[all-commits] [llvm/llvm-project] d75b83: [RISCV] Support umin/umax in tryFoldSelectIntoOp (...

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Sep 12 10:02:21 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d75b837ff4c27c8ab39a11a50ff64db3687503a7
      https://github.com/llvm/llvm-project/commit/d75b837ff4c27c8ab39a11a50ff64db3687503a7
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2025-09-12 (Fri, 12 Sep 2025)

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

  Log Message:
  -----------
  [RISCV] Support umin/umax in tryFoldSelectIntoOp (#157548)

The neutral values for these are -1U, and 0 respectively. We already
have good arithmetic lowerings for selects with one arm equal to these
values. smin/smax are a bit harder, and will be a separate change.
    
Somewhat surprisingly, this looks to be a net code improvement in all of
the configurations. With both zbb, it's a clear win. With only zicond,
we still seem to come out ahead because we reduce the number of ziconds
needed (since we lower min/max to them). Without either zbb or zicond,
we're a bit more of wash, but the available arithmetic sequences are
good enough that doing the select unconditionally before using branches
for the min/max is probably still worthwhile?



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