This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PR48941 / 51980] Rewrite arm_neon.h to use __builtin_shuffle


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:

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;


> Ramana


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]