On Thu, Jul 02, 2026 at 02:33:41PM +0530, Kishan Parmar wrote:
> Hello,
> 
> Below patch is bootstrapped and regtested on Power64le-linux-gnu.
> 
> Thank You,
> Kishan
> 
> The %Y print operand modifier unconditionally prints 
> reg_names[REGNO (x) + 2], i.e. it adds 2 to the register's hardware
> register number.
> 
> Some instruction patterns for a future Power processor print one
> operand with '%x', which forces that operand to be printed and follow
> (and allocated) using VSX register numbering.  A second, related
> operand in the same pattern is printed with %Y, which is meant to give
> the next register in sequence relative to the first. The %Y operand
> modifier always added 2 to the hardware register number without first
> converting to VSX register numbering. Reason being result did not match
> the numbering used by '%x' in the same instruction whenever an Altivec
> register was allocated, causing later code to reference the wrong
> physical registers.
> 
> Fix %Y so that, for VSX-eligible registers, it converts to VSX register
> numbering before adding 2, matching '%x'.  Non-VSX registers are
> unaffected.

I think we need to think about this.  And yes, I had used %Y in my
1,024 bit dense math register patch.

Now originally print_operand used %Y<n> to print the register +2 from
the operand and %Z<n> to print the register +3 from the operand.

This was used to pick apart the 4 GPR registers to hold a 128 bit value
(i.e. %<n> would print the first register in the 4 register group,
%L<n> would print the second register, %Y<n> would print the third
register, and %Z<n> would print the fourth register.

Long ago, GCC removed using either %Y or %Z.  The earliest GCC I have
on this system is GCC 10, and nothing uses %Y or %Z.  So perhaps we
should remove both %Y and %Z, and either add a new print_operand
letter, or do it within the insert/extract patterns.

Lets see, I think the following letters are available:

     b, d, g, i, m, o, r
     C, M, W

It also points out to me that I need to adjust the 1,024 bit dense math
patch to use %x<n> instead of %<n> for the VSX registers.  I will
adjust my patch.

Logically we have the same issue with %L on VSX registers, in that it
only works for traditional FPR registers.  I know I've run into this in
the past, and 'solved' it by use %f<n> to force allocation to the
traditional FPR registers or I used %x<n>+1.

Note, if GAS is used, you could just use %x<n> + 2.

So please consider rewriting the patch to use one of the unused
letters, or rewriting your code to use %x<n>+2.

We probably should remove %Y and %Z at some point.  Looking at
print_operand, we probably should fix the comments for %N and %O which
are used (the comment says they are unused).

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: [email protected]

Reply via email to