Index: runtime/vm/intermediate_language_ia32.cc |
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc |
index 50027124042b40695299f94bd3dcdf134f4bdeb6..965cbeb998a3e88ec3f6c74134b69479a7ef7662 100644 |
--- a/runtime/vm/intermediate_language_ia32.cc |
+++ b/runtime/vm/intermediate_language_ia32.cc |
@@ -3899,6 +3899,56 @@ 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 XmmRegister value = locs()->in(0).fpu_reg(); |
+ const Register result = locs()->out(0).reg(); |
+ if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { |
+ Label is_nan; |
+ __ LoadObject(result, Bool::True()); |
+ __ comisd(value, value); |
+ __ j(PARITY_EVEN, &is_nan, Assembler::kNearJump); |
+ __ LoadObject(result, Bool::False()); |
+ __ Bind(&is_nan); |
+ } else { |
+ ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); |
+ Label not_inf, done; |
+ __ AddImmediate(ESP, Immediate(-kDoubleSize)); |
+ __ movsd(Address(ESP, 0), value); |
+ __ movl(result, Address(ESP, 0)); |
+ // If the low word isn't zero, then it isn't infinity. |
+ __ cmpl(result, Immediate(0)); |
+ __ j(NOT_EQUAL, ¬_inf, Assembler::kNearJump); |
+ // Check the high word. |
+ __ movl(result, Address(ESP, kWordSize)); |
+ // Mask off sign bit. |
+ __ andl(result, Immediate(0x7FFFFFFF)); |
+ // Compare with +infinity. |
+ __ cmpl(result, Immediate(0x7FF00000)); |
+ __ j(NOT_EQUAL, ¬_inf, Assembler::kNearJump); |
+ __ LoadObject(result, Bool::True()); |
+ __ jmp(&done); |
+ |
+ __ Bind(¬_inf); |
+ __ LoadObject(result, Bool::False()); |
+ __ Bind(&done); |
+ __ AddImmediate(ESP, Immediate(kDoubleSize)); |
+ } |
+} |
+ |
+ |
LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, |
bool opt) const { |
const intptr_t kNumInputs = 2; |