@@ -4424,6 +4424,7 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
4424
4424
case NI_System_Math_Sqrt:
4425
4425
case NI_System_Math_Tan:
4426
4426
case NI_System_Math_Tanh:
4427
+ case NI_System_Math_Truncate:
4427
4428
{
4428
4429
retNode = impMathIntrinsic(method, sig, callType, ni, tailCall);
4429
4430
break;
@@ -5070,6 +5071,10 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
5070
5071
{
5071
5072
result = NI_System_Math_Tanh;
5072
5073
}
5074
+ else if (strcmp(methodName, "Truncate") == 0)
5075
+ {
5076
+ result = NI_System_Math_Truncate;
5077
+ }
5073
5078
}
5074
5079
else if (strcmp(className, "GC") == 0)
5075
5080
{
@@ -20425,14 +20430,15 @@ bool Compiler::IsTargetIntrinsic(NamedIntrinsic intrinsicName)
20425
20430
switch (intrinsicName)
20426
20431
{
20427
20432
// AMD64/x86 has SSE2 instructions to directly compute sqrt/abs and SSE4.1
20428
- // instructions to directly compute round/ceiling/floor.
20433
+ // instructions to directly compute round/ceiling/floor/truncate .
20429
20434
20430
20435
case NI_System_Math_Abs:
20431
20436
case NI_System_Math_Sqrt:
20432
20437
return true;
20433
20438
20434
20439
case NI_System_Math_Ceiling:
20435
20440
case NI_System_Math_Floor:
20441
+ case NI_System_Math_Truncate:
20436
20442
case NI_System_Math_Round:
20437
20443
return compOpportunisticallyDependsOn(InstructionSet_SSE41);
20438
20444
@@ -20448,6 +20454,7 @@ bool Compiler::IsTargetIntrinsic(NamedIntrinsic intrinsicName)
20448
20454
case NI_System_Math_Abs:
20449
20455
case NI_System_Math_Ceiling:
20450
20456
case NI_System_Math_Floor:
20457
+ case NI_System_Math_Truncate:
20451
20458
case NI_System_Math_Round:
20452
20459
case NI_System_Math_Sqrt:
20453
20460
return true;
@@ -20521,6 +20528,7 @@ bool Compiler::IsMathIntrinsic(NamedIntrinsic intrinsicName)
20521
20528
case NI_System_Math_Sqrt:
20522
20529
case NI_System_Math_Tan:
20523
20530
case NI_System_Math_Tanh:
20531
+ case NI_System_Math_Truncate:
20524
20532
{
20525
20533
assert((intrinsicName > NI_SYSTEM_MATH_START) && (intrinsicName < NI_SYSTEM_MATH_END));
20526
20534
return true;
0 commit comments