From 2c75fb13b73ac44f6a9e7ed02c60178e52394648 Mon Sep 17 00:00:00 2001 From: "J. Gareth \"Curious Kit\" Moreton" Date: Sat, 15 Oct 2022 02:40:11 +0100 Subject: [PATCH] * i386: Corrections to IMUL -> LEA/LEA optimisastions (fixes_3_2 only) --- compiler/i386/aoptcpu.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/i386/aoptcpu.pas b/compiler/i386/aoptcpu.pas index 8931a27d77..c4915715fc 100644 --- a/compiler/i386/aoptcpu.pas +++ b/compiler/i386/aoptcpu.pas @@ -248,7 +248,7 @@ begin if (current_settings.optimizecputype <= cpu_386) then begin TmpRef.index := taicpu(p).oper[1]^.reg; - if (taicpu(p).ops = 3) then + if (taicpu(p).ops = 3) and (taicpu(p).oper[1]^.reg <> taicpu(p).oper[2]^.reg) then begin TmpRef.base := taicpu(p).oper[2]^.reg; TmpRef.ScaleFactor := 4; @@ -263,7 +263,7 @@ begin reference_reset(tmpref,2,[]); TmpRef.index := taicpu(p).oper[1]^.reg; TmpRef.ScaleFactor := 2; - if (taicpu(p).ops = 3) then + if (taicpu(p).ops = 3) and (taicpu(p).oper[1]^.reg <> taicpu(p).oper[2]^.reg) then begin TmpRef.base := NR_NO; hp1 := taicpu.op_ref_reg(A_LEA, S_L, TmpRef, @@ -334,7 +334,7 @@ begin then begin TmpRef.index := taicpu(p).oper[1]^.reg; - if (taicpu(p).ops = 3) then + if (taicpu(p).ops = 3) and (taicpu(p).oper[1]^.reg <> taicpu(p).oper[2]^.reg) then begin TmpRef.base := taicpu(p).oper[2]^.reg; TmpRef.ScaleFactor := 8; @@ -349,7 +349,7 @@ begin InsertLLItem(p, p.next, hp1); reference_reset(tmpref,2,[]); TmpRef.index := taicpu(p).oper[1]^.reg; - if (taicpu(p).ops = 3) then + if (taicpu(p).ops = 3) and (taicpu(p).oper[1]^.reg <> taicpu(p).oper[2]^.reg) then begin TmpRef.base := NR_NO; TmpRef.ScaleFactor := 4;