diff --git a/src/Arch/X86/Analysis/FstswAnalysis.cs b/src/Arch/X86/Analysis/FstswAnalysis.cs index 916bb863af..d41d2f2c54 100644 --- a/src/Arch/X86/Analysis/FstswAnalysis.cs +++ b/src/Arch/X86/Analysis/FstswAnalysis.cs @@ -23,7 +23,6 @@ using Reko.Core.Code; using Reko.Core.Collections; using Reko.Core.Expressions; -using Reko.Core.Machine; using Reko.Core.Operators; using Reko.Core.Services; using System; @@ -208,6 +207,9 @@ binCof.Left is Identifier acc && ReplaceWithFpufCopy(use, ass.Dst, sidFpuf); changed = true; break; + case MkSequence _: + // An aliasing use of ax or ah; eax = SEQ(, ax) can be ignored. + continue; default: throw new NotImplementedException($"Fstsw of {ass} not implemented yet."); } diff --git a/src/UnitTests/Arch/X86/Analysis/FstswAnalysisTests.cs b/src/UnitTests/Arch/X86/Analysis/FstswAnalysisTests.cs index 81dffb1d2d..35782d9592 100644 --- a/src/UnitTests/Arch/X86/Analysis/FstswAnalysisTests.cs +++ b/src/UnitTests/Arch/X86/Analysis/FstswAnalysisTests.cs @@ -504,5 +504,33 @@ branch Test(NE,FPUF) l00100000 m.Ret(); }); } + + + [Test] + public void Fstsw_through_alias() + { + RunTest(@" +l00100000: + ax_4 = __fstsw(FPUF) + ah_5 = SLICE(ax_4, byte, 8) (alias) + SZP_6 = cond(ah_5 & 0x41<8>) + Z_9 = SLICE(SZP_6, bool, 2) (alias) + O_7 = false + C_8 = false + eax_12 = SEQ(eax_16_16, ax_4) (alias) + branch Test(GT,FPUF) l00100000 +", + m => + { + m.Label("foo"); + m.Fstsw(m.ax); + m.Test(m.ah, 0x41); + m.Jz("foo"); + + m.Label("m1"); + m.Or(m.eax, m.Imm(0xFFFFFFFF)); + m.Ret(); + }); + } } } diff --git a/subjects/regression.log b/subjects/regression.log index 45340ef66d..dc31ed0629 100644 --- a/subjects/regression.log +++ b/subjects/regression.log @@ -2521,4 +2521,4 @@ varargs_test.exe: warning: Win32 X86-64 main procedure finder not implemented ye === PE\x86\VCExeSample\VCExeSample Signature of 'Microsoft Visual C++ 8' detected. -Decompiled 90 binaries in 66.54 seconds. +Decompiled 90 binaries in 65.34 seconds.