[Mlir-commits] [mlir] [mlir][llvmir] Add llvm.intr.ldexp operation (PR #133070)
Tobias Gysi
llvmlistbot at llvm.org
Wed Mar 26 09:43:02 PDT 2025
================
@@ -106,10 +106,22 @@ def LLVM_IsFPClass : LLVM_OneResultIntrOp<"is.fpclass", [], [0], [Pure],
let arguments = (ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$in, I32Attr:$bit);
}
+class LLVM_PowFI<string func> :
+ LLVM_OneResultIntrOp<func, [], [0,1],
+ [Pure], /*requiresFastmath=*/1> {
+ let arguments =
+ (ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$val,
+ AnyInteger:$power,
+ DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
----------------
gysit wrote:
```suggestion
(ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$val,
AnySignlessInteger:$power,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
```
Let's use a signless integer nevertheless.
LLVM IR and hence also LLVM dialect works only with signless integer values (such as i32 or i16, it does not support ui16 or si32). The rational behind this is that the type itself should not encode if a value is signed or unsigned (this is different from c/c++). Instead the operations/instructions define if an integer is interpreted as signed or unsigned. That is why there is a signed and unsigned division operation and both of them take signless integer operands. Does that make sense?
https://github.com/llvm/llvm-project/pull/133070
More information about the Mlir-commits
mailing list