1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -verify -S < %s 2>&1 | FileCheck %s
4 target datalayout = "e-ni:4:6"
6 define i64 @f_0(i8 addrspace(4)* %ptr) {
8 ; CHECK-NEXT: [[VAL:%.*]] = ptrtoint i8 addrspace(4)* [[PTR:%.*]] to i64
9 ; CHECK-NEXT: ret i64 [[VAL]]
11 %val = ptrtoint i8 addrspace(4)* %ptr to i64
15 define <4 x i64> @f_1(<4 x i8 addrspace(4)*> %ptr) {
17 ; CHECK-NEXT: [[VAL:%.*]] = ptrtoint <4 x i8 addrspace(4)*> [[PTR:%.*]] to <4 x i64>
18 ; CHECK-NEXT: ret <4 x i64> [[VAL]]
20 %val = ptrtoint <4 x i8 addrspace(4)*> %ptr to <4 x i64>
24 define i64 @f_2(i8 addrspace(3)* %ptr) {
26 ; CHECK-NEXT: [[VAL:%.*]] = ptrtoint i8 addrspace(3)* [[PTR:%.*]] to i64
27 ; CHECK-NEXT: ret i64 [[VAL]]
29 %val = ptrtoint i8 addrspace(3)* %ptr to i64
33 define i8 addrspace(4)* @f_3(i64 %integer) {
35 ; CHECK-NEXT: [[VAL:%.*]] = inttoptr i64 [[INTEGER:%.*]] to i8 addrspace(4)*
36 ; CHECK-NEXT: ret i8 addrspace(4)* [[VAL]]
38 %val = inttoptr i64 %integer to i8 addrspace(4)*
39 ret i8 addrspace(4)* %val
42 define <4 x i8 addrspace(4)*> @f_4(<4 x i64> %integer) {
44 ; CHECK-NEXT: [[VAL:%.*]] = inttoptr <4 x i64> [[INTEGER:%.*]] to <4 x i8 addrspace(4)*>
45 ; CHECK-NEXT: ret <4 x i8 addrspace(4)*> [[VAL]]
47 %val = inttoptr <4 x i64> %integer to <4 x i8 addrspace(4)*>
48 ret <4 x i8 addrspace(4)*> %val
51 define i8 addrspace(3)* @f_5(i64 %integer) {
53 ; CHECK-NEXT: [[VAL:%.*]] = inttoptr i64 [[INTEGER:%.*]] to i8 addrspace(3)*
54 ; CHECK-NEXT: ret i8 addrspace(3)* [[VAL]]
56 %val = inttoptr i64 %integer to i8 addrspace(3)*
57 ret i8 addrspace(3)* %val
60 define i64 @f_6(i8 addrspace(6)* %ptr) {
62 ; CHECK-NEXT: [[VAL:%.*]] = ptrtoint i8 addrspace(6)* [[PTR:%.*]] to i64
63 ; CHECK-NEXT: ret i64 [[VAL]]
65 %val = ptrtoint i8 addrspace(6)* %ptr to i64
69 define i8 addrspace(4)* @f_7() {
71 ; CHECK-NEXT: ret i8 addrspace(4)* inttoptr (i64 50 to i8 addrspace(4)*)
73 ret i8 addrspace(4)* inttoptr (i64 50 to i8 addrspace(4)*)
76 @global0 = addrspace(4) constant i8 42
80 ; CHECK-NEXT: ret i64 ptrtoint (i8 addrspace(4)* @global0 to i64)
82 ret i64 ptrtoint (i8 addrspace(4)* @global0 to i64)
85 define i8 addrspace(4)* @f_9() {
87 ; CHECK-NEXT: ret i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* inttoptr (i64 55 to i8 addrspace(4)*), i32 100)
89 ret i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* inttoptr (i64 55 to i8 addrspace(4)*), i32 100)
92 @global1 = addrspace(4) constant i8 42
94 define i8 addrspace(4)* @f_10() {
96 ; CHECK-NEXT: ret i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* @global0, i64 ptrtoint (i8 addrspace(4)* @global1 to i64))
98 ret i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* @global0, i64 ptrtoint (i8 addrspace(4)* @global1 to i64))
101 @cycle_0 = addrspace(4) constant i64 ptrtoint (i64 addrspace(4)* addrspace(4)* @cycle_1 to i64)
102 @cycle_1 = addrspace(4) constant i64 addrspace(4) * @cycle_0
104 define i64 addrspace(4)* addrspace(4)* @f_11() {
105 ; CHECK-LABEL: @f_11(
106 ; CHECK-NEXT: ret i64 addrspace(4)* addrspace(4)* @cycle_1
108 ret i64 addrspace(4)* addrspace(4)* @cycle_1
111 @cycle_self = addrspace(4) constant i64 ptrtoint (i64 addrspace(4)* @cycle_self to i64)
113 define i64 addrspace(4)* @f_12() {
114 ; CHECK-LABEL: @f_12(
115 ; CHECK-NEXT: ret i64 addrspace(4)* @cycle_self
117 ret i64 addrspace(4)* @cycle_self