OLD | NEW |
(Empty) | |
| 1 ; RUN: not pnacl-abicheck < %s | FileCheck %s |
| 2 |
| 3 ; Most arithmetic operations are not very useful on i1, so use of i1 |
| 4 ; is restricted to a subset of operations. |
| 5 |
| 6 |
| 7 ; i1 is allowed on these bitwise operations because: |
| 8 ; * These operations never overflow. |
| 9 ; * They do get generated in practice for combining conditions. |
| 10 define internal void @allowed_cases() { |
| 11 %and = and i1 0, 0 |
| 12 %or = or 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 |
| 26 ret void |
| 27 } |
| 28 ; CHECK-NOT: disallowed |
| 29 |
| 30 |
| 31 define internal void @rejected_cases(i32 %ptr) { |
| 32 ; Loads and stores of i1 are disallowed. This is done by rejecting |
| 33 ; i1* as a pointer type. |
| 34 %ptr.p = inttoptr i32 %ptr to i1* |
| 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 |
| 38 load i1* %ptr.p, align 1 |
| 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>* |
| 42 |
| 43 ; Check that we don't allow weird sizes. |
| 44 add i31 0, 0 |
| 45 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} add i31 |
| 46 |
| 47 ; i1 arithmetic is of dubious usefulness, so it is rejected. |
| 48 add i1 0, 0 |
| 49 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} add i1 |
| 50 sub i1 0, 0 |
| 51 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sub i1 |
| 52 mul i1 0, 0 |
| 53 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} = mul i1 |
| 54 udiv i1 0, 0 |
| 55 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} = udiv i1 |
| 56 sdiv i1 0, 0 |
| 57 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} = sdiv i1 |
| 58 urem i1 0, 0 |
| 59 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} = urem i1 |
| 60 srem i1 0, 0 |
| 61 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} = srem i1 |
| 62 shl i1 0, 0 |
| 63 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} = shl i1 |
| 64 lshr i1 0, 0 |
| 65 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} lshr i1 |
| 66 ashr i1 0, 0 |
| 67 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} ashr i1 |
| 68 add <4 x i1> undef, undef |
| 69 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} add <4 x i1> |
| 70 sub <4 x i1> undef, undef |
| 71 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sub <4 x i1> |
| 72 mul <4 x i1> undef, undef |
| 73 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} mul <4 x i1> |
| 74 udiv <4 x i1> undef, undef |
| 75 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} udiv <4 x i1> |
| 76 sdiv <4 x i1> undef, undef |
| 77 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sdiv <4 x i1> |
| 78 urem <4 x i1> undef, undef |
| 79 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} urem <4 x i1> |
| 80 srem <4 x i1> undef, undef |
| 81 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} srem <4 x i1> |
| 82 shl <4 x i1> undef, undef |
| 83 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} shl <4 x i1> |
| 84 lshr <4 x i1> undef, undef |
| 85 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} lshr <4 x i1> |
| 86 ashr <4 x i1> undef, undef |
| 87 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} ashr <4 x i1> |
| 88 add <8 x i1> undef, undef |
| 89 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} add <8 x i1> |
| 90 sub <8 x i1> undef, undef |
| 91 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sub <8 x i1> |
| 92 mul <8 x i1> undef, undef |
| 93 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} mul <8 x i1> |
| 94 udiv <8 x i1> undef, undef |
| 95 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} udiv <8 x i1> |
| 96 sdiv <8 x i1> undef, undef |
| 97 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sdiv <8 x i1> |
| 98 urem <8 x i1> undef, undef |
| 99 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} urem <8 x i1> |
| 100 srem <8 x i1> undef, undef |
| 101 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} srem <8 x i1> |
| 102 shl <8 x i1> undef, undef |
| 103 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} shl <8 x i1> |
| 104 lshr <8 x i1> undef, undef |
| 105 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} lshr <8 x i1> |
| 106 ashr <8 x i1> undef, undef |
| 107 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} ashr <8 x i1> |
| 108 add <16 x i1> undef, undef |
| 109 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} add <16 x i1> |
| 110 sub <16 x i1> undef, undef |
| 111 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sub <16 x i1> |
| 112 mul <16 x i1> undef, undef |
| 113 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} mul <16 x i1> |
| 114 udiv <16 x i1> undef, undef |
| 115 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} udiv <16 x i1> |
| 116 sdiv <16 x i1> undef, undef |
| 117 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} sdiv <16 x i1> |
| 118 urem <16 x i1> undef, undef |
| 119 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} urem <16 x i1> |
| 120 srem <16 x i1> undef, undef |
| 121 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} srem <16 x i1> |
| 122 shl <16 x i1> undef, undef |
| 123 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} shl <16 x i1> |
| 124 lshr <16 x i1> undef, undef |
| 125 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} lshr <16 x i1> |
| 126 ashr <16 x i1> undef, undef |
| 127 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} ashr <16 x i1> |
| 128 |
| 129 ; The same applies to i1 comparisons. |
| 130 icmp eq i1 0, 0 |
| 131 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp eq i1 |
| 132 icmp ult i1 0, 0 |
| 133 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp ult i1 |
| 134 icmp eq <4 x i1> undef, undef |
| 135 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp eq <4 x i
1> |
| 136 icmp ult <4 x i1> undef, undef |
| 137 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp ult <4 x
i1> |
| 138 icmp eq <8 x i1> undef, undef |
| 139 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp eq <8 x i
1> |
| 140 icmp ult <8 x i1> undef, undef |
| 141 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp ult <8 x
i1> |
| 142 icmp eq <16 x i1> undef, undef |
| 143 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp eq <16 x
i1> |
| 144 icmp ult <16 x i1> undef, undef |
| 145 ; CHECK-NEXT: disallowed: Invalid integer arithmetic type: {{.*}} icmp ult <16 x
i1> |
| 146 |
| 147 ; There should be no implicit zero-extension in alloca. |
| 148 alloca i8, i1 1 |
| 149 ; CHECK-NEXT: disallowed: alloca array size is not i32 |
| 150 |
| 151 ; Switch on i1 is not useful. "br" should be used instead. |
| 152 switch i1 0, label %next [i1 0, label %next] |
| 153 ; CHECK-NEXT: disallowed: switch on i1 |
| 154 next: |
| 155 |
| 156 ret void |
| 157 } |
| 158 ; CHECK-NOT: disallowed |
| 159 |
| 160 |
| 161 ; This stops the verifier from complaining about the lack of an entry point. |
| 162 define void @_start(i32 %arg) { |
| 163 ret void |
| 164 } |
OLD | NEW |