Page MenuHomePhabricator

[FPEnv][X86] Implement lowering of llvm.set.rounding
Needs ReviewPublic

Authored by sepavloff on Feb 17 2020, 10:26 AM.

Event Timeline

sepavloff created this revision.Feb 17 2020, 10:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2020, 10:26 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
craig.topper added inline comments.Feb 17 2020, 10:50 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
25790

Why do we need an APInt?

25859

Why do we need an APInt?

25873

Removed commented out code.

30134

Where did FNSTSW16r come from? I deleted that recently.

llvm/lib/Target/X86/X86ISelLowering.h
660

STMXCSR/LDMXCSR aren't used.

craig.topper added inline comments.Feb 17 2020, 11:14 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
25774

I have no idea why FLT_ROUNDS calls TFI.getStackAlignment() to get the second parameter here. It should just be 4.

Modified patch according to reviewer's notes

sepavloff marked 7 inline comments as done.Feb 18 2020, 12:00 AM
sepavloff added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
25774

Changed here but implementation of LowerFLT_ROUNDS_ was not changed.

RKSimon added inline comments.Feb 18 2020, 6:45 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
30134

FNSTSW16r was removed at D73863, but FNSTCW16m stayed

@sepavloff - what's happening with this?

sepavloff updated this revision to Diff 260283.Apr 27 2020, 4:55 AM
sepavloff marked an inline comment as done.

Rebased patch

@sepavloff - what's happening with this?

It is still needed. This patch depends on D74729. Next steps, like support in frontend (as fesetround) and lowering on other platforms make sense only after destiny of these patches will be determined.

The motivation for this work is implementation of a pragma that would set/restore rounding mode without need to call fesetround.

kpn added a subscriber: kpn.Apr 27 2020, 10:32 AM