[PATCH] D88783: [InstCombine] matchFunnelShift - fold or(shl(a,x),lshr(b,sub(bw,x))) -> fshl(a,b,x) iff x < bw

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 15:30:08 PDT 2020


nlopes added a comment.

Alive2 complains about one of the test cases:

  define i64 @fshr_sub_mask(i64 %x, i64 %y, i64 %a) {
    %mask = and i64 %a, 63
    %shr = lshr i64 %x, %mask
    %sub = sub nsw nuw i64 64, %mask
    %shl = shl i64 %y, %sub
    %r = or i64 %shl, %shr
    ret i64 %r
  }
  =>
  define i64 @fshr_sub_mask(i64 %x, i64 %y, i64 %a) {
    %r = fshr i64 %x, i64 %y, i64 %a
    ret i64 %r
  }
  Transformation doesn't verify!
  ERROR: Value mismatch
  
  Example:
  i64 %x = #x0000100000000000 (17592186044416)
  i64 %y = #x0000000000000000 (0)
  i64 %a = #x0000000000000027 (39)
  
  Source:
  i64 %mask = #x0000000000000027 (39)
  i64 %shr = #x0000000000000020 (32)
  i64 %sub = #x0000000000000019 (25)
  i64 %shl = #x0000000000000000 (0)
  i64 %r = #x0000000000000020 (32)
  
  Target:
  i64 %r = #x0000000000000000 (0)
  Source value: #x0000000000000020 (32)
  Target value: #x0000000000000000 (0)

https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=65e89ee9edd0ccba&test=Transforms%2FInstCombine%2Ffunnel.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88783



More information about the llvm-commits mailing list