rotate.py revision 6445:647111272094
13348Sbinkertn@umich.edu# Copyright (c) 2007 The Hewlett-Packard Development Company
211013Sandreas.sandberg@arm.com# All rights reserved.
311013Sandreas.sandberg@arm.com#
411013Sandreas.sandberg@arm.com# Redistribution and use of this software in source and binary forms,
511013Sandreas.sandberg@arm.com# with or without modification, are permitted provided that the
611013Sandreas.sandberg@arm.com# following conditions are met:
711013Sandreas.sandberg@arm.com#
811013Sandreas.sandberg@arm.com# The software must be used only for Non-Commercial Use which means any
911013Sandreas.sandberg@arm.com# use which is NOT directed to receiving any direct monetary
1011013Sandreas.sandberg@arm.com# compensation for, or commercial advantage from such use.  Illustrative
1111013Sandreas.sandberg@arm.com# examples of non-commercial use are academic research, personal study,
1211013Sandreas.sandberg@arm.com# teaching, education and corporate research & development.
1311013Sandreas.sandberg@arm.com# Illustrative examples of commercial use are distributing products for
143348Sbinkertn@umich.edu# commercial advantage and providing services using the software for
153348Sbinkertn@umich.edu# commercial advantage.
163348Sbinkertn@umich.edu#
173348Sbinkertn@umich.edu# If you wish to use this software or functionality therein that may be
183348Sbinkertn@umich.edu# covered by patents for commercial use, please contact:
193348Sbinkertn@umich.edu#     Director of Intellectual Property Licensing
203348Sbinkertn@umich.edu#     Office of Strategy and Technology
213348Sbinkertn@umich.edu#     Hewlett-Packard Company
223348Sbinkertn@umich.edu#     1501 Page Mill Road
233348Sbinkertn@umich.edu#     Palo Alto, California  94304
243348Sbinkertn@umich.edu#
253348Sbinkertn@umich.edu# Redistributions of source code must retain the above copyright notice,
263348Sbinkertn@umich.edu# this list of conditions and the following disclaimer.  Redistributions
273348Sbinkertn@umich.edu# in binary form must reproduce the above copyright notice, this list of
283348Sbinkertn@umich.edu# conditions and the following disclaimer in the documentation and/or
293348Sbinkertn@umich.edu# other materials provided with the distribution.  Neither the name of
303348Sbinkertn@umich.edu# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
313348Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
323348Sbinkertn@umich.edu# this software without specific prior written permission.  No right of
333348Sbinkertn@umich.edu# sublicense is granted herewith.  Derivatives of the software and
343348Sbinkertn@umich.edu# output created using the software may be prepared, but only for
353348Sbinkertn@umich.edu# Non-Commercial Uses.  Derivatives of the software may be shared with
363348Sbinkertn@umich.edu# others provided: (i) the others agree to abide by the list of
373348Sbinkertn@umich.edu# conditions herein which includes the Non-Commercial Use restrictions;
383348Sbinkertn@umich.edu# and (ii) such Derivatives of the software include the above copyright
393348Sbinkertn@umich.edu# notice to acknowledge the contribution from this software where
403348Sbinkertn@umich.edu# applicable, this list of conditions and the disclaimer below.
413348Sbinkertn@umich.edu#
4211013Sandreas.sandberg@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
433348Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
443348Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
453348Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
463348Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
473348Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
483348Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
493348Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
503348Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
513348Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
523348Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
533348Sbinkertn@umich.edu#
5411013Sandreas.sandberg@arm.com# Authors: Gabe Black
553348Sbinkertn@umich.edu
565764Snate@binkert.orgmicrocode = '''
573348Sbinkertn@umich.edudef macroop ROL_R_I
5811013Sandreas.sandberg@arm.com{
593348Sbinkertn@umich.edu    roli reg, reg, imm, flags=(OF,CF)
603348Sbinkertn@umich.edu};
613348Sbinkertn@umich.edu
623348Sbinkertn@umich.edudef macroop ROL_M_I
6311013Sandreas.sandberg@arm.com{
643348Sbinkertn@umich.edu    ldst t1, seg, sib, disp
655764Snate@binkert.org    roli t1, t1, imm, flags=(OF,CF)
663348Sbinkertn@umich.edu    st t1, seg, sib, disp
6711295Sstever@gmail.com};
683348Sbinkertn@umich.edu
693348Sbinkertn@umich.edudef macroop ROL_P_I
7011013Sandreas.sandberg@arm.com{
7111013Sandreas.sandberg@arm.com    rdip t7
7211013Sandreas.sandberg@arm.com    ldst t1, seg, riprel, disp
7311013Sandreas.sandberg@arm.com    roli t1, t1, imm, flags=(OF,CF)
7411013Sandreas.sandberg@arm.com    st t1, seg, riprel, disp
7511013Sandreas.sandberg@arm.com};
7611013Sandreas.sandberg@arm.com
7711013Sandreas.sandberg@arm.comdef macroop ROL_1_R
7811013Sandreas.sandberg@arm.com{
7911013Sandreas.sandberg@arm.com    roli reg, reg, 1, flags=(OF,CF)
8011013Sandreas.sandberg@arm.com};
8111013Sandreas.sandberg@arm.com
8211013Sandreas.sandberg@arm.comdef macroop ROL_1_M
8311013Sandreas.sandberg@arm.com{
8411013Sandreas.sandberg@arm.com    ldst t1, seg, sib, disp
8511013Sandreas.sandberg@arm.com    roli t1, t1, 1, flags=(OF,CF)
8611013Sandreas.sandberg@arm.com    st t1, seg, sib, disp
8711013Sandreas.sandberg@arm.com};
8811013Sandreas.sandberg@arm.com
8911013Sandreas.sandberg@arm.comdef macroop ROL_1_P
9011013Sandreas.sandberg@arm.com{
9111013Sandreas.sandberg@arm.com    rdip t7
9211013Sandreas.sandberg@arm.com    ldst t1, seg, riprel, disp
9311013Sandreas.sandberg@arm.com    roli t1, t1, 1, flags=(OF,CF)
9411013Sandreas.sandberg@arm.com    st t1, seg, riprel, disp
9511013Sandreas.sandberg@arm.com};
9611013Sandreas.sandberg@arm.com
9711013Sandreas.sandberg@arm.comdef macroop ROL_R_R
9811013Sandreas.sandberg@arm.com{
9911013Sandreas.sandberg@arm.com    rol reg, reg, regm, flags=(OF,CF)
10011013Sandreas.sandberg@arm.com};
10113347Sgabeblack@google.com
10211013Sandreas.sandberg@arm.comdef macroop ROL_M_R
10311013Sandreas.sandberg@arm.com{
10411013Sandreas.sandberg@arm.com    ldst t1, seg, sib, disp
10511013Sandreas.sandberg@arm.com    rol t1, t1, reg, flags=(OF,CF)
10611013Sandreas.sandberg@arm.com    st t1, seg, sib, disp
10711013Sandreas.sandberg@arm.com};
10813347Sgabeblack@google.com
10911013Sandreas.sandberg@arm.comdef macroop ROL_P_R
11011013Sandreas.sandberg@arm.com{
11111013Sandreas.sandberg@arm.com    rdip t7
11211013Sandreas.sandberg@arm.com    ldst t1, seg, riprel, disp
11311013Sandreas.sandberg@arm.com    rol t1, t1, reg, flags=(OF,CF)
11411013Sandreas.sandberg@arm.com    st t1, seg, riprel, disp
11511013Sandreas.sandberg@arm.com};
11611013Sandreas.sandberg@arm.com
11711013Sandreas.sandberg@arm.comdef macroop ROR_R_I
11811013Sandreas.sandberg@arm.com{
11911013Sandreas.sandberg@arm.com    rori reg, reg, imm
12011013Sandreas.sandberg@arm.com};
12111013Sandreas.sandberg@arm.com
12211013Sandreas.sandberg@arm.comdef macroop ROR_M_I
12311013Sandreas.sandberg@arm.com{
12411013Sandreas.sandberg@arm.com    ldst t1, seg, sib, disp
12511013Sandreas.sandberg@arm.com    rori t1, t1, imm
12611013Sandreas.sandberg@arm.com    st t1, seg, sib, disp
12711013Sandreas.sandberg@arm.com};
12811013Sandreas.sandberg@arm.com
12911013Sandreas.sandberg@arm.comdef macroop ROR_P_I
13011013Sandreas.sandberg@arm.com{
13111013Sandreas.sandberg@arm.com    rdip t7
13211013Sandreas.sandberg@arm.com    ldst t1, seg, riprel, disp
13311013Sandreas.sandberg@arm.com    rori t1, t1, imm
13411013Sandreas.sandberg@arm.com    st t1, seg, riprel, disp
13511013Sandreas.sandberg@arm.com};
13611013Sandreas.sandberg@arm.com
13711013Sandreas.sandberg@arm.comdef macroop ROR_1_R
13811013Sandreas.sandberg@arm.com{
13911013Sandreas.sandberg@arm.com    rori reg, reg, 1
14013347Sgabeblack@google.com};
14111013Sandreas.sandberg@arm.com
14211013Sandreas.sandberg@arm.comdef macroop ROR_1_M
14311013Sandreas.sandberg@arm.com{
14411013Sandreas.sandberg@arm.com    ldst t1, seg, sib, disp
14511013Sandreas.sandberg@arm.com    rori t1, t1, 1
14611013Sandreas.sandberg@arm.com    st t1, seg, sib, disp
14713347Sgabeblack@google.com};
14811013Sandreas.sandberg@arm.com
1493348Sbinkertn@umich.edudef macroop ROR_1_P
150{
151    rdip t7
152    ldst t1, seg, riprel, disp
153    rori t1, t1, 1
154    st t1, seg, riprel, disp
155};
156
157def macroop ROR_R_R
158{
159    ror reg, reg, regm
160};
161
162def macroop ROR_M_R
163{
164    ldst t1, seg, sib, disp
165    ror t1, t1, reg
166    st t1, seg, sib, disp
167};
168
169def macroop ROR_P_R
170{
171    rdip t7
172    ldst t1, seg, riprel, disp
173    ror t1, t1, reg
174    st t1, seg, riprel, disp
175};
176
177def macroop RCL_R_I
178{
179    rcli reg, reg, imm
180};
181
182def macroop RCL_M_I
183{
184    ldst t1, seg, sib, disp
185    rcli t1, t1, imm
186    st t1, seg, sib, disp
187};
188
189def macroop RCL_P_I
190{
191    rdip t7
192    ldst t1, seg, riprel, disp
193    rcli t1, t1, imm
194    st t1, seg, riprel, disp
195};
196
197def macroop RCL_1_R
198{
199    rcli reg, reg, 1
200};
201
202def macroop RCL_1_M
203{
204    ldst t1, seg, sib, disp
205    rcli t1, t1, 1
206    st t1, seg, sib, disp
207};
208
209def macroop RCL_1_P
210{
211    rdip t7
212    ldst t1, seg, riprel, disp
213    rcli t1, t1, 1
214    st t1, seg, riprel, disp
215};
216
217def macroop RCL_R_R
218{
219    rcl reg, reg, regm
220};
221
222def macroop RCL_M_R
223{
224    ldst t1, seg, sib, disp
225    rcl t1, t1, reg
226    st t1, seg, sib, disp
227};
228
229def macroop RCL_P_R
230{
231    rdip t7
232    ldst t1, seg, riprel, disp
233    rcl t1, t1, reg
234    st t1, seg, riprel, disp
235};
236
237def macroop RCR_R_I
238{
239    rcri reg, reg, imm
240};
241
242def macroop RCR_M_I
243{
244    ldst t1, seg, sib, disp
245    rcri t1, t1, imm
246    st t1, seg, sib, disp
247};
248
249def macroop RCR_P_I
250{
251    rdip t7
252    ldst t1, seg, riprel, disp
253    rcri t1, t1, imm
254    st t1, seg, riprel, disp
255};
256
257def macroop RCR_1_R
258{
259    rcri reg, reg, 1
260};
261
262def macroop RCR_1_M
263{
264    ldst t1, seg, sib, disp
265    rcri t1, t1, 1
266    st t1, seg, sib, disp
267};
268
269def macroop RCR_1_P
270{
271    rdip t7
272    ldst t1, seg, riprel, disp
273    rcri t1, t1, 1
274    st t1, seg, riprel, disp
275};
276
277def macroop RCR_R_R
278{
279    rcr reg, reg, regm
280};
281
282def macroop RCR_M_R
283{
284    ldst t1, seg, sib, disp
285    rcr t1, t1, reg
286    st t1, seg, sib, disp
287};
288
289def macroop RCR_P_R
290{
291    rdip t7
292    ldst t1, seg, riprel, disp
293    rcr t1, t1, reg
294    st t1, seg, riprel, disp
295};
296'''
297