8184900: AArch64: Fix overflow in immediate cmp instruction
authoryzhang
Wed, 26 Jul 2017 15:54:13 +0800
changeset 46720 5c3f87b90eff
parent 46719 0de742eacb75
child 46721 5ea48e85ca90
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
hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
--- 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);