From 884cb758e782e14fff9ecd20a39a5046ae984491 Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 22 May 2017 15:20:18 +0000 Subject: [PATCH] * Ensure the number of operands is 2 for MOVXX instructions in OptPass1MOVXX. Otherwise the classic MOVSD/W/B no-operand instructions (REP MOVSX) cause AV during checks of operands. The AV is thrown when trying to compile ucomplex.pp with -Cfsse3. * Also fixed generation of debug comments in OptPass1MOVXX. git-svn-id: trunk@36295 - --- compiler/x86/aoptx86.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index dca26e9842..3594758ae8 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -1622,7 +1622,10 @@ unit aoptx86; hp1 : tai; begin Result:=false; + if taicpu(p).opercnt <> 2 then + exit; if GetNextInstruction(p,hp1) and + (taicpu(hp1).opercnt = 2) and MatchInstruction(hp1,taicpu(p).opcode,[taicpu(p).opsize]) then begin if (taicpu(hp1).oper[0]^.typ = taicpu(p).oper[1]^.typ) and @@ -1651,8 +1654,8 @@ unit aoptx86; begin asml.remove(p); p.free; - DebugMsg('PeepHole Optimization MovXXMovXX2Nop 1 done',p); GetNextInstruction(hp1,p); + DebugMsg('PeepHole Optimization MovXXMovXX2Nop 1 done',p); end else DebugMsg('PeepHole Optimization MovXXMovXX2MoVXX 1 done',p);