Page MenuHomePhabricator

[mlir] Added ctlz and cttz to math dialect and LLVM dialect
ClosedPublic

Authored by rsuderman on Dec 6 2021, 4:54 PM.

Details

Summary

Count leading/trailing zeros are an existing LLVM intrinsic. Added LLVM
support for the intrinsics with lowerings from the math dialect to LLVM
dialect.

Diff Detail

Event Timeline

rsuderman created this revision.Dec 6 2021, 4:54 PM
rsuderman requested review of this revision.Dec 6 2021, 4:54 PM
ftynse requested changes to this revision.Dec 7 2021, 1:14 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
97 ↗(On Diff #392233)

The comment does not match the code.

98–104 ↗(On Diff #392233)

Why do we need this? There is no "LLVM integer type", the dialect uses built-in integers. Why can't this match just use I1?

mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
1407

Please give the name to the second argument.

mlir/include/mlir/Dialect/Math/IR/MathOps.td
304

Bikeshed: can we consider more pronounceable names at this level?

This revision now requires changes to proceed.Dec 7 2021, 1:14 AM
rsuderman updated this revision to Diff 392595.Dec 7 2021, 4:37 PM

Updated names and addressed code review comments.

rsuderman updated this revision to Diff 392597.Dec 7 2021, 4:39 PM
rsuderman marked 3 inline comments as done.

Removed extra line.

rsuderman marked an inline comment as done.Dec 7 2021, 4:39 PM
rsuderman added inline comments.
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
97 ↗(On Diff #392233)

Removed.

98–104 ↗(On Diff #392233)

I wanted to match the existing type naming behavior. I changed to directly using I<1> after.

ftynse accepted this revision.Dec 8 2021, 5:38 AM
This revision is now accepted and ready to land.Dec 8 2021, 5:38 AM