• svenpanne@chromium.org's avatar
    Consistenly handle power-of-2 divisors in division-like operations · 819315db
    svenpanne@chromium.org authored
    Lithium currently supports 3 division-like operations on integral operands: "Normal" division (rounding towards zero), flooring division (rounding towards -Infinity) and modulus calculation (the counterpart for the "normal" division). For divisors which are a power of 2, one can efficiently use some bit fiddling to avoid the actual division for such operations. This CL cleanly splits off these operations into separate Lithium instructions, making the code much more maintainable and more consistent across platforms.
    
    There are 2 basic variations of these bit fiddling algorithms: One involving branches and a seemingly more clever one without branches. Choosing between the two is not as easy as it seems: Benchmarks (and probably real-world) programs seem to favor positive dividends, registers and shifting units are sometimes scarce resources, and branch prediction is quite good in modern processors. Therefore only the "normal" division by a power of 2 is implemented in a branch-free manner, this seems to be the best approach in practice. If this turns out to be wrong, we can easily and locally change this.
    
    R=bmeurer@chromium.org
    
    Review URL: https://codereview.chromium.org/175143002
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19715 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    819315db
Name
Last commit
Last update
..
OWNERS Loading commit data...
assembler-a64-inl.h Loading commit data...
assembler-a64.cc Loading commit data...
assembler-a64.h Loading commit data...
builtins-a64.cc Loading commit data...
code-stubs-a64.cc Loading commit data...
code-stubs-a64.h Loading commit data...
codegen-a64.cc Loading commit data...
codegen-a64.h Loading commit data...
constants-a64.h Loading commit data...
cpu-a64.cc Loading commit data...
cpu-a64.h Loading commit data...
debug-a64.cc Loading commit data...
debugger-a64.cc Loading commit data...
debugger-a64.h Loading commit data...
decoder-a64-inl.h Loading commit data...
decoder-a64.cc Loading commit data...
decoder-a64.h Loading commit data...
deoptimizer-a64.cc Loading commit data...
disasm-a64.cc Loading commit data...
disasm-a64.h Loading commit data...
frames-a64.cc Loading commit data...
frames-a64.h Loading commit data...
full-codegen-a64.cc Loading commit data...
ic-a64.cc Loading commit data...
instructions-a64.cc Loading commit data...
instructions-a64.h Loading commit data...
instrument-a64.cc Loading commit data...
instrument-a64.h Loading commit data...
lithium-a64.cc Loading commit data...
lithium-a64.h Loading commit data...
lithium-codegen-a64.cc Loading commit data...
lithium-codegen-a64.h Loading commit data...
lithium-gap-resolver-a64.cc Loading commit data...
lithium-gap-resolver-a64.h Loading commit data...
macro-assembler-a64-inl.h Loading commit data...
macro-assembler-a64.cc Loading commit data...
macro-assembler-a64.h Loading commit data...
regexp-macro-assembler-a64.cc Loading commit data...
regexp-macro-assembler-a64.h Loading commit data...
simulator-a64.cc Loading commit data...
simulator-a64.h Loading commit data...
stub-cache-a64.cc Loading commit data...
utils-a64.cc Loading commit data...
utils-a64.h Loading commit data...