-
Enhancement
-
Resolution: Unresolved
-
P4
-
21
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
FollowingJDK-8283699, optimizations were added to make peephole transforms to combine moves and left shifts into a single "lea" instruction. However, as described in the RFR, this optimization seems to only work in the case that the mov instruction comes before the shift instruction, and not in the case that the mov comes after the shift. For example, in this case:
public int shift(int x) {
return x << 1 >> 2;
}
the following opto assembly is created:
01a sall RDX, #1
01c movl RAX, RDX # spill
01e sarl RAX, #2
The sal and the mov could be combined into a "lea RAX, [RDX << #1]" similarly to what a method with just the body "return x << 1;" would create.
Following
public int shift(int x) {
return x << 1 >> 2;
}
the following opto assembly is created:
01a sall RDX, #1
01c movl RAX, RDX # spill
01e sarl RAX, #2
The sal and the mov could be combined into a "lea RAX, [RDX << #1]" similarly to what a method with just the body "return x << 1;" would create.
- relates to
-
JDK-8283699 Improve the peephole mechanism of hotspot
-
- Resolved
-