xref: /llvm-project/llvm/test/tools/llvm-objdump/ELF/ARM/literal-arm.s (revision a657440bc695a98c54cd95bb7cc4cec5ab811d17)
1@@ Check that PC-relative memory addressing is annotated
2
3@ RUN: llvm-mc %s -triple=armv7 -filetype=obj | \
4@ RUN:   llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv7 - | \
5@ RUN:   FileCheck %s
6
7.text
8foo:
9@ CHECK:      00000000 <foo>:
10  .word 0x01020304
11
12_start:
13@ CHECK:      00000004 <_start>:
14
15@@ Check a special case immediate for AddrMode_i12
16  ldr   r1, [pc, #-0]
17@ CHECK-NEXT:    4: ldr   r1, [pc, #-0]           @ 0xc <_start+0x8>
18
19@@ Check AddrMode_i12 instructions, with positive and negative immediates
20  ldr   r0, foo
21  ldrb  r0, bar
22  pli   _start
23  pld   bar
24@ CHECK-NEXT:    8: ldr   r0, [pc, #-16]          @ 0x0 <foo>
25@ CHECK-NEXT:    c: ldrb  r0, [pc, #48]           @ 0x44 <bar>
26@ CHECK-NEXT:   10: pli   [pc, #-20]              @ 0x4 <_start>
27@ CHECK-NEXT:   14: pld   [pc, #40]               @ 0x44 <bar>
28
29@@ Check that AddrMode_i12 instructions that do not use PC-relative addressing
30@@ are not annotated
31  ldr   r0, [r1, #8]
32@ CHECK-NEXT:   18: ldr   r0, [r1, #8]{{$}}
33
34@@ Check AddrMode3 instructions, with positive and negative immediates
35  ldrd  r0, r1, foo
36  ldrh  r0, bar
37@ CHECK-NEXT:   1c: ldrd  r0, r1, [pc, #-36]      @ 0x0 <foo>
38@ CHECK-NEXT:   20: ldrh  r0, [pc, #28]           @ 0x44 <bar>
39
40@@ Check that AddrMode3 instruction that do not use PC+imm addressing are not
41@@ annotated
42  ldrh  r0, [r1, #8]
43  ldrh  r0, [pc, r2]
44@ CHECK-NEXT:   24: ldrh  r0, [r1, #8]{{$}}
45@ CHECK-NEXT:   28: ldrh  r0, [pc, r2]{{$}}
46
47@@ Check AddrMode5 instructions, with positive and negative immediates
48  ldc   p14, c5, foo
49  ldcl  p6, c4, bar
50  ldc2  p5, c2, foo
51  ldc2l p3, c1, bar
52@ CHECK-NEXT:   2c: ldc   p14, c5, [pc, #-52]     @ 0x0 <foo>
53@ CHECK-NEXT:   30: ldcl  p6, c4, [pc, #12]       @ 0x44 <bar>
54@ CHECK-NEXT:   34: ldc2  p5, c2, [pc, #-60]      @ 0x0 <foo>
55@ CHECK-NEXT:   38: ldc2l p3, c1, [pc, #4]        @ 0x44 <bar>
56
57@@ Check that AddrMode5 instruction that do not use PC+imm addressing are not
58@@ annotated
59  ldc   p14, c5, [r1, #8]
60  ldc   p14, c5, [pc], {16}
61@ CHECK-NEXT:   3c: ldc   p14, c5, [r1, #8]{{$}}
62@ CHECK-NEXT:   40: ldc   p14, c5, [pc], {16}{{$}}
63
64bar:
65@ CHECK:      00000044 <bar>:
66  .word 0x01020304
67