@@ -816,8 +816,8 @@ def : BTI<"jc", 0b110>;
816816// TLBI (translation lookaside buffer invalidate) instruction options.
817817//===----------------------------------------------------------------------===//
818818
819- class TLBIEntry <string name, bits<3> op1, bits<4> crn, bits<4> crm,
820- bits<3> op2, bit needsreg> {
819+ class TLBICommon <string name, bits<3> op1, bits<4> crn, bits<4> crm,
820+ bits<3> op2, bit needsreg> {
821821 string Name = name;
822822 bits<14> Encoding;
823823 let Encoding{13-11} = op1;
@@ -830,131 +830,150 @@ class TLBIEntry<string name, bits<3> op1, bits<4> crn, bits<4> crm,
830830 code RequiresStr = [{ { }] # !interleave(Requires # ExtraRequires, [{, }]) # [{ } }];
831831}
832832
833- def TLBITable : GenericTable {
834- let FilterClass = "TLBIEntry";
835- let CppTypeName = "TLBI";
836- let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
837-
838- let PrimaryKey = ["Encoding"];
839- let PrimaryKeyName = "lookupTLBIByEncoding";
833+ class TLBIEntry<string name, bits<3> op1, bits<4> crn, bits<4> crm,
834+ bits<3> op2, bit needsreg>
835+ : TLBICommon<name, op1, crn, crm, op2, needsreg>;
836+
837+ class TLBIPEntry<string name, bits<3> op1, bits<4> crn, bits<4> crm,
838+ bits<3> op2, bit needsreg>
839+ : TLBICommon<name, op1, crn, crm, op2, needsreg>;
840+
841+ multiclass TLBITableBase {
842+ def NAME # Table : GenericTable {
843+ let FilterClass = NAME # "Entry";
844+ let CppTypeName = NAME;
845+ let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
846+ let PrimaryKey = ["Encoding"];
847+ let PrimaryKeyName = "lookup" # NAME # "ByEncoding";
848+ }
849+ def lookup # NAME # ByName : SearchIndex {
850+ let Table = !cast<GenericTable>(NAME # "Table");
851+ let Key = ["Name"];
852+ }
840853}
841854
842- def lookupTLBIByName : SearchIndex {
843- let Table = TLBITable;
844- let Key = ["Name"];
845- }
855+ defm TLBI : TLBITableBase;
856+ defm TLBIP : TLBITableBase;
846857
847- multiclass TLBI<string name, bits<3> op1, bits<4> crn, bits<4> crm,
858+ multiclass TLBI<string name, bit hasTLBIP, bits<3> op1, bits<4> crn, bits<4> crm,
848859 bits<3> op2, bit needsreg = 1> {
849860 def : TLBIEntry<name, op1, crn, crm, op2, needsreg>;
850861 def : TLBIEntry<!strconcat(name, "nXS"), op1, crn, crm, op2, needsreg> {
851862 let Encoding{7} = 1;
852863 let ExtraRequires = ["AArch64::FeatureXS"];
853864 }
865+ if !eq(hasTLBIP, true) then {
866+ def : TLBIPEntry<name, op1, crn, crm, op2, needsreg>;
867+ def : TLBIPEntry<!strconcat(name, "nXS"), op1, crn, crm, op2, needsreg> {
868+ let Encoding{7} = 1;
869+ let ExtraRequires = ["AArch64::FeatureXS"];
870+ }
871+ }
854872}
855873
856- defm : TLBI<"IPAS2E1IS", 0b100, 0b1000, 0b0000, 0b001>;
857- defm : TLBI<"IPAS2LE1IS", 0b100, 0b1000, 0b0000, 0b101>;
858- defm : TLBI<"VMALLE1IS", 0b000, 0b1000, 0b0011, 0b000, 0>;
859- defm : TLBI<"ALLE2IS", 0b100, 0b1000, 0b0011, 0b000, 0>;
860- defm : TLBI<"ALLE3IS", 0b110, 0b1000, 0b0011, 0b000, 0>;
861- defm : TLBI<"VAE1IS", 0b000, 0b1000, 0b0011, 0b001>;
862- defm : TLBI<"VAE2IS", 0b100, 0b1000, 0b0011, 0b001>;
863- defm : TLBI<"VAE3IS", 0b110, 0b1000, 0b0011, 0b001>;
864- defm : TLBI<"ASIDE1IS", 0b000, 0b1000, 0b0011, 0b010>;
865- defm : TLBI<"VAAE1IS", 0b000, 0b1000, 0b0011, 0b011>;
866- defm : TLBI<"ALLE1IS", 0b100, 0b1000, 0b0011, 0b100, 0>;
867- defm : TLBI<"VALE1IS", 0b000, 0b1000, 0b0011, 0b101>;
868- defm : TLBI<"VALE2IS", 0b100, 0b1000, 0b0011, 0b101>;
869- defm : TLBI<"VALE3IS", 0b110, 0b1000, 0b0011, 0b101>;
870- defm : TLBI<"VMALLS12E1IS", 0b100, 0b1000, 0b0011, 0b110, 0>;
871- defm : TLBI<"VAALE1IS", 0b000, 0b1000, 0b0011, 0b111>;
872- defm : TLBI<"IPAS2E1", 0b100, 0b1000, 0b0100, 0b001>;
873- defm : TLBI<"IPAS2LE1", 0b100, 0b1000, 0b0100, 0b101>;
874- defm : TLBI<"VMALLE1", 0b000, 0b1000, 0b0111, 0b000, 0>;
875- defm : TLBI<"ALLE2", 0b100, 0b1000, 0b0111, 0b000, 0>;
876- defm : TLBI<"ALLE3", 0b110, 0b1000, 0b0111, 0b000, 0>;
877- defm : TLBI<"VAE1", 0b000, 0b1000, 0b0111, 0b001>;
878- defm : TLBI<"VAE2", 0b100, 0b1000, 0b0111, 0b001>;
879- defm : TLBI<"VAE3", 0b110, 0b1000, 0b0111, 0b001>;
880- defm : TLBI<"ASIDE1", 0b000, 0b1000, 0b0111, 0b010>;
881- defm : TLBI<"VAAE1", 0b000, 0b1000, 0b0111, 0b011>;
882- defm : TLBI<"ALLE1", 0b100, 0b1000, 0b0111, 0b100, 0>;
883- defm : TLBI<"VALE1", 0b000, 0b1000, 0b0111, 0b101>;
884- defm : TLBI<"VALE2", 0b100, 0b1000, 0b0111, 0b101>;
885- defm : TLBI<"VALE3", 0b110, 0b1000, 0b0111, 0b101>;
886- defm : TLBI<"VMALLS12E1", 0b100, 0b1000, 0b0111, 0b110, 0>;
887- defm : TLBI<"VAALE1", 0b000, 0b1000, 0b0111, 0b111>;
874+ // hasTLBIP op1 CRn CRm op2 needsreg
875+ defm : TLBI<"IPAS2E1IS", 1, 0b100, 0b1000, 0b0000, 0b001>;
876+ defm : TLBI<"IPAS2LE1IS", 1, 0b100, 0b1000, 0b0000, 0b101>;
877+ defm : TLBI<"VMALLE1IS", 0, 0b000, 0b1000, 0b0011, 0b000, 0>;
878+ defm : TLBI<"ALLE2IS", 0, 0b100, 0b1000, 0b0011, 0b000, 0>;
879+ defm : TLBI<"ALLE3IS", 0, 0b110, 0b1000, 0b0011, 0b000, 0>;
880+ defm : TLBI<"VAE1IS", 1, 0b000, 0b1000, 0b0011, 0b001>;
881+ defm : TLBI<"VAE2IS", 1, 0b100, 0b1000, 0b0011, 0b001>;
882+ defm : TLBI<"VAE3IS", 1, 0b110, 0b1000, 0b0011, 0b001>;
883+ defm : TLBI<"ASIDE1IS", 0, 0b000, 0b1000, 0b0011, 0b010>;
884+ defm : TLBI<"VAAE1IS", 1, 0b000, 0b1000, 0b0011, 0b011>;
885+ defm : TLBI<"ALLE1IS", 0, 0b100, 0b1000, 0b0011, 0b100, 0>;
886+ defm : TLBI<"VALE1IS", 1, 0b000, 0b1000, 0b0011, 0b101>;
887+ defm : TLBI<"VALE2IS", 1, 0b100, 0b1000, 0b0011, 0b101>;
888+ defm : TLBI<"VALE3IS", 1, 0b110, 0b1000, 0b0011, 0b101>;
889+ defm : TLBI<"VMALLS12E1IS", 0, 0b100, 0b1000, 0b0011, 0b110, 0>;
890+ defm : TLBI<"VAALE1IS", 1, 0b000, 0b1000, 0b0011, 0b111>;
891+ defm : TLBI<"IPAS2E1", 1, 0b100, 0b1000, 0b0100, 0b001>;
892+ defm : TLBI<"IPAS2LE1", 1, 0b100, 0b1000, 0b0100, 0b101>;
893+ defm : TLBI<"VMALLE1", 0, 0b000, 0b1000, 0b0111, 0b000, 0>;
894+ defm : TLBI<"ALLE2", 0, 0b100, 0b1000, 0b0111, 0b000, 0>;
895+ defm : TLBI<"ALLE3", 0, 0b110, 0b1000, 0b0111, 0b000, 0>;
896+ defm : TLBI<"VAE1", 1, 0b000, 0b1000, 0b0111, 0b001>;
897+ defm : TLBI<"VAE2", 1, 0b100, 0b1000, 0b0111, 0b001>;
898+ defm : TLBI<"VAE3", 1, 0b110, 0b1000, 0b0111, 0b001>;
899+ defm : TLBI<"ASIDE1", 0, 0b000, 0b1000, 0b0111, 0b010>;
900+ defm : TLBI<"VAAE1", 1, 0b000, 0b1000, 0b0111, 0b011>;
901+ defm : TLBI<"ALLE1", 0, 0b100, 0b1000, 0b0111, 0b100, 0>;
902+ defm : TLBI<"VALE1", 1, 0b000, 0b1000, 0b0111, 0b101>;
903+ defm : TLBI<"VALE2", 1, 0b100, 0b1000, 0b0111, 0b101>;
904+ defm : TLBI<"VALE3", 1, 0b110, 0b1000, 0b0111, 0b101>;
905+ defm : TLBI<"VMALLS12E1", 0, 0b100, 0b1000, 0b0111, 0b110, 0>;
906+ defm : TLBI<"VAALE1", 1, 0b000, 0b1000, 0b0111, 0b111>;
888907
889908// Armv8.4-A Translation Lookaside Buffer Instructions (TLBI)
890909let Requires = ["AArch64::FeatureTLB_RMI"] in {
891910// Armv8.4-A Outer Sharable TLB Maintenance instructions:
892- // op1 CRn CRm op2
893- defm : TLBI<"VMALLE1OS", 0b000, 0b1000, 0b0001, 0b000, 0>;
894- defm : TLBI<"VAE1OS", 0b000, 0b1000, 0b0001, 0b001>;
895- defm : TLBI<"ASIDE1OS", 0b000, 0b1000, 0b0001, 0b010>;
896- defm : TLBI<"VAAE1OS", 0b000, 0b1000, 0b0001, 0b011>;
897- defm : TLBI<"VALE1OS", 0b000, 0b1000, 0b0001, 0b101>;
898- defm : TLBI<"VAALE1OS", 0b000, 0b1000, 0b0001, 0b111>;
899- defm : TLBI<"IPAS2E1OS", 0b100, 0b1000, 0b0100, 0b000>;
900- defm : TLBI<"IPAS2LE1OS", 0b100, 0b1000, 0b0100, 0b100>;
901- defm : TLBI<"VAE2OS", 0b100, 0b1000, 0b0001, 0b001>;
902- defm : TLBI<"VALE2OS", 0b100, 0b1000, 0b0001, 0b101>;
903- defm : TLBI<"VMALLS12E1OS", 0b100, 0b1000, 0b0001, 0b110, 0>;
904- defm : TLBI<"VAE3OS", 0b110, 0b1000, 0b0001, 0b001>;
905- defm : TLBI<"VALE3OS", 0b110, 0b1000, 0b0001, 0b101>;
906- defm : TLBI<"ALLE2OS", 0b100, 0b1000, 0b0001, 0b000, 0>;
907- defm : TLBI<"ALLE1OS", 0b100, 0b1000, 0b0001, 0b100, 0>;
908- defm : TLBI<"ALLE3OS", 0b110, 0b1000, 0b0001, 0b000, 0>;
911+ // hasTLBIP op1 CRn CRm op2 needsreg
912+ defm : TLBI<"VMALLE1OS", 0, 0b000, 0b1000, 0b0001, 0b000, 0>;
913+ defm : TLBI<"VAE1OS", 1, 0b000, 0b1000, 0b0001, 0b001>;
914+ defm : TLBI<"ASIDE1OS", 0, 0b000, 0b1000, 0b0001, 0b010>;
915+ defm : TLBI<"VAAE1OS", 1, 0b000, 0b1000, 0b0001, 0b011>;
916+ defm : TLBI<"VALE1OS", 1, 0b000, 0b1000, 0b0001, 0b101>;
917+ defm : TLBI<"VAALE1OS", 1, 0b000, 0b1000, 0b0001, 0b111>;
918+ defm : TLBI<"IPAS2E1OS", 1, 0b100, 0b1000, 0b0100, 0b000>;
919+ defm : TLBI<"IPAS2LE1OS", 1, 0b100, 0b1000, 0b0100, 0b100>;
920+ defm : TLBI<"VAE2OS", 1, 0b100, 0b1000, 0b0001, 0b001>;
921+ defm : TLBI<"VALE2OS", 1, 0b100, 0b1000, 0b0001, 0b101>;
922+ defm : TLBI<"VMALLS12E1OS", 0, 0b100, 0b1000, 0b0001, 0b110, 0>;
923+ defm : TLBI<"VAE3OS", 1, 0b110, 0b1000, 0b0001, 0b001>;
924+ defm : TLBI<"VALE3OS", 1, 0b110, 0b1000, 0b0001, 0b101>;
925+ defm : TLBI<"ALLE2OS", 0, 0b100, 0b1000, 0b0001, 0b000, 0>;
926+ defm : TLBI<"ALLE1OS", 0, 0b100, 0b1000, 0b0001, 0b100, 0>;
927+ defm : TLBI<"ALLE3OS", 0, 0b110, 0b1000, 0b0001, 0b000, 0>;
909928
910929// Armv8.4-A TLB Range Maintenance instructions:
911- // op1 CRn CRm op2
912- defm : TLBI<"RVAE1", 0b000, 0b1000, 0b0110, 0b001>;
913- defm : TLBI<"RVAAE1", 0b000, 0b1000, 0b0110, 0b011>;
914- defm : TLBI<"RVALE1", 0b000, 0b1000, 0b0110, 0b101>;
915- defm : TLBI<"RVAALE1", 0b000, 0b1000, 0b0110, 0b111>;
916- defm : TLBI<"RVAE1IS", 0b000, 0b1000, 0b0010, 0b001>;
917- defm : TLBI<"RVAAE1IS", 0b000, 0b1000, 0b0010, 0b011>;
918- defm : TLBI<"RVALE1IS", 0b000, 0b1000, 0b0010, 0b101>;
919- defm : TLBI<"RVAALE1IS", 0b000, 0b1000, 0b0010, 0b111>;
920- defm : TLBI<"RVAE1OS", 0b000, 0b1000, 0b0101, 0b001>;
921- defm : TLBI<"RVAAE1OS", 0b000, 0b1000, 0b0101, 0b011>;
922- defm : TLBI<"RVALE1OS", 0b000, 0b1000, 0b0101, 0b101>;
923- defm : TLBI<"RVAALE1OS", 0b000, 0b1000, 0b0101, 0b111>;
924- defm : TLBI<"RIPAS2E1IS", 0b100, 0b1000, 0b0000, 0b010>;
925- defm : TLBI<"RIPAS2LE1IS", 0b100, 0b1000, 0b0000, 0b110>;
926- defm : TLBI<"RIPAS2E1", 0b100, 0b1000, 0b0100, 0b010>;
927- defm : TLBI<"RIPAS2LE1", 0b100, 0b1000, 0b0100, 0b110>;
928- defm : TLBI<"RIPAS2E1OS", 0b100, 0b1000, 0b0100, 0b011>;
929- defm : TLBI<"RIPAS2LE1OS", 0b100, 0b1000, 0b0100, 0b111>;
930- defm : TLBI<"RVAE2", 0b100, 0b1000, 0b0110, 0b001>;
931- defm : TLBI<"RVALE2", 0b100, 0b1000, 0b0110, 0b101>;
932- defm : TLBI<"RVAE2IS", 0b100, 0b1000, 0b0010, 0b001>;
933- defm : TLBI<"RVALE2IS", 0b100, 0b1000, 0b0010, 0b101>;
934- defm : TLBI<"RVAE2OS", 0b100, 0b1000, 0b0101, 0b001>;
935- defm : TLBI<"RVALE2OS", 0b100, 0b1000, 0b0101, 0b101>;
936- defm : TLBI<"RVAE3", 0b110, 0b1000, 0b0110, 0b001>;
937- defm : TLBI<"RVALE3", 0b110, 0b1000, 0b0110, 0b101>;
938- defm : TLBI<"RVAE3IS", 0b110, 0b1000, 0b0010, 0b001>;
939- defm : TLBI<"RVALE3IS", 0b110, 0b1000, 0b0010, 0b101>;
940- defm : TLBI<"RVAE3OS", 0b110, 0b1000, 0b0101, 0b001>;
941- defm : TLBI<"RVALE3OS", 0b110, 0b1000, 0b0101, 0b101>;
930+ // hasTLBIP op1 CRn CRm op2 needsreg
931+ defm : TLBI<"RVAE1", 1, 0b000, 0b1000, 0b0110, 0b001>;
932+ defm : TLBI<"RVAAE1", 1, 0b000, 0b1000, 0b0110, 0b011>;
933+ defm : TLBI<"RVALE1", 1, 0b000, 0b1000, 0b0110, 0b101>;
934+ defm : TLBI<"RVAALE1", 1, 0b000, 0b1000, 0b0110, 0b111>;
935+ defm : TLBI<"RVAE1IS", 1, 0b000, 0b1000, 0b0010, 0b001>;
936+ defm : TLBI<"RVAAE1IS", 1, 0b000, 0b1000, 0b0010, 0b011>;
937+ defm : TLBI<"RVALE1IS", 1, 0b000, 0b1000, 0b0010, 0b101>;
938+ defm : TLBI<"RVAALE1IS", 1, 0b000, 0b1000, 0b0010, 0b111>;
939+ defm : TLBI<"RVAE1OS", 1, 0b000, 0b1000, 0b0101, 0b001>;
940+ defm : TLBI<"RVAAE1OS", 1, 0b000, 0b1000, 0b0101, 0b011>;
941+ defm : TLBI<"RVALE1OS", 1, 0b000, 0b1000, 0b0101, 0b101>;
942+ defm : TLBI<"RVAALE1OS", 1, 0b000, 0b1000, 0b0101, 0b111>;
943+ defm : TLBI<"RIPAS2E1IS", 1, 0b100, 0b1000, 0b0000, 0b010>;
944+ defm : TLBI<"RIPAS2LE1IS", 1, 0b100, 0b1000, 0b0000, 0b110>;
945+ defm : TLBI<"RIPAS2E1", 1, 0b100, 0b1000, 0b0100, 0b010>;
946+ defm : TLBI<"RIPAS2LE1", 1, 0b100, 0b1000, 0b0100, 0b110>;
947+ defm : TLBI<"RIPAS2E1OS", 1, 0b100, 0b1000, 0b0100, 0b011>;
948+ defm : TLBI<"RIPAS2LE1OS", 1, 0b100, 0b1000, 0b0100, 0b111>;
949+ defm : TLBI<"RVAE2", 1, 0b100, 0b1000, 0b0110, 0b001>;
950+ defm : TLBI<"RVALE2", 1, 0b100, 0b1000, 0b0110, 0b101>;
951+ defm : TLBI<"RVAE2IS", 1, 0b100, 0b1000, 0b0010, 0b001>;
952+ defm : TLBI<"RVALE2IS", 1, 0b100, 0b1000, 0b0010, 0b101>;
953+ defm : TLBI<"RVAE2OS", 1, 0b100, 0b1000, 0b0101, 0b001>;
954+ defm : TLBI<"RVALE2OS", 1, 0b100, 0b1000, 0b0101, 0b101>;
955+ defm : TLBI<"RVAE3", 1, 0b110, 0b1000, 0b0110, 0b001>;
956+ defm : TLBI<"RVALE3", 1, 0b110, 0b1000, 0b0110, 0b101>;
957+ defm : TLBI<"RVAE3IS", 1, 0b110, 0b1000, 0b0010, 0b001>;
958+ defm : TLBI<"RVALE3IS", 1, 0b110, 0b1000, 0b0010, 0b101>;
959+ defm : TLBI<"RVAE3OS", 1, 0b110, 0b1000, 0b0101, 0b001>;
960+ defm : TLBI<"RVALE3OS", 1, 0b110, 0b1000, 0b0101, 0b101>;
942961} //FeatureTLB_RMI
943962
944963// Armv9-A Realm Management Extension TLBI Instructions
945964let Requires = ["AArch64::FeatureRME"] in {
946- defm : TLBI<"RPAOS", 0b110, 0b1000, 0b0100, 0b011>;
947- defm : TLBI<"RPALOS", 0b110, 0b1000, 0b0100, 0b111>;
948- defm : TLBI<"PAALLOS", 0b110, 0b1000, 0b0001, 0b100, 0>;
949- defm : TLBI<"PAALL", 0b110, 0b1000, 0b0111, 0b100, 0>;
965+ defm : TLBI<"RPAOS", 0, 0b110, 0b1000, 0b0100, 0b011>;
966+ defm : TLBI<"RPALOS", 0, 0b110, 0b1000, 0b0100, 0b111>;
967+ defm : TLBI<"PAALLOS", 0, 0b110, 0b1000, 0b0001, 0b100, 0>;
968+ defm : TLBI<"PAALL", 0, 0b110, 0b1000, 0b0111, 0b100, 0>;
950969}
951970
952971// Armv9.5-A TLBI VMALL for Dirty State
953972let Requires = ["AArch64::FeatureTLBIW"] in {
954- // op1, CRn, CRm, op2, needsreg
955- defm : TLBI<"VMALLWS2E1", 0b100, 0b1000, 0b0110, 0b010, 0>;
956- defm : TLBI<"VMALLWS2E1IS", 0b100, 0b1000, 0b0010, 0b010, 0>;
957- defm : TLBI<"VMALLWS2E1OS", 0b100, 0b1000, 0b0101, 0b010, 0>;
973+ // op1, CRn, CRm, op2, needsreg
974+ defm : TLBI<"VMALLWS2E1", 0, 0b100, 0b1000, 0b0110, 0b010, 0>;
975+ defm : TLBI<"VMALLWS2E1IS", 0, 0b100, 0b1000, 0b0010, 0b010, 0>;
976+ defm : TLBI<"VMALLWS2E1OS", 0, 0b100, 0b1000, 0b0101, 0b010, 0>;
958977}
959978
960979//===----------------------------------------------------------------------===//
0 commit comments