source: rtems/testsuites/tmtests/tm26/fptest.h @ 4b374f36

4.104.114.84.95
Last change on this file since 4b374f36 was 4b374f36, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 17, 1995 at 7:36:43 PM

maximum number of messages removed and include statement cleanup

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*  fptest.h
2 *
3 *  This include file contains the CPU dependent implementation
4 *  of the following routines needed to test RTEMS floating
5 *  point support:
6 *           FP_load( &context )
7 *           FP_check( &context )
8 *
9 *  FP_load   - loads the specified floating point context
10 *  FP_check  - checks the specified floating point context
11 *
12 *  NOTE:  These routines are VERY CPU dependent and are thus
13 *         located in in the CPU dependent include file
14 *         fptest.h.  These routines form the core of the
15 *         floating point context switch test.
16 *
17 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
18 *  On-Line Applications Research Corporation (OAR).
19 *  All rights assigned to U.S. Government, 1994.
20 *
21 *  This material may be reproduced by or for the U.S. Government pursuant
22 *  to the copyright license under the clause at DFARS 252.227-7013.  This
23 *  notice must appear in all copies of this file and its derivatives.
24 *
25 *  fptest.h,v 1.2 1995/05/31 17:19:26 joel Exp
26 */
27
28
29#ifndef __FPTEST_h
30#define __FPTEST_h
31
32#include <stdio.h>
33
34#ifndef CPU_HARDWARE_FP
35#error "This CPU does not have CPU_HARDWARE_FP defined"
36#endif
37
38#if ( CPU_HARDWARE_FP == FALSE )
39
40#define FP_DECLARE
41#define FP_LOAD( _factor )
42#define FP_CHECK( _factor ) 0
43
44#else
45
46#define FP_DECLARE \
47    double  fp01 = 1.0; \
48    double  fp02 = 2.0; \
49    double  fp03 = 3.0; \
50    double  fp04 = 4.0; \
51    double  fp05 = 5.0; \
52    double  fp06 = 6.0; \
53    double  fp07 = 7.0; \
54    double  fp08 = 8.0; \
55    double  fp09 = 9.0; \
56    double  fp10 = 10.0; \
57    double  fp11 = 11.0; \
58    double  fp12 = 12.0; \
59    double  fp13 = 13.0; \
60    double  fp14 = 14.0; \
61    double  fp15 = 15.0; \
62    double  fp16 = 16.0; \
63    double  fp17 = 17.0; \
64    double  fp18 = 18.0; \
65    double  fp19 = 19.0; \
66    double  fp20 = 20.0; \
67    double  fp21 = 21.0; \
68    double  fp22 = 22.0; \
69    double  fp23 = 23.0; \
70    double  fp24 = 24.0; \
71    double  fp25 = 25.0; \
72    double  fp26 = 26.0; \
73    double  fp27 = 27.0; \
74    double  fp28 = 28.0; \
75    double  fp29 = 29.0; \
76    double  fp30 = 30.0; \
77    double  fp31 = 31.0; \
78    double  fp32 = 32.0
79
80#define FP_LOAD( _factor ) \
81  do {                \
82    fp01  += _factor; \
83    fp02  += _factor; \
84    fp03  += _factor; \
85    fp04  += _factor; \
86    fp05  += _factor; \
87    fp06  += _factor; \
88    fp07  += _factor; \
89    fp08  += _factor; \
90    fp09  += _factor; \
91    fp10  += _factor; \
92    fp11  += _factor; \
93    fp12  += _factor; \
94    fp13  += _factor; \
95    fp14  += _factor; \
96    fp15  += _factor; \
97    fp16  += _factor; \
98    fp17  += _factor; \
99    fp18  += _factor; \
100    fp19  += _factor; \
101    fp20  += _factor; \
102    fp21  += _factor; \
103    fp22  += _factor; \
104    fp23  += _factor; \
105    fp24  += _factor; \
106    fp25  += _factor; \
107    fp26  += _factor; \
108    fp27  += _factor; \
109    fp28  += _factor; \
110    fp29  += _factor; \
111    fp30  += _factor; \
112    fp31  += _factor; \
113    fp32  += _factor; \
114  } while (0)
115
116#define EPSILON    (0.0005)
117#define FPABS(d)   (((d) < 0.0) ? -(d) : (d))
118#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON)
119
120#define FP_CHECK_ONE( _v, _base, _factor ) \
121      if ( FPNEQ( (_v), ((_base) + (_factor)) ) )  { \
122          printf("%d: " #_v " wrong -- (%g not %g)\n", \
123             task_index, (_v), (_base + _factor));  \
124      }
125
126
127#define FP_CHECK( _factor ) \
128    do { \
129      FP_CHECK_ONE( fp01,  1.0, (_factor) ); \
130      FP_CHECK_ONE( fp02,  2.0, (_factor) ); \
131      FP_CHECK_ONE( fp03,  3.0, (_factor) ); \
132      FP_CHECK_ONE( fp04,  4.0, (_factor) ); \
133      FP_CHECK_ONE( fp05,  5.0, (_factor) ); \
134      FP_CHECK_ONE( fp06,  6.0, (_factor) ); \
135      FP_CHECK_ONE( fp07,  7.0, (_factor) ); \
136      FP_CHECK_ONE( fp08,  8.0, (_factor) ); \
137      FP_CHECK_ONE( fp09,  9.0, (_factor) ); \
138      FP_CHECK_ONE( fp10, 10.0, (_factor) ); \
139      FP_CHECK_ONE( fp11, 11.0, (_factor) ); \
140      FP_CHECK_ONE( fp12, 12.0, (_factor) ); \
141      FP_CHECK_ONE( fp13, 13.0, (_factor) ); \
142      FP_CHECK_ONE( fp14, 14.0, (_factor) ); \
143      FP_CHECK_ONE( fp15, 15.0, (_factor) ); \
144      FP_CHECK_ONE( fp16, 16.0, (_factor) ); \
145      FP_CHECK_ONE( fp17, 17.0, (_factor) ); \
146      FP_CHECK_ONE( fp18, 18.0, (_factor) ); \
147      FP_CHECK_ONE( fp19, 19.0, (_factor) ); \
148      FP_CHECK_ONE( fp20, 20.0, (_factor) ); \
149      FP_CHECK_ONE( fp21, 21.0, (_factor) ); \
150      FP_CHECK_ONE( fp22, 22.0, (_factor) ); \
151      FP_CHECK_ONE( fp23, 23.0, (_factor) ); \
152      FP_CHECK_ONE( fp24, 24.0, (_factor) ); \
153      FP_CHECK_ONE( fp25, 25.0, (_factor) ); \
154      FP_CHECK_ONE( fp26, 26.0, (_factor) ); \
155      FP_CHECK_ONE( fp27, 27.0, (_factor) ); \
156      FP_CHECK_ONE( fp28, 28.0, (_factor) ); \
157      FP_CHECK_ONE( fp29, 29.0, (_factor) ); \
158      FP_CHECK_ONE( fp30, 30.0, (_factor) ); \
159      FP_CHECK_ONE( fp31, 31.0, (_factor) ); \
160      FP_CHECK_ONE( fp32, 32.0, (_factor) ); \
161    } while (0)
162
163#endif
164
165#endif
Note: See TracBrowser for help on using the repository browser.