OSDN Git Service

PR target/23630
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Aug 2005 05:00:37 +0000 (05:00 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Aug 2005 05:00:37 +0000 (05:00 +0000)
        * expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: Use gen_lowpart
        whenever the mode sizes match.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103660 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expr.c

index b3d7f35..33a5c70 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-30  Richard Henderson  <rth@redhat.com>
+
+       PR target/23630
+       * expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: Use gen_lowpart
+       whenever the mode sizes match.
+
 2005-08-31  Alan Modra  <amodra@bigpond.net.au>
 
        * calls.c (load_register_parameters): Fix comment typo.
@@ -84,8 +90,8 @@
 2005-08-27  David Edelsohn  <edelsohn@gnu.org>
 
        PR target/23539
-        * config/rs6000/rs6000.c (expand_block_clear): Use HImode when
-        bytes >= 2 not bytes == 2.
+       * config/rs6000/rs6000.c (expand_block_clear): Use HImode when
+       bytes >= 2 not bytes == 2.
        (expand_block_move): Same.
 
 2005-08-27  Richard Guenther  <rguenther@suse.de>
index b15283a..e619808 100644 (file)
@@ -7505,18 +7505,23 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
     case VIEW_CONVERT_EXPR:
       op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier);
 
-      /* If the input and output modes are both the same, we are done.
-        Otherwise, if neither mode is BLKmode and both are integral and within
-        a word, we can use gen_lowpart.  If neither is true, make sure the
-        operand is in memory and convert the MEM to the new mode.  */
+      /* If the input and output modes are both the same, we are done.  */
       if (TYPE_MODE (type) == GET_MODE (op0))
        ;
+      /* If neither mode is BLKmode, and both modes are the same size
+        then we can use gen_lowpart.  */
       else if (TYPE_MODE (type) != BLKmode && GET_MODE (op0) != BLKmode
-              && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
-              && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT
-              && GET_MODE_SIZE (TYPE_MODE (type)) <= UNITS_PER_WORD
-              && GET_MODE_SIZE (GET_MODE (op0)) <= UNITS_PER_WORD)
+              && GET_MODE_SIZE (TYPE_MODE (type))
+                  == GET_MODE_SIZE (GET_MODE (op0)))
        op0 = gen_lowpart (TYPE_MODE (type), op0);
+      /* If both modes are integral, then we can convert from one to the
+        other.  */
+      else if (SCALAR_INT_MODE_P (GET_MODE (op0))
+              && SCALAR_INT_MODE_P (TYPE_MODE (type)))
+       op0 = convert_modes (TYPE_MODE (type), GET_MODE (op0), op0, 
+                            TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
+      /* As a last resort, spill op0 to memory, and reload it in a 
+        different mode.  */
       else if (!MEM_P (op0))
        {
          /* If the operand is not a MEM, force it into memory.  Since we