mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-24 13:06:56 +00:00
3d47402f2e
In ELF and COFF an alias is just another offset in a section. There is no way to represent an alias to something in another file. In MachO, the spec has the N_INDR type which should allow for exactly that, but is not currently implemented. Given that it is specified but not implemented, we error in codegen to avoid miscompiling but don't reject aliases to declarations in the verifier to leave the option open of implementing it. In the past we have used alias to declarations as a way of implementing weakref, which is why it exists in some old tests which this patch updates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194705 91177308-0d34-0410-b5e6-96231b3b80d8
28 lines
942 B
LLVM
28 lines
942 B
LLVM
; RUN: llc -mcpu=pwr7 -O0 -code-model=medium <%s | FileCheck %s
|
|
; RUN: llc -mcpu=pwr7 -O0 -code-model=large <%s | FileCheck %s
|
|
|
|
; Test correct code generation for medium and large code model
|
|
; for loading and storing an aliased external variable.
|
|
|
|
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
|
|
target triple = "powerpc64-unknown-linux-gnu"
|
|
|
|
@a = external global i32
|
|
|
|
define signext i32 @test_external() nounwind {
|
|
entry:
|
|
%0 = load i32* @a, align 4
|
|
%inc = add nsw i32 %0, 1
|
|
store i32 %inc, i32* @a, align 4
|
|
ret i32 %0
|
|
}
|
|
|
|
; CHECK-LABEL: test_external:
|
|
; CHECK: addis [[REG1:[0-9]+]], 2, .LC[[TOCNUM:[0-9]+]]@toc@ha
|
|
; CHECK: ld [[REG2:[0-9]+]], .LC[[TOCNUM]]@toc@l([[REG1]])
|
|
; CHECK: lwz {{[0-9]+}}, 0([[REG2]])
|
|
; CHECK: stw {{[0-9]+}}, 0([[REG2]])
|
|
; CHECK: .section .toc
|
|
; CHECK: .LC[[TOCNUM]]:
|
|
; CHECK: .tc {{[a-z0-9A-Z_.]+}}[TC],{{[a-z0-9A-Z_.]+}}
|