[all-commits] [llvm/llvm-project] 3057e8: [X86] Preserve FPSW when popping x87 stack
Serge Pavlov via All-commits
all-commits at lists.llvm.org
Thu Nov 11 21:56:18 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3057e850b88e8faf754db02293066e1182da2954
https://github.com/llvm/llvm-project/commit/3057e850b88e8faf754db02293066e1182da2954
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2021-11-12 (Fri, 12 Nov 2021)
Changed paths:
M llvm/lib/Target/X86/X86FloatingPoint.cpp
M llvm/lib/Target/X86/X86InsertWait.cpp
M llvm/lib/Target/X86/X86InstrFPStack.td
M llvm/lib/Target/X86/X86InstrInfo.cpp
M llvm/lib/Target/X86/X86InstrInfo.h
A llvm/test/CodeGen/X86/x87-stack-pop.mir
Log Message:
-----------
[X86] Preserve FPSW when popping x87 stack
When compiler converts x87 operations to stack model, it may insert
instructions that pop top stack element. To do it the compiler inserts
instruction FSTP right after the instruction that calculates value on
the stack. It can break the code that uses FPSW set by the last
instruction. For example, an instruction FXAM is usually followed by
FNSTSW, but FSTP is inserted after FXAM. As FSTP leaves condition code
in FPSW undefined, the compiler produces incorrect code.
With this change FSTP in inserted after the FPSW consumer if the last
instruction sets FPSW.
Differential Revision: https://reviews.llvm.org/D113335
More information about the All-commits
mailing list