This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] FIX PR 36431 The C++ front-end produces some NOP_EXPR for vector types


Hi,
  In the C++ front-end and in other places in the middle-end, we
produce NOP_EXPR for some vector types which confuses the gimplfier in
some cases.
The source was:
typedef vector float SIMD_Vector;
struct g
{
  vector float l[2];
};
  SIMD_Vector g0 = vec_splat (a.l[1], 0);

The Gimplfier produces:
  D.2144 = &a->l[1];
  D.2145 = VIEW_CONVERT_EXPR<__vector signed int>(*D.2144);

This patch adds checking to build1_stat for NOP_EXPR of vector types.
It also fixes the places where we would have built a NOP_EXPR for a
vector type to produce a VIEW_CONVERT_EXPR instead.

OK?  Bootstrapped and tested on powerpc64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* tree.c (build1_stat): Assert that we don't have NOP_EXPR with a vector type.
* fold-const.c (fold_convert): Use VIEW_CONVERT_EXPR instead of
NOP_EXPR for a vector type.

cp/ChangeLog:
* typeck.c (decay_conversion): Use convert_to_vector instead of
build_nop for vector types.
* cvt.c (ocp_convert): Use convert_to_vector for vector types.

testsuite/ChangeLog:
* g++.dg/ext/vector15.C: New test.

Attachment: fixvector.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]