[llvm] [X86] Try Folding icmp of v8i32 -> fcmp of v8f32 on AVX (PR #82290)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 15:01:47 PST 2024


================
@@ -42442,13 +42730,24 @@ SDValue X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(
     if (DemandedBits.isSignMask())
       return Op.getOperand(0);
     break;
-  case X86ISD::PCMPGT:
-    // icmp sgt(0, R) == ashr(R, BitWidth-1).
-    // iff we only need the sign bit then we can use R directly.
-    if (DemandedBits.isSignMask() &&
-        ISD::isBuildVectorAllZeros(Op.getOperand(0).getNode()))
-      return Op.getOperand(1);
+  case X86ISD::PCMPGT: {
+    SDLoc DL(Op);
+    if (SDValue R = simplifySExtOfDecomposedSetCC(
+            DAG, DL, ISD::SETGT, Op.getOperand(0), Op.getOperand(1),
+            DemandedBits, /*AllowNOT*/ false, Depth))
+      return R;
+    break;
----------------
goldsteinn wrote:

Not, its a common helper to do the simplifications for float/int.

I could add float->int, however.

https://github.com/llvm/llvm-project/pull/82290


More information about the llvm-commits mailing list