Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 2534413002: MIPS: Improve Float(32|64)(Max|Min). (Closed)
Patch Set: MIPS: Improve Float(32|64)(Max|Min). Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips64/code-generator-mips64.cc
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc
index a3bf433d4abd4d38462c3e06a488286f5b156309..c945a3c385fabc39b7b08d4ff19f2adad7d85003 100644
--- a/src/compiler/mips64/code-generator-mips64.cc
+++ b/src/compiler/mips64/code-generator-mips64.cc
@@ -270,6 +270,26 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
bool must_save_lr_;
};
+#define CREATE_OOL_CLASS(ool_name, masm_ool_name, T) \
+ class ool_name final : public OutOfLineCode { \
+ public: \
+ ool_name(CodeGenerator* gen, T dst, T src1, T src2) \
+ : OutOfLineCode(gen), dst_(dst), src1_(src1), src2_(src2) {} \
+ \
+ void Generate() final { __ masm_ool_name(dst_, src1_, src2_); } \
+ \
+ private: \
+ T const dst_; \
+ T const src1_; \
+ T const src2_; \
+ }
+
+CREATE_OOL_CLASS(OutOfLineFloat32Max, Float32MaxOutOfLine, FPURegister);
+CREATE_OOL_CLASS(OutOfLineFloat32Min, Float32MinOutOfLine, FPURegister);
+CREATE_OOL_CLASS(OutOfLineFloat64Max, Float64MaxOutOfLine, FPURegister);
+CREATE_OOL_CLASS(OutOfLineFloat64Min, Float64MinOutOfLine, FPURegister);
+
+#undef CREATE_OOL_CLASS
Condition FlagsConditionToConditionCmp(FlagsCondition condition) {
switch (condition) {
@@ -1430,47 +1450,55 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
}
case kMips64Float32Max: {
- Label compare_nan, done_compare;
- __ MaxNaNCheck_s(i.OutputSingleRegister(), i.InputSingleRegister(0),
- i.InputSingleRegister(1), &compare_nan);
- __ Branch(&done_compare);
- __ bind(&compare_nan);
- __ Move(i.OutputSingleRegister(),
- std::numeric_limits<float>::quiet_NaN());
- __ bind(&done_compare);
+ FPURegister dst = i.OutputSingleRegister();
+ FPURegister src1 = i.InputSingleRegister(0);
+ FPURegister src2 = i.InputSingleRegister(1);
+ if (src1.is(src2)) {
+ __ Move_s(dst, src1);
+ } else {
+ auto ool = new (zone()) OutOfLineFloat32Max(this, dst, src1, src2);
+ __ Float32Max(dst, src1, src2, ool->entry());
+ __ bind(ool->exit());
+ }
break;
}
case kMips64Float64Max: {
- Label compare_nan, done_compare;
- __ MaxNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
- i.InputDoubleRegister(1), &compare_nan);
- __ Branch(&done_compare);
- __ bind(&compare_nan);
- __ Move(i.OutputDoubleRegister(),
- std::numeric_limits<double>::quiet_NaN());
- __ bind(&done_compare);
+ FPURegister dst = i.OutputDoubleRegister();
+ FPURegister src1 = i.InputDoubleRegister(0);
+ FPURegister src2 = i.InputDoubleRegister(1);
+ if (src1.is(src2)) {
+ __ Move_d(dst, src1);
+ } else {
+ auto ool = new (zone()) OutOfLineFloat64Max(this, dst, src1, src2);
+ __ Float64Max(dst, src1, src2, ool->entry());
+ __ bind(ool->exit());
+ }
break;
}
case kMips64Float32Min: {
- Label compare_nan, done_compare;
- __ MinNaNCheck_s(i.OutputSingleRegister(), i.InputSingleRegister(0),
- i.InputSingleRegister(1), &compare_nan);
- __ Branch(&done_compare);
- __ bind(&compare_nan);
- __ Move(i.OutputSingleRegister(),
- std::numeric_limits<float>::quiet_NaN());
- __ bind(&done_compare);
+ FPURegister dst = i.OutputSingleRegister();
+ FPURegister src1 = i.InputSingleRegister(0);
+ FPURegister src2 = i.InputSingleRegister(1);
+ if (src1.is(src2)) {
+ __ Move_s(dst, src1);
+ } else {
+ auto ool = new (zone()) OutOfLineFloat32Min(this, dst, src1, src2);
+ __ Float32Min(dst, src1, src2, ool->entry());
+ __ bind(ool->exit());
+ }
break;
}
case kMips64Float64Min: {
- Label compare_nan, done_compare;
- __ MinNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
- i.InputDoubleRegister(1), &compare_nan);
- __ Branch(&done_compare);
- __ bind(&compare_nan);
- __ Move(i.OutputDoubleRegister(),
- std::numeric_limits<double>::quiet_NaN());
- __ bind(&done_compare);
+ FPURegister dst = i.OutputDoubleRegister();
+ FPURegister src1 = i.InputDoubleRegister(0);
+ FPURegister src2 = i.InputDoubleRegister(1);
+ if (src1.is(src2)) {
+ __ Move_d(dst, src1);
+ } else {
+ auto ool = new (zone()) OutOfLineFloat64Min(this, dst, src1, src2);
+ __ Float64Min(dst, src1, src2, ool->entry());
+ __ bind(ool->exit());
+ }
break;
}
case kMips64Float64SilenceNaN:
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698