Optimization to avoid generating unnecessary sign-extension code when converting UChar values to Long/ULong.

This ameliorates a performance regression due to promoting char to int instead of unsigned int.
This commit is contained in:
Stephen Heumann 2016-10-11 19:36:39 -05:00
parent cc75a9b12b
commit 953a7c36d5
1 changed files with 4 additions and 0 deletions

View File

@ -987,6 +987,10 @@ case op^.opcode of {check for optimizations of this node}
pc_cnv: begin {pc_cnv}
fromtype.i := (op^.q & $00F0) >> 4;
totype.i := op^.q & $000F;
if (fromtype.optype = cgWord) and (TypeOf(op^.left) = cgUByte) then begin
fromType.optype := cgUWord;
op^.q := (op^.q & $FF0F) | (fromtype.i << 4);
end; {if}
if op^.left^.opcode = pc_ldc then begin
case fromtype.optype of
cgByte,cgWord: