[mlir](arithmetic) Add ceildivui to the arithmetic dialect
The specific description is [[ https://llvm.discourse.group/t/adding-unsigned-integer-ceil-and-floor-in-std-dialect/4541 | Adding unsigned integer ceil in Std Dialect ]] . When we lower ceilDivOp this will generate below code, sometimes we know m and n are unsigned intergal.Here are some redundant judgments about positive and negative. So we need to add some unsigned operations to simplify the instructions. ``` ceilDiv(n, m) x = (m > 0) ? -1 : 1 return (n*m>0) ? ((n+x) / m) + 1 : - (-n / m) ``` unsigned operations: ``` ceilDivU(n, m) return n ==0 ? 0 : ((n - 1) / m) + 1 ``` Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D113363
Loading
Please register or sign in to comment