misc.isa revision 12358
111507SCurtis.Dunham@arm.com// -*- mode:c++ -*-
211507SCurtis.Dunham@arm.com
311956Sgabeblack@google.com// Copyright (c) 2010-2013,2017 ARM Limited
411956Sgabeblack@google.com// All rights reserved
511956Sgabeblack@google.com//
611956Sgabeblack@google.com// The license below extends only to copyright in the software and shall
711960Sgabeblack@google.com// not be construed as granting a license to any other intellectual
811960Sgabeblack@google.com// property including but not limited to intellectual property relating
911960Sgabeblack@google.com// to a hardware implementation of the functionality of the software
1011956Sgabeblack@google.com// licensed hereunder.  You may use the software subject to the license
1111960Sgabeblack@google.com// terms below provided that you ensure that this notice is replicated
1211956Sgabeblack@google.com// unmodified and in its entirety in all distributions of the software,
1311956Sgabeblack@google.com// modified or unmodified, in source code or in binary form.
1411956Sgabeblack@google.com//
1511956Sgabeblack@google.com// Redistribution and use in source and binary forms, with or without
1611956Sgabeblack@google.com// modification, are permitted provided that the following conditions are
1711956Sgabeblack@google.com// met: redistributions of source code must retain the above copyright
1811956Sgabeblack@google.com// notice, this list of conditions and the following disclaimer;
1911956Sgabeblack@google.com// redistributions in binary form must reproduce the above copyright
2011956Sgabeblack@google.com// notice, this list of conditions and the following disclaimer in the
2111956Sgabeblack@google.com// documentation and/or other materials provided with the distribution;
2211956Sgabeblack@google.com// neither the name of the copyright holders nor the names of its
2311956Sgabeblack@google.com// contributors may be used to endorse or promote products derived from
2411956Sgabeblack@google.com// this software without specific prior written permission.
2511956Sgabeblack@google.com//
2611956Sgabeblack@google.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2711956Sgabeblack@google.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2811956Sgabeblack@google.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2911956Sgabeblack@google.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3011956Sgabeblack@google.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3111956Sgabeblack@google.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3211956Sgabeblack@google.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3311956Sgabeblack@google.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3411956Sgabeblack@google.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3511956Sgabeblack@google.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3611956Sgabeblack@google.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3711956Sgabeblack@google.com//
3811956Sgabeblack@google.com// Authors: Gabe Black
3911956Sgabeblack@google.com
4011956Sgabeblack@google.comdef template MrsDeclare {{
4111956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
4211956Sgabeblack@google.com{
4311956Sgabeblack@google.com  protected:
4411956Sgabeblack@google.com    public:
4511956Sgabeblack@google.com        // Constructor
4611956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest);
4711956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
4811956Sgabeblack@google.com};
4911956Sgabeblack@google.com}};
5011956Sgabeblack@google.com
5111956Sgabeblack@google.comdef template MrsConstructor {{
5211956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
5311956Sgabeblack@google.com                                          IntRegIndex _dest)
5411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest)
5511956Sgabeblack@google.com    {
5611956Sgabeblack@google.com        %(constructor)s;
5711956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
5811956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
5911956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
6011956Sgabeblack@google.com            }
6111956Sgabeblack@google.com        }
6211956Sgabeblack@google.com    }
6311956Sgabeblack@google.com}};
6411956Sgabeblack@google.com
6511956Sgabeblack@google.comdef template MrsBankedRegDeclare {{
6611956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
6711956Sgabeblack@google.com{
6811956Sgabeblack@google.com  protected:
6911956Sgabeblack@google.com    uint8_t byteMask;
7011956Sgabeblack@google.com    bool    r;
7111956Sgabeblack@google.com
7211956Sgabeblack@google.com  public:
7311956Sgabeblack@google.com        // Constructor
7411956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
7511956Sgabeblack@google.com                       uint8_t _sysM, bool _r);
7611956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
7711956Sgabeblack@google.com};
7811956Sgabeblack@google.com}};
7911956Sgabeblack@google.com
8011956Sgabeblack@google.comdef template MrsBankedRegConstructor {{
8111956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
8211956Sgabeblack@google.com                                          IntRegIndex _dest,
8311956Sgabeblack@google.com                                          uint8_t     _sysM,
8411956Sgabeblack@google.com                                          bool        _r)
8511956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest),
8611956Sgabeblack@google.com          byteMask(_sysM), r(_r)
8711956Sgabeblack@google.com    {
8811956Sgabeblack@google.com        %(constructor)s;
8911956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
9011956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
9111956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
9211956Sgabeblack@google.com            }
9311956Sgabeblack@google.com        }
9411956Sgabeblack@google.com    }
9511956Sgabeblack@google.com}};
9611956Sgabeblack@google.com
9711956Sgabeblack@google.comdef template MsrBankedRegDeclare {{
9811956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
9911956Sgabeblack@google.com{
10011956Sgabeblack@google.com  protected:
10111956Sgabeblack@google.com    bool r;
10211956Sgabeblack@google.com
10311956Sgabeblack@google.com  public:
10411956Sgabeblack@google.com        // Constructor
10511956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, IntRegIndex _op1,
10611956Sgabeblack@google.com                       uint8_t _sysM, bool _r);
10711956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
10811956Sgabeblack@google.com};
10911956Sgabeblack@google.com}};
11011956Sgabeblack@google.com
11111956Sgabeblack@google.comdef template MsrBankedRegConstructor {{
11211956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
11311956Sgabeblack@google.com                                          IntRegIndex _op1,
11411956Sgabeblack@google.com                                          uint8_t     _sysM,
11511956Sgabeblack@google.com                                          bool        _r)
11611956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1, _sysM),
11711956Sgabeblack@google.com          r(_r)
11811956Sgabeblack@google.com    {
11911956Sgabeblack@google.com        %(constructor)s;
12011956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
12111956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
12211956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
12311956Sgabeblack@google.com            }
12411956Sgabeblack@google.com        }
12511956Sgabeblack@google.com    }
12611956Sgabeblack@google.com}};
12711956Sgabeblack@google.com
12811956Sgabeblack@google.comdef template MsrRegDeclare {{
12911956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
13011956Sgabeblack@google.com{
13111956Sgabeblack@google.com  protected:
13211956Sgabeblack@google.com    public:
13311956Sgabeblack@google.com        // Constructor
13411956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, IntRegIndex _op1, uint8_t mask);
13511956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
13611956Sgabeblack@google.com};
13711956Sgabeblack@google.com}};
13811956Sgabeblack@google.com
13911956Sgabeblack@google.comdef template MsrRegConstructor {{
14011956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
14111956Sgabeblack@google.com                                          IntRegIndex _op1,
14211956Sgabeblack@google.com                                          uint8_t mask)
14311956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1, mask)
14411956Sgabeblack@google.com    {
14511956Sgabeblack@google.com        %(constructor)s;
14611956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
14711956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
14811956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
14911956Sgabeblack@google.com            }
15011956Sgabeblack@google.com        }
15111956Sgabeblack@google.com    }
15211956Sgabeblack@google.com}};
15311956Sgabeblack@google.com
15411956Sgabeblack@google.comdef template MsrImmDeclare {{
15511956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
15611956Sgabeblack@google.com{
15711956Sgabeblack@google.com  protected:
15811956Sgabeblack@google.com    public:
15911956Sgabeblack@google.com        // Constructor
16011956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, uint32_t imm, uint8_t mask);
16111956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
16211956Sgabeblack@google.com};
16311956Sgabeblack@google.com}};
16411956Sgabeblack@google.com
16511956Sgabeblack@google.comdef template MsrImmConstructor {{
16611956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
16711956Sgabeblack@google.com                                          uint32_t imm,
16811956Sgabeblack@google.com                                          uint8_t mask)
16911956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, imm, mask)
17011956Sgabeblack@google.com    {
17111956Sgabeblack@google.com        %(constructor)s;
17211956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
17311956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
17411956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
17511956Sgabeblack@google.com            }
17611956Sgabeblack@google.com        }
17711956Sgabeblack@google.com    }
17811956Sgabeblack@google.com}};
17911956Sgabeblack@google.com
18011956Sgabeblack@google.comdef template MrrcOpDeclare {{
18111956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
18211956Sgabeblack@google.com{
18311956Sgabeblack@google.com  protected:
18411956Sgabeblack@google.com    public:
18511956Sgabeblack@google.com        // Constructor
18611956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, MiscRegIndex _op1,
18711956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _dest2, uint32_t imm);
18811956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
18911956Sgabeblack@google.com};
19011956Sgabeblack@google.com}};
19111956Sgabeblack@google.com
19211956Sgabeblack@google.comdef template MrrcOpConstructor {{
19311956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
19411956Sgabeblack@google.com                                          MiscRegIndex op1,
19511956Sgabeblack@google.com                                          IntRegIndex dest,
19611956Sgabeblack@google.com                                          IntRegIndex dest2,
19711956Sgabeblack@google.com                                          uint32_t    imm)
19811956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, op1, dest,
19911956Sgabeblack@google.com                         dest2, imm)
20011956Sgabeblack@google.com    {
20111956Sgabeblack@google.com        %(constructor)s;
20211956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
20311956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
20411956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
20511956Sgabeblack@google.com            }
20611956Sgabeblack@google.com        }
20711956Sgabeblack@google.com    }
20811956Sgabeblack@google.com}};
20911956Sgabeblack@google.com
21011956Sgabeblack@google.comdef template McrrOpDeclare {{
21111956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
21211956Sgabeblack@google.com{
21311956Sgabeblack@google.com  protected:
21411956Sgabeblack@google.com    public:
21511956Sgabeblack@google.com        // Constructor
21611956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, IntRegIndex _op1, IntRegIndex _op2,
21711956Sgabeblack@google.com                       MiscRegIndex _dest, uint32_t imm);
21811956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
21911956Sgabeblack@google.com};
22011956Sgabeblack@google.com}};
22111956Sgabeblack@google.com
22211956Sgabeblack@google.comdef template McrrOpConstructor {{
22311956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
22411956Sgabeblack@google.com                                          IntRegIndex op1,
22511956Sgabeblack@google.com                                          IntRegIndex op2,
22611956Sgabeblack@google.com                                          MiscRegIndex dest,
22711956Sgabeblack@google.com                                          uint32_t    imm)
22811956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, op1, op2,
22911956Sgabeblack@google.com                         dest, imm)
23011956Sgabeblack@google.com    {
23111956Sgabeblack@google.com        %(constructor)s;
23211956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
23311956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
23411956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
23511956Sgabeblack@google.com            }
23611956Sgabeblack@google.com        }
23711956Sgabeblack@google.com    }
23811956Sgabeblack@google.com}};
23911956Sgabeblack@google.com
24011956Sgabeblack@google.comdef template ImmOpDeclare {{
24111956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
24211956Sgabeblack@google.com{
24311956Sgabeblack@google.com  protected:
24411956Sgabeblack@google.com    public:
24511956Sgabeblack@google.com        // Constructor
24611956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, uint64_t _imm);
24711956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
24811956Sgabeblack@google.com};
24911956Sgabeblack@google.com}};
25011956Sgabeblack@google.com
25111956Sgabeblack@google.comdef template ImmOpConstructor {{
25211956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst, uint64_t _imm)
25311956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _imm)
25411956Sgabeblack@google.com    {
25511956Sgabeblack@google.com        %(constructor)s;
25611956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
25711956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
25811956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
25911956Sgabeblack@google.com            }
26011956Sgabeblack@google.com        }
26111956Sgabeblack@google.com    }
26211956Sgabeblack@google.com}};
26311956Sgabeblack@google.com
26411956Sgabeblack@google.comdef template RegImmOpDeclare {{
26511956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
26611956Sgabeblack@google.com{
26711956Sgabeblack@google.com  protected:
26811956Sgabeblack@google.com    public:
26911956Sgabeblack@google.com        // Constructor
27011956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, uint64_t _imm);
27111956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
27211956Sgabeblack@google.com};
27311956Sgabeblack@google.com}};
27411956Sgabeblack@google.com
27511956Sgabeblack@google.comdef template RegImmOpConstructor {{
27611956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
27711956Sgabeblack@google.com            IntRegIndex _dest, uint64_t _imm)
27811956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, _imm)
27911956Sgabeblack@google.com    {
28011956Sgabeblack@google.com        %(constructor)s;
28111956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
28211956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
28311956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
28411956Sgabeblack@google.com            }
28511956Sgabeblack@google.com        }
28611956Sgabeblack@google.com    }
28711956Sgabeblack@google.com}};
28811956Sgabeblack@google.com
28911956Sgabeblack@google.comdef template RegRegOpDeclare {{
29011956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
29111956Sgabeblack@google.com{
29211956Sgabeblack@google.com  protected:
29311956Sgabeblack@google.com    public:
29411956Sgabeblack@google.com        // Constructor
29511956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
29611956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _op1);
29711956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
29811956Sgabeblack@google.com};
29911956Sgabeblack@google.com}};
30011956Sgabeblack@google.com
30111956Sgabeblack@google.comdef template RegRegOpConstructor {{
30211956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
30311956Sgabeblack@google.com                                          IntRegIndex _dest, IntRegIndex _op1)
30411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, _op1)
30511956Sgabeblack@google.com    {
30611956Sgabeblack@google.com        %(constructor)s;
30711956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
30811956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
30911956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
31011956Sgabeblack@google.com            }
31111956Sgabeblack@google.com        }
31211956Sgabeblack@google.com    }
31311956Sgabeblack@google.com}};
31411956Sgabeblack@google.com
31511956Sgabeblack@google.comdef template RegRegRegImmOpDeclare {{
31611956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
31711956Sgabeblack@google.com{
31811956Sgabeblack@google.com  protected:
31911960Sgabeblack@google.com    public:
32011956Sgabeblack@google.com        // Constructor
32111956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
32211956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2,
32311956Sgabeblack@google.com                       uint64_t _imm);
32411956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
32511956Sgabeblack@google.com};
32611956Sgabeblack@google.com}};
32711956Sgabeblack@google.com
32811956Sgabeblack@google.comdef template RegRegRegImmOpConstructor {{
32911956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
33011956Sgabeblack@google.com                                          IntRegIndex _dest,
33111956Sgabeblack@google.com                                          IntRegIndex _op1,
33211956Sgabeblack@google.com                                          IntRegIndex _op2,
33311956Sgabeblack@google.com                                          uint64_t _imm)
33411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
33511956Sgabeblack@google.com                         _dest, _op1, _op2, _imm)
33611956Sgabeblack@google.com    {
33711956Sgabeblack@google.com        %(constructor)s;
33811956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
33911956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
34011956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
34111956Sgabeblack@google.com            }
34211956Sgabeblack@google.com        }
34311956Sgabeblack@google.com    }
34411956Sgabeblack@google.com}};
34511956Sgabeblack@google.com
34611956Sgabeblack@google.comdef template RegRegRegRegOpDeclare {{
34711956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
34811956Sgabeblack@google.com{
34911956Sgabeblack@google.com  protected:
35011956Sgabeblack@google.com    public:
35111956Sgabeblack@google.com        // Constructor
35211956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
35311956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _op1,
35411956Sgabeblack@google.com                       IntRegIndex _op2, IntRegIndex _op3);
35511956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
35611956Sgabeblack@google.com};
35711956Sgabeblack@google.com}};
35811956Sgabeblack@google.com
35911956Sgabeblack@google.comdef template RegRegRegRegOpConstructor {{
36011956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
36111956Sgabeblack@google.com                                          IntRegIndex _dest,
36211956Sgabeblack@google.com                                          IntRegIndex _op1,
36311956Sgabeblack@google.com                                          IntRegIndex _op2,
36411956Sgabeblack@google.com                                          IntRegIndex _op3)
36511956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
36611956Sgabeblack@google.com                         _dest, _op1, _op2, _op3)
36711956Sgabeblack@google.com    {
36811956Sgabeblack@google.com        %(constructor)s;
36911956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
37011956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
37111956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
37211956Sgabeblack@google.com            }
37311956Sgabeblack@google.com        }
37411956Sgabeblack@google.com    }
37511956Sgabeblack@google.com}};
37611960Sgabeblack@google.com
37711956Sgabeblack@google.comdef template RegRegRegOpDeclare {{
37811956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
37911956Sgabeblack@google.com{
38011956Sgabeblack@google.com  protected:
38111956Sgabeblack@google.com    public:
38211956Sgabeblack@google.com        // Constructor
38311956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
38411956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2);
38511956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
38611956Sgabeblack@google.com};
38711956Sgabeblack@google.com}};
38811956Sgabeblack@google.com
38911956Sgabeblack@google.comdef template RegRegRegOpConstructor {{
39011956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
39111956Sgabeblack@google.com                                          IntRegIndex _dest,
39211956Sgabeblack@google.com                                          IntRegIndex _op1,
39311956Sgabeblack@google.com                                          IntRegIndex _op2)
39411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
39511956Sgabeblack@google.com                         _dest, _op1, _op2)
39611956Sgabeblack@google.com    {
39711956Sgabeblack@google.com        %(constructor)s;
39811956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
39911956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
40011956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
40111956Sgabeblack@google.com            }
40211956Sgabeblack@google.com        }
40311956Sgabeblack@google.com    }
40411956Sgabeblack@google.com}};
40511956Sgabeblack@google.com
40611956Sgabeblack@google.comdef template RegRegImmOpDeclare {{
40711956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
40811956Sgabeblack@google.com{
40911956Sgabeblack@google.com  protected:
41011956Sgabeblack@google.com    public:
41111956Sgabeblack@google.com        // Constructor
41211956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
41311956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _op1,
41411956Sgabeblack@google.com                       uint64_t _imm);
41511956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
41611956Sgabeblack@google.com};
41711956Sgabeblack@google.com}};
41811956Sgabeblack@google.com
41911956Sgabeblack@google.comdef template RegRegImmOpConstructor {{
42011956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
42111956Sgabeblack@google.com                                          IntRegIndex _dest,
42211956Sgabeblack@google.com                                          IntRegIndex _op1,
42311956Sgabeblack@google.com                                          uint64_t _imm)
42411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
42511956Sgabeblack@google.com                         _dest, _op1, _imm)
42611956Sgabeblack@google.com    {
42711956Sgabeblack@google.com        %(constructor)s;
42811956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
42911956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
43011956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
43111956Sgabeblack@google.com            }
43211956Sgabeblack@google.com        }
43311956Sgabeblack@google.com    }
43411956Sgabeblack@google.com}};
43511956Sgabeblack@google.com
43611956Sgabeblack@google.comdef template MiscRegRegImmOpDeclare {{
43711956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
43811956Sgabeblack@google.com{
43911956Sgabeblack@google.com  protected:
44011956Sgabeblack@google.com    public:
44111956Sgabeblack@google.com        // Constructor
44211956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
44311956Sgabeblack@google.com                       MiscRegIndex _dest, IntRegIndex _op1,
44411956Sgabeblack@google.com                       uint64_t _imm);
44511956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
44611956Sgabeblack@google.com};
44711956Sgabeblack@google.com}};
44811956Sgabeblack@google.com
44911956Sgabeblack@google.comdef template MiscRegRegImmOpConstructor {{
45011956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
45111956Sgabeblack@google.com                                          MiscRegIndex _dest,
45211956Sgabeblack@google.com                                          IntRegIndex _op1,
45311956Sgabeblack@google.com                                          uint64_t _imm)
45411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
45511956Sgabeblack@google.com                         _dest, _op1, _imm)
45611956Sgabeblack@google.com    {
45711956Sgabeblack@google.com        %(constructor)s;
45811956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
45911956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
46011956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
46111956Sgabeblack@google.com            }
46211956Sgabeblack@google.com        }
46311956Sgabeblack@google.com    }
46411956Sgabeblack@google.com}};
46511956Sgabeblack@google.com
46611956Sgabeblack@google.comdef template RegMiscRegImmOpDeclare {{
46711956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
46811956Sgabeblack@google.com{
46911956Sgabeblack@google.com  protected:
47011956Sgabeblack@google.com    public:
47111956Sgabeblack@google.com        // Constructor
47211956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
47311956Sgabeblack@google.com                       IntRegIndex _dest, MiscRegIndex _op1,
47411956Sgabeblack@google.com                       uint64_t _imm);
47511956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
47611956Sgabeblack@google.com};
47711960Sgabeblack@google.com}};
47811956Sgabeblack@google.com
47911956Sgabeblack@google.comdef template RegMiscRegImmOpConstructor {{
48011956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
48111956Sgabeblack@google.com                                          IntRegIndex _dest,
48211956Sgabeblack@google.com                                          MiscRegIndex _op1,
48311956Sgabeblack@google.com                                          uint64_t _imm)
48411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
48511956Sgabeblack@google.com                         _dest, _op1, _imm)
48611956Sgabeblack@google.com    {
48711956Sgabeblack@google.com        %(constructor)s;
48811956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
48911956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
49011956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
49111956Sgabeblack@google.com            }
49211956Sgabeblack@google.com        }
49311956Sgabeblack@google.com    }
49411956Sgabeblack@google.com}};
49511956Sgabeblack@google.com
49611956Sgabeblack@google.comdef template RegImmImmOpDeclare {{
49711956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
49811956Sgabeblack@google.com{
49911956Sgabeblack@google.com  protected:
50011956Sgabeblack@google.com    public:
50111956Sgabeblack@google.com        // Constructor
50211956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
50311956Sgabeblack@google.com                       IntRegIndex _dest, uint64_t _imm1, uint64_t _imm2);
50411956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
50511956Sgabeblack@google.com};
50611956Sgabeblack@google.com}};
50711956Sgabeblack@google.com
50811956Sgabeblack@google.comdef template RegImmImmOpConstructor {{
50911956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
51011956Sgabeblack@google.com                                          IntRegIndex _dest,
51111956Sgabeblack@google.com                                          uint64_t _imm1,
51211956Sgabeblack@google.com                                          uint64_t _imm2)
51311956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
51411956Sgabeblack@google.com                         _dest, _imm1, _imm2)
51511956Sgabeblack@google.com    {
51611956Sgabeblack@google.com        %(constructor)s;
51711956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
51811956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
51911956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
52011956Sgabeblack@google.com            }
52111956Sgabeblack@google.com        }
52211956Sgabeblack@google.com    }
52311956Sgabeblack@google.com}};
52411956Sgabeblack@google.com
52511956Sgabeblack@google.comdef template RegRegImmImmOpDeclare {{
52611956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
52711956Sgabeblack@google.com{
52811956Sgabeblack@google.com  protected:
52911956Sgabeblack@google.com    public:
53011956Sgabeblack@google.com        // Constructor
53111956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
53211956Sgabeblack@google.com                       IntRegIndex _dest, IntRegIndex _op1,
53311956Sgabeblack@google.com                       uint64_t _imm1, uint64_t _imm2);
53411956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
53511956Sgabeblack@google.com};
53611956Sgabeblack@google.com}};
53711956Sgabeblack@google.com
53811956Sgabeblack@google.comdef template RegRegImmImmOpConstructor {{
53911956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
54011956Sgabeblack@google.com                                          IntRegIndex _dest,
54111956Sgabeblack@google.com                                          IntRegIndex _op1,
54211956Sgabeblack@google.com                                          uint64_t _imm1,
54311956Sgabeblack@google.com                                          uint64_t _imm2)
54411956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
54511956Sgabeblack@google.com                         _dest, _op1, _imm1, _imm2)
54611956Sgabeblack@google.com    {
54711956Sgabeblack@google.com        %(constructor)s;
54811956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
54911956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
55011956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
55111956Sgabeblack@google.com            }
55211956Sgabeblack@google.com        }
55311956Sgabeblack@google.com    }
55411956Sgabeblack@google.com}};
55511956Sgabeblack@google.com
55611956Sgabeblack@google.comdef template RegImmRegOpDeclare {{
55711956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
55811956Sgabeblack@google.com{
55911956Sgabeblack@google.com  protected:
56011956Sgabeblack@google.com    public:
56111956Sgabeblack@google.com        // Constructor
56211956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
56311956Sgabeblack@google.com                       IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1);
56411956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
56511956Sgabeblack@google.com};
56611956Sgabeblack@google.com}};
56711956Sgabeblack@google.com
56811956Sgabeblack@google.comdef template RegImmRegOpConstructor {{
56911956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
57011956Sgabeblack@google.com                                          IntRegIndex _dest,
57111956Sgabeblack@google.com                                          uint64_t _imm,
57211956Sgabeblack@google.com                                          IntRegIndex _op1)
57311956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
57411956Sgabeblack@google.com                         _dest, _imm, _op1)
57511956Sgabeblack@google.com    {
57611956Sgabeblack@google.com        %(constructor)s;
57711956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
57811956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
57911956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
58011956Sgabeblack@google.com            }
58111956Sgabeblack@google.com        }
58211956Sgabeblack@google.com    }
58311956Sgabeblack@google.com}};
58411956Sgabeblack@google.com
58511956Sgabeblack@google.comdef template RegImmRegShiftOpDeclare {{
58611956Sgabeblack@google.comclass %(class_name)s : public %(base_class)s
58711956Sgabeblack@google.com{
58811956Sgabeblack@google.com  protected:
58911956Sgabeblack@google.com    public:
59011956Sgabeblack@google.com        // Constructor
59111956Sgabeblack@google.com        %(class_name)s(ExtMachInst machInst,
59211956Sgabeblack@google.com                       IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1,
59311956Sgabeblack@google.com                       int32_t _shiftAmt, ArmShiftType _shiftType);
59411956Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const;
59511960Sgabeblack@google.com};
59611956Sgabeblack@google.com}};
59711956Sgabeblack@google.com
59811956Sgabeblack@google.comdef template RegImmRegShiftOpConstructor {{
59911956Sgabeblack@google.com    %(class_name)s::%(class_name)s(ExtMachInst machInst,
60011956Sgabeblack@google.com                                          IntRegIndex _dest,
60111956Sgabeblack@google.com                                          uint64_t _imm,
60211956Sgabeblack@google.com                                          IntRegIndex _op1,
60311956Sgabeblack@google.com                                          int32_t _shiftAmt,
60411956Sgabeblack@google.com                                          ArmShiftType _shiftType)
60511956Sgabeblack@google.com        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
60611956Sgabeblack@google.com                         _dest, _imm, _op1, _shiftAmt, _shiftType)
60711956Sgabeblack@google.com    {
60811956Sgabeblack@google.com        %(constructor)s;
60911956Sgabeblack@google.com        if (!(condCode == COND_AL || condCode == COND_UC)) {
61011956Sgabeblack@google.com            for (int x = 0; x < _numDestRegs; x++) {
61111956Sgabeblack@google.com                _srcRegIdx[_numSrcRegs++] = _destRegIdx[x];
61211956Sgabeblack@google.com            }
61311956Sgabeblack@google.com        }
61411956Sgabeblack@google.com    }
61511956Sgabeblack@google.com}};
61611956Sgabeblack@google.com
61711956Sgabeblack@google.comdef template MiscRegRegImmMemOpDeclare {{
61811956Sgabeblack@google.com    class %(class_name)s : public %(base_class)s
61911956Sgabeblack@google.com    {
62011956Sgabeblack@google.com    protected:
62111956Sgabeblack@google.com    public:
62211956Sgabeblack@google.com      // Constructor
62311956Sgabeblack@google.com      %(class_name)s(ExtMachInst machInst,
62411956Sgabeblack@google.com                     MiscRegIndex _dest, IntRegIndex _op1,
62511956Sgabeblack@google.com                     uint64_t _imm);
62611956Sgabeblack@google.com      Fault execute(ExecContext *, Trace::InstRecord *) const;
62711956Sgabeblack@google.com      Fault initiateAcc(ExecContext *, Trace::InstRecord *) const;
62811956Sgabeblack@google.com      Fault completeAcc(PacketPtr, ExecContext *, Trace::InstRecord *) const;
62911956Sgabeblack@google.com    };
63011956Sgabeblack@google.com}};
63111956Sgabeblack@google.com
63211956Sgabeblack@google.comdef template Mcr15Execute {{
63311956Sgabeblack@google.com    Fault %(class_name)s::execute(ExecContext *xc,
63411956Sgabeblack@google.com                                  Trace::InstRecord *traceData) const
63511956Sgabeblack@google.com    {
63611956Sgabeblack@google.com        Addr EA;
63711956Sgabeblack@google.com        Fault fault = NoFault;
63811956Sgabeblack@google.com
63911956Sgabeblack@google.com        %(op_decl)s;
64011956Sgabeblack@google.com        %(op_rd)s;
64111956Sgabeblack@google.com        %(ea_code)s;
64211956Sgabeblack@google.com
64311956Sgabeblack@google.com        if (%(predicate_test)s) {
64411956Sgabeblack@google.com            if (fault == NoFault) {
64511956Sgabeblack@google.com                %(memacc_code)s;
64611956Sgabeblack@google.com            }
64711956Sgabeblack@google.com
64811956Sgabeblack@google.com            if (fault == NoFault) {
64911956Sgabeblack@google.com                Addr size = 64;
65011956Sgabeblack@google.com                EA &= ~(size - 1);
65111956Sgabeblack@google.com                fault = xc->writeMem(NULL, size, EA, memAccessFlags, NULL);
65211956Sgabeblack@google.com            }
65311956Sgabeblack@google.com        } else {
65411956Sgabeblack@google.com            xc->setPredicate(false);
65511956Sgabeblack@google.com        }
65611956Sgabeblack@google.com
65711956Sgabeblack@google.com        return fault;
65811956Sgabeblack@google.com    }
65911956Sgabeblack@google.com}};
66011956Sgabeblack@google.com
66111956Sgabeblack@google.comdef template Mcr15InitiateAcc {{
66211956Sgabeblack@google.com    Fault %(class_name)s::initiateAcc(ExecContext *xc,
66311956Sgabeblack@google.com                                      Trace::InstRecord *traceData) const
66411956Sgabeblack@google.com    {
66511956Sgabeblack@google.com        Addr EA;
66611956Sgabeblack@google.com        Fault fault = NoFault;
66711956Sgabeblack@google.com
66811956Sgabeblack@google.com        %(op_decl)s;
66911956Sgabeblack@google.com        %(op_rd)s;
67011956Sgabeblack@google.com        %(ea_code)s;
67111956Sgabeblack@google.com
67211956Sgabeblack@google.com        if (%(predicate_test)s) {
67311956Sgabeblack@google.com            if (fault == NoFault) {
67411956Sgabeblack@google.com                %(memacc_code)s;
67511956Sgabeblack@google.com            }
67611956Sgabeblack@google.com
67711956Sgabeblack@google.com            if (fault == NoFault) {
67811956Sgabeblack@google.com                Addr size = 64;
67911956Sgabeblack@google.com                EA &= ~(size - 1);
68011956Sgabeblack@google.com                fault = xc->writeMem(NULL, size, EA, memAccessFlags, NULL);
68111956Sgabeblack@google.com            }
68211956Sgabeblack@google.com        } else {
68311956Sgabeblack@google.com            xc->setPredicate(false);
68411956Sgabeblack@google.com        }
68511956Sgabeblack@google.com
68611956Sgabeblack@google.com        return fault;
68711956Sgabeblack@google.com    }
68811956Sgabeblack@google.com}};
68911956Sgabeblack@google.com
69011956Sgabeblack@google.comdef template Mcr15CompleteAcc {{
69111956Sgabeblack@google.com    Fault %(class_name)s::completeAcc(PacketPtr pkt,
69211956Sgabeblack@google.com                                      ExecContext *xc,
69311956Sgabeblack@google.com                                      Trace::InstRecord *traceData) const
69411956Sgabeblack@google.com    {
69511956Sgabeblack@google.com        return NoFault;
69611956Sgabeblack@google.com    }
69711956Sgabeblack@google.com}};
69811956Sgabeblack@google.com