[Mlir-commits] [mlir] [arith][mlir] Fixed a bug in CeilDiv with neg values (PR #90855)

Balaji V. Iyer. llvmlistbot at llvm.org
Thu May 2 13:23:46 PDT 2024


bviyer wrote:

> This example works fine without your change (-120 instead of `-128`):
> 
> ```mlir
> func.func @simple_arith.ceildivsi_i8() -> (i8) {
>   %0 = arith.constant 7 : i8
>   %1 = arith.constant -120 : i8
>   // CHECK-NEXT: arith.constant -18
>   %2 = arith.ceildivsi %1, %0 : i8
>   return %2 : i8
> }
> ```
> 
> So, is the issue stemming from that fact that 128 is out of range for 8 bit signed integers? I'm basically trying to understand _why_ the current implementation is incorrect in your case.

yes, as far as I understand it.

https://github.com/llvm/llvm-project/pull/90855


More information about the Mlir-commits mailing list