re PR tree-optimization/69399 (wrong code with -O and int128)

PR tree-optimization/69399
	* wide-int.h (wi::lrshift): For larger precisions, only
	use fast path if shift is known to be < HOST_BITS_PER_WIDE_INT.

	* gcc.dg/torture/pr69399.c: New test.

From-SVN: r232869
This commit is contained in:
Jakub Jelinek 2016-01-27 12:40:04 +01:00 committed by Jakub Jelinek
parent dfa654c8cf
commit b1652ddea9
4 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-01-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/69399
* wide-int.h (wi::lrshift): For larger precisions, only
use fast path if shift is known to be < HOST_BITS_PER_WIDE_INT.
2016-01-27 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/predicates.md (proper_comparison_operator): Reject

View File

@ -1,3 +1,8 @@
2016-01-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/69399
* gcc.dg/torture/pr69399.c: New test.
2016-01-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/tree-ssa/ssa-dom-cse-2.c: XFAIL on SPARC 64-bit.

View File

@ -0,0 +1,18 @@
/* { dg-do run { target int128 } } */
static unsigned __attribute__((noinline, noclone))
foo (unsigned long long u)
{
unsigned __int128 v = u | 0xffffff81U;
v >>= 64;
return v;
}
int
main ()
{
unsigned x = foo (27);
if (x != 0)
__builtin_abort ();
return 0;
}

View File

@ -2909,7 +2909,9 @@ wi::lrshift (const T1 &x, const T2 &y)
For variable-precision integers like wide_int, handle HWI
and sub-HWI integers inline. */
if (STATIC_CONSTANT_P (xi.precision > HOST_BITS_PER_WIDE_INT)
? xi.len == 1 && xi.val[0] >= 0
? (shift < HOST_BITS_PER_WIDE_INT
&& xi.len == 1
&& xi.val[0] >= 0)
: xi.precision <= HOST_BITS_PER_WIDE_INT)
{
val[0] = xi.to_uhwi () >> shift;