Handle vector increment/decrement in build_unary_op
2013-11-27 Tom de Vries <tom@codesourcery.com> Marc Glisse <marc.glisse@inria.fr> PR c++/59032 * c-typeck.c (build_unary_op): Allow vector increment and decrement. * typeck.c (cp_build_unary_op): Allow vector increment and decrement. * c-c++-common/pr59032.c: New testcase. Co-Authored-By: Marc Glisse <marc.glisse@inria.fr> From-SVN: r205439
This commit is contained in:
parent
e934916c86
commit
241b71bb88
6 changed files with 55 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-11-27 Tom de Vries <tom@codesourcery.com>
|
||||
Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR c++/59032
|
||||
* c-typeck.c (build_unary_op): Allow vector increment and decrement.
|
||||
|
||||
2013-11-22 Andrew MacLeod <amacleod@redhat.com>
|
||||
|
||||
* c-typeck.c: Add required include files from gimple.h.
|
||||
|
|
|
@ -3982,7 +3982,7 @@ build_unary_op (location_t location,
|
|||
|
||||
if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE
|
||||
&& typecode != INTEGER_TYPE && typecode != REAL_TYPE
|
||||
&& typecode != COMPLEX_TYPE)
|
||||
&& typecode != COMPLEX_TYPE && typecode != VECTOR_TYPE)
|
||||
{
|
||||
if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
|
||||
error_at (location, "wrong type argument to increment");
|
||||
|
@ -4047,7 +4047,9 @@ build_unary_op (location_t location,
|
|||
}
|
||||
else
|
||||
{
|
||||
inc = integer_one_node;
|
||||
inc = VECTOR_TYPE_P (argtype)
|
||||
? build_one_cst (argtype)
|
||||
: integer_one_node;
|
||||
inc = convert (argtype, inc);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2013-11-27 Tom de Vries <tom@codesourcery.com>
|
||||
Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR c++/59032
|
||||
* typeck.c (cp_build_unary_op): Allow vector increment and decrement.
|
||||
|
||||
2013-11-27 Tom de Vries <tom@codesourcery.com>
|
||||
Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
|
|
|
@ -5748,7 +5748,9 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
|
|||
inc = cxx_sizeof_nowarn (TREE_TYPE (argtype));
|
||||
}
|
||||
else
|
||||
inc = integer_one_node;
|
||||
inc = VECTOR_TYPE_P (argtype)
|
||||
? build_one_cst (argtype)
|
||||
: integer_one_node;
|
||||
|
||||
inc = cp_convert (argtype, inc, complain);
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2013-11-27 Tom de Vries <tom@codesourcery.com>
|
||||
Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR c++/59032
|
||||
* c-c++-common/pr59032.c: New testcase.
|
||||
|
||||
2013-11-27 Tom de Vries <tom@codesourcery.com>
|
||||
Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
|
|
30
gcc/testsuite/c-c++-common/pr59032.c
Normal file
30
gcc/testsuite/c-c++-common/pr59032.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
void
|
||||
foo()
|
||||
{
|
||||
float v __attribute__((vector_size(8)));
|
||||
v++;
|
||||
}
|
||||
|
||||
void
|
||||
foo2 ()
|
||||
{
|
||||
float v __attribute__((vector_size(8)));
|
||||
++v;
|
||||
}
|
||||
|
||||
void
|
||||
foo3 ()
|
||||
{
|
||||
float v __attribute__((vector_size(8)));
|
||||
v--;
|
||||
}
|
||||
|
||||
void
|
||||
foo4 ()
|
||||
{
|
||||
float v __attribute__((vector_size(8)));
|
||||
--v;
|
||||
}
|
Loading…
Add table
Reference in a new issue