| 1 |
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type -emit-llvm-only -disable-llvm-passes -verify |
| 2 |
|
| 3 |
uint2 test_too_few_arg() { |
| 4 |
return __builtin_hlsl_adduint64(); |
| 5 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 6 |
} |
| 7 |
|
| 8 |
uint4 test_too_many_arg(uint4 a) { |
| 9 |
return __builtin_hlsl_adduint64(a, a, a); |
| 10 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 11 |
} |
| 12 |
|
| 13 |
uint2 test_mismatched_arg_types(uint2 a, uint4 b) { |
| 14 |
return __builtin_hlsl_adduint64(a, b); |
| 15 |
// expected-error@-1 {{all arguments to '__builtin_hlsl_adduint64' must have the same type}} |
| 16 |
} |
| 17 |
|
| 18 |
uint2 test_bad_num_arg_elements(uint3 a, uint3 b) { |
| 19 |
return __builtin_hlsl_adduint64(a, b); |
| 20 |
// expected-error@-1 {{incorrect number of bits in vector operand (expected a multiple of 64 bits, have 96)}} |
| 21 |
} |
| 22 |
|
| 23 |
uint2 test_scalar_arg_type(uint a) { |
| 24 |
return __builtin_hlsl_adduint64(a, a); |
| 25 |
// expected-error@-1 {{1st argument must be a vector of unsigned integer types (was 'uint' (aka 'unsigned int'))}} |
| 26 |
} |
| 27 |
|
| 28 |
uint2 test_uint64_args(uint16_t2 a) { |
| 29 |
return __builtin_hlsl_adduint64(a, a); |
| 30 |
// expected-error@-1 {{incorrect number of bits in integer (expected 32 bits, have 16)}} |
| 31 |
} |
| 32 |
|
| 33 |
uint2 test_signed_integer_args(int2 a, int2 b) { |
| 34 |
return __builtin_hlsl_adduint64(a, b); |
| 35 |
// expected-error@-1 {{1st argument must be a vector of unsigned integer types (was 'int2' (aka 'vector<int, 2>'))}} |
| 36 |
} |
| 37 |
|
| 38 |
struct S { |
| 39 |
uint2 a; |
| 40 |
}; |
| 41 |
|
| 42 |
uint2 test_incorrect_arg_type(S a) { |
| 43 |
return __builtin_hlsl_adduint64(a, a); |
| 44 |
// expected-error@-1 {{1st argument must be a vector of unsigned integer types (was 'S')}} |
| 45 |
} |
| 46 |
|