1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected 2 3float test_no_second_arg(float2 p0) { 4 return __builtin_hlsl_dot(p0); 5 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}} 6} 7 8float test_too_many_arg(float2 p0) { 9 return __builtin_hlsl_dot(p0, p0, p0); 10 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}} 11} 12 13float test_dot_no_second_arg(float2 p0) { 14 return dot(p0); 15 // expected-error@-1 {{no matching function for call to 'dot'}} 16} 17 18float test_dot_vector_size_mismatch(float3 p0, float2 p1) { 19 return dot(p0, p1); 20 // expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}} 21} 22 23float test_dot_builtin_vector_size_mismatch(float3 p0, float2 p1) { 24 return __builtin_hlsl_dot(p0, p1); 25 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 26} 27 28float test_dot_scalar_mismatch(float p0, int p1) { 29 return dot(p0, p1); 30 // expected-error@-1 {{call to 'dot' is ambiguous}} 31} 32 33float test_dot_element_type_mismatch(int2 p0, float2 p1) { 34 return dot(p0, p1); 35 // expected-error@-1 {{call to 'dot' is ambiguous}} 36} 37 38//NOTE: for all the *_promotion we are intentionally not handling type promotion in builtins 39float test_builtin_dot_vec_int_to_float_promotion(int2 p0, float2 p1) { 40 return __builtin_hlsl_dot(p0, p1); 41 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 42} 43 44int64_t test_builtin_dot_vec_int_to_int64_promotion(int64_t2 p0, int2 p1) { 45 return __builtin_hlsl_dot(p0, p1); 46 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 47} 48 49float test_builtin_dot_vec_half_to_float_promotion(float2 p0, half2 p1) { 50 return __builtin_hlsl_dot(p0, p1); 51 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 52} 53 54#ifdef __HLSL_ENABLE_16_BIT 55float test_builtin_dot_vec_int16_to_float_promotion(float2 p0, int16_t2 p1) { 56 return __builtin_hlsl_dot(p0, p1); 57 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 58} 59 60half test_builtin_dot_vec_int16_to_half_promotion(half2 p0, int16_t2 p1) { 61 return __builtin_hlsl_dot(p0, p1); 62 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 63} 64 65int test_builtin_dot_vec_int16_to_int_promotion(int2 p0, int16_t2 p1) { 66 return __builtin_hlsl_dot(p0, p1); 67 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 68} 69 70int64_t test_builtin_dot_vec_int16_to_int64_promotion(int64_t2 p0, 71 int16_t2 p1) { 72 return __builtin_hlsl_dot(p0, p1); 73 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must have the same type}} 74} 75#endif 76 77float test_builtin_dot_float2_splat(float p0, float2 p1) { 78 return __builtin_hlsl_dot(p0, p1); 79 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}} 80} 81 82float test_builtin_dot_float3_splat(float p0, float3 p1) { 83 return __builtin_hlsl_dot(p0, p1); 84 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}} 85} 86 87float test_builtin_dot_float4_splat(float p0, float4 p1) { 88 return __builtin_hlsl_dot(p0, p1); 89 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}} 90} 91 92float test_dot_float2_int_splat(float2 p0, int p1) { 93 return __builtin_hlsl_dot(p0, p1); 94 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}} 95} 96 97float test_dot_float3_int_splat(float3 p0, int p1) { 98 return __builtin_hlsl_dot(p0, p1); 99 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}} 100} 101 102float test_builtin_dot_int_vect_to_float_vec_promotion(int2 p0, float p1) { 103 return __builtin_hlsl_dot(p0, p1); 104 // expected-error@-1 {{all arguments to '__builtin_hlsl_dot' must be vectors}} 105} 106 107int test_builtin_dot_bool_type_promotion(bool p0, bool p1) { 108 return __builtin_hlsl_dot(p0, p1); 109 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}} 110} 111 112double test_dot_double(double2 p0, double2 p1) { 113 return dot(p0, p1); 114 // expected-error@-1 {{call to 'dot' is ambiguous}} 115} 116double test_dot_double_builtin(double2 p0, double2 p1) { 117 return __builtin_hlsl_dot(p0, p1); 118 // expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} 119} 120