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] Optimize COND_EXPR where then/else operands are INTEGER_CSTs of different size than the comparison operands


On 6 October 2011 18:17, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> Since Richard's changes recently to allow different modes in vcond
> patterns (so far on i?86/x86_64 only I think) we can vectorize more
> COND_EXPRs than before, and this patch improves it a tiny bit more
> - even i?86/x86_64 support vconds only if the sizes of vector element
> modes are the same. ?With this patch we can optimize even if it is wider
> or narrower, by vectorizing it as the COND_EXPR in integer mode matching
> the size of the comparsion operands and then a cast.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>

OK, but...

> --- gcc/tree-vect-stmts.c.jj ? ?2011-09-29 14:25:46.000000000 +0200
> +++ gcc/tree-vect-stmts.c ? ? ? 2011-10-06 12:16:43.000000000 +0200
> @@ -652,9 +652,26 @@ vect_mark_stmts_to_be_vectorized (loop_v
> ? ? ? ? ? ? ?have to scan the RHS or function arguments instead. ?*/
> ? ? ? ? ? if (is_gimple_assign (stmt))
> ? ? ? ? ? ? {
> - ? ? ? ? ? ? ?for (i = 1; i < gimple_num_ops (stmt); i++)
> + ? ? ? ? ? ? enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
> + ? ? ? ? ? ? tree op = gimple_assign_rhs1 (stmt);
> +
> + ? ? ? ? ? ? i = 1;
> + ? ? ? ? ? ? if ((rhs_code == COND_EXPR || rhs_code == VEC_COND_EXPR)

I don't understand why we need VEC_COND_EXPR here.

> + ? ? ? ? ? ? ? ? && COMPARISON_CLASS_P (op))
> + ? ? ? ? ? ? ? {
> + ? ? ? ? ? ? ? ? if (!process_use (stmt, TREE_OPERAND (op, 0), loop_vinfo,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? live_p, relevant, &worklist)
> + ? ? ? ? ? ? ? ? ? ? || !process_use (stmt, TREE_OPERAND (op, 1), loop_vinfo,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?live_p, relevant, &worklist))
> + ? ? ? ? ? ? ? ? ? {
> + ? ? ? ? ? ? ? ? ? ? VEC_free (gimple, heap, worklist);
> + ? ? ? ? ? ? ? ? ? ? return false;
> + ? ? ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? ? ? i = 2;
> + ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? for (; i < gimple_num_ops (stmt); i++)
> ? ? ? ? ? ? ? ? {
> - ? ? ? ? ? ? ? ? ?tree op = gimple_op (stmt, i);
> + ? ? ? ? ? ? ? ? op = gimple_op (stmt, i);
> ? ? ? ? ? ? ? ? ? if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &worklist))
> ? ? ? ? ? ? ? ? ? ? {
>

Thanks,
Ira


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