Skip to content

ARM Assembler does not support [pc, #offset] syntax for Thumb narrow LDR instructions. #13631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RichBarton-Arm opened this issue Jul 3, 2012 · 3 comments
Labels
backend:ARM bugzilla Issues migrated from bugzilla

Comments

@RichBarton-Arm
Copy link
Collaborator

Bugzilla Link 13259
Resolution FIXED
Resolved on Dec 09, 2015 10:51
Version trunk
OS All
Blocks llvm/llvm-bugzilla-archive#18926
CC @rengolin

Extended Description

LDR ,[pc, #​0]

Should form a valid syntax for a pc-relative load. Currently the Thumb assembler only generates the wide encoding for this instruction, when the narrow encoding should be available.

Reproduce with:

echo "LDR r0,[pc, #​4]" | ./llvm-oss/build-dbg/bin/llvm-mc -triple thumbv7 -show-encoding -show-inst

MC appears to treat immediates as offsets form the pc in this context (which I think is more than a little questionable). Assembling "LDR r0,#4" gives the narrow encoding.

@rengolin
Copy link
Member

Hi Richard,

Seems to be working with Thumb1:

$ echo "LDR r0,[pc, #​4]" | llvm-mc -triple thumbv7 -show-encoding -show-inst
.text
ldr r0, [pc, #​4] @ encoding: [0x01,0x48]
@ <MCInst #​2776 tLDRpci
@
@
@
@ >

@rengolin
Copy link
Member

rengolin commented Dec 9, 2015

Both encodings are identical.

@rengolin
Copy link
Member

mentioned in issue llvm/llvm-bugzilla-archive#18926

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:ARM bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants