changeset 13384:23e687f0c874

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
author yzhang
date Wed, 26 Jul 2017 15:54:13 +0800
parents bef84e964115
children 877b95d69748
files src/cpu/aarch64/vm/macroAssembler_aarch64.hpp src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Fri Jun 23 11:41:24 2017 +0800
+++ b/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/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Fri Jun 23 11:41:24 2017 +0800
+++ b/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);