[clang] [CIR] Introduce `cir.vec.fcmp` op and floating comparison kinds (PR #235843)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 06:54:31 PST 2026
================
@@ -6574,6 +6574,78 @@ def CIR_VecCmpOp : CIR_Op<"vec.cmp",
let hasFolder = 1;
}
+//===----------------------------------------------------------------------===//
+// VecFCmpOp
+//===----------------------------------------------------------------------===//
+
+def CIR_FCmpOpKind : CIR_I32Enum<"FCmpOpKind", "floating compare operation kind", [
+ I32EnumCase<"_false", 0, "false">,
+ I32EnumCase<"oeq", 1>,
+ I32EnumCase<"ogt", 2>,
+ I32EnumCase<"oge", 3>,
+ I32EnumCase<"olt", 4>,
+ I32EnumCase<"ole", 5>,
+ I32EnumCase<"one", 6>,
+ I32EnumCase<"ord", 7>,
+ I32EnumCase<"ueq", 8>,
+ I32EnumCase<"ugt", 9>,
+ I32EnumCase<"uge", 10>,
+ I32EnumCase<"ult", 11>,
+ I32EnumCase<"ule", 12>,
+ I32EnumCase<"une", 13>,
+ I32EnumCase<"uno", 14>,
+ I32EnumCase<"_true", 15, "true">
+]>;
+
+def CIR_FCmpOpKindAttr : CIR_EnumAttr<CIR_FCmpOpKind, "fcmp">;
+
+def CIR_VecFCmpOp : CIR_Op<"vec.fcmp",
----------------
Fznamznon wrote:
Honestly it does make sense to me since I did not really understand what is the point to have two. But I did not actually consider it because CIR already has the two.
One of original commits that added vec.cmp op in incubator had reasoning that it should return a vector instead of bool. But vec.cmp op is already inconsistent about the return type in doc and reality. Let me know if we want to do this in this PR. I would still prefer to switch to the new op gradually with a series of reviewable PRs though and not switching the whole CIR codegen at once.
https://github.com/llvm/llvm-project/pull/235843
More information about the cfe-commits
mailing list