Skip to content

Conversation

@zhaoqi5
Copy link
Contributor

@zhaoqi5 zhaoqi5 commented Aug 15, 2025

No description provided.

@llvmbot llvmbot added llvm:mc Machine (object) code backend:loongarch labels Aug 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-backend-loongarch

Author: ZhaoQi (zhaoqi5)

Changes

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 --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

@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-mc

Author: ZhaoQi (zhaoqi5)

Changes

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 --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

@zhaoqi5 zhaoqi5 merged commit 8181c76 into main Aug 18, 2025
12 checks passed
@zhaoqi5 zhaoqi5 deleted the users/zhaoqi5/test-branch-with-relax branch August 18, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:loongarch llvm:mc Machine (object) code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants