reorg.c (relax_delay_slots): Create a new variable to hold the temporary target rathe...
authorJeff Law <law@redhat.com>
Mon, 15 May 2017 17:21:31 +0000 (11:21 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 15 May 2017 17:21:31 +0000 (11:21 -0600)
* reorg.c (relax_delay_slots): Create a new variable to hold
the temporary target rather than clobbering TARGET_LABEL.

* gcc.target/mips/reorgbug-1.c: New test.

From-SVN: r248067

gcc/ChangeLog
gcc/reorg.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/reorgbug-1.c [new file with mode: 0644]

index 8cceb247a85871a58b2de4d0ace5f418c9077f50..18b6ed59c73bc21b2943b04cb5089206ab761793 100644 (file)
@@ -1,5 +1,8 @@
 2017-05-15  Jeff Law  <law@redhat.com>
 
+       * reorg.c (relax_delay_slots): Create a new variable to hold
+       the temporary target rather than clobbering TARGET_LABEL.
+
        * config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Add
        missing argument to extract_bit_field call.
        * config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Likewise.
index 85ef7d6880cb34451422cd7db790fd27374b01f5..1a6fd86e2866fc11051bd9b40ac95b225a96aac3 100644 (file)
@@ -3351,16 +3351,16 @@ relax_delay_slots (rtx_insn *first)
          && simplejump_or_return_p (trial_seq->insn (0))
          && redundant_insn (trial_seq->insn (1), insn, vNULL))
        {
-         target_label = JUMP_LABEL (trial_seq->insn (0));
-         if (ANY_RETURN_P (target_label))
-           target_label = find_end_label (target_label);
+         rtx temp_label = JUMP_LABEL (trial_seq->insn (0));
+         if (ANY_RETURN_P (temp_label))
+           temp_label = find_end_label (temp_label);
          
-         if (target_label
+         if (temp_label
              && redirect_with_delay_slots_safe_p (delay_jump_insn,
-                                                  target_label, insn))
+                                                  temp_label, insn))
            {
              update_block (trial_seq->insn (1), insn);
-             reorg_redirect_jump (delay_jump_insn, target_label);
+             reorg_redirect_jump (delay_jump_insn, temp_label);
              next = insn;
              continue;
            }
index f198fc6b42bb5e95b99e0da23c4b551f4916d7d9..9fb8c8598b8396d5f54fe5ccc2e9b58ce3f47577 100644 (file)
@@ -1,3 +1,7 @@
+2017-05-15  Jeff Law  <law@redhat.com>
+
+       * gcc.target/mips/reorgbug-1.c: New test.
+
 2017-05-15  Pierre-Marie de Rodat  <derodat@adacore.com>
 
        * gnat.dg/specs/pack13.ads: New test.
diff --git a/gcc/testsuite/gcc.target/mips/reorgbug-1.c b/gcc/testsuite/gcc.target/mips/reorgbug-1.c
new file mode 100644 (file)
index 0000000..b820a2b
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-options "-O2 -msoft-float -mips2" } */
+
+typedef long int __int32_t;
+typedef long unsigned int __uint32_t;
+typedef union
+{
+  double value;
+  struct
+  {
+    __uint32_t msw;
+    __uint32_t lsw;
+  }
+  parts;
+}
+ieee_double_shape_type;
+double
+__ieee754_fmod (double x, double y, int z, int xx)
+{
+  __int32_t n, hx, hy, hz, ix, iy, sx, i;
+  __uint32_t lx, ly, lz;
+  ieee_double_shape_type ew_u;
+  ew_u.value = (x);
+  (lx) = ew_u.parts.lsw;
+  ew_u.value = (y);
+  (hy) = ew_u.parts.msw;
+  (ly) = ew_u.parts.lsw;
+  if (hy == 0 || hx >= 0x7ff00000)
+    return (x * y);
+  if (z)
+    {
+      if ((hx < hy) || (lx < ly))
+       return x;
+      lz = lx - ly;
+      lx = lz + lz;
+    }
+  ieee_double_shape_type iw_u;
+  iw_u.parts.lsw = (lx);
+  return iw_u.value;
+}