build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value)
{
int width = tree_to_uhwi (TYPE_SIZE (inner_type));
- int n = HOST_BITS_PER_WIDE_INT / width;
- unsigned HOST_WIDE_INT low, high, mask;
- tree ret;
+ int n = TYPE_PRECISION (type) / width;
+ unsigned HOST_WIDE_INT low, mask;
+ HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
+ int i;
gcc_assert (n);
low = (unsigned HOST_WIDE_INT) ~0 / mask * (value & mask);
}
- if (TYPE_PRECISION (type) < HOST_BITS_PER_WIDE_INT)
- low &= ((HOST_WIDE_INT)1 << TYPE_PRECISION (type)) - 1, high = 0;
- else if (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT)
- high = 0;
- else if (TYPE_PRECISION (type) == HOST_BITS_PER_DOUBLE_INT)
- high = low;
- else
- gcc_unreachable ();
+ for (i = 0; i < n; i++)
+ a[i] = low;
- ret = build_int_cst_wide (type, low, high);
- return ret;
+ return wide_int_to_tree
+ (type, wide_int::from_array (a, n, TYPE_PRECISION (type)));
}
static GTY(()) tree vector_inner_type;
unsigned HOST_WIDE_INT *mulc = XALLOCAVEC (unsigned HOST_WIDE_INT, nunits);
int prec = TYPE_PRECISION (TREE_TYPE (type));
int dummy_int;
- unsigned int i, unsignedp = TYPE_UNSIGNED (TREE_TYPE (type));
+ unsigned int i;
+ signop sign_p = TYPE_SIGN (TREE_TYPE (type));
unsigned HOST_WIDE_INT mask = GET_MODE_MASK (TYPE_MODE (TREE_TYPE (type)));
tree *vec;
tree cur_op, mulcst, tem;
}
if (mode == -2)
continue;
- if (unsignedp)
+ if (sign_p == UNSIGNED)
{
unsigned HOST_WIDE_INT mh;
unsigned HOST_WIDE_INT d = TREE_INT_CST_LOW (cst) & mask;
if (use_pow2)
{
tree addend = NULL_TREE;
- if (!unsignedp)
+ if (sign_p == SIGNED)
{
tree uns_type;
}
if (code == TRUNC_DIV_EXPR)
{
- if (unsignedp)
+ if (sign_p == UNSIGNED)
{
/* q = op0 >> shift; */
cur_op = add_rshift (gsi, type, op0, shifts);
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (type)) != CODE_FOR_nothing)
{
- if (unsignedp)
+ if (sign_p == UNSIGNED)
/* r = op0 & mask; */
return gimplify_build2 (gsi, BIT_AND_EXPR, type, op0, mask);
else if (addend != NULL_TREE)
switch (mode)
{
case 0:
- gcc_assert (unsignedp);
+ gcc_assert (sign_p == UNSIGNED);
/* t1 = oprnd0 >> pre_shift;
t2 = t1 h* ml;
q = t2 >> post_shift; */
return NULL_TREE;
break;
case 1:
- gcc_assert (unsignedp);
+ gcc_assert (sign_p == UNSIGNED);
for (i = 0; i < nunits; i++)
{
shift_temps[i] = 1;
case 3:
case 4:
case 5:
- gcc_assert (!unsignedp);
+ gcc_assert (sign_p == SIGNED);
for (i = 0; i < nunits; i++)
shift_temps[i] = prec - 1;
break;