[clang] [CIR][X86] Add CIR codegen support for fpclass x86 builtins (PR #172813)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 13:14:51 PST 2026


================
@@ -264,15 +264,31 @@ static mlir::Value emitX86MaskTest(CIRGenBuilderTy &builder, mlir::Location loc,
                              mlir::ValueRange{lhsVec, rhsVec});
 }
 
-// TODO: The cgf parameter should be removed when all the NYI cases are
-// implemented.
 static std::optional<mlir::Value>
-emitX86MaskedCompareResult(CIRGenFunction &cgf, CIRGenBuilderTy &builder,
-                           mlir::Value cmp, unsigned numElts,
-                           mlir::Value maskIn, mlir::Location loc) {
+emitX86MaskedCompareResult(CIRGenBuilderTy &builder, mlir::Value cmp,
+                           unsigned numElts, mlir::Value maskIn,
+                           mlir::Location loc) {
   if (maskIn) {
-    cgf.cgm.errorNYI(loc, "emitX86MaskedCompareResult");
-    return {};
+    bool isAllOnes = false;
+    mlir::Value maskInValue = maskIn;
+    auto castOp = mlir::dyn_cast_or_null<cir::CastOp>(maskIn.getDefiningOp());
+    if (castOp && castOp.getKind() == cir::CastKind::integral) {
+      maskInValue = castOp.getResult();
+      isAllOnes = true;
----------------
andykaylor wrote:

This is not right. You can't assume just based on this being an integral cast that the value is all ones. What is the specific cast that this is meant to handle?

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


More information about the cfe-commits mailing list