3 // Copyright (c) 2010-2014 ARM Limited
6 // The license below extends only to copyright in the software and shall
7 // not be construed as granting a license to any other intellectual
8 // property including but not limited to intellectual property relating
9 // to a hardware implementation of the functionality of the software
10 // licensed hereunder. You may use the software subject to the license
11 // terms below provided that you ensure that this notice is replicated
12 // unmodified and in its entirety in all distributions of the software,
13 // modified or unmodified, in source code or in binary form.
15 // Copyright (c) 2007-2008 The Florida State University
16 // All rights reserved.
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are
20 // met: redistributions of source code must retain the above copyright
21 // notice, this list of conditions and the following disclaimer;
22 // redistributions in binary form must reproduce the above copyright
23 // notice, this list of conditions and the following disclaimer in the
24 // documentation and/or other materials provided with the distribution;
25 // neither the name of the copyright holders nor the names of its
26 // contributors may be used to endorse or promote products derived from
27 // this software without specific prior written permission.
29 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ////////////////////////////////////////////////////////////////////
43 // Load/store microops
46 def template MicroMemDeclare {{
47 class %(class_name)s : public %(base_class)s
50 %(class_name)s(ExtMachInst machInst,
51 RegIndex _ura, RegIndex _urb, bool _up,
53 Fault execute(ExecContext *, Trace::InstRecord *) const override;
54 Fault initiateAcc(ExecContext *, Trace::InstRecord *) const override;
55 Fault completeAcc(PacketPtr, ExecContext *,
56 Trace::InstRecord *) const override;
60 def template MicroMemConstructor {{
61 %(class_name)s::%(class_name)s(ExtMachInst machInst,
66 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
67 _ura, _urb, _up, _imm)
70 if (!(condCode == COND_AL || condCode == COND_UC)) {
71 for (int x = 0; x < _numDestRegs; x++) {
72 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
79 def template MicroMemPairDeclare {{
80 class %(class_name)s : public %(base_class)s
83 %(class_name)s(ExtMachInst machInst,
84 RegIndex _dreg1, RegIndex _dreg2, RegIndex _base,
85 bool _up, uint8_t _imm);
86 Fault execute(ExecContext *, Trace::InstRecord *) const override;
87 Fault initiateAcc(ExecContext *, Trace::InstRecord *) const override;
88 Fault completeAcc(PacketPtr, ExecContext *,
89 Trace::InstRecord *) const override;
93 def template MicroMemPairConstructor {{
94 %(class_name)s::%(class_name)s(ExtMachInst machInst,
100 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
101 _dreg1, _dreg2, _base, _up, _imm)
104 if (!(condCode == COND_AL || condCode == COND_UC)) {
105 for (int x = 0; x < _numDestRegs; x++) {
106 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
112 ////////////////////////////////////////////////////////////////////
114 // Neon load/store microops
117 def template MicroNeonMemDeclare {{
118 template <class Element>
119 class %(class_name)s : public %(base_class)s
122 %(class_name)s(ExtMachInst machInst, RegIndex _dest,
123 RegIndex _ura, uint32_t _imm, unsigned extraMemFlags)
124 : %(base_class)s("%(mnemonic)s", machInst,
125 %(op_class)s, _dest, _ura, _imm)
127 memAccessFlags |= extraMemFlags;
129 if (!(condCode == COND_AL || condCode == COND_UC)) {
130 for (int x = 0; x < _numDestRegs; x++) {
131 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
136 Fault execute(ExecContext *, Trace::InstRecord *) const override;
137 Fault initiateAcc(ExecContext *, Trace::InstRecord *) const override;
138 Fault completeAcc(PacketPtr, ExecContext *,
139 Trace::InstRecord *) const override;
143 ////////////////////////////////////////////////////////////////////
146 // CPSR = Integer(urb)
149 def template MicroSetPCCPSRDeclare {{
150 class %(class_name)s : public %(base_class)s
153 %(class_name)s(ExtMachInst machInst,
157 Fault execute(ExecContext *, Trace::InstRecord *) const override;
161 def template MicroSetPCCPSRConstructor {{
162 %(class_name)s::%(class_name)s(ExtMachInst machInst,
166 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
170 if (!(condCode == COND_AL || condCode == COND_UC)) {
171 flags[IsCondControl] = true;
172 for (int x = 0; x < _numDestRegs; x++) {
173 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
176 flags[IsUncondControl] = true;
181 ////////////////////////////////////////////////////////////////////
183 // Integer = Integer op Integer microops
186 def template MicroNeonMemExecDeclare {{
188 Fault %(class_name)s<%(targs)s>::execute(
189 ExecContext *, Trace::InstRecord *) const;
191 Fault %(class_name)s<%(targs)s>::initiateAcc(
192 ExecContext *, Trace::InstRecord *) const;
194 Fault %(class_name)s<%(targs)s>::completeAcc(PacketPtr,
195 ExecContext *, Trace::InstRecord *) const;
198 def template MicroNeonExecDeclare {{
200 Fault %(class_name)s<%(targs)s>::execute(
201 ExecContext *, Trace::InstRecord *) const;
204 ////////////////////////////////////////////////////////////////////
206 // Neon (de)interlacing microops
209 def template MicroNeonMixDeclare {{
210 template <class Element>
211 class %(class_name)s : public %(base_class)s
214 %(class_name)s(ExtMachInst machInst, RegIndex _dest, RegIndex _op1,
216 %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
220 if (!(condCode == COND_AL || condCode == COND_UC)) {
221 for (int x = 0; x < _numDestRegs; x++) {
222 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
227 Fault execute(ExecContext *, Trace::InstRecord *) const override;
231 def template MicroNeonMixExecute {{
232 template <class Element>
233 Fault %(class_name)s<Element>::execute(ExecContext *xc,
234 Trace::InstRecord *traceData) const
236 Fault fault = NoFault;
237 uint64_t resTemp = 0;
242 if (%(predicate_test)s)
245 if (fault == NoFault)
250 xc->setPredicate(false);
257 ////////////////////////////////////////////////////////////////////
259 // Neon (un)packing microops using a particular lane
262 def template MicroNeonMixLaneDeclare {{
263 template <class Element>
264 class %(class_name)s : public %(base_class)s
267 %(class_name)s(ExtMachInst machInst, RegIndex _dest, RegIndex _op1,
268 uint8_t _step, unsigned _lane) :
269 %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
270 _dest, _op1, _step, _lane)
273 if (!(condCode == COND_AL || condCode == COND_UC)) {
274 for (int x = 0; x < _numDestRegs; x++) {
275 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
280 Fault execute(ExecContext *, Trace::InstRecord *) const override;
284 ////////////////////////////////////////////////////////////////////
289 def template MicroIntMovDeclare {{
290 class %(class_name)s : public %(base_class)s
293 %(class_name)s(ExtMachInst machInst,
294 RegIndex _ura, RegIndex _urb);
295 Fault execute(ExecContext *, Trace::InstRecord *) const override;
298 def template MicroIntMovConstructor {{
299 %(class_name)s::%(class_name)s(ExtMachInst machInst,
302 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
306 if (!(condCode == COND_AL || condCode == COND_UC)) {
307 for (int x = 0; x < _numDestRegs; x++) {
308 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
314 ////////////////////////////////////////////////////////////////////
316 // Integer = Integer op Immediate microops
319 def template MicroIntImmDeclare {{
320 class %(class_name)s : public %(base_class)s
323 %(class_name)s(ExtMachInst machInst,
324 RegIndex _ura, RegIndex _urb,
326 Fault execute(ExecContext *, Trace::InstRecord *) const override;
330 def template MicroIntImmConstructor {{
331 %(class_name)s::%(class_name)s(ExtMachInst machInst,
335 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
339 if (!(condCode == COND_AL || condCode == COND_UC)) {
340 for (int x = 0; x < _numDestRegs; x++) {
341 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
347 def template MicroIntImmXConstructor {{
348 %(class_name)s::%(class_name)s(ExtMachInst machInst,
352 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
359 def template MicroIntRegDeclare {{
360 class %(class_name)s : public %(base_class)s
363 %(class_name)s(ExtMachInst machInst,
364 RegIndex _ura, RegIndex _urb, RegIndex _urc,
365 int32_t _shiftAmt, ArmShiftType _shiftType);
366 Fault execute(ExecContext *, Trace::InstRecord *) const override;
370 def template MicroIntXERegConstructor {{
371 %(class_name)s::%(class_name)s(ExtMachInst machInst,
372 RegIndex _ura, RegIndex _urb, RegIndex _urc,
373 ArmExtendType _type, uint32_t _shiftAmt)
374 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
375 _ura, _urb, _urc, _type, _shiftAmt)
381 def template MicroIntXERegDeclare {{
382 class %(class_name)s : public %(base_class)s
385 %(class_name)s(ExtMachInst machInst,
386 RegIndex _ura, RegIndex _urb, RegIndex _urc,
387 ArmExtendType _type, uint32_t _shiftAmt);
388 Fault execute(ExecContext *, Trace::InstRecord *) const override;
392 def template MicroIntRegConstructor {{
393 %(class_name)s::%(class_name)s(ExtMachInst machInst,
394 RegIndex _ura, RegIndex _urb, RegIndex _urc,
395 int32_t _shiftAmt, ArmShiftType _shiftType)
396 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
397 _ura, _urb, _urc, _shiftAmt, _shiftType)
400 if (!(condCode == COND_AL || condCode == COND_UC)) {
401 for (int x = 0; x < _numDestRegs; x++) {
402 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
408 ////////////////////////////////////////////////////////////////////
410 // Macro Memory-format instructions
413 def template MacroMemDeclare {{
415 * Static instructions class for a store multiple instruction
417 class %(class_name)s : public %(base_class)s
421 %(class_name)s(ExtMachInst machInst, IntRegIndex rn,
422 bool index, bool up, bool user, bool writeback, bool load,
427 def template MacroMemConstructor {{
428 %(class_name)s::%(class_name)s(ExtMachInst machInst, IntRegIndex rn,
429 bool index, bool up, bool user, bool writeback, bool load,
431 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, rn,
432 index, up, user, writeback, load, reglist)
435 if (!(condCode == COND_AL || condCode == COND_UC)) {
436 for (int x = 0; x < _numDestRegs; x++) {
437 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
444 def template BigFpMemImmDeclare {{
445 class %(class_name)s : public %(base_class)s
449 %(class_name)s(const char *mnemonic, ExtMachInst machInst,
450 bool load, IntRegIndex dest, IntRegIndex base, int64_t imm);
454 def template BigFpMemImmConstructor {{
455 %(class_name)s::%(class_name)s(const char *mnemonic, ExtMachInst machInst,
456 bool load, IntRegIndex dest, IntRegIndex base, int64_t imm)
457 : %(base_class)s(mnemonic, machInst, %(op_class)s, load, dest, base, imm)
463 def template BigFpMemRegDeclare {{
464 class %(class_name)s : public %(base_class)s
468 %(class_name)s(const char *mnemonic, ExtMachInst machInst,
469 bool load, IntRegIndex dest, IntRegIndex base,
470 IntRegIndex offset, ArmExtendType type, int64_t imm);
474 def template BigFpMemRegConstructor {{
475 %(class_name)s::%(class_name)s(const char *mnemonic, ExtMachInst machInst,
476 bool load, IntRegIndex dest, IntRegIndex base,
477 IntRegIndex offset, ArmExtendType type, int64_t imm)
478 : %(base_class)s(mnemonic, machInst, %(op_class)s, load, dest, base,
485 def template BigFpMemLitDeclare {{
486 class %(class_name)s : public %(base_class)s
490 %(class_name)s(const char *mnemonic, ExtMachInst machInst,
491 IntRegIndex dest, int64_t imm);
495 def template BigFpMemLitConstructor {{
496 %(class_name)s::%(class_name)s(const char *mnemonic, ExtMachInst machInst,
497 IntRegIndex dest, int64_t imm)
498 : %(base_class)s(mnemonic, machInst, %(op_class)s, dest, imm)
504 def template PairMemDeclare {{
505 class %(class_name)s : public %(base_class)s
509 %(class_name)s(const char *mnemonic, ExtMachInst machInst,
510 uint32_t size, bool fp, bool load, bool noAlloc, bool signExt,
511 bool exclusive, bool acrel, uint32_t imm,
512 AddrMode mode, IntRegIndex rn, IntRegIndex rt,
517 def template PairMemConstructor {{
518 %(class_name)s::%(class_name)s(const char *mnemonic, ExtMachInst machInst,
519 uint32_t size, bool fp, bool load, bool noAlloc, bool signExt,
520 bool exclusive, bool acrel, uint32_t imm, AddrMode mode,
521 IntRegIndex rn, IntRegIndex rt, IntRegIndex rt2)
522 : %(base_class)s(mnemonic, machInst, %(op_class)s, size,
523 fp, load, noAlloc, signExt, exclusive, acrel,
524 imm, mode, rn, rt, rt2)
530 def template VMemMultDeclare {{
531 class %(class_name)s : public %(base_class)s
535 %(class_name)s(ExtMachInst machInst, unsigned width,
536 RegIndex rn, RegIndex vd, unsigned regs, unsigned inc,
537 uint32_t size, uint32_t align, RegIndex rm);
541 def template VMemMultConstructor {{
542 %(class_name)s::%(class_name)s(ExtMachInst machInst, unsigned width,
543 RegIndex rn, RegIndex vd, unsigned regs, unsigned inc,
544 uint32_t size, uint32_t align, RegIndex rm)
545 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, width,
546 rn, vd, regs, inc, size, align, rm)
549 if (!(condCode == COND_AL || condCode == COND_UC)) {
550 for (int x = 0; x < _numDestRegs; x++) {
551 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
557 def template VMemSingleDeclare {{
558 class %(class_name)s : public %(base_class)s
562 %(class_name)s(ExtMachInst machInst, bool all, unsigned width,
563 RegIndex rn, RegIndex vd, unsigned regs, unsigned inc,
564 uint32_t size, uint32_t align, RegIndex rm, unsigned lane = 0);
568 def template VMemSingleConstructor {{
569 %(class_name)s::%(class_name)s(ExtMachInst machInst, bool all, unsigned width,
570 RegIndex rn, RegIndex vd, unsigned regs, unsigned inc,
571 uint32_t size, uint32_t align, RegIndex rm, unsigned lane)
572 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, all, width,
573 rn, vd, regs, inc, size, align, rm, lane)
576 if (!(condCode == COND_AL || condCode == COND_UC)) {
577 for (int x = 0; x < _numDestRegs; x++) {
578 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));
584 def template MacroVFPMemDeclare {{
586 * Static instructions class for a store multiple instruction
588 class %(class_name)s : public %(base_class)s
592 %(class_name)s(ExtMachInst machInst, IntRegIndex rn,
593 RegIndex vd, bool single, bool up, bool writeback,
594 bool load, uint32_t offset);
598 def template MacroVFPMemConstructor {{
599 %(class_name)s::%(class_name)s(ExtMachInst machInst, IntRegIndex rn,
600 RegIndex vd, bool single, bool up, bool writeback, bool load,
602 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, rn,
603 vd, single, up, writeback, load, offset)
606 if (!(condCode == COND_AL || condCode == COND_UC)) {
607 for (int x = 0; x < _numDestRegs; x++) {
608 setSrcRegIdx(_numSrcRegs++, destRegIdx(x));