[PATCH] D113335: [X86] Preserve FPSW when popping x87 stack
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 7 17:55:47 PST 2021
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/X86/X86FloatingPoint.cpp:874
} else { // Insert an explicit pop
+ // If this instruction sets FPSW, which is read in following instruction,
+ // insert pop after that reader.
----------------
pengfei wrote:
> craig.topper wrote:
> > pengfei wrote:
> > > craig.topper wrote:
> > > > Is checking the next instruction sufficient? Can other instructions be scheduled before the FNSTSW?
> > > I think it's sufficient. On one hand, most X87 instructions will def FPSW. So they won't have any chance to be scheduled before a use of FPSW. On the other hand, even if one X87 instruction neither def FPSW nor use it, it should always touch ST registers. Poping ST0 after the use of ST registers doesn't seem correct to me.
> > What about non-X87 instructions getting between them?
> `getNextFPInstruction` will skip them.
Oh right. Thank you.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113335/new/
https://reviews.llvm.org/D113335
More information about the llvm-commits
mailing list