From 86547d35d78ffd26e1d0b63187ebc8472beb204b Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 23 Oct 2022 22:09:00 +0200 Subject: [PATCH] + apply OpTest/Or2Op optimization to ANDN as well + DebugMsg for OpTest/Or2Op added --- compiler/x86/aoptx86.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index fdc54ec834..1fa550e12b 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -13915,6 +13915,7 @@ unit aoptx86; ) ) then begin + DebugMsg(SPeepholeOptimization + 'OpTest/Or2Op done', hp1); RemoveCurrentP(p, hp2); Result:=true; Exit; @@ -13932,6 +13933,7 @@ unit aoptx86; { and in case of carry for A(E)/B(E)/C/NC } (taicpu(hp2).condition in [C_Z,C_NZ,C_E,C_NE]) then begin + DebugMsg(SPeepholeOptimization + 'OpTest/Or2Op done', hp1); RemoveCurrentP(p, hp2); Result:=true; Exit; @@ -13944,6 +13946,19 @@ unit aoptx86; { and in case of carry for A(E)/B(E)/C/NC } (taicpu(hp2).condition in [C_Z,C_NZ,C_E,C_NE]) then begin + DebugMsg(SPeepholeOptimization + 'OpTest/Or2Op done', hp1); + RemoveCurrentP(p, hp2); + Result:=true; + Exit; + end; + end; + A_ANDN: + begin + if OpsEqual(taicpu(hp1).oper[2]^,taicpu(p).oper[1]^) and + { ANDN sets only the Z and S flag } + (taicpu(hp2).condition in [C_Z,C_NZ,C_E,C_NE]) then + begin + DebugMsg(SPeepholeOptimization + 'OpTest/Or2Op done', hp1); RemoveCurrentP(p, hp2); Result:=true; Exit;