diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-09-28 16:22:54 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-09-28 16:22:54 +0000 |
commit | e7870d75ef7b9b6c844b38f37ecf931ca39e394c (patch) | |
tree | a9f038bf4ebbf60d4895f2dddad96d8b439f152f /test/CodeGen/SystemZ/cmpxchg-06.ll | |
parent | 6bae1b9b2b8ac34fb81415e1fd8824574acf3765 (diff) |
[SystemZ] Custom-expand ATOMIC_CMP_AND_SWAP_WITH_SUCCESS
The SystemZ compare-and-swap instructions already provide the "success"
indication via a condition-code value, so the default expansion of those
operations generates an unnecessary extra comparsion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ/cmpxchg-06.ll')
-rw-r--r-- | test/CodeGen/SystemZ/cmpxchg-06.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/cmpxchg-06.ll b/test/CodeGen/SystemZ/cmpxchg-06.ll index da565791c7c..7da2ea0fde8 100644 --- a/test/CodeGen/SystemZ/cmpxchg-06.ll +++ b/test/CodeGen/SystemZ/cmpxchg-06.ll @@ -111,3 +111,21 @@ define i128 @f9(i128 %cmp, i128 *%ptr) { %val = extractvalue { i128, i1 } %pairval, 0 ret i128 %val } + +; Check generating the comparison result. +; CHECK-LABEL: f10 +; CHECK-DAG: lg %r1, 8(%r3) +; CHECK-DAG: lg %r0, 0(%r3) +; CHECK-DAG: lg %r13, 8(%r2) +; CHECK-DAG: lg %r12, 0(%r2) +; CHECK: cdsg %r12, %r0, 0(%r4) +; CHECK-NEXT: ipm %r2 +; CHECK-NEXT: afi %r2, -268435456 +; CHECK-NEXT: srl %r2, 31 +; CHECK: br %r14 +define i32 @f10(i128 %cmp, i128 %swap, i128 *%src) { + %pairval = cmpxchg i128 *%src, i128 %cmp, i128 %swap seq_cst seq_cst + %val = extractvalue { i128, i1 } %pairval, 1 + %res = zext i1 %val to i32 + ret i32 %res +} |