From 446faf9d7a8a1d1ed8510e5c169b763fb51c7027 Mon Sep 17 00:00:00 2001 From: phython <phython@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri, 29 Jul 2005 15:22:07 +0000 Subject: 2005-07-29 James A. Morrison <phython@gcc.gnu.org> * tree-vrp.c (compare_range_with_value): Return true or false for ~[VAL_1, VAL_2] OP VAL if VAL_1 <= VAL <= VAL_2 for NE_EXPR and EQ_EXPR respectively. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102558 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gcc.dg/tree-ssa/vrp19.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/vrp19.c (limited to 'gcc/testsuite/gcc.dg/tree-ssa/vrp19.c') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c new file mode 100644 index 00000000000..45a85fafe1b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-vrp" } */ + +#include <limits.h> +extern void abort (); +extern void exit (int); + +int f (int a) { + if (a != INT_MIN) { + a = a > 0 ? a : -a; + if (a < 0) + return 1; + } + return 0; +} + +int g (int b) { + if (b != INT_MIN) { + b = b > 0 ? b : -b; + if (b >= 0) + return 0; + } + return 1; +} +/* { dg-final { scan-tree-dump "Folding predicate a_. < 0 to 0" "vrp" } } */ +/* { dg-final { scan-tree-dump "Folding predicate b_. >= 0 to 1" "vrp" } } */ +/* { dg-final { cleanup-tree-dump "vrp" } } */ -- cgit v1.2.1