Skip to content

Commit b269447

Browse files
MichalPetrykajkotas
authored andcommitted
Simplify floating point mod and round math jit helpers
1 parent 78a895f commit b269447

File tree

28 files changed

+56
-289
lines changed

28 files changed

+56
-289
lines changed

src/coreclr/System.Private.CoreLib/src/System/Math.CoreCLR.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ public static unsafe (double Sin, double Cos) SinCos(double x)
115115
[MethodImpl(MethodImplOptions.InternalCall)]
116116
public static extern double Tanh(double value);
117117

118-
[Intrinsic]
119-
[MethodImpl(MethodImplOptions.InternalCall)]
120-
private static extern double FMod(double x, double y);
121-
122118
[MethodImpl(MethodImplOptions.InternalCall)]
123119
private static extern unsafe double ModF(double x, double* intptr);
124120

src/coreclr/System.Private.CoreLib/src/System/MathF.CoreCLR.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ public static unsafe (float Sin, float Cos) SinCos(float x)
112112
[MethodImpl(MethodImplOptions.InternalCall)]
113113
public static extern float Tanh(float x);
114114

115-
[Intrinsic]
116-
[MethodImpl(MethodImplOptions.InternalCall)]
117-
private static extern float FMod(float x, float y);
118-
119115
[MethodImpl(MethodImplOptions.InternalCall)]
120116
private static extern unsafe float ModF(float x, float* intptr);
121117

src/coreclr/classlibnative/float/floatdouble.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,6 @@ FCIMPLEND
181181
#pragma float_control(pop)
182182
#endif
183183

184-
/*=====================================FMod=====================================
185-
**
186-
==============================================================================*/
187-
FCIMPL2_VV(double, COMDouble::FMod, double x, double y)
188-
FCALL_CONTRACT;
189-
190-
return fmod(x, y);
191-
FCIMPLEND
192-
193184
/*=====================================FusedMultiplyAdd==========================
194185
**
195186
==============================================================================*/

src/coreclr/classlibnative/float/floatsingle.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,6 @@ FCIMPL1_V(float, COMSingle::Floor, float x)
156156
return floorf(x);
157157
FCIMPLEND
158158

159-
/*=====================================FMod=====================================
160-
**
161-
==============================================================================*/
162-
FCIMPL2_VV(float, COMSingle::FMod, float x, float y)
163-
FCALL_CONTRACT;
164-
165-
return fmodf(x, y);
166-
FCIMPLEND
167-
168159
/*=====================================FusedMultiplyAdd==========================
169160
**
170161
==============================================================================*/

