public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/109116] New: vector_pair register allocation bug
@ 2023-03-13 21:42 chip.kerchner at ibm dot com
  2023-03-13 21:46 ` [Bug rtl-optimization/109116] " chip.kerchner at ibm dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: chip.kerchner at ibm dot com @ 2023-03-13 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109116
           Summary: vector_pair register allocation bug
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chip.kerchner at ibm dot com
  Target Milestone: ---

There seems to be a bug in the register allocator when using a __vector_pair. 
GCC didn't choose a register for the load that served the later instruction.

With this testcase

```
#include <altivec.h>

#if !__has_builtin(__builtin_vsx_disassemble_pair)
#define __builtin_vsx_disassemble_pair __builtin_mma_disassemble_pair
#endif

int main() {
  float A[8] = { float(1), float(2), float(3), float(4),
                 float(5), float(6), float(7), float(8) };
  __vector_pair P;
  __vector_quad Q;
  vector float B, C[2], D[4];

  __builtin_mma_xxsetaccz(&Q);
  P = *reinterpret_cast<__vector_pair *>(A);
  B = *reinterpret_cast<vector float *>(A);
  __builtin_vsx_disassemble_pair((void*)(C), &P);
  __builtin_mma_xvf32gerpp(&Q, reinterpret_cast<__vector unsigned char>(C[0]),
reinterpret_cast<__vector unsigned char>(B));
  __builtin_mma_xvf32gerpp(&Q, reinterpret_cast<__vector unsigned char>(C[1]),
reinterpret_cast<__vector unsigned char>(B));
  __builtin_mma_disassemble_acc((void *)D, &Q);

  return int(D[0][0]);
}
```

It produces an output with extra (unneeded) register moves.

```
    plxvp 12,.LANCHOR0@pcrel
    xxsetaccz 0
    plxv 33,.LC1@pcrel
    xxlor 45,13,13
    xxlor 32,12,12
    xvf32gerpp 0,45,33
    xvf32gerpp 0,32,33
    xxmfacc 0
```

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

* [Bug rtl-optimization/109116] vector_pair register allocation bug
  2023-03-13 21:42 [Bug rtl-optimization/109116] New: vector_pair register allocation bug chip.kerchner at ibm dot com
@ 2023-03-13 21:46 ` chip.kerchner at ibm dot com
  2023-03-13 23:48 ` [Bug target/109116] " chip.kerchner at ibm dot com
  2023-03-15 16:25 ` bergner at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: chip.kerchner at ibm dot com @ 2023-03-13 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Chip Kerchner <chip.kerchner at ibm dot com> ---
This has been in GCC since the initial version that supported __vector_pair
(10.x)

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

* [Bug target/109116] vector_pair register allocation bug
  2023-03-13 21:42 [Bug rtl-optimization/109116] New: vector_pair register allocation bug chip.kerchner at ibm dot com
  2023-03-13 21:46 ` [Bug rtl-optimization/109116] " chip.kerchner at ibm dot com
@ 2023-03-13 23:48 ` chip.kerchner at ibm dot com
  2023-03-15 16:25 ` bergner at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: chip.kerchner at ibm dot com @ 2023-03-13 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Chip Kerchner <chip.kerchner at ibm dot com> ---
This could be a bigger issue with register allocation after the disassemble of
an opaque object like vector_pair or MMA.

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

* [Bug target/109116] vector_pair register allocation bug
  2023-03-13 21:42 [Bug rtl-optimization/109116] New: vector_pair register allocation bug chip.kerchner at ibm dot com
  2023-03-13 21:46 ` [Bug rtl-optimization/109116] " chip.kerchner at ibm dot com
  2023-03-13 23:48 ` [Bug target/109116] " chip.kerchner at ibm dot com
@ 2023-03-15 16:25 ` bergner at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: bergner at gcc dot gnu.org @ 2023-03-15 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-15
           Assignee|unassigned at gcc dot gnu.org      |bergner at gcc dot gnu.org

--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> ---
Mine.

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

end of thread, other threads:[~2023-03-15 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 21:42 [Bug rtl-optimization/109116] New: vector_pair register allocation bug chip.kerchner at ibm dot com
2023-03-13 21:46 ` [Bug rtl-optimization/109116] " chip.kerchner at ibm dot com
2023-03-13 23:48 ` [Bug target/109116] " chip.kerchner at ibm dot com
2023-03-15 16:25 ` bergner at gcc dot gnu.org

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