From 4c286961f9ff0fa9ffa4d232978e6617454a8d39 Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 20 Nov 2002 09:43:20 +0000 Subject: [PATCH] * combine.c (force_to_mode): Only replace with (not Y) if all bits in fuller_mask (not just mask) are set in C. * gcc.c-torture/execute/20021118-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59295 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/combine.c | 4 ++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/execute/20021118-3.c | 18 ++++++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021118-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f18c06..5238683 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-11-20 Jakub Jelinek + + * combine.c (force_to_mode): Only replace with (not Y) if all bits in fuller_mask + (not just mask) are set in C. + 2002-11-19 Andreas Jaeger * loop.c (record_giv): Initialize not_replaceable. diff --git a/gcc/combine.c b/gcc/combine.c index 8ce9d10..a0214d1 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6978,10 +6978,10 @@ force_to_mode (x, mode, mask, reg, just_select) return force_to_mode (x, mode, mask, reg, next_select); } - /* Similarly, if C contains every bit in the mask, then we may + /* Similarly, if C contains every bit in the fuller_mask, then we may replace with (not Y). */ if (GET_CODE (XEXP (x, 0)) == CONST_INT - && ((INTVAL (XEXP (x, 0)) | (HOST_WIDE_INT) mask) + && ((INTVAL (XEXP (x, 0)) | (HOST_WIDE_INT) fuller_mask) == INTVAL (XEXP (x, 0)))) { x = simplify_gen_unary (NOT, GET_MODE (x), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb13824..a09e7c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-11-20 Jakub Jelinek + + * gcc.c-torture/execute/20021118-3.c: New test. + 2002-11-19  Eric Botcazou   * gcc.c-torture/compile/20021119-1.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/20021118-3.c b/gcc/testsuite/gcc.c-torture/execute/20021118-3.c new file mode 100644 index 0000000..8ec01ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021118-3.c @@ -0,0 +1,18 @@ +extern void abort (void); +extern void exit (int); + +int +foo (int x) +{ + if (x == -2 || -x - 100 >= 0) + abort (); + return 0; +} + +int +main () +{ + foo (-3); + foo (-99); + exit (0); +} -- 2.7.4