micromediaop.hh (6799:36131e4dfb6e) micromediaop.hh (6800:335f8b406bb9)
1/*
2 * Copyright (c) 2009 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 */
30
31#ifndef __ARCH_X86_INSTS_MICROMEDIAOP_HH__
32#define __ARCH_X86_INSTS_MICROMEDIAOP_HH__
33
34#include "arch/x86/insts/microop.hh"
35
36namespace X86ISA
37{
38 enum MediaFlag {
1/*
2 * Copyright (c) 2009 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 */
30
31#ifndef __ARCH_X86_INSTS_MICROMEDIAOP_HH__
32#define __ARCH_X86_INSTS_MICROMEDIAOP_HH__
33
34#include "arch/x86/insts/microop.hh"
35
36namespace X86ISA
37{
38 enum MediaFlag {
39 MediaMultHiOp = 1,
39 MediaScalarOp = 128
40 };
41
42 class MediaOpBase : public X86MicroopBase
43 {
44 protected:
45 const RegIndex src1;
46 const RegIndex dest;
47 const uint8_t srcSize;
48 const uint8_t destSize;
49 const uint8_t ext;
50 static const RegIndex foldOBit = 0;
51
52 // Constructor
53 MediaOpBase(ExtMachInst _machInst,
54 const char *mnem, const char *_instMnem,
55 bool isMicro, bool isDelayed,
56 bool isFirst, bool isLast,
57 InstRegIndex _src1, InstRegIndex _dest,
58 uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
59 OpClass __opClass) :
60 X86MicroopBase(_machInst, mnem, _instMnem,
61 isMicro, isDelayed, isFirst, isLast,
62 __opClass),
63 src1(_src1.idx), dest(_dest.idx),
64 srcSize(_srcSize), destSize(_destSize), ext(_ext)
65 {}
66
67 bool
68 scalarOp() const
69 {
70 return ext & MediaScalarOp;
71 }
72
73 int
74 numItems(int size) const
75 {
76 return scalarOp() ? 1 : (sizeof(FloatRegBits) / size);
77 }
40 MediaScalarOp = 128
41 };
42
43 class MediaOpBase : public X86MicroopBase
44 {
45 protected:
46 const RegIndex src1;
47 const RegIndex dest;
48 const uint8_t srcSize;
49 const uint8_t destSize;
50 const uint8_t ext;
51 static const RegIndex foldOBit = 0;
52
53 // Constructor
54 MediaOpBase(ExtMachInst _machInst,
55 const char *mnem, const char *_instMnem,
56 bool isMicro, bool isDelayed,
57 bool isFirst, bool isLast,
58 InstRegIndex _src1, InstRegIndex _dest,
59 uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
60 OpClass __opClass) :
61 X86MicroopBase(_machInst, mnem, _instMnem,
62 isMicro, isDelayed, isFirst, isLast,
63 __opClass),
64 src1(_src1.idx), dest(_dest.idx),
65 srcSize(_srcSize), destSize(_destSize), ext(_ext)
66 {}
67
68 bool
69 scalarOp() const
70 {
71 return ext & MediaScalarOp;
72 }
73
74 int
75 numItems(int size) const
76 {
77 return scalarOp() ? 1 : (sizeof(FloatRegBits) / size);
78 }
79
80 bool
81 multHi() const
82 {
83 return ext & MediaMultHiOp;
84 }
78 };
79
80 class MediaOpReg : public MediaOpBase
81 {
82 protected:
83 const RegIndex src2;
84
85 // Constructor
86 MediaOpReg(ExtMachInst _machInst,
87 const char *mnem, const char *_instMnem,
88 bool isMicro, bool isDelayed,
89 bool isFirst, bool isLast,
90 InstRegIndex _src1, InstRegIndex _src2, InstRegIndex _dest,
91 uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
92 OpClass __opClass) :
93 MediaOpBase(_machInst, mnem, _instMnem,
94 isMicro, isDelayed, isFirst, isLast,
95 _src1, _dest, _srcSize, _destSize, _ext,
96 __opClass),
97 src2(_src2.idx)
98 {}
99
100 std::string generateDisassembly(Addr pc,
101 const SymbolTable *symtab) const;
102 };
103
104 class MediaOpImm : public MediaOpBase
105 {
106 protected:
107 uint8_t imm8;
108
109 // Constructor
110 MediaOpImm(ExtMachInst _machInst,
111 const char *mnem, const char *_instMnem,
112 bool isMicro, bool isDelayed,
113 bool isFirst, bool isLast,
114 InstRegIndex _src1, uint8_t _imm8, InstRegIndex _dest,
115 uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
116 OpClass __opClass) :
117 MediaOpBase(_machInst, mnem, _instMnem,
118 isMicro, isDelayed, isFirst, isLast,
119 _src1, _dest, _srcSize, _destSize, _ext,
120 __opClass),
121 imm8(_imm8)
122 {}
123
124 std::string generateDisassembly(Addr pc,
125 const SymbolTable *symtab) const;
126 };
127}
128
129#endif //__ARCH_X86_INSTS_MICROMEDIAOP_HH__
85 };
86
87 class MediaOpReg : public MediaOpBase
88 {
89 protected:
90 const RegIndex src2;
91
92 // Constructor
93 MediaOpReg(ExtMachInst _machInst,
94 const char *mnem, const char *_instMnem,
95 bool isMicro, bool isDelayed,
96 bool isFirst, bool isLast,
97 InstRegIndex _src1, InstRegIndex _src2, InstRegIndex _dest,
98 uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
99 OpClass __opClass) :
100 MediaOpBase(_machInst, mnem, _instMnem,
101 isMicro, isDelayed, isFirst, isLast,
102 _src1, _dest, _srcSize, _destSize, _ext,
103 __opClass),
104 src2(_src2.idx)
105 {}
106
107 std::string generateDisassembly(Addr pc,
108 const SymbolTable *symtab) const;
109 };
110
111 class MediaOpImm : public MediaOpBase
112 {
113 protected:
114 uint8_t imm8;
115
116 // Constructor
117 MediaOpImm(ExtMachInst _machInst,
118 const char *mnem, const char *_instMnem,
119 bool isMicro, bool isDelayed,
120 bool isFirst, bool isLast,
121 InstRegIndex _src1, uint8_t _imm8, InstRegIndex _dest,
122 uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
123 OpClass __opClass) :
124 MediaOpBase(_machInst, mnem, _instMnem,
125 isMicro, isDelayed, isFirst, isLast,
126 _src1, _dest, _srcSize, _destSize, _ext,
127 __opClass),
128 imm8(_imm8)
129 {}
130
131 std::string generateDisassembly(Addr pc,
132 const SymbolTable *symtab) const;
133 };
134}
135
136#endif //__ARCH_X86_INSTS_MICROMEDIAOP_HH__