[clang] [CIR] Add cir.signbit to tablegen (PR #184091)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 02:20:43 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Yeongu Choe (YeonguChoe)

<details>
<summary>Changes</summary>

`cir.signbit` was not included in `CIROps.td`. `cir.signbit` is in the specification (https://llvm.github.io/clangir/Dialect/ops.html#cirsignbit-cirsignbitop), so I added it.

---
Full diff: https://github.com/llvm/llvm-project/pull/184091.diff


1 Files Affected:

- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+10) 


``````````diff
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index a5a5197cd3ea6..ae32bc995a043 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -5847,6 +5847,16 @@ def CIR_AbsOp : CIR_Op<"abs", [Pure, SameOperandsAndResultType]> {
   let assemblyFormat = "$src ( `min_is_poison` $min_is_poison^ )? `:` type($src) attr-dict";
 }
 
+def CIR_SignBitOp : CIR_Op<"signbit", [Pure, AlwaysSpeculatableImplTrait]> {
+  let summary = "Return true if operand is negative. Otherwise, return false.";
+  let description = [{
+    `cir.signbit` checks the sign of a floating-point number.
+  }];
+  let arguments = (ins CIR_FloatType:$input);
+  let results = (outs CIR_BoolType:$res);
+  let assemblyFormat = "$input attr-dict `:` type($input) `->` type($res)";
+}
+
 def CIR_FloorOp : CIR_UnaryFPToFPBuiltinOp<"floor", "FloorOp"> {
   let summary = "Computes the floating-point floor value";
   let description = [{

``````````

</details>


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


More information about the cfe-commits mailing list