Example:
(A & 14) != 0 and (A & 1) != 0 => ((cttz (A ^ 8)) - 1) > 3
Differential D60590
[InstCombine] Simplify more cases of logical ops of masked icmps. shawnl on Apr 11 2019, 2:59 PM. Authored by
Details
Example: (A & 14) != 0 and (A & 1) != 0 => ((cttz (A ^ 8)) - 1) > 3
Diff Detail
Event TimelineComment Actions Note to self: If you get the logic reversed in the example, you will get it reversed in the code. Remove dead code. Comment Actions Could you please upload the diff with more context? This is done by passing -U99999 to git diff or whichever command you're using. Comment Actions [InstCombine] Simplify more cases of logical ops of masked icmps. Generalizing the work by Hiroshi Yamauchi in Example: (A & 3) == 3 and (A & 4) == 0 => (A & 7) == 3
|
This transform doesn't make any sense to me. (icmp eq (A & 3), 0) && (icmp ne (A & 4), 0) is the same as (icmp eq (A & 7) == 4). Which is exactly the expansion we produce for a cttz equality check in https://github.com/llvm-mirror/llvm/blob/3f5d54bc7b3a850a2df14a6f7b7d8661423d824f/lib/Transforms/InstCombine/InstCombineCompares.cpp#L2851-L2866. Using a mask is more efficient and analyzable than using cttz.