[PATCH] D105762: [X86] Teach X86FloatingPoint's handleCall to only erase the FP stack if there is a regmask operand that clobbers the FP stack.

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 10 19:59:18 PDT 2021


pengfei added inline comments.


================
Comment at: llvm/lib/Target/X86/X86FloatingPoint.cpp:988-989
     MachineOperand &Op = MI.getOperand(i);
+    // Check if this call clobbers the FP stack.
+    // is sufficient.
+    if (Op.isRegMask()) {
----------------
craig.topper wrote:
> craig.topper wrote:
> > pengfei wrote:
> > > I found we don't clobber FP stack by default. E.g. `void foo(void)`. The interesting thing is even if we passing registers to/from foo, e.g. `long double foo(void)` or `long double foo(long double)`, the regmasks of FP are still 0.
> > > Did I misunderstand something here?
> > The regmask bits indicate which registers aren't clobbered. So a 0 means clobbered.
> It's created from the callee saved register mask.
Yes, I see. They are caller saved registers.
By the way, does Clang/LLVM have a mechanism to label functions like known libraries that won't clobber some caller saved registers now.
We have the same requirements for AMX registers, but haven't handled for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105762/new/

https://reviews.llvm.org/D105762



More information about the llvm-commits mailing list