[llvm] 606551e - Revert "[X86][SSE] X86ISD::FSETCC nodes (cmpss/cmpsd) return a 0/-1 allbits signbits result"
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 12 22:27:07 PDT 2021
Author: Vitaly Buka
Date: 2021-07-12T22:26:54-07:00
New Revision: 606551ee983a70623d397b908d264450aebe099a
URL: https://github.com/llvm/llvm-project/commit/606551ee983a70623d397b908d264450aebe099a
DIFF: https://github.com/llvm/llvm-project/commit/606551ee983a70623d397b908d264450aebe099a.diff
LOG: Revert "[X86][SSE] X86ISD::FSETCC nodes (cmpss/cmpsd) return a 0/-1 allbits signbits result"
Fails here https://lab.llvm.org/buildbot/#/builders/37/builds/5267
This reverts commit e4aa6ad132164839a4a97dff0d433ea4766f77f1.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/known-signbits-vector.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index f5c61b8689ba..0410a6923310 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -34922,11 +34922,6 @@ unsigned X86TargetLowering::ComputeNumSignBitsForTargetNode(
return ShiftVal.uge(VTBits) ? VTBits : ShiftVal.getZExtValue();
}
- case X86ISD::FSETCC:
- // Scalar cmpss/cmpsd return zero/all-bits result values.
- assert((VT == MVT::f32 || VT == MVT::f64) && "Unexpected fp scalar result");
- return VTBits;
-
case X86ISD::PCMPGT:
case X86ISD::PCMPEQ:
case X86ISD::CMPP:
diff --git a/llvm/test/CodeGen/X86/known-signbits-vector.ll b/llvm/test/CodeGen/X86/known-signbits-vector.ll
index 9b31dca38696..ff5c62d9e7b4 100644
--- a/llvm/test/CodeGen/X86/known-signbits-vector.ll
+++ b/llvm/test/CodeGen/X86/known-signbits-vector.ll
@@ -666,19 +666,22 @@ define i32 @signbits_cmpss(float %0, float %1) {
; X86-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; X86-NEXT: vcmpeqss {{[0-9]+}}(%esp), %xmm0, %xmm0
; X86-NEXT: vmovd %xmm0, %eax
+; X86-NEXT: andl $1, %eax
+; X86-NEXT: negl %eax
; X86-NEXT: retl
;
; X64-LABEL: signbits_cmpss:
; X64: # %bb.0:
; X64-NEXT: vcmpeqss %xmm1, %xmm0, %xmm0
; X64-NEXT: vmovd %xmm0, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: negl %eax
; X64-NEXT: retq
%3 = fcmp oeq float %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
-; FIXME: X86 fails to remove the unnecessary neg(and(x,1))
define i64 @signbits_cmpsd(double %0, double %1) {
; X86-LABEL: signbits_cmpsd:
; X86: # %bb.0:
@@ -694,6 +697,8 @@ define i64 @signbits_cmpsd(double %0, double %1) {
; X64: # %bb.0:
; X64-NEXT: vcmpeqsd %xmm1, %xmm0, %xmm0
; X64-NEXT: vmovq %xmm0, %rax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: negq %rax
; X64-NEXT: retq
%3 = fcmp oeq double %0, %1
%4 = sext i1 %3 to i64
More information about the llvm-commits
mailing list