This is an archive of the discontinued LLVM Phabricator instance.

[GISel]:Add Opcodes for CTLZ/CTTZ/CTPOP
ClosedPublic

Authored by aditya_nandakumar on Jun 26 2018, 11:28 AM.

Details

Summary

Add IRTranslator support to translate these known intrinsics into GISel opcodes.

Diff Detail

Repository
rL LLVM

Event Timeline

arsenm added a subscriber: arsenm.Jun 26 2018, 11:36 AM
arsenm added inline comments.
include/llvm/Support/TargetOpcodes.def
470–471

Should we really preserve this SelectionDAGism or just make the zero is undef bit be an immediate operand to the instruction like the intrinsic?

include/llvm/Support/TargetOpcodes.def
470–471

I think having two opcodes is explicit and is a little easier to work with - we don't usually have immediates in GISel instructions - and constants are encoded through a reg defining G_CONSTANT which makes it a little inconvenient to use. It probably also might make importing tablegen patterns slightly easier.
I'm okay with either way if someone has a strong enough opinion.

aemerson added inline comments.Jul 30 2018, 5:46 AM
test/TableGen/trydecode-emission.td
37

Why are these tests changing?

test/TableGen/trydecode-emission.td
37

I believe these changes are due to increase in the number of opcodes.

dsanders added inline comments.Jul 30 2018, 11:35 AM
include/llvm/Support/TargetOpcodes.def
470–471

We'll need it for legalization. Typically only one or the other is legal and we can't do context-dependent legalization.

test/TableGen/trydecode-emission.td
37

We hit this out-of-tree a couple weeks ago, most of the changes are because the TryDecode/Decode are one byte larger and those are one byte larger because there are more opcodes before InstA.

39–40

The new bytes should be checked with {{[0-9]+}}

This revision is now accepted and ready to land.Aug 2 2018, 3:48 PM

Submitted in r338944