expmed.c (extract_bit_field_1): Avoid clobbering a yet-to-be-used base/index register.
authorDJ Delorie <dj@redhat.com>
Sat, 30 May 2015 06:05:54 +0000 (02:05 -0400)
committerDJ Delorie <dj@gcc.gnu.org>
Sat, 30 May 2015 06:05:54 +0000 (02:05 -0400)
* expmed.c (extract_bit_field_1): Avoid clobbering a
yet-to-be-used base/index register.

From-SVN: r223885

gcc/ChangeLog
gcc/expmed.c

index 76992ee4a75cd107d9283c0583d3c4d89265ff33..2f3fcaef24297e1dd35ed7230f68f4bfd8f09a23 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-28  DJ Delorie  <dj@redhat.com>
+
+       * expmed.c (extract_bit_field_1): Avoid clobbering a
+       yet-to-be-used base/index register.
+
 2015-05-30  Jan Hubicka  <hubicka@ucw.cz>
 
        * alias.c (alias_set_entry_d): Add is_pointer and has_pointer.
index fa13f8ced3fc47cdd3fd4e0c8dce4d76b292b4aa..4b2b02659e7803088dfd66b59bfc9b78b59ceb54 100644 (file)
@@ -1616,6 +1616,11 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
       if (target == 0 || !REG_P (target) || !valid_multiword_target_p (target))
        target = gen_reg_rtx (mode);
 
+      /* In case we're about to clobber a base register or something 
+        (see gcc.c-torture/execute/20040625-1.c).   */
+      if (reg_mentioned_p (target, str_rtx))
+       target = gen_reg_rtx (mode);
+
       /* Indicate for flow that the entire target reg is being set.  */
       emit_clobber (target);