[clang] [CIR] Upstream builtin lowering emitter & FAbs op (PR #151750)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 1 16:19:44 PDT 2025
================
@@ -3199,4 +3199,22 @@ def CIR_ExpectOp : CIR_Op<"expect", [
}];
}
+//===----------------------------------------------------------------------===//
+// Floating Point Ops
+//===----------------------------------------------------------------------===//
+
+class CIR_UnaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
+ : CIR_Op<mnemonic, [Pure, SameOperandsAndResultType]>
+{
+ let arguments = (ins CIR_AnyFloatOrVecOfFloatType:$src);
+ let results = (outs CIR_AnyFloatOrVecOfFloatType:$result);
+ let summary = "libc builtin equivalent ignoring "
+ "floating point exceptions and errno";
+ let assemblyFormat = "$src `:` type($src) attr-dict";
+
+ let llvmOp = llvmOpName;
+}
+
+def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp">;
----------------
andykaylor wrote:
I'd prefer to see a summary and description here. Something like:
```
let summary = "Computes the floating-point absolute value";
let description = [{
`cir.fabs` computes the absolute value of a floating-point operand
and returns a result of the same type, ignoring floating-point
exceptions. It does not set `errno`.
}];
```
https://github.com/llvm/llvm-project/pull/151750
More information about the cfe-commits
mailing list