[clang] [CIR][AMDGPU] Adds amdgcn logb and scalebn builtins (PR #191344)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 10:31:04 PDT 2026
================
@@ -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
More information about the cfe-commits
mailing list