[clang] [llvm] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 11:40:10 PDT 2024


================
@@ -1704,6 +1704,20 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_cross: {
+    if (SemaRef.checkArgCount(TheCall, 2))
+      return true;
+    if (CheckVectorElementCallArgs(&SemaRef, TheCall))
+      return true;
+    if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
+      return true;
+
----------------
farzonl wrote:

If thats the case could you add a test to `clang/test/CodeGenHLSL/builtins/cross.hlsl` As long as this gets caugh by an error then we should be good.

```hlsl
float2 builtin_cross_float2(float2  p1, float2  p2)
{
  return __builtin_hlsl_cross(p1, p2);
}
```

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


More information about the cfe-commits mailing list