blob: bf06b0522ff215bf0bc3c41ea366f4abec37d05c [file] [log] [blame]
Matt Walad8f4a7d2014-06-18 09:55:03 -07001; This test checks that undef values are represented as zero.
2
Jim Stichnoth729dbd02015-02-25 14:48:43 -08003; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
Jan Vounga2703ae2015-02-19 11:27:44 -08004; RUN: | FileCheck %s
Jim Stichnoth729dbd02015-02-25 14:48:43 -08005; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
Jan Vounga2703ae2015-02-19 11:27:44 -08006; RUN: | FileCheck %s
Jim Stichnoth729dbd02015-02-25 14:48:43 -08007; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 -mattr=sse4.1 \
8; RUN: | FileCheck %s
9; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 -mattr=sse4.1 \
10; RUN: | FileCheck %s
Matt Walad8f4a7d2014-06-18 09:55:03 -070011
Matt Wala928f1292014-07-07 16:50:46 -070012define i32 @undef_i32() {
Matt Walad8f4a7d2014-06-18 09:55:03 -070013entry:
Matt Walad8f4a7d2014-06-18 09:55:03 -070014 ret i32 undef
Jan Voungdddc3062014-08-29 12:59:02 -070015; CHECK-LABEL: undef_i32
Jan Vounga2703ae2015-02-19 11:27:44 -080016; CHECK: mov eax,0x0
Matt Walad8f4a7d2014-06-18 09:55:03 -070017}
18
Matt Wala928f1292014-07-07 16:50:46 -070019define i64 @undef_i64() {
Matt Walad8f4a7d2014-06-18 09:55:03 -070020entry:
Matt Walad8f4a7d2014-06-18 09:55:03 -070021 ret i64 undef
Jan Voungdddc3062014-08-29 12:59:02 -070022; CHECK-LABEL: undef_i64
Jan Vounga2703ae2015-02-19 11:27:44 -080023; CHECK-DAG: mov eax,0x0
24; CHECK-DAG: mov edx,0x0
Matt Walad8f4a7d2014-06-18 09:55:03 -070025; CHECK: ret
26}
27
Jan Voungfbdd2442015-07-15 12:36:20 -070028define i32 @trunc_undef_i64() {
29entry:
30 %ret = trunc i64 undef to i32
31 ret i32 %ret
32; CHECK-LABEL: trunc_undef_i64
33; CHECK: mov eax,0x0
34; CHECK: ret
35}
36
Matt Wala928f1292014-07-07 16:50:46 -070037define float @undef_float() {
Matt Walad8f4a7d2014-06-18 09:55:03 -070038entry:
Matt Walad8f4a7d2014-06-18 09:55:03 -070039 ret float undef
Jan Voungdddc3062014-08-29 12:59:02 -070040; CHECK-LABEL: undef_float
Jan Vounga2703ae2015-02-19 11:27:44 -080041; CHECK: fld DWORD PTR {{.*}} .L$float$0
Matt Walad8f4a7d2014-06-18 09:55:03 -070042}
43
Matt Wala928f1292014-07-07 16:50:46 -070044define <4 x i1> @undef_v4i1() {
45entry:
46 ret <4 x i1> undef
Jan Voungdddc3062014-08-29 12:59:02 -070047; CHECK-LABEL: undef_v4i1
Matt Wala928f1292014-07-07 16:50:46 -070048; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -070049}
50
51define <8 x i1> @undef_v8i1() {
52entry:
53 ret <8 x i1> undef
Jan Voungdddc3062014-08-29 12:59:02 -070054; CHECK-LABEL: undef_v8i1
Matt Wala928f1292014-07-07 16:50:46 -070055; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -070056}
57
58define <16 x i1> @undef_v16i1() {
59entry:
60 ret <16 x i1> undef
Jan Voungdddc3062014-08-29 12:59:02 -070061; CHECK-LABEL: undef_v16i1
Matt Wala928f1292014-07-07 16:50:46 -070062; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -070063}
64
65define <16 x i8> @undef_v16i8() {
66entry:
67 ret <16 x i8> undef
Jan Voungdddc3062014-08-29 12:59:02 -070068; CHECK-LABEL: undef_v16i8
Matt Wala928f1292014-07-07 16:50:46 -070069; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -070070}
71
72define <8 x i16> @undef_v8i16() {
73entry:
74 ret <8 x i16> undef
Jan Voungdddc3062014-08-29 12:59:02 -070075; CHECK-LABEL: undef_v8i16
Matt Wala928f1292014-07-07 16:50:46 -070076; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -070077}
78
79define <4 x i32> @undef_v4i32() {
80entry:
81 ret <4 x i32> undef
Jan Voungdddc3062014-08-29 12:59:02 -070082; CHECK-LABEL: undef_v4i32
Matt Wala928f1292014-07-07 16:50:46 -070083; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -070084}
85
86define <4 x float> @undef_v4f32() {
87entry:
88 ret <4 x float> undef
Jan Voungdddc3062014-08-29 12:59:02 -070089; CHECK-LABEL: undef_v4f32
Matt Wala928f1292014-07-07 16:50:46 -070090; CHECK: pxor
Matt Walae3777672014-07-31 09:06:17 -070091}
92
93define <4 x i32> @vector_arith(<4 x i32> %arg) {
94entry:
95 %val = add <4 x i32> undef, %arg
96 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -070097; CHECK-LABEL: vector_arith
Matt Walae3777672014-07-31 09:06:17 -070098; CHECK: pxor
99}
100
101define <4 x float> @vector_bitcast() {
102entry:
103 %val = bitcast <4 x i32> undef to <4 x float>
104 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700105; CHECK-LABEL: vector_bitcast
Matt Walae3777672014-07-31 09:06:17 -0700106; CHECK: pxor
107}
108
109define <4 x i32> @vector_sext() {
110entry:
111 %val = sext <4 x i1> undef to <4 x i32>
112 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700113; CHECK-LABEL: vector_sext
Matt Walae3777672014-07-31 09:06:17 -0700114; CHECK: pxor
115}
116
117define <4 x i32> @vector_zext() {
118entry:
119 %val = zext <4 x i1> undef to <4 x i32>
120 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700121; CHECK-LABEL: vector_zext
Matt Walae3777672014-07-31 09:06:17 -0700122; CHECK: pxor
123}
124
125define <4 x i1> @vector_trunc() {
126entry:
127 %val = trunc <4 x i32> undef to <4 x i1>
128 ret <4 x i1> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700129; CHECK-LABEL: vector_trunc
Matt Walae3777672014-07-31 09:06:17 -0700130; CHECK: pxor
131}
132
133define <4 x i1> @vector_icmp(<4 x i32> %arg) {
134entry:
135 %val = icmp eq <4 x i32> undef, %arg
136 ret <4 x i1> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700137; CHECK-LABEL: vector_icmp
Matt Walae3777672014-07-31 09:06:17 -0700138; CHECK: pxor
139}
140
141define <4 x i1> @vector_fcmp(<4 x float> %arg) {
142entry:
143 %val = fcmp ueq <4 x float> undef, %arg
144 ret <4 x i1> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700145; CHECK-LABEL: vector_fcmp
Matt Walae3777672014-07-31 09:06:17 -0700146; CHECK: pxor
147}
148
149define <4 x i32> @vector_fptosi() {
150entry:
151 %val = fptosi <4 x float> undef to <4 x i32>
152 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700153; CHECK-LABEL: vector_fptosi
Matt Walae3777672014-07-31 09:06:17 -0700154; CHECK: pxor
155}
156
157define <4 x i32> @vector_fptoui() {
158entry:
159 %val = fptoui <4 x float> undef to <4 x i32>
160 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700161; CHECK-LABEL: vector_fptoui
Matt Walae3777672014-07-31 09:06:17 -0700162; CHECK: pxor
163}
164
165define <4 x float> @vector_sitofp() {
166entry:
167 %val = sitofp <4 x i32> undef to <4 x float>
168 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700169; CHECK-LABEL: vector_sitofp
Matt Walae3777672014-07-31 09:06:17 -0700170; CHECK: pxor
171}
172
173define <4 x float> @vector_uitofp() {
174entry:
175 %val = uitofp <4 x i32> undef to <4 x float>
176 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700177; CHECK-LABEL: vector_uitofp
Matt Walae3777672014-07-31 09:06:17 -0700178; CHECK: pxor
179}
180
181define <4 x float> @vector_insertelement_arg1() {
182entry:
183 %val = insertelement <4 x float> undef, float 1.0, i32 0
184 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700185; CHECK-LABEL: vector_insertelement_arg1
Matt Walae3777672014-07-31 09:06:17 -0700186; CHECK: pxor
187}
188
189define <4 x float> @vector_insertelement_arg2(<4 x float> %arg) {
190entry:
191 %val = insertelement <4 x float> %arg, float undef, i32 0
192 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700193; CHECK-LABEL: vector_insertelement_arg2
Jim Stichnoth03ffa582015-06-04 09:25:07 -0700194; CHECK: {{movss|insertps}} {{.*}},DWORD PTR {{.*}} .L$float$0
Matt Walae3777672014-07-31 09:06:17 -0700195}
196
197define float @vector_extractelement_v4f32_index_0() {
198entry:
199 %val = extractelement <4 x float> undef, i32 0
200 ret float %val
Jan Voungdddc3062014-08-29 12:59:02 -0700201; CHECK-LABEL: vector_extractelement_v4f32_index_0
Matt Walae3777672014-07-31 09:06:17 -0700202; CHECK: pxor
203}
204
205define float @vector_extractelement_v4f32_index_1() {
206entry:
207 %val = extractelement <4 x float> undef, i32 1
208 ret float %val
Jan Voungdddc3062014-08-29 12:59:02 -0700209; CHECK-LABEL: vector_extractelement_v4f32_index_1
Matt Walae3777672014-07-31 09:06:17 -0700210; CHECK: pxor
211}
212
213define i32 @vector_extractelement_v16i1_index_7() {
214entry:
215 %val.trunc = extractelement <16 x i1> undef, i32 7
216 %val = sext i1 %val.trunc to i32
217 ret i32 %val
Jan Voungdddc3062014-08-29 12:59:02 -0700218; CHECK-LABEL: vector_extractelement_v16i1_index_7
Matt Walae3777672014-07-31 09:06:17 -0700219; CHECK: pxor
220}
221
222define <4 x i32> @vector_select_v4i32_cond(<4 x i32> %a, <4 x i32> %b) {
223entry:
224 %val = select <4 x i1> undef, <4 x i32> %a, <4 x i32> %b
225 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700226; CHECK-LABEL: vector_select_v4i32_cond
Matt Walae3777672014-07-31 09:06:17 -0700227; CHECK: pxor
228}
229
230define <4 x i32> @vector_select_v4i32_arg1(<4 x i1> %cond, <4 x i32> %b) {
231entry:
232 %val = select <4 x i1> %cond, <4 x i32> undef, <4 x i32> %b
233 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700234; CHECK-LABEL: vector_select_v4i32_arg1
Matt Walae3777672014-07-31 09:06:17 -0700235; CHECK: pxor
236}
237
238define <4 x i32> @vector_select_v4i32_arg2(<4 x i1> %cond, <4 x i32> %a) {
239entry:
240 %val = select <4 x i1> %cond, <4 x i32> %a, <4 x i32> undef
241 ret <4 x i32> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700242; CHECK-LABEL: vector_select_v4i32_arg2
Matt Walae3777672014-07-31 09:06:17 -0700243; CHECK: pxor
244}
245
246define <4 x i1> @vector_select_v4i1_cond(<4 x i1> %a, <4 x i1> %b) {
247entry:
248 %val = select <4 x i1> undef, <4 x i1> %a, <4 x i1> %b
249 ret <4 x i1> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700250; CHECK-LABEL: vector_select_v4i1_cond
Matt Walae3777672014-07-31 09:06:17 -0700251; CHECK: pxor
252}
253
254define <4 x i1> @vector_select_v4i1_arg1(<4 x i1> %cond, <4 x i1> %b) {
255entry:
256 %val = select <4 x i1> %cond, <4 x i1> undef, <4 x i1> %b
257 ret <4 x i1> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700258; CHECK-LABEL: vector_select_v4i1_arg1
Matt Walae3777672014-07-31 09:06:17 -0700259; CHECK: pxor
260}
261
262define <4 x i1> @vector_select_v4i1_arg2(<4 x i1> %cond, <4 x i1> %a) {
263entry:
264 %val = select <4 x i1> %cond, <4 x i1> %a, <4 x i1> undef
265 ret <4 x i1> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700266; CHECK-LABEL: vector_select_v4i1_arg2
Matt Walae3777672014-07-31 09:06:17 -0700267; CHECK: pxor
268}
269
270define <4 x float> @vector_select_v4f32_cond(<4 x float> %a, <4 x float> %b) {
271entry:
272 %val = select <4 x i1> undef, <4 x float> %a, <4 x float> %b
273 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700274; CHECK-LABEL: vector_select_v4f32_cond
Matt Walae3777672014-07-31 09:06:17 -0700275; CHECK: pxor
276}
277
278define <4 x float> @vector_select_v4f32_arg1(<4 x i1> %cond, <4 x float> %b) {
279entry:
280 %val = select <4 x i1> %cond, <4 x float> undef, <4 x float> %b
281 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700282; CHECK-LABEL: vector_select_v4f32_arg1
Matt Walae3777672014-07-31 09:06:17 -0700283; CHECK: pxor
284}
285
286define <4 x float> @vector_select_v4f32_arg2(<4 x i1> %cond, <4 x float> %a) {
287entry:
288 %val = select <4 x i1> %cond, <4 x float> %a, <4 x float> undef
289 ret <4 x float> %val
Jan Voungdddc3062014-08-29 12:59:02 -0700290; CHECK-LABEL: vector_select_v4f32_arg2
Matt Walae3777672014-07-31 09:06:17 -0700291; CHECK: pxor
Matt Wala928f1292014-07-07 16:50:46 -0700292}