[clang-tools-extra] [llvm] [clang] [HLSL] Vector standard conversions (PR #71098)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 11:13:55 PST 2024


================
@@ -4763,6 +4763,20 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
                              CK_ZeroToOCLOpaqueType,
                              From->getValueKind()).get();
     break;
+  case ICK_HLSL_Vector_Truncation: {
+    // Note: HLSL vectors are ExtVectors. Since this truncates a vector to a
+    // smaller vector, this can only operate on arguments where the source and
+    // destination types are ExtVectors.
----------------
llvm-beanz wrote:

HLSL's vector syntax produces ExtVectors. The `vector` type is basically:

```c++
template<typename T, int Sz>
using vector = T __attribute__((ext_vector_type(Sz)));
```

Then all the explicit types are just typedefs off that defined in `hlsl_basic_types.h`.

We haven't explicitly disabled non-Ext vector types in Clang, but they are disabled in DXC. I'm unsure one way or another whether we should explicitly disable them in Clang for HLSL.

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


More information about the cfe-commits mailing list