Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static partial class Math
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Cbrt(double d);

[Intrinsic]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Ceiling(double a);

Expand All @@ -71,6 +72,7 @@ public static partial class Math
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Exp(double d);

[Intrinsic]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Floor(double d);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static partial class MathF
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Cbrt(float x);

[Intrinsic]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Ceiling(float x);

Expand All @@ -60,6 +61,7 @@ public static partial class MathF
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Exp(float x);

[Intrinsic]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Floor(float x);

Expand Down
32 changes: 5 additions & 27 deletions src/coreclr/src/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ TODO: Talk about initializing strutures before use
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////

constexpr GUID JITEEVersionIdentifier = { /* 164b4e4f-21f6-4d05-b560-3728395404f2 */
0x164b4e4f,
0x21f6,
0x4d05,
{ 0xb5, 0x60, 0x37, 0x28, 0x39, 0x54, 0x04, 0xf2 }
constexpr GUID JITEEVersionIdentifier = { /* a5eec3a4-4176-43a7-8c2b-a05b551d4f49 */
0xa5eec3a4,
0x4176,
0x43a7,
{0x8c, 0x2b, 0xa0, 0x5b, 0x55, 0x1d, 0x4f, 0x49}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -891,28 +891,6 @@ enum CorInfoException

enum CorInfoIntrinsics
{
Comment thread
am11 marked this conversation as resolved.
Outdated
CORINFO_INTRINSIC_Sin,
CORINFO_INTRINSIC_Cos,
CORINFO_INTRINSIC_Cbrt,
CORINFO_INTRINSIC_Sqrt,
CORINFO_INTRINSIC_Abs,
CORINFO_INTRINSIC_Round,
CORINFO_INTRINSIC_Cosh,
CORINFO_INTRINSIC_Sinh,
CORINFO_INTRINSIC_Tan,
CORINFO_INTRINSIC_Tanh,
CORINFO_INTRINSIC_Asin,
CORINFO_INTRINSIC_Asinh,
CORINFO_INTRINSIC_Acos,
CORINFO_INTRINSIC_Acosh,
CORINFO_INTRINSIC_Atan,
CORINFO_INTRINSIC_Atan2,
CORINFO_INTRINSIC_Atanh,
CORINFO_INTRINSIC_Log10,
CORINFO_INTRINSIC_Pow,
CORINFO_INTRINSIC_Exp,
CORINFO_INTRINSIC_Ceiling,
CORINFO_INTRINSIC_Floor,
CORINFO_INTRINSIC_GetChar, // fetch character out of string
CORINFO_INTRINSIC_Array_GetDimLength, // Get number of elements in a given dimension of an array
CORINFO_INTRINSIC_Array_Get, // Get the value of an element in an array
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/src/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,31 +616,31 @@ void CodeGen::genIntrinsic(GenTree* treeNode)

// Right now only Abs/Ceiling/Floor/Round/Sqrt are treated as math intrinsics.
//
switch (treeNode->AsIntrinsic()->gtIntrinsicId)
switch (treeNode->AsIntrinsic()->gtIntrinsicName)
{
case CORINFO_INTRINSIC_Abs:
case NI_System_Math_Abs:
genConsumeOperands(treeNode->AsOp());
GetEmitter()->emitInsBinary(INS_ABS, emitActualTypeSize(treeNode), treeNode, srcNode);
break;

#ifdef TARGET_ARM64
case CORINFO_INTRINSIC_Ceiling:
case NI_System_Math_Ceiling:
genConsumeOperands(treeNode->AsOp());
GetEmitter()->emitInsBinary(INS_frintp, emitActualTypeSize(treeNode), treeNode, srcNode);
break;

case CORINFO_INTRINSIC_Floor:
case NI_System_Math_Floor:
genConsumeOperands(treeNode->AsOp());
GetEmitter()->emitInsBinary(INS_frintm, emitActualTypeSize(treeNode), treeNode, srcNode);
break;

case CORINFO_INTRINSIC_Round:
case NI_System_Math_Round:
genConsumeOperands(treeNode->AsOp());
GetEmitter()->emitInsBinary(INS_frintn, emitActualTypeSize(treeNode), treeNode, srcNode);
break;
#endif // TARGET_ARM64

case CORINFO_INTRINSIC_Sqrt:
case NI_System_Math_Sqrt:
genConsumeOperands(treeNode->AsOp());
GetEmitter()->emitInsBinary(INS_SQRT, emitActualTypeSize(treeNode), treeNode, srcNode);
break;
Expand Down
26 changes: 13 additions & 13 deletions src/coreclr/src/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6781,7 +6781,7 @@ void CodeGen::genSSE2BitwiseOp(GenTree* treeNode)
break;

case GT_INTRINSIC:
assert(treeNode->AsIntrinsic()->gtIntrinsicId == CORINFO_INTRINSIC_Abs);
assert(treeNode->AsIntrinsic()->gtIntrinsicName == NI_System_Math_Abs);

// Abs(x) = set sign-bit to zero
// Abs(f) = f & 0x7fffffff
Expand Down Expand Up @@ -6859,7 +6859,7 @@ void CodeGen::genSSE2BitwiseOp(GenTree* treeNode)
// ii) treeNode oper is a GT_INTRINSIC
// iii) treeNode type is a floating point type
// iv) treeNode is not used from memory
// v) tree oper is CORINFO_INTRINSIC_Round, _Ceiling, or _Floor
// v) tree oper is NI_System_Math{F}_Round, _Ceiling, or _Floor
// vi) caller of this routine needs to call genProduceReg()
void CodeGen::genSSE41RoundOp(GenTreeOp* treeNode)
{
Expand Down Expand Up @@ -6887,18 +6887,18 @@ void CodeGen::genSSE41RoundOp(GenTreeOp* treeNode)

unsigned ival = 0;

// v) tree oper is CORINFO_INTRINSIC_Round, _Ceiling, or _Floor
switch (treeNode->AsIntrinsic()->gtIntrinsicId)
// v) tree oper is NI_System_Math{F}_Round, _Ceiling, or _Floor
switch (treeNode->AsIntrinsic()->gtIntrinsicName)
{
case CORINFO_INTRINSIC_Round:
case NI_System_Math_Round:
ival = 4;
break;

case CORINFO_INTRINSIC_Ceiling:
case NI_System_Math_Ceiling:
ival = 10;
break;

case CORINFO_INTRINSIC_Floor:
case NI_System_Math_Floor:
ival = 9;
break;

Expand Down Expand Up @@ -7020,9 +7020,9 @@ void CodeGen::genSSE41RoundOp(GenTreeOp* treeNode)
void CodeGen::genIntrinsic(GenTree* treeNode)
{
// Right now only Sqrt/Abs are treated as math intrinsics.
switch (treeNode->AsIntrinsic()->gtIntrinsicId)
switch (treeNode->AsIntrinsic()->gtIntrinsicName)
{
case CORINFO_INTRINSIC_Sqrt:
case NI_System_Math_Sqrt:
{
// Both operand and its result must be of the same floating point type.
GenTree* srcNode = treeNode->AsOp()->gtOp1;
Expand All @@ -7034,13 +7034,13 @@ void CodeGen::genIntrinsic(GenTree* treeNode)
break;
}

case CORINFO_INTRINSIC_Abs:
case NI_System_Math_Abs:
genSSE2BitwiseOp(treeNode);
break;

case CORINFO_INTRINSIC_Round:
case CORINFO_INTRINSIC_Ceiling:
case CORINFO_INTRINSIC_Floor:
case NI_System_Math_Round:
case NI_System_Math_Ceiling:
case NI_System_Math_Floor:
genSSE41RoundOp(treeNode->AsOp());
break;

Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3741,7 +3741,7 @@ class Compiler
GenTree* impMathIntrinsic(CORINFO_METHOD_HANDLE method,
CORINFO_SIG_INFO* sig,
var_types callType,
CorInfoIntrinsics intrinsicID,
NamedIntrinsic intrinsicName,
bool tailCall);
NamedIntrinsic lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method);
GenTree* impUnsupportedNamedIntrinsic(unsigned helper,
Expand Down Expand Up @@ -3937,9 +3937,9 @@ class Compiler
bool VarTypeIsMultiByteAndCanEnreg(
var_types type, CORINFO_CLASS_HANDLE typeClass, unsigned* typeSize, bool forReturn, bool isVarArg);

bool IsIntrinsicImplementedByUserCall(CorInfoIntrinsics intrinsicId);
bool IsTargetIntrinsic(CorInfoIntrinsics intrinsicId);
bool IsMathIntrinsic(CorInfoIntrinsics intrinsicId);
bool IsIntrinsicImplementedByUserCall(NamedIntrinsic intrinsicName);
bool IsTargetIntrinsic(NamedIntrinsic intrinsicName);
bool IsMathIntrinsic(NamedIntrinsic intrinsicName);
bool IsMathIntrinsic(GenTree* tree);

private:
Expand Down Expand Up @@ -9067,7 +9067,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bool compIsVarArgs : 1; // Does the method have varargs parameters?
bool compInitMem : 1; // Is the CORINFO_OPT_INIT_LOCALS bit set in the method info options?
bool compProfilerCallback : 1; // JIT inserted a profiler Enter callback
bool compPublishStubParam : 1; // EAX captured in prolog will be available through an instrinsic
bool compPublishStubParam : 1; // EAX captured in prolog will be available through an intrinsic
bool compRetBuffDefStack : 1; // The ret buff argument definitely points into the stack.
bool compHasNextCallRetAddr : 1; // The NextCallReturnAddress intrinsic is used.

Expand Down
Loading