public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/28367]  New: accessing via union on a vector does not cause vec_extract to be used
@ 2006-07-13  2:43 pinskia at gcc dot gnu dot org
  2006-07-13  5:37 ` [Bug middle-end/28367] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-13  2:43 UTC (permalink / raw)
  To: gcc-bugs

Take the following code and compile with -O2 -m64 -maltivec -mabi=altivec:
#define vector __attribute__((vector_size(16)))
float f(vector float t)
{
  union {
    vector float t1;
    float t2[4];
  }t5;
  t5.t1 = t;
  return t5.t2[0];
}

Currently we get:
        addi 12,1,-32
        stvx 2,0,12
        ld 11,0(12)
        srdi 9,11,32
        stw 9,-16(1)
        lfs 1,-16(1)
        blr

Which is bad for at least the Cell as we now hit two store load hazards.  We
can remove one if the compile uses the vec_extract patterns causing us to use
stvewx and lfs.

This does not effect x86 as the union is recorded as BLKmode but x86_64 has the
same issue, maybe even worse as there is no need to go through memory there.
X86_64 produces:
f:
.LFB2:
        movaps  %xmm0, -24(%rsp)
        movss   -24(%rsp), %xmm0
        ret
When really it should produce just a ret.


-- 
           Summary: accessing via union on a vector does not cause
                    vec_extract to be used
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc-linux-gnu


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


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

end of thread, other threads:[~2014-11-24  9:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-28367-4@http.gcc.gnu.org/bugzilla/>
2011-03-16 11:58 ` [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used rguenth at gcc dot gnu.org
2014-10-10  0:25 ` glisse at gcc dot gnu.org
2014-11-24  9:03 ` rguenth at gcc dot gnu.org
2006-07-13  2:43 [Bug middle-end/28367] New: " pinskia at gcc dot gnu dot org
2006-07-13  5:37 ` [Bug middle-end/28367] " pinskia at gcc dot gnu dot org
2006-07-14  7:58 ` pinskia at gcc dot gnu dot org
2006-07-19 14:46 ` pinskia at gcc dot gnu dot org
2006-08-26  4:48 ` pinskia at gcc dot gnu dot 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).