mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
Use HOST_WIDE_INT_{C,UC,0,0U,1,1U} macros some more
I've searched for some uses of (HOST_WIDE_INT) constant or (unsigned HOST_WIDE_INT) constant and turned them into uses of the appropriate macros. THere are quite a few cases in non-i386 backends but I've left that out for now. The only behavior change is in build_replicated_int_cst where the left shift was done in HOST_WIDE_INT type but assigned to unsigned HOST_WIDE_INT, which I've changed into unsigned HOST_WIDE_INT shift. 2024-02-24 Jakub Jelinek <jakub@redhat.com> gcc/ * builtins.cc (fold_builtin_isascii): Use HOST_WIDE_INT_UC macro. * combine.cc (make_field_assignment): Use HOST_WIDE_INT_1U macro. * double-int.cc (double_int::mask): Use HOST_WIDE_INT_UC macros. * genattrtab.cc (attr_alt_complement): Use HOST_WIDE_INT_1 macro. (mk_attr_alt): Use HOST_WIDE_INT_0 macro. * genautomata.cc (bitmap_set_bit, CLEAR_BIT): Use HOST_WIDE_INT_1 macros. * ipa-strub.cc (can_strub_internally_p): Use HOST_WIDE_INT_1 macro. * loop-iv.cc (implies_p): Use HOST_WIDE_INT_1U macro. * pretty-print.cc (test_pp_format): Use HOST_WIDE_INT_C and HOST_WIDE_INT_UC macros. * rtlanal.cc (nonzero_bits1): Use HOST_WIDE_INT_UC macro. * tree.cc (build_replicated_int_cst): Use HOST_WIDE_INT_1U macro. * tree.h (DECL_OFFSET_ALIGN): Use HOST_WIDE_INT_1U macro. * tree-ssa-structalias.cc (dump_varinfo): Use ~HOST_WIDE_INT_0U macros. * wide-int.cc (divmod_internal_2): Use HOST_WIDE_INT_1U macro. * config/i386/constraints.md (define_constraint "L"): Use HOST_WIDE_INT_C macro. * config/i386/i386.md (movabsq split peephole2): Use HOST_WIDE_INT_C macro. (movl + movb peephole2): Likewise. * config/i386/predicates.md (x86_64_zext_immediate_operand): Likewise. (const_32bit_mask): Likewise. gcc/objc/ * objc-encoding.cc (encode_array): Use HOST_WIDE_INT_0 macros.
This commit is contained in:
parent
5e7a176e88
commit
d8b74d0b1c
@ -9326,7 +9326,7 @@ fold_builtin_isascii (location_t loc, tree arg)
|
||||
/* Transform isascii(c) -> ((c & ~0x7f) == 0). */
|
||||
arg = fold_build2 (BIT_AND_EXPR, integer_type_node, arg,
|
||||
build_int_cst (integer_type_node,
|
||||
~ (unsigned HOST_WIDE_INT) 0x7f));
|
||||
~ HOST_WIDE_INT_UC (0x7f)));
|
||||
return fold_build2_loc (loc, EQ_EXPR, integer_type_node,
|
||||
arg, integer_zero_node);
|
||||
}
|
||||
|
@ -9745,7 +9745,7 @@ make_field_assignment (rtx x)
|
||||
if (width >= HOST_BITS_PER_WIDE_INT)
|
||||
ze_mask = -1;
|
||||
else
|
||||
ze_mask = ((unsigned HOST_WIDE_INT)1 << width) - 1;
|
||||
ze_mask = (HOST_WIDE_INT_1U << width) - 1;
|
||||
|
||||
/* Complete overlap. We can remove the source AND. */
|
||||
if ((and_mask & ze_mask) == ze_mask)
|
||||
|
@ -280,7 +280,7 @@
|
||||
(and (match_code "const_int")
|
||||
(ior (match_test "ival == 0xff")
|
||||
(match_test "ival == 0xffff")
|
||||
(match_test "ival == (HOST_WIDE_INT) 0xffffffff"))))
|
||||
(match_test "ival == HOST_WIDE_INT_C (0xffffffff)"))))
|
||||
|
||||
(define_constraint "M"
|
||||
"0, 1, 2, or 3 (shifts for the @code{lea} instruction)."
|
||||
|
@ -2689,7 +2689,7 @@
|
||||
&& !x86_64_immediate_operand (operands[1], DImode)
|
||||
&& !x86_64_zext_immediate_operand (operands[1], DImode)
|
||||
&& !((UINTVAL (operands[1]) >> ctz_hwi (UINTVAL (operands[1])))
|
||||
& ~(HOST_WIDE_INT) 0xffffffff)
|
||||
& ~HOST_WIDE_INT_C (0xffffffff))
|
||||
&& peep2_regno_dead_p (0, FLAGS_REG)"
|
||||
[(set (match_dup 0) (match_dup 1))
|
||||
(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
|
||||
@ -3542,7 +3542,7 @@
|
||||
[(set (match_operand:SWI48 0 "general_reg_operand")
|
||||
(match_dup 4))]
|
||||
{
|
||||
HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~(HOST_WIDE_INT)0xff00;
|
||||
HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~HOST_WIDE_INT_C (0xff00);
|
||||
tmp |= (INTVAL (operands[3]) & 0xff) << 8;
|
||||
operands[4] = gen_int_mode (tmp, <SWI48:MODE>mode);
|
||||
})
|
||||
|
@ -309,7 +309,7 @@
|
||||
switch (GET_CODE (op))
|
||||
{
|
||||
case CONST_INT:
|
||||
return !(INTVAL (op) & ~(HOST_WIDE_INT) 0xffffffff);
|
||||
return !(INTVAL (op) & ~HOST_WIDE_INT_C (0xffffffff));
|
||||
|
||||
case SYMBOL_REF:
|
||||
/* TLS symbols are not constant. */
|
||||
@ -839,7 +839,7 @@
|
||||
(define_predicate "const_32bit_mask"
|
||||
(and (match_code "const_int")
|
||||
(match_test "trunc_int_for_mode (INTVAL (op), DImode)
|
||||
== (HOST_WIDE_INT) 0xffffffff")))
|
||||
== HOST_WIDE_INT_C (0xffffffff)")))
|
||||
|
||||
;; Match 2, 4, or 8. Used for leal multiplicands.
|
||||
(define_predicate "const248_operand"
|
||||
|
@ -671,14 +671,14 @@ double_int::mask (unsigned prec)
|
||||
if (prec > HOST_BITS_PER_WIDE_INT)
|
||||
{
|
||||
prec -= HOST_BITS_PER_WIDE_INT;
|
||||
m = ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1;
|
||||
m = (HOST_WIDE_INT_UC (2) << (prec - 1)) - 1;
|
||||
mask.high = (HOST_WIDE_INT) m;
|
||||
mask.low = ALL_ONES;
|
||||
}
|
||||
else
|
||||
{
|
||||
mask.high = 0;
|
||||
mask.low = prec ? ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1 : 0;
|
||||
mask.low = prec ? (HOST_WIDE_INT_UC (2) << (prec - 1)) - 1 : 0;
|
||||
}
|
||||
|
||||
return mask;
|
||||
|
@ -2392,7 +2392,7 @@ static rtx
|
||||
attr_alt_complement (rtx s)
|
||||
{
|
||||
return attr_rtx (EQ_ATTR_ALT, XWINT (s, 0),
|
||||
((HOST_WIDE_INT) 1) - XWINT (s, 1));
|
||||
HOST_WIDE_INT_1 - XWINT (s, 1));
|
||||
}
|
||||
|
||||
/* Return EQ_ATTR_ALT expression representing set containing elements set
|
||||
@ -2401,7 +2401,7 @@ attr_alt_complement (rtx s)
|
||||
static rtx
|
||||
mk_attr_alt (alternative_mask e)
|
||||
{
|
||||
return attr_rtx (EQ_ATTR_ALT, (HOST_WIDE_INT) e, (HOST_WIDE_INT) 0);
|
||||
return attr_rtx (EQ_ATTR_ALT, (HOST_WIDE_INT) e, HOST_WIDE_INT_0);
|
||||
}
|
||||
|
||||
/* Given an expression, see if it can be simplified for a particular insn
|
||||
|
@ -3416,13 +3416,13 @@ finish_alt_states (void)
|
||||
|
||||
/* Set bit number bitno in the bit string. The macro is not side
|
||||
effect proof. */
|
||||
#define bitmap_set_bit(bitstring, bitno) \
|
||||
#define bitmap_set_bit(bitstring, bitno) \
|
||||
((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] |= \
|
||||
(HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))
|
||||
HOST_WIDE_INT_1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))
|
||||
|
||||
#define CLEAR_BIT(bitstring, bitno) \
|
||||
((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] &= \
|
||||
~((HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)))
|
||||
~(HOST_WIDE_INT_1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)))
|
||||
|
||||
/* Test if bit number bitno in the bitstring is set. The macro is not
|
||||
side effect proof. */
|
||||
|
@ -940,7 +940,7 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
|
||||
}
|
||||
|
||||
if (list_length (TYPE_ARG_TYPES (TREE_TYPE (node->decl)))
|
||||
>= (((HOST_WIDE_INT) 1 << IPA_PARAM_MAX_INDEX_BITS)
|
||||
>= ((HOST_WIDE_INT_1 << IPA_PARAM_MAX_INDEX_BITS)
|
||||
- STRUB_INTERNAL_MAX_EXTRA_ARGS))
|
||||
{
|
||||
result = false;
|
||||
|
@ -1577,7 +1577,7 @@ implies_p (rtx a, rtx b)
|
||||
&& CONST_INT_P (XEXP (opb0, 1))
|
||||
/* Avoid overflows. */
|
||||
&& ((unsigned HOST_WIDE_INT) INTVAL (XEXP (opb0, 1))
|
||||
!= ((unsigned HOST_WIDE_INT)1
|
||||
!= (HOST_WIDE_INT_1U
|
||||
<< (HOST_BITS_PER_WIDE_INT - 1)) - 1)
|
||||
&& INTVAL (XEXP (opb0, 1)) + 1 == -INTVAL (op1))
|
||||
return rtx_equal_p (op0, XEXP (opb0, 0));
|
||||
|
@ -391,10 +391,10 @@ encode_array (tree type, int curtype, int format)
|
||||
|
||||
/* Else, we are in a struct, and we encode it as a zero-length
|
||||
array. */
|
||||
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0);
|
||||
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, HOST_WIDE_INT_0);
|
||||
}
|
||||
else if (TREE_INT_CST_LOW (TYPE_SIZE (array_of)) == 0)
|
||||
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0);
|
||||
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, HOST_WIDE_INT_0);
|
||||
else
|
||||
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC,
|
||||
TREE_INT_CST_LOW (an_int_cst)
|
||||
|
@ -2813,13 +2813,16 @@ test_pp_format ()
|
||||
ASSERT_PP_FORMAT_2 ("17 12345678", "%llo %x", (long long)15, 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("cafebabe 12345678", "%llx %x", (long long)0xcafebabe,
|
||||
0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("-27 12345678", "%wd %x", (HOST_WIDE_INT)-27, 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("-5 12345678", "%wi %x", (HOST_WIDE_INT)-5, 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("10 12345678", "%wu %x", (unsigned HOST_WIDE_INT)10,
|
||||
ASSERT_PP_FORMAT_2 ("-27 12345678", "%wd %x", HOST_WIDE_INT_C (-27),
|
||||
0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("17 12345678", "%wo %x", (HOST_WIDE_INT)15, 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("0xcafebabe 12345678", "%wx %x", (HOST_WIDE_INT)0xcafebabe,
|
||||
ASSERT_PP_FORMAT_2 ("-5 12345678", "%wi %x", HOST_WIDE_INT_C (-5),
|
||||
0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("10 12345678", "%wu %x", HOST_WIDE_INT_UC (10),
|
||||
0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("17 12345678", "%wo %x", HOST_WIDE_INT_C (15),
|
||||
0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("0xcafebabe 12345678", "%wx %x",
|
||||
HOST_WIDE_INT_C (0xcafebabe), 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("-27 12345678", "%zd %x", (ssize_t)-27, 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("-5 12345678", "%zi %x", (ssize_t)-5, 0x12345678);
|
||||
ASSERT_PP_FORMAT_2 ("10 12345678", "%zu %x", (size_t)10, 0x12345678);
|
||||
|
@ -5184,7 +5184,7 @@ nonzero_bits1 (const_rtx x, scalar_int_mode mode, const_rtx known_x,
|
||||
case FFS:
|
||||
case POPCOUNT:
|
||||
/* This is at most the number of bits in the mode. */
|
||||
nonzero = ((unsigned HOST_WIDE_INT) 2 << (floor_log2 (mode_width))) - 1;
|
||||
nonzero = (HOST_WIDE_INT_UC (2) << (floor_log2 (mode_width))) - 1;
|
||||
break;
|
||||
|
||||
case CLZ:
|
||||
|
@ -8179,10 +8179,9 @@ dump_varinfo (FILE *file, varinfo_t vi)
|
||||
fprintf (file, "%shead:%u", sep, vi->head);
|
||||
if (vi->offset)
|
||||
fprintf (file, "%soffset:" HOST_WIDE_INT_PRINT_DEC, sep, vi->offset);
|
||||
if (vi->size != ~(unsigned HOST_WIDE_INT)0)
|
||||
if (vi->size != ~HOST_WIDE_INT_0U)
|
||||
fprintf (file, "%ssize:" HOST_WIDE_INT_PRINT_DEC, sep, vi->size);
|
||||
if (vi->fullsize != ~(unsigned HOST_WIDE_INT)0
|
||||
&& vi->fullsize != vi->size)
|
||||
if (vi->fullsize != ~HOST_WIDE_INT_0U && vi->fullsize != vi->size)
|
||||
fprintf (file, "%sfullsize:" HOST_WIDE_INT_PRINT_DEC, sep,
|
||||
vi->fullsize);
|
||||
fprintf (file, "\n");
|
||||
|
@ -2691,7 +2691,7 @@ build_replicated_int_cst (tree type, unsigned int width, HOST_WIDE_INT value)
|
||||
low = value;
|
||||
else
|
||||
{
|
||||
mask = ((HOST_WIDE_INT)1 << width) - 1;
|
||||
mask = (HOST_WIDE_INT_1U << width) - 1;
|
||||
low = (unsigned HOST_WIDE_INT) ~0 / mask * (value & mask);
|
||||
}
|
||||
|
||||
|
@ -3020,7 +3020,7 @@ extern void decl_value_expr_insert (tree, tree);
|
||||
DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
|
||||
has. */
|
||||
#define DECL_OFFSET_ALIGN(NODE) \
|
||||
(((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl_common.off_align)
|
||||
(HOST_WIDE_INT_1U << FIELD_DECL_CHECK (NODE)->decl_common.off_align)
|
||||
|
||||
/* Specify that DECL_OFFSET_ALIGN(NODE) is X. */
|
||||
#define SET_DECL_OFFSET_ALIGN(NODE, X) \
|
||||
|
@ -1713,8 +1713,7 @@ divmod_internal_2 (unsigned HOST_HALF_WIDE_INT *b_quotient,
|
||||
HOST_WIDE_INT and stored in the lower bits of each word. This
|
||||
algorithm should work properly on both 32 and 64 bit
|
||||
machines. */
|
||||
unsigned HOST_WIDE_INT b
|
||||
= (unsigned HOST_WIDE_INT)1 << HOST_BITS_PER_HALF_WIDE_INT;
|
||||
unsigned HOST_WIDE_INT b = HOST_WIDE_INT_1U << HOST_BITS_PER_HALF_WIDE_INT;
|
||||
unsigned HOST_WIDE_INT qhat; /* Estimate of quotient digit. */
|
||||
unsigned HOST_WIDE_INT rhat; /* A remainder. */
|
||||
unsigned HOST_WIDE_INT p; /* Product of two digits. */
|
||||
|
Loading…
Reference in New Issue
Block a user