[clang] [llvm] [HLSL] Implement f32tof16() intrinsic (PR #172469)

Tim Corringham via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 06:03:28 PST 2026


================
@@ -211,6 +211,58 @@ static Value *handleElementwiseF16ToF32(CodeGenFunction &CGF,
   llvm_unreachable("Intrinsic F16ToF32 not supported by target architecture");
 }
 
+static Value *handleElementwiseF32ToF16(CodeGenFunction &CGF,
+                                        const CallExpr *E) {
+  Value *Op0 = CGF.EmitScalarExpr(E->getArg(0));
+  QualType Op0Ty = E->getArg(0)->getType();
+  llvm::Type *ResType = CGF.IntTy;
+  uint64_t NumElements = 0;
+  if (Op0->getType()->isVectorTy()) {
+    NumElements =
----------------
tcorringham wrote:

Actually NumElements is used when building the ResType for vectors which is used for DXIL too.

https://github.com/llvm/llvm-project/pull/172469


More information about the cfe-commits mailing list