Discussion:
Common simd instructions and the gcc vector extensions
Hendrik Siedelmann
2014-06-14 08:03:05 UTC
Permalink
Hello everybody,

I'm trying to use the vector extensions, but I'm unable to find common
functions like min/max or saturated arithmetic. Given that those are
pretty essential simd instructions I expected something like
_builtin_min(). Are there other ways to express those instructions?

Cheers,
Hendrik
Marc Glisse
2014-06-14 19:34:40 UTC
Permalink
Post by Hendrik Siedelmann
I'm trying to use the vector extensions, but I'm unable to find common
functions like min/max or saturated arithmetic. Given that those are pretty
essential simd instructions I expected something like _builtin_min(). Are
there other ways to express those instructions?
Did you try (a<b)?a:b ?
--
Marc Glisse
Hendrik Siedelmann
2014-06-15 08:21:10 UTC
Permalink
Post by Marc Glisse
Post by Hendrik Siedelmann
I'm trying to use the vector extensions, but I'm unable to find common
functions like min/max or saturated arithmetic. Given that those are
pretty essential simd instructions I expected something like
_builtin_min(). Are there other ways to express those instructions?
Did you try (a<b)?a:b ?
You mean element-wise? That doesn't get vectorized for some reason. Or
do you mean with whole vectors? That complains with:
error: used vector type where scalar is required
Are there tricks like this for saturated arithmetics?

Thanks
Hendrik
Marc Glisse
2014-06-15 08:43:48 UTC
Permalink
Post by Hendrik Siedelmann
Post by Marc Glisse
Post by Hendrik Siedelmann
I'm trying to use the vector extensions, but I'm unable to find common
functions like min/max or saturated arithmetic. Given that those are
pretty essential simd instructions I expected something like
_builtin_min(). Are there other ways to express those instructions?
Did you try (a<b)?a:b ?
You mean element-wise?
No.
Post by Hendrik Siedelmann
That doesn't get vectorized for some reason.
Some versions are (one of the vectors involved has to be non-local).
I hope this limitation will be lifted some day.
Post by Hendrik Siedelmann
Or do you mean with whole vectors? That complains with: error: used
vector type where scalar is required
That's only supported in C++, sorry.
Post by Hendrik Siedelmann
Are there tricks like this for saturated arithmetics?
I am not familiar with that so I cannot answer.
--
Marc Glisse
Loading...