llvm-project
72 строки · 1.1 Кб
1# REQUIRES: aarch64
2
3# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o
4# RUN: %lld -arch arm64 %t.o -o %t
5# RUN: llvm-objdump -d --macho %t | FileCheck %s
6
7# CHECK-LABEL: _main:
8## Valid
9# CHECK-NEXT: adrp x0
10# CHECK-NEXT: nop
11## Mismatched registers
12# CHECK-NEXT: adrp x1
13# CHECK-NEXT: adrp x2
14## Not on the same page
15# CHECK-NEXT: adrp x3
16# CHECK-NEXT: adrp x3
17## Not an adrp instruction (invalid)
18# CHECK-NEXT: nop
19# CHECK-NEXT: adrp x4
20## Other relaxations take precedence over AdrpAdrp
21# CHECK-NEXT: adr x6
22# CHECK-NEXT: nop
23# CHECK-NEXT: adr x6
24# CHECK-NEXT: nop
25
26.text
27.align 2
28
29.globl _main
30_main:
31L1:
32adrp x0, _foo@PAGE
33L2:
34adrp x0, _bar@PAGE
35L3:
36adrp x1, _foo@PAGE
37L4:
38adrp x2, _bar@PAGE
39L5:
40adrp x3, _foo@PAGE
41L6:
42adrp x3, _baz@PAGE
43L7:
44nop
45L8:
46adrp x4, _baz@PAGE
47L9:
48adrp x5, _foo@PAGE
49L10:
50add x6, x5, _foo@PAGEOFF
51L11:
52adrp x5, _bar@PAGE
53L12:
54add x6, x5, _bar@PAGEOFF
55
56.data
57.align 12
58_foo:
59.byte 0
60_bar:
61.byte 0
62.space 4094
63_baz:
64.byte 0
65
66.loh AdrpAdrp L1, L2
67.loh AdrpAdrp L3, L4
68.loh AdrpAdrp L5, L6
69.loh AdrpAdrp L7, L8
70.loh AdrpAdrp L9, L11
71.loh AdrpAdd L9, L10
72.loh AdrpAdd L11, L12
73