Status: New
Owner: ----

New issue 1019 by alexandre.rames: Missing vmrs after vcmp instructions on ARM in LCodeGen::DoBranch
http://code.google.com/p/v8/issues/detail?id=1019

On ARM:

There are 2 vmrs(pc) instructions are missing in LCodeGen::DoBranch after vcmp instructions. Because of this the vfp status flags are not retrieved and the following branches evaluate a wrong condition.

Bug discovered after implementing LCodeGen::DoStoreNamedField, which was provoking many bailouts.

JS code showing the bug: (with --crankshaft --always_opt)

function test(a) {
  print(a ? 1 : 0);
}

for(var i = -5; i < 5; i++) {
  test(i + 0.1);
}

Index: src/arm/lithium-codegen-arm.cc
=======================
--- src/arm/lithium-codegen-arm.cc      (revision 6149)
+++ src/arm/lithium-codegen-arm.cc      (working copy)
@@ -1031,6 +1031,7 @@
   } else if (r.IsDouble()) {
     DoubleRegister reg = ToDoubleRegister(instr->input());
     __ vcmp(reg, 0.0);
+    __ vmrs(pc);  // Move vector status bits to normal status bits.
     EmitBranch(true_block, false_block, ne);
   } else {
     ASSERT(r.IsTagged());
@@ -1069,6 +1070,7 @@
       __ sub(ip, reg, Operand(kHeapObjectTag));
       __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset);
       __ vcmp(dbl_scratch, 0.0);
+      __ vmrs(pc);  // Move vector status bits to normal status bits.
       __ b(eq, false_label);
       __ b(true_label);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to