@@ -2493,3 +2493,206 @@ def : MLBI<"ALLE1", 0b100, 0b0111, 0b0000, 0b100, 0>;
24932493def : MLBI<"VMALLE1", 0b100, 0b0111, 0b0000, 0b101, 0>;
24942494def : MLBI<"VPIDE1", 0b100, 0b0111, 0b0000, 0b110, 1>;
24952495def : MLBI<"VPMGE1", 0b100, 0b0111, 0b0000, 0b111, 1>;
2496+
2497+
2498+ // v9.7-A GICv5 (FEAT_GCIE)
2499+ // CPU Interface Registers
2500+ // Op0 Op1 CRn CRm Op2
2501+ def : RWSysReg<"ICC_APR_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b000>;
2502+ def : RWSysReg<"ICC_APR_EL3", 0b11, 0b110, 0b1100, 0b1000, 0b000>;
2503+ def : RWSysReg<"ICC_CR0_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b001>;
2504+ def : RWSysReg<"ICC_CR0_EL3", 0b11, 0b110, 0b1100, 0b1001, 0b000>;
2505+ def : ROSysReg<"ICC_DOMHPPIR_EL3", 0b11, 0b110, 0b1100, 0b1000, 0b010>;
2506+ def : ROSysReg<"ICC_HAPR_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b011>;
2507+ def : ROSysReg<"ICC_HPPIR_EL1", 0b11, 0b000, 0b1100, 0b1010, 0b011>;
2508+ def : ROSysReg<"ICC_HPPIR_EL3", 0b11, 0b110, 0b1100, 0b1001, 0b001>;
2509+ def : ROSysReg<"ICC_IAFFIDR_EL1", 0b11, 0b000, 0b1100, 0b1010, 0b101>;
2510+ def : RWSysReg<"ICC_ICSR_EL1", 0b11, 0b000, 0b1100, 0b1010, 0b100>;
2511+ def : ROSysReg<"ICC_IDR0_EL1", 0b11, 0b000, 0b1100, 0b1010, 0b010>;
2512+ def : RWSysReg<"ICC_PCR_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b010>;
2513+ def : RWSysReg<"ICC_PCR_EL3", 0b11, 0b110, 0b1100, 0b1000, 0b001>;
2514+
2515+ // Virtual CPU Interface Registers
2516+ // Op0 Op1 CRn CRm Op2
2517+ def : RWSysReg<"ICV_APR_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b000>;
2518+ def : RWSysReg<"ICV_CR0_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b001>;
2519+ def : RWSysReg<"ICV_HAPR_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b011>;
2520+ def : RWSysReg<"ICV_HPPIR_EL1", 0b11, 0b000, 0b1100, 0b1010, 0b011>;
2521+ def : RWSysReg<"ICV_PCR_EL1", 0b11, 0b001, 0b1100, 0b0000, 0b010>;
2522+
2523+ foreach n=0-3 in {
2524+ defvar nb = !cast<bits<2>>(n);
2525+ // Op0 Op1 CRn CRm Op2
2526+ def : RWSysReg<"ICC_PPI_DOMAINR"#n#"_EL3", 0b11, 0b110, 0b1100, 0b1000, {0b1,nb{1-0}}>;
2527+
2528+ }
2529+
2530+ foreach n=0-15 in{
2531+ defvar nb = !cast<bits<4>>(n);
2532+ // Op0 Op1 CRn CRm Op2
2533+ def : RWSysReg<"ICC_PPI_PRIORITYR"#n#"_EL1", 0b11, 0b000, 0b1100, {0b111,nb{3}}, nb{2-0}>;
2534+ }
2535+
2536+ // PPI and Virtual PPI Registers
2537+ multiclass PPIRegisters<string prefix> {
2538+ foreach n=0-1 in {
2539+ defvar nb = !cast<bit>(n);
2540+ // Op0 Op1 CRn CRm Op2
2541+ def : RWSysReg<prefix#"_PPI_CACTIVER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b00,nb}>;
2542+ def : RWSysReg<prefix#"_PPI_CPENDR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b10,nb}>;
2543+ def : RWSysReg<prefix#"_PPI_ENABLER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1010, {0b11,nb}>;
2544+ def : RWSysReg<prefix#"_PPI_SACTIVER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b01,nb}>;
2545+ def : RWSysReg<prefix#"_PPI_SPENDR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b11,nb}>;
2546+ def : RWSysReg<prefix#"_PPI_HMR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1010, {0b00,nb}>;
2547+ }
2548+ }
2549+
2550+ defm : PPIRegisters<"ICC">; // PPI Registers
2551+ defm : PPIRegisters<"ICV">; // Virtual PPI Registers
2552+
2553+ foreach n=0-15 in {
2554+ defvar nb = !cast<bits<4>>(n);
2555+ // Op0 Op1 CRn CRm Op2
2556+ def : RWSysReg<"ICV_PPI_PRIORITYR"#n#"_EL1", 0b11, 0b000, 0b1100, {0b111,nb{3}}, nb{2-0}>;
2557+ }
2558+
2559+ // Hypervisor Control Registers
2560+ // Op0 Op1 CRn CRm Op2
2561+ def : RWSysReg<"ICH_APR_EL2", 0b11, 0b100, 0b1100, 0b1000, 0b100>;
2562+ def : RWSysReg<"ICH_CONTEXTR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b110>;
2563+ def : RWSysReg<"ICH_HFGITR_EL2", 0b11, 0b100, 0b1100, 0b1001, 0b111>;
2564+ def : RWSysReg<"ICH_HFGRTR_EL2", 0b11, 0b100, 0b1100, 0b1001, 0b100>;
2565+ def : RWSysReg<"ICH_HFGWTR_EL2", 0b11, 0b100, 0b1100, 0b1001, 0b110>;
2566+ def : ROSysReg<"ICH_HPPIR_EL2", 0b11, 0b100, 0b1100, 0b1000, 0b101>;
2567+ def : RWSysReg<"ICH_VCTLR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b100>;
2568+
2569+ foreach n=0-1 in {
2570+ defvar nb = !cast<bit>(n);
2571+ // Op0 Op1 CRn CRm Op2
2572+ def : RWSysReg<"ICH_PPI_ACTIVER"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b11,nb}>;
2573+ def : RWSysReg<"ICH_PPI_DVIR"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b00,nb}>;
2574+ def : RWSysReg<"ICH_PPI_ENABLER"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b01,nb}>;
2575+ def : RWSysReg<"ICH_PPI_PENDR"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b10,nb}>;
2576+ }
2577+
2578+ foreach n=0-15 in {
2579+ defvar nb = !cast<bits<4>>(n);
2580+ // Op0 Op1 CRn CRm Op2
2581+ def : RWSysReg<"ICH_PPI_PRIORITYR"#n#"_EL2", 0b11, 0b100, 0b1100, {0b111,nb{3}}, nb{2-0}>;
2582+ }
2583+
2584+ //===----------------------------------------------------------------------===//
2585+ // GICv5 instruction options.
2586+ //===----------------------------------------------------------------------===//
2587+
2588+ // GIC
2589+ class GIC<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2> {
2590+ string Name = name;
2591+ bits<14> Encoding;
2592+ let Encoding{13-11} = op1;
2593+ let Encoding{10-7} = crn;
2594+ let Encoding{6-3} = crm;
2595+ let Encoding{2-0} = op2;
2596+ bit NeedsReg = 1;
2597+ string RequiresStr = [{ {AArch64::FeatureGCIE} }];
2598+ }
2599+
2600+ // GSB
2601+ class GSB<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2> {
2602+ string Name = name;
2603+ bits<14> Encoding;
2604+ let Encoding{13-11} = op1;
2605+ let Encoding{10-7} = crn;
2606+ let Encoding{6-3} = crm;
2607+ let Encoding{2-0} = op2;
2608+ string RequiresStr = [{ {AArch64::FeatureGCIE} }];
2609+ }
2610+
2611+ // GICR
2612+ class GICR<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2> {
2613+ string Name = name;
2614+ bits<14> Encoding;
2615+ let Encoding{13-11} = op1;
2616+ let Encoding{10-7} = crn;
2617+ let Encoding{6-3} = crm;
2618+ let Encoding{2-0} = op2;
2619+ bit NeedsReg = 1;
2620+ string RequiresStr = [{ {AArch64::FeatureGCIE} }];
2621+ }
2622+
2623+ def GICTable : GenericTable {
2624+ let FilterClass = "GIC";
2625+ let CppTypeName = "GIC";
2626+ let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
2627+
2628+ let PrimaryKey = ["Encoding"];
2629+ let PrimaryKeyName = "lookupGICByEncoding";
2630+ }
2631+
2632+ def GSBTable : GenericTable {
2633+ let FilterClass = "GSB";
2634+ let CppTypeName = "GSB";
2635+ let Fields = ["Name", "Encoding", "RequiresStr"];
2636+
2637+ let PrimaryKey = ["Encoding"];
2638+ let PrimaryKeyName = "lookupGSBByEncoding";
2639+ }
2640+
2641+ def GICRTable : GenericTable {
2642+ let FilterClass = "GICR";
2643+ let CppTypeName = "GICR";
2644+ let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
2645+
2646+ let PrimaryKey = ["Encoding"];
2647+ let PrimaryKeyName = "lookupGICRByEncoding";
2648+ }
2649+
2650+ def lookupGICByName : SearchIndex {
2651+ let Table = GICTable;
2652+ let Key = ["Name"];
2653+ }
2654+
2655+ def lookupGSBByName : SearchIndex {
2656+ let Table = GSBTable;
2657+ let Key = ["Name"];
2658+ }
2659+
2660+ def lookupGICRByName : SearchIndex {
2661+ let Table = GICRTable;
2662+ let Key = ["Name"];
2663+ }
2664+
2665+ // Op1 CRn CRm Op2
2666+ def : GSB<"sys", 0b000, 0b1100, 0b0000, 0b000>;
2667+ def : GSB<"ack", 0b000, 0b1100, 0b0000, 0b001>;
2668+
2669+ // Op1 CRn CRm Op2
2670+ def : GICR<"cdia", 0b000, 0b1100, 0b0011, 0b000>;
2671+ def : GICR<"cdnmia", 0b000, 0b1100, 0b0011, 0b001>;
2672+
2673+ // Op1 CRn CRm Op2
2674+ def : GIC<"cdaff", 0b000, 0b1100, 0b0001, 0b011>;
2675+ def : GIC<"cddi", 0b000, 0b1100, 0b0010, 0b000>;
2676+ def : GIC<"cddis", 0b000, 0b1100, 0b0001, 0b000>;
2677+ def : GIC<"cden", 0b000, 0b1100, 0b0001, 0b001>;
2678+ def : GIC<"cdeoi", 0b000, 0b1100, 0b0001, 0b111>;
2679+ def : GIC<"cdhm", 0b000, 0b1100, 0b0010, 0b001>;
2680+ def : GIC<"cdpend", 0b000, 0b1100, 0b0001, 0b100>;
2681+ def : GIC<"cdpri", 0b000, 0b1100, 0b0001, 0b010>;
2682+ def : GIC<"cdrcfg", 0b000, 0b1100, 0b0001, 0b101>;
2683+ def : GIC<"vdaff", 0b100, 0b1100, 0b0001, 0b011>;
2684+ def : GIC<"vddi", 0b100, 0b1100, 0b0010, 0b000>;
2685+ def : GIC<"vddis", 0b100, 0b1100, 0b0001, 0b000>;
2686+ def : GIC<"vden", 0b100, 0b1100, 0b0001, 0b001>;
2687+ def : GIC<"vdhm", 0b100, 0b1100, 0b0010, 0b001>;
2688+ def : GIC<"vdpend", 0b100, 0b1100, 0b0001, 0b100>;
2689+ def : GIC<"vdpri", 0b100, 0b1100, 0b0001, 0b010>;
2690+ def : GIC<"vdrcfg", 0b100, 0b1100, 0b0001, 0b101>;
2691+ def : GIC<"ldaff", 0b110, 0b1100, 0b0001, 0b011>;
2692+ def : GIC<"lddi", 0b110, 0b1100, 0b0010, 0b000>;
2693+ def : GIC<"lddis", 0b110, 0b1100, 0b0001, 0b000>;
2694+ def : GIC<"lden", 0b110, 0b1100, 0b0001, 0b001>;
2695+ def : GIC<"ldhm", 0b110, 0b1100, 0b0010, 0b001>;
2696+ def : GIC<"ldpend", 0b110, 0b1100, 0b0001, 0b100>;
2697+ def : GIC<"ldpri", 0b110, 0b1100, 0b0001, 0b010>;
2698+ def : GIC<"ldrcfg", 0b110, 0b1100, 0b0001, 0b101>;
0 commit comments