Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1996
32
    		 Crown Copyright (c) 1996
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 43... Line 73...
43
Revision 1.3  1997/10/13 08:50:06  ma
73
Revision 1.3  1997/10/13 08:50:06  ma
44
Made all pl_tests for general proc & exception handling pass.
74
Made all pl_tests for general proc & exception handling pass.
45
 
75
 
46
Revision 1.2  1997/09/25 06:45:30  ma
76
Revision 1.2  1997/09/25 06:45:30  ma
47
All general_proc tests passed
77
All general_proc tests passed
48
 
78
 
49
Revision 1.1.1.1  1997/03/14 07:50:16  ma
79
Revision 1.1.1.1  1997/03/14 07:50:16  ma
50
Imported from DRA
80
Imported from DRA
51
 
81
 
52
 * Revision 1.1.1.1  1996/09/20  10:56:57  john
82
 * Revision 1.1.1.1  1996/09/20  10:56:57  john
53
 *
83
 *
Line 56... Line 86...
56
 *
86
 *
57
 * Revision 1.1.1.1  1996/03/26  15:45:16  john
87
 * Revision 1.1.1.1  1996/03/26  15:45:16  john
58
 *
88
 *
59
 * Revision 1.2  93/03/03  14:50:17  14:50:17  ra (Robert Andrews)
89
 * Revision 1.2  93/03/03  14:50:17  14:50:17  ra (Robert Andrews)
60
 * Added support for jump_overflow routine.
90
 * Added support for jump_overflow routine.
61
 * 
91
 *
62
 * Revision 1.1  93/02/22  17:16:28  17:16:28  ra (Robert Andrews)
92
 * Revision 1.1  93/02/22  17:16:28  17:16:28  ra (Robert Andrews)
63
 * Initial revision
93
 * Initial revision
64
 * 
94
 *
65
--------------------------------------------------------------------------
95
--------------------------------------------------------------------------
66
*/
96
*/
67
 
97
 
68
 
98
 
69
#ifndef OPS_SHARED_INCLUDED
99
#ifndef OPS_SHARED_INCLUDED
Line 81... Line 111...
81
   ON_OVERFLOW,
111
   ON_OVERFLOW,
82
   ON_CARRY,
112
   ON_CARRY,
83
   ON_FP_OVERFLOW,
113
   ON_FP_OVERFLOW,
84
   ON_FP_CARRY,
114
   ON_FP_CARRY,
85
   ON_FP_OPERAND_ERROR
115
   ON_FP_OPERAND_ERROR
86
} overflow_type ;
116
} overflow_type;
87
 
117
 
88
#define ON_SHAPE( s )	( is_signed ( s ) ? ON_OVERFLOW : ON_CARRY )
118
#define ON_SHAPE(s)	(is_signed(s)? ON_OVERFLOW : ON_CARRY)
89
 
119
 
90
 
120
 
91
/*
121
/*
92
    PROTOTYPES
122
    PROTOTYPES
93
 
123
 
94
    This file is a relic of the old operations.c which was split into
124
    This file is a relic of the old operations.c which was split into
95
    the four ops_*.c files.  These routines were previously static but
125
    the four ops_*.c files.  These routines were previously static but
96
    now must be external.
126
    now must be external.
97
*/
127
*/
98
 
128
 
