This is an archive of the discontinued LLVM Phabricator instance.

[AArc64] Handle ISD::LROUND and ISD::LLROUND
ClosedPublic

Authored by zatrazz on May 1 2019, 11:22 AM.

Details

Summary

This patch optimizes ISD::LROUND and ISD::LROUND to fcvtas
instruction. It currently only handles the scalar version.

This patch depends on https://reviews.llvm.org/D61390.

Diff Detail

Event Timeline

zatrazz created this revision.May 1 2019, 11:22 AM
craig.topper added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
771

Is this really legal? I don't see any patterns or tests for lround.i32.

Missing testcase for lroundl.

zatrazz updated this revision to Diff 198067.May 3 2019, 12:45 PM
zatrazz marked an inline comment as done.

Updated patch based on the previous comment. The main change adapt the testcases for D61390
update and handle lroundl/llroundl correctly.

zatrazz updated this revision to Diff 198320.May 6 2019, 11:49 AM

Updated patch based on D61390 changes. The main change is it allows
index both lround/llround by returned type.

Ping again now that D61390 has been approved.

SjoerdMeijer added inline comments.May 13 2019, 6:10 AM
llvm/lib/Target/AArch64/AArch64InstrInfo.td
3076

I think this is supported too for f16s with Armv8.2.

zatrazz marked an inline comment as done.May 13 2019, 10:15 AM
zatrazz added inline comments.
llvm/lib/Target/AArch64/AArch64InstrInfo.td
3076

Indeed it does, but FPToIntegerPats does not define a pattern for f16 currently. I think one possible addition would to extends fp to/from int pattern to f16 as well, however, I also think it is out the scope of this specific patch.

So should I handle f16 in a different patch or should I also adapt it on this one?

SjoerdMeijer accepted this revision.May 15 2019, 1:18 AM

Looks reasonable to me.

llvm/lib/Target/AArch64/AArch64InstrInfo.td
3076

Okay, I see, there's indeed a pattern missing for f16s in FPToIntegerPats, so that's indeed extra work that belongs to a follow up patch. Would be highly appreciated if you can follow this up with a patch, so that we don't run into this later.

This revision is now accepted and ready to land.May 15 2019, 1:18 AM
zatrazz closed this revision.May 16 2019, 6:27 AM
zatrazz marked an inline comment as done.
zatrazz added inline comments.
llvm/lib/Target/AArch64/AArch64InstrInfo.td
3076

Ok, I will add it on my backlog. I plan to send a lrint patch similar to lround, and then I will take a look at f16 support on FPToIntegerPats.