FIAS . Impressum . Privacy

add support for unsigned char

Matthias Kretz [please enable javascript to see the address]
Thu Oct 1 10:46:21 CEST 2015


Hi Paul,

On Wednesday 30 September 2015 21:49:11 paul elsner wrote:
> I want to add support for unsigned char to the library to later on use
> functions like _mm_sad_epu8.

Yes!!

> Where should I start and on which branch? I saw that there is a huge
> difference where types are defined between 0.8 and master.

Definitely start on master. I'm currently working on stabilizing for Vc 1.0. 
So your target would be 1.1 or 2.0.
The changes on master will make your job easier. I did a lot of cleanup and 
removed code duplication. Also you will find that the AVX and SSE 
implementations are already prepared for (un)signed char types.

I recommend you take the arithmetics unit test and add Vc::uchar_v to the list 
of types to test. Then fix/implement whatever the test/compiler tells you.

Regarding the SAD instruction. This thing is quite special. Do you know of any 
equivalent function/abstraction that you could use to model the interface 
after? Otherwise you'll probably just have to go with a function such as
  ushort_v sum_of_8_absolute_differences(uchar_v a, uchar_v b)

> An additional problem is that master does not build currently on my mac
> with clang 7.0.0:
> 
> In file included from
> /Users/paulwork/repo/Vc/build/trigonometric_SSE2.cpp:32:
> In file included from /Users/paulwork/repo/Vc/include/Vc/vector.h:147:
> 
> */Users/paulwork/repo/Vc/scalar/math.h:93:7: **error: *
> *no member named 'sincos' in the global namespace; did you mean '__sincos'?*
>   ::sincos(x.data(), &sin->data(), &cos->data());
> 
> *    ~~^~~~~~*      __sincos
> 
> 
> */Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Develo
> per/SDKs/MacOSX10.11.sdk/usr/include/math.h:666:29: note: *      '__sincos'
> declared here
> __header_always_inline void __sincos(double __x, double *__sinp, double
> *__cosp) {
> 
> *                            ^*1 error generated.
> make[2]: *** [CMakeFiles/Vc.dir/trigonometric_SSE2.cpp.o] Error 1
> 
> 
> Any thoughts on that?

This should be easy to fix. I don't have a Apple-flavored clang to test this 
myself. I was searching for a sincos function on Mac, but could not find 
anything documented on the web. I just pushed a fix to use std::sin and 
std::cos on Apple. Let me know.

Cheers,
  Matthias





More information about the Vc-devel mailing list
FIAS . Impressum . Privacy