Scalar vector binary operation

Artem Shinkarov artyom.shinkaroff@gmail.com
Mon Nov 1 16:21:00 GMT 2010


This patch allows binary operations: "vector <op> scalar" and "scalar
<op> vector" in which case scalar is converted into the vector type,
if the scalar type fits in the vectors element type.

ChangeLog:

2010-11-01  Artjoms Sinkarovs <artyom.shinakroff@gmail.com>

       /gcc
       * tree.c (build_vector_from_val): Build vector from scalar
       * tree.h (build_vector_from_val): New declaration
       * c-typeck.c (expr_fits_type_p): New function. Check if expression
       fits into the type considering constants.
       (scalar_to_vector): New function. Try scalar to vector conversion.
       (build_binary_op): Adjust.
       * doc/extend.texi: Description of scalar to vector expansion.

       /gcc/testsuite
       * gcc.c-torture/execute/scal-to-vec1.c: New test.
       * gcc.dg/scal-to-vec1.c: New test.

bootstrapped and tested on x86_64_unknown-linux

OK?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scal-to-vec.c.v5.diff
Type: text/x-diff
Size: 10868 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101101/153436d5/attachment.bin>


More information about the Gcc-patches mailing list