aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@baylibre.com>2024-02-22 15:41:00 +0000
committerAndrew Stubbs <ams@baylibre.com>2024-03-04 15:39:02 +0000
commit77eb86be8841989651b3150a020dd1a95910cc00 (patch)
tree224f200a1925178ff144b02b4119a17e24fc76ab /gcc/expr.cc
parent71244316cf714725930c2de61c79d635238595bf (diff)
downloadgcc-77eb86be8841989651b3150a020dd1a95910cc00.zip
gcc-77eb86be8841989651b3150a020dd1a95910cc00.tar.gz
gcc-77eb86be8841989651b3150a020dd1a95910cc00.tar.bz2
vect: Fix integer overflow calculating mask
The masks and bitvectors were broken when nunits==32 on hosts where int is 32-bit. gcc/ChangeLog: * dojump.cc (do_compare_and_jump): Use full-width integers for shifts. * expr.cc (store_constructor): Likewise. (do_store_flag): Likewise.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 8d34d02..f7d7452 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -7879,8 +7879,8 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size,
auto nunits = TYPE_VECTOR_SUBPARTS (type).to_constant ();
if (maybe_ne (GET_MODE_PRECISION (mode), nunits))
tmp = expand_binop (mode, and_optab, tmp,
- GEN_INT ((1 << nunits) - 1), target,
- true, OPTAB_WIDEN);
+ GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1),
+ target, true, OPTAB_WIDEN);
if (tmp != target)
emit_move_insn (target, tmp);
break;
@@ -13707,11 +13707,11 @@ do_store_flag (sepops ops, rtx target, machine_mode mode)
{
gcc_assert (code == EQ || code == NE);
op0 = expand_binop (mode, and_optab, op0,
- GEN_INT ((1 << nunits) - 1), NULL_RTX,
- true, OPTAB_WIDEN);
+ GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1),
+ NULL_RTX, true, OPTAB_WIDEN);
op1 = expand_binop (mode, and_optab, op1,
- GEN_INT ((1 << nunits) - 1), NULL_RTX,
- true, OPTAB_WIDEN);
+ GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1),
+ NULL_RTX, true, OPTAB_WIDEN);
}
if (target == 0)