[ARM] Better OR's for MVE compares
[llvm-core.git] / test / MC / RISCV / relocations.s
blob10a28903906aeb45ea4765e37126ce1469f075d5
1 # RUN: llvm-mc -triple riscv32 -riscv-no-aliases < %s -show-encoding \
2 # RUN: | FileCheck -check-prefix=INSTR -check-prefix=FIXUP %s
3 # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s \
4 # RUN: | llvm-readobj -r | FileCheck -check-prefix=RELOC %s
6 # Check prefixes:
7 # RELOC - Check the relocation in the object.
8 # FIXUP - Check the fixup on the instruction.
9 # INSTR - Check the instruction is handled properly by the ASMPrinter
11 .long foo
12 # RELOC: R_RISCV_32 foo
14 .quad foo
15 # RELOC: R_RISCV_64 foo
17 lui t1, %hi(foo)
18 # RELOC: R_RISCV_HI20 foo 0x0
19 # INSTR: lui t1, %hi(foo)
20 # FIXUP: fixup A - offset: 0, value: %hi(foo), kind: fixup_riscv_hi20
22 lui t1, %hi(foo+4)
23 # RELOC: R_RISCV_HI20 foo 0x4
24 # INSTR: lui t1, %hi(foo+4)
25 # FIXUP: fixup A - offset: 0, value: %hi(foo+4), kind: fixup_riscv_hi20
27 lui t1, %tprel_hi(foo)
28 # RELOC: R_RISCV_TPREL_HI20 foo 0x0
29 # INSTR: lui t1, %tprel_hi(foo)
30 # FIXUP: fixup A - offset: 0, value: %tprel_hi(foo), kind: fixup_riscv_tprel_hi20
32 lui t1, %tprel_hi(foo+4)
33 # RELOC: R_RISCV_TPREL_HI20 foo 0x4
34 # INSTR: lui t1, %tprel_hi(foo+4)
35 # FIXUP: fixup A - offset: 0, value: %tprel_hi(foo+4), kind: fixup_riscv_tprel_hi20
37 addi t1, t1, %lo(foo)
38 # RELOC: R_RISCV_LO12_I foo 0x0
39 # INSTR: addi t1, t1, %lo(foo)
40 # FIXUP: fixup A - offset: 0, value: %lo(foo), kind: fixup_riscv_lo12_i
42 addi t1, t1, %lo(foo+4)
43 # RELOC: R_RISCV_LO12_I foo 0x4
44 # INSTR: addi t1, t1, %lo(foo+4)
45 # FIXUP: fixup A - offset: 0, value: %lo(foo+4), kind: fixup_riscv_lo12_i
47 addi t1, t1, %tprel_lo(foo)
48 # RELOC: R_RISCV_TPREL_LO12_I foo 0x0
49 # INSTR: addi t1, t1, %tprel_lo(foo)
50 # FIXUP: fixup A - offset: 0, value: %tprel_lo(foo), kind: fixup_riscv_tprel_lo12_i
52 addi t1, t1, %tprel_lo(foo+4)
53 # RELOC: R_RISCV_TPREL_LO12_I foo 0x4
54 # INSTR: addi t1, t1, %tprel_lo(foo+4)
55 # FIXUP: fixup A - offset: 0, value: %tprel_lo(foo+4), kind: fixup_riscv_tprel_lo12_i
57 sb t1, %lo(foo)(a2)
58 # RELOC: R_RISCV_LO12_S foo 0x0
59 # INSTR: sb t1, %lo(foo)(a2)
60 # FIXUP: fixup A - offset: 0, value: %lo(foo), kind: fixup_riscv_lo12_s
62 sb t1, %lo(foo+4)(a2)
63 # RELOC: R_RISCV_LO12_S foo 0x4
64 # INSTR: sb t1, %lo(foo+4)(a2)
65 # FIXUP: fixup A - offset: 0, value: %lo(foo+4), kind: fixup_riscv_lo12_s
67 sb t1, %tprel_lo(foo)(a2)
68 # RELOC: R_RISCV_TPREL_LO12_S foo 0x0
69 # INSTR: sb t1, %tprel_lo(foo)(a2)
70 # FIXUP: fixup A - offset: 0, value: %tprel_lo(foo), kind: fixup_riscv_tprel_lo12_s
72 sb t1, %tprel_lo(foo+4)(a2)
73 # RELOC: R_RISCV_TPREL_LO12_S foo 0x4
74 # INSTR: sb t1, %tprel_lo(foo+4)(a2)
75 # FIXUP: fixup A - offset: 0, value: %tprel_lo(foo+4), kind: fixup_riscv_tprel_lo12_s
77 .L0:
78 auipc t1, %pcrel_hi(foo)
79 # RELOC: R_RISCV_PCREL_HI20 foo 0x0
80 # INSTR: auipc t1, %pcrel_hi(foo)
81 # FIXUP: fixup A - offset: 0, value: %pcrel_hi(foo), kind: fixup_riscv_pcrel_hi20
83 auipc t1, %pcrel_hi(foo+4)
84 # RELOC: R_RISCV_PCREL_HI20 foo 0x4
85 # INSTR: auipc t1, %pcrel_hi(foo+4)
86 # FIXUP: fixup A - offset: 0, value: %pcrel_hi(foo+4), kind: fixup_riscv_pcrel_hi20
88 addi t1, t1, %pcrel_lo(.L0)
89 # RELOC: R_RISCV_PCREL_LO12_I .L0 0x0
90 # INSTR: addi t1, t1, %pcrel_lo(.L0)
91 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L0), kind: fixup_riscv_pcrel_lo12_i
93 sb t1, %pcrel_lo(.L0)(a2)
94 # RELOC: R_RISCV_PCREL_LO12_S .L0 0x0
95 # INSTR: sb t1, %pcrel_lo(.L0)(a2)
96 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L0), kind: fixup_riscv_pcrel_lo12_s
98 .L1:
99 auipc t1, %got_pcrel_hi(foo)
100 # RELOC: R_RISCV_GOT_HI20 foo 0x0
101 # INSTR: auipc t1, %got_pcrel_hi(foo)
102 # FIXUP: fixup A - offset: 0, value: %got_pcrel_hi(foo), kind: fixup_riscv_got_hi20
104 addi t1, t1, %pcrel_lo(.L1)
105 # RELOC: R_RISCV_PCREL_LO12_I .L1 0x0
106 # INSTR: addi t1, t1, %pcrel_lo(.L1)
107 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L1), kind: fixup_riscv_pcrel_lo12_i
109 sb t1, %pcrel_lo(.L1)(a2)
110 # RELOC: R_RISCV_PCREL_LO12_S .L1 0x0
111 # INSTR: sb t1, %pcrel_lo(.L1)(a2)
112 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L1), kind: fixup_riscv_pcrel_lo12_s
114 # Check that GOT relocations aren't evaluated to a constant when the symbol is
115 # in the same object file.
116 .L2:
117 auipc t1, %got_pcrel_hi(.L1)
118 # RELOC: R_RISCV_GOT_HI20 .L1 0x0
119 # INSTR: auipc t1, %got_pcrel_hi(.L1)
120 # FIXUP: fixup A - offset: 0, value: %got_pcrel_hi(.L1), kind: fixup_riscv_got_hi20
122 addi t1, t1, %pcrel_lo(.L2)
123 # RELOC: R_RISCV_PCREL_LO12_I .L2 0x0
124 # INSTR: addi t1, t1, %pcrel_lo(.L2)
125 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L2), kind: fixup_riscv_pcrel_lo12_i
127 sb t1, %pcrel_lo(.L2)(a2)
128 # RELOC: R_RISCV_PCREL_LO12_S .L2 0x0
129 # INSTR: sb t1, %pcrel_lo(.L2)(a2)
130 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L2), kind: fixup_riscv_pcrel_lo12_s
132 .L3:
133 auipc t1, %tls_ie_pcrel_hi(foo)
134 # RELOC: R_RISCV_TLS_GOT_HI20 foo 0x0
135 # INSTR: auipc t1, %tls_ie_pcrel_hi(foo)
136 # FIXUP: fixup A - offset: 0, value: %tls_ie_pcrel_hi(foo), kind: fixup_riscv_tls_got_hi20
138 addi t1, t1, %pcrel_lo(.L3)
139 # RELOC: R_RISCV_PCREL_LO12_I .L3 0x0
140 # INSTR: addi t1, t1, %pcrel_lo(.L3)
141 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L3), kind: fixup_riscv_pcrel_lo12_i
143 sb t1, %pcrel_lo(.L3)(a2)
144 # RELOC: R_RISCV_PCREL_LO12_S .L3 0x0
145 # INSTR: sb t1, %pcrel_lo(.L3)(a2)
146 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L3), kind: fixup_riscv_pcrel_lo12_s
148 .L4:
149 auipc t1, %tls_gd_pcrel_hi(foo)
150 # RELOC: R_RISCV_TLS_GD_HI20 foo 0x0
151 # INSTR: auipc t1, %tls_gd_pcrel_hi(foo)
152 # FIXUP: fixup A - offset: 0, value: %tls_gd_pcrel_hi(foo), kind: fixup_riscv_tls_gd_hi20
154 addi t1, t1, %pcrel_lo(.L4)
155 # RELOC: R_RISCV_PCREL_LO12_I .L4 0x0
156 # INSTR: addi t1, t1, %pcrel_lo(.L4)
157 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L4), kind: fixup_riscv_pcrel_lo12_i
159 sb t1, %pcrel_lo(.L4)(a2)
160 # RELOC: R_RISCV_PCREL_LO12_S .L4 0x0
161 # INSTR: sb t1, %pcrel_lo(.L4)(a2)
162 # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L4), kind: fixup_riscv_pcrel_lo12_s
164 add t1, t1, tp, %tprel_add(foo)
165 # RELOC: R_RISCV_TPREL_ADD foo 0x0
166 # INSTR: add t1, t1, tp, %tprel_add(foo)
167 # FIXUP: fixup A - offset: 0, value: %tprel_add(foo), kind: fixup_riscv_tprel_add
169 jal zero, foo
170 # RELOC: R_RISCV_JAL
171 # INSTR: jal zero, foo
172 # FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_jal
174 bgeu a0, a1, foo
175 # RELOC: R_RISCV_BRANCH
176 # INSTR: bgeu a0, a1, foo
177 # FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_branch