Bug 1510735 - ARM64 codegen for LTestDAndBranch and LTestFAndBranch. r=nbp
authorSean Stangl <sean.stangl@gmail.com>
Fri, 30 Nov 2018 09:30:00 +0200
changeset 505484 534d6864862bdbcec64551b12bc87e5a230b66ab
parent 505483 6c17ac872bdfa23edf836b45246eca9201430d6f
child 505485 035d5b058729aed86f13d9309c657ffb94ba8fdb
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1510735
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510735 - ARM64 codegen for LTestDAndBranch and LTestFAndBranch. r=nbp
js/src/jit/arm/CodeGenerator-arm.cpp
js/src/jit/arm64/CodeGenerator-arm64.cpp
--- a/js/src/jit/arm/CodeGenerator-arm.cpp
+++ b/js/src/jit/arm/CodeGenerator-arm.cpp
@@ -1416,32 +1416,32 @@ void CodeGeneratorARM::splitTagForTest(c
 
 void CodeGenerator::visitTestDAndBranch(LTestDAndBranch* test) {
   const LAllocation* opd = test->input();
   masm.ma_vcmpz(ToFloatRegister(opd));
   masm.as_vmrs(pc);
 
   MBasicBlock* ifTrue = test->ifTrue();
   MBasicBlock* ifFalse = test->ifFalse();
-  // If the compare set the 0 bit, then the result is definately false.
+  // If the compare set the 0 bit, then the result is definitely false.
   jumpToBlock(ifFalse, Assembler::Zero);
   // It is also false if one of the operands is NAN, which is shown as
   // Overflow.
   jumpToBlock(ifFalse, Assembler::Overflow);
   jumpToBlock(ifTrue);
 }
 
 void CodeGenerator::visitTestFAndBranch(LTestFAndBranch* test) {
   const LAllocation* opd = test->input();
   masm.ma_vcmpz_f32(ToFloatRegister(opd));
   masm.as_vmrs(pc);
 
   MBasicBlock* ifTrue = test->ifTrue();
   MBasicBlock* ifFalse = test->ifFalse();
-  // If the compare set the 0 bit, then the result is definately false.
+  // If the compare set the 0 bit, then the result is definitely false.
   jumpToBlock(ifFalse, Assembler::Zero);
   // It is also false if one of the operands is NAN, which is shown as
   // Overflow.
   jumpToBlock(ifFalse, Assembler::Overflow);
   jumpToBlock(ifTrue);
 }
 
 void CodeGenerator::visitCompareD(LCompareD* comp) {
--- a/js/src/jit/arm64/CodeGenerator-arm64.cpp
+++ b/js/src/jit/arm64/CodeGenerator-arm64.cpp
@@ -864,21 +864,43 @@ void CodeGenerator::visitDouble(LDouble*
 }
 
 void CodeGenerator::visitFloat32(LFloat32* ins) {
   ARMFPRegister output(ToFloatRegister(ins->getDef(0)), 32);
   masm.Fmov(output, ins->getFloat());
 }
 
 void CodeGenerator::visitTestDAndBranch(LTestDAndBranch* test) {
-  MOZ_CRASH("visitTestDAndBranch");
+  const LAllocation* opd = test->input();
+  MBasicBlock* ifTrue = test->ifTrue();
+  MBasicBlock* ifFalse = test->ifFalse();
+
+  masm.Fcmp(ARMFPRegister(ToFloatRegister(opd), 64), 0.0);
+
+  // If the compare set the 0 bit, then the result is definitely false.
+  jumpToBlock(ifFalse, Assembler::Zero);
+
+  // Overflow means one of the operands was NaN, which is also false.
+  jumpToBlock(ifFalse, Assembler::Overflow);
+  jumpToBlock(ifTrue);
 }
 
 void CodeGenerator::visitTestFAndBranch(LTestFAndBranch* test) {
-  MOZ_CRASH("visitTestFAndBranch");
+  const LAllocation* opd = test->input();
+  MBasicBlock* ifTrue = test->ifTrue();
+  MBasicBlock* ifFalse = test->ifFalse();
+
+  masm.Fcmp(ARMFPRegister(ToFloatRegister(opd), 32), 0.0);
+
+  // If the compare set the 0 bit, then the result is definitely false.
+  jumpToBlock(ifFalse, Assembler::Zero);
+
+  // Overflow means one of the operands was NaN, which is also false.
+  jumpToBlock(ifFalse, Assembler::Overflow);
+  jumpToBlock(ifTrue);
 }
 
 void CodeGenerator::visitCompareD(LCompareD* comp) {
   const FloatRegister left = ToFloatRegister(comp->left());
   const FloatRegister right = ToFloatRegister(comp->right());
   ARMRegister output = toWRegister(comp->output());
   Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop());