public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/46943] New: Unnecessary ZERO_EXTEND Date: Tue, 14 Dec 2010 17:34:00 -0000 [thread overview] Message-ID: <bug-46943-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2010-12-14 17:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-12-14 17:34 jakub at gcc dot gnu.org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-46943-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).