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  <meiss...@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: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
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.
 

Reply via email to