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

            Bug ID: 109073
           Summary: __builtin_vsx_lxvp() doesn't allow a const
                    __vector_pair * operand in GCC 11 & 10
           Product: gcc
           Version: 11.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

On GCC 11 and GCC 10, we error on the following test case which GCC 12 and
trunk accept with no errors:

bergner@ltcden2$ cat t.cc 
void
foo (void *dst, const __vector_pair *src)
{
  __vector_pair pair = __builtin_vsx_lxvp(0L, src);
  __builtin_vsx_disassemble_pair(dst, &pair);
}

bergner@ltcden2$ g++ -S -O2 -mcpu=power10 t.cc 
t.cc: In function ‘void foo(void*, const __vector_pair*)’:
t.cc:4:47: error: invalid conversion from ‘const __vector_pair*’ to
‘__vector_pair*’ [-fpermissive]
    4 |   __vector_pair pair = __builtin_vsx_lxvp(0L, src);
      |                                               ^~~
      |                                               |
      |                                               const __vector_pair*
<built-in>: note:   initializing argument 2 of ‘__vector_pair
__builtin_vsx_lxvp(sizetype, __vector_pair*)’

This was "fixed" in GCC 12 with Bill's rs6000 built-in rewrite, which we don't
want to backport.  I have a smaller fix which can be backported that I am
testing. The same problem affects the __builtin_vsx_stxvp() and
__builtin_vsx_disassemble_pair() and __builtin_mma_disassemble_acc() builtins.

Reply via email to