https://gcc.gnu.org/g:d23837ede804a02a121c93b38aca207e2913f308

commit r17-2357-gd23837ede804a02a121c93b38aca207e2913f308
Author: Jeevitha Palanisamy <[email protected]>
Date:   Thu Jul 2 01:31:36 2026 -0500

    rs6000: Add TDOmode support
    
    Introduce the new opaque mode `TDOmode` for the `__dmr1024` type, which
    may be supported on a future Power processor, and treat it similarly
    to the existing MMA opaque types when diagnosing invalid function
    parameter and return values. Update the diagnostics to distinguish
    between Dense Math and MMA types in error messages.
    
    2026-07-13  Jeevitha Palanisamy  <[email protected]>
    
    gcc/
            * config/rs6000/rs6000-call.cc (rs6000_return_in_memory): Handle
            TDOmode and emit "Dense Math" diagnostics.
            (rs6000_function_arg): Reject TDOmode function parameters and
            emit "Dense Math" diagnostics.
            * config/rs6000/rs6000-modes.def: Add TDOmode.

Diff:
---
 gcc/config/rs6000/rs6000-call.cc   | 22 +++++++++++++++-------
 gcc/config/rs6000/rs6000-modes.def |  3 ++-
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc
index b9b791bfe8ae..0da2c1f60718 100644
--- a/gcc/config/rs6000/rs6000-call.cc
+++ b/gcc/config/rs6000/rs6000-call.cc
@@ -432,19 +432,24 @@ rs6000_discover_homogeneous_aggregate (machine_mode mode, 
const_tree type,
 bool
 rs6000_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
-  /* We do not allow MMA types being used as return values.  Only report
-     the invalid return value usage the first time we encounter it.  */
+  /* We do not allow Dense Math/MMA types being used as return values.  Only
+     report the invalid return value usage the first time we encounter it.  */
   if (cfun
       && !cfun->machine->mma_return_type_error
       && TREE_TYPE (cfun->decl) == fntype
-      && (TYPE_MODE (type) == OOmode || TYPE_MODE (type) == XOmode))
+      && (TYPE_MODE (type) == OOmode
+          || TYPE_MODE (type) == XOmode
+          || TYPE_MODE (type) == TDOmode))
     {
       /* Record we have now handled function CFUN, so the next time we
         are called, we do not re-report the same error.  */
       cfun->machine->mma_return_type_error = true;
       if (TYPE_CANONICAL (type) != NULL_TREE)
        type = TYPE_CANONICAL (type);
-      error ("invalid use of MMA type %qs as a function return value",
+      const char *type_class =
+        (TYPE_MODE (type) == TDOmode) ? "Dense Math" : "MMA";
+      error ("invalid use of %s type %qs as a function return value",
+            type_class,
             IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
     }
 
@@ -1631,12 +1636,15 @@ rs6000_function_arg (cumulative_args_t cum_v, const 
function_arg_info &arg)
   machine_mode elt_mode;
   int n_elts;
 
-  /* We do not allow MMA types being used as function arguments.  */
-  if (mode == OOmode || mode == XOmode)
+  /* We do not allow Dense Math/MMA types being used as function arguments.  */
+  if (mode == OOmode || mode == XOmode || mode == TDOmode)
     {
       if (TYPE_CANONICAL (type) != NULL_TREE)
        type = TYPE_CANONICAL (type);
-      error ("invalid use of MMA operand of type %qs as a function parameter",
+      const char *type_class =
+        (mode == TDOmode) ? "Dense Math" : "MMA";
+      error ("invalid use of %s operand of type %qs as a function parameter",
+            type_class,
             IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
       return NULL_RTX;
     }
diff --git a/gcc/config/rs6000/rs6000-modes.def 
b/gcc/config/rs6000/rs6000-modes.def
index 7140b634c414..0ad326751c4a 100644
--- a/gcc/config/rs6000/rs6000-modes.def
+++ b/gcc/config/rs6000/rs6000-modes.def
@@ -76,6 +76,7 @@ VECTOR_MODE (INT, SI, 2);     /*                 V2SI  */
    combination.  */
 PARTIAL_INT_MODE (TI, 128, PTI);
 
-/* Modes used by __vector_pair and __vector_quad.  */
+/* Modes used by __vector_pair, __vector_quad and __dmr1024.  */
 OPAQUE_MODE (OO, 32);
 OPAQUE_MODE (XO, 64);
+OPAQUE_MODE (TDO, 128);

Reply via email to