[llvm] [RISCV] Add short forward branch support for `min`, `max`, `maxu` and `minu` (PR #164394)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 12:00:52 PDT 2025


================
@@ -0,0 +1,539 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc < %s -mtriple=riscv32 | FileCheck %s --check-prefixes=RV32I-NOZBB
+; RUN: llc < %s -mtriple=riscv64 | FileCheck %s --check-prefixes=RV64I-NOZBB
+; RUN: llc < %s -mtriple=riscv32 -mattr=+zbb,+short-forward-branch-opt | \
+; RUN:   FileCheck %s --check-prefixes=RV32I-SFB-ZBB
+; RUN: llc < %s -mtriple=riscv64 -mattr=+zbb,+short-forward-branch-opt | \
+; RUN:   FileCheck %s --check-prefixes=RV64I-SFB-ZBB
----------------
lenary wrote:

This is still unaddressed.

Probably we want:
- ZBB only (rv32 and rv64)
- ZBB+SFB (rv32 and rv64)
- ZBB+SFBIMinMax (rv32 and rv64)

To verify the optimisation only happens with SFBIMinMax.

https://github.com/llvm/llvm-project/pull/164394


More information about the llvm-commits mailing list