On 2012/11/07 09:54:03, ulan1 wrote:
> Looks good overall!
Thanks! I've uploaded a new patch. This passes all tests (except one, but
that
times out on bleeding_edge too). I also couldn't build and test it on MIPS,
because it seems that build is broken.
I've cleaned it up and think this is ready for a proper review now. I'll
look
into adding some new tests for it next week.
> > This confuses me, becaue the simulator just does:
> > set_d_register_from_double(vd, dd_value + dn_value * dm_value);
> Could it be that the simulator is using 80-bit registers to compute the
> expression and therefore is too precise?
> Maybe split it into two instructions? one computes the product and writes
> it
> into the register, and another computes the sum after reading from the
register.
Yes, this seems to fix it.
> > I'm also not entirely sure if this approach is the best.
> I not sure too, but putting it at a lower level would require support for
> instruction sequence matching, which we don't have yet.
One idea I had was to try to do this when we go from the hydrogen
representation
to lithium. That way it's easy to find the pattern. I changed the DoAdd
function
to detect that one operand is a multiplication and generate a multiply-add
there, but then I couldn't figure out how to prevent it from generating
code for
the multiplication as well.
> > Also, is it even ok to introduce a hydrogen instruction that only works
> with
> doubles?
> I think so.
OK, cool. I'll rename it to MultiplyAddD to make this more clear.
> > And I guess my #ifdef's in the hydrogen file is not ok.
> Yep, we need to implement vmla instruction for other architectures.
I don't know about availability of floating-point multiply-add instructions
on
the other architectures, but I guess we can just expand it to mul and add
when
we generate the assembly. I tried emitting two lithium instructions for one
hydrogen, but that obviously doesn't work.
I did this for mips too, but that build seems to be broken currently, so I
haven't verified that it works.
> Small nit: I noticed long lines in the code, we have 80 chars limits.
>
https://codereview.chromium.org/11293061/diff/3001/src/arm/lithium-arm.cc
> File src/arm/lithium-arm.cc (right):
https://codereview.chromium.org/11293061/diff/3001/src/arm/lithium-arm.cc#newcode1321
> src/arm/lithium-arm.cc:1321: // FIXME: Not entirely sure this is how to do
it..
> This looks correct.
Great
>
https://codereview.chromium.org/11293061/diff/3001/src/arm/lithium-arm.h
> File src/arm/lithium-arm.h (right):
https://codereview.chromium.org/11293061/diff/3001/src/arm/lithium-arm.h#newcode625
> src/arm/lithium-arm.h:625: class LMultiplyAdd: public
> LTemplateInstruction<1,
3,
> 0> { // FIXME: Do we need a tmp?
> > Do we need a tmp?
> Nope, we don't use tmp register in the implementation of the instruction.
Removed the comment.
https://codereview.chromium.org/11293061/diff/3001/src/arm/lithium-codegen-arm.cc
> File src/arm/lithium-codegen-arm.cc (right):
https://codereview.chromium.org/11293061/diff/3001/src/arm/lithium-codegen-arm.cc#newcode1293
> src/arm/lithium-codegen-arm.cc:1293: DwVfpRegister a =
> ToDoubleRegister(instr->a()); // FIXME: Not sure this is correct..
> Should we check for support of vmla here?
> Otherwise, this looks correct.
If I understand correctly, VMLA is supported in all versions of VFP, so I
don't
think we need to do any checks for support.
>
https://codereview.chromium.org/11293061/diff/3001/src/hydrogen-instructions.h
> File src/hydrogen-instructions.h (right):
https://codereview.chromium.org/11293061/diff/3001/src/hydrogen-instructions.h#newcode3551
> src/hydrogen-instructions.h:3551: // HArithmeticBinaryOperation and
> HMathFloorOfDiv.
> It sets the output representation of this instruction.
Great. I've removed the comment.
>
https://codereview.chromium.org/11293061/diff/3001/src/hydrogen.cc
> File src/hydrogen.cc (right):
>
https://codereview.chromium.org/11293061/diff/3001/src/hydrogen.cc#newcode8327
> src/hydrogen.cc:8327: // FIXME: Probably need to check types here?
> Setting input representation should be sufficient. Hydrogen will introduce
> special change instructions for inputs.
OK.
https://codereview.chromium.org/11293061/