[clang] [llvm] [HLSL] Implementation of the fmod intrinsic (PR #108849)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 09:59:40 PDT 2024
================
@@ -18709,6 +18709,25 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
CGM.getHLSLRuntime().getNormalizeIntrinsic(), ArrayRef<Value *>{X},
nullptr, "hlsl.normalize");
}
+ case Builtin::BI__builtin_hlsl_elementwise_fmod: {
+ Value *Op0 = EmitScalarExpr(E->getArg(0));
+ Value *Op1 = EmitScalarExpr(E->getArg(1));
+ if (!E->getArg(0)->getType()->hasFloatingRepresentation() ||
+ (E->getArg(0)->getType() != E->getArg(1)->getType()))
+ llvm_unreachable("fmod operands must have the same float representation");
+
+ llvm::Triple::ArchType Arch = CGM.getTarget().getTriple().getArch();
----------------
farzonl wrote:
This is just and FYI because I expect to see this whole block removed, but we don't do this for target switching we us the `CGM.getHLSLRuntime().get<intrinsic_name>Intrinsic()`
https://github.com/llvm/llvm-project/pull/108849
More information about the cfe-commits
mailing list