diff options
author | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-03 12:21:14 +0000 |
---|---|---|
committer | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-03 12:21:14 +0000 |
commit | 4f5712bd2b23b68ba510f4ed99018df2a7c5fb93 (patch) | |
tree | 567eda01e87e579ad9caa799953466f4a2dfb161 /gcc/testsuite | |
parent | bfa091eeca8305aee66359c5333e854ad3f2ddc1 (diff) | |
download | gcc-4f5712bd2b23b68ba510f4ed99018df2a7c5fb93.tar.gz |
gcc/
2012-08-03 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/30318
* double-int.c (mul_double_wide_with_sign): New function.
(mul_double_with_sign): Call the new function.
* double-int.h (mul_double_wide_with_sign): Declare the new function.
* tree-vrp.c (extract_range_from_binary_expr_1) [MULT_EXPR]:
Handle integer types that wrap on overflow.
(quad_int_cmp): New helper function.
(quad_int_pair_sort): Likewise.
gcc/testsuite/
2012-08-03 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/30318
* gcc.dg/tree-ssa/vrp77.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190125 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp77.c | 47 |
2 files changed, 52 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cde4e40bc6c..b7486f97c28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-08-03 Marc Glisse <marc.glisse@inria.fr> + + PR tree-optimization/30318 + * gcc.dg/tree-ssa/vrp77.c: New testcase. + 2012-08-03 Marc Glisse <marc.glisse@inria.fr> * g++.dg/ext/vector17.C: New testcase. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp77.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp77.c new file mode 100644 index 00000000000..c0a8a865388 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp77.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +#ifdef __SIZEOF_INT128__ +#define T __int128 +#else +#define T long long +#endif + +extern void impossible (void); + +void f(T x) +{ + unsigned T y; + unsigned T z; + if (x < -7) + return; + if (x > 2) + return; + y = x; + z = y * y; + if (z == 666) + impossible (); +} + +void g(unsigned T x) +{ + unsigned T y; + unsigned T z; + unsigned T m = -1; + m = m / 2; + if (x < m-2) + return; + if (x > m-1) + return; + y = x; + z = y * y; + /* The product (ignoring it is a square) has only 3 possible values: + 4, 9 and 2^127+6. At least one of the values 7, 666 and -666 is + known to be impossible. 7 is the most logical in the current + implementation. */ + if (z == 7) + impossible (); +} + +/* { dg-final { scan-tree-dump-not "impossible" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |