public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
@ 2015-06-01 21:53 marcus.kool at urlfilterdb dot com
  2015-06-01 21:57 ` [Bug c/66369] " marcus.kool at urlfilterdb dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: marcus.kool at urlfilterdb dot com @ 2015-06-01 21:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66369

            Bug ID: 66369
           Summary: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcus.kool at urlfilterdb dot com
  Target Milestone: ---

Created attachment 35672
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35672&action=edit
example C code to demonstrate the missed optimisation in gcc 4.8.3 and 5.1.0

When using _mm256_movemask_epi8() I cannot find a way for gcc to produce
   vpmovmskb YMM,R64
instead of 
   vpmovmskb YMM,R32

When the result of the vpmovmskb is not stored in R64, unnecessary
sign-extension instructions cltq, movl or movslq are generated later.  With a
result in R32 and indexing an array of structs, gcc generates for 
   node = node->children[ __builtin_ctzl(result-of-vpmovmskb) ]
the following:
   vpmovmskb YMM,R32
   movslq    R32, R64
   tzcntq    R64, R64
   movq      offset(%rdi,R64,8), %rdi
instead of the more efficient:
   vpmovmskb YMM,R64
   tzcntq    R64,R64
   movq      offset(%rdi,R64,8), %rdi

Attached is avx2.c which has the C source code that demonstrates the above.
aavx2.c is compiled with gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9) and flags
   -std=c99 -march=core-avx2  -mtune=core-avx2 -O3
gcc 5.1.0 has the same behaviour.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-06-04 17:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
2015-06-01 21:57 ` [Bug c/66369] " marcus.kool at urlfilterdb dot com
2015-06-02  9:05 ` [Bug target/66369] " rguenth at gcc dot gnu.org
2015-06-02 10:21 ` ubizjak at gmail dot com
2015-06-02 11:21 ` marcus.kool at urlfilterdb dot com
2015-06-02 14:51 ` marcus.kool at urlfilterdb dot com
2015-06-03 18:00 ` ubizjak at gmail dot com
2015-06-04 10:06 ` uros at gcc dot gnu.org
2015-06-04 10:11 ` ubizjak at gmail dot com
2015-06-04 17:50 ` marcus.kool at urlfilterdb dot com

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).