@@ -2493,3 +2493,211 @@ 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+ // PPI Registers
2524+ foreach n=0-1 in {
2525+ defvar nb = !cast<bit>(n);
2526+ // Op0 Op1 CRn CRm Op2
2527+ def : RWSysReg<"ICC_PPI_CACTIVER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b00,nb}>;
2528+ def : RWSysReg<"ICC_PPI_CPENDR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b10,nb}>;
2529+ def : RWSysReg<"ICC_PPI_ENABLER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1010, {0b11,nb}>;
2530+ def : RWSysReg<"ICC_PPI_SACTIVER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b01,nb}>;
2531+ def : RWSysReg<"ICC_PPI_SPENDR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b11,nb}>;
2532+ def : ROSysReg<"ICC_PPI_HMR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1010, {0b00,nb}>;
2533+ }
2534+
2535+ foreach n=0-3 in {
2536+ defvar nb = !cast<bits<2>>(n);
2537+ // Op0 Op1 CRn CRm Op2
2538+ def : RWSysReg<"ICC_PPI_DOMAINR"#n#"_EL3", 0b11, 0b110, 0b1100, 0b1000, {0b1,nb{1-0}}>;
2539+
2540+ }
2541+
2542+ foreach n=0-15 in{
2543+ defvar nb = !cast<bits<4>>(n);
2544+ // Op0 Op1 CRn CRm Op2
2545+ def : RWSysReg<"ICC_PPI_PRIORITYR"#n#"_EL1", 0b11, 0b000, 0b1100, {0b111,nb{3}}, nb{2-0}>;
2546+ }
2547+
2548+ // Virtual PPI Registers
2549+ foreach n=0-1 in {
2550+ defvar nb = !cast<bit>(n);
2551+ // Op0 Op1 CRn CRm Op2
2552+ def : RWSysReg<"ICV_PPI_CACTIVER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b00,nb}>;
2553+ def : RWSysReg<"ICV_PPI_CPENDR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b10,nb}>;
2554+ def : RWSysReg<"ICV_PPI_ENABLER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1010, {0b11,nb}>;
2555+ def : RWSysReg<"ICV_PPI_SACTIVER"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b01,nb}>;
2556+ def : RWSysReg<"ICV_PPI_SPENDR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1101, {0b11,nb}>;
2557+ def : RWSysReg<"ICV_PPI_HMR"#n#"_EL1", 0b11, 0b000, 0b1100, 0b1010, {0b00,nb}>;
2558+ }
2559+
2560+ foreach n=0-15 in {
2561+ defvar nb = !cast<bits<4>>(n);
2562+ // Op0 Op1 CRn CRm Op2
2563+ def : RWSysReg<"ICV_PPI_PRIORITYR"#n#"_EL1", 0b11, 0b000, 0b1100, {0b111,nb{3}}, nb{2-0}>;
2564+ }
2565+
2566+ // Hypervisor Control Registers
2567+ // Op0 Op1 CRn CRm Op2
2568+ def : RWSysReg<"ICH_APR_EL2", 0b11, 0b100, 0b1100, 0b1000, 0b100>;
2569+ def : RWSysReg<"ICH_CONTEXTR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b110>;
2570+ def : RWSysReg<"ICH_HFGITR_EL2", 0b11, 0b100, 0b1100, 0b1001, 0b111>;
2571+ def : RWSysReg<"ICH_HFGRTR_EL2", 0b11, 0b100, 0b1100, 0b1001, 0b100>;
2572+ def : RWSysReg<"ICH_HFGWTR_EL2", 0b11, 0b100, 0b1100, 0b1001, 0b110>;
2573+ def : ROSysReg<"ICH_HPPIR_EL2", 0b11, 0b100, 0b1100, 0b1000, 0b101>;
2574+ def : RWSysReg<"ICH_VCTLR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b100>;
2575+
2576+ foreach n=0-1 in {
2577+ defvar nb = !cast<bit>(n);
2578+ // Op0 Op1 CRn CRm Op2
2579+ def : RWSysReg<"ICH_PPI_ACTIVER"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b11,nb}>;
2580+ def : RWSysReg<"ICH_PPI_DVIR"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b00,nb}>;
2581+ def : RWSysReg<"ICH_PPI_ENABLER"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b01,nb}>;
2582+ def : RWSysReg<"ICH_PPI_PENDR"#n#"_EL2", 0b11, 0b100, 0b1100, 0b1010, {0b10,nb}>;
2583+ }
2584+
2585+ foreach n=0-15 in {
2586+ defvar nb = !cast<bits<4>>(n);
2587+ // Op0 Op1 CRn CRm Op2
2588+ def : RWSysReg<"ICH_PPI_PRIORITYR"#n#"_EL2", 0b11, 0b100, 0b1100, {0b111,nb{3}}, nb{2-0}>;
2589+ }
2590+
2591+ //===----------------------------------------------------------------------===//
2592+ // GICv5 instruction options.
2593+ //===----------------------------------------------------------------------===//
2594+
2595+ // GIC
2596+ class GIC<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2, bit needsreg> {
2597+ string Name = name;
2598+ bits<14> Encoding;
2599+ let Encoding{13-11} = op1;
2600+ let Encoding{10-7} = crn;
2601+ let Encoding{6-3} = crm;
2602+ let Encoding{2-0} = op2;
2603+ bit NeedsReg = needsreg;
2604+ string RequiresStr = [{ {AArch64::FeatureGCIE} }];
2605+ }
2606+
2607+ // GSB
2608+ class GSB<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2> {
2609+ string Name = name;
2610+ bits<14> Encoding;
2611+ let Encoding{13-11} = op1;
2612+ let Encoding{10-7} = crn;
2613+ let Encoding{6-3} = crm;
2614+ let Encoding{2-0} = op2;
2615+ string RequiresStr = [{ {AArch64::FeatureGCIE} }];
2616+ }
2617+
2618+ // GICR
2619+ class GICR<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2, bit needsreg> {
2620+ string Name = name;
2621+ bits<14> Encoding;
2622+ let Encoding{13-11} = op1;
2623+ let Encoding{10-7} = crn;
2624+ let Encoding{6-3} = crm;
2625+ let Encoding{2-0} = op2;
2626+ bit NeedsReg = needsreg;
2627+ string RequiresStr = [{ {AArch64::FeatureGCIE} }];
2628+ }
2629+
2630+ def GICTable : GenericTable {
2631+ let FilterClass = "GIC";
2632+ let CppTypeName = "GIC";
2633+ let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
2634+
2635+ let PrimaryKey = ["Encoding"];
2636+ let PrimaryKeyName = "lookupGICByEncoding";
2637+ }
2638+
2639+ def GSBTable : GenericTable {
2640+ let FilterClass = "GSB";
2641+ let CppTypeName = "GSB";
2642+ let Fields = ["Name", "Encoding", "RequiresStr"];
2643+
2644+ let PrimaryKey = ["Encoding"];
2645+ let PrimaryKeyName = "lookupGSBByEncoding";
2646+ }
2647+
2648+ def GICRTable : GenericTable {
2649+ let FilterClass = "GICR";
2650+ let CppTypeName = "GICR";
2651+ let Fields = ["Name", "Encoding", "NeedsReg", "RequiresStr"];
2652+
2653+ let PrimaryKey = ["Encoding"];
2654+ let PrimaryKeyName = "lookupGICRByEncoding";
2655+ }
2656+
2657+ def lookupGICByName : SearchIndex {
2658+ let Table = GICTable;
2659+ let Key = ["Name"];
2660+ }
2661+
2662+ def lookupGSBByName : SearchIndex {
2663+ let Table = GSBTable;
2664+ let Key = ["Name"];
2665+ }
2666+
2667+ def lookupGICRByName : SearchIndex {
2668+ let Table = GICRTable;
2669+ let Key = ["Name"];
2670+ }
2671+
2672+ // Op1 CRn CRm Op2
2673+ def : GSB<"sys", 0b000, 0b1100, 0b0000, 0b000>;
2674+ def : GSB<"ack", 0b000, 0b1100, 0b0000, 0b001>;
2675+
2676+ // Op1 CRn CRm Op2 needsReg
2677+ def : GIC<"cdaff", 0b000, 0b1100, 0b0001, 0b011, 1>;
2678+ def : GIC<"cddi", 0b000, 0b1100, 0b0010, 0b000, 1>;
2679+ def : GIC<"cddis", 0b000, 0b1100, 0b0001, 0b000, 1>;
2680+ def : GIC<"cden", 0b000, 0b1100, 0b0001, 0b001, 1>;
2681+ def : GIC<"cdeoi", 0b000, 0b1100, 0b0001, 0b111, 1>;
2682+ def : GIC<"cdhm", 0b000, 0b1100, 0b0010, 0b001, 1>;
2683+ def : GIC<"cdpend", 0b000, 0b1100, 0b0001, 0b100, 1>;
2684+ def : GIC<"cdpri", 0b000, 0b1100, 0b0001, 0b010, 1>;
2685+ def : GIC<"cdrcfg", 0b000, 0b1100, 0b0001, 0b101, 1>;
2686+ def : GICR<"cdia", 0b000, 0b1100, 0b0011, 0b000, 1>;
2687+ def : GICR<"cdnmia", 0b000, 0b1100, 0b0011, 0b001, 1>;
2688+ def : GIC<"vdaff", 0b100, 0b1100, 0b0001, 0b011, 1>;
2689+ def : GIC<"vddi", 0b100, 0b1100, 0b0010, 0b000, 1>;
2690+ def : GIC<"vddis", 0b100, 0b1100, 0b0001, 0b000, 1>;
2691+ def : GIC<"vden", 0b100, 0b1100, 0b0001, 0b001, 1>;
2692+ def : GIC<"vdhm", 0b100, 0b1100, 0b0010, 0b001, 1>;
2693+ def : GIC<"vdpend", 0b100, 0b1100, 0b0001, 0b100, 1>;
2694+ def : GIC<"vdpri", 0b100, 0b1100, 0b0001, 0b010, 1>;
2695+ def : GIC<"vdrcfg", 0b100, 0b1100, 0b0001, 0b101, 1>;
2696+ def : GIC<"ldaff", 0b110, 0b1100, 0b0001, 0b011, 1>;
2697+ def : GIC<"lddi", 0b110, 0b1100, 0b0010, 0b000, 1>;
2698+ def : GIC<"lddis", 0b110, 0b1100, 0b0001, 0b000, 1>;
2699+ def : GIC<"lden", 0b110, 0b1100, 0b0001, 0b001, 1>;
2700+ def : GIC<"ldhm", 0b110, 0b1100, 0b0010, 0b001, 1>;
2701+ def : GIC<"ldpend", 0b110, 0b1100, 0b0001, 0b100, 1>;
2702+ def : GIC<"ldpri", 0b110, 0b1100, 0b0001, 0b010, 1>;
2703+ def : GIC<"ldrcfg", 0b110, 0b1100, 0b0001, 0b101, 1>;
0 commit comments