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

commit r16-5354-gc8380ed022c2669ea1b1352aded27bdf32da7a0e
Author: Xi Ruoyao <[email protected]>
Date:   Sun Nov 16 21:52:38 2025 +0800

    simplify-rtx: Simplify VEC_CONCAT of two CONST_VECTOR
    
    The code for simplify the VEC_CONCAT of two CONST_VECTOR is already
    there, but it's guarded by CONST_SCALAR_INT_P || CONST_FIXED_P ||
    CONST_DOUBLE_AS_FLOAT_P.  I don't think this logic makes sense.
    
    Either we should allow CONST_VECTOR here or we should remove the dead
    code handling CONST_VECTOR in this if statement.  I cannot see anything
    wrong to just allow CONST_VECTOR.
    
    gcc/
    
            * simplify-rtx.cc (simplify_const_binary_operation): Simplify
            VEC_CONCAT two constant vectors.

Diff:
---
 gcc/simplify-rtx.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index 59a86c6c6cd5..2f7ad2de1d19 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -5489,10 +5489,12 @@ simplify_const_binary_operation (enum rtx_code code, 
machine_mode mode,
       && code == VEC_CONCAT
       && (CONST_SCALAR_INT_P (op0)
          || CONST_FIXED_P (op0)
-         || CONST_DOUBLE_AS_FLOAT_P (op0))
+         || CONST_DOUBLE_AS_FLOAT_P (op0)
+         || CONST_VECTOR_P (op0))
       && (CONST_SCALAR_INT_P (op1)
          || CONST_DOUBLE_AS_FLOAT_P (op1)
-         || CONST_FIXED_P (op1)))
+         || CONST_FIXED_P (op1)
+         || CONST_VECTOR_P (op1)))
     {
       /* Both inputs have a constant number of elements, so the result
         must too.  */

Reply via email to