Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DP FP option from float calls #1492

Merged
merged 2 commits into from
Nov 11, 2019
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
113 changes: 29 additions & 84 deletions src/CLR/CorLib/corlib_native_System_MathInternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,99 +5,44 @@
//
#include "CorLib.h"

#if !defined(NANOCLR_EMULATED_FLOATINGPOINT)
josesimoes marked this conversation as resolved.
Show resolved Hide resolved
#include "nanoPAL_NativeDouble.h"
HRESULT Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

HRESULT Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4( CLR_RT_StackFrame& stack )
{
#if (DP_FLOATINGPOINT == TRUE)
stack.NotImplementedStub();
#else
CLR_INT32 d = stack.Arg0().NumericByRefConst().s4;
CLR_INT32 res = abs( d );

NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();
stack.SetResult_I4( res );

float d = stack.Arg0().NumericByRefConst().s4;
float res = fabs( d );
NANOCLR_NOCLEANUP_NOLABEL();
}

stack.SetResult_I4( res );
HRESULT Library_corlib_native_System_MathInternal::Max___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

NANOCLR_NOCLEANUP_NOLABEL();
CLR_INT32 x = stack.Arg0().NumericByRefConst().s4;
CLR_INT32 y = stack.Arg1().NumericByRefConst().s4;
CLR_INT32 res = x >= y ? x : y;

#endif
}
stack.SetResult_I4( res );

HRESULT Library_corlib_native_System_MathInternal::Max___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
{
#if (DP_FLOATINGPOINT == TRUE)
return stack.NotImplementedStub();
#else
NANOCLR_NOCLEANUP_NOLABEL();
}

NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();
HRESULT Library_corlib_native_System_MathInternal::Min___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

float x = stack.Arg0().NumericByRefConst().s4;
float y = stack.Arg1().NumericByRefConst().s4;
float res = x >= y ? x : y;
CLR_INT32 x = stack.Arg0().NumericByRefConst().s4;
CLR_INT32 y = stack.Arg1().NumericByRefConst().s4;
CLR_INT32 res = x <= y ? x : y;

stack.SetResult_I4( res );
stack.SetResult_I4( res );

NANOCLR_NOCLEANUP_NOLABEL();
NANOCLR_NOCLEANUP_NOLABEL();
}

#endif
}

HRESULT Library_corlib_native_System_MathInternal::Min___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
{
#if (DP_FLOATINGPOINT == TRUE)
return stack.NotImplementedStub();
#else

NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

float x = stack.Arg0().NumericByRefConst().s4;
float y = stack.Arg1().NumericByRefConst().s4;
float res = x <= y ? x : y;

stack.SetResult_I4( res );

NANOCLR_NOCLEANUP_NOLABEL();

#endif
}

#else

/// No floating point
HRESULT Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

NANOCLR_SET_AND_LEAVE(stack.NotImplementedStub());

NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_MathInternal::Max___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

NANOCLR_SET_AND_LEAVE(stack.NotImplementedStub());

NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_MathInternal::Min___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

NANOCLR_SET_AND_LEAVE(stack.NotImplementedStub());

NANOCLR_NOCLEANUP();
}

#endif // NANOCLR_EMULATED_FLOATINGPOINT
Loading