[PATCH] Add vcond_gen_code optab and expand VEC_COND_EXPR

Devang Patel dpatel@apple.com
Mon Sep 27 15:56:00 GMT 2004


On Sep 24, 2004, at 2:06 PM, Richard Henderson wrote:

> On Thu, Sep 23, 2004 at 02:38:48PM -0700, Devang Patel wrote:
>> !   /* Do not emit cmp instructions for vectors here. 
>> expand_vec_cond_expr() will
>> !      emit appropriate instruction.  */
>> !   if (VECTOR_MODE_P (mode))
>> !     return gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
>
> You don't need this change, corresponding with not needing ...
>
>> +   /* Get comparison rtx.  */
>> +   comparison = compare_from_rtx (rtx_op0, rtx_op1, rcode, unsignedp,
>> + 				 TYPE_MODE (TREE_TYPE (cond)), NULL_RTX);
>
> ... this later.

ok

>
>> !   else if (TREE_CODE (exp) == VEC_COND_EXPR
>> ! 	   && VECTOR_MODE_P (GET_MODE (target)))
>> !       {
>> ! 	target = expand_vec_cond_expr (exp, target);
>> ! 	return target;
>
> This should go in expand_expr_real_1.  And no check for VECTOR_MODE_P.

ok

>
>> +   if (TREE_CODE_CLASS (TREE_CODE (cond)) != '<')
>> +     {
>> +       /* This is unlikely. While generating VEC_COND_EXPR,
>> + 	 auto vectorizer ensures that condition is a relational
>> + 	 operation. Replace 'cond' with 'cond != 0'.  */
>> +       rcode = NE_EXPR;
>> +       t_op0 = cond;
>> +       t_op1 = build_zero_vector (TREE_TYPE (cond));
>
> This should be an abort, I think.  You can't do anything useful here.

done

>
>> +
>> +
>> +
>> +   return comparison;
>
> Watch your whitespace.

ok.

This updated patch uses two new optabs, vcond_gen_code and 
vcondu_gen_code.
Bootstrapped on tested on powerpc-darwin.

OK to commit?
Thanks,
-
Devang

2004-09-27  Devang Patel  <dpatel@apple.com>

         * expr.c (expand_expr_real_1): Handle VEC_COND_EXPR.
         * genopinit.c (optabs): New entry for vcond_gen_code and
         vcondu_gen_code.
         * optabs.c (vcond_gen_code, vcondu_gen_code): New optabs.
         (get_rtx_code): New function.
         (vector_compare_rtx): New function.
         (init_optabs): Initialize vcond_gen_code and vcondu_gen_code.
         (expand_vec_cond_expr_p): New function.
         (expand_vec_cond_expr): New function.
         (get_vcond_icode): New function.
         * optabs.h (expand_vec_cond_expr, expand_vec_cond_expr_p): New 
externs.
         (vcond_gen_code, vcondu_gen_code): Same.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifc2_fsf_mainline.3.3.diff
Type: application/octet-stream
Size: 9615 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040927/b168da85/attachment.obj>


More information about the Gcc-patches mailing list