mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 23:35:00 +08:00
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
This commit is contained in:
parent
e056dfd06a
commit
4c1cb4da7a
@ -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...
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user