[PATCH] D113335: [X86] Preserve FPSW when popping x87 stack

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 7 17:22:54 PST 2021


pengfei 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.
----------------
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.


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