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: Scalar vector binary operation


On Mon, 8 Nov 2010, Artem Shinkarov wrote:

> +/* Possibe cases of scalar_to_vector conversion.  */
> +enum stv_conv {
> +  stv_error,
> +  stv_nothing,
> +  stv_firstarg,
> +  stv_secondarg
> +};

The description of the semantics of the individual enum values should go 
here, not on the function scalar_to_vector.

> @@ -2156,7 +2164,7 @@ build_component_ref (location_t loc, tre
>        /* Chain the COMPONENT_REFs if necessary down to the FIELD.
>  	 This might be better solved in future the way the C++ front
>  	 end does it - by giving the anonymous entities each a
> -	 separate name and type, and then have build_component_ref
> +	 /edseparate name and type, and then have build_component_ref
>  	 recursively call itself.  We can't do that here.  */
>        do
>  	{

This change seems bogus.

> +/* Return true if expression EXPR can be converted to the
> +   vector type TYPE preserving its value.  */

I don't see anything here that checks whether integers can safely be 
converted to floating-point types (thus, any short value can be converted 
to float, but some int values cannot, for example).

Such logic exists in c-common.c:conversion_warning.  It would be good to 
share as much code as possible with that function.

> +  else if (TREE_CODE (expr) == REAL_CST)
> +    {
> +      REAL_VALUE_TYPE c, c1;
> +      c = TREE_REAL_CST (expr);
> +      real_convert (&c1, mode, &c);
> +      return real_identical (&c, &c1);

conversion_warning uses exact_real_truncate....

-- 
Joseph S. Myers
joseph@codesourcery.com


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