[llvm-bugs] [Bug 28819] New: [AArch64] cmpxchg produces inverted success flag at -O0
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 2 07:54:23 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28819
Bug ID: 28819
Summary: [AArch64] cmpxchg produces inverted success flag at
-O0
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Backend: AArch64
Assignee: unassignedbugs at nondot.org
Reporter: gberry at codeaurora.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The success status flag generated for cmpxchg instructions is inverted when
compiled at -O0. cmpxchg is supposed to return 1 for success, but looking at
the generated code for llvm/test/CodeGen/AArch64/cmpxchg-O0.ll:test_cmpxchg_64:
test_cmpxchg_64: // @test_cmpxchg_64
// BB#0:
sub sp, sp, #16 // =16
.LBB3_1: // =>This Inner Loop Header: Depth=1
ldaxr x8, [x0]
cmp x8, x1
b.ne .LBB3_3
// BB#2: // in Loop: Header=BB3_1 Depth=1
stlxr w9, x2, [x0]
cbnz w9, .LBB3_1
.LBB3_3:
subs x0, x8, x1
cset w1, eq
str x0, [sp, #8] // 8-byte Folded Spill
mov x0, x8
str w9, [sp, #4] // 4-byte Folded Spill
add sp, sp, #16 // =16
ret
The success flag (w9) will always be 0 (or the loop won't terminate).
This only occurs at -O0, and I believe was introduced by the fix for
https://llvm.org/bugs/show_bug.cgi?id=25526
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160802/c7e3dfa3/attachment.html>
More information about the llvm-bugs
mailing list