defer to helper thunk for frem and drem

This commit is contained in:
Joel Dice 2009-10-24 19:29:20 -06:00
parent 95c3f37bfb
commit 3b4be3decd
3 changed files with 19 additions and 0 deletions

View File

@ -873,6 +873,9 @@ class Context {
case FloatDivide:
return local::getThunk(t, divideDoubleThunk);
case FloatRemainder:
return local::getThunk(t, moduloDoubleThunk);
case JumpIfFloatEqual:
case JumpIfFloatNotEqual:
case JumpIfFloatLess:
@ -894,13 +897,19 @@ class Context {
switch (op) {
case FloatAdd:
return local::getThunk(t, addFloatThunk);
case FloatSubtract:
return local::getThunk(t, subtractFloatThunk);
case FloatMultiply:
return local::getThunk(t, multiplyFloatThunk);
case FloatDivide:
return local::getThunk(t, divideFloatThunk);
case FloatRemainder:
return local::getThunk(t, moduloFloatThunk);
case JumpIfFloatEqual:
case JumpIfFloatNotEqual:
case JumpIfFloatLess:

View File

@ -3110,6 +3110,10 @@ class MyArchitecture: public Assembler::Architecture {
}
break;
case FloatRemainder:
*thunk = true;
break;
case Multiply:
if (BytesPerWord == 4 and aSize == 8) {
const uint32_t mask = GeneralRegisterMask & ~((1 << rax) | (1 << rdx));

View File

@ -7,6 +7,9 @@ public class AllFloats {
private static float divide(float a, float b) {return a / b;}
private static double divide(double a, double b) {return a / b;}
private static double divide(float a, double b) {return a / b;}
private static float remainder(float a, float b) {return a % b;}
private static double remainder(double a, double b) {return a % b;}
private static double remainder(float a, double b) {return a % b;}
private static float add(float a, float b) {return a + b;}
private static double add(double a, double b) {return a + b;}
private static double add(float a, double b) {return a + b;}
@ -44,6 +47,9 @@ public class AllFloats {
expect(divide(5f, 2f) == 5f/2f);
expect(divide(5d, 2d) == 5d/2d);
expect(divide(5f, 2d) == 5f/2d);
expect(remainder(5f, 2f) == 5f%2f);
expect(remainder(5d, 2d) == 5d%2d);
expect(remainder(5f, 2d) == 5f%2d);
expect(add(5f, 4f) == 5f+4f);
expect(add(5d, 4d) == 5f+4d);
expect(add(5f, 4d) == 5f+4d);