llvm-6502/test/Other/multi-pointer-size.ll
Micah Villmow aa76e9e2cf Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the
clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 15:52:52 +00:00

44 lines
1.3 KiB
LLVM

; RUN: opt -instcombine %s | llvm-dis | FileCheck %s
target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16--p4:96:96:96-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
define i32 @test_as0(i32 addrspace(0)* %A) {
entry:
; CHECK: %arrayidx = getelementptr i32* %A, i32 1
%arrayidx = getelementptr i32 addrspace(0)* %A, i64 1
%y = load i32 addrspace(0)* %arrayidx, align 4
ret i32 %y
}
define i32 @test_as1(i32 addrspace(1)* %A) {
entry:
; CHECK: %arrayidx = getelementptr i32 addrspace(1)* %A, i64 1
%arrayidx = getelementptr i32 addrspace(1)* %A, i32 1
%y = load i32 addrspace(1)* %arrayidx, align 4
ret i32 %y
}
define i32 @test_as2(i32 addrspace(2)* %A) {
entry:
; CHECK: %arrayidx = getelementptr i32 addrspace(2)* %A, i8 1
%arrayidx = getelementptr i32 addrspace(2)* %A, i32 1
%y = load i32 addrspace(2)* %arrayidx, align 4
ret i32 %y
}
define i32 @test_as3(i32 addrspace(3)* %A) {
entry:
; CHECK: %arrayidx = getelementptr i32 addrspace(3)* %A, i16 1
%arrayidx = getelementptr i32 addrspace(3)* %A, i32 1
%y = load i32 addrspace(3)* %arrayidx, align 4
ret i32 %y
}
define i32 @test_as4(i32 addrspace(4)* %A) {
entry:
; CHECK: %arrayidx = getelementptr i32 addrspace(4)* %A, i96 1
%arrayidx = getelementptr i32 addrspace(4)* %A, i32 1
%y = load i32 addrspace(4)* %arrayidx, align 4
ret i32 %y
}