Description
When right shifting a Vector512 with the >> operator, the generated code contains a shift instruction to the ymm register rather than zmm, causing the upper lanes of the resulting vector to contain zeroes/wrong values.
This problem appears to be specific to this operator, the others (and the static functions) are working properly.
Reproduction Steps
usingSystem.Runtime.CompilerServices;usingSystem.Runtime.Intrinsics;classProgram{[MethodImpl(MethodImplOptions.NoInlining)]staticVector512<int>BadShift(Vector512<int>x)=>x>>8;staticvoidMain()=>BadShift(Vector512.Create(511));}Expected behavior
JIT should emit the correct instruction operand.
Actual behavior
JIT emits an incorrect instruction operand:
; Assembly listing for method Program:BadShift(System.Runtime.Intrinsics.Vector512`1[int]):System.Runtime.Intrinsics.Vector512`1[int]; Emitting BLENDED_CODE for X64 with AVX512 - Windows; optimized code; rsp based frame; partially interruptible; No PGO dataG_M000_IG01: ;; offset=0000HvzeroupperG_M000_IG02: ;; offset=0003Hvmovupszmm0, zmmword ptr [rdx]vpsradymm0,ymm0,8vmovups zmmword ptr [rcx],zmm0movrax,rcxG_M000_IG03: ;; offset=0017Hvzeroupperret; Total bytes of code 27
Regression?
No response
Known Workarounds
Using Vector512.ShiftRightArithmetic(x, 8) instead of x >> 8.
Configuration
.NET SDK:
Version: 8.0.100-preview.6.23330.14
Commit: ba97796b8f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
Other information
No response
Description
When right shifting a
Vector512with the>>operator, the generated code contains a shift instruction to theymmregister rather thanzmm, causing the upper lanes of the resulting vector to contain zeroes/wrong values.This problem appears to be specific to this operator, the others (and the static functions) are working properly.
Reproduction Steps
Expected behavior
JIT should emit the correct instruction operand.
Actual behavior
JIT emits an incorrect instruction operand:
Regression?
No response
Known Workarounds
Using
Vector512.ShiftRightArithmetic(x, 8)instead ofx >> 8.Configuration
.NET SDK:
Version: 8.0.100-preview.6.23330.14
Commit: ba97796b8f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
Other information
No response