<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] Integer exceeds imm range"
href="http://llvm.org/bugs/show_bug.cgi?id=20456">20456</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[AArch64] Integer exceeds imm range
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</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>llvm-as
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zhaoshiz@codeaurora.org
</td>
</tr>
<tr>
<th>CC</th>
<td>apazos@codeaurora.org, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>GCC-4.9 is able to handle the test case below and generate:
<span class="quote">> sub w0, w0, 0x1</span >
but LLVM is producing:
<span class="quote">> add w0, w0, 0xffffffff</span >
$ clang++ --target=aarch64-linux-gnu -mfpu=neon
--sysroot=$GCC64/aarch64-linux-gnu/libc --gcc-toolchain=$GCC64 -Os -c imm.cpp
-no-integrated-as
/tmp/imm-c1564c.s: Assembler messages:
/tmp/imm-c1564c.s:11: Error: immediate out of range
clang-3.5: error: assembler command failed with exit code 1 (use -v to see
invocation)
$ cat imm.cpp
int ref_count_;
inline int AsmInc(volatile int* ptr,
/*volatile*/ int increment) {
int result;
__asm__ __volatile__ (
"add %w[result], %w[result], %w[increment]\n\t"
: [result]"=&r" (result),
[ptr]"+Q" (*ptr)
: [increment]"IJr" (increment)
: "memory"
);
return result;
}
int Release() {
int ret = AsmInc(&ref_count_, -1);
if (ret == 0) {
return -1;
}
return ret;
}</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>