public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/53101] New: Recognize casts to sub-vectors
@ 2012-04-24 10:18 marc.glisse at normalesup dot org
  2012-04-24 11:14 ` [Bug target/53101] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marc.glisse at normalesup dot org @ 2012-04-24 10:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53101

             Bug #: 53101
           Summary: Recognize casts to sub-vectors
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marc.glisse@normalesup.org
            Target: x86_64-linux-gnu


Hello,

starting from an AVX __m256d vector x, getting its first element is best done
with *(double*)&x, which is what x[0] internally does, and which generates no
instruction (well, the following has vzeroupper, but let's forget that).
However, *(__m128d*)&x generates 2 movs and I have to explicitly use
_mm256_extractf128_pd to get the proper nop. Could the compiler be taught to
recognize the casts between pointers to vectors of the same object type the
same way it recognizes casts to pointers to that object type?

#include <x86intrin.h>
#if 0
typedef double T;
#else
typedef __m128d T;
#endif
T f(__m256d x){
  return *(T*)&x;
}

The closest report I found is PR 44551, which is quite different. PR 29881
shows that using a union is not an interesting alternative. I marked this one
as target, but it may very well be that the recognition should be in the
middle-end, or even that the front-end should mark the cast somehow.


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

end of thread, other threads:[~2021-08-19 19:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 10:18 [Bug target/53101] New: Recognize casts to sub-vectors marc.glisse at normalesup dot org
2012-04-24 11:14 ` [Bug target/53101] " rguenth at gcc dot gnu.org
2012-05-01 15:10 ` marc.glisse at normalesup dot org
2012-05-01 17:18 ` marc.glisse at normalesup dot org
2012-05-03 19:20 ` marc.glisse at normalesup dot org
2012-05-06 20:31 ` glisse at gcc dot gnu.org
2012-11-11 22:18 ` glisse at gcc dot gnu.org
2012-11-16 23:04 ` glisse at gcc dot gnu.org
2021-08-19 19:49 ` pinskia 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).