brintos

brintos / llvm-project-archived public Read only

0
0
Text · 753 B · ae6ab54 Raw
27 lines · plain
1; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu |  FileCheck %s2 3define i32 @exchange_and_add(ptr %mem, i32 %val) nounwind {4; CHECK-LABEL: exchange_and_add:5; CHECK: lwarx {{[0-9]+}}, 0, {{[0-9]+}}6  %tmp = atomicrmw add ptr %mem, i32 %val monotonic7; CHECK: stwcx. {{[0-9]+}}, 0, {{[0-9]+}}8  ret i32 %tmp9}10 11define i32 @exchange_and_cmp(ptr %mem) nounwind {12; CHECK-LABEL: exchange_and_cmp:13; CHECK: lwarx14  %tmppair = cmpxchg ptr %mem, i32 0, i32 1 monotonic monotonic15  %tmp = extractvalue { i32, i1 } %tmppair, 016; CHECK: stwcx.17  ret i32 %tmp18}19 20define i32 @exchange(ptr %mem, i32 %val) nounwind {21; CHECK-LABEL: exchange:22; CHECK: lwarx23  %tmp = atomicrmw xchg ptr %mem, i32 1 monotonic24; CHECK: stwcx.25  ret i32 %tmp26}27