logical.py revision 5081
15347Ssaidi@eecs.umich.edu# Copyright (c) 2007 The Hewlett-Packard Development Company
27534Ssteve.reinhardt@amd.com# All rights reserved.
33395Shsul@eecs.umich.edu#
43395Shsul@eecs.umich.edu# Redistribution and use of this software in source and binary forms,
53395Shsul@eecs.umich.edu# with or without modification, are permitted provided that the
63395Shsul@eecs.umich.edu# following conditions are met:
73395Shsul@eecs.umich.edu#
83395Shsul@eecs.umich.edu# The software must be used only for Non-Commercial Use which means any
93395Shsul@eecs.umich.edu# use which is NOT directed to receiving any direct monetary
103395Shsul@eecs.umich.edu# compensation for, or commercial advantage from such use.  Illustrative
113395Shsul@eecs.umich.edu# examples of non-commercial use are academic research, personal study,
123395Shsul@eecs.umich.edu# teaching, education and corporate research & development.
133395Shsul@eecs.umich.edu# Illustrative examples of commercial use are distributing products for
143395Shsul@eecs.umich.edu# commercial advantage and providing services using the software for
153395Shsul@eecs.umich.edu# commercial advantage.
163395Shsul@eecs.umich.edu#
173395Shsul@eecs.umich.edu# If you wish to use this software or functionality therein that may be
183395Shsul@eecs.umich.edu# covered by patents for commercial use, please contact:
193395Shsul@eecs.umich.edu#     Director of Intellectual Property Licensing
203395Shsul@eecs.umich.edu#     Office of Strategy and Technology
213395Shsul@eecs.umich.edu#     Hewlett-Packard Company
223395Shsul@eecs.umich.edu#     1501 Page Mill Road
233395Shsul@eecs.umich.edu#     Palo Alto, California  94304
243395Shsul@eecs.umich.edu#
253395Shsul@eecs.umich.edu# Redistributions of source code must retain the above copyright notice,
263395Shsul@eecs.umich.edu# this list of conditions and the following disclaimer.  Redistributions
273395Shsul@eecs.umich.edu# in binary form must reproduce the above copyright notice, this list of
283395Shsul@eecs.umich.edu# conditions and the following disclaimer in the documentation and/or
293395Shsul@eecs.umich.edu# other materials provided with the distribution.  Neither the name of
303395Shsul@eecs.umich.edu# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
313509Shsul@eecs.umich.edu# contributors may be used to endorse or promote products derived from
326654Snate@binkert.org# this software without specific prior written permission.  No right of
333395Shsul@eecs.umich.edu# sublicense is granted herewith.  Derivatives of the software and
346654Snate@binkert.org# output created using the software may be prepared, but only for
353395Shsul@eecs.umich.edu# Non-Commercial Uses.  Derivatives of the software may be shared with
366654Snate@binkert.org# others provided: (i) the others agree to abide by the list of
378724Srdreslin@umich.edu# conditions herein which includes the Non-Commercial Use restrictions;
386654Snate@binkert.org# and (ii) such Derivatives of the software include the above copyright
396654Snate@binkert.org# notice to acknowledge the contribution from this software where
403395Shsul@eecs.umich.edu# applicable, this list of conditions and the disclaimer below.
413481Shsul@eecs.umich.edu#
423481Shsul@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
433481Shsul@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
448649Snilay@cs.wisc.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
455347Ssaidi@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
468724Srdreslin@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
478718Snilay@cs.wisc.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
483681Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
493681Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
508724Srdreslin@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
518724Srdreslin@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
528724Srdreslin@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
538724Srdreslin@umich.edu#
548649Snilay@cs.wisc.edu# Authors: Gabe Black
555869Sksewell@umich.edu
565869Sksewell@umich.edumicrocode = '''
575869Sksewell@umich.edudef macroop OR_R_R
585869Sksewell@umich.edu{
593481Shsul@eecs.umich.edu    or reg, reg, regm, flags=(OF,SF,ZF,PF,CF)
605347Ssaidi@eecs.umich.edu};
613481Shsul@eecs.umich.edu
623481Shsul@eecs.umich.edudef macroop OR_M_I
633481Shsul@eecs.umich.edu{
643481Shsul@eecs.umich.edu    limm t2, imm
653481Shsul@eecs.umich.edu    ld t1, seg, sib, disp
663481Shsul@eecs.umich.edu    or t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
678689Snilay@cs.wisc.edu    st t1, seg, sib, disp
688689Snilay@cs.wisc.edu};
698689Snilay@cs.wisc.edu
708689Snilay@cs.wisc.edudef macroop OR_P_I
718689Snilay@cs.wisc.edu{
728689Snilay@cs.wisc.edu    limm t2, imm
738689Snilay@cs.wisc.edu    rdip t7
748689Snilay@cs.wisc.edu    ld t1, seg, riprel, disp
758689Snilay@cs.wisc.edu    or t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
763481Shsul@eecs.umich.edu    st t1, seg, riprel, disp
775347Ssaidi@eecs.umich.edu};
783481Shsul@eecs.umich.edu
793481Shsul@eecs.umich.edudef macroop OR_M_R
803481Shsul@eecs.umich.edu{
813481Shsul@eecs.umich.edu    ld t1, seg, sib, disp
823481Shsul@eecs.umich.edu    or t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
838919Snilay@cs.wisc.edu    st t1, seg, sib, disp
848919Snilay@cs.wisc.edu};
858919Snilay@cs.wisc.edu
868919Snilay@cs.wisc.edudef macroop OR_P_R
878919Snilay@cs.wisc.edu{
888919Snilay@cs.wisc.edu    rdip t7
898919Snilay@cs.wisc.edu    ld t1, seg, riprel, disp
908919Snilay@cs.wisc.edu    or t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
918919Snilay@cs.wisc.edu    st t1, seg, riprel, disp
928919Snilay@cs.wisc.edu};
938919Snilay@cs.wisc.edu
948919Snilay@cs.wisc.edudef macroop OR_R_M
958919Snilay@cs.wisc.edu{
968919Snilay@cs.wisc.edu    ld t1, seg, sib, disp
978919Snilay@cs.wisc.edu    or reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
983481Shsul@eecs.umich.edu};
993481Shsul@eecs.umich.edu
1003395Shsul@eecs.umich.edudef macroop OR_R_P
1013395Shsul@eecs.umich.edu{
1023395Shsul@eecs.umich.edu    rdip t7
1034167Sbinkertn@umich.edu    ld t1, seg, riprel, disp
1043395Shsul@eecs.umich.edu    or reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1053395Shsul@eecs.umich.edu};
1063395Shsul@eecs.umich.edu
1073511Shsul@eecs.umich.edudef macroop OR_R_I
1083395Shsul@eecs.umich.edu{
1093395Shsul@eecs.umich.edu    limm t1, imm
1103395Shsul@eecs.umich.edu    or reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1115211Ssaidi@eecs.umich.edu};
1125211Ssaidi@eecs.umich.edu
1133395Shsul@eecs.umich.edudef macroop XOR_R_R
1143395Shsul@eecs.umich.edu{
1153395Shsul@eecs.umich.edu    xor reg, reg, regm, flags=(OF,SF,ZF,PF,CF)
1165370Ssaidi@eecs.umich.edu};
1176654Snate@binkert.org
1185370Ssaidi@eecs.umich.edudef macroop XOR_R_I
1195371Shsul@eecs.umich.edu{
1206654Snate@binkert.org    limm t1, imm
1215370Ssaidi@eecs.umich.edu    xor reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1223395Shsul@eecs.umich.edu};
1233395Shsul@eecs.umich.edu
1243481Shsul@eecs.umich.edudef macroop XOR_M_I
1253481Shsul@eecs.umich.edu{
1268318Sksewell@umich.edu    limm t2, imm
1276144Sksewell@umich.edu    ld t1, seg, sib, disp
1288311Sksewell@umich.edu    xor t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
1296144Sksewell@umich.edu    st t1, seg, sib, disp
1306641Sksewell@umich.edu};
1316641Sksewell@umich.edu
1326641Sksewell@umich.edudef macroop XOR_P_I
1336641Sksewell@umich.edu{
1343481Shsul@eecs.umich.edu    limm t2, imm
1353481Shsul@eecs.umich.edu    rdip t7
1363481Shsul@eecs.umich.edu    ld t1, seg, riprel, disp
1373481Shsul@eecs.umich.edu    xor t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
1383481Shsul@eecs.umich.edu    st t1, seg, riprel, disp
1395361Srstrong@cs.ucsd.edu};
1405369Ssaidi@eecs.umich.edu
1413481Shsul@eecs.umich.edudef macroop XOR_M_R
1428803Sgblack@eecs.umich.edu{
1433481Shsul@eecs.umich.edu    ld t1, seg, sib, disp
1445369Ssaidi@eecs.umich.edu    xor t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
1458311Sksewell@umich.edu    st t1, seg, sib, disp
1468311Sksewell@umich.edu};
1478887Sgeoffrey.blake@arm.com
1488887Sgeoffrey.blake@arm.comdef macroop XOR_P_R
1498887Sgeoffrey.blake@arm.com{
1503481Shsul@eecs.umich.edu    rdip t7
1515311Ssaidi@eecs.umich.edu    ld t1, seg, riprel, disp
1523481Shsul@eecs.umich.edu    xor t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
1533395Shsul@eecs.umich.edu    st t1, seg, riprel, disp
1543395Shsul@eecs.umich.edu};
1558211Satgutier@umich.edu
1568211Satgutier@umich.edudef macroop XOR_R_M
1578211Satgutier@umich.edu{
1588211Satgutier@umich.edu    ld t1, seg, sib, disp
1598211Satgutier@umich.edu    xor reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1603395Shsul@eecs.umich.edu};
1613395Shsul@eecs.umich.edu
1623478Shsul@eecs.umich.edudef macroop XOR_R_P
1633395Shsul@eecs.umich.edu{
1643478Shsul@eecs.umich.edu    rdip t7
1653395Shsul@eecs.umich.edu    ld t1, seg, riprel, disp
1663395Shsul@eecs.umich.edu    xor reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1673478Shsul@eecs.umich.edu};
1688803Sgblack@eecs.umich.edu
1698803Sgblack@eecs.umich.edudef macroop AND_R_R
1703395Shsul@eecs.umich.edu{
1713478Shsul@eecs.umich.edu    and reg, reg, regm, flags=(OF,SF,ZF,PF,CF)
1723480Shsul@eecs.umich.edu};
1735361Srstrong@cs.ucsd.edu
1745369Ssaidi@eecs.umich.edudef macroop AND_R_M
1755361Srstrong@cs.ucsd.edu{
1765361Srstrong@cs.ucsd.edu    ld t1, seg, sib, disp
1775361Srstrong@cs.ucsd.edu    and reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1785369Ssaidi@eecs.umich.edu};
1795361Srstrong@cs.ucsd.edu
1805361Srstrong@cs.ucsd.edudef macroop AND_R_P
1815378Ssaidi@eecs.umich.edu{
1826654Snate@binkert.org    rdip t7
1835361Srstrong@cs.ucsd.edu    ld t1, seg, riprel, disp
1845361Srstrong@cs.ucsd.edu    and reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1855361Srstrong@cs.ucsd.edu};
1865361Srstrong@cs.ucsd.edu
1875361Srstrong@cs.ucsd.edudef macroop AND_R_I
1885361Srstrong@cs.ucsd.edu{
1895361Srstrong@cs.ucsd.edu    limm t1, imm
1905361Srstrong@cs.ucsd.edu    and reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
1915361Srstrong@cs.ucsd.edu};
1925361Srstrong@cs.ucsd.edu
1935361Srstrong@cs.ucsd.edudef macroop AND_M_I
1948311Sksewell@umich.edu{
1958311Sksewell@umich.edu    ld t2, seg, sib, disp
1965353Svilas.sridharan@gmail.com    limm t1, imm
1978887Sgeoffrey.blake@arm.com    and t2, t2, t1, flags=(OF,SF,ZF,PF,CF)
1988887Sgeoffrey.blake@arm.com    st t2, seg, sib, disp
1998887Sgeoffrey.blake@arm.com};
2008887Sgeoffrey.blake@arm.com
2018887Sgeoffrey.blake@arm.comdef macroop AND_P_I
2028211Satgutier@umich.edu{
2038211Satgutier@umich.edu    rdip t7
2048211Satgutier@umich.edu    ld t2, seg, riprel, disp
2058211Satgutier@umich.edu    limm t1, imm
2063395Shsul@eecs.umich.edu    and t2, t2, t1, flags=(OF,SF,ZF,PF,CF)
2075361Srstrong@cs.ucsd.edu    st t2, seg, riprel, disp
2085369Ssaidi@eecs.umich.edu};
2095361Srstrong@cs.ucsd.edu
2105361Srstrong@cs.ucsd.edudef macroop AND_M_R
2115361Srstrong@cs.ucsd.edu{
2125361Srstrong@cs.ucsd.edu    ld t1, seg, sib, disp
2135361Srstrong@cs.ucsd.edu    and t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
2145378Ssaidi@eecs.umich.edu    st t1, seg, sib, disp
2156654Snate@binkert.org};
2165369Ssaidi@eecs.umich.edu
2175361Srstrong@cs.ucsd.edudef macroop AND_P_R
2185361Srstrong@cs.ucsd.edu{
2195361Srstrong@cs.ucsd.edu    rdip t7
2205361Srstrong@cs.ucsd.edu    ld t1, seg, riprel, disp
2215361Srstrong@cs.ucsd.edu    and t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
2225361Srstrong@cs.ucsd.edu    st t1, seg, riprel, disp
2235361Srstrong@cs.ucsd.edu};
2245361Srstrong@cs.ucsd.edu
2255361Srstrong@cs.ucsd.edudef macroop NOT_R
2265361Srstrong@cs.ucsd.edu{
2277531Ssteve.reinhardt@amd.com    limm t1, -1
2285369Ssaidi@eecs.umich.edu    xor reg, reg, t1
2295361Srstrong@cs.ucsd.edu};
2303395Shsul@eecs.umich.edu
2313395Shsul@eecs.umich.edudef macroop NOT_M
2323395Shsul@eecs.umich.edu{
2333395Shsul@eecs.umich.edu    limm t1, -1
2346654Snate@binkert.org    ld t2, seg, sib, disp
2353395Shsul@eecs.umich.edu    xor t2, t2, t1
2367530Ssteve.reinhardt@amd.com    st t2, seg, sib, disp
2377530Ssteve.reinhardt@amd.com};
2387530Ssteve.reinhardt@amd.com
2397530Ssteve.reinhardt@amd.comdef macroop NOT_P
2407530Ssteve.reinhardt@amd.com{
2417530Ssteve.reinhardt@amd.com    limm t1, -1
2427530Ssteve.reinhardt@amd.com    rdip t7
2437530Ssteve.reinhardt@amd.com    ld t2, seg, riprel, disp
2447530Ssteve.reinhardt@amd.com    xor t2, t2, t1
2457530Ssteve.reinhardt@amd.com    st t2, seg, riprel, disp
2465361Srstrong@cs.ucsd.edu};
2476654Snate@binkert.org'''
2485361Srstrong@cs.ucsd.edu