[llvm] [DAG] Fixing the non-optimal code with the following: `select i1 %0, float 1.0, float 0.0`. (PR #107732)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 8 21:55:36 PDT 2024
================
@@ -24150,6 +24150,13 @@ SDValue X86TargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) const {
DAG.getBitcast(NVT, Op2)));
}
+ // (select cc, 1.0, 0.0) -> (sint_to_fp (zext cc))
+ const ConstantFPSDNode *FPTV = dyn_cast<ConstantFPSDNode>(Op1);
+ const ConstantFPSDNode *FPFV = dyn_cast<ConstantFPSDNode>(Op2);
+ if (FPTV && FPFV && FPTV->isExactlyValue(1.0) && FPFV->isExactlyValue(0.0)) {
----------------
c8ef wrote:
The original issue recommended trying x86 first, so I did not include the fold in DAGCombiner.
https://github.com/llvm/llvm-project/pull/107732
More information about the llvm-commits
mailing list