]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
simplify-rtx: Simplify VEC_CONCAT of two CONST_VECTOR
authorXi Ruoyao <xry111@xry111.site>
Sun, 16 Nov 2025 13:52:38 +0000 (21:52 +0800)
committerXi Ruoyao <xry111@xry111.site>
Mon, 17 Nov 2025 15:23:46 +0000 (23:23 +0800)
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.

gcc/simplify-rtx.cc

index 59a86c6c6cd5713f1d4ffc79ebacbc219788c5c3..2f7ad2de1d194e0474367b1ea738c3a689f718bc 100644 (file)
@@ -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.  */