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

Unified Diff: runtime/vm/intermediate_language_mips.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Address comments Created 4 years, 2 months 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 | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_mips.cc
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index e824df18862e5c411a9bf1cc4128604139ea1d92..d61337d52f38a965917fbdb336448c81a91d5052 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -3692,6 +3692,51 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new(zone) LocationSummary(
+ zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresFpuRegister());
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+
+void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ ASSERT(compiler->is_optimizing());
+ const DRegister value = locs()->in(0).fpu_reg();
+ const Register result = locs()->out(0).reg();
+ if (op_kind() == MethodRecognizer::kDouble_getIsNaN) {
+ Label is_not_nan;
+ __ LoadObject(result, Bool::False());
+ __ cund(value, value);
+ __ bc1f(&is_not_nan);
+ __ LoadObject(result, Bool::True());
+ __ Bind(&is_not_nan);
+ } else {
+ ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite);
+ Label not_inf, done;
+ __ mfc1(TMP, EvenFRegisterOf(value));
+ __ mfc1(result, OddFRegisterOf(value));
+ // If the low word isn't zero, then it isn't infinity.
+ __ bne(TMP, ZR, &not_inf);
+ // Mask off the sign bit.
+ __ AndImmediate(result, result, 0x7FFFFFFF);
+ // Compare with +infinity.
+ __ BranchNotEqual(result, Immediate(0x7FF00000), &not_inf);
+
+ __ LoadObject(result, Bool::True());
+ __ b(&done);
+
+ __ Bind(&not_inf);
+ __ LoadObject(result, Bool::False());
+ __ Bind(&done);
+ }
+}
+
+
LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
UNIMPLEMENTED();
@@ -4536,10 +4581,10 @@ static void InvokeDoublePow(FlowGraphCompiler* compiler,
__ Bind(&try_sqrt);
// Before calling pow, check if we could use sqrt instead of pow.
__ LoadImmediate(result, kPosInfinity);
- // base == -Infinity -> call pow;
+ // base == Infinity -> call pow;
__ ceqd(base, result);
Label do_pow;
- __ b(&do_pow);
+ __ bc1t(&do_pow);
// exponent == 0.5 ?
__ LoadImmediate(result, 0.5);
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698