[mono] Fix LLVM IR emission for Ssse3.AlignRight and Sse2/Sse41.Extract (#20429)
commita50346aac7a2f9afbd75ce85612ca92af8d9fe0e
authormonojenkins <jo.shields+jenkins@xamarin.com>
Thu, 24 Sep 2020 08:07:19 +0000 (24 04:07 -0400)
committerGitHub <noreply@github.com>
Thu, 24 Sep 2020 08:07:19 +0000 (24 01:07 -0700)
treeb559d96bb10ae00cdddc47bc122d86c25298ee42
parentf9db252a5ffcf0aba3bc31092caa73098a2e419e
[mono] Fix LLVM IR emission for Ssse3.AlignRight and Sse2/Sse41.Extract (#20429)

The `mask` parameter to `shufflevector` must be a vector of `i32`s; we
were mistakenly using a vector of `i8`s previously.

`extractelement` requires that supplied index is smaller than the source
vector's length. The underlying instructions only pay attention to the
lower bits of the index, so replicate this behavior manually with
masking at the LLVM IR level.

This change makes JIT/HardwareIntrinsics/X86/Sse2/Sse2_{r,ro} pass with
LLVM JIT. LLVM AOT still makes this test fail for unrelated reasons.

This change makes more subtests in
JIT/HardwareIntrinsics/X86/Ssse3/Ssse3_{r,ro} pass with LLVM JIT. But
there are still other unrelated failures.

Co-authored-by: imhameed <imhameed@users.noreply.github.com>
mono/mini/mini-llvm.c