vec-strict-cmp-sub128.ll
12 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 -O3 | FileCheck %s --check-prefixes=CHECK,SSE,SSE-32
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 -O3 | FileCheck %s --check-prefixes=CHECK,SSE,SSE-64
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx -O3 | FileCheck %s --check-prefixes=CHECK,AVX,AVX-32
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx -O3 | FileCheck %s --check-prefixes=CHECK,AVX,AVX-64
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512f -mattr=+avx512vl -O3 | FileCheck %s --check-prefixes=CHECK,AVX512-32
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f -mattr=+avx512vl -O3 | FileCheck %s --check-prefixes=CHECK,AVX512-64
define <2 x i32> @test_v2f32_ogt_s(<2 x i32> %a, <2 x i32> %b, <2 x float> %f1, <2 x float> %f2) #0 {
; SSE-32-LABEL: test_v2f32_ogt_s:
; SSE-32: # %bb.0:
; SSE-32-NEXT: pushl %ebp
; SSE-32-NEXT: movl %esp, %ebp
; SSE-32-NEXT: andl $-16, %esp
; SSE-32-NEXT: subl $16, %esp
; SSE-32-NEXT: movaps 8(%ebp), %xmm3
; SSE-32-NEXT: xorl %eax, %eax
; SSE-32-NEXT: comiss %xmm3, %xmm2
; SSE-32-NEXT: movl $-1, %ecx
; SSE-32-NEXT: movl $0, %edx
; SSE-32-NEXT: cmoval %ecx, %edx
; SSE-32-NEXT: movd %edx, %xmm4
; SSE-32-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1,2,3]
; SSE-32-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,1,2,3]
; SSE-32-NEXT: comiss %xmm3, %xmm2
; SSE-32-NEXT: cmoval %ecx, %eax
; SSE-32-NEXT: movd %eax, %xmm2
; SSE-32-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
; SSE-32-NEXT: pand %xmm4, %xmm0
; SSE-32-NEXT: pandn %xmm1, %xmm4
; SSE-32-NEXT: por %xmm4, %xmm0
; SSE-32-NEXT: movl %ebp, %esp
; SSE-32-NEXT: popl %ebp
; SSE-32-NEXT: retl
;
; SSE-64-LABEL: test_v2f32_ogt_s:
; SSE-64: # %bb.0:
; SSE-64-NEXT: xorl %eax, %eax
; SSE-64-NEXT: comiss %xmm3, %xmm2
; SSE-64-NEXT: movl $-1, %ecx
; SSE-64-NEXT: movl $0, %edx
; SSE-64-NEXT: cmoval %ecx, %edx
; SSE-64-NEXT: movd %edx, %xmm4
; SSE-64-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1,2,3]
; SSE-64-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,1,2,3]
; SSE-64-NEXT: comiss %xmm3, %xmm2
; SSE-64-NEXT: cmoval %ecx, %eax
; SSE-64-NEXT: movd %eax, %xmm2
; SSE-64-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
; SSE-64-NEXT: pand %xmm4, %xmm0
; SSE-64-NEXT: pandn %xmm1, %xmm4
; SSE-64-NEXT: por %xmm4, %xmm0
; SSE-64-NEXT: retq
;
; AVX-32-LABEL: test_v2f32_ogt_s:
; AVX-32: # %bb.0:
; AVX-32-NEXT: pushl %ebp
; AVX-32-NEXT: movl %esp, %ebp
; AVX-32-NEXT: andl $-16, %esp
; AVX-32-NEXT: subl $16, %esp
; AVX-32-NEXT: vmovaps 8(%ebp), %xmm3
; AVX-32-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX-32-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX-32-NEXT: xorl %eax, %eax
; AVX-32-NEXT: vcomiss %xmm4, %xmm5
; AVX-32-NEXT: movl $-1, %ecx
; AVX-32-NEXT: movl $0, %edx
; AVX-32-NEXT: cmoval %ecx, %edx
; AVX-32-NEXT: vcomiss %xmm3, %xmm2
; AVX-32-NEXT: cmoval %ecx, %eax
; AVX-32-NEXT: vmovd %eax, %xmm2
; AVX-32-NEXT: vpinsrd $1, %edx, %xmm2, %xmm2
; AVX-32-NEXT: vblendvps %xmm2, %xmm0, %xmm1, %xmm0
; AVX-32-NEXT: movl %ebp, %esp
; AVX-32-NEXT: popl %ebp
; AVX-32-NEXT: retl
;
; AVX-64-LABEL: test_v2f32_ogt_s:
; AVX-64: # %bb.0:
; AVX-64-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX-64-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX-64-NEXT: xorl %eax, %eax
; AVX-64-NEXT: vcomiss %xmm4, %xmm5
; AVX-64-NEXT: movl $-1, %ecx
; AVX-64-NEXT: movl $0, %edx
; AVX-64-NEXT: cmoval %ecx, %edx
; AVX-64-NEXT: vcomiss %xmm3, %xmm2
; AVX-64-NEXT: cmoval %ecx, %eax
; AVX-64-NEXT: vmovd %eax, %xmm2
; AVX-64-NEXT: vpinsrd $1, %edx, %xmm2, %xmm2
; AVX-64-NEXT: vblendvps %xmm2, %xmm0, %xmm1, %xmm0
; AVX-64-NEXT: retq
;
; AVX512-32-LABEL: test_v2f32_ogt_s:
; AVX512-32: # %bb.0:
; AVX512-32-NEXT: pushl %ebp
; AVX512-32-NEXT: movl %esp, %ebp
; AVX512-32-NEXT: andl $-16, %esp
; AVX512-32-NEXT: subl $16, %esp
; AVX512-32-NEXT: vmovaps 8(%ebp), %xmm3
; AVX512-32-NEXT: movw $-3, %ax
; AVX512-32-NEXT: kmovw %eax, %k0
; AVX512-32-NEXT: vcomiss %xmm3, %xmm2
; AVX512-32-NEXT: seta %al
; AVX512-32-NEXT: andl $1, %eax
; AVX512-32-NEXT: kmovw %eax, %k1
; AVX512-32-NEXT: kandw %k0, %k1, %k0
; AVX512-32-NEXT: vmovshdup {{.*#+}} xmm3 = xmm3[1,1,3,3]
; AVX512-32-NEXT: vmovshdup {{.*#+}} xmm2 = xmm2[1,1,3,3]
; AVX512-32-NEXT: vcomiss %xmm3, %xmm2
; AVX512-32-NEXT: seta %al
; AVX512-32-NEXT: kmovw %eax, %k1
; AVX512-32-NEXT: kshiftlw $15, %k1, %k1
; AVX512-32-NEXT: kshiftrw $14, %k1, %k1
; AVX512-32-NEXT: korw %k1, %k0, %k1
; AVX512-32-NEXT: vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
; AVX512-32-NEXT: movl %ebp, %esp
; AVX512-32-NEXT: popl %ebp
; AVX512-32-NEXT: retl
;
; AVX512-64-LABEL: test_v2f32_ogt_s:
; AVX512-64: # %bb.0:
; AVX512-64-NEXT: movw $-3, %ax
; AVX512-64-NEXT: kmovw %eax, %k0
; AVX512-64-NEXT: vcomiss %xmm3, %xmm2
; AVX512-64-NEXT: seta %al
; AVX512-64-NEXT: andl $1, %eax
; AVX512-64-NEXT: kmovw %eax, %k1
; AVX512-64-NEXT: kandw %k0, %k1, %k0
; AVX512-64-NEXT: vmovshdup {{.*#+}} xmm3 = xmm3[1,1,3,3]
; AVX512-64-NEXT: vmovshdup {{.*#+}} xmm2 = xmm2[1,1,3,3]
; AVX512-64-NEXT: vcomiss %xmm3, %xmm2
; AVX512-64-NEXT: seta %al
; AVX512-64-NEXT: kmovw %eax, %k1
; AVX512-64-NEXT: kshiftlw $15, %k1, %k1
; AVX512-64-NEXT: kshiftrw $14, %k1, %k1
; AVX512-64-NEXT: korw %k1, %k0, %k1
; AVX512-64-NEXT: vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
; AVX512-64-NEXT: retq
%cond = call <2 x i1> @llvm.experimental.constrained.fcmps.v2f32(
<2 x float> %f1, <2 x float> %f2, metadata !"ogt",
metadata !"fpexcept.strict") #0
%res = select <2 x i1> %cond, <2 x i32> %a, <2 x i32> %b
ret <2 x i32> %res
}
define <2 x i32> @test_v2f32_oeq_q(<2 x i32> %a, <2 x i32> %b, <2 x float> %f1, <2 x float> %f2) #0 {
; SSE-32-LABEL: test_v2f32_oeq_q:
; SSE-32: # %bb.0:
; SSE-32-NEXT: pushl %ebp
; SSE-32-NEXT: movl %esp, %ebp
; SSE-32-NEXT: andl $-16, %esp
; SSE-32-NEXT: subl $16, %esp
; SSE-32-NEXT: movaps 8(%ebp), %xmm3
; SSE-32-NEXT: xorl %eax, %eax
; SSE-32-NEXT: ucomiss %xmm3, %xmm2
; SSE-32-NEXT: movl $-1, %ecx
; SSE-32-NEXT: movl $-1, %edx
; SSE-32-NEXT: cmovnel %eax, %edx
; SSE-32-NEXT: cmovpl %eax, %edx
; SSE-32-NEXT: movd %edx, %xmm4
; SSE-32-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1,2,3]
; SSE-32-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,1,2,3]
; SSE-32-NEXT: ucomiss %xmm3, %xmm2
; SSE-32-NEXT: cmovnel %eax, %ecx
; SSE-32-NEXT: cmovpl %eax, %ecx
; SSE-32-NEXT: movd %ecx, %xmm2
; SSE-32-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
; SSE-32-NEXT: pand %xmm4, %xmm0
; SSE-32-NEXT: pandn %xmm1, %xmm4
; SSE-32-NEXT: por %xmm4, %xmm0
; SSE-32-NEXT: movl %ebp, %esp
; SSE-32-NEXT: popl %ebp
; SSE-32-NEXT: retl
;
; SSE-64-LABEL: test_v2f32_oeq_q:
; SSE-64: # %bb.0:
; SSE-64-NEXT: xorl %eax, %eax
; SSE-64-NEXT: ucomiss %xmm3, %xmm2
; SSE-64-NEXT: movl $-1, %ecx
; SSE-64-NEXT: movl $-1, %edx
; SSE-64-NEXT: cmovnel %eax, %edx
; SSE-64-NEXT: cmovpl %eax, %edx
; SSE-64-NEXT: movd %edx, %xmm4
; SSE-64-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1,2,3]
; SSE-64-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,1,2,3]
; SSE-64-NEXT: ucomiss %xmm3, %xmm2
; SSE-64-NEXT: cmovnel %eax, %ecx
; SSE-64-NEXT: cmovpl %eax, %ecx
; SSE-64-NEXT: movd %ecx, %xmm2
; SSE-64-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
; SSE-64-NEXT: pand %xmm4, %xmm0
; SSE-64-NEXT: pandn %xmm1, %xmm4
; SSE-64-NEXT: por %xmm4, %xmm0
; SSE-64-NEXT: retq
;
; AVX-32-LABEL: test_v2f32_oeq_q:
; AVX-32: # %bb.0:
; AVX-32-NEXT: pushl %ebp
; AVX-32-NEXT: movl %esp, %ebp
; AVX-32-NEXT: andl $-16, %esp
; AVX-32-NEXT: subl $16, %esp
; AVX-32-NEXT: vmovaps 8(%ebp), %xmm3
; AVX-32-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX-32-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX-32-NEXT: xorl %eax, %eax
; AVX-32-NEXT: vucomiss %xmm4, %xmm5
; AVX-32-NEXT: movl $-1, %ecx
; AVX-32-NEXT: movl $-1, %edx
; AVX-32-NEXT: cmovnel %eax, %edx
; AVX-32-NEXT: cmovpl %eax, %edx
; AVX-32-NEXT: vucomiss %xmm3, %xmm2
; AVX-32-NEXT: cmovnel %eax, %ecx
; AVX-32-NEXT: cmovpl %eax, %ecx
; AVX-32-NEXT: vmovd %ecx, %xmm2
; AVX-32-NEXT: vpinsrd $1, %edx, %xmm2, %xmm2
; AVX-32-NEXT: vblendvps %xmm2, %xmm0, %xmm1, %xmm0
; AVX-32-NEXT: movl %ebp, %esp
; AVX-32-NEXT: popl %ebp
; AVX-32-NEXT: retl
;
; AVX-64-LABEL: test_v2f32_oeq_q:
; AVX-64: # %bb.0:
; AVX-64-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX-64-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX-64-NEXT: xorl %eax, %eax
; AVX-64-NEXT: vucomiss %xmm4, %xmm5
; AVX-64-NEXT: movl $-1, %ecx
; AVX-64-NEXT: movl $-1, %edx
; AVX-64-NEXT: cmovnel %eax, %edx
; AVX-64-NEXT: cmovpl %eax, %edx
; AVX-64-NEXT: vucomiss %xmm3, %xmm2
; AVX-64-NEXT: cmovnel %eax, %ecx
; AVX-64-NEXT: cmovpl %eax, %ecx
; AVX-64-NEXT: vmovd %ecx, %xmm2
; AVX-64-NEXT: vpinsrd $1, %edx, %xmm2, %xmm2
; AVX-64-NEXT: vblendvps %xmm2, %xmm0, %xmm1, %xmm0
; AVX-64-NEXT: retq
;
; AVX512-32-LABEL: test_v2f32_oeq_q:
; AVX512-32: # %bb.0:
; AVX512-32-NEXT: pushl %ebp
; AVX512-32-NEXT: movl %esp, %ebp
; AVX512-32-NEXT: andl $-16, %esp
; AVX512-32-NEXT: subl $16, %esp
; AVX512-32-NEXT: vmovaps 8(%ebp), %xmm3
; AVX512-32-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX512-32-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX512-32-NEXT: vucomiss %xmm4, %xmm5
; AVX512-32-NEXT: setnp %al
; AVX512-32-NEXT: sete %cl
; AVX512-32-NEXT: testb %al, %cl
; AVX512-32-NEXT: setne %al
; AVX512-32-NEXT: kmovw %eax, %k0
; AVX512-32-NEXT: kshiftlw $15, %k0, %k0
; AVX512-32-NEXT: kshiftrw $14, %k0, %k0
; AVX512-32-NEXT: vucomiss %xmm3, %xmm2
; AVX512-32-NEXT: setnp %al
; AVX512-32-NEXT: sete %cl
; AVX512-32-NEXT: testb %al, %cl
; AVX512-32-NEXT: setne %al
; AVX512-32-NEXT: andl $1, %eax
; AVX512-32-NEXT: kmovw %eax, %k1
; AVX512-32-NEXT: movw $-3, %ax
; AVX512-32-NEXT: kmovw %eax, %k2
; AVX512-32-NEXT: kandw %k2, %k1, %k1
; AVX512-32-NEXT: korw %k0, %k1, %k1
; AVX512-32-NEXT: vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
; AVX512-32-NEXT: movl %ebp, %esp
; AVX512-32-NEXT: popl %ebp
; AVX512-32-NEXT: retl
;
; AVX512-64-LABEL: test_v2f32_oeq_q:
; AVX512-64: # %bb.0:
; AVX512-64-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX512-64-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX512-64-NEXT: vucomiss %xmm4, %xmm5
; AVX512-64-NEXT: setnp %al
; AVX512-64-NEXT: sete %cl
; AVX512-64-NEXT: testb %al, %cl
; AVX512-64-NEXT: setne %al
; AVX512-64-NEXT: kmovw %eax, %k0
; AVX512-64-NEXT: kshiftlw $15, %k0, %k0
; AVX512-64-NEXT: kshiftrw $14, %k0, %k0
; AVX512-64-NEXT: vucomiss %xmm3, %xmm2
; AVX512-64-NEXT: setnp %al
; AVX512-64-NEXT: sete %cl
; AVX512-64-NEXT: testb %al, %cl
; AVX512-64-NEXT: setne %al
; AVX512-64-NEXT: andl $1, %eax
; AVX512-64-NEXT: kmovw %eax, %k1
; AVX512-64-NEXT: movw $-3, %ax
; AVX512-64-NEXT: kmovw %eax, %k2
; AVX512-64-NEXT: kandw %k2, %k1, %k1
; AVX512-64-NEXT: korw %k0, %k1, %k1
; AVX512-64-NEXT: vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
; AVX512-64-NEXT: retq
%cond = call <2 x i1> @llvm.experimental.constrained.fcmp.v2f32(
<2 x float> %f1, <2 x float> %f2, metadata !"oeq",
metadata !"fpexcept.strict") #0
%res = select <2 x i1> %cond, <2 x i32> %a, <2 x i32> %b
ret <2 x i32> %res
}
attributes #0 = { strictfp nounwind }
declare <2 x i1> @llvm.experimental.constrained.fcmp.v2f32(<2 x float>, <2 x float>, metadata, metadata)
declare <2 x i1> @llvm.experimental.constrained.fcmps.v2f32(<2 x float>, <2 x float>, metadata, metadata)