[LLVMbugs] [Bug 18354] New: ldr= pseudo instruction produces incorrect code when using in inline assembly
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jan 2 10:14:36 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18354
Bug ID: 18354
Summary: ldr= pseudo instruction produces incorrect code when
using in inline assembly
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: ARM
Assignee: unassignedbugs at nondot.org
Reporter: kristof.beyls at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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).
--
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/20140102/f2103737/attachment.html>
More information about the llvm-bugs
mailing list