My rule of thumb would be similar to Sven's one: conditional non-execution
of
2-3 "simple" instructions is equivalent to a probably correctly predicted
jump
around them. If the jump is not easily predicted then you can add 1-2 simple
instructions.
Of course there are other factors to take into account: the branch
predictor has
limited resources and has such can only track a limited number of
conditional
branches, with a limited density. Using conditional instructions instead of
branches free some resources. On some earlier cores we had performance
issues
due to the branch predictor being overwhelmed (octane/crypto was the culprit
IIRC)
https://codereview.chromium.org/100483006/diff/1/src/arm/lithium-codegen-arm.cc
File src/arm/lithium-codegen-arm.cc (right):
https://codereview.chromium.org/100483006/diff/1/src/arm/lithium-codegen-arm.cc#newcode1418
src/arm/lithium-codegen-arm.cc:1418: __ cmp(right, Operand(-1), eq);
On 2013/12/12 13:43:23, Sven Panne wrote:
Is conditional non-execution of 2 instructions really better than a
probably
correctly predicted jump around them? I think it is (IIRC the
threshold was
around 3 instructions), but I'll let our ARM black belts decide... :-)
conditional execution of two "simple" instructions will be comparable to
the branch case. Since we save space, this is good.
https://codereview.chromium.org/100483006/diff/1/src/arm/lithium-codegen-arm.cc#newcode3445
src/arm/lithium-codegen-arm.cc:3445: __ ldr(result, MemOperand(fp,
StandardFrameConstants::kCallerFPOffset), ne);
On 2013/12/12 13:43:23, Sven Panne wrote:
... and here (3 instructions now)
Here the answer would depend on the surrounding code (e.g. how many
loads/stores around). If ArgumentsLength is not too common (I believe it
is the case) then we are fine.
https://codereview.chromium.org/100483006/diff/1/src/arm/lithium-codegen-arm.cc#newcode3875
src/arm/lithium-codegen-arm.cc:3875: __ vadd(result, input,
kDoubleRegZero, ne);
On 2013/12/12 13:43:23, Sven Panne wrote:
... and here.
vadd and especially vsqrt are complex instructions. Complex instructions
don't interact too well with conditions and the CPU could perform the
entire operation before discarding the result if the condition is false.
So here we'll be slower on most modern CPU. If we were in full-codegen
that would be acceptable though.
https://codereview.chromium.org/100483006/
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.