1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128"
4
5define <2 x i64> @test1() {
6; CHECK-LABEL: @test1(
7; CHECK-NEXT:    ret <2 x i64> <i64 4294967296, i64 12884901890>
8;
9  %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x i64>
10  ret <2 x i64> %tmp3
11}
12
13define <4 x i32> @test2() {
14; CHECK-LABEL: @test2(
15; CHECK-NEXT:    ret <4 x i32> <i32 0, i32 0, i32 1, i32 0>
16;
17  %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x i32>
18  ret <4 x i32> %tmp3
19}
20
21define <2 x double> @test3() {
22; CHECK-LABEL: @test3(
23; CHECK-NEXT:    ret <2 x double> <double 0x100000000, double 0x300000002>
24;
25  %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x double>
26  ret <2 x double> %tmp3
27}
28
29define <4 x float> @test4() {
30; CHECK-LABEL: @test4(
31; CHECK-NEXT:    ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000, float 0.000000e+00>
32;
33  %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x float>
34  ret <4 x float> %tmp3
35}
36
37define <2 x i64> @test5() {
38; CHECK-LABEL: @test5(
39; CHECK-NEXT:    ret <2 x i64> <i64 4575657221408423936, i64 4629700418010611712>
40;
41  %tmp3 = bitcast <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0> to <2 x i64>
42  ret <2 x i64> %tmp3
43}
44
45define <4 x i32> @test6() {
46; CHECK-LABEL: @test6(
47; CHECK-NEXT:    ret <4 x i32> <i32 0, i32 1071644672, i32 0, i32 1072693248>
48;
49  %tmp3 = bitcast <2 x double> <double 0.5, double 1.0> to <4 x i32>
50  ret <4 x i32> %tmp3
51}
52
53define i32 @test7() {
54; CHECK-LABEL: @test7(
55; CHECK-NEXT:    ret i32 1118464
56;
57  %tmp3 = bitcast <2 x half> <half 0xH1100, half 0xH0011> to i32
58  ret i32 %tmp3
59}
60
61define <4 x i32> @test8(<1 x i64> %y) {
62; CHECK-LABEL: @test8(
63; CHECK-NEXT:    ret <4 x i32> zeroinitializer
64;
65  %c = bitcast <2 x i64> <i64 0, i64 0> to <4 x i32>
66  ret <4 x i32> %c
67}
68
69define <4 x i32> @test9(<1 x i64> %y) {
70; CHECK-LABEL: @test9(
71; CHECK-NEXT:    ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
72;
73  %c = bitcast <2 x i64> <i64 -1, i64 -1> to <4 x i32>
74  ret <4 x i32> %c
75}
76
77; from MultiSource/Benchmarks/Bullet
78define <2 x float> @foo() {
79; CHECK-LABEL: @foo(
80; CHECK-NEXT:    ret <2 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>
81;
82  %cast = bitcast i64 -1 to <2 x float>
83  ret <2 x float> %cast
84}
85
86
87define <2 x double> @foo2() {
88; CHECK-LABEL: @foo2(
89; CHECK-NEXT:    ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
90;
91  %cast = bitcast i128 -1 to <2 x double>
92  ret <2 x double> %cast
93}
94
95define <1 x float> @foo3() {
96; CHECK-LABEL: @foo3(
97; CHECK-NEXT:    ret <1 x float> <float 0xFFFFFFFFE0000000>
98;
99  %cast = bitcast i32 -1 to <1 x float>
100  ret <1 x float> %cast
101}
102
103define float @foo4() {
104; CHECK-LABEL: @foo4(
105; CHECK-NEXT:    ret float 0xFFFFFFFFE0000000
106;
107  %cast = bitcast <1 x i32 ><i32 -1> to float
108  ret float %cast
109}
110
111define double @foo5() {
112; CHECK-LABEL: @foo5(
113; CHECK-NEXT:    ret double 0xFFFFFFFFFFFFFFFF
114;
115  %cast = bitcast <2 x i32 ><i32 -1, i32 -1> to double
116  ret double %cast
117}
118
119define <2 x double> @foo6() {
120; CHECK-LABEL: @foo6(
121; CHECK-NEXT:    ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
122;
123  %cast = bitcast <4 x i32><i32 -1, i32 -1, i32 -1, i32 -1> to <2 x double>
124  ret <2 x double> %cast
125}
126