[PATCH] D34029: Infer lowest bits of an integer Multiply when the low bits of the operands are known

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 17:05:28 PDT 2017


efriedma added a comment.

Alive is up again.

I tried a bit more; got an alive proof working.  Does this look right?  (The precondition for C7 is kind of complicated, but I think it matches the computation in this patch.)

https://rise4fun.com/Alive/zCv

  Name: mul_to_const
  Pre: (C1 >= 0) && (C1 < (1 << C5)) && (C2 >= 0) && (C2 < (1 << C6)) && (C7 == (1 << (umin(countTrailingZeros(C1), C5) + umin(countTrailingZeros(C2), C6) + umin(C5 - umin(countTrailingZeros(C1), C5), C6 - umin(countTrailingZeros(C2), C6)))) - 1)
  
  %aa = shl i8 %a, C5
  %bb = shl i8 %b, C6
  %aaa = or i8 %aa, C1
  %bbb = or i8 %bb, C2
  %mul = mul i8 %aaa, %bbb
  %mask = and i8 %mul, C7
  
    =>
  
  %mask = i8 ((C1*C2)&C7)


https://reviews.llvm.org/D34029





More information about the llvm-commits mailing list