Expose various integer intrinsics for Avx512F, Avx512BW, and Avx512CD (#85833)
authorTanner Gooding <tagoo@outlook.com>
Wed, 10 May 2023 16:04:09 +0000 (09:04 -0700)
committerGitHub <noreply@github.com>
Wed, 10 May 2023 16:04:09 +0000 (09:04 -0700)
commit16559f925702a27a1ee3ffbb553514901aec38f1
treeb9a6646fed62fbeaa699be39103c0e94dae5cedd
parentd8cf33b2873d7472f46242b62639e8d92293bbdf
Expose various integer intrinsics for Avx512F, Avx512BW, and Avx512CD (#85833)

* Expose AlignRight32 and AlignRight64 on Avx512F

* Expose RotateLeft and RotateRight for Avx512F

* Expose SumAbsoluteDifferencesInBlock32 for Avx512BW + DetectConflicts and LeadingZeroCOunt for Avx512DQ

* Exponse TernaryLogic for Avx512F

* Apply formatting patch

* Ensure side effects are preserved when optimizing certain intrinsic imports

* Ensure the instruction code has the SIMD prefix before trying to encode the register

* Ensure side effects have been accounted for before swapping operands

* Move the complex ternary logic simplification logic to import, since the JIT will never produce such nodes itself

* Ensure gtNewSimdUnOpNode(GT_NOT) uses an in range constant for TernaryLogic

* Remove a new assert added to AND_NOT, logging an issue instead

* Add a missing `break;` statement

* Ensure val1/2/3 are GenTree** so swapping works and add a comment explaining the TernaryLogic table

* Fix formatting of a comment

* Don't double encode the 'vvvv' bits for `emitOutputAM`

* Avoid an assert in gtNewSimdCreateBroadcastNode for TYP_LONG on 32-bit

* Ensure we use CHECK_SPILL_ALL

* Ensure mustExpand is handled for `RotateLeft(Vector###<long>)` on 32-bit

* Make sure all tests are actually running and handle the "maybe no jmp table fallback"

* Handle a couple test issues  and ensure we set the constant when normalizing ~B | C

* Ensure ValidateRemaining uses firstOp[i]
26 files changed:
src/coreclr/jit/compiler.h
src/coreclr/jit/emitxarch.cpp
src/coreclr/jit/emitxarch.h
src/coreclr/jit/gentree.cpp
src/coreclr/jit/gtlist.h
src/coreclr/jit/hwintrinsic.cpp
src/coreclr/jit/hwintrinsic.h
src/coreclr/jit/hwintrinsiccodegenxarch.cpp
src/coreclr/jit/hwintrinsiclistxarch.h
src/coreclr/jit/hwintrinsicxarch.cpp
src/coreclr/jit/importervectorization.cpp
src/coreclr/jit/instrsxarch.h
src/coreclr/jit/lowerxarch.cpp
src/coreclr/jit/simd.h
src/coreclr/jit/valuenum.cpp
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx512BW.PlatformNotSupported.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx512BW.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx512CD.PlatformNotSupported.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx512CD.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx512F.PlatformNotSupported.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx512F.cs
src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs
src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_X86.cs
src/tests/JIT/HardwareIntrinsics/X86/Shared/Avx512Verify.cs
src/tests/JIT/HardwareIntrinsics/X86/Shared/ImmUnOpTest.template
src/tests/JIT/HardwareIntrinsics/X86/Shared/SseVerify.cs