// Right now only Abs/Ceiling/Floor/Round/Sqrt are treated as math intrinsics.
//
- switch (treeNode->gtIntrinsic.gtIntrinsicId)
+ switch (treeNode->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Abs:
genConsumeOperands(treeNode->AsOp());
break;
case GT_INTRINSIC:
- assert(treeNode->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Abs);
+ assert(treeNode->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Abs);
// Abs(x) = set sign-bit to zero
// Abs(f) = f & 0x7fffffff
unsigned ival = 0;
// v) tree oper is CORINFO_INTRINSIC_Round, _Ceiling, or _Floor
- switch (treeNode->gtIntrinsic.gtIntrinsicId)
+ switch (treeNode->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Round:
ival = 4;
void CodeGen::genIntrinsic(GenTree* treeNode)
{
// Right now only Sqrt/Abs are treated as math intrinsics.
- switch (treeNode->gtIntrinsic.gtIntrinsicId)
+ switch (treeNode->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Sqrt:
{
}
else if (op == GT_INTRINSIC)
{
- CorInfoIntrinsics intrin = tree->gtIntrinsic.gtIntrinsicId;
+ CorInfoIntrinsics intrin = tree->AsIntrinsic()->gtIntrinsicId;
chars += printf(":");
switch (intrin)
switch (oper)
{
case GT_INTRINSIC:
- if (op1->gtIntrinsic.gtIntrinsicId != op2->gtIntrinsic.gtIntrinsicId)
+ if (op1->AsIntrinsic()->gtIntrinsicId != op2->AsIntrinsic()->gtIntrinsicId)
{
return false;
}
switch (oper)
{
case GT_INTRINSIC:
- hash += tree->gtIntrinsic.gtIntrinsicId;
+ hash += tree->AsIntrinsic()->gtIntrinsicId;
break;
case GT_LEA:
hash += static_cast<unsigned>(tree->AsAddrMode()->Offset() << 3) + tree->AsAddrMode()->gtScale;
// GT_INTRINSIC intrinsics Sin, Cos, Sqrt, Abs ... have higher costs.
// TODO: tune these costs target specific as some of these are
// target intrinsics and would cost less to generate code.
- switch (tree->gtIntrinsic.gtIntrinsicId)
+ switch (tree->AsIntrinsic()->gtIntrinsicId)
{
default:
assert(!"missing case for gtIntrinsicId");
case GT_INTRINSIC:
- switch (tree->gtIntrinsic.gtIntrinsicId)
+ switch (tree->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Atan2:
case CORINFO_INTRINSIC_Pow:
case GT_INTRINSIC:
copy = new (this, GT_INTRINSIC)
GenTreeIntrinsic(tree->TypeGet(), tree->AsOp()->gtOp1, tree->AsOp()->gtOp2,
- tree->gtIntrinsic.gtIntrinsicId, tree->gtIntrinsic.gtMethodHandle);
+ tree->AsIntrinsic()->gtIntrinsicId, tree->AsIntrinsic()->gtMethodHandle);
#ifdef FEATURE_READYTORUN_COMPILER
- copy->gtIntrinsic.gtEntryPoint = tree->gtIntrinsic.gtEntryPoint;
+ copy->AsIntrinsic()->gtEntryPoint = tree->AsIntrinsic()->gtEntryPoint;
#endif
break;
if (tree->gtOper == GT_INTRINSIC)
{
- switch (tree->gtIntrinsic.gtIntrinsicId)
+ switch (tree->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Sin:
printf(" sin");
}
}
}
- else if ((tree->gtOper == GT_INTRINSIC) && (tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Object_GetType))
+ else if ((tree->gtOper == GT_INTRINSIC) && (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Object_GetType))
{
return TPK_GetType;
}
if (opts.IsReadyToRun())
{
noway_assert(callInfo->kind == CORINFO_CALL);
- call->gtIntrinsic.gtEntryPoint = callInfo->codePointerLookup.constLookup;
+ call->AsIntrinsic()->gtEntryPoint = callInfo->codePointerLookup.constLookup;
}
else
{
- call->gtIntrinsic.gtEntryPoint.addr = nullptr;
- call->gtIntrinsic.gtEntryPoint.accessType = IAT_VALUE;
+ call->AsIntrinsic()->gtEntryPoint.addr = nullptr;
+ call->AsIntrinsic()->gtEntryPoint.accessType = IAT_VALUE;
}
}
#endif
bool Compiler::IsMathIntrinsic(GenTree* tree)
{
- return (tree->OperGet() == GT_INTRINSIC) && IsMathIntrinsic(tree->gtIntrinsic.gtIntrinsicId);
+ return (tree->OperGet() == GT_INTRINSIC) && IsMathIntrinsic(tree->AsIntrinsic()->gtIntrinsicId);
}
//------------------------------------------------------------------------
{
assert(node->OperIs(GT_INTRINSIC));
- CorInfoIntrinsics intrinsicId = node->gtIntrinsic.gtIntrinsicId;
+ CorInfoIntrinsics intrinsicId = node->AsIntrinsic()->gtIntrinsicId;
if (intrinsicId == CORINFO_INTRINSIC_Sqrt || intrinsicId == CORINFO_INTRINSIC_Round ||
intrinsicId == CORINFO_INTRINSIC_Ceiling || intrinsicId == CORINFO_INTRINSIC_Floor)
BuildUse(op1);
srcCount = 1;
- switch (tree->gtIntrinsic.gtIntrinsicId)
+ switch (tree->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Abs:
case CORINFO_INTRINSIC_Sqrt:
case GT_INTRINSIC:
{
- 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));
+ noway_assert((tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Abs) ||
+ (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Ceiling) ||
+ (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Floor) ||
+ (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Round) ||
+ (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Sqrt));
// Both operand and its result must be of the same floating point type.
GenTree* op1 = tree->gtGetOp1();
assert(op1->TypeGet() == tree->TypeGet());
RefPosition* internalFloatDef = nullptr;
- switch (tree->gtIntrinsic.gtIntrinsicId)
+ switch (tree->AsIntrinsic()->gtIntrinsicId)
{
case CORINFO_INTRINSIC_Abs:
// Abs(float x) = x & 0x7fffffff
// xmm register. When we add support in emitter to emit 128-bit
// data constants and instructions that operate on 128-bit
// memory operands we can avoid the need for an internal register.
- if (tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Abs)
+ if (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Abs)
{
internalFloatDef = buildInternalFloatRegisterDefForNode(tree, internalFloatRegCandidates());
}
#ifdef _TARGET_ARM_
case GT_INTRINSIC:
- if (tree->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Round)
+ if (tree->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Round)
{
switch (tree->TypeGet())
{
case GT_INTRINSIC:
// Non-target intrinsics should have already been rewritten back into user calls.
- assert(comp->IsTargetIntrinsic(node->gtIntrinsic.gtIntrinsicId));
+ assert(comp->IsTargetIntrinsic(node->AsIntrinsic()->gtIntrinsicId));
break;
case GT_BLK:
{
GenTree* const node = *use;
if (node->OperGet() == GT_INTRINSIC &&
- m_rationalizer.comp->IsIntrinsicImplementedByUserCall(node->gtIntrinsic.gtIntrinsicId))
+ m_rationalizer.comp->IsIntrinsicImplementedByUserCall(node->AsIntrinsic()->gtIntrinsicId))
{
m_rationalizer.RewriteIntrinsicAsUserCall(use, this->m_ancestors);
}