[clang] [CIR] Use `cir.vec.fcmp` op for all fp vector comparisons (PR #241348)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 04:00:04 PST 2026


https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/241348

>From 384ecef88e65e18d0f8ed45ded2ec00e6bb4374f Mon Sep 17 00:00:00 2001
From: Mariya Podchishchaeva <Mariya.Podchishchaeva at amd.com>
Date: Wed, 11 Nov 2026 09:11:07 -0600
Subject: [PATCH 1/3] [CIR] Use `cir.vec.fcmp` op for all fp vector comparisons

Also removes support for floating point vectors from `cir.vec.cmp` op.

Claude helped with test update.
---
 .../CIR/Dialect/Builder/CIRBaseBuilder.h      |  15 +-
 clang/include/clang/CIR/Dialect/IR/CIROps.td  |  26 +--
 clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp    |  34 +++-
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp       | 127 ++++-----------
 .../CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp |  15 --
 clang/test/CIR/CodeGen/vector-ext.cpp         |  12 +-
 clang/test/CIR/CodeGen/vector.cpp             |  12 +-
 clang/test/CIR/IR/fenv.cir                    |  10 +-
 clang/test/CIR/IR/invalid-cmp.cir             |  13 --
 clang/test/CIR/Lowering/fenv.cir              |   8 +-
 clang/test/CIR/Transforms/vector-cmp-fold.cir | 150 ------------------
 11 files changed, 95 insertions(+), 327 deletions(-)

diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
index 7b067a50ef4636..3d9c30207bcd7d 100644
--- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
+++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
@@ -939,17 +939,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
   }
 
   /// Compares \p lhs and \p rhs element-wise.  Each result element is a
-  /// signed integer of the operand element's bit width.  That is not the
-  /// result an FP80 element needs, so an FP80 compare names its result type
-  /// with the overload below.
+  /// signed integer of the operand element's bit width.
   cir::VecCmpOp createVecCompare(mlir::Location loc, cir::CmpOpKind kind,
                                  mlir::Value lhs, mlir::Value rhs) {
     VectorType vecCast = mlir::cast<VectorType>(lhs.getType());
     mlir::Type elemTy = vecCast.getElementType();
-    assert(!(mlir::isa<cir::FPTypeInterface>(elemTy) &&
-             &mlir::cast<cir::FPTypeInterface>(elemTy).getFloatSemantics() ==
-                 &llvm::APFloat::x87DoubleExtended()) &&
-           "an FP80 vector compare must name its result type");
     IntType integralTy = getSIntNTy(getCIRIntOrFloatBitWidth(elemTy));
     return createVecCompare(loc,
                             cir::VectorType::get(integralTy, vecCast.getSize()),
@@ -959,7 +953,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
   /// Compares \p lhs and \p rhs element-wise, producing \p resultTy, which
   /// must be a vector of integers or bools with as many elements as \p lhs.
   /// The result element width can then differ from the operand element's
-  /// bit width, as for FP80, whose result elements are 128 bits.
+  /// bit width.
   cir::VecCmpOp createVecCompare(mlir::Location loc, VectorType resultTy,
                                  cir::CmpOpKind kind, mlir::Value lhs,
                                  mlir::Value rhs) {
@@ -968,10 +962,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
            cir::isIntOrBoolType(resultTy.getElementType()) &&
            "vector compare result must be an int or bool vector of the "
            "operand length");
-    cir::FenvAttr fenv;
-    if (cir::isFPOrVectorOfFPType(lhs.getType()))
-      fenv = getConstrainedFPAttr();
-    return cir::VecCmpOp::create(*this, loc, resultTy, kind, lhs, rhs, fenv);
+    return cir::VecCmpOp::create(*this, loc, resultTy, kind, lhs, rhs);
   }
 
   /// Compares \p lhs and \p rhs element-wise.  Each result element is a
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 8823b4fe0e5604..69dd3a0b7571c3 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -6649,48 +6649,33 @@ def CIR_VecReduceFMulOp : CIR_VecReduceAccFPOp<"fmul", "vector_reduce_fmul">;
 // VecCmpOp
 //===----------------------------------------------------------------------===//
 
-def CIR_VecCmpOp : CIR_Op<"vec.cmp",
-    !listconcat([SameTypeOperands], CIR_FenvOpTraits)> {
+def CIR_VecCmpOp : CIR_Op<"vec.cmp", [Pure, SameTypeOperands]> {
   let summary = "Compare two vectors";
   let description = [{
     The `cir.vec.cmp` operation does an element-wise comparison of two vectors
-    of the same type. The result is a vector of the same size as the operands
+    of the same non-fp type. The result is a vector of the same size as the operands
     whose element type is the signed integral type that is the same size as the
     element type of the operands. The values in the result are 0 or -1.
 
-    The optional `fenv` attribute describes constraints on the floating-point
-    handling of the operation. It is only valid for floating-point vector
-    comparisons.
-
     ```
     %eq = cir.vec.cmp(eq, %vec_a, %vec_b) : !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>
     %lt = cir.vec.cmp(lt, %vec_a, %vec_b) : !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>
-    %gt = cir.vec.cmp(gt, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> fenv<>
     ```
   }];
 
   let arguments = (ins
     CIR_CmpOpKindAttr:$kind,
-    CIR_VectorType:$lhs,
-    CIR_VectorType:$rhs,
-    OptionalAttr<CIR_FenvAttr>:$fenv
+    CIR_VectorOfIntOrBoolType:$lhs,
+    CIR_VectorOfIntOrBoolType:$rhs
   );
 
   let results = (outs CIR_VectorType:$result);
 
   let assemblyFormat = [{
     `(` enum($kind) `,` $lhs `,` $rhs `)` `:` qualified(type($lhs)) `,`
-    qualified(type($result)) (`fenv` `` $fenv^)? attr-dict
+    qualified(type($result)) attr-dict
   }];
 
-  let builders = [
-    OpBuilder<(ins "mlir::Type":$result, "cir::CmpOpKind":$kind,
-                   "mlir::Value":$lhs, "mlir::Value":$rhs), [{
-      build($_builder, $_state, result, kind, lhs, rhs, cir::FenvAttr{});
-    }]>
-  ];
-
-  let hasVerifier = 1;
   let hasFolder = 1;
 }
 
@@ -6764,7 +6749,6 @@ def CIR_VecFCmpOp : CIR_Op<"vec.fcmp",
             cir::FenvAttr{});
     }]>
   ];
