PPCRegisterInfoMMA.td 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //===-- PPCRegisterInfoMMA.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 for registers related to MMA. These are the ACC and UACC
  10. // registers.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. let Namespace = "PPC" in {
  14. def sub_pair0 : SubRegIndex<256>;
  15. def sub_pair1 : SubRegIndex<256, 256>;
  16. }
  17. // ACC - One of the 8 512-bit VSX accumulators.
  18. class ACC<bits<3> num, string n, list<Register> subregs> : PPCReg<n> {
  19. let HWEncoding{2-0} = num;
  20. let SubRegs = subregs;
  21. }
  22. // UACC - One of the 8 512-bit VSX accumulators prior to being primed.
  23. // Without using this register class, the register allocator has no way to
  24. // differentiate a primed accumulator from an unprimed accumulator.
  25. // This may result in invalid copies between primed and unprimed accumulators.
  26. class UACC<bits<3> num, string n, list<Register> subregs> : PPCReg<n> {
  27. let HWEncoding{2-0} = num;
  28. let SubRegs = subregs;
  29. }
  30. // SPE Accumulator for multiply-accumulate SPE operations. Never directly
  31. // accessed, so there's no real encoding for it.
  32. def SPEACC: DwarfRegNum<[99, 111]>;
  33. let SubRegIndices = [sub_pair0, sub_pair1] in {
  34. def ACC0 : ACC<0, "acc0", [VSRp0, VSRp1]>, DwarfRegNum<[-1, -1]>;
  35. def ACC1 : ACC<1, "acc1", [VSRp2, VSRp3]>, DwarfRegNum<[-1, -1]>;
  36. def ACC2 : ACC<2, "acc2", [VSRp4, VSRp5]>, DwarfRegNum<[-1, -1]>;
  37. def ACC3 : ACC<3, "acc3", [VSRp6, VSRp7]>, DwarfRegNum<[-1, -1]>;
  38. def ACC4 : ACC<4, "acc4", [VSRp8, VSRp9]>, DwarfRegNum<[-1, -1]>;
  39. def ACC5 : ACC<5, "acc5", [VSRp10, VSRp11]>, DwarfRegNum<[-1, -1]>;
  40. def ACC6 : ACC<6, "acc6", [VSRp12, VSRp13]>, DwarfRegNum<[-1, -1]>;
  41. def ACC7 : ACC<7, "acc7", [VSRp14, VSRp15]>, DwarfRegNum<[-1, -1]>;
  42. }
  43. def ACCRC : RegisterClass<"PPC", [v512i1], 128, (add ACC0, ACC1, ACC2, ACC3,
  44. ACC4, ACC5, ACC6, ACC7)> {
  45. // The AllocationPriority is in the range [0, 31]. Assigned the ACC registers
  46. // the highest possible priority in this range to force the register allocator
  47. // to assign these registers first. This is done because the ACC registers
  48. // must represent 4 advacent vector registers. For example ACC1 must be
  49. // VS4 - VS7.
  50. let AllocationPriority = 31;
  51. // We want to allocate these registers even before we allocate
  52. // global ranges.
  53. let GlobalPriority = true;
  54. let Size = 512;
  55. }
  56. let SubRegIndices = [sub_pair0, sub_pair1] in {
  57. def UACC0 : UACC<0, "acc0", [VSRp0, VSRp1]>, DwarfRegNum<[-1, -1]>;
  58. def UACC1 : UACC<1, "acc1", [VSRp2, VSRp3]>, DwarfRegNum<[-1, -1]>;
  59. def UACC2 : UACC<2, "acc2", [VSRp4, VSRp5]>, DwarfRegNum<[-1, -1]>;
  60. def UACC3 : UACC<3, "acc3", [VSRp6, VSRp7]>, DwarfRegNum<[-1, -1]>;
  61. def UACC4 : UACC<4, "acc4", [VSRp8, VSRp9]>, DwarfRegNum<[-1, -1]>;
  62. def UACC5 : UACC<5, "acc5", [VSRp10, VSRp11]>, DwarfRegNum<[-1, -1]>;
  63. def UACC6 : UACC<6, "acc6", [VSRp12, VSRp13]>, DwarfRegNum<[-1, -1]>;
  64. def UACC7 : UACC<7, "acc7", [VSRp14, VSRp15]>, DwarfRegNum<[-1, -1]>;
  65. }
  66. def UACCRC : RegisterClass<"PPC", [v512i1], 128,
  67. (add UACC0, UACC1, UACC2, UACC3,
  68. UACC4, UACC5, UACC6, UACC7)> {
  69. // The AllocationPriority for the UACC registers is still high and must be at
  70. // least 32 as we want to allocate these registers before we allocate other
  71. // global ranges. The value must be less than the AllocationPriority of the
  72. // ACC registers.
  73. let AllocationPriority = 4;
  74. let GlobalPriority = true;
  75. let Size = 512;
  76. }
  77. // FIXME: This allocation order may increase stack frame size when allocating
  78. // non-volatile registers.
  79. //
  80. // Placing Altivec registers first and allocate the rest as underlying VSX
  81. // ones, to reduce interference with accumulator registers (lower 32 VSRs).
  82. // This reduces copies when loading for accumulators, which is common use for
  83. // paired VSX registers.
  84. def VSRpRC :
  85. RegisterClass<"PPC", [v256i1], 128,
  86. (add VSRp17, VSRp18, VSRp16, VSRp19, VSRp20, VSRp21,
  87. VSRp22, VSRp23, VSRp24, VSRp25, VSRp31, VSRp30,
  88. VSRp29, VSRp28, VSRp27, VSRp26,
  89. (sequence "VSRp%u", 0, 6),
  90. (sequence "VSRp%u", 15, 7))> {
  91. // Give the VSRp registers a non-zero AllocationPriority. The value is less
  92. // than 32 as these registers should not always be allocated before global
  93. // ranges and the value should be less than the AllocationPriority - 32 for
  94. // the UACC registers. Even global VSRp registers should be allocated after
  95. // the UACC registers have been chosen.
  96. let AllocationPriority = 2;
  97. let Size = 256;
  98. }