rotate.py revision 7087:fb8d5786ff30
19850Sandreas.hansson@arm.com# Copyright (c) 2007 The Hewlett-Packard Development Company
29850Sandreas.hansson@arm.com# All rights reserved.
39850Sandreas.hansson@arm.com#
49850Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall
59850Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual
69850Sandreas.hansson@arm.com# property including but not limited to intellectual property relating
79850Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software
89850Sandreas.hansson@arm.com# licensed hereunder.  You may use the software subject to the license
99850Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated
109850Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software,
119850Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form.
129850Sandreas.hansson@arm.com#
139850Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
149850Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
159850Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
169850Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
179850Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
189850Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
199850Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
209850Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
219850Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
229850Sandreas.hansson@arm.com# this software without specific prior written permission.
239850Sandreas.hansson@arm.com#
249850Sandreas.hansson@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
259850Sandreas.hansson@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
269850Sandreas.hansson@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
279850Sandreas.hansson@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
289850Sandreas.hansson@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
299850Sandreas.hansson@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
309850Sandreas.hansson@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
319850Sandreas.hansson@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
329850Sandreas.hansson@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
339850Sandreas.hansson@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
349850Sandreas.hansson@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
359850Sandreas.hansson@arm.com#
369850Sandreas.hansson@arm.com# Authors: Gabe Black
379850Sandreas.hansson@arm.com
389850Sandreas.hansson@arm.commicrocode = '''
399850Sandreas.hansson@arm.comdef macroop ROL_R_I
409850Sandreas.hansson@arm.com{
419850Sandreas.hansson@arm.com    roli reg, reg, imm, flags=(OF,CF)
429850Sandreas.hansson@arm.com};
439850Sandreas.hansson@arm.com
449850Sandreas.hansson@arm.comdef macroop ROL_M_I
459850Sandreas.hansson@arm.com{
469850Sandreas.hansson@arm.com    ldst t1, seg, sib, disp
479850Sandreas.hansson@arm.com    roli t1, t1, imm, flags=(OF,CF)
489850Sandreas.hansson@arm.com    st t1, seg, sib, disp
499850Sandreas.hansson@arm.com};
509850Sandreas.hansson@arm.com
519850Sandreas.hansson@arm.comdef macroop ROL_P_I
529850Sandreas.hansson@arm.com{
539850Sandreas.hansson@arm.com    rdip t7
549850Sandreas.hansson@arm.com    ldst t1, seg, riprel, disp
559850Sandreas.hansson@arm.com    roli t1, t1, imm, flags=(OF,CF)
56    st t1, seg, riprel, disp
57};
58
59def macroop ROL_1_R
60{
61    roli reg, reg, 1, flags=(OF,CF)
62};
63
64def macroop ROL_1_M
65{
66    ldst t1, seg, sib, disp
67    roli t1, t1, 1, flags=(OF,CF)
68    st t1, seg, sib, disp
69};
70
71def macroop ROL_1_P
72{
73    rdip t7
74    ldst t1, seg, riprel, disp
75    roli t1, t1, 1, flags=(OF,CF)
76    st t1, seg, riprel, disp
77};
78
79def macroop ROL_R_R
80{
81    rol reg, reg, regm, flags=(OF,CF)
82};
83
84def macroop ROL_M_R
85{
86    ldst t1, seg, sib, disp
87    rol t1, t1, reg, flags=(OF,CF)
88    st t1, seg, sib, disp
89};
90
91def macroop ROL_P_R
92{
93    rdip t7
94    ldst t1, seg, riprel, disp
95    rol t1, t1, reg, flags=(OF,CF)
96    st t1, seg, riprel, disp
97};
98
99def macroop ROR_R_I
100{
101    rori reg, reg, imm, flags=(OF,CF)
102};
103
104def macroop ROR_M_I
105{
106    ldst t1, seg, sib, disp
107    rori t1, t1, imm, flags=(OF,CF)
108    st t1, seg, sib, disp
109};
110
111def macroop ROR_P_I
112{
113    rdip t7
114    ldst t1, seg, riprel, disp
115    rori t1, t1, imm, flags=(OF,CF)
116    st t1, seg, riprel, disp
117};
118
119def macroop ROR_1_R
120{
121    rori reg, reg, 1, flags=(OF,CF)
122};
123
124def macroop ROR_1_M
125{
126    ldst t1, seg, sib, disp
127    rori t1, t1, 1, flags=(OF,CF)
128    st t1, seg, sib, disp
129};
130
131def macroop ROR_1_P
132{
133    rdip t7
134    ldst t1, seg, riprel, disp
135    rori t1, t1, 1, flags=(OF,CF)
136    st t1, seg, riprel, disp
137};
138
139def macroop ROR_R_R
140{
141    ror reg, reg, regm, flags=(OF,CF)
142};
143
144def macroop ROR_M_R
145{
146    ldst t1, seg, sib, disp
147    ror t1, t1, reg, flags=(OF,CF)
148    st t1, seg, sib, disp
149};
150
151def macroop ROR_P_R
152{
153    rdip t7
154    ldst t1, seg, riprel, disp
155    ror t1, t1, reg, flags=(OF,CF)
156    st t1, seg, riprel, disp
157};
158
159def macroop RCL_R_I
160{
161    rcli reg, reg, imm, flags=(OF,CF)
162};
163
164def macroop RCL_M_I
165{
166    ldst t1, seg, sib, disp
167    rcli t1, t1, imm, flags=(OF,CF)
168    st t1, seg, sib, disp
169};
170
171def macroop RCL_P_I
172{
173    rdip t7
174    ldst t1, seg, riprel, disp
175    rcli t1, t1, imm, flags=(OF,CF)
176    st t1, seg, riprel, disp
177};
178
179def macroop RCL_1_R
180{
181    rcli reg, reg, 1, flags=(OF,CF)
182};
183
184def macroop RCL_1_M
185{
186    ldst t1, seg, sib, disp
187    rcli t1, t1, 1, flags=(OF,CF)
188    st t1, seg, sib, disp
189};
190
191def macroop RCL_1_P
192{
193    rdip t7
194    ldst t1, seg, riprel, disp
195    rcli t1, t1, 1, flags=(OF,CF)
196    st t1, seg, riprel, disp
197};
198
199def macroop RCL_R_R
200{
201    rcl reg, reg, regm, flags=(OF,CF)
202};
203
204def macroop RCL_M_R
205{
206    ldst t1, seg, sib, disp
207    rcl t1, t1, reg, flags=(OF,CF)
208    st t1, seg, sib, disp
209};
210
211def macroop RCL_P_R
212{
213    rdip t7
214    ldst t1, seg, riprel, disp
215    rcl t1, t1, reg, flags=(OF,CF)
216    st t1, seg, riprel, disp
217};
218
219def macroop RCR_R_I
220{
221    rcri reg, reg, imm, flags=(OF,CF)
222};
223
224def macroop RCR_M_I
225{
226    ldst t1, seg, sib, disp
227    rcri t1, t1, imm, flags=(OF,CF)
228    st t1, seg, sib, disp
229};
230
231def macroop RCR_P_I
232{
233    rdip t7
234    ldst t1, seg, riprel, disp
235    rcri t1, t1, imm, flags=(OF,CF)
236    st t1, seg, riprel, disp
237};
238
239def macroop RCR_1_R
240{
241    rcri reg, reg, 1, flags=(OF,CF)
242};
243
244def macroop RCR_1_M
245{
246    ldst t1, seg, sib, disp
247    rcri t1, t1, 1, flags=(OF,CF)
248    st t1, seg, sib, disp
249};
250
251def macroop RCR_1_P
252{
253    rdip t7
254    ldst t1, seg, riprel, disp
255    rcri t1, t1, 1, flags=(OF,CF)
256    st t1, seg, riprel, disp
257};
258
259def macroop RCR_R_R
260{
261    rcr reg, reg, regm, flags=(OF,CF)
262};
263
264def macroop RCR_M_R
265{
266    ldst t1, seg, sib, disp
267    rcr t1, t1, reg, flags=(OF,CF)
268    st t1, seg, sib, disp
269};
270
271def macroop RCR_P_R
272{
273    rdip t7
274    ldst t1, seg, riprel, disp
275    rcr t1, t1, reg, flags=(OF,CF)
276    st t1, seg, riprel, disp
277};
278'''
279