Add multiplication for floats/doubles in optimizing compiler
Change-Id: I61de8ce1d9e37e30db62e776979b3f22dc643894
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index acf4103..5f01265 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1212,16 +1212,16 @@
locations->AddTemp(Location::RegisterLocation(EDX));
break;
}
-
- case Primitive::kPrimBoolean:
- case Primitive::kPrimByte:
- case Primitive::kPrimChar:
- case Primitive::kPrimShort:
- LOG(FATAL) << "Unexpected mul type " << mul->GetResultType();
+ case Primitive::kPrimFloat:
+ case Primitive::kPrimDouble: {
+ locations->SetInAt(0, Location::RequiresFpuRegister());
+ locations->SetInAt(1, Location::RequiresFpuRegister());
+ locations->SetOut(Location::SameAsFirstInput());
break;
+ }
default:
- LOG(FATAL) << "Unimplemented mul type " << mul->GetResultType();
+ LOG(FATAL) << "Unexpected mul type " << mul->GetResultType();
}
}
@@ -1283,15 +1283,18 @@
break;
}
- case Primitive::kPrimBoolean:
- case Primitive::kPrimByte:
- case Primitive::kPrimChar:
- case Primitive::kPrimShort:
- LOG(FATAL) << "Unexpected mul type " << mul->GetResultType();
+ case Primitive::kPrimFloat: {
+ __ mulss(first.As<XmmRegister>(), second.As<XmmRegister>());
break;
+ }
+
+ case Primitive::kPrimDouble: {
+ __ mulsd(first.As<XmmRegister>(), second.As<XmmRegister>());
+ break;
+ }
default:
- LOG(FATAL) << "Unimplemented mul type " << mul->GetResultType();
+ LOG(FATAL) << "Unexpected mul type " << mul->GetResultType();
}
}