rotate.py revision 5081
18889Sgeoffrey.blake@arm.com# Copyright (c) 2007 The Hewlett-Packard Development Company
28889Sgeoffrey.blake@arm.com# All rights reserved.
38889Sgeoffrey.blake@arm.com#
48889Sgeoffrey.blake@arm.com# Redistribution and use of this software in source and binary forms,
58889Sgeoffrey.blake@arm.com# with or without modification, are permitted provided that the
68889Sgeoffrey.blake@arm.com# following conditions are met:
78889Sgeoffrey.blake@arm.com#
88889Sgeoffrey.blake@arm.com# The software must be used only for Non-Commercial Use which means any
98889Sgeoffrey.blake@arm.com# use which is NOT directed to receiving any direct monetary
108889Sgeoffrey.blake@arm.com# compensation for, or commercial advantage from such use.  Illustrative
119885Sstever@gmail.com# examples of non-commercial use are academic research, personal study,
128889Sgeoffrey.blake@arm.com# teaching, education and corporate research & development.
139885Sstever@gmail.com# Illustrative examples of commercial use are distributing products for
149885Sstever@gmail.com# commercial advantage and providing services using the software for
158889Sgeoffrey.blake@arm.com# commercial advantage.
168889Sgeoffrey.blake@arm.com#
178889Sgeoffrey.blake@arm.com# If you wish to use this software or functionality therein that may be
189449SAli.Saidi@ARM.com# covered by patents for commercial use, please contact:
199449SAli.Saidi@ARM.com#     Director of Intellectual Property Licensing
208889Sgeoffrey.blake@arm.com#     Office of Strategy and Technology
218889Sgeoffrey.blake@arm.com#     Hewlett-Packard Company
228889Sgeoffrey.blake@arm.com#     1501 Page Mill Road
238889Sgeoffrey.blake@arm.com#     Palo Alto, California  94304
248889Sgeoffrey.blake@arm.com#
258889Sgeoffrey.blake@arm.com# Redistributions of source code must retain the above copyright notice,
268889Sgeoffrey.blake@arm.com# this list of conditions and the following disclaimer.  Redistributions
278889Sgeoffrey.blake@arm.com# in binary form must reproduce the above copyright notice, this list of
288889Sgeoffrey.blake@arm.com# conditions and the following disclaimer in the documentation and/or
298889Sgeoffrey.blake@arm.com# other materials provided with the distribution.  Neither the name of
308889Sgeoffrey.blake@arm.com# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
318889Sgeoffrey.blake@arm.com# contributors may be used to endorse or promote products derived from
328889Sgeoffrey.blake@arm.com# this software without specific prior written permission.  No right of
339885Sstever@gmail.com# sublicense is granted herewith.  Derivatives of the software and
349885Sstever@gmail.com# output created using the software may be prepared, but only for
359885Sstever@gmail.com# Non-Commercial Uses.  Derivatives of the software may be shared with
369885Sstever@gmail.com# others provided: (i) the others agree to abide by the list of
379885Sstever@gmail.com# conditions herein which includes the Non-Commercial Use restrictions;
388889Sgeoffrey.blake@arm.com# and (ii) such Derivatives of the software include the above copyright
398889Sgeoffrey.blake@arm.com# notice to acknowledge the contribution from this software where
409481Snilay@cs.wisc.edu# applicable, this list of conditions and the disclaimer below.
418889Sgeoffrey.blake@arm.com#
428889Sgeoffrey.blake@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
438889Sgeoffrey.blake@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
448889Sgeoffrey.blake@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
458889Sgeoffrey.blake@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
468889Sgeoffrey.blake@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
478889Sgeoffrey.blake@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
488889Sgeoffrey.blake@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
499481Snilay@cs.wisc.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
508889Sgeoffrey.blake@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
518889Sgeoffrey.blake@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
529885Sstever@gmail.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
538889Sgeoffrey.blake@arm.com#
548889Sgeoffrey.blake@arm.com# Authors: Gabe Black
558889Sgeoffrey.blake@arm.com
568889Sgeoffrey.blake@arm.commicrocode = '''
578889Sgeoffrey.blake@arm.comdef macroop ROL_R_I
588889Sgeoffrey.blake@arm.com{
598889Sgeoffrey.blake@arm.com    roli reg, reg, imm
608889Sgeoffrey.blake@arm.com};
618889Sgeoffrey.blake@arm.com
628889Sgeoffrey.blake@arm.comdef macroop ROL_M_I
638889Sgeoffrey.blake@arm.com{
648889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
658889Sgeoffrey.blake@arm.com    roli t1, t1, imm
668889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
678889Sgeoffrey.blake@arm.com};
688889Sgeoffrey.blake@arm.com
698889Sgeoffrey.blake@arm.comdef macroop ROL_P_I
708889Sgeoffrey.blake@arm.com{
718889Sgeoffrey.blake@arm.com    rdip t7
728889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
738889Sgeoffrey.blake@arm.com    roli t1, t1, imm
748889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
758889Sgeoffrey.blake@arm.com};
768889Sgeoffrey.blake@arm.com
778889Sgeoffrey.blake@arm.comdef macroop ROL_1_R
788889Sgeoffrey.blake@arm.com{
799449SAli.Saidi@ARM.com    roli reg, reg, 1
808889Sgeoffrey.blake@arm.com};
818889Sgeoffrey.blake@arm.com
828889Sgeoffrey.blake@arm.comdef macroop ROL_1_M
838889Sgeoffrey.blake@arm.com{
848889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
858889Sgeoffrey.blake@arm.com    roli t1, t1, 1
868889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
878889Sgeoffrey.blake@arm.com};
888889Sgeoffrey.blake@arm.com
898889Sgeoffrey.blake@arm.comdef macroop ROL_1_P
908889Sgeoffrey.blake@arm.com{
918889Sgeoffrey.blake@arm.com    rdip t7
928889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
938889Sgeoffrey.blake@arm.com    roli t1, t1, 1
948889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
958889Sgeoffrey.blake@arm.com};
968889Sgeoffrey.blake@arm.com
978889Sgeoffrey.blake@arm.comdef macroop ROL_R_R
988889Sgeoffrey.blake@arm.com{
998889Sgeoffrey.blake@arm.com    rol reg, reg, regm
1008889Sgeoffrey.blake@arm.com};
1019885Sstever@gmail.com
1028889Sgeoffrey.blake@arm.comdef macroop ROL_M_R
1038889Sgeoffrey.blake@arm.com{
1048889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
1058889Sgeoffrey.blake@arm.com    rol t1, t1, reg
1068889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
1078889Sgeoffrey.blake@arm.com};
1088889Sgeoffrey.blake@arm.com
1098889Sgeoffrey.blake@arm.comdef macroop ROL_P_R
1108889Sgeoffrey.blake@arm.com{
1118889Sgeoffrey.blake@arm.com    rdip t7
1128889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
1139449SAli.Saidi@ARM.com    rol t1, t1, reg
1148889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
1158889Sgeoffrey.blake@arm.com};
1168889Sgeoffrey.blake@arm.com
1178889Sgeoffrey.blake@arm.comdef macroop ROR_R_I
1188889Sgeoffrey.blake@arm.com{
1198889Sgeoffrey.blake@arm.com    rori reg, reg, imm
1208889Sgeoffrey.blake@arm.com};
1218889Sgeoffrey.blake@arm.com
1228889Sgeoffrey.blake@arm.comdef macroop ROR_M_I
1239481Snilay@cs.wisc.edu{
1249481Snilay@cs.wisc.edu    ld t1, seg, sib, disp
1259481Snilay@cs.wisc.edu    rori t1, t1, imm
1269481Snilay@cs.wisc.edu    st t1, seg, sib, disp
1279481Snilay@cs.wisc.edu};
1289481Snilay@cs.wisc.edu
1299481Snilay@cs.wisc.edudef macroop ROR_P_I
1309481Snilay@cs.wisc.edu{
1319481Snilay@cs.wisc.edu    rdip t7
1329481Snilay@cs.wisc.edu    ld t1, seg, riprel, disp
1339481Snilay@cs.wisc.edu    rori t1, t1, imm
1349481Snilay@cs.wisc.edu    st t1, seg, riprel, disp
1359481Snilay@cs.wisc.edu};
1369481Snilay@cs.wisc.edu
1379481Snilay@cs.wisc.edudef macroop ROR_1_R
1389481Snilay@cs.wisc.edu{
1398889Sgeoffrey.blake@arm.com    rori reg, reg, 1
1408889Sgeoffrey.blake@arm.com};
1419449SAli.Saidi@ARM.com
1428889Sgeoffrey.blake@arm.comdef macroop ROR_1_M
1439885Sstever@gmail.com{
1449265SAli.Saidi@ARM.com    ld t1, seg, sib, disp
1458889Sgeoffrey.blake@arm.com    rori t1, t1, 1
1468889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
1478889Sgeoffrey.blake@arm.com};
1488889Sgeoffrey.blake@arm.com
1498889Sgeoffrey.blake@arm.comdef macroop ROR_1_P
1508889Sgeoffrey.blake@arm.com{
1518889Sgeoffrey.blake@arm.com    rdip t7
1528889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
1539449SAli.Saidi@ARM.com    rori t1, t1, 1
1548889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
1558889Sgeoffrey.blake@arm.com};
1568889Sgeoffrey.blake@arm.com
1578889Sgeoffrey.blake@arm.comdef macroop ROR_R_R
1588889Sgeoffrey.blake@arm.com{
1598889Sgeoffrey.blake@arm.com    ror reg, reg, regm
1608889Sgeoffrey.blake@arm.com};
1618889Sgeoffrey.blake@arm.com
1629885Sstever@gmail.comdef macroop ROR_M_R
1639449SAli.Saidi@ARM.com{
1648889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
1658889Sgeoffrey.blake@arm.com    ror t1, t1, reg
1668889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
1678889Sgeoffrey.blake@arm.com};
1688889Sgeoffrey.blake@arm.com
1698889Sgeoffrey.blake@arm.comdef macroop ROR_P_R
1708889Sgeoffrey.blake@arm.com{
1718889Sgeoffrey.blake@arm.com    rdip t7
1728889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
1738889Sgeoffrey.blake@arm.com    ror t1, t1, reg
1748889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
1758889Sgeoffrey.blake@arm.com};
1768889Sgeoffrey.blake@arm.com
1778889Sgeoffrey.blake@arm.comdef macroop RCL_R_I
1789885Sstever@gmail.com{
1799265SAli.Saidi@ARM.com    rcli reg, reg, imm
1808889Sgeoffrey.blake@arm.com};
1818889Sgeoffrey.blake@arm.com
1828889Sgeoffrey.blake@arm.comdef macroop RCL_M_I
1839449SAli.Saidi@ARM.com{
1849449SAli.Saidi@ARM.com    ld t1, seg, sib, disp
1859449SAli.Saidi@ARM.com    rcli t1, t1, imm
1869449SAli.Saidi@ARM.com    st t1, seg, sib, disp
1879449SAli.Saidi@ARM.com};
1889449SAli.Saidi@ARM.com
1899449SAli.Saidi@ARM.comdef macroop RCL_P_I
1909449SAli.Saidi@ARM.com{
1919449SAli.Saidi@ARM.com    rdip t7
1929449SAli.Saidi@ARM.com    ld t1, seg, riprel, disp
1939449SAli.Saidi@ARM.com    rcli t1, t1, imm
1949449SAli.Saidi@ARM.com    st t1, seg, riprel, disp
1959449SAli.Saidi@ARM.com};
1969449SAli.Saidi@ARM.com
1979449SAli.Saidi@ARM.comdef macroop RCL_1_R
1989449SAli.Saidi@ARM.com{
1999449SAli.Saidi@ARM.com    rcli reg, reg, 1
2008889Sgeoffrey.blake@arm.com};
2018889Sgeoffrey.blake@arm.com
2028889Sgeoffrey.blake@arm.comdef macroop RCL_1_M
2038889Sgeoffrey.blake@arm.com{
2048889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
2058889Sgeoffrey.blake@arm.com    rcli t1, t1, 1
2068889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
2078889Sgeoffrey.blake@arm.com};
2089885Sstever@gmail.com
2099265SAli.Saidi@ARM.comdef macroop RCL_1_P
2108889Sgeoffrey.blake@arm.com{
2118889Sgeoffrey.blake@arm.com    rdip t7
2128889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
2138889Sgeoffrey.blake@arm.com    rcli t1, t1, 1
2148889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
2158889Sgeoffrey.blake@arm.com};
2168889Sgeoffrey.blake@arm.com
2178889Sgeoffrey.blake@arm.comdef macroop RCL_R_R
2189885Sstever@gmail.com{
2198889Sgeoffrey.blake@arm.com    rcl reg, reg, regm
2208889Sgeoffrey.blake@arm.com};
2219885Sstever@gmail.com
2228889Sgeoffrey.blake@arm.comdef macroop RCL_M_R
2239348SAli.Saidi@ARM.com{
2248889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
2258889Sgeoffrey.blake@arm.com    rcl t1, t1, reg
2269348SAli.Saidi@ARM.com    st t1, seg, sib, disp
2278889Sgeoffrey.blake@arm.com};
2288889Sgeoffrey.blake@arm.com
2299348SAli.Saidi@ARM.comdef macroop RCL_P_R
2308889Sgeoffrey.blake@arm.com{
2318889Sgeoffrey.blake@arm.com    rdip t7
2329885Sstever@gmail.com    ld t1, seg, riprel, disp
2338889Sgeoffrey.blake@arm.com    rcl t1, t1, reg
2348889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
2358889Sgeoffrey.blake@arm.com};
2368889Sgeoffrey.blake@arm.com
2378889Sgeoffrey.blake@arm.comdef macroop RCR_R_I
2388889Sgeoffrey.blake@arm.com{
2399885Sstever@gmail.com    rcri reg, reg, imm
2409885Sstever@gmail.com};
2419885Sstever@gmail.com
2429885Sstever@gmail.comdef macroop RCR_M_I
2439885Sstever@gmail.com{
2449885Sstever@gmail.com    ld t1, seg, sib, disp
2459885Sstever@gmail.com    rcri t1, t1, imm
2469885Sstever@gmail.com    st t1, seg, sib, disp
2478889Sgeoffrey.blake@arm.com};
2488889Sgeoffrey.blake@arm.com
2498889Sgeoffrey.blake@arm.comdef macroop RCR_P_I
2508889Sgeoffrey.blake@arm.com{
2518889Sgeoffrey.blake@arm.com    rdip t7
2528889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
2538889Sgeoffrey.blake@arm.com    rcri t1, t1, imm
2548889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
2559885Sstever@gmail.com};
2569265SAli.Saidi@ARM.com
2578889Sgeoffrey.blake@arm.comdef macroop RCR_1_R
2588889Sgeoffrey.blake@arm.com{
2598889Sgeoffrey.blake@arm.com    rcri reg, reg, 1
2608889Sgeoffrey.blake@arm.com};
2618889Sgeoffrey.blake@arm.com
2628889Sgeoffrey.blake@arm.comdef macroop RCR_1_M
2638889Sgeoffrey.blake@arm.com{
2648889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
2658889Sgeoffrey.blake@arm.com    rcri t1, t1, 1
2668889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
2678889Sgeoffrey.blake@arm.com};
2688889Sgeoffrey.blake@arm.com
2698889Sgeoffrey.blake@arm.comdef macroop RCR_1_P
2708889Sgeoffrey.blake@arm.com{
2718889Sgeoffrey.blake@arm.com    rdip t7
2728889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
2738889Sgeoffrey.blake@arm.com    rcri t1, t1, 1
2748889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
2758889Sgeoffrey.blake@arm.com};
2768889Sgeoffrey.blake@arm.com
2778889Sgeoffrey.blake@arm.comdef macroop RCR_R_R
2788889Sgeoffrey.blake@arm.com{
2798889Sgeoffrey.blake@arm.com    rcr reg, reg, regm
2808889Sgeoffrey.blake@arm.com};
2818889Sgeoffrey.blake@arm.com
2828889Sgeoffrey.blake@arm.comdef macroop RCR_M_R
2838889Sgeoffrey.blake@arm.com{
2848889Sgeoffrey.blake@arm.com    ld t1, seg, sib, disp
2858889Sgeoffrey.blake@arm.com    rcr t1, t1, reg
2868889Sgeoffrey.blake@arm.com    st t1, seg, sib, disp
2878889Sgeoffrey.blake@arm.com};
2888889Sgeoffrey.blake@arm.com
2898889Sgeoffrey.blake@arm.comdef macroop RCR_P_R
2908889Sgeoffrey.blake@arm.com{
2918889Sgeoffrey.blake@arm.com    rdip t7
2928889Sgeoffrey.blake@arm.com    ld t1, seg, riprel, disp
2938889Sgeoffrey.blake@arm.com    rcr t1, t1, reg
2948889Sgeoffrey.blake@arm.com    st t1, seg, riprel, disp
2958889Sgeoffrey.blake@arm.com};
2968889Sgeoffrey.blake@arm.com'''
2978889Sgeoffrey.blake@arm.com