gcc/libgomp/testsuite/libgomp.c/examples-4/simd-6.c

106 lines
1.8 KiB
C
Raw Normal View History

Update libgomp/testsuite/*/examples-4/* according to latest version (4.0.2) 2015-07-13 Maxim Blumenthal <maxim.blumenthal@intel.com> * testsuite/libgomp.c++/examples-4/e.53.2.C: Renamed to... * testsuite/libgomp.c++/examples-4/declare_target-2.C: ...this. * testsuite/libgomp.c++/examples-4/e.51.5.C: Renamed to... * testsuite/libgomp.c++/examples-4/target_data-5.C: ...this. * testsuite/libgomp.c/examples-4/e.56.3.c: Renamed to... * testsuite/libgomp.c/examples-4/array_sections-3.c: ...this. * testsuite/libgomp.c/examples-4/e.56.4.c: Renamed to... * testsuite/libgomp.c/examples-4/array_sections-4.c: ...this. * testsuite/libgomp.c/examples-4/e.55.1.c: Renamed to... * testsuite/libgomp.c/examples-4/async_target-1.c: ...this. * testsuite/libgomp.c/examples-4/e.55.2.c: Renamed to... * testsuite/libgomp.c/examples-4/async_target-2.c: ...this. (vec_mult_ref): Remove v1 and v2 arguments, turn them into local variables. (vec_mult): Likewise. Add #pragma omp taskwait. (main): Adjust caller. * testsuite/libgomp.c/examples-4/e.53.1.c: Renamed to... * testsuite/libgomp.c/examples-4/declare_target-1.c: ...this. * testsuite/libgomp.c/examples-4/e.53.3.c: Renamed to... * testsuite/libgomp.c/examples-4/declare_target-3.c: ...this. * testsuite/libgomp.c/examples-4/e.53.4.c: Renamed to... * testsuite/libgomp.c/examples-4/declare_target-4.c: ...this. * testsuite/libgomp.c/examples-4/e.53.5.c: Renamed to... * testsuite/libgomp.c/examples-4/declare_target-5.c: ...this. * testsuite/libgomp.c/examples-4/e.57.1.c: Renamed to... * testsuite/libgomp.c/examples-4/device-1.c: ...this. * testsuite/libgomp.c/examples-4/e.57.2.c: Renamed to... * testsuite/libgomp.c/examples-4/device-2.c: ...this. * testsuite/libgomp.c/examples-4/e.57.3.c: Renamed to... * testsuite/libgomp.c/examples-4/device-3.c: ...this. * testsuite/libgomp.c/examples-4/simd-1.c: New file. * testsuite/libgomp.c/examples-4/simd-2.c: New file. * testsuite/libgomp.c/examples-4/simd-3.c: New file. * testsuite/libgomp.c/examples-4/simd-4.c: New file. * testsuite/libgomp.c/examples-4/simd-5.c: New file. * testsuite/libgomp.c/examples-4/simd-6.c: New file. * testsuite/libgomp.c/examples-4/simd-7.c: New file. * testsuite/libgomp.c/examples-4/simd-8.c: New file. * testsuite/libgomp.c/examples-4/e.50.1.c: Renamed to... * testsuite/libgomp.c/examples-4/target-1.c: ...this. * testsuite/libgomp.c/examples-4/e.50.2.c: Renamed to... * testsuite/libgomp.c/examples-4/target-2.c: ...this. * testsuite/libgomp.c/examples-4/e.50.3.c: Renamed to... * testsuite/libgomp.c/examples-4/target-3.c: ...this. * testsuite/libgomp.c/examples-4/e.50.4.c: Renamed to... * testsuite/libgomp.c/examples-4/target-4.c: ...this. * testsuite/libgomp.c/examples-4/e.50.5.c: Renamed to... * testsuite/libgomp.c/examples-4/target-5.c: ...this. * testsuite/libgomp.c/examples-4/e.51.1.c: Renamed to... * testsuite/libgomp.c/examples-4/target_data-1.c: ...this. * testsuite/libgomp.c/examples-4/e.51.2.c: Renamed to... * testsuite/libgomp.c/examples-4/target_data-2.c: ...this. * testsuite/libgomp.c/examples-4/e.51.3.c: Renamed to... * testsuite/libgomp.c/examples-4/target_data-3.c: ...this. * testsuite/libgomp.c/examples-4/e.51.4.c: Renamed to... * testsuite/libgomp.c/examples-4/target_data-4.c: ...this. * testsuite/libgomp.c/examples-4/e.51.6.c: Renamed to... * testsuite/libgomp.c/examples-4/target_data-6.c: ...this. * testsuite/libgomp.c/examples-4/e.51.7.c: Renamed to... * testsuite/libgomp.c/examples-4/target_data-7.c: ...this. * testsuite/libgomp.c/examples-4/e.52.1.c: Renamed to... * testsuite/libgomp.c/examples-4/target_update-1.c: ...this. * testsuite/libgomp.c/examples-4/e.52.2.c: Renamed to... * testsuite/libgomp.c/examples-4/target_update-2.c: ...this. * testsuite/libgomp.c/examples-4/task_dep-1.c: New file. * testsuite/libgomp.c/examples-4/task_dep-2.c: New file. * testsuite/libgomp.c/examples-4/task_dep-3.c: New file. * testsuite/libgomp.c/examples-4/task_dep-4.c: New file. * testsuite/libgomp.c/examples-4/task_dep-5.c: New file. * testsuite/libgomp.c/examples-4/e.54.2.c: Renamed to... * testsuite/libgomp.c/examples-4/teams-2.c: ...this. * testsuite/libgomp.c/examples-4/e.54.3.c: Renamed to... * testsuite/libgomp.c/examples-4/teams-3.c: ...this. * testsuite/libgomp.c/examples-4/e.54.4.c: Renamed to... * testsuite/libgomp.c/examples-4/teams-4.c: ...this. * testsuite/libgomp.c/examples-4/e.54.5.c: Renamed to... * testsuite/libgomp.c/examples-4/teams-5.c: ...this. * testsuite/libgomp.c/examples-4/e.54.6.c: Renamed to... * testsuite/libgomp.c/examples-4/teams-6.c: ...this. * testsuite/libgomp.fortran/examples-4/e.56.3.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/array_sections-3.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.56.4.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/array_sections-4.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.55.1.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/async_target-1.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.55.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/async_target-2.f90: ...this. (vec_mult): Add !$omp taskwait. * testsuite/libgomp.fortran/examples-4/e.53.1.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/declare_target-1.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.53.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/declare_target-2.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.53.3.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/declare_target-3.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.53.4.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/declare_target-4.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.53.5.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/declare_target-5.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.57.1.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/device-1.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.57.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/device-2.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.57.3.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/device-3.f90: ...this. * testsuite/libgomp.fortran/examples-4/simd-1.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-2.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-3.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-4.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-5.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-6.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-7.f90: New file. * testsuite/libgomp.fortran/examples-4/simd-8.f90: New file. * testsuite/libgomp.fortran/examples-4/e.50.1.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target-1.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.50.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target-2.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.50.3.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target-3.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.50.4.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target-4.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.50.5.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target-5.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.1.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-1.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-2.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.3.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-3.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.4.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-4.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.5.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-5.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.6.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-6.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.51.7.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_data-7.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.52.1.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_update-1.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.52.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/target_update-2.f90: ...this. * testsuite/libgomp.fortran/examples-4/task_dep-1.f90: New file. * testsuite/libgomp.fortran/examples-4/task_dep-2.f90: New file. * testsuite/libgomp.fortran/examples-4/task_dep-3.f90: New file. * testsuite/libgomp.fortran/examples-4/task_dep-4.f90: New file. * testsuite/libgomp.fortran/examples-4/task_dep-5.f90: New file. * testsuite/libgomp.fortran/examples-4/e.54.2.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/teams-2.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.54.3.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/teams-3.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.54.4.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/teams-4.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.54.5.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/teams-5.f90: ...this. * testsuite/libgomp.fortran/examples-4/e.54.6.f90: Renamed to... * testsuite/libgomp.fortran/examples-4/teams-6.f90: ...this. From-SVN: r225735
2015-07-13 15:08:13 +02:00
/* { dg-do run { target vect_simd_clones } } */
/* { dg-additional-options "-msse2" { target sse2_runtime } } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
#define N 100
#define EPS 0.000001
#include <stdlib.h>
#include <stdio.h>
void init(int *b, float *y, int n)
{
int i, s = -1;
for ( i=0; i<N; i++ )
{
b[i] = i*i*s;
y[i] = b[i] * 0.1f;
s = -s;
}
}
#pragma omp declare simd linear(p:1) notinbranch
int foo(int *p){
*p = *p + 10;
return *p;
}
int myaddint(int *a, int *b, int n)
{
#pragma omp simd
for (int i=0; i<n; i++){
a[i] = foo(&b[i]); /* foo is not called under a condition */
}
return a[n-1];
}
int myaddint_ref(int *a, int *b, int n)
{
for (int i=0; i<n; i++){
a[i] = foo(&b[i]);
}
return a[n-1];
}
#pragma omp declare simd linear(p:1) inbranch
float goo(float *p){
*p = *p + 18.5f;
return *p;
}
int myaddfloat(float *x, float *y, int n)
{
#pragma omp simd
for (int i=0; i<n; i++){
x[i] = (x[i] > y[i]) ? goo(&y[i]) : y[i];
/* goo is called under the condition (or within a branch) */
}
return x[n-1];
}
int myaddfloat_ref(float *x, float *y, int n)
{
for (int i=0; i<n; i++){
x[i] = (x[i] > y[i]) ? goo(&y[i]) : y[i];
}
return x[n-1];
}
void check_addint (int *a, int *b)
{
int i;
for (i = 0; i < N; i++)
if (a[i] != b[i])
abort ();
}
void check_addfloat (float *a, float *b)
{
int i;
for (i = 0; i < N; i++)
if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
abort ();
}
int main ()
{
int i;
int a[N], a_ref[N], b[N];
float x[N], x_ref[N], y[N];
init(a, x, N);
init(b, y, N);
myaddint(a, b, N);
myaddfloat(x, y, N);
init(a_ref, x_ref, N);
init(b, y, N);
myaddint_ref(a_ref, b, N);
myaddfloat_ref(x_ref, y, N);
check_addint(a, a_ref);
check_addfloat(x, x_ref);
return 0;
}