DescriptionImprove code for integral modulus calculation.
Depending on what we know about the right operand, we basically do 3
different things (and the code is actually structured this way):
* If we statically know that the right operand is a power of 2, we do
some bit fiddling instead of doing a "real" modulus calculation.
This should actually be done on the Hydrogen level, not on the
Lithium level, but this will be a separate CL.
* If type feedback tells us that the right operand is a power of 2, we
do the same as above, but guarded by conditional deoptimization to
make sure that the assumption is still valid. In the long run, we
should make this guard visible on the Hydrogen level to make it
visible for GVN and other optimizations.
* In the general case we only do the minimum steps necessary and don't
try to be too clever, because cleverness actually slows us down on
real-world code.
If we look at the code gerators for LModI, we actually see that we
basically have 3 (4 on ARM) fundamentally different translations. I
don't really like lumping them together, they should probably be
different Lithium instructions. For the time being, I restructured the
generators to make this crystal-clear, at the cost of some duplication
regarding the power-of-2 cases. This will go away when we do the
strength reduction on the Hydrogen level, so I'd like to keep it as it
is for now.
Note that the MIPS part was only slightly restructured, there is still
some work to do there.
R=jkummerow@chromium.org
Committed: http://code.google.com/p/v8/source/detail?r=15034
Patch Set 1 #
Total comments: 4
Patch Set 2 : Rebased. Addressed feedback. Tiny simplifications. #Patch Set 3 : Rebased. x64. Partial stuff on ARM/MIPS. #Patch Set 4 : Rebased. ia32/x64/ARM done, MIPS restructured. #
Total comments: 17
Patch Set 5 : Rebased. Addressed feedback. #Patch Set 6 : Rebased. #
Messages
Total messages: 11 (0 generated)
|