[clang] [CIR][X86] Add support for cmp builtins (PR #174318)
Zhihui Yang via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 19:19:00 PST 2026
================
@@ -501,19 +417,88 @@ static mlir::Value emitX86vpcom(CIRGenBuilderTy &builder, mlir::Location loc,
return builder.createVecCompare(loc, pred, op0, op1);
}
-std::optional<mlir::Value>
-CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr) {
+static cir::CmpOpKind getCmpPredFromImm(unsigned imm) {
+ switch (imm) {
+ case 0:
+ return cir::CmpOpKind::eq;
+ case 1:
+ return cir::CmpOpKind::lt;
+ case 2:
+ return cir::CmpOpKind::le;
+ case 4:
+ return cir::CmpOpKind::ne;
+ case 5:
+ return cir::CmpOpKind::ge;
+ case 6:
+ return cir::CmpOpKind::gt;
+ default:
+ llvm_unreachable("Unknown condition code");
+ }
+}
+
+static mlir::Value emitX86MaskedCompare(CIRGenBuilderTy &builder,
----------------
YGGkk wrote:
I see it, I will change my code
https://github.com/llvm/llvm-project/pull/174318
More information about the cfe-commits
mailing list