[llvm] [RISCV] Test Zibi relocation type (PR #177896)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 25 19:37:49 PST 2026
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/177896
Zibi beqi/bnei (#127463) use a modified B-type format (replace `rs2`
with `cimm`) and reuse the R_RISCV_BRANCH relocation type.
>From cc1c2fe8b9e987b87d643e1f4f0984e7cc3d56b6 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sun, 25 Jan 2026 19:25:32 -0800
Subject: [PATCH] [RISCV] Test Zibi relocation type
Zibi beqi/bnei (#127463) use a modified B-type format (replace `rs2`
with `cimm`) and reuse the R_RISCV_BRANCH relocation type.
---
llvm/test/MC/RISCV/zibi-valid.s | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/llvm/test/MC/RISCV/zibi-valid.s b/llvm/test/MC/RISCV/zibi-valid.s
index b062c4cf1efb3..8c4154a4a741e 100644
--- a/llvm/test/MC/RISCV/zibi-valid.s
+++ b/llvm/test/MC/RISCV/zibi-valid.s
@@ -7,7 +7,7 @@
# RUN: not llvm-mc -triple=riscv64 -show-encoding %s 2>&1 \
# RUN: | FileCheck %s --check-prefix=CHECK-ERROR
# RUN: llvm-mc -triple=riscv32 -filetype=obj --mattr=+experimental-zibi %s \
-# RUN: | llvm-objdump -d --mattr=+experimental-zibi --no-print-imm-hex - \
+# RUN: | llvm-objdump -dr --mattr=+experimental-zibi --no-print-imm-hex - \
# RUN: | FileCheck %s --check-prefix=CHECK-OBJ
# RUN: llvm-mc -triple=riscv32 -filetype=obj --mattr=+experimental-zibi %s \
# RUN: | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
@@ -61,3 +61,8 @@ bnei s1, 11, -4096
# CHECK-ENCODING: [0x63,0xb0,0xb4,0x80]
# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
# CHECK-UNKNOWN: 80b4b063 <unknown>
+
+bnei s1, 12, undef+1
+# CHECK-OBJ: bnei s1, 12, {{.*}}
+# CHECK-OBJ-NEXT: R_RISCV_BRANCH undef+0x1
+# CHECK-ASM: bnei s1, 12, undef+1
More information about the llvm-commits
mailing list