Re: [PATCH] Vector to scalar casting and widening

Ulrich Weigand
2012-11-29T17:50:17Z

Andrew Burgess wrote:
> On 26/11/2012 2:18 PM, Ulrich Weigand wrote:
> > Thus, I'd prefer a patch that:
> > - changes the default behaviour of value_cast etc. to the GCC behaviour, and
> > - adds handling of UNOP_CAST etc. to evaluate_subexp_opencl to implement the
> > OpenCL semantics.
>
> The latest patch below is is closer to the initial patch I posted, the
> behaviour of value_cast now follows GCC, and the UNOP_CAST case is handled
> in evaluate_subexp_opencl. I wasn't sure what the "etc" in the above point
> referred to, I believe UNOP_CAST is all I need to catch, let me know if I've
> missed anything.

Well, there's the whole "vector <binop> scalar" issue; with your patch, this
is now only supported if the scalar type is widened, and rejected if it is
truncated. This does not correspond to OpenCL semantics, where truncation
is explicitly supported.

Another problem: in several places in opencl-lang.c, the code calls
value_cast with the explicit assumption that this will splat a scalar
across all vector components. Those uses would now have to be changed
to a value_cast/value_vector_widen pair, I guess.

> > Unfortunately the only environment I know of to test the GDB OpenCL support
> > is the IBM OpenCL SDK for PowerPC. I'll be happy to run the test for you ...
>
> I've built and tested on x86-64 GNU/Linux, but I've not run any OpenCL tests. If
> you were able to give this patch a go and let me know if I've broken any of the
> OpenCL tests I'd be very grateful.

As expected, given the above, a whole bunch of tests fail ...

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com