public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
@ 2021-03-24  2:58 hjl.tools at gmail dot com
  2021-03-24  9:16 ` [Bug target/99744] " rguenth at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-24  2:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99744
           Summary: __attribute__ ((target("general-regs-only"))) doesn't
                    work with GPR intrinsics
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com, ubizjak at gmail dot com
  Target Milestone: ---
            Target: x86-64,i386

[hjl@gnu-cfl-2 uintr-2]$ cat x.c
#include <x86intrin.h>

extern unsigned long long int curr_deadline;
extern void bar (void);

__attribute__ ((target("general-regs-only")))
void
foo (void)
{
  if (__rdtsc () < curr_deadline)
    return; 
  bar ();
}
[hjl@gnu-cfl-2 uintr-2]$ /usr/gcc-11.0.0-x32/bin/gcc -S x.c
In file included from
/usr/gcc-11.0.0-x32/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include/x86gprintrin.h:27,
                 from
/usr/gcc-11.0.0-x32/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include/x86intrin.h:27,
                 from x.c:1:
x.c: In function ‘foo’:
/usr/gcc-11.0.0-x32/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include/ia32intrin.h:112:1:
error: inlining failed in call to ‘always_inline’ ‘__rdtsc’: target specific
option mismatch
  112 | __rdtsc (void)
      | ^~~~~~~
x.c:10:7: note: called from here
   10 |   if (__rdtsc () < curr_deadline)
      |       ^~~~~~~~~~
[hjl@gnu-cfl-2 uintr-2]$ ls
foo.c  Makefile  x.c
[hjl@gnu-cfl-2 uintr-2]$ 

ix86_can_inline_p failed since caller disabled SSE and MMX, but __rdtsc had
SSE and MMX enanbled.  However GPR intrinsics don't need SSE nor MMX.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
@ 2021-03-24  9:16 ` rguenth at gcc dot gnu.org
  2021-03-24  9:47 ` crazylht at gmail dot com
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-24  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
it's difficult to check all requirements so elsewhere I suggested to be
forgiving when inlining always-inline functions.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
  2021-03-24  9:16 ` [Bug target/99744] " rguenth at gcc dot gnu.org
@ 2021-03-24  9:47 ` crazylht at gmail dot com
  2021-03-24 11:15 ` jakub at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: crazylht at gmail dot com @ 2021-03-24  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
in ix86_can_inline_p
----
static bool
ix86_can_inline_p (tree caller, tree callee)
{
  tree caller_tree = DECL_FUNCTION_SPECIFIC_TARGET (caller);
  tree callee_tree = DECL_FUNCTION_SPECIFIC_TARGET (callee);
...
  if (!callee_tree)
    callee_tree = target_option_default_node;
  if (!caller_tree)
    caller_tree = target_option_default_node;
  if (callee_tree == caller_tree)
    return true;
----
caller_tree is like:

    -m64 -mfxsr -m128bit-long-double -mfp-ret-in-387 -mieee-fp
-mno-fancy-math-387 -mtls-direct-seg-refs -mvzeroupper -mstv
-mgeneral-regs-only -mfpmath=387

callee_tree is null, then it's assigned with target_option_default_node which
is like

    -m64 -msse2 -msse -mmmx -mfxsr -m128bit-long-double -m80387 -mfp-ret-in-387
-mieee-fp -mtls-direct-seg-refs -mvzeroupper -mstv -mfpmath=sse

So should it's safe to inline when callee_tree is null?

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
  2021-03-24  9:16 ` [Bug target/99744] " rguenth at gcc dot gnu.org
  2021-03-24  9:47 ` crazylht at gmail dot com
@ 2021-03-24 11:15 ` jakub at gcc dot gnu.org
  2021-03-24 17:58 ` hjl.tools at gmail dot com
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-24 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looks like the same thing as PR98209.  Basically, that for always_inline we
don't know whether the implicitly set target/optimization flags (inherited from
command line rather than from explicit target pragmas or optimize/target
attributes) must be matched in the caller or not.  And we don't really track
what was from the command line and what was overridden.
For some functions we don't really care and want to inline them always no
matter if there are any optimize/target differences (e.g. the various glibc
-D_FORTIFY_SOURCE* functions), in other functions we care about the explicit
but not implicit flags, and in yet other we care about everything.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2021-03-24 11:15 ` jakub at gcc dot gnu.org
@ 2021-03-24 17:58 ` hjl.tools at gmail dot com
  2021-03-25 12:37 ` cvs-commit at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-24 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-24
           Keywords|                            |patch
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2021-March/5
                   |                            |67255.html

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch has been posted at

https://gcc.gnu.org/pipermail/gcc-patches/2021-March/567255.html

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2021-03-24 17:58 ` hjl.tools at gmail dot com
@ 2021-03-25 12:37 ` cvs-commit at gcc dot gnu.org
  2021-03-25 12:43 ` hjl.tools at gmail dot com
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-25 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:72982851d70dfbc547d83ed2bb45356b9ebe3ff0

