|| !TREE_CONSTANT (expr)
|| !INTEGRAL_TYPE_P (TREE_TYPE (expr)))
error_at (loc, "vectorlength must be an integer constant");
- else if (exact_log2 (TREE_INT_CST_LOW (expr)) == -1)
+ else if (wi::exact_log2 (expr) == -1)
error_at (loc, "vectorlength must be a power of 2");
else
{
#include "tm_p.h"
#include "target.h"
#include "target-def.h"
+#include "wide-int.h"
static void vax_option_override (void);
static bool vax_legitimate_address_p (enum machine_mode, rtx, bool);
{
int x = 1 << i;
bool ok;
- REAL_VALUE_FROM_INT (s, x, mode);
+ real_from_integer (&s, mode, x, SIGNED);
if (REAL_VALUES_EQUAL (r, s))
return true;
Returns the absolute value of @var{x}.
@end deftypefn
-@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode})
-Converts integer @var{val} into a floating-point value which is then
-stored into @var{x}. The value is truncated to fit in mode @var{mode}.
-@end deftypefn
-
@node Mode Switching
@section Mode Switching Instructions
@cindex mode switching
Returns the absolute value of @var{x}.
@end deftypefn
-@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode})
-Converts integer @var{val} into a floating-point value which is then
-stored into @var{x}. The value is truncated to fit in mode @var{mode}.
-@end deftypefn
-
@node Mode Switching
@section Mode Switching Instructions
@cindex mode switching
if (mode != VOIDmode && (dwarf_version >= 4 || !dwarf_strict))
{
- gcc_assert (mode == GET_MODE (rtl) || VOIDmode == GET_MODE (rtl));
-
- /* Note that a CONST_DOUBLE rtx could represent either an integer
- or a floating-point constant. A CONST_DOUBLE is used whenever
- the constant requires more than one word in order to be
- adequately represented. We output CONST_DOUBLEs as blocks. */
loc_result = new_loc_descr (DW_OP_implicit_value,
GET_MODE_SIZE (mode), 0);
loc_result->dw_loc_oprnd2.val_class = dw_val_class_wide_int;
else
const_true_rtx = gen_rtx_CONST_INT (VOIDmode, STORE_FLAG_VALUE);
- REAL_VALUE_FROM_INT (dconst0, 0, double_mode);
- REAL_VALUE_FROM_INT (dconst1, 1, double_mode);
- REAL_VALUE_FROM_INT (dconst2, 2, double_mode);
+ real_from_integer (&dconst0, double_mode, 0, SIGNED);
+ real_from_integer (&dconst1, double_mode, 1, SIGNED);
+ real_from_integer (&dconst2, double_mode, 2, SIGNED);
dconstm1 = dconst1;
dconstm1.sign = 1;
/* This is only a win if casting to a signed type is cheap,
i.e. when arg00's type is not a partial mode. */
&& TYPE_PRECISION (TREE_TYPE (arg00))
- == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg00))))
+ == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg00))))
{
tree stype = signed_type_for (TREE_TYPE (arg00));
return fold_build2_loc (loc, code == EQ_EXPR ? GE_EXPR : LT_EXPR,
zerobits = ((((unsigned HOST_WIDE_INT) 1) << shiftc) - 1);
else if (TREE_CODE (arg0) == RSHIFT_EXPR
&& TYPE_PRECISION (TREE_TYPE (arg0))
- == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg0))))
+ == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg0))))
{
prec = TYPE_PRECISION (TREE_TYPE (arg0));
tree arg00 = TREE_OPERAND (arg0, 0);
{
tree inner_type = TREE_TYPE (TREE_OPERAND (arg00, 0));
if (TYPE_PRECISION (inner_type)
- == GET_MODE_BITSIZE (TYPE_MODE (inner_type))
+ == GET_MODE_PRECISION (TYPE_MODE (inner_type))
&& TYPE_PRECISION (inner_type) < prec)
{
prec = TYPE_PRECISION (inner_type);
else if (wi::eq_p (arg1, signed_max)
&& TYPE_UNSIGNED (arg1_type)
- /* KENNY QUESTIONS THE CHECKING OF THE BITSIZE
- HERE. HE FEELS THAT THE PRECISION SHOULD BE
- CHECKED */
-
/* We will flip the signedness of the comparison operator
associated with the mode of arg1, so the sign bit is
specified by this mode. Check that arg1 is the signed
max associated with this sign bit. */
- && prec == GET_MODE_BITSIZE (TYPE_MODE (arg1_type))
+ && prec == GET_MODE_PRECISION (TYPE_MODE (arg1_type))
/* signed_type does not work on pointer types. */
&& INTEGRAL_TYPE_P (arg1_type))
{
bitmap_clear_bit (pre_delete_map[i], j);
}
- if (dump_file)
- {
- dump_bitmap_vector (dump_file, "pre_insert_map", "", pre_insert_map, n_edges);
- dump_bitmap_vector (dump_file, "pre_delete_map", "", pre_delete_map,
- last_basic_block);
- }
-
sbitmap_free (prune_exprs);
free (insertions);
free (deletions);
{"immediate_operand", false, true, {UNKNOWN}},
{"const_int_operand", false, false, {CONST_INT}},
#if TARGET_SUPPORTS_WIDE_INT
- {"const_wide_int_operand", false, false, {CONST_WIDE_INT}},
{"const_scalar_int_operand", false, false, {CONST_INT, CONST_WIDE_INT}},
{"const_double_operand", false, false, {CONST_DOUBLE}},
#else
else if (type == float_type_node || type == double_type_node)
{
REAL_VALUE_TYPE x;
- REAL_VALUE_FROM_INT (x, ival, TYPE_MODE (type));
+ real_from_integer (&x, TYPE_MODE (type), ival, SIGNED);
value = build_real (type, x);
}
else
#include "sbitmap.h"
#include "dumpfile.h"
-#define LCM_DEBUG_INFO 1
/* Edge based LCM routines. */
static void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
static void compute_earliest (struct edge_list *, int, sbitmap *, sbitmap *,
/* We want a maximal solution, so make an optimistic initialization of
ANTIN. */
bitmap_vector_ones (antin, last_basic_block);
- bitmap_vector_clear (antout, last_basic_block);
/* Put every block on the worklist; this is necessary because of the
optimistic initialization of ANTIN above. */
/* Allocate an extra element for the exit block in the laterin vector. */
laterin = sbitmap_vector_alloc (last_basic_block + 1, n_exprs);
- bitmap_vector_clear (laterin, last_basic_block);
compute_laterin (edge_list, earliest, antloc, later, laterin);
#ifdef LCM_DEBUG_INFO
real_convert (r, mode, r);
}
-/* Initialize R from a HOST_WIDE_INT. */
-
-void
-real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode,
- HOST_WIDE_INT val, signop sgn)
-{
- if (val == 0)
- get_zero (r, 0);
- else
- {
- memset (r, 0, sizeof (*r));
- r->cl = rvc_normal;
- r->sign = val < 0 && sgn == SIGNED;
- SET_REAL_EXP (r, HOST_BITS_PER_WIDE_INT);
-
- /* TODO: This fails for -MAXHOSTWIDEINT, wide_int version would
- have worked. */
- if (r->sign)
- val = -val;
-
- if (HOST_BITS_PER_LONG == HOST_BITS_PER_WIDE_INT)
- r->sig[SIGSZ-1] = val;
- else
- {
- gcc_assert (HOST_BITS_PER_LONG*2 == HOST_BITS_PER_WIDE_INT);
- r->sig[SIGSZ-1] = val >> (HOST_BITS_PER_LONG - 1) >> 1;
- r->sig[SIGSZ-2] = val;
- }
-
- normalize (r);
- }
-
- if (DECIMAL_FLOAT_MODE_P (mode))
- decimal_from_integer (r);
- else if (mode != VOIDmode)
- real_convert (r, mode, r);
-}
-
-/* Initialize R from the integer pair HIGH+LOW. */
+/* Initialize R from the wide_int VAL_IN. The MODE is not VOIDmode,*/
void
real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode,
/* Wrapper to allow different internal representation for decimal floats. */
extern void real_from_string3 (REAL_VALUE_TYPE *, const char *, enum machine_mode);
-/* Initialize R from an integer. */
-extern void real_from_integer (REAL_VALUE_TYPE *, enum machine_mode,
- HOST_WIDE_INT, signop);
-
extern long real_to_target_fmt (long *, const REAL_VALUE_TYPE *,
const struct real_format *);
extern long real_to_target (long *, const REAL_VALUE_TYPE *, enum machine_mode);
#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_FLOAT, 0)))
-#define REAL_VALUE_FROM_INT(r, val, mode) \
- real_from_integer (&(r), mode, val, SIGNED)
-
/* Real values to IEEE 754 decimal floats. */
/* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */
return 1;
}
-/* Returns 1 if OP is an operand that is a CONST_WIDE_INT of mode
- MODE. This most likely is not as useful as
- const_scalar_int_operand since it does not accept CONST_INTs, but
- is here for consistancy. */
-int
-const_wide_int_operand (rtx op, enum machine_mode mode)
-{
- if (!CONST_WIDE_INT_P (op))
- return 0;
-
- return const_scalar_int_operand (op, mode);
-}
-
/* Returns 1 if OP is an operand that is a constant integer or constant
floating-point number of MODE. */
int i = CWI_GET_NUM_ELEM (x);
gcc_assert (i > 0);
if (CWI_ELT (x, i-1) == 0)
+ /* The HOST_WIDE_INT_PRINT_HEX prepends a 0x only if the val is
+ non zero. We want all numbers to have a 0x prefix. */
fprintf (outfile, "0x");
fprintf (outfile, HOST_WIDE_INT_PRINT_HEX, CWI_ELT (x, --i));
while (--i >= 0)
return t;
}
else if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
- && !AGGREGATE_TYPE_P (TREE_TYPE (t))
&& TYPE_MODE (TREE_TYPE (t)) != BLKmode
&& (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (t)))
!= tree_to_uhwi (TREE_OPERAND (t, 1))))
return true;
/* Third, unsigned integers with top bit set never fit signed types. */
- if (!TYPE_UNSIGNED (type) && sgn_c == UNSIGNED && wi::neg_p (c))
- return false;
+ if (!TYPE_UNSIGNED (type) && sgn_c == UNSIGNED)
+ {
+ int uprec = GET_MODE_PRECISION (TYPE_MODE TREE_TYPE (c));
+ if (uprec < TYPE_PRECISION (TREE_TYPE (c)))
+ {
+ /* When a tree_cst is converted to a wide-int, the precision
+ is taken from the type. However, if the precision of the
+ mode underneath the type is smaller than that, it is
+ possible that the value will not fit. The test below
+ fails if any bit is set between the sign bit of the
+ underlying mode and the top bit of the type. */
+ if (wi::ne_p (wi::zext (c, uprec - 1), c))
+ return false;
+ }
+ else if (wi::neg_p (c))
+ return false;
+ }
/* If we haven't been able to decide at this point, there nothing more we
can check ourselves here. Look at the base type if we have one and it