-
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index 6438c9d6163595..69762deae8712b 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -1281,6 +1281,25 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
       llvm_unreachable("unsupported comparison kind for cir.cmp");
     }
   }
+  /// Returns <Signaling, Kind>.
+  std::pair<bool, cir::FCmpOpKind>
+  clangCmpToCIRFCmp(clang::BinaryOperatorKind clangCmp) {
+    switch (clangCmp) {
+    case BO_LT:
+      return std::make_pair(/*Signaling=*/true, cir::FCmpOpKind::olt);
+    case BO_GT:
+      return std::make_pair(/*Signaling=*/true, cir::FCmpOpKind::ogt);
+    case BO_LE:
+      return std::make_pair(/*Signaling=*/true, cir::FCmpOpKind::ole);
+    case BO_GE:
+      return std::make_pair(/*Signaling=*/true, cir::FCmpOpKind::oge);
+    case BO_EQ:
+      return std::make_pair(/*Signaling=*/false, cir::FCmpOpKind::oeq);
+    case BO_NE:
+      return std::make_pair(/*Signaling=*/false, cir::FCmpOpKind::une);
+    }
+    llvm_unreachable("unsupported comparison kind");
+  }
 
   mlir::Value emitCmp(const BinaryOperator *e) {
     ignoreResultAssign = false;
@@ -1290,6 +1309,7 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
     QualType rhsTy = e->getRHS()->getType();
 
     cir::CmpOpKind kind = clangCmpToCIRCmp(e->getOpcode());
+    std::pair<bool, cir::FCmpOpKind> fpInfo = clangCmpToCIRFCmp(e->getOpcode());
     if (lhsTy->getAs<MemberPointerType>()) {
       assert(!cir::MissingFeatures::dataMemberType());
       assert(e->getOpcode() == BO_EQ || e->getOpcode() == BO_NE);
@@ -1309,9 +1329,17 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
         } else {
           // Other kinds of vectors. Element-wise comparison returning
           // a vector.
-          result = cir::VecCmpOp::create(builder, cgf.getLoc(boInfo.loc),
-                                         cgf.convertType(boInfo.fullType), kind,
-                                         boInfo.lhs, boInfo.rhs);
+          auto resultTy =
+              mlir::cast<cir::VectorType>(cgf.convertType(boInfo.fullType));
+          if (cir::isFPOrVectorOfFPType(lhs.getType())) {
+            CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, e);
+            result = builder.createVecFCompare(cgf.getLoc(boInfo.loc), resultTy,
+                                               fpInfo.second, lhs, rhs,
+                                               fpInfo.first);
+          } else {
+            result = builder.createVecCompare(cgf.getLoc(boInfo.loc), resultTy,
+                                              kind, lhs, rhs);
+          }
         }
       } else if (boInfo.isFixedPointOp()) {
         result = emitFixedPointBinOp(boInfo);
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index de9f5461b97aea..b5a1f7d0b513f6 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -4349,22 +4349,7 @@ LogicalResult cir::CmpOp::verify() {
 // VecCmpOp
 //===----------------------------------------------------------------------===//
 
-LogicalResult cir::VecCmpOp::verify() {
-  if (getFenvAttr() && !cir::isFPOrVectorOfFPType(getLhs().getType()))
-    return emitOpError()
-           << "'fenv' is only valid for floating-point comparisons";
-  return success();
-}
-
 OpFoldResult cir::VecCmpOp::fold(FoldAdaptor adaptor) {
-  // Do not fold when fenv is present.
-  // TODO(cir): This is overly conservative. We could fold comparisons as long
-  //            as we can prove that the operation wouldn't raise exceptions or
-  //            when the fenv attribute does not require strict exception
-  //            semantics.
-  if (getFenvAttr())
-    return {};
-
   auto lhsVecAttr =
       mlir::dyn_cast_if_present<cir::ConstVectorAttr>(adaptor.getLhs());
   auto rhsVecAttr =
@@ -4374,7 +4359,9 @@ OpFoldResult cir::VecCmpOp::fold(FoldAdaptor adaptor) {
 
   mlir::Type inputElemTy =
       mlir::cast<cir::VectorType>(lhsVecAttr.getType()).getElementType();
-  if (!isAnyIntegerOrFloatingPointType(inputElemTy))
+  auto IntTy = mlir::dyn_cast<cir::IntType>(inputElemTy);
+  // FIXME: Fold vectors of bool too?
+  if (!IntTy)
     return {};
 
   cir::CmpOpKind opKind = adaptor.getKind();
@@ -4383,103 +4370,59 @@ OpFoldResult cir::VecCmpOp::fold(FoldAdaptor adaptor) {
   uint64_t vecSize = lhsVecElhs.size();
 
   SmallVector<mlir::Attribute, 16> elements(vecSize);
-  bool isIntAttr = vecSize && mlir::isa<cir::IntAttr>(lhsVecElhs[0]);
-  bool isUnsignedInt =
-      isIntAttr && mlir::cast<cir::IntType>(inputElemTy).isUnsigned();
+  bool isUnsignedInt = IntTy.isUnsigned();
   for (uint64_t i = 0; i < vecSize; i++) {
     mlir::Attribute lhsAttr = lhsVecElhs[i];
     mlir::Attribute rhsAttr = rhsVecElhs[i];
     bool cmpResult = false;
     switch (opKind) {
     case cir::CmpOpKind::lt: {
-      if (isIntAttr) {
-        if (isUnsignedInt)
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() <
-                      mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
-        else
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() <
-                      mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
-      } else {
-        cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue() <
-                    mlir::cast<cir::FPAttr>(rhsAttr).getValue();
-      }
+      if (isUnsignedInt)
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() <
+                    mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
+      else
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() <
+                    mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
       break;
     }
     case cir::CmpOpKind::le: {
-      if (isIntAttr) {
-        if (isUnsignedInt)
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() <=
-                      mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
-        else
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() <=
-                      mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
-      } else {
-        cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue() <=
-                    mlir::cast<cir::FPAttr>(rhsAttr).getValue();
-      }
+      if (isUnsignedInt)
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() <=
+                    mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
+      else
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() <=
+                    mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
       break;
     }
     case cir::CmpOpKind::gt: {
-      if (isIntAttr) {
-        if (isUnsignedInt)
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() >
-                      mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
-        else
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() >
-                      mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
-      } else {
-        cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue() >
-                    mlir::cast<cir::FPAttr>(rhsAttr).getValue();
-      }
+      if (isUnsignedInt)
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() >
+                    mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
+      else
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() >
+                    mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
       break;
     }
     case cir::CmpOpKind::ge: {
-      if (isIntAttr) {
-        if (isUnsignedInt)
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() >=
-                      mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
-        else
-          cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() >=
-                      mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
-      } else {
-        cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue() >=
-                    mlir::cast<cir::FPAttr>(rhsAttr).getValue();
-      }
-      break;
-    }
-    case cir::CmpOpKind::eq: {
-      if (isIntAttr) {
-        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() ==
+      if (isUnsignedInt)
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getUInt() >=
+                    mlir::cast<cir::IntAttr>(rhsAttr).getUInt();
+      else
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() >=
                     mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
-      } else {
-        cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue() ==
-                    mlir::cast<cir::FPAttr>(rhsAttr).getValue();
-      }
       break;
     }
-    case cir::CmpOpKind::ne: {
-      if (isIntAttr) {
-        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() !=
-                    mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
-      } else {
-        cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue() !=
-                    mlir::cast<cir::FPAttr>(rhsAttr).getValue();
-      }
+    case cir::CmpOpKind::eq:
+      cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getValue() ==
+                  mlir::cast<cir::IntAttr>(rhsAttr).getValue();
       break;
-    }
-    case cir::CmpOpKind::one: {
-      llvm::APFloat::cmpResult cr =
-          mlir::cast<cir::FPAttr>(lhsAttr).getValue().compare(
-              mlir::cast<cir::FPAttr>(rhsAttr).getValue());
-      cmpResult =
-          cr != llvm::APFloat::cmpUnordered && cr != llvm::APFloat::cmpEqual;
+    case cir::CmpOpKind::ne:
+      cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getValue() !=
+                  mlir::cast<cir::IntAttr>(rhsAttr).getValue();
       break;
-    }
+    case cir::CmpOpKind::one:
     case cir::CmpOpKind::uno: {
-      cmpResult = mlir::cast<cir::FPAttr>(lhsAttr).getValue().compare(
-                      mlir::cast<cir::FPAttr>(rhsAttr).getValue()) ==
-                  llvm::APFloat::cmpUnordered;
-      break;
+      llvm_unreachable("Should not reach fp-only comparison kinds here");
     }
     }
 
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 8cd0ec6b00eaa7..e91255988e601f 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -5661,21 +5661,6 @@ mlir::LogicalResult CIRToLLVMVecCmpOpLowering::matchAndRewrite(
         rewriter, op.getLoc(),
         convertCmpKindToICmpPredicate(op.getKind(), /*isSigned=*/false),
         adaptor.getLhs(), adaptor.getRhs());
-  } else if (mlir::isa<cir::FPTypeInterface>(elementType)) {
-    if (cir::FenvAttr fenv = op.getFenvAttr()) {
-      llvm::ElementCount size = op.getLhs().getType().getSize();
-      auto i1VecTy = mlir::VectorType::get(
-          size.getKnownMinValue(), rewriter.getI1Type(), {size.isScalable()});
-      bitResult = createConstrainedFCmpCall(
-                      rewriter, op.getLoc(), adaptor.getLhs(), adaptor.getRhs(),
-                      op.getKind(), isSignalingConstrainedFCmp(op.getKind()),
-                      fenv, i1VecTy)
-                      .getResult(0);
-    } else {
-      bitResult = mlir::LLVM::FCmpOp::create(
-          rewriter, op.getLoc(), convertCmpKindToFCmpPredicate(op.getKind()),
-          adaptor.getLhs(), adaptor.getRhs());
-    }
   } else {
     return op.emitError() << "unsupported type for VecCmpOp: " << elementType;
   }
diff --git a/clang/test/CIR/CodeGen/vector-ext.cpp b/clang/test/CIR/CodeGen/vector-ext.cpp
index 561f666c8d569d..f812c60f57a5ac 100644
--- a/clang/test/CIR/CodeGen/vector-ext.cpp
+++ b/clang/test/CIR/CodeGen/vector-ext.cpp
@@ -863,27 +863,27 @@ void foo14() {
 // CIR: cir.store{{.*}} %[[VEC_B_VAL]], %[[VEC_B]] : !cir.vector<4 x !cir.float>, !cir.ptr<!cir.vector<4 x !cir.float>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[EQ:.*]] = cir.vec.cmp(eq, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[EQ:.*]] = cir.vec.fcmp(oeq, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
 // CIR: cir.store{{.*}} %[[EQ]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[NE:.*]] = cir.vec.cmp(ne, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[NE:.*]] = cir.vec.fcmp(une, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
 // CIR: cir.store{{.*}} %[[NE]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[LT:.*]] = cir.vec.cmp(lt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[LT:.*]] = cir.vec.fcmp(olt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[LT]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[GT:.*]] = cir.vec.cmp(gt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[GT:.*]] = cir.vec.fcmp(ogt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[GT]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[LE:.*]] = cir.vec.cmp(le, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[LE:.*]] = cir.vec.fcmp(ole, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[LE]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[GE:.*]] = cir.vec.cmp(ge, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[GE:.*]] = cir.vec.fcmp(oge, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[GE]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 
 // LLVM: %[[VEC_A:.*]] = alloca <4 x float>, align 16
diff --git a/clang/test/CIR/CodeGen/vector.cpp b/clang/test/CIR/CodeGen/vector.cpp
index b521665681da55..a4f23fc4e4584e 100644
--- a/clang/test/CIR/CodeGen/vector.cpp
+++ b/clang/test/CIR/CodeGen/vector.cpp
@@ -850,27 +850,27 @@ void foo14() {
 // CIR: cir.store{{.*}} %[[VEC_B_VAL]], %[[VEC_B]] : !cir.vector<4 x !cir.float>, !cir.ptr<!cir.vector<4 x !cir.float>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[EQ:.*]] = cir.vec.cmp(eq, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[EQ:.*]] = cir.vec.fcmp(oeq, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
 // CIR: cir.store{{.*}} %[[EQ]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[NE:.*]] = cir.vec.cmp(ne, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[NE:.*]] = cir.vec.fcmp(une, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
 // CIR: cir.store{{.*}} %[[NE]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[LT:.*]] = cir.vec.cmp(lt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[LT:.*]] = cir.vec.fcmp(olt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[LT]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[GT:.*]] = cir.vec.cmp(gt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[GT:.*]] = cir.vec.fcmp(ogt, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[GT]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[LE:.*]] = cir.vec.cmp(le, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[LE:.*]] = cir.vec.fcmp(ole, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[LE]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
 // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !cir.float>>, !cir.vector<4 x !cir.float>
-// CIR: %[[GE:.*]] = cir.vec.cmp(ge, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+// CIR: %[[GE:.*]] = cir.vec.fcmp(oge, %[[TMP_A]], %[[TMP_B]]) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
 // CIR: cir.store{{.*}} %[[GE]], {{.*}} : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
 
 // LLVM: %[[VEC_A:.*]] = alloca <4 x float>, align 16
diff --git a/clang/test/CIR/IR/fenv.cir b/clang/test/CIR/IR/fenv.cir
index 2c938c2c74c70b..d013fe002913ee 100644
--- a/clang/test/CIR/IR/fenv.cir
+++ b/clang/test/CIR/IR/fenv.cir
@@ -128,14 +128,14 @@ cir.func @cmp_fenv(%a: !cir.float, %b: !cir.float,
   %0 = cir.cmp lt %a, %b : !cir.float fenv<except_mode = unmasked>
   // CHECK: cir.cmp eq %{{.*}}, %{{.*}} : !cir.float fenv<>
   %1 = cir.cmp eq %a, %b : !cir.float fenv<>
-  // CHECK: cir.vec.cmp(gt, %{{.*}}, %{{.*}}) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> fenv<strict_except = true>
-  %2 = cir.vec.cmp(gt, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-       fenv<strict_except = true>
+  // CHECK: cir.vec.fcmp(ogt, %{{.*}}, %{{.*}}) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling fenv<strict_except = true>
+  %2 = cir.vec.fcmp(ogt, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+       signaling fenv<strict_except = true>
   // CHECK: cir.cmp ne %{{.*}}, %{{.*}} : !cir.float
   // CHECK-NOT: fenv
   %3 = cir.cmp ne %a, %b : !cir.float
-  // CHECK: cir.vec.cmp(le, %{{.*}}, %{{.*}}) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+  // CHECK: cir.vec.fcmp(ole, %{{.*}}, %{{.*}}) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
   // CHECK-NOT: fenv
-  %4 = cir.vec.cmp(le, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+  %4 = cir.vec.fcmp(ole, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
   cir.return
 }
diff --git a/clang/test/CIR/IR/invalid-cmp.cir b/clang/test/CIR/IR/invalid-cmp.cir
index 25e09700c2d72f..10788c00c7d3ff 100644
--- a/clang/test/CIR/IR/invalid-cmp.cir
+++ b/clang/test/CIR/IR/invalid-cmp.cir
@@ -22,16 +22,3 @@ module {
   }
 }
 
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module {
-  cir.func @fenv_on_int_vec_cmp(%a: !cir.vector<4 x !s32i>,
-                                %b: !cir.vector<4 x !s32i>) {
-    // expected-error at +1 {{'fenv' is only valid for floating-point comparisons}}
-    %0 = cir.vec.cmp(eq, %a, %b) : !cir.vector<4 x !s32i>,
-                                   !cir.vector<4 x !s32i> fenv<>
-    cir.return
-  }
-}
diff --git a/clang/test/CIR/Lowering/fenv.cir b/clang/test/CIR/Lowering/fenv.cir
index 5d0c39245164de..ad815e18b874a3 100644
--- a/clang/test/CIR/Lowering/fenv.cir
+++ b/clang/test/CIR/Lowering/fenv.cir
@@ -241,16 +241,16 @@ module {
     // CHECK: %[[EB:.*]] = llvm.mlir.metadata_as_value #llvm.md_string<"fpexcept.strict">
     // CHECK: %[[CMP:.*]] = llvm.call_intrinsic "llvm.experimental.constrained.fcmps"(%{{.*}}, %{{.*}}, %[[PRED]], %[[EB]]) : (vector<4xf32>, vector<4xf32>, !llvm.metadata, !llvm.metadata) -> vector<4xi1>
     // CHECK: llvm.sext %[[CMP]] : vector<4xi1> to vector<4xi32>
-    %0 = cir.vec.cmp(gt, %a, %b) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-         fenv<strict_except = true>
+    %0 = cir.vec.fcmp(ogt, %a, %b) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+         signaling fenv<strict_except = true>
     // CHECK: %[[PRED_EQ:.*]] = llvm.mlir.metadata_as_value #llvm.md_string<"oeq">
     // CHECK: %[[CMP_EQ:.*]] = llvm.call_intrinsic "llvm.experimental.constrained.fcmp"(%{{.*}}, %{{.*}}, %[[PRED_EQ]], %{{.*}}) : (vector<4xf32>, vector<4xf32>, !llvm.metadata, !llvm.metadata) -> vector<4xi1>
     // CHECK: llvm.sext %[[CMP_EQ]] : vector<4xi1> to vector<4xi32>
-    %1 = cir.vec.cmp(eq, %a, %b) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+    %1 = cir.vec.fcmp(oeq, %a, %b) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
          fenv<strict_except = true>
     // CHECK: llvm.fcmp "olt" %{{.*}}, %{{.*}} : vector<4xf32>
     // CHECK: llvm.sext %{{.*}} : vector<4xi1> to vector<4xi32>
-    %2 = cir.vec.cmp(lt, %a, %b) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+    %2 = cir.vec.fcmp(olt, %a, %b) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> signaling
     cir.return
   }
 
diff --git a/clang/test/CIR/Transforms/vector-cmp-fold.cir b/clang/test/CIR/Transforms/vector-cmp-fold.cir
index 0d18af84ec145c..78aaae2a77235a 100644
--- a/clang/test/CIR/Transforms/vector-cmp-fold.cir
+++ b/clang/test/CIR/Transforms/vector-cmp-fold.cir
@@ -108,126 +108,6 @@ module  {
 
 // -----
 
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00>
-      : !cir.float, #cir.fp<3.000000e+00> : !cir.float, #cir.fp<4.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[#cir.fp<5.000000e+00> : !cir.float, #cir.fp<6.000000e+00>
-      : !cir.float, #cir.fp<7.000000e+00> : !cir.float, #cir.fp<8.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(eq, %vec_1, %vec_2) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK:  cir.func{{.*}} @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-  // CHECK-NEXT: %[[RES:.*]] = cir.const #cir.const_vector<[#cir.int<0> : !s32i, #cir.int<0> : !s32i,
-  // CHECK-SAME: #cir.int<0> : !s32i, #cir.int<0> : !s32i]> : !cir.vector<4 x !s32i>
-  // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !s32i>
-}
-
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00>
-      : !cir.float, #cir.fp<3.000000e+00> : !cir.float, #cir.fp<4.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[#cir.fp<5.000000e+00> : !cir.float, #cir.fp<6.000000e+00>
-      : !cir.float, #cir.fp<7.000000e+00> : !cir.float, #cir.fp<8.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(ne, %vec_1, %vec_2) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK:  cir.func{{.*}} @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-  // CHECK-NEXT: %[[RES:.*]] = cir.const #cir.const_vector<[#cir.int<-1> : !s32i, #cir.int<-1> : !s32i,
-  // CHECK-SAME: #cir.int<-1> : !s32i, #cir.int<-1> : !s32i]> : !cir.vector<4 x !s32i>
-  // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !s32i>
-}
-
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00>
-      : !cir.float, #cir.fp<3.000000e+00> : !cir.float, #cir.fp<4.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[#cir.fp<5.000000e+00> : !cir.float, #cir.fp<6.000000e+00>
-      : !cir.float, #cir.fp<7.000000e+00> : !cir.float, #cir.fp<8.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(lt, %vec_1, %vec_2) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK:  cir.func{{.*}} @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-  // CHECK-NEXT: %[[RES:.*]] = cir.const #cir.const_vector<[#cir.int<-1> : !s32i, #cir.int<-1> : !s32i,
-  // CHECK-SAME: #cir.int<-1> : !s32i, #cir.int<-1> : !s32i]> : !cir.vector<4 x !s32i>
-  // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !s32i>
-}
-
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00>
-      : !cir.float, #cir.fp<3.000000e+00> : !cir.float, #cir.fp<4.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[#cir.fp<5.000000e+00> : !cir.float, #cir.fp<6.000000e+00>
-      : !cir.float, #cir.fp<7.000000e+00> : !cir.float, #cir.fp<8.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(le, %vec_1, %vec_2) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK:  cir.func{{.*}} @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-  // CHECK-NEXT: %[[RES:.*]] = cir.const #cir.const_vector<[#cir.int<-1> : !s32i, #cir.int<-1> : !s32i,
-  // CHECK-SAME: #cir.int<-1> : !s32i, #cir.int<-1> : !s32i]> : !cir.vector<4 x !s32i>
-  // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !s32i>
-}
-
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00>
-      : !cir.float, #cir.fp<3.000000e+00> : !cir.float, #cir.fp<4.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[#cir.fp<5.000000e+00> : !cir.float, #cir.fp<6.000000e+00>
-      : !cir.float, #cir.fp<7.000000e+00> : !cir.float, #cir.fp<8.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(gt, %vec_1, %vec_2) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK:  cir.func{{.*}} @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-  // CHECK-NEXT: %[[RES:.*]] = cir.const #cir.const_vector<[#cir.int<0> : !s32i, #cir.int<0> : !s32i,
-  // CHECK-SAME: #cir.int<0> : !s32i, #cir.int<0> : !s32i]> : !cir.vector<4 x !s32i>
-  // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !s32i>
-}
-
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00>
-      : !cir.float, #cir.fp<3.000000e+00> : !cir.float, #cir.fp<4.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[#cir.fp<5.000000e+00> : !cir.float, #cir.fp<6.000000e+00>
-      : !cir.float, #cir.fp<7.000000e+00> : !cir.float, #cir.fp<8.000000e+00> : !cir.float]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(ge, %vec_1, %vec_2) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK:  cir.func{{.*}} @fold_cmp_vector_op_test() -> !cir.vector<4 x !s32i> {
-  // CHECK-NEXT: %[[RES:.*]] = cir.const #cir.const_vector<[#cir.int<0> : !s32i, #cir.int<0> : !s32i,
-  // CHECK-SAME: #cir.int<0> : !s32i, #cir.int<0> : !s32i]> : !cir.vector<4 x !s32i>
-  // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !s32i>
-}
-
-// -----
-
 // Test unsigned integer comparisons: result must use unsigned ordering and
 // produce 0 or -1 (all-ones) per the SIMD convention.
 
@@ -292,33 +172,3 @@ module  {
   // CHECK-SAME: #cir.int<-1> : !cir.int<s, 1>, #cir.int<-1> : !cir.int<s, 1>]> : !cir.vector<4 x !cir.int<s, 1>>
   // CHECK-NEXT: cir.return %[[RES]] : !cir.vector<4 x !cir.int<s, 1>>
 }
-
-// -----
-
-!s32i = !cir.int<s, 32>
-
-module  {
-  cir.func @no_fold_cmp_vector_with_fenv() -> !cir.vector<4 x !s32i> {
-    %vec_1 = cir.const #cir.const_vector<[
-      #cir.fp<0x7FC00000> : !cir.float,
-      #cir.fp<2.000000e+00> : !cir.float,
-      #cir.fp<3.000000e+00> : !cir.float,
-      #cir.fp<4.000000e+00> : !cir.float
-    ]> : !cir.vector<4 x !cir.float>
-    %vec_2 = cir.const #cir.const_vector<[
-      #cir.fp<5.000000e+00> : !cir.float,
-      #cir.fp<6.000000e+00> : !cir.float,
-      #cir.fp<7.000000e+00> : !cir.float,
-      #cir.fp<8.000000e+00> : !cir.float
-    ]> : !cir.vector<4 x !cir.float>
-    %new_vec = cir.vec.cmp(lt, %vec_1, %vec_2) :
-        !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-        fenv<strict_except = true>
-    cir.return %new_vec : !cir.vector<4 x !s32i>
-  }
-
-  // CHECK-LABEL: cir.func{{.*}} @no_fold_cmp_vector_with_fenv
-  // CHECK: cir.vec.cmp(lt, %{{.*}}, %{{.*}}) :
-  // CHECK-SAME: !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-  // CHECK-SAME: fenv<strict_except = true>
-}

>From 7235004eddc97974693ebff8ba0494988980bfd9 Mon Sep 17 00:00:00 2001
From: Mariya Podchishchaeva <Mariya.Podchishchaeva at amd.com>
Date: Wed, 11 Nov 2026 09:58:51 -0600
Subject: [PATCH 2/3] Fix a warning

---
 clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index 69762deae8712b..8bad2c335cc0b9 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -1297,8 +1297,9 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
       return std::make_pair(/*Signaling=*/false, cir::FCmpOpKind::oeq);
     case BO_NE:
       return std::make_pair(/*Signaling=*/false, cir::FCmpOpKind::une);
+    default:
+      llvm_unreachable("unsupported comparison kind");
     }
-    llvm_unreachable("unsupported comparison kind");
   }
 
   mlir::Value emitCmp(const BinaryOperator *e) {

>From 8ba92e062ee38dcef237076b50d6262a27ee3e5a Mon Sep 17 00:00:00 2001
From: Mariya Podchishchaeva <Mariya.Podchishchaeva at amd.com>
Date: Wed, 11 Nov 2026 11:38:06 -0600
Subject: [PATCH 3/3] There are unit tests now???

---
 clang/unittests/CIR/FenvOpTest.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/unittests/CIR/FenvOpTest.cpp b/clang/unittests/CIR/FenvOpTest.cpp
index b0ff67b9167010..fc1f35db73a332 100644
--- a/clang/unittests/CIR/FenvOpTest.cpp
+++ b/clang/unittests/CIR/FenvOpTest.cpp
@@ -79,8 +79,8 @@ TEST_F(CIRFenvOpTest, MemoryEffects) {
       %9 = cir.cast floating %a : !cir.float -> !cir.double fenv<>
       %10 = cir.cmp lt %a, %b : !cir.float
       %11 = cir.cmp lt %a, %b : !cir.float fenv<>
-      %12 = cir.vec.cmp(eq, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
-      %13 = cir.vec.cmp(eq, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> fenv<>
+      %12 = cir.vec.fcmp(oeq, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i>
+      %13 = cir.vec.fcmp(oeq, %va, %vb) : !cir.vector<4 x !cir.float>, !cir.vector<4 x !s32i> fenv<>
       cir.return
     }
   )CIR");
@@ -129,7 +129,7 @@ TEST_F(CIRFenvOpTest, MemoryEffects) {
   expectFenvReadAndWrite(cmpOps[1]);
   EXPECT_FALSE(isMemoryEffectFree(cmpOps[1]));
 
-  SmallVector<cir::VecCmpOp> vecCmpOps = findOps<cir::VecCmpOp>(*module);
+  SmallVector<cir::VecFCmpOp> vecCmpOps = findOps<cir::VecFCmpOp>(*module);
   ASSERT_EQ(vecCmpOps.size(), 2u);
   EXPECT_TRUE(getEffects(vecCmpOps[0]).empty());
   EXPECT_TRUE(isMemoryEffectFree(vecCmpOps[0]));



More information about the cfe-commits mailing list