mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-03 14:21:30 +00:00
[PowerPC] Load BlockAddress values from the TOC in 64-bit SVR4 code
Since block address values can be larger than 2GB in 64-bit code, they cannot be loaded simply using an @l / @ha pair, but instead must be loaded from the TOC, just like GlobalAddress, ConstantPool, and JumpTable values are. The commit also fixes a bug in PPCLinuxAsmPrinter::doFinalization where temporary labels could not be used as TOC values, since code would attempt (and fail) to use GetOrCreateSymbol to create a symbol of the same name as the temporary label. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
26
test/CodeGen/PowerPC/blockaddress.ll
Normal file
26
test/CodeGen/PowerPC/blockaddress.ll
Normal file
@@ -0,0 +1,26 @@
|
||||
; RUN: llc < %s -code-model=small -march=ppc64 -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=SMALL
|
||||
; RUN: llc < %s -code-model=medium -march=ppc64 -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM
|
||||
; RUN: llc < %s -code-model=large -march=ppc64 -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM
|
||||
; RUN: llc < %s -code-model=small -march=ppc64 -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=SMALL
|
||||
; RUN: llc < %s -code-model=medium -march=ppc64 -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM
|
||||
; RUN: llc < %s -code-model=large -march=ppc64 -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=MEDIUM
|
||||
|
||||
define i8* @test() {
|
||||
entry:
|
||||
br label %here
|
||||
|
||||
here: ; preds = %entry
|
||||
; MEDIUM: .Ltmp[[TMP0:[0-9]+]]:
|
||||
; MEDIUM: addis [[R0:[0-9]+]], 2, .LC[[LC0:[0-9]+]]@toc@ha
|
||||
; MEDIUM: ld 3, .LC[[LC0]]@toc@l([[R0]])
|
||||
; MEDIUM: blr
|
||||
; MEDIUM: .LC[[LC0]]:
|
||||
; MEDIUM: .tc .Ltmp[[TMP0]][TC],.Ltmp[[TMP0]]
|
||||
; SMALL: .Ltmp[[TMP0:[0-9]+]]:
|
||||
; SMALL: ld 3, .LC[[LC0:[0-9]+]]@toc(2)
|
||||
; SMALL: blr
|
||||
; SMALL: .LC[[LC0]]:
|
||||
; SMALL: .tc .Ltmp[[TMP0]][TC],.Ltmp[[TMP0]]
|
||||
ret i8* blockaddress(@test, %here)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user