[all-commits] [llvm/llvm-project] aa14f0: [RISCV] Branchless lowering for (select (x < 0), T...

ChunyuLiao via All-commits all-commits at lists.llvm.org
Fri Nov 25 04:18:43 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aa14f002d57b8b3cf30f07c782d2d93f358e51fd
      https://github.com/llvm/llvm-project/commit/aa14f002d57b8b3cf30f07c782d2d93f358e51fd
  Author: LiaoChunyu <chunyu at iscas.ac.cn>
  Date:   2022-11-25 (Fri, 25 Nov 2022)

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

  Log Message:
  -----------
  [RISCV] Branchless lowering for (select (x < 0), TrueConstant, FalseConstant) and (select (x >= 0), TrueConstant, FalseConstant)

This patch reduces the number of unpredictable branches

(select (x < 0), y, z)  -> x >> (XLEN - 1) & (y - z) + z
(select (x >= 0), y, z) -> x >> (XLEN - 1) & (z - y) + y

Reviewed By: craig.topper, reames

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




More information about the All-commits mailing list