[aarch64-port-dev ] RFR(XS): 8242070: AArch64: Fix a typo introduced by JDK-8238690
Yang Zhang
Yang.Zhang at arm.com
Fri Apr 10 02:52:45 UTC 2020
Hi,
Could you please help to review this patch?
JBS: https://bugs.openjdk.java.net/browse/JDK-8242070
Webrev: http://cr.openjdk.java.net/~yzhang/8242070/webrev.00/
In JDK-8238690, it unified IR shape for vector shifts by scalar and always used
ShiftV src (ShiftCntV shift)
When shift is scalar, the following IR nodes are generated.
scalar_shift
|
src ShiftCntV
| /
| /
ShiftV
But when implementing this on AArch64, there is an issue in match rule
of vector shift right with imm shift for short type.
match(Set dst (RShiftVS src (LShiftCntV shift)));
LShiftCntV should be RShiftCntV here.
Test case:
public static void shiftR(short[] a, short[] c) {
for (int i = 0; i < a.length; i++) {
c[i] = (short)(a[i] >> 2);
}
}
IR nodes:
imm:2
|
LoadVector RShiftCntV
| /
| /
RShiftVS
C2 aassembly generated:
Before:
0x0000ffffac563764: orr w11, wzr, #0x2
0x0000ffffac563768: dup v16.16b, w11 -------- vshiftcnt16B
0x0000ffffac5637a8: ldr q24, [x18, #16]
0x0000ffffac5637ac: neg v25.16b, v16.16b ------
0x0000ffffac5637b0: sshl v24.8h, v24.8h, v25.8h ------vsra8S
0x0000ffffac5637b8: str q24, [x14, #16]
"match(Set dst (RShiftVS src (LShiftCntV shift)));" matching fails.
RShiftCntV and RShiftVS are matched separately by vshiftcnt16B and vsra8S.
After:
0x0000ffffac563808: ldr q16, [x15, #16]
0x0000ffffac56380c: sshr v16.8h, v16.8h, #2
0x0000ffffac563814: str q16, [x14, #16]
"match(Set dst (RShiftVS src (RShiftCntV shift)));" matching succeeds.
Performance:
JMH test case is attached in JBS.
Before:
Benchmark Mode Cnt Score Error Units
TestVect.testVectShift avgt 10 66.964 ± 0.052 us/op
After:
Benchmark Mode Cnt Score Error Units
TestVect.testVectShift avgt 10 56.156 ± 0.053 us/op
Testing: tier1
Pass and no new failure.
Regards
Yang
More information about the hotspot-compiler-dev
mailing list