This is an archive of the discontinued LLVM Phabricator instance.

[mlir][arith] Support wide int cast emulation
ClosedPublic

Authored by kuhar on Sep 9 2022, 1:19 PM.

Details

Summary

Add support for arith.extsi, arith.extui, and arith.trunci ops.

Tested by checking the results for all 16-bit inputs when emulating i16 with i8.

Diff Detail

Event Timeline

kuhar created this revision.Sep 9 2022, 1:19 PM
Herald added a project: Restricted Project. · View Herald Transcript
kuhar requested review of this revision.Sep 9 2022, 1:19 PM
kuhar updated this revision to Diff 459187.Sep 9 2022, 1:26 PM

Rebased.

kuhar updated this revision to Diff 459189.Sep 9 2022, 1:27 PM

Removed accidentally added includes.

kuhar retitled this revision from [mlir][spirv] Support wide int cast emulation to [mlir][arith] Support wide int cast emulation.Sep 12 2022, 12:41 PM
antiagainst accepted this revision.Sep 12 2022, 3:09 PM
This revision is now accepted and ready to land.Sep 12 2022, 3:09 PM
Mogball requested changes to this revision.Sep 13 2022, 9:39 AM

the implementation lgtm

mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
276

This is unnecessary. The operands to adaptor will always be materialized as legal for the target.

280

Type conversion can fail. And the pattern should if it does.

317–322

same here

This revision now requires changes to proceed.Sep 13 2022, 9:39 AM
kuhar updated this revision to Diff 459935.Sep 13 2022, 5:47 PM
kuhar marked 3 inline comments as done.

Fixed type checks for ExtSI and ExtUI. Rebased.

Do you have any other suggestions, @Mogball?

Mogball accepted this revision.Sep 15 2022, 7:41 AM

LGTM

This revision is now accepted and ready to land.Sep 15 2022, 7:41 AM
This revision was automatically updated to reflect the committed changes.