DescriptionFixed and improved code for integral division. Fixed and extended tests.
Arithmetic right shifting is *not* division in two's complement
representation, only in one's complement. So we convert to one's
complement, shift, and go back to two's complement. By permutating the
last steps, one can get efficient branch-free code. This insight comes
from the paleozoic era of computer science, see the paper from 1976:
Guy Lewis Steele Jr.: "Arithmetic Shifting Considered Harmful"
ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-378.pdf
This results in better and more correct code than our previous
"neg/shift/neg" dance.
LOG=y
BUG=v8:3151
R=bmeurer@chromium.org
Committed: https://code.google.com/p/v8/source/detail?r=19434
Patch Set 1 #Patch Set 2 : x64 port #Patch Set 3 : Rebased. Added ARM port. Fixes. #Patch Set 4 : First (almost correct) A64 port. #Patch Set 5 : A64 fixes and cleanup #
Total comments: 2
Messages
Total messages: 3 (0 generated)
|