From 7e4ec472eeae2c37c4c16767eca148d568773bd0 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Mon, 11 Jul 2011 10:13:30 +0000 Subject: [PATCH] re PR target/39633 ([avr] loop bug: missing 8-bit comparison (*cmpqi)) gcc/ PR target/39633 * config/avr/avr.c (notice_update_cc): For ashiftrt:QI, only offsets 1..5 set cc0 in a usable way. testsuite/ PR target/39633 * gcc.target/avr/torture/pr39633.c: New test case. From-SVN: r176141 --- gcc/ChangeLog | 6 +++++ gcc/config/avr/avr.c | 5 ++-- gcc/testsuite/ChangeLog | 5 ++++ .../gcc.target/avr/torture/pr39633.c | 25 +++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/avr/torture/pr39633.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e43ef791e20..95977050f49 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-07-11 Georg-Johann Lay + + PR target/39633 + * config/avr/avr.c (notice_update_cc): For ashiftrt:QI, only + offsets 1..5 set cc0 in a usable way. + 2011-07-11 Romain Geissler * tree.h (call_expr_arg): Remove. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 5d1a127ea27..128706d6776 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -1479,9 +1479,8 @@ notice_update_cc (rtx body ATTRIBUTE_UNUSED, rtx insn) { rtx x = XEXP (src, 1); - if (GET_CODE (x) == CONST_INT - && INTVAL (x) > 0 - && INTVAL (x) != 6) + if (CONST_INT_P (x) + && IN_RANGE (INTVAL (x), 1, 5)) { cc_status.value1 = SET_DEST (set); cc_status.flags |= CC_OVERFLOW_UNUSABLE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ae096ec44f..e87be0dc150 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-11 Georg-Johann Lay + + PR target/39633 + * gcc.target/avr/torture/pr39633.c: New test case. + 2011-07-11 Tobias Burnus PR fortran/18918 diff --git a/gcc/testsuite/gcc.target/avr/torture/pr39633.c b/gcc/testsuite/gcc.target/avr/torture/pr39633.c new file mode 100644 index 00000000000..c5f5b0450e6 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr39633.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ + +#include + +char c = 42; + +void __attribute__((noinline,noclone)) +pr39633 (char a) +{ + a >>= 7; + if (a) + c = a; +} + +int main() +{ + pr39633 (6); + + if (c != 42) + abort(); + + exit(0); + + return 0; +} -- 2.30.2