@@ -615,7 +615,8 @@ def spe4rc : RegisterOperand<GPRC> {
615615}
616616
617617def PPCU1ImmAsmOperand : AsmOperandClass {
618- let Name = "U1Imm"; let PredicateMethod = "isU1Imm";
618+ let Name = "U1Imm";
619+ let PredicateMethod = "isUImm<1>";
619620 let RenderMethod = "addImmOperands";
620621}
621622def u1imm : Operand<i32> {
@@ -626,7 +627,8 @@ def u1imm : Operand<i32> {
626627}
627628
628629def PPCU2ImmAsmOperand : AsmOperandClass {
629- let Name = "U2Imm"; let PredicateMethod = "isU2Imm";
630+ let Name = "U2Imm";
631+ let PredicateMethod = "isUImm<2>";
630632 let RenderMethod = "addImmOperands";
631633}
632634def u2imm : Operand<i32> {
@@ -647,7 +649,8 @@ def atimm : Operand<i32> {
647649}
648650
649651def PPCU3ImmAsmOperand : AsmOperandClass {
650- let Name = "U3Imm"; let PredicateMethod = "isU3Imm";
652+ let Name = "U3Imm";
653+ let PredicateMethod = "isUImm<3>";
651654 let RenderMethod = "addImmOperands";
652655}
653656def u3imm : Operand<i32> {
@@ -658,7 +661,8 @@ def u3imm : Operand<i32> {
658661}
659662
660663def PPCU4ImmAsmOperand : AsmOperandClass {
661- let Name = "U4Imm"; let PredicateMethod = "isU4Imm";
664+ let Name = "U4Imm";
665+ let PredicateMethod = "isUImm<4>";
662666 let RenderMethod = "addImmOperands";
663667}
664668def u4imm : Operand<i32> {
@@ -668,7 +672,8 @@ def u4imm : Operand<i32> {
668672 let OperandType = "OPERAND_IMMEDIATE";
669673}
670674def PPCS5ImmAsmOperand : AsmOperandClass {
671- let Name = "S5Imm"; let PredicateMethod = "isS5Imm";
675+ let Name = "S5Imm";
676+ let PredicateMethod = "isSImm<5>";
672677 let RenderMethod = "addImmOperands";
673678}
674679def s5imm : Operand<i32> {
@@ -678,7 +683,8 @@ def s5imm : Operand<i32> {
678683 let OperandType = "OPERAND_IMMEDIATE";
679684}
680685def PPCU5ImmAsmOperand : AsmOperandClass {
681- let Name = "U5Imm"; let PredicateMethod = "isU5Imm";
686+ let Name = "U5Imm";
687+ let PredicateMethod = "isUImm<5>";
682688 let RenderMethod = "addImmOperands";
683689}
684690def u5imm : Operand<i32> {
@@ -688,7 +694,8 @@ def u5imm : Operand<i32> {
688694 let OperandType = "OPERAND_IMMEDIATE";
689695}
690696def PPCU6ImmAsmOperand : AsmOperandClass {
691- let Name = "U6Imm"; let PredicateMethod = "isU6Imm";
697+ let Name = "U6Imm";
698+ let PredicateMethod = "isUImm<6>";
692699 let RenderMethod = "addImmOperands";
693700}
694701def u6imm : Operand<i32> {
@@ -698,7 +705,8 @@ def u6imm : Operand<i32> {
698705 let OperandType = "OPERAND_IMMEDIATE";
699706}
700707def PPCU7ImmAsmOperand : AsmOperandClass {
701- let Name = "U7Imm"; let PredicateMethod = "isU7Imm";
708+ let Name = "U7Imm";
709+ let PredicateMethod = "isUImm<7>";
702710 let RenderMethod = "addImmOperands";
703711}
704712def u7imm : Operand<i32> {
@@ -708,7 +716,8 @@ def u7imm : Operand<i32> {
708716 let OperandType = "OPERAND_IMMEDIATE";
709717}
710718def PPCU8ImmAsmOperand : AsmOperandClass {
711- let Name = "U8Imm"; let PredicateMethod = "isU8Imm";
719+ let Name = "U8Imm";
720+ let PredicateMethod = "isUImm<8>";
712721 let RenderMethod = "addImmOperands";
713722}
714723def u8imm : Operand<i32> {
@@ -718,7 +727,8 @@ def u8imm : Operand<i32> {
718727 let OperandType = "OPERAND_IMMEDIATE";
719728}
720729def PPCU10ImmAsmOperand : AsmOperandClass {
721- let Name = "U10Imm"; let PredicateMethod = "isU10Imm";
730+ let Name = "U10Imm";
731+ let PredicateMethod = "isUImm<10>";
722732 let RenderMethod = "addImmOperands";
723733}
724734def u10imm : Operand<i32> {
@@ -728,7 +738,8 @@ def u10imm : Operand<i32> {
728738 let OperandType = "OPERAND_IMMEDIATE";
729739}
730740def PPCU12ImmAsmOperand : AsmOperandClass {
731- let Name = "U12Imm"; let PredicateMethod = "isU12Imm";
741+ let Name = "U12Imm";
742+ let PredicateMethod = "isUImm<12>";
732743 let RenderMethod = "addImmOperands";
733744}
734745def u12imm : Operand<i32> {
@@ -743,7 +754,14 @@ def PPCS16ImmAsmOperand : AsmOperandClass {
743754}
744755def s16imm : Operand<i32> {
745756 let PrintMethod = "printS16ImmOperand";
746- let EncoderMethod = "getImm16Encoding";
757+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_half16>";
758+ let ParserMatchClass = PPCS16ImmAsmOperand;
759+ let DecoderMethod = "decodeSImmOperand<16>";
760+ let OperandType = "OPERAND_IMMEDIATE";
761+ }
762+ def s16imm64 : Operand<i64> {
763+ let PrintMethod = "printS16ImmOperand";
764+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_half16>";
747765 let ParserMatchClass = PPCS16ImmAsmOperand;
748766 let DecoderMethod = "decodeSImmOperand<16>";
749767 let OperandType = "OPERAND_IMMEDIATE";
@@ -754,7 +772,14 @@ def PPCU16ImmAsmOperand : AsmOperandClass {
754772}
755773def u16imm : Operand<i32> {
756774 let PrintMethod = "printU16ImmOperand";
757- let EncoderMethod = "getImm16Encoding";
775+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_half16>";
776+ let ParserMatchClass = PPCU16ImmAsmOperand;
777+ let DecoderMethod = "decodeUImmOperand<16>";
778+ let OperandType = "OPERAND_IMMEDIATE";
779+ }
780+ def u16imm64 : Operand<i64> {
781+ let PrintMethod = "printU16ImmOperand";
782+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_half16>";
758783 let ParserMatchClass = PPCU16ImmAsmOperand;
759784 let DecoderMethod = "decodeUImmOperand<16>";
760785 let OperandType = "OPERAND_IMMEDIATE";
@@ -768,7 +793,17 @@ def s17imm : Operand<i32> {
768793 // to accept immediates in the range -65536..65535 for compatibility with
769794 // the GNU assembler. The operand is treated as 16-bit otherwise.
770795 let PrintMethod = "printS16ImmOperand";
771- let EncoderMethod = "getImm16Encoding";
796+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_half16>";
797+ let ParserMatchClass = PPCS17ImmAsmOperand;
798+ let DecoderMethod = "decodeSImmOperand<16>";
799+ let OperandType = "OPERAND_IMMEDIATE";
800+ }
801+ def s17imm64 : Operand<i64> {
802+ // This operand type is used for addis/lis to allow the assembler parser
803+ // to accept immediates in the range -65536..65535 for compatibility with
804+ // the GNU assembler. The operand is treated as 16-bit otherwise.
805+ let PrintMethod = "printS16ImmOperand";
806+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_half16>";
772807 let ParserMatchClass = PPCS17ImmAsmOperand;
773808 let DecoderMethod = "decodeSImmOperand<16>";
774809 let OperandType = "OPERAND_IMMEDIATE";
@@ -780,14 +815,14 @@ def PPCS34ImmAsmOperand : AsmOperandClass {
780815}
781816def s34imm : Operand<i64> {
782817 let PrintMethod = "printS34ImmOperand";
783- let EncoderMethod = "getImm34EncodingNoPCRel ";
818+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_imm34> ";
784819 let ParserMatchClass = PPCS34ImmAsmOperand;
785820 let DecoderMethod = "decodeSImmOperand<34>";
786821 let OperandType = "OPERAND_IMMEDIATE";
787822}
788823def s34imm_pcrel : Operand<i64> {
789824 let PrintMethod = "printS34ImmOperand";
790- let EncoderMethod = "getImm34EncodingPCRel ";
825+ let EncoderMethod = "getImmEncoding<PPC::fixup_ppc_pcrel34> ";
791826 let ParserMatchClass = PPCS34ImmAsmOperand;
792827 let DecoderMethod = "decodeSImmOperand<34>";
793828 let OperandType = "OPERAND_IMMEDIATE";
0 commit comments