backend_x64/block_of_code: Add more floating point constants

* MFloatPositiveZero32
* MFloatPositiveZero64
* MFloatMinS32
* MFloatMaxS32
* MFloatMinU32
* MFloatMaxU32
This commit is contained in:
MerryMage 2016-08-22 15:35:07 +01:00
parent a32689c832
commit 72250b119f
2 changed files with 42 additions and 10 deletions

View file

@ -60,6 +60,14 @@ void BlockOfCode::GenConstants() {
Write64(0x7fffffffffffffffu);
const_FloatPenultimatePositiveDenormal64 = AlignCode16();
Write64(0x000ffffffffffffeu);
const_FloatMinS32 = AlignCode16();
Write64(0xc1e0000000000000u); // -2147483648 as a double
const_FloatMaxS32 = AlignCode16();
Write64(0x41dfffffffc00000u); // 2147483647 as a double
const_FloatPositiveZero32 = const_FloatPositiveZero64 = const_FloatMinU32 = AlignCode16();
Write64(0x0000000000000000u); // 0 as a double
const_FloatMaxU32 = AlignCode16();
Write64(0x41efffffffe00000u); // 4294967295 as a double
AlignCode16();
}

View file

@ -31,6 +31,9 @@ public:
/// Code emitter: Makes saved host MXCSR the current MXCSR
void SwitchMxcsrOnExit();
Gen::OpArg MFloatPositiveZero32() const {
return Gen::M(const_FloatPositiveZero32);
}
Gen::OpArg MFloatNegativeZero32() const {
return Gen::M(const_FloatNegativeZero32);
}
@ -40,6 +43,9 @@ public:
Gen::OpArg MFloatNonSignMask32() const {
return Gen::M(const_FloatNonSignMask32);
}
Gen::OpArg MFloatPositiveZero64() const {
return Gen::M(const_FloatPositiveZero64);
}
Gen::OpArg MFloatNegativeZero64() const {
return Gen::M(const_FloatNegativeZero64);
}
@ -52,27 +58,45 @@ public:
Gen::OpArg MFloatPenultimatePositiveDenormal64() const {
return Gen::M(const_FloatPenultimatePositiveDenormal64);
}
Gen::OpArg MFloatMinS32() const {
return Gen::M(const_FloatMinS32);
}
Gen::OpArg MFloatMaxS32() const {
return Gen::M(const_FloatMaxS32);
}
Gen::OpArg MFloatMinU32() const {
return Gen::M(const_FloatMinU32);
}
Gen::OpArg MFloatMaxU32() const {
return Gen::M(const_FloatMaxU32);
}
CodePtr GetReturnFromRunCodeAddress() const {
return return_from_run_code;
}
private:
const u8* const_FloatNegativeZero32;
const u8* const_FloatNaN32;
const u8* const_FloatNonSignMask32;
const u8* const_FloatNegativeZero64;
const u8* const_FloatNaN64;
const u8* const_FloatNonSignMask64;
const u8* const_FloatPenultimatePositiveDenormal64;
const u8* const_FloatPositiveZero32 = nullptr;
const u8* const_FloatNegativeZero32 = nullptr;
const u8* const_FloatNaN32 = nullptr;
const u8* const_FloatNonSignMask32 = nullptr;
const u8* const_FloatPositiveZero64 = nullptr;
const u8* const_FloatNegativeZero64 = nullptr;
const u8* const_FloatNaN64 = nullptr;
const u8* const_FloatNonSignMask64 = nullptr;
const u8* const_FloatPenultimatePositiveDenormal64 = nullptr;
const u8* const_FloatMinS32 = nullptr;
const u8* const_FloatMaxS32 = nullptr;
const u8* const_FloatMinU32 = nullptr;
const u8* const_FloatMaxU32 = nullptr;
void GenConstants();
using RunCodeFuncType = void(*)(JitState*, CodePtr);
RunCodeFuncType run_code;
RunCodeFuncType run_code = nullptr;
void GenRunCode();
CodePtr return_from_run_code;
CodePtr return_from_run_code_without_mxcsr_switch;
CodePtr return_from_run_code = nullptr;
CodePtr return_from_run_code_without_mxcsr_switch = nullptr;
void GenReturnFromRunCode();
};