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 --no-print-imm-hex -d --macho %t | FileCheck %s
19 ## Out of range, before
20 L1
: adrp x0
, _before_far@PAGE
21 L2
: ldr x0
, [x0
, _before_far@PAGEOFF
]
26 L3
: adrp x1
, _before_near@PAGE
27 L4
: ldr x1
, [x1
, _before_near@PAGEOFF
]
29 # CHECK-NEXT: ldr x1, #-20
31 ## Registers don't match (invalid input)
32 L5
: adrp x2
, _before_near@PAGE
33 L6
: ldr x3
, [x3
, _before_near@PAGEOFF
]
37 ## Not an adrp instruction
39 L10
: ldr x5
, [x5
, _after_near@PAGEOFF
]
43 ## Not an ldr with an immediate offset
44 L11
: adrp x6
, _after_near@PAGE
47 # CHECK-NEXT: ldr x6, #0
49 ## Byte load, unsupported
50 L15
: adrp x8
, _after_near@PAGE
51 L16
: ldr b8
, [x8
, _after_near@PAGEOFF
]
55 ## Halfword load, unsupported
56 L17
: adrp x9
, _after_near@PAGE
57 L18
: ldr h9
, [x9
, _after_near@PAGEOFF
]
62 L19
: adrp x10
, _after_near@PAGE
63 L20
: ldr w10
, [x10
, _after_near@PAGEOFF
]
65 # CHECK-NEXT: ldr w10, _after_near
68 L21
: adrp x11
, _after_near@PAGE
+ 8
69 L22
: ldr x11
, [x11
, _after_near@PAGEOFF
+ 8]
73 ## Signed 32-bit read from 16-bit value, unsupported
74 L23
: adrp x12
, _after_near@PAGE
75 L24
: ldrsb w12
, [x12
, _after_near@PAGEOFF
]
76 # CHECK-NEXT: adrp x12
77 # CHECK-NEXT: ldrsb w12
79 ## 64-bit load from signed 32-bit value
80 L25
: adrp x13
, _after_near@PAGE
81 L26
: ldrsw x13
, [x13
, _after_near@PAGEOFF
]
83 # CHECK-NEXT: ldrsw x13, _after_near
85 ## Single precision FP read
86 L27
: adrp x14
, _after_near@PAGE
87 L28
: ldr s0
, [x14
, _after_near@PAGEOFF
]
89 # CHECK-NEXT: ldr s0, _after_near
91 ## Double precision FP read
92 L29
: adrp x15
, _after_near@PAGE
93 L30
: ldr d0
, [x15
, _after_near@PAGEOFF
]
95 # CHECK-NEXT: ldr d0, _after_near
97 ## Quad precision FP read
98 L31
: adrp x16
, _after_near@PAGE
99 L32
: ldr q0
, [x16
, _after_near@PAGEOFF
]
101 # CHECK-NEXT: ldr q0, _after_near
103 ## Out of range, after
104 L33
: adrp x17
, _after_far@PAGE
105 L34
: ldr x17
, [x17
, _after_far@PAGEOFF
]
106 # CHECK-NEXT: adrp x17
107 # CHECK-NEXT: ldr x17
123 .loh AdrpLdr L11, L12
124 .loh AdrpLdr L15, L16
125 .loh AdrpLdr L17, L18
126 .loh AdrpLdr L19, L20
127 .loh AdrpLdr L21, L22
128 .loh AdrpLdr L23, L24
129 .loh AdrpLdr L25, L26
130 .loh AdrpLdr L27, L28
131 .loh AdrpLdr L29, L30
132 .loh AdrpLdr L31, L32
133 .loh AdrpLdr L33, L34