<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 --- - ldr= pseudo instruction produces incorrect code when using in inline assembly"
href="http://llvm.org/bugs/show_bug.cgi?id=18354">18354</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ldr= pseudo instruction produces incorrect code when using in inline assembly
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>Backend: ARM
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kristof.beyls@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>Incorrect code is generated for the following function using the ldr= pseudo
instruction, when used in inline assembly
$ cat t2.c
int main() {
int result;
__asm volatile ("ldr %[result],=1" : [result] "=r" (result));
return result;
}
$ clang -O3 -c -target armv7a-none-none-eabi -marm t2.c
$ llvm-objdump -disassemble t2.o
t2.o: file format ELF32-arm
Disassembly of section .text:
main:
0: 04 00 1f e5 ldr r0,
[pc, #-4]
$d.2:
4: 01 00 00 00 andeq r0, r0,
r1
$a.3:
/work/llvm.org/cmake-git-build/bin/llvm-objdump: warning: invalid instruction
encoding
/work/llvm.org/cmake-git-build/bin/llvm-objdump: warning: invalid instruction
encoding
/work/llvm.org/cmake-git-build/bin/llvm-objdump: warning: invalid instruction
encoding
/work/llvm.org/cmake-git-build/bin/llvm-objdump: warning: invalid instruction
encoding
The constant 1 is instantiated in the middle of a code block, meaning that the
constant will be “executed”.
It seems that when I first produce an assembly file using -S, and then assemble
the resulting file, correct code is generated (i.e. the constant is outputted
after the BX LR that ends the function).</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>