RFR: 8279225: C1 longs comparison operation destroys argument registers
Hao Sun
haosun at openjdk.java.net
Mon Dec 27 08:12:11 UTC 2021
On Fri, 24 Dec 2021 16:25:37 GMT, Sergey Nazarkin <snazarki at openjdk.org> wrote:
> Several regression tests are failed on arm32 CPU if tiered compilation is enabled.
>
> The list includes
> java/math/BigDecimal/DivideMcTests
> java/util/Arrays/Sorting.java
> java/util/Arrays/SortingNearlySortedPrimitive.java
> java/util/concurrent/tck/JSR166TestCase
> java/util/stream/SliceOpTest.java
> etc
>
> It appears C1 comp_op for long operands destroys arguments registers:
> void LIR_Assembler::comp_op(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Op2* op) {
> ....
> Register ylo = opr2->as_register_lo();
> Register yhi = opr2->as_register_hi();
> if (condition == lir_cond_equal || condition == lir_cond_notEqual) {
> __ teq(xhi, yhi);
> __ teq(xlo, ylo, eq);
> } else {
> __ subs(xlo, xlo, ylo); // <<< incorrect
> __ sbcs(xhi, xhi, yhi); // <<< incorrect
> }
> ...
> }
>
> Tested with hotspot_tier2, jdk_tier3 on linux_arm
This fix looks good to me. (I'm not a Reviewer).
One thing to remind is that the PR and JBS should use the same title.
src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp line 1823:
> 1821: __ teq(xlo, ylo, eq);
> 1822: } else {
> 1823: __ cmp(xlo, ylo);
nit: we may want to use `__ subs(Rtemp, xlo, ylo);` here to align with the usage in match rules in arm.ad, e.g., `compL_reg_reg_LEGT`. It's okay to me if you use `cmp` anyway.
-------------
Marked as reviewed by haosun (Author).
PR: https://git.openjdk.java.net/jdk/pull/6934
More information about the hotspot-compiler-dev
mailing list