1- # RUN: llvm-objdump -d %p/Inputs/riscv -ar-coverage | FileCheck %s
1+ # RUN: llvm-objdump -d %p/Inputs/riscv64 -ar-coverage | FileCheck %s
22
33# CHECK: 0000000000001000 <_start>:
44# CHECK-NEXT: 1000 : 00001517 auipc a0 , 0x1
2222# CHECK-NEXT: 1032 : 00a02423 sw a0 , 0x8(zero)
2323# CHECK-NEXT: 1036 : 00101097 auipc ra, 0x101
2424# CHECK-NEXT: 103a: fd6080e7 jalr -0x2a(ra) <func>
25- # CHECK-NEXT: 103e: 00102437 lui s0, 0x102
26- # CHECK-NEXT: 1042 : 8800 sb s0, 0x0(s0) <target+0xffffc >
27- # CHECK-NEXT: 1044 : 00102137 lui sp , 0x102
28- # CHECK-NEXT: 1048 : 4522 lw a0 , 0x8( sp ) <far_target>
25+ # CHECK-NEXT: 103e: 640d lui s0, 0x3
26+ # CHECK-NEXT: 1040 : 8800 sb s0, 0x0(s0) <zcb >
27+ # CHECK-NEXT: 1042 : 4522 lw a0 , 0x8( sp )
28+
2929
3030.global _start
3131.text
3232
33- # The core of the feature being added was address resolution for instruction
34- # sequences where a register is populated by immediate values via two
33+ # The core of the feature being added was address resolution for instruction
34+ # sequences where an register is populated by immediate values via two
3535# separate instructions. First by an instruction that provides the upper bits
3636# (auipc, lui ...) followed by another instruction for the lower bits (addi ,
3737# jalr, ld ...).
3838
39-
4039_start:
41- # Test block 1-3 each focus on a certain starting instruction in a sequences,
40+ # Test block 1-3 each focus on a certain starting instruction in a sequences,
4241 # the ones that provide the upper bits. The other sequence is another
4342 # instruction the provides the lower bits. The second instruction is
4443 # arbitrarily chosen to increase code coverage
@@ -69,7 +68,7 @@ _start:
6968 lui a1 , 0x1 # unrelated instruction
7069 slli t1, t1, 0x1 # unrelated instruction
7170 addi a0 , a0 , 0x4
72- addi a0 , a0 , 0x1
71+ addi a0 , a0 , 0x1 # verify register tracking terminates
7372
7473 # Test 5 ensures that an instruction writing into the zero register does
7574 # not trigger resolution because that register's value cannot change and
@@ -86,25 +85,21 @@ _start:
8685 call func
8786
8887 # test #7 zcb extension
89- lui x8, 0x102
90- # the immediate value for Zcb extension is heavily bounded, so we will relax
91- # the requirement of hitting one of the labels and focus on correctness of the
92- # resolution. This can be verified by looking at the source: The upper bits of
93- # lui make the far jump related to .skip 0x100000 and then 8 more bytes must be
94- # traversed before we hit far_target--.skip 0x4 and .word 1 in target. Adding 8
95- # to address resolved for the instruction below yields exactly the desired label.
88+ lui x8, 0x3
9689 c.sb x8, 0 (x8)
9790
9891 # test #8 stack based load/stores
99- lui sp , 0x102
10092 c.lwsp a0 , 0x8(sp )
10193
10294# these are the labels that the instructions above are expecteed to resolve to
10395.section .data
10496.skip 0x4
10597target:
10698 .word 1
107- .skip 0x100000
99+ .skip 0xff8
100+ zcb:
101+ .word 1
102+ .skip 0xff004
108103far_target:
109104 .word 2
110105func:
0 commit comments