patch: CONST_VECTOR (was clear_storage)

Richard Henderson rth@redhat.com
Sun Feb 17 11:44:00 GMT 2002


On Sun, Feb 17, 2002 at 08:19:14PM +1100, Aldy Hernandez wrote:
> - i changed the name to CONST_VECTOR to be more consistent with CONST_INT
> and CONST_DOUBLE.

Yeah, that's fine.

> - the machmode description was wrong.  i changed it to be a vector of
> elements, not a parallel containing a vector of elements.

Excellent.

> - i had to add a VECTOR_CST node (and corresponding magic all throughout)
> because (a) we'll need it (b) force_const_mem() needs it to get the
> alignment of vector constants correct.

Yep.

> +   int over1, over2;
[...]
> +       over1 |= TREE_OVERFLOW (value);
> +       over2 |= TREE_CONSTANT_OVERFLOW (value);

Uninitialized.

> + /* For a CONST_VECTOR, return element #n.  */
> + #define CONST_VECTOR_ELT(x,n) RTVEC_ELT (XVEC(x, 0), n)

#define CONST_VECTOR_ELT(RTX, N)  XCVECEXP (RTX, 0, N, CONST_VECTOR)

> + /* For a CONST_VECTOR, return the number of elements in a vector.  */
> + #define CONST_VECTOR_NUNITS(x) GET_MODE_NUNITS (GET_MODE (x))

Surely,

#define CONST_VECTOR_NUNITS(RTX)  XCVECLEN (RTX, 0, CONST_VECTOR)

Yes, it should always match the mode, but that's something else no?

> + 	  /* HOST_WIDE_INTs can be in places other than [0],
> + 	     otherwise we can't recognize CONST_DOUBLEs.

You can't recoginize CONST_DOUBLE anyway.  The exact form
is dependent on the host.  You'll have to use match_operand.

> ! #define CONSTANT_ALIGNMENT(EXP, ALIGN)          \
> !   (TREE_CODE (EXP) == STRING_CST	        \
> !    && (ALIGN) < BITS_PER_WORD                   \
> !    ? BITS_PER_WORD                              \
> !    : (TREE_CODE (EXP) == VECTOR_CST) ? 128      \
> !    : (ALIGN))

	: TREE_CODE (EXP) == VECTOR_CST && (ALIGN) < 128 ? 128

> + 	(const_vector:V4SF [(const_double:SF 0 0 0 0 0)

As mentioned, need a match_operand here.  And really, what
you probably ought to do is 

(define_insn "*movv8hi_const0"
  [(set (match_operand:V8HI 0 "altivec_register_operand" "=v")
	(match_operand:V8HI 1 "zero_constant" ""))]
  ...)

Where zero_constant is the existing zero_fp_constant with
the gratuitous GET_MODE_CLASS check removed.


r~



More information about the Gcc-patches mailing list