commit r11-7825-g72982851d70dfbc547d83ed2bb45356b9ebe3ff0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 23 20:04:58 2021 -0700

    x86: Skip ISA check for always_inline in system headers

    For always_inline in system headers, we don't know if caller's ISAs are
    compatible with callee's ISAs until much later.  Skip ISA check for
    always_inline in system headers if caller has target attribute.

    gcc/

            PR target/98209
            PR target/99744
            * config/i386/i386.c (ix86_can_inline_p): Don't check ISA for
            always_inline in system headers.

    gcc/testsuite/

            PR target/98209
            PR target/99744
            * gcc.target/i386/pr98209.c: New test.
            * gcc.target/i386/pr99744-1.c: Likewise.
            * gcc.target/i386/pr99744-2.c: Likewise.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2021-03-25 12:37 ` cvs-commit at gcc dot gnu.org
@ 2021-03-25 12:43 ` hjl.tools at gmail dot com
  2021-03-25 14:00 ` hjl.tools at gmail dot com
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-25 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0
             Status|NEW                         |RESOLVED

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2021-03-25 12:43 ` hjl.tools at gmail dot com
@ 2021-03-25 14:00 ` hjl.tools at gmail dot com
  2021-03-30 13:29 ` cvs-commit at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-25 14:00 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
The fix was reverted by

commit de00a7bda94910835012bc7150be53b460a5c8b6
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Mar 25 06:57:37 2021 -0700

    Revert "x86: Skip ISA check for always_inline in system headers"

    This reverts commit 72982851d70dfbc547d83ed2bb45356b9ebe3ff0.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2021-03-25 14:00 ` hjl.tools at gmail dot com
@ 2021-03-30 13:29 ` cvs-commit at gcc dot gnu.org
  2021-04-10 13:00 ` cvs-commit at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-30 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:5463cee277038df4688b61144db498ae7d24e631

commit r11-7910-g5463cee277038df4688b61144db498ae7d24e631
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 23 20:04:58 2021 -0700

    x86: Define __rdtsc and __rdtscp as macros

    Define __rdtsc and __rdtscp as macros for callers with general-regs-only
    target attribute to avoid inline failure with always_inline attribute.

    gcc/

            PR target/99744
            * config/i386/ia32intrin.h (__rdtsc): Defined as macro.
            (__rdtscp): Likewise.

    gcc/testsuite/

            PR target/99744
            * gcc.target/i386/pr99744-1.c: New test.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2021-03-30 13:29 ` cvs-commit at gcc dot gnu.org
@ 2021-04-10 13:00 ` cvs-commit at gcc dot gnu.org
  2021-04-27 11:40 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-10 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:71958f740f1b8c47a86ea222418abee395d254a0

commit r11-8109-g71958f740f1b8c47a86ea222418abee395d254a0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Apr 9 11:44:32 2021 -0700

    x86: Define _serialize as macro

    Define _serialize as macro for callers with general-regs-only target
    attribute to avoid inline failure with always_inline attribute.

    gcc/

            PR target/99744
            * config/i386/serializeintrin.h (_serialize): Defined as macro.

    gcc/testsuite/

            PR target/99744
            * gcc.target/i386/pr99744-2.c: New test.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (8 preceding siblings ...)
  2021-04-10 13:00 ` cvs-commit at gcc dot gnu.org
@ 2021-04-27 11:40 ` jakub at gcc dot gnu.org
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.0                        |11.2

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (9 preceding siblings ...)
  2021-04-27 11:40 ` jakub at gcc dot gnu.org
@ 2021-07-28  7:06 ` rguenth at gcc dot gnu.org
  2021-08-05 13:27 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (10 preceding siblings ...)
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
@ 2021-08-05 13:27 ` cvs-commit at gcc dot gnu.org
  2021-08-06  1:45 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-05 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:72264a639729a5dcc21dbee304717ce22b338bfd

