This is the umin alternative to the umax code from D53033, If I'm getting the maths correct.
As Sanjay suggested, we can use De Morgan's law on the umax case to bring us to the same thing on umin, but using countLeadingOnes, not countLeadingZeros.
Differential D53036
[InstCombine] Demand bits of UMin dmgreen on Oct 9 2018, 12:18 PM. Authored by
Details This is the umin alternative to the umax code from D53033, If I'm getting the maths correct. As Sanjay suggested, we can use De Morgan's law on the umax case to bring us to the same thing on umin, but using countLeadingOnes, not countLeadingZeros.
Diff Detail Event TimelineComment Actions Same comments as with D53033 (alive + inverse of https://reviews.llvm.org/D53033#inline-467182) Comment Actions Luckily, it appears that Alive can do countLeadingOnes too (although I don't see it anywhere in the sources I have). Comment Actions Same as with D53033, looks ok, but maybe wait a bit for someone else.
Comment Actions Just added a new test, and changed some of the others around a little.
Comment Actions This is the page I look at as reference for alive coding: Comment Actions LGTM - see inline for a couple of nits.
Comment Actions
Thanks. Different branch, that makes sense. |
Period at end of each sentence. Rather than random math, note this as the DeMorgan'd version of the umax logic.