1; RUN: llc < %s -march=sparcv9 -verify-machineinstrs | FileCheck %s 2 3; CHECK-LABEL: test_atomic_i64 4; CHECK: ldx [%o0] 5; CHECK: membar 6; CHECK: ldx [%o1] 7; CHECK: membar 8; CHECK: membar 9; CHECK: stx {{.+}}, [%o2] 10define i64 @test_atomic_i64(i64* %ptr1, i64* %ptr2, i64* %ptr3) { 11entry: 12 %0 = load atomic i64, i64* %ptr1 acquire, align 8 13 %1 = load atomic i64, i64* %ptr2 acquire, align 8 14 %2 = add i64 %0, %1 15 store atomic i64 %2, i64* %ptr3 release, align 8 16 ret i64 %2 17} 18 19; CHECK-LABEL: test_cmpxchg_i64 20; CHECK: mov 123, [[R:%[gilo][0-7]]] 21; CHECK: casx [%o1], %o0, [[R]] 22 23define i64 @test_cmpxchg_i64(i64 %a, i64* %ptr) { 24entry: 25 %pair = cmpxchg i64* %ptr, i64 %a, i64 123 monotonic monotonic 26 %b = extractvalue { i64, i1 } %pair, 0 27 ret i64 %b 28} 29 30; CHECK-LABEL: test_swap_i64 31; CHECK: casx [%o1], 32 33define i64 @test_swap_i64(i64 %a, i64* %ptr) { 34entry: 35 %b = atomicrmw xchg i64* %ptr, i64 42 monotonic 36 ret i64 %b 37} 38 39; CHECK-LABEL: test_load_sub_64 40; CHECK: membar 41; CHECK: sub 42; CHECK: casx [%o0] 43; CHECK: membar 44define zeroext i64 @test_load_sub_64(i64* %p, i64 zeroext %v) { 45entry: 46 %0 = atomicrmw sub i64* %p, i64 %v seq_cst 47 ret i64 %0 48} 49 50; CHECK-LABEL: test_load_max_64 51; CHECK: membar 52; CHECK: cmp 53; CHECK: movg %xcc 54; CHECK: casx [%o0] 55; CHECK: membar 56define zeroext i64 @test_load_max_64(i64* %p, i64 zeroext %v) { 57entry: 58 %0 = atomicrmw max i64* %p, i64 %v seq_cst 59 ret i64 %0 60} 61