commit r12-2765-g72264a639729a5dcc21dbee304717ce22b338bfd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Jul 17 07:44:45 2021 -0700

    <x86gprintrin.h>: Add pragma GCC target("general-regs-only")

    1. Intrinsics in <x86gprintrin.h> only require GPR ISAs.  Add

     #if defined __MMX__ || defined __SSE__
     #pragma GCC push_options
     #pragma GCC target("general-regs-only")
     #define __DISABLE_GENERAL_REGS_ONLY__
     #endif

    and

     #ifdef __DISABLE_GENERAL_REGS_ONLY__
     #undef __DISABLE_GENERAL_REGS_ONLY__
     #pragma GCC pop_options
     #endif /* __DISABLE_GENERAL_REGS_ONLY__ */

    to <x86gprintrin.h> to disable non-GPR ISAs so that they can be used in
    functions with __attribute__ ((target("general-regs-only"))).
    2. When checking always_inline attribute, if callee only uses GPRs,
    ignore MASK_80387 since enable MASK_80387 in caller has no impact on
    callee inline.

    gcc/

            PR target/99744
            * config/i386/i386.c (ix86_can_inline_p): Ignore MASK_80387 if
            callee only uses GPRs.
            * config/i386/ia32intrin.h: Revert commit 5463cee2770.
            * config/i386/serializeintrin.h: Revert commit 71958f740f1.
            * config/i386/x86gprintrin.h: Add
            #pragma GCC target("general-regs-only") and #pragma GCC pop_options
            to disable non-GPR ISAs.

    gcc/testsuite/

            PR target/99744
            * gcc.target/i386/pr99744-3.c: New test.
            * gcc.target/i386/pr99744-4.c: Likewise.
            * gcc.target/i386/pr99744-5.c: Likewise.
            * gcc.target/i386/pr99744-6.c: Likewise.
            * gcc.target/i386/pr99744-7.c: Likewise.
            * gcc.target/i386/pr99744-8.c: Likewise.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (11 preceding siblings ...)
  2021-08-05 13:27 ` cvs-commit at gcc dot gnu.org
@ 2021-08-06  1:45 ` hjl.tools at gmail dot com
  2021-08-25 12:58 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-06  1:45 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |heinzisoft at web dot de

--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> ---
*** Bug 100438 has been marked as a duplicate of this bug. ***

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (12 preceding siblings ...)
  2021-08-06  1:45 ` hjl.tools at gmail dot com
@ 2021-08-25 12:58 ` cvs-commit at gcc dot gnu.org
  2021-08-25 13:06 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-25 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:918332d17c8bf0e547c847356db0817ac9f0047f

commit r11-8929-g918332d17c8bf0e547c847356db0817ac9f0047f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Jul 17 07:44:45 2021 -0700

    <x86gprintrin.h>: Add pragma GCC target("general-regs-only")

    1. Intrinsics in <x86gprintrin.h> only require GPR ISAs.  Add

     #if defined __MMX__ || defined __SSE__
     #pragma GCC push_options
     #pragma GCC target("general-regs-only")
     #define __DISABLE_GENERAL_REGS_ONLY__
     #endif

    and

     #ifdef __DISABLE_GENERAL_REGS_ONLY__
     #undef __DISABLE_GENERAL_REGS_ONLY__
     #pragma GCC pop_options
     #endif /* __DISABLE_GENERAL_REGS_ONLY__ */

    to <x86gprintrin.h> to disable non-GPR ISAs so that they can be used in
    functions with __attribute__ ((target("general-regs-only"))).
    2. When checking always_inline attribute, if callee only uses GPRs,
    ignore MASK_80387 since enable MASK_80387 in caller has no impact on
    callee inline.

    gcc/

            PR target/99744
            * config/i386/i386.c (ix86_can_inline_p): Ignore MASK_80387 if
            callee only uses GPRs.
            * config/i386/ia32intrin.h: Revert commit 5463cee2770.
            * config/i386/serializeintrin.h: Revert commit 71958f740f1.
            * config/i386/x86gprintrin.h: Add
            #pragma GCC target("general-regs-only") and #pragma GCC pop_options
            to disable non-GPR ISAs.

    gcc/testsuite/

            PR target/99744
            * gcc.target/i386/pr99744-3.c: New test.
            * gcc.target/i386/pr99744-4.c: Likewise.
            * gcc.target/i386/pr99744-5.c: Likewise.
            * gcc.target/i386/pr99744-6.c: Likewise.
            * gcc.target/i386/pr99744-7.c: Likewise.
            * gcc.target/i386/pr99744-8.c: Likewise.

    (cherry picked from commit 72264a639729a5dcc21dbee304717ce22b338bfd)

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (13 preceding siblings ...)
  2021-08-25 12:58 ` cvs-commit at gcc dot gnu.org
@ 2021-08-25 13:06 ` hjl.tools at gmail dot com
  2022-03-15 10:56 ` poulhies at adacore dot com
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-25 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #15 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11.3 and GCC 12.

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (14 preceding siblings ...)
  2021-08-25 13:06 ` hjl.tools at gmail dot com
