public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: newlib@sourceware.org
Subject: [PATCH] arm/strlen-thumb2-Os.S: Correct assembly syntax for ldrb instruction
Date: Tue, 12 May 2020 10:58:30 -0700	[thread overview]
Message-ID: <20200512175830.1186422-1-keithp@keithp.com> (raw)

We want to use a post-indexed addressing mode (which means use the
original register contents as the address, then increment that
register) which is only valid in Encoding T3 of the LDRB instruction.

According to the ARMv7-M Architecture Reference Manual, the assembly
syntax for Encoding T3 does not include the '.W' width specifier as
that is used to specify Encoding T2, presumably to provide a wider
immediate field for possible relocations.

GAS allows the .W specifier for this addressing mode and generates
identical output with and without it. clang does not allow the .W
specifier for this addressing mode, so removing it offers wider
portability and closer adherance to the ARM assembly syntax
specification.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 newlib/libc/machine/arm/strlen-thumb2-Os.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/machine/arm/strlen-thumb2-Os.S b/newlib/libc/machine/arm/strlen-thumb2-Os.S
index 961f41a0a..aed8adf33 100644
--- a/newlib/libc/machine/arm/strlen-thumb2-Os.S
+++ b/newlib/libc/machine/arm/strlen-thumb2-Os.S
@@ -45,7 +45,7 @@
 
 def_fn	strlen p2align=1
 	mov     r3, r0
-1:	ldrb.w  r2, [r3], #1
+1:	ldrb    r2, [r3], #1
 	cmp     r2, #0
 	bne	1b
 	subs    r0, r3, r0
-- 
2.26.2


             reply	other threads:[~2020-05-12 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 17:58 Keith Packard [this message]
2020-05-15 13:25 ` Richard Earnshaw
2020-05-15 14:38   ` Emmanuel Blot
2020-05-15 15:19   ` Keith Packard
2020-05-15 15:44     ` Richard Earnshaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512175830.1186422-1-keithp@keithp.com \
    --to=keithp@keithp.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).