public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kretz at kde dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/47754] New: [missed optimization] AVX allows unaligned memory operands but GCC uses unaligned load and register operand Date: Tue, 15 Feb 2011 15:37:00 -0000 [thread overview] Message-ID: <bug-47754-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47754 Summary: [missed optimization] AVX allows unaligned memory operands but GCC uses unaligned load and register operand Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: kretz@kde.org According to the AVX docs: "With the exception of explicitly aligned 16 or 32 byte SIMD load/store instructions, most VEX-encoded, arithmetic and data processing instructions operate in a flexible environment regarding memory address alignment, i.e. VEX-encoded instruction with 32-byte or 16-byte load semantics will support unaligned load operation by default. Memory arguments for most instructions with VEX prefix operate normally without causing #GP(0) on any byte-granularity alignment (unlike Legacy SSE instructions)." I tested whether GCC would take advantage of this, and found that it doesn't: _mm256_store_ps(&data[3], _mm256_add_ps(_mm256_load_ps(&data[0]), _mm256_load_ps(&data[1])) ); compiles to: vmovaps 0x200b18(%rip),%ymm0 vaddps 0x200b13(%rip),%ymm0,%ymm0 vmovaps %ymm0,0x200b10(%rip) whereas _mm256_store_ps(&data[3], _mm256_add_ps(_mm256_loadu_ps(&data[0]), _mm256_loadu_ps(&data[1])) ); compiles to: vmovups 0x200b4c(%rip),%ymm0 vmovups 0x200b40(%rip),%ymm1 vaddps %ymm0,%ymm1,%ymm0 vmovaps %ymm0,0x200b3c(%rip) GCC could use a memory operand in the vaddps here instead. According to the AVX docs, this doesn't hurt performance. But it reduces register pressure AFAIU. Would be nice to have.
next reply other threads:[~2011-02-15 15:36 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-15 15:37 kretz at kde dot org [this message] 2011-02-15 16:22 ` [Bug target/47754] " rguenth at gcc dot gnu.org 2011-02-15 16:40 ` kretz at kde dot org 2011-02-15 16:51 ` kretz at kde dot org 2011-02-16 10:56 ` rguenth at gcc dot gnu.org 2012-02-22 13:54 ` xiaoyuanbo at yeah dot net
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-47754-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).