[llvm] [RISC-V][ISel] Remove redundant czero.eqz like 'czero.eqz a0, a0, a0' (PR #90208)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 09:26:35 PDT 2024
================
@@ -7503,6 +7503,17 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
return DAG.getNode(ISD::ADD, DL, VT, CMOV, RHSVal);
}
+ // c = setcc f, 0, seteq
+ // (select c, t, f) -> (or f, (czero_nez t, f))
----------------
dtcxzyw wrote:
> Emm, it would be better to add the following folds in `RISCVInstrInfoZicond.td`:
>
> ```
> def : Pat<(XLenVT (riscv_czero_eqz GPR:$rs1, (riscv_setne (XLenVT GPR:$rs1)))),
> (COPY GPR:$rs1)>;
> def : Pat<(XLenVT (riscv_czero_nez GPR:$rs1, (riscv_seteq (XLenVT GPR:$rs1)))),
> (COPY GPR:$rs1)>;
> ```
Sorry, it is incorrect.
https://github.com/llvm/llvm-project/pull/90208
More information about the llvm-commits
mailing list