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] [Patch]: Try and vectorize with shift for mult expr with power 2 integer constant.


Hi Jeff, 

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Jeff Law
> Sent: Monday, August 03, 2015 11:42 PM
> To: Kumar, Venkataramanan; Jakub Jelinek
> Cc: Richard Beiner (richard.guenther@gmail.com); gcc-patches@gcc.gnu.org
> Subject: Re: [RFC] [Patch]: Try and vectorize with shift for mult expr with
> power 2 integer constant.
> 
> On 08/02/2015 05:03 AM, Kumar, Venkataramanan wrote:
> > Hi Jakub,
> >
> > Thank you for reviewing the patch.
> >
> > I have incorporated your comments in the attached patch.
> Note Jakub is on PTO for the next 3 weeks.

 Thank you for this information.

> 
> 
> >
> >
> >
> > vectorize_mults_via_shift.diff.txt
> >
> >
> > diff --git a/gcc/testsuite/gcc.dg/vect/vect-mult-patterns.c
> > b/gcc/testsuite/gcc.dg/vect/vect-mult-patterns.c
> Jakub would probably like more testcases :-)
> 
> The most obvious thing to test would be other shift factors.
> 
> A negative test to verify we don't try to turn a multiply by non-constant or
> multiply by a constant that is not a power of 2 into shifts.

I have added negative test in the attached patch.


> 
> [ Would it make sense, for example, to turn a multiply by 3 into a shift-add
> sequence?  As Jakub said, choose_mult_variant can be your friend. ]

Yes I will do that in a follow up patch.   

The new change log becomes 

gcc/ChangeLog
2015-08-04  Venkataramanan Kumar  <Venkataramanan.kumar@amd.com>
     * tree-vect-patterns.c (vect_recog_mult_pattern): New function for vectorizing
        multiplication patterns.
     * tree-vectorizer.h: Adjust the number of patterns.

gcc/testsuite/ChangeLog
2015-08-04  Venkataramanan Kumar  <Venkataramanan.kumar@amd.com>
     * gcc.dg/vect/vect-mult-pattern-1.c: New
    * gcc.dg/vect/vect-mult-pattern-2.c: New

Bootstrapped and reg tested on aarch64-unknown-linux-gnu.

Ok for trunk ?

> 
> 
> 
> > @@ -2147,6 +2152,140 @@ vect_recog_vector_vector_shift_pattern
> (vec<gimple> *stmts,
> >     return pattern_stmt;
> >   }
> >
> > +/* Detect multiplication by constant which are postive or negatives
> > +of power 2,
> s/postive/positive/
> 
> 
> Jeff

Regards,
Venkat.

Attachment: vectorize_mults_via_shift.diff.txt
Description: vectorize_mults_via_shift.diff.txt


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