@ 2022-03-15 10:56 ` poulhies at adacore dot com
  2022-03-15 14:25 ` hjl.tools at gmail dot com
  2022-03-15 14:32 ` poulhies at adacore dot com
  17 siblings, 0 replies; 19+ messages in thread
From: poulhies at adacore dot com @ 2022-03-15 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Poulhiès <poulhies at adacore dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |poulhies at adacore dot com

--- Comment #16 from Marc Poulhiès <poulhies at adacore dot com> ---
Hi!
I'm seeing regressions in pr99744-{1,2,4,5}.c for an i586 target where MMX/SSE
are not enabled.

IIUC, your patch inserts "general-regs-only" in x86gprintrin.h if MMX or SSE is
enabled and makes the inlining of the calls in theses tests (using
target("general-regs-only")) be compatible with the intrinsics defined in the
header.

In my case, MMX/SSE being both disabled, the calls can't be inlined (mismatch
of target options).

Would that still be correct to change the

     #if defined __MMX__ || defined __SSE__

by

     #if defined __i686__

?

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (15 preceding siblings ...)
  2022-03-15 10:56 ` poulhies at adacore dot com
@ 2022-03-15 14:25 ` hjl.tools at gmail dot com
  2022-03-15 14:32 ` poulhies at adacore dot com
  17 siblings, 0 replies; 19+ messages in thread
From: hjl.tools at gmail dot com @ 2022-03-15 14:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Marc Poulhiès from comment #16)
> Hi!
> I'm seeing regressions in pr99744-{1,2,4,5}.c for an i586 target where
> MMX/SSE are not enabled.

Please try

https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591716.html

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

* [Bug target/99744] __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics
  2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
                   ` (16 preceding siblings ...)
  2022-03-15 14:25 ` hjl.tools at gmail dot com
@ 2022-03-15 14:32 ` poulhies at adacore dot com
  17 siblings, 0 replies; 19+ messages in thread
From: poulhies at adacore dot com @ 2022-03-15 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Marc Poulhiès <poulhies at adacore dot com> ---
Solved our regressions in  pr99744-{1,2,4,5}.c, thanks!

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

end of thread, other threads:[~2022-03-15 14:32 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24  2:58 [Bug target/99744] New: __attribute__ ((target("general-regs-only"))) doesn't work with GPR intrinsics hjl.tools at gmail dot com
2021-03-24  9:16 ` [Bug target/99744] " rguenth at gcc dot gnu.org
2021-03-24  9:47 ` crazylht at gmail dot com
2021-03-24 11:15 ` jakub at gcc dot gnu.org
2021-03-24 17:58 ` hjl.tools at gmail dot com
2021-03-25 12:37 ` cvs-commit at gcc dot gnu.org
2021-03-25 12:43 ` hjl.tools at gmail dot com
2021-03-25 14:00 ` hjl.tools at gmail dot com
2021-03-30 13:29 ` cvs-commit at gcc dot gnu.org
2021-04-10 13:00 ` cvs-commit at gcc dot gnu.org
2021-04-27 11:40 ` jakub at gcc dot gnu.org
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-08-05 13:27 ` cvs-commit at gcc dot gnu.org
2021-08-06  1:45 ` hjl.tools at gmail dot com
2021-08-25 12:58 ` cvs-commit at gcc dot gnu.org
2021-08-25 13:06 ` hjl.tools at gmail dot com
2022-03-15 10:56 ` poulhies at adacore dot com
2022-03-15 14:25 ` hjl.tools at gmail dot com
2022-03-15 14:32 ` poulhies at adacore dot com

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