summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp19/inttest.h
blob: 1f07090547da89769db4b458991270dfd3cbffd1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/* SPDX-License-Identifier: BSD-2-Clause */

/*
 *  This include file contains the CPU dependent implementation
 *  of the following routines needed to test RTEMS floating
 *  point support:
 *           INTEGER_load( &context )
 *           INTEGER_check( &context )
 *
 *  INTEGER_load   - loads the specified floating point context
 *  INTEGER_check  - checks the specified floating point context
 *
 *  NOTE:  These routines are VERY CPU dependent and are thus
 *         located in in the CPU dependent include file
 *         inttest.h.  These routines form the core of the
 *         floating point context switch test.
 *
 *  COPYRIGHT (c) 1989-2011.
 *  On-Line Applications Research Corporation (OAR).
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */


#ifndef __INTEGER_TEST_h
#define __INTEGER_TEST_h

#include <stdio.h>
#define REG_VARIABLE uint32_t

#define INTEGER_DECLARE \
    REG_VARIABLE int01 = 1; \
    REG_VARIABLE int02 = 2; \
    REG_VARIABLE int03 = 3; \
    REG_VARIABLE int04 = 4; \
    REG_VARIABLE int05 = 5; \
    REG_VARIABLE int06 = 6; \
    REG_VARIABLE int07 = 7; \
    REG_VARIABLE int08 = 8; \
    REG_VARIABLE int09 = 9; \
    REG_VARIABLE int10 = 10; \
    REG_VARIABLE int11 = 11; \
    REG_VARIABLE int12 = 12; \
    REG_VARIABLE int13 = 13; \
    REG_VARIABLE int14 = 14; \
    REG_VARIABLE int15 = 15; \
    REG_VARIABLE int16 = 16; \
    REG_VARIABLE int17 = 17; \
    REG_VARIABLE int18 = 18; \
    REG_VARIABLE int19 = 19; \
    REG_VARIABLE int20 = 20; \
    REG_VARIABLE int21 = 21; \
    REG_VARIABLE int22 = 22; \
    REG_VARIABLE int23 = 23; \
    REG_VARIABLE int24 = 24; \
    REG_VARIABLE int25 = 25; \
    REG_VARIABLE int26 = 26; \
    REG_VARIABLE int27 = 27; \
    REG_VARIABLE int28 = 28; \
    REG_VARIABLE int29 = 29; \
    REG_VARIABLE int30 = 30; \
    REG_VARIABLE int31 = 31; \
    REG_VARIABLE int32 = 32

#define INTEGER_LOAD( _factor ) \
  do {                \
    int01  += _factor; \
    int02  += _factor; \
    int03  += _factor; \
    int04  += _factor; \
    int05  += _factor; \
    int06  += _factor; \
    int07  += _factor; \
    int08  += _factor; \
    int09  += _factor; \
    int10  += _factor; \
    int11  += _factor; \
    int12  += _factor; \
    int13  += _factor; \
    int14  += _factor; \
    int15  += _factor; \
    int16  += _factor; \
    int17  += _factor; \
    int18  += _factor; \
    int19  += _factor; \
    int20  += _factor; \
    int21  += _factor; \
    int22  += _factor; \
    int23  += _factor; \
    int24  += _factor; \
    int25  += _factor; \
    int26  += _factor; \
    int27  += _factor; \
    int28  += _factor; \
    int29  += _factor; \
    int30  += _factor; \
    int31  += _factor; \
    int32  += _factor; \
  } while (0)

#define INTEGER_CHECK_ONE( _v, _base, _factor ) \
  if ( (_v) != ((_base) + (_factor)) )  { \
    printf( \
      "%" PRIu32 ": " #_v " wrong -- (0x%" PRIx32 " not 0x%" PRIx32 ")\n", \
      task_index, \
      (_v), \
      (_base + _factor) \
    ); \
  }


#define INTEGER_CHECK( _factor ) \
    do { \
      INTEGER_CHECK_ONE( int01,  1, (_factor) ); \
      INTEGER_CHECK_ONE( int02,  2, (_factor) ); \
      INTEGER_CHECK_ONE( int03,  3, (_factor) ); \
      INTEGER_CHECK_ONE( int04,  4, (_factor) ); \
      INTEGER_CHECK_ONE( int05,  5, (_factor) ); \
      INTEGER_CHECK_ONE( int06,  6, (_factor) ); \
      INTEGER_CHECK_ONE( int07,  7, (_factor) ); \
      INTEGER_CHECK_ONE( int08,  8, (_factor) ); \
      INTEGER_CHECK_ONE( int09,  9, (_factor) ); \
      INTEGER_CHECK_ONE( int10, 10, (_factor) ); \
      INTEGER_CHECK_ONE( int11, 11, (_factor) ); \
      INTEGER_CHECK_ONE( int12, 12, (_factor) ); \
      INTEGER_CHECK_ONE( int13, 13, (_factor) ); \
      INTEGER_CHECK_ONE( int14, 14, (_factor) ); \
      INTEGER_CHECK_ONE( int15, 15, (_factor) ); \
      INTEGER_CHECK_ONE( int16, 16, (_factor) ); \
      INTEGER_CHECK_ONE( int17, 17, (_factor) ); \
      INTEGER_CHECK_ONE( int18, 18, (_factor) ); \
      INTEGER_CHECK_ONE( int19, 19, (_factor) ); \
      INTEGER_CHECK_ONE( int20, 20, (_factor) ); \
      INTEGER_CHECK_ONE( int21, 21, (_factor) ); \
      INTEGER_CHECK_ONE( int22, 22, (_factor) ); \
      INTEGER_CHECK_ONE( int23, 23, (_factor) ); \
      INTEGER_CHECK_ONE( int24, 24, (_factor) ); \
      INTEGER_CHECK_ONE( int25, 25, (_factor) ); \
      INTEGER_CHECK_ONE( int26, 26, (_factor) ); \
      INTEGER_CHECK_ONE( int27, 27, (_factor) ); \
      INTEGER_CHECK_ONE( int28, 28, (_factor) ); \
      INTEGER_CHECK_ONE( int29, 29, (_factor) ); \
      INTEGER_CHECK_ONE( int30, 30, (_factor) ); \
      INTEGER_CHECK_ONE( int31, 31, (_factor) ); \
      INTEGER_CHECK_ONE( int32, 32, (_factor) ); \
    } while (0)

#endif