Hello all -
I’m trying to find the llvm intrinsic name for the VPANDNPS AVX instruction to be able to call the intrinsic directly (usually something like x86_avx2_xxx). Usually google or a search through the .td files or source turns something up, but I’m stumped with this one. Any help would be much appreciated.
Hi Matt -
I think this should either be VPANDN (integer) or VANDNPS (float); there is no “VPANDNPS”.
I don’t think there is an intrinsic. This is supported by native IR by looking for something like (and %a, (xor %b, -1))
Thanks for the correction Sanjay; I meant VANDNPS.
Thanks Craig. I guess that works. Is there a better way to get access to AVX intrinsics in the future? I am using LLVM to jit AVX code and I need to use the intrinsics directly when there isn’t a native LLVM intrinsic. Is there any reason why these aren’t exposed to LLVM users when a native LLVM intrinsic doesn’t exist?
LLVM and clang only provide intrinsics for things that cannot be represented in a straightforward way in the LLVM IR. This means for simple things like and/or/xor/add/sub/cmp there are no instrinics. Most shuffles also have to be implemented through the shufflevector IR instruction. This minimizes the number of intrinsics that have to be supported and allows the optimizers to just be aware of the native IR.
The clang docs have this to say
“Please note that Clang does not and will not support all of the GCC builtins for vector operations. Instead of using builtins, you should use the functions defined in target-specific header files like
<xmmintrin.h>, which define portable wrappers for these. Many of the Clang versions of these functions are implemented directly in terms of extended vector support instead of builtins, in order to reduce the number of builtins that we need to implement.”