[PowerPC] Add cmpxchg test for pwr7 in atomic expand pass. NFC.
authorKai Luo <lkail@cn.ibm.com>
Fri, 1 Apr 2022 05:16:11 +0000 (13:16 +0800)
committerKai Luo <lkail@cn.ibm.com>
Fri, 1 Apr 2022 05:27:54 +0000 (13:27 +0800)
llvm/test/Transforms/AtomicExpand/PowerPC/cmpxchg.ll

index 4c5b0eb..e4dcc92 100644 (file)
@@ -1,6 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -atomic-expand -S -mtriple=powerpc64-unknown-unknown \
 ; RUN:   -ppc-quadword-atomics -mcpu=pwr8 %s | FileCheck %s
+; RUN: opt -atomic-expand -S -mtriple=powerpc64-unknown-unknown \
+; RUN:   -mcpu=pwr7 %s | FileCheck --check-prefix=PWR7 %s
 
 define i1 @test_cmpxchg_seq_cst(i128* %addr, i128 %desire, i128 %new) {
 ; CHECK-LABEL: @test_cmpxchg_seq_cst(
@@ -30,6 +32,14 @@ define i1 @test_cmpxchg_seq_cst(i128* %addr, i128 %desire, i128 %new) {
 ; CHECK-NEXT:    [[SUCC:%.*]] = extractvalue { i128, i1 } [[TMP7]], 1
 ; CHECK-NEXT:    ret i1 [[SUCC]]
 ;
+; PWR7-LABEL: @test_cmpxchg_seq_cst(
+; PWR7-NEXT:  entry:
+; PWR7-NEXT:    call void @llvm.ppc.sync()
+; PWR7-NEXT:    [[PAIR:%.*]] = cmpxchg weak i128* [[ADDR:%.*]], i128 [[DESIRE:%.*]], i128 [[NEW:%.*]] monotonic monotonic, align 16
+; PWR7-NEXT:    call void @llvm.ppc.lwsync()
+; PWR7-NEXT:    [[SUCC:%.*]] = extractvalue { i128, i1 } [[PAIR]], 1
+; PWR7-NEXT:    ret i1 [[SUCC]]
+;
 entry:
   %pair = cmpxchg weak i128* %addr, i128 %desire, i128 %new seq_cst seq_cst
   %succ = extractvalue {i128, i1} %pair, 1