dotnet/runtime
Auf GitHub ansehenRecognize Shift(vec, vec(8)) and replace with Shift(vec, 8)
Open
#99.009 geöffnet am 27. Feb. 2024
area-CodeGen-coreclrhelp wanted
Repository-Metriken
- Stars
- (17.886 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 12T 11h) (661 gemergte PRs in 30 T)
Beschreibung
public static Vector<uint> Method(Vector<uint> v)
{
return Method<Struct>(v);
}
public static Vector<uint> Method<TStruct>(Vector<uint> v) where TStruct : IInterface
{
return v << TStruct.Shift;
}
public interface IInterface
{
public static abstract int Shift { get; }
}
public struct Struct : IInterface
{
public static int Shift => 8;
}
Actual codegen:
C.Method(System.Numerics.Vector`1<UInt32>)
L0000: vzeroupper
L0003: vmovups ymm0, [rdx]
L0007: mov eax, 8
L000c: vmovd xmm1, eax
L0010: vpslld ymm0, ymm0, xmm1
L0014: vmovups [rcx], ymm0
L0018: mov rax, rcx
L001b: vzeroupper
L001e: ret
Expected codegen:
C.Method(System.Numerics.Vector`1<UInt32>)
L0000: vzeroupper
L0003: vmovups ymm0, [rdx]
L0007: vpslld ymm0, ymm0, 8
L000c: vmovups [rcx], ymm0
L0010: mov rax, rcx
L0013: vzeroupper
L0016: ret