public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] powerpc: Fix operand prefixes
@ 2016-04-20 20:55 Gabriel F. T. Gomes
  2016-04-20 21:21 ` Adhemerval Zanella
  2016-04-20 22:11 ` Steven Munroe
  0 siblings, 2 replies; 6+ messages in thread
From: Gabriel F. T. Gomes @ 2016-04-20 20:55 UTC (permalink / raw)
  To: libc-alpha; +Cc: munroesj, tuliom

The file sysdeps/powerpc/sysdeps.h defines aliases for control register
operands.  E.g.: 'cr7' means control register 7.  On the one hand, this
increases readability, as it makes it easier for readers to know whether the
operand is a control register, a general purpose register or an immediate.  On
the other hand, this permits that control register be written as if they were
general purpose, and vice-versa, thus reducing the readability of the code.

This commit removes some of these unintentional misuses.

The changes have no effect on the final code.  Checked with objdump.

2016-04-18  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Fix use of control
	registers specifiers where general purpose registers specifiers should
	have been used.
---
 sysdeps/powerpc/powerpc64/power8/strncpy.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/power8/strncpy.S b/sysdeps/powerpc/powerpc64/power8/strncpy.S
index 0bb3bd4..437edeb 100644
--- a/sysdeps/powerpc/powerpc64/power8/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/power8/strncpy.S
@@ -294,7 +294,7 @@ L(pagecross):
 #endif
 	orc	r9,r7,r9	/* Mask bits that are not part of the
 				   string.  */
-	li	cr7,0
+	li	r7,0
 	cmpb	r9,r9,r7	/* Check for null bytes in DWORD1.  */
 	cmpdi	cr7,r9,0
 	bne	cr7,L(short_path_prepare_2)
@@ -305,14 +305,14 @@ L(pagecross):
 	/* For next checks we have aligned address, so we check for more
 	   three doublewords to make sure we can read 16 unaligned bytes
 	   to start the bulk copy with 16 aligned addresses.  */
-	ld	cr7,8(r11)
+	ld	r7,8(r11)
 	cmpb	r9,r7,r9
 	cmpdi	cr7,r9,0
 	bne	cr7,L(short_path_prepare_2)
-	addi	cr7,r8,-8
+	addi	r7,r8,-8
 	cmpldi	cr7,r7,8
 	ble	cr7,L(short_path_prepare_2)
-	ld	cr7,16(r11)
+	ld	r7,16(r11)
 	cmpb	r9,r7,r9
 	cmpdi	cr7,r9,0
 	bne	cr7,L(short_path_prepare_2)
-- 
2.4.11

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

* Re: [PATCH 2/2] powerpc: Fix operand prefixes
  2016-04-20 20:55 [PATCH 2/2] powerpc: Fix operand prefixes Gabriel F. T. Gomes
@ 2016-04-20 21:21 ` Adhemerval Zanella
  2016-04-20 22:11 ` Steven Munroe
  1 sibling, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2016-04-20 21:21 UTC (permalink / raw)
  To: libc-alpha

LGTM.

On 20-04-2016 17:55, Gabriel F. T. Gomes wrote:
> The file sysdeps/powerpc/sysdeps.h defines aliases for control register
> operands.  E.g.: 'cr7' means control register 7.  On the one hand, this
> increases readability, as it makes it easier for readers to know whether the
> operand is a control register, a general purpose register or an immediate.  On
> the other hand, this permits that control register be written as if they were
> general purpose, and vice-versa, thus reducing the readability of the code.
> 
> This commit removes some of these unintentional misuses.
> 
> The changes have no effect on the final code.  Checked with objdump.
> 
> 2016-04-18  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
> 
> 	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Fix use of control
> 	registers specifiers where general purpose registers specifiers should
> 	have been used.
> ---
>  sysdeps/powerpc/powerpc64/power8/strncpy.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/powerpc/powerpc64/power8/strncpy.S b/sysdeps/powerpc/powerpc64/power8/strncpy.S
> index 0bb3bd4..437edeb 100644
> --- a/sysdeps/powerpc/powerpc64/power8/strncpy.S
> +++ b/sysdeps/powerpc/powerpc64/power8/strncpy.S
> @@ -294,7 +294,7 @@ L(pagecross):
>  #endif
>  	orc	r9,r7,r9	/* Mask bits that are not part of the
>  				   string.  */
> -	li	cr7,0
> +	li	r7,0
>  	cmpb	r9,r9,r7	/* Check for null bytes in DWORD1.  */
>  	cmpdi	cr7,r9,0
>  	bne	cr7,L(short_path_prepare_2)
> @@ -305,14 +305,14 @@ L(pagecross):
>  	/* For next checks we have aligned address, so we check for more
>  	   three doublewords to make sure we can read 16 unaligned bytes
>  	   to start the bulk copy with 16 aligned addresses.  */
> -	ld	cr7,8(r11)
> +	ld	r7,8(r11)
>  	cmpb	r9,r7,r9
>  	cmpdi	cr7,r9,0
>  	bne	cr7,L(short_path_prepare_2)
> -	addi	cr7,r8,-8
> +	addi	r7,r8,-8
>  	cmpldi	cr7,r7,8
>  	ble	cr7,L(short_path_prepare_2)
> -	ld	cr7,16(r11)
> +	ld	r7,16(r11)
>  	cmpb	r9,r7,r9
>  	cmpdi	cr7,r9,0
>  	bne	cr7,L(short_path_prepare_2)
> 

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

