OLD | NEW |
1 ; RUN: pnacl-abicheck < %s | FileCheck %s | 1 ; RUN: 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 ; Terminator instructions | 8 ; Terminator instructions |
9 terminators: | 9 terminators: |
10 ret void | 10 ret void |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 ret void | 69 ret void |
70 } | 70 } |
71 | 71 |
72 define internal void @memory() { | 72 define internal void @memory() { |
73 ; Memory operations | 73 ; Memory operations |
74 %a1 = alloca i8, i32 4 | 74 %a1 = alloca i8, i32 4 |
75 %ptr = inttoptr i32 0 to i32* | 75 %ptr = inttoptr i32 0 to i32* |
76 %a2 = load i32* %ptr, align 1 | 76 %a2 = load i32* %ptr, align 1 |
77 store i32 undef, i32* %ptr, align 1 | 77 store i32 undef, i32* %ptr, align 1 |
78 fence acq_rel | |
79 %a3 = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel | |
80 %a4 = atomicrmw add i32* %ptr, i32 1 acquire | |
81 ; CHECK-NOT: disallowed | 78 ; CHECK-NOT: disallowed |
82 ; CHECK: disallowed: bad instruction opcode: {{.*}} getelementptr | 79 ; CHECK: disallowed: bad instruction opcode: {{.*}} getelementptr |
83 %a5 = getelementptr { i32, i32}* undef | 80 %a3 = getelementptr { i32, i32}* undef |
84 ret void | 81 ret void |
85 } | 82 } |
86 | 83 |
| 84 define internal void @atomic() { |
| 85 %a1 = alloca i8, i32 4 |
| 86 %ptr = inttoptr i32 0 to i32* |
| 87 ; CHECK: disallowed: atomic load: {{.*}} load atomic |
| 88 %a2 = load atomic i32* %ptr seq_cst, align 4 |
| 89 ; CHECK: disallowed: volatile load: {{.*}} load volatile |
| 90 %a3 = load volatile i32* %ptr, align 4 |
| 91 ; CHECK: disallowed: atomic store: store atomic |
| 92 store atomic i32 undef, i32* %ptr seq_cst, align 4 |
| 93 ; CHECK: disallowed: volatile store: store volatile |
| 94 store volatile i32 undef, i32* %ptr, align 4 |
| 95 ; CHECK: disallowed: bad instruction opcode: fence |
| 96 fence acq_rel |
| 97 ; CHECK: disallowed: bad instruction opcode: {{.*}} cmpxchg |
| 98 %a4 = cmpxchg i32* %ptr, i32 undef, i32 undef acq_rel |
| 99 ; CHECK: disallowed: bad instruction opcode: {{.*}} atomicrmw |
| 100 %a5 = atomicrmw add i32* %ptr, i32 1 acquire |
| 101 ret void |
| 102 } |
| 103 |
87 define internal void @conversion() { | 104 define internal void @conversion() { |
88 ; Conversion operations | 105 ; Conversion operations |
89 %a1 = trunc i32 undef to i8 | 106 %a1 = trunc i32 undef to i8 |
90 %a2 = zext i8 undef to i32 | 107 %a2 = zext i8 undef to i32 |
91 %a3 = sext i8 undef to i32 | 108 %a3 = sext i8 undef to i32 |
92 %a4 = fptrunc double undef to float | 109 %a4 = fptrunc double undef to float |
93 %a5 = fpext float undef to double | 110 %a5 = fpext float undef to double |
94 %a6 = fptoui double undef to i64 | 111 %a6 = fptoui double undef to i64 |
95 %a7 = fptosi double undef to i64 | 112 %a7 = fptosi double undef to i64 |
96 %a8 = uitofp i64 undef to double | 113 %a8 = uitofp i64 undef to double |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 171 |
155 define internal void @inline_asm() { | 172 define internal void @inline_asm() { |
156 call void asm "foo", ""() | 173 call void asm "foo", ""() |
157 ret void | 174 ret void |
158 } | 175 } |
159 ; CHECK-NOT: disallowed | 176 ; CHECK-NOT: disallowed |
160 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() | 177 ; CHECK: disallowed: inline assembly: call void asm "foo", ""() |
161 | 178 |
162 ; CHECK-NOT: disallowed | 179 ; CHECK-NOT: disallowed |
163 ; If another check is added, there should be a check-not in between each check | 180 ; If another check is added, there should be a check-not in between each check |
OLD | NEW |