OLD | NEW |
1 ; RUN: not pnacl-abicheck < %s | FileCheck %s | 1 ; RUN: not pnacl-abicheck < %s | FileCheck %s |
2 | 2 |
3 ; Most arithmetic operations are not very useful on i1, so use of i1 | 3 ; Most arithmetic operations are not very useful on i1, so use of i1 |
4 ; is restricted to a subset of operations. | 4 ; is restricted to a subset of operations. |
5 | 5 |
6 | 6 |
7 ; i1 is allowed on these bitwise operations because: | 7 ; i1 is allowed on these bitwise operations because: |
8 ; * These operations never overflow. | 8 ; * These operations never overflow. |
9 ; * They do get generated in practice for combining conditions. | 9 ; * They do get generated in practice for combining conditions. |
10 define internal void @allowed_cases() { | 10 define internal void @allowed_cases() { |
11 %and = and i1 0, 0 | 11 %and = and i1 0, 0 |
12 %or = or i1 0, 0 | 12 %or = or i1 0, 0 |
13 %xor = xor i1 0, 0 | 13 %xor = xor i1 0, 0 |
| 14 |
| 15 %v4and = and <4 x i1> undef, undef |
| 16 %v4or = or <4 x i1> undef, undef |
| 17 %v4xor = xor <4 x i1> undef, undef |
| 18 |
| 19 %v8and = and <8 x i1> undef, undef |
| 20 %v8or = or <8 x i1> undef, undef |
| 21 %v8xor = xor <8 x i1> undef, undef |
| 22 |
| 23 %v16and = and <16 x i1> undef, undef |
| 24 %v16or = or <16 x i1> undef, undef |
| 25 %v16xor = xor <16 x i1> undef, undef |
14 ret void | 26 ret void |
15 } | 27 } |
16 ; CHECK-NOT: disallowed | 28 ; CHECK-NOT: disallowed |
17 | 29 |
18 | 30 |
19 define internal void @rejected_cases(i32 %ptr) { | 31 define internal void @rejected_cases(i32 %ptr) { |
20 ; Loads and stores of i1 are disallowed. This is done by rejecting | 32 ; Loads and stores of i1 are disallowed. This is done by rejecting |
21 ; i1* as a pointer type. | 33 ; i1* as a pointer type. |
22 %ptr.p = inttoptr i32 %ptr to i1* | 34 %ptr.p = inttoptr i32 %ptr to i1* |
23 ; CHECK: disallowed: bad result type: %ptr.p = inttoptr | 35 ; CHECK: disallowed: bad result type: i1* %ptr.p = inttoptr |
| 36 %vptr.p = inttoptr i32 %ptr to <4 x i1>* |
| 37 ; CHECK: disallowed: bad result type: <4 x i1>* %vptr.p = inttoptr |
24 load i1* %ptr.p, align 1 | 38 load i1* %ptr.p, align 1 |
25 ; CHECK-NEXT: disallowed: bad pointer: {{.*}} load i1* | 39 ; CHECK-NEXT: disallowed: bad pointer: {{.*}} load i1* |
| 40 load <4 x i1>* %vptr.p, align 4 |
| 41 ; CHECK-NEXT: disallowed: bad pointer: {{.*}} load <4 x i1>* |
26 | 42 |
27 ; i1 arithmetic is of dubious usefulness, so it is rejected. | 43 ; i1 arithmetic is of dubious usefulness, so it is rejected. |
28 add i1 0, 0 | 44 add i1 0, 0 |
29 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} add | 45 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} add i1 |
30 sub i1 0, 0 | 46 sub i1 0, 0 |
31 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} sub | 47 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} sub i1 |
32 mul i1 0, 0 | 48 mul i1 0, 0 |
33 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} mul | 49 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} mul i1 |
34 udiv i1 0, 0 | 50 udiv i1 0, 0 |
35 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} udiv | 51 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} udiv i1 |
36 sdiv i1 0, 0 | 52 sdiv i1 0, 0 |
37 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} sdiv | 53 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} sdiv i1 |
38 urem i1 0, 0 | 54 urem i1 0, 0 |
39 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} urem | 55 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} urem i1 |
40 srem i1 0, 0 | 56 srem i1 0, 0 |
41 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} srem | 57 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} srem i1 |
42 shl i1 0, 0 | 58 shl i1 0, 0 |
43 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} shl | 59 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} shl i1 |
44 lshr i1 0, 0 | 60 lshr i1 0, 0 |
45 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} lshr | 61 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} lshr i1 |
46 ashr i1 0, 0 | 62 ashr i1 0, 0 |
47 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} ashr | 63 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} ashr i1 |
| 64 add <4 x i1> undef, undef |
| 65 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} add <4 x i1> |
| 66 sub <4 x i1> undef, undef |
| 67 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} sub <4 x i1> |
| 68 mul <4 x i1> undef, undef |
| 69 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} mul <4 x i1> |
| 70 udiv <4 x i1> undef, undef |
| 71 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} udiv <4 x i1> |
| 72 sdiv <4 x i1> undef, undef |
| 73 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} sdiv <4 x i1> |
| 74 urem <4 x i1> undef, undef |
| 75 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} urem <4 x i1> |
| 76 srem <4 x i1> undef, undef |
| 77 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} srem <4 x i1> |
| 78 shl <4 x i1> undef, undef |
| 79 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} shl <4 x i1> |
| 80 lshr <4 x i1> undef, undef |
| 81 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} lshr <4 x i1> |
| 82 ashr <4 x i1> undef, undef |
| 83 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} ashr <4 x i1> |
| 84 add <8 x i1> undef, undef |
| 85 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} add <8 x i1> |
| 86 sub <8 x i1> undef, undef |
| 87 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} sub <8 x i1> |
| 88 mul <8 x i1> undef, undef |
| 89 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} mul <8 x i1> |
| 90 udiv <8 x i1> undef, undef |
| 91 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} udiv <8 x i1> |
| 92 sdiv <8 x i1> undef, undef |
| 93 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} sdiv <8 x i1> |
| 94 urem <8 x i1> undef, undef |
| 95 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} urem <8 x i1> |
| 96 srem <8 x i1> undef, undef |
| 97 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} srem <8 x i1> |
| 98 shl <8 x i1> undef, undef |
| 99 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} shl <8 x i1> |
| 100 lshr <8 x i1> undef, undef |
| 101 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} lshr <8 x i1> |
| 102 ashr <8 x i1> undef, undef |
| 103 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} ashr <8 x i1> |
| 104 add <16 x i1> undef, undef |
| 105 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} add <16 x i1> |
| 106 sub <16 x i1> undef, undef |
| 107 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} sub <16 x i1> |
| 108 mul <16 x i1> undef, undef |
| 109 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} mul <16 x i1> |
| 110 udiv <16 x i1> undef, undef |
| 111 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} udiv <16 x i1> |
| 112 sdiv <16 x i1> undef, undef |
| 113 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} sdiv <16 x i1> |
| 114 urem <16 x i1> undef, undef |
| 115 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} urem <16 x i1> |
| 116 srem <16 x i1> undef, undef |
| 117 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} srem <16 x i1> |
| 118 shl <16 x i1> undef, undef |
| 119 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} shl <16 x i1> |
| 120 lshr <16 x i1> undef, undef |
| 121 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} lshr <16 x i1> |
| 122 ashr <16 x i1> undef, undef |
| 123 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} ashr <16 x i1> |
48 | 124 |
49 ; The same applies to i1 comparisons. | 125 ; The same applies to i1 comparisons. |
50 icmp eq i1 0, 0 | 126 icmp eq i1 0, 0 |
51 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} icmp eq | 127 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} icmp eq i1 |
52 icmp ult i1 0, 0 | 128 icmp ult i1 0, 0 |
53 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} icmp ult | 129 ; CHECK-NEXT: disallowed: arithmetic on i1: {{.*}} icmp ult i1 |
| 130 icmp eq <4 x i1> undef, undef |
| 131 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} icmp eq <4 x i1> |
| 132 icmp ult <4 x i1> undef, undef |
| 133 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} icmp ult <4 x i1> |
| 134 icmp eq <8 x i1> undef, undef |
| 135 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} icmp eq <8 x i1> |
| 136 icmp ult <8 x i1> undef, undef |
| 137 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} icmp ult <8 x i1> |
| 138 icmp eq <16 x i1> undef, undef |
| 139 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} icmp eq <16 x i1> |
| 140 icmp ult <16 x i1> undef, undef |
| 141 ; CHECK-NEXT: disallowed: arithmetic on vector of i1: {{.*}} icmp ult <16 x i1> |
54 | 142 |
55 ; There should be no implicit zero-extension in alloca. | 143 ; There should be no implicit zero-extension in alloca. |
56 alloca i8, i1 1 | 144 alloca i8, i1 1 |
57 ; CHECK-NEXT: disallowed: alloca array size is not i32 | 145 ; CHECK-NEXT: disallowed: alloca array size is not i32 |
58 | 146 |
59 ; Switch on i1 is not useful. "br" should be used instead. | 147 ; Switch on i1 is not useful. "br" should be used instead. |
60 switch i1 0, label %next [i1 0, label %next] | 148 switch i1 0, label %next [i1 0, label %next] |
61 ; CHECK-NEXT: disallowed: switch on i1 | 149 ; CHECK-NEXT: disallowed: switch on i1 |
62 next: | 150 next: |
63 | 151 |
64 ret void | 152 ret void |
65 } | 153 } |
66 ; CHECK-NOT: disallowed | 154 ; CHECK-NOT: disallowed |
OLD | NEW |