* Re: [PATCH 2/2] powerpc: Fix operand prefixes
  2016-04-20 20:55 [PATCH 2/2] powerpc: Fix operand prefixes Gabriel F. T. Gomes
  2016-04-20 21:21 ` Adhemerval Zanella
@ 2016-04-20 22:11 ` Steven Munroe
  2016-04-26 14:51   ` [PATCH v2 " Gabriel F. T. Gomes
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Munroe @ 2016-04-20 22:11 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha, tuliom

On Wed, 2016-04-20 at 17:55 -0300, Gabriel F. T. Gomes wrote:
> The file sysdeps/powerpc/sysdeps.h defines aliases for control register
> operands.  E.g.: 'cr7' means control register 7.  On the one hand, this
> increases readability, as it makes it easier for readers to know whether the
> operand is a control register, a general purpose register or an immediate.  On
> the other hand, this permits that control register be written as if they were
> general purpose, and vice-versa, thus reducing the readability of the code.
> 

I think you mean condition registers, and there are instructions that
will correctly update a specific cr# (cmpdi for example). 

But li and ld are not examples of instructions that do that. 

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

* [PATCH v2 2/2] powerpc: Fix operand prefixes
  2016-04-20 22:11 ` Steven Munroe
@ 2016-04-26 14:51   ` Gabriel F. T. Gomes
  2016-05-03 14:25     ` Tulio Magno Quites Machado Filho
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel F. T. Gomes @ 2016-04-26 14:51 UTC (permalink / raw)
  To: munroesj; +Cc: libc-alpha, tuliom

On Wed, 20 Apr 2016 17:10:56 -0500
Steven Munroe <munroesj@linux.vnet.ibm.com> wrote:

> On Wed, 2016-04-20 at 17:55 -0300, Gabriel F. T. Gomes wrote:
> > The file sysdeps/powerpc/sysdeps.h defines aliases for control register
> > operands.  E.g.: 'cr7' means control register 7.  On the one hand, this
> > increases readability, as it makes it easier for readers to know whether the
> > operand is a control register, a general purpose register or an immediate.  On
> > the other hand, this permits that control register be written as if they were
> > general purpose, and vice-versa, thus reducing the readability of the code.
> >   
> 
> I think you mean condition registers, and there are instructions that
> will correctly update a specific cr# (cmpdi for example). 
> 
> But li and ld are not examples of instructions that do that. 

Indeed, I meant condition register.

This new version should fix it. Thank you!

---8<---
The file sysdeps/powerpc/sysdeps.h defines aliases for condition register
operands.  E.g.: 'cr7' means condition register 7.  On the one hand, this
increases readability, as it makes it easier for readers to know whether the
operand is a condition register, a general purpose register or an immediate.
On the other hand, this permits that condition registers be written as if they
were general purpose, and vice-versa, thus reducing the readability of the
code.

This commit removes some of these unintentional misuses.

The changes have no effect on the final code.  Checked with objdump.

2016-04-18  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Fix use of condition
	registers specifiers where general purpose registers specifiers should
	have been used.
---
 sysdeps/powerpc/powerpc64/power8/strncpy.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/power8/strncpy.S b/sysdeps/powerpc/powerpc64/power8/strncpy.S
