https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102976

            Bug ID: 102976
           Summary: MMA test case emits wrong code when building a vector
                    pair
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

The following test case generates wrong code using trunk and GCC11:

[bergner@pike debug]$ cat bug.c 
#include <altivec.h>
void
bug (__vector_pair *dst)
{
  register vector unsigned char vec0 asm ("vs44");
  register vector unsigned char vec1 asm ("vs32");
  __builtin_vsx_build_pair (dst, vec0, vec1);
}
[bergner@pike debug]$ gcc -S -O2 -mcpu=power10 bug.c
[bergner@pike debug]$ cat bug.s 
bug:
        xxlor 0,32,32
        xxlor 1,32,32
        stxvp 0,0(3)
        blr

The above only copies one of the inputs into the output pair, when it should
copy both r44 and r32, like so:
bug:
        xxlor 0,44,44
        xxlor 1,32,32
        stxvp 0,0(3)
        blr

This is due to a missing early clobber in the MMA patterns.  I have a fix I'm
testing.

Reply via email to