This is an archive of the discontinued LLVM Phabricator instance.

[mlir][StandardToSPIRV] Add support for lowering trunci to SPIR-V to i1 types.
ClosedPublic

Authored by hanchung on Feb 17 2021, 2:14 AM.

Details

Summary

Add a pattern to converting some value to a boolean. spirv.S/UConvert does not
work on i1 types. Thus, the pattern is lowered to cmpi + select.

Diff Detail

Event Timeline

hanchung created this revision.Feb 17 2021, 2:14 AM
hanchung requested review of this revision.Feb 17 2021, 2:14 AM
hanchung updated this revision to Diff 324243.Feb 17 2021, 2:19 AM

Remove a blank line in the test

antiagainst accepted this revision.Feb 17 2021, 5:56 AM

Nice, thanks for fixing this!

mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
536

It might not matter that much given we are using the same boolean type in standard and SPIR-V, but still we should move this line above the if statement at L525 here to make sure we are checking the converted dstType.

580–582

Same here.

This revision is now accepted and ready to land.Feb 17 2021, 5:56 AM
hanchung updated this revision to Diff 324293.Feb 17 2021, 6:46 AM

address comments

hanchung marked 2 inline comments as done.Feb 17 2021, 6:46 AM