diff options
Diffstat (limited to 'test/CodeGen/AArch64/cmpxchg-O0.ll')
-rw-r--r-- | test/CodeGen/AArch64/cmpxchg-O0.ll | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/CodeGen/AArch64/cmpxchg-O0.ll b/test/CodeGen/AArch64/cmpxchg-O0.ll index c79d82a63774..aed1aa493a8f 100644 --- a/test/CodeGen/AArch64/cmpxchg-O0.ll +++ b/test/CodeGen/AArch64/cmpxchg-O0.ll @@ -65,11 +65,41 @@ define { i128, i1 } @test_cmpxchg_128(i128* %addr, i128 %desired, i128 %new) nou ; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]: ; CHECK: ldaxp [[OLD_LO:x[0-9]+]], [[OLD_HI:x[0-9]+]], [x0] ; CHECK: cmp [[OLD_LO]], x2 -; CHECK: sbcs xzr, [[OLD_HI]], x3 -; CHECK: b.ne [[DONE:.LBB[0-9]+_[0-9]+]] +; CHECK: cset [[CMP_TMP:w[0-9]+]], ne +; CHECK: cmp [[OLD_HI]], x3 +; CHECK: cinc [[CMP:w[0-9]+]], [[CMP_TMP]], ne +; CHECK: cbnz [[CMP]], [[DONE:.LBB[0-9]+_[0-9]+]] ; CHECK: stlxp [[STATUS:w[0-9]+]], x4, x5, [x0] ; CHECK: cbnz [[STATUS]], [[RETRY]] ; CHECK: [[DONE]]: %res = cmpxchg i128* %addr, i128 %desired, i128 %new seq_cst monotonic ret { i128, i1 } %res } + +; Original implementation assumed the desired & new arguments had already been +; type-legalized into some kind of BUILD_PAIR operation and crashed when this +; was false. +@var128 = global i128 0 +define {i128, i1} @test_cmpxchg_128_unsplit(i128* %addr) { +; CHECK-LABEL: test_cmpxchg_128_unsplit: +; CHECK: add x[[VAR128:[0-9]+]], {{x[0-9]+}}, :lo12:var128 +; CHECK: ldr [[DESIRED_HI:x[0-9]+]], [x[[VAR128]], #8] +; CHECK: ldr [[DESIRED_LO:x[0-9]+]], [x[[VAR128]]] +; CHECK: ldr [[NEW_HI:x[0-9]+]], [x[[VAR128]], #8] +; CHECK: ldr [[NEW_LO:x[0-9]+]], [x[[VAR128]]] +; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]: +; CHECK: ldaxp [[OLD_LO:x[0-9]+]], [[OLD_HI:x[0-9]+]], [x0] +; CHECK: cmp [[OLD_LO]], [[DESIRED_LO]] +; CHECK: cset [[CMP_TMP:w[0-9]+]], ne +; CHECK: cmp [[OLD_HI]], [[DESIRED_HI]] +; CHECK: cinc [[CMP:w[0-9]+]], [[CMP_TMP]], ne +; CHECK: cbnz [[CMP]], [[DONE:.LBB[0-9]+_[0-9]+]] +; CHECK: stlxp [[STATUS:w[0-9]+]], [[NEW_LO]], [[NEW_HI]], [x0] +; CHECK: cbnz [[STATUS]], [[RETRY]] +; CHECK: [[DONE]]: + + %desired = load volatile i128, i128* @var128 + %new = load volatile i128, i128* @var128 + %val = cmpxchg i128* %addr, i128 %desired, i128 %new seq_cst seq_cst + ret { i128, i1 } %val +} |