brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · d708df2 Raw
55 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)));5 6float2 test_no_second_arg(float2 p0) {7  return __builtin_spirv_faceforward(p0);8  // expected-error@-1 {{too few arguments to function call, expected 3, have 1}}9}10 11float2 test_no_third_arg(float2 p0) {12  return __builtin_spirv_faceforward(p0, p0);13  // expected-error@-1 {{too few arguments to function call, expected 3, have 2}}14}15 16float2 test_too_many_arg(float2 p0) {17  return __builtin_spirv_faceforward(p0, p0, p0, p0);18  // expected-error@-1 {{too many arguments to function call, expected 3, have 4}}19}20 21int test_int_scalar_inputs(int p0) {22  return __builtin_spirv_faceforward(p0, p0, p0);23  //  expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}}24}25 26float test_int_scalar_inputs2(float p0, int p1) {27  return __builtin_spirv_faceforward(p0, p1, p1);28  //  expected-error@-1 {{all arguments to '__builtin_spirv_faceforward' must have the same type}}29}30 31float test_int_scalar_inputs3(float p0, int p1) {32  return __builtin_spirv_faceforward(p0, p0, p1);33  //  expected-error@-1 {{all arguments to '__builtin_spirv_faceforward' must have the same type}}34}35 36float test_mismatched_arg(float p0, float2 p1) {37  return __builtin_spirv_faceforward(p0, p1, p1);38  // expected-error@-1 {{all arguments to '__builtin_spirv_faceforward' must have the same type}}39}40 41float test_mismatched_arg2(float p0, float2 p1) {42  return __builtin_spirv_faceforward(p0, p0, p1);43  // expected-error@-1 {{all arguments to '__builtin_spirv_faceforward' must have the same type}}44}45 46float test_mismatched_return(float2 p0) {47  return __builtin_spirv_faceforward(p0, p0, p0);48  // expected-error@-1 {{returning 'float2' (vector of 2 'float' values) from a function with incompatible result type 'float'}}49}50 51float3 test_mismatched_return2(float2 p0) {52  return __builtin_spirv_faceforward(p0, p0, p0);53  // expected-error@-1 {{returning 'float2' (vector of 2 'float' values) from a function with incompatible result type 'float3' (vector of 3 'float' values)}}54}55