-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIavx512Related to the AVX-512 architectureRelated to the AVX-512 architecture
Milestone
Description
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
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
class Program
{
[MethodImpl(MethodImplOptions.NoInlining)]
static Vector512<int> BadShift(Vector512<int> x) => x >> 8;
static void Main() => 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 data
G_M000_IG01: ;; offset=0000H
vzeroupper
G_M000_IG02: ;; offset=0003H
vmovups zmm0, zmmword ptr [rdx]
vpsrad ymm0, ymm0, 8
vmovups zmmword ptr [rcx], zmm0
mov rax, rcx
G_M000_IG03: ;; offset=0017H
vzeroupper
ret
; Total bytes of code 27Regression?
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
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIavx512Related to the AVX-512 architectureRelated to the AVX-512 architecture