comparison lib/Target/SystemZ/SystemZInstrFormats.td @ 77:54457678186b

LLVM 3.6
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 08 Sep 2014 22:06:00 +0900
parents 95c75e76d11b
children afa8332a0e37
comparison
equal deleted inserted replaced
34:e874dbf0ad9d 77:54457678186b
509 // The instruction stores a range of registers to the address, 509 // The instruction stores a range of registers to the address,
510 // with the explicit operands giving the first and last register 510 // with the explicit operands giving the first and last register
511 // to store. Other stored registers are added as implicit uses. 511 // to store. Other stored registers are added as implicit uses.
512 // 512 //
513 // Unary: 513 // Unary:
514 // One register output operand and one input operand. The input 514 // One register output operand and one input operand.
515 // operand may be a register, immediate or memory.
516 // 515 //
517 // Binary: 516 // Binary:
518 // One register output operand and two input operands. The first 517 // One register output operand and two input operands.
519 // input operand is always a register and he second may be a register,
520 // immediate or memory.
521 //
522 // Shift:
523 // One register output operand and two input operands. The first
524 // input operand is a register and the second has the same form as
525 // an address (although it isn't actually used to address memory).
526 // 518 //
527 // Compare: 519 // Compare:
528 // Two input operands. The first operand is always a register, 520 // Two input operands and an implicit CC output operand.
529 // the second may be a register, immediate or memory.
530 // 521 //
531 // Ternary: 522 // Ternary:
532 // One register output operand and three register input operands. 523 // One register output operand and three input operands.
524 //
525 // LoadAndOp:
526 // One output operand and two input operands, one of which is an address.
527 // The instruction both reads from and writes to the address.
533 // 528 //
534 // CmpSwap: 529 // CmpSwap:
535 // One output operand and three input operands. The first two 530 // One output operand and three input operands, one of which is an address.
536 // operands are registers and the third is an address. The instruction 531 // The instruction both reads from and writes to the address.
537 // both reads from and writes to the address.
538 // 532 //
539 // RotateSelect: 533 // RotateSelect:
540 // One output operand and five input operands. The first two operands 534 // One output operand and five input operands. The first two operands
541 // are registers and the other three are immediates. 535 // are registers and the other three are immediates.
542 // 536 //
685 // Like CondStoreRSY, but used for the raw assembly form. The condition-code 679 // Like CondStoreRSY, but used for the raw assembly form. The condition-code
686 // mask is the third operand rather than being part of the mnemonic. 680 // mask is the third operand rather than being part of the mnemonic.
687 class AsmCondStoreRSY<string mnemonic, bits<16> opcode, 681 class AsmCondStoreRSY<string mnemonic, bits<16> opcode,
688 RegisterOperand cls, bits<5> bytes, 682 RegisterOperand cls, bits<5> bytes,
689 AddressingMode mode = bdaddr20only> 683 AddressingMode mode = bdaddr20only>
690 : InstRSY<opcode, (outs), (ins cls:$R1, mode:$BD2, uimm8zx4:$R3), 684 : InstRSY<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$R3),
691 mnemonic#"\t$R1, $BD2, $R3", []>, 685 mnemonic#"\t$R1, $BD2, $R3", []>,
692 Requires<[FeatureLoadStoreOnCond]> { 686 Requires<[FeatureLoadStoreOnCond]> {
693 let mayStore = 1; 687 let mayStore = 1;
694 let AccessBytes = bytes; 688 let AccessBytes = bytes;
695 } 689 }
724 let OpType = "reg"; 718 let OpType = "reg";
725 } 719 }
726 720
727 class UnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 721 class UnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
728 RegisterOperand cls2> 722 RegisterOperand cls2>
729 : InstRRF<opcode, (outs cls1:$R1), (ins uimm8zx4:$R3, cls2:$R2), 723 : InstRRF<opcode, (outs cls1:$R1), (ins imm32zx4:$R3, cls2:$R2),
730 mnemonic#"r\t$R1, $R3, $R2", []> { 724 mnemonic#"r\t$R1, $R3, $R2", []> {
731 let OpKey = mnemonic ## cls1; 725 let OpKey = mnemonic ## cls1;
732 let OpType = "reg"; 726 let OpType = "reg";
733 let R4 = 0; 727 let R4 = 0;
734 } 728 }
735 729
736 class UnaryRRF4<string mnemonic, bits<16> opcode, RegisterOperand cls1, 730 class UnaryRRF4<string mnemonic, bits<16> opcode, RegisterOperand cls1,
737 RegisterOperand cls2> 731 RegisterOperand cls2>
738 : InstRRF<opcode, (outs cls1:$R1), (ins uimm8zx4:$R3, cls2:$R2, uimm8zx4:$R4), 732 : InstRRF<opcode, (outs cls1:$R1), (ins imm32zx4:$R3, cls2:$R2, imm32zx4:$R4),
739 mnemonic#"\t$R1, $R3, $R2, $R4", []>; 733 mnemonic#"\t$R1, $R3, $R2, $R4", []>;
740 734
741 // These instructions are generated by if conversion. The old value of R1 735 // These instructions are generated by if conversion. The old value of R1
742 // is added as an implicit use. 736 // is added as an implicit use.
743 class CondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 737 class CondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
751 745
752 // Like CondUnaryRRF, but used for the raw assembly form. The condition-code 746 // Like CondUnaryRRF, but used for the raw assembly form. The condition-code
753 // mask is the third operand rather than being part of the mnemonic. 747 // mask is the third operand rather than being part of the mnemonic.
754 class AsmCondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 748 class AsmCondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
755 RegisterOperand cls2> 749 RegisterOperand cls2>
756 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2, uimm8zx4:$R3), 750 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2, imm32zx4:$R3),
757 mnemonic#"r\t$R1, $R2, $R3", []>, 751 mnemonic#"r\t$R1, $R2, $R3", []>,
758 Requires<[FeatureLoadStoreOnCond]> { 752 Requires<[FeatureLoadStoreOnCond]> {
759 let Constraints = "$R1 = $R1src"; 753 let Constraints = "$R1 = $R1src";
760 let DisableEncoding = "$R1src"; 754 let DisableEncoding = "$R1src";
761 let R4 = 0; 755 let R4 = 0;
817 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code 811 // Like CondUnaryRSY, but used for the raw assembly form. The condition-code
818 // mask is the third operand rather than being part of the mnemonic. 812 // mask is the third operand rather than being part of the mnemonic.
819 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode, 813 class AsmCondUnaryRSY<string mnemonic, bits<16> opcode,
820 RegisterOperand cls, bits<5> bytes, 814 RegisterOperand cls, bits<5> bytes,
821 AddressingMode mode = bdaddr20only> 815 AddressingMode mode = bdaddr20only>
822 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, uimm8zx4:$R3), 816 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$R3),
823 mnemonic#"\t$R1, $BD2, $R3", []>, 817 mnemonic#"\t$R1, $BD2, $R3", []>,
824 Requires<[FeatureLoadStoreOnCond]> { 818 Requires<[FeatureLoadStoreOnCond]> {
825 let mayLoad = 1; 819 let mayLoad = 1;
826 let AccessBytes = bytes; 820 let AccessBytes = bytes;
827 let Constraints = "$R1 = $R1src"; 821 let Constraints = "$R1 = $R1src";
985 : InstRIL<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 979 : InstRIL<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
986 mnemonic#"\t$R1, $I2", 980 mnemonic#"\t$R1, $I2",
987 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 981 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
988 let Constraints = "$R1 = $R1src"; 982 let Constraints = "$R1 = $R1src";
989 let DisableEncoding = "$R1src"; 983 let DisableEncoding = "$R1src";
984 }
985
986 class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
987 RegisterOperand cls>
988 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2),
989 mnemonic#"\t$R1, $BD2",
990 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
991 let R3 = 0;
992 let Constraints = "$R1 = $R1src";
993 let DisableEncoding = "$R1src";
994 }
995
996 class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
997 RegisterOperand cls>
998 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2),
999 mnemonic#"\t$R1, $R3, $BD2",
1000 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
1001
1002 multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
1003 SDPatternOperator operator, RegisterOperand cls> {
1004 let NumOpsKey = mnemonic in {
1005 let NumOpsValue = "3" in
1006 def K : BinaryRSY<mnemonic##"k", opcode2, null_frag, cls>,
1007 Requires<[FeatureDistinctOps]>;
1008 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
1009 def "" : BinaryRS<mnemonic, opcode1, operator, cls>;
1010 }
990 } 1011 }
991 1012
992 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1013 class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
993 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 1014 RegisterOperand cls, SDPatternOperator load, bits<5> bytes,
994 AddressingMode mode = bdxaddr12only> 1015 AddressingMode mode = bdxaddr12only>
1071 let DispSize = "20" in 1092 let DispSize = "20" in
1072 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>; 1093 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
1073 } 1094 }
1074 } 1095 }
1075 1096
1076 class ShiftRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
1077 RegisterOperand cls>
1078 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2),
1079 mnemonic#"\t$R1, $BD2",
1080 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> {
1081 let R3 = 0;
1082 let Constraints = "$R1 = $R1src";
1083 let DisableEncoding = "$R1src";
1084 }
1085
1086 class ShiftRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
1087 RegisterOperand cls>
1088 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2),
1089 mnemonic#"\t$R1, $R3, $BD2",
1090 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>;
1091
1092 multiclass ShiftRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2,
1093 SDPatternOperator operator, RegisterOperand cls> {
1094 let NumOpsKey = mnemonic in {
1095 let NumOpsValue = "3" in
1096 def K : ShiftRSY<mnemonic##"k", opcode2, null_frag, cls>,
1097 Requires<[FeatureDistinctOps]>;
1098 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in
1099 def "" : ShiftRS<mnemonic, opcode1, operator, cls>;
1100 }
1101 }
1102
1103 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1097 class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
1104 RegisterOperand cls1, RegisterOperand cls2> 1098 RegisterOperand cls1, RegisterOperand cls2>
1105 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2), 1099 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
1106 mnemonic#"r\t$R1, $R2", 1100 mnemonic#"r\t$R1, $R2",
1107 [(operator cls1:$R1, cls2:$R2)]> { 1101 [(operator cls1:$R1, cls2:$R2)]> {
1265 let DisableEncoding = "$R1src"; 1259 let DisableEncoding = "$R1src";
1266 let mayLoad = 1; 1260 let mayLoad = 1;
1267 let AccessBytes = bytes; 1261 let AccessBytes = bytes;
1268 } 1262 }
1269 1263
1264 class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
1265 RegisterOperand cls, AddressingMode mode = bdaddr20only>
1266 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2),
1267 mnemonic#"\t$R1, $R3, $BD2",
1268 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> {
1269 let mayLoad = 1;
1270 let mayStore = 1;
1271 }
1272
1270 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1273 class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
1271 RegisterOperand cls, AddressingMode mode = bdaddr12only> 1274 RegisterOperand cls, AddressingMode mode = bdaddr12only>
1272 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 1275 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
1273 mnemonic#"\t$R1, $R3, $BD2", 1276 mnemonic#"\t$R1, $R3, $BD2",
1274 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 1277 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
1300 } 1303 }
1301 1304
1302 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1, 1305 class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
1303 RegisterOperand cls2> 1306 RegisterOperand cls2>
1304 : InstRIEf<opcode, (outs cls1:$R1), 1307 : InstRIEf<opcode, (outs cls1:$R1),
1305 (ins cls1:$R1src, cls2:$R2, uimm8:$I3, uimm8:$I4, uimm8zx6:$I5), 1308 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
1309 imm32zx6:$I5),
1306 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> { 1310 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
1307 let Constraints = "$R1 = $R1src"; 1311 let Constraints = "$R1 = $R1src";
1308 let DisableEncoding = "$R1src"; 1312 let DisableEncoding = "$R1src";
1309 } 1313 }
1310 1314
1311 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator> 1315 class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator>
1312 : InstRXY<opcode, (outs), (ins uimm8zx4:$R1, bdxaddr20only:$XBD2), 1316 : InstRXY<opcode, (outs), (ins imm32zx4:$R1, bdxaddr20only:$XBD2),
1313 mnemonic##"\t$R1, $XBD2", 1317 mnemonic##"\t$R1, $XBD2",
1314 [(operator uimm8zx4:$R1, bdxaddr20only:$XBD2)]>; 1318 [(operator imm32zx4:$R1, bdxaddr20only:$XBD2)]>;
1315 1319
1316 class PrefetchRILPC<string mnemonic, bits<12> opcode, 1320 class PrefetchRILPC<string mnemonic, bits<12> opcode,
1317 SDPatternOperator operator> 1321 SDPatternOperator operator>
1318 : InstRIL<opcode, (outs), (ins uimm8zx4:$R1, pcrel32:$I2), 1322 : InstRIL<opcode, (outs), (ins imm32zx4:$R1, pcrel32:$I2),
1319 mnemonic##"\t$R1, $I2", 1323 mnemonic##"\t$R1, $I2",
1320 [(operator uimm8zx4:$R1, pcrel32:$I2)]> { 1324 [(operator imm32zx4:$R1, pcrel32:$I2)]> {
1321 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 1325 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
1322 // However, BDXs have two extra operands and are therefore 6 units more 1326 // However, BDXs have two extra operands and are therefore 6 units more
1323 // complex. 1327 // complex.
1324 let AddedComplexity = 7; 1328 let AddedComplexity = 7;
1325 } 1329 }
1435 1439
1436 // Like RotateSelectRIEf, but expanded after RA depending on the choice 1440 // Like RotateSelectRIEf, but expanded after RA depending on the choice
1437 // of registers. 1441 // of registers.
1438 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2> 1442 class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2>
1439 : Pseudo<(outs cls1:$R1), 1443 : Pseudo<(outs cls1:$R1),
1440 (ins cls1:$R1src, cls2:$R2, uimm8:$I3, uimm8:$I4, uimm8zx6:$I5), 1444 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
1445 imm32zx6:$I5),
1441 []> { 1446 []> {
1442 let Constraints = "$R1 = $R1src"; 1447 let Constraints = "$R1 = $R1src";
1443 let DisableEncoding = "$R1src"; 1448 let DisableEncoding = "$R1src";
1444 } 1449 }
1445 1450
1446 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is 1451 // Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
1447 // the value of the PSW's 2-bit condition code field. 1452 // the value of the PSW's 2-bit condition code field.
1448 class SelectWrapper<RegisterOperand cls> 1453 class SelectWrapper<RegisterOperand cls>
1449 : Pseudo<(outs cls:$dst), 1454 : Pseudo<(outs cls:$dst),
1450 (ins cls:$src1, cls:$src2, uimm8zx4:$valid, uimm8zx4:$cc), 1455 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc),
1451 [(set cls:$dst, (z_select_ccmask cls:$src1, cls:$src2, 1456 [(set cls:$dst, (z_select_ccmask cls:$src1, cls:$src2,
1452 uimm8zx4:$valid, uimm8zx4:$cc))]> { 1457 imm32zx4:$valid, imm32zx4:$cc))]> {
1453 let usesCustomInserter = 1; 1458 let usesCustomInserter = 1;
1454 // Although the instructions used by these nodes do not in themselves 1459 // Although the instructions used by these nodes do not in themselves
1455 // change CC, the insertion requires new blocks, and CC cannot be live 1460 // change CC, the insertion requires new blocks, and CC cannot be live
1456 // across them. 1461 // across them.
1457 let Defs = [CC]; 1462 let Defs = [CC];
1461 // Stores $new to $addr if $cc is true ("" case) or false (Inv case). 1466 // Stores $new to $addr if $cc is true ("" case) or false (Inv case).
1462 multiclass CondStores<RegisterOperand cls, SDPatternOperator store, 1467 multiclass CondStores<RegisterOperand cls, SDPatternOperator store,
1463 SDPatternOperator load, AddressingMode mode> { 1468 SDPatternOperator load, AddressingMode mode> {
1464 let Defs = [CC], Uses = [CC], usesCustomInserter = 1 in { 1469 let Defs = [CC], Uses = [CC], usesCustomInserter = 1 in {
1465 def "" : Pseudo<(outs), 1470 def "" : Pseudo<(outs),
1466 (ins cls:$new, mode:$addr, uimm8zx4:$valid, uimm8zx4:$cc), 1471 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
1467 [(store (z_select_ccmask cls:$new, (load mode:$addr), 1472 [(store (z_select_ccmask cls:$new, (load mode:$addr),
1468 uimm8zx4:$valid, uimm8zx4:$cc), 1473 imm32zx4:$valid, imm32zx4:$cc),
1469 mode:$addr)]>; 1474 mode:$addr)]>;
1470 def Inv : Pseudo<(outs), 1475 def Inv : Pseudo<(outs),
1471 (ins cls:$new, mode:$addr, uimm8zx4:$valid, uimm8zx4:$cc), 1476 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc),
1472 [(store (z_select_ccmask (load mode:$addr), cls:$new, 1477 [(store (z_select_ccmask (load mode:$addr), cls:$new,
1473 uimm8zx4:$valid, uimm8zx4:$cc), 1478 imm32zx4:$valid, imm32zx4:$cc),
1474 mode:$addr)]>; 1479 mode:$addr)]>;
1475 } 1480 }
1476 } 1481 }
1477 1482
1478 // OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND 1483 // OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND
1596 } 1601 }
1597 1602
1598 // An alias of a RotateSelectRIEf, but with different register sizes. 1603 // An alias of a RotateSelectRIEf, but with different register sizes.
1599 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2> 1604 class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2>
1600 : Alias<6, (outs cls1:$R1), 1605 : Alias<6, (outs cls1:$R1),
1601 (ins cls1:$R1src, cls2:$R2, uimm8:$I3, uimm8:$I4, uimm8zx6:$I5), []> { 1606 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4,
1602 let Constraints = "$R1 = $R1src"; 1607 imm32zx6:$I5), []> {
1603 } 1608 let Constraints = "$R1 = $R1src";
1609 }