llvm.org GIT mirror llvm / 42ac929
Fix a bug in the ComputeMaskedBits logic for multiply. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50793 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
3 changed file(s) with 14 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
12431243 unsigned TrailZ = KnownZero.countTrailingOnes() +
12441244 KnownZero2.countTrailingOnes();
12451245 unsigned LeadZ = std::max(KnownZero.countLeadingOnes() +
1246 KnownZero2.countLeadingOnes() +
1247 1, BitWidth) - BitWidth;
1246 KnownZero2.countLeadingOnes(),
1247 BitWidth) - BitWidth;
12481248
12491249 TrailZ = std::min(TrailZ, BitWidth);
12501250 LeadZ = std::min(LeadZ, BitWidth);
766766 unsigned TrailZ = KnownZero.countTrailingOnes() +
767767 KnownZero2.countTrailingOnes();
768768 unsigned LeadZ = std::max(KnownZero.countLeadingOnes() +
769 KnownZero2.countLeadingOnes() +
770 1, BitWidth) - BitWidth;
769 KnownZero2.countLeadingOnes(),
770 BitWidth) - BitWidth;
771771
772772 TrailZ = std::min(TrailZ, BitWidth);
773773 LeadZ = std::min(LeadZ, BitWidth);
0 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ashr
1
2 define i32 @foo(i32 %x, i32 %y) {
3 %a = and i32 %x, 7
4 %b = and i32 %y, 7
5 %c = mul i32 %a, %b
6 %d = shl i32 %c, 26
7 %e = ashr i32 %d, 26
8 ret i32 %e
9 }