File: arm-adr-long.s

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (42 lines) | stat: -rw-r--r-- 1,383 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// REQUIRES: arm
// RUN: llvm-mc --triple=armv7a-none-eabi --arm-add-build-attributes -filetype=obj -o %t.o %s
// RUN: echo "SECTIONS { \
// RUN:                 .text.0 0x10000000 : AT(0x10000000) { *(.text.0) } \
// RUN:                 .text.1 0x80000000 : AT(0x80000000) { *(.text.1) } \
// RUN:                 .text.2 0xf0000010 : AT(0xf0000010) { *(.text.2) } \
// RUN:               } " > %t.script
// RUN: ld.lld --script %t.script %t.o -o %t
// RUN: llvm-objdump -d --no-show-raw-insn --triple=armv7a-none-eabi %t | FileCheck %s

/// Test the long range encoding of R_ARM_ALU_PC_G0. We can encode an 8-bit
/// immediate rotated right by an even 4-bit field.
 .section .text.0, "ax", %progbits
dat1:
 .word 0

 .section .text.1, "ax", %progbits
 .global _start
 .type _start, %function
_start:
/// adr.w r0, dat1
 .inst 0xe24f0008
 .reloc 0, R_ARM_ALU_PC_G0, dat1
/// adr.w r1, dat2
 .inst 0xe24f1008
 .reloc 4, R_ARM_ALU_PC_G0, dat2

 .section .text.2, "ax", %progbits
dat2:
 .word 0

// CHECK:      10000000 <dat1>:
// CHECK-NEXT: 10000000: andeq   r0, r0, r0

// CHECK:      80000000 <_start>:
/// 0x80000000 + 0x8 - 0x70000008 = 0x10000000
// CHECK-NEXT: 80000000: sub     r0, pc, #1879048200
/// 0x80000004 + 0x8 + 0x70000004 = 0xf0000010
// CHECK-NEXT: 80000004: add     r1, pc, #1879048196

// CHECK:      f0000010 <dat2>:
// CHECK-NEXT: f0000010: andeq   r0, r0, r0