public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined
@ 2021-12-03 18:52 bergner at gcc dot gnu.org
  2021-12-03 19:45 ` [Bug target/103548] " bergner at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-12-03 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103548
           Summary: Identical MMA assemble quads are incorrectly combined
           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: ---

We incorrectly combine multiple identical build/assemble quads/accs leading to
incorrect assembly being generated:

typedef unsigned char  vec_t __attribute__((vector_size(16)));

void
foo (__vector_quad *dst, vec_t *src)
{
  __vector_quad quad0, quad1;
  /* Adjacent loads should be combined into two lxvp instructions.
     and identical build accs should not be combined.  */
  __builtin_mma_build_acc (&quad0, src[0], src[1], src[2], src[3]);
  __builtin_mma_build_acc (&quad1, src[0], src[1], src[2], src[3]);
  dst[0] = quad0;
  dst[2] = quad1;
}

...gives:

        lxv 3,0(4)
        lxv 2,16(4)
        lxv 1,32(4)
        lxv 0,48(4)
        xxmtacc 0
        xxmfacc 0
        stxvp 2,0(3)
        stxvp 0,32(3)
        xxmfacc 0
        stxvp 2,128(3)
        stxvp 0,160(3)
        blr

Notive we only have 4 loads and 1 xxmtacc but 2 xxmfacc.  This is incorrect.  I
have a patch I'm testing. 

Note that for build/assemble pair, we are allowed to combine identical
calls...amd we do.

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

* [Bug target/103548] Identical MMA assemble quads are incorrectly combined
  2021-12-03 18:52 [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined bergner at gcc dot gnu.org
@ 2021-12-03 19:45 ` bergner at gcc dot gnu.org
  2021-12-14 21:00 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-12-03 19:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |powerpc*-*-*
           Assignee|unassigned at gcc dot gnu.org      |bergner at gcc dot gnu.org
   Target Milestone|---                         |12.0
   Last reconfirmed|                            |2021-12-03
             Status|UNCONFIRMED                 |ASSIGNED
      Known to fail|                            |10.0, 11.0, 12.0
     Ever confirmed|0                           |1

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

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

* [Bug target/103548] Identical MMA assemble quads are incorrectly combined
  2021-12-03 18:52 [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined bergner at gcc dot gnu.org
  2021-12-03 19:45 ` [Bug target/103548] " bergner at gcc dot gnu.org
@ 2021-12-14 21:00 ` cvs-commit at gcc dot gnu.org
  2021-12-14 23:19 ` bergner at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-14 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Peter Bergner <bergner@gcc.gnu.org>:

https://gcc.gnu.org/g:15c02ab2569b3c4e27d6f133c013b15a9fa70177

commit r12-5969-g15c02ab2569b3c4e27d6f133c013b15a9fa70177
Author: Peter Bergner <bergner@linux.ibm.com>
Date:   Tue Dec 14 14:50:41 2021 -0600

    rs6000: Do not allow combining of multiple assemble quads [PR103548]

    The compiler will gladly CSE the result of two __builtin_mma_build_acc
    calls with the same four vector arguments, leading to illegal MMA
    code being generated.  The fix here is to make the mma_assemble_acc
    pattern use a unspec_volatile to stop the CSE from happening.

    2021-12-14  Peter Bergner  <bergner@linux.ibm.com>

    gcc/
            PR target/103548
            * config/rs6000/mma.md (UNSPEC_MMA_ASSEMBLE): Rename unspec from
this...
            (UNSPEC_VSX_ASSEMBLE): ...to this.
            (UNSPECV_MMA_ASSEMBLE): New unspecv.
            (vsx_assemble_pair): Use UNSPEC_VSX_ASSEMBLE.
            (*vsx_assemble_pair): Likewise.
            (mma_assemble_acc): Use UNSPECV_MMA_ASSEMBLE.
            (*mma_assemble_acc): Likewise.
            * config/rs6000/rs6000.c (rs6000_split_multireg_move): Handle
            UNSPEC_VOLATILE.  Use UNSPEC_VSX_ASSEMBLE and UNSPECV_MMA_ASSEMBLE.

    gcc/testsuite/
            PR target/103548
            * gcc.target/powerpc/mma-builtin-10-pair.c: New test.
            * gcc.target/powerpc/mma-builtin-10-quad.c: New test.

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

* [Bug target/103548] Identical MMA assemble quads are incorrectly combined
  2021-12-03 18:52 [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined bergner at gcc dot gnu.org
  2021-12-03 19:45 ` [Bug target/103548] " bergner at gcc dot gnu.org
  2021-12-14 21:00 ` cvs-commit at gcc dot gnu.org
@ 2021-12-14 23:19 ` bergner at gcc dot gnu.org
  2022-05-06  8:32 ` jakub at gcc dot gnu.org
  2023-05-08 12:23 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-12-14 23:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> ---
Fixed on trunk.  I'll let it bake a couple of days there before backporting to
GCC 11 & 10.

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

* [Bug target/103548] Identical MMA assemble quads are incorrectly combined
  2021-12-03 18:52 [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined bergner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-12-14 23:19 ` bergner at gcc dot gnu.org
@ 2022-05-06  8:32 ` jakub at gcc dot gnu.org
  2023-05-08 12:23 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.0                        |12.2

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.

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

* [Bug target/103548] Identical MMA assemble quads are incorrectly combined
  2021-12-03 18:52 [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined bergner at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-05-06  8:32 ` jakub at gcc dot gnu.org
@ 2023-05-08 12:23 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.3                        |12.4

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.

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

end of thread, other threads:[~2023-05-08 12:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 18:52 [Bug target/103548] New: Identical MMA assemble quads are incorrectly combined bergner at gcc dot gnu.org
2021-12-03 19:45 ` [Bug target/103548] " bergner at gcc dot gnu.org
2021-12-14 21:00 ` cvs-commit at gcc dot gnu.org
2021-12-14 23:19 ` bergner at gcc dot gnu.org
2022-05-06  8:32 ` jakub at gcc dot gnu.org
2023-05-08 12:23 ` rguenth 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).