[PATCH] D151719: [RISCV] Add special case for (select cc, 1.0, 0.0) to lowerSELECT

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 22:02:36 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5573
+  // (select_cc 0, x, setlt, 0.0, 1.0)
+  // -> (sint_to_fp (zext (setcc x, 1, setlt)))
+  if (FPTV && FPFV && isNullConstant(LHS) && CCVal == ISD::CondCode::SETLT &&
----------------
liaolucy wrote:
> liaolucy wrote:
> > craig.topper wrote:
> > > Why not handle this like the earlier, but use an XOR with 1 to flip the condition? Wouldn't that always better than the branch?
> > The select true/false are 0.0 and 1.0 (not 1.0 and 0.0) we can not replace the select with a sint_to_fp.
> > https://alive2.llvm.org/ce/z/L32zaJ
> > I didn't find an easier replacement. 
> Maybe I can change it to perform select and reuse the above code, I'll try it, thanks.
https://alive2.llvm.org/ce/z/zngvSB


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151719/new/

https://reviews.llvm.org/D151719



More information about the llvm-commits mailing list