mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-30 23:42:52 +01:00
7e501cf4c3
This update was done with the following bash script: find test/CodeGen -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc.*debug" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_-]*\):\( *\)$FUNC: *\$/;\1\2-LABEL:\3$FUNC:/g" $TEMP done sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP mv $TEMP $NAME fi done llvm-svn: 186280
71 lines
2.0 KiB
LLVM
71 lines
2.0 KiB
LLVM
; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s
|
|
; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -relocation-model=pic -filetype=obj %s -o -| llvm-objdump -r - | FileCheck --check-prefix=CHECK-ELF %s
|
|
|
|
@var = global i32 0
|
|
|
|
; CHECK-ELF: RELOCATION RECORDS FOR [.rela.text]
|
|
|
|
define i32 @get_globalvar() {
|
|
; CHECK-LABEL: get_globalvar:
|
|
|
|
%val = load i32* @var
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
|
|
; CHECK: ldr x[[GOTLOC:[0-9]+]], [x[[GOTHI]], #:got_lo12:var]
|
|
; CHECK: ldr w0, [x[[GOTLOC]]]
|
|
|
|
; CHECK-ELF: R_AARCH64_ADR_GOT_PAGE var
|
|
; CHECK-ELF: R_AARCH64_LD64_GOT_LO12_NC var
|
|
ret i32 %val
|
|
}
|
|
|
|
define i32* @get_globalvaraddr() {
|
|
; CHECK-LABEL: get_globalvaraddr:
|
|
|
|
%val = load i32* @var
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
|
|
; CHECK: ldr x0, [x[[GOTHI]], #:got_lo12:var]
|
|
|
|
; CHECK-ELF: R_AARCH64_ADR_GOT_PAGE var
|
|
; CHECK-ELF: R_AARCH64_LD64_GOT_LO12_NC var
|
|
ret i32* @var
|
|
}
|
|
|
|
@hiddenvar = hidden global i32 0
|
|
|
|
define i32 @get_hiddenvar() {
|
|
; CHECK-LABEL: get_hiddenvar:
|
|
|
|
%val = load i32* @hiddenvar
|
|
; CHECK: adrp x[[HI:[0-9]+]], hiddenvar
|
|
; CHECK: ldr w0, [x[[HI]], #:lo12:hiddenvar]
|
|
|
|
; CHECK-ELF: R_AARCH64_ADR_PREL_PG_HI21 hiddenvar
|
|
; CHECK-ELF: R_AARCH64_LDST32_ABS_LO12_NC hiddenvar
|
|
ret i32 %val
|
|
}
|
|
|
|
define i32* @get_hiddenvaraddr() {
|
|
; CHECK-LABEL: get_hiddenvaraddr:
|
|
|
|
%val = load i32* @hiddenvar
|
|
; CHECK: adrp [[HI:x[0-9]+]], hiddenvar
|
|
; CHECK: add x0, [[HI]], #:lo12:hiddenvar
|
|
|
|
; CHECK-ELF: R_AARCH64_ADR_PREL_PG_HI21 hiddenvar
|
|
; CHECK-ELF: R_AARCH64_ADD_ABS_LO12_NC hiddenvar
|
|
ret i32* @hiddenvar
|
|
}
|
|
|
|
define void()* @get_func() {
|
|
; CHECK-LABEL: get_func:
|
|
|
|
ret void()* bitcast(void()*()* @get_func to void()*)
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:get_func
|
|
; CHECK: ldr x0, [x[[GOTHI]], #:got_lo12:get_func]
|
|
|
|
; Particularly important that the ADRP gets a relocation, LLVM tends to think
|
|
; it can relax it because it knows where get_func is. It can't!
|
|
; CHECK-ELF: R_AARCH64_ADR_GOT_PAGE get_func
|
|
; CHECK-ELF: R_AARCH64_LD64_GOT_LO12_NC get_func
|
|
}
|