-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 SuperPMI
Milestone
Description
Slightly refactoring vector code can degrade CQ in some cases:
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
class C
{
static float M1(float v)
{
return Sse2.Or(Vector128.CreateScalarUnsafe(v), Vector128.Create(2).AsSingle()).ToScalar();
}
[SkipLocalsInit] // ".locals init" -> ".locals" in IL (it had no effect on codegen)
static float M1_afterRefactoring(float v)
{
Vector128<float> op2 = Vector128.Create(2).AsSingle();
return Sse2.Or(Vector128.CreateScalarUnsafe(v), op2).ToScalar();
}
}
.NET 6 x64 codegen:
C.M1(Single)
vzeroupper
vorps xmm0, xmm0, [0x7ffb275b0450]
ret
C.M1_afterRefactoring(Single)
vzeroupper
vmovupd xmm1, [0x7ffb275b04a0]
vorps xmm0, xmm0, xmm1
ret
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 SuperPMI
Type
Projects
Status
Done