blob: b0be282007eff89de616c40a85a5e14e241d43e5 [file] [log] [blame]
Sanjoy Das1c20b712016-07-28 23:43:38 +00001; RUN: not opt -verify < %s 2>&1 | FileCheck %s
2
3target datalayout = "e-ni:4:6"
4
5define i64 @f_0(i8 addrspace(4)* %ptr) {
6; CHECK: ptrtoint not supported for non-integral pointers
7 %val = ptrtoint i8 addrspace(4)* %ptr to i64
8 ret i64 %val
9}
10
11define <4 x i64> @f_1(<4 x i8 addrspace(4)*> %ptr) {
12; CHECK: ptrtoint not supported for non-integral pointers
13 %val = ptrtoint <4 x i8 addrspace(4)*> %ptr to <4 x i64>
14 ret <4 x i64> %val
15}
16
17define i64 @f_2(i8 addrspace(3)* %ptr) {
18; Negative test
19 %val = ptrtoint i8 addrspace(3)* %ptr to i64
20 ret i64 %val
21}
22
23define i8 addrspace(4)* @f_3(i64 %integer) {
24; CHECK: inttoptr not supported for non-integral pointers
25 %val = inttoptr i64 %integer to i8 addrspace(4)*
26 ret i8 addrspace(4)* %val
27}
28
29define <4 x i8 addrspace(4)*> @f_4(<4 x i64> %integer) {
30; CHECK: inttoptr not supported for non-integral pointers
31 %val = inttoptr <4 x i64> %integer to <4 x i8 addrspace(4)*>
32 ret <4 x i8 addrspace(4)*> %val
33}
34
35define i8 addrspace(3)* @f_5(i64 %integer) {
36; Negative test
37 %val = inttoptr i64 %integer to i8 addrspace(3)*
38 ret i8 addrspace(3)* %val
39}
40
41define i64 @f_6(i8 addrspace(6)* %ptr) {
42; CHECK: ptrtoint not supported for non-integral pointers
43 %val = ptrtoint i8 addrspace(6)* %ptr to i64
44 ret i64 %val
45}
Sanjoy Das308cf932016-08-02 02:55:57 +000046
47define i8 addrspace(4)* @f_7() {
48; CHECK: inttoptr not supported for non-integral pointers
49 ret i8 addrspace(4)* inttoptr (i64 50 to i8 addrspace(4)*)
50}
51
52@global0 = addrspace(4) constant i8 42
53
54define i64 @f_8() {
55; CHECK: ptrtoint not supported for non-integral pointers
56 ret i64 ptrtoint (i8 addrspace(4)* @global0 to i64)
57}
Sanjoy Dasf21ab362016-08-02 03:23:22 +000058
59define i8 addrspace(4)* @f_9() {
60; CHECK: inttoptr not supported for non-integral pointers
61 ret i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* inttoptr (i64 55 to i8 addrspace(4)*), i32 100)
62}
63
64@global1 = addrspace(4) constant i8 42
65
Sanjoy Dasf9a50812016-08-02 23:32:53 +000066define i8 addrspace(4)* @f_10() {
Sanjoy Dasf21ab362016-08-02 03:23:22 +000067; CHECK: ptrtoint not supported for non-integral pointers
68 ret i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* @global0, i64 ptrtoint (i8 addrspace(4)* @global1 to i64))
69}
Sanjoy Dasf9a50812016-08-02 23:32:53 +000070
71@cycle_0 = addrspace(4) constant i64 ptrtoint (i64 addrspace(4)* addrspace(4)* @cycle_1 to i64)
72@cycle_1 = addrspace(4) constant i64 addrspace(4) * @cycle_0
73
74define i64 addrspace(4)* addrspace(4)* @f_11() {
75; CHECK: ptrtoint not supported for non-integral pointers
76 ret i64 addrspace(4)* addrspace(4)* @cycle_1
77}
78
79@cycle_self = addrspace(4) constant i64 ptrtoint (i64 addrspace(4)* @cycle_self to i64)
80
81define i64 addrspace(4)* @f_12() {
82; CHECK: ptrtoint not supported for non-integral pointers
83 ret i64 addrspace(4)* @cycle_self
84}