-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
Priority:3Work that is nice to haveWork that is nice to havearea-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 SuperPMIgood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issuePerformance related issue
Milestone
Description
public float GetComp5(uint color) {
return color * (255 / 31f);
}
converted to
C.GetComp5(UInt32)
L0000: vzeroupper
L0003: mov eax, edx
L0005: vxorps xmm0, xmm0, xmm0
L0009: vcvtsi2sd xmm0, xmm0, rax ; <-- 2x conversion, should use cvtsi2ss
L000e: vcvtsd2ss xmm0, xmm0, xmm0
L0012: vmulss xmm0, xmm0, [0x7ff9f52004a0]
L001a: ret
there shouldn't be two conversions, integer directly to single-precision is possible
for reference, clang does this (in C++):
GetComp5(unsigned int):
mov edi, edi
pxor xmm0, xmm0
cvtsi2ss xmm0, rdi
mulss xmm0, DWORD PTR .LC2[rip]
ret
Metadata
Metadata
Assignees
Labels
Priority:3Work that is nice to haveWork that is nice to havearea-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 SuperPMIgood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issuePerformance related issue