public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC
@ 2015-06-09 18:29 Michael Meissner
  2015-06-09 19:26 ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Meissner @ 2015-06-09 18:29 UTC (permalink / raw)
  To: gcc-patches, dje.gcc

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

A user pointed out that we never documented the requirement to use %x<n> in the
ouptut template when VSX registers are used.  This patch adds the necessary
documentation. Is it ok to install in the trunk and the open release branches?

2015-06-09  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/66474
	* doc/md.texi (Machine Constraints): Document that on the PowerPC
	if you use a constraint that targets a VSX register, you must use
	%x<n> in the template.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

[-- Attachment #2: pr66474.patch01b --]
[-- Type: text/plain, Size: 1052 bytes --]

Index: gcc/doc/md.texi
===================================================================
--- gcc/doc/md.texi	(revision 224165)
+++ gcc/doc/md.texi	(working copy)
@@ -3070,6 +3070,26 @@ Altivec vector register
 @item wa
 Any VSX register if the -mvsx option was used or NO_REGS.
 
+When using any of the register constraints (@code{wa}, @code{wd},
+@code{wf}, @code{wg}, @code{wh}, @code{wi}, @code{wj}, @code{wk},
+@code{wl}, @code{wm}, @code{ws}, @code{wt}, @code{wu}, @code{wv},
+@code{ww}, or @code{wy}) that take VSX registers, you must use
+@code{%x<n>} in the template so that the correct register is used.
+Otherwise, the register number will be incorrect if an Altivec
+register is used in a place where a VSX register is expected.
+
+@smallexample
+asm ("xvadddp %x0,%x1,%x2" "=wa" (v1) : "wa" (v2), "wa" (v3));
+@end smallexample
+
+is correct, but:
+
+@smallexample
+asm ("xvadddp %0,%1,%2" "=wa" (v1) : "wa" (v2), "wa" (v3));
+@end smallexample
+
+is not correct.
+
 @item wd
 VSX vector register to hold vector double data or NO_REGS.
 

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

* Re: [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC
  2015-06-09 18:29 [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC Michael Meissner
@ 2015-06-09 19:26 ` Segher Boessenkool
  2015-06-09 19:30   ` Michael Meissner
  0 siblings, 1 reply; 5+ messages in thread
From: Segher Boessenkool @ 2015-06-09 19:26 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, dje.gcc

On Tue, Jun 09, 2015 at 02:00:48PM -0400, Michael Meissner wrote:
> +asm ("xvadddp %x0,%x1,%x2" "=wa" (v1) : "wa" (v2), "wa" (v3));

A colon went missing?       ^^^


Segher

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

* Re: [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC
  2015-06-09 19:26 ` Segher Boessenkool
@ 2015-06-09 19:30   ` Michael Meissner
  2015-06-10  2:39     ` David Edelsohn
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Meissner @ 2015-06-09 19:30 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Michael Meissner, gcc-patches, dje.gcc

On Tue, Jun 09, 2015 at 02:17:19PM -0500, Segher Boessenkool wrote:
> On Tue, Jun 09, 2015 at 02:00:48PM -0400, Michael Meissner wrote:
> > +asm ("xvadddp %x0,%x1,%x2" "=wa" (v1) : "wa" (v2), "wa" (v3));
> 
> A colon went missing?       ^^^

Yes, I will correct it when I check it in.  Thanks.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

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

* Re: [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC
  2015-06-09 19:30   ` Michael Meissner
@ 2015-06-10  2:39     ` David Edelsohn
  2015-06-10 17:23       ` Michael Meissner
  0 siblings, 1 reply; 5+ messages in thread
From: David Edelsohn @ 2015-06-10  2:39 UTC (permalink / raw)
  To: Michael Meissner, Segher Boessenkool, GCC Patches, David Edelsohn

On Tue, Jun 9, 2015 at 3:26 PM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:
> On Tue, Jun 09, 2015 at 02:17:19PM -0500, Segher Boessenkool wrote:
>> On Tue, Jun 09, 2015 at 02:00:48PM -0400, Michael Meissner wrote:
>> > +asm ("xvadddp %x0,%x1,%x2" "=wa" (v1) : "wa" (v2), "wa" (v3));
>>
>> A colon went missing?       ^^^
>
> Yes, I will correct it when I check it in.  Thanks.

Mike,

VSX registers are a superset of Altivec registers, so the statement
about an Altivec register used where a VSX register is expected is a
little confusing.  How about:

Otherwise the register number output in the assembly file will be
incorrect if an Altivec register is an operand of a VSX instruction
that expects VSX register numbering.

Thanks, David

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

* Re: [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC
  2015-06-10  2:39     ` David Edelsohn
@ 2015-06-10 17:23       ` Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2015-06-10 17:23 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Michael Meissner, Segher Boessenkool, GCC Patches

On Tue, Jun 09, 2015 at 08:28:35PM -0400, David Edelsohn wrote:
> On Tue, Jun 9, 2015 at 3:26 PM, Michael Meissner
> <meissner@linux.vnet.ibm.com> wrote:
> > On Tue, Jun 09, 2015 at 02:17:19PM -0500, Segher Boessenkool wrote:
> >> On Tue, Jun 09, 2015 at 02:00:48PM -0400, Michael Meissner wrote:
> >> > +asm ("xvadddp %x0,%x1,%x2" "=wa" (v1) : "wa" (v2), "wa" (v3));
> >>
> >> A colon went missing?       ^^^
> >
> > Yes, I will correct it when I check it in.  Thanks.
> 
> Mike,
> 
> VSX registers are a superset of Altivec registers, so the statement
> about an Altivec register used where a VSX register is expected is a
> little confusing.  How about:
> 
> Otherwise the register number output in the assembly file will be
> incorrect if an Altivec register is an operand of a VSX instruction
> that expects VSX register numbering.

The re-wording is fine with me.  I will check in the patch.  Thanks.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

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

end of thread, other threads:[~2015-06-10 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 18:29 [PATCH] PR 66474, Document using %x<n> for VSX registers on PowerPC Michael Meissner
2015-06-09 19:26 ` Segher Boessenkool
2015-06-09 19:30   ` Michael Meissner
2015-06-10  2:39     ` David Edelsohn
2015-06-10 17:23       ` Michael Meissner

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