OLD | NEW |
(Empty) | |
| 1 ; RUN: not pnacl-abicheck < %s | FileCheck %s |
| 2 ; Test instruction opcodes allowed by PNaCl ABI |
| 3 |
| 4 target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64
:64:64-p:32:32:32-v128:32:32" |
| 5 target triple = "le32-unknown-nacl" |
| 6 |
| 7 define internal void @terminators() { |
| 8 ; CHECK: ERROR: Function terminators |
| 9 ; Terminator instructions |
| 10 terminators: |
| 11 ret void |
| 12 br i1 0, label %next2, label %next |
| 13 next: |
| 14 switch i32 1, label %next2 [i32 0, label %next] |
| 15 next2: |
| 16 unreachable |
| 17 ; CHECK-NOT: disallowed |
| 18 ; CHECK: Function terminators disallowed: bad instruction opcode: indirectbr |
| 19 indirectbr i8* undef, [label %next, label %next2] |
| 20 } |
| 21 |
| 22 define internal void @binops() { |
| 23 ; CHECK-NOT: ERROR: Function binops |
| 24 ; Binary operations |
| 25 %a1 = add i32 0, 0 |
| 26 %a2 = fadd float 0.0, 0.0 |
| 27 %a3 = sub i32 0, 0 |
| 28 %a4 = fsub float 0.0, 0.0 |
| 29 %a5 = mul i32 0, 0 |
| 30 %a6 = fmul float 0.0, 0.0 |
| 31 %a7 = udiv i32 0, 1 |
| 32 %a8 = sdiv i32 0, 1 |
| 33 %a9 = fdiv float 0.0, 1.0 |
| 34 %a10 = urem i32 0, 1 |
| 35 %a11 = srem i32 0, 1 |
| 36 %a12 = frem float 0.0, 1.0 |
| 37 ; Bitwise binary operations |
| 38 %a13 = shl i32 1, 1 |
| 39 %a14 = lshr i32 1, 1 |
| 40 %a15 = ashr i32 1, 1 |
| 41 %a16 = and i32 1, 1 |
| 42 %a17 = or i32 1, 1 |
| 43 %a18 = xor i32 1, 1 |
| 44 ret void |
| 45 } |
| 46 ; CHECK-NOT: disallowed |
| 47 |
| 48 define internal void @vector_binops(<4 x i32> %i, <4 x float> %f) { |
| 49 ; CHECK-NOT: ERROR: Function vector_binops |
| 50 ; Binary operations |
| 51 %a1 = add <4 x i32> %i, %i |
| 52 %a2 = fadd <4 x float> %f, %f |
| 53 %a3 = sub <4 x i32> %i, %i |
| 54 %a4 = fsub <4 x float> %f, %f |
| 55 %a5 = mul <4 x i32> %i, %i |
| 56 %a6 = fmul <4 x float> %f, %f |
| 57 %a7 = udiv <4 x i32> %i, %i |
| 58 %a8 = sdiv <4 x i32> %i, %i |
| 59 %a9 = fdiv <4 x float> %f, %f |
| 60 %a10 = urem <4 x i32> %i, %i |
| 61 %a11 = srem <4 x i32> %i, %i |
| 62 %a12 = frem <4 x float> %f, %f |
| 63 ; Bitwise binary operations |
| 64 %a13 = shl <4 x i32> %i, %i |
| 65 %a14 = lshr <4 x i32> %i, %i |
| 66 %a15 = ashr <4 x i32> %i, %i |
| 67 %a16 = and <4 x i32> %i, %i |
| 68 %a17 = or <4 x i32> %i, %i |
| 69 %a18 = xor <4 x i32> %i, %i |
| 70 ret void |
| 71 } |
| 72 ; CHECK-NOT: disallowed |
| 73 |
| 74 define internal void @vectors_ok(<4 x i32> %i) { |
| 75 ; CHECK-NOT: ERROR: Function vectors_ok |
| 76 %eu4xi32.0 = extractelement <4 x i32> undef, i32 0 |
| 77 %eu4xi32.1 = extractelement <4 x i32> undef, i32 1 |
| 78 %eu4xi32.2 = extractelement <4 x i32> undef, i32 2 |
| 79 %eu4xi32.3 = extractelement <4 x i32> undef, i32 3 |
| 80 |
| 81 %ev4xi32.0 = extractelement <4 x i32> %i, i32 0 |
| 82 %ev4xi32.1 = extractelement <4 x i32> %i, i32 1 |
| 83 %ev4xi32.2 = extractelement <4 x i32> %i, i32 2 |
| 84 %ev4xi32.3 = extractelement <4 x i32> %i, i32 3 |
| 85 |
| 86 %iu4xi32.0 = insertelement <4 x i32> undef, i32 1, i32 0 |
| 87 %iu4xi32.1 = insertelement <4 x i32> undef, i32 1, i32 1 |
| 88 %iu4xi32.2 = insertelement <4 x i32> undef, i32 1, i32 2 |
| 89 %iu4xi32.3 = insertelement <4 x i32> undef, i32 1, i32 3 |
| 90 |
| 91 %iv4xi32.0 = insertelement <4 x i32> %i, i32 1, i32 0 |
| 92 %iv4xi32.1 = insertelement <4 x i32> %i, i32 1, i32 1 |
| 93 %iv4xi32.2 = insertelement <4 x i32> %i, i32 1, i32 2 |
| 94 %iv4xi32.3 = insertelement <4 x i32> %i, i32 1, i32 3 |
| 95 |
| 96 ret void |
| 97 } |
| 98 ; CHECK-NOT: disallowed |
| 99 |
| 100 define internal void @vectors_bad(i32 %idx) { |
| 101 ; CHECK: ERROR: Function vectors_bad |
| 102 |
| 103 %e.var.idx = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 %idx ;
CHECK-NEXT: disallowed: non-constant vector insert/extract index: {{.*}} extrac
telement |
| 104 %e.oob.idx = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 4 ; CH
ECK-NEXT: disallowed: out of range vector insert/extract index: {{.*}} extractel
ement |
| 105 %e.vec.imm = extractelement <4 x i32> <i32 0, i32 1, i32 2, i32 3>, i32 0 ; CH
ECK-NEXT: disallowed: bad operand: {{.*}} extractelement |
| 106 %i.var.idx = insertelement <4 x i32> undef, i32 42, i32 %idx ; CHECK-NEXT: dis
allowed: non-constant vector insert/extract index: {{.*}} insertelement |
| 107 %i.oob.idx = insertelement <4 x i32> undef, i32 42, i32 4 ; CHECK-NEXT: disall
owed: out of range vector insert/extract index: {{.*}} insertelement |
| 108 %i.vec.imm = insertelement <4 x i32> <i32 0, i32 1, i32 2, i32 3>, i32 42, i32
0 ; CHECK-NEXT: disallowed: bad operand: {{.*}} insertelement |
| 109 %a3 = shufflevector <4 x i32> undef, <4 x i32> undef, <4 x i32> undef ; CHECK-
NEXT: disallowed: bad instruction opcode: {{.*}} shufflevector |
| 110 |
| 111 ret void |
| 112 } |
| 113 |
| 114 define internal void @vectors_bad_zeroinitializer() { |
| 115 ; CHECK: ERROR: Function vectors_bad_zeroinitializer |
| 116 |
| 117 ; zeroinitializer isn't allowed, it should be globalized instead. |
| 118 %ez4xi32.0 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 0 ; CH
ECK-NEXT: disallowed: bad operand: {{.*}} extractelement {{.*}} zeroinitializer |
| 119 %ez4xi32.1 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1 ; CH
ECK-NEXT: disallowed: bad operand: {{.*}} extractelement {{.*}} zeroinitializer |
| 120 %ez4xi32.2 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 2 ; CH
ECK-NEXT: disallowed: bad operand: {{.*}} extractelement {{.*}} zeroinitializer |
| 121 %ez4xi32.3 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 3 ; CH
ECK-NEXT: disallowed: bad operand: {{.*}} extractelement {{.*}} zeroinitializer |
| 122 %iz4xi32.0 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
0 ; CHECK-NEXT: disallowed: bad operand: {{.*}} insertelement {{.*}} zeroinitial
izer |
| 123 %iz4xi32.1 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
1 ; CHECK-NEXT: disallowed: bad operand: {{.*}} insertelement {{.*}} zeroinitial
izer |
| 124 %iz4xi32.2 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
2 ; CHECK-NEXT: disallowed: bad operand: {{.*}} insertelement {{.*}} zeroinitial
izer |
| 125 %iz4xi32.3 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
3 ; CHECK-NEXT: disallowed: bad operand: {{.*}} insertelement {{.*}} zeroinitial
izer |
| 126 |
| 127 ret void |
| 128 } |
| 129 |
| 130 define internal void @aggregates() { |
| 131 ; CHECK: ERROR: Function aggregates |
| 132 |
| 133 ; Aggregate operations |
| 134 %a1 = extractvalue { i32, i32 } { i32 0, i32 0 }, 0 |
| 135 ; CHECK: disallowed: bad instruction opcode: {{.*}} extractvalue |
| 136 |
| 137 %a2 = insertvalue {i32, float} undef, i32 1, 0 |
| 138 ; CHECK-NEXT: disallowed: bad instruction opcode: {{.*}} insertvalue |
| 139 |
| 140 ret void |
| 141 } |
| 142 |
| 143 define internal void @memory() { |
| 144 ; CHECK: ERROR: Function memory |
| 145 ; Memory operations |
| 146 %a1 = alloca i8, i32 4 |
| 147 %ptr = inttoptr i32 0 to i32* |
| 148 %a2 = load i32* %ptr, align 1 |
| 149 store i32 undef, i32* %ptr, align 1 |
| 150 ; CHECK-NOT: disallowed |
| 151 %a4 = getelementptr { i32, i32}* undef ; CHECK-NEXT: disallowed: bad instructi
on opcode: {{.*}} getelementptr |
| 152 ret void |
| 153 } |
| 154 |
| 155 define internal void @vector_memory() { |
| 156 ; CHECK: ERROR: Function vector_memory |
| 157 ; Vector memory operations. |
| 158 %ptr16xi8 = inttoptr i32 0 to <16 x i8>* |
| 159 %ptr8xi16 = inttoptr i32 0 to <8 x i16>* |
| 160 %ptr4xi32 = inttoptr i32 0 to <4 x i32>* |
| 161 %ptr4xfloat = inttoptr i32 0 to <4 x float>* |
| 162 |
| 163 %l16xi8 = load <16 x i8>* %ptr16xi8, align 1 |
| 164 %l8xi16 = load <8 x i16>* %ptr8xi16, align 2 |
| 165 %l4xi32 = load <4 x i32>* %ptr4xi32, align 4 |
| 166 %l4xfloat = load <4 x float>* %ptr4xfloat, align 4 |
| 167 |
| 168 store <16 x i8> undef, <16 x i8>* %ptr16xi8, align 1 |
| 169 store <8 x i16> undef, <8 x i16>* %ptr8xi16, align 2 |
| 170 store <4 x i32> undef, <4 x i32>* %ptr4xi32, align 4 |
| 171 store <4 x float> undef, <4 x float>* %ptr4xfloat, align 4 |
| 172 |
| 173 ; CHECK-NOT: disallowed |
| 174 ; The following vector types are disallowed. |
| 175 %ptr2xi1 = inttoptr i32 0 to <2 x i1>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x i1>* |
| 176 %ptr4xi1 = inttoptr i32 0 to <4 x i1>* ; CHECK-NEXT: disallowed: bad r
esult type: <4 x i1>* |
| 177 %ptr8xi1 = inttoptr i32 0 to <8 x i1>* ; CHECK-NEXT: disallowed: bad r
esult type: <8 x i1>* |
| 178 %ptr16xi1 = inttoptr i32 0 to <16 x i1>* ; CHECK-NEXT: disallowed: bad r
esult type: <16 x i1>* |
| 179 %ptr32xi1 = inttoptr i32 0 to <32 x i1>* ; CHECK-NEXT: disallowed: bad r
esult type: <32 x i1>* |
| 180 %ptr64xi1 = inttoptr i32 0 to <64 x i1>* ; CHECK-NEXT: disallowed: bad r
esult type: <64 x i1>* |
| 181 %ptr2xi8 = inttoptr i32 0 to <2 x i8>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x i8>* |
| 182 %ptr4xi8 = inttoptr i32 0 to <4 x i8>* ; CHECK-NEXT: disallowed: bad r
esult type: <4 x i8>* |
| 183 %ptr32xi8 = inttoptr i32 0 to <32 x i8>* ; CHECK-NEXT: disallowed: bad r
esult type: <32 x i8>* |
| 184 %ptr64xi8 = inttoptr i32 0 to <64 x i8>* ; CHECK-NEXT: disallowed: bad r
esult type: <64 x i8>* |
| 185 %ptr2xi16 = inttoptr i32 0 to <2 x i16>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x i16>* |
| 186 %ptr4xi16 = inttoptr i32 0 to <4 x i16>* ; CHECK-NEXT: disallowed: bad r
esult type: <4 x i16>* |
| 187 %ptr16xi16 = inttoptr i32 0 to <16 x i16>* ; CHECK-NEXT: disallowed: bad r
esult type: <16 x i16>* |
| 188 %ptr32xi16 = inttoptr i32 0 to <32 x i16>* ; CHECK-NEXT: disallowed: bad r
esult type: <32 x i16>* |
| 189 %ptr2xi32 = inttoptr i32 0 to <2 x i32>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x i32>* |
| 190 %ptr8xi32 = inttoptr i32 0 to <8 x i32>* ; CHECK-NEXT: disallowed: bad r
esult type: <8 x i32>* |
| 191 %ptr16xi32 = inttoptr i32 0 to <16 x i32>* ; CHECK-NEXT: disallowed: bad r
esult type: <16 x i32>* |
| 192 %ptr2xi64 = inttoptr i32 0 to <2 x i64>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x i64>* |
| 193 %ptr4xi64 = inttoptr i32 0 to <4 x i64>* ; CHECK-NEXT: disallowed: bad r
esult type: <4 x i64>* |
| 194 %ptr8xi64 = inttoptr i32 0 to <8 x i64>* ; CHECK-NEXT: disallowed: bad r
esult type: <8 x i64>* |
| 195 %ptr2xfloat = inttoptr i32 0 to <2 x float>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x float>* |
| 196 %ptr8xfloat = inttoptr i32 0 to <8 x float>* ; CHECK-NEXT: disallowed: bad r
esult type: <8 x float>* |
| 197 %ptr16xfloat = inttoptr i32 0 to <16 x float>* ; CHECK-NEXT: disallowed: bad r
esult type: <16 x float>* |
| 198 %ptr2xdouble = inttoptr i32 0 to <2 x double>* ; CHECK-NEXT: disallowed: bad r
esult type: <2 x double>* |
| 199 %ptr4xdouble = inttoptr i32 0 to <4 x double>* ; CHECK-NEXT: disallowed: bad r
esult type: <4 x double>* |
| 200 %ptr8xdouble = inttoptr i32 0 to <8 x double>* ; CHECK-NEXT: disallowed: bad r
esult type: <8 x double>* |
| 201 |
| 202 ; i1 vector pointers are simply disallowed, their alignment is inconsequential
. |
| 203 %l4xi1 = load <4 x i1>* %ptr4xi1, align 1 ; CHECK-NEXT: disallowed: bad poi
nter: %l4xi1 = load <4 x i1>* %ptr4xi1, align 1 |
| 204 %l8xi1 = load <8 x i1>* %ptr8xi1, align 1 ; CHECK-NEXT: disallowed: bad poi
nter: %l8xi1 = load <8 x i1>* %ptr8xi1, align 1 |
| 205 %l16xi1 = load <16 x i1>* %ptr16xi1, align 1 ; CHECK-NEXT: disallowed: bad poi
nter: %l16xi1 = load <16 x i1>* %ptr16xi1, align 1 |
| 206 |
| 207 store <4 x i1> undef, <4 x i1>* %ptr4xi1, align 1 ; CHECK-NEXT: disallowed:
bad pointer: store <4 x i1> undef, <4 x i1>* %ptr4xi1, align 1 |
| 208 store <8 x i1> undef, <8 x i1>* %ptr8xi1, align 1 ; CHECK-NEXT: disallowed:
bad pointer: store <8 x i1> undef, <8 x i1>* %ptr8xi1, align 1 |
| 209 store <16 x i1> undef, <16 x i1>* %ptr16xi1, align 1 ; CHECK-NEXT: disallowed:
bad pointer: store <16 x i1> undef, <16 x i1>* %ptr16xi1, align 1 |
| 210 |
| 211 ; Under- or over-aligned load/store are disallowed. |
| 212 %a1_8xi16 = load <8 x i16>* %ptr8xi16, align 1 ; CHECK-NEXT: disallowed:
bad alignment: %a1_8xi16 = load <8 x i16>* %ptr8xi16, align 1 |
| 213 %a1_4xi32 = load <4 x i32>* %ptr4xi32, align 1 ; CHECK-NEXT: disallowed:
bad alignment: %a1_4xi32 = load <4 x i32>* %ptr4xi32, align 1 |
| 214 %a1_4xfloat = load <4 x float>* %ptr4xfloat, align 1 ; CHECK-NEXT: disallowed:
bad alignment: %a1_4xfloat = load <4 x float>* %ptr4xfloat, align 1 |
| 215 |
| 216 %a16_16xi8 = load <16 x i8>* %ptr16xi8, align 16 ; CHECK-NEXT: disallowe
d: bad alignment: %a16_16xi8 = load <16 x i8>* %ptr16xi8, align 16 |
| 217 %a16_8xi16 = load <8 x i16>* %ptr8xi16, align 16 ; CHECK-NEXT: disallowe
d: bad alignment: %a16_8xi16 = load <8 x i16>* %ptr8xi16, align 16 |
| 218 %a16_4xi32 = load <4 x i32>* %ptr4xi32, align 16 ; CHECK-NEXT: disallowe
d: bad alignment: %a16_4xi32 = load <4 x i32>* %ptr4xi32, align 16 |
| 219 %a16_4xfloat = load <4 x float>* %ptr4xfloat, align 16 ; CHECK-NEXT: disallowe
d: bad alignment: %a16_4xfloat = load <4 x float>* %ptr4xfloat, align 16 |
| 220 |
| 221 store <8 x i16> undef, <8 x i16>* %ptr8xi16, align 1 ; CHECK-NEXT: disal
lowed: bad alignment: store <8 x i16> undef, <8 x i16>* %ptr8xi16, align 1 |
| 222 store <4 x i32> undef, <4 x i32>* %ptr4xi32, align 1 ; CHECK-NEXT: disal
lowed: bad alignment: store <4 x i32> undef, <4 x i32>* %ptr4xi32, align 1 |
| 223 store <4 x float> undef, <4 x float>* %ptr4xfloat, align 1 ; CHECK-NEXT: disal
lowed: bad alignment: store <4 x float> undef, <4 x float>* %ptr4xfloat, align 1 |
| 224 |
| 225 store <16 x i8> undef, <16 x i8>* %ptr16xi8, align 16 ; CHECK-NEXT: disa
llowed: bad alignment: store <16 x i8> undef, <16 x i8>* %ptr16xi8, align 16 |
| 226 store <8 x i16> undef, <8 x i16>* %ptr8xi16, align 16 ; CHECK-NEXT: disa
llowed: bad alignment: store <8 x i16> undef, <8 x i16>* %ptr8xi16, align 16 |
| 227 store <4 x i32> undef, <4 x i32>* %ptr4xi32, align 16 ; CHECK-NEXT: disa
llowed: bad alignment: store <4 x i32> undef, <4 x i32>* %ptr4xi32, align 16 |
| 228 store <4 x float> undef, <4 x float>* %ptr4xfloat, align 16 ; CHECK-NEXT: disa
llowed: bad alignment: store <4 x float> undef, <4 x float>* %ptr4xfloat, align
16 |
| 229 |
| 230 ret void |
| 231 } |
| 232 |
| 233 define internal void @atomic() { |
| 234 ; CHECK: ERROR: Function atomic |
| 235 %ptr = inttoptr i32 0 to i32* |
| 236 |
| 237 ; CHECK-NOT: disallowed |
| 238 %la = load atomic i32* %ptr seq_cst, align 4 ; CHECK: dis
allowed: atomic load: {{.*}} load atomic |
| 239 %lv = load volatile i32* %ptr, align 4 ; CHECK: dis
allowed: volatile load: {{.*}} load volatile |
| 240 store atomic i32 undef, i32* %ptr seq_cst, align 4 ; CHECK: dis
allowed: atomic store: store atomic |
| 241 store volatile i32 undef, i32* %ptr, align 4 ; CHECK: dis
allowed: volatile store: store volatile |
| 242 fence acq_rel ; CHECK: dis
allowed: bad instruction opcode: fence |
| 243 %cmpx = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel monotonic ; CHECK: dis
allowed: bad instruction opcode: {{.*}} cmpxchg |
| 244 %crm = atomicrmw add i32* %ptr, i32 1 acquire ; CHECK: dis
allowed: bad instruction opcode: {{.*}} atomicrmw |
| 245 ret void |
| 246 } |
| 247 |
| 248 define internal void @atomic_vector() { |
| 249 ; CHECK: ERROR: Function atomic_vector |
| 250 %ptr = inttoptr i32 0 to <4 x i32>* |
| 251 |
| 252 ; CHECK-NOT: disallowed |
| 253 %la = load atomic <4 x i32>* %ptr seq_cst, align 1 ; CHECK: disall
owed: atomic load: {{.*}} load atomic |
| 254 %lv = load volatile <4 x i32>* %ptr, align 1 ; CHECK: disall
owed: volatile load: {{.*}} load volatile |
| 255 store atomic <4 x i32> undef, <4 x i32>* %ptr seq_cst, align 1 ; CHECK: disall
owed: atomic store: store atomic |
| 256 store volatile <4 x i32> undef, <4 x i32>* %ptr, align 1 ; CHECK: disall
owed: volatile store: store volatile |
| 257 ret void |
| 258 } |
| 259 |
| 260 define internal void @conversion() { |
| 261 ; CHECK-NOT: Function conversion |
| 262 ; Conversion operations |
| 263 %t = trunc i32 undef to i8 |
| 264 %z = zext i8 undef to i32 |
| 265 %s = sext i8 undef to i32 |
| 266 %ft = fptrunc double undef to float |
| 267 %fe = fpext float undef to double |
| 268 %fu32 = fptoui float undef to i32 |
| 269 %fs32 = fptosi float undef to i32 |
| 270 %fu64 = fptoui double undef to i64 |
| 271 %fs64 = fptosi double undef to i64 |
| 272 %uf32 = uitofp i32 undef to float |
| 273 %sf32 = sitofp i32 undef to float |
| 274 %uf64 = uitofp i64 undef to double |
| 275 %sf64 = sitofp i64 undef to double |
| 276 ret void |
| 277 } |
| 278 ; CHECK-NOT: disallowed |
| 279 |
| 280 define internal void @vector_conversion() { |
| 281 ; CHECK: ERROR: Function vector_conversion |
| 282 %t1 = trunc <4 x i32> undef to <4 x i16> ; CHECK-NEXT: bad result type: <4 x i
16> |
| 283 %t2 = trunc <4 x i32> undef to <4 x i8> ; CHECK-NEXT: bad result type: <4 x i8
> |
| 284 %t3 = trunc <8 x i16> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8
> |
| 285 %z1 = zext <8 x i16> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i3
2> |
| 286 %z2 = zext <8 x i1> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i32
> |
| 287 %z4 = zext <8 x i1> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8> |
| 288 %z5 = zext <16 x i8> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 289 %z6 = zext <16 x i8> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 290 %z7 = zext <16 x i1> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 291 %z8 = zext <16 x i1> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 292 %s1 = sext <8 x i16> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i3
2> |
| 293 %s2 = sext <8 x i1> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i32
> |
| 294 %s4 = sext <8 x i1> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8> |
| 295 %s5 = sext <16 x i8> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 296 %s6 = sext <16 x i8> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 297 %s7 = sext <16 x i1> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 298 %s8 = sext <16 x i1> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 299 %ft = fptrunc <2 x double> undef to <2 x float> ; CHECK-NEXT: bad operand |
| 300 %fe = fpext <4 x float> undef to <4 x double> ; CHECK-NEXT: bad result type: <
4 x double> |
| 301 %fu64 = fptoui <2 x double> undef to <2 x i64> ; CHECK-NEXT: bad operand |
| 302 %fs64 = fptosi <2 x double> undef to <2 x i64> ; CHECK-NEXT: bad operand |
| 303 %uf64 = uitofp <2 x i64> undef to <2 x double> ; CHECK-NEXT: bad operand |
| 304 %sf64 = sitofp <2 x i64> undef to <2 x double> ; CHECK-NEXT: bad operand |
| 305 |
| 306 ; Conversions to allowed types should work. |
| 307 %t4 = trunc <4 x i32> undef to <4 x i1> ; CHECK-NOT: bad |
| 308 %t5 = trunc <8 x i16> undef to <8 x i1> ; CHECK-NOT: bad |
| 309 %t6 = trunc <16 x i8> undef to <16 x i1> ; CHECK-NOT: bad |
| 310 %z10 = zext <4 x i1> undef to <4 x i32> ; CHECK-NOT: bad |
| 311 %z11 = zext <8 x i1> undef to <8 x i16> ; CHECK-NOT: bad |
| 312 %z12 = zext <16 x i1> undef to <16 x i8> ; CHECK-NOT: bad |
| 313 %s10 = sext <4 x i1> undef to <4 x i32> ; CHECK-NOT: bad |
| 314 %s11 = sext <8 x i1> undef to <8 x i16> ; CHECK-NOT: bad |
| 315 %s12 = sext <16 x i1> undef to <16 x i8> ; CHECK-NOT: bad |
| 316 %fu32 = fptoui <4 x float> undef to <4 x i32> ; CHECK-NOT: bad |
| 317 %fs32 = fptosi <4 x float> undef to <4 x i32> ; CHECK-NOT: bad |
| 318 %uf32 = uitofp <4 x i32> undef to <4 x float> ; CHECK-NOT: bad |
| 319 %sf32 = sitofp <4 x i32> undef to <4 x float> ; CHECK-NOT: bad |
| 320 ret void |
| 321 } |
| 322 ; CHECK-NOT: disallowed |
| 323 |
| 324 define internal void @other() { |
| 325 ; CHECK-NOT: Function other |
| 326 entry: |
| 327 %icmp8 = icmp eq i8 undef, undef |
| 328 %icmp16 = icmp eq i16 undef, undef |
| 329 %icmp32 = icmp eq i32 undef, undef |
| 330 %icmp64 = icmp eq i64 undef, undef |
| 331 %vicmp8 = icmp eq <16 x i8> undef, undef |
| 332 %vicmp16 = icmp eq <8 x i16> undef, undef |
| 333 %vicmp32 = icmp eq <4 x i32> undef, undef |
| 334 %fcmp32 = fcmp oeq float undef, undef |
| 335 %fcmp64 = fcmp oeq double undef, undef |
| 336 %vfcmp = fcmp oeq <4 x float> undef, undef |
| 337 br i1 undef, label %foo, label %bar |
| 338 foo: |
| 339 ; phi predecessor labels have to match to appease module verifier |
| 340 %phi1 = phi i1 [0, %entry], [0, %foo] |
| 341 %phi8 = phi i8 [0, %entry], [0, %foo] |
| 342 %phi16 = phi i16 [0, %entry], [0, %foo] |
| 343 %phi32 = phi i32 [0, %entry], [0, %foo] |
| 344 %phi64 = phi i64 [0, %entry], [0, %foo] |
| 345 %vphi4x1 = phi <4 x i1> [undef, %entry], [undef, %foo] |
| 346 %vphi8x1 = phi <8 x i1> [undef, %entry], [undef, %foo] |
| 347 %vphi16x1 = phi <16 x i1> [undef, %entry], [undef, %foo] |
| 348 %vphi8 = phi <16 x i8> [undef, %entry], [undef, %foo] |
| 349 %vphi16 = phi <8 x i16> [undef, %entry], [undef, %foo] |
| 350 %vphi32 = phi <4 x i32> [undef, %entry], [undef, %foo] |
| 351 |
| 352 %select = select i1 true, i8 undef, i8 undef |
| 353 |
| 354 %vselect4x1 = select i1 true, <4 x i1> undef, <4 x i1> undef |
| 355 %vselect8x1 = select i1 true, <8 x i1> undef, <8 x i1> undef |
| 356 %vselect16x1 = select i1 true, <16 x i1> undef, <16 x i1> undef |
| 357 %vselect8 = select i1 true, <16 x i8> undef, <16 x i8> undef |
| 358 %vselect16 = select i1 true, <8 x i16> undef, <8 x i16> undef |
| 359 %vselect32 = select i1 true, <4 x i32> undef, <4 x i32> undef |
| 360 |
| 361 %vvselect4x1 = select <4 x i1> undef, <4 x i1> undef, <4 x i1> undef |
| 362 %vvselect8x1 = select <8 x i1> undef, <8 x i1> undef, <8 x i1> undef |
| 363 %vvselect16x1 = select <16 x i1> undef, <16 x i1> undef, <16 x i1> undef |
| 364 %vvselect8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef |
| 365 %vvselect16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef |
| 366 %vvselect32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef |
| 367 |
| 368 call void @conversion() |
| 369 br i1 undef, label %foo, label %bar |
| 370 bar: |
| 371 ret void |
| 372 } |
| 373 ; CHECK-NOT: disallowed |
| 374 |
| 375 define internal void @throwing_func() { |
| 376 ; CHECK-NOT: Function throwing_func |
| 377 ret void |
| 378 } |
| 379 ; CHECK-NOT: disallowed |
| 380 |
| 381 define internal void @personality_func() { |
| 382 ; CHECK-NOT: Function personality_func |
| 383 ret void |
| 384 } |
| 385 ; CHECK-NOT: disallowed |
| 386 |
| 387 define internal void @invoke_func() { |
| 388 ; CHECK: ERROR: Function invoke_func |
| 389 invoke void @throwing_func() to label %ok unwind label %onerror |
| 390 ; CHECK-NOT: disallowed |
| 391 ; CHECK: disallowed: bad instruction opcode: invoke |
| 392 ok: |
| 393 ret void |
| 394 onerror: |
| 395 %lp = landingpad i32 |
| 396 personality i8* bitcast (void ()* @personality_func to i8*) |
| 397 catch i32* null |
| 398 ; CHECK: disallowed: bad instruction opcode: {{.*}} landingpad |
| 399 resume i32 %lp |
| 400 ; CHECK: disallowed: bad instruction opcode: resume |
| 401 } |
| 402 |
| 403 define internal i32 @va_arg(i32 %va_list_as_int) { |
| 404 ; CHECK: ERROR: Function va_arg |
| 405 %va_list = inttoptr i32 %va_list_as_int to i8* |
| 406 %val = va_arg i8* %va_list, i32 |
| 407 ret i32 %val |
| 408 } |
| 409 ; CHECK-NOT: disallowed |
| 410 ; CHECK: disallowed: bad instruction opcode: {{.*}} va_arg |
| 411 |
| 412 @global_var = internal global [4 x i8] zeroinitializer |
| 413 |
| 414 define internal void @constantexpr() { |
| 415 ; CHECK: ERROR: Function constantexpr |
| 416 ptrtoint i8* getelementptr ([4 x i8]* @global_var, i32 1, i32 0) to i32 |
| 417 ret void |
| 418 } |
| 419 ; CHECK-NOT: disallowed |
| 420 ; CHECK: disallowed: operand not InherentPtr: %1 = ptrtoint i8* getelementptr |
| 421 |
| 422 define internal void @inline_asm() { |
| 423 ; CHECK: ERROR: Function inline_asm |
| 424 call void asm "foo", ""() |
| 425 ret void |
| 426 } |
| 427 ; CHECK-NOT: disallowed |
| 428 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() |
| 429 |
| 430 ; CHECK-NOT: disallowed |
| 431 ; If another check is added, there should be a check-not in between each check |
OLD | NEW |