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 |
|
---|
22 | /*
|
---|
23 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
24 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
25 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
26 | * a choice of LGPL license versions is made available with the language indicating
|
---|
27 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
28 | * of the LGPL is applied is otherwise unspecified.
|
---|
29 | */
|
---|
30 | void OPPROTO glue(op_movl_A0,REGNAME)(void)
|
---|
31 | {
|
---|
32 | A0 = (uint32_t)REG;
|
---|
33 | }
|
---|
34 |
|
---|
35 | void OPPROTO glue(op_addl_A0,REGNAME)(void)
|
---|
36 | {
|
---|
37 | A0 = (uint32_t)(A0 + REG);
|
---|
38 | }
|
---|
39 |
|
---|
40 | void OPPROTO glue(glue(op_addl_A0,REGNAME),_s1)(void)
|
---|
41 | {
|
---|
42 | A0 = (uint32_t)(A0 + (REG << 1));
|
---|
43 | }
|
---|
44 |
|
---|
45 | void OPPROTO glue(glue(op_addl_A0,REGNAME),_s2)(void)
|
---|
46 | {
|
---|
47 | A0 = (uint32_t)(A0 + (REG << 2));
|
---|
48 | }
|
---|
49 |
|
---|
50 | void OPPROTO glue(glue(op_addl_A0,REGNAME),_s3)(void)
|
---|
51 | {
|
---|
52 | A0 = (uint32_t)(A0 + (REG << 3));
|
---|
53 | }
|
---|
54 |
|
---|
55 | #ifdef TARGET_X86_64
|
---|
56 | void OPPROTO glue(op_movq_A0,REGNAME)(void)
|
---|
57 | {
|
---|
58 | A0 = REG;
|
---|
59 | }
|
---|
60 |
|
---|
61 | void OPPROTO glue(op_addq_A0,REGNAME)(void)
|
---|
62 | {
|
---|
63 | A0 = (A0 + REG);
|
---|
64 | }
|
---|
65 |
|
---|
66 | void OPPROTO glue(glue(op_addq_A0,REGNAME),_s1)(void)
|
---|
67 | {
|
---|
68 | A0 = (A0 + (REG << 1));
|
---|
69 | }
|
---|
70 |
|
---|
71 | void OPPROTO glue(glue(op_addq_A0,REGNAME),_s2)(void)
|
---|
72 | {
|
---|
73 | A0 = (A0 + (REG << 2));
|
---|
74 | }
|
---|
75 |
|
---|
76 | void OPPROTO glue(glue(op_addq_A0,REGNAME),_s3)(void)
|
---|
77 | {
|
---|
78 | A0 = (A0 + (REG << 3));
|
---|
79 | }
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | void OPPROTO glue(op_movl_T0,REGNAME)(void)
|
---|
83 | {
|
---|
84 | T0 = REG;
|
---|
85 | }
|
---|
86 |
|
---|
87 | void OPPROTO glue(op_movl_T1,REGNAME)(void)
|
---|
88 | {
|
---|
89 | T1 = REG;
|
---|
90 | }
|
---|
91 |
|
---|
92 | void OPPROTO glue(op_movh_T0,REGNAME)(void)
|
---|
93 | {
|
---|
94 | T0 = REG >> 8;
|
---|
95 | }
|
---|
96 |
|
---|
97 | void OPPROTO glue(op_movh_T1,REGNAME)(void)
|
---|
98 | {
|
---|
99 | T1 = REG >> 8;
|
---|
100 | }
|
---|
101 |
|
---|
102 | void OPPROTO glue(glue(op_movl,REGNAME),_T0)(void)
|
---|
103 | {
|
---|
104 | REG = (uint32_t)T0;
|
---|
105 | }
|
---|
106 |
|
---|
107 | void OPPROTO glue(glue(op_movl,REGNAME),_T1)(void)
|
---|
108 | {
|
---|
109 | REG = (uint32_t)T1;
|
---|
110 | }
|
---|
111 |
|
---|
112 | void OPPROTO glue(glue(op_movl,REGNAME),_A0)(void)
|
---|
113 | {
|
---|
114 | REG = (uint32_t)A0;
|
---|
115 | }
|
---|
116 |
|
---|
117 | #ifdef TARGET_X86_64
|
---|
118 | void OPPROTO glue(glue(op_movq,REGNAME),_T0)(void)
|
---|
119 | {
|
---|
120 | REG = T0;
|
---|
121 | }
|
---|
122 |
|
---|
123 | void OPPROTO glue(glue(op_movq,REGNAME),_T1)(void)
|
---|
124 | {
|
---|
125 | REG = T1;
|
---|
126 | }
|
---|
127 |
|
---|
128 | void OPPROTO glue(glue(op_movq,REGNAME),_A0)(void)
|
---|
129 | {
|
---|
130 | REG = A0;
|
---|
131 | }
|
---|
132 | #endif
|
---|
133 |
|
---|
134 | /* mov T1 to REG if T0 is true */
|
---|
135 | void OPPROTO glue(glue(op_cmovw,REGNAME),_T1_T0)(void)
|
---|
136 | {
|
---|
137 | if (T0)
|
---|
138 | REG = (REG & ~0xffff) | (T1 & 0xffff);
|
---|
139 | FORCE_RET();
|
---|
140 | }
|
---|
141 |
|
---|
142 | void OPPROTO glue(glue(op_cmovl,REGNAME),_T1_T0)(void)
|
---|
143 | {
|
---|
144 | if (T0)
|
---|
145 | REG = (uint32_t)T1;
|
---|
146 | FORCE_RET();
|
---|
147 | }
|
---|
148 |
|
---|
149 | #ifdef TARGET_X86_64
|
---|
150 | void OPPROTO glue(glue(op_cmovq,REGNAME),_T1_T0)(void)
|
---|
151 | {
|
---|
152 | if (T0)
|
---|
153 | REG = T1;
|
---|
154 | FORCE_RET();
|
---|
155 | }
|
---|
156 | #endif
|
---|
157 |
|
---|
158 | /* NOTE: T0 high order bits are ignored */
|
---|
159 | void OPPROTO glue(glue(op_movw,REGNAME),_T0)(void)
|
---|
160 | {
|
---|
161 | REG = (REG & ~0xffff) | (T0 & 0xffff);
|
---|
162 | }
|
---|
163 |
|
---|
164 | /* NOTE: T0 high order bits are ignored */
|
---|
165 | void OPPROTO glue(glue(op_movw,REGNAME),_T1)(void)
|
---|
166 | {
|
---|
167 | REG = (REG & ~0xffff) | (T1 & 0xffff);
|
---|
168 | }
|
---|
169 |
|
---|
170 | /* NOTE: A0 high order bits are ignored */
|
---|
171 | void OPPROTO glue(glue(op_movw,REGNAME),_A0)(void)
|
---|
172 | {
|
---|
173 | REG = (REG & ~0xffff) | (A0 & 0xffff);
|
---|
174 | }
|
---|
175 |
|
---|
176 | /* NOTE: T0 high order bits are ignored */
|
---|
177 | void OPPROTO glue(glue(op_movb,REGNAME),_T0)(void)
|
---|
178 | {
|
---|
179 | REG = (REG & ~0xff) | (T0 & 0xff);
|
---|
180 | }
|
---|
181 |
|
---|
182 | /* NOTE: T0 high order bits are ignored */
|
---|
183 | void OPPROTO glue(glue(op_movh,REGNAME),_T0)(void)
|
---|
184 | {
|
---|
185 | REG = (REG & ~0xff00) | ((T0 & 0xff) << 8);
|
---|
186 | }
|
---|
187 |
|
---|
188 | /* NOTE: T1 high order bits are ignored */
|
---|
189 | void OPPROTO glue(glue(op_movb,REGNAME),_T1)(void)
|
---|
190 | {
|
---|
191 | REG = (REG & ~0xff) | (T1 & 0xff);
|
---|
192 | }
|
---|
193 |
|
---|
194 | /* NOTE: T1 high order bits are ignored */
|
---|
195 | void OPPROTO glue(glue(op_movh,REGNAME),_T1)(void)
|
---|
196 | {
|
---|
197 | REG = (REG & ~0xff00) | ((T1 & 0xff) << 8);
|
---|
198 | }
|
---|
199 |
|
---|