index 0bb3bd4..437edeb 100644
--- a/sysdeps/powerpc/powerpc64/power8/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/power8/strncpy.S
@@ -294,7 +294,7 @@ L(pagecross):
 #endif
 	orc	r9,r7,r9	/* Mask bits that are not part of the
 				   string.  */
-	li	cr7,0
+	li	r7,0
 	cmpb	r9,r9,r7	/* Check for null bytes in DWORD1.  */
 	cmpdi	cr7,r9,0
 	bne	cr7,L(short_path_prepare_2)
@@ -305,14 +305,14 @@ L(pagecross):
 	/* For next checks we have aligned address, so we check for more
 	   three doublewords to make sure we can read 16 unaligned bytes
 	   to start the bulk copy with 16 aligned addresses.  */
-	ld	cr7,8(r11)
+	ld	r7,8(r11)
 	cmpb	r9,r7,r9
 	cmpdi	cr7,r9,0
 	bne	cr7,L(short_path_prepare_2)
-	addi	cr7,r8,-8
+	addi	r7,r8,-8
 	cmpldi	cr7,r7,8
 	ble	cr7,L(short_path_prepare_2)
-	ld	cr7,16(r11)
+	ld	r7,16(r11)
 	cmpb	r9,r7,r9
 	cmpdi	cr7,r9,0
 	bne	cr7,L(short_path_prepare_2)
-- 
2.4.11

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

* Re: [PATCH v2 2/2] powerpc: Fix operand prefixes
  2016-04-26 14:51   ` [PATCH v2 " Gabriel F. T. Gomes
@ 2016-05-03 14:25     ` Tulio Magno Quites Machado Filho
  2016-05-04 13:17       ` Gabriel F. T. Gomes
  0 siblings, 1 reply; 6+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2016-05-03 14:25 UTC (permalink / raw)
  To: Gabriel F. T. Gomes, munroesj; +Cc: libc-alpha

"Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> writes:

> The file sysdeps/powerpc/sysdeps.h defines aliases for condition register
> operands.  E.g.: 'cr7' means condition register 7.  On the one hand, this
> increases readability, as it makes it easier for readers to know whether the
> operand is a condition register, a general purpose register or an immediate.
> On the other hand, this permits that condition registers be written as if they
> were general purpose, and vice-versa, thus reducing the readability of the
> code.
>
> This commit removes some of these unintentional misuses.
>
> The changes have no effect on the final code.  Checked with objdump.
>
> 2016-04-18  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
>
> 	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Fix use of condition
> 	registers specifiers where general purpose registers specifiers should
> 	have been used.

LGTM.

-- 
Tulio Magno

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

* Re: [PATCH v2 2/2] powerpc: Fix operand prefixes
  2016-05-03 14:25     ` Tulio Magno Quites Machado Filho
@ 2016-05-04 13:17       ` Gabriel F. T. Gomes
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel F. T. Gomes @ 2016-05-04 13:17 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho; +Cc: munroesj, libc-alpha

Thank you.

Pushed as eb3b8a4924502e508d5b353ed75f39826d2c9466.

On Tue, 03 May 2016 11:24:45 -0300
"Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> wrote:

> "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> writes:
> 
> > The file sysdeps/powerpc/sysdeps.h defines aliases for condition register
> > operands.  E.g.: 'cr7' means condition register 7.  On the one hand, this
> > increases readability, as it makes it easier for readers to know whether the
> > operand is a condition register, a general purpose register or an immediate.
> > On the other hand, this permits that condition registers be written as if they
> > were general purpose, and vice-versa, thus reducing the readability of the
> > code.
> >
> > This commit removes some of these unintentional misuses.
> >
> > The changes have no effect on the final code.  Checked with objdump.
> >
> > 2016-04-18  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
> >
> > 	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Fix use of condition
> > 	registers specifiers where general purpose registers specifiers should
> > 	have been used.  
> 
> LGTM.
> 

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

end of thread, other threads:[~2016-05-04 13:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20 20:55 [PATCH 2/2] powerpc: Fix operand prefixes Gabriel F. T. Gomes
2016-04-20 21:21 ` Adhemerval Zanella
2016-04-20 22:11 ` Steven Munroe
2016-04-26 14:51   ` [PATCH v2 " Gabriel F. T. Gomes
2016-05-03 14:25     ` Tulio Magno Quites Machado Filho
2016-05-04 13:17       ` Gabriel F. T. Gomes

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