| OLD | NEW |
| 1 ; This tests each of the supported NaCl atomic instructions for every | 1 ; This tests each of the supported NaCl atomic instructions for every |
| 2 ; size allowed. | 2 ; size allowed. |
| 3 | 3 |
| 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 5 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 5 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 7 ; RUN: -allow-externally-defined-symbols | FileCheck --check-prefix=O2 %s | 7 ; RUN: -allow-externally-defined-symbols | FileCheck --check-prefix=O2 %s |
| 8 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ | 8 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 9 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 9 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 %r = zext i8 %i2 to i32 | 82 %r = zext i8 %i2 to i32 |
| 83 ret i32 %r | 83 ret i32 %r |
| 84 } | 84 } |
| 85 ; CHECK-LABEL: test_atomic_load_8 | 85 ; CHECK-LABEL: test_atomic_load_8 |
| 86 ; CHECK: mov {{.*}},DWORD | 86 ; CHECK: mov {{.*}},DWORD |
| 87 ; CHECK: mov {{.*}},BYTE | 87 ; CHECK: mov {{.*}},BYTE |
| 88 ; ARM32-LABEL: test_atomic_load_8 | 88 ; ARM32-LABEL: test_atomic_load_8 |
| 89 ; ARM32: ldrb r{{[0-9]+}}, [r{{[0-9]+}} | 89 ; ARM32: ldrb r{{[0-9]+}}, [r{{[0-9]+}} |
| 90 ; ARM32: dmb | 90 ; ARM32: dmb |
| 91 ; MIPS32-LABEL: test_atomic_load_8 | 91 ; MIPS32-LABEL: test_atomic_load_8 |
| 92 ; MIPS32: lb | 92 ; MIPS32: sync |
| 93 ; MIPS32: ll |
| 94 ; MIPS32: sc |
| 93 ; MIPS32: sync | 95 ; MIPS32: sync |
| 94 | 96 |
| 95 define internal i32 @test_atomic_load_16(i32 %iptr) { | 97 define internal i32 @test_atomic_load_16(i32 %iptr) { |
| 96 entry: | 98 entry: |
| 97 %ptr = inttoptr i32 %iptr to i16* | 99 %ptr = inttoptr i32 %iptr to i16* |
| 98 %i = call i16 @llvm.nacl.atomic.load.i16(i16* %ptr, i32 6) | 100 %i = call i16 @llvm.nacl.atomic.load.i16(i16* %ptr, i32 6) |
| 99 %i2 = sub i16 %i, 0 | 101 %i2 = sub i16 %i, 0 |
| 100 %r = zext i16 %i2 to i32 | 102 %r = zext i16 %i2 to i32 |
| 101 ret i32 %r | 103 ret i32 %r |
| 102 } | 104 } |
| 103 ; CHECK-LABEL: test_atomic_load_16 | 105 ; CHECK-LABEL: test_atomic_load_16 |
| 104 ; CHECK: mov {{.*}},DWORD | 106 ; CHECK: mov {{.*}},DWORD |
| 105 ; CHECK: mov {{.*}},WORD | 107 ; CHECK: mov {{.*}},WORD |
| 106 ; ARM32-LABEL: test_atomic_load_16 | 108 ; ARM32-LABEL: test_atomic_load_16 |
| 107 ; ARM32: ldrh r{{[0-9]+}}, [r{{[0-9]+}} | 109 ; ARM32: ldrh r{{[0-9]+}}, [r{{[0-9]+}} |
| 108 ; ARM32: dmb | 110 ; ARM32: dmb |
| 109 ; MIPS32-LABEL: test_atomic_load_16 | 111 ; MIPS32-LABEL: test_atomic_load_16 |
| 110 ; MIPS32: lh | 112 ; MIPS32: sync |
| 113 ; MIPS32: ll |
| 114 ; MIPS32: sc |
| 111 ; MIPS32: sync | 115 ; MIPS32: sync |
| 112 | 116 |
| 113 define internal i32 @test_atomic_load_32(i32 %iptr) { | 117 define internal i32 @test_atomic_load_32(i32 %iptr) { |
| 114 entry: | 118 entry: |
| 115 %ptr = inttoptr i32 %iptr to i32* | 119 %ptr = inttoptr i32 %iptr to i32* |
| 116 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) | 120 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) |
| 117 ret i32 %r | 121 ret i32 %r |
| 118 } | 122 } |
| 119 ; CHECK-LABEL: test_atomic_load_32 | 123 ; CHECK-LABEL: test_atomic_load_32 |
| 120 ; CHECK: mov {{.*}},DWORD | 124 ; CHECK: mov {{.*}},DWORD |
| 121 ; CHECK: mov {{.*}},DWORD | 125 ; CHECK: mov {{.*}},DWORD |
| 122 ; ARM32-LABEL: test_atomic_load_32 | 126 ; ARM32-LABEL: test_atomic_load_32 |
| 123 ; ARM32: ldr r{{[0-9]+}}, [r{{[0-9]+}} | 127 ; ARM32: ldr r{{[0-9]+}}, [r{{[0-9]+}} |
| 124 ; ARM32: dmb | 128 ; ARM32: dmb |
| 125 ; MIPS32-LABEL: test_atomic_load_32 | 129 ; MIPS32-LABEL: test_atomic_load_32 |
| 126 ; MIPS32: lw | 130 ; MIPS32: sync |
| 131 ; MIPS32: ll |
| 132 ; MIPS32: sc |
| 127 ; MIPS32: sync | 133 ; MIPS32: sync |
| 128 | 134 |
| 129 define internal i64 @test_atomic_load_64(i32 %iptr) { | 135 define internal i64 @test_atomic_load_64(i32 %iptr) { |
| 130 entry: | 136 entry: |
| 131 %ptr = inttoptr i32 %iptr to i64* | 137 %ptr = inttoptr i32 %iptr to i64* |
| 132 %r = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) | 138 %r = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) |
| 133 ret i64 %r | 139 ret i64 %r |
| 134 } | 140 } |
| 135 ; CHECK-LABEL: test_atomic_load_64 | 141 ; CHECK-LABEL: test_atomic_load_64 |
| 136 ; CHECK: movq x{{.*}},QWORD | 142 ; CHECK: movq x{{.*}},QWORD |
| 137 ; CHECK: movq QWORD {{.*}},x{{.*}} | 143 ; CHECK: movq QWORD {{.*}},x{{.*}} |
| 138 ; ARM32-LABEL: test_atomic_load_64 | 144 ; ARM32-LABEL: test_atomic_load_64 |
| 139 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}} | 145 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}} |
| 140 ; ARM32: dmb | 146 ; ARM32: dmb |
| 141 ; MIPS32-LABEL: test_atomic_load_64 | 147 ; MIPS32-LABEL: test_atomic_load_64 |
| 142 ; MIPS32: lw | 148 ; MIPS32: jal __sync_val_compare_and_swap_8 |
| 143 ; MIPS32: lw | |
| 144 ; MIPS32: sync | 149 ; MIPS32: sync |
| 145 | 150 |
| 146 define internal i32 @test_atomic_load_32_with_arith(i32 %iptr) { | 151 define internal i32 @test_atomic_load_32_with_arith(i32 %iptr) { |
| 147 entry: | 152 entry: |
| 148 br label %next | 153 br label %next |
| 149 | 154 |
| 150 next: | 155 next: |
| 151 %ptr = inttoptr i32 %iptr to i32* | 156 %ptr = inttoptr i32 %iptr to i32* |
| 152 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) | 157 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) |
| 153 %r2 = sub i32 32, %r | 158 %r2 = sub i32 32, %r |
| 154 ret i32 %r2 | 159 ret i32 %r2 |
| 155 } | 160 } |
| 156 ; CHECK-LABEL: test_atomic_load_32_with_arith | 161 ; CHECK-LABEL: test_atomic_load_32_with_arith |
| 157 ; CHECK: mov {{.*}},DWORD | 162 ; CHECK: mov {{.*}},DWORD |
| 158 ; The next instruction may be a separate load or folded into an add. | 163 ; The next instruction may be a separate load or folded into an add. |
| 159 ; | 164 ; |
| 160 ; In O2 mode, we know that the load and sub are going to be fused. | 165 ; In O2 mode, we know that the load and sub are going to be fused. |
| 161 ; O2-LABEL: test_atomic_load_32_with_arith | 166 ; O2-LABEL: test_atomic_load_32_with_arith |
| 162 ; O2: mov {{.*}},DWORD | 167 ; O2: mov {{.*}},DWORD |
| 163 ; O2: sub {{.*}},DWORD | 168 ; O2: sub {{.*}},DWORD |
| 164 ; ARM32-LABEL: test_atomic_load_32_with_arith | 169 ; ARM32-LABEL: test_atomic_load_32_with_arith |
| 165 ; ARM32: ldr r{{[0-9]+}}, [r{{[0-9]+}} | 170 ; ARM32: ldr r{{[0-9]+}}, [r{{[0-9]+}} |
| 166 ; ARM32: dmb | 171 ; ARM32: dmb |
| 167 ; MIPS32-LABEL: test_atomic_load_32_with_arith | 172 ; MIPS32-LABEL: test_atomic_load_32_with_arith |
| 168 ; MIPS32: lw | |
| 169 ; MIPS32: sync | 173 ; MIPS32: sync |
| 174 ; MIPS32: ll |
| 175 ; MIPS32: sc |
| 176 ; MIPS32: sync |
| 177 ; MIPS32: subu |
| 170 | 178 |
| 171 define internal i32 @test_atomic_load_32_ignored(i32 %iptr) { | 179 define internal i32 @test_atomic_load_32_ignored(i32 %iptr) { |
| 172 entry: | 180 entry: |
| 173 %ptr = inttoptr i32 %iptr to i32* | 181 %ptr = inttoptr i32 %iptr to i32* |
| 174 %ignored = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) | 182 %ignored = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) |
| 175 ret i32 0 | 183 ret i32 0 |
| 176 } | 184 } |
| 177 ; CHECK-LABEL: test_atomic_load_32_ignored | 185 ; CHECK-LABEL: test_atomic_load_32_ignored |
| 178 ; CHECK: mov {{.*}},DWORD | 186 ; CHECK: mov {{.*}},DWORD |
| 179 ; CHECK: mov {{.*}},DWORD | 187 ; CHECK: mov {{.*}},DWORD |
| 180 ; O2-LABEL: test_atomic_load_32_ignored | 188 ; O2-LABEL: test_atomic_load_32_ignored |
| 181 ; O2: mov {{.*}},DWORD | 189 ; O2: mov {{.*}},DWORD |
| 182 ; O2: mov {{.*}},DWORD | 190 ; O2: mov {{.*}},DWORD |
| 183 ; ARM32-LABEL: test_atomic_load_32_ignored | 191 ; ARM32-LABEL: test_atomic_load_32_ignored |
| 184 ; ARM32: ldr r{{[0-9]+}}, [r{{[0-9]+}} | 192 ; ARM32: ldr r{{[0-9]+}}, [r{{[0-9]+}} |
| 185 ; ARM32: dmb | 193 ; ARM32: dmb |
| 186 ; MIPS32-LABEL: test_atomic_load_32_ignored | 194 ; MIPS32-LABEL: test_atomic_load_32_ignored |
| 187 ; MIPS32: lw | 195 ; MIPS32: sync |
| 196 ; MIPS32: ll |
| 197 ; MIPS32: sc |
| 188 ; MIPS32: sync | 198 ; MIPS32: sync |
| 189 | 199 |
| 190 define internal i64 @test_atomic_load_64_ignored(i32 %iptr) { | 200 define internal i64 @test_atomic_load_64_ignored(i32 %iptr) { |
| 191 entry: | 201 entry: |
| 192 %ptr = inttoptr i32 %iptr to i64* | 202 %ptr = inttoptr i32 %iptr to i64* |
| 193 %ignored = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) | 203 %ignored = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) |
| 194 ret i64 0 | 204 ret i64 0 |
| 195 } | 205 } |
| 196 ; CHECK-LABEL: test_atomic_load_64_ignored | 206 ; CHECK-LABEL: test_atomic_load_64_ignored |
| 197 ; CHECK: movq x{{.*}},QWORD | 207 ; CHECK: movq x{{.*}},QWORD |
| 198 ; CHECK: movq QWORD {{.*}},x{{.*}} | 208 ; CHECK: movq QWORD {{.*}},x{{.*}} |
| 199 ; ARM32-LABEL: test_atomic_load_64_ignored | 209 ; ARM32-LABEL: test_atomic_load_64_ignored |
| 200 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}} | 210 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}} |
| 201 ; ARM32: dmb | 211 ; ARM32: dmb |
| 202 ; MIPS32-LABEL: test_atomic_load_64_ignored | 212 ; MIPS32-LABEL: test_atomic_load_64_ignored |
| 203 ; MIPS32: lw | 213 ; MIPS32: jal» __sync_val_compare_and_swap_8 |
| 204 ; MIPS32: lw | |
| 205 ; MIPS32: sync | 214 ; MIPS32: sync |
| 206 | 215 |
| 207 ;;; Store | 216 ;;; Store |
| 208 | 217 |
| 209 define internal void @test_atomic_store_8(i32 %iptr, i32 %v) { | 218 define internal void @test_atomic_store_8(i32 %iptr, i32 %v) { |
| 210 entry: | 219 entry: |
| 211 %truncv = trunc i32 %v to i8 | 220 %truncv = trunc i32 %v to i8 |
| 212 %ptr = inttoptr i32 %iptr to i8* | 221 %ptr = inttoptr i32 %iptr to i8* |
| 213 call void @llvm.nacl.atomic.store.i8(i8 %truncv, i8* %ptr, i32 6) | 222 call void @llvm.nacl.atomic.store.i8(i8 %truncv, i8* %ptr, i32 6) |
| 214 ret void | 223 ret void |
| 215 } | 224 } |
| 216 ; CHECK-LABEL: test_atomic_store_8 | 225 ; CHECK-LABEL: test_atomic_store_8 |
| 217 ; CHECK: mov BYTE | 226 ; CHECK: mov BYTE |
| 218 ; CHECK: mfence | 227 ; CHECK: mfence |
| 219 ; ARM32-LABEL: test_atomic_store_8 | 228 ; ARM32-LABEL: test_atomic_store_8 |
| 220 ; ARM32: dmb | 229 ; ARM32: dmb |
| 221 ; ARM32: strb r{{[0-9]+}}, [r{{[0-9]+}} | 230 ; ARM32: strb r{{[0-9]+}}, [r{{[0-9]+}} |
| 222 ; ARM32: dmb | 231 ; ARM32: dmb |
| 223 ; MIPS32-LABEL: test_atomic_store_8 | 232 ; MIPS32-LABEL: test_atomic_store_8 |
| 224 ; MIPS32: sync | 233 ; MIPS32: sync |
| 225 ; MIPS32: sb | 234 ; MIPS32: ll |
| 235 ; MIPS32: sc |
| 226 ; MIPS32: sync | 236 ; MIPS32: sync |
| 227 | 237 |
| 228 define internal void @test_atomic_store_16(i32 %iptr, i32 %v) { | 238 define internal void @test_atomic_store_16(i32 %iptr, i32 %v) { |
| 229 entry: | 239 entry: |
| 230 %truncv = trunc i32 %v to i16 | 240 %truncv = trunc i32 %v to i16 |
| 231 %ptr = inttoptr i32 %iptr to i16* | 241 %ptr = inttoptr i32 %iptr to i16* |
| 232 call void @llvm.nacl.atomic.store.i16(i16 %truncv, i16* %ptr, i32 6) | 242 call void @llvm.nacl.atomic.store.i16(i16 %truncv, i16* %ptr, i32 6) |
| 233 ret void | 243 ret void |
| 234 } | 244 } |
| 235 ; CHECK-LABEL: test_atomic_store_16 | 245 ; CHECK-LABEL: test_atomic_store_16 |
| 236 ; CHECK: mov WORD | 246 ; CHECK: mov WORD |
| 237 ; CHECK: mfence | 247 ; CHECK: mfence |
| 238 ; ARM32-LABEL: test_atomic_store_16 | 248 ; ARM32-LABEL: test_atomic_store_16 |
| 239 ; ARM32: dmb | 249 ; ARM32: dmb |
| 240 ; ARM32: strh r{{[0-9]+}}, [r{{[0-9]+}} | 250 ; ARM32: strh r{{[0-9]+}}, [r{{[0-9]+}} |
| 241 ; ARM32: dmb | 251 ; ARM32: dmb |
| 242 ; MIPS32-LABEL: test_atomic_store_16 | 252 ; MIPS32-LABEL: test_atomic_store_16 |
| 243 ; MIPS32: sync | 253 ; MIPS32: sync |
| 244 ; MIPS32: sh | 254 ; MIPS32: ll |
| 255 ; MIPS32: sc |
| 245 ; MIPS32: sync | 256 ; MIPS32: sync |
| 246 | 257 |
| 247 define internal void @test_atomic_store_32(i32 %iptr, i32 %v) { | 258 define internal void @test_atomic_store_32(i32 %iptr, i32 %v) { |
| 248 entry: | 259 entry: |
| 249 %ptr = inttoptr i32 %iptr to i32* | 260 %ptr = inttoptr i32 %iptr to i32* |
| 250 call void @llvm.nacl.atomic.store.i32(i32 %v, i32* %ptr, i32 6) | 261 call void @llvm.nacl.atomic.store.i32(i32 %v, i32* %ptr, i32 6) |
| 251 ret void | 262 ret void |
| 252 } | 263 } |
| 253 ; CHECK-LABEL: test_atomic_store_32 | 264 ; CHECK-LABEL: test_atomic_store_32 |
| 254 ; CHECK: mov DWORD | 265 ; CHECK: mov DWORD |
| 255 ; CHECK: mfence | 266 ; CHECK: mfence |
| 256 ; ARM32-LABEL: test_atomic_store_32 | 267 ; ARM32-LABEL: test_atomic_store_32 |
| 257 ; ARM32: dmb | 268 ; ARM32: dmb |
| 258 ; ARM32: str r{{[0-9]+}}, [r{{[0-9]+}} | 269 ; ARM32: str r{{[0-9]+}}, [r{{[0-9]+}} |
| 259 ; ARM32: dmb | 270 ; ARM32: dmb |
| 260 ; MIPS32-LABEL: test_atomic_store_32 | 271 ; MIPS32-LABEL: test_atomic_store_32 |
| 261 ; MIPS32: sync | 272 ; MIPS32: sync |
| 262 ; MIPS32: sw | 273 ; MIPS32: ll |
| 274 ; MIPS32: sc |
| 263 ; MIPS32: sync | 275 ; MIPS32: sync |
| 264 | 276 |
| 265 define internal void @test_atomic_store_64(i32 %iptr, i64 %v) { | 277 define internal void @test_atomic_store_64(i32 %iptr, i64 %v) { |
| 266 entry: | 278 entry: |
| 267 %ptr = inttoptr i32 %iptr to i64* | 279 %ptr = inttoptr i32 %iptr to i64* |
| 268 call void @llvm.nacl.atomic.store.i64(i64 %v, i64* %ptr, i32 6) | 280 call void @llvm.nacl.atomic.store.i64(i64 %v, i64* %ptr, i32 6) |
| 269 ret void | 281 ret void |
| 270 } | 282 } |
| 271 ; CHECK-LABEL: test_atomic_store_64 | 283 ; CHECK-LABEL: test_atomic_store_64 |
| 272 ; CHECK: movq x{{.*}},QWORD | 284 ; CHECK: movq x{{.*}},QWORD |
| 273 ; CHECK: movq QWORD {{.*}},x{{.*}} | 285 ; CHECK: movq QWORD {{.*}},x{{.*}} |
| 274 ; CHECK: mfence | 286 ; CHECK: mfence |
| 275 ; ARM32-LABEL: test_atomic_store_64 | 287 ; ARM32-LABEL: test_atomic_store_64 |
| 276 ; ARM32: dmb | 288 ; ARM32: dmb |
| 277 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [[MEM:.*]] | 289 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [[MEM:.*]] |
| 278 ; ARM32: strexd [[S:r[0-9]+]], r{{[0-9]+}}, r{{[0-9]+}}, [[MEM]] | 290 ; ARM32: strexd [[S:r[0-9]+]], r{{[0-9]+}}, r{{[0-9]+}}, [[MEM]] |
| 279 ; ARM32: cmp [[S]], #0 | 291 ; ARM32: cmp [[S]], #0 |
| 280 ; ARM32: bne | 292 ; ARM32: bne |
| 281 ; ARM32: dmb | 293 ; ARM32: dmb |
| 282 ; MIPS32-LABEL: test_atomic_store_64 | 294 ; MIPS32-LABEL: test_atomic_store_64 |
| 283 ; MIPS32: sync | 295 ; MIPS32: sync |
| 284 ; MIPS32: sw | 296 ; MIPS32: jal» __sync_lock_test_and_set_8 |
| 285 ; MIPS32: sw | |
| 286 ; MIPS32: sync | 297 ; MIPS32: sync |
| 287 | 298 |
| 288 define internal void @test_atomic_store_64_const(i32 %iptr) { | 299 define internal void @test_atomic_store_64_const(i32 %iptr) { |
| 289 entry: | 300 entry: |
| 290 %ptr = inttoptr i32 %iptr to i64* | 301 %ptr = inttoptr i32 %iptr to i64* |
| 291 call void @llvm.nacl.atomic.store.i64(i64 12345678901234, i64* %ptr, i32 6) | 302 call void @llvm.nacl.atomic.store.i64(i64 12345678901234, i64* %ptr, i32 6) |
| 292 ret void | 303 ret void |
| 293 } | 304 } |
| 294 ; CHECK-LABEL: test_atomic_store_64_const | 305 ; CHECK-LABEL: test_atomic_store_64_const |
| 295 ; CHECK: mov {{.*}},0x73ce2ff2 | 306 ; CHECK: mov {{.*}},0x73ce2ff2 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 306 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [[MEM:.*]] | 317 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [[MEM:.*]] |
| 307 ; ARM32: strexd [[S:r[0-9]+]], r{{[0-9]+}}, r{{[0-9]+}}, [[MEM]] | 318 ; ARM32: strexd [[S:r[0-9]+]], r{{[0-9]+}}, r{{[0-9]+}}, [[MEM]] |
| 308 ; ARM32: cmp [[S]], #0 | 319 ; ARM32: cmp [[S]], #0 |
| 309 ; ARM32: bne .L[[RETRY]] | 320 ; ARM32: bne .L[[RETRY]] |
| 310 ; ARM32: dmb | 321 ; ARM32: dmb |
| 311 ; MIPS32-LABEL: test_atomic_store_64_const | 322 ; MIPS32-LABEL: test_atomic_store_64_const |
| 312 ; MIPS32: sync | 323 ; MIPS32: sync |
| 313 ; MIPS32: lui {{.*}}, 29646 | 324 ; MIPS32: lui {{.*}}, 29646 |
| 314 ; MIPS32: ori {{.*}},{{.*}}, 12274 | 325 ; MIPS32: ori {{.*}},{{.*}}, 12274 |
| 315 ; MIPS32: addiu {{.*}}, $zero, 2874 | 326 ; MIPS32: addiu {{.*}}, $zero, 2874 |
| 316 ; MIPS32: sw | 327 ; MIPS32: jal» __sync_lock_test_and_set_8 |
| 317 ; MIPS32: sw | |
| 318 ; MIPS32: sync | 328 ; MIPS32: sync |
| 319 | 329 |
| 320 ;;; RMW | 330 ;;; RMW |
| 321 | 331 |
| 322 ;; add | 332 ;; add |
| 323 | 333 |
| 324 define internal i32 @test_atomic_rmw_add_8(i32 %iptr, i32 %v) { | 334 define internal i32 @test_atomic_rmw_add_8(i32 %iptr, i32 %v) { |
| 325 entry: | 335 entry: |
| 326 %trunc = trunc i32 %v to i8 | 336 %trunc = trunc i32 %v to i8 |
| 327 %ptr = inttoptr i32 %iptr to i8* | 337 %ptr = inttoptr i32 %iptr to i8* |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 ; ARM32-LABEL: test_atomic_rmw_add_64 | 462 ; ARM32-LABEL: test_atomic_rmw_add_64 |
| 453 ; ARM32: dmb | 463 ; ARM32: dmb |
| 454 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 464 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 455 ; ARM32: adds | 465 ; ARM32: adds |
| 456 ; ARM32: adc | 466 ; ARM32: adc |
| 457 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 467 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 458 ; ARM32: bne | 468 ; ARM32: bne |
| 459 ; ARM32: dmb | 469 ; ARM32: dmb |
| 460 ; MIPS32-LABEL: test_atomic_rmw_add_64 | 470 ; MIPS32-LABEL: test_atomic_rmw_add_64 |
| 461 ; MIPS32: sync | 471 ; MIPS32: sync |
| 462 ; MIPS32: ll | 472 ; MIPS32: jal» __sync_fetch_and_add_8 |
| 463 ; MIPS32: addu | |
| 464 ; MIPS32: sltu | |
| 465 ; MIPS32: sc | |
| 466 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 467 ; MIPS32: ll | |
| 468 ; MIPS32: addu | |
| 469 ; MIPS32: addu | |
| 470 ; MIPS32: sc | |
| 471 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 472 ; MIPS32: sync | 473 ; MIPS32: sync |
| 473 | 474 |
| 474 ; Same test as above, but with a global address to test FakeUse issues. | 475 ; Same test as above, but with a global address to test FakeUse issues. |
| 475 define internal i64 @test_atomic_rmw_add_64_global(i64 %v) { | 476 define internal i64 @test_atomic_rmw_add_64_global(i64 %v) { |
| 476 entry: | 477 entry: |
| 477 %ptr = bitcast [8 x i8]* @SzGlobal64 to i64* | 478 %ptr = bitcast [8 x i8]* @SzGlobal64 to i64* |
| 478 %a = call i64 @llvm.nacl.atomic.rmw.i64(i32 1, i64* %ptr, i64 %v, i32 6) | 479 %a = call i64 @llvm.nacl.atomic.rmw.i64(i32 1, i64* %ptr, i64 %v, i32 6) |
| 479 ret i64 %a | 480 ret i64 %a |
| 480 } | 481 } |
| 481 ; CHECK-LABEL: test_atomic_rmw_add_64_global | 482 ; CHECK-LABEL: test_atomic_rmw_add_64_global |
| 482 ; ARM32-LABEL: test_atomic_rmw_add_64_global | 483 ; ARM32-LABEL: test_atomic_rmw_add_64_global |
| 483 ; ARM32: dmb | 484 ; ARM32: dmb |
| 484 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 485 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 485 ; ARM32: adds | 486 ; ARM32: adds |
| 486 ; ARM32: adc | 487 ; ARM32: adc |
| 487 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 488 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 488 ; ARM32: bne | 489 ; ARM32: bne |
| 489 ; ARM32: dmb | 490 ; ARM32: dmb |
| 490 ; MIPS32-LABEL: test_atomic_rmw_add_64_global | 491 ; MIPS32-LABEL: test_atomic_rmw_add_64_global |
| 491 ; MIPS32: sync | 492 ; MIPS32: sync |
| 492 ; MIPS32: ll | 493 ; MIPS32: jal» __sync_fetch_and_add_8 |
| 493 ; MIPS32: addu | |
| 494 ; MIPS32: sltu | |
| 495 ; MIPS32: sc | |
| 496 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 497 ; MIPS32: ll | |
| 498 ; MIPS32: addu | |
| 499 ; MIPS32: addu | |
| 500 ; MIPS32: sc | |
| 501 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 502 ; MIPS32: sync | 494 ; MIPS32: sync |
| 503 | 495 |
| 504 ; Test with some more register pressure. When we have an alloca, ebp is | 496 ; Test with some more register pressure. When we have an alloca, ebp is |
| 505 ; used to manage the stack frame, so it cannot be used as a register either. | 497 ; used to manage the stack frame, so it cannot be used as a register either. |
| 506 declare void @use_ptr(i32 %iptr) | 498 declare void @use_ptr(i32 %iptr) |
| 507 | 499 |
| 508 define internal i64 @test_atomic_rmw_add_64_alloca(i32 %iptr, i64 %v) { | 500 define internal i64 @test_atomic_rmw_add_64_alloca(i32 %iptr, i64 %v) { |
| 509 entry: | 501 entry: |
| 510 br label %eblock ; Disable alloca optimization | 502 br label %eblock ; Disable alloca optimization |
| 511 eblock: | 503 eblock: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 536 ; ARM32-LABEL: test_atomic_rmw_add_64_alloca | 528 ; ARM32-LABEL: test_atomic_rmw_add_64_alloca |
| 537 ; ARM32: dmb | 529 ; ARM32: dmb |
| 538 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 530 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 539 ; ARM32: adds | 531 ; ARM32: adds |
| 540 ; ARM32: adc | 532 ; ARM32: adc |
| 541 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 533 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 542 ; ARM32: bne | 534 ; ARM32: bne |
| 543 ; ARM32: dmb | 535 ; ARM32: dmb |
| 544 ; MIPS32-LABEL: test_atomic_rmw_add_64_alloca | 536 ; MIPS32-LABEL: test_atomic_rmw_add_64_alloca |
| 545 ; MIPS32: sync | 537 ; MIPS32: sync |
| 546 ; MIPS32: ll | 538 ; MIPS32: jal» __sync_fetch_and_add_8 |
| 547 ; MIPS32: addu | |
| 548 ; MIPS32: sltu | |
| 549 ; MIPS32: sc | |
| 550 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 551 ; MIPS32: ll | |
| 552 ; MIPS32: addu | |
| 553 ; MIPS32: addu | |
| 554 ; MIPS32: sc | |
| 555 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 556 ; MIPS32: sync | 539 ; MIPS32: sync |
| 557 | 540 |
| 558 define internal i32 @test_atomic_rmw_add_32_ignored(i32 %iptr, i32 %v) { | 541 define internal i32 @test_atomic_rmw_add_32_ignored(i32 %iptr, i32 %v) { |
| 559 entry: | 542 entry: |
| 560 %ptr = inttoptr i32 %iptr to i32* | 543 %ptr = inttoptr i32 %iptr to i32* |
| 561 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 1, i32* %ptr, i32 %v, i32 6) | 544 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 1, i32* %ptr, i32 %v, i32 6) |
| 562 ret i32 %v | 545 ret i32 %v |
| 563 } | 546 } |
| 564 ; Technically this could use "lock add" instead of "lock xadd", if liveness | 547 ; Technically this could use "lock add" instead of "lock xadd", if liveness |
| 565 ; tells us that the destination variable is dead. | 548 ; tells us that the destination variable is dead. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 ; ARM32: dmb | 597 ; ARM32: dmb |
| 615 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 598 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 616 ; ARM32: adds | 599 ; ARM32: adds |
| 617 ; ARM32: adc | 600 ; ARM32: adc |
| 618 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 601 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 619 ; ARM32: bne | 602 ; ARM32: bne |
| 620 ; ARM32: dmb | 603 ; ARM32: dmb |
| 621 ; ARM32: b | 604 ; ARM32: b |
| 622 ; MIPS32-LABEL: test_atomic_rmw_add_64_loop | 605 ; MIPS32-LABEL: test_atomic_rmw_add_64_loop |
| 623 ; MIPS32: sync | 606 ; MIPS32: sync |
| 624 ; MIPS32: ll | 607 ; MIPS32: jal» __sync_fetch_and_add_8 |
| 625 ; MIPS32: addu | |
| 626 ; MIPS32: sltu | |
| 627 ; MIPS32: sc | |
| 628 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 629 ; MIPS32: ll | |
| 630 ; MIPS32: addu | |
| 631 ; MIPS32: addu | |
| 632 ; MIPS32: sc | |
| 633 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 634 ; MIPS32: sync | 608 ; MIPS32: sync |
| 635 | 609 |
| 636 ;; sub | 610 ;; sub |
| 637 | 611 |
| 638 define internal i32 @test_atomic_rmw_sub_8(i32 %iptr, i32 %v) { | 612 define internal i32 @test_atomic_rmw_sub_8(i32 %iptr, i32 %v) { |
| 639 entry: | 613 entry: |
| 640 %trunc = trunc i32 %v to i8 | 614 %trunc = trunc i32 %v to i8 |
| 641 %ptr = inttoptr i32 %iptr to i8* | 615 %ptr = inttoptr i32 %iptr to i8* |
| 642 %a = call i8 @llvm.nacl.atomic.rmw.i8(i32 2, i8* %ptr, i8 %trunc, i32 6) | 616 %a = call i8 @llvm.nacl.atomic.rmw.i8(i32 2, i8* %ptr, i8 %trunc, i32 6) |
| 643 %a_ext = zext i8 %a to i32 | 617 %a_ext = zext i8 %a to i32 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 ; ARM32-LABEL: test_atomic_rmw_sub_64 | 737 ; ARM32-LABEL: test_atomic_rmw_sub_64 |
| 764 ; ARM32: dmb | 738 ; ARM32: dmb |
| 765 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 739 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 766 ; ARM32: subs | 740 ; ARM32: subs |
| 767 ; ARM32: sbc | 741 ; ARM32: sbc |
| 768 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 742 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 769 ; ARM32: bne | 743 ; ARM32: bne |
| 770 ; ARM32: dmb | 744 ; ARM32: dmb |
| 771 ; MIPS32-LABEL: test_atomic_rmw_sub_64 | 745 ; MIPS32-LABEL: test_atomic_rmw_sub_64 |
| 772 ; MIPS32: sync | 746 ; MIPS32: sync |
| 773 ; MIPS32: ll | 747 ; MIPS32: jal» __sync_fetch_and_sub_8 |
| 774 ; MIPS32: subu | |
| 775 ; MIPS32: sltu | |
| 776 ; MIPS32: sc | |
| 777 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 778 ; MIPS32: ll | |
| 779 ; MIPS32: addu | |
| 780 ; MIPS32: subu | |
| 781 ; MIPS32: sc | |
| 782 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 783 ; MIPS32: sync | 748 ; MIPS32: sync |
| 784 | 749 |
| 785 define internal i32 @test_atomic_rmw_sub_32_ignored(i32 %iptr, i32 %v) { | 750 define internal i32 @test_atomic_rmw_sub_32_ignored(i32 %iptr, i32 %v) { |
| 786 entry: | 751 entry: |
| 787 %ptr = inttoptr i32 %iptr to i32* | 752 %ptr = inttoptr i32 %iptr to i32* |
| 788 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 2, i32* %ptr, i32 %v, i32 6) | 753 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 2, i32* %ptr, i32 %v, i32 6) |
| 789 ret i32 %v | 754 ret i32 %v |
| 790 } | 755 } |
| 791 ; Could use "lock sub" instead of "neg; lock xadd" | 756 ; Could use "lock sub" instead of "neg; lock xadd" |
| 792 ; CHECK-LABEL: test_atomic_rmw_sub_32_ignored | 757 ; CHECK-LABEL: test_atomic_rmw_sub_32_ignored |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 ; ARM32-LABEL: test_atomic_rmw_or_64 | 1016 ; ARM32-LABEL: test_atomic_rmw_or_64 |
| 1052 ; ARM32: dmb | 1017 ; ARM32: dmb |
| 1053 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 1018 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 1054 ; ARM32: orr | 1019 ; ARM32: orr |
| 1055 ; ARM32: orr | 1020 ; ARM32: orr |
| 1056 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 1021 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 1057 ; ARM32: bne | 1022 ; ARM32: bne |
| 1058 ; ARM32: dmb | 1023 ; ARM32: dmb |
| 1059 ; MIPS32-LABEL: test_atomic_rmw_or_64 | 1024 ; MIPS32-LABEL: test_atomic_rmw_or_64 |
| 1060 ; MIPS32: sync | 1025 ; MIPS32: sync |
| 1061 ; MIPS32: ll | 1026 ; MIPS32: jal» __sync_fetch_and_or_8 |
| 1062 ; MIPS32: or | |
| 1063 ; MIPS32: sc | |
| 1064 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1065 ; MIPS32: ll | |
| 1066 ; MIPS32: or | |
| 1067 ; MIPS32: sc | |
| 1068 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1069 ; MIPS32: sync | 1027 ; MIPS32: sync |
| 1070 | 1028 |
| 1071 define internal i32 @test_atomic_rmw_or_32_ignored(i32 %iptr, i32 %v) { | 1029 define internal i32 @test_atomic_rmw_or_32_ignored(i32 %iptr, i32 %v) { |
| 1072 entry: | 1030 entry: |
| 1073 %ptr = inttoptr i32 %iptr to i32* | 1031 %ptr = inttoptr i32 %iptr to i32* |
| 1074 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 3, i32* %ptr, i32 %v, i32 6) | 1032 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 3, i32* %ptr, i32 %v, i32 6) |
| 1075 ret i32 %v | 1033 ret i32 %v |
| 1076 } | 1034 } |
| 1077 ; CHECK-LABEL: test_atomic_rmw_or_32_ignored | 1035 ; CHECK-LABEL: test_atomic_rmw_or_32_ignored |
| 1078 ; Could just "lock or", if we inspect the liveness information first. | 1036 ; Could just "lock or", if we inspect the liveness information first. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 ; ARM32-LABEL: test_atomic_rmw_and_64 | 1188 ; ARM32-LABEL: test_atomic_rmw_and_64 |
| 1231 ; ARM32: dmb | 1189 ; ARM32: dmb |
| 1232 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 1190 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 1233 ; ARM32: and | 1191 ; ARM32: and |
| 1234 ; ARM32: and | 1192 ; ARM32: and |
| 1235 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 1193 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 1236 ; ARM32: bne | 1194 ; ARM32: bne |
| 1237 ; ARM32: dmb | 1195 ; ARM32: dmb |
| 1238 ; MIPS32-LABEL: test_atomic_rmw_and_64 | 1196 ; MIPS32-LABEL: test_atomic_rmw_and_64 |
| 1239 ; MIPS32: sync | 1197 ; MIPS32: sync |
| 1240 ; MIPS32: ll | 1198 ; MIPS32: jal» __sync_fetch_and_and_8 |
| 1241 ; MIPS32: and | |
| 1242 ; MIPS32: sc | |
| 1243 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1244 ; MIPS32: ll | |
| 1245 ; MIPS32: and | |
| 1246 ; MIPS32: sc | |
| 1247 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1248 ; MIPS32: sync | 1199 ; MIPS32: sync |
| 1249 | 1200 |
| 1250 define internal i32 @test_atomic_rmw_and_32_ignored(i32 %iptr, i32 %v) { | 1201 define internal i32 @test_atomic_rmw_and_32_ignored(i32 %iptr, i32 %v) { |
| 1251 entry: | 1202 entry: |
| 1252 %ptr = inttoptr i32 %iptr to i32* | 1203 %ptr = inttoptr i32 %iptr to i32* |
| 1253 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 4, i32* %ptr, i32 %v, i32 6) | 1204 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 4, i32* %ptr, i32 %v, i32 6) |
| 1254 ret i32 %v | 1205 ret i32 %v |
| 1255 } | 1206 } |
| 1256 ; CHECK-LABEL: test_atomic_rmw_and_32_ignored | 1207 ; CHECK-LABEL: test_atomic_rmw_and_32_ignored |
| 1257 ; Could just "lock and" | 1208 ; Could just "lock and" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 ; ARM32-LABEL: test_atomic_rmw_xor_64 | 1358 ; ARM32-LABEL: test_atomic_rmw_xor_64 |
| 1408 ; ARM32: dmb | 1359 ; ARM32: dmb |
| 1409 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 1360 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 1410 ; ARM32: eor | 1361 ; ARM32: eor |
| 1411 ; ARM32: eor | 1362 ; ARM32: eor |
| 1412 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] | 1363 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, [r{{[0-9]+}}] |
| 1413 ; ARM32: bne | 1364 ; ARM32: bne |
| 1414 ; ARM32: dmb | 1365 ; ARM32: dmb |
| 1415 ; MIPS32-LABEL: test_atomic_rmw_xor_64 | 1366 ; MIPS32-LABEL: test_atomic_rmw_xor_64 |
| 1416 ; MIPS32: sync | 1367 ; MIPS32: sync |
| 1417 ; MIPS32: ll | 1368 ; MIPS32: jal» __sync_fetch_and_xor_8 |
| 1418 ; MIPS32: xor | |
| 1419 ; MIPS32: sc | |
| 1420 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1421 ; MIPS32: ll | |
| 1422 ; MIPS32: xor | |
| 1423 ; MIPS32: sc | |
| 1424 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1425 ; MIPS32: sync | 1369 ; MIPS32: sync |
| 1426 | 1370 |
| 1427 define internal i32 @test_atomic_rmw_xor_32_ignored(i32 %iptr, i32 %v) { | 1371 define internal i32 @test_atomic_rmw_xor_32_ignored(i32 %iptr, i32 %v) { |
| 1428 entry: | 1372 entry: |
| 1429 %ptr = inttoptr i32 %iptr to i32* | 1373 %ptr = inttoptr i32 %iptr to i32* |
| 1430 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 5, i32* %ptr, i32 %v, i32 6) | 1374 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 5, i32* %ptr, i32 %v, i32 6) |
| 1431 ret i32 %v | 1375 ret i32 %v |
| 1432 } | 1376 } |
| 1433 ; CHECK-LABEL: test_atomic_rmw_xor_32_ignored | 1377 ; CHECK-LABEL: test_atomic_rmw_xor_32_ignored |
| 1434 ; CHECK: mov eax,DWORD PTR | 1378 ; CHECK: mov eax,DWORD PTR |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 ; CHECK: jne | 1511 ; CHECK: jne |
| 1568 ; ARM32-LABEL: test_atomic_rmw_xchg_64 | 1512 ; ARM32-LABEL: test_atomic_rmw_xchg_64 |
| 1569 ; ARM32: dmb | 1513 ; ARM32: dmb |
| 1570 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[PTR:r[0-9]+]]{{[]]}} | 1514 ; ARM32: ldrexd r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[PTR:r[0-9]+]]{{[]]}} |
| 1571 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[PTR]]{{[]]}} | 1515 ; ARM32: strexd r{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[PTR]]{{[]]}} |
| 1572 ; ARM32: cmp | 1516 ; ARM32: cmp |
| 1573 ; ARM32: bne | 1517 ; ARM32: bne |
| 1574 ; ARM32: dmb | 1518 ; ARM32: dmb |
| 1575 ; MIPS32-LABEL: test_atomic_rmw_xchg_64 | 1519 ; MIPS32-LABEL: test_atomic_rmw_xchg_64 |
| 1576 ; MIPS32: sync | 1520 ; MIPS32: sync |
| 1577 ; MIPS32: ll | 1521 ; MIPS32: jal» __sync_lock_test_and_set_8 |
| 1578 ; MIPS32: move | |
| 1579 ; MIPS32: sc | |
| 1580 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1581 ; MIPS32: ll | |
| 1582 ; MIPS32: move | |
| 1583 ; MIPS32: sc | |
| 1584 ; MIPS32: beq» {{.*}}, $zero, {{.*}} | |
| 1585 ; MIPS32: sync | 1522 ; MIPS32: sync |
| 1586 | 1523 |
| 1587 define internal i32 @test_atomic_rmw_xchg_32_ignored(i32 %iptr, i32 %v) { | 1524 define internal i32 @test_atomic_rmw_xchg_32_ignored(i32 %iptr, i32 %v) { |
| 1588 entry: | 1525 entry: |
| 1589 %ptr = inttoptr i32 %iptr to i32* | 1526 %ptr = inttoptr i32 %iptr to i32* |
| 1590 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 6, i32* %ptr, i32 %v, i32 6) | 1527 %ignored = call i32 @llvm.nacl.atomic.rmw.i32(i32 6, i32* %ptr, i32 %v, i32 6) |
| 1591 ret i32 %v | 1528 ret i32 %v |
| 1592 } | 1529 } |
| 1593 ; In this case, ignoring the return value doesn't help. The xchg is | 1530 ; In this case, ignoring the return value doesn't help. The xchg is |
| 1594 ; used to do an atomic store. | 1531 ; used to do an atomic store. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} | 1699 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} |
| 1763 ; ARM32: cmp [[V0]], {{r[0-9]+}} | 1700 ; ARM32: cmp [[V0]], {{r[0-9]+}} |
| 1764 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} | 1701 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} |
| 1765 ; ARM32: movne [[SUCCESS:r[0-9]+]], | 1702 ; ARM32: movne [[SUCCESS:r[0-9]+]], |
| 1766 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} | 1703 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} |
| 1767 ; ARM32: cmp [[SUCCESS]], #0 | 1704 ; ARM32: cmp [[SUCCESS]], #0 |
| 1768 ; ARM32: bne | 1705 ; ARM32: bne |
| 1769 ; ARM32: dmb | 1706 ; ARM32: dmb |
| 1770 ; MIPS32-LABEL: test_atomic_cmpxchg_64 | 1707 ; MIPS32-LABEL: test_atomic_cmpxchg_64 |
| 1771 ; MIPS32: sync | 1708 ; MIPS32: sync |
| 1772 ; MIPS32: ll | 1709 ; MIPS32: jal» __sync_val_compare_and_swap_8 |
| 1773 ; MIPS32: bne | |
| 1774 ; MIPS32: sc | |
| 1775 ; MIPS32: beq | |
| 1776 ; MIPS32: ll | |
| 1777 ; MIPS32: bne | |
| 1778 ; MIPS32: sc | |
| 1779 ; MIPS32: beq | |
| 1780 ; MIPS32: sync | 1710 ; MIPS32: sync |
| 1781 | 1711 |
| 1782 | 1712 |
| 1783 define internal i64 @test_atomic_cmpxchg_64_undef(i32 %iptr, i64 %desired) { | 1713 define internal i64 @test_atomic_cmpxchg_64_undef(i32 %iptr, i64 %desired) { |
| 1784 entry: | 1714 entry: |
| 1785 %ptr = inttoptr i32 %iptr to i64* | 1715 %ptr = inttoptr i32 %iptr to i64* |
| 1786 %old = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %ptr, i64 undef, | 1716 %old = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %ptr, i64 undef, |
| 1787 i64 %desired, i32 6, i32 6) | 1717 i64 %desired, i32 6, i32 6) |
| 1788 ret i64 %old | 1718 ret i64 %old |
| 1789 } | 1719 } |
| 1790 ; CHECK-LABEL: test_atomic_cmpxchg_64_undef | 1720 ; CHECK-LABEL: test_atomic_cmpxchg_64_undef |
| 1791 ; CHECK: lock cmpxchg8b QWORD PTR [e{{.[^x]}}+0x0] | 1721 ; CHECK: lock cmpxchg8b QWORD PTR [e{{.[^x]}}+0x0] |
| 1792 ; ARM32-LABEL: test_atomic_cmpxchg_64_undef | 1722 ; ARM32-LABEL: test_atomic_cmpxchg_64_undef |
| 1793 ; ARM32: mov r{{[0-9]+}}, #0 | 1723 ; ARM32: mov r{{[0-9]+}}, #0 |
| 1794 ; ARM32: mov r{{[0-9]+}}, #0 | 1724 ; ARM32: mov r{{[0-9]+}}, #0 |
| 1795 ; ARM32: dmb | 1725 ; ARM32: dmb |
| 1796 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} | 1726 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} |
| 1797 ; ARM32: cmp [[V0]], {{r[0-9]+}} | 1727 ; ARM32: cmp [[V0]], {{r[0-9]+}} |
| 1798 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} | 1728 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} |
| 1799 ; ARM32: movne [[SUCCESS:r[0-9]+]], | 1729 ; ARM32: movne [[SUCCESS:r[0-9]+]], |
| 1800 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} | 1730 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} |
| 1801 ; ARM32: cmp [[SUCCESS]], #0 | 1731 ; ARM32: cmp [[SUCCESS]], #0 |
| 1802 ; ARM32: bne | 1732 ; ARM32: bne |
| 1803 ; ARM32: dmb | 1733 ; ARM32: dmb |
| 1804 ; MIPS32-LABEL: test_atomic_cmpxchg_64_undef | 1734 ; MIPS32-LABEL: test_atomic_cmpxchg_64_undef |
| 1805 ; MIPS32: sync | 1735 ; MIPS32: sync |
| 1806 ; MIPS32: ll | 1736 ; MIPS32: jal» __sync_val_compare_and_swap_8 |
| 1807 ; MIPS32: bne | |
| 1808 ; MIPS32: sc | |
| 1809 ; MIPS32: beq | |
| 1810 ; MIPS32: ll | |
| 1811 ; MIPS32: bne | |
| 1812 ; MIPS32: sc | |
| 1813 ; MIPS32: beq | |
| 1814 ; MIPS32: sync | 1737 ; MIPS32: sync |
| 1815 | 1738 |
| 1816 ; Test a case where %old really does need to be copied out of edx:eax. | 1739 ; Test a case where %old really does need to be copied out of edx:eax. |
| 1817 define internal void @test_atomic_cmpxchg_64_store( | 1740 define internal void @test_atomic_cmpxchg_64_store( |
| 1818 i32 %ret_iptr, i32 %iptr, i64 %expected, i64 %desired) { | 1741 i32 %ret_iptr, i32 %iptr, i64 %expected, i64 %desired) { |
| 1819 entry: | 1742 entry: |
| 1820 %ptr = inttoptr i32 %iptr to i64* | 1743 %ptr = inttoptr i32 %iptr to i64* |
| 1821 %old = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %ptr, i64 %expected, | 1744 %old = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %ptr, i64 %expected, |
| 1822 i64 %desired, i32 6, i32 6) | 1745 i64 %desired, i32 6, i32 6) |
| 1823 %__6 = inttoptr i32 %ret_iptr to i64* | 1746 %__6 = inttoptr i32 %ret_iptr to i64* |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1840 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} | 1763 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} |
| 1841 ; ARM32: movne [[SUCCESS:r[0-9]+]], | 1764 ; ARM32: movne [[SUCCESS:r[0-9]+]], |
| 1842 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} | 1765 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} |
| 1843 ; ARM32: cmp [[SUCCESS]], #0 | 1766 ; ARM32: cmp [[SUCCESS]], #0 |
| 1844 ; ARM32: bne | 1767 ; ARM32: bne |
| 1845 ; ARM32: dmb | 1768 ; ARM32: dmb |
| 1846 ; ARM32: str | 1769 ; ARM32: str |
| 1847 ; ARM32: str | 1770 ; ARM32: str |
| 1848 ; MIPS32-LABEL: test_atomic_cmpxchg_64_store | 1771 ; MIPS32-LABEL: test_atomic_cmpxchg_64_store |
| 1849 ; MIPS32: sync | 1772 ; MIPS32: sync |
| 1850 ; MIPS32: ll | 1773 ; MIPS32: jal» __sync_val_compare_and_swap_8 |
| 1851 ; MIPS32: bne | |
| 1852 ; MIPS32: sc | |
| 1853 ; MIPS32: beq | |
| 1854 ; MIPS32: ll | |
| 1855 ; MIPS32: bne | |
| 1856 ; MIPS32: sc | |
| 1857 ; MIPS32: beq | |
| 1858 ; MIPS32: sync | 1774 ; MIPS32: sync |
| 1859 | 1775 |
| 1860 | 1776 |
| 1861 ; Test with some more register pressure. When we have an alloca, ebp is | 1777 ; Test with some more register pressure. When we have an alloca, ebp is |
| 1862 ; used to manage the stack frame, so it cannot be used as a register either. | 1778 ; used to manage the stack frame, so it cannot be used as a register either. |
| 1863 define internal i64 @test_atomic_cmpxchg_64_alloca(i32 %iptr, i64 %expected, | 1779 define internal i64 @test_atomic_cmpxchg_64_alloca(i32 %iptr, i64 %expected, |
| 1864 i64 %desired) { | 1780 i64 %desired) { |
| 1865 entry: | 1781 entry: |
| 1866 br label %eblock ; Disable alloca optimization | 1782 br label %eblock ; Disable alloca optimization |
| 1867 eblock: | 1783 eblock: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1895 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} | 1811 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} |
| 1896 ; ARM32: cmp [[V0]], {{r[0-9]+}} | 1812 ; ARM32: cmp [[V0]], {{r[0-9]+}} |
| 1897 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} | 1813 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} |
| 1898 ; ARM32: movne [[SUCCESS:r[0-9]+]], | 1814 ; ARM32: movne [[SUCCESS:r[0-9]+]], |
| 1899 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} | 1815 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[A]]{{[]]}} |
| 1900 ; ARM32: cmp [[SUCCESS]], #0 | 1816 ; ARM32: cmp [[SUCCESS]], #0 |
| 1901 ; ARM32: bne | 1817 ; ARM32: bne |
| 1902 ; ARM32: dmb | 1818 ; ARM32: dmb |
| 1903 ; MIPS32-LABEL: test_atomic_cmpxchg_64_alloca | 1819 ; MIPS32-LABEL: test_atomic_cmpxchg_64_alloca |
| 1904 ; MIPS32: sync | 1820 ; MIPS32: sync |
| 1905 ; MIPS32: ll | 1821 ; MIPS32: jal» __sync_val_compare_and_swap_8 |
| 1906 ; MIPS32: bne | |
| 1907 ; MIPS32: sc | |
| 1908 ; MIPS32: beq | |
| 1909 ; MIPS32: ll | |
| 1910 ; MIPS32: bne | |
| 1911 ; MIPS32: sc | |
| 1912 ; MIPS32: beq | |
| 1913 ; MIPS32: sync | 1822 ; MIPS32: sync |
| 1914 | 1823 |
| 1915 define internal i32 @test_atomic_cmpxchg_32_ignored(i32 %iptr, i32 %expected, | 1824 define internal i32 @test_atomic_cmpxchg_32_ignored(i32 %iptr, i32 %expected, |
| 1916 i32 %desired) { | 1825 i32 %desired) { |
| 1917 entry: | 1826 entry: |
| 1918 %ptr = inttoptr i32 %iptr to i32* | 1827 %ptr = inttoptr i32 %iptr to i32* |
| 1919 %ignored = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %ptr, i32 %expected, | 1828 %ignored = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %ptr, i32 %expected, |
| 1920 i32 %desired, i32 6, i32 6) | 1829 i32 %desired, i32 6, i32 6) |
| 1921 ret i32 0 | 1830 ret i32 0 |
| 1922 } | 1831 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} | 1869 ; ARM32: ldrexd [[V0:r[0-9]+]], [[V1:r[0-9]+]], {{[[]}}[[A:r[0-9]+]]{{[]]}} |
| 1961 ; ARM32: cmp [[V0]], {{r[0-9]+}} | 1870 ; ARM32: cmp [[V0]], {{r[0-9]+}} |
| 1962 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} | 1871 ; ARM32: cmpeq [[V1]], {{r[0-9]+}} |
| 1963 ; ARM32: movne [[SUCCESS:r[0-9]+]], | 1872 ; ARM32: movne [[SUCCESS:r[0-9]+]], |
| 1964 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[PTR]]{{[]]}} | 1873 ; ARM32: strexdeq [[SUCCESS]], r{{[0-9]+}}, r{{[0-9]+}}, {{[[]}}[[PTR]]{{[]]}} |
| 1965 ; ARM32: cmp [[SUCCESS]], #0 | 1874 ; ARM32: cmp [[SUCCESS]], #0 |
| 1966 ; ARM32: bne | 1875 ; ARM32: bne |
| 1967 ; ARM32: dmb | 1876 ; ARM32: dmb |
| 1968 ; MIPS32-LABEL: test_atomic_cmpxchg_64_ignored | 1877 ; MIPS32-LABEL: test_atomic_cmpxchg_64_ignored |
| 1969 ; MIPS32: sync | 1878 ; MIPS32: sync |
| 1970 ; MIPS32: ll | 1879 ; MIPS32: jal» __sync_val_compare_and_swap_8 |
| 1971 ; MIPS32: bne | |
| 1972 ; MIPS32: sc | |
| 1973 ; MIPS32: beq | |
| 1974 ; MIPS32: ll | |
| 1975 ; MIPS32: bne | |
| 1976 ; MIPS32: sc | |
| 1977 ; MIPS32: beq | |
| 1978 ; MIPS32: sync | 1880 ; MIPS32: sync |
| 1979 | 1881 |
| 1980 ;;;; Fence and is-lock-free. | 1882 ;;;; Fence and is-lock-free. |
| 1981 | 1883 |
| 1982 define internal void @test_atomic_fence() { | 1884 define internal void @test_atomic_fence() { |
| 1983 entry: | 1885 entry: |
| 1984 call void @llvm.nacl.atomic.fence(i32 6) | 1886 call void @llvm.nacl.atomic.fence(i32 6) |
| 1985 ret void | 1887 ret void |
| 1986 } | 1888 } |
| 1987 ; CHECK-LABEL: test_atomic_fence | 1889 ; CHECK-LABEL: test_atomic_fence |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 br i1 %cmp, label %done, label %body | 2057 br i1 %cmp, label %done, label %body |
| 2156 done: | 2058 done: |
| 2157 ret void | 2059 ret void |
| 2158 } | 2060 } |
| 2159 ; O2-LABEL: test_cmpxchg8b_regalloc | 2061 ; O2-LABEL: test_cmpxchg8b_regalloc |
| 2160 ;;; eax and some other register will be used in the cmpxchg instruction. | 2062 ;;; eax and some other register will be used in the cmpxchg instruction. |
| 2161 ; O2: lock cmpxchg8b QWORD PTR | 2063 ; O2: lock cmpxchg8b QWORD PTR |
| 2162 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. | 2064 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. |
| 2163 ; O2-NOT: ,{{eax|ecx|edx|ebx}} | 2065 ; O2-NOT: ,{{eax|ecx|edx|ebx}} |
| 2164 ; O2: pop ebx | 2066 ; O2: pop ebx |
| OLD | NEW |