[PATCH] D151719: [RISCV] Add special case for (select cc, 1.0, 0.0) to lowerSELECT
Liao Chunyu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 21:37:01 PDT 2023
liaolucy 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 &&
----------------
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.
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