summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-03 19:41:06 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-03 19:41:06 +0000
commit4c3f4e89ebe7cb39ed666b6cd2fdfd69bdd87b02 (patch)
tree547100dbbf027f84c7bcd3cfd648ba2e4d3f7248 /gcc/simplify-rtx.c
parent7229ff38143252a174108e998c397190c13a289a (diff)
downloadgcc-4c3f4e89ebe7cb39ed666b6cd2fdfd69bdd87b02.tar.gz
* simplify-rtx.c (simplify_binary_operation): Handle VEC_CONCAT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92861 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 34b0ab8fe20..6525e1604aa 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1190,14 +1190,11 @@ simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
&& GET_CODE (trueop0) == CONST_VECTOR
&& GET_CODE (trueop1) == CONST_VECTOR)
{
- int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
- unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
+ unsigned n_elts = GET_MODE_NUNITS (mode);
enum machine_mode op0mode = GET_MODE (trueop0);
- int op0_elt_size = GET_MODE_SIZE (GET_MODE_INNER (op0mode));
- unsigned op0_n_elts = (GET_MODE_SIZE (op0mode) / op0_elt_size);
+ unsigned op0_n_elts = GET_MODE_NUNITS (op0mode);
enum machine_mode op1mode = GET_MODE (trueop1);
- int op1_elt_size = GET_MODE_SIZE (GET_MODE_INNER (op1mode));
- unsigned op1_n_elts = (GET_MODE_SIZE (op1mode) / op1_elt_size);
+ unsigned op1_n_elts = GET_MODE_NUNITS (op1mode);
rtvec v = rtvec_alloc (n_elts);
unsigned int i;
@@ -1216,6 +1213,41 @@ simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
return gen_rtx_CONST_VECTOR (mode, v);
}
+ if (VECTOR_MODE_P (mode)
+ && code == VEC_CONCAT
+ && CONSTANT_P (trueop0) && CONSTANT_P (trueop1))
+ {
+ unsigned n_elts = GET_MODE_NUNITS (mode);
+ rtvec v = rtvec_alloc (n_elts);
+
+ gcc_assert (n_elts >= 2);
+ if (n_elts == 2)
+ {
+ gcc_assert (GET_CODE (trueop0) != CONST_VECTOR);
+ gcc_assert (GET_CODE (trueop1) != CONST_VECTOR);
+
+ RTVEC_ELT (v, 0) = trueop0;
+ RTVEC_ELT (v, 1) = trueop1;
+ }
+ else
+ {
+ unsigned op0_n_elts = GET_MODE_NUNITS (GET_MODE (trueop0));
+ unsigned op1_n_elts = GET_MODE_NUNITS (GET_MODE (trueop1));
+ unsigned i;
+
+ gcc_assert (GET_CODE (trueop0) == CONST_VECTOR);
+ gcc_assert (GET_CODE (trueop1) == CONST_VECTOR);
+ gcc_assert (op0_n_elts + op1_n_elts == n_elts);
+
+ for (i = 0; i < op0_n_elts; ++i)
+ RTVEC_ELT (v, i) = XVECEXP (trueop0, 0, i);
+ for (i = 0; i < op1_n_elts; ++i)
+ RTVEC_ELT (v, op0_n_elts+i) = XVECEXP (trueop1, 0, i);
+ }
+
+ return gen_rtx_CONST_VECTOR (mode, v);
+ }
+
if (GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_CODE (trueop0) == CONST_DOUBLE
&& GET_CODE (trueop1) == CONST_DOUBLE