public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
@ 2020-07-08 20:08 bergner at gcc dot gnu.org
  2020-07-08 20:10 ` [Bug target/96125] " bergner at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-08 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96125
           Summary: __attribute__((target("cpu=power10,mma"))) does not
                    set TARGET_MMA
           Product: gcc
           Version: 11.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: ---

__attribute__((target("cpu=power10,mma"))) should set TARGET_MMA within the
compiler.  It doesn't, so calling our MMA built-ins results in errors.  In the
test case below, we correctly emit a ".machine power10" so the first function
is fine.  We only seem to be missing the setting of TARGET_MMA.


bergner@marlin:~/$ cat bug.c 
void
__attribute__((target("cpu=power10,mma")))
foo (long *dst)
{
  long e = -1;
  asm ("pli %0,%1" : "+r" (e) : "n" (0x12345));
  *dst = e;
}

void
__attribute__((target("cpu=power10,mma")))
bar (void *dst)
{
  __vector_quad acc;
  __builtin_mma_xxsetaccz (&acc);
  __builtin_mma_disassemble_acc (dst, &acc);
}
bergner@marlin:~/$ gcc -S -O2 -mcpu=power8 bug.c 
bug.c: In function ‘bar’:
bug.c:14:3: error: unknown type name ‘__vector_quad’
   14 |   __vector_quad acc;
      |   ^~~~~~~~~~~~~
bug.c:15:3: warning: implicit declaration of function
‘__builtin_mma_xxsetaccz’; did you mean ‘__builtin_va_start’?
[-Wimplicit-function-declaration]
   15 |   __builtin_mma_xxsetaccz (&acc);
      |   ^~~~~~~~~~~~~~~~~~~~~~~
      |   __builtin_va_start
bug.c:16:3: warning: implicit declaration of function
‘__builtin_mma_disassemble_acc’ [-Wimplicit-function-declaration]
   16 |   __builtin_mma_disassemble_acc (dst, &acc);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
@ 2020-07-08 20:10 ` bergner at gcc dot gnu.org
  2020-07-08 20:55 ` bergner at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-08 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |bergner at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |dje at gcc dot gnu.org,
                   |                            |meissner at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org,
                   |                            |wschmidt at gcc dot gnu.org
   Last reconfirmed|                            |2020-07-08
     Ever confirmed|0                           |1

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

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
  2020-07-08 20:10 ` [Bug target/96125] " bergner at gcc dot gnu.org
@ 2020-07-08 20:55 ` bergner at gcc dot gnu.org
  2020-07-08 22:09 ` bergner at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-08 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Peter Bergner <bergner at gcc dot gnu.org> ---
Looks like some missing code in rs6000_option_override_internal() to enable
TARGET_MMA by default when -mcpu=power10 is used, similar to how we handle
-mprefix.  I'm testing a patch.

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
  2020-07-08 20:10 ` [Bug target/96125] " bergner at gcc dot gnu.org
  2020-07-08 20:55 ` bergner at gcc dot gnu.org
@ 2020-07-08 22:09 ` bergner at gcc dot gnu.org
  2020-07-09 20:59 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-08 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> ---
Actually, it's more complicated than that.  We only initialize the target
builtins once, using the command line option values and not again using the
target attribute/pragma values.  That means we basically have to initialize the
builtins, even if TARGET_MMA is false, just in case the user uses a target
attribute/pragma that allows them.

Will fixed a similar issue in March (no bugzilla entry for it though):

https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542555.html

...which basically just always enables the builtins.  I'll do something
similar.

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-07-08 22:09 ` bergner at gcc dot gnu.org
@ 2020-07-09 20:59 ` cvs-commit at gcc dot gnu.org
  2020-07-09 23:20 ` bergner at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-09 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:fd263be4b523ff1b7f7dda49d856cc57221e8d21

