[clang] [CIR][AMDGPU] Adds amdgcn logb and scalebn builtins (PR #191344)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 10 17:11:06 PDT 2026
================
@@ -18,6 +18,90 @@
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));
+
+ auto &Builder = CGF.getBuilder();
+
+ CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(CGF, E);
+
+ if (Builder.getIsFPConstrained()) {
+ return cir::LLVMIntrinsicCallOp::create(
+ Builder, CGF.getLoc(E->getExprLoc()),
+ Builder.getStringAttr(ConstrainedIntrinsicName), Src0.getType(),
+ {Src0, Src1})
+ .getResult();
+ }
+
+ return cir::LLVMIntrinsicCallOp::create(Builder, CGF.getLoc(E->getExprLoc()),
+ Builder.getStringAttr(IntrinsicName),
+ Src0.getType(), {Src0, Src1})
+ .getResult();
+}
+
+static mlir::Value emitLogbBuiltin(CIRGenFunction &CGF, const CallExpr *E,
+ bool IsFloat) {
+ auto &Builder = CGF.getBuilder();
----------------
andykaylor wrote:
Don't use `auto` here. One way CIR doesn't follow MLIR style is in the aggressive use of `auto`.
https://github.com/llvm/llvm-project/pull/191344
More information about the cfe-commits
mailing list