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 | * Oracle 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, Oracle 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 |
|
---|
31 | void OPPROTO glue(op_movl_A0,REGNAME)(void)
|
---|
32 | {
|
---|
33 | A0 = (uint32_t)REG;
|
---|
34 | }
|
---|
35 |
|
---|
36 | void OPPROTO glue(op_addl_A0,REGNAME)(void)
|
---|
37 | {
|
---|
38 | A0 = (uint32_t)(A0 + REG);
|
---|
39 | }
|
---|
40 |
|
---|
41 | void OPPROTO glue(glue(op_addl_A0,REGNAME),_s1)(void)
|
---|
42 | {
|
---|
43 | A0 = (uint32_t)(A0 + (REG << 1));
|
---|
44 | }
|
---|
45 |
|
---|
46 | void OPPROTO glue(glue(op_addl_A0,REGNAME),_s2)(void)
|
---|
47 | {
|
---|
48 | A0 = (uint32_t)(A0 + (REG << 2));
|
---|
49 | }
|
---|
50 |
|
---|
51 | void OPPROTO glue(glue(op_addl_A0,REGNAME),_s3)(void)
|
---|
52 | {
|
---|
53 | A0 = (uint32_t)(A0 + (REG << 3));
|
---|
54 | }
|
---|
55 |
|
---|
56 | #ifdef TARGET_X86_64
|
---|
57 | void OPPROTO glue(op_movq_A0,REGNAME)(void)
|
---|
58 | {
|
---|
59 | A0 = REG;
|
---|
60 | }
|
---|
61 |
|
---|
62 | void OPPROTO glue(op_addq_A0,REGNAME)(void)
|
---|
63 | {
|
---|
64 | A0 = (A0 + REG);
|
---|
65 | }
|
---|
66 |
|
---|
67 | void OPPROTO glue(glue(op_addq_A0,REGNAME),_s1)(void)
|
---|
68 | {
|
---|
69 | A0 = (A0 + (REG << 1));
|
---|
70 | }
|
---|
71 |
|
---|
72 | void OPPROTO glue(glue(op_addq_A0,REGNAME),_s2)(void)
|
---|
73 | {
|
---|
74 | A0 = (A0 + (REG << 2));
|
---|
75 | }
|
---|
76 |
|
---|
77 | void OPPROTO glue(glue(op_addq_A0,REGNAME),_s3)(void)
|
---|
78 | {
|
---|
79 | A0 = (A0 + (REG << 3));
|
---|
80 | }
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | void OPPROTO glue(op_movl_T0,REGNAME)(void)
|
---|
84 | {
|
---|
85 | T0 = REG;
|
---|
86 | }
|
---|
87 |
|
---|
88 | void OPPROTO glue(op_movl_T1,REGNAME)(void)
|
---|
89 | {
|
---|
90 | T1 = REG;
|
---|
91 | }
|
---|
92 |
|
---|
93 | void OPPROTO glue(op_movh_T0,REGNAME)(void)
|
---|
94 | {
|
---|
95 | T0 = REG >> 8;
|
---|
96 | }
|
---|
97 |
|
---|
98 | void OPPROTO glue(op_movh_T1,REGNAME)(void)
|
---|
99 | {
|
---|
100 | T1 = REG >> 8;
|
---|
101 | }
|
---|
102 |
|
---|
103 | void OPPROTO glue(glue(op_movl,REGNAME),_T0)(void)
|
---|
104 | {
|
---|
105 | REG = (uint32_t)T0;
|
---|
106 | }
|
---|
107 |
|
---|
108 | void OPPROTO glue(glue(op_movl,REGNAME),_T1)(void)
|
---|
109 | {
|
---|
110 | REG = (uint32_t)T1;
|
---|
111 | }
|
---|
112 |
|
---|
113 | void OPPROTO glue(glue(op_movl,REGNAME),_A0)(void)
|
---|
114 | {
|
---|
115 | REG = (uint32_t)A0;
|
---|
116 | }
|
---|
117 |
|
---|
118 | #ifdef TARGET_X86_64
|
---|
119 | void OPPROTO glue(glue(op_movq,REGNAME),_T0)(void)
|
---|
120 | {
|
---|
121 | REG = T0;
|
---|
122 | }
|
---|
123 |
|
---|
124 | void OPPROTO glue(glue(op_movq,REGNAME),_T1)(void)
|
---|
125 | {
|
---|
126 | REG = T1;
|
---|
127 | }
|
---|
128 |
|
---|
129 | void OPPROTO glue(glue(op_movq,REGNAME),_A0)(void)
|
---|
130 | {
|
---|
131 | REG = A0;
|
---|
132 | }
|
---|
133 | #endif
|
---|
134 |
|
---|
135 | /* mov T1 to REG if T0 is true */
|
---|
136 | void OPPROTO glue(glue(op_cmovw,REGNAME),_T1_T0)(void)
|
---|
137 | {
|
---|
138 | if (T0)
|
---|
139 | REG = (REG & ~0xffff) | (T1 & 0xffff);
|
---|
140 | FORCE_RET();
|
---|
141 | }
|
---|
142 |
|
---|
143 | void OPPROTO glue(glue(op_cmovl,REGNAME),_T1_T0)(void)
|
---|
144 | {
|
---|
145 | if (T0)
|
---|
146 | REG = (uint32_t)T1;
|
---|
147 | FORCE_RET();
|
---|
148 | }
|
---|
149 |
|
---|
150 | #ifdef TARGET_X86_64
|
---|
151 | void OPPROTO glue(glue(op_cmovq,REGNAME),_T1_T0)(void)
|
---|
152 | {
|
---|
153 | if (T0)
|
---|
154 | REG = T1;
|
---|
155 | FORCE_RET();
|
---|
156 | }
|
---|
157 | #endif
|
---|
158 |
|
---|
159 | /* NOTE: T0 high order bits are ignored */
|
---|
160 | void OPPROTO glue(glue(op_movw,REGNAME),_T0)(void)
|
---|
161 | {
|
---|
162 | REG = (REG & ~0xffff) | (T0 & 0xffff);
|
---|
163 | }
|
---|
164 |
|
---|
165 | /* NOTE: T0 high order bits are ignored */
|
---|
166 | void OPPROTO glue(glue(op_movw,REGNAME),_T1)(void)
|
---|
167 | {
|
---|
168 | REG = (REG & ~0xffff) | (T1 & 0xffff);
|
---|
169 | }
|
---|
170 |
|
---|
171 | /* NOTE: A0 high order bits are ignored */
|
---|
172 | void OPPROTO glue(glue(op_movw,REGNAME),_A0)(void)
|
---|
173 | {
|
---|
174 | REG = (REG & ~0xffff) | (A0 & 0xffff);
|
---|
175 | }
|
---|
176 |
|
---|
177 | /* NOTE: T0 high order bits are ignored */
|
---|
178 | void OPPROTO glue(glue(op_movb,REGNAME),_T0)(void)
|
---|
179 | {
|
---|
180 | REG = (REG & ~0xff) | (T0 & 0xff);
|
---|
181 | }
|
---|
182 |
|
---|
183 | /* NOTE: T0 high order bits are ignored */
|
---|
184 | void OPPROTO glue(glue(op_movh,REGNAME),_T0)(void)
|
---|
185 | {
|
---|
186 | REG = (REG & ~0xff00) | ((T0 & 0xff) << 8);
|
---|
187 | }
|
---|
188 |
|
---|
189 | /* NOTE: T1 high order bits are ignored */
|
---|
190 | void OPPROTO glue(glue(op_movb,REGNAME),_T1)(void)
|
---|
191 | {
|
---|
192 | REG = (REG & ~0xff) | (T1 & 0xff);
|
---|
193 | }
|
---|
194 |
|
---|
195 | /* NOTE: T1 high order bits are ignored */
|
---|
196 | void OPPROTO glue(glue(op_movh,REGNAME),_T1)(void)
|
---|
197 | {
|
---|
198 | REG = (REG & ~0xff00) | ((T1 & 0xff) << 8);
|
---|
199 | }
|
---|
200 |
|
---|