2 # RUN: rm -rf %t && split-file %s %t && cd %t
4 # RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=+relax a.s -o rv32.o
5 # RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=+relax a.s -o rv64.o
7 # RUN: ld.lld --relax-gp --undefined=__global_pointer$ rv32.o lds -o rv32
8 # RUN: ld.lld --relax-gp --undefined=__global_pointer$ rv64.o lds -o rv64
9 # RUN: llvm-objdump -td -M no-aliases --no-show-raw-insn rv32 | FileCheck %s
10 # RUN: llvm-objdump -td -M no-aliases --no-show-raw-insn rv64 | FileCheck %s
12 # CHECK: 00000028 l .text {{0*}}0 a
15 # CHECK: addi a0, gp, -0x800
16 # CHECK-NEXT: lw a0, -0x800(gp)
17 # CHECK-NEXT: sw a0, -0x800(gp)
19 # CHECK-NEXT: addi a0, gp, 0x7ff
20 # CHECK-NEXT: lb a0, 0x7ff(gp)
21 # CHECK-NEXT: sb a0, 0x7ff(gp)
22 # CHECK-NEXT: lui a0, 0x201
23 # CHECK-NEXT: addi a0, a0, 0x0
24 # CHECK-NEXT: lw a0, 0x0(a0)
25 # CHECK-NEXT: sw a0, 0x0(a0)
28 # CHECK-NEXT: addi a0, a0, 0x1
42 addi a0
, a0
, %lo
(norelax
)
43 lw a0
, %lo
(norelax
)(a0
)
44 sw a0
, %lo
(norelax
)(a0
)