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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 14:23:38 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;
----------------
RKSimon wrote:

Why is this case necessary? I thought it was just to convert a XMM X86ISD::CMPP back to an integer?

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


More information about the llvm-commits mailing list