public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX @ 2012-03-12 19:00 marc.glisse at normalesup dot org 2012-03-13 8:36 ` [Bug target/52568] " jakub at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: marc.glisse at normalesup dot org @ 2012-03-12 19:00 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52568 Bug #: 52568 Summary: suboptimal __builtin_shuffle on cycles with AVX Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: marc.glisse@normalesup.org Hello, I compiled the following with -O3 (or -Os) and -mavx #include <x86intrin.h> __m256d left(__m256d x){ __m256i mask={1,2,3,0}; return __builtin_shuffle(x,mask); } (by the way, for some reason, gcc insists that 'mask' is set but not used with -Wall) and got: vunpckhpd %xmm0, %xmm0, %xmm3 vmovapd %xmm0, %xmm1 vextractf128 $0x1, %ymm0, %xmm0 vmovaps %xmm0, %xmm2 vunpckhpd %xmm0, %xmm0, %xmm0 vunpcklpd %xmm1, %xmm0, %xmm1 vunpcklpd %xmm2, %xmm3, %xmm0 vinsertf128 $0x1, %xmm1, %ymm0, %ymm0 ret That doesn't really match the code I currently use to do this: #ifdef __AVX2__ __m256d d=_mm256_permute4x64_pd(x,1+2*4+3*16+0*64); #else __m256d b=_mm256_shuffle_pd(x,x,5); __m256d c=_mm256_permute2f128_pd(b,b,1); __m256d d=_mm256_blend_pd(b,c,10); #endif Could something recognizing this permutation pattern (and the right cyclic shift) be added? I know there are too many shuffles to hand-code them all, but cycles seem like they shouldn't be too uncommon. With -mavx2, I get a single vpermq, which is close enough to the expected vpermpd. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/52568] suboptimal __builtin_shuffle on cycles with AVX 2012-03-12 19:00 [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX marc.glisse at normalesup dot org @ 2012-03-13 8:36 ` jakub at gcc dot gnu.org 2012-03-13 8:44 ` rguenth at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2012-03-13 8:36 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52568 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 08:36:29 UTC --- -Wunused-but-set-* warning false positive tracked in PR52577. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/52568] suboptimal __builtin_shuffle on cycles with AVX 2012-03-12 19:00 [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX marc.glisse at normalesup dot org 2012-03-13 8:36 ` [Bug target/52568] " jakub at gcc dot gnu.org @ 2012-03-13 8:44 ` rguenth at gcc dot gnu.org 2012-03-15 23:47 ` jakub at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2012-03-13 8:44 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52568 Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Target| |x86_64-*-* Status|UNCONFIRMED |NEW Last reconfirmed| |2012-03-13 Ever Confirmed|0 |1 --- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-13 08:44:06 UTC --- Confirmed. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/52568] suboptimal __builtin_shuffle on cycles with AVX 2012-03-12 19:00 [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX marc.glisse at normalesup dot org 2012-03-13 8:36 ` [Bug target/52568] " jakub at gcc dot gnu.org 2012-03-13 8:44 ` rguenth at gcc dot gnu.org @ 2012-03-15 23:47 ` jakub at gcc dot gnu.org 2012-03-15 23:54 ` jakub at gcc dot gnu.org 2012-03-16 8:28 ` jakub at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2012-03-15 23:47 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52568 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 23:45:49 UTC --- Author: jakub Date: Thu Mar 15 23:45:45 2012 New Revision: 185446 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185446 Log: PR target/52568 * config/i386/sse.md (UNSPEC_VPERMDF): Remove. (avx2_permv4df): Remove. (avx2_permv4di): Macroize into... (avx2_perm<mode>): ... this using VI8F_256 iterator. (avx2_permv4di_1): Macroize into... (avx2_perm<mode>_1): ... this using VI8F_256 iterator. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/sse.md ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/52568] suboptimal __builtin_shuffle on cycles with AVX 2012-03-12 19:00 [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX marc.glisse at normalesup dot org ` (2 preceding siblings ...) 2012-03-15 23:47 ` jakub at gcc dot gnu.org @ 2012-03-15 23:54 ` jakub at gcc dot gnu.org 2012-03-16 8:28 ` jakub at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2012-03-15 23:54 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52568 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 23:46:37 UTC --- Author: jakub Date: Thu Mar 15 23:46:34 2012 New Revision: 185447 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185447 Log: PR target/52568 * config/i386/i386.c (expand_vec_perm_vperm2f128_vblend): New function. (ix86_expand_vec_perm_const_1): Use it. * gcc.dg/torture/vshuf-4.inc: Add two new tests. * gcc.dg/torture/vshuf-8.inc: Likewise. * gcc.dg/torture/vshuf-16.inc: Likewise. * gcc.dg/torture/vshuf-32.inc: Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/torture/vshuf-16.inc trunk/gcc/testsuite/gcc.dg/torture/vshuf-32.inc trunk/gcc/testsuite/gcc.dg/torture/vshuf-4.inc trunk/gcc/testsuite/gcc.dg/torture/vshuf-8.inc ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/52568] suboptimal __builtin_shuffle on cycles with AVX 2012-03-12 19:00 [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX marc.glisse at normalesup dot org ` (3 preceding siblings ...) 2012-03-15 23:54 ` jakub at gcc dot gnu.org @ 2012-03-16 8:28 ` jakub at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2012-03-16 8:28 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52568 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-16 07:40:13 UTC --- Should be fixed on the trunk. For -mavx2 we now generate vpermpd, for -mavx vpermilpd + vperm2f128 + vblendpd. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-16 7:40 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-03-12 19:00 [Bug target/52568] New: suboptimal __builtin_shuffle on cycles with AVX marc.glisse at normalesup dot org 2012-03-13 8:36 ` [Bug target/52568] " jakub at gcc dot gnu.org 2012-03-13 8:44 ` rguenth at gcc dot gnu.org 2012-03-15 23:47 ` jakub at gcc dot gnu.org 2012-03-15 23:54 ` jakub at gcc dot gnu.org 2012-03-16 8:28 ` 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).