public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andrii.riabushenko at barclays dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53645] New: Missed optimization for division of vector types Date: Tue, 12 Jun 2012 12:45:00 -0000 [thread overview] Message-ID: <bug-53645-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53645 Bug #: 53645 Summary: Missed optimization for division of vector types Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: andrii.riabushenko@barclays.com for the following code v4si ttt(v4si x) { return x / (v4si) {3,3,3,3}; } GCC generates the following assembler ttt: movdqa (%rcx), %xmm0 movl $1431655766, %ecx movd %xmm0, %r8d pextrd $1, %xmm0, %r10d pextrd $2, %xmm0, %r11d movl %r8d, %eax sarl $31, %r8d imull %ecx movl %r10d, %eax sarl $31, %r10d movl %edx, %r9d imull %ecx movl %r11d, %eax subl %r8d, %r9d sarl $31, %r11d movl %edx, %r8d imull %ecx subl %r10d, %r8d movl %edx, %r10d subl %r11d, %r10d pextrd $3, %xmm0, %r11d movl %r11d, %eax imull %ecx sarl $31, %r11d movd %r10d, %xmm1 movd %r9d, %xmm0 pinsrd $0x1, %r8d, %xmm0 subl %r11d, %edx pinsrd $0x1, %edx, %xmm1 punpcklqdq %xmm1, %xmm0 ret Thus gcc DOES optimize the division to be done through High Multiplication, but it is applied to each value separately instead of vectorized ones. Assember should look like movdqa .LC190(%rip), %xmm0 pmulld (%rcx), %xmm0 pslld $31, %xmm0 ret
next reply other threads:[~2012-06-12 12:45 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-06-12 12:45 andrii.riabushenko at barclays dot com [this message] 2012-06-12 13:34 ` [Bug c/53645] " rguenth at gcc dot gnu.org 2012-06-12 13:37 ` [Bug tree-optimization/53645] Missed optimization for vector integer division lowering rguenth at gcc dot gnu.org 2012-06-12 18:34 ` jakub at gcc dot gnu.org 2012-06-12 20:55 ` pinskia at gcc dot gnu.org 2012-06-13 9:46 ` rguenth at gcc dot gnu.org 2012-06-27 8:50 ` jakub at gcc dot gnu.org 2012-06-28 11:38 ` jakub at gcc dot gnu.org 2012-06-28 12:34 ` jakub at gcc dot gnu.org 2012-06-28 17:53 ` jakub at gcc dot gnu.org 2012-07-01 10:24 ` ubizjak at gmail dot com 2012-07-02 6:56 ` jakub at gcc dot gnu.org 2012-07-02 7:00 ` jakub 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-53645-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).