Basic tests for atomic load and store on x86.
[oota-llvm.git] / test / CodeGen / X86 / atomic-load-store.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx10.7.0 | FileCheck %s
2
3 define void @test1(i32* %ptr, i32 %val1) {
4 ; CHECK: test1
5 ; CHECK: xchgl  %esi, (%rdi)
6   store atomic i32 %val1, i32* %ptr seq_cst, align 4
7   ret void
8 }
9
10 define void @test2(i32* %ptr, i32 %val1) {
11 ; CHECK: test2
12 ; CHECK: movl   %esi, (%rdi)
13   store atomic i32 %val1, i32* %ptr release, align 4
14   ret void
15 }
16
17 define i32 @test3(i32* %ptr) {
18 ; CHECK: test3
19 ; CHECK: movl   (%rdi), %eax
20   %val = load atomic i32* %ptr seq_cst, align 4
21   ret i32 %val
22 }