Some vector operation simplifications.
authorBernd Schmidt <bernds@redhat.co.uk>
Fri, 8 Sep 2000 09:39:23 +0000 (09:39 +0000)
committerBernd Schmidt <crux@gcc.gnu.org>
Fri, 8 Sep 2000 09:39:23 +0000 (09:39 +0000)
From-SVN: r36263

gcc/ChangeLog
gcc/combine.c

index 1a215366390ba062b1c2b2b8a2b03ef17ca2682b..6e2837b660a3b4d4433eb41cbc690a87f892bee3 100644 (file)
@@ -1,3 +1,8 @@
+2000-09-08  Bernd Schmidt  <bernds@redhat.co.uk>
+
+       * combine.c (combine_simplify_rtx): Try to simplify VEC_SELECT of a
+       VEC_CONCAT.
+
 2000-09-07  Richard Henderson  <rth@cygnus.com>
 
        * config/ia64/lib1funcs.asm (__divsi3): Use .s1 for frcpa.
index 56bedce3b3b1ea2c34de194e60d9266ed35140a7..053b42060ce246d39590e7350c207468fd7b1935 100644 (file)
@@ -4539,6 +4539,45 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
 
       break;
 
+    case VEC_SELECT:
+      {
+       rtx op0 = XEXP (x, 0);
+       rtx op1 = XEXP (x, 1);
+       int len;
+
+       if (GET_CODE (op1) != PARALLEL)
+         abort ();
+       len = XVECLEN (op1, 0);
+       if (len == 1
+           && GET_CODE (XVECEXP (op1, 0, 0)) == CONST_INT
+           && GET_CODE (op0) == VEC_CONCAT)
+         {
+           int offset = INTVAL (XVECEXP (op1, 0, 0)) * GET_MODE_SIZE (GET_MODE (x));
+
+           /* Try to find the element in the VEC_CONCAT.  */
+           for (;;)
+             {
+               if (GET_MODE (op0) == GET_MODE (x))
+                 return op0;
+               if (GET_CODE (op0) == VEC_CONCAT)
+                 {
+                   HOST_WIDE_INT op0_size = GET_MODE_SIZE (GET_MODE (XEXP (op0, 0)));
+                   if (op0_size < offset)
+                     op0 = XEXP (op0, 0);
+                   else
+                     {
+                       offset -= op0_size;
+                       op0 = XEXP (op0, 1);
+                     }
+                 }
+               else
+                 break;
+             }
+         }
+      }
+
+      break;
+      
     default:
       break;
     }