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.
---

Bootstrapped and regtested on x86_64-linux-gnu.  Ok for trunk?

 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 59a86c6c6cd..2f7ad2de1d1 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.  */
-- 
2.51.2

Reply via email to