Commit 07bfc9ec by Richard Biener Committed by Richard Biener

double-int.h (lshift): New overload without precision and arith argument.

2013-05-03  Richard Biener  <rguenther@suse.de>

	* double-int.h (lshift): New overload without precision
	and arith argument.
	(operator *=, operator +=, operator -=): Move ...
	* double-int.c (operator *=, operator +=, operator -=): ... here
	and implement more efficiently.
	(mul_double_with_sign): Remove.
	(lshift_double): Adjust to take unsinged shift argument, push
	dispatching code to callers.
	(mul_double_wide_with_sign): Add early out for callers that
	are not interested in high parts or overflow.
	(lshift): New function.
	(lshift, rshift, alshift, arshift, llshift, lrshift): Add
	dispatch code here.
	(lrotate, rrotate): Use logical shifts.
	* expr.c (get_inner_reference): Use lshift.
	* fixed-value.c (do_fixed_divide): Likewise.
	* tree-dfa.c (get_ref_base_and_extent): Likewise.
	* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Likewise.
	(indirect_refs_may_alias_p): Likewise.
	(stmt_kills_ref_p_1): Likewise.

From-SVN: r198576
parent 7769bb64
2013-05-03 Richard Biener <rguenther@suse.de>
* double-int.h (lshift): New overload without precision
and arith argument.
(operator *=, operator +=, operator -=): Move ...
* double-int.c (operator *=, operator +=, operator -=): ... here
and implement more efficiently.
(mul_double_with_sign): Remove.
(lshift_double): Adjust to take unsinged shift argument, push
dispatching code to callers.
(mul_double_wide_with_sign): Add early out for callers that
are not interested in high parts or overflow.
(lshift): New function.
(lshift, rshift, alshift, arshift, llshift, lrshift): Add
dispatch code here.
(lrotate, rrotate): Use logical shifts.
* expr.c (get_inner_reference): Use lshift.
* fixed-value.c (do_fixed_divide): Likewise.
* tree-dfa.c (get_ref_base_and_extent): Likewise.
* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Likewise.
(indirect_refs_may_alias_p): Likewise.
(stmt_kills_ref_p_1): Likewise.
2013-05-03 Vidya Praveen <vidyapraveen@arm.com> 2013-05-03 Vidya Praveen <vidyapraveen@arm.com>
* config/aarch64/aarch64-simd.md (simd_fabd): Correct the description. * config/aarch64/aarch64-simd.md (simd_fabd): Correct the description.
......
...@@ -34,11 +34,6 @@ static int add_double_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT, ...@@ -34,11 +34,6 @@ static int add_double_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
static int neg_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT, static int neg_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *); unsigned HOST_WIDE_INT *, HOST_WIDE_INT *);
static int mul_double_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *,
bool);
static int mul_double_wide_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT, static int mul_double_wide_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT, HOST_WIDE_INT, unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *, unsigned HOST_WIDE_INT *, HOST_WIDE_INT *,
...@@ -46,11 +41,7 @@ static int mul_double_wide_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT, ...@@ -46,11 +41,7 @@ static int mul_double_wide_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
bool); bool);
#define mul_double(l1,h1,l2,h2,lv,hv) \ #define mul_double(l1,h1,l2,h2,lv,hv) \
mul_double_with_sign (l1, h1, l2, h2, lv, hv, false) mul_double_wide_with_sign (l1, h1, l2, h2, lv, hv, NULL, NULL, false)
static void lshift_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
HOST_WIDE_INT, unsigned int,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *, bool);
static int div_and_round_double (unsigned, int, unsigned HOST_WIDE_INT, static int div_and_round_double (unsigned, int, unsigned HOST_WIDE_INT,
HOST_WIDE_INT, unsigned HOST_WIDE_INT, HOST_WIDE_INT, unsigned HOST_WIDE_INT,
...@@ -158,25 +149,13 @@ neg_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, ...@@ -158,25 +149,13 @@ neg_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
} }
} }
/* Multiply two doubleword integers with doubleword result. /* Multiply two doubleword integers with quadword result.
Return nonzero if the operation overflows according to UNSIGNED_P. Return nonzero if the operation overflows according to UNSIGNED_P.
Each argument is given as two `HOST_WIDE_INT' pieces. Each argument is given as two `HOST_WIDE_INT' pieces.
One argument is L1 and H1; the other, L2 and H2. One argument is L1 and H1; the other, L2 and H2.
The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */ The value is stored as four `HOST_WIDE_INT' pieces in *LV and *HV,
*LW and *HW.
static int If lw is NULL then only the low part and no overflow is computed. */
mul_double_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
unsigned HOST_WIDE_INT l2, HOST_WIDE_INT h2,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv,
bool unsigned_p)
{
unsigned HOST_WIDE_INT toplow;
HOST_WIDE_INT tophigh;
return mul_double_wide_with_sign (l1, h1, l2, h2,
lv, hv, &toplow, &tophigh,
unsigned_p);
}
static int static int
mul_double_wide_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, mul_double_wide_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
...@@ -215,6 +194,11 @@ mul_double_wide_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, ...@@ -215,6 +194,11 @@ mul_double_wide_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
} }
decode (prod, lv, hv); decode (prod, lv, hv);
/* We are not interested in the wide part nor in overflow. */
if (lw == NULL)
return 0;
decode (prod + 4, lw, hw); decode (prod + 4, lw, hw);
/* Unsigned overflow is immediate. */ /* Unsigned overflow is immediate. */
...@@ -306,17 +290,11 @@ rshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, ...@@ -306,17 +290,11 @@ rshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
static void static void
lshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, lshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
HOST_WIDE_INT count, unsigned int prec, unsigned HOST_WIDE_INT count, unsigned int prec,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv, bool arith) unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv)
{ {
unsigned HOST_WIDE_INT signmask; unsigned HOST_WIDE_INT signmask;
if (count < 0)
{
rshift_double (l1, h1, absu_hwi (count), prec, lv, hv, arith);
return;
}
if (SHIFT_COUNT_TRUNCATED) if (SHIFT_COUNT_TRUNCATED)
count %= prec; count %= prec;
...@@ -832,6 +810,15 @@ double_int::operator * (double_int b) const ...@@ -832,6 +810,15 @@ double_int::operator * (double_int b) const
return ret; return ret;
} }
/* Multiplies *this with B and returns a reference to *this. */
double_int &
double_int::operator *= (double_int b)
{
mul_double (low, high, b.low, b.high, &low, &high);
return *this;
}
/* Returns A * B. If the operation overflows according to UNSIGNED_P, /* Returns A * B. If the operation overflows according to UNSIGNED_P,
*OVERFLOW is set to nonzero. */ *OVERFLOW is set to nonzero. */
...@@ -839,9 +826,10 @@ double_int ...@@ -839,9 +826,10 @@ double_int
double_int::mul_with_sign (double_int b, bool unsigned_p, bool *overflow) const double_int::mul_with_sign (double_int b, bool unsigned_p, bool *overflow) const
{ {
const double_int &a = *this; const double_int &a = *this;
double_int ret; double_int ret, tem;
*overflow = mul_double_with_sign (a.low, a.high, b.low, b.high, *overflow = mul_double_wide_with_sign (a.low, a.high, b.low, b.high,
&ret.low, &ret.high, unsigned_p); &ret.low, &ret.high,
&tem.low, &tem.high, unsigned_p);
return ret; return ret;
} }
...@@ -869,6 +857,16 @@ double_int::operator + (double_int b) const ...@@ -869,6 +857,16 @@ double_int::operator + (double_int b) const
return ret; return ret;
} }
/* Adds B to *this and returns a reference to *this. */
double_int &
double_int::operator += (double_int b)
{
add_double (low, high, b.low, b.high, &low, &high);
return *this;
}
/* Returns A + B. If the operation overflows according to UNSIGNED_P, /* Returns A + B. If the operation overflows according to UNSIGNED_P,
*OVERFLOW is set to nonzero. */ *OVERFLOW is set to nonzero. */
...@@ -894,6 +892,17 @@ double_int::operator - (double_int b) const ...@@ -894,6 +892,17 @@ double_int::operator - (double_int b) const
return ret; return ret;
} }
/* Subtracts B from *this and returns a reference to *this. */
double_int &
double_int::operator -= (double_int b)
{
neg_double (b.low, b.high, &b.low, &b.high);
add_double (low, high, b.low, b.high, &low, &high);
return *this;
}
/* Returns A - B. If the operation overflows via inconsistent sign bits, /* Returns A - B. If the operation overflows via inconsistent sign bits,
*OVERFLOW is set to nonzero. */ *OVERFLOW is set to nonzero. */
...@@ -1076,6 +1085,37 @@ double_int::trailing_zeros () const ...@@ -1076,6 +1085,37 @@ double_int::trailing_zeros () const
return bits; return bits;
} }
/* Shift A left by COUNT places. */
double_int
double_int::lshift (HOST_WIDE_INT count) const
{
double_int ret;
gcc_checking_assert (count >= 0);
if (count >= HOST_BITS_PER_DOUBLE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
ret.high = 0;
ret.low = 0;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{
ret.high = low << (count - HOST_BITS_PER_WIDE_INT);
ret.low = 0;
}
else
{
ret.high = (((unsigned HOST_WIDE_INT) high << count)
| (low >> (HOST_BITS_PER_WIDE_INT - count - 1) >> 1));
ret.low = low << count;
}
return ret;
}
/* Shift A left by COUNT places keeping only PREC bits of result. Shift /* Shift A left by COUNT places keeping only PREC bits of result. Shift
right if COUNT is negative. ARITH true specifies arithmetic shifting; right if COUNT is negative. ARITH true specifies arithmetic shifting;
otherwise use logical shift. */ otherwise use logical shift. */
...@@ -1083,9 +1123,11 @@ double_int::trailing_zeros () const ...@@ -1083,9 +1123,11 @@ double_int::trailing_zeros () const
double_int double_int
double_int::lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const double_int::lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const
{ {
const double_int &a = *this;
double_int ret; double_int ret;
lshift_double (a.low, a.high, count, prec, &ret.low, &ret.high, arith); if (count > 0)
lshift_double (low, high, count, prec, &ret.low, &ret.high);
else
rshift_double (low, high, absu_hwi (count), prec, &ret.low, &ret.high, arith);
return ret; return ret;
} }
...@@ -1096,9 +1138,11 @@ double_int::lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const ...@@ -1096,9 +1138,11 @@ double_int::lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const
double_int double_int
double_int::rshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const double_int::rshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const
{ {
const double_int &a = *this;
double_int ret; double_int ret;
lshift_double (a.low, a.high, -count, prec, &ret.low, &ret.high, arith); if (count > 0)
rshift_double (low, high, count, prec, &ret.low, &ret.high, arith);
else
lshift_double (low, high, absu_hwi (count), prec, &ret.low, &ret.high);
return ret; return ret;
} }
...@@ -1109,7 +1153,10 @@ double_int ...@@ -1109,7 +1153,10 @@ double_int
double_int::alshift (HOST_WIDE_INT count, unsigned int prec) const double_int::alshift (HOST_WIDE_INT count, unsigned int prec) const
{ {
double_int r; double_int r;
lshift_double (low, high, count, prec, &r.low, &r.high, true); if (count > 0)
lshift_double (low, high, count, prec, &r.low, &r.high);
else
rshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high, true);
return r; return r;
} }
...@@ -1120,7 +1167,10 @@ double_int ...@@ -1120,7 +1167,10 @@ double_int
double_int::arshift (HOST_WIDE_INT count, unsigned int prec) const double_int::arshift (HOST_WIDE_INT count, unsigned int prec) const
{ {
double_int r; double_int r;
lshift_double (low, high, -count, prec, &r.low, &r.high, true); if (count > 0)
rshift_double (low, high, count, prec, &r.low, &r.high, true);
else
lshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high);
return r; return r;
} }
...@@ -1131,7 +1181,10 @@ double_int ...@@ -1131,7 +1181,10 @@ double_int
double_int::llshift (HOST_WIDE_INT count, unsigned int prec) const double_int::llshift (HOST_WIDE_INT count, unsigned int prec) const
{ {
double_int r; double_int r;
lshift_double (low, high, count, prec, &r.low, &r.high, false); if (count > 0)
lshift_double (low, high, count, prec, &r.low, &r.high);
else
rshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high, false);
return r; return r;
} }
...@@ -1142,7 +1195,10 @@ double_int ...@@ -1142,7 +1195,10 @@ double_int
double_int::lrshift (HOST_WIDE_INT count, unsigned int prec) const double_int::lrshift (HOST_WIDE_INT count, unsigned int prec) const
{ {
double_int r; double_int r;
lshift_double (low, high, -count, prec, &r.low, &r.high, false); if (count > 0)
rshift_double (low, high, count, prec, &r.low, &r.high, false);
else
lshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high);
return r; return r;
} }
...@@ -1158,8 +1214,8 @@ double_int::lrotate (HOST_WIDE_INT count, unsigned int prec) const ...@@ -1158,8 +1214,8 @@ double_int::lrotate (HOST_WIDE_INT count, unsigned int prec) const
if (count < 0) if (count < 0)
count += prec; count += prec;
t1 = this->lshift (count, prec, false); t1 = this->llshift (count, prec);
t2 = this->rshift (prec - count, prec, false); t2 = this->lrshift (prec - count, prec);
return t1 | t2; return t1 | t2;
} }
...@@ -1176,8 +1232,8 @@ double_int::rrotate (HOST_WIDE_INT count, unsigned int prec) const ...@@ -1176,8 +1232,8 @@ double_int::rrotate (HOST_WIDE_INT count, unsigned int prec) const
if (count < 0) if (count < 0)
count += prec; count += prec;
t1 = this->rshift (count, prec, false); t1 = this->lrshift (count, prec);
t2 = this->lshift (prec - count, prec, false); t2 = this->llshift (prec - count, prec);
return t1 | t2; return t1 | t2;
} }
......
...@@ -128,6 +128,7 @@ struct double_int ...@@ -128,6 +128,7 @@ struct double_int
double_int operator ^ (double_int) const; double_int operator ^ (double_int) const;
double_int and_not (double_int) const; double_int and_not (double_int) const;
double_int lshift (HOST_WIDE_INT count) const;
double_int lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const; double_int lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const;
double_int rshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const; double_int rshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const;
double_int alshift (HOST_WIDE_INT count, unsigned int prec) const; double_int alshift (HOST_WIDE_INT count, unsigned int prec) const;
...@@ -258,27 +259,6 @@ double_int::operator -- () ...@@ -258,27 +259,6 @@ double_int::operator -- ()
} }
inline double_int & inline double_int &
double_int::operator *= (double_int b)
{
*this = *this * b;
return *this;
}
inline double_int &
double_int::operator += (double_int b)
{
*this = *this + b;
return *this;
}
inline double_int &
double_int::operator -= (double_int b)
{
*this = *this - b;
return *this;
}
inline double_int &
double_int::operator &= (double_int b) double_int::operator &= (double_int b)
{ {
*this = *this & b; *this = *this & b;
......
...@@ -6704,9 +6704,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, ...@@ -6704,9 +6704,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
if (!integer_zerop (off)) if (!integer_zerop (off))
{ {
double_int boff, coff = mem_ref_offset (exp); double_int boff, coff = mem_ref_offset (exp);
boff = coff.alshift (BITS_PER_UNIT == 8 boff = coff.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
bit_offset += boff; bit_offset += boff;
} }
exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
...@@ -6732,8 +6731,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, ...@@ -6732,8 +6731,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
{ {
double_int tem = tree_to_double_int (offset); double_int tem = tree_to_double_int (offset);
tem = tem.sext (TYPE_PRECISION (sizetype)); tem = tem.sext (TYPE_PRECISION (sizetype));
tem = tem.alshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT), tem = tem.lshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
tem += bit_offset; tem += bit_offset;
if (tem.fits_shwi ()) if (tem.fits_shwi ())
{ {
......
...@@ -569,14 +569,14 @@ do_fixed_divide (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a, ...@@ -569,14 +569,14 @@ do_fixed_divide (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a,
int leftmost_mod = (mod.high < 0); int leftmost_mod = (mod.high < 0);
/* Shift left mod by 1 bit. */ /* Shift left mod by 1 bit. */
mod = mod.llshift (1, HOST_BITS_PER_DOUBLE_INT); mod = mod.lshift (1);
/* Test the leftmost bit of s to add to mod. */ /* Test the leftmost bit of s to add to mod. */
if (s.high < 0) if (s.high < 0)
mod.low += 1; mod.low += 1;
/* Shift left quo_s by 1 bit. */ /* Shift left quo_s by 1 bit. */
quo_s = quo_s.llshift (1, HOST_BITS_PER_DOUBLE_INT); quo_s = quo_s.lshift (1);
/* Try to calculate (mod - pos_b). */ /* Try to calculate (mod - pos_b). */
temp = mod - pos_b; temp = mod - pos_b;
...@@ -588,7 +588,7 @@ do_fixed_divide (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a, ...@@ -588,7 +588,7 @@ do_fixed_divide (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a,
} }
/* Shift left s by 1 bit. */ /* Shift left s by 1 bit. */
s = s.llshift (1, HOST_BITS_PER_DOUBLE_INT); s = s.lshift (1);
} }
......
...@@ -433,9 +433,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -433,9 +433,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (this_offset && TREE_CODE (this_offset) == INTEGER_CST) if (this_offset && TREE_CODE (this_offset) == INTEGER_CST)
{ {
double_int doffset = tree_to_double_int (this_offset); double_int doffset = tree_to_double_int (this_offset);
doffset = doffset.alshift (BITS_PER_UNIT == 8 doffset = doffset.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
doffset += tree_to_double_int (DECL_FIELD_BIT_OFFSET (field)); doffset += tree_to_double_int (DECL_FIELD_BIT_OFFSET (field));
bit_offset = bit_offset + doffset; bit_offset = bit_offset + doffset;
...@@ -501,9 +500,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -501,9 +500,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
= (TREE_INT_CST (index) - TREE_INT_CST (low_bound)) = (TREE_INT_CST (index) - TREE_INT_CST (low_bound))
.sext (TYPE_PRECISION (TREE_TYPE (index))); .sext (TYPE_PRECISION (TREE_TYPE (index)));
doffset *= tree_to_double_int (unit_size); doffset *= tree_to_double_int (unit_size);
doffset = doffset.alshift (BITS_PER_UNIT == 8 doffset = doffset.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
bit_offset = bit_offset + doffset; bit_offset = bit_offset + doffset;
/* An array ref with a constant index up in the structure /* An array ref with a constant index up in the structure
...@@ -552,9 +550,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -552,9 +550,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
else else
{ {
double_int off = mem_ref_offset (exp); double_int off = mem_ref_offset (exp);
off = off.alshift (BITS_PER_UNIT == 8 off = off.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
off = off + bit_offset; off = off + bit_offset;
if (off.fits_shwi ()) if (off.fits_shwi ())
{ {
...@@ -583,9 +580,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -583,9 +580,8 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
else else
{ {
double_int off = mem_ref_offset (exp); double_int off = mem_ref_offset (exp);
off = off.alshift (BITS_PER_UNIT == 8 off = off.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
off += bit_offset; off += bit_offset;
if (off.fits_shwi ()) if (off.fits_shwi ())
{ {
......
...@@ -882,9 +882,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, ...@@ -882,9 +882,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
/* The offset embedded in MEM_REFs can be negative. Bias them /* The offset embedded in MEM_REFs can be negative. Bias them
so that the resulting offset adjustment is positive. */ so that the resulting offset adjustment is positive. */
moff = mem_ref_offset (base1); moff = mem_ref_offset (base1);
moff = moff.alshift (BITS_PER_UNIT == 8 moff = moff.lshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT));
? 3 : exact_log2 (BITS_PER_UNIT),
HOST_BITS_PER_DOUBLE_INT);
if (moff.is_negative ()) if (moff.is_negative ())
offset2p += (-moff).low; offset2p += (-moff).low;
else else
...@@ -960,9 +958,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, ...@@ -960,9 +958,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
|| TREE_CODE (dbase2) == TARGET_MEM_REF) || TREE_CODE (dbase2) == TARGET_MEM_REF)
{ {
double_int moff = mem_ref_offset (dbase2); double_int moff = mem_ref_offset (dbase2);
moff = moff.alshift (BITS_PER_UNIT == 8 moff = moff.lshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT));
? 3 : exact_log2 (BITS_PER_UNIT),
HOST_BITS_PER_DOUBLE_INT);
if (moff.is_negative ()) if (moff.is_negative ())
doffset1 -= (-moff).low; doffset1 -= (-moff).low;
else else
...@@ -1056,17 +1052,13 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, ...@@ -1056,17 +1052,13 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
/* The offset embedded in MEM_REFs can be negative. Bias them /* The offset embedded in MEM_REFs can be negative. Bias them
so that the resulting offset adjustment is positive. */ so that the resulting offset adjustment is positive. */
moff = mem_ref_offset (base1); moff = mem_ref_offset (base1);
moff = moff.alshift (BITS_PER_UNIT == 8 moff = moff.lshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT));
? 3 : exact_log2 (BITS_PER_UNIT),
HOST_BITS_PER_DOUBLE_INT);
if (moff.is_negative ()) if (moff.is_negative ())
offset2 += (-moff).low; offset2 += (-moff).low;
else else
offset1 += moff.low; offset1 += moff.low;
moff = mem_ref_offset (base2); moff = mem_ref_offset (base2);
moff = moff.alshift (BITS_PER_UNIT == 8 moff = moff.lshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT));
? 3 : exact_log2 (BITS_PER_UNIT),
HOST_BITS_PER_DOUBLE_INT);
if (moff.is_negative ()) if (moff.is_negative ())
offset1 += (-moff).low; offset1 += (-moff).low;
else else
...@@ -2014,14 +2006,12 @@ stmt_kills_ref_p_1 (gimple stmt, ao_ref *ref) ...@@ -2014,14 +2006,12 @@ stmt_kills_ref_p_1 (gimple stmt, ao_ref *ref)
TREE_OPERAND (ref->base, 0))) TREE_OPERAND (ref->base, 0)))
{ {
double_int off1 = mem_ref_offset (base); double_int off1 = mem_ref_offset (base);
off1 = off1.alshift (BITS_PER_UNIT == 8 off1 = off1.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
off1 = off1 + double_int::from_shwi (offset); off1 = off1 + double_int::from_shwi (offset);
double_int off2 = mem_ref_offset (ref->base); double_int off2 = mem_ref_offset (ref->base);
off2 = off2.alshift (BITS_PER_UNIT == 8 off2 = off2.lshift (BITS_PER_UNIT == 8
? 3 : exact_log2 (BITS_PER_UNIT), ? 3 : exact_log2 (BITS_PER_UNIT));
HOST_BITS_PER_DOUBLE_INT);
off2 = off2 + double_int::from_shwi (ref_offset); off2 = off2 + double_int::from_shwi (ref_offset);
if (off1.fits_shwi () && off2.fits_shwi ()) if (off1.fits_shwi () && off2.fits_shwi ())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment