[PATCH] D119629: [DAG] computeKnownBits - add ISD::AVGCEILU handling

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 13 05:27:07 PST 2022


foad added a comment.

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 at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3135
+    Known2 = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
+    Known = Known.zext(BitWidth * 2);
+    Known2 = Known2.zext(BitWidth * 2);
----------------
BitWidth+1 is enough.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119629/new/

https://reviews.llvm.org/D119629



More information about the llvm-commits mailing list