[Mlir-commits] [mlir] [mlir][arith] Add nneg to extui and uitofp. (PR #183165)

Erick Ochoa Lopez llvmlistbot at llvm.org
Wed Feb 25 10:45:56 PST 2026


amd-eochoalo wrote:

> If we were starting from zero, would we want to put these flags together?

I think I wouldn't be putting these flags together unless all ffast-math flags are valid in operations containing ffast-math flags. I know we can use verifiers and constraints to limit the valid ffast-math flags on any given operation, but keeping them separate achieves what we want already.

 >  Perhaps it would help to see how often each flag like nneg/nsw/exact/disjoint appears over the same instruction, or if these are always mutually exclusive
 
 From what I can see, both in MLIR and LLVM these operations are disjoint. (But from what I understand, maybe exact and nneg will be added to index_castui)
 
 | Flag category | Arith Ops |
 |---------------|------------|
 | overflow     |  addi, subi, muli, shli, trunci |
 | exact | divui, divsi, shrui, shrsi (future: index_castui, index_cast) |
 | nneg | extui, uitofp, and in the future index_castui |
 | fastmath | negf, addf, subf, maxf, maxnumf, minimumf, minnumf |
 
 In LLVM:
 
 | Flag category | Ops |
 |----------------|-----|
 | nsw/nuw | add, sub, mul, shl, trucn |
 | exact | sdiv, udiv, ashr, and in the future index_cast |
 | disjoint | or |
 | nneg | zext, uitofp |
 | fastmath | f* |
 
 I think keeping them separate makes sense and index_castui will can have both exact and nneg.

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


More information about the Mlir-commits mailing list