Sanjoy Das | 1c20b71 | 2016-07-28 23:43:38 +0000 | [diff] [blame] | 1 | ; RUN: not opt -verify < %s 2>&1 | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-ni:4:6" |
| 4 | |
| 5 | define 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 | |
| 11 | define <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 | |
| 17 | define 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 | |
| 23 | define 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 | |
| 29 | define <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 | |
| 35 | define 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 | |
| 41 | define 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 Das | 308cf93 | 2016-08-02 02:55:57 +0000 | [diff] [blame] | 46 | |
| 47 | define 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 | |
| 54 | define i64 @f_8() { |
| 55 | ; CHECK: ptrtoint not supported for non-integral pointers |
| 56 | ret i64 ptrtoint (i8 addrspace(4)* @global0 to i64) |
| 57 | } |
Sanjoy Das | f21ab36 | 2016-08-02 03:23:22 +0000 | [diff] [blame] | 58 | |
| 59 | define 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 Das | f9a5081 | 2016-08-02 23:32:53 +0000 | [diff] [blame] | 66 | define i8 addrspace(4)* @f_10() { |
Sanjoy Das | f21ab36 | 2016-08-02 03:23:22 +0000 | [diff] [blame] | 67 | ; 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 Das | f9a5081 | 2016-08-02 23:32:53 +0000 | [diff] [blame] | 70 | |
| 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 | |
| 74 | define 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 | |
| 81 | define i64 addrspace(4)* @f_12() { |
| 82 | ; CHECK: ptrtoint not supported for non-integral pointers |
| 83 | ret i64 addrspace(4)* @cycle_self |
| 84 | } |