[all-commits] [llvm/llvm-project] 1a042d: [RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ...

Craig Topper via All-commits all-commits at lists.llvm.org
Sun Aug 21 12:15:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a042dd6ed2108f67f567fcd13a9737f946e6522
      https://github.com/llvm/llvm-project/commit/1a042dd6ed2108f67f567fcd13a9737f946e6522
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-08-21 (Sun, 21 Aug 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/forced-atomics.ll
    M llvm/test/CodeGen/RISCV/min-max.ll

  Log Message:
  -----------
  [RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1.

Similar to D132211, we can optimize x <s -1 ? x : -1 -> x <s 0 ? x : -1

Also improve the unsigned case from D132211 to use x != 0 which
will give a bnez instruction which might be compressible.

Differential Revision: https://reviews.llvm.org/D132252




More information about the All-commits mailing list