From: Maxim Blumenthal Date: Tue, 14 Jul 2015 18:54:35 +0000 (+0000) Subject: simd-3.c: (main): Change type of res and ref from int to double. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c1cb4da7ae9916e3dae516f360d6a438e5af5e5;p=gcc.git simd-3.c: (main): Change type of res and ref from int to double. 2015-07-14 Maxim Blumenthal 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 --- diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 16b84c50544..27c205d495d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,18 @@ +2015-07-14 Maxim Blumenthal + + * 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 * 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 9f33713d356..9082e49ecc3 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 397e2a340aa..bbef778b776 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 #include +#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 f2e00475d21..2c02945de87 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 a58093730dd..ba7b0f90a4e 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