From 07efe87198fbb883acd3fde94d3afc11a4cced99 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Mon, 21 Jul 2014 22:54:44 +0000 Subject: [PATCH] Add some tests for NVPTX lowering of cmpxchg git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213586 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/NVPTX/atomics.ll | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/CodeGen/NVPTX/atomics.ll b/test/CodeGen/NVPTX/atomics.ll index 00e02a7f9b2..daadb6e9c1a 100644 --- a/test/CodeGen/NVPTX/atomics.ll +++ b/test/CodeGen/NVPTX/atomics.ll @@ -166,3 +166,17 @@ define float @atomic_add_f32_addrspace3(float addrspace(3)* %addr, float %val) { %ret = call float @llvm.nvvm.atomic.load.add.f32.p3f32(float addrspace(3)* %addr, float %val) ret float %ret } + +; CHECK-LABEL: atomic_cmpxchg_i32 +define i32 @atomic_cmpxchg_i32(i32* %addr, i32 %cmp, i32 %new) { +; CHECK: atom.cas.b32 + %pairold = cmpxchg i32* %addr, i32 %cmp, i32 %new seq_cst seq_cst + ret i32 %new +} + +; CHECK-LABEL: atomic_cmpxchg_i64 +define i64 @atomic_cmpxchg_i64(i64* %addr, i64 %cmp, i64 %new) { +; CHECK: atom.cas.b64 + %pairold = cmpxchg i64* %addr, i64 %cmp, i64 %new seq_cst seq_cst + ret i64 %new +}