6 |
|
* Copyright 1996 Bernd Schmidt |
7 |
|
*/ |
8 |
|
|
9 |
< |
#if defined(__i386__) && defined(X86_ASSEMBLY) |
9 |
> |
#ifndef M68K_FLAGS_H |
10 |
> |
#define M68K_FLAGS_H |
11 |
|
|
12 |
+ |
#ifdef OPTIMIZED_FLAGS |
13 |
+ |
|
14 |
+ |
#if (defined(__i386__) && defined(X86_ASSEMBLY)) || (defined(__x86_64__) && defined(X86_64_ASSEMBLY)) |
15 |
+ |
|
16 |
+ |
#ifndef SAHF_SETO_PROFITABLE |
17 |
+ |
|
18 |
+ |
/* PUSH/POP instructions are naturally 64-bit sized on x86-64, thus |
19 |
+ |
unsigned long hereunder is either 64-bit or 32-bit wide depending |
20 |
+ |
on the target. */ |
21 |
|
struct flag_struct { |
22 |
< |
unsigned int cznv; |
23 |
< |
unsigned int x; |
22 |
> |
unsigned long cznv; |
23 |
> |
unsigned long x; |
24 |
|
}; |
25 |
|
|
26 |
< |
#define SET_ZFLG(y) (regflags.cznv = (regflags.cznv & ~0x40) | (((y) & 1) << 6)) |
27 |
< |
#define SET_CFLG(y) (regflags.cznv = (regflags.cznv & ~1) | ((y) & 1)) |
28 |
< |
#define SET_VFLG(y) (regflags.cznv = (regflags.cznv & ~0x800) | (((y) & 1) << 11)) |
29 |
< |
#define SET_NFLG(y) (regflags.cznv = (regflags.cznv & ~0x80) | (((y) & 1) << 7)) |
30 |
< |
#define SET_XFLG(y) (regflags.x = (y)) |
31 |
< |
|
32 |
< |
#define GET_ZFLG ((regflags.cznv >> 6) & 1) |
33 |
< |
#define GET_CFLG (regflags.cznv & 1) |
34 |
< |
#define GET_VFLG ((regflags.cznv >> 11) & 1) |
35 |
< |
#define GET_NFLG ((regflags.cznv >> 7) & 1) |
36 |
< |
#define GET_XFLG (regflags.x & 1) |
26 |
> |
#define FLAGVAL_Z 0x40 |
27 |
> |
#define FLAGVAL_N 0x80 |
28 |
> |
|
29 |
> |
#define SET_ZFLG(y) (regflags.cznv = (((uae_u32)regflags.cznv) & ~0x40) | (((y) & 1) << 6)) |
30 |
> |
#define SET_CFLG(y) (regflags.cznv = (((uae_u32)regflags.cznv) & ~1) | ((y) & 1)) |
31 |
> |
#define SET_VFLG(y) (regflags.cznv = (((uae_u32)regflags.cznv) & ~0x800) | (((y) & 1) << 11)) |
32 |
> |
#define SET_NFLG(y) (regflags.cznv = (((uae_u32)regflags.cznv) & ~0x80) | (((y) & 1) << 7)) |
33 |
> |
#define SET_XFLG(y) (regflags.x = (y)) |
34 |
> |
|
35 |
> |
#define GET_ZFLG ((regflags.cznv >> 6) & 1) |
36 |
> |
#define GET_CFLG (regflags.cznv & 1) |
37 |
> |
#define GET_VFLG ((regflags.cznv >> 11) & 1) |
38 |
> |
#define GET_NFLG ((regflags.cznv >> 7) & 1) |
39 |
> |
#define GET_XFLG (regflags.x & 1) |
40 |
> |
|
41 |
> |
#define CLEAR_CZNV (regflags.cznv = 0) |
42 |
> |
#define GET_CZNV (regflags.cznv) |
43 |
> |
#define IOR_CZNV(X) (regflags.cznv |= (X)) |
44 |
> |
#define SET_CZNV(X) (regflags.cznv = (X)) |
45 |
|
|
46 |
< |
#define CLEAR_CZNV (regflags.cznv = 0) |
29 |
< |
#define COPY_CARRY (regflags.x = regflags.cznv) |
46 |
> |
#define COPY_CARRY (regflags.x = regflags.cznv) |
47 |
|
|
48 |
|
extern struct flag_struct regflags __asm__ ("regflags"); |
49 |
|
|
75 |
|
return 0; |
76 |
|
} |
77 |
|
|
78 |
< |
#define x86_flag_testl(v) \ |
79 |
< |
__asm__ __volatile__ ("testl %1,%1\n\t" \ |
80 |
< |
"pushfl\n\t" \ |
81 |
< |
"popl %0\n\t" \ |
78 |
> |
#define optflag_testl(v) \ |
79 |
> |
__asm__ __volatile__ ("andl %1,%1\n\t" \ |
80 |
> |
"pushf\n\t" \ |
81 |
> |
"pop %0\n\t" \ |
82 |
|
: "=r" (regflags.cznv) : "r" (v) : "cc") |
83 |
|
|
84 |
< |
#define x86_flag_testw(v) \ |
85 |
< |
__asm__ __volatile__ ("testw %w1,%w1\n\t" \ |
86 |
< |
"pushfl\n\t" \ |
87 |
< |
"popl %0\n\t" \ |
84 |
> |
#define optflag_testw(v) \ |
85 |
> |
__asm__ __volatile__ ("andw %w1,%w1\n\t" \ |
86 |
> |
"pushf\n\t" \ |
87 |
> |
"pop %0\n\t" \ |
88 |
|
: "=r" (regflags.cznv) : "r" (v) : "cc") |
89 |
|
|
90 |
< |
#define x86_flag_testb(v) \ |
91 |
< |
__asm__ __volatile__ ("testb %b1,%b1\n\t" \ |
92 |
< |
"pushfl\n\t" \ |
93 |
< |
"popl %0\n\t" \ |
90 |
> |
#define optflag_testb(v) \ |
91 |
> |
__asm__ __volatile__ ("andb %b1,%b1\n\t" \ |
92 |
> |
"pushf\n\t" \ |
93 |
> |
"pop %0\n\t" \ |
94 |
|
: "=r" (regflags.cznv) : "q" (v) : "cc") |
95 |
|
|
96 |
< |
#define x86_flag_addl(v, s, d) do { \ |
96 |
> |
#define optflag_addl(v, s, d) do { \ |
97 |
|
__asm__ __volatile__ ("addl %k2,%k1\n\t" \ |
98 |
< |
"pushfl\n\t" \ |
99 |
< |
"popl %0\n\t" \ |
98 |
> |
"pushf\n\t" \ |
99 |
> |
"pop %0\n\t" \ |
100 |
|
: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \ |
101 |
|
COPY_CARRY; \ |
102 |
|
} while (0) |
103 |
|
|
104 |
< |
#define x86_flag_addw(v, s, d) do { \ |
104 |
> |
#define optflag_addw(v, s, d) do { \ |
105 |
|
__asm__ __volatile__ ("addw %w2,%w1\n\t" \ |
106 |
< |
"pushfl\n\t" \ |
107 |
< |
"popl %0\n\t" \ |
106 |
> |
"pushf\n\t" \ |
107 |
> |
"pop %0\n\t" \ |
108 |
|
: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \ |
109 |
|
COPY_CARRY; \ |
110 |
|
} while (0) |
111 |
|
|
112 |
< |
#define x86_flag_addb(v, s, d) do { \ |
112 |
> |
#define optflag_addb(v, s, d) do { \ |
113 |
|
__asm__ __volatile__ ("addb %b2,%b1\n\t" \ |
114 |
< |
"pushfl\n\t" \ |
115 |
< |
"popl %0\n\t" \ |
114 |
> |
"pushf\n\t" \ |
115 |
> |
"pop %0\n\t" \ |
116 |
|
: "=r" (regflags.cznv), "=q" (v) : "qmi" (s), "1" (d) : "cc"); \ |
117 |
|
COPY_CARRY; \ |
118 |
|
} while (0) |
119 |
|
|
120 |
< |
#define x86_flag_subl(v, s, d) do { \ |
120 |
> |
#define optflag_subl(v, s, d) do { \ |
121 |
|
__asm__ __volatile__ ("subl %k2,%k1\n\t" \ |
122 |
< |
"pushfl\n\t" \ |
123 |
< |
"popl %0\n\t" \ |
122 |
> |
"pushf\n\t" \ |
123 |
> |
"pop %0\n\t" \ |
124 |
|
: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \ |
125 |
|
COPY_CARRY; \ |
126 |
|
} while (0) |
127 |
|
|
128 |
< |
#define x86_flag_subw(v, s, d) do { \ |
128 |
> |
#define optflag_subw(v, s, d) do { \ |
129 |
|
__asm__ __volatile__ ("subw %w2,%w1\n\t" \ |
130 |
< |
"pushfl\n\t" \ |
131 |
< |
"popl %0\n\t" \ |
130 |
> |
"pushf\n\t" \ |
131 |
> |
"pop %0\n\t" \ |
132 |
|
: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \ |
133 |
|
COPY_CARRY; \ |
134 |
|
} while (0) |
135 |
|
|
136 |
< |
#define x86_flag_subb(v, s, d) do { \ |
136 |
> |
#define optflag_subb(v, s, d) do { \ |
137 |
|
__asm__ __volatile__ ("subb %b2,%b1\n\t" \ |
138 |
< |
"pushfl\n\t" \ |
139 |
< |
"popl %0\n\t" \ |
138 |
> |
"pushf\n\t" \ |
139 |
> |
"pop %0\n\t" \ |
140 |
|
: "=r" (regflags.cznv), "=q" (v) : "qmi" (s), "1" (d) : "cc"); \ |
141 |
|
COPY_CARRY; \ |
142 |
|
} while (0) |
143 |
|
|
144 |
< |
#define x86_flag_cmpl(s, d) \ |
144 |
> |
#define optflag_cmpl(s, d) \ |
145 |
|
__asm__ __volatile__ ("cmpl %k1,%k2\n\t" \ |
146 |
< |
"pushfl\n\t" \ |
147 |
< |
"popl %0\n\t" \ |
146 |
> |
"pushf\n\t" \ |
147 |
> |
"pop %0\n\t" \ |
148 |
|
: "=r" (regflags.cznv) : "rmi" (s), "r" (d) : "cc") |
149 |
|
|
150 |
< |
#define x86_flag_cmpw(s, d) \ |
150 |
> |
#define optflag_cmpw(s, d) \ |
151 |
|
__asm__ __volatile__ ("cmpw %w1,%w2\n\t" \ |
152 |
< |
"pushfl\n\t" \ |
153 |
< |
"popl %0\n\t" \ |
152 |
> |
"pushf\n\t" \ |
153 |
> |
"pop %0\n\t" \ |
154 |
|
: "=r" (regflags.cznv) : "rmi" (s), "r" (d) : "cc") |
155 |
|
|
156 |
< |
#define x86_flag_cmpb(s, d) \ |
156 |
> |
#define optflag_cmpb(s, d) \ |
157 |
|
__asm__ __volatile__ ("cmpb %b1,%b2\n\t" \ |
158 |
< |
"pushfl\n\t" \ |
159 |
< |
"popl %0\n\t" \ |
158 |
> |
"pushf\n\t" \ |
159 |
> |
"pop %0\n\t" \ |
160 |
|
: "=r" (regflags.cznv) : "qmi" (s), "q" (d) : "cc") |
161 |
|
|
162 |
+ |
#else |
163 |
+ |
|
164 |
+ |
struct flag_struct { |
165 |
+ |
uae_u32 cznv; |
166 |
+ |
uae_u32 x; |
167 |
+ |
}; |
168 |
+ |
|
169 |
+ |
#define FLAGVAL_Z 0x4000 |
170 |
+ |
#define FLAGVAL_N 0x8000 |
171 |
+ |
|
172 |
+ |
#define SET_ZFLG(y) (regflags.cznv = (regflags.cznv & ~0x4000) | (((y) & 1) << 14)) |
173 |
+ |
#define SET_CFLG(y) (regflags.cznv = (regflags.cznv & ~0x100) | (((y) & 1) << 8)) |
174 |
+ |
#define SET_VFLG(y) (regflags.cznv = (regflags.cznv & ~0x1) | (((y) & 1))) |
175 |
+ |
#define SET_NFLG(y) (regflags.cznv = (regflags.cznv & ~0x8000) | (((y) & 1) << 15)) |
176 |
+ |
#define SET_XFLG(y) (regflags.x = (y)) |
177 |
+ |
|
178 |
+ |
#define GET_ZFLG ((regflags.cznv >> 14) & 1) |
179 |
+ |
#define GET_CFLG ((regflags.cznv >> 8) & 1) |
180 |
+ |
#define GET_VFLG ((regflags.cznv >> 0) & 1) |
181 |
+ |
#define GET_NFLG ((regflags.cznv >> 15) & 1) |
182 |
+ |
#define GET_XFLG (regflags.x & 1) |
183 |
+ |
|
184 |
+ |
#define CLEAR_CZNV (regflags.cznv = 0) |
185 |
+ |
#define GET_CZNV (regflags.cznv) |
186 |
+ |
#define IOR_CZNV(X) (regflags.cznv |= (X)) |
187 |
+ |
#define SET_CZNV(X) (regflags.cznv = (X)) |
188 |
+ |
|
189 |
+ |
#define COPY_CARRY (regflags.x = (regflags.cznv)>>8) |
190 |
+ |
|
191 |
+ |
extern struct flag_struct regflags __asm__ ("regflags"); |
192 |
+ |
|
193 |
+ |
static __inline__ int cctrue(int cc) |
194 |
+ |
{ |
195 |
+ |
uae_u32 cznv = regflags.cznv; |
196 |
+ |
switch(cc){ |
197 |
+ |
case 0: return 1; /* T */ |
198 |
+ |
case 1: return 0; /* F */ |
199 |
+ |
case 2: return (cznv & 0x4100) == 0; /* !GET_CFLG && !GET_ZFLG; HI */ |
200 |
+ |
case 3: return (cznv & 0x4100) != 0; /* GET_CFLG || GET_ZFLG; LS */ |
201 |
+ |
case 4: return (cznv & 0x100) == 0; /* !GET_CFLG; CC */ |
202 |
+ |
case 5: return (cznv & 0x100) != 0; /* GET_CFLG; CS */ |
203 |
+ |
case 6: return (cznv & 0x4000) == 0; /* !GET_ZFLG; NE */ |
204 |
+ |
case 7: return (cznv & 0x4000) != 0; /* GET_ZFLG; EQ */ |
205 |
+ |
case 8: return (cznv & 0x01) == 0; /* !GET_VFLG; VC */ |
206 |
+ |
case 9: return (cznv & 0x01) != 0; /* GET_VFLG; VS */ |
207 |
+ |
case 10:return (cznv & 0x8000) == 0; /* !GET_NFLG; PL */ |
208 |
+ |
case 11:return (cznv & 0x8000) != 0; /* GET_NFLG; MI */ |
209 |
+ |
case 12:return (((cznv << 15) ^ cznv) & 0x8000) == 0; /* GET_NFLG == GET_VFLG; GE */ |
210 |
+ |
case 13:return (((cznv << 15) ^ cznv) & 0x8000) != 0;/* GET_NFLG != GET_VFLG; LT */ |
211 |
+ |
case 14: |
212 |
+ |
cznv &= 0xc001; |
213 |
+ |
return (((cznv << 15) ^ cznv) & 0xc000) == 0; /* !GET_ZFLG && (GET_NFLG == GET_VFLG); GT */ |
214 |
+ |
case 15: |
215 |
+ |
cznv &= 0xc001; |
216 |
+ |
return (((cznv << 15) ^ cznv) & 0xc000) != 0; /* GET_ZFLG || (GET_NFLG != GET_VFLG); LE */ |
217 |
+ |
} |
218 |
+ |
abort(); |
219 |
+ |
return 0; |
220 |
+ |
} |
221 |
+ |
|
222 |
+ |
/* Is there any way to do this without declaring *all* memory clobbered? |
223 |
+ |
I.e. any way to tell gcc that some byte-sized value is in %al? */ |
224 |
+ |
#define optflag_testl(v) \ |
225 |
+ |
__asm__ __volatile__ ("andl %0,%0\n\t" \ |
226 |
+ |
"lahf\n\t" \ |
227 |
+ |
"seto %%al\n\t" \ |
228 |
+ |
"movb %%al,regflags\n\t" \ |
229 |
+ |
"movb %%ah,regflags+1\n\t" \ |
230 |
+ |
: : "r" (v) : "%eax","cc","memory") |
231 |
+ |
|
232 |
+ |
#define optflag_testw(v) \ |
233 |
+ |
__asm__ __volatile__ ("andw %w0,%w0\n\t" \ |
234 |
+ |
"lahf\n\t" \ |
235 |
+ |
"seto %%al\n\t" \ |
236 |
+ |
"movb %%al,regflags\n\t" \ |
237 |
+ |
"movb %%ah,regflags+1\n\t" \ |
238 |
+ |
: : "r" (v) : "%eax","cc","memory") |
239 |
+ |
|
240 |
+ |
#define optflag_testb(v) \ |
241 |
+ |
__asm__ __volatile__ ("andb %b0,%b0\n\t" \ |
242 |
+ |
"lahf\n\t" \ |
243 |
+ |
"seto %%al\n\t" \ |
244 |
+ |
"movb %%al,regflags\n\t" \ |
245 |
+ |
"movb %%ah,regflags+1\n\t" \ |
246 |
+ |
: : "q" (v) : "%eax","cc","memory") |
247 |
+ |
|
248 |
+ |
#define optflag_addl(v, s, d) do { \ |
249 |
+ |
__asm__ __volatile__ ("addl %k1,%k0\n\t" \ |
250 |
+ |
"lahf\n\t" \ |
251 |
+ |
"seto %%al\n\t" \ |
252 |
+ |
"movb %%al,regflags\n\t" \ |
253 |
+ |
"movb %%ah,regflags+1\n\t" \ |
254 |
+ |
: "=r" (v) : "rmi" (s), "0" (d) : "%eax","cc","memory"); \ |
255 |
+ |
COPY_CARRY; \ |
256 |
+ |
} while (0) |
257 |
+ |
|
258 |
+ |
#define optflag_addw(v, s, d) do { \ |
259 |
+ |
__asm__ __volatile__ ("addw %w1,%w0\n\t" \ |
260 |
+ |
"lahf\n\t" \ |
261 |
+ |
"seto %%al\n\t" \ |
262 |
+ |
"movb %%al,regflags\n\t" \ |
263 |
+ |
"movb %%ah,regflags+1\n\t" \ |
264 |
+ |
: "=r" (v) : "rmi" (s), "0" (d) : "%eax","cc","memory"); \ |
265 |
+ |
COPY_CARRY; \ |
266 |
+ |
} while (0) |
267 |
+ |
|
268 |
+ |
#define optflag_addb(v, s, d) do { \ |
269 |
+ |
__asm__ __volatile__ ("addb %b1,%b0\n\t" \ |
270 |
+ |
"lahf\n\t" \ |
271 |
+ |
"seto %%al\n\t" \ |
272 |
+ |
"movb %%al,regflags\n\t" \ |
273 |
+ |
"movb %%ah,regflags+1\n\t" \ |
274 |
+ |
: "=q" (v) : "qmi" (s), "0" (d) : "%eax","cc","memory"); \ |
275 |
+ |
COPY_CARRY; \ |
276 |
+ |
} while (0) |
277 |
+ |
|
278 |
+ |
#define optflag_subl(v, s, d) do { \ |
279 |
+ |
__asm__ __volatile__ ("subl %k1,%k0\n\t" \ |
280 |
+ |
"lahf\n\t" \ |
281 |
+ |
"seto %%al\n\t" \ |
282 |
+ |
"movb %%al,regflags\n\t" \ |
283 |
+ |
"movb %%ah,regflags+1\n\t" \ |
284 |
+ |
: "=r" (v) : "rmi" (s), "0" (d) : "%eax","cc","memory"); \ |
285 |
+ |
COPY_CARRY; \ |
286 |
+ |
} while (0) |
287 |
+ |
|
288 |
+ |
#define optflag_subw(v, s, d) do { \ |
289 |
+ |
__asm__ __volatile__ ("subw %w1,%w0\n\t" \ |
290 |
+ |
"lahf\n\t" \ |
291 |
+ |
"seto %%al\n\t" \ |
292 |
+ |
"movb %%al,regflags\n\t" \ |
293 |
+ |
"movb %%ah,regflags+1\n\t" \ |
294 |
+ |
: "=r" (v) : "rmi" (s), "0" (d) : "%eax","cc","memory"); \ |
295 |
+ |
COPY_CARRY; \ |
296 |
+ |
} while (0) |
297 |
+ |
|
298 |
+ |
#define optflag_subb(v, s, d) do { \ |
299 |
+ |
__asm__ __volatile__ ("subb %b1,%b0\n\t" \ |
300 |
+ |
"lahf\n\t" \ |
301 |
+ |
"seto %%al\n\t" \ |
302 |
+ |
"movb %%al,regflags\n\t" \ |
303 |
+ |
"movb %%ah,regflags+1\n\t" \ |
304 |
+ |
: "=q" (v) : "qmi" (s), "0" (d) : "%eax","cc","memory"); \ |
305 |
+ |
COPY_CARRY; \ |
306 |
+ |
} while (0) |
307 |
+ |
|
308 |
+ |
#define optflag_cmpl(s, d) \ |
309 |
+ |
__asm__ __volatile__ ("cmpl %k0,%k1\n\t" \ |
310 |
+ |
"lahf\n\t" \ |
311 |
+ |
"seto %%al\n\t" \ |
312 |
+ |
"movb %%al,regflags\n\t" \ |
313 |
+ |
"movb %%ah,regflags+1\n\t" \ |
314 |
+ |
: : "rmi" (s), "r" (d) : "%eax","cc","memory") |
315 |
+ |
|
316 |
+ |
#define optflag_cmpw(s, d) \ |
317 |
+ |
__asm__ __volatile__ ("cmpw %w0,%w1\n\t" \ |
318 |
+ |
"lahf\n\t" \ |
319 |
+ |
"seto %%al\n\t" \ |
320 |
+ |
"movb %%al,regflags\n\t" \ |
321 |
+ |
"movb %%ah,regflags+1\n\t" \ |
322 |
+ |
: : "rmi" (s), "r" (d) : "%eax","cc","memory"); |
323 |
+ |
|
324 |
+ |
#define optflag_cmpb(s, d) \ |
325 |
+ |
__asm__ __volatile__ ("cmpb %b0,%b1\n\t" \ |
326 |
+ |
"lahf\n\t" \ |
327 |
+ |
"seto %%al\n\t" \ |
328 |
+ |
"movb %%al,regflags\n\t" \ |
329 |
+ |
"movb %%ah,regflags+1\n\t" \ |
330 |
+ |
: : "qmi" (s), "q" (d) : "%eax","cc","memory") |
331 |
+ |
|
332 |
+ |
#endif |
333 |
+ |
|
334 |
|
#elif defined(__sparc__) && (defined(SPARC_V8_ASSEMBLY) || defined(SPARC_V9_ASSEMBLY)) |
335 |
|
|
336 |
|
struct flag_struct { |
340 |
|
|
341 |
|
extern struct flag_struct regflags; |
342 |
|
|
343 |
< |
#define SET_ZFLG(y) (regflags.nzvc = (regflags.nzvc & ~0x04) | (((y) & 1) << 2)) |
344 |
< |
#define SET_CFLG(y) (regflags.nzvc = (regflags.nzvc & ~1) | ((y) & 1)) |
345 |
< |
#define SET_VFLG(y) (regflags.nzvc = (regflags.nzvc & ~0x02) | (((y) & 1) << 1)) |
346 |
< |
#define SET_NFLG(y) (regflags.nzvc = (regflags.nzvc & ~0x08) | (((y) & 1) << 3)) |
347 |
< |
#define SET_XFLG(y) (regflags.x = (y)) |
348 |
< |
|
349 |
< |
#define GET_ZFLG ((regflags.nzvc >> 2) & 1) |
350 |
< |
#define GET_CFLG (regflags.nzvc & 1) |
351 |
< |
#define GET_VFLG ((regflags.nzvc >> 1) & 1) |
352 |
< |
#define GET_NFLG ((regflags.nzvc >> 3) & 1) |
353 |
< |
#define GET_XFLG (regflags.x & 1) |
343 |
> |
#define FLAGVAL_Z 0x04 |
344 |
> |
#define FLAGVAL_N 0x08 |
345 |
> |
|
346 |
> |
#define SET_ZFLG(y) (regflags.nzvc = (regflags.nzvc & ~0x04) | (((y) & 1) << 2)) |
347 |
> |
#define SET_CFLG(y) (regflags.nzvc = (regflags.nzvc & ~1) | ((y) & 1)) |
348 |
> |
#define SET_VFLG(y) (regflags.nzvc = (regflags.nzvc & ~0x02) | (((y) & 1) << 1)) |
349 |
> |
#define SET_NFLG(y) (regflags.nzvc = (regflags.nzvc & ~0x08) | (((y) & 1) << 3)) |
350 |
> |
#define SET_XFLG(y) (regflags.x = (y)) |
351 |
> |
|
352 |
> |
#define GET_ZFLG ((regflags.nzvc >> 2) & 1) |
353 |
> |
#define GET_CFLG (regflags.nzvc & 1) |
354 |
> |
#define GET_VFLG ((regflags.nzvc >> 1) & 1) |
355 |
> |
#define GET_NFLG ((regflags.nzvc >> 3) & 1) |
356 |
> |
#define GET_XFLG (regflags.x & 1) |
357 |
> |
|
358 |
> |
#define CLEAR_CZNV (regflags.nzvc = 0) |
359 |
> |
#define GET_CZNV (reflags.nzvc) |
360 |
> |
#define IOR_CZNV(X) (refglags.nzvc |= (X)) |
361 |
> |
#define SET_CZNV(X) (regflags.nzvc = (X)) |
362 |
|
|
166 |
– |
#define CLEAR_CZNV (regflags.nzvc = 0) |
363 |
|
#define COPY_CARRY (regflags.x = regflags.nzvc) |
364 |
|
|
365 |
|
static __inline__ int cctrue(int cc) |
983 |
|
|
984 |
|
#endif /* SPARC_V9_ASSEMBLY */ |
985 |
|
|
986 |
+ |
#endif |
987 |
+ |
|
988 |
|
#else |
989 |
|
|
990 |
|
struct flag_struct { |
1003 |
|
#define VFLG (regflags.v) |
1004 |
|
#define XFLG (regflags.x) |
1005 |
|
|
1006 |
+ |
#define SET_CFLG(x) (CFLG = (x)) |
1007 |
+ |
#define SET_NFLG(x) (NFLG = (x)) |
1008 |
+ |
#define SET_VFLG(x) (VFLG = (x)) |
1009 |
+ |
#define SET_ZFLG(x) (ZFLG = (x)) |
1010 |
+ |
#define SET_XFLG(x) (XFLG = (x)) |
1011 |
+ |
|
1012 |
+ |
#define GET_CFLG CFLG |
1013 |
+ |
#define GET_NFLG NFLG |
1014 |
+ |
#define GET_VFLG VFLG |
1015 |
+ |
#define GET_ZFLG ZFLG |
1016 |
+ |
#define GET_XFLG XFLG |
1017 |
+ |
|
1018 |
+ |
#define CLEAR_CZNV do { \ |
1019 |
+ |
SET_CFLG (0); \ |
1020 |
+ |
SET_ZFLG (0); \ |
1021 |
+ |
SET_NFLG (0); \ |
1022 |
+ |
SET_VFLG (0); \ |
1023 |
+ |
} while (0) |
1024 |
+ |
|
1025 |
+ |
#define COPY_CARRY (SET_XFLG (GET_CFLG)) |
1026 |
+ |
|
1027 |
|
static __inline__ int cctrue(const int cc) |
1028 |
|
{ |
1029 |
|
switch(cc){ |
1047 |
|
return 0; |
1048 |
|
} |
1049 |
|
|
1050 |
< |
#endif |
1050 |
> |
#endif /* OPTIMIZED_FLAGS */ |
1051 |
> |
|
1052 |
> |
#endif /* M68K_FLAGS_H */ |