Patchwork [RFC,PR48941,/,51980] Rewrite arm_neon.h to use __builtin_shuffle

login
register
mail settings
Submitter Richard Guenther
Date June 12, 2012, 12:28 p.m.
Message ID <CAFiYyc3BZUJkT4egMQcNgrHB-2QhxTnnG4iavmt=44nCdPavjQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/164405/
State New
Headers show

Comments

Richard Guenther - June 12, 2012, 12:28 p.m.
On Tue, Jun 12, 2012 at 2:23 PM, Ramana Radhakrishnan
<ramana.radhakrishnan@linaro.org> wrote:
>>
>> +  if (TREE_CODE (mask) == SSA_NAME)
>> +    {
>> +      gimple def_stmt = SSA_NAME_DEF_STMT (mask);
>> +      if (is_gimple_assign (def_stmt)
>> +         && gimple_assign_rhs_code (def_stmt) == VECTOR_CST)
>> +       mask = gimple_assign_rhs1 (def_stmt);
>> +    }
>> +
>>   if (TREE_CODE (mask) == VECTOR_CST)
>>     {
>>       unsigned char *sel_int = XALLOCAVEC (unsigned char, elements);
>>
>> pre-approved if it passes bootstrap & regtest.
>
> Thanks that's similar to what I was wiring up. I'm happy to bootstrap
> and regtest that along with my other changes.

Looks like you need to adjust the gimple as well:



> Ramana

Patch

Index: gcc/tree-vect-generic.c
===================================================================
--- gcc/tree-vect-generic.c     (revision 188428)
+++ gcc/tree-vect-generic.c     (working copy)
@@ -628,6 +628,14 @@  lower_vec_perm (gimple_stmt_iterator *gs
   location_t loc = gimple_location (gsi_stmt (*gsi));
   unsigned i;

+  if (TREE_CODE (mask) == SSA_NAME)
+    {
+      gimple def_stmt = SSA_NAME_DEF_STMT (mask);
+      if (is_gimple_assign (def_stmt)
+         && gimple_assign_rhs_code (def_stmt) == VECTOR_CST)
+       mask = gimple_assign_rhs1 (def_stmt);
+    }
+
   if (TREE_CODE (mask) == VECTOR_CST)
     {
       unsigned char *sel_int = XALLOCAVEC (unsigned char, elements);
@@ -637,7 +645,11 @@  lower_vec_perm (gimple_stmt_iterator *gs
                      & (2 * elements - 1));

       if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int))
-       return;
+       {
+         gimple_assign_set_rhs3 (stmt, mask);
+         update_stmt (stmt);
+         return;
+       }
     }
   else if (can_vec_perm_p (TYPE_MODE (vect_type), true, NULL))
     return;