blob: c8c390ea6be47c7e4982f392a731a9194a1fe137 [file] [log] [blame]
Andrea Di Biagiobdd576d2016-09-07 14:50:07 +00001; 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}
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000126
127define <4 x i32> @bitcast_constexpr_4i32_2i64_u2() {
128; CHECK-LABEL: @bitcast_constexpr_4i32_2i64_u2(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000129; CHECK-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000130;
131 %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32>
132 ret <4 x i32> %cast
133}
134
135define <4 x i32> @bitcast_constexpr_4i32_2i64_1u() {
136; CHECK-LABEL: @bitcast_constexpr_4i32_2i64_1u(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000137; CHECK-NEXT: ret <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000138;
139 %cast = bitcast <2 x i64><i64 1, i64 undef> to <4 x i32>
140 ret <4 x i32> %cast
141}
142
143define <4 x i32> @bitcast_constexpr_4i32_2i64() {
144; CHECK-LABEL: @bitcast_constexpr_4i32_2i64(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000145; CHECK-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000146;
147 %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32>
148 ret <4 x i32> %cast
149}
150
151define <8 x i16> @bitcast_constexpr_8i16_2i64_u2() {
152; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_u2(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000153; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 0, i16 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000154;
155 %cast = bitcast <2 x i64><i64 undef, i64 2> to <8 x i16>
156 ret <8 x i16> %cast
157}
158
159define <8 x i16> @bitcast_constexpr_8i16_2i64_1u() {
160; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_1u(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000161; CHECK-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000162;
163 %cast = bitcast <2 x i64><i64 1, i64 undef> to <8 x i16>
164 ret <8 x i16> %cast
165}
166
167define <8 x i16> @bitcast_constexpr_8i16_2i64_u65536() {
168; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_u65536(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000169; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 1, i16 0, i16 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000170;
171 %cast = bitcast <2 x i64><i64 undef, i64 65536> to <8 x i16>
172 ret <8 x i16> %cast
173}
174
175define <16 x i8> @bitcast_constexpr_16i8_2i64_u2() {
176; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_u2(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000177; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 2, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000178;
179 %cast = bitcast <2 x i64><i64 undef, i64 2> to <16 x i8>
180 ret <16 x i8> %cast
181}
182
183define <16 x i8> @bitcast_constexpr_16i8_2i64_256u() {
184; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_256u(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000185; CHECK-NEXT: ret <16 x i8> <i8 0, i8 1, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000186;
187 %cast = bitcast <2 x i64><i64 256, i64 undef> to <16 x i8>
188 ret <16 x i8> %cast
189}
190
191define <16 x i8> @bitcast_constexpr_16i8_2i64_u256() {
192; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_u256(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000193; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 1, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000194;
195 %cast = bitcast <2 x i64><i64 undef, i64 256> to <16 x i8>
196 ret <16 x i8> %cast
197}
198
199define <8 x i16> @bitcast_constexpr_8i16_4i32_uu22() {
200; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_uu22(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000201; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 2, i16 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000202;
203 %cast = bitcast <4 x i32><i32 undef, i32 undef, i32 2, i32 2> to <8 x i16>
204 ret <8 x i16> %cast
205}
206
207define <8 x i16> @bitcast_constexpr_8i16_4i32_10uu() {
208; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_10uu(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000209; CHECK-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000210;
211 %cast = bitcast <4 x i32><i32 1, i32 0, i32 undef, i32 undef> to <8 x i16>
212 ret <8 x i16> %cast
213}
214
215define <8 x i16> @bitcast_constexpr_8i16_4i32_u257u256() {
216; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_u257u256(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000217; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 0, i16 1, i16 undef, i16 undef, i16 0, i16 1>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000218;
219 %cast = bitcast <4 x i32><i32 undef, i32 65536, i32 undef, i32 65536> to <8 x i16>
220 ret <8 x i16> %cast
221}
222
223define <16 x i8> @bitcast_constexpr_16i8_4i32_u2u2() {
224; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_u2u2(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000225; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 2, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 2, i8 0, i8 0, i8 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000226;
227 %cast = bitcast <4 x i32><i32 undef, i32 2, i32 undef, i32 2> to <16 x i8>
228 ret <16 x i8> %cast
229}
230
231define <16 x i8> @bitcast_constexpr_16i8_4i32_1u1u() {
232; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_1u1u(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000233; CHECK-NEXT: ret <16 x i8> <i8 1, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 1, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000234;
235 %cast = bitcast <4 x i32><i32 1, i32 undef, i32 1, i32 undef> to <16 x i8>
236 ret <16 x i8> %cast
237}
238
239define <16 x i8> @bitcast_constexpr_16i8_4i32_u256uu() {
240; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_u256uu(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000241; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 1, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000242;
243 %cast = bitcast <4 x i32><i32 undef, i32 256, i32 undef, i32 undef> to <16 x i8>
244 ret <16 x i8> %cast
245}
246
247define <16 x i8> @bitcast_constexpr_16i8_8i16_u2u2u2u2() {
248; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_u2u2u2u2(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000249; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 2, i8 0, i8 undef, i8 undef, i8 2, i8 0, i8 undef, i8 undef, i8 2, i8 0, i8 undef, i8 undef, i8 2, i8 0>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000250;
251 %cast = bitcast <8 x i16><i16 undef, i16 2, i16 undef, i16 2, i16 undef, i16 2, i16 undef, i16 2> to <16 x i8>
252 ret <16 x i8> %cast
253}
254
255define <16 x i8> @bitcast_constexpr_16i8_8i16_1u1u1u1u() {
256; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_1u1u1u1u(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000257; CHECK-NEXT: ret <16 x i8> <i8 1, i8 0, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000258;
259 %cast = bitcast <8 x i16><i16 1, i16 undef, i16 1, i16 undef, i16 1, i16 undef, i16 1, i16 undef> to <16 x i8>
260 ret <16 x i8> %cast
261}
262
263define <16 x i8> @bitcast_constexpr_16i8_8i16_u256uuu256uu() {
264; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_u256uuu256uu(
Andrea Di Biagio7277afe2016-09-13 14:50:47 +0000265; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 undef, i8 undef>
Andrea Di Biagio3647a962016-09-13 13:17:42 +0000266;
267 %cast = bitcast <8 x i16><i16 undef, i16 256, i16 undef, i16 undef, i16 undef, i16 256, i16 undef, i16 undef> to <16 x i8>
268 ret <16 x i8> %cast
269}