[llvm] [RISC-V] Make Short Forward Branches capable of matching Zibi instructions (PR #208637)

Jesse Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 00:03:52 PDT 2026


================
@@ -251,3 +260,16 @@ def PseudoCCLBU : SFBLoad;
 def PseudoCCLWU : SFBLoad;
 def PseudoCCLD : SFBLoad;
 }
+
+// Zibi: select with immediate comparison folded into SFB.
+// imm5_zibi is defined in RISCVInstrInfoZibi.td (included before this file).
+class SelectZibiSFB<CondCode Cond>
+    : Pat<(riscv_selectcc (XLenVT GPR:$lhs), imm5_zibi:$cimm, Cond:$cc,
+                          (XLenVT GPR:$truev), GPR:$falsev),
----------------
jaidTw wrote:

Tests added.

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


More information about the llvm-commits mailing list