8184900: AArch64: Fix overflow in immediate cmp instruction
Summary: Use subs instead of cmp to compare BlockZeroingLowLimit.
Reviewed-by: aph
Contributed-by: yang.zhang@linaro.org
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Fri Jun 23 11:41:24 2017 +0800
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Wed Jul 26 15:54:13 2017 +0800
@@ -169,6 +169,7 @@
template<class T>
inline void cmpw(Register Rd, T imm) { subsw(zr, Rd, imm); }
+ // imm is limited to 12 bits.
inline void cmp(Register Rd, unsigned imm) { subs(zr, Rd, imm); }
inline void cmnw(Register Rd, unsigned imm) { addsw(zr, Rd, imm); }
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri Jun 23 11:41:24 2017 +0800
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Wed Jul 26 15:54:13 2017 +0800
@@ -764,7 +764,7 @@
// alignment.
Label small;
int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit);
- __ cmp(cnt, low_limit >> 3);
+ __ subs(rscratch1, cnt, low_limit >> 3);
__ br(Assembler::LT, small);
__ zero_dcache_blocks(base, cnt);
__ bind(small);