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 PR28268, ICE building vector const { 1, 1 }


On Thu, 6 Jul 2006, Paolo Bonzini wrote:

> 
> > This makes me uncomfortable.  The number zero seems like a special
> > case which merits special handling.  The number one does not.  What
> > you are looking for is a function which returns the multiplicative
> > identity for TYPE.  Currently you are getting it by calling
> > fold_convert (TYPE, integer_one_node).  Suppose you write the
> > multiplicative identify function, and handle VECTOR_TYPE there, rather
> > than making the number one a special case in fold_convert?
> 
> I agree, and there is indeed already get_one_constant in tree-ssa-math-opts.c.

/* Return the LHS of a RDIV_EXPR that computes a reciprocal in type TYPE.  
*/
static tree
get_constant_one (tree type)

;)

well, ok - more like writing a general one.  And I'd call it 
build_cst_one?  (or even build_one_cst to mimic build_int_cst).

> I'd suggest that you move it to fold-const.c and use it.
> 
> I think -1 is way more "special" than 1.  It is not stretching the argument as
> much as 1, because it is always "all ones".

It depends on what transformations you are after.

Richard.

--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs


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