public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz
@ 2020-06-04 14:58 gabravier at gmail dot com
2020-06-04 16:36 ` [Bug target/95535] " jakub at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: gabravier at gmail dot com @ 2020-06-04 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95535
Bug ID: 95535
Summary: Failure to optimize out cdqe after __bultin_ctz
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
long long f(int n)
{
return __builtin_ctz(n);
}
With -O3, GCC outputs this :
f(int):
xor eax, eax
tzcnt eax, edi
cdqe
ret
LLVM outputs this :
f(int): # @f(int)
tzcnt eax, edi
ret
Looks like the cdqe can be omitted.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/95535] Failure to optimize out cdqe after __bultin_ctz
2020-06-04 14:58 [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz gabravier at gmail dot com
@ 2020-06-04 16:36 ` jakub at gcc dot gnu.org
2020-06-04 17:08 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-04 16:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95535
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-04
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
CC| |jakub at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I've done this for popcount in January, so need to do the same for tzcntl and
lzcntl.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/95535] Failure to optimize out cdqe after __bultin_ctz
2020-06-04 14:58 [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz gabravier at gmail dot com
2020-06-04 16:36 ` [Bug target/95535] " jakub at gcc dot gnu.org
@ 2020-06-04 17:08 ` jakub at gcc dot gnu.org
2020-06-05 8:45 ` cvs-commit at gcc dot gnu.org
2020-09-04 9:08 ` gabravier at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-04 17:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95535
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48676
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48676&action=edit
gcc11-pr95535.patch
Untested version of the PR91824 popcnt fix.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/95535] Failure to optimize out cdqe after __bultin_ctz
2020-06-04 14:58 [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz gabravier at gmail dot com
2020-06-04 16:36 ` [Bug target/95535] " jakub at gcc dot gnu.org
2020-06-04 17:08 ` jakub at gcc dot gnu.org
@ 2020-06-05 8:45 ` cvs-commit at gcc dot gnu.org
2020-09-04 9:08 ` gabravier at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-05 8:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95535
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:892b51cb73f24157391cd18c2215e8d703af97e7
commit r11-965-g892b51cb73f24157391cd18c2215e8d703af97e7
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Jun 5 10:44:23 2020 +0200
ix86: Improve __builtin_c[lt]z followed by extension [PR95535]
In January I've added patterns to optimize SImode -> DImode sign or zero
extension of __builtin_popcount, this patch does the same for
__builtin_c[lt]z. Like most other instructions, the [tl]zcntl instructions
clear the upper 32 bits of the destination register and as the instructions
only result in values 0 to 32 inclusive, both sign and zero extensions
behave the same.
2020-06-05 Jakub Jelinek <jakub@redhat.com>
PR target/95535
* config/i386/i386.md (*ctzsi2_zext, *clzsi2_lzcnt_zext): New
define_insn_and_split patterns.
(*ctzsi2_zext_falsedep, *clzsi2_lzcnt_zext_falsedep): New
define_insn patterns.
* gcc.target/i386/pr95535-1.c: New test.
* gcc.target/i386/pr95535-2.c: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/95535] Failure to optimize out cdqe after __bultin_ctz
2020-06-04 14:58 [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz gabravier at gmail dot com
` (2 preceding siblings ...)
2020-06-05 8:45 ` cvs-commit at gcc dot gnu.org
@ 2020-09-04 9:08 ` gabravier at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: gabravier at gmail dot com @ 2020-09-04 9:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95535
Gabriel Ravier <gabravier at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Gabriel Ravier <gabravier at gmail dot com> ---
Looks like this is fixed but not marked as such, so I'll make it so.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-04 9:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 14:58 [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz gabravier at gmail dot com
2020-06-04 16:36 ` [Bug target/95535] " jakub at gcc dot gnu.org
2020-06-04 17:08 ` jakub at gcc dot gnu.org
2020-06-05 8:45 ` cvs-commit at gcc dot gnu.org
2020-09-04 9:08 ` gabravier 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).