diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2014-10-31 10:33:14 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2014-10-31 10:33:14 +0000 |
commit | 8a9c531e9adfdd7fee915fbcfb9ecad18da5674c (patch) | |
tree | e3bddf4039fa2f7a8b74205c46792f4dcf87e9c4 /test/CodeGen/PowerPC/blockaddress.ll | |
parent | 42187d2c0029969f3b6239e54b4cc5ed31e4d9e0 (diff) |
[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
Diffstat (limited to 'test/CodeGen/PowerPC/blockaddress.ll')
-rw-r--r-- | test/CodeGen/PowerPC/blockaddress.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/blockaddress.ll b/test/CodeGen/PowerPC/blockaddress.ll new file mode 100644 index 00000000000..c1981e21fff --- /dev/null +++ b/test/CodeGen/PowerPC/blockaddress.ll @@ -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) +} + |