PPCRegisterInfoDMR.td 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. //===- PPCRegisterInfoDMR.td - The PowerPC Register File *- tablegen -*----===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // Register info specific to Power PC Dense Math Registers(DMR).
  10. //
  11. // Register classes in this file are related to the Dense Math Registers (DMR).
  12. // There are a total of 8 DMR registers numbered 0 to 7.
  13. // The 4 different views of each DMR register.
  14. //
  15. // [ DMR0 ]
  16. // | WACC0 | WACC_HI0 |
  17. // | DMRROWp0 | DMRROWp1 | DMRROWp2 | DMRROWp3 |
  18. // |DMRROW0|DMRROW1|DMRROW2|DMRROW3|DMRROW4|DMRROW5|DMRROW6|DMRROW7|
  19. // [128bits|128bits|128bits|128bits|128bits|128bits|128bits|128bits]
  20. //
  21. // In addition to the above classes two consecutive DMR registers make a DMR
  22. // DMR pair (DMRp) that is 2048 bits.
  23. //===----------------------------------------------------------------------===//
  24. let Namespace = "PPC" in {
  25. def sub_dmrrow0 : SubRegIndex<128>;
  26. def sub_dmrrow1 : SubRegIndex<128, 128>;
  27. def sub_dmrrowp0 : SubRegIndex<256>;
  28. def sub_dmrrowp1 : SubRegIndex<256, 256>;
  29. def sub_wacc_lo : SubRegIndex<512>;
  30. def sub_wacc_hi : SubRegIndex<512, 512>;
  31. def sub_dmr0 : SubRegIndex<1024>;
  32. def sub_dmr1 : SubRegIndex<1024, 1024>;
  33. }
  34. // A single row in a DMR register.
  35. // There are 8 128 bit rows in each DMR register and 8 DMR registers so that
  36. // makes 64 DMRROW registers in total.
  37. class DMRROW<bits<6> num, string n> : PPCReg<n> {
  38. let HWEncoding{5-0} = num;
  39. }
  40. // A consecutive pair of DMR row registers.
  41. class DMRROWp<bits<5> num, string n, list<Register> subregs> : PPCReg<n> {
  42. let HWEncoding{4-0} = num;
  43. let SubRegs = subregs;
  44. }
  45. // WACC - Wide ACC registers. Accumulator registers that are subregs of DMR.
  46. // These ACC registers no longer include VSR regs as subregs.
  47. class WACC<bits<3> num, string n, list<Register> subregs> : PPCReg<n> {
  48. let HWEncoding{2-0} = num;
  49. let SubRegs = subregs;
  50. }
  51. // High bits for the ACC registers.
  52. // When the ACC register is used these bits are ignored.
  53. // When the ACC register is the target, these bits are set to zero.
  54. class WACC_HI<bits<3> num, string n, list<Register> subregs> : PPCReg<n> {
  55. let HWEncoding{2-0} = num;
  56. let SubRegs = subregs;
  57. }
  58. class DMR<bits<3> num, string n, list<Register> subregs> : PPCReg<n> {
  59. let HWEncoding{2-0} = num;
  60. let SubRegs = subregs;
  61. }
  62. class DMRp<bits<2> num, string n, list<Register> subregs> : PPCReg<n> {
  63. let HWEncoding{1-0} = num;
  64. let SubRegs = subregs;
  65. }
  66. // The DMR Row type registers are the lowest level of registers and have no
  67. // subregs.
  68. foreach Index = 0-63 in {
  69. def DMRROW#Index : DMRROW<Index, "dmrrow"#Index>, DwarfRegNum<[-1, -1]>;
  70. }
  71. // DMRROW pairs are consecutive pairs.
  72. // DMRROWp0 = DMRROW0, DMRROW1
  73. // DMRROWp1 = DMRROW2, DMRROW3
  74. // DMRROWp2 = DMRROW4, DMRROW5
  75. // etc...
  76. let SubRegIndices = [sub_dmrrow0, sub_dmrrow1] in {
  77. foreach Index = 0-31 in {
  78. def DMRROWp#Index : DMRROWp<Index, "dmrrowp"#Index,
  79. [!cast<DMRROW>("DMRROW"#!mul(Index, 2)),
  80. !cast<DMRROW>("DMRROW"#!add(!mul(Index, 2), 1))]>, DwarfRegNum<[-1, -1]>;
  81. }
  82. }
  83. let SubRegIndices = [sub_dmrrowp0, sub_dmrrowp1] in {
  84. // WACC0 = DMRROWp0, DMRROWp1
  85. // WACC1 = DMRROWp4, DMRROWp5
  86. // WACC2 = DMRROWp8, DMRROWp9
  87. // etc...
  88. foreach Index = 0-7 in {
  89. def WACC#Index : WACC<Index, "wacc"#Index,
  90. [!cast<DMRROWp>("DMRROWp"#!mul(Index, 4)),
  91. !cast<DMRROWp>("DMRROWp"#!add(!mul(Index, 4), 1))]>, DwarfRegNum<[-1, -1]>;
  92. }
  93. // WACC_HI0 = DMRROWp2, DMRROWp3
  94. // WACC_HI1 = DMRROWp6, DMRROWp7
  95. // WACC_HI2 = DMRROWp10, DMRROWp11
  96. // etc...
  97. foreach Index = 0-7 in {
  98. def WACC_HI#Index : WACC_HI<Index, "wacc_hi"#Index,
  99. [!cast<DMRROWp>("DMRROWp"#!add(!mul(Index, 4), 2)),
  100. !cast<DMRROWp>("DMRROWp"#!add(!mul(Index, 4), 3))]>, DwarfRegNum<[-1, -1]>;
  101. }
  102. }
  103. // DMR0 = WACC0, WACC_HI0
  104. // DMR1 = WACC1, WACC_HI1
  105. // DMR2 = WACC2, WACC_HI2
  106. // etc...
  107. let SubRegIndices = [sub_wacc_lo, sub_wacc_hi] in {
  108. foreach Index = 0-7 in {
  109. def DMR#Index : DMR<Index, "dmr"#Index, [!cast<WACC>("WACC"#Index), !cast<WACC_HI>("WACC_HI"#Index)]>, DwarfRegNum<[-1, -1]>;
  110. }
  111. }
  112. // DMRp0 = DMR0, DMR1
  113. // DMRp1 = DMR2, DMR3
  114. // DMRp2 = DMR4, DMR5
  115. // DMRp3 = DMR6, DMR7
  116. let SubRegIndices = [sub_dmr0, sub_dmr1] in {
  117. def DMRp0 : DMRp<0, "dmrp0", [DMR0, DMR1]>, DwarfRegNum<[-1, -1]>;
  118. def DMRp1 : DMRp<1, "dmrp1", [DMR2, DMR3]>, DwarfRegNum<[-1, -1]>;
  119. def DMRp2 : DMRp<2, "dmrp2", [DMR4, DMR5]>, DwarfRegNum<[-1, -1]>;
  120. def DMRp3 : DMRp<3, "dmrp3", [DMR6, DMR7]>, DwarfRegNum<[-1, -1]>;
  121. }
  122. def DMRROWRC : RegisterClass<"PPC", [v128i1], 128,
  123. (add (sequence "DMRROW%u", 0, 63))> {
  124. let Size = 128;
  125. }
  126. def DMRROWpRC : RegisterClass<"PPC", [v256i1], 128,
  127. (add (sequence "DMRROWp%u", 0, 31))> {
  128. let Size = 256;
  129. }
  130. def WACCRC : RegisterClass<"PPC", [v512i1], 128,
  131. (add (sequence "WACC%u", 0, 7))> {
  132. let Size = 512;
  133. }
  134. def WACC_HIRC : RegisterClass<"PPC", [v512i1], 128,
  135. (add (sequence "WACC_HI%u", 0, 7))> {
  136. let Size = 512;
  137. }
  138. def DMRRC : RegisterClass<"PPC", [v1024i1], 128,
  139. (add (sequence "DMR%u", 0, 7))> {
  140. let Size = 1024;
  141. }
  142. def DMRpRC : RegisterClass<"PPC", [v2048i1], 128,
  143. (add DMRp0, DMRp1, DMRp2, DMRp3)> {
  144. let Size = 2048;
  145. }