[Alignment][NFC] Instructions::getLoadStoreAlignment
[llvm-complete.git] / test / ExecutionEngine / RuntimeDyld / AArch64 / ELF_ARM64_relocations.s
blobeb0eb83672ee60217f051386d83ffdac08d9dfbc
1 # RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %t %s
2 # RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -dummy-extern symbol=0xf00f -check=%s %t
4 .globl Q
5 .section .dummy, "ax"
6 Q:
7 nop
9 .text
10 .globl g
11 .p2align 2
12 .type g,@function
14 # R_AARCH64_MOVW_UABS_G3
15 movz x0, #:abs_g3:f
16 # R_AARCH64_MOVW_UABS_G2_NC
17 movk x0, #:abs_g2_nc:f
18 # R_AARCH64_MOVW_UABS_G1_NC
19 movk x0, #:abs_g1_nc:f
20 # R_AARCH64_MOVW_UABS_G0_NC
21 movk x0, #:abs_g0_nc:f
23 # R_AARCH64_LDST8_ABS_LO12_NC
24 ldrsb x4, [x5, :lo12:a+1]
25 # R_AARCH64_LDST16_ABS_LO12_NC
26 ldrh w4, [x5, :lo12:a+2]
27 # R_AARCH64_LDST32_ABS_LO12_NC
28 ldr s4, [x5, :lo12:a]
29 # R_AARCH64_LDST64_ABS_LO12_NC
30 ldr x4, [x5, :lo12:a]
31 # R_AARCH64_LDST128_ABS_LO12_NC
32 ldr q4, [x5, :lo12:a]
34 # R_AARCH64_ADR_PREL_PG_HI21
35 # Test both low and high immediate values
36 adrp x4, a + 20480 // 16384 + 4096
37 # Align next label to 16 bytes, so that LDST immediate
38 # fields will be non-zero
39 .align 4
41 # R_AARCH64_ADD_ABS_LO12_NC
42 add x0, x0, :lo12:f
43 ret
44 .Lfunc_end0:
45 .size g, .Lfunc_end0-g
47 .type k,@object
48 .data
49 .globl k
50 .p2align 3
52 .xword f
53 .size k, 16
55 # R_AARCH64_PREL32: use Q instead of f to fit in 32 bits.
56 .word Q - .
57 # R_AARCH64_PREL64
58 .p2align 3
59 .xword f - .
61 # rtdyld-check: *{4}(g) = 0xd2e02460
62 # rtdyld-check: *{4}(g + 4) = 0xf2c8ace0
63 # rtdyld-check: *{4}(g + 8) = 0xf2b13560
64 # rtdyld-check: *{4}(g + 12) = 0xf299bde0
66 ## Check LDSTXX_ABS_LO12_NC
67 # rtdyld-check: (*{4}l)[21:10] = (a+1)[11:0]
68 # rtdyld-check: (*{4}(l+4))[21:10] = (a+2)[11:1]
69 # rtdyld-check: (*{4}(l+8))[21:10] = a[11:2]
70 # rtdyld-check: (*{4}(l+12))[21:10] = a[11:3]
71 # rtdyld-check: (*{4}(l+16))[21:10] = a[11:4]
73 ## Check ADR_PREL_PG_HI21. Low order bits of immediate value
74 ## go to bits 30:29. High order bits go to bits 23:5
75 # rtdyld-check: (*{4}p)[30:29] = (a - p + 20480)[13:12]
76 # rtdyld-check: (*{4}p)[23:5] = (a - p + 20480)[32:14]
78 # rtdyld-check: *{8}k = f
79 # rtdyld-check: *{4}r = (Q - r)[31:0]
80 # rtdyld-check: *{8}(r + 8) = f - r - 8
82 ## f & 0xFFF = 0xdef (bits 11:0 of f)
83 ## 0xdef << 10 = 0x37bc00
84 # rtdyld-check: *{4}(a) = 0x9137bc00
86 .data
87 ABS16:
88 .short symbol
89 # rtdyld-check: (*{2}ABS16) = symbol[15:0]
90 ABS32:
91 .long symbol
92 # rtdyld-check: (*{4}ABS32) = symbol[31:0]
93 ABS64:
94 .xword symbol
95 # rtdyld-check: (*{8}ABS64) = symbol