assert(varTypeIsFloating(srcNode));
assert(srcNode->TypeGet() == treeNode->TypeGet());
- // Right now only Abs/Round/Sqrt are treated as math intrinsics.
+ // Right now only Abs/Ceiling/Floor/Round/Sqrt are treated as math intrinsics.
//
switch (treeNode->gtIntrinsic.gtIntrinsicId)
{
getEmitter()->emitInsBinary(INS_ABS, emitTypeSize(treeNode), treeNode, srcNode);
break;
+#ifdef _TARGET_ARM64_
+ case CORINFO_INTRINSIC_Ceiling:
+ genConsumeOperands(treeNode->AsOp());
+ getEmitter()->emitInsBinary(INS_frintp, emitActualTypeSize(treeNode), treeNode, srcNode);
+ break;
+
+ case CORINFO_INTRINSIC_Floor:
+ genConsumeOperands(treeNode->AsOp());
+ getEmitter()->emitInsBinary(INS_frintm, emitActualTypeSize(treeNode), treeNode, srcNode);
+ break;
+#endif
case CORINFO_INTRINSIC_Round:
NYI_ARM("genIntrinsic for round - not implemented yet");
genConsumeOperands(treeNode->AsOp());
extern const unsigned short emitTypeActSz[TYP_COUNT];
-inline emitAttr emitActualTypeSize(var_types type)
+template <class T>
+inline emitAttr emitActualTypeSize(T type)
{
- assert(type < TYP_COUNT);
- assert(emitTypeActSz[type] > 0);
- return (emitAttr)emitTypeActSz[type];
+ assert(TypeGet(type) < TYP_COUNT);
+ assert(emitTypeActSz[TypeGet(type)] > 0);
+ return (emitAttr)emitTypeActSz[TypeGet(type)];
}
/*****************************************************************************
case CORINFO_INTRINSIC_Sqrt:
case CORINFO_INTRINSIC_Abs:
case CORINFO_INTRINSIC_Round:
+ case CORINFO_INTRINSIC_Floor:
+ case CORINFO_INTRINSIC_Ceiling:
return true;
default:
case GT_INTRINSIC:
{
- // TODO-ARM64-NYI
- // Right now only Abs/Round/Sqrt are treated as math intrinsics
noway_assert((tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Abs) ||
+ (tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Ceiling) ||
+ (tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Floor) ||
(tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Round) ||
(tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Sqrt));
case CORINFO_INTRINSIC_Abs:
res = fabs(arg0Val);
break;
+ case CORINFO_INTRINSIC_Ceiling:
+ res = ceil(arg0Val);
+ break;
+ case CORINFO_INTRINSIC_Floor:
+ res = floor(arg0Val);
+ break;
case CORINFO_INTRINSIC_Round:
res = FloatingPointUtils::round(arg0Val);
break;
case CORINFO_INTRINSIC_Abs:
res = fabsf(arg0Val);
break;
+ case CORINFO_INTRINSIC_Ceiling:
+ res = ceilf(arg0Val);
+ break;
+ case CORINFO_INTRINSIC_Floor:
+ res = floorf(arg0Val);
+ break;
case CORINFO_INTRINSIC_Round:
res = FloatingPointUtils::round(arg0Val);
break;