Does Zig IR have Sum of Absolute Differences operation for vectors?

grep SAD -r didn’t show anything in zig. Question came from learning about GCC’s tree vectors with SAD_EXPR.

I’m not aware of a builtin that does this, so I’d assume there is no functionality for it.
What do you need this for? Is this an actual instruction on some particular hardware that you own?

I only ask out of curiosity. I don’t need this for my zig projects for now.

Zig uses LLVM as a backend. If you are asking if it’s possible to emit a sum of absolute difference instruction, there are three ways of accomplishing that. You can rely on LLVM to optimize a set of operations that can become a single instruction, you can use an intrinsic, or you can use inline assembly. If there’s a specific instruction you want to get, feel free to contact me at any time and I’ll help you.

2 Likes