[llvm] [clang] [clang-tools-extra] [InstCombine] Convert or concat to fshl if opposite or concat exists (PR #68502)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 11 19:22:58 PST 2023


HaohaiWen wrote:

> Your original example does not verify: https://alive2.llvm.org/ce/z/Bkd89Z Can you please provide a correct example of what you're trying to do?

As I said in previous comments:

> This requires first optimize

>  %sly = shl nuw i32 %zext.y, 8
>  %yx = or i32 %zext.x, %sly
> to
>  fshl %xy, %xy, 8
> Then teach InstCombine to optimize the rest to bitreverse.

This PR only teach InstCombine to optimize shl+or to fshl. 
I'll add another patch to teach InstComibine(matchBSwapOrBitReverse) to convert the example you metioned to bitreverse. And the original example will be the test in that patch.

https://github.com/llvm/llvm-project/pull/68502


More information about the cfe-commits mailing list