99
extern void branch PROTO_S ( ( long, exp, int, int, int ) ) ;
129
extern void branch(long, exp, int, int, int);
100
extern int branch_ins PROTO_S ( ( long, int, int, int ) ) ;
130
extern int branch_ins(long, int, int, int);
101
extern void jump_overflow PROTO_S ( ( int ) ) ;
131
extern void jump_overflow(int);
102
extern void test_overflow PROTO_S ( ( overflow_type ) ) ;
132
extern void test_overflow(overflow_type);
103
extern void test_overflow2 PROTO_S ( ( int ) ) ;
133
extern void test_overflow2(int);
104
extern void push PROTO_S ( ( shape, long, where ) ) ;
134
extern void push(shape, long, where);
105
extern void push_float PROTO_S ( ( long, where ) ) ;
135
extern void push_float(long, where);
106
extern void pop PROTO_S ( ( shape, long, where ) ) ;
136
extern void pop(shape, long, where);
107
extern void pop_float PROTO_S ( ( long, where ) ) ;
137
extern void pop_float(long, where);
108
extern void shift_aux PROTO_S ( ( shape, where, where, where, int, int ) ) ;
138
extern void shift_aux(shape, where, where, where, int, int);
109
extern void checkalloc_stack PROTO_S ( (where, int) );
139
extern void checkalloc_stack(where, int);
110
extern int set_overflow PROTO_S ( ( exp ) );
140
extern int set_overflow(exp);
111
extern int have_overflow PROTO_S ( ( void ) );
141
extern int have_overflow(void);
112
extern void clear_overflow PROTO_S ( ( int ) );
142
extern void clear_overflow(int);
113
extern void reset_round_mode PROTO_S ( ( void ) );
143
extern void reset_round_mode(void);
114
extern void cmp_zero PROTO_S ( ( shape, long, where ) ) ;
144
extern void cmp_zero(shape, long, where);
115
 
145
 
116
 
146
 
117
/*
147
/*
118
    CONDITION CODES
148
    CONDITION CODES
119
 
149
 
120
    These condition codes are used to eliminate unnecessary comparison
150
    These condition codes are used to eliminate unnecessary comparison
121
    instructions.
151
    instructions.
122
*/
152
*/
123
 
153
 
124
extern where last_cond ;
154
extern where last_cond;
125
extern where last_cond2 ;
155
extern where last_cond2;
126
extern where last_cond_alt ;
156
extern where last_cond_alt;
127
extern long last_cond_sz ;
157
extern long last_cond_sz;
128
 
158
 
129
 
159
 
130
/*
160
/*
131
    SET CONDITION CODES
161
    SET CONDITION CODES
132
 
162
 
133
    This macro is used to set the condition codes for the where X of
163
    This macro is used to set the condition codes for the where X of
134
    size Y.
164
    size Y.
135
*/
165
*/
136
 
166
 
137
#define  set_cond( X, Y )		\
167
#define  set_cond(X, Y)		\
138
    {					\
168
    {					\
139
	have_cond = 1 ;			\
169
	have_cond = 1; \
140
	last_cond = ( X ) ;		\
170
	last_cond = (X);		\
141
	last_cond_sz = ( Y ) ;		\
171
	last_cond_sz = (Y);		\
142
    }
172
    }
143
 
173
 
144
 
174
 
145
/*
175
/*
146
    SET ALTERNATIVE CONDITION CODES
176
    SET ALTERNATIVE CONDITION CODES
147
 
177
 
148
    This macro is used to set the alterative last condition to X.
178
    This macro is used to set the alterative last condition to X.
149
*/
179
*/
150
 
180
 
151
#define  set_cond_alt( X )		\
181
#define  set_cond_alt(X)		\
152
    {					\
182
    {					\
153
	have_cond = 3 ;			\
183
	have_cond = 3; \
154
	last_cond_alt = ( X ) ;		\
184
	last_cond_alt = (X);		\
155
    }
185
    }
156
 
186
 
157
 
187
 
158
/*
188
/*
159
    OUTPUT A COMPARISON INSTRUCTION
189
    OUTPUT A COMPARISON INSTRUCTION
Line 161... Line 191...
161
    Some assemblers (e.g. HP) reverse the order of the operands in
191
    Some assemblers (e.g. HP) reverse the order of the operands in
162
    comparison instructions.  This macro handles this fact.
192
    comparison instructions.  This macro handles this fact.
163
*/
193
*/
164
 
194
 
165
#ifndef asm_cmp_reversed
195
#ifndef asm_cmp_reversed
166
#define ins2_cmp( I, S1, S2, X1, X2, M ) ins2 ( I, S1, S2, X1, X2, M )
196
#define ins2_cmp(I, S1, S2, X1, X2, M)ins2(I, S1, S2, X1, X2, M)
167
#else
197
#else
168
#define ins2_cmp( I, S1, S2, X1, X2, M ) ins2 ( I, S2, S1, X2, X1, M )
198
#define ins2_cmp(I, S1, S2, X1, X2, M)ins2(I, S2, S1, X2, X1, M)
169
#endif
199
#endif
170
 
200
 
171
 
201
 
172
#endif
202
#endif