A DESCRIPTION OF THE PROBLEM :
C2 can be improved to Idealize bool eq/ne (cmp (and (urshift X const1) const2) 0) into bool eq/ne (cmp (and X newconst) 0) where newconst is being computed from the two original constants.
The following pattern can be improved:
public boolean testFunc(int a) {
int mask = 0b101;
int shift = 12;
return ((a >> shift) & mask) == 0;
}
On x86, this improvement means only a "test" instruction will be emitted instead of a "shift" followed by a "test".
I've already created a PR: https://github.com/openjdk/jdk/pull/19310
C2 can be improved to Idealize bool eq/ne (cmp (and (urshift X const1) const2) 0) into bool eq/ne (cmp (and X newconst) 0) where newconst is being computed from the two original constants.
The following pattern can be improved:
public boolean testFunc(int a) {
int mask = 0b101;
int shift = 12;
return ((a >> shift) & mask) == 0;
}
On x86, this improvement means only a "test" instruction will be emitted instead of a "shift" followed by a "test".
I've already created a PR: https://github.com/openjdk/jdk/pull/19310
- links to
-
Review(master) openjdk/jdk/19310