gcc/
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jul 2011 10:13:30 +0000 (10:13 +0000)
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jul 2011 10:13:30 +0000 (10:13 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176141 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/avr/avr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/avr/torture/pr39633.c [new file with mode: 0644]

index e43ef79..9597705 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-11  Georg-Johann Lay  <avr@gjlay.de>
+       
+       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  <romain.geissler@gmail.com>
 
        * tree.h (call_expr_arg): Remove.
index 5d1a127..128706d 100644 (file)
@@ -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;
index 3ae096e..e87be0d 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-11  Georg-Johann Lay  <avr@gjlay.de>
+       
+       PR target/39633
+       * gcc.target/avr/torture/pr39633.c: New test case.
+
 2011-07-11  Tobias Burnus  <burnus@net-b.de>
 
        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 (file)
index 0000000..c5f5b04
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+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;
+}