================
@@ -18,6 +18,79 @@
 
 using namespace clang;
 using namespace clang::CIRGen;
+using namespace cir;
+
+static mlir::Value emitBinaryExpMaybeConstrainedFPBuiltin(
+    CIRGenFunction &cgf, const CallExpr *e, llvm::StringRef intrinsicName,
+    llvm::StringRef constrainedIntrinsicName) {
+  mlir::Value src0 = cgf.emitScalarExpr(e->getArg(0));
+  mlir::Value src1 = cgf.emitScalarExpr(e->getArg(1));
+  mlir::Location loc = cgf.getLoc(e->getExprLoc());
+
+  CIRGenBuilderTy &builder = cgf.getBuilder();
+
+  CIRGenFunction::CIRGenFPOptionsRAII fpOptsRAII(cgf, e);
+
+  if (builder.getIsFPConstrained()) {
+    return builder.emitIntrinsicCallOp(loc, constrainedIntrinsicName,
----------------
andykaylor wrote:

Can you have this case call `cfg.cgm.errorNYI()` instead. The constrained 
intrinsics require rounding mode and exception behavior arguments that in 
classic codegen are part of the IRBuilder state. We haven't implemented that 
yet in CIR, so this will result in a bad call. Also, the constrained intrinsics 
may be replaced before we get this mechanism properly implemented in CIR.

https://github.com/llvm/llvm-project/pull/191344
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to