Mercurial > hg > CbC > CbC_llvm
comparison lib/Target/Mips/MipsInstrInfo.td @ 100:7d135dc70f03 LLVM 3.9
LLVM 3.9
author | Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 22:53:40 +0900 |
parents | afa8332a0e37 |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
96:6418606d0ead | 100:7d135dc70f03 |
---|---|
74 def MipsThreadPointer: SDNode<"MipsISD::ThreadPointer", SDT_MipsThreadPointer>; | 74 def MipsThreadPointer: SDNode<"MipsISD::ThreadPointer", SDT_MipsThreadPointer>; |
75 | 75 |
76 // Return | 76 // Return |
77 def MipsRet : SDNode<"MipsISD::Ret", SDTNone, | 77 def MipsRet : SDNode<"MipsISD::Ret", SDTNone, |
78 [SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; | 78 [SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; |
79 | |
80 def MipsERet : SDNode<"MipsISD::ERet", SDTNone, | |
81 [SDNPHasChain, SDNPOptInGlue, SDNPSideEffect]>; | |
79 | 82 |
80 // These are target-independent nodes, but have target-specific formats. | 83 // These are target-independent nodes, but have target-specific formats. |
81 def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart, | 84 def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart, |
82 [SDNPHasChain, SDNPSideEffect, SDNPOutGlue]>; | 85 [SDNPHasChain, SDNPSideEffect, SDNPOutGlue]>; |
83 def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_MipsCallSeqEnd, | 86 def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_MipsCallSeqEnd, |
176 AssemblerPredicate<"FeatureGP64Bit">; | 179 AssemblerPredicate<"FeatureGP64Bit">; |
177 def IsGP32bit : Predicate<"!Subtarget->isGP64bit()">, | 180 def IsGP32bit : Predicate<"!Subtarget->isGP64bit()">, |
178 AssemblerPredicate<"!FeatureGP64Bit">; | 181 AssemblerPredicate<"!FeatureGP64Bit">; |
179 def HasMips64 : Predicate<"Subtarget->hasMips64()">, | 182 def HasMips64 : Predicate<"Subtarget->hasMips64()">, |
180 AssemblerPredicate<"FeatureMips64">; | 183 AssemblerPredicate<"FeatureMips64">; |
184 def NotMips64 : Predicate<"!Subtarget->hasMips64()">, | |
185 AssemblerPredicate<"!FeatureMips64">; | |
181 def HasMips64r2 : Predicate<"Subtarget->hasMips64r2()">, | 186 def HasMips64r2 : Predicate<"Subtarget->hasMips64r2()">, |
182 AssemblerPredicate<"FeatureMips64r2">; | 187 AssemblerPredicate<"FeatureMips64r2">; |
183 def HasMips64r6 : Predicate<"Subtarget->hasMips64r6()">, | 188 def HasMips64r6 : Predicate<"Subtarget->hasMips64r6()">, |
184 AssemblerPredicate<"FeatureMips64r6">; | 189 AssemblerPredicate<"FeatureMips64r6">; |
185 def NotMips64r6 : Predicate<"!Subtarget->hasMips64r6()">, | 190 def NotMips64r6 : Predicate<"!Subtarget->hasMips64r6()">, |
304 // MIPS32r6 and MIPS64r6. | 309 // MIPS32r6 and MIPS64r6. |
305 class INSN_MIPS5_32R2_NOT_32R6_64R6 { | 310 class INSN_MIPS5_32R2_NOT_32R6_64R6 { |
306 list<Predicate> InsnPredicates = [HasMips5_32r2, NotMips32r6, NotMips64r6]; | 311 list<Predicate> InsnPredicates = [HasMips5_32r2, NotMips32r6, NotMips64r6]; |
307 } | 312 } |
308 | 313 |
314 class ASE_CNMIPS { | |
315 list<Predicate> InsnPredicates = [HasCnMips]; | |
316 } | |
317 | |
309 class ASE_MSA { | 318 class ASE_MSA { |
310 list<Predicate> InsnPredicates = [HasMSA]; | 319 list<Predicate> InsnPredicates = [HasMSA]; |
320 } | |
321 | |
322 class ASE_MSA_NOT_MSA64 { | |
323 list<Predicate> InsnPredicates = [HasMSA, NotMips64]; | |
311 } | 324 } |
312 | 325 |
313 class ASE_MSA64 { | 326 class ASE_MSA64 { |
314 list<Predicate> InsnPredicates = [HasMSA, HasMips64]; | 327 list<Predicate> InsnPredicates = [HasMSA, HasMips64]; |
315 } | 328 } |
370 | 383 |
371 //===----------------------------------------------------------------------===// | 384 //===----------------------------------------------------------------------===// |
372 // Mips Operand, Complex Patterns and Transformations Definitions. | 385 // Mips Operand, Complex Patterns and Transformations Definitions. |
373 //===----------------------------------------------------------------------===// | 386 //===----------------------------------------------------------------------===// |
374 | 387 |
388 class ConstantSImmAsmOperandClass<int Bits, list<AsmOperandClass> Supers = []> | |
389 : AsmOperandClass { | |
390 let Name = "ConstantSImm" # Bits; | |
391 let RenderMethod = "addImmOperands"; | |
392 let PredicateMethod = "isConstantSImm<" # Bits # ">"; | |
393 let SuperClasses = Supers; | |
394 let DiagnosticType = "SImm" # Bits; | |
395 } | |
396 | |
397 class ConstantUImmAsmOperandClass<int Bits, list<AsmOperandClass> Supers = [], | |
398 int Offset = 0> : AsmOperandClass { | |
399 let Name = "ConstantUImm" # Bits # "_" # Offset; | |
400 let RenderMethod = "addConstantUImmOperands<" # Bits # ", " # Offset # ">"; | |
401 let PredicateMethod = "isConstantUImm<" # Bits # ", " # Offset # ">"; | |
402 let SuperClasses = Supers; | |
403 let DiagnosticType = "UImm" # Bits # "_" # Offset; | |
404 } | |
405 | |
406 def ConstantUImm10AsmOperandClass | |
407 : ConstantUImmAsmOperandClass<10, []>; | |
408 def ConstantUImm8AsmOperandClass | |
409 : ConstantUImmAsmOperandClass<8, [ConstantUImm10AsmOperandClass]>; | |
410 def ConstantUImm7AsmOperandClass | |
411 : ConstantUImmAsmOperandClass<7, [ConstantUImm8AsmOperandClass]>; | |
412 def ConstantUImm6AsmOperandClass | |
413 : ConstantUImmAsmOperandClass<6, [ConstantUImm7AsmOperandClass]>; | |
414 def ConstantSImm6AsmOperandClass | |
415 : ConstantSImmAsmOperandClass<6, [ConstantUImm7AsmOperandClass]>; | |
416 def ConstantUImm5Plus1AsmOperandClass | |
417 : ConstantUImmAsmOperandClass<5, [ConstantUImm6AsmOperandClass], 1>; | |
418 def ConstantUImm5Plus32AsmOperandClass | |
419 : ConstantUImmAsmOperandClass<5, [ConstantUImm6AsmOperandClass], 32>; | |
420 def ConstantUImm5Plus33AsmOperandClass | |
421 : ConstantUImmAsmOperandClass<5, [ConstantUImm6AsmOperandClass], 33>; | |
422 def ConstantUImm5Plus32NormalizeAsmOperandClass | |
423 : ConstantUImmAsmOperandClass<5, [ConstantUImm6AsmOperandClass], 32> { | |
424 let Name = "ConstantUImm5_32_Norm"; | |
425 // We must also subtract 32 when we render the operand. | |
426 let RenderMethod = "addConstantUImmOperands<5, 32, -32>"; | |
427 } | |
428 def ConstantUImm5Lsl2AsmOperandClass : AsmOperandClass { | |
429 let Name = "UImm5Lsl2"; | |
430 let RenderMethod = "addImmOperands"; | |
431 let PredicateMethod = "isScaledUImm<5, 2>"; | |
432 let SuperClasses = [ConstantUImm6AsmOperandClass]; | |
433 let DiagnosticType = "UImm5_Lsl2"; | |
434 } | |
435 def ConstantUImm5ReportUImm6AsmOperandClass | |
436 : ConstantUImmAsmOperandClass<5, [ConstantUImm6AsmOperandClass]> { | |
437 let Name = "ConstantUImm5_0_Report_UImm6"; | |
438 let DiagnosticType = "UImm5_0_Report_UImm6"; | |
439 } | |
440 def ConstantUImm5AsmOperandClass | |
441 : ConstantUImmAsmOperandClass<5, [ConstantUImm6AsmOperandClass]>; | |
442 def ConstantUImm4AsmOperandClass | |
443 : ConstantUImmAsmOperandClass< | |
444 4, [ConstantUImm5AsmOperandClass, | |
445 ConstantUImm5Plus32AsmOperandClass, | |
446 ConstantUImm5Plus32NormalizeAsmOperandClass]>; | |
447 def ConstantUImm3AsmOperandClass | |
448 : ConstantUImmAsmOperandClass<3, [ConstantUImm4AsmOperandClass]>; | |
449 def ConstantUImm2Plus1AsmOperandClass | |
450 : ConstantUImmAsmOperandClass<2, [ConstantUImm3AsmOperandClass], 1>; | |
451 def ConstantUImm2AsmOperandClass | |
452 : ConstantUImmAsmOperandClass<2, [ConstantUImm3AsmOperandClass]>; | |
453 def ConstantUImm1AsmOperandClass | |
454 : ConstantUImmAsmOperandClass<1, [ConstantUImm2AsmOperandClass]>; | |
455 def ConstantImmzAsmOperandClass : AsmOperandClass { | |
456 let Name = "ConstantImmz"; | |
457 let RenderMethod = "addConstantUImmOperands<1>"; | |
458 let PredicateMethod = "isConstantImmz"; | |
459 let SuperClasses = [ConstantUImm1AsmOperandClass]; | |
460 let DiagnosticType = "Immz"; | |
461 } | |
462 | |
375 def MipsJumpTargetAsmOperand : AsmOperandClass { | 463 def MipsJumpTargetAsmOperand : AsmOperandClass { |
376 let Name = "JumpTarget"; | 464 let Name = "JumpTarget"; |
377 let ParserMethod = "parseJumpTarget"; | 465 let ParserMethod = "parseJumpTarget"; |
378 let PredicateMethod = "isImm"; | 466 let PredicateMethod = "isImm"; |
379 let RenderMethod = "addImmOperands"; | 467 let RenderMethod = "addImmOperands"; |
395 let ParserMatchClass = MipsJumpTargetAsmOperand; | 483 let ParserMatchClass = MipsJumpTargetAsmOperand; |
396 } | 484 } |
397 | 485 |
398 def imm64: Operand<i64>; | 486 def imm64: Operand<i64>; |
399 | 487 |
488 def simm6 : Operand<i32> { | |
489 let ParserMatchClass = ConstantSImm6AsmOperandClass; | |
490 let OperandType = "OPERAND_IMMEDIATE"; | |
491 } | |
400 def simm9 : Operand<i32>; | 492 def simm9 : Operand<i32>; |
401 def simm10 : Operand<i32>; | 493 def simm10 : Operand<i32>; |
402 def simm11 : Operand<i32>; | 494 def simm11 : Operand<i32>; |
403 | 495 |
404 def simm16 : Operand<i32> { | 496 def simm16 : Operand<i32> { |
415 let EncoderMethod = "getSimm18Lsl3Encoding"; | 507 let EncoderMethod = "getSimm18Lsl3Encoding"; |
416 let DecoderMethod = "DecodeSimm18Lsl3"; | 508 let DecoderMethod = "DecodeSimm18Lsl3"; |
417 let ParserMatchClass = MipsJumpTargetAsmOperand; | 509 let ParserMatchClass = MipsJumpTargetAsmOperand; |
418 } | 510 } |
419 | 511 |
420 def simm20 : Operand<i32> { | 512 def simm20 : Operand<i32>; |
421 } | 513 def simm32 : Operand<i32>; |
422 | 514 |
423 def uimm20 : Operand<i32> { | 515 def uimm20 : Operand<i32> { |
424 } | |
425 | |
426 def MipsUImm10AsmOperand : AsmOperandClass { | |
427 let Name = "UImm10"; | |
428 let RenderMethod = "addImmOperands"; | |
429 let ParserMethod = "parseImm"; | |
430 let PredicateMethod = "isUImm<10>"; | |
431 } | |
432 | |
433 def uimm10 : Operand<i32> { | |
434 let ParserMatchClass = MipsUImm10AsmOperand; | |
435 } | 516 } |
436 | 517 |
437 def simm16_64 : Operand<i64> { | 518 def simm16_64 : Operand<i64> { |
438 let DecoderMethod = "DecodeSimm16"; | 519 let DecoderMethod = "DecodeSimm16"; |
439 } | 520 } |
440 | 521 |
441 // Zero | 522 // Zero |
442 def uimmz : Operand<i32> { | 523 def uimmz : Operand<i32> { |
443 let PrintMethod = "printUnsignedImm"; | 524 let PrintMethod = "printUnsignedImm"; |
444 } | 525 let ParserMatchClass = ConstantImmzAsmOperandClass; |
445 | 526 } |
446 // Unsigned Operand | 527 |
447 def uimm2 : Operand<i32> { | 528 // Unsigned Operands |
529 foreach I = {1, 2, 3, 4, 5, 6, 7, 8, 10} in | |
530 def uimm # I : Operand<i32> { | |
531 let PrintMethod = "printUnsignedImm"; | |
532 let ParserMatchClass = | |
533 !cast<AsmOperandClass>("ConstantUImm" # I # "AsmOperandClass"); | |
534 } | |
535 | |
536 def uimm2_plus1 : Operand<i32> { | |
448 let PrintMethod = "printUnsignedImm"; | 537 let PrintMethod = "printUnsignedImm"; |
449 } | 538 let EncoderMethod = "getUImmWithOffsetEncoding<2, 1>"; |
450 | 539 let DecoderMethod = "DecodeUImmWithOffset<2, 1>"; |
451 def uimm3 : Operand<i32> { | 540 let ParserMatchClass = ConstantUImm2Plus1AsmOperandClass; |
541 } | |
542 | |
543 def uimm5_plus1 : Operand<i32> { | |
452 let PrintMethod = "printUnsignedImm"; | 544 let PrintMethod = "printUnsignedImm"; |
453 } | 545 let EncoderMethod = "getUImmWithOffsetEncoding<5, 1>"; |
454 | 546 let DecoderMethod = "DecodeUImmWithOffset<5, 1>"; |
455 def uimm5 : Operand<i32> { | 547 let ParserMatchClass = ConstantUImm5Plus1AsmOperandClass; |
548 } | |
549 | |
550 def uimm5_plus32 : Operand<i32> { | |
456 let PrintMethod = "printUnsignedImm"; | 551 let PrintMethod = "printUnsignedImm"; |
457 } | 552 let ParserMatchClass = ConstantUImm5Plus32AsmOperandClass; |
458 | 553 } |
459 def uimm6 : Operand<i32> { | 554 |
555 def uimm5_plus33 : Operand<i32> { | |
460 let PrintMethod = "printUnsignedImm"; | 556 let PrintMethod = "printUnsignedImm"; |
557 let EncoderMethod = "getUImmWithOffsetEncoding<5, 1>"; | |
558 let DecoderMethod = "DecodeUImmWithOffset<5, 1>"; | |
559 let ParserMatchClass = ConstantUImm5Plus33AsmOperandClass; | |
560 } | |
561 | |
562 def uimm5_plus32_normalize : Operand<i32> { | |
563 let PrintMethod = "printUnsignedImm"; | |
564 let ParserMatchClass = ConstantUImm5Plus32NormalizeAsmOperandClass; | |
565 } | |
566 | |
567 def uimm5_lsl2 : Operand<OtherVT> { | |
568 let EncoderMethod = "getUImm5Lsl2Encoding"; | |
569 let DecoderMethod = "DecodeUImm5lsl2"; | |
570 let ParserMatchClass = ConstantUImm5Lsl2AsmOperandClass; | |
571 } | |
572 | |
573 def uimm5_plus32_normalize_64 : Operand<i64> { | |
574 let PrintMethod = "printUnsignedImm"; | |
575 let ParserMatchClass = ConstantUImm5Plus32NormalizeAsmOperandClass; | |
576 } | |
577 | |
578 foreach I = {5} in | |
579 def uimm # I # _64 : Operand<i64> { | |
580 let PrintMethod = "printUnsignedImm"; | |
581 let ParserMatchClass = | |
582 !cast<AsmOperandClass>("ConstantUImm" # I # "AsmOperandClass"); | |
583 } | |
584 | |
585 // Like uimm5_64 but reports a less confusing error for 32-63 when | |
586 // an instruction alias permits that. | |
587 def uimm5_64_report_uimm6 : Operand<i64> { | |
588 let PrintMethod = "printUnsignedImm"; | |
589 let ParserMatchClass = ConstantUImm5ReportUImm6AsmOperandClass; | |
461 } | 590 } |
462 | 591 |
463 def uimm16 : Operand<i32> { | 592 def uimm16 : Operand<i32> { |
464 let PrintMethod = "printUnsignedImm"; | 593 let PrintMethod = "printUnsignedImm"; |
465 } | 594 } |
568 | 697 |
569 def PtrRC : Operand<iPTR> { | 698 def PtrRC : Operand<iPTR> { |
570 let MIOperandInfo = (ops ptr_rc); | 699 let MIOperandInfo = (ops ptr_rc); |
571 let DecoderMethod = "DecodePtrRegisterClass"; | 700 let DecoderMethod = "DecodePtrRegisterClass"; |
572 let ParserMatchClass = GPR32AsmOperand; | 701 let ParserMatchClass = GPR32AsmOperand; |
573 } | |
574 | |
575 // size operand of ext instruction | |
576 def size_ext : Operand<i32> { | |
577 let EncoderMethod = "getSizeExtEncoding"; | |
578 let DecoderMethod = "DecodeExtSize"; | |
579 } | 702 } |
580 | 703 |
581 // size operand of ins instruction | 704 // size operand of ins instruction |
582 def size_ins : Operand<i32> { | 705 def size_ins : Operand<i32> { |
583 let EncoderMethod = "getSizeInsEncoding"; | 706 let EncoderMethod = "getSizeInsEncoding"; |
878 | 1001 |
879 // Jump and Link (Call) | 1002 // Jump and Link (Call) |
880 let isCall=1, hasDelaySlot=1, Defs = [RA] in { | 1003 let isCall=1, hasDelaySlot=1, Defs = [RA] in { |
881 class JumpLink<string opstr, DAGOperand opnd> : | 1004 class JumpLink<string opstr, DAGOperand opnd> : |
882 InstSE<(outs), (ins opnd:$target), !strconcat(opstr, "\t$target"), | 1005 InstSE<(outs), (ins opnd:$target), !strconcat(opstr, "\t$target"), |
883 [(MipsJmpLink imm:$target)], II_JAL, FrmJ, opstr> { | 1006 [(MipsJmpLink tglobaladdr:$target)], II_JAL, FrmJ, opstr> { |
884 let DecoderMethod = "DecodeJumpTarget"; | 1007 let DecoderMethod = "DecodeJumpTarget"; |
885 } | 1008 } |
886 | 1009 |
887 class JumpLinkRegPseudo<RegisterOperand RO, Instruction JALRInst, | 1010 class JumpLinkRegPseudo<RegisterOperand RO, Instruction JALRInst, |
888 Register RetReg, RegisterOperand ResRO = RO>: | 1011 Register RetReg, RegisterOperand ResRO = RO>: |
1074 InstSE<(outs CPURegOperand:$rt), (ins RO:$rd), "rdhwr\t$rt, $rd", [], | 1197 InstSE<(outs CPURegOperand:$rt), (ins RO:$rd), "rdhwr\t$rt, $rd", [], |
1075 II_RDHWR, FrmR, "rdhwr">; | 1198 II_RDHWR, FrmR, "rdhwr">; |
1076 | 1199 |
1077 // Ext and Ins | 1200 // Ext and Ins |
1078 class ExtBase<string opstr, RegisterOperand RO, Operand PosOpnd, | 1201 class ExtBase<string opstr, RegisterOperand RO, Operand PosOpnd, |
1079 SDPatternOperator Op = null_frag>: | 1202 Operand SizeOpnd, SDPatternOperator Op = null_frag> : |
1080 InstSE<(outs RO:$rt), (ins RO:$rs, PosOpnd:$pos, size_ext:$size), | 1203 InstSE<(outs RO:$rt), (ins RO:$rs, PosOpnd:$pos, SizeOpnd:$size), |
1081 !strconcat(opstr, " $rt, $rs, $pos, $size"), | 1204 !strconcat(opstr, " $rt, $rs, $pos, $size"), |
1082 [(set RO:$rt, (Op RO:$rs, imm:$pos, imm:$size))], II_EXT, | 1205 [(set RO:$rt, (Op RO:$rs, imm:$pos, imm:$size))], II_EXT, |
1083 FrmR, opstr>, ISA_MIPS32R2; | 1206 FrmR, opstr>, ISA_MIPS32R2; |
1084 | 1207 |
1085 class InsBase<string opstr, RegisterOperand RO, Operand PosOpnd, | 1208 class InsBase<string opstr, RegisterOperand RO, Operand PosOpnd, |
1137 //===----------------------------------------------------------------------===// | 1260 //===----------------------------------------------------------------------===// |
1138 | 1261 |
1139 // Return RA. | 1262 // Return RA. |
1140 let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1, hasCtrlDep=1 in | 1263 let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1, hasCtrlDep=1 in |
1141 def RetRA : PseudoSE<(outs), (ins), [(MipsRet)]>; | 1264 def RetRA : PseudoSE<(outs), (ins), [(MipsRet)]>; |
1265 | |
1266 let isReturn=1, isTerminator=1, isBarrier=1, hasCtrlDep=1, hasSideEffects=1 in | |
1267 def ERet : PseudoSE<(outs), (ins), [(MipsERet)]>; | |
1142 | 1268 |
1143 let Defs = [SP], Uses = [SP], hasSideEffects = 1 in { | 1269 let Defs = [SP], Uses = [SP], hasSideEffects = 1 in { |
1144 def ADJCALLSTACKDOWN : MipsPseudo<(outs), (ins i32imm:$amt), | 1270 def ADJCALLSTACKDOWN : MipsPseudo<(outs), (ins i32imm:$amt), |
1145 [(callseq_start timm:$amt)]>; | 1271 [(callseq_start timm:$amt)]>; |
1146 def ADJCALLSTACKUP : MipsPseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), | 1272 def ADJCALLSTACKUP : MipsPseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), |
1324 def SDC3 : SW_FT3<"sdc3", COP3Opnd, NoItinerary, store>, LW_FM<0x3f>, | 1450 def SDC3 : SW_FT3<"sdc3", COP3Opnd, NoItinerary, store>, LW_FM<0x3f>, |
1325 ISA_MIPS2; | 1451 ISA_MIPS2; |
1326 } | 1452 } |
1327 } | 1453 } |
1328 | 1454 |
1329 def SYNC : MMRel, SYNC_FT<"sync">, SYNC_FM, ISA_MIPS32; | 1455 def SYNC : MMRel, StdMMR6Rel, SYNC_FT<"sync">, SYNC_FM, ISA_MIPS32; |
1330 def SYNCI : MMRel, SYNCI_FT<"synci">, SYNCI_FM, ISA_MIPS32R2; | 1456 def SYNCI : MMRel, StdMMR6Rel, SYNCI_FT<"synci">, SYNCI_FM, ISA_MIPS32R2; |
1331 | 1457 |
1332 let AdditionalPredicates = [NotInMicroMips] in { | 1458 let AdditionalPredicates = [NotInMicroMips] in { |
1333 def TEQ : MMRel, TEQ_FT<"teq", GPR32Opnd>, TEQ_FM<0x34>, ISA_MIPS2; | 1459 def TEQ : MMRel, TEQ_FT<"teq", GPR32Opnd>, TEQ_FM<0x34>, ISA_MIPS2; |
1334 def TGE : MMRel, TEQ_FT<"tge", GPR32Opnd>, TEQ_FM<0x30>, ISA_MIPS2; | 1460 def TGE : MMRel, TEQ_FT<"tge", GPR32Opnd>, TEQ_FM<0x30>, ISA_MIPS2; |
1335 def TGEU : MMRel, TEQ_FT<"tgeu", GPR32Opnd>, TEQ_FM<0x31>, ISA_MIPS2; | 1461 def TGEU : MMRel, TEQ_FT<"tgeu", GPR32Opnd>, TEQ_FM<0x31>, ISA_MIPS2; |
1357 def SYSCALL : MMRel, SYS_FT<"syscall">, SYS_FM<0xc>; | 1483 def SYSCALL : MMRel, SYS_FT<"syscall">, SYS_FM<0xc>; |
1358 def TRAP : TrapBase<BREAK>; | 1484 def TRAP : TrapBase<BREAK>; |
1359 def SDBBP : MMRel, SYS_FT<"sdbbp">, SDBBP_FM, ISA_MIPS32_NOT_32R6_64R6; | 1485 def SDBBP : MMRel, SYS_FT<"sdbbp">, SDBBP_FM, ISA_MIPS32_NOT_32R6_64R6; |
1360 | 1486 |
1361 let AdditionalPredicates = [NotInMicroMips] in { | 1487 let AdditionalPredicates = [NotInMicroMips] in { |
1362 def ERET : MMRel, ER_FT<"eret">, ER_FM<0x18, 0x0>, INSN_MIPS3_32; | 1488 def ERET : MMRel, ER_FT<"eret">, ER_FM<0x18, 0x0>, INSN_MIPS3_32; |
1363 def ERETNC : MMRel, ER_FT<"eretnc">, ER_FM<0x18, 0x1>, ISA_MIPS32R5; | 1489 def ERETNC : MMRel, ER_FT<"eretnc">, ER_FM<0x18, 0x1>, ISA_MIPS32R5; |
1364 } | 1490 def DERET : MMRel, ER_FT<"deret">, ER_FM<0x1f, 0x0>, ISA_MIPS32; |
1365 def DERET : MMRel, ER_FT<"deret">, ER_FM<0x1f, 0x0>, ISA_MIPS32; | 1491 } |
1366 | 1492 |
1367 let AdditionalPredicates = [NotInMicroMips] in { | 1493 let AdditionalPredicates = [NotInMicroMips] in { |
1368 def EI : MMRel, StdMMR6Rel, DEI_FT<"ei", GPR32Opnd>, EI_FM<1>, ISA_MIPS32R2; | 1494 def EI : MMRel, StdMMR6Rel, DEI_FT<"ei", GPR32Opnd>, EI_FM<1>, ISA_MIPS32R2; |
1369 } | 1495 def DI : MMRel, StdMMR6Rel, DEI_FT<"di", GPR32Opnd>, EI_FM<0>, ISA_MIPS32R2; |
1370 def DI : MMRel, DEI_FT<"di", GPR32Opnd>, EI_FM<0>, ISA_MIPS32R2; | 1496 } |
1371 | 1497 |
1372 let EncodingPredicates = []<Predicate>, // FIXME: Lack of HasStdEnc is probably a bug | 1498 let EncodingPredicates = []<Predicate>, // FIXME: Lack of HasStdEnc is probably a bug |
1373 AdditionalPredicates = [NotInMicroMips] in { | 1499 AdditionalPredicates = [NotInMicroMips] in { |
1374 def WAIT : WAIT_FT<"wait">, WAIT_FM; | 1500 def WAIT : WAIT_FT<"wait">, WAIT_FM; |
1375 | 1501 |
1557 | 1683 |
1558 def PseudoSDIV : MultDivPseudo<SDIV, ACC64, GPR32Opnd, MipsDivRem, II_DIV, | 1684 def PseudoSDIV : MultDivPseudo<SDIV, ACC64, GPR32Opnd, MipsDivRem, II_DIV, |
1559 0, 1, 1>, ISA_MIPS1_NOT_32R6_64R6; | 1685 0, 1, 1>, ISA_MIPS1_NOT_32R6_64R6; |
1560 def PseudoUDIV : MultDivPseudo<UDIV, ACC64, GPR32Opnd, MipsDivRemU, II_DIVU, | 1686 def PseudoUDIV : MultDivPseudo<UDIV, ACC64, GPR32Opnd, MipsDivRemU, II_DIVU, |
1561 0, 1, 1>, ISA_MIPS1_NOT_32R6_64R6; | 1687 0, 1, 1>, ISA_MIPS1_NOT_32R6_64R6; |
1562 | 1688 let AdditionalPredicates = [NotInMicroMips] in { |
1563 def RDHWR : MMRel, ReadHardware<GPR32Opnd, HWRegsOpnd>, RDHWR_FM; | 1689 def RDHWR : MMRel, ReadHardware<GPR32Opnd, HWRegsOpnd>, RDHWR_FM; |
1564 | 1690 } |
1565 def EXT : MMRel, ExtBase<"ext", GPR32Opnd, uimm5, MipsExt>, EXT_FM<0>; | 1691 // TODO: Add '0 < pos+size <= 32' constraint check to ext instruction |
1692 def EXT : MMRel, ExtBase<"ext", GPR32Opnd, uimm5, uimm5_plus1, MipsExt>, | |
1693 EXT_FM<0>; | |
1566 def INS : MMRel, InsBase<"ins", GPR32Opnd, uimm5, MipsIns>, EXT_FM<4>; | 1694 def INS : MMRel, InsBase<"ins", GPR32Opnd, uimm5, MipsIns>, EXT_FM<4>; |
1567 | 1695 |
1568 /// Move Control Registers From/To CPU Registers | 1696 /// Move Control Registers From/To CPU Registers |
1569 def MFC0 : MFC3OP<"mfc0", GPR32Opnd, COP0Opnd>, MFC3OP_FM<0x10, 0>, ISA_MIPS32; | 1697 def MFC0 : MFC3OP<"mfc0", GPR32Opnd, COP0Opnd>, MFC3OP_FM<0x10, 0>, ISA_MIPS32; |
1570 def MTC0 : MTC3OP<"mtc0", COP0Opnd, GPR32Opnd>, MFC3OP_FM<0x10, 4>, ISA_MIPS32; | 1698 def MTC0 : MTC3OP<"mtc0", COP0Opnd, GPR32Opnd>, MFC3OP_FM<0x10, 4>, ISA_MIPS32; |
1571 def MFC2 : MFC3OP<"mfc2", GPR32Opnd, COP2Opnd>, MFC3OP_FM<0x12, 0>; | 1699 def MFC2 : MFC3OP<"mfc2", GPR32Opnd, COP2Opnd>, MFC3OP_FM<0x12, 0>; |
1572 def MTC2 : MTC3OP<"mtc2", COP2Opnd, GPR32Opnd>, MFC3OP_FM<0x12, 4>; | 1700 def MTC2 : MTC3OP<"mtc2", COP2Opnd, GPR32Opnd>, MFC3OP_FM<0x12, 4>; |
1573 | 1701 |
1574 class Barrier<string asmstr> : InstSE<(outs), (ins), asmstr, [], NoItinerary, | 1702 class Barrier<string asmstr> : InstSE<(outs), (ins), asmstr, [], NoItinerary, |
1575 FrmOther, asmstr>; | 1703 FrmOther, asmstr>; |
1576 def SSNOP : MMRel, Barrier<"ssnop">, BARRIER_FM<1>; | 1704 def SSNOP : MMRel, StdMMR6Rel, Barrier<"ssnop">, BARRIER_FM<1>; |
1577 def EHB : MMRel, Barrier<"ehb">, BARRIER_FM<3>; | 1705 def EHB : MMRel, Barrier<"ehb">, BARRIER_FM<3>; |
1578 def PAUSE : MMRel, Barrier<"pause">, BARRIER_FM<5>, ISA_MIPS32R2; | 1706 def PAUSE : MMRel, StdMMR6Rel, Barrier<"pause">, BARRIER_FM<5>, ISA_MIPS32R2; |
1579 | 1707 |
1580 // JR_HB and JALR_HB are defined here using the new style naming | 1708 // JR_HB and JALR_HB are defined here using the new style naming |
1581 // scheme because some of this code is shared with Mips32r6InstrInfo.td | 1709 // scheme because some of this code is shared with Mips32r6InstrInfo.td |
1582 // and because of that it doesn't follow the naming convention of the | 1710 // and because of that it doesn't follow the naming convention of the |
1583 // rest of the file. To avoid a mixture of old vs new style, the new | 1711 // rest of the file. To avoid a mixture of old vs new style, the new |
1633 | 1761 |
1634 def CACHE : MMRel, CacheOp<"cache", mem>, CACHEOP_FM<0b101111>, | 1762 def CACHE : MMRel, CacheOp<"cache", mem>, CACHEOP_FM<0b101111>, |
1635 INSN_MIPS3_32_NOT_32R6_64R6; | 1763 INSN_MIPS3_32_NOT_32R6_64R6; |
1636 def PREF : MMRel, CacheOp<"pref", mem>, CACHEOP_FM<0b110011>, | 1764 def PREF : MMRel, CacheOp<"pref", mem>, CACHEOP_FM<0b110011>, |
1637 INSN_MIPS3_32_NOT_32R6_64R6; | 1765 INSN_MIPS3_32_NOT_32R6_64R6; |
1766 | |
1767 def ROL : MipsAsmPseudoInst<(outs), | |
1768 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, GPR32Opnd:$rd), | |
1769 "rol\t$rs, $rt, $rd">; | |
1770 def ROLImm : MipsAsmPseudoInst<(outs), | |
1771 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, simm16:$imm), | |
1772 "rol\t$rs, $rt, $imm">; | |
1773 def : MipsInstAlias<"rol $rd, $rs", | |
1774 (ROL GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rs), 0>; | |
1775 def : MipsInstAlias<"rol $rd, $imm", | |
1776 (ROLImm GPR32Opnd:$rd, GPR32Opnd:$rd, simm16:$imm), 0>; | |
1777 | |
1778 def ROR : MipsAsmPseudoInst<(outs), | |
1779 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, GPR32Opnd:$rd), | |
1780 "ror\t$rs, $rt, $rd">; | |
1781 def RORImm : MipsAsmPseudoInst<(outs), | |
1782 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, simm16:$imm), | |
1783 "ror\t$rs, $rt, $imm">; | |
1784 def : MipsInstAlias<"ror $rd, $rs", | |
1785 (ROR GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rs), 0>; | |
1786 def : MipsInstAlias<"ror $rd, $imm", | |
1787 (RORImm GPR32Opnd:$rd, GPR32Opnd:$rd, simm16:$imm), 0>; | |
1788 | |
1789 def DROL : MipsAsmPseudoInst<(outs), | |
1790 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, GPR32Opnd:$rd), | |
1791 "drol\t$rs, $rt, $rd">, ISA_MIPS64; | |
1792 def DROLImm : MipsAsmPseudoInst<(outs), | |
1793 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, simm16:$imm), | |
1794 "drol\t$rs, $rt, $imm">, ISA_MIPS64; | |
1795 def : MipsInstAlias<"drol $rd, $rs", | |
1796 (DROL GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rs), 0>, ISA_MIPS64; | |
1797 def : MipsInstAlias<"drol $rd, $imm", | |
1798 (DROLImm GPR32Opnd:$rd, GPR32Opnd:$rd, simm16:$imm), 0>, ISA_MIPS64; | |
1799 | |
1800 def DROR : MipsAsmPseudoInst<(outs), | |
1801 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, GPR32Opnd:$rd), | |
1802 "dror\t$rs, $rt, $rd">, ISA_MIPS64; | |
1803 def DRORImm : MipsAsmPseudoInst<(outs), | |
1804 (ins GPR32Opnd:$rs, GPR32Opnd:$rt, simm16:$imm), | |
1805 "dror\t$rs, $rt, $imm">, ISA_MIPS64; | |
1806 def : MipsInstAlias<"dror $rd, $rs", | |
1807 (DROR GPR32Opnd:$rd, GPR32Opnd:$rd, GPR32Opnd:$rs), 0>, ISA_MIPS64; | |
1808 def : MipsInstAlias<"dror $rd, $imm", | |
1809 (DRORImm GPR32Opnd:$rd, GPR32Opnd:$rd, simm16:$imm), 0>, ISA_MIPS64; | |
1638 | 1810 |
1639 //===----------------------------------------------------------------------===// | 1811 //===----------------------------------------------------------------------===// |
1640 // Instruction aliases | 1812 // Instruction aliases |
1641 //===----------------------------------------------------------------------===// | 1813 //===----------------------------------------------------------------------===// |
1642 def : MipsInstAlias<"move $dst, $src", | 1814 def : MipsInstAlias<"move $dst, $src", |
1711 def : MipsInstAlias<"syscall", (SYSCALL 0), 1>; | 1883 def : MipsInstAlias<"syscall", (SYSCALL 0), 1>; |
1712 | 1884 |
1713 def : MipsInstAlias<"break", (BREAK 0, 0), 1>; | 1885 def : MipsInstAlias<"break", (BREAK 0, 0), 1>; |
1714 def : MipsInstAlias<"break $imm", (BREAK uimm10:$imm, 0), 1>; | 1886 def : MipsInstAlias<"break $imm", (BREAK uimm10:$imm, 0), 1>; |
1715 let AdditionalPredicates = [NotInMicroMips] in { | 1887 let AdditionalPredicates = [NotInMicroMips] in { |
1716 def : MipsInstAlias<"ei", (EI ZERO), 1>, ISA_MIPS32R2; | 1888 def : MipsInstAlias<"ei", (EI ZERO), 1>, ISA_MIPS32R2; |
1717 } | 1889 def : MipsInstAlias<"di", (DI ZERO), 1>, ISA_MIPS32R2; |
1718 def : MipsInstAlias<"di", (DI ZERO), 1>, ISA_MIPS32R2; | 1890 } |
1719 let AdditionalPredicates = [NotInMicroMips] in { | 1891 let AdditionalPredicates = [NotInMicroMips] in { |
1720 def : MipsInstAlias<"teq $rs, $rt", | 1892 def : MipsInstAlias<"teq $rs, $rt", |
1721 (TEQ GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>, ISA_MIPS2; | 1893 (TEQ GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>, ISA_MIPS2; |
1722 def : MipsInstAlias<"tge $rs, $rt", | 1894 def : MipsInstAlias<"tge $rs, $rt", |
1723 (TGE GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>, ISA_MIPS2; | 1895 (TGE GPR32Opnd:$rs, GPR32Opnd:$rt, 0), 1>, ISA_MIPS2; |
1755 //===----------------------------------------------------------------------===// | 1927 //===----------------------------------------------------------------------===// |
1756 | 1928 |
1757 class LoadImmediate32<string instr_asm, Operand Od, RegisterOperand RO> : | 1929 class LoadImmediate32<string instr_asm, Operand Od, RegisterOperand RO> : |
1758 MipsAsmPseudoInst<(outs RO:$rt), (ins Od:$imm32), | 1930 MipsAsmPseudoInst<(outs RO:$rt), (ins Od:$imm32), |
1759 !strconcat(instr_asm, "\t$rt, $imm32")> ; | 1931 !strconcat(instr_asm, "\t$rt, $imm32")> ; |
1760 def LoadImm32 : LoadImmediate32<"li", uimm5, GPR32Opnd>; | 1932 def LoadImm32 : LoadImmediate32<"li", simm32, GPR32Opnd>; |
1761 | 1933 |
1762 class LoadAddressFromReg32<string instr_asm, Operand MemOpnd, | 1934 class LoadAddressFromReg32<string instr_asm, Operand MemOpnd, |
1763 RegisterOperand RO> : | 1935 RegisterOperand RO> : |
1764 MipsAsmPseudoInst<(outs RO:$rt), (ins MemOpnd:$addr), | 1936 MipsAsmPseudoInst<(outs RO:$rt), (ins MemOpnd:$addr), |
1765 !strconcat(instr_asm, "\t$rt, $addr")> ; | 1937 !strconcat(instr_asm, "\t$rt, $addr")> ; |
1766 def LoadAddrReg32 : LoadAddressFromReg32<"la", mem, GPR32Opnd>; | 1938 def LoadAddrReg32 : LoadAddressFromReg32<"la", mem, GPR32Opnd>; |
1767 | 1939 |
1768 class LoadAddressFromImm32<string instr_asm, Operand Od, RegisterOperand RO> : | 1940 class LoadAddressFromImm32<string instr_asm, Operand Od, RegisterOperand RO> : |
1769 MipsAsmPseudoInst<(outs RO:$rt), (ins Od:$imm32), | 1941 MipsAsmPseudoInst<(outs RO:$rt), (ins Od:$imm32), |
1770 !strconcat(instr_asm, "\t$rt, $imm32")> ; | 1942 !strconcat(instr_asm, "\t$rt, $imm32")> ; |
1771 def LoadAddrImm32 : LoadAddressFromImm32<"la", uimm5, GPR32Opnd>; | 1943 def LoadAddrImm32 : LoadAddressFromImm32<"la", simm32, GPR32Opnd>; |
1772 | 1944 |
1773 def JalTwoReg : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins GPR32Opnd:$rs), | 1945 def JalTwoReg : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins GPR32Opnd:$rs), |
1774 "jal\t$rd, $rs"> ; | 1946 "jal\t$rd, $rs"> ; |
1775 def JalOneReg : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs), | 1947 def JalOneReg : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs), |
1776 "jal\t$rs"> ; | 1948 "jal\t$rs"> ; |
1846 "ddiv\t$rs, $rt">; //, ISA_MIPS64_NOT_64R6; | 2018 "ddiv\t$rs, $rt">; //, ISA_MIPS64_NOT_64R6; |
1847 | 2019 |
1848 def DUDivMacro : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt), | 2020 def DUDivMacro : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt), |
1849 "ddivu\t$rs, $rt">; //, ISA_MIPS64_NOT_64R6; | 2021 "ddivu\t$rs, $rt">; //, ISA_MIPS64_NOT_64R6; |
1850 | 2022 |
2023 def Ulh : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr), | |
2024 "ulh\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6; | |
2025 | |
1851 def Ulhu : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr), | 2026 def Ulhu : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr), |
1852 "ulhu\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6; | 2027 "ulhu\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6; |
1853 | 2028 |
1854 def Ulw : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr), | 2029 def Ulw : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr), |
1855 "ulw\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6; | 2030 "ulw\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6; |
1898 // SYNC | 2073 // SYNC |
1899 def : MipsPat<(MipsSync (i32 immz)), | 2074 def : MipsPat<(MipsSync (i32 immz)), |
1900 (SYNC 0)>, ISA_MIPS2; | 2075 (SYNC 0)>, ISA_MIPS2; |
1901 | 2076 |
1902 // Call | 2077 // Call |
1903 def : MipsPat<(MipsJmpLink (i32 tglobaladdr:$dst)), | |
1904 (JAL tglobaladdr:$dst)>; | |
1905 def : MipsPat<(MipsJmpLink (i32 texternalsym:$dst)), | 2078 def : MipsPat<(MipsJmpLink (i32 texternalsym:$dst)), |
1906 (JAL texternalsym:$dst)>; | 2079 (JAL texternalsym:$dst)>; |
1907 //def : MipsPat<(MipsJmpLink GPR32:$dst), | 2080 //def : MipsPat<(MipsJmpLink GPR32:$dst), |
1908 // (JALR GPR32:$dst)>; | 2081 // (JALR GPR32:$dst)>; |
1909 | 2082 |
2066 let AdditionalPredicates = [NotInMicroMips] in { | 2239 let AdditionalPredicates = [NotInMicroMips] in { |
2067 def : LoadRegImmPat<LW, i32, load>; | 2240 def : LoadRegImmPat<LW, i32, load>; |
2068 } | 2241 } |
2069 } | 2242 } |
2070 | 2243 |
2244 // Atomic load patterns. | |
2245 def : MipsPat<(atomic_load_8 addr:$a), (LB addr:$a)>; | |
2246 def : MipsPat<(atomic_load_16 addr:$a), (LH addr:$a)>; | |
2247 def : MipsPat<(atomic_load_32 addr:$a), (LW addr:$a)>; | |
2248 | |
2249 // Atomic store patterns. | |
2250 def : MipsPat<(atomic_store_8 addr:$a, GPR32:$v), (SB GPR32:$v, addr:$a)>; | |
2251 def : MipsPat<(atomic_store_16 addr:$a, GPR32:$v), (SH GPR32:$v, addr:$a)>; | |
2252 def : MipsPat<(atomic_store_32 addr:$a, GPR32:$v), (SW GPR32:$v, addr:$a)>; | |
2253 | |
2071 //===----------------------------------------------------------------------===// | 2254 //===----------------------------------------------------------------------===// |
2072 // Floating Point Support | 2255 // Floating Point Support |
2073 //===----------------------------------------------------------------------===// | 2256 //===----------------------------------------------------------------------===// |
2074 | 2257 |
2075 include "MipsInstrFPU.td" | 2258 include "MipsInstrFPU.td" |