42 lines · c
1// RUN: %clang_cc1 %s -triple spirv-pc-vulkan-compute -verify2 3typedef float float2 __attribute__((ext_vector_type(2)));4typedef float float3 __attribute__((ext_vector_type(3)));5typedef _Float16 half;6typedef half half2 __attribute__((ext_vector_type(2)));7 8float2 test_no_third_arg(float2 p0) {9 return __builtin_spirv_refract(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, float p1) {14 return __builtin_spirv_refract(p0, p0, p1, p1);15 // expected-error@-1 {{too many arguments to function call, expected 3, have 4}}16}17 18float test_double_scalar_inputs(double p0, double p1, double p2) {19 return __builtin_spirv_refract(p0, p1, p2);20 // expected-error@-1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'double')}}21}22 23float test_int_scalar_inputs(int p0, int p1, int p2) {24 return __builtin_spirv_refract(p0, p1, p2);25 // expected-error@-1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'int')}}26}27 28float test_float_and_half_inputs(float2 p0, half2 p1, float p2) {29 return __builtin_spirv_refract(p0, p1, p2);30 // expected-error@-1 {{first two arguments to '__builtin_spirv_refract' must have the same type}}31}32 33float test_float_and_half_2_inputs(float2 p0, float2 p1, half p2) {34 return __builtin_spirv_refract(p0, p1, p2);35 // expected-error@-1 {{all arguments to '__builtin_spirv_refract' must be of scalar or vector type with matching scalar element type: 'float2' (vector of 2 'float' values) vs 'half' (aka '_Float16')}}36}37 38float2 test_mismatch_vector_size_inputs(float2 p0, float3 p1, float p2) {39 return __builtin_spirv_refract(p0, p1, p2);40 // expected-error@-1 {{first two arguments to '__builtin_spirv_refract' must have the same type}}41}42