[all-commits] [llvm/llvm-project] 0107c8: [RISCV][SDAG] Improve codegen of select with const...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Thu Feb 22 08:19:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0107c8824b695db86706bbc3466bbfd585a754aa
      https://github.com/llvm/llvm-project/commit/0107c8824b695db86706bbc3466bbfd585a754aa
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2024-02-23 (Fri, 23 Feb 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/select.ll

  Log Message:
  -----------
  [RISCV][SDAG] Improve codegen of select with constants if zicond is available (#82456)

This patch uses `add + czero.eqz/nez` to lower select with constants if
zicond is available.
```
(select c, c1, c2) -> (add (czero_nez c2 - c1, c), c1)
(select c, c1, c2) -> (add (czero_eqz c1 - c2, c), c2)
```
The above code sequence is suggested by [RISCV Optimization
Guide](https://riscv-optimization-guide-riseproject-c94355ae3e6872252baa952524.gitlab.io/riscv-optimization-guide.html#_avoid_branches_using_conditional_moves).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list