This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR middle-end/17055: Casting integer zero to a vector
On Wed, Sep 08, 2004 at 12:04:16PM -0700, Zack Weinberg wrote:
> > + elem = fold_convert_const (NOP_EXPR, TREE_TYPE (type), integer_zero_node);
>
> I'd just like to point out that this is better written
>
> elem = build_int_cst (TREE_TYPE (type), 0);
>
> these days.
fold_convert_const also handles real types.
Although you could probably do
subtype = TREE_TYPE (type);
if (TREE_CODE (subtype) == REAL_TYPE)
elem = build_real (subtype, dconst0);
else
elem = build_int_cst (subtype, 0);
r~