From af3c8e1eea410d9461c2663bbea1133ad3560b82 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 17 Jun 2023 19:24:50 -0500 Subject: [PATCH] Optimize double stores to just use integer operations. This is equivalent to an optimization already done for float. --- DAG.pas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/DAG.pas b/DAG.pas index 3aa7ee1..b086945 100644 --- a/DAG.pas +++ b/DAG.pas @@ -565,6 +565,12 @@ var false: (rval: real); end; + cnvdbl: record {for stuffing a double in a quad space} + case boolean of + true: (qval: longlong); + false: (rval: double); + end; + begin {RealStoreOptimizations} if opl^.opcode = pc_cnv then if baseTypeEnum(opl^.q & $000F) = op^.optype then @@ -631,6 +637,19 @@ var opl^.optype := cgLong; op^.optype := cgLong; end; {if} + end {if} + else if op^.optype = cgDouble then begin + if opl^.opcode = pc_ldc then begin + cnvdbl.rval := opl^.rval; + opl^.qval := cnvdbl.qval; + opl^.optype := cgQuad; + op^.optype := cgQuad; + end {if} + else if opl^.opcode in [pc_ind,pc_ldo,pc_lod] then + if opl^.optype = cgDouble then begin + opl^.optype := cgQuad; + op^.optype := cgQuad; + end; {if} end; {if} end; {RealStoreOptimizations}