recent troubles with float vectors & bitwise ops
tbp
tbptbp@gmail.com
Fri Aug 24 15:25:00 GMT 2007
Paolo Bonzini wrote:
> I'm not sure that it is *so* useful for a user to have access to it,
> except for specialized cases:
As there's other means, it may not be that useful but for sure it's
extremely convenient.
> 2) selection operations on vectors, kind of (v1 <= v2 ? v3 : v4). These
> can be written for example like this:
>
> cmpleps xmm1, xmm2 ; xmm1 = xmm1 <= xmm2 ? all-ones : 0
> andnps xmm4, xmm1 ; xmm4 = xmm1 <= xmm2 ? 0 : xmm4
> andps xmm1, xmm3 ; xmm1 = xmm1 <= xmm2 ? xmm3 : 0
> orps xmm1, xmm4 ; xmm1 = xmm1 <= xmm2 ? xmm3 : xmm4
I suppose you'll find such variant of a conditional move pattern in
every piece of SSE code.
But you can't condense bitwise vs float usage to a few patterns because
when writing SSE, the efficiency of those operations is taken for granted.
> If we have a good extension for vector arithmetic, we should aim at
> improving it consistently rather than extending it in unpredictable
> ways. For example, another useful extension would be the ability to
> access vectors by item using x[n] (at least with constant expressions).
Yes, yes and yes.
More information about the Gcc
mailing list