Skip to content

Commit 5f3d90c

Browse files
committed
Fix .option relax inline asm test
1 parent c9c3edf commit 5f3d90c

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

llvm/test/CodeGen/RISCV/option-relax-relocation.ll

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,45 @@
1-
;; With +relax, J below needs a relocation to ensure the target is correct
2-
;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/1965
31

42
; RUN: llc -mtriple=riscv64 -mattr=-relax -filetype=obj < %s \
53
; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,NORELAX
64
; RUN: llc -mtriple=riscv64 -mattr=+relax -filetype=obj < %s \
75
; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,RELAX
86

7+
;; With +relax, All `j` instructions below need a relocation to ensure the target is correct
8+
;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/1965
9+
910
; CHECK: j {{.*}}
1011
; RELAX-NEXT: R_RISCV_JAL {{.*}}
12+
; RELAX-NOT: R_RISCV_RELAX
1113
; CHECK-NEXT: auipc ra, 0x0
1214
; CHECK-NEXT: R_RISCV_CALL_PLT f
1315
; RELAX-NEXT: R_RISCV_RELAX *ABS*
1416
; CHECK-NEXT: jalr ra
1517
; CHECK-NEXT: j {{.*}}
18+
; RELAX-NEXT: R_RISCV_JAL {{.*}}
19+
; RELAX-NOT: R_RISCV_RELAX
1620
; CHECK-NEXT: j {{.*}}
17-
; RELAX-NEXT: R_RISCV_JAL .L0
21+
; RELAX-NEXT: R_RISCV_JAL {{.*}}
22+
; RELAX-NEXT: R_RISCV_RELAX *ABS*
1823
; NORELAX-NEXT: li a0, 0x0
1924
; RELAX-EMPTY:
2025

2126
define dso_local noundef signext i32 @main() local_unnamed_addr #0 {
2227
entry:
23-
callbr void asm sideeffect ".option push\0A.option norelax\0Aj $0\0A.option pop\0A", "!i"()
24-
to label %asm.fallthrough [label %label]
28+
callbr void asm sideeffect "
29+
.option push
30+
.option norelax
31+
j $0
32+
.option pop",
33+
"!i"() to label %asm.fallthrough [label %label]
2534

2635
asm.fallthrough: ; preds = %entry
2736
tail call void @f()
28-
callbr void asm sideeffect ".option push\0A.option norelax\0Aj $0\0A.option pop\0A", "!i"()
29-
to label %asm.fallthrough [label %label]
37+
callbr void asm sideeffect "
38+
.option push
39+
.option norelax
40+
j $0
41+
.option pop",
42+
"!i"() to label %asm.fallthrough [label %label]
3043
br label %label
3144

3245
label: ; preds = %asm.fallthrough, %entry

0 commit comments

Comments
 (0)