Expand the ISD::AVGCEILU to determine the known bits of the result.
I can move this inside KnownBits if you would prefer - we don't have any use for it outside this method yet so wasn't sure if it was worth it.
First part of PR53622
Differential D119629
[DAG] computeKnownBits - add ISD::AVGCEILU handling RKSimon on Feb 12 2022, 6:28 AM. Authored by
Details Expand the ISD::AVGCEILU to determine the known bits of the result. I can move this inside KnownBits if you would prefer - we don't have any use for it outside this method yet so wasn't sure if it was worth it. First part of PR53622
Diff Detail
Event TimelineComment Actions I guess this method can calculate some low bits of the result, but is that actually useful? If you're only interested in the high bits you can just say that the result is known to be >= the smaller operand and <= the larger one, which would work for all four avg variants (floor/ceil, signed/unsigned).
Comment Actions LGTM. I'd prefer not to have this inside KnownBits since it is a rather specific operation. Comment Actions Sounds good. I'll try and get that in now. I found the llvm.aarch64.neon.hadd intrinsics useful for testing, as they will be transformed directly to avg nodes. |
BitWidth+1 is enough.