This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch: CONST_VECTOR (was clear_storage)
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, dje at watson dot ibm dot com
- Date: Tue, 19 Feb 2002 10:36:35 +1100
- Subject: Re: patch: CONST_VECTOR (was clear_storage)
>> *************** rtx_equal_p (x, y)
>> *** 626,631 ****
>> --- 639,645 ----
>> case SCRATCH:
>> case CONST_DOUBLE:
>> case CONST_INT:
>> + case CONST_VECTOR:
>> return 0;
>
> Err, except that it is necessary if you do this. The reason we can
> return 0 here is that we've already handled pointer equality above.
uhh, i don't understand. should i remove the case for
CONST_VECTOR?
>> *************** purge_addressof_1 (loc, insn, force, sto
>> *** 3087,3092 ****
>> --- 3088,3094 ----
>> /* Don't even consider working with paradoxical subregs,
>> or the moral equivalent seen here. */
>> if (size_x <= size_sub
>> + && !VECTOR_MODE_P (GET_MODE (sub))
>> && int_mode_for_mode (GET_MODE (sub)) != BLKmode)
>
> I don't understand this. You say "disallow paradoxical subregs of
> vectors", yet SIZE_X is the outer and SIZE_SUB is the inner, thus
> inside the if we have non-paradoxical subregs.
>
> Leave this out and we can discuss this independently.
ok
>> + static rtx
>> + gen_const_vector_0 (type, mode)
>> + enum mode_class type;
>> + enum machine_mode mode;
>> + {
>> + rtx tem;
>> + rtvec v;
>> + int units, i;
>> + enum machine_mode inner;
>> +
>> + units = GET_MODE_NUNITS (mode);
>> + inner = GET_MODE_INNER (mode);
>> +
>> + v = rtvec_alloc (units);
>> +
>> + if (type == MODE_VECTOR_INT)
>> + {
>> + for (i = 0; i < units; ++i)
>> + RTVEC_ELT (v, i)
>> + = gen_rtx_CONST_INT (VOIDmode, 0);
>> + }
>> + else if (type == MODE_VECTOR_FLOAT)
>> + {
>> + for (i = 0; i < units; ++i)
>> + RTVEC_ELT (v, i)
>> + = gen_rtx_CONST_DOUBLE (inner, 0, 0);
>> + }
>
> Note that if this is run after int and fp const0 is generated,
> this simplfies to
>
> RTVEC_ELT (v, i) = CONST0_RTX (inner);
yup. noticed that too after i submitted. it should be ok.
i'll test.
>> ! /* Make strings word-aligned so strcpy from constants will be faster.
>> ! Make vector constants quadword aligned. */
>> ! #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
>> ! (TREE_CODE (EXP) == STRING_CST \
>> ! && (ALIGN) < BITS_PER_WORD \
>> ! ? BITS_PER_WORD \
>> ! : (TREE_CODE (EXP) == VECTOR_CST && (ALIGN) < 128) ? 128 \
>> ! : (ALIGN))
>
> I'm surprised you need this. I would have thought this would have
> been handled by the alignment of the type. Notice, for instance,
that is what started me on my goose chase.
force_const_mem() does this nastiness to get the alignment right:
/* Align the location counter as required by EXP's data type. */
align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);
#ifdef CONSTANT_ALIGNMENT
align = CONSTANT_ALIGNMENT (make_tree (type_for_mode (mode, 0), x),
align);
#endif
get_mode_alignment() returns 32 for vectors:
unsigned int
get_mode_alignment (mode)
enum machine_mode mode;
{
unsigned int alignment = GET_MODE_UNIT_SIZE (mode);
/* Extract the LSB of the size. */
alignment = alignment & -alignment;
alignment *= BITS_PER_UNIT;
alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
return alignment;
}
so we defer to CONSTANT_ALIGNMENT. and this, believe it or not,
is the ony place where we need a VECTOR_CST.
1500 lines of a patch later, we get correct alignment :)
--
Aldy Hernandez E-mail: aldyh@redhat.com
Professional Gypsy Lost in Australia
Red Hat, Inc.