On Tue, 2 Aug 2011, Ira Rosen wrote:

> 
> 
> Richard Guenther <rguent...@suse.de> wrote on 02/08/2011 04:25:58 PM:
> 
> 
> >
> > Thinking about it it probably makes sense to keep a variant of this
> > in the vectorizer - after all it has quite specific requirements on
> > operand sizes while VRP would probably demote as far as possible
> > (maybe taking PROMOTE_MODE into account).
> >
> > A quick look at your patch reveals
> >
> > +  if (gimple_assign_rhs_code (use_stmt) == CONVERT_EXPR)
> >
> > CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (use_stmt))
> >
> > +          tmp = create_tmp_var (use_type, NULL);
> >
> > create_tmp_reg
> 
> Why? USE_TYPE is neither COMPLEX_TYPE nor VECTOR_TYPE.

Just for making it the common routine to call whenever you expect
SSA names to be created.  Thus, not confuse people with a mix
of create_tmp_var and create_tmp_reg when they are grepping.

Richard.

> Thanks,
> Ira
> 
> 
> >
> > +  if (!types_compatible_p (TREE_TYPE (oprnd0), type)
> > +      || !types_compatible_p (TREE_TYPE (oprnd1), type)
> > +      || (TREE_CODE (oprnd0) != INTEGER_CST
> > +          && TREE_CODE (oprnd1) != INTEGER_CST))
> >
> > it's always the second operand that is constant, you can simplify
> > the code to not handle CST op SSA.
> >
> > +  code = gimple_assign_rhs_code (stmt);
> > +  if (code != LSHIFT_EXPR && code != RSHIFT_EXPR
> > +      && code != BIT_IOR_EXPR && code != BIT_XOR_EXPR && code !=
> > BIT_AND_EXPR)
> > +    return false;
> > +
> > +  oprnd0 = gimple_assign_rhs1 (stmt);
> > +  oprnd1 = gimple_assign_rhs2 (stmt);
> > +  type = gimple_expr_type (stmt);
> > +  if (!types_compatible_p (TREE_TYPE (oprnd0), type)
> > +      || !types_compatible_p (TREE_TYPE (oprnd1), type)
> >
> > for shifts the type compatibility check of oprnd1 isn't guaranteed
> > (but do we care?  we only will handle constant shift amounts), for
> > the other operands of the codes you handle they always return true.
> >
> > So I'd simplify the check to
> >
> >   if (TREE_CODE (oprnd0) != SSA_NAME
> >       || TREE_CODE (oprnd1) != INTEGER_CST)
> >     return false;
> >
> > Otherwise the patch looks sensible.
> >
> > Richard.
> 
> 

-- 
Richard Guenther <rguent...@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Reply via email to