diff mbox series

Simplify range-op shift mask generation

Message ID 20240924132056.A32B63858CD1@sourceware.org
State New
Headers show
Series Simplify range-op shift mask generation | expand

Commit Message

Richard Biener Sept. 24, 2024, 1:20 p.m. UTC
The following reduces the number of wide_ints built which show up
in the profile for PR114855 as the largest remaining bit at -O1.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	* range-op.cc (operator_rshift::op1_range): Use wi::mask instead
	of shift and not.
---
 gcc/range-op.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index c576f688221..3f5cf083440 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -2863,7 +2863,7 @@  operator_rshift::op1_range (irange &r,
       // OP1 is anything from 0011 1000 to 0011 1111.  That is, a
       // range from LHS<<3 plus a mask of the 3 bits we shifted on the
       // right hand side (0x07).
-      wide_int mask = wi::bit_not (wi::lshift (wi::minus_one (prec), shift));
+      wide_int mask = wi::mask (shift.to_uhwi (), false, prec);
       int_range_max mask_range (type,
 				wi::zero (TYPE_PRECISION (type)),
 				mask);