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 |
jvoung (off chromium)
2014/04/16 00:10:27
Is there a test for function call operands anywher
JF
2014/04/16 20:48:07
I added test/NaCl/PNaClABI/function-signatures.ll
| |
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* |
76 %a2 = load i32* %ptr, align 1 | 142 %a2 = load i32* %ptr, align 1 |
77 store i32 undef, i32* %ptr, align 1 | 143 store i32 undef, i32* %ptr, align 1 |
78 ; CHECK-NOT: disallowed | 144 ; CHECK-NOT: disallowed |
79 ; CHECK: disallowed: bad instruction opcode: {{.*}} getelementptr | 145 %vptr = inttoptr i32 0 to <4 x i32>* ; CHECK-NEXT: disallowed: bad result type : <4 x i32>* |
80 %a3 = getelementptr { i32, i32}* undef | 146 %a3 = load <4 x i32>* %vptr, align 16 ; CHECK-NEXT: disallowed: bad pointer: { {.*}} load <4 x i32>* |
147 store <4 x i32> undef, <4 x i32>* %vptr, align 16 ; CHECK-NEXT: disallowed: ba d pointer: 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 ; CHECK-NOT: disallowed | |
87 ; CHECK: disallowed: atomic load: {{.*}} load atomic | 157 ; CHECK: disallowed: atomic load: {{.*}} load atomic |
88 %a2 = load atomic i32* %ptr seq_cst, align 4 | 158 %a2 = load atomic i32* %ptr seq_cst, align 4 |
89 ; CHECK: disallowed: volatile load: {{.*}} load volatile | 159 ; CHECK: disallowed: volatile load: {{.*}} load volatile |
90 %a3 = load volatile i32* %ptr, align 4 | 160 %a3 = load volatile i32* %ptr, align 4 |
91 ; CHECK: disallowed: atomic store: store atomic | 161 ; CHECK: disallowed: atomic store: store atomic |
92 store atomic i32 undef, i32* %ptr seq_cst, align 4 | 162 store atomic i32 undef, i32* %ptr seq_cst, align 4 |
93 ; CHECK: disallowed: volatile store: store volatile | 163 ; CHECK: disallowed: volatile store: store volatile |
94 store volatile i32 undef, i32* %ptr, align 4 | 164 store volatile i32 undef, i32* %ptr, align 4 |
95 ; CHECK: disallowed: bad instruction opcode: fence | 165 ; CHECK: disallowed: bad instruction opcode: fence |
96 fence acq_rel | 166 fence acq_rel |
97 ; CHECK: disallowed: bad instruction opcode: {{.*}} cmpxchg | 167 ; CHECK: disallowed: bad instruction opcode: {{.*}} cmpxchg |
98 %a4 = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel | 168 %a4 = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel |
99 ; CHECK: disallowed: bad instruction opcode: {{.*}} atomicrmw | 169 ; CHECK: disallowed: bad instruction opcode: {{.*}} atomicrmw |
100 %a5 = atomicrmw add i32* %ptr, i32 1 acquire | 170 %a6 = atomicrmw add i32* %ptr, i32 1 acquire |
jvoung (off chromium)
2014/04/16 00:10:27
nit: could revert this variable number bump?
JF
2014/04/16 20:48:07
Done.
| |
101 ret void | 171 ret void |
102 } | 172 } |
103 | 173 |
104 define internal void @conversion() { | 174 define internal void @conversion() { |
175 ; CHECK-NOT: Function conversion | |
105 ; Conversion operations | 176 ; Conversion operations |
106 %a1 = trunc i32 undef to i8 | 177 %t = trunc i32 undef to i8 |
107 %a2 = zext i8 undef to i32 | 178 %z = zext i8 undef to i32 |
108 %a3 = sext i8 undef to i32 | 179 %s = sext i8 undef to i32 |
109 %a4 = fptrunc double undef to float | 180 %ft = fptrunc double undef to float |
110 %a5 = fpext float undef to double | 181 %fe = fpext float undef to double |
111 %a6 = fptoui double undef to i64 | 182 %fu32 = fptoui float undef to i32 |
112 %a7 = fptosi double undef to i64 | 183 %fs32 = fptosi float undef to i32 |
113 %a8 = uitofp i64 undef to double | 184 %fu64 = fptoui double undef to i64 |
114 %a9 = sitofp i64 undef to double | 185 %fs64 = fptosi double undef to i64 |
186 %uf32 = uitofp i32 undef to float | |
187 %sf32 = sitofp i32 undef to float | |
188 %uf64 = uitofp i64 undef to double | |
189 %sf64 = sitofp i64 undef to double | |
115 ret void | 190 ret void |
116 } | 191 } |
192 ; CHECK-NOT: disallowed | |
193 | |
194 define internal void @vector_conversion() { | |
195 ; CHECK: ERROR: Function vector_conversion | |
196 %t1 = trunc <4 x i32> undef to <4 x i16> ; CHECK-NEXT: bad result type: <4 x i 16> | |
197 %t2 = trunc <4 x i32> undef to <4 x i8> ; CHECK-NEXT: bad result type: <4 x i8 > | |
198 %t3 = trunc <8 x i16> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8 > | |
199 %z1 = zext <8 x i16> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i3 2> | |
200 %z2 = zext <8 x i1> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i32 > | |
201 %z4 = zext <8 x i1> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8> | |
202 %z5 = zext <16 x i8> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x i16> | |
203 %z6 = zext <16 x i8> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x i32> | |
204 %z7 = zext <16 x i1> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x i32> | |
205 %z8 = zext <16 x i1> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x i16> | |
206 %s1 = sext <8 x i16> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i3 2> | |
207 %s2 = sext <8 x i1> undef to <8 x i32> ; CHECK-NEXT: bad result type: <8 x i32 > | |
208 %s4 = sext <8 x i1> undef to <8 x i8> ; CHECK-NEXT: bad result type: <8 x i8> | |
209 %s5 = sext <16 x i8> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x i16> | |
210 %s6 = sext <16 x i8> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x i32> | |
211 %s7 = sext <16 x i1> undef to <16 x i32> ; CHECK-NEXT: bad result type: <16 x i32> | |
212 %s8 = sext <16 x i1> undef to <16 x i16> ; CHECK-NEXT: bad result type: <16 x i16> | |
213 %ft = fptrunc <2 x double> undef to <2 x float> ; CHECK-NEXT: bad operand | |
214 %fe = fpext <4 x float> undef to <4 x double> ; CHECK-NEXT: bad result type: < 4 x double> | |
215 %fu64 = fptoui <2 x double> undef to <2 x i64> ; CHECK-NEXT: bad operand | |
216 %fs64 = fptosi <2 x double> undef to <2 x i64> ; CHECK-NEXT: bad operand | |
217 %uf64 = uitofp <2 x i64> undef to <2 x double> ; CHECK-NEXT: bad operand | |
218 %sf64 = sitofp <2 x i64> undef to <2 x double> ; CHECK-NEXT: bad operand | |
219 | |
220 ; Conversions to allowed types should work. | |
221 %t4 = trunc <4 x i32> undef to <4 x i1> ; CHECK-NOT: bad | |
222 %t5 = trunc <8 x i16> undef to <8 x i1> ; CHECK-NOT: bad | |
223 %t6 = trunc <16 x i8> undef to <16 x i1> ; CHECK-NOT: bad | |
224 %z10 = zext <4 x i1> undef to <4 x i32> ; CHECK-NOT: bad | |
225 %z11 = zext <8 x i1> undef to <8 x i16> ; CHECK-NOT: bad | |
226 %z12 = zext <16 x i1> undef to <16 x i8> ; CHECK-NOT: bad | |
227 %s10 = sext <4 x i1> undef to <4 x i32> ; CHECK-NOT: bad | |
228 %s11 = sext <8 x i1> undef to <8 x i16> ; CHECK-NOT: bad | |
229 %s12 = sext <16 x i1> undef to <16 x i8> ; CHECK-NOT: bad | |
230 %fu32 = fptoui <4 x float> undef to <4 x i32> ; CHECK-NOT: bad | |
231 %fs32 = fptosi <4 x float> undef to <4 x i32> ; CHECK-NOT: bad | |
232 %uf32 = uitofp <4 x i32> undef to <4 x float> ; CHECK-NOT: bad | |
233 %sf32 = sitofp <4 x i32> undef to <4 x float> ; CHECK-NOT: bad | |
234 ret void | |
235 } | |
236 ; CHECK-NOT: disallowed | |
117 | 237 |
118 define internal void @other() { | 238 define internal void @other() { |
239 ; CHECK-NOT: Function other | |
119 entry: | 240 entry: |
120 %a1 = icmp eq i32 undef, undef | 241 %icmp8 = icmp eq i8 undef, undef |
121 %a2 = fcmp oeq float undef, undef | 242 %icmp16 = icmp eq i16 undef, undef |
243 %icmp32 = icmp eq i32 undef, undef | |
244 %icmp64 = icmp eq i64 undef, undef | |
245 %vicmp8 = icmp eq <16 x i8> undef, undef | |
246 %vicmp16 = icmp eq <8 x i16> undef, undef | |
247 %vicmp32 = icmp eq <4 x i32> undef, undef | |
248 %fcmp32 = fcmp oeq float undef, undef | |
249 %fcmp64 = fcmp oeq double undef, undef | |
250 %vfcmp = fcmp oeq <4 x float> undef, undef | |
122 br i1 undef, label %foo, label %bar | 251 br i1 undef, label %foo, label %bar |
123 foo: | 252 foo: |
124 ; phi predecessor labels have to match to appease module verifier | 253 ; phi predecessor labels have to match to appease module verifier |
125 %a3 = phi i32 [0, %entry], [0, %foo] | 254 %phi1 = phi i1 [0, %entry], [0, %foo] |
126 %a4 = select i1 true, i8 undef, i8 undef | 255 %phi8 = phi i8 [0, %entry], [0, %foo] |
256 %phi16 = phi i16 [0, %entry], [0, %foo] | |
257 %phi32 = phi i32 [0, %entry], [0, %foo] | |
258 %phi64 = phi i64 [0, %entry], [0, %foo] | |
259 %vphi4x1 = phi <4 x i1> [undef, %entry], [undef, %foo] | |
260 %vphi8x1 = phi <8 x i1> [undef, %entry], [undef, %foo] | |
261 %vphi16x1 = phi <16 x i1> [undef, %entry], [undef, %foo] | |
262 %vphi8 = phi <16 x i8> [undef, %entry], [undef, %foo] | |
263 %vphi16 = phi <8 x i16> [undef, %entry], [undef, %foo] | |
264 %vphi32 = phi <4 x i32> [undef, %entry], [undef, %foo] | |
265 %select = select i1 true, i8 undef, i8 undef | |
266 %vselect4x1 = select i1 true, <4 x i1> undef, <4 x i1> undef | |
267 %vselect8x1 = select i1 true, <8 x i1> undef, <8 x i1> undef | |
268 %vselect16x1 = select i1 true, <16 x i1> undef, <16 x i1> undef | |
269 %vselect8 = select i1 true, <16 x i8> undef, <16 x i8> undef | |
270 %vselect16 = select i1 true, <8 x i16> undef, <8 x i16> undef | |
271 %vselect32 = select i1 true, <4 x i32> undef, <4 x i32> undef | |
127 call void @conversion() | 272 call void @conversion() |
128 br i1 undef, label %foo, label %bar | 273 br i1 undef, label %foo, label %bar |
129 bar: | 274 bar: |
130 ret void | 275 ret void |
131 } | 276 } |
277 ; CHECK-NOT: disallowed | |
132 | 278 |
133 define internal void @throwing_func() { | 279 define internal void @throwing_func() { |
280 ; CHECK-NOT: Function throwing_func | |
134 ret void | 281 ret void |
135 } | 282 } |
283 ; CHECK-NOT: disallowed | |
284 | |
136 define internal void @personality_func() { | 285 define internal void @personality_func() { |
286 ; CHECK-NOT: Function personality_func | |
137 ret void | 287 ret void |
138 } | 288 } |
289 ; CHECK-NOT: disallowed | |
139 | 290 |
140 define internal void @invoke_func() { | 291 define internal void @invoke_func() { |
292 ; CHECK: Function invoke_func | |
jvoung (off chromium)
2014/04/16 00:10:27
CHECK: ERROR: Function invoke_func
like the other
JF
2014/04/16 20:48:07
Done.
| |
141 invoke void @throwing_func() to label %ok unwind label %onerror | 293 invoke void @throwing_func() to label %ok unwind label %onerror |
142 ; CHECK-NOT: disallowed | 294 ; CHECK-NOT: disallowed |
143 ; CHECK: disallowed: bad instruction opcode: invoke | 295 ; CHECK: disallowed: bad instruction opcode: invoke |
144 ok: | 296 ok: |
145 ret void | 297 ret void |
146 onerror: | 298 onerror: |
147 %lp = landingpad i32 | 299 %lp = landingpad i32 |
148 personality i8* bitcast (void ()* @personality_func to i8*) | 300 personality i8* bitcast (void ()* @personality_func to i8*) |
149 catch i32* null | 301 catch i32* null |
150 ; CHECK: disallowed: bad instruction opcode: {{.*}} landingpad | 302 ; CHECK: disallowed: bad instruction opcode: {{.*}} landingpad |
151 resume i32 %lp | 303 resume i32 %lp |
152 ; CHECK: disallowed: bad instruction opcode: resume | 304 ; CHECK: disallowed: bad instruction opcode: resume |
153 } | 305 } |
154 | 306 |
155 define internal i32 @va_arg(i32 %va_list_as_int) { | 307 define internal i32 @va_arg(i32 %va_list_as_int) { |
308 ; CHECK: Function va_arg | |
156 %va_list = inttoptr i32 %va_list_as_int to i8* | 309 %va_list = inttoptr i32 %va_list_as_int to i8* |
157 %val = va_arg i8* %va_list, i32 | 310 %val = va_arg i8* %va_list, i32 |
158 ret i32 %val | 311 ret i32 %val |
159 } | 312 } |
160 ; CHECK-NOT: disallowed | 313 ; CHECK-NOT: disallowed |
161 ; CHECK: disallowed: bad instruction opcode: {{.*}} va_arg | 314 ; CHECK: disallowed: bad instruction opcode: {{.*}} va_arg |
162 | 315 |
163 @global_var = internal global [4 x i8] zeroinitializer | 316 @global_var = internal global [4 x i8] zeroinitializer |
164 | 317 |
165 define internal void @constantexpr() { | 318 define internal void @constantexpr() { |
319 ; CHECK: Function constantexpr | |
166 ptrtoint i8* getelementptr ([4 x i8]* @global_var, i32 1, i32 0) to i32 | 320 ptrtoint i8* getelementptr ([4 x i8]* @global_var, i32 1, i32 0) to i32 |
167 ret void | 321 ret void |
168 } | 322 } |
169 ; CHECK-NOT: disallowed | 323 ; CHECK-NOT: disallowed |
170 ; CHECK: disallowed: operand not InherentPtr: %1 = ptrtoint i8* getelementptr | 324 ; CHECK: disallowed: operand not InherentPtr: %1 = ptrtoint i8* getelementptr |
171 | 325 |
172 define internal void @inline_asm() { | 326 define internal void @inline_asm() { |
327 ; CHECK: Function inline_asm | |
173 call void asm "foo", ""() | 328 call void asm "foo", ""() |
174 ret void | 329 ret void |
175 } | 330 } |
176 ; CHECK-NOT: disallowed | 331 ; CHECK-NOT: disallowed |
177 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() | 332 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() |
178 | 333 |
179 ; CHECK-NOT: disallowed | 334 ; CHECK-NOT: disallowed |
180 ; If another check is added, there should be a check-not in between each check | 335 ; If another check is added, there should be a check-not in between each check |
OLD | NEW |