blob: db9d481ac6ab000fcdf78cf607252880a1ae4917 [file] [log] [blame]
Nemanja Ivanovicd9d5bd32018-03-19 18:50:02 +00001; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu %s -o - | FileCheck %s
2
3; Check that codegen for an addrspace cast succeeds without error.
4define <4 x i32 addrspace(1)*> @f (<4 x i32*> %x) {
5 %1 = addrspacecast <4 x i32*> %x to <4 x i32 addrspace(1)*>
6 ret <4 x i32 addrspace(1)*> %1
7 ; CHECK-LABEL: @f
8}
9
10; Check that fairly complicated addrspace cast and operations succeed without error.
11%struct = type opaque
12define void @g (%struct addrspace(10)** %x) {
13 %1 = load %struct addrspace(10)*, %struct addrspace(10)** %x
14 %2 = addrspacecast %struct addrspace(10)* %1 to %struct addrspace(11)*
15 %3 = bitcast %struct addrspace(11)* %2 to i8 addrspace(11)*
16 %4 = getelementptr i8, i8 addrspace(11)* %3, i64 16
17 %5 = bitcast i8 addrspace(11)* %4 to %struct addrspace(10)* addrspace(11)*
18 %6 = load %struct addrspace(10)*, %struct addrspace(10)* addrspace(11)* %5
19 store %struct addrspace(10)* %6, %struct addrspace(10)** undef
20 ret void
21 ; CHECK-LABEL: @g
22}