public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95861] New: popcnt --- unnecessary leading xor instruction
@ 2020-06-24 8:42 zero at smallinteger dot com
2020-06-24 8:55 ` [Bug target/95861] " jakub at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: zero at smallinteger dot com @ 2020-06-24 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95861
Bug ID: 95861
Summary: popcnt --- unnecessary leading xor instruction
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: zero at smallinteger dot com
Target Milestone: ---
Created attachment 48778
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48778&action=edit
sample code
Consider the attached code, compiled with -O3 -mpopcnt. The assembly produced
in gcc 9.3 is below (the same code is generated by gcc 10.x at godbolt).
foo(unsigned long long):
xor eax, eax
popcnt rax, rdi
ret
The popcnt instruction will overwrite rax. Whether eax is cleared with xor has
no effect. No xor instruction should be emitted in this case. For reference,
trunk clang emits this code instead:
foo(unsigned long long): # @foo(unsigned long
long)
popcnt rax, rdi
ret
This second code sample is as expected.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/95861] popcnt --- unnecessary leading xor instruction
2020-06-24 8:42 [Bug target/95861] New: popcnt --- unnecessary leading xor instruction zero at smallinteger dot com
@ 2020-06-24 8:55 ` jakub at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-24 8:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95861
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is very much intentional, please see PR62011 for the reason.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-24 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 8:42 [Bug target/95861] New: popcnt --- unnecessary leading xor instruction zero at smallinteger dot com
2020-06-24 8:55 ` [Bug target/95861] " jakub 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).