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: [patch] Fix PR tree-optimization/46049 and tree-optimization/46052 - take 2


On Thu, Oct 21, 2010 at 5:15 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
>
> Richard Guenther <rguenther@suse.de> wrote on 19/10/2010 04:49:02 PM:
>
>> > Now I see this code in vectorizable_operation:
>> >
>> > ? ? ? ? ? ? ? /* Unlike the other binary operators, shifts/rotates have
>> > ? ? ? ? ? ? ? ? ?the rhs being int, instead of the same type as the
> lhs,
>> > ? ? ? ? ? ? ? ? ?so make sure the scalar is the right type if we are
>> > ? ? ? ? ? ? ? ? ?dealing with vectors of short/char. ?*/
>> > ? ? ? ? ? ? ? if (dt[1] == vect_constant_def)
>> > ? ? ? ? ? ? ? ? op1 = fold_convert (TREE_TYPE (vectype), op1);
>> >
>> > op1 is passed to vect_get_vec_def_for_operand, but not to
>> > vect_get_constant_vectors, which explains the difference in behavior
>> > between regular vectorization and SLP. So, now I think that it will be
>> > enough to pass op1 to SLP functions in order to fix this.
>>
>> Ick - what a twisted maze! ;)
>
> Hopefully the attached patch removes one twist... It adds a new function
> vectorizable_shift and passes operands to vect_get_slp_defs.
>
> Bootstrapped and tested on x86_64-suse-linux and powerpc64-suse-linux.
> I'll commit it to trunk (if there are no objections) and prepare similar
> patch to fix PR 45902 on 4.5.
>
> Thanks,
> Ira
>
> ChangeLog:
>
> ? ? ? ?PR tree-optimization/46049
> ? ? ? ?PR tree-optimization/46052
> ? ? ? ?* tree-vectorizer.h (enum stmt_vec_info_type): Add new value for
> ? ? ? ?shift.
> ? ? ? ?(vect_get_slp_defs): Add arguments.
> ? ? ? ?* tree-vect-loop.c (vect_create_epilog_for_reduction): Pass scalar
> ? ? ? ?operands to vect_get_slp_defs.
> ? ? ? ?(vectorizable_reduction): Fix comment, pass scalar operands to
> ? ? ? ?vect_get_slp_defs.
> ? ? ? ?* tree-vect-stmts.c (vect_get_vec_def_for_operand): Use operand's
> ? ? ? ?type to determine number of units in the created vector.
> ? ? ? ?(vect_get_vec_defs): Pass scalar operands to vect_get_slp_defs.
> ? ? ? ?(vectorizable_conversion): Fix comment.
> ? ? ? ?(vectorizable_shift): New function.
> ? ? ? ?(vectorizable_operation): Move code that handles shifts to
> ? ? ? ?vectorizable_shift.
> ? ? ? ?(vectorizable_type_demotion): Fix comment, pass scalar operands to
> ? ? ? ?vect_get_slp_defs.
> ? ? ? ?(vectorizable_type_promotion, vectorizable_store): Likewise.
> ? ? ? ?(vectorizable_condition): Fix comment.
> ? ? ? ?(vect_analyze_stmt): Call vectorizable_shift.
> ? ? ? ?(vect_transform_stmt): Likewise.
> ? ? ? ?* tree-vect-slp.c (vect_get_constant_vectors): Add new argument.
> ? ? ? ?Use it as the operand to create vectors for, except reduction
> ? ? ? ?initial definition and store. Use operands type.
> ? ? ? ?(vect_get_slp_defs): Add new arguments. Pass them to
> ? ? ? ?vect_get_constant_vectors.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46126



-- 
H.J.


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