public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/101127] New: d: Compile-time reflection for supported built-ins
@ 2021-06-18 15:51 ibuclaw at gdcproject dot org
2021-06-18 17:41 ` [Bug d/101127] " ibuclaw at gdcproject dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-06-18 15:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
Bug ID: 101127
Summary: d: Compile-time reflection for supported built-ins
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
With the 11 release, compile-time reflection support was added for vector
types, but this does not extend to built-ins that use them.
e.g:
---
// This prints "Yes" with -mavx because vector(float[8]) also becomes
available.
static if (__traits(compiles, __builtin_ia32_andps256 ))
pragma(msg, "Yes AVX support");
else
pragma(msg, "No AVX support");
// Always prints "Yes", because vector(short[8]) is available from -msse
static if (__traits(compiles, __builtin_ia32_pmulhrsw128))
pragma(msg, "Yes SSSE3 support");
else
pragma(msg, "No SSSE3 support");
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug d/101127] d: Compile-time reflection for supported built-ins
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
@ 2021-06-18 17:41 ` ibuclaw at gdcproject dot org
2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-06-18 17:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
There's the language hook LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE, which seems to
do what we want on the surface, but then there's a question over whether this
is to be correct.
---
// static condition is false
static if (__traits(compiles, __builtin_ia32_pmulhrsw128))
pragma(msg, "Yes SSSE3 support");
else
{
short8 truc(short8 a, short8 b) @target("ssse3") // adds SSSE3 built-ins.
{
return __builtin_ia32_pmulhrsw128(a, b);
}
}
// static condition could be true, depending on order of evaluation.
static if (__traits(compiles, __builtin_ia32_pmaddubsw128))
pragma(msg, "Yes SSSE3 support");
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug d/101127] d: Compile-time reflection for supported built-ins
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
2021-06-18 17:41 ` [Bug d/101127] " ibuclaw at gdcproject dot org
@ 2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:b2f6e1de242fff5713763cd3146dcf3f9dee51ca
commit r12-2562-gb2f6e1de242fff5713763cd3146dcf3f9dee51ca
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Sun Jul 25 23:19:36 2021 +0200
d: Compile-time reflection for supported built-ins (PR101127)
In order to allow user-code to determine whether a back-end builtin is
available without error, LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE has been
defined to delay putting back-end builtin functions until the ISA that
defines them has been declared.
However in D, there is no global namespace. All builtins get pushed
into the `gcc.builtins' module, which is constructed during the semantic
analysis pass, which has already finished by the time target attributes
are evaluated. So builtins are not pushed by the new langhook because
they would be ultimately ignored. Builtins exposed to D code then can
now only be altered by the command-line.
PR d/101127
gcc/d/ChangeLog:
* d-builtins.cc (d_builtin_function_ext_scope): New function.
* d-lang.cc (LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE): Define.
* d-tree.h (d_builtin_function_ext_scope): Declare.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101127a.d: New test.
* gdc.dg/pr101127b.d: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug d/101127] d: Compile-time reflection for supported built-ins
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
2021-06-18 17:41 ` [Bug d/101127] " ibuclaw at gdcproject dot org
2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:89f0f83cdd1192f682f849e289b6188f9dbff961
commit r11-8807-g89f0f83cdd1192f682f849e289b6188f9dbff961
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Sun Jul 25 23:19:36 2021 +0200
d: Compile-time reflection for supported built-ins (PR101127)
In order to allow user-code to determine whether a back-end builtin is
available without error, LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE has been
defined to delay putting back-end builtin functions until the ISA that
defines them has been declared.
However in D, there is no global namespace. All builtins get pushed
into the `gcc.builtins' module, which is constructed during the semantic
analysis pass, which has already finished by the time target attributes
are evaluated. So builtins are not pushed by the new langhook because
they would be ultimately ignored. Builtins exposed to D code then can
now only be altered by the command-line.
PR d/101127
gcc/d/ChangeLog:
* d-builtins.cc (d_builtin_function_ext_scope): New function.
* d-lang.cc (LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE): Define.
* d-tree.h (d_builtin_function_ext_scope): Declare.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101127a.d: New test.
* gdc.dg/pr101127b.d: New test.
(cherry picked from commit b2f6e1de242fff5713763cd3146dcf3f9dee51ca)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug d/101127] d: Compile-time reflection for supported built-ins
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
` (2 preceding siblings ...)
2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
2021-07-28 12:47 ` ibuclaw at gdcproject dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:4ae456dc2fcc5f12caa8abb5e5781839e2a0c7f7
commit r10-10005-g4ae456dc2fcc5f12caa8abb5e5781839e2a0c7f7
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Sun Jul 25 23:19:36 2021 +0200
d: Compile-time reflection for supported built-ins (PR101127)
In order to allow user-code to determine whether a back-end builtin is
available without error, LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE has been
defined to delay putting back-end builtin functions until the ISA that
defines them has been declared.
However in D, there is no global namespace. All builtins get pushed
into the `gcc.builtins' module, which is constructed during the semantic
analysis pass, which has already finished by the time target attributes
are evaluated. So builtins are not pushed by the new langhook because
they would be ultimately ignored. Builtins exposed to D code then can
now only be altered by the command-line.
PR d/101127
gcc/d/ChangeLog:
* d-builtins.cc (d_builtin_function_ext_scope): New function.
* d-lang.cc (LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE): Define.
* d-tree.h (d_builtin_function_ext_scope): Declare.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101127a.d: New test.
* gdc.dg/pr101127b.d: New test.
(cherry picked from commit b2f6e1de242fff5713763cd3146dcf3f9dee51ca)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug d/101127] d: Compile-time reflection for supported built-ins
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
` (3 preceding siblings ...)
2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
2021-07-28 12:47 ` ibuclaw at gdcproject dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 11:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:58cae53cb1cf8971a9c9611680f373a43e7547b7
commit r9-9648-g58cae53cb1cf8971a9c9611680f373a43e7547b7
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Sun Jul 25 23:19:36 2021 +0200
d: Compile-time reflection for supported built-ins (PR101127)
In order to allow user-code to determine whether a back-end builtin is
available without error, LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE has been
defined to delay putting back-end builtin functions until the ISA that
defines them has been declared.
However in D, there is no global namespace. All builtins get pushed
into the `gcc.builtins' module, which is constructed during the semantic
analysis pass, which has already finished by the time target attributes
are evaluated. So builtins are not pushed by the new langhook because
they would be ultimately ignored. Builtins exposed to D code then can
now only be altered by the command-line.
PR d/101127
gcc/d/ChangeLog:
* d-builtins.cc (d_builtin_function_ext_scope): New function.
* d-lang.cc (LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE): Define.
* d-tree.h (d_builtin_function_ext_scope): Declare.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101127a.d: New test.
* gdc.dg/pr101127b.d: New test.
(cherry picked from commit b2f6e1de242fff5713763cd3146dcf3f9dee51ca)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug d/101127] d: Compile-time reflection for supported built-ins
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
` (4 preceding siblings ...)
2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 12:47 ` ibuclaw at gdcproject dot org
5 siblings, 0 replies; 7+ messages in thread
From: ibuclaw at gdcproject dot org @ 2021-07-28 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101127
Iain Buclaw <ibuclaw at gdcproject dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Fix committed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-07-28 12:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 15:51 [Bug d/101127] New: d: Compile-time reflection for supported built-ins ibuclaw at gdcproject dot org
2021-06-18 17:41 ` [Bug d/101127] " ibuclaw at gdcproject dot org
2021-07-28 11:18 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:36 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:50 ` cvs-commit at gcc dot gnu.org
2021-07-28 11:57 ` cvs-commit at gcc dot gnu.org
2021-07-28 12:47 ` ibuclaw at gdcproject dot 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).