[clang] [CIR] Attach FenvAttr when strictfp mode is in effect (PR #213368)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 31 14:55:17 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangir
Author: Andy Kaylor (andykaylor)
<details>
<summary>Changes</summary>
This change adds tracking of floating-point constraints via the CIRGenFPOptionsRAII object, deriving the state from the FP features in effect tracking in the Clang AST. When we are about to generate an operation that may require floating point constraints, a CIRGenFPOptionsRAII object is used to get the effective floating-point state from the expression for which we are generating the operations. This object in turn sets the floating-point state of the CIRGenBuilder which uses these settings to determine whether a cir::FenvAttr should be attached to generated objects and, if so, what its state should be.
This does not cover complex operations, AArch64 builtins, or global constructors. Those will be updated in follow-up changes.
Assisted-by: Cursor / various models
---
Patch is 171.26 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/213368.diff
13 Files Affected:
- (modified) clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h (+113-13)
- (modified) clang/include/clang/CIR/Dialect/IR/CIRDialect.td (+1)
- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+1)
- (modified) clang/lib/CIR/CodeGen/CIRGenBuilder.h (+2-43)
- (modified) clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp (+13-19)
- (modified) clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp (+1-2)
- (modified) clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp (+19-11)
- (modified) clang/lib/CIR/CodeGen/CIRGenFunction.cpp (+28-31)
- (modified) clang/lib/CIR/CodeGen/CIRGenFunction.h (+28-1)
- (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+12)
- (added) clang/test/CIR/CodeGen/pragma-fenv_access.c (+1716)
- (modified) clang/test/CIR/Lowering/fenv.cir (+14-1)
- (added) clang/test/CIR/Lowering/strictfp.cir (+28)
``````````diff
diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
index fbbf54314191c..45cb18a50eeee 100644
--- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
+++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
@@ -11,6 +11,7 @@
#include "clang/AST/CharUnits.h"
#include "clang/Basic/AddressSpaces.h"
+#include "clang/Basic/LangOptions.h"
#include "clang/CIR/Dialect/IR/CIRAttrs.h"
#include "clang/CIR/Dialect/IR/CIRDialect.h"
#include "clang/CIR/Dialect/IR/CIRTypes.h"
@@ -68,6 +69,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
: mlir::OpBuilder(&mlirContext) {}
CIRBaseBuilderTy(mlir::OpBuilder &builder) : mlir::OpBuilder(builder) {}
+ bool isFPConstrained = false;
+ clang::LangOptions::FPExceptionModeKind defaultConstrainedExcept =
+ clang::LangOptions::FPE_Ignore;
+ llvm::RoundingMode defaultConstrainedRounding =
+ llvm::RoundingMode::NearestTiesToEven;
+
mlir::Value getConstAPInt(mlir::Location loc, mlir::Type typ,
const llvm::APInt &val) {
return cir::ConstantOp::create(*this, loc, cir::IntAttr::get(typ, val));
@@ -203,6 +210,96 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
cir::BoolAttr getTrueAttr() { return getCIRBoolAttr(true); }
cir::BoolAttr getFalseAttr() { return getCIRBoolAttr(false); }
+ //
+ // Floating point specific helpers
+ // -------------------------------
+ //
+
+ /// Enable/Disable use of constrained floating point math. When enabled the
+ /// CreateF<op>() calls instead create constrained floating point intrinsic
+ /// calls. Fast math flags are unaffected by this setting.
+ void setIsFPConstrained(bool isCon) { isFPConstrained = isCon; }
+
+ /// Query for the use of constrained floating point math
+ bool getIsFPConstrained() const { return isFPConstrained; }
+
+ /// Set the exception handling to be used with constrained floating point
+ void setDefaultConstrainedExcept(
+ clang::LangOptions::FPExceptionModeKind newExcept) {
+ defaultConstrainedExcept = newExcept;
+ }
+
+ /// Get the exception handling used with constrained floating point
+ clang::LangOptions::FPExceptionModeKind getDefaultConstrainedExcept() const {
+ return defaultConstrainedExcept;
+ }
+
+ /// Set the rounding mode handling to be used with constrained floating point
+ void setDefaultConstrainedRounding(llvm::RoundingMode newRounding) {
+ defaultConstrainedRounding = newRounding;
+ }
+
+ /// Get the rounding mode handling used with constrained floating point
+ llvm::RoundingMode getDefaultConstrainedRounding() const {
+ return defaultConstrainedRounding;
+ }
+
+ /// Build the `#cir.fenv` attribute describing the constrained floating-point
+ /// environment currently in effect. This is attached to floating-point
+ /// operations that support it to capture the rounding and exception
+ /// behavior. Returns a null attribute when constrained floating-point is not
+ /// enabled, in which case no attribute should be attached.
+ cir::FenvAttr getConstrainedFPAttr() {
+ if (!isFPConstrained)
+ return {};
+
+ cir::FPDynamicRoundingMode roundingMode;
+ switch (defaultConstrainedRounding) {
+ case llvm::RoundingMode::NearestTiesToEven:
+ roundingMode = cir::FPDynamicRoundingMode::ToNearest;
+ break;
+ case llvm::RoundingMode::TowardNegative:
+ roundingMode = cir::FPDynamicRoundingMode::Downward;
+ break;
+ case llvm::RoundingMode::TowardPositive:
+ roundingMode = cir::FPDynamicRoundingMode::Upward;
+ break;
+ case llvm::RoundingMode::TowardZero:
+ roundingMode = cir::FPDynamicRoundingMode::UpwardZero;
+ break;
+ case llvm::RoundingMode::NearestTiesToAway:
+ roundingMode = cir::FPDynamicRoundingMode::ToNearestAway;
+ break;
+ case llvm::RoundingMode::Dynamic:
+ roundingMode = cir::FPDynamicRoundingMode::Unknown;
+ break;
+ default:
+ llvm_unreachable("unexpected constrained rounding mode");
+ }
+
+ cir::FPExceptionMode exceptMode;
+ bool strictExcept;
+ switch (defaultConstrainedExcept) {
+ case clang::LangOptions::FPE_Ignore:
+ exceptMode = cir::FPExceptionMode::Masked;
+ strictExcept = false;
+ break;
+ case clang::LangOptions::FPE_MayTrap:
+ exceptMode = cir::FPExceptionMode::Unknown;
+ strictExcept = false;
+ break;
+ case clang::LangOptions::FPE_Strict:
+ exceptMode = cir::FPExceptionMode::Unknown;
+ strictExcept = true;
+ break;
+ default:
+ llvm_unreachable("unexpected constrained exception mode");
+ }
+
+ return cir::FenvAttr::get(getContext(), roundingMode, exceptMode,
+ mlir::BoolAttr::get(getContext(), strictExcept));
+ }
+
mlir::Value createComplexCreate(mlir::Location loc, mlir::Value real,
mlir::Value imag) {
auto resultComplexTy = cir::ComplexType::get(real.getType());
@@ -744,45 +841,41 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
mlir::Value createFAdd(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) {
assert(!cir::MissingFeatures::metaDataNode());
- assert(!cir::MissingFeatures::fpConstraints());
assert(!cir::MissingFeatures::fastMathFlags());
- return cir::FAddOp::create(*this, loc, lhs, rhs);
+ return cir::FAddOp::create(*this, loc, lhs, rhs, getConstrainedFPAttr());
}
mlir::Value createFSub(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) {
assert(!cir::MissingFeatures::metaDataNode());
- assert(!cir::MissingFeatures::fpConstraints());
assert(!cir::MissingFeatures::fastMathFlags());
- return cir::FSubOp::create(*this, loc, lhs, rhs);
+ return cir::FSubOp::create(*this, loc, lhs, rhs, getConstrainedFPAttr());
}
mlir::Value createFMul(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) {
assert(!cir::MissingFeatures::metaDataNode());
- assert(!cir::MissingFeatures::fpConstraints());
assert(!cir::MissingFeatures::fastMathFlags());
- return cir::FMulOp::create(*this, loc, lhs, rhs);
+ return cir::FMulOp::create(*this, loc, lhs, rhs, getConstrainedFPAttr());
}
mlir::Value createFDiv(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) {
assert(!cir::MissingFeatures::metaDataNode());
- assert(!cir::MissingFeatures::fpConstraints());
assert(!cir::MissingFeatures::fastMathFlags());
- return cir::FDivOp::create(*this, loc, lhs, rhs);
+ return cir::FDivOp::create(*this, loc, lhs, rhs, getConstrainedFPAttr());
}
mlir::Value createFRem(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) {
assert(!cir::MissingFeatures::metaDataNode());
- assert(!cir::MissingFeatures::fpConstraints());
assert(!cir::MissingFeatures::fastMathFlags());
- return cir::FRemOp::create(*this, loc, lhs, rhs);
+ return cir::FRemOp::create(*this, loc, lhs, rhs, getConstrainedFPAttr());
}
mlir::Value createFNeg(mlir::Location loc, mlir::Value operand) {
assert(cir::isFPOrVectorOfFPType(operand.getType()) &&
"expected floating-point or vector-of-float type");
assert(!cir::MissingFeatures::metaDataNode());
- assert(!cir::MissingFeatures::fpConstraints());
assert(!cir::MissingFeatures::fastMathFlags());
+ // fneg does not raise FP exceptions or depend on the rounding mode, so it
+ // never carries an fenv attribute.
return cir::FNegOp::create(*this, loc, operand);
}
@@ -796,7 +889,10 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
cir::CmpOp createCompare(mlir::Location loc, cir::CmpOpKind kind,
mlir::Value lhs, mlir::Value rhs) {
- return cir::CmpOp::create(*this, loc, kind, lhs, rhs);
+ cir::FenvAttr fenv;
+ if (cir::isAnyFloatingPointType(lhs.getType()))
+ fenv = getConstrainedFPAttr();
+ return cir::CmpOp::create(*this, loc, kind, lhs, rhs, fenv);
}
cir::VecCmpOp createVecCompare(mlir::Location loc, cir::CmpOpKind kind,
@@ -806,7 +902,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
getSIntNTy(getCIRIntOrFloatBitWidth(vecCast.getElementType()));
VectorType integralVecTy =
cir::VectorType::get(integralTy, vecCast.getSize());
- return cir::VecCmpOp::create(*this, loc, integralVecTy, kind, lhs, rhs);
+ cir::FenvAttr fenv;
+ if (cir::isFPOrVectorOfFPType(lhs.getType()))
+ fenv = getConstrainedFPAttr();
+ return cir::VecCmpOp::create(*this, loc, integralVecTy, kind, lhs, rhs,
+ fenv);
}
mlir::Value createIsNaN(mlir::Location loc, mlir::Value operand) {
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
index d340a9061310f..de90fed45f170 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -44,6 +44,7 @@ def CIR_Dialect : Dialect {
static llvm::StringRef getReturnsTwiceAttrName() { return "returns_twice"; }
static llvm::StringRef getColdAttrName() { return "cold"; }
static llvm::StringRef getHotAttrName() { return "hot"; }
+ static llvm::StringRef getStrictFPAttrName() { return "strictfp"; }
static llvm::StringRef getNoDuplicatesAttrName() { return "noduplicate"; }
static llvm::StringRef getConvergentAttrName() { return "convergent"; }
static llvm::StringRef getNoUnwindAttrName() { return "nounwind"; }
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 591b5dc9acf1c..ba8011e03f638 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -7619,6 +7619,7 @@ class CIR_TernaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
];
let llvmOp = llvmOpName;
+ let constrainedLLVMIntrinsic = mnemonic;
}
def CIR_FMAOp : CIR_TernaryFPToFPBuiltinOp<"fma", "FMAOp"> {
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
index 074233050bee7..c906e65a132c2 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h
+++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
@@ -30,9 +30,6 @@ namespace clang::CIRGen {
class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
const CIRGenTypeCache &typeCache;
- bool isFPConstrained = false;
- llvm::fp::ExceptionBehavior defaultConstrainedExcept = llvm::fp::ebStrict;
- llvm::RoundingMode defaultConstrainedRounding = llvm::RoundingMode::Dynamic;
llvm::StringMap<unsigned> recordNames;
llvm::StringMap<unsigned> globalsVersioning;
@@ -120,43 +117,6 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
return baseName + "." + std::to_string(recordNames[baseName]++);
}
- //
- // Floating point specific helpers
- // -------------------------------
- //
-
- /// Enable/Disable use of constrained floating point math. When enabled the
- /// CreateF<op>() calls instead create constrained floating point intrinsic
- /// calls. Fast math flags are unaffected by this setting.
- void setIsFPConstrained(bool isCon) { isFPConstrained = isCon; }
-
- /// Query for the use of constrained floating point math
- bool getIsFPConstrained() const { return isFPConstrained; }
-
- /// Set the exception handling to be used with constrained floating point
- void setDefaultConstrainedExcept(llvm::fp::ExceptionBehavior newExcept) {
- assert(llvm::convertExceptionBehaviorToStr(newExcept) &&
- "Garbage strict exception behavior!");
- defaultConstrainedExcept = newExcept;
- }
-
- /// Get the exception handling used with constrained floating point
- llvm::fp::ExceptionBehavior getDefaultConstrainedExcept() const {
- return defaultConstrainedExcept;
- }
-
- /// Set the rounding mode handling to be used with constrained floating point
- void setDefaultConstrainedRounding(llvm::RoundingMode newRounding) {
- assert(llvm::convertRoundingModeToStr(newRounding) &&
- "Garbage strict rounding mode!");
- defaultConstrainedRounding = newRounding;
- }
-
- /// Get the rounding mode handling used with constrained floating point
- llvm::RoundingMode getDefaultConstrainedRounding() const {
- return defaultConstrainedRounding;
- }
-
cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const {
if (&format == &llvm::APFloat::IEEEdouble())
return cir::LongDoubleType::get(getContext(), typeCache.doubleTy);
@@ -497,10 +457,9 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
// TODO: split this to createFPExt/createFPTrunc when we have dedicated cast
// operations.
mlir::Value createFloatingCast(mlir::Value v, mlir::Type destType) {
- assert(!cir::MissingFeatures::fpConstraints());
-
return cir::CastOp::create(*this, v.getLoc(), destType,
- cir::CastKind::floating, v);
+ cir::CastKind::floating, v,
+ getConstrainedFPAttr());
}
mlir::Value createDynCast(mlir::Location loc, mlir::Value src,
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
index 874f5188ae009..beb3082f48537 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
@@ -356,10 +356,9 @@ static RValue emitUnaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf,
mlir::Value arg = cgf.emitScalarExpr(e.getArg(0));
CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, &e);
- assert(!cir::MissingFeatures::fpConstraints());
- auto call =
- Operation::create(cgf.getBuilder(), arg.getLoc(), arg.getType(), arg);
+ auto call = Operation::create(cgf.getBuilder(), arg.getLoc(), arg.getType(),
+ arg, cgf.getBuilder().getConstrainedFPAttr());
return RValue::get(call->getResult(0));
}
@@ -377,9 +376,10 @@ static RValue emitUnaryMaybeConstrainedFPToIntBuiltin(CIRGenFunction &cgf,
mlir::Type resultType = cgf.convertType(e.getType());
mlir::Value src = cgf.emitScalarExpr(e.getArg(0));
- assert(!cir::MissingFeatures::fpConstraints());
+ CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, &e);
- auto call = Op::create(cgf.getBuilder(), src.getLoc(), resultType, src);
+ auto call = Op::create(cgf.getBuilder(), src.getLoc(), resultType, src,
+ cgf.getBuilder().getConstrainedFPAttr());
return RValue::get(call->getResult(0));
}
@@ -398,6 +398,8 @@ static RValue emitBinaryFPBuiltin(CIRGenFunction &cgf, const CallExpr &e) {
template <typename Op>
static RValue emitTernaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf,
const CallExpr &e) {
+ CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, &e);
+
mlir::Value arg0 = cgf.emitScalarExpr(e.getArg(0));
mlir::Value arg1 = cgf.emitScalarExpr(e.getArg(1));
mlir::Value arg2 = cgf.emitScalarExpr(e.getArg(2));
@@ -405,9 +407,8 @@ static RValue emitTernaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf,
mlir::Location loc = cgf.getLoc(e.getExprLoc());
mlir::Type ty = cgf.convertType(e.getType());
- assert(!cir::MissingFeatures::fpConstraints());
-
- auto call = Op::create(cgf.getBuilder(), loc, ty, arg0, arg1, arg2);
+ auto call = Op::create(cgf.getBuilder(), loc, ty, arg0, arg1, arg2,
+ cgf.getBuilder().getConstrainedFPAttr());
return RValue::get(call->getResult(0));
}
@@ -417,12 +418,13 @@ static mlir::Value emitBinaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf,
mlir::Value arg0 = cgf.emitScalarExpr(e.getArg(0));
mlir::Value arg1 = cgf.emitScalarExpr(e.getArg(1));
+ CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, &e);
+
mlir::Location loc = cgf.getLoc(e.getExprLoc());
mlir::Type ty = cgf.convertType(e.getType());
- assert(!cir::MissingFeatures::fpConstraints());
-
- auto call = Op::create(cgf.getBuilder(), loc, ty, arg0, arg1);
+ auto call = Op::create(cgf.getBuilder(), loc, ty, arg0, arg1,
+ cgf.getBuilder().getConstrainedFPAttr());
return call->getResult(0);
}
@@ -1587,7 +1589,6 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
case Builtin::BI__builtin_isnan: {
CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(*this, e);
mlir::Value v = emitScalarExpr(e->getArg(0));
- assert(!cir::MissingFeatures::fpConstraints());
mlir::Location loc = getLoc(e->getBeginLoc());
return RValue::get(builder.createBoolToInt(
builder.createIsFPClass(loc, v, cir::FPClassTest::Nan),
@@ -1606,7 +1607,6 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
case Builtin::BI__builtin_isinf: {
CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(*this, e);
mlir::Value v = emitScalarExpr(e->getArg(0));
- assert(!cir::MissingFeatures::fpConstraints());
mlir::Location loc = getLoc(e->getBeginLoc());
return RValue::get(builder.createBoolToInt(
builder.createIsFPClass(loc, v, cir::FPClassTest::Infinity),
@@ -1619,9 +1619,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
case Builtin::BIfinitel:
case Builtin::BI__finitel:
case Builtin::BI__builtin_isfinite: {
- CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(*this, e);
mlir::Value v = emitScalarExpr(e->getArg(0));
- assert(!cir::MissingFeatures::fpConstraints());
mlir::Location loc = getLoc(e->getBeginLoc());
return RValue::get(builder.createBoolToInt(
builder.createIsFPClass(loc, v, cir::FPClassTest::Finite),
@@ -1629,7 +1627,6 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
}
case Builtin::BI__builtin_isnormal: {
- CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(*this, e);
mlir::Value v = emitScalarExpr(e->getArg(0));
mlir::Location loc = getLoc(e->getBeginLoc());
return RValue::get(builder.createBoolToInt(
@@ -1638,7 +1635,6 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
}
case Builtin::BI__builtin_issubnormal: {
- CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(*this, e);
mlir::Value v = emitScalarExpr(e->getArg(0));
mlir::Location loc = getLoc(e->getBeginLoc());
return RValue::get(builder.createBoolToInt(
@@ -1647,7 +1643,6 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
}
case Builtin::BI__builtin_iszero: {
- CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(*this, e);
mlir::Value v = emitScalarExpr(e->getArg(0));
mlir::Location loc = getLoc(e->getBeginLoc());
return RValue::get(builder.createBoolToInt(
@@ -1663,7 +1658,6 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
mlir::Value v = emitScalarExpr(e->getArg(0));
uint64_t test = result.Val.getInt().getLimitedValue();
mlir::Location loc = getLoc(e->getBeginLoc());
- //
return RValue::get(builder.createBoolToInt(
builder.createIsFPClass(loc, v, cir::FPClassTest(test)),
convertType(e->getType())));
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
index 9c98f4bc55daa..9228367fdd44f 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
@@ -58,11 +58,10 @@ static mlir::Value emitVectorFCmp(CIRGenFunction &cgf, const CallExpr &expr,
llvm::SmallVector<mlir::Value> &ops,
cir::CmpOpKind pred, bool shouldInvert) {
CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, &expr);
- // TODO(cir): Add isSignaling boolean once emitConstrainedFPCall implemented
- assert(!cir::MissingFeatures::emitConstrainedFPCall());
clang::CIRGen::CIRGenBuilderTy &builder = cgf.getBuilder();
mlir::Value cmp = builder.createVecCompare(cgf.getLoc(expr.getExprLoc()),
pred, ops[0], ops[1]);
+ // TODO(cir): Add dedicated predicates to avoid the need to invert this.
mlir::Value bitCast = builder.createBitcast(
shouldInvert ? builder.createNot(cmp) : cmp, ops[0].getType());
return bitCast;
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index 7ed01ecdf27ff..8d660a0a2c721 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/213368
More information about the cfe-commits
mailing list