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

commit ae97fd9445fbddffbd4f2e8ee8412f9f0116b2a3
Author: Michael Meissner <[email protected]>
Date:   Fri Oct 16 18:41:37 2026 -0400

    Use xxspltib rather than 2 Altivec instructions.
    
    2026-10-15  Michael Meissner  <[email protected]>
    
            * config/rs6000/rs6000.cc (easy_altivec_constant): If we can use
            xxspltib to generate a constant, don't treat it like an Altivec
            constant.

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

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 054696e5d092..e3065ea73bd0 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -6610,6 +6610,15 @@ easy_altivec_constant (rtx op, machine_mode mode)
   else if (mode != GET_MODE (op))
     return 0;
 
+  /* If we can use xxsplitb, don't classify this as an Altivec constant.  This
+     prevents vec_dup ((char)16) from generating vsltib/xxsplitb and
+     vaddubm.  */
+  int value = 256;
+  int num_insns = -1;
+
+  if (xxspltib_constant_p (op, mode, &num_insns, &value) && num_insns >= 0)
+    return false;
+
   /* V2DI/V2DF was added with VSX.  Only allow 0 and all 1's as easy
      constants.  */
   if (mode == V2DFmode)

Reply via email to