[PATCH] D116469: [AMDGPU] Correct the known bits calculation for MUL_I24.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 03:13:29 PST 2022


foad added a comment.

In D116469#3235782 <https://reviews.llvm.org/D116469#3235782>, @craig.topper wrote:

> @foad were you able to come up with a test for this?

Sorry it had dropped off my radar. Here's a test where your patch makes a difference (with llc -march=amdgcn -mcpu=gfx900):

  define i32 @f(i32 %x, i32 %y) {
    %xx = or i32 %x, -128 ; 0xffffff80
    %yy = or i32 %y, -128 ; 0xffffff80
    %r = mul i32 %xx, %yy
    %rr = lshr i32 %r, 14
    ret i32 %rr
  }

Without your patch the result is simplified to 0 which is wrong. %xx and %yy are in the range -128..-1, so if they are both -128 then the product is -16384, shifted right by 14 is 1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116469



More information about the llvm-commits mailing list