<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [AArch64] Produce STLXR with unpredictable behavior."
href="http://llvm.org/bugs/show_bug.cgi?id=18881">18881</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[AArch64] Produce STLXR with unpredictable behavior.
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kevinqindev@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12081" name="attach_12081" title="test file to reproduce">attachment 12081</a> <a href="attachment.cgi?id=12081&action=edit" title="test file to reproduce">[details]</a></span>
test file to reproduce
With the following command line
$clang --target=aarch64-linux-gnuabi -mfpu=neon -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -DNDEBUG -O3 -m64 -fomit-frame-pointer AtomicOps.c
We would see failure as below on foundation model,
$./a.out
[ 8592.507973] a.out[1447]: undefined instruction: pc=00000000004005d0
[ 8592.508058] Code: f94007e0 885ffc01 b94007e2 0b020023 (8803fc03)
Illegal instruction
The assembly code in 00000000004005d0 is
4005d0: 8803fc03 stlxr w3, w3, [x0]
Which result is UNPREDICTABLE.
Compiler shouldn't produce unpredictable instructions, so Ws and Wt must be
different registers.
Below is quoted from ARM reference manual:
STLXR <Ws>, <Wt>, [<Xn|SP>{,#0}]
if memop == MemOp_STORE && excl then
if s == t || (pair && s == t2) then
Constraint c = ConstrainUnpredictable(Unpredictable_DATAOVERLAP);
assert c IN {Constraint_UNKNOWN, Constraint_NONE, Constraint_UNDEF,
Constraint_NOP};
case c of
when Constraint_UNKNOWN rt_unknown = TRUE; // store UNKNOWN value
when Constraint_NONE rt_unknown = FALSE; // store original value
when Constraint_UNDEF UnallocatedEncoding();
when Constraint_NOP EndOfInstruction();</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>