m68k: if we're loading small (8 bit signed) values into long references, move them through a register (usually with MOVEQ). this is two bytes shorter and also faster on most 68k CPUs

git-svn-id: trunk@32837 -
This commit is contained in:
Károly Balogh 2016-01-03 18:32:27 +00:00
parent f69f6336e9
commit 185ee93312

View File

@ -827,7 +827,18 @@ unit cgcpu;
list.concat(taicpu.op_reg_ref(A_MOVE,tcgsize2opsize[tosize],hreg,href));
end
else
list.concat(taicpu.op_const_ref(A_MOVE,tcgsize2opsize[tosize],longint(a),href));
{ loading via a register is almost always faster if the value is small.
(with the 68040 being the only notable exception, so maybe disable
this on a '040? but the difference is minor) it also results in shorter
code. (KB) }
if isvalue8bit(a) and (tcgsize2opsize[tosize] = S_L) then
begin
hreg:=getintregister(list,OS_INT);
a_load_const_reg(list,OS_INT,a,hreg); // this will use moveq et.al.
list.concat(taicpu.op_reg_ref(A_MOVE,tcgsize2opsize[tosize],hreg,href));
end
else
list.concat(taicpu.op_const_ref(A_MOVE,tcgsize2opsize[tosize],longint(a),href));
end;