[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
Fri Mar 15 09:21:26 PDT 2024


================
@@ -2313,6 +2313,26 @@ bool TargetLowering::SimplifyDemandedBits(
     Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth);
     break;
   }
+  case ISD::SINT_TO_FP: {
+    EVT InnerVT = Op.getOperand(0).getValueType();
+    const APInt &DemandedBitsToUse =
+        TLO.DAG.getTargetLoweringInfo().isBitcastFree(VT, InnerVT)
+            ? OriginalDemandedBits
+            : DemandedBits;
+    if (DemandedBitsToUse.isSignMask() &&
+        VT.getScalarSizeInBits() == InnerVT.getScalarSizeInBits())
+      return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Op.getOperand(0)));
+
+    Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth);
+    break;
+  }
+  case ISD::UINT_TO_FP: {
+    if (OriginalDemandedBits.isSignMask())
+      return TLO.CombineTo(Op, TLO.DAG.getConstant(0, dl, VT));
+
+    Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth);
+    break;
+  }
----------------
RKSimon wrote:

Cheers - any luck with pulling this out entirely?

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


More information about the llvm-commits mailing list