bitcast-vector-fold.ll
9.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128"
define <2 x i64> @test1() {
; CHECK-LABEL: @test1(
; CHECK-NEXT: ret <2 x i64> <i64 4294967296, i64 12884901890>
;
%tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x i64>
ret <2 x i64> %tmp3
}
define <4 x i32> @test2() {
; CHECK-LABEL: @test2(
; CHECK-NEXT: ret <4 x i32> <i32 0, i32 0, i32 1, i32 0>
;
%tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x i32>
ret <4 x i32> %tmp3
}
define <2 x double> @test3() {
; CHECK-LABEL: @test3(
; CHECK-NEXT: ret <2 x double> <double 0x100000000, double 0x300000002>
;
%tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x double>
ret <2 x double> %tmp3
}
define <4 x float> @test4() {
; CHECK-LABEL: @test4(
; CHECK-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000, float 0.000000e+00>
;
%tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x float>
ret <4 x float> %tmp3
}
define <2 x i64> @test5() {
; CHECK-LABEL: @test5(
; CHECK-NEXT: ret <2 x i64> <i64 4575657221408423936, i64 4629700418010611712>
;
%tmp3 = bitcast <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0> to <2 x i64>
ret <2 x i64> %tmp3
}
define <4 x i32> @test6() {
; CHECK-LABEL: @test6(
; CHECK-NEXT: ret <4 x i32> <i32 0, i32 1071644672, i32 0, i32 1072693248>
;
%tmp3 = bitcast <2 x double> <double 0.5, double 1.0> to <4 x i32>
ret <4 x i32> %tmp3
}
define i32 @test7() {
; CHECK-LABEL: @test7(
; CHECK-NEXT: ret i32 1118464
;
%tmp3 = bitcast <2 x half> <half 0xH1100, half 0xH0011> to i32
ret i32 %tmp3
}
define <4 x i32> @test8(<1 x i64> %y) {
; CHECK-LABEL: @test8(
; CHECK-NEXT: ret <4 x i32> zeroinitializer
;
%c = bitcast <2 x i64> <i64 0, i64 0> to <4 x i32>
ret <4 x i32> %c
}
define <4 x i32> @test9(<1 x i64> %y) {
; CHECK-LABEL: @test9(
; CHECK-NEXT: ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
;
%c = bitcast <2 x i64> <i64 -1, i64 -1> to <4 x i32>
ret <4 x i32> %c
}
define <1 x i1> @test10() {
; CHECK-LABEL: @test10(
; CHECK-NEXT: ret <1 x i1> <i1 icmp eq (i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64), i64 0)>
;
%ret = icmp eq <1 x i64> <i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64)>, zeroinitializer
ret <1 x i1> %ret
}
; from MultiSource/Benchmarks/Bullet
define <2 x float> @foo() {
; CHECK-LABEL: @foo(
; CHECK-NEXT: ret <2 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>
;
%cast = bitcast i64 -1 to <2 x float>
ret <2 x float> %cast
}
define <2 x double> @foo2() {
; CHECK-LABEL: @foo2(
; CHECK-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
;
%cast = bitcast i128 -1 to <2 x double>
ret <2 x double> %cast
}
define <1 x float> @foo3() {
; CHECK-LABEL: @foo3(
; CHECK-NEXT: ret <1 x float> <float 0xFFFFFFFFE0000000>
;
%cast = bitcast i32 -1 to <1 x float>
ret <1 x float> %cast
}
define float @foo4() {
; CHECK-LABEL: @foo4(
; CHECK-NEXT: ret float 0xFFFFFFFFE0000000
;
%cast = bitcast <1 x i32 ><i32 -1> to float
ret float %cast
}
define double @foo5() {
; CHECK-LABEL: @foo5(
; CHECK-NEXT: ret double 0xFFFFFFFFFFFFFFFF
;
%cast = bitcast <2 x i32 ><i32 -1, i32 -1> to double
ret double %cast
}
define <2 x double> @foo6() {
; CHECK-LABEL: @foo6(
; CHECK-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>
;
%cast = bitcast <4 x i32><i32 -1, i32 -1, i32 -1, i32 -1> to <2 x double>
ret <2 x double> %cast
}
define <4 x i32> @bitcast_constexpr_4i32_2i64_u2() {
; CHECK-LABEL: @bitcast_constexpr_4i32_2i64_u2(
; CHECK-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0>
;
%cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32>
ret <4 x i32> %cast
}
define <4 x i32> @bitcast_constexpr_4i32_2i64_1u() {
; CHECK-LABEL: @bitcast_constexpr_4i32_2i64_1u(
; CHECK-NEXT: ret <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
;
%cast = bitcast <2 x i64><i64 1, i64 undef> to <4 x i32>
ret <4 x i32> %cast
}
define <4 x i32> @bitcast_constexpr_4i32_2i64() {
; CHECK-LABEL: @bitcast_constexpr_4i32_2i64(
; CHECK-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0>
;
%cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32>
ret <4 x i32> %cast
}
define <8 x i16> @bitcast_constexpr_8i16_2i64_u2() {
; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_u2(
; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 0, i16 0>
;
%cast = bitcast <2 x i64><i64 undef, i64 2> to <8 x i16>
ret <8 x i16> %cast
}
define <8 x i16> @bitcast_constexpr_8i16_2i64_1u() {
; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_1u(
; CHECK-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef>
;
%cast = bitcast <2 x i64><i64 1, i64 undef> to <8 x i16>
ret <8 x i16> %cast
}
define <8 x i16> @bitcast_constexpr_8i16_2i64_u65536() {
; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_u65536(
; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 1, i16 0, i16 0>
;
%cast = bitcast <2 x i64><i64 undef, i64 65536> to <8 x i16>
ret <8 x i16> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_2i64_u2() {
; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_u2(
; 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>
;
%cast = bitcast <2 x i64><i64 undef, i64 2> to <16 x i8>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_2i64_256u() {
; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_256u(
; 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>
;
%cast = bitcast <2 x i64><i64 256, i64 undef> to <16 x i8>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_2i64_u256() {
; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_u256(
; 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>
;
%cast = bitcast <2 x i64><i64 undef, i64 256> to <16 x i8>
ret <16 x i8> %cast
}
define <8 x i16> @bitcast_constexpr_8i16_4i32_uu22() {
; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_uu22(
; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 2, i16 0>
;
%cast = bitcast <4 x i32><i32 undef, i32 undef, i32 2, i32 2> to <8 x i16>
ret <8 x i16> %cast
}
define <8 x i16> @bitcast_constexpr_8i16_4i32_10uu() {
; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_10uu(
; CHECK-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef>
;
%cast = bitcast <4 x i32><i32 1, i32 0, i32 undef, i32 undef> to <8 x i16>
ret <8 x i16> %cast
}
define <8 x i16> @bitcast_constexpr_8i16_4i32_u257u256() {
; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_u257u256(
; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 0, i16 1, i16 undef, i16 undef, i16 0, i16 1>
;
%cast = bitcast <4 x i32><i32 undef, i32 65536, i32 undef, i32 65536> to <8 x i16>
ret <8 x i16> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_4i32_u2u2() {
; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_u2u2(
; 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>
;
%cast = bitcast <4 x i32><i32 undef, i32 2, i32 undef, i32 2> to <16 x i8>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_4i32_1u1u() {
; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_1u1u(
; 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>
;
%cast = bitcast <4 x i32><i32 1, i32 undef, i32 1, i32 undef> to <16 x i8>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_4i32_u256uu() {
; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_u256uu(
; 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>
;
%cast = bitcast <4 x i32><i32 undef, i32 256, i32 undef, i32 undef> to <16 x i8>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_8i16_u2u2u2u2() {
; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_u2u2u2u2(
; 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>
;
%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>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_8i16_1u1u1u1u() {
; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_1u1u1u1u(
; 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>
;
%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>
ret <16 x i8> %cast
}
define <16 x i8> @bitcast_constexpr_16i8_8i16_u256uuu256uu() {
; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_u256uuu256uu(
; 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>
;
%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>
ret <16 x i8> %cast
}