simd-3.c: (main): Change type of res and ref from int to double.
authorMaxim Blumenthal <maxim.blumenthal@intel.com>
Tue, 14 Jul 2015 18:54:35 +0000 (18:54 +0000)
committerIlya Verbin <iverbin@gcc.gnu.org>
Tue, 14 Jul 2015 18:54:35 +0000 (18:54 +0000)
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

libgomp/ChangeLog
libgomp/testsuite/libgomp.c/examples-4/simd-3.c
libgomp/testsuite/libgomp.c/examples-4/simd-8.c
libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90
libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90

index 16b84c5..27c205d 100644 (file)
@@ -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...
index 9f33713..9082e49 100644 (file)
@@ -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;
index 397e2a3..bbef778 100644 (file)
@@ -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;
index f2e0047..2c02945 100644 (file)
@@ -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
index a580937..ba7b0f9 100644 (file)
@@ -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