]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/51821 (64bit > 32bit conversion produces incorrect results...
authorUros Bizjak <uros@gcc.gnu.org>
Sun, 15 Jan 2012 20:27:17 +0000 (21:27 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Sun, 15 Jan 2012 20:27:17 +0000 (21:27 +0100)
PR rtl-optimization/51821
* recog.c (peep2_find_free_register): Determine clobbered registers
from insn pattern.

testsuite/ChangeLog:

PR rtl-optimization/51821
* gcc.dg/pr51821.c: New test.

From-SVN: r183199

gcc/ChangeLog
gcc/recog.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr51821.c [new file with mode: 0644]

index 4c52caf14455552bcef713f839f4e308b7c9a06d..efe8df0fee7bdb6bfbc7a18bef4a1c9ac9689bb7 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-15  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/51821
+       * recog.c (peep2_find_free_register): Determine clobbered registers
+       from insn pattern.
+
 2012-01-12  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
 
        Backport from mainline:
@@ -35,8 +41,8 @@
        Backport from mainline
        2010-09-15  Martin Jambor  <mjambor@suse.cz>
 
-        PR middle-end/45644
-        * tree-sra.c (create_access): Check for bit-fields directly.
+       PR middle-end/45644
+       * tree-sra.c (create_access): Check for bit-fields directly.
 
 2012-01-09  Eric Botcazou  <ebotcazou@adacore.com>
 
@@ -90,7 +96,7 @@
        CAST_RESTRICT.
 
 2012-01-03  Richard Guenther  <rguenther@suse.de>
+
        Backport from mainline
        2011-08-23  Richard Guenther  <rguenther@suse.de>
 
 2011-10-29  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR target/50691
-       * config/pa/pa.c (emit_move_sequence): Legitimize TLS symbol references.
+       * config/pa/pa.c (emit_move_sequence): Legitimize TLS symbol
+       references.
        * config/pa/pa.h (LEGITIMATE_CONSTANT_P): Return false for
        TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC symbol references.
 
index 254e83a9769d3f73fb5afeacb480c18411270a40..21ecb87be4e291c66263cd4ad9ffe8cc96c9251f 100644 (file)
@@ -2991,6 +2991,7 @@ peep2_find_free_register (int from, int to, const char *class_str,
   static int search_ofs;
   enum reg_class cl;
   HARD_REG_SET live;
+  df_ref *def_rec;
   int i;
 
   gcc_assert (from < MAX_INSNS_PER_PEEP2 + 1);
@@ -3008,13 +3009,15 @@ peep2_find_free_register (int from, int to, const char *class_str,
 
   while (from != to)
     {
-      HARD_REG_SET this_live;
+      gcc_assert (peep2_insn_data[from].insn != NULL_RTX);
+
+      /* Don't use registers set or clobbered by the insn.  */
+      for (def_rec = DF_INSN_DEFS (peep2_insn_data[from].insn);
+          *def_rec; def_rec++)
+       SET_HARD_REG_BIT (live, DF_REF_REGNO (*def_rec));
 
       if (++from >= MAX_INSNS_PER_PEEP2 + 1)
        from = 0;
-      gcc_assert (peep2_insn_data[from].insn != NULL_RTX);
-      REG_SET_TO_HARD_REG_SET (this_live, peep2_insn_data[from].live_before);
-      IOR_HARD_REG_SET (live, this_live);
     }
 
   cl = (class_str[0] == 'r' ? GENERAL_REGS
index 9fb2ffadf735dfca77cc45a73dfbebbc672b3e33..68a7f9e85fdf538ad3d3523037a80b083f5c01f5 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-15  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/51821
+       * gcc.dg/pr51821.c: New test.
+
 2012-01-12  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
 
        Backport from mainline:
@@ -13,7 +18,7 @@
 2012-01-09  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/51759
-        * gcc.dg/ipa/pr45644.c: New test.
+       * gcc.dg/ipa/pr45644.c: New test.
        * g++.dg/ipa/pr51759.C: Likewise.
 
 2012-01-06  Richard Sandiford  <richard.sandiford@linaro.org>
diff --git a/gcc/testsuite/gcc.dg/pr51821.c b/gcc/testsuite/gcc.dg/pr51821.c
new file mode 100644 (file)
index 0000000..e7ba409
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
+
+extern void abort (void);
+
+unsigned int  __attribute__((noinline))
+test (int shift_size)
+{
+  unsigned long long res = ~0;
+
+  return res << shift_size;
+}
+
+int
+main ()
+{
+  int dst = 32;
+
+  if (test (dst) != 0)
+    abort ();
+
+  return 0;
+}