[clang] [llvm] [HLSL] implement the rcp intrinsic (PR #83857)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 09:32:01 PST 2024


================
@@ -18057,6 +18057,14 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
         /*ReturnType*/ Op0->getType(), Intrinsic::dx_frac,
         ArrayRef<Value *>{Op0}, nullptr, "dx.frac");
   }
+  case Builtin::BI__builtin_hlsl_elementwise_rcp: {
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    if (!E->getArg(0)->getType()->hasFloatingRepresentation())
+      llvm_unreachable("rcp operand must have a float representation");
+    return Builder.CreateIntrinsic(
+        /*ReturnType*/ Op0->getType(), Intrinsic::dx_rcp,
----------------
farzonl wrote:

done

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


More information about the cfe-commits mailing list