[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 07:39:43 PDT 2024


================
@@ -18901,6 +18901,150 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
         CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef<Value *>{Op0},
         nullptr, "hlsl.radians");
   }
+  // This should only be called when targeting DXIL
+  case Builtin::BI__builtin_hlsl_splitdouble: {
+
+    assert((E->getArg(0)->getType()->hasFloatingRepresentation() &&
+            E->getArg(1)->getType()->hasUnsignedIntegerRepresentation() &&
+            E->getArg(2)->getType()->hasUnsignedIntegerRepresentation()) &&
+           "asuint operands types mismatch");
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    const HLSLOutArgExpr *OutArg1 = dyn_cast<HLSLOutArgExpr>(E->getArg(1));
+    const HLSLOutArgExpr *OutArg2 = dyn_cast<HLSLOutArgExpr>(E->getArg(2));
----------------
llvm-beanz wrote:

nit:
```suggestion
    const auto *OutArg1 = dyn_cast<HLSLOutArgExpr>(E->getArg(1));
    const auto *OutArg2 = dyn_cast<HLSLOutArgExpr>(E->getArg(2));
```

https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable

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


More information about the cfe-commits mailing list