mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/71257 (OpenMP declare simd linear with ref modifier doesn't accept references to non-integer/non-pointer)
PR c++/71257 * tree-vect-stmts.c (vectorizable_simd_clone_call): Handle SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Add SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP and SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP cases explicitly. * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_LINEAR>: For OMP_CLAUSE_LINEAR_REF don't require type to be integral or pointer. * g++.dg/vect/simd-clone-6.cc: New test. * g++.dg/gomp/declare-simd-6.C: New test. From-SVN: r236648
This commit is contained in:
parent
e90434e3aa
commit
7adb26f202
|
|
@ -1,3 +1,12 @@
|
|||
2016-05-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/71257
|
||||
* tree-vect-stmts.c (vectorizable_simd_clone_call): Handle
|
||||
SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like
|
||||
SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP. Add
|
||||
SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP and
|
||||
SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP cases explicitly.
|
||||
|
||||
2016-05-24 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/71240
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
2016-05-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/71257
|
||||
* semantics.c (finish_omp_clauses) <case OMP_CLAUSE_LINEAR>:
|
||||
For OMP_CLAUSE_LINEAR_REF don't require type to be
|
||||
integral or pointer.
|
||||
|
||||
2016-05-24 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/70434
|
||||
|
|
|
|||
|
|
@ -5881,7 +5881,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_REF)
|
||||
{
|
||||
if (!INTEGRAL_TYPE_P (type)
|
||||
&& TREE_CODE (type) != POINTER_TYPE)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
2016-05-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/71257
|
||||
* g++.dg/vect/simd-clone-6.cc: New test.
|
||||
* g++.dg/gomp/declare-simd-6.C: New test.
|
||||
|
||||
PR middle-end/70434
|
||||
PR c/69504
|
||||
* c-c++-common/vector-subscript-5.c (foo): Move ; out of the ifdef.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
// PR c++/71257
|
||||
// { dg-do compile }
|
||||
// { dg-options "-fopenmp-simd" }
|
||||
|
||||
struct S { int a; };
|
||||
#pragma omp declare simd linear(val(a):2)
|
||||
int f1 (int &a);
|
||||
#pragma omp declare simd linear(uval(a):2)
|
||||
unsigned short f2 (unsigned short &a);
|
||||
#pragma omp declare simd linear(ref(a):1)
|
||||
int f3 (long long int &a);
|
||||
#pragma omp declare simd linear(a:1)
|
||||
int f4 (int &a);
|
||||
#pragma omp declare simd linear(val(a))
|
||||
int f5 (int a);
|
||||
#pragma omp declare simd linear(uval(a):2) // { dg-error "modifier applied to non-reference variable" }
|
||||
int f6 (unsigned short a);
|
||||
#pragma omp declare simd linear(ref(a):1) // { dg-error "modifier applied to non-reference variable" }
|
||||
int f7 (unsigned long int a);
|
||||
#pragma omp declare simd linear(a:1)
|
||||
int f8 (int a);
|
||||
#pragma omp declare simd linear(val(a):2) // { dg-error "applied to non-integral non-pointer variable" }
|
||||
int f9 (S &a);
|
||||
#pragma omp declare simd linear(uval(a):2) // { dg-error "applied to non-integral non-pointer variable" }
|
||||
int f10 (S &a);
|
||||
#pragma omp declare simd linear(ref(a):1) // { dg-bogus "applied to non-integral non-pointer variable" }
|
||||
int f11 (S &a);
|
||||
#pragma omp declare simd linear(a:1) // { dg-error "applied to non-integral non-pointer variable" }
|
||||
int f12 (S &a);
|
||||
#pragma omp declare simd linear(val(a)) // { dg-error "applied to non-integral non-pointer variable" }
|
||||
int f13 (S a);
|
||||
#pragma omp declare simd linear(uval(a):2) // { dg-error "modifier applied to non-reference variable" }
|
||||
int f14 (S a);
|
||||
#pragma omp declare simd linear(ref(a):1) // { dg-error "modifier applied to non-reference variable" }
|
||||
int f15 (S a);
|
||||
#pragma omp declare simd linear(a:1) // { dg-error "applied to non-integral non-pointer variable" }
|
||||
int f16 (S a);
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
// PR c++/71257
|
||||
// { dg-require-effective-target vect_simd_clones }
|
||||
// { dg-additional-options "-fopenmp-simd -fno-inline" }
|
||||
// { dg-additional-options "-mavx" { target avx_runtime } }
|
||||
|
||||
#include "../../gcc.dg/vect/tree-vect.h"
|
||||
|
||||
#define N 1024
|
||||
struct S { int a; };
|
||||
int c[N], e[N], f[N];
|
||||
S d[N];
|
||||
|
||||
#pragma omp declare simd linear(ref(b, c) : 1)
|
||||
int
|
||||
foo (int a, S &b, int &c)
|
||||
{
|
||||
return a + b.a + c;
|
||||
}
|
||||
|
||||
void
|
||||
do_main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
c[i] = i;
|
||||
d[i].a = 2 * i;
|
||||
f[i] = 3 * i;
|
||||
}
|
||||
#pragma omp simd
|
||||
for (i = 0; i < N; i++)
|
||||
e[i] = foo (c[i], d[i], f[i]);
|
||||
for (i = 0; i < N; i++)
|
||||
if (e[i] != 6 * i)
|
||||
__builtin_abort ();
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
check_vect ();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3012,8 +3012,10 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
|
|||
{
|
||||
STMT_VINFO_SIMD_CLONE_INFO (stmt_info).safe_push (bestn->decl);
|
||||
for (i = 0; i < nargs; i++)
|
||||
if (bestn->simdclone->args[i].arg_type
|
||||
== SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP)
|
||||
if ((bestn->simdclone->args[i].arg_type
|
||||
== SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP)
|
||||
|| (bestn->simdclone->args[i].arg_type
|
||||
== SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP))
|
||||
{
|
||||
STMT_VINFO_SIMD_CLONE_INFO (stmt_info).safe_grow_cleared (i * 3
|
||||
+ 1);
|
||||
|
|
@ -3148,6 +3150,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
|
|||
vargs.safe_push (op);
|
||||
break;
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP:
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP:
|
||||
if (j == 0)
|
||||
{
|
||||
gimple_seq stmts;
|
||||
|
|
@ -3211,6 +3214,8 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
|
|||
vargs.safe_push (new_temp);
|
||||
}
|
||||
break;
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP:
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP:
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP:
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP:
|
||||
case SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP:
|
||||
|
|
|
|||
Loading…
Reference in New Issue