JIT: Handle half accesses for SIMDs in local morph (#89520)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Thu, 27 Jul 2023 17:07:25 +0000 (19:07 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jul 2023 17:07:25 +0000 (19:07 +0200)
commit87526fb97efcf77092e04180ed9f5be10a085024
tree116de9d2fe498ed952fcbbdce966daa3898941fc
parent7f513e6632cfe011884f4f892d727bb9d1fc6de0
JIT: Handle half accesses for SIMDs in local morph (#89520)

While it's not generally expected that halves can be accessed directly (ending
up with LCL_FLD), it sometimes happens in some of the SW implementations of
Vector256/Vector512 methods. In rare cases the JIT still falls back to these
even with there is HW acceleration. In those cases we want to avoid DNER'ing the
involved locals, so expand the existing recognition with these patterns.

Also add a check to the existing SIMD16 -> SIMD12 to verify the source is a
SIMD16.

Fix #85359
Fix #89456

Some size wise regressions are expected, which come down to

- A large number of similar looking tests end up now enregistering some locals
  that cause new upper half saves/restores to be required. This accounts for
  most of the size-wise regressions.
- The expansions often do not result in smaller code because loading/storing the
  halves directly from/to stack is smaller code than the vector equivalent with
  extraction/insertion.

Many of the regressions are in SW implementations of Vector256/Vector512 methods
that we usually do not expect to see called with HW acceleration supported.
src/coreclr/jit/lclmorph.cpp
src/tests/JIT/Regression/JitBlue/Runtime_89456/Runtime_89456.cs [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_89456/Runtime_89456.csproj [new file with mode: 0644]