c - how to link against sse intrinsics when using icc on OS X -
c - how to link against sse intrinsics when using icc on OS X -
not sure gcc, using clang can take address of sse intrinsic, without much trouble, unfortunately when seek same thing using icc on os x, fails, precise linker unable locate underlying function ...
for example:
sse.h:
#include <immintrin.h> static __m128i (*load)(const __m128i *) = &_mm_load_si128;
main.c:
#include <stdio.h> #include "sse.h" int main(void) { char buffer[sizeof(__m128i)] __attribute__((aligned(sizeof(__m128i)))); __m128i b = load((void *)buffer); printf("%i\n", _mm_extract_epi16(b, 0)); homecoming 0; }
to clear not want utilize macros, curious why this, main goal create dispatcher, preferably @ compile time, depending on how aggressive compiler optimizes, thats story.
$ gcc main.c -o0 $ $ gcc --version configured with: --prefix=/applications/xcode.app/contents/developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 apple llvm version 6.0 (clang-600.0.51) (based on llvm 3.5svn) target: x86_64-apple-darwin13.4.0 thread model: posix $ $ icc main.c -o0 undefined symbols architecture x86_64: "__mm_load_si128", referenced from: _load in icckt7t6c.o ld: symbol(s) not found architecture x86_64 $ icc --version icc (icc) 13.0.0 20120731 copyright (c) 1985-2012 intel corporation. rights reserved. $ $ uname -a darwin *****-macbook-pro.local 13.4.0 darwin kernel version 13.4.0: sun aug 17 19:50:11 pdt 2014; root:xnu-2422.115.4~1/release_x86_64 x86_64
i'm not aware of solution writing code once, , beingness able compile either 256bit avx or 128bit sse. i'm pretty sure isn't it, though.
notice icc got far link stage before had problem. maybe if you'd turned on optimization, have inlined phone call , not referenced symbol @ all.
you absolutely need compiler inline calls function pointers, though. running single sse instructions through function pointer not going create fast code. (esp. if compiler makes functions follow usual abi, xmm registers caller-save (i.e. must assume callee clobbers them)).
c clang sse ld icc
Comments
Post a Comment