Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / loh-adrp-adrp.s
blob55d6a614f374e665a912b49045bb44dff8c14b2d
1 # REQUIRES: aarch64
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
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
26 .text
27 .align 2
29 .globl _main
30 _main:
31 L1:
32 adrp x0, _foo@PAGE
33 L2:
34 adrp x0, _bar@PAGE
35 L3:
36 adrp x1, _foo@PAGE
37 L4:
38 adrp x2, _bar@PAGE
39 L5:
40 adrp x3, _foo@PAGE
41 L6:
42 adrp x3, _baz@PAGE
43 L7:
44 nop
45 L8:
46 adrp x4, _baz@PAGE
47 L9:
48 adrp x5, _foo@PAGE
49 L10:
50 add x6, x5, _foo@PAGEOFF
51 L11:
52 adrp x5, _bar@PAGE
53 L12:
54 add x6, x5, _bar@PAGEOFF
56 .data
57 .align 12
58 _foo:
59 .byte 0
60 _bar:
61 .byte 0
62 .space 4094
63 _baz:
64 .byte 0
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