expr.c (convert_move): Latch mem integer inputs into a register before expanding...
authorOlivier Hainque <hainque@adacore.com>
Thu, 28 Jun 2012 07:56:40 +0000 (07:56 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Thu, 28 Jun 2012 07:56:40 +0000 (07:56 +0000)
        * expr.c (convert_move): Latch mem integer inputs into a
        register before expanding a multi-instructions sequence.

From-SVN: r189040

gcc/ChangeLog
gcc/expr.c

index dd228e8cf73ddba3b7335deea588a30ebfbe6a34..213cca11de58884d3c127edc99881cbd8553ea0a 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-28  OLivier Hainque  <hainque@adacore.com>
+
+       * expr.c (convert_move): Latch mem integer inputs into a
+       register before expanding a multi-instructions sequence.
+
 2012-06-28  Alexandre Oliva  <aoliva@redhat.com>,
             Uros Bizjak  <ubizjak@gmail.com>,
             Jakub Jelinek  <jakub@redhat.com>
index 5295da2149caebabe378079711b26c3274176197..0d26442b500b4c8f1a423e3cde023ecf83bc6d5a 100644 (file)
@@ -520,10 +520,13 @@ convert_move (rtx to, rtx from, int unsignedp)
       /* No special multiword conversion insn; do it by hand.  */
       start_sequence ();
 
-      /* Since we will turn this into a no conflict block, we must ensure
-        that the source does not overlap the target.  */
+      /* Since we will turn this into a no conflict block, we must ensure the
+         the source does not overlap the target so force it into an isolated
+         register when maybe so.  Likewise for any MEM input, since the
+         conversion sequence might require several references to it and we
+         must ensure we're getting the same value every time.  */
 
-      if (reg_overlap_mentioned_p (to, from))
+      if (MEM_P (from) || reg_overlap_mentioned_p (to, from))
        from = force_reg (from_mode, from);
 
       /* Get a copy of FROM widened to a word, if necessary.  */