1 |
gbeauche |
1.1 |
#ifndef NOFLAGS_H |
2 |
|
|
#define NOFLAGS_H |
3 |
|
|
|
4 |
|
|
/* Undefine everything that will *set* flags. Note: Leave *reading* |
5 |
|
|
flags alone ;-). We assume that nobody does something like |
6 |
|
|
SET_ZFLG(a=b+c), i.e. expect side effects of the macros. That would |
7 |
|
|
be a stupid thing to do when using macros. |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
/* Gwenole Beauchesne pointed out that CAS and CAS2 use flag_cmp to set |
11 |
|
|
flags that are then used internally, and that thus the noflags versions |
12 |
|
|
of those instructions were broken. Oops! |
13 |
|
|
Easy fix: Leave flag_cmp alone. It is only used by CMP* and CAS* |
14 |
|
|
instructions. For CAS*, noflags is a bad idea. For CMP*, which has |
15 |
|
|
setting flags as its only function, the noflags version is kinda pointless, |
16 |
|
|
anyway. |
17 |
|
|
Note that this will only work while using the optflag_* routines --- |
18 |
|
|
as we do on all (one ;-) platforms that will ever use the noflags |
19 |
|
|
versions, anyway. |
20 |
|
|
However, if you try to compile without optimized flags, the "SET_ZFLAG" |
21 |
|
|
macro will be left unchanged, to make CAS and CAS2 work right. Of course, |
22 |
|
|
this is contrary to the whole idea of noflags, but better be right than |
23 |
|
|
be fast. |
24 |
|
|
|
25 |
|
|
Another problem exists with one of the bitfield operations. Once again, |
26 |
|
|
one of the operations sets a flag, and looks at it later. And the CHK2 |
27 |
|
|
instruction does so as well. For those, a different solution is possible. |
28 |
|
|
the *_ALWAYS versions of the SET_?FLG macros shall remain untouched by |
29 |
|
|
the redefinitions in this file. |
30 |
|
|
Unfortunately, they are defined in terms of the macros we *do* redefine. |
31 |
|
|
So here comes a bit of trickery.... |
32 |
|
|
*/ |
33 |
|
|
#define NOFLAGS_CMP 0 |
34 |
|
|
|
35 |
|
|
#undef SET_NFLG_ALWAYS |
36 |
|
|
static __inline__ void SET_NFLG_ALWAYS(uae_u32 x) |
37 |
|
|
{ |
38 |
|
|
SET_NFLG(x); /* This has not yet been redefined */ |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
#undef SET_CFLG_ALWAYS |
42 |
|
|
static __inline__ void SET_CFLG_ALWAYS(uae_u32 x) |
43 |
|
|
{ |
44 |
|
|
SET_CFLG(x); /* This has not yet been redefined */ |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
#undef CPUFUNC |
48 |
|
|
#define CPUFUNC(x) x##_nf |
49 |
|
|
|
50 |
|
|
#ifndef OPTIMIZED_FLAGS |
51 |
|
|
#undef SET_ZFLG |
52 |
|
|
#define SET_ZFLG(y) do {uae_u32 dummy=(y); } while (0) |
53 |
|
|
#endif |
54 |
|
|
|
55 |
|
|
#undef SET_CFLG |
56 |
|
|
#define SET_CFLG(y) do {uae_u32 dummy=(y); } while (0) |
57 |
|
|
#undef SET_VFLG |
58 |
|
|
#define SET_VFLG(y) do {uae_u32 dummy=(y); } while (0) |
59 |
|
|
#undef SET_NFLG |
60 |
|
|
#define SET_NFLG(y) do {uae_u32 dummy=(y); } while (0) |
61 |
|
|
#undef SET_XFLG |
62 |
|
|
#define SET_XFLG(y) do {uae_u32 dummy=(y); } while (0) |
63 |
|
|
|
64 |
|
|
#undef CLEAR_CZNV |
65 |
|
|
#define CLEAR_CZNV |
66 |
|
|
#undef IOR_CZNV |
67 |
|
|
#define IOR_CZNV(y) do {uae_u32 dummy=(y); } while (0) |
68 |
|
|
#undef SET_CZNV |
69 |
|
|
#define SET_CZNV(y) do {uae_u32 dummy=(y); } while (0) |
70 |
|
|
#undef COPY_CARRY |
71 |
|
|
#define COPY_CARRY |
72 |
|
|
|
73 |
|
|
#ifdef optflag_testl |
74 |
|
|
#undef optflag_testl |
75 |
|
|
#endif |
76 |
|
|
|
77 |
|
|
#ifdef optflag_testw |
78 |
|
|
#undef optflag_testw |
79 |
|
|
#endif |
80 |
|
|
|
81 |
|
|
#ifdef optflag_testb |
82 |
|
|
#undef optflag_testb |
83 |
|
|
#endif |
84 |
|
|
|
85 |
|
|
#ifdef optflag_addl |
86 |
|
|
#undef optflag_addl |
87 |
|
|
#endif |
88 |
|
|
|
89 |
|
|
#ifdef optflag_addw |
90 |
|
|
#undef optflag_addw |
91 |
|
|
#endif |
92 |
|
|
|
93 |
|
|
#ifdef optflag_addb |
94 |
|
|
#undef optflag_addb |
95 |
|
|
#endif |
96 |
|
|
|
97 |
|
|
#ifdef optflag_subl |
98 |
|
|
#undef optflag_subl |
99 |
|
|
#endif |
100 |
|
|
|
101 |
|
|
#ifdef optflag_subw |
102 |
|
|
#undef optflag_subw |
103 |
|
|
#endif |
104 |
|
|
|
105 |
|
|
#ifdef optflag_subb |
106 |
|
|
#undef optflag_subb |
107 |
|
|
#endif |
108 |
|
|
|
109 |
|
|
#if NOFLAGS_CMP |
110 |
|
|
#ifdef optflag_cmpl |
111 |
|
|
#undef optflag_cmpl |
112 |
|
|
#endif |
113 |
|
|
|
114 |
|
|
#ifdef optflag_cmpw |
115 |
|
|
#undef optflag_cmpw |
116 |
|
|
#endif |
117 |
|
|
|
118 |
|
|
#ifdef optflag_cmpb |
119 |
|
|
#undef optflag_cmpb |
120 |
|
|
#endif |
121 |
|
|
#endif |
122 |
|
|
|
123 |
|
|
#define optflag_testl(v) do { } while (0) |
124 |
|
|
#define optflag_testw(v) do { } while (0) |
125 |
|
|
#define optflag_testb(v) do { } while (0) |
126 |
|
|
|
127 |
|
|
#define optflag_addl(v, s, d) (v = (uae_s32)(d) + (uae_s32)(s)) |
128 |
|
|
#define optflag_addw(v, s, d) (v = (uae_s16)(d) + (uae_s16)(s)) |
129 |
|
|
#define optflag_addb(v, s, d) (v = (uae_s8)(d) + (uae_s8)(s)) |
130 |
|
|
|
131 |
|
|
#define optflag_subl(v, s, d) (v = (uae_s32)(d) - (uae_s32)(s)) |
132 |
|
|
#define optflag_subw(v, s, d) (v = (uae_s16)(d) - (uae_s16)(s)) |
133 |
|
|
#define optflag_subb(v, s, d) (v = (uae_s8)(d) - (uae_s8)(s)) |
134 |
|
|
|
135 |
|
|
#if NOFLAGS_CMP |
136 |
|
|
/* These are just for completeness sake */ |
137 |
|
|
#define optflag_cmpl(s, d) do { } while (0) |
138 |
|
|
#define optflag_cmpw(s, d) do { } while (0) |
139 |
|
|
#define optflag_cmpb(s, d) do { } while (0) |
140 |
|
|
#endif |
141 |
|
|
|
142 |
|
|
#endif |