[mono] Implement Sse2.AddSaturate using LLVM#32116
Conversation
| {INTRINS_SSE_ROUNDPD, "llvm.x86.sse41.round.pd"}, | ||
| {INTRINS_SSE_PTESTZ, "llvm.x86.sse41.ptestz"}, | ||
| {INTRINS_SSE_INSERTPS, "llvm.x86.sse41.insertps"}, | ||
| #if LLVM_API_VERSION >= 800 |
There was a problem hiding this comment.
|
@EgorBo, is there a doc on how to add these as work happens so we can get both done at the same time in the future? Is it worth doing it for ARM64 as well and would the process be similar? |
@tannergooding Not yet, the code needs some refactoring as there are too many repeatable patterns. The problem is the fact that sometimeы hw intrinsics are implemented as LLVM named intrinsics but in most cases we have to use native llvm-vector operators to implement them. But I'll try to compose a small doc. But first we need to add "Mono-LLVM CI lane" to catch such things (intrinsics are implemented only when LLVM back-end is available) 🙂
We currently don't support them yet (there is a PR but it's WIP and only for scalar intrinsics so far) |
Mono currently supports a limited subset of Sse1-Sse42 intrinsics used only by CoreLib internally. So once a new API is used to optimize things there, we also have to implement it in Mono. So it recently happened in #32036 (
Sse2.AddSaturatewas used for the first time).So this PR implements it for mono (with all Sse2 overloads) using named LLVM intrinsics. It turns out it's different between LLVM6 (we currently based on) and LLVM9 (we plan to migrate to soon).
for
Vector128<byte>overload it emitswhich is then emitted as
vpaddusw