| 1 |
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type -verify |
| 2 |
|
| 3 |
void test_no_second_arg(double D) { |
| 4 |
__builtin_hlsl_elementwise_splitdouble(D); |
| 5 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}} |
| 6 |
} |
| 7 |
|
| 8 |
void test_no_third_arg(double D) { |
| 9 |
uint A; |
| 10 |
__builtin_hlsl_elementwise_splitdouble(D, A); |
| 11 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}} |
| 12 |
} |
| 13 |
|
| 14 |
void test_too_many_arg(double D) { |
| 15 |
uint A, B, C; |
| 16 |
__builtin_hlsl_elementwise_splitdouble(D, A, B, C); |
| 17 |
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}} |
| 18 |
} |
| 19 |
|
| 20 |
void test_first_arg_type_mismatch(bool3 D) { |
| 21 |
uint3 A, B; |
| 22 |
__builtin_hlsl_elementwise_splitdouble(D, A, B); |
| 23 |
// expected-error@-1 {{invalid operand of type 'bool3' (aka 'vector<bool, 3>') where 'double' or a vector of such type is required}} |
| 24 |
} |
| 25 |
|
| 26 |
void test_second_arg_type_mismatch(double D) { |
| 27 |
bool A; |
| 28 |
uint B; |
| 29 |
__builtin_hlsl_elementwise_splitdouble(D, A, B); |
| 30 |
// expected-error@-1 {{invalid operand of type 'bool' where 'unsigned int' or a vector of such type is required}} |
| 31 |
} |
| 32 |
|
| 33 |
void test_third_arg_type_mismatch(double D) { |
| 34 |
bool A; |
| 35 |
uint B; |
| 36 |
__builtin_hlsl_elementwise_splitdouble(D, B, A); |
| 37 |
// expected-error@-1 {{invalid operand of type 'bool' where 'unsigned int' or a vector of such type is required}} |
| 38 |
} |
| 39 |
|
| 40 |
void test_const_second_arg(double D) { |
| 41 |
const uint A = 1; |
| 42 |
uint B; |
| 43 |
__builtin_hlsl_elementwise_splitdouble(D, A, B); |
| 44 |
// expected-error@-1 {{cannot bind non-lvalue argument 'A' to out paramemter}} |
| 45 |
} |
| 46 |
|
| 47 |
void test_const_third_arg(double D) { |
| 48 |
uint A; |
| 49 |
const uint B = 1; |
| 50 |
__builtin_hlsl_elementwise_splitdouble(D, A, B); |
| 51 |
// expected-error@-1 {{cannot bind non-lvalue argument 'B' to out paramemter}} |
| 52 |
} |
| 53 |
|
| 54 |
void test_number_second_arg(double D) { |
| 55 |
uint B; |
| 56 |
__builtin_hlsl_elementwise_splitdouble(D, (uint)1, B); |
| 57 |
// expected-error@-1 {{cannot bind non-lvalue argument '(uint)1' to out paramemter}} |
| 58 |
} |
| 59 |
|
| 60 |
void test_number_third_arg(double D) { |
| 61 |
uint B; |
| 62 |
__builtin_hlsl_elementwise_splitdouble(D, B, (uint)1); |
| 63 |
// expected-error@-1 {{cannot bind non-lvalue argument '(uint)1' to out paramemter}} |
| 64 |
} |
| 65 |
|
| 66 |
void test_expr_second_arg(double D) { |
| 67 |
uint B; |
| 68 |
__builtin_hlsl_elementwise_splitdouble(D, B+1, B); |
| 69 |
// expected-error@-1 {{cannot bind non-lvalue argument 'B + 1' to out paramemter}} |
| 70 |
} |
| 71 |
|
| 72 |
void test_expr_third_arg(double D) { |
| 73 |
uint B; |
| 74 |
__builtin_hlsl_elementwise_splitdouble(D, B, B+1); |
| 75 |
// expected-error@-1 {{cannot bind non-lvalue argument 'B + 1' to out paramemter}} |
| 76 |
} |