On Tue, 8 May 2012, Richard Sandiford wrote:

Marc Glisse <marc.gli...@inria.fr> writes:
On Tue, 8 May 2012, Richard Sandiford wrote:
I know you said that generalising it could be done later,
and that's fine, but it looks in some ways like it would
be easier to go straight for the more general:

          && GET_CODE (trueop0) == VEC_CONCAT
          && GET_CODE (XEXP (trueop0, 0)) == VEC_CONCAT
          && GET_MODE (XEXP (trueop0, 0)) == mode
          && GET_CODE (XEXP (trueop0, 1)) == VEC_CONCAT
          && GET_MODE (XEXP (trueop0, 1)) == mode)
        {
          unsigned int i0 = INTVAL (XVECEXP (trueop1, 0, 0));
          unsigned int i1 = INTVAL (XVECEXP (trueop1, 0, 1));
          rtx op0, op1;

          gcc_assert (i0 < 4 && i1 < 4);
          op0 = XEXP (XEXP (trueop0, i0 / 2), i0 % 2);
          op1 = XEXP (XEXP (trueop0, i1 / 2), i1 % 2);

          return simplify_gen_binary (VEC_CONCAT, mode, op0, op1);
        }

Yes, I hesitated.

Realised afterwards that both versions need to check
GET_MODE_NUNITS (mode) == 2, because we're requiring OP0 and OP1
to be scalar.  Sorry for not noticing first time.

I thought that was a consequence of

XVECLEN (trueop1, 0) == 2

(in the lines before your first &&)
ie the result (which has mode "mode") is a vec_select of 2 objects.

--
Marc Glisse

Reply via email to