On Tue, Sep 27, 2011 at 8:32 AM, Ira Rosen <ira.ro...@linaro.org> wrote: > On 26 September 2011 17:12, Richard Guenther <richard.guent...@gmail.com> > wrote: >> On Mon, Sep 19, 2011 at 9:54 AM, Ira Rosen <ira.ro...@linaro.org> wrote: >>> Hi, >>> >>> This patch adds a support of widening shift left. The following >>> pattern is detected: >>> >>> type a_t; >>> TYPE a_T, res_T; >>> >>> a_t = ; >>> a_T = (TYPE) a_t; >>> res_T = a_T << CONST; >>> >>> ('TYPE' is at least 2 times bigger than 'type', and CONST is at most >>> the size of 'type') >>> >>> and create a pattern stmt using new tree code WIDEN_SHIFT_LEFT_EXPR for it: >>> >>> a_t = ; >>> a_T = (TYPE) a_t; >>> res_T = a_T << CONST; >>> --> res_T = a_t w<< CONST; >>> >>> which is later transformed into: >>> >>> va_t = ; >>> vres_T0 = WIDEN_SHIFT_LEFT_LO_EXPR <va_t, CONST>; >>> vres_T1 = WIDEN_SHIFT_LEFT_HI_EXPR <va_t, CONST>; >>> >>> This patch also supports unsigned types, and cases when 'TYPE' is 4 >>> times bigger than 'type'. >>> This feature is similar to vectorization of widening multiplication. >>> >>> Bootstrapped on powerpc64-suse-linux, tested on powerpc64-suse-linux >>> and arm-linux-gnueabi >>> OK for mainline? >> >> Hmm, it doesn't look like arm has real widening shift instructions. > > It does: vshll. The implementation may look awkward because we don't > support multiple vector sizes in the same operation (vshll takes a > 64-bit vector and produces a 128-bit vector), but the resulting code > is just the instruction itself.
Ah, ok. Can you please do s/SHIFT_LEFT/LSHIFT/ on the new tree code names for consistency with LSHIFT_EXPR? Also please implement some gimple verification for the new codes instead of sticking them to the /* FIXME */ case in tree-cfg.c. >> So why not split this into the widening, shift parts in the vectorizer? > > What do you mean? (We of course already support widening first and > then shifting the widened value). Of course. Ok with the above changes. Thanks, Richard. > Thanks, > Ira > >> That >> way you wouldn't need new tree codes and all architectures that can >> do widening conversions would benefit? >> >> Thanks, >> Richard. >> >