1 # RUN: llvm-mc %s -triple=riscv32 | FileCheck -check-prefixes=ASM %s
2 # RUN: llvm-mc %s -triple=riscv64 | FileCheck -check-prefixes=ASM %s
3 # RUN: llvm-mc %s -triple=riscv32 -mattr=+relax | FileCheck -check-prefix=ASM %s
4 # RUN: llvm-mc %s -triple=riscv64 -mattr=+relax | FileCheck -check-prefix=ASM %s
5 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
6 # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefixes=DISASM,DISASM-NORELAX %s
7 # RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
8 # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefixes=DISASM,DISASM-NORELAX %s
9 # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+relax < %s \
10 # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefixes=DISASM,DISASM-RELAX %s
11 # RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+relax < %s \
12 # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefixes=DISASM,DISASM-RELAX %s
14 # Checks change of options does not cause error: could not find corresponding %pcrel_hi
15 # when assembling pseudoinstruction and its extended form. Also checks that we
16 # evaluate the correct value for local symbols in such a situation.
24 # ASM-LABEL: .Lpcrel_hi0{{>?}}:
25 # ASM-NEXT: auipc a0, %pcrel_hi(a_symbol)
26 # ASM-NEXT: addi a0, a0, %pcrel_lo(.Lpcrel_hi0)
27 # ASM-LABEL: .Lpcrel_hi1{{>?}}:
28 # ASM-NEXT: auipc a1, %pcrel_hi(another_symbol)
29 # ASM-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi1)
31 # DISASM-LABEL: <.Lpcrel_hi0>:
32 # DISASM-NEXT: auipc a0, 0
33 # DISASM-NEXT: addi a0, a0, 0
34 # DISASM-LABEL: <.Lpcrel_hi1>:
35 # DISASM-NEXT: auipc a1, 0
36 # DISASM-NEXT: addi a1, a1, 0
40 1:auipc a0
, %pcrel_hi
(a_symbol
)
41 addi a0
, a0
, %pcrel_lo
(1b)
43 2:auipc a1
, %pcrel_hi
(another_symbol
)
44 addi a1
, a1
, %pcrel_lo
(2b)
46 # ASM-LABEL: .Ltmp0{{>?}}:
47 # ASM-NEXT: auipc a0, %pcrel_hi(a_symbol)
48 # ASM-NEXT: addi a0, a0, %pcrel_lo(.Ltmp0)
49 # ASM-LABEL: .Ltmp1{{>?}}:
50 # ASM-NEXT: auipc a1, %pcrel_hi(another_symbol)
51 # ASM-NEXT: addi a1, a1, %pcrel_lo(.Ltmp1)
53 # DISASM-LABEL: .Ltmp0{{>?}}:
54 # DISASM-NEXT: auipc a0, 0
55 # DISASM-NEXT: addi a0, a0, 0
56 # DISASM-LABEL: .Ltmp1{{>?}}:
57 # DISASM-NEXT: auipc a1, 0
58 # DISASM-NEXT: addi a1, a1, 0
69 # ASM-LABEL: .Lpcrel_hi2{{>?}}:
70 # ASM-NEXT: auipc a0, %pcrel_hi(a_symbol)
71 # ASM-NEXT: addi a0, a0, %pcrel_lo(.Lpcrel_hi2)
72 # ASM-LABEL: .Lpcrel_hi3{{>?}}:
73 # ASM-NEXT: auipc a1, %pcrel_hi(local_symbol1)
74 # ASM-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi3)
76 # DISASM-LABEL: .Lpcrel_hi2{{>?}}:
77 # DISASM-NEXT: auipc a0, 0
78 # DISASM-NEXT: addi a0, a0, 0
79 # DISASM-NORELAX-NEXT: auipc a1, 0
80 # DISASM-NORELAX-NEXT: addi a1, a1, 8
81 # DISASM-RELAX-LABEL: .Lpcrel_hi3{{>?}}:
82 # DISASM-RELAX-NEXT: auipc a1, 0
83 # DISASM-RELAX-NEXT: addi a1, a1, 0
87 1:auipc a0
, %pcrel_hi
(a_symbol
)
88 addi a0
, a0
, %pcrel_lo
(1b)
90 2:auipc a1
, %pcrel_hi
(local_symbol2
)
91 addi a1
, a1
, %pcrel_lo
(2b)
96 # ASM-LABEL: .Ltmp2{{>?}}:
97 # ASM-NEXT: auipc a0, %pcrel_hi(a_symbol)
98 # ASM-NEXT: addi a0, a0, %pcrel_lo(.Ltmp2)
99 # ASM-LABEL: .Ltmp3{{>?}}:
100 # ASM-NEXT: auipc a1, %pcrel_hi(local_symbol2)
101 # ASM-NEXT: addi a1, a1, %pcrel_lo(.Ltmp3)
103 # DISASM-LABEL: .Ltmp2{{>?}}:
104 # DISASM-NEXT: auipc a0, 0
105 # DISASM-NEXT: addi a0, a0, 0
106 # DISASM-NORELAX-NEXT: auipc a1, 0
107 # DISASM-NORELAX-NEXT: addi a1, a1, 8
108 # DISASM-RELAX-LABEL: .Ltmp3{{>?}}:
109 # DISASM-RELAX-NEXT: auipc a1, 0
110 # DISASM-RELAX-NEXT: addi a1, a1, 0