This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add custom lowering for llvm.roundeven with sse4.1.
ClosedPublic

Authored by craig.topper on Jul 25 2020, 3:48 PM.

Details

Summary

We can use the roundss/sd/ps/pd instructions like we do for
ceil/floor/trunc/rint/nearbyint.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 25 2020, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2020, 3:48 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
sepavloff added inline comments.Jul 27 2020, 9:41 PM
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
1026

Should it be 0?
From ROUNDSS description:

Precision (signaled only if imm[3] = ‘0; if imm[3] = ‘1, then the Precision Mask in the MXSCSR is ignored and precision
exception is not signaled.)
craig.topper added inline comments.Jul 27 2020, 10:34 PM
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
1026

Should it be 0?
From ROUNDSS description:

Precision (signaled only if imm[3] = ‘0; if imm[3] = ‘1, then the Precision Mask in the MXSCSR is ignored and precision
exception is not signaled.)

I thought TS 18661-1 doesn't allow roundeven/round/ceil/trunc/floor to raise inexact exception.

sepavloff accepted this revision.Jul 27 2020, 11:55 PM

LGTM.

llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
1026

I thought TS 18661-1 doesn't allow roundeven/round/ceil/trunc/floor to raise inexact exception.

Indeed, TS 18661-1 changed wording and now these functions are closer to their roundToIntegral* counterparts from IEEE-754.

This revision is now accepted and ready to land.Jul 27 2020, 11:55 PM
This revision was landed with ongoing or failed builds.Jul 29 2020, 10:23 AM
This revision was automatically updated to reflect the committed changes.