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

Chris B via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 10:53:41 PDT 2024


================
@@ -312,6 +312,8 @@ def err_invalid_vector_long_double_decl_spec : Error<
   "cannot use 'long double' with '__vector'">;
 def err_invalid_vector_complex_decl_spec : Error<
   "cannot use '_Complex' with '__vector'">;
+def err_invalid_vector_size : Error<
+  "expected vector size of '%0', but vector size is '%1'">;
----------------
llvm-beanz wrote:

I'm a little surprised we don't have a similar diagnostic, but it seems that we don't. Maybe we could make a small tweak to an existing message and reuse the message. What if we changed `err_vector_incorrect_num_initializers` to:

```
def err_vector_incorrect_num_initializers : Error<
  "%select{too many|too few}0 elements in vector %select{initialization|operand}3 (expected %1 elements, have %2)">;
```
Then you could add a `0` argument to the one place it is called, and change your new diagnostic to:

```suggestion
def err_incorrect_vector_element_count : Error<
  err_vector_incorrect_num_initializers.Summary>;
```

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


More information about the llvm-commits mailing list