[llvm] [LoongArch][NFC] More tests to ensure branch relocs reserved when relax enabled (PR #153768)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 15 02:51:34 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-loongarch
Author: ZhaoQi (zhaoqi5)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/153768.diff
1 Files Affected:
- (modified) llvm/test/MC/LoongArch/Relocations/relax-attr.s (+23-8)
``````````diff
diff --git a/llvm/test/MC/LoongArch/Relocations/relax-attr.s b/llvm/test/MC/LoongArch/Relocations/relax-attr.s
index b1e648d850bb9..e3e9038b755d3 100644
--- a/llvm/test/MC/LoongArch/Relocations/relax-attr.s
+++ b/llvm/test/MC/LoongArch/Relocations/relax-attr.s
@@ -1,19 +1,27 @@
-# RUN: llvm-mc --filetype=obj --triple=loongarch64 %s -o %t
-# RUN: llvm-readobj -r %t | FileCheck %s
-# RUN: llvm-mc --filetype=obj --triple=loongarch64 -mattr=+relax %s -o %t
-# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=CHECKR
+# RUN: llvm-mc --filetype=obj --triple=loongarch64 -mattr=-relax %s -o %t.n
+# RUN: llvm-readobj -r %t.n | FileCheck %s
+# RUN: llvm-mc --filetype=obj --triple=loongarch64 -mattr=+relax %s -o %t.r
+# RUN: llvm-readobj -r %t.r | FileCheck %s --check-prefix=CHECKR
# CHECK: Relocations [
+# CHECK-NEXT: Section ({{.*}}) .rela.text {
+# CHECK-NEXT: 0x4 R_LARCH_CALL36 foo 0x0
+# CHECK-NEXT: }
# CHECK-NEXT: Section ({{.*}}) .rela.data {
-# CHECK-NEXT: 0x0 R_LARCH_64 .text 0x4
+# CHECK-NEXT: 0x0 R_LARCH_64 .text 0xC
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECKR: Relocations [
# CHECKR-NEXT: Section ({{.*}}) .rela.text {
-# CHECKR-NEXT: 0x8 R_LARCH_B21 .L1 0x0
-# CHECKR-NEXT: 0xC R_LARCH_B16 .L1 0x0
-# CHECKR-NEXT: 0x10 R_LARCH_B26 .L1 0x0
+# CHECKR-NEXT: 0x4 R_LARCH_CALL36 foo 0x0
+# CHECKR-NEXT: 0x4 R_LARCH_RELAX - 0x0
+# CHECKR-NEXT: 0x10 R_LARCH_B21 .L0 0x0
+# CHECKR-NEXT: 0x14 R_LARCH_B21 .L1 0x0
+# CHECKR-NEXT: 0x18 R_LARCH_B16 .L0 0x0
+# CHECKR-NEXT: 0x1C R_LARCH_B16 .L1 0x0
+# CHECKR-NEXT: 0x20 R_LARCH_B26 .L0 0x0
+# CHECKR-NEXT: 0x24 R_LARCH_B26 .L1 0x0
# CHECKR-NEXT: }
# CHECKR-NEXT: Section ({{.*}}) .rela.data {
# CHECKR-NEXT: 0x0 R_LARCH_64 .L1 0x0
@@ -22,10 +30,17 @@
.text
nop
+
+.L0:
+ call36 foo
+
.L1:
nop
+ bnez $a0, .L0
beqz $a0, .L1
+ beq $a0, $a1, .L0
blt $a0, $a1, .L1
+ bl .L0
b .L1
.data
``````````
</details>
https://github.com/llvm/llvm-project/pull/153768
More information about the llvm-commits
mailing list