public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/46943] New: Unnecessary ZERO_EXTEND
@ 2010-12-14 17:34 jakub at gcc dot gnu.org
2010-12-16 15:10 ` [Bug rtl-optimization/46943] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-14 17:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46943
Summary: Unnecessary ZERO_EXTEND
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
Target: x86_64-linux
In http://blog.regehr.org/archives/320 Example 4
unsigned long long v;
unsigned short
foo (signed char x, unsigned short y)
{
v = (unsigned long long) y;
return (unsigned short) ((int) y / 3);
}
we emit a redundant zero-extension:
movzwl %si, %eax
movq %rax, v(%rip)
movzwl %si, %eax
imull $43691, %eax, %eax
shrl $17, %eax
ret
The reason why the second movzwl %si, %eax wasn't CSEd with the first one is
because the first one is (set (reg:DI reg1) (zero_extend:DI (reg:HI reg2))
while the second one is (set (reg:SI reg3) (zero_extend:SI (reg:HI reg2))
Wonder if we can't teach CSE to optimize it (say that reg3 is actually
(subreg:SI (reg:DI reg1) 0), or if e.g. one of the zee/see passes (implicit-zee
e.g.) couldn't handle such cases. Combiner can't do anything here, as there is
no data dependency, so try_combine won't see them together.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/46943] Unnecessary ZERO_EXTEND
2010-12-14 17:34 [Bug ada/46943] New: Unnecessary ZERO_EXTEND jakub at gcc dot gnu.org
@ 2010-12-16 15:10 ` rguenth at gcc dot gnu.org
2012-02-02 8:52 ` pinskia at gcc dot gnu.org
2023-05-20 1:57 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-16 15:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46943
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-16 15:10:12 UTC ---
Hmm. I think at least postreload CSE should handle it as we then know that
zero-extends extend to the full HW register. Pre-regalloc would be difficult
as we'd need some new form of canonicalization with an associated cost
(think of a zero_extend:TI).
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/46943] Unnecessary ZERO_EXTEND
2010-12-14 17:34 [Bug ada/46943] New: Unnecessary ZERO_EXTEND jakub at gcc dot gnu.org
2010-12-16 15:10 ` [Bug rtl-optimization/46943] " rguenth at gcc dot gnu.org
@ 2012-02-02 8:52 ` pinskia at gcc dot gnu.org
2023-05-20 1:57 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-02 8:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46943
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-02
Ever Confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-02 08:51:50 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/46943] Unnecessary ZERO_EXTEND
2010-12-14 17:34 [Bug ada/46943] New: Unnecessary ZERO_EXTEND jakub at gcc dot gnu.org
2010-12-16 15:10 ` [Bug rtl-optimization/46943] " rguenth at gcc dot gnu.org
2012-02-02 8:52 ` pinskia at gcc dot gnu.org
@ 2023-05-20 1:57 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-20 1:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46943
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2018-04-22 00:00:00 |2023-5-19
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-20 1:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-14 17:34 [Bug ada/46943] New: Unnecessary ZERO_EXTEND jakub at gcc dot gnu.org
2010-12-16 15:10 ` [Bug rtl-optimization/46943] " rguenth at gcc dot gnu.org
2012-02-02 8:52 ` pinskia at gcc dot gnu.org
2023-05-20 1:57 ` pinskia 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).