This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add patterns for CTLZ on MVE
ClosedPublic

Authored by oliverlars on Sep 3 2019, 9:49 AM.

Details

Summary

CTLZ intrinsic can use the VCLS instruction on MVE, which produces better results than expanding.

Diff Detail

Repository
rL LLVM

Event Timeline

oliverlars created this revision.Sep 3 2019, 9:49 AM
dmgreen added inline comments.Sep 4 2019, 12:14 AM
llvm/test/CodeGen/Thumb2/mve-ctlz.ll
35

I believe these intrinsics should take an extra i1 parameter specifying whether an input of 0 in undef or not. The MVE instructions should produce sensible values for an input of 0, as far as I understand, so they should both lower to the same thing. Worth adding tests for both.

We might as well add tests for v2i64 too, just to show that they are doing something that doesn't look wrong.

oliverlars updated this revision to Diff 218708.Sep 4 2019, 7:59 AM

Added verify-machineinstrs, a test for 2i64 as well as tests for the 'isundef' parameter

dmgreen accepted this revision.Sep 4 2019, 8:48 AM

LGTM, with a couple of formatting nits below.

llvm/lib/Target/ARM/ARMInstrMVE.td
1728

You can remove the spaces before the ctlz, and before the MVE_VCLZs8 below.

1734

And this empty line.

This revision is now accepted and ready to land.Sep 4 2019, 8:48 AM