https://gcc.gnu.org/g:10eb3b9851e0cac60c1286d2dff46911e597dcd1

commit 10eb3b9851e0cac60c1286d2dff46911e597dcd1
Author: Michael Meissner <[email protected]>
Date:   Tue Jun 9 11:56:29 2026 -0400

    Add paddis support.
    
    This patch adds support for the paddis instruction that might be added to a
    future PowerPC processor.
    
    2026-06-09  Michael Meissner  <[email protected]>
    
    gcc/
    
            * config/rs6000/constraints.md (eU): New constraint.
            (eV): Likewise.
            * config/rs6000/predicates.md (paddis_operand): New predicate.
            (paddis_paddi_operand): Likewise.
            (add_cint_operand): Add paddis support.
            (add_operand): Likewise.
            * config/rs6000/rs6000.cc (num_insns_constant_gpr): Likewise.
            (print_operand): Add %B<n> for paddis support.
            * config/rs6000/rs6000.h (TARGET_PADDIS): New macro.
            (SIGNED_INTEGER_64BIT_P): Likewise.
            * config/rs6000/rs6000.md (isa attribute): Add paddis support.
            (enabled attribute); Likewise.
            (add<mode>3): Likewise.
            (adddi3 splitter): New splitter for paddis.
            (movdi_internal64): Add paddis support.
            (movdi splitter): New splitter for paddis.
            * doc/md.texi (PowerPC constraints): Add eU and eV documentation.
    
    gcc/testsuite/
    
            * gcc.target/powerpc/prefixed-addis.c: New test.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 32cd1de3055b..0e7848315139 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -6245,17 +6245,17 @@ num_insns_constant_gpr (HOST_WIDE_INT value)
     return 1;
 
   /* PADDIS support.  */
-  else if (TARGET_PADDIS && SIGNED_INTEGER_64BIT_P (value))
+  else if (TARGET_PADDIS)
     {
-      if ((value & HOST_WIDE_INT_C(0xffffffff)) == 0)
+      rtx num = GEN_INT (value);
+      if (paddis_operand (num, VOIDmode))
        return 1;       /* paddis alone.  */
 
-      /* Don't do paddi + paddis if we can do addis and rldicl.  */
-      if (!rs6000_is_valid_and_mask (GEN_INT (value), DImode))
-       return 2;       /* paddi + paddis.  */
+      if (paddis_paddi_operand (num, VOIDmode))
+       return 2;       /* paddis + paddi/addi.  */
     }
 
-  else if (TARGET_POWERPC64)
+  if (TARGET_POWERPC64)
     {
       int num_insns = 0;
       rs6000_emit_set_long_const (nullptr, value, &num_insns);

Reply via email to