[clang] [clang][sema] consolidate diags for incompatible_vector_* (PR #83609)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 11:56:59 PST 2024


================
@@ -38,70 +38,70 @@ float test_dot_element_type_mismatch(int2 p0, float2 p1) {
 //NOTE: for all the *_promotion we are intentionally not handling type promotion in builtins
 float test_builtin_dot_vec_int_to_float_promotion(int2 p0, float2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 
 int64_t test_builtin_dot_vec_int_to_int64_promotion(int64_t2 p0, int2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 
 float test_builtin_dot_vec_half_to_float_promotion(float2 p0, half2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 
 #ifdef __HLSL_ENABLE_16_BIT
 float test_builtin_dot_vec_int16_to_float_promotion(float2 p0, int16_t2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 
 half test_builtin_dot_vec_int16_to_half_promotion(half2 p0, int16_t2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 
 int test_builtin_dot_vec_int16_to_int_promotion(int2 p0, int16_t2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 
 int64_t test_builtin_dot_vec_int16_to_int64_promotion(int64_t2 p0,
                                                       int16_t2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must have vectors of the same type}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must have the same type}}
 }
 #endif
 
 float test_builtin_dot_float2_splat(float p0, float2 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must be vectors}}
 }
 
 float test_builtin_dot_float3_splat(float p0, float3 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must be vectors}}
 }
 
 float test_builtin_dot_float4_splat(float p0, float4 p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must be vectors}}
 }
 
 float test_dot_float2_int_splat(float2 p0, int p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must be vectors}}
 }
 
 float test_dot_float3_int_splat(float3 p0, int p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must be vectors}}
 }
 
 float test_builtin_dot_int_vect_to_float_vec_promotion(int2 p0, float p1) {
   return __builtin_hlsl_dot(p0, p1);
-  // expected-error at -1 {{all arguments to '__builtin_hlsl_dot' must be vectors}}
+  // expected-error at -1 {{first two arguments to '__builtin_hlsl_dot' must be vectors}}
----------------
farzonl wrote:

In this case they mean the same thing because dot only has two arguments. That said this is an easy change. However it means we won't take into account argument length for the diag string just set the bool to always pick all.

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


More information about the cfe-commits mailing list