[PATCH] D77316: [AArch64] Add a special case for shifting by (BitWidth - 1) - X

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 12:31:06 PST 2022


efriedma added a comment.

In D77316#3307261 <https://reviews.llvm.org/D77316#3307261>, @foad wrote:

> In D77316#2040193 <https://reviews.llvm.org/D77316#2040193>, @efriedma wrote:
>
>> What happens if the shift amount has more than one use?
>
> Not sure, but the same as the existing special case for shifting by BitWidth - X.

So, we emit the shift amount separately. Which isn't a big deal, I guess, but we should have a testcase.  Something like:

  define void @foo(i64* %valptr, i64* %shamtptr, i64 %shamt) {
    %val = load i64, i64* %valptr
    %negshamt = sub i64 64, %shamt
    %shifted = ashr i64 %val, %negshamt
    store i64 %shifted, i64* %valptr
    store i64 %negshamt, i64* %shamtptr
    ret void
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77316/new/

https://reviews.llvm.org/D77316



More information about the llvm-commits mailing list