OLD | NEW |
1 ; RUN: not pnacl-abicheck < %s | FileCheck %s | 1 ; RUN: not pnacl-abicheck < %s | FileCheck %s |
2 ; Test instruction opcodes allowed by PNaCl ABI | 2 ; Test instruction opcodes allowed by PNaCl ABI |
3 | 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" | 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" | 5 target triple = "le32-unknown-nacl" |
6 | 6 |
7 define internal void @terminators() { | 7 define internal void @terminators() { |
| 8 ; CHECK: ERROR: Function terminators |
8 ; Terminator instructions | 9 ; Terminator instructions |
9 terminators: | 10 terminators: |
10 ret void | 11 ret void |
11 br i1 0, label %next2, label %next | 12 br i1 0, label %next2, label %next |
12 next: | 13 next: |
13 switch i32 1, label %next2 [i32 0, label %next] | 14 switch i32 1, label %next2 [i32 0, label %next] |
14 next2: | 15 next2: |
15 unreachable | 16 unreachable |
16 ; CHECK-NOT: disallowed | 17 ; CHECK-NOT: disallowed |
17 ; CHECK: Function terminators disallowed: bad instruction opcode: indirectbr | 18 ; CHECK: Function terminators disallowed: bad instruction opcode: indirectbr |
18 indirectbr i8* undef, [label %next, label %next2] | 19 indirectbr i8* undef, [label %next, label %next2] |
19 } | 20 } |
20 | 21 |
21 define internal void @binops() { | 22 define internal void @binops() { |
| 23 ; CHECK-NOT: ERROR: Function binops |
22 ; Binary operations | 24 ; Binary operations |
23 %a1 = add i32 0, 0 | 25 %a1 = add i32 0, 0 |
24 %a2 = sub i32 0, 0 | 26 %a2 = fadd float 0.0, 0.0 |
25 %a3 = fsub float 0.0, 0.0 | 27 %a3 = sub i32 0, 0 |
26 %a4 = mul i32 0, 0 | 28 %a4 = fsub float 0.0, 0.0 |
27 %a5 = fmul float 0.0, 0.0 | 29 %a5 = mul i32 0, 0 |
28 %a6 = udiv i32 0, 1 | 30 %a6 = fmul float 0.0, 0.0 |
29 %a7 = sdiv i32 0, 1 | 31 %a7 = udiv i32 0, 1 |
30 %a8 = fdiv float 0.0, 1.0 | 32 %a8 = sdiv i32 0, 1 |
31 %a9 = urem i32 0, 1 | 33 %a9 = fdiv float 0.0, 1.0 |
32 %a10 = srem i32 0, 1 | 34 %a10 = urem i32 0, 1 |
33 %a11 = frem float 0.0, 1.0 | 35 %a11 = srem i32 0, 1 |
| 36 %a12 = frem float 0.0, 1.0 |
34 ; Bitwise binary operations | 37 ; Bitwise binary operations |
35 %a12 = shl i32 1, 1 | 38 %a13 = shl i32 1, 1 |
36 %a13 = lshr i32 1, 1 | 39 %a14 = lshr i32 1, 1 |
37 %a14 = ashr i32 1, 1 | 40 %a15 = ashr i32 1, 1 |
38 %a15 = and i32 1, 1 | 41 %a16 = and i32 1, 1 |
39 %a16 = or i32 1, 1 | 42 %a17 = or i32 1, 1 |
40 %a17 = xor i32 1, 1 | 43 %a18 = xor i32 1, 1 |
41 ret void | 44 ret void |
42 } | 45 } |
43 | |
44 define internal void @vectors() { | |
45 ; CHECK-NOT: disallowed | 46 ; CHECK-NOT: disallowed |
46 | 47 |
47 ; CHECK: disallowed: bad instruction opcode: {{.*}} extractelement | 48 define internal void @vector_binops(<4 x i32> %i, <4 x float> %f) { |
48 %a1 = extractelement <2 x i32> <i32 0, i32 0>, i32 0 | 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 |
49 | 73 |
50 ; CHECK: disallowed: bad instruction opcode: {{.*}} shufflevector | 74 define internal void @vectors_ok(<4 x i32> %i) { |
51 %a2 = shufflevector <2 x i32> undef, <2 x i32> undef, <2 x i32> undef | 75 ; CHECK-NOT: ERROR: Function vectors_ok |
| 76 %ez4xi32.0 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 0 |
| 77 %ez4xi32.1 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1 |
| 78 %ez4xi32.2 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 2 |
| 79 %ez4xi32.3 = extractelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 3 |
52 | 80 |
53 ; CHECK: disallowed: bad instruction opcode: {{.*}} insertelement | 81 %eu4xi32.0 = extractelement <4 x i32> undef, i32 0 |
54 %a3 = insertelement <2 x i32> undef, i32 1, i32 0 | 82 %eu4xi32.1 = extractelement <4 x i32> undef, i32 1 |
| 83 %eu4xi32.2 = extractelement <4 x i32> undef, i32 2 |
| 84 %eu4xi32.3 = extractelement <4 x i32> undef, i32 3 |
| 85 |
| 86 %ev4xi32.0 = extractelement <4 x i32> %i, i32 0 |
| 87 %ev4xi32.1 = extractelement <4 x i32> %i, i32 1 |
| 88 %ev4xi32.2 = extractelement <4 x i32> %i, i32 2 |
| 89 %ev4xi32.3 = extractelement <4 x i32> %i, i32 3 |
| 90 |
| 91 %iz4xi32.0 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
0 |
| 92 %iz4xi32.1 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
1 |
| 93 %iz4xi32.2 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
2 |
| 94 %iz4xi32.3 = insertelement <4 x i32> <i32 0, i32 0, i32 0, i32 0>, i32 1, i32
3 |
| 95 |
| 96 %iu4xi32.0 = insertelement <4 x i32> undef, i32 1, i32 0 |
| 97 %iu4xi32.1 = insertelement <4 x i32> undef, i32 1, i32 1 |
| 98 %iu4xi32.2 = insertelement <4 x i32> undef, i32 1, i32 2 |
| 99 %iu4xi32.3 = insertelement <4 x i32> undef, i32 1, i32 3 |
| 100 |
| 101 %iv4xi32.0 = insertelement <4 x i32> %i, i32 1, i32 0 |
| 102 %iv4xi32.1 = insertelement <4 x i32> %i, i32 1, i32 1 |
| 103 %iv4xi32.2 = insertelement <4 x i32> %i, i32 1, i32 2 |
| 104 %iv4xi32.3 = insertelement <4 x i32> %i, i32 1, i32 3 |
| 105 |
| 106 ret void |
| 107 } |
| 108 ; CHECK-NOT: disallowed |
| 109 |
| 110 define internal void @vectors_bad(i32 %idx) { |
| 111 ; CHECK: ERROR: Function vectors_bad |
| 112 |
| 113 %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 |
| 114 %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 |
| 115 %e.vec.imm = extractelement <4 x i32> <i32 0, i32 1, i32 2, i32 3>, i32 0 ; CH
ECK-NEXT: disallowed: bad operand: {{.*}} extractelement |
| 116 %i.var.idx = insertelement <4 x i32> undef, i32 42, i32 %idx ; CHECK-NEXT: dis
allowed: non-constant vector insert/extract index: {{.*}} insertelement |
| 117 %i.oob.idx = insertelement <4 x i32> undef, i32 42, i32 4 ; CHECK-NEXT: disall
owed: out of range vector insert/extract index: {{.*}} insertelement |
| 118 %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 |
| 119 %a3 = shufflevector <4 x i32> undef, <4 x i32> undef, <4 x i32> undef ; CHECK-
NEXT: disallowed: bad instruction opcode: {{.*}} shufflevector |
55 | 120 |
56 ret void | 121 ret void |
57 } | 122 } |
58 | 123 |
59 define internal void @aggregates() { | 124 define internal void @aggregates() { |
60 ; CHECK-NOT: disallowed | 125 ; CHECK: ERROR: Function aggregates |
61 | 126 |
62 ; Aggregate operations | 127 ; Aggregate operations |
63 %a1 = extractvalue { i32, i32 } { i32 0, i32 0 }, 0 | 128 %a1 = extractvalue { i32, i32 } { i32 0, i32 0 }, 0 |
64 ; CHECK: disallowed: bad instruction opcode: {{.*}} extractvalue | 129 ; CHECK: disallowed: bad instruction opcode: {{.*}} extractvalue |
65 | 130 |
66 %a2 = insertvalue {i32, float} undef, i32 1, 0 | 131 %a2 = insertvalue {i32, float} undef, i32 1, 0 |
67 ; CHECK-NEXT: disallowed: bad instruction opcode: {{.*}} insertvalue | 132 ; CHECK-NEXT: disallowed: bad instruction opcode: {{.*}} insertvalue |
68 | 133 |
69 ret void | 134 ret void |
70 } | 135 } |
71 | 136 |
72 define internal void @memory() { | 137 define internal void @memory() { |
| 138 ; CHECK: ERROR: Function memory |
73 ; Memory operations | 139 ; Memory operations |
74 %a1 = alloca i8, i32 4 | 140 %a1 = alloca i8, i32 4 |
75 %ptr = inttoptr i32 0 to i32* | 141 %ptr = inttoptr i32 0 to i32* |
| 142 %vptr = inttoptr i32 0 to <4 x i32>* |
76 %a2 = load i32* %ptr, align 1 | 143 %a2 = load i32* %ptr, align 1 |
77 store i32 undef, i32* %ptr, align 1 | 144 store i32 undef, i32* %ptr, align 1 |
78 ; CHECK-NOT: disallowed | 145 ; CHECK-NOT: disallowed |
79 ; CHECK: disallowed: bad instruction opcode: {{.*}} getelementptr | 146 %a3 = load <4 x i32>* %vptr, align 16 ; CHECK-NEXT: disallowed: vector load: {
{.*}} load <4 x i32>* |
80 %a3 = getelementptr { i32, i32}* undef | 147 store <4 x i32> undef, <4 x i32>* %vptr, align 16 ; CHECK-NEXT: disallowed: ve
ctor store: store <4 x i32> |
| 148 %a4 = getelementptr { i32, i32}* undef ; CHECK-NEXT: disallowed: bad instructi
on opcode: {{.*}} getelementptr |
81 ret void | 149 ret void |
82 } | 150 } |
83 | 151 |
84 define internal void @atomic() { | 152 define internal void @atomic() { |
| 153 ; CHECK: ERROR: Function atomic |
85 %a1 = alloca i8, i32 4 | 154 %a1 = alloca i8, i32 4 |
86 %ptr = inttoptr i32 0 to i32* | 155 %ptr = inttoptr i32 0 to i32* |
| 156 %vptr = inttoptr i32 0 to <4 x i32>* |
| 157 ; CHECK-NOT: disallowed |
87 ; CHECK: disallowed: atomic load: {{.*}} load atomic | 158 ; CHECK: disallowed: atomic load: {{.*}} load atomic |
88 %a2 = load atomic i32* %ptr seq_cst, align 4 | 159 %a2 = load atomic i32* %ptr seq_cst, align 4 |
89 ; CHECK: disallowed: volatile load: {{.*}} load volatile | 160 ; CHECK: disallowed: volatile load: {{.*}} load volatile |
90 %a3 = load volatile i32* %ptr, align 4 | 161 %a3 = load volatile i32* %ptr, align 4 |
91 ; CHECK: disallowed: atomic store: store atomic | 162 ; CHECK: disallowed: atomic store: store atomic |
92 store atomic i32 undef, i32* %ptr seq_cst, align 4 | 163 store atomic i32 undef, i32* %ptr seq_cst, align 4 |
93 ; CHECK: disallowed: volatile store: store volatile | 164 ; CHECK: disallowed: volatile store: store volatile |
94 store volatile i32 undef, i32* %ptr, align 4 | 165 store volatile i32 undef, i32* %ptr, align 4 |
95 ; CHECK: disallowed: bad instruction opcode: fence | 166 ; CHECK: disallowed: bad instruction opcode: fence |
96 fence acq_rel | 167 fence acq_rel |
97 ; CHECK: disallowed: bad instruction opcode: {{.*}} cmpxchg | 168 ; CHECK: disallowed: bad instruction opcode: {{.*}} cmpxchg |
98 %a4 = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel | 169 %a4 = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel |
99 ; CHECK: disallowed: bad instruction opcode: {{.*}} atomicrmw | 170 ; CHECK: disallowed: bad instruction opcode: {{.*}} atomicrmw |
100 %a5 = atomicrmw add i32* %ptr, i32 1 acquire | 171 %a6 = atomicrmw add i32* %ptr, i32 1 acquire |
101 ret void | 172 ret void |
102 } | 173 } |
103 | 174 |
104 define internal void @conversion() { | 175 define internal void @conversion() { |
| 176 ; CHECK-NOT: Function conversion |
105 ; Conversion operations | 177 ; Conversion operations |
106 %a1 = trunc i32 undef to i8 | 178 %t = trunc i32 undef to i8 |
107 %a2 = zext i8 undef to i32 | 179 %z = zext i8 undef to i32 |
108 %a3 = sext i8 undef to i32 | 180 %s = sext i8 undef to i32 |
109 %a4 = fptrunc double undef to float | 181 %ft = fptrunc double undef to float |
110 %a5 = fpext float undef to double | 182 %fe = fpext float undef to double |
111 %a6 = fptoui double undef to i64 | 183 %fu32 = fptoui float undef to i32 |
112 %a7 = fptosi double undef to i64 | 184 %fs32 = fptosi float undef to i32 |
113 %a8 = uitofp i64 undef to double | 185 %fu64 = fptoui double undef to i64 |
114 %a9 = sitofp i64 undef to double | 186 %fs64 = fptosi double undef to i64 |
| 187 %uf32 = uitofp i32 undef to float |
| 188 %sf32 = sitofp i32 undef to float |
| 189 %uf64 = uitofp i64 undef to double |
| 190 %sf64 = sitofp i64 undef to double |
115 ret void | 191 ret void |
116 } | 192 } |
| 193 ; CHECK-NOT: disallowed |
| 194 |
| 195 define internal void @vector_conversion() { |
| 196 ; CHECK: ERROR: Function vector_conversion |
| 197 %t1 = trunc <4 x i32> undef to <4 x i16> ; CHECK-NEXT: bad result type: <4 x i
16> |
| 198 %t2 = trunc <4 x i32> undef to <4 x i8> ; CHECK-NEXT: bad result type: <4 x i8
> |
| 199 %t3 = trunc <8 x i16> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8
> |
| 200 %z1 = zext <8 x i16> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i3
2> |
| 201 %z2 = zext <8 x i1> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i32
> |
| 202 %z4 = zext <8 x i1> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8> |
| 203 %z5 = zext <16 x i8> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 204 %z6 = zext <16 x i8> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 205 %z7 = zext <16 x i1> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 206 %z8 = zext <16 x i1> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 207 %s1 = sext <8 x i16> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i3
2> |
| 208 %s2 = sext <8 x i1> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i32
> |
| 209 %s4 = sext <8 x i1> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8> |
| 210 %s5 = sext <16 x i8> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 211 %s6 = sext <16 x i8> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 212 %s7 = sext <16 x i1> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x
i32> |
| 213 %s8 = sext <16 x i1> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x
i16> |
| 214 %ft = fptrunc <2 x double> undef to <2 x float> ; CHECK-NEXT: bad operand |
| 215 %fe = fpext <4 x float> undef to <4 x double> ; CHECK-NEXT: bad result type: <
4 x double> |
| 216 %fu64 = fptoui <2 x double> undef to <2 x i64> ; CHECK-NEXT: bad operand |
| 217 %fs64 = fptosi <2 x double> undef to <2 x i64> ; CHECK-NEXT: bad operand |
| 218 %uf64 = uitofp <2 x i64> undef to <2 x double> ; CHECK-NEXT: bad operand |
| 219 %sf64 = sitofp <2 x i64> undef to <2 x double> ; CHECK-NEXT: bad operand |
| 220 |
| 221 ; Conversions to allowed types should work. |
| 222 %t4 = trunc <4 x i32> undef to <4 x i1> ; CHECK-NOT: bad |
| 223 %t5 = trunc <8 x i16> undef to <8 x i1> ; CHECK-NOT: bad |
| 224 %t6 = trunc <16 x i8> undef to <16 x i1> ; CHECK-NOT: bad |
| 225 %z10 = zext <4 x i1> undef to <4 x i32> ; CHECK-NOT: bad |
| 226 %z11 = zext <8 x i1> undef to <8 x i16> ; CHECK-NOT: bad |
| 227 %z12 = zext <16 x i1> undef to <16 x i8> ; CHECK-NOT: bad |
| 228 %s10 = sext <4 x i1> undef to <4 x i32> ; CHECK-NOT: bad |
| 229 %s11 = sext <8 x i1> undef to <8 x i16> ; CHECK-NOT: bad |
| 230 %s12 = sext <16 x i1> undef to <16 x i8> ; CHECK-NOT: bad |
| 231 %fu32 = fptoui <4 x float> undef to <4 x i32> ; CHECK-NOT: bad |
| 232 %fs32 = fptosi <4 x float> undef to <4 x i32> ; CHECK-NOT: bad |
| 233 %uf32 = uitofp <4 x i32> undef to <4 x float> ; CHECK-NOT: bad |
| 234 %sf32 = sitofp <4 x i32> undef to <4 x float> ; CHECK-NOT: bad |
| 235 ret void |
| 236 } |
| 237 ; CHECK-NOT: disallowed |
117 | 238 |
118 define internal void @other() { | 239 define internal void @other() { |
| 240 ; CHECK-NOT: Function other |
119 entry: | 241 entry: |
120 %a1 = icmp eq i32 undef, undef | 242 %icmp8 = icmp eq i8 undef, undef |
121 %a2 = fcmp oeq float undef, undef | 243 %icmp16 = icmp eq i16 undef, undef |
| 244 %icmp32 = icmp eq i32 undef, undef |
| 245 %icmp64 = icmp eq i64 undef, undef |
| 246 %vicmp8 = icmp eq <16 x i8> undef, undef |
| 247 %vicmp16 = icmp eq <8 x i16> undef, undef |
| 248 %vicmp32 = icmp eq <4 x i32> undef, undef |
| 249 %fcmp32 = fcmp oeq float undef, undef |
| 250 %fcmp64 = fcmp oeq double undef, undef |
| 251 %vfcmp = fcmp oeq <4 x float> undef, undef |
122 br i1 undef, label %foo, label %bar | 252 br i1 undef, label %foo, label %bar |
123 foo: | 253 foo: |
124 ; phi predecessor labels have to match to appease module verifier | 254 ; phi predecessor labels have to match to appease module verifier |
125 %a3 = phi i32 [0, %entry], [0, %foo] | 255 %phi1 = phi i1 [0, %entry], [0, %foo] |
126 %a4 = select i1 true, i8 undef, i8 undef | 256 %phi8 = phi i8 [0, %entry], [0, %foo] |
| 257 %phi16 = phi i16 [0, %entry], [0, %foo] |
| 258 %phi32 = phi i32 [0, %entry], [0, %foo] |
| 259 %phi64 = phi i64 [0, %entry], [0, %foo] |
| 260 %vphi4x1 = phi <4 x i1> [undef, %entry], [undef, %foo] |
| 261 %vphi8x1 = phi <8 x i1> [undef, %entry], [undef, %foo] |
| 262 %vphi16x1 = phi <16 x i1> [undef, %entry], [undef, %foo] |
| 263 %vphi8 = phi <16 x i8> [undef, %entry], [undef, %foo] |
| 264 %vphi16 = phi <8 x i16> [undef, %entry], [undef, %foo] |
| 265 %vphi32 = phi <4 x i32> [undef, %entry], [undef, %foo] |
| 266 %select = select i1 true, i8 undef, i8 undef |
| 267 %vselect4x1 = select i1 true, <4 x i1> undef, <4 x i1> undef |
| 268 %vselect8x1 = select i1 true, <8 x i1> undef, <8 x i1> undef |
| 269 %vselect16x1 = select i1 true, <16 x i1> undef, <16 x i1> undef |
| 270 %vselect8 = select i1 true, <16 x i8> undef, <16 x i8> undef |
| 271 %vselect16 = select i1 true, <8 x i16> undef, <8 x i16> undef |
| 272 %vselect32 = select i1 true, <4 x i32> undef, <4 x i32> undef |
127 call void @conversion() | 273 call void @conversion() |
128 br i1 undef, label %foo, label %bar | 274 br i1 undef, label %foo, label %bar |
129 bar: | 275 bar: |
130 ret void | 276 ret void |
131 } | 277 } |
| 278 ; CHECK-NOT: disallowed |
132 | 279 |
133 define internal void @throwing_func() { | 280 define internal void @throwing_func() { |
| 281 ; CHECK-NOT: Function throwing_func |
134 ret void | 282 ret void |
135 } | 283 } |
| 284 ; CHECK-NOT: disallowed |
| 285 |
136 define internal void @personality_func() { | 286 define internal void @personality_func() { |
| 287 ; CHECK-NOT: Function personality_func |
137 ret void | 288 ret void |
138 } | 289 } |
| 290 ; CHECK-NOT: disallowed |
139 | 291 |
140 define internal void @invoke_func() { | 292 define internal void @invoke_func() { |
| 293 ; CHECK: Function invoke_func |
141 invoke void @throwing_func() to label %ok unwind label %onerror | 294 invoke void @throwing_func() to label %ok unwind label %onerror |
142 ; CHECK-NOT: disallowed | 295 ; CHECK-NOT: disallowed |
143 ; CHECK: disallowed: bad instruction opcode: invoke | 296 ; CHECK: disallowed: bad instruction opcode: invoke |
144 ok: | 297 ok: |
145 ret void | 298 ret void |
146 onerror: | 299 onerror: |
147 %lp = landingpad i32 | 300 %lp = landingpad i32 |
148 personality i8* bitcast (void ()* @personality_func to i8*) | 301 personality i8* bitcast (void ()* @personality_func to i8*) |
149 catch i32* null | 302 catch i32* null |
150 ; CHECK: disallowed: bad instruction opcode: {{.*}} landingpad | 303 ; CHECK: disallowed: bad instruction opcode: {{.*}} landingpad |
151 resume i32 %lp | 304 resume i32 %lp |
152 ; CHECK: disallowed: bad instruction opcode: resume | 305 ; CHECK: disallowed: bad instruction opcode: resume |
153 } | 306 } |
154 | 307 |
155 define internal i32 @va_arg(i32 %va_list_as_int) { | 308 define internal i32 @va_arg(i32 %va_list_as_int) { |
| 309 ; CHECK: Function va_arg |
156 %va_list = inttoptr i32 %va_list_as_int to i8* | 310 %va_list = inttoptr i32 %va_list_as_int to i8* |
157 %val = va_arg i8* %va_list, i32 | 311 %val = va_arg i8* %va_list, i32 |
158 ret i32 %val | 312 ret i32 %val |
159 } | 313 } |
160 ; CHECK-NOT: disallowed | 314 ; CHECK-NOT: disallowed |
161 ; CHECK: disallowed: bad instruction opcode: {{.*}} va_arg | 315 ; CHECK: disallowed: bad instruction opcode: {{.*}} va_arg |
162 | 316 |
163 @global_var = internal global [4 x i8] zeroinitializer | 317 @global_var = internal global [4 x i8] zeroinitializer |
164 | 318 |
165 define internal void @constantexpr() { | 319 define internal void @constantexpr() { |
| 320 ; CHECK: Function constantexpr |
166 ptrtoint i8* getelementptr ([4 x i8]* @global_var, i32 1, i32 0) to i32 | 321 ptrtoint i8* getelementptr ([4 x i8]* @global_var, i32 1, i32 0) to i32 |
167 ret void | 322 ret void |
168 } | 323 } |
169 ; CHECK-NOT: disallowed | 324 ; CHECK-NOT: disallowed |
170 ; CHECK: disallowed: operand not InherentPtr: %1 = ptrtoint i8* getelementptr | 325 ; CHECK: disallowed: operand not InherentPtr: %1 = ptrtoint i8* getelementptr |
171 | 326 |
172 define internal void @inline_asm() { | 327 define internal void @inline_asm() { |
| 328 ; CHECK: Function inline_asm |
173 call void asm "foo", ""() | 329 call void asm "foo", ""() |
174 ret void | 330 ret void |
175 } | 331 } |
176 ; CHECK-NOT: disallowed | 332 ; CHECK-NOT: disallowed |
177 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() | 333 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() |
178 | 334 |
179 ; CHECK-NOT: disallowed | 335 ; CHECK-NOT: disallowed |
180 ; If another check is added, there should be a check-not in between each check | 336 ; If another check is added, there should be a check-not in between each check |
OLD | NEW |