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

Unified Diff: runtime/vm/intermediate_language_arm64.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Cleanup 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
Index: runtime/vm/intermediate_language_arm64.cc
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index 1eabe23055f10867cae5ef623d5ba392d905b47c..23022f0d92239d505a5b34d56049e0b6b38e09a2 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -3482,6 +3482,41 @@ 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 VRegister value = locs()->in(0).fpu_reg();
+ const Register result = locs()->out(0).reg();
+ if (op_kind() == MethodRecognizer::kDoubleIsNaN) {
+ __ fcmpd(value, value);
+ __ LoadObject(result, Bool::False());
+ __ LoadObject(TMP, Bool::True());
+ __ csel(result, TMP, result, VS);
+ } else {
+ ASSERT(op_kind() == MethodRecognizer::kDoubleIsInfinite);
+ __ vmovrd(result, value, 0);
+ // Mask off the sign.
+ __ AndImmediate(result, result, 0x7FFFFFFFFFFFFFFFLL);
+ // Compare with +infinity.
+ __ CompareImmediate(result, 0x7FF0000000000000LL);
+ __ LoadObject(result, Bool::False());
+ __ LoadObject(TMP, Bool::True());
+ __ csel(result, TMP, result, EQ);
+ }
+}
+
+
LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 2;

Powered by Google App Engine
This is Rietveld 408576698