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 3float2 test_no_second_arg(float2 p0) { 4 return __builtin_hlsl_elementwise_clamp(p0); 5 // expected-error@-1 {{too few arguments to function call, expected 3, have 1}} 6} 7 8float2 test_no_third_arg(float2 p0) { 9 return __builtin_hlsl_elementwise_clamp(p0, p0); 10 // expected-error@-1 {{too few arguments to function call, expected 3, have 2}} 11} 12 13float2 test_too_many_arg(float2 p0) { 14 return __builtin_hlsl_elementwise_clamp(p0, p0, p0, p0); 15 // expected-error@-1 {{too many arguments to function call, expected 3, have 4}} 16} 17 18float2 test_clamp_no_second_arg(float2 p0) { 19 return clamp(p0); 20 // expected-error@-1 {{no matching function for call to 'clamp'}} 21} 22 23float2 test_clamp_vector_size_mismatch(float3 p0, float2 p1) { 24 return clamp(p0, p0, p1); 25 // expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}} 26} 27 28float2 test_clamp_builtin_vector_size_mismatch(float3 p0, float2 p1) { 29 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 30 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type}} 31} 32 33float test_clamp_scalar_mismatch(float p0, half p1) { 34 return clamp(p1, p0, p1); 35 // expected-error@-1 {{call to 'clamp' is ambiguous}} 36} 37 38float2 test_clamp_element_type_mismatch(half2 p0, float2 p1) { 39 return clamp(p1, p0, p1); 40 // expected-error@-1 {{call to 'clamp' is ambiguous}} 41} 42 43float2 test_builtin_clamp_float2_splat(float p0, float2 p1) { 44 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 45 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}} 46} 47 48float3 test_builtin_clamp_float3_splat(float p0, float3 p1) { 49 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 50 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}} 51} 52 53float4 test_builtin_clamp_float4_splat(float p0, float4 p1) { 54 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 55 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}} 56} 57 58float2 test_clamp_float2_int_splat(float2 p0, int p1) { 59 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 60 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}} 61} 62 63float3 test_clamp_float3_int_splat(float3 p0, int p1) { 64 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 65 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}} 66} 67 68float2 test_builtin_clamp_int_vect_to_float_vec_promotion(int2 p0, float p1) { 69 return __builtin_hlsl_elementwise_clamp(p0, p1, p1); 70 // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}} 71} 72 73float test_builtin_clamp_bool_type_promotion(bool p0) { 74 return __builtin_hlsl_elementwise_clamp(p0, p0, p0); 75 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}} 76} 77 78float builtin_bool_to_float_type_promotion(float p0, bool p1) { 79 return __builtin_hlsl_elementwise_clamp(p0, p0, p1); 80 // expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}} 81} 82 83float builtin_bool_to_float_type_promotion2(bool p0, float p1) { 84 return __builtin_hlsl_elementwise_clamp(p1, p0, p1); 85 // expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}} 86} 87 88float builtin_clamp_int_to_float_promotion(float p0, int p1) { 89 return __builtin_hlsl_elementwise_clamp(p0, p0, p1); 90 // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}} 91} 92