This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add intrinsic to read or set FPSCR register
ClosedPublic

Authored by qiucf on Jul 30 2020, 1:10 AM.

Details

Summary

This patch introduces two intrinsics: llvm.ppc.setflm and llvm.ppc.readflm. They read from or write to FPSCR register (floating-point status & control) which contains rounding mode and exception status.

To ensure correctness of program, we need to prevent FP operations from being moved across these intrinsics (mffs/mtfsf instruction), so here I set them as scheduling boundaries. We can relax such restriction if FPSCR is modeled well in the future.

Diff Detail

Event Timeline

qiucf created this revision.Jul 30 2020, 1:10 AM
qiucf requested review of this revision.Jul 30 2020, 1:10 AM
steven.zhang accepted this revision.Aug 9 2020, 5:22 PM

LGTM. But even we mark these two bif as boundary, there is still possible that, the pass after ISEL might move the MI across them. Some follow up work is needed to confirm this.

This revision is now accepted and ready to land.Aug 9 2020, 5:22 PM
This revision was automatically updated to reflect the committed changes.