+2018-05-02 Tom de Vries <tom@codesourcery.com>
+
+ PR testsuite/83791
+ * testsuite/libgomp.c++/udr-9.C: Update.
+ * testsuite/libgomp.c++/atomic-16.C: Remove.
+ * testsuite/libgomp.c++/cancel-taskgroup-2.C: Remove.
+ * testsuite/libgomp.c++/loop-13.C: Remove.
+ * testsuite/libgomp.c++/loop-14.C: Remove.
+ * testsuite/libgomp.c++/loop-15.C: Remove.
+ * testsuite/libgomp.c++/monotonic-1.C: Remove.
+ * testsuite/libgomp.c++/monotonic-2.C: Remove.
+ * testsuite/libgomp.c++/nonmonotonic-1.C: Remove.
+ * testsuite/libgomp.c++/nonmonotonic-2.C: Remove.
+ * testsuite/libgomp.c++/ordered-1.C: Remove.
+ * testsuite/libgomp.c++/pr45784.C: Remove.
+ * testsuite/libgomp.c++/pr64824.C: Remove.
+ * testsuite/libgomp.c++/pr64868.C: Remove.
+ * testsuite/libgomp.c++/pr66199-1.C: Remove.
+ * testsuite/libgomp.c++/pr66199-2.C: Remove.
+ * testsuite/libgomp.c++/pr66199-3.C: Remove.
+ * testsuite/libgomp.c++/pr66199-4.C: Remove.
+ * testsuite/libgomp.c++/pr66199-5.C: Remove.
+ * testsuite/libgomp.c++/pr66199-6.C: Remove.
+ * testsuite/libgomp.c++/pr66199-7.C: Remove.
+ * testsuite/libgomp.c++/pr66199-8.C: Remove.
+ * testsuite/libgomp.c++/pr66199-9.C: Remove.
+ * testsuite/libgomp.c++/pr69389.C: Remove.
+ * testsuite/libgomp.c++/simd10.C: Remove.
+ * testsuite/libgomp.c++/simd11.C: Remove.
+ * testsuite/libgomp.c++/simd12.C: Remove.
+ * testsuite/libgomp.c++/simd13.C: Remove.
+ * testsuite/libgomp.c++/target-1.C: Remove.
+ * testsuite/libgomp.c++/target-3.C: Remove.
+ * testsuite/libgomp.c++/target-4.C: Remove.
+ * testsuite/libgomp.c++/target-5.C: Remove.
+ * testsuite/libgomp.c++/taskgroup-1.C: Remove.
+ * testsuite/libgomp.c++/taskloop-1.C: Remove.
+ * testsuite/libgomp.c++/taskloop-2.C: Remove.
+ * testsuite/libgomp.c++/taskloop-3.C: Remove.
+ * testsuite/libgomp.c++/taskloop-4.C: Remove.
+ * testsuite/libgomp.c++/udr-9.C: Remove.
+ * testsuite/libgomp.c++/for-10.C: Remove.
+ * testsuite/libgomp.c++/for-11.C: Remove.
+ * testsuite/libgomp.c++/for-12.C: Remove.
+ * testsuite/libgomp.c++/for-13.C: Remove.
+ * testsuite/libgomp.c++/for-14.C: Remove.
+ * testsuite/libgomp.c++/for-9.C: Remove.
+ * testsuite/libgomp.c/atomic-18.c: Move ...
+ * testsuite/libgomp.c-c++-common/atomic-18.c: ... here.
+ * testsuite/libgomp.c/cancel-taskgroup-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/cancel-taskgroup-2.c: here.
+ * testsuite/libgomp.c/loop-13.c: Move ...
+ * testsuite/libgomp.c-c++-common/loop-13.c: ... here.
+ * testsuite/libgomp.c/loop-14.c: Move ...
+ * testsuite/libgomp.c-c++-common/loop-14.c: ... here.
+ * testsuite/libgomp.c/loop-15.c: Remove.
+ * testsuite/libgomp.c-c++-common/loop-15.c: New test.
+ * testsuite/libgomp.c/monotonic-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/monotonic-1.c: ... here.
+ * testsuite/libgomp.c/monotonic-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/monotonic-2.c: ... here.
+ * testsuite/libgomp.c/nonmonotonic-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/nonmonotonic-1.c: ... here.
+ * testsuite/libgomp.c/nonmonotonic-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/nonmonotonic-2.c: ... here.
+ * testsuite/libgomp.c/ordered-4.c: Move ...
+ * testsuite/libgomp.c-c++-common/ordered-4.c: ... here.
+ * testsuite/libgomp.c/pr45784.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr45784.c: ... here.
+ * testsuite/libgomp.c/pr64824.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr64824.c: ... here.
+ * testsuite/libgomp.c/pr64868.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr64868.c: ... here.
+ * testsuite/libgomp.c/pr66199-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-1.c: ... here.
+ * testsuite/libgomp.c/pr66199-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-2.c: ... here.
+ * testsuite/libgomp.c/pr66199-3.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-3.c: ... here.
+ * testsuite/libgomp.c/pr66199-4.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-4.c: ... here.
+ * testsuite/libgomp.c/pr66199-5.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-5.c: ... here.
+ * testsuite/libgomp.c/pr66199-6.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-6.c: ... here.
+ * testsuite/libgomp.c/pr66199-7.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-7.c: ... here.
+ * testsuite/libgomp.c/pr66199-8.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-8.c: ... here.
+ * testsuite/libgomp.c/pr66199-9.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr66199-9.c: ... here.
+ * testsuite/libgomp.c/pr69389.c: Move ...
+ * testsuite/libgomp.c-c++-common/pr69389.c: ... here.
+ * testsuite/libgomp.c/simd-14.c: Move ...
+ * testsuite/libgomp.c-c++-common/simd-14.c: ... here.
+ * testsuite/libgomp.c/simd-15.c: Move ...
+ * testsuite/libgomp.c-c++-common/simd-15.c: ... here.
+ * testsuite/libgomp.c/simd-16.c: Move ...
+ * testsuite/libgomp.c-c++-common/simd-16.c: ... here.
+ * testsuite/libgomp.c/simd-17.c: Move ...
+ * testsuite/libgomp.c-c++-common/simd-17.c: ... here.
+ * testsuite/libgomp.c/target-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/target-1.c: ... here.
+ * testsuite/libgomp.c/target-10.c: Move ...
+ * testsuite/libgomp.c-c++-common/target-10.c: ... here.
+ * testsuite/libgomp.c/target-13.c: Move ...
+ * testsuite/libgomp.c-c++-common/target-13.c: ... here.
+ * testsuite/libgomp.c/target-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/target-2.c: ... here.
+ * testsuite/libgomp.c/taskgroup-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/taskgroup-1.c: ... here.
+ * testsuite/libgomp.c/taskloop-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/taskloop-1.c: ... here.
+ * testsuite/libgomp.c/taskloop-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/taskloop-2.c: ... here.
+ * testsuite/libgomp.c/taskloop-3.c: Move ...
+ * testsuite/libgomp.c-c++-common/taskloop-3.c: ... here.
+ * testsuite/libgomp.c/taskloop-4.c: Move ...
+ * testsuite/libgomp.c-c++-common/taskloop-4.c: ... here.
+ * testsuite/libgomp.c/udr-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/udr-1.c: ... here.
+ * testsuite/libgomp.c/for-1.c: Move ...
+ * testsuite/libgomp.c-c++-common/for-1.c: ... here.
+ * testsuite/libgomp.c/for-1.h: Move ...
+ * testsuite/libgomp.c-c++-common/for-1.h: ... here.
+ * testsuite/libgomp.c/for-2.c: Move ...
+ * testsuite/libgomp.c-c++-common/for-2.c: ... here.
+ * testsuite/libgomp.c/for-2.h: Move ...
+ * testsuite/libgomp.c-c++-common/for-2.h: ... here.
+ * testsuite/libgomp.c/for-3.c: Move ...
+ * testsuite/libgomp.c-c++-common/for-3.c: ... here.
+ * testsuite/libgomp.c/for-4.c: Move ...
+ * testsuite/libgomp.c-c++-common/for-4.c: ... here.
+ * testsuite/libgomp.c/for-5.c: Move ...
+ * testsuite/libgomp.c-c++-common/for-5.c: ... here.
+ * testsuite/libgomp.c/for-6.c: Move ...
+ * testsuite/libgomp.c-c++-common/for-6.c: ... here.
+
2018-05-02 Tom de Vries <tom@codesourcery.com>
PR libgomp/82428
+++ /dev/null
-// PR c/64824
-// { dg-do run }
-
-#include "../libgomp.c/atomic-18.c"
+++ /dev/null
-// { dg-do run }
-// { dg-set-target-env-var OMP_CANCELLATION "true" }
-
-#include "../libgomp.c/cancel-taskgroup-2.c"
+++ /dev/null
-extern "C" void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#define F simd
-#define G simd
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F parallel for simd
-#define G pf_simd
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#undef SC
-#define SC static
-#define F for simd
-#define G f_simd
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-#undef SC
-
-int
-main ()
-{
- if (test_simd_normal ()
- || test_pf_simd_static ()
- || test_pf_simd_static32 ()
- || test_pf_simd_auto ()
- || test_pf_simd_guided32 ()
- || test_pf_simd_runtime ()
- || test_f_simd_static ()
- || test_f_simd_static32 ()
- || test_f_simd_auto ()
- || test_f_simd_guided32 ()
- || test_f_simd_runtime ())
- abort ();
- return 0;
-}
+++ /dev/null
-extern "C" void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#pragma omp declare target
-
-#define F distribute
-#define G d
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute
-#define G d_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute simd
-#define G ds
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute simd
-#define G ds_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute parallel for
-#define G dpf
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F distribute parallel for dist_schedule(static, 128)
-#define G dpf_ds128
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F distribute parallel for simd
-#define G dpfs
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F distribute parallel for simd dist_schedule(static, 128)
-#define G dpfs_ds128
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#pragma omp end declare target
-
-int
-main ()
-{
- int err = 0;
- #pragma omp target teams reduction(|:err)
- {
- err |= test_d_normal ();
- err |= test_d_ds128_normal ();
- err |= test_ds_normal ();
- err |= test_ds_ds128_normal ();
- err |= test_dpf_static ();
- err |= test_dpf_static32 ();
- err |= test_dpf_auto ();
- err |= test_dpf_guided32 ();
- err |= test_dpf_runtime ();
- err |= test_dpf_ds128_static ();
- err |= test_dpf_ds128_static32 ();
- err |= test_dpf_ds128_auto ();
- err |= test_dpf_ds128_guided32 ();
- err |= test_dpf_ds128_runtime ();
- err |= test_dpfs_static ();
- err |= test_dpfs_static32 ();
- err |= test_dpfs_auto ();
- err |= test_dpfs_guided32 ();
- err |= test_dpfs_runtime ();
- err |= test_dpfs_ds128_static ();
- err |= test_dpfs_ds128_static32 ();
- err |= test_dpfs_ds128_auto ();
- err |= test_dpfs_ds128_guided32 ();
- err |= test_dpfs_ds128_runtime ();
- }
- if (err)
- abort ();
- return 0;
-}
+++ /dev/null
-extern "C" void abort (void);
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#define F taskloop
-#define G taskloop
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F taskloop simd
-#define G taskloop_simd
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-int
-main ()
-{
- int err = 0;
- #pragma omp parallel reduction(|:err)
- #pragma omp single
- {
- if (test_taskloop_normal ()
- || test_taskloop_simd_normal ())
- err = 1;
- }
- if (err)
- abort ();
- return 0;
-}
+++ /dev/null
-extern "C" void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#pragma omp declare target
-
-#define F for
-#define G f
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#pragma omp end declare target
-
-#undef OMPFROM
-#undef OMPTO
-#define DO_PRAGMA(x) _Pragma (#x)
-#define OMPFROM(v) DO_PRAGMA (omp target update from(v))
-#define OMPTO(v) DO_PRAGMA (omp target update to(v))
-
-#define F target parallel for
-#define G tpf
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F target simd
-#define G t_simd
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target parallel for simd
-#define G tpf_simd
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute
-#define G ttd
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute
-#define G ttd_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute simd
-#define G ttds
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute simd
-#define G ttds_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute parallel for
-#define G ttdpf
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute parallel for dist_schedule(static, 128)
-#define G ttdpf_ds128
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute parallel for simd
-#define G ttdpfs
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute parallel for simd dist_schedule(static, 128)
-#define G ttdpfs_ds128
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-int
-main ()
-{
- if (test_tpf_static ()
- || test_tpf_static32 ()
- || test_tpf_auto ()
- || test_tpf_guided32 ()
- || test_tpf_runtime ()
- || test_t_simd_normal ()
- || test_tpf_simd_static ()
- || test_tpf_simd_static32 ()
- || test_tpf_simd_auto ()
- || test_tpf_simd_guided32 ()
- || test_tpf_simd_runtime ()
- || test_ttd_normal ()
- || test_ttd_ds128_normal ()
- || test_ttds_normal ()
- || test_ttds_ds128_normal ()
- || test_ttdpf_static ()
- || test_ttdpf_static32 ()
- || test_ttdpf_auto ()
- || test_ttdpf_guided32 ()
- || test_ttdpf_runtime ()
- || test_ttdpf_ds128_static ()
- || test_ttdpf_ds128_static32 ()
- || test_ttdpf_ds128_auto ()
- || test_ttdpf_ds128_guided32 ()
- || test_ttdpf_ds128_runtime ()
- || test_ttdpfs_static ()
- || test_ttdpfs_static32 ()
- || test_ttdpfs_auto ()
- || test_ttdpfs_guided32 ()
- || test_ttdpfs_runtime ()
- || test_ttdpfs_ds128_static ()
- || test_ttdpfs_ds128_static32 ()
- || test_ttdpfs_ds128_auto ()
- || test_ttdpfs_ds128_guided32 ()
- || test_ttdpfs_ds128_runtime ())
- abort ();
-}
+++ /dev/null
-extern "C" void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#pragma omp declare target
-
-#define F for
-#define G f
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#pragma omp end declare target
-
-#undef OMPTGT
-#undef OMPFROM
-#undef OMPTO
-#define DO_PRAGMA(x) _Pragma (#x)
-#define OMPTGT DO_PRAGMA (omp target)
-#define OMPFROM(v) DO_PRAGMA (omp target update from(v))
-#define OMPTO(v) DO_PRAGMA (omp target update to(v))
-
-#define F teams distribute
-#define G td
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute
-#define G td_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute simd
-#define G tds
-#define S
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute simd
-#define G tds_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "../libgomp.c/for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute parallel for
-#define G tdpf
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F teams distribute parallel for dist_schedule(static, 128)
-#define G tdpf_ds128
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F teams distribute parallel for simd
-#define G tdpfs
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F teams distribute parallel for simd dist_schedule(static, 128)
-#define G tdpfs_ds128
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-int
-main ()
-{
- if (test_td_normal ()
- || test_td_ds128_normal ()
- || test_tds_normal ()
- || test_tds_ds128_normal ()
- || test_tdpf_static ()
- || test_tdpf_static32 ()
- || test_tdpf_auto ()
- || test_tdpf_guided32 ()
- || test_tdpf_runtime ()
- || test_tdpf_ds128_static ()
- || test_tdpf_ds128_static32 ()
- || test_tdpf_ds128_auto ()
- || test_tdpf_ds128_guided32 ()
- || test_tdpf_ds128_runtime ()
- || test_tdpfs_static ()
- || test_tdpfs_static32 ()
- || test_tdpfs_auto ()
- || test_tdpfs_guided32 ()
- || test_tdpfs_runtime ()
- || test_tdpfs_ds128_static ()
- || test_tdpfs_ds128_static32 ()
- || test_tdpfs_ds128_auto ()
- || test_tdpfs_ds128_guided32 ()
- || test_tdpfs_ds128_runtime ())
- abort ();
-}
+++ /dev/null
-extern "C" void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#define F parallel for
-#define G pf
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-#define F for
-#define G f
-#include "../libgomp.c/for-1.h"
-#undef F
-#undef G
-
-int
-main ()
-{
- if (test_pf_static ()
- || test_pf_static32 ()
- || test_pf_auto ()
- || test_pf_guided32 ()
- || test_pf_runtime ()
- || test_f_static ()
- || test_f_static32 ()
- || test_f_auto ()
- || test_f_guided32 ()
- || test_f_runtime ())
- abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-#include "../libgomp.c/loop-13.c"
+++ /dev/null
-/* { dg-do run } */
-
-#include "../libgomp.c/loop-14.c"
+++ /dev/null
-/* { dg-do run } */
-
-#include "../libgomp.c/loop-15.c"
+++ /dev/null
-// { dg-do run }
-
-#include "../libgomp.c/monotonic-1.c"
+++ /dev/null
-// { dg-do run }
-
-#include "../libgomp.c/monotonic-2.c"
+++ /dev/null
-// { dg-do run }
-
-#include "../libgomp.c/nonmonotonic-1.c"
+++ /dev/null
-// { dg-do run }
-
-#include "../libgomp.c/nonmonotonic-2.c"
+++ /dev/null
-#include "../libgomp.c/ordered-4.c"
+++ /dev/null
-// PR c/45784
-// { dg-do run }
-
-#include "../libgomp.c/pr45784.c"
-
+++ /dev/null
-// PR c/64824
-// { dg-do run }
-
-#include "../libgomp.c/pr64824.c"
+++ /dev/null
-// PR c/64868
-// { dg-do run }
-
-#include "../libgomp.c/pr64868.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-1.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-2.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-3.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-4.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-5.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-6.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-7.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-8.c"
+++ /dev/null
-// PR middle-end/66199
-// { dg-do run }
-
-#include "../libgomp.c/pr66199-9.c"
+++ /dev/null
-// PR c/69389
-
-#include "../libgomp.c/pr69389.c"
+++ /dev/null
-// { dg-do run }
-// { dg-additional-options "-msse2" { target sse2_runtime } }
-// { dg-additional-options "-mavx" { target avx_runtime } }
-
-#include "../libgomp.c/simd-14.c"
+++ /dev/null
-// { dg-do run }
-// { dg-additional-options "-msse2" { target sse2_runtime } }
-// { dg-additional-options "-mavx" { target avx_runtime } }
-
-#include "../libgomp.c/simd-15.c"
+++ /dev/null
-// { dg-do run }
-// { dg-additional-options "-msse2" { target sse2_runtime } }
-// { dg-additional-options "-mavx" { target avx_runtime } }
-
-#include "../libgomp.c/simd-16.c"
+++ /dev/null
-// { dg-do run }
-// { dg-additional-options "-msse2" { target sse2_runtime } }
-// { dg-additional-options "-mavx" { target avx_runtime } }
-
-#include "../libgomp.c/simd-17.c"
+++ /dev/null
-#include "../libgomp.c/target-1.c"
+++ /dev/null
-#include "../libgomp.c/target-2.c"
+++ /dev/null
-// { dg-do run }
-
-#include "../libgomp.c/target-10.c"
+++ /dev/null
-#include "../libgomp.c/target-13.c"
+++ /dev/null
-#include "../libgomp.c/taskgroup-1.c"
+++ /dev/null
-// { dg-do run }
-// { dg-options "-O2" }
-
-#include "../libgomp.c/taskloop-1.c"
+++ /dev/null
-// { dg-do run }
-// { dg-options "-O2" }
-// { dg-additional-options "-msse2" { target sse2_runtime } }
-// { dg-additional-options "-mavx" { target avx_runtime } }
-
-#include "../libgomp.c/taskloop-2.c"
+++ /dev/null
-// { dg-do run }
-// { dg-options "-O2" }
-
-#include "../libgomp.c/taskloop-3.c"
+++ /dev/null
-// { dg-do run }
-// { dg-options "-O2" }
-
-#include "../libgomp.c/taskloop-4.c"
// { dg-do run }
// { dg-additional-options "-std=c++11" }
-#include "udr-9.C"
+#include "../libgomp.c-c++-common/udr-1.c"
+++ /dev/null
-// { dg-do run }
-
-#include "../libgomp.c/udr-1.c"
--- /dev/null
+/* PR c/64824 */
+/* { dg-do run } */
+
+void
+f1 (void)
+{
+ short a;
+ short b = 1;
+ int c = 3;
+#pragma omp atomic capture
+ a = b = c << b;
+ if (b != 6 || a != 6)
+ __builtin_abort ();
+}
+
+void
+f2 (void)
+{
+ short a;
+ short b = 1;
+ int c = 3;
+#pragma omp atomic capture
+ a = b = c + b;
+ if (b != 4 || a != 4)
+ __builtin_abort ();
+}
+
+void
+f3 (void)
+{
+ short a;
+ short b = 1;
+ long long int c = 3;
+#pragma omp atomic capture
+ a = b = c + b;
+ if (b != 4 || a != 4)
+ __builtin_abort ();
+}
+
+void
+f4 (void)
+{
+ char a;
+ char b = 1;
+ long long int c = 3LL;
+#pragma omp atomic capture
+ a = b = c << b;
+ if (b != 6 || a != 6)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ f1 ();
+ f2 ();
+ f3 ();
+ f4 ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <omp.h>
+
+int
+main ()
+{
+ #pragma omp parallel
+ #pragma omp taskgroup
+ #pragma omp task
+ {
+ #pragma omp cancel taskgroup
+ if (omp_get_cancellation ())
+ abort ();
+ }
+ #pragma omp parallel
+ {
+ #pragma omp barrier
+ #pragma omp single
+ #pragma omp taskgroup
+ {
+ int i;
+ for (i = 0; i < 50; i++)
+ #pragma omp task
+ {
+ #pragma omp cancellation point taskgroup
+ usleep (30);
+ #pragma omp cancel taskgroup if (i > 5)
+ }
+ }
+ usleep (10);
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-additional-options "-std=gnu99" {target c } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#define M(x, y, z) O(x, y, z)
+#define O(x, y, z) x ## _ ## y ## _ ## z
+
+#define F parallel for
+#define G pf
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F for
+#define G f
+#include "for-1.h"
+#undef F
+#undef G
+
+int
+main ()
+{
+ if (test_pf_static ()
+ || test_pf_static32 ()
+ || test_pf_auto ()
+ || test_pf_guided32 ()
+ || test_pf_runtime ()
+ || test_f_static ()
+ || test_f_static32 ()
+ || test_f_auto ()
+ || test_f_guided32 ()
+ || test_f_runtime ())
+ abort ();
+ return 0;
+}
--- /dev/null
+#define S
+#define N(x) M(x, G, static)
+#include "for-2.h"
+#undef S
+#undef N
+#define S schedule(static, 32)
+#define N(x) M(x, G, static32)
+#include "for-2.h"
+#undef S
+#undef N
+#define S schedule(auto)
+#define N(x) M(x, G, auto)
+#include "for-2.h"
+#undef S
+#undef N
+#define S schedule(guided, 32)
+#define N(x) M(x, G, guided32)
+#include "for-2.h"
+#undef S
+#undef N
+#define S schedule(runtime)
+#define N(x) M(x, G, runtime)
+#include "for-2.h"
+#undef S
+#undef N
--- /dev/null
+/* { dg-additional-options "-std=gnu99" { target c } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#define M(x, y, z) O(x, y, z)
+#define O(x, y, z) x ## _ ## y ## _ ## z
+
+#define F simd
+#define G simd
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F parallel for simd
+#define G pf_simd
+#include "for-1.h"
+#undef F
+#undef G
+
+#undef SC
+#define SC static
+#define F for simd
+#define G f_simd
+#include "for-1.h"
+#undef F
+#undef G
+#undef SC
+
+int
+main ()
+{
+ if (test_simd_normal ()
+ || test_pf_simd_static ()
+ || test_pf_simd_static32 ()
+ || test_pf_simd_auto ()
+ || test_pf_simd_guided32 ()
+ || test_pf_simd_runtime ()
+ || test_f_simd_static ()
+ || test_f_simd_static32 ()
+ || test_f_simd_auto ()
+ || test_f_simd_guided32 ()
+ || test_f_simd_runtime ())
+ abort ();
+ return 0;
+}
--- /dev/null
+#ifndef VARS
+#define VARS
+int a[1500];
+float b[10][15][10];
+__attribute__((noreturn)) void
+noreturn (void)
+{
+ for (;;);
+}
+#endif
+#ifndef SC
+#define SC
+#endif
+#ifndef OMPTGT
+#define OMPTGT
+#endif
+#ifndef OMPTO
+#define OMPTO(v) do {} while (0)
+#endif
+#ifndef OMPFROM
+#define OMPFROM(v) do {} while (0)
+#endif
+
+__attribute__((noinline, noclone)) void
+N(f0) (void)
+{
+ int i;
+ OMPTGT
+#pragma omp F S
+ for (i = 0; i < 1500; i++)
+ a[i] += 2;
+}
+
+__attribute__((noinline, noclone)) void
+N(f1) (void)
+{
+ OMPTGT
+#pragma omp F S
+ for (unsigned int i = __INT_MAX__; i < 3000U + __INT_MAX__; i += 2)
+ a[(i - __INT_MAX__) >> 1] -= 2;
+}
+
+__attribute__((noinline, noclone)) void
+N(f2) (void)
+{
+ unsigned long long i;
+ OMPTGT
+#pragma omp F S
+ for (i = __LONG_LONG_MAX__ + 4500ULL - 27;
+ i > __LONG_LONG_MAX__ - 27ULL; i -= 3)
+ a[(i + 26LL - __LONG_LONG_MAX__) / 3] -= 4;
+}
+
+__attribute__((noinline, noclone)) void
+N(f3) (long long n1, long long n2, long long s3)
+{
+ OMPTGT
+#pragma omp F S
+ for (long long i = n1 + 23; i > n2 - 25; i -= s3)
+ a[i + 48] += 7;
+}
+
+__attribute__((noinline, noclone)) void
+N(f4) (void)
+{
+ unsigned int i;
+ OMPTGT
+#pragma omp F S
+ for (i = 30; i < 20; i += 2)
+ a[i] += 10;
+}
+
+__attribute__((noinline, noclone)) void
+N(f5) (int n11, int n12, int n21, int n22, int n31, int n32,
+ int s1, int s2, int s3)
+{
+ SC int v1, v2, v3;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (v1 = n11; v1 < n12; v1 += s1)
+ for (v2 = n21; v2 < n22; v2 += s2)
+ for (v3 = n31; v3 < n32; v3 += s3)
+ b[v1][v2][v3] += 2.5;
+}
+
+__attribute__((noinline, noclone)) void
+N(f6) (int n11, int n12, int n21, int n22, long long n31, long long n32,
+ int s1, int s2, long long int s3)
+{
+ SC int v1, v2;
+ SC long long v3;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (v1 = n11; v1 > n12; v1 += s1)
+ for (v2 = n21; v2 > n22; v2 += s2)
+ for (v3 = n31; v3 > n32; v3 += s3)
+ b[v1][v2 / 2][v3] -= 4.5;
+}
+
+__attribute__((noinline, noclone)) void
+N(f7) (void)
+{
+ SC unsigned int v1, v3;
+ SC unsigned long long v2;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (v1 = 0; v1 < 20; v1 += 2)
+ for (v2 = __LONG_LONG_MAX__ + 16ULL;
+ v2 > __LONG_LONG_MAX__ - 29ULL; v2 -= 3)
+ for (v3 = 10; v3 > 0; v3--)
+ b[v1 >> 1][(v2 - __LONG_LONG_MAX__ + 64) / 3 - 12][v3 - 1] += 5.5;
+}
+
+__attribute__((noinline, noclone)) void
+N(f8) (void)
+{
+ SC long long v1, v2, v3;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (v1 = 0; v1 < 20; v1 += 2)
+ for (v2 = 30; v2 < 20; v2++)
+ for (v3 = 10; v3 < 0; v3--)
+ b[v1][v2][v3] += 5.5;
+}
+
+__attribute__((noinline, noclone)) void
+N(f9) (void)
+{
+ int i;
+ OMPTGT
+#pragma omp F S
+ for (i = 20; i < 10; i++)
+ {
+ a[i] += 2;
+ noreturn ();
+ a[i] -= 4;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+N(f10) (void)
+{
+ SC int i;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (i = 0; i < 10; i++)
+ for (int j = 10; j < 8; j++)
+ for (long k = -10; k < 10; k++)
+ {
+ b[i][j][k] += 4;
+ noreturn ();
+ b[i][j][k] -= 8;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+N(f11) (int n)
+{
+ int i;
+ OMPTGT
+#pragma omp F S
+ for (i = 20; i < n; i++)
+ {
+ a[i] += 8;
+ noreturn ();
+ a[i] -= 16;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+N(f12) (int n)
+{
+ SC int i;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (i = 0; i < 10; i++)
+ for (int j = n; j < 8; j++)
+ for (long k = -10; k < 10; k++)
+ {
+ b[i][j][k] += 16;
+ noreturn ();
+ b[i][j][k] -= 32;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+N(f13) (void)
+{
+ int *i;
+ OMPTGT
+#pragma omp F S
+ for (i = a; i < &a[1500]; i++)
+ i[0] += 2;
+}
+
+__attribute__((noinline, noclone)) void
+N(f14) (void)
+{
+ SC float *i;
+ OMPTGT
+#pragma omp F S collapse(3)
+ for (i = &b[0][0][0]; i < &b[0][0][10]; i++)
+ for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)
+ for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)
+ b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1]
+ -= 3.5;
+}
+
+__attribute__((noinline, noclone)) int
+N(test) (void)
+{
+ int i, j, k;
+ for (i = 0; i < 1500; i++)
+ a[i] = i - 25;
+ OMPTO (a);
+ N(f0) ();
+ OMPFROM (a);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 23)
+ return 1;
+ N(f1) ();
+ OMPFROM (a);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 25)
+ return 1;
+ N(f2) ();
+ OMPFROM (a);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 29)
+ return 1;
+ N(f3) (1500LL - 1 - 23 - 48, -1LL + 25 - 48, 1LL);
+ OMPFROM (a);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 22)
+ return 1;
+ N(f3) (1500LL - 1 - 23 - 48, 1500LL - 1, 7LL);
+ OMPFROM (a);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 22)
+ return 1;
+ N(f4) ();
+ OMPFROM (a);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 22)
+ return 1;
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ b[i][j][k] = i - 2.5 + 1.5 * j - 1.5 * k;
+ OMPTO (b);
+ N(f5) (0, 10, 0, 15, 0, 10, 1, 1, 1);
+ OMPFROM (b);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i + 1.5 * j - 1.5 * k)
+ return 1;
+ N(f5) (0, 10, 30, 15, 0, 10, 4, 5, 6);
+ OMPFROM (b);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i + 1.5 * j - 1.5 * k)
+ return 1;
+ N(f6) (9, -1, 29, 0, 9, -1, -1, -2, -1);
+ OMPFROM (b);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i - 4.5 + 1.5 * j - 1.5 * k)
+ return 1;
+ N(f7) ();
+ OMPFROM (b);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k)
+ return 1;
+ N(f8) ();
+ OMPFROM (b);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k)
+ return 1;
+ N(f9) ();
+ N(f10) ();
+ N(f11) (10);
+ N(f12) (12);
+ OMPFROM (a);
+ OMPFROM (b);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 22)
+ return 1;
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k)
+ return 1;
+ N(f13) ();
+ N(f14) ();
+ OMPFROM (a);
+ OMPFROM (b);
+ for (i = 0; i < 1500; i++)
+ if (a[i] != i - 20)
+ return 1;
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
+ for (k = 0; k < 10; k++)
+ if (b[i][j][k] != i - 2.5 + 1.5 * j - 1.5 * k)
+ return 1;
+ return 0;
+}
--- /dev/null
+/* { dg-additional-options "-std=gnu99" { target c } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort ();
+
+#define M(x, y, z) O(x, y, z)
+#define O(x, y, z) x ## _ ## y ## _ ## z
+
+#pragma omp declare target
+
+#define F distribute
+#define G d
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F distribute
+#define G d_ds128
+#define S dist_schedule(static, 128)
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F distribute simd
+#define G ds
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F distribute simd
+#define G ds_ds128
+#define S dist_schedule(static, 128)
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F distribute parallel for
+#define G dpf
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F distribute parallel for dist_schedule(static, 128)
+#define G dpf_ds128
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F distribute parallel for simd
+#define G dpfs
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F distribute parallel for simd dist_schedule(static, 128)
+#define G dpfs_ds128
+#include "for-1.h"
+#undef F
+#undef G
+
+#pragma omp end declare target
+
+int
+main ()
+{
+ int err = 0;
+ #pragma omp target teams reduction(|:err)
+ {
+ err |= test_d_normal ();
+ err |= test_d_ds128_normal ();
+ err |= test_ds_normal ();
+ err |= test_ds_ds128_normal ();
+ err |= test_dpf_static ();
+ err |= test_dpf_static32 ();
+ err |= test_dpf_auto ();
+ err |= test_dpf_guided32 ();
+ err |= test_dpf_runtime ();
+ err |= test_dpf_ds128_static ();
+ err |= test_dpf_ds128_static32 ();
+ err |= test_dpf_ds128_auto ();
+ err |= test_dpf_ds128_guided32 ();
+ err |= test_dpf_ds128_runtime ();
+ err |= test_dpfs_static ();
+ err |= test_dpfs_static32 ();
+ err |= test_dpfs_auto ();
+ err |= test_dpfs_guided32 ();
+ err |= test_dpfs_runtime ();
+ err |= test_dpfs_ds128_static ();
+ err |= test_dpfs_ds128_static32 ();
+ err |= test_dpfs_ds128_auto ();
+ err |= test_dpfs_ds128_guided32 ();
+ err |= test_dpfs_ds128_runtime ();
+ }
+ if (err)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-options "-std=gnu99" { target c } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#define M(x, y, z) O(x, y, z)
+#define O(x, y, z) x ## _ ## y ## _ ## z
+
+#define F taskloop
+#define G taskloop
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F taskloop simd
+#define G taskloop_simd
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+int
+main ()
+{
+ int err = 0;
+ #pragma omp parallel reduction(|:err)
+ #pragma omp single
+ {
+ if (test_taskloop_normal ()
+ || test_taskloop_simd_normal ())
+ err = 1;
+ }
+ if (err)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-additional-options "-std=gnu99" { target c } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort ();
+
+#define M(x, y, z) O(x, y, z)
+#define O(x, y, z) x ## _ ## y ## _ ## z
+
+#pragma omp declare target
+
+#define F for
+#define G f
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#pragma omp end declare target
+
+#undef OMPFROM
+#undef OMPTO
+#define DO_PRAGMA(x) _Pragma (#x)
+#define OMPFROM(v) DO_PRAGMA (omp target update from(v))
+#define OMPTO(v) DO_PRAGMA (omp target update to(v))
+
+#define F target parallel for
+#define G tpf
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F target simd
+#define G t_simd
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F target parallel for simd
+#define G tpf_simd
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F target teams distribute
+#define G ttd
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F target teams distribute
+#define G ttd_ds128
+#define S dist_schedule(static, 128)
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F target teams distribute simd
+#define G ttds
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F target teams distribute simd
+#define G ttds_ds128
+#define S dist_schedule(static, 128)
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F target teams distribute parallel for
+#define G ttdpf
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F target teams distribute parallel for dist_schedule(static, 128)
+#define G ttdpf_ds128
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F target teams distribute parallel for simd
+#define G ttdpfs
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F target teams distribute parallel for simd dist_schedule(static, 128)
+#define G ttdpfs_ds128
+#include "for-1.h"
+#undef F
+#undef G
+
+int
+main ()
+{
+ if (test_tpf_static ()
+ || test_tpf_static32 ()
+ || test_tpf_auto ()
+ || test_tpf_guided32 ()
+ || test_tpf_runtime ()
+ || test_t_simd_normal ()
+ || test_tpf_simd_static ()
+ || test_tpf_simd_static32 ()
+ || test_tpf_simd_auto ()
+ || test_tpf_simd_guided32 ()
+ || test_tpf_simd_runtime ()
+ || test_ttd_normal ()
+ || test_ttd_ds128_normal ()
+ || test_ttds_normal ()
+ || test_ttds_ds128_normal ()
+ || test_ttdpf_static ()
+ || test_ttdpf_static32 ()
+ || test_ttdpf_auto ()
+ || test_ttdpf_guided32 ()
+ || test_ttdpf_runtime ()
+ || test_ttdpf_ds128_static ()
+ || test_ttdpf_ds128_static32 ()
+ || test_ttdpf_ds128_auto ()
+ || test_ttdpf_ds128_guided32 ()
+ || test_ttdpf_ds128_runtime ()
+ || test_ttdpfs_static ()
+ || test_ttdpfs_static32 ()
+ || test_ttdpfs_auto ()
+ || test_ttdpfs_guided32 ()
+ || test_ttdpfs_runtime ()
+ || test_ttdpfs_ds128_static ()
+ || test_ttdpfs_ds128_static32 ()
+ || test_ttdpfs_ds128_auto ()
+ || test_ttdpfs_ds128_guided32 ()
+ || test_ttdpfs_ds128_runtime ())
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-additional-options "-std=gnu99" { target c } } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort ();
+
+#define M(x, y, z) O(x, y, z)
+#define O(x, y, z) x ## _ ## y ## _ ## z
+
+#pragma omp declare target
+
+#define F for
+#define G f
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#pragma omp end declare target
+
+#undef OMPTGT
+#undef OMPFROM
+#undef OMPTO
+#define DO_PRAGMA(x) _Pragma (#x)
+#define OMPTGT DO_PRAGMA (omp target)
+#define OMPFROM(v) DO_PRAGMA (omp target update from(v))
+#define OMPTO(v) DO_PRAGMA (omp target update to(v))
+
+#define F teams distribute
+#define G td
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F teams distribute
+#define G td_ds128
+#define S dist_schedule(static, 128)
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F teams distribute simd
+#define G tds
+#define S
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F teams distribute simd
+#define G tds_ds128
+#define S dist_schedule(static, 128)
+#define N(x) M(x, G, normal)
+#include "for-2.h"
+#undef S
+#undef N
+#undef F
+#undef G
+
+#define F teams distribute parallel for
+#define G tdpf
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F teams distribute parallel for dist_schedule(static, 128)
+#define G tdpf_ds128
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F teams distribute parallel for simd
+#define G tdpfs
+#include "for-1.h"
+#undef F
+#undef G
+
+#define F teams distribute parallel for simd dist_schedule(static, 128)
+#define G tdpfs_ds128
+#include "for-1.h"
+#undef F
+#undef G
+
+int
+main ()
+{
+ if (test_td_normal ()
+ || test_td_ds128_normal ()
+ || test_tds_normal ()
+ || test_tds_ds128_normal ()
+ || test_tdpf_static ()
+ || test_tdpf_static32 ()
+ || test_tdpf_auto ()
+ || test_tdpf_guided32 ()
+ || test_tdpf_runtime ()
+ || test_tdpf_ds128_static ()
+ || test_tdpf_ds128_static32 ()
+ || test_tdpf_ds128_auto ()
+ || test_tdpf_ds128_guided32 ()
+ || test_tdpf_ds128_runtime ()
+ || test_tdpfs_static ()
+ || test_tdpfs_static32 ()
+ || test_tdpfs_auto ()
+ || test_tdpfs_guided32 ()
+ || test_tdpfs_runtime ()
+ || test_tdpfs_ds128_static ()
+ || test_tdpfs_ds128_static32 ()
+ || test_tdpfs_ds128_auto ()
+ || test_tdpfs_ds128_guided32 ()
+ || test_tdpfs_ds128_runtime ())
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+volatile int ji = 100, ki = 2;
+volatile unsigned int ju = 100, ku = 2;
+volatile long long int jll = 100, kll = 2;
+volatile unsigned long long int jull = 100, kull = 2;
+unsigned long long l;
+
+void
+f0 (void)
+{
+ int i, j, k;
+ unsigned int j2, k2;
+ #pragma omp for reduction(+: l)
+ for (i = ji; i < ki; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l)
+ for (i = ji; i < ki; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ji; i < ki; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ji; i < ki; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = ki + 10; k < ji - 10; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = ki + 10; j < ji - 10; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f1 (void)
+{
+ unsigned int i, j, k;
+ int j2, k2;
+ #pragma omp for reduction(+: l)
+ for (i = ju; i < ku; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l)
+ for (i = ju; i < ku; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ju; i < ku; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ju; i < ku; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = ku; k < ju; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = ku; j < ju; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f2 (void)
+{
+ long long int i, j, k;
+ unsigned long long int j2, k2;
+ #pragma omp for reduction(+: l)
+ for (i = jll; i < kll; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l)
+ for (i = jll; i < kll; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jll; i < kll; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jll; i < kll; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = kll; k < jll; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = kll; j < jll; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f3 (void)
+{
+ unsigned long long int i, j, k;
+ long long int j2, k2;
+ #pragma omp for reduction(+: l)
+ for (i = jull; i < kull; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l)
+ for (i = jull; i < kull; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jull; i < kull; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jull; i < kull; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = kull; k < jull; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3)
+ for (j = kull; j < jull; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ f0 ();
+ f1 ();
+ f2 ();
+ f3 ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+volatile int ji = 100, ki = 2;
+volatile unsigned int ju = 100, ku = 2;
+volatile long long int jll = 100, kll = 2;
+volatile unsigned long long int jull = 100, kull = 2;
+unsigned long long l;
+
+void
+f0 (void)
+{
+ int i, j, k;
+ unsigned int j2, k2;
+ #pragma omp for reduction(+: l) schedule(static, 2)
+ for (i = ji; i < ki; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(static, 2)
+ for (i = ji; i < ki; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ji; i < ki; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ji; i < ki; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = ki + 10; k < ji - 10; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = ki + 10; j < ji - 10; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f1 (void)
+{
+ unsigned int i, j, k;
+ int j2, k2;
+ #pragma omp for reduction(+: l) schedule(static, 2)
+ for (i = ju; i < ku; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(static, 2)
+ for (i = ju; i < ku; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ju; i < ku; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ju; i < ku; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = ku; k < ju; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = ku; j < ju; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f2 (void)
+{
+ long long int i, j, k;
+ unsigned long long int j2, k2;
+ #pragma omp for reduction(+: l) schedule(static, 2)
+ for (i = jll; i < kll; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(static, 2)
+ for (i = jll; i < kll; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jll; i < kll; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jll; i < kll; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = kll; k < jll; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = kll; j < jll; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f3 (void)
+{
+ unsigned long long int i, j, k;
+ long long int j2, k2;
+ #pragma omp for reduction(+: l) schedule(static, 2)
+ for (i = jull; i < kull; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(static, 2)
+ for (i = jull; i < kull; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jull; i < kull; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jull; i < kull; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = kull; k < jull; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
+ for (j = kull; j < jull; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ f0 ();
+ f1 ();
+ f2 ();
+ f3 ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+volatile int ji = 100, ki = 2;
+volatile unsigned int ju = 100, ku = 2;
+volatile long long int jll = 100, kll = 2;
+volatile unsigned long long int jull = 100, kull = 2;
+unsigned long long l;
+
+void
+f0 (void)
+{
+ int i, j, k;
+ unsigned int j2, k2;
+ #pragma omp for reduction(+: l) schedule(runtime)
+ for (i = ji; i < ki; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(runtime)
+ for (i = ji; i < ki; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ji; i < ki; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ji; i < ki; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = ji; i < ki; i++)
+ for (k = ki + 10; k < ji - 10; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = ki + 10; j < ji - 10; j++)
+ for (i = ji; i < ki; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f1 (void)
+{
+ unsigned int i, j, k;
+ int j2, k2;
+ #pragma omp for reduction(+: l) schedule(runtime)
+ for (i = ju; i < ku; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(runtime)
+ for (i = ju; i < ku; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ju; i < ku; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = ju; i < ku; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = ju; i < ku; i++)
+ for (k = ku; k < ju; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = ku; j < ju; j++)
+ for (i = ju; i < ku; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f2 (void)
+{
+ long long int i, j, k;
+ unsigned long long int j2, k2;
+ #pragma omp for reduction(+: l) schedule(runtime)
+ for (i = jll; i < kll; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(runtime)
+ for (i = jll; i < kll; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jll; i < kll; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jll; i < kll; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = jll; i < kll; i++)
+ for (k = kll; k < jll; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = kll; j < jll; j++)
+ for (i = jll; i < kll; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+void
+f3 (void)
+{
+ unsigned long long int i, j, k;
+ long long int j2, k2;
+ #pragma omp for reduction(+: l) schedule(runtime)
+ for (i = jull; i < kull; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) schedule(runtime)
+ for (i = jull; i < kull; i++)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jull; i < kull; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j2 = 0; j2 < 4; j2++)
+ for (i = jull; i < kull; i++)
+ for (k2 = 0; k2 < 5; k2 += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = 0; j < 4; j++)
+ for (i = jull; i < kull; i++)
+ for (k = kull; k < jull; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+ #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
+ for (j = kull; j < jull; j++)
+ for (i = jull; i < kull; i++)
+ for (k = 0; k < 5; k += 2)
+ l++;
+ if (l != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ f0 ();
+ f1 ();
+ f2 ();
+ f3 ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#ifndef MONOTONIC_TYPE
+#include <omp.h>
+#include <stdlib.h>
+#define MONOTONIC_TYPE int
+#define MONOTONIC_UNDEF -1
+#define MONOTONIC_END(n) n
+#endif
+
+int
+main ()
+{
+ MONOTONIC_TYPE i;
+ #pragma omp parallel
+ {
+ int cnt = omp_get_num_threads ();
+ int thr = omp_get_thread_num ();
+ MONOTONIC_TYPE l = MONOTONIC_UNDEF;
+ int c = 0;
+ int n = 0;
+ #pragma omp for nowait schedule(static, 5)
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ {
+ if (l >= i)
+ abort ();
+ if (cnt == 1)
+ abort ();
+ if (n != 5)
+ abort ();
+ n = 1;
+ c++;
+ }
+ if (n == 1)
+ {
+ if ((i % 5) != 0)
+ abort ();
+ if ((i / 5) % cnt != thr)
+ abort ();
+ }
+ l = i;
+ }
+ if (cnt == 1)
+ {
+ if (n != 73 || l != 73 - 1 || c != 1)
+ abort ();
+ }
+ else if (thr > 73 / 5)
+ {
+ if (l != MONOTONIC_UNDEF || c != 0 || n != 0)
+ abort ();
+ }
+ else if (thr == 73 / 5)
+ {
+ if (l != 73 - 1 || c != 1 || n != 73 % 5)
+ abort ();
+ }
+ else if (c == 0)
+ abort ();
+ else if (l == 73 - 1)
+ {
+ if (thr != (73 / 5) % cnt || n != 73 % 5)
+ abort ();
+ }
+ else if ((n % 5) != 0)
+ abort ();
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for schedule( monotonic: static, 7) nowait
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ {
+ if (l >= i)
+ abort ();
+ if (cnt == 1)
+ abort ();
+ if (n != 7)
+ abort ();
+ n = 1;
+ c++;
+ }
+ if (n == 1)
+ {
+ if ((i % 7) != 0)
+ abort ();
+ if ((i / 7) % cnt != thr)
+ abort ();
+ }
+ l = i;
+ }
+ if (cnt == 1)
+ {
+ if (n != 73 || l != 73 - 1 || c != 1)
+ abort ();
+ }
+ else if (thr > 73 / 7)
+ {
+ if (l != MONOTONIC_UNDEF || c != 0 || n != 0)
+ abort ();
+ }
+ else if (thr == 73 / 7)
+ {
+ if (l != 73 - 1 || c != 1 || n != 73 % 7)
+ abort ();
+ }
+ else if (c == 0)
+ abort ();
+ else if (l == 73 - 1)
+ {
+ if (thr != (73 / 7) % cnt || n != 73 % 7)
+ abort ();
+ }
+ else if ((n % 7) != 0)
+ abort ();
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for nowait schedule(static)
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ abort ();
+ l = i;
+ }
+ if (c > 1)
+ abort ();
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for nowait schedule(monotonic,simd:static)
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ abort ();
+ l = i;
+ }
+ if (c > 1)
+ abort ();
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for schedule(monotonic : dynamic, 5) nowait
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ {
+ if (l >= i)
+ abort ();
+ if ((n % 5) != 0 || n == 0)
+ abort ();
+ n = 1;
+ c++;
+ }
+ l = i;
+ }
+ if (l == 73 - 1)
+ {
+ if (n % 5 != 73 % 5)
+ abort ();
+ }
+ else if (l == MONOTONIC_UNDEF)
+ {
+ if (n != 0 || c != 0)
+ abort ();
+ }
+ else if ((n % 5) != 0 || n == 0)
+ abort ();
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for nowait schedule(dynamic, 7) ordered(1)
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ {
+ if (l >= i)
+ abort ();
+ if ((n % 7) != 0 || n == 0)
+ abort ();
+ n = 1;
+ c++;
+ }
+ #pragma omp ordered depend(source)
+ if (MONOTONIC_UNDEF > 0)
+ {
+ #pragma omp ordered depend(sink: i)
+ }
+ else
+ {
+ #pragma omp ordered depend(sink: i - 1)
+ }
+ l = i;
+ }
+ if (l == 73 - 1)
+ {
+ if (n % 7 != 73 % 7)
+ abort ();
+ }
+ else if (l == MONOTONIC_UNDEF)
+ {
+ if (n != 0 || c != 0)
+ abort ();
+ }
+ else if ((n % 7) != 0 || n == 0)
+ abort ();
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for schedule (monotonic :guided , 7) nowait
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ {
+ if (l >= i)
+ abort ();
+ if (n < 7)
+ abort ();
+ n = 1;
+ c++;
+ }
+ l = i;
+ }
+ l = MONOTONIC_UNDEF;
+ c = 0;
+ n = 0;
+ #pragma omp for nowait schedule(guided, 7) ordered
+ for (i = 0; i < MONOTONIC_END (73); i++)
+ {
+ if (l == MONOTONIC_UNDEF)
+ {
+ n = 1;
+ c++;
+ }
+ else if (l == i - 1)
+ n++;
+ else
+ {
+ if (l >= i)
+ abort ();
+ if (n < 7)
+ abort ();
+ n = 1;
+ c++;
+ }
+ #pragma omp ordered
+ l = i;
+ }
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+#define MONOTONIC_TYPE unsigned long long
+#define MONOTONIC_UNDEF -1ULL
+#define MONOTONIC_END(n) n + v
+
+volatile int v;
+
+#include "monotonic-1.c"
--- /dev/null
+/* { dg-do run } */
+
+#ifndef NONMONOTONIC_TYPE
+#include <omp.h>
+#include <stdlib.h>
+#define NONMONOTONIC_TYPE int
+#define NONMONOTONIC_END(n) n
+#endif
+
+int a[73];
+
+int
+main ()
+{
+ NONMONOTONIC_TYPE i;
+ #pragma omp parallel for schedule(nonmonotonic: dynamic)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp parallel for schedule(nonmonotonic: dynamic, 5)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp parallel for schedule(nonmonotonic: guided)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp parallel for schedule(nonmonotonic: guided, 7)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp parallel
+ {
+ int cnt = omp_get_num_threads ();
+ int thr = omp_get_thread_num ();
+ if (thr < 73)
+ a[thr]++;
+ #pragma omp barrier
+ #pragma omp for schedule(nonmonotonic: dynamic)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp for schedule(nonmonotonic: dynamic, 7)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp for schedule(nonmonotonic: guided)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp for schedule(nonmonotonic: guided, 5)
+ for (i = 0; i < NONMONOTONIC_END (73); i++)
+ a[i]++;
+ #pragma omp single private (i)
+ for (i = 0; i < 73; i++)
+ if (a[i] != 8 + (i < cnt))
+ abort ();
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+#define NONMONOTONIC_TYPE unsigned long long
+#define NONMONOTONIC_END(n) n + v
+
+volatile int v;
+
+#include "nonmonotonic-1.c"
--- /dev/null
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+void
+foo (int i, char *j)
+{
+ #pragma omp atomic
+ j[i]++;
+ #pragma omp ordered threads
+ {
+ int t;
+ #pragma omp atomic read
+ t = j[i];
+ if (t != 3)
+ abort ();
+ if (i > 1)
+ {
+ #pragma omp atomic read
+ t = j[i - 1];
+ if (t == 2)
+ abort ();
+ }
+ if (i < 127)
+ {
+ #pragma omp atomic read
+ t = j[i + 1];
+ if (t == 4)
+ abort ();
+ }
+ }
+ #pragma omp atomic
+ j[i]++;
+}
+
+int
+main ()
+{
+ int i;
+ char j[128];
+ #pragma omp parallel
+ {
+ #pragma omp for
+ for (i = 0; i < 128; i++)
+ j[i] = 0;
+ #pragma omp for ordered schedule(dynamic, 1)
+ for (i = 0; i < 128; i++)
+ {
+ #pragma omp atomic
+ j[i]++;
+ #pragma omp ordered threads
+ {
+ int t;
+ #pragma omp atomic read
+ t = j[i];
+ if (t != 1)
+ abort ();
+ if (i > 1)
+ {
+ #pragma omp atomic read
+ t = j[i - 1];
+ if (t == 0)
+ abort ();
+ }
+ if (i < 127)
+ {
+ #pragma omp atomic read
+ t = j[i + 1];
+ if (t == 2)
+ abort ();
+ }
+ }
+ #pragma omp atomic
+ j[i]++;
+ }
+ #pragma omp for ordered schedule(static, 1)
+ for (i = 0; i < 128; i++)
+ foo (i, j);
+ }
+ return 0;
+}
--- /dev/null
+/* PR c/45784 */
+/* { dg-do run } */
+
+void
+foo (int n)
+{
+ char *p, vla[2 * n];
+ int i;
+ #pragma omp parallel for
+ for (p = vla; p < vla + (sizeof (vla) / sizeof (vla[0])); p++)
+ *p = ' ';
+ #pragma omp parallel for
+ for (i = 0; i < 2 * n; i++)
+ if (vla[i] != ' ')
+ __builtin_abort ();
+}
+
+void
+bar (int n)
+{
+ char *p, vla1[n], vla2[n * 2], vla3[n * 3], vla4[n * 4];
+ int i;
+ __builtin_memset (vla4, ' ', n * 4);
+ #pragma omp parallel for
+ for (p = vla4 + sizeof (vla1); p < vla4 + sizeof (vla3) - sizeof (vla2) + sizeof (vla1); p += sizeof (vla4) / sizeof (vla4))
+ p[0] = '!';
+ #pragma omp parallel for
+ for (i = 0; i < n * 4; i++)
+ if (vla4[i] != ((i >= n && i < 2 * n) ? '!' : ' '))
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ volatile int n;
+ n = 128;
+ foo (n);
+ bar (n);
+ return 0;
+}
--- /dev/null
+/* PR c/64824 */
+/* { dg-do run } */
+
+int
+main ()
+{
+ long long a;
+ long long b = 1LL;
+ int c = 3;
+#pragma omp atomic capture
+ a = b = c << b;
+ if (b != 6LL || a != 6LL)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR c/64868 */
+/* { dg-do run } */
+
+float f = 2.0f;
+double d = 4.0;
+long double ld = 8.0L;
+
+void
+foo ()
+{
+#pragma omp atomic
+ f = 1.0f / f;
+#pragma omp atomic
+ f = 1 / f;
+#pragma omp atomic
+ f = f / 2.0f;
+#pragma omp atomic
+ f = f / 2;
+#pragma omp atomic
+ f /= 2.0f;
+#pragma omp atomic
+ f /= 2;
+#pragma omp atomic
+ d = 1.0 / d;
+#pragma omp atomic
+ d = 1 / d;
+#pragma omp atomic
+ d = d / 2.0;
+#pragma omp atomic
+ d = d / 2;
+#pragma omp atomic
+ d /= 2.0;
+#pragma omp atomic
+ d /= 2;
+#pragma omp atomic
+ ld = 1.0L / ld;
+#pragma omp atomic
+ ld = 1 / ld;
+#pragma omp atomic
+ ld = ld / 2.0L;
+#pragma omp atomic
+ ld = ld / 2;
+#pragma omp atomic
+ ld /= 2.0L;
+#pragma omp atomic
+ ld /= 2;
+ if (f != 0.125f || d != 0.25 || ld != 0.5L)
+ __builtin_abort ();
+}
+
+#ifdef __cplusplus
+template <typename T, int N1, int N2>
+void
+bar ()
+{
+ T v = ::d;
+#pragma omp atomic
+ v *= 16;
+#pragma omp atomic
+ v = 1.0 / v;
+#pragma omp atomic
+ v = N1 / v;
+#pragma omp atomic
+ v = v / 2.0;
+#pragma omp atomic
+ v = v / N2;
+#pragma omp atomic
+ v /= 2.0;
+#pragma omp atomic
+ v /= N2;
+ if (v != 0.25)
+ __builtin_abort ();
+}
+#endif
+
+int
+main ()
+{
+ foo ();
+#ifdef __cplusplus
+ bar<float, 1, 2> ();
+ bar<double, 1, 2> ();
+ bar<long double, 1, 2> ();
+#endif
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+
+int u[1024], v[1024], w[1024];
+
+__attribute__((noinline, noclone)) long
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+ return d;
+}
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ c += 5;
+ e = c;
+ }
+ return d + c + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+__attribute__((noinline, noclone)) long
+f4 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f1 (0, 1024) != 1024
+ || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024)
+ || f3 (0, 32, 0, 32) != 64
+ || f4 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) void
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+}
+
+__attribute__((noinline, noclone)) void
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+}
+
+__attribute__((noinline, noclone)) void
+f4 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+}
+
+int
+main ()
+{
+ f1 (0, 1024);
+ f2 (0, 1024, 17);
+ f3 (0, 32, 0, 32);
+ f4 (0, 32, 0, 32);
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+/* { dg-options "-O2" { target c } } */
+
+int u[1024], v[1024], w[1024];
+
+__attribute__((noinline, noclone)) long
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+ return d;
+}
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) linear(c:5) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ c += 5;
+ e = c;
+ }
+ return d + c + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f1 (0, 1024) != 1024
+ || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024)
+ || f3 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+/* { dg-options "-O2" { target c } } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) void
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp target teams distribute parallel for default(none) firstprivate (a, b) shared(u, v, w)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+}
+
+__attribute__((noinline, noclone)) void
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+}
+
+__attribute__((noinline, noclone)) void
+f4 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+}
+
+int
+main ()
+{
+ f1 (0, 1024);
+ f2 (0, 1024, 17);
+ f3 (0, 32, 0, 32);
+ f4 (0, 32, 0, 32);
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) long
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp target map(from: d)
+ #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+ return d;
+}
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target map(from: d, e)
+ #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+ return d + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+__attribute__((noinline, noclone)) long
+f4 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f1 (0, 1024) != 1024
+ || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
+ || f3 (0, 32, 0, 32) != 64
+ || f4 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+/* { dg-options "-O2" { target c } } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target map(from: d, e)
+ #pragma omp teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+ return d + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
+ || f3 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) long
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp target map(from: d)
+ #pragma omp teams distribute simd default(none) firstprivate (a, b) shared(u, v, w)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+ return d;
+}
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target map(from: d, e)
+ #pragma omp teams distribute simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+ return d + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+__attribute__((noinline, noclone)) long
+f4 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f1 (0, 1024) != 1024
+ || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
+ || f3 (0, 32, 0, 32) != 64
+ || f4 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) long
+f1 (long a, long b)
+{
+ long d;
+ #pragma omp target map(from: d)
+ #pragma omp teams default(none) shared(a, b, d, u, v, w)
+ #pragma omp distribute simd firstprivate (a, b)
+ for (d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+ return d;
+}
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target map(from: d, e)
+ #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w)
+ #pragma omp distribute simd linear(d) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+ return d + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w)
+ #pragma omp distribute simd firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+__attribute__((noinline, noclone)) long
+f4 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams default(none) firstprivate (a1, b1, a2, b2) shared(d1, d2, u, v, w)
+ #pragma omp distribute simd collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f1 (0, 1024) != 1024
+ || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
+ || f3 (0, 32, 0, 32) != 64
+ || f4 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/66199 */
+/* { dg-do run } */
+
+#pragma omp declare target
+int u[1024], v[1024], w[1024];
+#pragma omp end declare target
+
+__attribute__((noinline, noclone)) long
+f2 (long a, long b, long c)
+{
+ long d, e;
+ #pragma omp target map(from: d, e)
+ #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w)
+ #pragma omp distribute lastprivate(d, e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ e = c + d * 5;
+ }
+ return d + e;
+}
+
+__attribute__((noinline, noclone)) long
+f3 (long a1, long b1, long a2, long b2)
+{
+ long d1, d2;
+ #pragma omp target map(from: d1, d2)
+ #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w)
+ #pragma omp distribute firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2)
+ for (d1 = a1; d1 < b1; d1++)
+ for (d2 = a2; d2 < b2; d2++)
+ u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
+ return d1 + d2;
+}
+
+int
+main ()
+{
+ if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
+ || f3 (0, 32, 0, 32) != 64)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR c/69389 */
+
+struct S { unsigned int a : 10; unsigned int b : 4; unsigned int c : 18; } s = { 210, 11, 1235 };
+
+unsigned int
+f1 (void)
+{
+ unsigned int v;
+ #pragma omp atomic read
+ v = s.b;
+ return v;
+}
+
+void
+f2 (unsigned int v)
+{
+ #pragma omp atomic write
+ s.b = v;
+}
+
+void
+f3 (void)
+{
+ #pragma omp atomic
+ s.b |= 1;
+}
+
+int
+f4 (void)
+{
+ int v;
+ #pragma omp atomic capture
+ v = s.b += 8;
+ return v;
+}
+
+int
+f5 (void)
+{
+ int v;
+ #pragma omp atomic capture
+ {
+ v = s.b;
+ s.b -= 4;
+ }
+ return v;
+}
+
+void
+f6 (void)
+{
+ #pragma omp atomic
+ s.b = s.b & 7;
+}
+
+void
+f7 (void)
+{
+ #pragma omp atomic
+ s.b = ~7 & s.b;
+}
+
+int
+f8 (void)
+{
+ int v;
+ #pragma omp atomic capture
+ v = s.b = 8 + s.b;
+ return v;
+}
+
+int
+f9 (void)
+{
+ int v;
+ #pragma omp atomic capture
+ {
+ v = s.b;
+ s.b = s.b - 4;
+ }
+ return v;
+}
+
+int
+main ()
+{
+ if (f1 () != 11)
+ __builtin_abort ();
+ f2 (4);
+ if (s.a != 210 || s.b != 4 || s.c != 1235)
+ __builtin_abort ();
+ s.a = 813;
+ s.c = 31532;
+ if (f1 () != 4)
+ __builtin_abort ();
+ f3 ();
+ if (f1 () != 5)
+ __builtin_abort ();
+ if (s.a != 813 || s.b != 5 || s.c != 31532)
+ __builtin_abort ();
+ if (f4 () != 13)
+ __builtin_abort ();
+ if (f1 () != 13)
+ __builtin_abort ();
+ f2 (14);
+ if (s.a != 813 || s.b != 14 || s.c != 31532)
+ __builtin_abort ();
+ if (f5 () != 14)
+ __builtin_abort ();
+ if (f1 () != 10 || s.a != 813 || s.b != 10 || s.c != 31532)
+ __builtin_abort ();
+ f6 ();
+ if (f1 () != 2)
+ __builtin_abort ();
+ f2 (15);
+ f7 ();
+ if (f1 () != 8)
+ __builtin_abort ();
+ if (f8 () != 0 || s.a != 813 || s.b != 0 || s.c != 31532)
+ __builtin_abort ();
+ if (f9 () != 0 || s.a != 813 || s.b != 12 || s.c != 31532)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+int
+main ()
+{
+ int i, j, b, c = 0;
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ b = b + 2;
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ b = b + 3;
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(i) linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ b = b + 2;
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(i:4) linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ b = b + 3;
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ b = b + 2;
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ b = b + 2;
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ b = b + 2;
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ b = b + 3;
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ b = b + 2;
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ b = b + 3;
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ b = b + 2;
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ b = b + 2;
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+static inline void
+foo (int *b, int *i, int *j, int x)
+{
+ *b = *b + x + (*i - *i) + (*j - *j);
+}
+
+int
+main ()
+{
+ int i, j, b, c = 0;
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ foo (&b, &i, &j, 3);
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(i) linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd linear(i:4) linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ foo (&b, &i, &j, 3);
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ foo (&b, &i, &j, 3);
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
+ for (i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 64 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
+ for (i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ foo (&b, &i, &j, 3);
+ }
+ if (c || i != 64 || b != 7 + 16 * 3)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ i = 4; j = 4; b = 7;
+ #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+/* { dg-additional-options "-std=c99" {target c } } */
+
+int
+main ()
+{
+ int b, c = 0;
+ b = 7;
+ #pragma omp simd linear(b:2) reduction(+:c)
+ for (int i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ b = b + 2;
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp simd linear(b:3) reduction(+:c)
+ for (int i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ b = b + 3;
+ }
+ if (c || b != 7 + 16 * 3)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ b = b + 2;
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
+ for (int i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ b = b + 2;
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
+ for (int i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ b = b + 3;
+ }
+ if (c || b != 7 + 16 * 3)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ b = b + 2;
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+static inline void
+foo (int *b, int *i, int *j, int x)
+{
+ *b = *b + x + (*i - *i) + (*j - *j);
+}
+
+int
+main ()
+{
+ int b, c = 0;
+ b = 7;
+ #pragma omp simd linear(b:2) reduction(+:c)
+ for (int i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ foo (&b, &i, &i, 2);
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp simd linear(b:3) reduction(+:c)
+ for (int i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ foo (&b, &i, &i, 3);
+ }
+ if (c || b != 7 + 16 * 3)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
+ for (int i = 0; i < 64; i++)
+ {
+ c = c + (b != 7 + 2 * i);
+ foo (&b, &i, &i, 2);
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
+ for (int i = 0; i < 64; i += 4)
+ {
+ c = c + (b != 7 + i / 4 * 3);
+ foo (&b, &i, &i, 3);
+ }
+ if (c || b != 7 + 16 * 3)
+ __builtin_abort ();
+ b = 7;
+ #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ {
+ c = c + (b != 7 + 2 * j + 2 * 8 * i);
+ foo (&b, &i, &j, 2);
+ }
+ if (c || b != 7 + 64 * 2)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+void
+fn1 (double *x, double *y, int z)
+{
+ int i;
+ for (i = 0; i < z; i++)
+ {
+ x[i] = i & 31;
+ y[i] = (i & 63) - 30;
+ }
+}
+
+#pragma omp declare target
+int tgtv = 6;
+int
+tgt (void)
+{
+ #pragma omp atomic update
+ tgtv++;
+ return 0;
+}
+#pragma omp end declare target
+
+double
+fn2 (int x, int y, int z)
+{
+ double b[1024], c[1024], s = 0;
+ int i, j;
+ fn1 (b, c, x);
+ #pragma omp target data map(to: b)
+ {
+ #pragma omp target map(tofrom: c, s)
+ #pragma omp teams num_teams(y) thread_limit(z) reduction(+:s) firstprivate(x)
+ #pragma omp distribute dist_schedule(static, 4) collapse(1)
+ for (j=0; j < x; j += y)
+ #pragma omp parallel for reduction(+:s)
+ for (i = j; i < j + y; i++)
+ tgt (), s += b[i] * c[i];
+ #pragma omp target update from(b, tgtv)
+ }
+ return s;
+}
+
+double
+fn3 (int x)
+{
+ double b[1024], c[1024], s = 0;
+ int i;
+ fn1 (b, c, x);
+ #pragma omp target map(to: b, c) map(tofrom:s)
+ #pragma omp parallel for reduction(+:s)
+ for (i = 0; i < x; i++)
+ tgt (), s += b[i] * c[i];
+ return s;
+}
+
+double
+fn4 (int x, double *p)
+{
+ double b[1024], c[1024], d[1024], s = 0;
+ int i;
+ fn1 (b, c, x);
+ fn1 (d + x, p + x, x);
+ #pragma omp target map(to: b, c[0:x], d[x:x]) map(to:p[x:64 + (x & 31)]) \
+ map(tofrom: s)
+ #pragma omp parallel for reduction(+:s)
+ for (i = 0; i < x; i++)
+ s += b[i] * c[i] + d[x + i] + p[x + i];
+ return s;
+}
+
+int
+main ()
+{
+ double a = fn2 (128, 4, 6);
+ int b = tgtv;
+ double c = fn3 (61);
+ #pragma omp target update from(tgtv)
+ int d = tgtv;
+ double e[1024];
+ double f = fn4 (64, e);
+ if (a != 13888.0 || b != 6 + 128 || c != 4062.0 || d != 6 + 128 + 61
+ || f != 8032.0)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#pragma omp declare target
+extern int v;
+#pragma omp end declare target
+
+int v;
+
+int
+main ()
+{
+ #pragma omp target update to(v)
+ return 0;
+}
--- /dev/null
+#ifdef __cplusplus
+extern "C"
+#else
+extern
+#endif
+void abort (void);
+struct S { int s, t; };
+
+void
+foo ()
+{
+ int x = 5, y = 6, err = 0;
+ struct S u = { 7, 8 }, v = { 9, 10 };
+ double s = 11.5, t = 12.5;
+ #pragma omp target private (x, u, s) firstprivate (y, v, t) map(from:err)
+ {
+ x = y;
+ u = v;
+ s = t;
+ err = (x != 6 || y != 6
+ || u.s != 9 || u.t != 10 || v.s != 9 || v.t != 10
+ || s != 12.5 || t != 12.5);
+ x += 1;
+ y += 2;
+ u.s += 3;
+ v.t += 4;
+ s += 2.5;
+ t += 3.0;
+ if (x != 7 || y != 8
+ || u.s != 12 || u.t != 10 || v.s != 9 || v.t != 14
+ || s != 15.0 || t != 15.5)
+ err = 1;
+ }
+ if (err || x != 5 || y != 6
+ || u.s != 7 || u.t != 8 || v.s != 9 || v.t != 10
+ || s != 11.5 || t != 12.5)
+ abort ();
+}
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
--- /dev/null
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+void
+fn1 (double *x, double *y, int z)
+{
+ int i;
+ for (i = 0; i < z; i++)
+ {
+ x[i] = i & 31;
+ y[i] = (i & 63) - 30;
+ }
+}
+
+double
+fn2 (int x)
+{
+ double s = 0;
+ double b[3 * x], c[3 * x], d[3 * x], e[3 * x];
+ int i;
+ fn1 (b, c, x);
+ fn1 (e, d + x, x);
+ #pragma omp target map(to: b, c[:x], d[x:x], e) map(tofrom: s)
+ #pragma omp parallel for reduction(+:s)
+ for (i = 0; i < x; i++)
+ s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c);
+ return s;
+}
+
+double
+fn3 (int x)
+{
+ double s = 0;
+ double b[3 * x], c[3 * x], d[3 * x], e[3 * x];
+ int i;
+ fn1 (b, c, x);
+ fn1 (e, d, x);
+ #pragma omp target map(tofrom: s)
+ #pragma omp parallel for reduction(+:s)
+ for (i = 0; i < x; i++)
+ s += b[i] * c[i] + d[i];
+ return s;
+}
+
+double
+fn4 (int x)
+{
+ double s = 0;
+ double b[3 * x], c[3 * x], d[3 * x], e[3 * x];
+ int i;
+ fn1 (b, c, x);
+ fn1 (e, d + x, x);
+ #pragma omp target data map(from: b, c[:x], d[x:x], e)
+ {
+ #pragma omp target update to(b, c[:x], d[x:x], e)
+ #pragma omp target map(c[:x], d[x:x], s)
+ #pragma omp parallel for reduction(+:s)
+ for (i = 0; i < x; i++)
+ {
+ s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c);
+ b[i] = i + 0.5;
+ c[i] = 0.5 - i;
+ d[x + i] = 0.5 * i;
+ }
+ }
+ for (i = 0; i < x; i++)
+ if (b[i] != i + 0.5 || c[i] != 0.5 - i || d[x + i] != 0.5 * i)
+ abort ();
+ return s;
+}
+
+int
+main ()
+{
+ double a = fn2 (128);
+ if (a != 14080.0)
+ abort ();
+ double b = fn3 (128);
+ if (a != b)
+ abort ();
+ double c = fn4 (256);
+ if (c != 28160.0)
+ abort ();
+ return 0;
+}
--- /dev/null
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+int v[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+
+int
+main ()
+{
+ #pragma omp parallel num_threads (4)
+ #pragma omp single
+ {
+ int i;
+ #pragma omp taskgroup
+ {
+ for (i = 0; i < 16; i += 2)
+ #pragma omp task
+ {
+ #pragma omp task
+ v[i]++;
+ #pragma omp task
+ v[i + 1]++;
+ }
+ }
+ for (i = 0; i < 16; i++)
+ if (v[i] != i + 2)
+ abort ();
+ #pragma omp taskgroup
+ {
+ for (i = 0; i < 16; i += 2)
+ #pragma omp task
+ {
+ #pragma omp task
+ v[i]++;
+ #pragma omp task
+ v[i + 1]++;
+ #pragma omp taskwait
+ }
+ }
+ for (i = 0; i < 16; i++)
+ if (v[i] != i + 3)
+ abort ();
+ #pragma omp taskgroup
+ {
+ for (i = 0; i < 16; i += 2)
+ #pragma omp task
+ {
+ #pragma omp task
+ v[i]++;
+ v[i + 1]++;
+ }
+ #pragma omp taskwait
+ for (i = 0; i < 16; i += 2)
+ #pragma omp task
+ v[i + 1]++;
+ }
+ for (i = 0; i < 16; i++)
+ if (v[i] != i + 4 + (i & 1))
+ abort ();
+ #pragma omp taskgroup
+ {
+ for (i = 0; i < 16; i += 2)
+ {
+ #pragma omp taskgroup
+ {
+ #pragma omp task
+ v[i]++;
+ #pragma omp task
+ v[i + 1]++;
+ }
+ if (v[i] != i + 5 || v[i + 1] != i + 7)
+ abort ();
+ #pragma omp task
+ v[i]++;
+ }
+ }
+ for (i = 0; i < 16; i++)
+ if (v[i] != i + 6)
+ abort ();
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+int q, r, e;
+
+__attribute__((noinline, noclone)) void
+foo (long a, long b)
+{
+ #pragma omp taskloop lastprivate (q) nogroup
+ for (long d = a; d < b; d += 2)
+ {
+ q = d;
+ if (d < 2 || d > 6 || (d & 1))
+ #pragma omp atomic
+ e |= 1;
+ }
+}
+
+__attribute__((noinline, noclone)) int
+bar (int a, int b)
+{
+ int q = 7;
+ #pragma omp taskloop lastprivate (q)
+ for (int d = a; d < b; d++)
+ {
+ if (d < 12 || d > 17)
+ #pragma omp atomic
+ e |= 1;
+ q = d;
+ }
+ return q;
+}
+
+int
+main ()
+{
+ #pragma omp parallel
+ #pragma omp single
+ {
+ foo (2, 7);
+ r = bar (12, 18);
+ }
+ if (q != 6 || r != 17 || e)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+int u[1024], v[1024], w[1024], m;
+
+__attribute__((noinline, noclone)) void
+f1 (long a, long b)
+{
+ #pragma omp taskloop simd default(none) shared(u, v, w) nogroup
+ for (long d = a; d < b; d++)
+ u[d] = v[d] + w[d];
+}
+
+__attribute__((noinline, noclone)) int
+f2 (long a, long b, long c)
+{
+ int d, e;
+ #pragma omp taskloop simd default(none) shared(u, v, w) linear(d:1) linear(c:5) lastprivate(e)
+ for (d = a; d < b; d++)
+ {
+ u[d] = v[d] + w[d];
+ c = c + 5;
+ e = c + 9;
+ }
+ return d + c + e;
+}
+
+__attribute__((noinline, noclone)) int
+f3 (long a, long b)
+{
+ int d;
+ #pragma omp taskloop simd default(none) shared(u, v, w)
+ for (d = a; d < b; d++)
+ {
+ int *p = &d;
+ u[d] = v[d] + w[d];
+ }
+ return d;
+}
+
+__attribute__((noinline, noclone)) int
+f4 (long a, long b, long c, long d)
+{
+ int e, f, g;
+ #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2) lastprivate(g)
+ for (e = a; e < b; e++)
+ for (f = c; f < d; f++)
+ {
+ int *p = &e;
+ int *q = &f;
+ int r = 32 * e + f;
+ u[r] = v[r] + w[r];
+ g = r;
+ }
+ return e + f + g;
+}
+
+__attribute__((noinline, noclone)) int
+f5 (long a, long b, long c, long d)
+{
+ int e, f;
+ #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2)
+ for (e = a; e < b; e++)
+ for (f = c; f < d; f++)
+ {
+ int r = 32 * e + f;
+ u[r] = v[r] + w[r];
+ }
+ return e + f;
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ v[i] = i;
+ w[i] = i + 1;
+ }
+ #pragma omp parallel
+ #pragma omp single
+ f1 (0, 1024);
+ for (i = 0; i < 1024; i++)
+ if (u[i] != 2 * i + 1)
+ __builtin_abort ();
+ else
+ {
+ v[i] = 1024 - i;
+ w[i] = 512 - i;
+ }
+ #pragma omp parallel
+ #pragma omp single
+ m = f2 (2, 1022, 17);
+ for (i = 0; i < 1024; i++)
+ if ((i < 2 || i >= 1022) ? u[i] != 2 * i + 1 : u[i] != 1536 - 2 * i)
+ __builtin_abort ();
+ else
+ {
+ v[i] = i;
+ w[i] = i + 1;
+ }
+ if (m != 1022 + 2 * (1020 * 5 + 17) + 9)
+ __builtin_abort ();
+ #pragma omp parallel
+ #pragma omp single
+ m = f3 (0, 1024);
+ for (i = 0; i < 1024; i++)
+ if (u[i] != 2 * i + 1)
+ __builtin_abort ();
+ else
+ {
+ v[i] = 1024 - i;
+ w[i] = 512 - i;
+ }
+ if (m != 1024)
+ __builtin_abort ();
+ #pragma omp parallel
+ #pragma omp single
+ m = f4 (0, 32, 0, 32);
+ for (i = 0; i < 1024; i++)
+ if (u[i] != 1536 - 2 * i)
+ __builtin_abort ();
+ else
+ {
+ v[i] = i;
+ w[i] = i + 1;
+ }
+ if (m != 32 + 32 + 1023)
+ __builtin_abort ();
+ #pragma omp parallel
+ #pragma omp single
+ m = f5 (0, 32, 0, 32);
+ for (i = 0; i < 1024; i++)
+ if (u[i] != 2 * i + 1)
+ __builtin_abort ();
+ else
+ {
+ v[i] = 1024 - i;
+ w[i] = 512 - i;
+ }
+ if (m != 32 + 32)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+int g;
+int a[1024];
+
+__attribute__((noinline, noclone)) int
+f1 (int x)
+{
+ #pragma omp taskloop firstprivate (x) lastprivate (x)
+ for (int i = 0; i < 64; i++)
+ {
+ if (x != 74)
+ __builtin_abort ();
+ if (i == 63)
+ x = i + 4;
+ }
+ return x;
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ #pragma omp taskloop firstprivate (g) lastprivate (g) nogroup
+ for (int i = 0; i < 64; i++)
+ {
+ if (g != 77)
+ __builtin_abort ();
+ if (i == 63)
+ g = i + 9;
+ }
+}
+
+__attribute__((noinline, noclone)) long long
+f3 (long long a, long long b, long long c)
+{
+ long long i;
+ int l;
+ #pragma omp taskloop default (none) lastprivate (i, l)
+ for (i = a; i < b; i += c)
+ l = i;
+ return l * 7 + i;
+}
+
+__attribute__((noinline, noclone)) long long
+f4 (long long a, long long b, long long c, long long d,
+ long long e, long long f, int k)
+{
+ long long i, j;
+ int l;
+ #pragma omp taskloop default (none) collapse(2) \
+ firstprivate (k) lastprivate (i, j, k, l)
+ for (i = a; i < b; i += e)
+ for (j = c; j < d; j += f)
+ {
+ if (k != 73)
+ __builtin_abort ();
+ if (i == 31 && j == 46)
+ k = i;
+ l = j;
+ }
+ return i + 5 * j + 11 * k + 17 * l;
+}
+
+int
+main ()
+{
+ #pragma omp parallel
+ #pragma omp single
+ {
+ if (f1 (74) != 63 + 4)
+ __builtin_abort ();
+ g = 77;
+ f2 ();
+ #pragma omp taskwait
+ if (g != 63 + 9)
+ __builtin_abort ();
+ if (f3 (7, 12, 2) != 11 * 7 + 13)
+ __builtin_abort ();
+ if (f4 (0, 32, 16, 48, 1, 2, 73) != 32 + 5 * 48 + 11 * 31 + 17 * 46)
+ __builtin_abort ();
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int u[64], v;
+
+__attribute__((noinline, noclone)) int
+test (int a, int b, int c, int d, void (*fn) (int, int, int, int),
+ int *num_tasks, int *min_iters, int *max_iters)
+{
+ int i, t = 0;
+ __builtin_memset (u, 0, sizeof u);
+ v = 0;
+ fn (a, b, c, d);
+ *min_iters = 0;
+ *max_iters = 0;
+ *num_tasks = v;
+ if (v)
+ {
+ *min_iters = u[0];
+ *max_iters = u[0];
+ t = u[0];
+ for (i = 1; i < v; i++)
+ {
+ if (*min_iters > u[i])
+ *min_iters = u[i];
+ if (*max_iters < u[i])
+ *max_iters = u[i];
+ t += u[i];
+ }
+ }
+ return t;
+}
+
+void
+grainsize (int a, int b, int c, int d)
+{
+ int i, j = 0, k = 0;
+ #pragma omp taskloop firstprivate (j, k) grainsize(d)
+ for (i = a; i < b; i += c)
+ {
+ if (j == 0)
+ {
+ #pragma omp atomic capture
+ k = v++;
+ if (k >= 64)
+ __builtin_abort ();
+ }
+ u[k] = ++j;
+ }
+}
+
+void
+num_tasks (int a, int b, int c, int d)
+{
+ int i, j = 0, k = 0;
+ #pragma omp taskloop firstprivate (j, k) num_tasks(d)
+ for (i = a; i < b; i += c)
+ {
+ if (j == 0)
+ {
+ #pragma omp atomic capture
+ k = v++;
+ if (k >= 64)
+ __builtin_abort ();
+ }
+ u[k] = ++j;
+ }
+}
+
+int
+main ()
+{
+ #pragma omp parallel
+ #pragma omp single
+ {
+ int min_iters, max_iters, ntasks;
+ /* If grainsize is present, # of task loop iters is >= grainsize && < 2 * grainsize,
+ unless # of loop iterations is smaller than grainsize. */
+ if (test (0, 79, 1, 17, grainsize, &ntasks, &min_iters, &max_iters) != 79
+ || min_iters < 17 || max_iters >= 17 * 2)
+ __builtin_abort ();
+ if (test (-49, 2541, 7, 28, grainsize, &ntasks, &min_iters, &max_iters) != 370
+ || min_iters < 28 || max_iters >= 28 * 2)
+ __builtin_abort ();
+ if (test (7, 21, 2, 15, grainsize, &ntasks, &min_iters, &max_iters) != 7
+ || ntasks != 1 || min_iters != 7 || max_iters != 7)
+ __builtin_abort ();
+ /* If num_tasks is present, # of task loop iters is min (# of loop iters, num_tasks). */
+ if (test (-51, 2500, 48, 9, num_tasks, &ntasks, &min_iters, &max_iters) != 54
+ || ntasks != 9)
+ __builtin_abort ();
+ if (test (0, 25, 2, 17, num_tasks, &ntasks, &min_iters, &max_iters) != 13
+ || ntasks != 13)
+ __builtin_abort ();
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort ();
+
+struct S { int s; struct S *t; };
+
+void
+foo (struct S *out, struct S *in)
+{
+ out->s += in->s;
+}
+
+void
+bar (struct S *x)
+{
+ if (x->s != 6) abort ();
+ x->s = 15;
+}
+
+void
+baz (struct S *x, struct S *y)
+{
+ x->s = 6;
+ x->t = x;
+ (void) y;
+}
+
+#pragma omp declare reduction (foo: struct S: foo (&omp_out, &omp_in)) \
+ initializer (omp_priv = { 8, &omp_priv })
+#pragma omp declare reduction (foo: char, int, short: omp_out += omp_in - 4) \
+ initializer (omp_priv = 4)
+#pragma omp declare reduction (+: struct S: foo (&omp_out, &omp_in)) \
+ initializer (baz (&omp_priv, &omp_orig))
+
+void
+test (struct S s, struct S t)
+{
+ int q = 0;
+ #pragma omp parallel num_threads (4) reduction (+: s, q) reduction (foo: t)
+ {
+ if (s.s != 6 || s.t != &s || t.s != 8 || t.t != &t)
+ abort ();
+ s.s = 2;
+ t.s = 3;
+ q = 1;
+ }
+ if (s.s != 12 + 2 * q || t.s != 14 + 3 * q)
+ abort ();
+}
+
+int
+main ()
+{
+ struct S s, t;
+ s.s = 9; t.s = 10;
+ int h = 30, v = 2, q = 0;
+ #pragma omp declare reduction (foo: struct S: omp_out.s *= omp_in.s) \
+ initializer (omp_priv = omp_orig)
+ {
+ #pragma omp declare reduction (foo: struct S: omp_out.s += omp_in.s) \
+ initializer (omp_priv = omp_orig)
+ #pragma omp parallel num_threads (4) reduction (+: t, q) \
+ reduction (min: h) reduction (foo: s, v)
+ {
+ if (s.s != 9 || t.s != 6 || v != 4 || h != __INT_MAX__) abort ();
+ asm volatile ("" : "+m" (s.s), "+m" (t.s));
+ asm volatile ("" : "+r" (h), "+r" (v));
+ h = t.s; s.s++; t.s++; v++; q++;
+ }
+ }
+ if (h != 6 || s.s != 9 + q * 10 || t.s != 10 + q * 7 || v != 2 + q)
+ abort ();
+ s.s = 12;
+ t.s = 14;
+ test (s, t);
+ return 0;
+}
+++ /dev/null
-/* PR c/64824 */
-/* { dg-do run } */
-
-void
-f1 (void)
-{
- short a;
- short b = 1;
- int c = 3;
-#pragma omp atomic capture
- a = b = c << b;
- if (b != 6 || a != 6)
- __builtin_abort ();
-}
-
-void
-f2 (void)
-{
- short a;
- short b = 1;
- int c = 3;
-#pragma omp atomic capture
- a = b = c + b;
- if (b != 4 || a != 4)
- __builtin_abort ();
-}
-
-void
-f3 (void)
-{
- short a;
- short b = 1;
- long long int c = 3;
-#pragma omp atomic capture
- a = b = c + b;
- if (b != 4 || a != 4)
- __builtin_abort ();
-}
-
-void
-f4 (void)
-{
- char a;
- char b = 1;
- long long int c = 3LL;
-#pragma omp atomic capture
- a = b = c << b;
- if (b != 6 || a != 6)
- __builtin_abort ();
-}
-
-int
-main ()
-{
- f1 ();
- f2 ();
- f3 ();
- f4 ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <omp.h>
-
-int
-main ()
-{
- #pragma omp parallel
- #pragma omp taskgroup
- #pragma omp task
- {
- #pragma omp cancel taskgroup
- if (omp_get_cancellation ())
- abort ();
- }
- #pragma omp parallel
- {
- #pragma omp barrier
- #pragma omp single
- #pragma omp taskgroup
- {
- int i;
- for (i = 0; i < 50; i++)
- #pragma omp task
- {
- #pragma omp cancellation point taskgroup
- usleep (30);
- #pragma omp cancel taskgroup if (i > 5)
- }
- }
- usleep (10);
- }
- return 0;
-}
+++ /dev/null
-/* { dg-additional-options "-std=gnu99" } */
-
-extern void abort (void);
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#define F parallel for
-#define G pf
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F for
-#define G f
-#include "for-1.h"
-#undef F
-#undef G
-
-int
-main ()
-{
- if (test_pf_static ()
- || test_pf_static32 ()
- || test_pf_auto ()
- || test_pf_guided32 ()
- || test_pf_runtime ()
- || test_f_static ()
- || test_f_static32 ()
- || test_f_auto ()
- || test_f_guided32 ()
- || test_f_runtime ())
- abort ();
- return 0;
-}
+++ /dev/null
-#define S
-#define N(x) M(x, G, static)
-#include "for-2.h"
-#undef S
-#undef N
-#define S schedule(static, 32)
-#define N(x) M(x, G, static32)
-#include "for-2.h"
-#undef S
-#undef N
-#define S schedule(auto)
-#define N(x) M(x, G, auto)
-#include "for-2.h"
-#undef S
-#undef N
-#define S schedule(guided, 32)
-#define N(x) M(x, G, guided32)
-#include "for-2.h"
-#undef S
-#undef N
-#define S schedule(runtime)
-#define N(x) M(x, G, runtime)
-#include "for-2.h"
-#undef S
-#undef N
+++ /dev/null
-/* { dg-additional-options "-std=gnu99" } */
-
-extern void abort (void);
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#define F simd
-#define G simd
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F parallel for simd
-#define G pf_simd
-#include "for-1.h"
-#undef F
-#undef G
-
-#undef SC
-#define SC static
-#define F for simd
-#define G f_simd
-#include "for-1.h"
-#undef F
-#undef G
-#undef SC
-
-int
-main ()
-{
- if (test_simd_normal ()
- || test_pf_simd_static ()
- || test_pf_simd_static32 ()
- || test_pf_simd_auto ()
- || test_pf_simd_guided32 ()
- || test_pf_simd_runtime ()
- || test_f_simd_static ()
- || test_f_simd_static32 ()
- || test_f_simd_auto ()
- || test_f_simd_guided32 ()
- || test_f_simd_runtime ())
- abort ();
- return 0;
-}
+++ /dev/null
-#ifndef VARS
-#define VARS
-int a[1500];
-float b[10][15][10];
-__attribute__((noreturn)) void
-noreturn (void)
-{
- for (;;);
-}
-#endif
-#ifndef SC
-#define SC
-#endif
-#ifndef OMPTGT
-#define OMPTGT
-#endif
-#ifndef OMPTO
-#define OMPTO(v) do {} while (0)
-#endif
-#ifndef OMPFROM
-#define OMPFROM(v) do {} while (0)
-#endif
-
-__attribute__((noinline, noclone)) void
-N(f0) (void)
-{
- int i;
- OMPTGT
-#pragma omp F S
- for (i = 0; i < 1500; i++)
- a[i] += 2;
-}
-
-__attribute__((noinline, noclone)) void
-N(f1) (void)
-{
- OMPTGT
-#pragma omp F S
- for (unsigned int i = __INT_MAX__; i < 3000U + __INT_MAX__; i += 2)
- a[(i - __INT_MAX__) >> 1] -= 2;
-}
-
-__attribute__((noinline, noclone)) void
-N(f2) (void)
-{
- unsigned long long i;
- OMPTGT
-#pragma omp F S
- for (i = __LONG_LONG_MAX__ + 4500ULL - 27;
- i > __LONG_LONG_MAX__ - 27ULL; i -= 3)
- a[(i + 26LL - __LONG_LONG_MAX__) / 3] -= 4;
-}
-
-__attribute__((noinline, noclone)) void
-N(f3) (long long n1, long long n2, long long s3)
-{
- OMPTGT
-#pragma omp F S
- for (long long i = n1 + 23; i > n2 - 25; i -= s3)
- a[i + 48] += 7;
-}
-
-__attribute__((noinline, noclone)) void
-N(f4) (void)
-{
- unsigned int i;
- OMPTGT
-#pragma omp F S
- for (i = 30; i < 20; i += 2)
- a[i] += 10;
-}
-
-__attribute__((noinline, noclone)) void
-N(f5) (int n11, int n12, int n21, int n22, int n31, int n32,
- int s1, int s2, int s3)
-{
- SC int v1, v2, v3;
- OMPTGT
-#pragma omp F S collapse(3)
- for (v1 = n11; v1 < n12; v1 += s1)
- for (v2 = n21; v2 < n22; v2 += s2)
- for (v3 = n31; v3 < n32; v3 += s3)
- b[v1][v2][v3] += 2.5;
-}
-
-__attribute__((noinline, noclone)) void
-N(f6) (int n11, int n12, int n21, int n22, long long n31, long long n32,
- int s1, int s2, long long int s3)
-{
- SC int v1, v2;
- SC long long v3;
- OMPTGT
-#pragma omp F S collapse(3)
- for (v1 = n11; v1 > n12; v1 += s1)
- for (v2 = n21; v2 > n22; v2 += s2)
- for (v3 = n31; v3 > n32; v3 += s3)
- b[v1][v2 / 2][v3] -= 4.5;
-}
-
-__attribute__((noinline, noclone)) void
-N(f7) (void)
-{
- SC unsigned int v1, v3;
- SC unsigned long long v2;
- OMPTGT
-#pragma omp F S collapse(3)
- for (v1 = 0; v1 < 20; v1 += 2)
- for (v2 = __LONG_LONG_MAX__ + 16ULL;
- v2 > __LONG_LONG_MAX__ - 29ULL; v2 -= 3)
- for (v3 = 10; v3 > 0; v3--)
- b[v1 >> 1][(v2 - __LONG_LONG_MAX__ + 64) / 3 - 12][v3 - 1] += 5.5;
-}
-
-__attribute__((noinline, noclone)) void
-N(f8) (void)
-{
- SC long long v1, v2, v3;
- OMPTGT
-#pragma omp F S collapse(3)
- for (v1 = 0; v1 < 20; v1 += 2)
- for (v2 = 30; v2 < 20; v2++)
- for (v3 = 10; v3 < 0; v3--)
- b[v1][v2][v3] += 5.5;
-}
-
-__attribute__((noinline, noclone)) void
-N(f9) (void)
-{
- int i;
- OMPTGT
-#pragma omp F S
- for (i = 20; i < 10; i++)
- {
- a[i] += 2;
- noreturn ();
- a[i] -= 4;
- }
-}
-
-__attribute__((noinline, noclone)) void
-N(f10) (void)
-{
- SC int i;
- OMPTGT
-#pragma omp F S collapse(3)
- for (i = 0; i < 10; i++)
- for (int j = 10; j < 8; j++)
- for (long k = -10; k < 10; k++)
- {
- b[i][j][k] += 4;
- noreturn ();
- b[i][j][k] -= 8;
- }
-}
-
-__attribute__((noinline, noclone)) void
-N(f11) (int n)
-{
- int i;
- OMPTGT
-#pragma omp F S
- for (i = 20; i < n; i++)
- {
- a[i] += 8;
- noreturn ();
- a[i] -= 16;
- }
-}
-
-__attribute__((noinline, noclone)) void
-N(f12) (int n)
-{
- SC int i;
- OMPTGT
-#pragma omp F S collapse(3)
- for (i = 0; i < 10; i++)
- for (int j = n; j < 8; j++)
- for (long k = -10; k < 10; k++)
- {
- b[i][j][k] += 16;
- noreturn ();
- b[i][j][k] -= 32;
- }
-}
-
-__attribute__((noinline, noclone)) void
-N(f13) (void)
-{
- int *i;
- OMPTGT
-#pragma omp F S
- for (i = a; i < &a[1500]; i++)
- i[0] += 2;
-}
-
-__attribute__((noinline, noclone)) void
-N(f14) (void)
-{
- SC float *i;
- OMPTGT
-#pragma omp F S collapse(3)
- for (i = &b[0][0][0]; i < &b[0][0][10]; i++)
- for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)
- for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)
- b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1]
- -= 3.5;
-}
-
-__attribute__((noinline, noclone)) int
-N(test) (void)
-{
- int i, j, k;
- for (i = 0; i < 1500; i++)
- a[i] = i - 25;
- OMPTO (a);
- N(f0) ();
- OMPFROM (a);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 23)
- return 1;
- N(f1) ();
- OMPFROM (a);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 25)
- return 1;
- N(f2) ();
- OMPFROM (a);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 29)
- return 1;
- N(f3) (1500LL - 1 - 23 - 48, -1LL + 25 - 48, 1LL);
- OMPFROM (a);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 22)
- return 1;
- N(f3) (1500LL - 1 - 23 - 48, 1500LL - 1, 7LL);
- OMPFROM (a);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 22)
- return 1;
- N(f4) ();
- OMPFROM (a);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 22)
- return 1;
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- b[i][j][k] = i - 2.5 + 1.5 * j - 1.5 * k;
- OMPTO (b);
- N(f5) (0, 10, 0, 15, 0, 10, 1, 1, 1);
- OMPFROM (b);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i + 1.5 * j - 1.5 * k)
- return 1;
- N(f5) (0, 10, 30, 15, 0, 10, 4, 5, 6);
- OMPFROM (b);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i + 1.5 * j - 1.5 * k)
- return 1;
- N(f6) (9, -1, 29, 0, 9, -1, -1, -2, -1);
- OMPFROM (b);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i - 4.5 + 1.5 * j - 1.5 * k)
- return 1;
- N(f7) ();
- OMPFROM (b);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k)
- return 1;
- N(f8) ();
- OMPFROM (b);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k)
- return 1;
- N(f9) ();
- N(f10) ();
- N(f11) (10);
- N(f12) (12);
- OMPFROM (a);
- OMPFROM (b);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 22)
- return 1;
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k)
- return 1;
- N(f13) ();
- N(f14) ();
- OMPFROM (a);
- OMPFROM (b);
- for (i = 0; i < 1500; i++)
- if (a[i] != i - 20)
- return 1;
- for (i = 0; i < 10; i++)
- for (j = 0; j < 15; j++)
- for (k = 0; k < 10; k++)
- if (b[i][j][k] != i - 2.5 + 1.5 * j - 1.5 * k)
- return 1;
- return 0;
-}
+++ /dev/null
-/* { dg-additional-options "-std=gnu99" } */
-
-extern void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#pragma omp declare target
-
-#define F distribute
-#define G d
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute
-#define G d_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute simd
-#define G ds
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute simd
-#define G ds_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F distribute parallel for
-#define G dpf
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F distribute parallel for dist_schedule(static, 128)
-#define G dpf_ds128
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F distribute parallel for simd
-#define G dpfs
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F distribute parallel for simd dist_schedule(static, 128)
-#define G dpfs_ds128
-#include "for-1.h"
-#undef F
-#undef G
-
-#pragma omp end declare target
-
-int
-main ()
-{
- int err = 0;
- #pragma omp target teams reduction(|:err)
- {
- err |= test_d_normal ();
- err |= test_d_ds128_normal ();
- err |= test_ds_normal ();
- err |= test_ds_ds128_normal ();
- err |= test_dpf_static ();
- err |= test_dpf_static32 ();
- err |= test_dpf_auto ();
- err |= test_dpf_guided32 ();
- err |= test_dpf_runtime ();
- err |= test_dpf_ds128_static ();
- err |= test_dpf_ds128_static32 ();
- err |= test_dpf_ds128_auto ();
- err |= test_dpf_ds128_guided32 ();
- err |= test_dpf_ds128_runtime ();
- err |= test_dpfs_static ();
- err |= test_dpfs_static32 ();
- err |= test_dpfs_auto ();
- err |= test_dpfs_guided32 ();
- err |= test_dpfs_runtime ();
- err |= test_dpfs_ds128_static ();
- err |= test_dpfs_ds128_static32 ();
- err |= test_dpfs_ds128_auto ();
- err |= test_dpfs_ds128_guided32 ();
- err |= test_dpfs_ds128_runtime ();
- }
- if (err)
- abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-options "-std=gnu99" } */
-
-extern void abort (void);
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#define F taskloop
-#define G taskloop
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F taskloop simd
-#define G taskloop_simd
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-int
-main ()
-{
- int err = 0;
- #pragma omp parallel reduction(|:err)
- #pragma omp single
- {
- if (test_taskloop_normal ()
- || test_taskloop_simd_normal ())
- err = 1;
- }
- if (err)
- abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-additional-options "-std=gnu99" } */
-
-extern void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#pragma omp declare target
-
-#define F for
-#define G f
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#pragma omp end declare target
-
-#undef OMPFROM
-#undef OMPTO
-#define DO_PRAGMA(x) _Pragma (#x)
-#define OMPFROM(v) DO_PRAGMA (omp target update from(v))
-#define OMPTO(v) DO_PRAGMA (omp target update to(v))
-
-#define F target parallel for
-#define G tpf
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F target simd
-#define G t_simd
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target parallel for simd
-#define G tpf_simd
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute
-#define G ttd
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute
-#define G ttd_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute simd
-#define G ttds
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute simd
-#define G ttds_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F target teams distribute parallel for
-#define G ttdpf
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute parallel for dist_schedule(static, 128)
-#define G ttdpf_ds128
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute parallel for simd
-#define G ttdpfs
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F target teams distribute parallel for simd dist_schedule(static, 128)
-#define G ttdpfs_ds128
-#include "for-1.h"
-#undef F
-#undef G
-
-int
-main ()
-{
- if (test_tpf_static ()
- || test_tpf_static32 ()
- || test_tpf_auto ()
- || test_tpf_guided32 ()
- || test_tpf_runtime ()
- || test_t_simd_normal ()
- || test_tpf_simd_static ()
- || test_tpf_simd_static32 ()
- || test_tpf_simd_auto ()
- || test_tpf_simd_guided32 ()
- || test_tpf_simd_runtime ()
- || test_ttd_normal ()
- || test_ttd_ds128_normal ()
- || test_ttds_normal ()
- || test_ttds_ds128_normal ()
- || test_ttdpf_static ()
- || test_ttdpf_static32 ()
- || test_ttdpf_auto ()
- || test_ttdpf_guided32 ()
- || test_ttdpf_runtime ()
- || test_ttdpf_ds128_static ()
- || test_ttdpf_ds128_static32 ()
- || test_ttdpf_ds128_auto ()
- || test_ttdpf_ds128_guided32 ()
- || test_ttdpf_ds128_runtime ()
- || test_ttdpfs_static ()
- || test_ttdpfs_static32 ()
- || test_ttdpfs_auto ()
- || test_ttdpfs_guided32 ()
- || test_ttdpfs_runtime ()
- || test_ttdpfs_ds128_static ()
- || test_ttdpfs_ds128_static32 ()
- || test_ttdpfs_ds128_auto ()
- || test_ttdpfs_ds128_guided32 ()
- || test_ttdpfs_ds128_runtime ())
- abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-additional-options "-std=gnu99" } */
-
-extern void abort ();
-
-#define M(x, y, z) O(x, y, z)
-#define O(x, y, z) x ## _ ## y ## _ ## z
-
-#pragma omp declare target
-
-#define F for
-#define G f
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#pragma omp end declare target
-
-#undef OMPTGT
-#undef OMPFROM
-#undef OMPTO
-#define DO_PRAGMA(x) _Pragma (#x)
-#define OMPTGT DO_PRAGMA (omp target)
-#define OMPFROM(v) DO_PRAGMA (omp target update from(v))
-#define OMPTO(v) DO_PRAGMA (omp target update to(v))
-
-#define F teams distribute
-#define G td
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute
-#define G td_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute simd
-#define G tds
-#define S
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute simd
-#define G tds_ds128
-#define S dist_schedule(static, 128)
-#define N(x) M(x, G, normal)
-#include "for-2.h"
-#undef S
-#undef N
-#undef F
-#undef G
-
-#define F teams distribute parallel for
-#define G tdpf
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F teams distribute parallel for dist_schedule(static, 128)
-#define G tdpf_ds128
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F teams distribute parallel for simd
-#define G tdpfs
-#include "for-1.h"
-#undef F
-#undef G
-
-#define F teams distribute parallel for simd dist_schedule(static, 128)
-#define G tdpfs_ds128
-#include "for-1.h"
-#undef F
-#undef G
-
-int
-main ()
-{
- if (test_td_normal ()
- || test_td_ds128_normal ()
- || test_tds_normal ()
- || test_tds_ds128_normal ()
- || test_tdpf_static ()
- || test_tdpf_static32 ()
- || test_tdpf_auto ()
- || test_tdpf_guided32 ()
- || test_tdpf_runtime ()
- || test_tdpf_ds128_static ()
- || test_tdpf_ds128_static32 ()
- || test_tdpf_ds128_auto ()
- || test_tdpf_ds128_guided32 ()
- || test_tdpf_ds128_runtime ()
- || test_tdpfs_static ()
- || test_tdpfs_static32 ()
- || test_tdpfs_auto ()
- || test_tdpfs_guided32 ()
- || test_tdpfs_runtime ()
- || test_tdpfs_ds128_static ()
- || test_tdpfs_ds128_static32 ()
- || test_tdpfs_ds128_auto ()
- || test_tdpfs_ds128_guided32 ()
- || test_tdpfs_ds128_runtime ())
- abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-volatile int ji = 100, ki = 2;
-volatile unsigned int ju = 100, ku = 2;
-volatile long long int jll = 100, kll = 2;
-volatile unsigned long long int jull = 100, kull = 2;
-unsigned long long l;
-
-void
-f0 (void)
-{
- int i, j, k;
- unsigned int j2, k2;
- #pragma omp for reduction(+: l)
- for (i = ji; i < ki; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l)
- for (i = ji; i < ki; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ji; i < ki; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ji; i < ki; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = ki + 10; k < ji - 10; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = ki + 10; j < ji - 10; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f1 (void)
-{
- unsigned int i, j, k;
- int j2, k2;
- #pragma omp for reduction(+: l)
- for (i = ju; i < ku; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l)
- for (i = ju; i < ku; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ju; i < ku; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ju; i < ku; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = ku; k < ju; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = ku; j < ju; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f2 (void)
-{
- long long int i, j, k;
- unsigned long long int j2, k2;
- #pragma omp for reduction(+: l)
- for (i = jll; i < kll; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l)
- for (i = jll; i < kll; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jll; i < kll; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jll; i < kll; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = kll; k < jll; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = kll; j < jll; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f3 (void)
-{
- unsigned long long int i, j, k;
- long long int j2, k2;
- #pragma omp for reduction(+: l)
- for (i = jull; i < kull; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l)
- for (i = jull; i < kull; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jull; i < kull; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jull; i < kull; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = kull; k < jull; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3)
- for (j = kull; j < jull; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-int
-main ()
-{
- f0 ();
- f1 ();
- f2 ();
- f3 ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-volatile int ji = 100, ki = 2;
-volatile unsigned int ju = 100, ku = 2;
-volatile long long int jll = 100, kll = 2;
-volatile unsigned long long int jull = 100, kull = 2;
-unsigned long long l;
-
-void
-f0 (void)
-{
- int i, j, k;
- unsigned int j2, k2;
- #pragma omp for reduction(+: l) schedule(static, 2)
- for (i = ji; i < ki; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(static, 2)
- for (i = ji; i < ki; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ji; i < ki; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ji; i < ki; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = ki + 10; k < ji - 10; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = ki + 10; j < ji - 10; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f1 (void)
-{
- unsigned int i, j, k;
- int j2, k2;
- #pragma omp for reduction(+: l) schedule(static, 2)
- for (i = ju; i < ku; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(static, 2)
- for (i = ju; i < ku; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ju; i < ku; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ju; i < ku; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = ku; k < ju; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = ku; j < ju; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f2 (void)
-{
- long long int i, j, k;
- unsigned long long int j2, k2;
- #pragma omp for reduction(+: l) schedule(static, 2)
- for (i = jll; i < kll; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(static, 2)
- for (i = jll; i < kll; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jll; i < kll; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jll; i < kll; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = kll; k < jll; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = kll; j < jll; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f3 (void)
-{
- unsigned long long int i, j, k;
- long long int j2, k2;
- #pragma omp for reduction(+: l) schedule(static, 2)
- for (i = jull; i < kull; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(static, 2)
- for (i = jull; i < kull; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jull; i < kull; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jull; i < kull; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = kull; k < jull; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2)
- for (j = kull; j < jull; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-int
-main ()
-{
- f0 ();
- f1 ();
- f2 ();
- f3 ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-volatile int ji = 100, ki = 2;
-volatile unsigned int ju = 100, ku = 2;
-volatile long long int jll = 100, kll = 2;
-volatile unsigned long long int jull = 100, kull = 2;
-unsigned long long l;
-
-void
-f0 (void)
-{
- int i, j, k;
- unsigned int j2, k2;
- #pragma omp for reduction(+: l) schedule(runtime)
- for (i = ji; i < ki; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(runtime)
- for (i = ji; i < ki; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ji; i < ki; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ji; i < ki; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = ji; i < ki; i++)
- for (k = ki + 10; k < ji - 10; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = ki + 10; j < ji - 10; j++)
- for (i = ji; i < ki; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f1 (void)
-{
- unsigned int i, j, k;
- int j2, k2;
- #pragma omp for reduction(+: l) schedule(runtime)
- for (i = ju; i < ku; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(runtime)
- for (i = ju; i < ku; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ju; i < ku; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = ju; i < ku; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = ju; i < ku; i++)
- for (k = ku; k < ju; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = ku; j < ju; j++)
- for (i = ju; i < ku; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f2 (void)
-{
- long long int i, j, k;
- unsigned long long int j2, k2;
- #pragma omp for reduction(+: l) schedule(runtime)
- for (i = jll; i < kll; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(runtime)
- for (i = jll; i < kll; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jll; i < kll; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jll; i < kll; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = jll; i < kll; i++)
- for (k = kll; k < jll; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = kll; j < jll; j++)
- for (i = jll; i < kll; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-void
-f3 (void)
-{
- unsigned long long int i, j, k;
- long long int j2, k2;
- #pragma omp for reduction(+: l) schedule(runtime)
- for (i = jull; i < kull; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) schedule(runtime)
- for (i = jull; i < kull; i++)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jull; i < kull; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j2 = 0; j2 < 4; j2++)
- for (i = jull; i < kull; i++)
- for (k2 = 0; k2 < 5; k2 += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = 0; j < 4; j++)
- for (i = jull; i < kull; i++)
- for (k = kull; k < jull; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
- #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime)
- for (j = kull; j < jull; j++)
- for (i = jull; i < kull; i++)
- for (k = 0; k < 5; k += 2)
- l++;
- if (l != 0)
- __builtin_abort ();
-}
-
-int
-main ()
-{
- f0 ();
- f1 ();
- f2 ();
- f3 ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-#ifndef MONOTONIC_TYPE
-#include <omp.h>
-#include <stdlib.h>
-#define MONOTONIC_TYPE int
-#define MONOTONIC_UNDEF -1
-#define MONOTONIC_END(n) n
-#endif
-
-int
-main ()
-{
- MONOTONIC_TYPE i;
- #pragma omp parallel
- {
- int cnt = omp_get_num_threads ();
- int thr = omp_get_thread_num ();
- MONOTONIC_TYPE l = MONOTONIC_UNDEF;
- int c = 0;
- int n = 0;
- #pragma omp for nowait schedule(static, 5)
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- {
- if (l >= i)
- abort ();
- if (cnt == 1)
- abort ();
- if (n != 5)
- abort ();
- n = 1;
- c++;
- }
- if (n == 1)
- {
- if ((i % 5) != 0)
- abort ();
- if ((i / 5) % cnt != thr)
- abort ();
- }
- l = i;
- }
- if (cnt == 1)
- {
- if (n != 73 || l != 73 - 1 || c != 1)
- abort ();
- }
- else if (thr > 73 / 5)
- {
- if (l != MONOTONIC_UNDEF || c != 0 || n != 0)
- abort ();
- }
- else if (thr == 73 / 5)
- {
- if (l != 73 - 1 || c != 1 || n != 73 % 5)
- abort ();
- }
- else if (c == 0)
- abort ();
- else if (l == 73 - 1)
- {
- if (thr != (73 / 5) % cnt || n != 73 % 5)
- abort ();
- }
- else if ((n % 5) != 0)
- abort ();
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for schedule( monotonic: static, 7) nowait
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- {
- if (l >= i)
- abort ();
- if (cnt == 1)
- abort ();
- if (n != 7)
- abort ();
- n = 1;
- c++;
- }
- if (n == 1)
- {
- if ((i % 7) != 0)
- abort ();
- if ((i / 7) % cnt != thr)
- abort ();
- }
- l = i;
- }
- if (cnt == 1)
- {
- if (n != 73 || l != 73 - 1 || c != 1)
- abort ();
- }
- else if (thr > 73 / 7)
- {
- if (l != MONOTONIC_UNDEF || c != 0 || n != 0)
- abort ();
- }
- else if (thr == 73 / 7)
- {
- if (l != 73 - 1 || c != 1 || n != 73 % 7)
- abort ();
- }
- else if (c == 0)
- abort ();
- else if (l == 73 - 1)
- {
- if (thr != (73 / 7) % cnt || n != 73 % 7)
- abort ();
- }
- else if ((n % 7) != 0)
- abort ();
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for nowait schedule(static)
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- abort ();
- l = i;
- }
- if (c > 1)
- abort ();
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for nowait schedule(monotonic,simd:static)
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- abort ();
- l = i;
- }
- if (c > 1)
- abort ();
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for schedule(monotonic : dynamic, 5) nowait
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- {
- if (l >= i)
- abort ();
- if ((n % 5) != 0 || n == 0)
- abort ();
- n = 1;
- c++;
- }
- l = i;
- }
- if (l == 73 - 1)
- {
- if (n % 5 != 73 % 5)
- abort ();
- }
- else if (l == MONOTONIC_UNDEF)
- {
- if (n != 0 || c != 0)
- abort ();
- }
- else if ((n % 5) != 0 || n == 0)
- abort ();
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for nowait schedule(dynamic, 7) ordered(1)
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- {
- if (l >= i)
- abort ();
- if ((n % 7) != 0 || n == 0)
- abort ();
- n = 1;
- c++;
- }
- #pragma omp ordered depend(source)
- if (MONOTONIC_UNDEF > 0)
- {
- #pragma omp ordered depend(sink: i)
- }
- else
- {
- #pragma omp ordered depend(sink: i - 1)
- }
- l = i;
- }
- if (l == 73 - 1)
- {
- if (n % 7 != 73 % 7)
- abort ();
- }
- else if (l == MONOTONIC_UNDEF)
- {
- if (n != 0 || c != 0)
- abort ();
- }
- else if ((n % 7) != 0 || n == 0)
- abort ();
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for schedule (monotonic :guided , 7) nowait
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- {
- if (l >= i)
- abort ();
- if (n < 7)
- abort ();
- n = 1;
- c++;
- }
- l = i;
- }
- l = MONOTONIC_UNDEF;
- c = 0;
- n = 0;
- #pragma omp for nowait schedule(guided, 7) ordered
- for (i = 0; i < MONOTONIC_END (73); i++)
- {
- if (l == MONOTONIC_UNDEF)
- {
- n = 1;
- c++;
- }
- else if (l == i - 1)
- n++;
- else
- {
- if (l >= i)
- abort ();
- if (n < 7)
- abort ();
- n = 1;
- c++;
- }
- #pragma omp ordered
- l = i;
- }
- }
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-#include <omp.h>
-#include <stdlib.h>
-#define MONOTONIC_TYPE unsigned long long
-#define MONOTONIC_UNDEF -1ULL
-#define MONOTONIC_END(n) n + v
-
-volatile int v;
-
-#include "monotonic-1.c"
+++ /dev/null
-/* { dg-do run } */
-
-#ifndef NONMONOTONIC_TYPE
-#include <omp.h>
-#include <stdlib.h>
-#define NONMONOTONIC_TYPE int
-#define NONMONOTONIC_END(n) n
-#endif
-
-int a[73];
-
-int
-main ()
-{
- NONMONOTONIC_TYPE i;
- #pragma omp parallel for schedule(nonmonotonic: dynamic)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp parallel for schedule(nonmonotonic: dynamic, 5)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp parallel for schedule(nonmonotonic: guided)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp parallel for schedule(nonmonotonic: guided, 7)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp parallel
- {
- int cnt = omp_get_num_threads ();
- int thr = omp_get_thread_num ();
- if (thr < 73)
- a[thr]++;
- #pragma omp barrier
- #pragma omp for schedule(nonmonotonic: dynamic)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp for schedule(nonmonotonic: dynamic, 7)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp for schedule(nonmonotonic: guided)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp for schedule(nonmonotonic: guided, 5)
- for (i = 0; i < NONMONOTONIC_END (73); i++)
- a[i]++;
- #pragma omp single private (i)
- for (i = 0; i < 73; i++)
- if (a[i] != 8 + (i < cnt))
- abort ();
- }
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-#include <omp.h>
-#include <stdlib.h>
-#define NONMONOTONIC_TYPE unsigned long long
-#define NONMONOTONIC_END(n) n + v
-
-volatile int v;
-
-#include "nonmonotonic-1.c"
+++ /dev/null
-extern
-#ifdef __cplusplus
-"C"
-#endif
-void abort (void);
-
-void
-foo (int i, char *j)
-{
- #pragma omp atomic
- j[i]++;
- #pragma omp ordered threads
- {
- int t;
- #pragma omp atomic read
- t = j[i];
- if (t != 3)
- abort ();
- if (i > 1)
- {
- #pragma omp atomic read
- t = j[i - 1];
- if (t == 2)
- abort ();
- }
- if (i < 127)
- {
- #pragma omp atomic read
- t = j[i + 1];
- if (t == 4)
- abort ();
- }
- }
- #pragma omp atomic
- j[i]++;
-}
-
-int
-main ()
-{
- int i;
- char j[128];
- #pragma omp parallel
- {
- #pragma omp for
- for (i = 0; i < 128; i++)
- j[i] = 0;
- #pragma omp for ordered schedule(dynamic, 1)
- for (i = 0; i < 128; i++)
- {
- #pragma omp atomic
- j[i]++;
- #pragma omp ordered threads
- {
- int t;
- #pragma omp atomic read
- t = j[i];
- if (t != 1)
- abort ();
- if (i > 1)
- {
- #pragma omp atomic read
- t = j[i - 1];
- if (t == 0)
- abort ();
- }
- if (i < 127)
- {
- #pragma omp atomic read
- t = j[i + 1];
- if (t == 2)
- abort ();
- }
- }
- #pragma omp atomic
- j[i]++;
- }
- #pragma omp for ordered schedule(static, 1)
- for (i = 0; i < 128; i++)
- foo (i, j);
- }
- return 0;
-}
+++ /dev/null
-/* PR c/45784 */
-/* { dg-do run } */
-
-void
-foo (int n)
-{
- char *p, vla[2 * n];
- int i;
- #pragma omp parallel for
- for (p = vla; p < vla + (sizeof (vla) / sizeof (vla[0])); p++)
- *p = ' ';
- #pragma omp parallel for
- for (i = 0; i < 2 * n; i++)
- if (vla[i] != ' ')
- __builtin_abort ();
-}
-
-void
-bar (int n)
-{
- char *p, vla1[n], vla2[n * 2], vla3[n * 3], vla4[n * 4];
- int i;
- __builtin_memset (vla4, ' ', n * 4);
- #pragma omp parallel for
- for (p = vla4 + sizeof (vla1); p < vla4 + sizeof (vla3) - sizeof (vla2) + sizeof (vla1); p += sizeof (vla4) / sizeof (vla4))
- p[0] = '!';
- #pragma omp parallel for
- for (i = 0; i < n * 4; i++)
- if (vla4[i] != ((i >= n && i < 2 * n) ? '!' : ' '))
- __builtin_abort ();
-}
-
-int
-main ()
-{
- volatile int n;
- n = 128;
- foo (n);
- bar (n);
- return 0;
-}
+++ /dev/null
-/* PR c/64824 */
-/* { dg-do run } */
-
-int
-main ()
-{
- long long a;
- long long b = 1LL;
- int c = 3;
-#pragma omp atomic capture
- a = b = c << b;
- if (b != 6LL || a != 6LL)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR c/64868 */
-/* { dg-do run } */
-
-float f = 2.0f;
-double d = 4.0;
-long double ld = 8.0L;
-
-void
-foo ()
-{
-#pragma omp atomic
- f = 1.0f / f;
-#pragma omp atomic
- f = 1 / f;
-#pragma omp atomic
- f = f / 2.0f;
-#pragma omp atomic
- f = f / 2;
-#pragma omp atomic
- f /= 2.0f;
-#pragma omp atomic
- f /= 2;
-#pragma omp atomic
- d = 1.0 / d;
-#pragma omp atomic
- d = 1 / d;
-#pragma omp atomic
- d = d / 2.0;
-#pragma omp atomic
- d = d / 2;
-#pragma omp atomic
- d /= 2.0;
-#pragma omp atomic
- d /= 2;
-#pragma omp atomic
- ld = 1.0L / ld;
-#pragma omp atomic
- ld = 1 / ld;
-#pragma omp atomic
- ld = ld / 2.0L;
-#pragma omp atomic
- ld = ld / 2;
-#pragma omp atomic
- ld /= 2.0L;
-#pragma omp atomic
- ld /= 2;
- if (f != 0.125f || d != 0.25 || ld != 0.5L)
- __builtin_abort ();
-}
-
-#ifdef __cplusplus
-template <typename T, int N1, int N2>
-void
-bar ()
-{
- T v = ::d;
-#pragma omp atomic
- v *= 16;
-#pragma omp atomic
- v = 1.0 / v;
-#pragma omp atomic
- v = N1 / v;
-#pragma omp atomic
- v = v / 2.0;
-#pragma omp atomic
- v = v / N2;
-#pragma omp atomic
- v /= 2.0;
-#pragma omp atomic
- v /= N2;
- if (v != 0.25)
- __builtin_abort ();
-}
-#endif
-
-int
-main ()
-{
- foo ();
-#ifdef __cplusplus
- bar<float, 1, 2> ();
- bar<double, 1, 2> ();
- bar<long double, 1, 2> ();
-#endif
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-
-int u[1024], v[1024], w[1024];
-
-__attribute__((noinline, noclone)) long
-f1 (long a, long b)
-{
- long d;
- #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
- return d;
-}
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- c += 5;
- e = c;
- }
- return d + c + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-__attribute__((noinline, noclone)) long
-f4 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f1 (0, 1024) != 1024
- || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024)
- || f3 (0, 32, 0, 32) != 64
- || f4 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) void
-f1 (long a, long b)
-{
- long d;
- #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
-}
-
-__attribute__((noinline, noclone)) void
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
-}
-
-__attribute__((noinline, noclone)) void
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
-}
-
-__attribute__((noinline, noclone)) void
-f4 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
-}
-
-int
-main ()
-{
- f1 (0, 1024);
- f2 (0, 1024, 17);
- f3 (0, 32, 0, 32);
- f4 (0, 32, 0, 32);
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-/* { dg-options "-O2" } */
-
-int u[1024], v[1024], w[1024];
-
-__attribute__((noinline, noclone)) long
-f1 (long a, long b)
-{
- long d;
- #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
- return d;
-}
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) linear(c:5) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- c += 5;
- e = c;
- }
- return d + c + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f1 (0, 1024) != 1024
- || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024)
- || f3 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-/* { dg-options "-O2" } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) void
-f1 (long a, long b)
-{
- long d;
- #pragma omp target teams distribute parallel for default(none) firstprivate (a, b) shared(u, v, w)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
-}
-
-__attribute__((noinline, noclone)) void
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
-}
-
-__attribute__((noinline, noclone)) void
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
-}
-
-__attribute__((noinline, noclone)) void
-f4 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
-}
-
-int
-main ()
-{
- f1 (0, 1024);
- f2 (0, 1024, 17);
- f3 (0, 32, 0, 32);
- f4 (0, 32, 0, 32);
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) long
-f1 (long a, long b)
-{
- long d;
- #pragma omp target map(from: d)
- #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
- return d;
-}
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target map(from: d, e)
- #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
- return d + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-__attribute__((noinline, noclone)) long
-f4 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f1 (0, 1024) != 1024
- || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
- || f3 (0, 32, 0, 32) != 64
- || f4 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-/* { dg-options "-O2" } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target map(from: d, e)
- #pragma omp teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
- return d + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
- || f3 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) long
-f1 (long a, long b)
-{
- long d;
- #pragma omp target map(from: d)
- #pragma omp teams distribute simd default(none) firstprivate (a, b) shared(u, v, w)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
- return d;
-}
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target map(from: d, e)
- #pragma omp teams distribute simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
- return d + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-__attribute__((noinline, noclone)) long
-f4 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f1 (0, 1024) != 1024
- || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
- || f3 (0, 32, 0, 32) != 64
- || f4 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) long
-f1 (long a, long b)
-{
- long d;
- #pragma omp target map(from: d)
- #pragma omp teams default(none) shared(a, b, d, u, v, w)
- #pragma omp distribute simd firstprivate (a, b)
- for (d = a; d < b; d++)
- u[d] = v[d] + w[d];
- return d;
-}
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target map(from: d, e)
- #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w)
- #pragma omp distribute simd linear(d) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
- return d + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w)
- #pragma omp distribute simd firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-__attribute__((noinline, noclone)) long
-f4 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams default(none) firstprivate (a1, b1, a2, b2) shared(d1, d2, u, v, w)
- #pragma omp distribute simd collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f1 (0, 1024) != 1024
- || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
- || f3 (0, 32, 0, 32) != 64
- || f4 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR middle-end/66199 */
-/* { dg-do run } */
-
-#pragma omp declare target
-int u[1024], v[1024], w[1024];
-#pragma omp end declare target
-
-__attribute__((noinline, noclone)) long
-f2 (long a, long b, long c)
-{
- long d, e;
- #pragma omp target map(from: d, e)
- #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w)
- #pragma omp distribute lastprivate(d, e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- e = c + d * 5;
- }
- return d + e;
-}
-
-__attribute__((noinline, noclone)) long
-f3 (long a1, long b1, long a2, long b2)
-{
- long d1, d2;
- #pragma omp target map(from: d1, d2)
- #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w)
- #pragma omp distribute firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2)
- for (d1 = a1; d1 < b1; d1++)
- for (d2 = a2; d2 < b2; d2++)
- u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
- return d1 + d2;
-}
-
-int
-main ()
-{
- if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
- || f3 (0, 32, 0, 32) != 64)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* PR c/69389 */
-
-struct S { unsigned int a : 10; unsigned int b : 4; unsigned int c : 18; } s = { 210, 11, 1235 };
-
-unsigned int
-f1 (void)
-{
- unsigned int v;
- #pragma omp atomic read
- v = s.b;
- return v;
-}
-
-void
-f2 (unsigned int v)
-{
- #pragma omp atomic write
- s.b = v;
-}
-
-void
-f3 (void)
-{
- #pragma omp atomic
- s.b |= 1;
-}
-
-int
-f4 (void)
-{
- int v;
- #pragma omp atomic capture
- v = s.b += 8;
- return v;
-}
-
-int
-f5 (void)
-{
- int v;
- #pragma omp atomic capture
- {
- v = s.b;
- s.b -= 4;
- }
- return v;
-}
-
-void
-f6 (void)
-{
- #pragma omp atomic
- s.b = s.b & 7;
-}
-
-void
-f7 (void)
-{
- #pragma omp atomic
- s.b = ~7 & s.b;
-}
-
-int
-f8 (void)
-{
- int v;
- #pragma omp atomic capture
- v = s.b = 8 + s.b;
- return v;
-}
-
-int
-f9 (void)
-{
- int v;
- #pragma omp atomic capture
- {
- v = s.b;
- s.b = s.b - 4;
- }
- return v;
-}
-
-int
-main ()
-{
- if (f1 () != 11)
- __builtin_abort ();
- f2 (4);
- if (s.a != 210 || s.b != 4 || s.c != 1235)
- __builtin_abort ();
- s.a = 813;
- s.c = 31532;
- if (f1 () != 4)
- __builtin_abort ();
- f3 ();
- if (f1 () != 5)
- __builtin_abort ();
- if (s.a != 813 || s.b != 5 || s.c != 31532)
- __builtin_abort ();
- if (f4 () != 13)
- __builtin_abort ();
- if (f1 () != 13)
- __builtin_abort ();
- f2 (14);
- if (s.a != 813 || s.b != 14 || s.c != 31532)
- __builtin_abort ();
- if (f5 () != 14)
- __builtin_abort ();
- if (f1 () != 10 || s.a != 813 || s.b != 10 || s.c != 31532)
- __builtin_abort ();
- f6 ();
- if (f1 () != 2)
- __builtin_abort ();
- f2 (15);
- f7 ();
- if (f1 () != 8)
- __builtin_abort ();
- if (f8 () != 0 || s.a != 813 || s.b != 0 || s.c != 31532)
- __builtin_abort ();
- if (f9 () != 0 || s.a != 813 || s.b != 12 || s.c != 31532)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-additional-options "-msse2" { target sse2_runtime } } */
-/* { dg-additional-options "-mavx" { target avx_runtime } } */
-
-int
-main ()
-{
- int i, j, b, c = 0;
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- b = b + 2;
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- b = b + 3;
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(i) linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- b = b + 2;
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(i:4) linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- b = b + 3;
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- b = b + 2;
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- b = b + 2;
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- b = b + 2;
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- b = b + 3;
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- b = b + 2;
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- b = b + 3;
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- b = b + 2;
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- b = b + 2;
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-additional-options "-msse2" { target sse2_runtime } } */
-/* { dg-additional-options "-mavx" { target avx_runtime } } */
-
-static inline void
-foo (int *b, int *i, int *j, int x)
-{
- *b = *b + x + (*i - *i) + (*j - *j);
-}
-
-int
-main ()
-{
- int i, j, b, c = 0;
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- foo (&b, &i, &j, 3);
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(i) linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd linear(i:4) linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- foo (&b, &i, &j, 3);
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- foo (&b, &i, &j, 3);
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
- for (i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 64 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
- for (i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- foo (&b, &i, &j, 3);
- }
- if (c || i != 64 || b != 7 + 16 * 3)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- i = 4; j = 4; b = 7;
- #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-additional-options "-msse2" { target sse2_runtime } } */
-/* { dg-additional-options "-mavx" { target avx_runtime } } */
-/* { dg-additional-options "-std=c99" } */
-
-int
-main ()
-{
- int b, c = 0;
- b = 7;
- #pragma omp simd linear(b:2) reduction(+:c)
- for (int i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- b = b + 2;
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- b = 7;
- #pragma omp simd linear(b:3) reduction(+:c)
- for (int i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- b = b + 3;
- }
- if (c || b != 7 + 16 * 3)
- __builtin_abort ();
- b = 7;
- #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
- for (int i = 0; i < 8; i++)
- for (int j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- b = b + 2;
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
- for (int i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- b = b + 2;
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
- for (int i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- b = b + 3;
- }
- if (c || b != 7 + 16 * 3)
- __builtin_abort ();
- b = 7;
- #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
- for (int i = 0; i < 8; i++)
- for (int j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- b = b + 2;
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-additional-options "-msse2" { target sse2_runtime } } */
-/* { dg-additional-options "-mavx" { target avx_runtime } } */
-/* { dg-additional-options "-std=c99" } */
-
-static inline void
-foo (int *b, int *i, int *j, int x)
-{
- *b = *b + x + (*i - *i) + (*j - *j);
-}
-
-int
-main ()
-{
- int b, c = 0;
- b = 7;
- #pragma omp simd linear(b:2) reduction(+:c)
- for (int i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- foo (&b, &i, &i, 2);
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- b = 7;
- #pragma omp simd linear(b:3) reduction(+:c)
- for (int i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- foo (&b, &i, &i, 3);
- }
- if (c || b != 7 + 16 * 3)
- __builtin_abort ();
- b = 7;
- #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
- for (int i = 0; i < 8; i++)
- for (int j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
- for (int i = 0; i < 64; i++)
- {
- c = c + (b != 7 + 2 * i);
- foo (&b, &i, &i, 2);
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- b = 7;
- #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
- for (int i = 0; i < 64; i += 4)
- {
- c = c + (b != 7 + i / 4 * 3);
- foo (&b, &i, &i, 3);
- }
- if (c || b != 7 + 16 * 3)
- __builtin_abort ();
- b = 7;
- #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
- for (int i = 0; i < 8; i++)
- for (int j = 0; j < 8; j++)
- {
- c = c + (b != 7 + 2 * j + 2 * 8 * i);
- foo (&b, &i, &j, 2);
- }
- if (c || b != 7 + 64 * 2)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-extern
-#ifdef __cplusplus
-"C"
-#endif
-void abort (void);
-
-void
-fn1 (double *x, double *y, int z)
-{
- int i;
- for (i = 0; i < z; i++)
- {
- x[i] = i & 31;
- y[i] = (i & 63) - 30;
- }
-}
-
-#pragma omp declare target
-int tgtv = 6;
-int
-tgt (void)
-{
- #pragma omp atomic update
- tgtv++;
- return 0;
-}
-#pragma omp end declare target
-
-double
-fn2 (int x, int y, int z)
-{
- double b[1024], c[1024], s = 0;
- int i, j;
- fn1 (b, c, x);
- #pragma omp target data map(to: b)
- {
- #pragma omp target map(tofrom: c, s)
- #pragma omp teams num_teams(y) thread_limit(z) reduction(+:s) firstprivate(x)
- #pragma omp distribute dist_schedule(static, 4) collapse(1)
- for (j=0; j < x; j += y)
- #pragma omp parallel for reduction(+:s)
- for (i = j; i < j + y; i++)
- tgt (), s += b[i] * c[i];
- #pragma omp target update from(b, tgtv)
- }
- return s;
-}
-
-double
-fn3 (int x)
-{
- double b[1024], c[1024], s = 0;
- int i;
- fn1 (b, c, x);
- #pragma omp target map(to: b, c) map(tofrom:s)
- #pragma omp parallel for reduction(+:s)
- for (i = 0; i < x; i++)
- tgt (), s += b[i] * c[i];
- return s;
-}
-
-double
-fn4 (int x, double *p)
-{
- double b[1024], c[1024], d[1024], s = 0;
- int i;
- fn1 (b, c, x);
- fn1 (d + x, p + x, x);
- #pragma omp target map(to: b, c[0:x], d[x:x]) map(to:p[x:64 + (x & 31)]) \
- map(tofrom: s)
- #pragma omp parallel for reduction(+:s)
- for (i = 0; i < x; i++)
- s += b[i] * c[i] + d[x + i] + p[x + i];
- return s;
-}
-
-int
-main ()
-{
- double a = fn2 (128, 4, 6);
- int b = tgtv;
- double c = fn3 (61);
- #pragma omp target update from(tgtv)
- int d = tgtv;
- double e[1024];
- double f = fn4 (64, e);
- if (a != 13888.0 || b != 6 + 128 || c != 4062.0 || d != 6 + 128 + 61
- || f != 8032.0)
- abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-#pragma omp declare target
-extern int v;
-#pragma omp end declare target
-
-int v;
-
-int
-main ()
-{
- #pragma omp target update to(v)
- return 0;
-}
+++ /dev/null
-#ifdef __cplusplus
-extern "C"
-#else
-extern
-#endif
-void abort (void);
-struct S { int s, t; };
-
-void
-foo ()
-{
- int x = 5, y = 6, err = 0;
- struct S u = { 7, 8 }, v = { 9, 10 };
- double s = 11.5, t = 12.5;
- #pragma omp target private (x, u, s) firstprivate (y, v, t) map(from:err)
- {
- x = y;
- u = v;
- s = t;
- err = (x != 6 || y != 6
- || u.s != 9 || u.t != 10 || v.s != 9 || v.t != 10
- || s != 12.5 || t != 12.5);
- x += 1;
- y += 2;
- u.s += 3;
- v.t += 4;
- s += 2.5;
- t += 3.0;
- if (x != 7 || y != 8
- || u.s != 12 || u.t != 10 || v.s != 9 || v.t != 14
- || s != 15.0 || t != 15.5)
- err = 1;
- }
- if (err || x != 5 || y != 6
- || u.s != 7 || u.t != 8 || v.s != 9 || v.t != 10
- || s != 11.5 || t != 12.5)
- abort ();
-}
-
-int
-main ()
-{
- foo ();
- return 0;
-}
+++ /dev/null
-extern
-#ifdef __cplusplus
-"C"
-#endif
-void abort (void);
-
-void
-fn1 (double *x, double *y, int z)
-{
- int i;
- for (i = 0; i < z; i++)
- {
- x[i] = i & 31;
- y[i] = (i & 63) - 30;
- }
-}
-
-double
-fn2 (int x)
-{
- double s = 0;
- double b[3 * x], c[3 * x], d[3 * x], e[3 * x];
- int i;
- fn1 (b, c, x);
- fn1 (e, d + x, x);
- #pragma omp target map(to: b, c[:x], d[x:x], e) map(tofrom: s)
- #pragma omp parallel for reduction(+:s)
- for (i = 0; i < x; i++)
- s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c);
- return s;
-}
-
-double
-fn3 (int x)
-{
- double s = 0;
- double b[3 * x], c[3 * x], d[3 * x], e[3 * x];
- int i;
- fn1 (b, c, x);
- fn1 (e, d, x);
- #pragma omp target map(tofrom: s)
- #pragma omp parallel for reduction(+:s)
- for (i = 0; i < x; i++)
- s += b[i] * c[i] + d[i];
- return s;
-}
-
-double
-fn4 (int x)
-{
- double s = 0;
- double b[3 * x], c[3 * x], d[3 * x], e[3 * x];
- int i;
- fn1 (b, c, x);
- fn1 (e, d + x, x);
- #pragma omp target data map(from: b, c[:x], d[x:x], e)
- {
- #pragma omp target update to(b, c[:x], d[x:x], e)
- #pragma omp target map(c[:x], d[x:x], s)
- #pragma omp parallel for reduction(+:s)
- for (i = 0; i < x; i++)
- {
- s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c);
- b[i] = i + 0.5;
- c[i] = 0.5 - i;
- d[x + i] = 0.5 * i;
- }
- }
- for (i = 0; i < x; i++)
- if (b[i] != i + 0.5 || c[i] != 0.5 - i || d[x + i] != 0.5 * i)
- abort ();
- return s;
-}
-
-int
-main ()
-{
- double a = fn2 (128);
- if (a != 14080.0)
- abort ();
- double b = fn3 (128);
- if (a != b)
- abort ();
- double c = fn4 (256);
- if (c != 28160.0)
- abort ();
- return 0;
-}
+++ /dev/null
-extern
-#ifdef __cplusplus
-"C"
-#endif
-void abort (void);
-int v[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-
-int
-main ()
-{
- #pragma omp parallel num_threads (4)
- #pragma omp single
- {
- int i;
- #pragma omp taskgroup
- {
- for (i = 0; i < 16; i += 2)
- #pragma omp task
- {
- #pragma omp task
- v[i]++;
- #pragma omp task
- v[i + 1]++;
- }
- }
- for (i = 0; i < 16; i++)
- if (v[i] != i + 2)
- abort ();
- #pragma omp taskgroup
- {
- for (i = 0; i < 16; i += 2)
- #pragma omp task
- {
- #pragma omp task
- v[i]++;
- #pragma omp task
- v[i + 1]++;
- #pragma omp taskwait
- }
- }
- for (i = 0; i < 16; i++)
- if (v[i] != i + 3)
- abort ();
- #pragma omp taskgroup
- {
- for (i = 0; i < 16; i += 2)
- #pragma omp task
- {
- #pragma omp task
- v[i]++;
- v[i + 1]++;
- }
- #pragma omp taskwait
- for (i = 0; i < 16; i += 2)
- #pragma omp task
- v[i + 1]++;
- }
- for (i = 0; i < 16; i++)
- if (v[i] != i + 4 + (i & 1))
- abort ();
- #pragma omp taskgroup
- {
- for (i = 0; i < 16; i += 2)
- {
- #pragma omp taskgroup
- {
- #pragma omp task
- v[i]++;
- #pragma omp task
- v[i + 1]++;
- }
- if (v[i] != i + 5 || v[i + 1] != i + 7)
- abort ();
- #pragma omp task
- v[i]++;
- }
- }
- for (i = 0; i < 16; i++)
- if (v[i] != i + 6)
- abort ();
- }
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-options "-O2 -std=c99" } */
-
-int q, r, e;
-
-__attribute__((noinline, noclone)) void
-foo (long a, long b)
-{
- #pragma omp taskloop lastprivate (q) nogroup
- for (long d = a; d < b; d += 2)
- {
- q = d;
- if (d < 2 || d > 6 || (d & 1))
- #pragma omp atomic
- e |= 1;
- }
-}
-
-__attribute__((noinline, noclone)) int
-bar (int a, int b)
-{
- int q = 7;
- #pragma omp taskloop lastprivate (q)
- for (int d = a; d < b; d++)
- {
- if (d < 12 || d > 17)
- #pragma omp atomic
- e |= 1;
- q = d;
- }
- return q;
-}
-
-int
-main ()
-{
- #pragma omp parallel
- #pragma omp single
- {
- foo (2, 7);
- r = bar (12, 18);
- }
- if (q != 6 || r != 17 || e)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-options "-O2 -std=c99" } */
-/* { dg-additional-options "-msse2" { target sse2_runtime } } */
-/* { dg-additional-options "-mavx" { target avx_runtime } } */
-
-int u[1024], v[1024], w[1024], m;
-
-__attribute__((noinline, noclone)) void
-f1 (long a, long b)
-{
- #pragma omp taskloop simd default(none) shared(u, v, w) nogroup
- for (long d = a; d < b; d++)
- u[d] = v[d] + w[d];
-}
-
-__attribute__((noinline, noclone)) int
-f2 (long a, long b, long c)
-{
- int d, e;
- #pragma omp taskloop simd default(none) shared(u, v, w) linear(d:1) linear(c:5) lastprivate(e)
- for (d = a; d < b; d++)
- {
- u[d] = v[d] + w[d];
- c = c + 5;
- e = c + 9;
- }
- return d + c + e;
-}
-
-__attribute__((noinline, noclone)) int
-f3 (long a, long b)
-{
- int d;
- #pragma omp taskloop simd default(none) shared(u, v, w)
- for (d = a; d < b; d++)
- {
- int *p = &d;
- u[d] = v[d] + w[d];
- }
- return d;
-}
-
-__attribute__((noinline, noclone)) int
-f4 (long a, long b, long c, long d)
-{
- int e, f, g;
- #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2) lastprivate(g)
- for (e = a; e < b; e++)
- for (f = c; f < d; f++)
- {
- int *p = &e;
- int *q = &f;
- int r = 32 * e + f;
- u[r] = v[r] + w[r];
- g = r;
- }
- return e + f + g;
-}
-
-__attribute__((noinline, noclone)) int
-f5 (long a, long b, long c, long d)
-{
- int e, f;
- #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2)
- for (e = a; e < b; e++)
- for (f = c; f < d; f++)
- {
- int r = 32 * e + f;
- u[r] = v[r] + w[r];
- }
- return e + f;
-}
-
-int
-main ()
-{
- int i;
- for (i = 0; i < 1024; i++)
- {
- v[i] = i;
- w[i] = i + 1;
- }
- #pragma omp parallel
- #pragma omp single
- f1 (0, 1024);
- for (i = 0; i < 1024; i++)
- if (u[i] != 2 * i + 1)
- __builtin_abort ();
- else
- {
- v[i] = 1024 - i;
- w[i] = 512 - i;
- }
- #pragma omp parallel
- #pragma omp single
- m = f2 (2, 1022, 17);
- for (i = 0; i < 1024; i++)
- if ((i < 2 || i >= 1022) ? u[i] != 2 * i + 1 : u[i] != 1536 - 2 * i)
- __builtin_abort ();
- else
- {
- v[i] = i;
- w[i] = i + 1;
- }
- if (m != 1022 + 2 * (1020 * 5 + 17) + 9)
- __builtin_abort ();
- #pragma omp parallel
- #pragma omp single
- m = f3 (0, 1024);
- for (i = 0; i < 1024; i++)
- if (u[i] != 2 * i + 1)
- __builtin_abort ();
- else
- {
- v[i] = 1024 - i;
- w[i] = 512 - i;
- }
- if (m != 1024)
- __builtin_abort ();
- #pragma omp parallel
- #pragma omp single
- m = f4 (0, 32, 0, 32);
- for (i = 0; i < 1024; i++)
- if (u[i] != 1536 - 2 * i)
- __builtin_abort ();
- else
- {
- v[i] = i;
- w[i] = i + 1;
- }
- if (m != 32 + 32 + 1023)
- __builtin_abort ();
- #pragma omp parallel
- #pragma omp single
- m = f5 (0, 32, 0, 32);
- for (i = 0; i < 1024; i++)
- if (u[i] != 2 * i + 1)
- __builtin_abort ();
- else
- {
- v[i] = 1024 - i;
- w[i] = 512 - i;
- }
- if (m != 32 + 32)
- __builtin_abort ();
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-options "-O2 -std=c99" } */
-
-int g;
-int a[1024];
-
-__attribute__((noinline, noclone)) int
-f1 (int x)
-{
- #pragma omp taskloop firstprivate (x) lastprivate (x)
- for (int i = 0; i < 64; i++)
- {
- if (x != 74)
- __builtin_abort ();
- if (i == 63)
- x = i + 4;
- }
- return x;
-}
-
-__attribute__((noinline, noclone)) void
-f2 (void)
-{
- #pragma omp taskloop firstprivate (g) lastprivate (g) nogroup
- for (int i = 0; i < 64; i++)
- {
- if (g != 77)
- __builtin_abort ();
- if (i == 63)
- g = i + 9;
- }
-}
-
-__attribute__((noinline, noclone)) long long
-f3 (long long a, long long b, long long c)
-{
- long long i;
- int l;
- #pragma omp taskloop default (none) lastprivate (i, l)
- for (i = a; i < b; i += c)
- l = i;
- return l * 7 + i;
-}
-
-__attribute__((noinline, noclone)) long long
-f4 (long long a, long long b, long long c, long long d,
- long long e, long long f, int k)
-{
- long long i, j;
- int l;
- #pragma omp taskloop default (none) collapse(2) \
- firstprivate (k) lastprivate (i, j, k, l)
- for (i = a; i < b; i += e)
- for (j = c; j < d; j += f)
- {
- if (k != 73)
- __builtin_abort ();
- if (i == 31 && j == 46)
- k = i;
- l = j;
- }
- return i + 5 * j + 11 * k + 17 * l;
-}
-
-int
-main ()
-{
- #pragma omp parallel
- #pragma omp single
- {
- if (f1 (74) != 63 + 4)
- __builtin_abort ();
- g = 77;
- f2 ();
- #pragma omp taskwait
- if (g != 63 + 9)
- __builtin_abort ();
- if (f3 (7, 12, 2) != 11 * 7 + 13)
- __builtin_abort ();
- if (f4 (0, 32, 16, 48, 1, 2, 73) != 32 + 5 * 48 + 11 * 31 + 17 * 46)
- __builtin_abort ();
- }
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-/* { dg-options "-O2" } */
-
-int u[64], v;
-
-__attribute__((noinline, noclone)) int
-test (int a, int b, int c, int d, void (*fn) (int, int, int, int),
- int *num_tasks, int *min_iters, int *max_iters)
-{
- int i, t = 0;
- __builtin_memset (u, 0, sizeof u);
- v = 0;
- fn (a, b, c, d);
- *min_iters = 0;
- *max_iters = 0;
- *num_tasks = v;
- if (v)
- {
- *min_iters = u[0];
- *max_iters = u[0];
- t = u[0];
- for (i = 1; i < v; i++)
- {
- if (*min_iters > u[i])
- *min_iters = u[i];
- if (*max_iters < u[i])
- *max_iters = u[i];
- t += u[i];
- }
- }
- return t;
-}
-
-void
-grainsize (int a, int b, int c, int d)
-{
- int i, j = 0, k = 0;
- #pragma omp taskloop firstprivate (j, k) grainsize(d)
- for (i = a; i < b; i += c)
- {
- if (j == 0)
- {
- #pragma omp atomic capture
- k = v++;
- if (k >= 64)
- __builtin_abort ();
- }
- u[k] = ++j;
- }
-}
-
-void
-num_tasks (int a, int b, int c, int d)
-{
- int i, j = 0, k = 0;
- #pragma omp taskloop firstprivate (j, k) num_tasks(d)
- for (i = a; i < b; i += c)
- {
- if (j == 0)
- {
- #pragma omp atomic capture
- k = v++;
- if (k >= 64)
- __builtin_abort ();
- }
- u[k] = ++j;
- }
-}
-
-int
-main ()
-{
- #pragma omp parallel
- #pragma omp single
- {
- int min_iters, max_iters, ntasks;
- /* If grainsize is present, # of task loop iters is >= grainsize && < 2 * grainsize,
- unless # of loop iterations is smaller than grainsize. */
- if (test (0, 79, 1, 17, grainsize, &ntasks, &min_iters, &max_iters) != 79
- || min_iters < 17 || max_iters >= 17 * 2)
- __builtin_abort ();
- if (test (-49, 2541, 7, 28, grainsize, &ntasks, &min_iters, &max_iters) != 370
- || min_iters < 28 || max_iters >= 28 * 2)
- __builtin_abort ();
- if (test (7, 21, 2, 15, grainsize, &ntasks, &min_iters, &max_iters) != 7
- || ntasks != 1 || min_iters != 7 || max_iters != 7)
- __builtin_abort ();
- /* If num_tasks is present, # of task loop iters is min (# of loop iters, num_tasks). */
- if (test (-51, 2500, 48, 9, num_tasks, &ntasks, &min_iters, &max_iters) != 54
- || ntasks != 9)
- __builtin_abort ();
- if (test (0, 25, 2, 17, num_tasks, &ntasks, &min_iters, &max_iters) != 13
- || ntasks != 13)
- __builtin_abort ();
- }
- return 0;
-}
+++ /dev/null
-/* { dg-do run } */
-
-extern
-#ifdef __cplusplus
-"C"
-#endif
-void abort ();
-
-struct S { int s; struct S *t; };
-
-void
-foo (struct S *out, struct S *in)
-{
- out->s += in->s;
-}
-
-void
-bar (struct S *x)
-{
- if (x->s != 6) abort ();
- x->s = 15;
-}
-
-void
-baz (struct S *x, struct S *y)
-{
- x->s = 6;
- x->t = x;
- (void) y;
-}
-
-#pragma omp declare reduction (foo: struct S: foo (&omp_out, &omp_in)) \
- initializer (omp_priv = { 8, &omp_priv })
-#pragma omp declare reduction (foo: char, int, short: omp_out += omp_in - 4) \
- initializer (omp_priv = 4)
-#pragma omp declare reduction (+: struct S: foo (&omp_out, &omp_in)) \
- initializer (baz (&omp_priv, &omp_orig))
-
-void
-test (struct S s, struct S t)
-{
- int q = 0;
- #pragma omp parallel num_threads (4) reduction (+: s, q) reduction (foo: t)
- {
- if (s.s != 6 || s.t != &s || t.s != 8 || t.t != &t)
- abort ();
- s.s = 2;
- t.s = 3;
- q = 1;
- }
- if (s.s != 12 + 2 * q || t.s != 14 + 3 * q)
- abort ();
-}
-
-int
-main ()
-{
- struct S s, t;
- s.s = 9; t.s = 10;
- int h = 30, v = 2, q = 0;
- #pragma omp declare reduction (foo: struct S: omp_out.s *= omp_in.s) \
- initializer (omp_priv = omp_orig)
- {
- #pragma omp declare reduction (foo: struct S: omp_out.s += omp_in.s) \
- initializer (omp_priv = omp_orig)
- #pragma omp parallel num_threads (4) reduction (+: t, q) \
- reduction (min: h) reduction (foo: s, v)
- {
- if (s.s != 9 || t.s != 6 || v != 4 || h != __INT_MAX__) abort ();
- asm volatile ("" : "+m" (s.s), "+m" (t.s));
- asm volatile ("" : "+r" (h), "+r" (v));
- h = t.s; s.s++; t.s++; v++; q++;
- }
- }
- if (h != 6 || s.s != 9 + q * 10 || t.s != 10 + q * 7 || v != 2 + q)
- abort ();
- s.s = 12;
- t.s = 14;
- test (s, t);
- return 0;
-}