8203041: AArch64: fix overflow in immediate cmp/cmn instruction

Fix overflow in immediate cmp/cmn instruction for AArch64

Reviewed-by: aph, dpochepk, drwhite
This commit is contained in:
Joshua Zhu 2018-05-24 07:20:10 +08:00 committed by Fei Yang
parent 6a0c745008
commit 24d75d940a

@ -3851,7 +3851,9 @@ class StubGenerator: public StubCodeGenerator {
__ sub(cnt1, cnt1, 8 * wordSize);
__ eor(tmp7, tmp7, tmp8);
__ ldp(tmp2, tmp4, Address(__ post(a2, 2 * wordSize)));
__ cmp(cnt1, loopThreshold);
// tmp6 is not used. MacroAssembler::subs is used here (rather than
// cmp) because subs allows an unlimited range of immediate operand.
__ subs(tmp6, cnt1, loopThreshold);
__ orr(tmp5, tmp5, tmp7);
__ cbnz(tmp5, NOT_EQUAL);
__ br(__ GE, LOOP);
@ -3877,7 +3879,7 @@ class StubGenerator: public StubCodeGenerator {
__ ld1(v0, v1, v2, v3, __ T2D, Address(__ post(a1, 4 * 2 * wordSize)));
__ sub(cnt1, cnt1, 8 * wordSize);
__ ld1(v4, v5, v6, v7, __ T2D, Address(__ post(a2, 4 * 2 * wordSize)));
__ cmp(cnt1, loopThreshold);
__ subs(tmp1, cnt1, loopThreshold);
__ eor(v0, __ T16B, v0, v4);
__ eor(v1, __ T16B, v1, v5);
__ eor(v2, __ T16B, v2, v6);
@ -3936,7 +3938,7 @@ class StubGenerator: public StubCodeGenerator {
}
if (UseSIMDForArrayEquals) {
if (SoftwarePrefetchHintDistance >= 0) {
__ cmp(cnt1, prefetchLoopThreshold);
__ subs(tmp1, cnt1, prefetchLoopThreshold);
__ br(__ LE, NO_PREFETCH_LARGE_LOOP);
generate_large_array_equals_loop_simd(prefetchLoopThreshold,
/* prfm = */ true, NOT_EQUAL);
@ -3949,7 +3951,7 @@ class StubGenerator: public StubCodeGenerator {
} else {
__ push(spilled_regs, sp);
if (SoftwarePrefetchHintDistance >= 0) {
__ cmp(cnt1, prefetchLoopThreshold);
__ subs(tmp1, cnt1, prefetchLoopThreshold);
__ br(__ LE, NO_PREFETCH_LARGE_LOOP);
generate_large_array_equals_loop_nonsimd(prefetchLoopThreshold,
/* prfm = */ true, NOT_EQUAL);