public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/100312] New: __builtin_ia32_maskloadpd256 and friends should be pure
@ 2021-04-28 8:59 rguenth at gcc dot gnu.org
2021-04-28 8:59 ` [Bug target/100312] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-28 8:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100312
Bug ID: 100312
Summary: __builtin_ia32_maskloadpd256 and friends should be
pure
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
The testcase in PR99912 shows that we fail to eliminate dead AVX2 masked loads
since the x86 specific builtins are not marked pure and thus are considered
to clobber their arguments and have other unwanted side-effects.
It looks like the "way" to change this is to remove the builtins from
i386-builtin.def and manually add them to ix86_init_mmx_sse_builtins like
the AVX2 gather builtins (which are properly constructed as pure).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/100312] __builtin_ia32_maskloadpd256 and friends should be pure
2021-04-28 8:59 [Bug target/100312] New: __builtin_ia32_maskloadpd256 and friends should be pure rguenth at gcc dot gnu.org
@ 2021-04-28 8:59 ` rguenth at gcc dot gnu.org
2021-04-28 10:08 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-28 8:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100312
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Last reconfirmed| |2021-04-28
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Target| |x86_64-*-* i?86-*-*
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Working on a patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/100312] __builtin_ia32_maskloadpd256 and friends should be pure
2021-04-28 8:59 [Bug target/100312] New: __builtin_ia32_maskloadpd256 and friends should be pure rguenth at gcc dot gnu.org
2021-04-28 8:59 ` [Bug target/100312] " rguenth at gcc dot gnu.org
@ 2021-04-28 10:08 ` rguenth at gcc dot gnu.org
2021-04-29 14:46 ` cvs-commit at gcc dot gnu.org
2021-04-29 15:08 ` ubizjak at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-28 10:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100312
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 50699
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50699&action=edit
not working patch
This one misses the RTL expansion part. I'm too lazy to writing duplicate code
to handle this. The following works but is a bit ugly. Meh, the builtins
stuff _is_ ugly (adding extra flags to bdesc would be nicer but a lot of
boiler-plate work and the question is whether all the rest is "nice enough"
or in need of serious overhaul anyway...)
diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index 128bd39816c..fa05cd6cf65 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -521,7 +521,17 @@ ix86_init_mmx_sse_builtins (void)
continue;
ftype = (enum ix86_builtin_func_type) d->flag;
- def_builtin (d->mask, d->mask2, d->name, ftype, d->code);
+ if (d->code == IX86_BUILTIN_MASKLOADPD
+ || d->code == IX86_BUILTIN_MASKLOADPS
+ || d->code == IX86_BUILTIN_MASKLOADPD256
+ || d->code == IX86_BUILTIN_MASKLOADPS256
+ || d->code == IX86_BUILTIN_MASKLOADD
+ || d->code == IX86_BUILTIN_MASKLOADQ
+ || d->code == IX86_BUILTIN_MASKLOADD256
+ || d->code == IX86_BUILTIN_MASKLOADQ256)
+ def_builtin_pure (d->mask, d->mask2, d->name, ftype, d->code);
+ else
+ def_builtin (d->mask, d->mask2, d->name, ftype, d->code);
}
BDESC_VERIFYS (IX86_BUILTIN__BDESC_SPECIAL_ARGS_LAST,
IX86_BUILTIN__BDESC_SPECIAL_ARGS_FIRST,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/100312] __builtin_ia32_maskloadpd256 and friends should be pure
2021-04-28 8:59 [Bug target/100312] New: __builtin_ia32_maskloadpd256 and friends should be pure rguenth at gcc dot gnu.org
2021-04-28 8:59 ` [Bug target/100312] " rguenth at gcc dot gnu.org
2021-04-28 10:08 ` rguenth at gcc dot gnu.org
@ 2021-04-29 14:46 ` cvs-commit at gcc dot gnu.org
2021-04-29 15:08 ` ubizjak at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-29 14:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100312
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:
https://gcc.gnu.org/g:fd5d57946036c967dae292330fa0aa856a58fb4b
commit r12-290-gfd5d57946036c967dae292330fa0aa856a58fb4b
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Thu Apr 29 16:43:33 2021 +0200
i386: Mark x86 masked load builtins pure [PR100312]
Mark x86 AVX and AVX2 masked load builtins pure to enable dead code
elimination and more appropriate alias analysis.
2021-04-29 Uroš Bizjak <ubizjak@gmail.com>
Richard Biener <rguenther@suse.de>
gcc/
PR target/100312
* config/i386/i386-builtin.def (IX86_BUILTIN_MASKLOADPD)
(IX86_BUILTIN_MASKLOADPS, IX86_BUILTIN_MASKLOADPD256)
(IX86_BUILTIN_MASKLOADPS256, IX86_BUILTIN_MASKLOADD)
(IX86_BUILTIN_MASKLOADQ, IX86_BUILTIN_MASKLOADD256)
(IX86_BUILTIN_MASKLOADQ256): Move from SPECIAL_ARGS
to PURE_ARGS category.
* config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins):
Handle PURE_ARGS category.
* config/i386/i386-expand.c (ix86_expand_builtin): Ditto.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/100312] __builtin_ia32_maskloadpd256 and friends should be pure
2021-04-28 8:59 [Bug target/100312] New: __builtin_ia32_maskloadpd256 and friends should be pure rguenth at gcc dot gnu.org
` (2 preceding siblings ...)
2021-04-29 14:46 ` cvs-commit at gcc dot gnu.org
@ 2021-04-29 15:08 ` ubizjak at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2021-04-29 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100312
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|rguenth at gcc dot gnu.org |ubizjak at gmail dot com
Target|x86_64-*-* i?86-*-* |x86
Target Milestone|--- |12.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-29 15:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 8:59 [Bug target/100312] New: __builtin_ia32_maskloadpd256 and friends should be pure rguenth at gcc dot gnu.org
2021-04-28 8:59 ` [Bug target/100312] " rguenth at gcc dot gnu.org
2021-04-28 10:08 ` rguenth at gcc dot gnu.org
2021-04-29 14:46 ` cvs-commit at gcc dot gnu.org
2021-04-29 15:08 ` ubizjak at gmail 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).