X86: delegate expanding atomic libcalls to generic code.
[oota-llvm.git] / test / CodeGen / X86 / atomic-ops-ancient-64.ll
1 ; RUN: llc -mtriple=i386-linux-gnu %s -o - | FileCheck %s
2
3 define i64 @test_add(i64* %addr, i64 %inc) {
4 ; CHECK-LABEL: test_add:
5 ; CHECK: calll __sync_fetch_and_add_8
6   %old = atomicrmw add i64* %addr, i64 %inc seq_cst
7   ret i64 %old
8 }
9
10 define i64 @test_sub(i64* %addr, i64 %inc) {
11 ; CHECK-LABEL: test_sub:
12 ; CHECK: calll __sync_fetch_and_sub_8
13   %old = atomicrmw sub i64* %addr, i64 %inc seq_cst
14   ret i64 %old
15 }
16
17 define i64 @test_and(i64* %andr, i64 %inc) {
18 ; CHECK-LABEL: test_and:
19 ; CHECK: calll __sync_fetch_and_and_8
20   %old = atomicrmw and i64* %andr, i64 %inc seq_cst
21   ret i64 %old
22 }
23
24 define i64 @test_or(i64* %orr, i64 %inc) {
25 ; CHECK-LABEL: test_or:
26 ; CHECK: calll __sync_fetch_and_or_8
27   %old = atomicrmw or i64* %orr, i64 %inc seq_cst
28   ret i64 %old
29 }
30
31 define i64 @test_xor(i64* %xorr, i64 %inc) {
32 ; CHECK-LABEL: test_xor:
33 ; CHECK: calll __sync_fetch_and_xor_8
34   %old = atomicrmw xor i64* %xorr, i64 %inc seq_cst
35   ret i64 %old
36 }
37
38 define i64 @test_nand(i64* %nandr, i64 %inc) {
39 ; CHECK-LABEL: test_nand:
40 ; CHECK: calll __sync_fetch_and_nand_8
41   %old = atomicrmw nand i64* %nandr, i64 %inc seq_cst
42   ret i64 %old
43 }