commit r11-1973-gfd263be4b523ff1b7f7dda49d856cc57221e8d21
Author: Peter Bergner <bergner@linux.ibm.com>
Date:   Thu Jul 9 15:52:59 2020 -0500

    rs6000: Allow MMA built-in initialization regardless of compiler options

    Built-in initialization occurs only once and fairly early, when the
    command line options are in force.  If the -mcpu=<CPU> is pre-power10,
    then we fail to initialize the MMA built-ins, so they are not
    available to call in a #pragma target/attribute target function.
    The fix is to basically always (on server type cpus) initialize the MMA
    built-ins so we can use them in #pragma target/attribute target functions.

    2020-07-09  Peter Bergner  <bergner@linux.ibm.com>

    gcc/
            PR target/96125
            * config/rs6000/rs6000-call.c (rs6000_init_builtins): Define the
MMA
            specific types __vector_quad and __vector_pair, and initialize the
            MMA built-ins if TARGET_EXTRA_BUILTINS is set.
            (mma_init_builtins): Don't test for mask set in
rs6000_builtin_mask.
            Remove now unneeded mask variable.
            * config/rs6000/rs6000.c (rs6000_option_override_internal): Add the
            OPTION_MASK_MMA flag for power10 if not already set.

    gcc/testsuite/
            PR target/96125
            * gcc.target/powerpc/pr96125.c: New test.

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-07-09 20:59 ` cvs-commit at gcc dot gnu.org
@ 2020-07-09 23:20 ` bergner at gcc dot gnu.org
  2020-07-10 15:12 ` cvs-commit at gcc dot gnu.org
  2020-07-10 15:29 ` bergner at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-09 23:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.2

--- Comment #5 from Peter Bergner <bergner at gcc dot gnu.org> ---
Fixed on trunk.  I'll backport to GCC10 tomorrow, after our nightly regtesters
have blessed it.

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-07-09 23:20 ` bergner at gcc dot gnu.org
@ 2020-07-10 15:12 ` cvs-commit at gcc dot gnu.org
  2020-07-10 15:29 ` bergner at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-10 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:45b7f80f2e591d4f674d2f0798d31d51a7e46a72

commit r10-8458-g45b7f80f2e591d4f674d2f0798d31d51a7e46a72
Author: Peter Bergner <bergner@linux.ibm.com>
Date:   Thu Jul 9 15:52:59 2020 -0500

    rs6000: Allow MMA built-in initialization regardless of compiler options

    Built-in initialization occurs only once and fairly early, when the
    command line options are in force.  If the -mcpu=<CPU> is pre-power10,
    then we fail to initialize the MMA built-ins, so they are not
    available to call in a #pragma target/attribute target function.
    The fix is to basically always (on server type cpus) initialize the MMA
    built-ins so we can use them in #pragma target/attribute target functions.

    2020-07-09  Peter Bergner  <bergner@linux.ibm.com>

    gcc/
            PR target/96125
            * config/rs6000/rs6000-call.c (rs6000_init_builtins): Define the
MMA
            specific types __vector_quad and __vector_pair, and initialize the
            MMA built-ins if TARGET_EXTRA_BUILTINS is set.
            (mma_init_builtins): Don't test for mask set in
rs6000_builtin_mask.
            Remove now unneeded mask variable.
            * config/rs6000/rs6000.c (rs6000_option_override_internal): Add the
            OPTION_MASK_MMA flag for power10 if not already set.

    gcc/testsuite/
            PR target/96125
            * gcc.target/powerpc/pr96125.c: New test.

    (cherry picked from commit fd263be4b523ff1b7f7dda49d856cc57221e8d21)

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

* [Bug target/96125] __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA
  2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-07-10 15:12 ` cvs-commit at gcc dot gnu.org
@ 2020-07-10 15:29 ` bergner at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-10 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Peter Bergner <bergner at gcc dot gnu.org> ---
Fixed on GCC10 now too.

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

end of thread, other threads:[~2020-07-10 15:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 20:08 [Bug target/96125] New: __attribute__((target("cpu=power10,mma"))) does not set TARGET_MMA bergner at gcc dot gnu.org
2020-07-08 20:10 ` [Bug target/96125] " bergner at gcc dot gnu.org
2020-07-08 20:55 ` bergner at gcc dot gnu.org
2020-07-08 22:09 ` bergner at gcc dot gnu.org
2020-07-09 20:59 ` cvs-commit at gcc dot gnu.org
2020-07-09 23:20 ` bergner at gcc dot gnu.org
2020-07-10 15:12 ` cvs-commit at gcc dot gnu.org
2020-07-10 15:29 ` 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).