This is an archive of the discontinued LLVM Phabricator instance.

[ConstantFolding] add simplifications for funnel shift intrinsics
ClosedPublic

Authored by spatel on Aug 16 2018, 9:21 AM.

Details

Summary

This is another step towards being able to canonicalize to the funnel shift intrinsics in IR (see D49242 for the initial patch). We should not have any loss of simplification power in IR between these and the equivalent IR constructs.

Diff Detail

Event Timeline

spatel created this revision.Aug 16 2018, 9:21 AM
craig.topper added inline comments.Aug 16 2018, 3:27 PM
lib/Analysis/ConstantFolding.cpp
2096

Can we use APInt::urem(uint64_t) version here since bitwidth is guaranteed 32-bits? Then your ShAmt would be unsigned. Then LshrAmt and ShlAmt can be unsigned. And we get rid of a lot of temporary APInts which could save heap allocations if bit width is more than 64.

spatel updated this revision to Diff 161139.Aug 16 2018, 4:03 PM
spatel marked an inline comment as done.

Patch updated:
Use native integers where possible to make the math more efficient.

This revision is now accepted and ready to land.Aug 16 2018, 4:17 PM
This revision was automatically updated to reflect the committed changes.