This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Handle ISD::LRINT and ISD::LLRINT

Authored by zatrazz on May 16 2019, 11:26 AM.



This patch optimizes ISD::LRINT and ISD::LLRINT to frintx plus
fcvtzs. It currently only handles the scalar version.

This patch depends on

Diff Detail


Event Timeline

zatrazz created this revision.May 16 2019, 11:26 AM

Ping now that both D62017 and D62019 have been approved.

mstorsjo added inline comments.
3159 ↗(On Diff #199864)

Please add patterns for returning i32 as well; the original C standard math function, which is turned into the llvm IR intrinsic, returns long, which is 32 bit on windows platforms. See D62108 for a fix for the same for lround.

SjoerdMeijer added inline comments.May 21 2019, 5:35 AM
3159 ↗(On Diff #199864)

And also a pattern for (lrint f16)?

zatrazz marked an inline comment as done.May 21 2019, 11:54 AM
zatrazz added inline comments.
3159 ↗(On Diff #199864)

I plan to address lrint and lround for f16 in a subsequent patch.

zatrazz updated this revision to Diff 200563.May 21 2019, 12:01 PM

Updated patch based on previous comments. Add a pattern to handle i32 return and a testcase for Windows.

Is this patch ok with windows support now?

Is this patch ok with windows support now?

Sorry, I was away for a bit. Yes, it looks good wrt Windows now - thanks for taking the time to fix it!

This revision was not accepted when it landed; it landed in state Needs Review.May 28 2019, 2:01 PM
This revision was automatically updated to reflect the committed changes.