From: Simon Pilgrim Date: Fri, 29 Mar 2019 17:20:27 +0000 (+0000) Subject: [X86] Fix some tests using fcmp with undef arguments X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d874dc21eb3fe0fa6a50f5f9f48009fe8797001;p=llvm [X86] Fix some tests using fcmp with undef arguments Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357278 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/2011-10-19-widen_vselect.ll b/test/CodeGen/X86/2011-10-19-widen_vselect.ll index 44d9569bc57..292cfb1d755 100644 --- a/test/CodeGen/X86/2011-10-19-widen_vselect.ll +++ b/test/CodeGen/X86/2011-10-19-widen_vselect.ll @@ -21,24 +21,26 @@ entry: ret void } -define void @complex_inreg_work(<2 x float> %a, <2 x float> %b) { +define void @complex_inreg_work(<2 x float> %a, <2 x float> %b, <2 x float> %c) { ; X32-LABEL: complex_inreg_work: ; X32: # %bb.0: # %entry -; X32-NEXT: movaps %xmm0, %xmm2 -; X32-NEXT: cmpordps %xmm0, %xmm0 -; X32-NEXT: blendvps %xmm0, %xmm2, %xmm1 +; X32-NEXT: movaps %xmm0, %xmm3 +; X32-NEXT: cmpordps %xmm2, %xmm2 +; X32-NEXT: movaps %xmm2, %xmm0 +; X32-NEXT: blendvps %xmm0, %xmm3, %xmm1 ; X32-NEXT: movlps %xmm1, (%eax) ; X32-NEXT: retl ; ; X64-LABEL: complex_inreg_work: ; X64: # %bb.0: # %entry -; X64-NEXT: movaps %xmm0, %xmm2 -; X64-NEXT: cmpordps %xmm0, %xmm0 -; X64-NEXT: blendvps %xmm0, %xmm2, %xmm1 +; X64-NEXT: movaps %xmm0, %xmm3 +; X64-NEXT: cmpordps %xmm2, %xmm2 +; X64-NEXT: movaps %xmm2, %xmm0 +; X64-NEXT: blendvps %xmm0, %xmm3, %xmm1 ; X64-NEXT: movlps %xmm1, (%rax) ; X64-NEXT: retq entry: - %0 = fcmp oeq <2 x float> undef, undef + %0 = fcmp oeq <2 x float> %c, %c %1 = select <2 x i1> %0, <2 x float> %a, <2 x float> %b store <2 x float> %1, <2 x float>* undef ret void diff --git a/test/CodeGen/X86/2011-10-21-widen-cmp.ll b/test/CodeGen/X86/2011-10-21-widen-cmp.ll index 812faaf473d..5cba1dd1ab7 100644 --- a/test/CodeGen/X86/2011-10-21-widen-cmp.ll +++ b/test/CodeGen/X86/2011-10-21-widen-cmp.ll @@ -4,31 +4,33 @@ ; Check that a <4 x float> compare is generated and that we are ; not stuck in an endless loop. -define void @cmp_2_floats(<2 x float> %a, <2 x float> %b) { +define void @cmp_2_floats(<2 x float> %a, <2 x float> %b, <2 x float> %c) { ; CHECK-LABEL: cmp_2_floats: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: movaps %xmm0, %xmm2 -; CHECK-NEXT: cmpordps %xmm0, %xmm0 -; CHECK-NEXT: blendvps %xmm0, %xmm2, %xmm1 +; CHECK-NEXT: movaps %xmm0, %xmm3 +; CHECK-NEXT: cmpordps %xmm2, %xmm2 +; CHECK-NEXT: movaps %xmm2, %xmm0 +; CHECK-NEXT: blendvps %xmm0, %xmm3, %xmm1 ; CHECK-NEXT: movlps %xmm1, (%rax) ; CHECK-NEXT: retq entry: - %0 = fcmp oeq <2 x float> undef, undef + %0 = fcmp oeq <2 x float> %c, %c %1 = select <2 x i1> %0, <2 x float> %a, <2 x float> %b store <2 x float> %1, <2 x float>* undef ret void } -define void @cmp_2_doubles(<2 x double> %a, <2 x double> %b) { +define void @cmp_2_doubles(<2 x double> %a, <2 x double> %b, <2 x double> %c) { ; CHECK-LABEL: cmp_2_doubles: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: movapd %xmm0, %xmm2 -; CHECK-NEXT: cmpordpd %xmm0, %xmm0 -; CHECK-NEXT: blendvpd %xmm0, %xmm2, %xmm1 +; CHECK-NEXT: movapd %xmm0, %xmm3 +; CHECK-NEXT: cmpordpd %xmm2, %xmm2 +; CHECK-NEXT: movapd %xmm2, %xmm0 +; CHECK-NEXT: blendvpd %xmm0, %xmm3, %xmm1 ; CHECK-NEXT: movapd %xmm1, (%rax) ; CHECK-NEXT: retq entry: - %0 = fcmp oeq <2 x double> undef, undef + %0 = fcmp oeq <2 x double> %c, %c %1 = select <2 x i1> %0, <2 x double> %a, <2 x double> %b store <2 x double> %1, <2 x double>* undef ret void diff --git a/test/CodeGen/X86/avx-cmp.ll b/test/CodeGen/X86/avx-cmp.ll index c789ec4d77f..e564cf162ac 100644 --- a/test/CodeGen/X86/avx-cmp.ll +++ b/test/CodeGen/X86/avx-cmp.ll @@ -23,12 +23,13 @@ define <4 x i64> @cmp01(<4 x double> %a, <4 x double> %b) nounwind { declare void @scale() nounwind -define void @render() nounwind { +define void @render(double %a0) nounwind { ; CHECK-LABEL: render: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: pushq %rbp ; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: pushq %rax +; CHECK-NEXT: vmovsd %xmm0, (%rsp) # 8-byte Spill ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: testb %al, %al ; CHECK-NEXT: jne .LBB2_6 @@ -44,14 +45,16 @@ define void @render() nounwind { ; CHECK-NEXT: # in Loop: Header=BB2_2 Depth=1 ; CHECK-NEXT: testb %bpl, %bpl ; CHECK-NEXT: jne .LBB2_2 -; CHECK-NEXT: # %bb.4: # %for.body33 +; CHECK-NEXT: # %bb.4: # %for.body33.preheader ; CHECK-NEXT: # in Loop: Header=BB2_2 Depth=1 +; CHECK-NEXT: vmovsd (%rsp), %xmm0 # 8-byte Reload +; CHECK-NEXT: # xmm0 = mem[0],zero ; CHECK-NEXT: vucomisd {{\.LCPI.*}}, %xmm0 ; CHECK-NEXT: jne .LBB2_5 ; CHECK-NEXT: jnp .LBB2_2 ; CHECK-NEXT: .LBB2_5: # %if.then -; CHECK-NEXT: # in Loop: Header=BB2_2 Depth=1 -; CHECK-NEXT: callq scale +; CHECK-NEXT: # in Loop: Header=BB2_2 Depth=1 +; CHECK-NEXT: callq scale ; CHECK-NEXT: jmp .LBB2_2 ; CHECK-NEXT: .LBB2_6: # %for.end52 ; CHECK-NEXT: addq $8, %rsp @@ -69,7 +72,7 @@ for.cond30: br i1 false, label %for.body33, label %for.cond5 for.body33: - %tobool = fcmp une double undef, 0.000000e+00 + %tobool = fcmp une double %a0, 0.000000e+00 br i1 %tobool, label %if.then, label %for.cond30 if.then: @@ -194,29 +197,29 @@ define <32 x i8> @v32i8_cmpeq(<32 x i8> %i, <32 x i8> %j) nounwind { ;; Scalar comparison -define i32 @scalarcmpA() uwtable ssp { +define i32 @scalarcmpA(double %a0) uwtable ssp { ; CHECK-LABEL: scalarcmpA: ; CHECK: # %bb.0: -; CHECK-NEXT: vxorpd %xmm0, %xmm0, %xmm0 -; CHECK-NEXT: vcmpeqsd %xmm0, %xmm0, %xmm0 +; CHECK-NEXT: vxorpd %xmm1, %xmm1, %xmm1 +; CHECK-NEXT: vcmpeqsd %xmm1, %xmm0, %xmm0 ; CHECK-NEXT: vmovq %xmm0, %rax ; CHECK-NEXT: andl $1, %eax ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax ; CHECK-NEXT: retq - %cmp29 = fcmp oeq double undef, 0.000000e+00 + %cmp29 = fcmp oeq double %a0, 0.000000e+00 %res = zext i1 %cmp29 to i32 ret i32 %res } -define i32 @scalarcmpB() uwtable ssp { +define i32 @scalarcmpB(float %a0) uwtable ssp { ; CHECK-LABEL: scalarcmpB: ; CHECK: # %bb.0: -; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0 -; CHECK-NEXT: vcmpeqss %xmm0, %xmm0, %xmm0 +; CHECK-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; CHECK-NEXT: vcmpeqss %xmm1, %xmm0, %xmm0 ; CHECK-NEXT: vmovd %xmm0, %eax ; CHECK-NEXT: andl $1, %eax ; CHECK-NEXT: retq - %cmp29 = fcmp oeq float undef, 0.000000e+00 + %cmp29 = fcmp oeq float %a0, 0.000000e+00 %res = zext i1 %cmp29 to i32 ret i32 %res } diff --git a/test/CodeGen/X86/avx512-vbroadcast.ll b/test/CodeGen/X86/avx512-vbroadcast.ll index ddcd0cb1ba9..3277f99dce6 100644 --- a/test/CodeGen/X86/avx512-vbroadcast.ll +++ b/test/CodeGen/X86/avx512-vbroadcast.ll @@ -205,18 +205,18 @@ define <16 x float> @_xmm16xfloat(<16 x float> %a) { ret <16 x float> %b } -define <16 x i32> @test_vbroadcast() { +define <16 x i32> @test_vbroadcast(<16 x float> %a0) { ; ALL-LABEL: test_vbroadcast: ; ALL: # %bb.0: # %entry -; ALL-NEXT: vxorps %xmm0, %xmm0, %xmm0 -; ALL-NEXT: vcmpunordps %zmm0, %zmm0, %k1 +; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; ALL-NEXT: vcmpunordps %zmm1, %zmm0, %k1 ; ALL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z} ; ALL-NEXT: knotw %k1, %k1 ; ALL-NEXT: vmovdqa32 %zmm0, %zmm0 {%k1} {z} ; ALL-NEXT: retq entry: %0 = sext <16 x i1> zeroinitializer to <16 x i32> - %1 = fcmp uno <16 x float> undef, zeroinitializer + %1 = fcmp uno <16 x float> %a0, zeroinitializer %2 = sext <16 x i1> %1 to <16 x i32> %3 = select <16 x i1> %1, <16 x i32> %0, <16 x i32> %2 ret <16 x i32> %3