conversions between vectors
Joseph S. Myers
jsm28@cam.ac.uk
Sat Dec 22 11:08:00 GMT 2001
On 22 Dec 2001, Aldy Hernandez wrote:
> we have no support for any kind of operations on vectors. dan berlin
> had a patch for + and - a few weeks ago, but no one approved AFAICT.
We can't expect the intermediate states of work on vector support to be
particularly useful. The final state will allow + when valarrays allow
it.
> from what i've seen in vector extensions, signed and unsigned additions
> for vector types are the same. i don't think there's overflow.
By default one would suppose that + on vectors has the elementwise effect,
with undefined behaviour on overflow if the operation on individual
elements is undefined. I doubt that we should change this, even if the
machine instructions define things more precisely.
> > The programmers should normally be using the much less cumbersome +
>
> i absolutely agree. so, let's get Dan's patch approved.
Does Dan's patch include docs? Let's first get in docs for vectors
corresponding to valarrays (effectively explaining those parts of
valarrays for C programmers), stating what is and is not currently
supported, then start adding the semantics (updating the docs as each part
is implemented). But unless you can produce a bug that this fixes, this
ought to be 3.2 (or some new branch) material rather than for the mainline
now.
> however, what do you do for a function:
>
> void foo (vector int, vector int);
>
> that operates on vector int's but has the same effect for vector
> unsigned as for vector signed? are you going to explicitly require a
> cast? that's the part i don't like.
Define two such functions? Define an alias for the function? Suggest to
the programmer that it might be safer and clearer if they don't use both
signed and unsigned together?
--
Joseph S. Myers
jsm28@cam.ac.uk
More information about the Gcc-patches
mailing list