[X86] Add test RUN lines to show cases where we use 512-bit vcmppd/ps with garbage upper bits for 128/256-bit strict_fsetcc

On KNL targets, we widen 128/256-bit strict_fsetcc nodes to
512-bits without forcing the upper bits to zero. This can cause
spurious exceptions due to garbage upper bits. This behavior was
inherited from the non-strict case where the spurious exception
isn't a problem.
This commit is contained in:
Craig Topper 2020-02-12 20:39:30 -08:00
parent 61bd33e37b
commit af15082af4
3 changed files with 3376 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,8 @@
; 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
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512f -mattr=+avx512f -O3 | FileCheck %s --check-prefixes=CHECK,AVX512F-32
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f -mattr=+avx512f -O3 | FileCheck %s --check-prefixes=CHECK,AVX512F-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:
@ -137,6 +139,61 @@ define <2 x i32> @test_v2f32_ogt_s(<2 x i32> %a, <2 x i32> %b, <2 x float> %f1,
; AVX512-64-NEXT: korw %k1, %k0, %k1
; AVX512-64-NEXT: vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
; AVX512-64-NEXT: retq
;
; AVX512F-32-LABEL: test_v2f32_ogt_s:
; AVX512F-32: # %bb.0:
; AVX512F-32-NEXT: pushl %ebp
; AVX512F-32-NEXT: movl %esp, %ebp
; AVX512F-32-NEXT: andl $-16, %esp
; AVX512F-32-NEXT: subl $16, %esp
; AVX512F-32-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
; AVX512F-32-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512F-32-NEXT: vmovaps 8(%ebp), %xmm3
; AVX512F-32-NEXT: movw $-3, %ax
; AVX512F-32-NEXT: kmovw %eax, %k0
; AVX512F-32-NEXT: vcomiss %xmm3, %xmm2
; AVX512F-32-NEXT: seta %al
; AVX512F-32-NEXT: andl $1, %eax
; AVX512F-32-NEXT: kmovw %eax, %k1
; AVX512F-32-NEXT: kandw %k0, %k1, %k0
; AVX512F-32-NEXT: vmovshdup {{.*#+}} xmm3 = xmm3[1,1,3,3]
; AVX512F-32-NEXT: vmovshdup {{.*#+}} xmm2 = xmm2[1,1,3,3]
; AVX512F-32-NEXT: vcomiss %xmm3, %xmm2
; AVX512F-32-NEXT: seta %al
; AVX512F-32-NEXT: kmovw %eax, %k1
; AVX512F-32-NEXT: kshiftlw $15, %k1, %k1
; AVX512F-32-NEXT: kshiftrw $14, %k1, %k1
; AVX512F-32-NEXT: korw %k1, %k0, %k1
; AVX512F-32-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
; AVX512F-32-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
; AVX512F-32-NEXT: movl %ebp, %esp
; AVX512F-32-NEXT: popl %ebp
; AVX512F-32-NEXT: vzeroupper
; AVX512F-32-NEXT: retl
;
; AVX512F-64-LABEL: test_v2f32_ogt_s:
; AVX512F-64: # %bb.0:
; AVX512F-64-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
; AVX512F-64-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512F-64-NEXT: movw $-3, %ax
; AVX512F-64-NEXT: kmovw %eax, %k0
; AVX512F-64-NEXT: vcomiss %xmm3, %xmm2
; AVX512F-64-NEXT: seta %al
; AVX512F-64-NEXT: andl $1, %eax
; AVX512F-64-NEXT: kmovw %eax, %k1
; AVX512F-64-NEXT: kandw %k0, %k1, %k0
; AVX512F-64-NEXT: vmovshdup {{.*#+}} xmm3 = xmm3[1,1,3,3]
; AVX512F-64-NEXT: vmovshdup {{.*#+}} xmm2 = xmm2[1,1,3,3]
; AVX512F-64-NEXT: vcomiss %xmm3, %xmm2
; AVX512F-64-NEXT: seta %al
; AVX512F-64-NEXT: kmovw %eax, %k1
; AVX512F-64-NEXT: kshiftlw $15, %k1, %k1
; AVX512F-64-NEXT: kshiftrw $14, %k1, %k1
; AVX512F-64-NEXT: korw %k1, %k0, %k1
; AVX512F-64-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
; AVX512F-64-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
; AVX512F-64-NEXT: vzeroupper
; AVX512F-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
@ -295,6 +352,73 @@ define <2 x i32> @test_v2f32_oeq_q(<2 x i32> %a, <2 x i32> %b, <2 x float> %f1,
; AVX512-64-NEXT: korw %k0, %k1, %k1
; AVX512-64-NEXT: vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
; AVX512-64-NEXT: retq
;
; AVX512F-32-LABEL: test_v2f32_oeq_q:
; AVX512F-32: # %bb.0:
; AVX512F-32-NEXT: pushl %ebp
; AVX512F-32-NEXT: movl %esp, %ebp
; AVX512F-32-NEXT: andl $-16, %esp
; AVX512F-32-NEXT: subl $16, %esp
; AVX512F-32-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
; AVX512F-32-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512F-32-NEXT: vmovaps 8(%ebp), %xmm3
; AVX512F-32-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX512F-32-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX512F-32-NEXT: vucomiss %xmm4, %xmm5
; AVX512F-32-NEXT: setnp %al
; AVX512F-32-NEXT: sete %cl
; AVX512F-32-NEXT: testb %al, %cl
; AVX512F-32-NEXT: setne %al
; AVX512F-32-NEXT: kmovw %eax, %k0
; AVX512F-32-NEXT: kshiftlw $15, %k0, %k0
; AVX512F-32-NEXT: kshiftrw $14, %k0, %k0
; AVX512F-32-NEXT: vucomiss %xmm3, %xmm2
; AVX512F-32-NEXT: setnp %al
; AVX512F-32-NEXT: sete %cl
; AVX512F-32-NEXT: testb %al, %cl
; AVX512F-32-NEXT: setne %al
; AVX512F-32-NEXT: andl $1, %eax
; AVX512F-32-NEXT: kmovw %eax, %k1
; AVX512F-32-NEXT: movw $-3, %ax
; AVX512F-32-NEXT: kmovw %eax, %k2
; AVX512F-32-NEXT: kandw %k2, %k1, %k1
; AVX512F-32-NEXT: korw %k0, %k1, %k1
; AVX512F-32-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
; AVX512F-32-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
; AVX512F-32-NEXT: movl %ebp, %esp
; AVX512F-32-NEXT: popl %ebp
; AVX512F-32-NEXT: vzeroupper
; AVX512F-32-NEXT: retl
;
; AVX512F-64-LABEL: test_v2f32_oeq_q:
; AVX512F-64: # %bb.0:
; AVX512F-64-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
; AVX512F-64-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512F-64-NEXT: vmovshdup {{.*#+}} xmm4 = xmm3[1,1,3,3]
; AVX512F-64-NEXT: vmovshdup {{.*#+}} xmm5 = xmm2[1,1,3,3]
; AVX512F-64-NEXT: vucomiss %xmm4, %xmm5
; AVX512F-64-NEXT: setnp %al
; AVX512F-64-NEXT: sete %cl
; AVX512F-64-NEXT: testb %al, %cl
; AVX512F-64-NEXT: setne %al
; AVX512F-64-NEXT: kmovw %eax, %k0
; AVX512F-64-NEXT: kshiftlw $15, %k0, %k0
; AVX512F-64-NEXT: kshiftrw $14, %k0, %k0
; AVX512F-64-NEXT: vucomiss %xmm3, %xmm2
; AVX512F-64-NEXT: setnp %al
; AVX512F-64-NEXT: sete %cl
; AVX512F-64-NEXT: testb %al, %cl
; AVX512F-64-NEXT: setne %al
; AVX512F-64-NEXT: andl $1, %eax
; AVX512F-64-NEXT: kmovw %eax, %k1
; AVX512F-64-NEXT: movw $-3, %ax
; AVX512F-64-NEXT: kmovw %eax, %k2
; AVX512F-64-NEXT: kandw %k2, %k1, %k1
; AVX512F-64-NEXT: korw %k0, %k1, %k1
; AVX512F-64-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
; AVX512F-64-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
; AVX512F-64-NEXT: vzeroupper
; AVX512F-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