This patch is a minor modification of my previous patch that I submitted on
November 14th to address some review comments.

The patches submitted on November 14th, 2025 were:

  * https://gcc.gnu.org/pipermail/gcc-patches/2025-November/700541.html
  * https://gcc.gnu.org/pipermail/gcc-patches/2025-November/700542.html
  * https://gcc.gnu.org/pipermail/gcc-patches/2025-November/700543.html
  * https://gcc.gnu.org/pipermail/gcc-patches/2025-November/700544.html

The changes in these patches include:

  * Splitting the dense math register support from MMA to allow for other
    future instructions to use dense math registers such as cryptography.

  * Changing the name of the 1,024 bit type from '__dmf' to '__dm1024'.

  * Adding documentation for the -mdense-math switch.

The Dense Math Facility (dmf) is designed to be an extension to the ISA
3.1 (i.e. power10/power11) MMA facility.  Now, since these are future
patches, the Dense Math Facility might appear in future PowerPC
machines or maybe it won't be used in real hardware.

One of the concepts of the DMF system is the accumulators used in the
MMA and the DMF extensions will become separate registers, rather
than being overlaid over the traditional floating point registers
(i.e. VSX registers 0..31).

In addition to being separate registers, the dense math accumulators
are now logically 1,024 biits instead of 512.

The way the Dense Math registers and instructions are designed,
existing power10/power11 MMA instructions that operate on 512 bits will
work with Dense Math.  In ISA 3.1, each of the 8 accumulators are
overlaid over 4 adjacent FPR registers, and the compiler must not touch
the 4 adjacent FPRs while the MMA accumulator is used.

In the Dense Math system, the accumulator is a separate register.  When
-mcpu=power11 or -mcpu=power10 is used, the GCC compiler will not
allocate the appropriate FPR (VSX) reigsters when generating MMA
instructions.

If a function compiled for Power10/Power11 is run on a system with
Dense Math support enabled, the effect is a bunch of the FPR registers
will not be allocated because the compiler assumes the accumulaters are
there.  After these patches are applied, if the user compiles the code
with -mcpu=future, the compiler can allocate up to 32 more vector
registers, because the Dense Math accumulators are separate registers.

In fact two of the MMA tests (mma-double-test.c and mma-single-test.c)
do about 20 less spills of floating point values to the stack, since
the compiler can allocate those FPR vector registers for other
purposes.

These 4 patches will allow GCC to allocate these registers if the
-mcpu=future option is used.

  1: The first patch adds a new constraint (%wD) that can be used by
     code generating MMA instructions. If the user used -mcpu=power10
     or -mcpu=power11, %wD will act like %d and insist the register be
     VSX registers 0..31.  If the user used -mcpu=future, the new
     separate dense math accumulators will be used.

  2: This patch adds the support for the current MMA 512-bit
     instructions to use separate accumulators instead of overlaid VSX
     registers.

  3: This patch adds support for an extension to MMA where the
     accumulators grow to 1,024 bits instead of 512 bits.

  4: This patch is an optional patch that adds comments to the various
     MMA insn that explain what MMA instructions are generated by the
     particular insn.

This patch is the foundation for the Dense Math support.  It is
expected other patches may be added to this to support potential new
features added to the Dense Math Facility.

I have built bootstrap little endian compilers on power10 systems, and
there were no regression in the tests.  Can I add the patches to the
GCC trunk after the -mcpu=future patch is applied?

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: [email protected]

Reply via email to