Populate call info and inline float/double conversions on x86.
Also cleaned up neg-float/neg-double implementation.
Change-Id: I8e7fe76e36d3c31bae0a82a956691202c09b8e0c
diff --git a/src/compiler/codegen/GenInvoke.cc b/src/compiler/codegen/GenInvoke.cc
index e6714aa..9f1d58e 100644
--- a/src/compiler/codegen/GenInvoke.cc
+++ b/src/compiler/codegen/GenInvoke.cc
@@ -752,7 +752,7 @@
bool genInlinedFloatCvt(CompilationUnit *cUnit, CallInfo* info)
{
-#if defined(TARGET_ARM)
+#if defined(TARGET_ARM) || defined(TARGET_X86)
RegLocation rlSrc = info->args[0];
RegLocation rlDest = inlineTarget(cUnit, info);
storeValue(cUnit, rlDest, rlSrc);
@@ -764,7 +764,7 @@
bool genInlinedDoubleCvt(CompilationUnit *cUnit, CallInfo* info)
{
-#if defined(TARGET_ARM)
+#if defined(TARGET_ARM) || defined(TARGET_X86)
RegLocation rlSrc = info->args[0];
RegLocation rlDest = inlineTargetWide(cUnit, info);
storeValueWide(cUnit, rlDest, rlSrc);
diff --git a/src/compiler/codegen/MethodCodegenDriver.cc b/src/compiler/codegen/MethodCodegenDriver.cc
index e56e627..b93cbd9 100644
--- a/src/compiler/codegen/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/MethodCodegenDriver.cc
@@ -179,10 +179,6 @@
{
CallInfo* info = (CallInfo*)oatNew(cUnit, sizeof(CallInfo), true,
kAllocMisc);
-//FIXME: Disable fusing for x86
-#if defined(TARGET_X86)
- info->result.location = kLocInvalid;
-#else
MIR* moveResultMIR = oatFindMoveResult(cUnit, bb, mir);
if (moveResultMIR == NULL) {
info->result.location = kLocInvalid;
@@ -190,7 +186,6 @@
info->result = oatGetRawDest(cUnit, moveResultMIR);
moveResultMIR->dalvikInsn.opcode = Instruction::NOP;
}
-#endif
info->numArgWords = mir->ssaRep->numUses;
info->args = (info->numArgWords == 0) ? NULL : (RegLocation*)
oatNew(cUnit, sizeof(RegLocation) * info->numArgWords, false, kAllocMisc);
diff --git a/src/compiler/codegen/x86/FP/X86FP.cc b/src/compiler/codegen/x86/FP/X86FP.cc
index bb648bf..be628db 100644
--- a/src/compiler/codegen/x86/FP/X86FP.cc
+++ b/src/compiler/codegen/x86/FP/X86FP.cc
@@ -21,7 +21,6 @@
RegLocation rlSrc2) {
X86OpCode op = kX86Nop;
RegLocation rlResult;
- int tempReg;
/*
* Don't attempt to optimize register usage since these opcodes call out to
@@ -44,27 +43,10 @@
case Instruction::MUL_FLOAT:
op = kX86MulssRR;
break;
- case Instruction::NEG_FLOAT: {
- // TODO: Make this an XorpsRM where the memory location holds 0x80000000
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- tempReg = oatAllocTemp(cUnit);
- loadConstantNoClobber(cUnit, tempReg, 0x80000000);
- int rDest = rlResult.lowReg;
- int rSrc1 = rlSrc1.lowReg;
- if (rDest == rSrc1) {
- rSrc1 = oatAllocTempFloat(cUnit);
- opRegCopy(cUnit, rSrc1, rDest);
- }
- newLIR2(cUnit, kX86MovdxrRR, rDest, tempReg);
- newLIR2(cUnit, kX86XorpsRR, rDest, rSrc1);
- storeValue(cUnit, rlDest, rlResult);
- return false;
- }
+ case Instruction::NEG_FLOAT:
case Instruction::REM_FLOAT_2ADDR:
- case Instruction::REM_FLOAT: {
+ case Instruction::REM_FLOAT:
return genArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
- }
default:
return true;
}
@@ -90,7 +72,6 @@
RegLocation rlSrc2) {
X86OpCode op = kX86Nop;
RegLocation rlResult;
- int tempReg;
switch (opcode) {
case Instruction::ADD_DOUBLE_2ADDR:
@@ -109,28 +90,10 @@
case Instruction::MUL_DOUBLE:
op = kX86MulsdRR;
break;
- case Instruction::NEG_DOUBLE: {
- // TODO: Make this an XorpdRM where the memory location holds 0x8000000000000000
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- tempReg = oatAllocTemp(cUnit);
- loadConstantNoClobber(cUnit, tempReg, 0x80000000);
- int rDest = S2D(rlResult.lowReg, rlResult.highReg);
- int rSrc1 = S2D(rlSrc1.lowReg, rlSrc1.highReg);
- if (rDest == rSrc1) {
- rSrc1 = oatAllocTempDouble(cUnit) | FP_DOUBLE;
- opRegCopy(cUnit, rSrc1, rDest);
- }
- newLIR2(cUnit, kX86MovdxrRR, rDest, tempReg);
- newLIR2(cUnit, kX86PsllqRI, rDest, 32);
- newLIR2(cUnit, kX86XorpsRR, rDest, rSrc1);
- storeValueWide(cUnit, rlDest, rlResult);
- return false;
- }
+ case Instruction::NEG_DOUBLE:
case Instruction::REM_DOUBLE_2ADDR:
- case Instruction::REM_DOUBLE: {
+ case Instruction::REM_DOUBLE:
return genArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
- }
default:
return true;
}
@@ -221,9 +184,7 @@
}
case Instruction::LONG_TO_DOUBLE:
case Instruction::LONG_TO_FLOAT:
- // These can be implemented inline by using memory as a 64-bit source.
- // However, this can't be done easily if the register has been promoted.
- UNIMPLEMENTED(WARNING) << "inline l2[df] " << PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
+ // TODO: inline by using memory as a 64-bit source. Be careful about promoted registers.
case Instruction::FLOAT_TO_LONG:
case Instruction::DOUBLE_TO_LONG:
return genConversionPortable(cUnit, opcode, rlDest, rlSrc);
diff --git a/src/compiler/codegen/x86/X86/Gen.cc b/src/compiler/codegen/x86/X86/Gen.cc
index 69aaaad..4bfc531 100644
--- a/src/compiler/codegen/x86/X86/Gen.cc
+++ b/src/compiler/codegen/x86/X86/Gen.cc
@@ -181,31 +181,21 @@
void genNegFloat(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
{
- UNIMPLEMENTED(WARNING) << "genNegFloat "
- << PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
- newLIR0(cUnit, kX86Bkpt);
-#if 0
RegLocation rlResult;
rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
opRegRegImm(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, 0x80000000);
storeValue(cUnit, rlDest, rlResult);
-#endif
}
void genNegDouble(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
{
- UNIMPLEMENTED(WARNING) << "genNegDouble"
- << PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
- newLIR0(cUnit, kX86Bkpt);
-#if 0
RegLocation rlResult;
rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
opRegRegImm(cUnit, kOpAdd, rlResult.highReg, rlSrc.highReg, 0x80000000);
opRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
storeValueWide(cUnit, rlDest, rlResult);
-#endif
}
LIR* genNullCheck(CompilationUnit* cUnit, int sReg, int mReg, int optFlags);