]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add code written by rth to generate use shifts to perform an extension if no
authorNick Clifton <nickc@cygnus.com>
Wed, 28 Oct 1998 10:30:46 +0000 (10:30 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Wed, 28 Oct 1998 10:30:46 +0000 (10:30 +0000)
suitable extend patterns can be found.

From-SVN: r23398

gcc/ChangeLog
gcc/expr.c

index a84f2124f9a14c294f87210b77985df8540c0581..21ec81f21df80c63e18a2c118c7da163b6ca66ed 100644 (file)
@@ -1,3 +1,9 @@
+Wed Oct 28 10:29:09 1998  Nick Clifton  <nickc@cygnus.com>
+
+       * expr.c (convert_move): Use shifts to perform the move if a
+       suitable extend pattern cannot be found.  Code written by
+       Richard Henderson <rth@cygnus.com>.
+
 Wed Oct 28 03:59:29 1998  Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
 
        * regclass.c (renumber, regno_allocated): New static variables, moved
index 37581ec39ce81e3f214e231360e0e56fbd3e44f8..1dd7cb718d6455e7efba688457a333c033947dc8 100644 (file)
@@ -1100,6 +1100,8 @@ convert_move (to, from, unsignedp)
       else
        {
          enum machine_mode intermediate;
+         rtx tmp;
+         tree shift_amount;
 
          /* Search for a mode to convert via.  */
          for (intermediate = from_mode; intermediate != VOIDmode;
@@ -1116,8 +1118,18 @@ convert_move (to, from, unsignedp)
                return;
              }
 
-         /* No suitable intermediate mode.  */
-         abort ();
+         /* No suitable intermediate mode.
+            Generate what we need with shifts. */
+         shift_amount = build_int_2 (GET_MODE_BITSIZE (to_mode)
+                                     - GET_MODE_BITSIZE (from_mode), 0);
+         from = gen_lowpart (to_mode, force_reg (from_mode, from));
+         tmp = expand_shift (LSHIFT_EXPR, to_mode, from, shift_amount,
+                             to, unsignedp);
+         tmp = expand_shift (RSHIFT_EXPR, to_mode, tmp,  shift_amount,
+                             to, unsignedp);
+         if (tmp != to)
+           emit_move_insn (to, tmp);
+         return;
        }
     }