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

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 09:09:56 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,
----------------
arsenm wrote:

```suggestion
        /*ReturnType=*/ Op0->getType(), Intrinsic::dx_rcp,
```

You're supposed to include the = after the parameter name to get clang-format to recognize it 

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


More information about the cfe-commits mailing list