Reviewers: Benedikt Meurer, ulan,
Message:
This is relevant to the discussion in issue 1179503003.
As I see it, we have two options:
- Handle arbitrary immediate shifts. (That's what this patch does.)
- Disallow out-of-range immediate shifts.
I prefer the method of just taking bits 0-4/5 because that's what ARM64
hardware
does for variable shifts. Since we currently use variable shift
instructions for
out-of-range immediates, the actual behaviour of the generated code is
unchanged
by this patch. It's also how JavaScript shifts are defined, and it makes
sense
for the kWord32ShiftIsSafe flag.
That is, kWord32ShiftIsSafe allows us to provide out-of-range values for
variable shifts so why not for immediate shifts?
For the record, (at least) the following JavaScript will generate
out-of-range
immediate shifts:
function f() {
var x = 0;
x -= 34;
return x >>> (33 % x);
}
print(f());
This kind of pattern is found in the numops-fuzz tests, and in one or two
instruction selector tests, but that's all.
What are your thoughts on the matter?
Description:
[arm64][turbofan]: Handle any immediate shift.
With this patch, we can generate simple immediate-shift instructions for
immediates outside the range "0 <= imm < width". Several related
instruction selectors have also been updated accordingly.
Example of generated code:
---- Before --- ---- After ----
movz w0, #33 lsr w0, w1, #1
lsr w0, w1, w0
BUG=
Please review this at https://codereview.chromium.org/1179733004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+137, -101 lines):
M src/compiler/arm64/code-generator-arm64.cc
M src/compiler/arm64/instruction-selector-arm64.cc
M test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
--
--
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/d/optout.