While looking into a performance issue in 4.1.1 on PowerPC, I noticed that the
C++ front-end produces a NOP_EXPR for a vector type.  This caused the following
performance testcase to fail:
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-O2" } */

// We should not produce any addi but instead use li for this function as
// the two address expressions should be done correctly.
/* { dg-final { scan-assembler-not "addi" } } */

#include <altivec.h>

typedef vector float SIMD_Vector;
struct g
{
  vector float l[2];
};
vector float f(const struct g &a, const struct g &a1)
{
  SIMD_Vector g0 = vec_splat (a.l[1], 0);
  SIMD_Vector g1 = vec_splat (a.l[1], 1);
  SIMD_Vector g2 = vec_splat (a1.l[1], 1);
  SIMD_Vector g3 = vec_splat (a1.l[1], 2);
  return g0 + g1 + g2 + g3;
}

---- CUT ---

Note on the trunk it works correctly as we prop the &a->l[1] into the indirect
reference during forwprop but the C++ front-end is still produce the weird IR.


-- 
           Summary: The C++ front-end produces some NOP_EXPR for vector
                    types
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc*-*-*


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

Reply via email to