-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
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 SuperPMItenet-performancePerformance related issuePerformance related issue
Milestone
Description
The codegen for Math.SinCos can currently be problematic on GCC and MSVC leading to decreased perf.
https://godbolt.org/z/K5dad3 shows the codegen for:
#include <math.h>
#ifdef _MSC_VER
#pragma float_control(precise, off)
#endif
void SinCos1(float x, float* pSin, float* pCos)
{
#ifdef _MSC_VER
*pSin = sinf(x);
*pCos = cosf(x);
#else
sincosf(x, pSin, pCos);
#endif
}In particular, GCC and MSVC end up with many shuffles between registers and to/from the stack causing a noticeable perf slowdown across hundreds of calls.
https://godbolt.org/z/sG6dTW shows comparison of several other possible variants, but none is "ideal" across all 3 compilers. We should investigate this further to determine what can be done to ensure that SinCos is at least as fast as calling Sin and Cos independently, possibly following up with the MSVC team to improve the codegen here.
category:performance
theme:expression-opts
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 SuperPMItenet-performancePerformance related issuePerformance related issue
Type
Projects
Status
Performance