Page MenuHomePhabricator

[X86] add mayRaiseFPException flag and FPCW registers for X87 instructions
ClosedPublic

Authored by LiuChen3 on Oct 10 2019, 7:45 PM.

Diff Detail

Event Timeline

LiuChen3 created this revision.Oct 10 2019, 7:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2019, 7:45 PM
LiuChen3 retitled this revision from add mayRaiseFPException flag and FPCW registers for X87 instructions to [X86] add mayRaiseFPException flag and FPCW registers for X87 instructions.Oct 10 2019, 7:53 PM

Test cases?

llvm/lib/Target/X86/X86InstrFPStack.td
703

Why did you change this? FFREE/FFREEP leave FPSW in an undefined state

LiuChen3 added inline comments.Oct 28 2019, 8:11 PM
llvm/lib/Target/X86/X86InstrFPStack.td
703

Thanks for your review. I have added 'let Defs = [FPSW]' in class FPI.

LiuChen3 updated this revision to Diff 226855.Oct 29 2019, 2:07 AM

Add testcase to verify if x87 instructions use/def fpcw and fpcw registers.

LiuChen3 updated this revision to Diff 226860.Oct 29 2019, 2:55 AM

The Diff 226855 has some problems. This one adds testcase to verify if x87 instructions use/def fpcw and fpcw registers.

LiuChen3 updated this revision to Diff 226862.Oct 29 2019, 3:06 AM

I am sorry I updated two wrong versions. The Diff 226862 is right version.

craig.topper added inline comments.Oct 31 2019, 2:31 PM
llvm/lib/Target/X86/X86InstrFPStack.td
706

FNINIT also defs FPCW as far as I can tell. It reinitializes the entire X87 FPU.

714

I don't think this instruction updates FPSW it appears to be a mistake in the Intel SDM, but since we never generate it it probably doesn't matter.

craig.topper commandeered this revision.Oct 31 2019, 2:35 PM
craig.topper edited reviewers, added: LiuChen3; removed: craig.topper.

commandeering so I can fix the FNINIT issue. And put FPCW/FPSW in consistent order in the Uses/Defs so we don't end up with two different Implicit defs lists in X86GenInstrInfo.inc

Fix FNINIT Defs. Put FPSW/FPCW in consistent order when both are used or defed.

This revision is now accepted and ready to land.Oct 31 2019, 2:50 PM
This revision was automatically updated to reflect the committed changes.

This broke CodeGen/ms-inline-asm.c' everywhere. Can you please revert?

LiuChen3 reopened this revision.Oct 31 2019, 10:10 PM
This revision is now accepted and ready to land.Oct 31 2019, 10:10 PM
LiuChen3 commandeered this revision.Oct 31 2019, 10:33 PM
LiuChen3 removed a reviewer: LiuChen3.
LiuChen3 updated this revision to Diff 227399.Oct 31 2019, 10:37 PM

This patch fix the broken test: CodeGen/ms-inline-asm.c.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2019, 9:15 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript