@@ -4447,6 +4447,7 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
4447
4447
case NI_System_Math_Sqrt:
4448
4448
case NI_System_Math_Tan:
4449
4449
case NI_System_Math_Tanh:
4450
+ case NI_System_Math_Truncate:
4450
4451
{
4451
4452
retNode = impMathIntrinsic(method, sig, callType, ni, tailCall);
4452
4453
break;
@@ -5093,6 +5094,10 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
5093
5094
{
5094
5095
result = NI_System_Math_Tanh;
5095
5096
}
5097
+ else if (strcmp(methodName, "Truncate") == 0)
5098
+ {
5099
+ result = NI_System_Math_Truncate;
5100
+ }
5096
5101
}
5097
5102
else if (strcmp(className, "GC") == 0)
5098
5103
{
@@ -20448,14 +20453,15 @@ bool Compiler::IsTargetIntrinsic(NamedIntrinsic intrinsicName)
20448
20453
switch (intrinsicName)
20449
20454
{
20450
20455
// AMD64/x86 has SSE2 instructions to directly compute sqrt/abs and SSE4.1
20451
- // instructions to directly compute round/ceiling/floor.
20456
+ // instructions to directly compute round/ceiling/floor/truncate .
20452
20457
20453
20458
case NI_System_Math_Abs:
20454
20459
case NI_System_Math_Sqrt:
20455
20460
return true;
20456
20461
20457
20462
case NI_System_Math_Ceiling:
20458
20463
case NI_System_Math_Floor:
20464
+ case NI_System_Math_Truncate:
20459
20465
case NI_System_Math_Round:
20460
20466
return compOpportunisticallyDependsOn(InstructionSet_SSE41);
20461
20467
@@ -20471,6 +20477,7 @@ bool Compiler::IsTargetIntrinsic(NamedIntrinsic intrinsicName)
20471
20477
case NI_System_Math_Abs:
20472
20478
case NI_System_Math_Ceiling:
20473
20479
case NI_System_Math_Floor:
20480
+ case NI_System_Math_Truncate:
20474
20481
case NI_System_Math_Round:
20475
20482
case NI_System_Math_Sqrt:
20476
20483
return true;
@@ -20544,6 +20551,7 @@ bool Compiler::IsMathIntrinsic(NamedIntrinsic intrinsicName)
20544
20551
case NI_System_Math_Sqrt:
20545
20552
case NI_System_Math_Tan:
20546
20553
case NI_System_Math_Tanh:
20554
+ case NI_System_Math_Truncate:
20547
20555
{
20548
20556
assert((intrinsicName > NI_SYSTEM_MATH_START) && (intrinsicName < NI_SYSTEM_MATH_END));
20549
20557
return true;
0 commit comments