Hi,
The attached patch teaches ComputeNumSignBits that when a number is divided by a positive constant then the top floor(log(n)) bits are identical.
Thanks,
Nadav
Differential D8028
Teach ComputeNumSignBits about signed divisions nadav on Mar 3 2015, 12:03 AM. Authored by
Details
Diff Detail
Event Timeline
|
I think this result can become larger than the bitwidth if your numerator is very small and your denominator is very large.
Arithmetically, the result of such a division would be zero but we might not have simplified it yet.
An example of this would be
%and = and i32 %x, 1
%div = sdiv i32 %and, 1073741824
The number of sign bits in %and is 31 and they are all zero.
The log-base2 of the denominator is 30. I don't think the answer coming from this query cannot be larger than the bitwdith.