diff options
author | Maxim Blumenthal <maxim.blumenthal@intel.com> | 2015-07-14 18:54:35 +0000 |
---|---|---|
committer | Ilya Verbin <iverbin@gcc.gnu.org> | 2015-07-14 18:54:35 +0000 |
commit | 4c1cb4da7ae9916e3dae516f360d6a438e5af5e5 (patch) | |
tree | e5dcec9f9dccfd2a80bd5288ad62b0509eff9870 /libgomp | |
parent | e056dfd06a163af1204b2af5b7e44322a3e39cd1 (diff) | |
download | gcc-4c1cb4da7ae9916e3dae516f360d6a438e5af5e5.zip gcc-4c1cb4da7ae9916e3dae516f360d6a438e5af5e5.tar.gz gcc-4c1cb4da7ae9916e3dae516f360d6a438e5af5e5.tar.bz2 |
simd-3.c: (main): Change type of res and ref from int to double.
2015-07-14 Maxim Blumenthal <maxim.blumenthal@intel.com>
libgomp/
* testsuite/libgomp.c/examples-4/simd-3.c: (main): Change type of res
and ref from int to double. Replaced their comparison with
an inequality of their difference and EPS.
* testsuite/libgomp.c/examples-4/simd-8.c: (main): Replace the
comparison of pri and a reference number with an inequality of their
difference and EPS.
* testsuite/libgomp.fortran/examples-4/simd-3.f90: (main): Replaced
the comparison of sum and sum_ref with an inequality of their
difference and EPS.
* testsuite/libgomp.fortran/examples-4/simd-8.f90: (main): Replace
the comparison of pri and a reference number with an inequality of
their difference and EPS.
From-SVN: r225786
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 15 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/examples-4/simd-3.c | 7 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/examples-4/simd-8.c | 8 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 | 7 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 | 8 |
5 files changed, 36 insertions, 9 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 16b84c5..27c205d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,18 @@ +2015-07-14 Maxim Blumenthal <maxim.blumenthal@intel.com> + + * testsuite/libgomp.c/examples-4/simd-3.c: (main): Change type of res + and ref from int to double. Replaced their comparison with + an inequality of their difference and EPS. + * testsuite/libgomp.c/examples-4/simd-8.c: (main): Replace the + comparison of pri and a reference number with an inequality of their + difference and EPS. + * testsuite/libgomp.fortran/examples-4/simd-3.f90: (main): Replaced + the comparison of sum and sum_ref with an inequality of their + difference and EPS. + * testsuite/libgomp.fortran/examples-4/simd-8.f90: (main): Replace + the comparison of pri and a reference number with an inequality of + their difference and EPS. + 2015-07-13 Maxim Blumenthal <maxim.blumenthal@intel.com> * testsuite/libgomp.c++/examples-4/e.53.2.C: Renamed to... diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-3.c b/libgomp/testsuite/libgomp.c/examples-4/simd-3.c index 9f33713..9082e49 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/simd-3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-3.c @@ -46,15 +46,16 @@ double work_ref( double *a, double *b, int n ) int main () { - double a[N], a_ref[N], b[N]; - int res, ref; + double a[N], a_ref[N], b[N], res, ref, diff; init(a, a_ref, b, N); res = work(a, b, N); ref = work_ref(a_ref, b, N); - if (res != ref) + diff = res - ref; + + if (diff > EPS || -diff > EPS) abort (); return 0; diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-8.c b/libgomp/testsuite/libgomp.c/examples-4/simd-8.c index 397e2a3..bbef778 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/simd-8.c +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-8.c @@ -5,6 +5,8 @@ #include <stdlib.h> #include <math.h> +#define EPS 0.005 + int P[1000]; float A[1000]; @@ -31,7 +33,7 @@ float do_work(float *arr) int main(void) { - float pri, arr[1000]; + float pri, arr[1000], diff; for (int i = 0; i < 1000; ++i) { @@ -42,7 +44,9 @@ int main(void) pri = do_work(&arr[0]); - if (pri != 8237.25) + diff = pri - 8237.25; + + if (diff > EPS || -diff > EPS) abort (); return 0; diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 index f2e0047..2c02945 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 @@ -49,11 +49,14 @@ end module program SIMD3 use SIMD3_mod - double precision :: a(128), b(128), sum, sum_ref + double precision :: a(128), b(128), sum, sum_ref, diff + double precision, parameter :: EPS = 0.0000000000000001 call work(a, b, 128, sum) call work_ref(a, b, 128, sum_ref) - if (sum .ne. sum_ref) call abort + diff = sum - sum_ref + + if (diff > EPS .or. -diff > EPS) call abort end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 index a580937..ba7b0f9 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 @@ -34,8 +34,9 @@ end module work program simd_8f use work implicit none - real :: pri, arr(1000) + real :: pri, arr(1000), diff integer :: i + integer, parameter :: EPS = 0.005 do i = 1, 1000 P(i) = i @@ -43,6 +44,9 @@ program simd_8f arr(i) = (i-1) * 1.8 end do pri = do_work(arr) - if (pri .ne. 8237.25) call abort () + + diff = pri - 8237.25 + + if (diff > EPS .or. -diff > EPS) call abort end program |