public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax.
@ 2013-03-11 18:22 Roland McGrath
  2013-03-11 21:19 ` Carlos O'Donell
  2013-03-11 23:35 ` Joseph S. Myers
  0 siblings, 2 replies; 4+ messages in thread
From: Roland McGrath @ 2013-03-11 18:22 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-ports

The assemblers I'm using give warnings about some code being in the older
syntax.  This makes them happy.  Verified that the assembled instructions
are unchanged.

OK?


Thanks,
Roland


ports/ChangeLog.arm
	* sysdeps/arm/memcpy.S: Convert to unified assembly syntax.
	* sysdeps/arm/memmove.S: Likewise.
	* sysdeps/arm/memset.S: Likewise.
	* sysdeps/arm/strlen.S: Likewise.

--- a/ports/sysdeps/arm/memcpy.S
+++ b/ports/sysdeps/arm/memcpy.S
@@ -53,6 +53,7 @@
 #endif
 
 		.text
+		.syntax unified
 
 /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
 
@@ -84,7 +85,7 @@ ENTRY(memcpy)
 
 	CALGN(	ands	ip, r1, #31		)
 	CALGN(	rsb	r3, ip, #32		)
-	CALGN(	sbcnes	r4, r3, r2		)  @ C is always set here
+	CALGN(	sbcsne	r4, r3, r2		)  @ C is always set here
 	CALGN(	bcs	2f			)
 	CALGN(	adr	r4, 6f			)
 	CALGN(	subs	r2, r2, r3		)  @ C gets set
@@ -139,12 +140,12 @@ ENTRY(memcpy)
 		cfi_restore (r8)
 
 8:		movs	r2, r2, lsl #31
-		ldrneb	r3, [r1], #1
-		ldrcsb	r4, [r1], #1
-		ldrcsb	ip, [r1]
-		strneb	r3, [r0], #1
-		strcsb	r4, [r0], #1
-		strcsb	ip, [r0]
+		ldrbne	r3, [r1], #1
+		ldrbcs	r4, [r1], #1
+		ldrbcs	ip, [r1]
+		strbne	r3, [r0], #1
+		strbcs	r4, [r0], #1
+		strbcs	ip, [r0]
 
 #if defined (__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
 		pop	{r0, r4, lr}
@@ -160,11 +161,11 @@ ENTRY(memcpy)
 
 9:		rsb	ip, ip, #4
 		cmp	ip, #2
-		ldrgtb	r3, [r1], #1
-		ldrgeb	r4, [r1], #1
+		ldrbgt	r3, [r1], #1
+		ldrbge	r4, [r1], #1
 		ldrb	lr, [r1], #1
-		strgtb	r3, [r0], #1
-		strgeb	r4, [r0], #1
+		strbgt	r3, [r0], #1
+		strbge	r4, [r0], #1
 		subs	r2, r2, ip
 		strb	lr, [r0], #1
 		blt	8b
@@ -185,7 +186,7 @@ ENTRY(memcpy)
 
 	CALGN(	ands	ip, r1, #31		)
 	CALGN(	rsb	ip, ip, #32		)
-	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	sbcsne	r4, ip, r2		)  @ C is always set here
 	CALGN(	subcc	r2, r2, ip		)
 	CALGN(	bcc	15f			)
 
--- a/ports/sysdeps/arm/memmove.S
+++ b/ports/sysdeps/arm/memmove.S
@@ -53,6 +53,7 @@
 #endif
 
 		.text
+		.syntax unified
 
 /*
  * Prototype: void *memmove(void *dest, const void *src, size_t n);
@@ -100,7 +101,7 @@ ENTRY(memmove)
 		blt	5f
 
 	CALGN(	ands	ip, r1, #31		)
-	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	sbcsne	r4, ip, r2		)  @ C is always set here
 	CALGN(	bcs	2f			)
 	CALGN(	adr	r4, 6f			)
 	CALGN(	subs	r2, r2, ip		)  @ C is set here
@@ -155,12 +156,12 @@ ENTRY(memmove)
 		cfi_restore (r8)
 
 8:		movs	r2, r2, lsl #31
-		ldrneb	r3, [r1, #-1]!
-		ldrcsb	r4, [r1, #-1]!
-		ldrcsb	ip, [r1, #-1]
-		strneb	r3, [r0, #-1]!
-		strcsb	r4, [r0, #-1]!
-		strcsb	ip, [r0, #-1]
+		ldrbne	r3, [r1, #-1]!
+		ldrbcs	r4, [r1, #-1]!
+		ldrbcs	ip, [r1, #-1]
+		strbne	r3, [r0, #-1]!
+		strbcs	r4, [r0, #-1]!
+		strbcs	ip, [r0, #-1]
 
 #if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__)
 		pop	{r0, r4, lr}
@@ -175,11 +176,11 @@ ENTRY(memmove)
 		cfi_restore_state
 
 9:		cmp	ip, #2
-		ldrgtb	r3, [r1, #-1]!
-		ldrgeb	r4, [r1, #-1]!
+		ldrbgt	r3, [r1, #-1]!
+		ldrbge	r4, [r1, #-1]!
 		ldrb	lr, [r1, #-1]!
-		strgtb	r3, [r0, #-1]!
-		strgeb	r4, [r0, #-1]!
+		strbgt	r3, [r0, #-1]!
+		strbge	r4, [r0, #-1]!
 		subs	r2, r2, ip
 		strb	lr, [r0, #-1]!
 		blt	8b
@@ -200,7 +201,7 @@ ENTRY(memmove)
 
 	CALGN(	ands	ip, r1, #31		)
 	CALGN(	rsb	ip, ip, #32		)
-	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	sbcsne	r4, ip, r2		)  @ C is always set here
 	CALGN(	subcc	r2, r2, ip		)
 	CALGN(	bcc	15f			)
 
--- a/ports/sysdeps/arm/memset.S
+++ b/ports/sysdeps/arm/memset.S
@@ -20,6 +20,9 @@
 #define NO_THUMB
 #include <sysdep.h>
 
+	.text
+	.syntax unified
+
 /* void *memset (dstpp, c, len) */
 
 ENTRY(memset)
@@ -29,7 +32,7 @@ ENTRY(memset)
 
 1:
 	tst	r3, #3		@ aligned yet?
-	strneb	r1, [r3], #1
+	strbne	r1, [r3], #1
 	subne	r2, r2, #1
 	bne	1b
 
@@ -40,27 +43,27 @@ ENTRY(memset)
 
 1:
 	subs	r2, r2, #8
-	stmcsia	r3!, {r1, ip}	@ store up to 32 bytes per loop iteration
-	subcss	r2, r2, #8
-	stmcsia	r3!, {r1, ip}
-	subcss	r2, r2, #8
-	stmcsia	r3!, {r1, ip}
-	subcss	r2, r2, #8
-	stmcsia	r3!, {r1, ip}
+	stmiacs	r3!, {r1, ip}	@ store up to 32 bytes per loop iteration
+	subscs	r2, r2, #8
+	stmiacs	r3!, {r1, ip}
+	subscs	r2, r2, #8
+	stmiacs	r3!, {r1, ip}
+	subscs	r2, r2, #8
+	stmiacs	r3!, {r1, ip}
 	bcs	1b
 
 	and	r2, r2, #7
 2:
 	subs	r2, r2, #1	@ store up to 4 bytes per loop iteration
-	strcsb	r1, [r3], #1
-	subcss	r2, r2, #1
-	strcsb	r1, [r3], #1
-	subcss	r2, r2, #1
-	strcsb	r1, [r3], #1
-	subcss	r2, r2, #1
-	strcsb	r1, [r3], #1
+	strbcs	r1, [r3], #1
+	subscs	r2, r2, #1
+	strbcs	r1, [r3], #1
+	subscs	r2, r2, #1
+	strbcs	r1, [r3], #1
+	subscs	r2, r2, #1
+	strbcs	r1, [r3], #1
 	bcs	2b
-	
+
 	DO_RET(lr)
 END(memset)
 libc_hidden_builtin_def (memset)
--- a/ports/sysdeps/arm/strlen.S
+++ b/ports/sysdeps/arm/strlen.S
@@ -25,6 +25,9 @@
  * exit: r0 = len
  */
 
+	.syntax unified
+	.text
+
 ENTRY(strlen)
 	bic     r1, r0, $3              @ addr of word containing first byte
 	ldr     r2, [r1], $4            @ get the first word

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax.
  2013-03-11 18:22 [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax Roland McGrath
@ 2013-03-11 21:19 ` Carlos O'Donell
  2013-03-11 21:25   ` Roland McGrath
  2013-03-11 23:35 ` Joseph S. Myers
  1 sibling, 1 reply; 4+ messages in thread
From: Carlos O'Donell @ 2013-03-11 21:19 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Joseph Myers, libc-ports

On 03/11/2013 02:22 PM, Roland McGrath wrote:
> The assemblers I'm using give warnings about some code being in the older
> syntax.  This makes them happy.  Verified that the assembled instructions
> are unchanged.
> 
> OK?
> 
> 
> Thanks,
> Roland
> 
> 
> ports/ChangeLog.arm
> 	* sysdeps/arm/memcpy.S: Convert to unified assembly syntax.
> 	* sysdeps/arm/memmove.S: Likewise.
> 	* sysdeps/arm/memset.S: Likewise.
> 	* sysdeps/arm/strlen.S: Likewise.
> 
> --- a/ports/sysdeps/arm/memcpy.S
> +++ b/ports/sysdeps/arm/memcpy.S
> @@ -53,6 +53,7 @@
>  #endif
>  
>  		.text
> +		.syntax unified

All new code should really be using the unified syntax, I'm happy
to see this change, and a quick check against my quick reference
for unified syntax passes OK.

When you verified the assembled instructions were unchanged did
you look to see that the opcodes were the same or that disassembling
the result yielded the same previously disassembled instructions?

I say this just to make sure we didn't happen across any binutils
bugs, which isn't uncommon in some of the less used encodings, or
that the encodings changed and that they mean something else now.

Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax.
  2013-03-11 21:19 ` Carlos O'Donell
@ 2013-03-11 21:25   ` Roland McGrath
  0 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2013-03-11 21:25 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: Joseph Myers, libc-ports

> When you verified the assembled instructions were unchanged did
> you look to see that the opcodes were the same or that disassembling
> the result yielded the same previously disassembled instructions?

Both: I compared the output of objdump -rd and there were no differences at
all.  That compared both the disassembly and the hex bytes.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax.
  2013-03-11 18:22 [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax Roland McGrath
  2013-03-11 21:19 ` Carlos O'Donell
@ 2013-03-11 23:35 ` Joseph S. Myers
  1 sibling, 0 replies; 4+ messages in thread
From: Joseph S. Myers @ 2013-03-11 23:35 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-ports

On Mon, 11 Mar 2013, Roland McGrath wrote:

> 	* sysdeps/arm/memcpy.S: Convert to unified assembly syntax.
> 	* sysdeps/arm/memmove.S: Likewise.
> 	* sysdeps/arm/memset.S: Likewise.
> 	* sysdeps/arm/strlen.S: Likewise.

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-11 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 18:22 [PATCH roland/arm-unified] ARM: Convert string/ assembly to unified syntax Roland McGrath
2013-03-11 21:19 ` Carlos O'Donell
2013-03-11 21:25   ` Roland McGrath
2013-03-11 23:35 ` Joseph S. Myers

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).