2 //***************************************************************************
9 // 7/15/01 - Vikram Adve - Created
10 //**************************************************************************/
12 #ifndef LLVM_CODEGEN_SPARC_H
13 #define LLVM_CODEGEN_SPARC_H
15 #include <sys/types.h>
16 #include "llvm/CodeGen/TargetMachine.h"
18 // OpCodeMask definitions for the Sparc V9
20 const OpCodeMask Immed = 0x00002000; // immed or reg operand?
21 const OpCodeMask Annul = 0x20000000; // annul delay instr?
22 const OpCodeMask PredictTaken = 0x00080000; // predict branch taken?
25 enum SparcInstrSchedClass {
26 SPARC_NONE, /* Instructions with no scheduling restrictions */
27 SPARC_IEUN, /* Integer class that can use IEU0 or IEU1 */
28 SPARC_IEU0, /* Integer class IEU0 */
29 SPARC_IEU1, /* Integer class IEU1 */
30 SPARC_FPM, /* FP Multiply or Divide instructions */
31 SPARC_FPA, /* All other FP instructions */
32 SPARC_CTI, /* Control-transfer instructions */
33 SPARC_LD, /* Load instructions */
34 SPARC_ST, /* Store instructions */
35 SPARC_SINGLE, /* Instructions that must issue by themselves */
37 SPARC_INV, /* This should stay at the end for the next value */
38 SPARC_NUM_SCHED_CLASSES = SPARC_INV
41 // inline operator int (const SparcInstrSchedClass& si) {
45 // inline operator SparcInstrSchedClass (int i) {
46 // return (SparcInstrSchedClass) si;
49 // inline operator const SparcInstrSchedClass (int i) {
50 // return (const SparcInstrSchedClass) si;
53 //---------------------------------------------------------------------------
54 // enum SparcMachineOpCode.
55 // const MachineInstrDescriptor SparcMachineInstrDesc[]
58 // Description of UltraSparc machine instructions.
60 //---------------------------------------------------------------------------
63 enum SparcMachineOpCode {
67 // Synthetic SPARC assembly opcodes for setting a register to a constant
71 // Set high-order bits of register and clear low-order bits
74 // Add or add with carry.
75 // Immed bit specifies if second operand is immediate(1) or register(0)
81 // Subtract or subtract with carry.
82 // Immed bit specifies if second operand is immediate(1) or register(0)
88 // Integer multiply, signed divide, unsigned divide.
89 // Note that the deprecated 32-bit multiply and multiply-step are not used.
94 // Floating point add, subtract, compare
104 // NOTE: FCMPE{S,D,Q}: FP Compare With Exception are currently unused!
106 // Floating point multiply or divide.
119 // Logical operations
141 // Floating point move, negate, and abs instructions
152 // Convert from floating point to floating point formats
160 // Convert from floating point to integer formats
168 // Convert from integer to floating point formats
176 // Branch on integer comparison with zero.
177 // Annul bit specifies if intruction in delay slot is annulled(1) or not(0).
178 // PredictTaken bit hints if branch should be predicted taken(1) or not(0).
186 // Branch on integer condition code.
187 // Annul bit specifies if intruction in delay slot is annulled(1) or not(0).
188 // PredictTaken bit hints if branch should be predicted taken(1) or not(0).
206 // Branch on floating point condition code.
207 // Annul bit specifies if intruction in delay slot is annulled(1) or not(0).
208 // PredictTaken bit hints if branch should be predicted taken(1) or not(0).
226 // Conditional move on integer comparison with zero.
234 // Conditional move on integer condition code.
252 // Conditional move on floating point condition code.
253 // Note that the enum name is not the same as the assembly mnemonic below
254 // because that would duplicate some entries with those above.
255 // Therefore, we use MOVF here instead of MOV.
273 // Conditional move of floating point register on each of the above:
274 // i. on integer comparison with zero.
275 // ii. on integer condition code
276 // iii. on floating point condition code
277 // Note that the same set is repeated for S,D,Q register classes.
401 // Load integer instructions
410 // Load floating-point instructions
412 LDD, // use of this for integers is deprecated for Sparc V9
415 // Store integer instructions
421 // Store floating-point instructions
425 // Call, Return, and "Jump and link"
426 // Immed bit specifies if second operand is immediate(1) or register(0)
429 RETURN, // last valid opcode
431 // Synthetic phi operation for near-SSA form of machine code
434 // End-of-array marker
436 NUM_REAL_OPCODES = RETURN+1, // number of valid opcodes
437 NUM_TOTAL_OPCODES = INVALID_OPCODE
440 const MachineInstrDescriptor SparcMachineInstrDesc[] = {
442 // Fields of each structure:
445 // resultPosition (0-based; -1 if no result),
447 // immedIsSignExtended,
448 // numDelaySlots (in cycles)
449 // latency (in cycles)
450 // instr sched class (defined above)
451 // instr class flags (defined in TargretMachine.h)
453 { "NOP", 0, -1, 0, false, 0, 1, SPARC_NONE, M_NOP_FLAG },
455 // Synthetic SPARC assembly opcodes for setting a register to a constant.
456 // Max immediate constant should be ignored for both these instructions.
457 { "SETSW", 2, 1, 0, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
458 { "SETUW", 2, 1, 0, false, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG | M_ARITH_FLAG },
460 // Set high-order bits of register and clear low-order bits
461 { "SETHI", 2, 1, (1 << 22) - 1, false, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG | M_ARITH_FLAG },
463 // Add or add with carry.
464 { "ADD", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
465 { "ADDcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_ARITH_FLAG },
466 { "ADDC", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
467 { "ADDCcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_ARITH_FLAG },
469 // Sub tract or subtract with carry.
470 { "SUB", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
471 { "SUBcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_ARITH_FLAG },
472 { "SUBC", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
473 { "SUBCcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_ARITH_FLAG },
475 // Integer multiply, signed divide, unsigned divide.
476 // Note that the deprecated 32-bit multiply and multiply-step are not used.
477 { "MULX", 3, 2, (1 << 12) - 1, true, 0, 3, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
478 { "SDIVX", 3, 2, (1 << 12) - 1, true, 0, 6, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
479 { "UDIVX", 3, 2, (1 << 12) - 1, true, 0, 6, SPARC_IEUN, M_INT_FLAG | M_ARITH_FLAG },
481 // Floating point add, subtract, compare.
482 // Note that destination of FCMP* instructions is operand 0, not operand 2.
483 { "FADDS", 3, 2, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
484 { "FADDD", 3, 2, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
485 { "FADDQ", 3, 2, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
486 { "FSUBS", 3, 2, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
487 { "FSUBD", 3, 2, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
488 { "FSUBQ", 3, 2, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
489 { "FCMPS", 3, 0, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
490 { "FCMPD", 3, 0, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
491 { "FCMPQ", 3, 0, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
492 // NOTE: FCMPE{S,D,Q}: FP Compare With Exception are currently unused!
494 // Floating point multiply or divide.
495 { "FMULS", 3, 2, 0, false, 0, 3, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
496 { "FMULD", 3, 2, 0, false, 0, 3, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
497 { "FMULQ", 3, 2, 0, false, 0, 0, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
498 { "FSMULD", 3, 2, 0, false, 0, 3, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
499 { "FDMULQ", 3, 2, 0, false, 0, 0, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
500 { "FDIVS", 3, 2, 0, false, 0, 12, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
501 { "FDIVD", 3, 2, 0, false, 0, 22, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
502 { "FDIVQ", 3, 2, 0, false, 0, 0, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
503 { "FSQRTS", 3, 2, 0, false, 0, 12, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
504 { "FSQRTD", 3, 2, 0, false, 0, 22, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
505 { "FSQRTQ", 3, 2, 0, false, 0, 0, SPARC_FPM, M_FLOAT_FLAG | M_ARITH_FLAG },
507 // Logical operations
508 { "AND", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG},
509 { "ANDcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_LOGICAL_FLAG},
510 { "ANDN", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG},
511 { "ANDNcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_LOGICAL_FLAG},
512 { "OR", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG},
513 { "ORcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_LOGICAL_FLAG},
514 { "ORN", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG},
515 { "ORNcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_LOGICAL_FLAG},
516 { "XOR", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG},
517 { "XORcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_LOGICAL_FLAG},
518 { "XNOR", 3, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEUN, M_INT_FLAG | M_LOGICAL_FLAG},
519 { "XNORcc", 4, 2, (1 << 12) - 1, true, 0, 1, SPARC_IEU1, M_INT_FLAG | M_LOGICAL_FLAG},
522 { "SLL", 3, 2, (1 << 5) - 1, true, 0, 1, SPARC_IEU0, M_INT_FLAG | M_LOGICAL_FLAG},
523 { "SRL", 3, 2, (1 << 5) - 1, true, 0, 1, SPARC_IEU0, M_INT_FLAG | M_LOGICAL_FLAG},
524 { "SRA", 3, 2, (1 << 5) - 1, true, 0, 1, SPARC_IEU0, M_INT_FLAG | M_ARITH_FLAG },
525 { "SLLX", 3, 2, (1 << 6) - 1, true, 0, 1, SPARC_IEU0, M_INT_FLAG | M_LOGICAL_FLAG},
526 { "SRLX", 3, 2, (1 << 6) - 1, true, 0, 1, SPARC_IEU0, M_INT_FLAG | M_LOGICAL_FLAG},
527 { "SRAX", 3, 2, (1 << 6) - 1, true, 0, 1, SPARC_IEU0, M_INT_FLAG | M_ARITH_FLAG },
529 // Floating point move, negate, and abs instructions
530 { "FMOVS", 2, 1, 0, false, 0, 1, SPARC_FPA, M_FLOAT_FLAG },
531 { "FMOVD", 2, 1, 0, false, 0, 1, SPARC_FPA, M_FLOAT_FLAG },
532 //{ "FMOVQ", 2, 1, 0, false, 0, ?, SPARC_FPA, M_FLOAT_FLAG },
533 { "FNEGS", 2, 1, 0, false, 0, 1, SPARC_FPA, M_FLOAT_FLAG },
534 { "FNEGD", 2, 1, 0, false, 0, 1, SPARC_FPA, M_FLOAT_FLAG },
535 //{ "FNEGQ", 2, 1, 0, false, 0, ?, SPARC_FPA, M_FLOAT_FLAG },
536 { "FABSS", 2, 1, 0, false, 0, 1, SPARC_FPA, M_FLOAT_FLAG },
537 { "FABSD", 2, 1, 0, false, 0, 1, SPARC_FPA, M_FLOAT_FLAG },
538 //{ "FABSQ", 2, 1, 0, false, 0, ?, SPARC_FPA, M_FLOAT_FLAG },
540 // Convert from floating point to floating point formats
541 { "FSTOD", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
542 { "FSTOQ", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
543 { "FDTOS", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
544 { "FDTOQ", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
545 { "FQTOS", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
546 { "FQTOD", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_ARITH_FLAG },
548 // Convert from floating point to integer formats.
549 // Note that this accesses both integer and floating point registers.
550 { "FSTOX", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
551 { "FDTOX", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
552 { "FQTOX", 2, 1, 0, false, 0, 2, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
553 { "FSTOI", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
554 { "FDTOI", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
555 { "FQTOI", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
557 // Convert from integer to floating point formats
558 // Note that this accesses both integer and floating point registers.
559 { "FXTOS", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
560 { "FXTOD", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
561 { "FXTOQ", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
562 { "FITOS", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
563 { "FITOD", 2, 1, 0, false, 0, 3, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
564 { "FITOQ", 2, 1, 0, false, 0, 0, SPARC_FPA, M_FLOAT_FLAG | M_INT_FLAG | M_ARITH_FLAG },
566 // Branch on integer comparison with zero.
567 // Latency includes the delay slot.
568 { "BRZ", 2, -1, (1 << 15) - 1, true, 1, 2, SPARC_CTI, M_INT_FLAG | M_BRANCH_FLAG },
569 { "BRLEZ", 2, -1, (1 << 15) - 1, true, 1, 2, SPARC_CTI, M_INT_FLAG | M_BRANCH_FLAG },
570 { "BRLZ", 2, -1, (1 << 15) - 1, true, 1, 2, SPARC_CTI, M_INT_FLAG | M_BRANCH_FLAG },
571 { "BRNZ", 2, -1, (1 << 15) - 1, true, 1, 2, SPARC_CTI, M_INT_FLAG | M_BRANCH_FLAG },
572 { "BRGZ", 2, -1, (1 << 15) - 1, true, 1, 2, SPARC_CTI, M_INT_FLAG | M_BRANCH_FLAG },
573 { "BRGEZ", 2, -1, (1 << 15) - 1, true, 1, 2, SPARC_CTI, M_INT_FLAG | M_BRANCH_FLAG },
575 // Branch on condition code.
576 // The first argument specifies the ICC register: %icc or %xcc
577 // Latency includes the delay slot.
578 { "BA", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
579 { "BN", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
580 { "BNE", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
581 { "BE", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
582 { "BG", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
583 { "BLE", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
584 { "BGE", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
585 { "BL", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
586 { "BGU", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
587 { "BLEU", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
588 { "BCC", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
589 { "BCS", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
590 { "BPOS", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
591 { "BNEG", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
592 { "BVC", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
593 { "BVS", 2, -1, (1 << 21) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
595 // Branch on floating point condition code.
596 // Annul bit specifies if intruction in delay slot is annulled(1) or not(0).
597 // PredictTaken bit hints if branch should be predicted taken(1) or not(0).
598 // The first argument is the FCCn register (0 <= n <= 3).
599 // Latency includes the delay slot.
600 { "FBA", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
601 { "FBN", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
602 { "FBU", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
603 { "FBG", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
604 { "FBUG", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
605 { "FBL", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
606 { "FBUL", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
607 { "FBLG", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
608 { "FBNE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
609 { "FBE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
610 { "FBUE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
611 { "FBGE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
612 { "FBUGE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
613 { "FBLE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
614 { "FBULE", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
615 { "FBO", 2, -1, (1 << 18) - 1, true, 1, 2, SPARC_CTI, M_CC_FLAG | M_BRANCH_FLAG },
617 // Conditional move on integer comparison with zero.
618 { "MOVRZ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_INT_FLAG },
619 { "MOVRLEZ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_INT_FLAG },
620 { "MOVRLZ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_INT_FLAG },
621 { "MOVRNZ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_INT_FLAG },
622 { "MOVRGZ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_INT_FLAG },
623 { "MOVRGEZ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_INT_FLAG },
625 // Conditional move on integer condition code.
626 // The first argument specifies the ICC register: %icc or %xcc
627 { "MOVA", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
628 { "MOVN", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
629 { "MOVNE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
630 { "MOVE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
631 { "MOVG", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
632 { "MOVLE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
633 { "MOVGE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
634 { "MOVL", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
635 { "MOVGU", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
636 { "MOVLEU", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
637 { "MOVCC", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
638 { "MOVCS", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
639 { "MOVPOS", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
640 { "MOVNEG", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
641 { "MOVVC", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
642 { "MOVVS", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
644 // Conditional move (of integer register) on floating point condition code.
645 // The first argument is the FCCn register (0 <= n <= 3).
646 // Note that the enum name above is not the same as the assembly mnemonic
647 // because some of the assembly mnemonics are the same as the move on
648 // integer CC (e.g., MOVG), and we cannot have the same enum entry twice.
649 { "MOVA", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
650 { "MOVN", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
651 { "MOVU", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
652 { "MOVG", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
653 { "MOVUG", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
654 { "MOVL", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
655 { "MOVUL", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
656 { "MOVLG", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
657 { "MOVNE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
658 { "MOVE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
659 { "MOVUE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
660 { "MOVGE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
661 { "MOVUGE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
662 { "MOVLE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
663 { "MOVULE", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
664 { "MOVO", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_INT_FLAG },
666 // Conditional move of floating point register on each of the above:
667 // i. on integer comparison with zero.
668 // ii. on integer condition code
669 // iii. on floating point condition code
670 // Note that the same set is repeated for S,D,Q register classes.
671 { "FMOVRSZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
672 { "FMOVRSLEZ",3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
673 { "FMOVRSLZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
674 { "FMOVRSNZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
675 { "FMOVRSGZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
676 { "FMOVRSGEZ",3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
678 { "FMOVSA", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
679 { "FMOVSN", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
680 { "FMOVSNE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
681 { "FMOVSE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
682 { "FMOVSG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
683 { "FMOVSLE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
684 { "FMOVSGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
685 { "FMOVSL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
686 { "FMOVSGU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
687 { "FMOVSLEU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
688 { "FMOVSCC", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
689 { "FMOVSCS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
690 { "FMOVSPOS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
691 { "FMOVSNEG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
692 { "FMOVSVC", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
693 { "FMOVSVS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
695 { "FMOVSA", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
696 { "FMOVSN", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
697 { "FMOVSU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
698 { "FMOVSG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
699 { "FMOVSUG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
700 { "FMOVSL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
701 { "FMOVSUL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
702 { "FMOVSLG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
703 { "FMOVSNE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
704 { "FMOVSE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
705 { "FMOVSUE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
706 { "FMOVSGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
707 { "FMOVSUGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
708 { "FMOVSLE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
709 { "FMOVSULE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
710 { "FMOVSO", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
712 { "FMOVRDZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
713 { "FMOVRDLEZ",3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
714 { "FMOVRDLZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
715 { "FMOVRDNZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
716 { "FMOVRDGZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
717 { "FMOVRDGEZ",3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
719 { "FMOVDA", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
720 { "FMOVDN", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
721 { "FMOVDNE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
722 { "FMOVDE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
723 { "FMOVDG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
724 { "FMOVDLE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
725 { "FMOVDGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
726 { "FMOVDL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
727 { "FMOVDGU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
728 { "FMOVDLEU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
729 { "FMOVDCC", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
730 { "FMOVDCS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
731 { "FMOVDPOS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
732 { "FMOVDNEG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
733 { "FMOVDVC", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
734 { "FMOVDVS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
736 { "FMOVDA", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
737 { "FMOVDN", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
738 { "FMOVDU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
739 { "FMOVDG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
740 { "FMOVDUG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
741 { "FMOVDL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
742 { "FMOVDUL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
743 { "FMOVDLG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
744 { "FMOVDNE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
745 { "FMOVDE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
746 { "FMOVDUE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
747 { "FMOVDGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
748 { "FMOVDUGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
749 { "FMOVDLE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
750 { "FMOVDULE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
751 { "FMOVDO", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
753 { "FMOVRQZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
754 { "FMOVRQLEZ",3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
755 { "FMOVRQLZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
756 { "FMOVRQNZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
757 { "FMOVRQGZ", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
758 { "FMOVRQGEZ",3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CONDL_FLAG | M_FLOAT_FLAG | M_INT_FLAG },
760 { "FMOVQA", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
761 { "FMOVQN", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
762 { "FMOVQNE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
763 { "FMOVQE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
764 { "FMOVQG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
765 { "FMOVQLE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
766 { "FMOVQGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
767 { "FMOVQL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
768 { "FMOVQGU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
769 { "FMOVQLEU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
770 { "FMOVQCC", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
771 { "FMOVQCS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
772 { "FMOVQPOS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
773 { "FMOVQNEG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
774 { "FMOVQVC", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
775 { "FMOVQVS", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
777 { "FMOVQA", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
778 { "FMOVQN", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
779 { "FMOVQU", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
780 { "FMOVQG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
781 { "FMOVQUG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
782 { "FMOVQL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
783 { "FMOVQUL", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
784 { "FMOVQLG", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
785 { "FMOVQNE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
786 { "FMOVQE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
787 { "FMOVQUE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
788 { "FMOVQGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
789 { "FMOVQUGE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
790 { "FMOVQLE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
791 { "FMOVQULE", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
792 { "FMOVQO", 3, 2, 0, false, 0, 2, SPARC_SINGLE, M_CC_FLAG | M_FLOAT_FLAG },
794 // Load integer instructions
795 // Latency includes 1 cycle for address generation (Sparc IIi)
796 // Signed loads of less than 64 bits need an extra cycle for sign-extension.
798 // Not reflected here: After a 3-cycle loads, all subsequent consecutive
799 // loads also require 3 cycles to avoid contention for the load return
800 // stage. Latency returns to 2 cycles after the first cycle with no load.
801 { "LDSB", 3, 2, (1 << 12) - 1, true, 0, 3, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
802 { "LDSH", 3, 2, (1 << 12) - 1, true, 0, 3, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
803 { "LDSW", 3, 2, (1 << 12) - 1, true, 0, 3, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
804 { "LDUB", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
805 { "LDUH", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
806 { "LDUW", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
807 { "LDX", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_INT_FLAG | M_LOAD_FLAG },
809 // Load floating-point instructions
810 // Latency includes 1 cycle for address generation (Sparc IIi)
811 { "LD", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_FLOAT_FLAG | M_LOAD_FLAG },
812 { "LDD", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_FLOAT_FLAG | M_LOAD_FLAG },
813 { "LDQ", 3, 2, (1 << 12) - 1, true, 0, 2, SPARC_LD, M_FLOAT_FLAG | M_LOAD_FLAG },
815 // Store integer instructions
816 // Latency includes 1 cycle for address generation (Sparc IIi)
817 { "STB", 3, -1, (1 << 12) - 1, true, 0, 2, SPARC_ST, M_INT_FLAG | M_STORE_FLAG },
818 { "STH", 3, -1, (1 << 12) - 1, true, 0, 2, SPARC_ST, M_INT_FLAG | M_STORE_FLAG },
819 { "STW", 3, -1, (1 << 12) - 1, true, 0, 2, SPARC_ST, M_INT_FLAG | M_STORE_FLAG },
820 { "STX", 3, -1, (1 << 12) - 1, true, 0, 3, SPARC_ST, M_INT_FLAG | M_STORE_FLAG },
822 // Store floating-point instructions (Sparc IIi)
823 { "ST", 3, -1, (1 << 12) - 1, true, 0, 2, SPARC_ST, M_FLOAT_FLAG | M_STORE_FLAG},
824 { "STD", 3, -1, (1 << 12) - 1, true, 0, 2, SPARC_ST, M_FLOAT_FLAG | M_STORE_FLAG},
826 // Call, Return and "Jump and link".
827 // Latency includes the delay slot.
828 { "CALL", 1, -1, (1 << 29) - 1, true, 1, 2, SPARC_CTI, M_BRANCH_FLAG | M_CALL_FLAG},
829 { "JMPL", 3, -1, (1 << 12) - 1, true, 1, 2, SPARC_CTI, M_BRANCH_FLAG | M_CALL_FLAG},
830 { "RETURN", 2, -1, 0, false, 1, 2, SPARC_CTI, M_BRANCH_FLAG | M_RET_FLAG },
832 // Synthetic phi operation for near-SSA form of machine code
833 // Number of operands is variable, indicated by -1. Result is the first op.
834 { "PHI", -1, 0, 0, false, 0, 0, SPARC_INV, M_DUMMY_PHI_FLAG },
839 //---------------------------------------------------------------------------
840 // class UltraSparcInstrInfo
843 // Information about individual instructions.
844 // Most information is stored in the SparcMachineInstrDesc array above.
845 // Other information is computed on demand, and most such functions
846 // default to member functions in base class MachineInstrInfo.
847 //---------------------------------------------------------------------------
849 class UltraSparcInstrInfo : public MachineInstrInfo {
851 /*ctor*/ UltraSparcInstrInfo();
853 virtual bool hasResultInterlock (MachineOpCode opCode)
855 // All UltraSPARC instructions have interlocks (note that delay slots
856 // are not considered here).
857 // However, instructions that use the result of an FCMP produce a
858 // 9-cycle stall if they are issued less than 3 cycles after the FCMP.
859 // Force the compiler to insert a software interlock (i.e., gap of
860 // 2 other groups, including NOPs if necessary).
861 return (opCode == FCMPS || opCode == FCMPD || opCode == FCMPQ);
866 //---------------------------------------------------------------------------
867 // class UltraSparcMachine
870 // Primary interface to machine description for the UltraSPARC.
871 // Primarily just initializes machine-dependent parameters in
872 // class TargetMachine, and creates machine-dependent subclasses
873 // for classes such as MachineInstrInfo.
874 //---------------------------------------------------------------------------
876 class UltraSparc: public TargetMachine {
878 /*ctor*/ UltraSparc ();
879 /*dtor*/ virtual ~UltraSparc ();
883 /*---------------------------------------------------------------------------
884 Scheduling guidelines for SPARC IIi:
886 I-Cache alignment rules (pg 326)
887 -- Align a branch target instruction so that it's entire group is within
888 the same cache line (may be 1-4 instructions).
889 ** Don't let a branch that is predicted taken be the last instruction
890 on an I-cache line: delay slot will need an entire line to be fetched
891 -- Make a FP instruction or a branch be the 4th instruction in a group.
892 For branches, there are tradeoffs in reordering to make this happen
894 ** Don't put a branch in a group that crosses a 32-byte boundary!
895 An artificial branch is inserted after every 32 bytes, and having
896 another branch will force the group to be broken into 2 groups.
899 -- Don't let a loop span two memory pages, if possible
901 Branch prediction performance:
902 -- Don't make the branch in a delay slot the target of a branch
903 -- Try not to have 2 predicted branches within a group of 4 instructions
904 (because each such group has a single branch target field).
905 -- Try to align branches in slots 0, 2, 4 or 6 of a cache line (to avoid
906 the wrong prediction bits being used in some cases).
908 D-Cache timing constraints:
909 -- Signed int loads of less than 64 bits have 3 cycle latency, not 2
910 -- All other loads that hit in D-Cache have 2 cycle latency
911 -- All loads are returned IN ORDER, so a D-Cache miss will delay a later hit
912 -- Mis-aligned loads or stores cause a trap. In particular, replace
913 mis-aligned FP double precision l/s with 2 single-precision l/s.
914 -- Simulations of integer codes show increase in avg. group size of
915 33% when code (including esp. non-faulting loads) is moved across
916 one branch, and 50% across 2 branches.
918 E-Cache timing constraints:
919 -- Scheduling for E-cache (D-Cache misses) is effective (due to load buffering)
921 Store buffer timing constraints:
922 -- Stores can be executed in same cycle as instruction producing the value
923 -- Stores are buffered and have lower priority for E-cache until
924 highwater mark is reached in the store buffer (5 stores)
926 Pipeline constraints:
927 -- Shifts can only use IEU0.
928 -- CC setting instructions can only use IEU1.
929 -- Several other instructions must only use IEU1:
930 EDGE(?), ARRAY(?), CALL, JMPL, BPr, PST, and FCMP.
931 -- Two instructions cannot store to the same register file in a single cycle
932 (single write port per file).
934 Issue and grouping constraints:
935 -- FP and branch instructions must use slot 4.
936 -- Shift instructions cannot be grouped with other IEU0-specific instructions.
937 -- CC setting instructions cannot be grouped with other IEU1-specific instrs.
938 -- Several instructions must be issued in a single-instruction group:
939 MOVcc or MOVr, MULs/x and DIVs/x, SAVE/RESTORE, many others
940 -- A CALL or JMPL breaks a group, ie, is not combined with subsequent instrs.
944 Branch delay slot scheduling rules:
945 -- A CTI couple (two back-to-back CTI instructions in the dynamic stream)
946 has a 9-instruction penalty: the entire pipeline is flushed when the
947 second instruction reaches stage 9 (W-Writeback).
948 -- Avoid putting multicycle instructions, and instructions that may cause
949 load misses, in the delay slot of an annulling branch.
950 -- Avoid putting WR, SAVE..., RESTORE and RETURN instructions in the
951 delay slot of an annulling branch.
953 *--------------------------------------------------------------------------- */
955 //---------------------------------------------------------------------------
956 // List of CPUResources for UltraSPARC IIi.
957 //---------------------------------------------------------------------------
959 const CPUResource AllIssueSlots( "All Instr Slots", 4);
960 const CPUResource IntIssueSlots( "Int Instr Slots", 3);
961 const CPUResource First3IssueSlots("Instr Slots 0-3", 3);
962 const CPUResource LSIssueSlots( "Load-Store Instr Slot", 1);
963 const CPUResource CTIIssueSlots( "Ctrl Transfer Instr Slot", 1);
964 const CPUResource FPAIssueSlots( "Int Instr Slot 1", 1);
965 const CPUResource FPMIssueSlots( "Int Instr Slot 1", 1);
967 // IEUN instructions can use either Alu and should use IAluN.
968 // IEU0 instructions must use Alu 1 and should use both IAluN and IAlu0.
969 // IEU1 instructions must use Alu 2 and should use both IAluN and IAlu1.
970 const CPUResource IAluN("Int ALU 1or2", 2);
971 const CPUResource IAlu0("Int ALU 1", 1);
972 const CPUResource IAlu1("Int ALU 2", 1);
974 const CPUResource LSAluC1("Load/Store Unit Addr Cycle", 1);
975 const CPUResource LSAluC2("Load/Store Unit Issue Cycle", 1);
976 const CPUResource LdReturn("Load Return Unit", 1);
978 const CPUResource FPMAluC1("FP Mul/Div Alu Cycle 1", 1);
979 const CPUResource FPMAluC2("FP Mul/Div Alu Cycle 2", 1);
980 const CPUResource FPMAluC3("FP Mul/Div Alu Cycle 3", 1);
982 const CPUResource FPAAluC1("FP Other Alu Cycle 1", 1);
983 const CPUResource FPAAluC2("FP Other Alu Cycle 2", 1);
984 const CPUResource FPAAluC3("FP Other Alu Cycle 3", 1);
986 const CPUResource IRegReadPorts("Int Reg ReadPorts", INT_MAX); // CHECK
987 const CPUResource IRegWritePorts("Int Reg WritePorts", 2); // CHECK
988 const CPUResource FPRegReadPorts("FP Reg Read Ports", INT_MAX); // CHECK
989 const CPUResource FPRegWritePorts("FP Reg Write Ports", 1); // CHECK
991 const CPUResource CTIDelayCycle( "CTI delay cycle", 1);
992 const CPUResource FCMPDelayCycle("FCMP delay cycle", 1);
995 //---------------------------------------------------------------------------
996 // const InstrClassRUsage SparcRUsageDesc[]
999 // Resource usage information for instruction in each scheduling class.
1000 // The InstrRUsage Objects for individual classes are specified first.
1001 // Note that fetch and decode are decoupled from the execution pipelines
1002 // via an instr buffer, so they are not included in the cycles below.
1003 //---------------------------------------------------------------------------
1005 const InstrClassRUsage NoneClassRUsage = {
1009 /* maxIssueNum */ 4,
1010 /* isSingleIssue */ false,
1011 /* breaksGroup */ false,
1015 /* feasibleSlots[] */ { 0, 1, 2, 3 },
1029 const InstrClassRUsage IEUNClassRUsage = {
1033 /* maxIssueNum */ 3,
1034 /* isSingleIssue */ false,
1035 /* breaksGroup */ false,
1039 /* feasibleSlots[] */ { 0, 1, 2 },
1043 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1044 { IntIssueSlots.rid, 0, 1 },
1045 /*Cycle E */ { IAluN.rid, 1, 1 },
1050 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
1054 const InstrClassRUsage IEU0ClassRUsage = {
1058 /* maxIssueNum */ 1,
1059 /* isSingleIssue */ false,
1060 /* breaksGroup */ false,
1064 /* feasibleSlots[] */ { 0, 1, 2 },
1068 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1069 { IntIssueSlots.rid, 0, 1 },
1070 /*Cycle E */ { IAluN.rid, 1, 1 },
1071 { IAlu0.rid, 1, 1 },
1076 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
1080 const InstrClassRUsage IEU1ClassRUsage = {
1084 /* maxIssueNum */ 1,
1085 /* isSingleIssue */ false,
1086 /* breaksGroup */ false,
1090 /* feasibleSlots[] */ { 0, 1, 2 },
1094 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1095 { IntIssueSlots.rid, 0, 1 },
1096 /*Cycle E */ { IAluN.rid, 1, 1 },
1097 { IAlu1.rid, 1, 1 },
1102 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
1106 const InstrClassRUsage FPMClassRUsage = {
1110 /* maxIssueNum */ 1,
1111 /* isSingleIssue */ false,
1112 /* breaksGroup */ false,
1116 /* feasibleSlots[] */ { 0, 1, 2, 3 },
1120 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1121 { FPMIssueSlots.rid, 0, 1 },
1122 /*Cycle E */ { FPRegReadPorts.rid, 1, 1 },
1123 /*Cycle C */ { FPMAluC1.rid, 2, 1 },
1124 /*Cycle N1*/ { FPMAluC2.rid, 3, 1 },
1125 /*Cycle N1*/ { FPMAluC3.rid, 4, 1 },
1127 /*Cycle W */ { FPRegWritePorts.rid, 6, 1 }
1131 const InstrClassRUsage FPAClassRUsage = {
1135 /* maxIssueNum */ 1,
1136 /* isSingleIssue */ false,
1137 /* breaksGroup */ false,
1141 /* feasibleSlots[] */ { 0, 1, 2, 3 },
1145 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1146 { FPAIssueSlots.rid, 0, 1 },
1147 /*Cycle E */ { FPRegReadPorts.rid, 1, 1 },
1148 /*Cycle C */ { FPAAluC1.rid, 2, 1 },
1149 /*Cycle N1*/ { FPAAluC2.rid, 3, 1 },
1150 /*Cycle N1*/ { FPAAluC3.rid, 4, 1 },
1152 /*Cycle W */ { FPRegWritePorts.rid, 6, 1 }
1156 const InstrClassRUsage LDClassRUsage = {
1160 /* maxIssueNum */ 1,
1161 /* isSingleIssue */ false,
1162 /* breaksGroup */ false,
1166 /* feasibleSlots[] */ { 0, 1, 2, },
1170 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1171 { First3IssueSlots.rid, 0, 1 },
1172 { LSIssueSlots.rid, 0, 1 },
1173 /*Cycle E */ { LSAluC1.rid, 1, 1 },
1174 /*Cycle C */ { LSAluC2.rid, 2, 1 },
1175 { LdReturn.rid, 2, 1 },
1179 /*Cycle W */ { IRegWritePorts.rid, 6, 1 }
1183 const InstrClassRUsage STClassRUsage = {
1187 /* maxIssueNum */ 1,
1188 /* isSingleIssue */ false,
1189 /* breaksGroup */ false,
1193 /* feasibleSlots[] */ { 0, 1, 2 },
1197 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1198 { First3IssueSlots.rid, 0, 1 },
1199 { LSIssueSlots.rid, 0, 1 },
1200 /*Cycle E */ { LSAluC1.rid, 1, 1 },
1201 /*Cycle C */ { LSAluC2.rid, 2, 1 }
1209 const InstrClassRUsage CTIClassRUsage = {
1213 /* maxIssueNum */ 1,
1214 /* isSingleIssue */ false,
1215 /* breaksGroup */ false,
1219 /* feasibleSlots[] */ { 0, 1, 2, 3 },
1223 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1224 { CTIIssueSlots.rid, 0, 1 },
1225 /*Cycle E */ { IAlu0.rid, 1, 1 },
1226 /*Cycles E-C */ { CTIDelayCycle.rid, 1, 2 }
1235 const InstrClassRUsage SingleClassRUsage = {
1239 /* maxIssueNum */ 1,
1240 /* isSingleIssue */ true,
1241 /* breaksGroup */ false,
1245 /* feasibleSlots[] */ { 0 },
1249 /*Cycle G */ { AllIssueSlots.rid, 0, 1 },
1250 { AllIssueSlots.rid, 0, 1 },
1251 { AllIssueSlots.rid, 0, 1 },
1252 { AllIssueSlots.rid, 0, 1 },
1253 /*Cycle E */ { IAlu0.rid, 1, 1 }
1263 const InstrClassRUsage SparcRUsageDesc[] = {
1277 //---------------------------------------------------------------------------
1278 // const InstrIssueDelta SparcInstrIssueDeltas[]
1281 // Changes to issue restrictions information in InstrClassRUsage for
1282 // instructions that differ from other instructions in their class.
1283 //---------------------------------------------------------------------------
1285 const InstrIssueDelta SparcInstrIssueDeltas[] = {
1287 // opCode, isSingleIssue, breaksGroup, numBubbles
1289 // Special cases for single-issue only
1290 // Other single issue cases are below.
1291 //{ LDDA, true, true, 0 },
1292 //{ STDA, true, true, 0 },
1293 //{ LDDF, true, true, 0 },
1294 //{ LDDFA, true, true, 0 },
1295 { ADDC, true, true, 0 },
1296 { ADDCcc, true, true, 0 },
1297 { SUBC, true, true, 0 },
1298 { SUBCcc, true, true, 0 },
1299 //{ SAVE, true, true, 0 },
1300 //{ RESTORE, true, true, 0 },
1301 //{ LDSTUB, true, true, 0 },
1302 //{ SWAP, true, true, 0 },
1303 //{ SWAPA, true, true, 0 },
1304 //{ CAS, true, true, 0 },
1305 //{ CASA, true, true, 0 },
1306 //{ CASX, true, true, 0 },
1307 //{ CASXA, true, true, 0 },
1308 //{ LDFSR, true, true, 0 },
1309 //{ LDFSRA, true, true, 0 },
1310 //{ LDXFSR, true, true, 0 },
1311 //{ LDXFSRA, true, true, 0 },
1312 //{ STFSR, true, true, 0 },
1313 //{ STFSRA, true, true, 0 },
1314 //{ STXFSR, true, true, 0 },
1315 //{ STXFSRA, true, true, 0 },
1316 //{ SAVED, true, true, 0 },
1317 //{ RESTORED, true, true, 0 },
1318 //{ FLUSH, true, true, 9 },
1319 //{ FLUSHW, true, true, 9 },
1320 //{ ALIGNADDR, true, true, 0 },
1321 { RETURN, true, true, 0 },
1322 //{ DONE, true, true, 0 },
1323 //{ RETRY, true, true, 0 },
1324 //{ WR, true, true, 0 },
1325 //{ WRPR, true, true, 4 },
1326 //{ RD, true, true, 0 },
1327 //{ RDPR, true, true, 0 },
1328 //{ TCC, true, true, 0 },
1329 //{ SHUTDOWN, true, true, 0 },
1331 // Special cases for breaking group *before*
1332 // CURRENTLY NOT SUPPORTED!
1333 { CALL, false, false, 0 },
1334 { JMPL, false, false, 0 },
1336 // Special cases for breaking the group *after*
1337 { MULX, true, true, (4+34)/2 },
1338 { FDIVS, false, true, 0 },
1339 { FDIVD, false, true, 0 },
1340 { FDIVQ, false, true, 0 },
1341 { FSQRTS, false, true, 0 },
1342 { FSQRTD, false, true, 0 },
1343 { FSQRTQ, false, true, 0 },
1344 //{ FCMP{LE,GT,NE,EQ}, false, true, 0 },
1346 // Instructions that introduce bubbles
1347 //{ MULScc, true, true, 2 },
1348 //{ SMULcc, true, true, (4+18)/2 },
1349 //{ UMULcc, true, true, (4+19)/2 },
1350 { SDIVX, true, true, 68 },
1351 { UDIVX, true, true, 68 },
1352 //{ SDIVcc, true, true, 36 },
1353 //{ UDIVcc, true, true, 37 },
1354 //{ WR, false, false, 4 },
1355 //{ WRPR, false, false, 4 },
1359 //---------------------------------------------------------------------------
1360 // const InstrRUsageDelta SparcInstrUsageDeltas[]
1363 // Changes to resource usage information in InstrClassRUsage for
1364 // instructions that differ from other instructions in their class.
1365 //---------------------------------------------------------------------------
1367 const InstrRUsageDelta SparcInstrUsageDeltas[] = {
1369 // MachineOpCode, Resource, Start cycle, Num cycles
1372 // JMPL counts as a load/store instruction for issue!
1374 { JMPL, LSIssueSlots.rid, 0, 1 },
1377 // Many instructions cannot issue for the next 2 cycles after an FCMP
1378 // We model that with a fake resource FCMPDelayCycle.
1380 { FCMPS, FCMPDelayCycle.rid, 1, 3 },
1381 { FCMPD, FCMPDelayCycle.rid, 1, 3 },
1382 { FCMPQ, FCMPDelayCycle.rid, 1, 3 },
1384 { MULX, FCMPDelayCycle.rid, 1, 1 },
1385 { SDIVX, FCMPDelayCycle.rid, 1, 1 },
1386 { UDIVX, FCMPDelayCycle.rid, 1, 1 },
1387 //{ SMULcc, FCMPDelayCycle.rid, 1, 1 },
1388 //{ UMULcc, FCMPDelayCycle.rid, 1, 1 },
1389 //{ SDIVcc, FCMPDelayCycle.rid, 1, 1 },
1390 //{ UDIVcc, FCMPDelayCycle.rid, 1, 1 },
1391 { STD, FCMPDelayCycle.rid, 1, 1 },
1392 { FMOVRSZ, FCMPDelayCycle.rid, 1, 1 },
1393 { FMOVRSLEZ,FCMPDelayCycle.rid, 1, 1 },
1394 { FMOVRSLZ, FCMPDelayCycle.rid, 1, 1 },
1395 { FMOVRSNZ, FCMPDelayCycle.rid, 1, 1 },
1396 { FMOVRSGZ, FCMPDelayCycle.rid, 1, 1 },
1397 { FMOVRSGEZ,FCMPDelayCycle.rid, 1, 1 },
1400 // Some instructions are stalled in the GROUP stage if a CTI is in
1403 { LDD, CTIDelayCycle.rid, 1, 1 },
1404 //{ LDDA, CTIDelayCycle.rid, 1, 1 },
1405 //{ LDDSTUB, CTIDelayCycle.rid, 1, 1 },
1406 //{ LDDSTUBA, CTIDelayCycle.rid, 1, 1 },
1407 //{ SWAP, CTIDelayCycle.rid, 1, 1 },
1408 //{ SWAPA, CTIDelayCycle.rid, 1, 1 },
1409 //{ CAS, CTIDelayCycle.rid, 1, 1 },
1410 //{ CASA, CTIDelayCycle.rid, 1, 1 },
1411 //{ CASX, CTIDelayCycle.rid, 1, 1 },
1412 //{ CASXA, CTIDelayCycle.rid, 1, 1 },
1415 // Signed int loads of less than dword size return data in cycle N1 (not C)
1416 // and put all loads in consecutive cycles into delayed load return mode.
1418 { LDSB, LdReturn.rid, 2, -1 },
1419 { LDSB, LdReturn.rid, 3, 1 },
1421 { LDSH, LdReturn.rid, 2, -1 },
1422 { LDSH, LdReturn.rid, 3, 1 },
1424 { LDSW, LdReturn.rid, 2, -1 },
1425 { LDSW, LdReturn.rid, 3, 1 },
1428 #undef EXPLICIT_BUBBLES_NEEDED
1429 #ifdef EXPLICIT_BUBBLES_NEEDED
1431 // MULScc inserts one bubble.
1432 // This means it breaks the current group (captured in UltraSparcSchedInfo)
1433 // *and occupies all issue slots for the next cycle
1435 //{ MULScc, AllIssueSlots.rid, 2, 2-1 },
1436 //{ MULScc, AllIssueSlots.rid, 2, 2-1 },
1437 //{ MULScc, AllIssueSlots.rid, 2, 2-1 },
1438 //{ MULScc, AllIssueSlots.rid, 2, 2-1 },
1441 // SMULcc inserts between 4 and 18 bubbles, depending on #leading 0s in rs1.
1442 // We just model this with a simple average.
1444 //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
1445 //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
1446 //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
1447 //{ SMULcc, AllIssueSlots.rid, 2, ((4+18)/2)-1 },
1449 // SMULcc inserts between 4 and 19 bubbles, depending on #leading 0s in rs1.
1450 //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
1451 //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
1452 //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
1453 //{ UMULcc, AllIssueSlots.rid, 2, ((4+19)/2)-1 },
1456 // MULX inserts between 4 and 34 bubbles, depending on #leading 0s in rs1.
1458 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
1459 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
1460 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
1461 { MULX, AllIssueSlots.rid, 2, ((4+34)/2)-1 },
1464 // SDIVcc inserts 36 bubbles.
1466 //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
1467 //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
1468 //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
1469 //{ SDIVcc, AllIssueSlots.rid, 2, 36-1 },
1471 // UDIVcc inserts 37 bubbles.
1472 //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
1473 //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
1474 //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
1475 //{ UDIVcc, AllIssueSlots.rid, 2, 37-1 },
1478 // SDIVX inserts 68 bubbles.
1480 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
1481 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
1482 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
1483 { SDIVX, AllIssueSlots.rid, 2, 68-1 },
1486 // UDIVX inserts 68 bubbles.
1488 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
1489 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
1490 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
1491 { UDIVX, AllIssueSlots.rid, 2, 68-1 },
1494 // WR inserts 4 bubbles.
1496 //{ WR, AllIssueSlots.rid, 2, 68-1 },
1497 //{ WR, AllIssueSlots.rid, 2, 68-1 },
1498 //{ WR, AllIssueSlots.rid, 2, 68-1 },
1499 //{ WR, AllIssueSlots.rid, 2, 68-1 },
1502 // WRPR inserts 4 bubbles.
1504 //{ WRPR, AllIssueSlots.rid, 2, 68-1 },
1505 //{ WRPR, AllIssueSlots.rid, 2, 68-1 },
1506 //{ WRPR, AllIssueSlots.rid, 2, 68-1 },
1507 //{ WRPR, AllIssueSlots.rid, 2, 68-1 },
1510 // DONE inserts 9 bubbles.
1512 //{ DONE, AllIssueSlots.rid, 2, 9-1 },
1513 //{ DONE, AllIssueSlots.rid, 2, 9-1 },
1514 //{ DONE, AllIssueSlots.rid, 2, 9-1 },
1515 //{ DONE, AllIssueSlots.rid, 2, 9-1 },
1518 // RETRY inserts 9 bubbles.
1520 //{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1521 //{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1522 //{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1523 //{ RETRY, AllIssueSlots.rid, 2, 9-1 },
1525 #endif EXPLICIT_BUBBLES_NEEDED
1530 // Additional delays to be captured in code:
1531 // 1. RDPR from several state registers (page 349)
1532 // 2. RD from *any* register (page 349)
1533 // 3. Writes to TICK, PSTATE, TL registers and FLUSH{W} instr (page 349)
1534 // 4. Integer store can be in same group as instr producing value to store.
1535 // 5. BICC and BPICC can be in the same group as instr producing CC (pg 350)
1536 // 6. FMOVr cannot be in the same or next group as an IEU instr (pg 351).
1537 // 7. The second instr. of a CTI group inserts 9 bubbles (pg 351)
1538 // 8. WR{PR}, SVAE, SAVED, RESTORE, RESTORED, RETURN, RETRY, and DONE that
1539 // follow an annulling branch cannot be issued in the same group or in
1540 // the 3 groups following the branch.
1541 // 9. A predicted annulled load does not stall dependent instructions.
1542 // Other annulled delay slot instructions *do* stall dependents, so
1543 // nothing special needs to be done for them during scheduling.
1544 //10. Do not put a load use that may be annulled in the same group as the
1545 // branch. The group will stall until the load returns.
1546 //11. Single-prec. FP loads lock 2 registers, for dependency checking.
1549 // Additional delays we cannot or will not capture:
1550 // 1. If DCTI is last word of cache line, it is delayed until next line can be
1551 // fetched. Also, other DCTI alignment-related delays (pg 352)
1552 // 2. Load-after-store is delayed by 7 extra cycles if load hits in D-Cache.
1553 // Also, several other store-load and load-store conflicts (pg 358)
1554 // 3. MEMBAR, LD{X}FSR, LDD{A} and a bunch of other load stalls (pg 358)
1555 // 4. There can be at most 8 outstanding buffered store instructions
1556 // (including some others like MEMBAR, LDSTUB, CAS{AX}, and FLUSH)
1560 //---------------------------------------------------------------------------
1561 // class UltraSparcSchedInfo
1564 // Interface to instruction scheduling information for UltraSPARC.
1565 // The parameter values above are based on UltraSPARC IIi.
1566 //---------------------------------------------------------------------------
1569 class UltraSparcSchedInfo: public MachineSchedInfo {
1571 /*ctor*/ UltraSparcSchedInfo (const MachineInstrInfo* mii);
1572 /*dtor*/ virtual ~UltraSparcSchedInfo () {}
1574 virtual void initializeResources ();
1578 /***************************************************************************/