From b821e3144289c7d70354fd2c000e00c99d7e0b2f Mon Sep 17 00:00:00 2001
From: Jonas Maebe <jonas@freepascal.org>
Date: Sat, 28 Feb 2015 22:31:03 +0000
Subject: [PATCH]   * force constants into a registers in the 32x32->64
 optimized case

git-svn-id: trunk@30034 -
---
 compiler/aarch64/ncpuadd.pas | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler/aarch64/ncpuadd.pas b/compiler/aarch64/ncpuadd.pas
index ccebd21883..16c9abcb73 100644
--- a/compiler/aarch64/ncpuadd.pas
+++ b/compiler/aarch64/ncpuadd.pas
@@ -366,6 +366,10 @@ interface
                       not(is_signed(right.resultdef));
             pass_left_right;
             force_reg_left_right(true,true);
+            { force_reg_left_right can leave right as a LOC_CONSTANT (we can't
+              say "a constant register is okay, but an ordinal constant isn't) }
+            if right.location.loc=LOC_CONSTANT then
+              hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
             location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
             location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resultdef));
             current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg_reg(multops[unsigned],location.register,left.location.register,right.location.register));