root / opreg_template.h @ b6d78bfa
History | View | Annotate | Download (2.9 kB)
1 |
/*
|
---|---|
2 |
* i386 micro operations (templates for various register related
|
3 |
* operations)
|
4 |
*
|
5 |
* Copyright (c) 2003 Fabrice Bellard
|
6 |
*
|
7 |
* This library is free software; you can redistribute it and/or
|
8 |
* modify it under the terms of the GNU Lesser General Public
|
9 |
* License as published by the Free Software Foundation; either
|
10 |
* version 2 of the License, or (at your option) any later version.
|
11 |
*
|
12 |
* This library is distributed in the hope that it will be useful,
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
* Lesser General Public License for more details.
|
16 |
*
|
17 |
* You should have received a copy of the GNU Lesser General Public
|
18 |
* License along with this library; if not, write to the Free Software
|
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 |
*/
|
21 |
void OPPROTO glue(op_movl_A0,REGNAME)(void) |
22 |
{ |
23 |
A0 = REG; |
24 |
} |
25 |
|
26 |
void OPPROTO glue(op_addl_A0,REGNAME)(void) |
27 |
{ |
28 |
A0 += REG; |
29 |
} |
30 |
|
31 |
void OPPROTO glue(glue(op_addl_A0,REGNAME),_s1)(void) |
32 |
{ |
33 |
A0 += REG << 1;
|
34 |
} |
35 |
|
36 |
void OPPROTO glue(glue(op_addl_A0,REGNAME),_s2)(void) |
37 |
{ |
38 |
A0 += REG << 2;
|
39 |
} |
40 |
|
41 |
void OPPROTO glue(glue(op_addl_A0,REGNAME),_s3)(void) |
42 |
{ |
43 |
A0 += REG << 3;
|
44 |
} |
45 |
|
46 |
void OPPROTO glue(op_movl_T0,REGNAME)(void) |
47 |
{ |
48 |
T0 = REG; |
49 |
} |
50 |
|
51 |
void OPPROTO glue(op_movl_T1,REGNAME)(void) |
52 |
{ |
53 |
T1 = REG; |
54 |
} |
55 |
|
56 |
void OPPROTO glue(op_movh_T0,REGNAME)(void) |
57 |
{ |
58 |
T0 = REG >> 8;
|
59 |
} |
60 |
|
61 |
void OPPROTO glue(op_movh_T1,REGNAME)(void) |
62 |
{ |
63 |
T1 = REG >> 8;
|
64 |
} |
65 |
|
66 |
void OPPROTO glue(glue(op_movl,REGNAME),_T0)(void) |
67 |
{ |
68 |
REG = T0; |
69 |
} |
70 |
|
71 |
void OPPROTO glue(glue(op_movl,REGNAME),_T1)(void) |
72 |
{ |
73 |
REG = T1; |
74 |
} |
75 |
|
76 |
void OPPROTO glue(glue(op_movl,REGNAME),_A0)(void) |
77 |
{ |
78 |
REG = A0; |
79 |
} |
80 |
|
81 |
/* mov T1 to REG if T0 is true */
|
82 |
void OPPROTO glue(glue(op_cmovw,REGNAME),_T1_T0)(void) |
83 |
{ |
84 |
if (T0)
|
85 |
REG = (REG & 0xffff0000) | (T1 & 0xffff); |
86 |
} |
87 |
|
88 |
void OPPROTO glue(glue(op_cmovl,REGNAME),_T1_T0)(void) |
89 |
{ |
90 |
if (T0)
|
91 |
REG = T1; |
92 |
} |
93 |
|
94 |
/* NOTE: T0 high order bits are ignored */
|
95 |
void OPPROTO glue(glue(op_movw,REGNAME),_T0)(void) |
96 |
{ |
97 |
REG = (REG & 0xffff0000) | (T0 & 0xffff); |
98 |
} |
99 |
|
100 |
/* NOTE: T0 high order bits are ignored */
|
101 |
void OPPROTO glue(glue(op_movw,REGNAME),_T1)(void) |
102 |
{ |
103 |
REG = (REG & 0xffff0000) | (T1 & 0xffff); |
104 |
} |
105 |
|
106 |
/* NOTE: A0 high order bits are ignored */
|
107 |
void OPPROTO glue(glue(op_movw,REGNAME),_A0)(void) |
108 |
{ |
109 |
REG = (REG & 0xffff0000) | (A0 & 0xffff); |
110 |
} |
111 |
|
112 |
/* NOTE: T0 high order bits are ignored */
|
113 |
void OPPROTO glue(glue(op_movb,REGNAME),_T0)(void) |
114 |
{ |
115 |
REG = (REG & 0xffffff00) | (T0 & 0xff); |
116 |
} |
117 |
|
118 |
/* NOTE: T0 high order bits are ignored */
|
119 |
void OPPROTO glue(glue(op_movh,REGNAME),_T0)(void) |
120 |
{ |
121 |
REG = (REG & 0xffff00ff) | ((T0 & 0xff) << 8); |
122 |
} |
123 |
|
124 |
/* NOTE: T1 high order bits are ignored */
|
125 |
void OPPROTO glue(glue(op_movb,REGNAME),_T1)(void) |
126 |
{ |
127 |
REG = (REG & 0xffffff00) | (T1 & 0xff); |
128 |
} |
129 |
|
130 |
/* NOTE: T1 high order bits are ignored */
|
131 |
void OPPROTO glue(glue(op_movh,REGNAME),_T1)(void) |
132 |
{ |
133 |
REG = (REG & 0xffff00ff) | ((T1 & 0xff) << 8); |
134 |
} |