src/coreclr/classlibnative/inc/floatdouble.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class COMDouble {
2222
FCDECL1_V(static double, Cosh, double x);
2323
FCDECL1_V(static double, Exp, double x);
2424
FCDECL1_V(static double, Floor, double x);
25-
FCDECL2_VV(static double, FMod, double x, double y);
2625
FCDECL3_VVV(static double, FusedMultiplyAdd, double x, double y, double z);
2726
FCDECL1_V(static double, Log, double x);
2827
FCDECL1_V(static double, Log2, double x);

src/coreclr/classlibnative/inc/floatsingle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class COMSingle {
2222
FCDECL1_V(static float, Cosh, float x);
2323
FCDECL1_V(static float, Exp, float x);
2424
FCDECL1_V(static float, Floor, float x);
25-
FCDECL2_VV(static float, FMod, float x, float y);
2625
FCDECL3_VVV(static float, FusedMultiplyAdd, float x, float y, float z);
2726
FCDECL1_V(static float, Log, float x);
2827
FCDECL1_V(static float, Log2, float x);

src/coreclr/inc/corinfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ enum CorInfoHelpFunc
397397
CORINFO_HELP_DBL2ULNG_OVF,
398398
CORINFO_HELP_FLTREM,
399399
CORINFO_HELP_DBLREM,
400-
CORINFO_HELP_FLTROUND,
401-
CORINFO_HELP_DBLROUND,
400+
CORINFO_HELP_FLTROUND, // unused, remove once MINIMUM_READYTORUN_MAJOR_VERSION > 9
401+
CORINFO_HELP_DBLROUND, // unused, remove once MINIMUM_READYTORUN_MAJOR_VERSION > 9
402402

403403
/* Allocating a new object. Always use ICorClassInfo::getNewHelper() to decide
404404
which is the right helper to use to allocate an object of a given type. */

src/coreclr/inc/jithelpers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
JITHELPER(CORINFO_HELP_DBL2ULNG_OVF, JIT_Dbl2ULngOvf, CORINFO_HELP_SIG_8_STACK)
6666
JITHELPER(CORINFO_HELP_FLTREM, JIT_FltRem, CORINFO_HELP_SIG_8_STACK)
6767
JITHELPER(CORINFO_HELP_DBLREM, JIT_DblRem, CORINFO_HELP_SIG_16_STACK)
68-
JITHELPER(CORINFO_HELP_FLTROUND, JIT_FloatRound, CORINFO_HELP_SIG_8_STACK)
69-
JITHELPER(CORINFO_HELP_DBLROUND, JIT_DoubleRound, CORINFO_HELP_SIG_16_STACK)
68+
DYNAMICJITHELPER(CORINFO_HELP_FLTROUND, NULL, CORINFO_HELP_SIG_8_STACK)
69+
DYNAMICJITHELPER(CORINFO_HELP_DBLROUND, NULL, CORINFO_HELP_SIG_16_STACK)
7070

7171
// Allocating a new object
7272
JITHELPER(CORINFO_HELP_NEWFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY)
@@ -203,7 +203,7 @@
203203
JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
204204
JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
205205
JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
206-
JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY)
206+
JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY)
207207
JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY)
208208
JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED, JIT_GetSharedGCThreadStaticBaseOptimized, CORINFO_HELP_SIG_REG_ONLY)
209209
JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED, JIT_GetSharedNonGCThreadStaticBaseOptimized, CORINFO_HELP_SIG_REG_ONLY)

src/coreclr/jit/gentree.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5627,7 +5627,6 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
56275627
case NI_System_Math_Cosh:
56285628
case NI_System_Math_Exp:
56295629
case NI_System_Math_Floor:
5630-
case NI_System_Math_FMod:
56315630
case NI_System_Math_FusedMultiplyAdd:
56325631
case NI_System_Math_ILogB:
56335632
case NI_System_Math_Log:
@@ -12771,9 +12770,6 @@ void Compiler::gtDispTree(GenTree* tree,
1277112770
case NI_System_Math_Floor:
1277212771
printf(" floor");
1277312772
break;
12774-
case NI_System_Math_FMod:
12775-
printf(" fmod");
12776-
break;
1277712773
case NI_System_Math_FusedMultiplyAdd:
1277812774
printf(" fma");
1277912775
break;

src/coreclr/jit/importercalls.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4033,7 +4033,6 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
40334033
case NI_System_Math_Cosh:
40344034
case NI_System_Math_Exp:
40354035
case NI_System_Math_Floor:
4036-
case NI_System_Math_FMod:
40374036
case NI_System_Math_ILogB:
40384037
case NI_System_Math_Log:
40394038
case NI_System_Math_Log2:
@@ -7369,7 +7368,6 @@ bool Compiler::IsMathIntrinsic(NamedIntrinsic intrinsicName)
73697368
case NI_System_Math_Cosh:
73707369
case NI_System_Math_Exp:
73717370
case NI_System_Math_Floor:
7372-
case NI_System_Math_FMod:
73737371
case NI_System_Math_FusedMultiplyAdd:
73747372
case NI_System_Math_ILogB:
73757373
case NI_System_Math_Log:
@@ -10084,10 +10082,6 @@ NamedIntrinsic Compiler::lookupPrimitiveFloatNamedIntrinsic(CORINFO_METHOD_HANDL
1008410082
{
1008510083
result = NI_System_Math_Floor;
1008610084
}
10087-
else if (strcmp(methodName, "FMod") == 0)
10088-
{
10089-
result = NI_System_Math_FMod;
10090-
}
1009110085
else if (strcmp(methodName, "FusedMultiplyAdd") == 0)
1009210086
{
1009310087
result = NI_System_Math_FusedMultiplyAdd;

0 commit comments

Comments
 (0)