|
1 |
| -// RUN: %clang_cc1 -finclude-default-header |
2 |
| -// -triple dxil-pc-shadermodel6.6-library %s -emit-llvm-only |
3 |
| -// -disable-llvm-passes -verify -verify-ignore-unexpected |
| 1 | +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -emit-llvm-only -disable-llvm-passes -verify |
4 | 2 |
|
5 |
| -int test_no_arg() { |
6 |
| - return select(); |
7 |
| - // expected-error@-1 {{no matching function for call to 'select'}} |
8 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template |
9 |
| - // not viable: requires 3 arguments, but 0 were provided}} |
10 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
11 |
| - // viable: requires 3 arguments, but 0 were provided}} |
12 |
| -} |
13 |
| - |
14 |
| -int test_too_few_args(bool p0) { |
15 |
| - return select(p0); |
16 |
| - // expected-error@-1 {{no matching function for call to 'select'}} |
17 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
18 |
| - // viable: requires 3 arguments, but 1 was provided}} |
19 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
20 |
| - // viable: requires 3 arguments, but 1 was provided}} |
21 |
| -} |
22 |
| - |
23 |
| -int test_too_many_args(bool p0, int t0, int f0, int g0) { |
24 |
| - return select<int>(p0, t0, f0, g0); |
25 |
| - // expected-error@-1 {{no matching function for call to 'select'}} |
26 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
27 |
| - // viable: requires 3 arguments, but 4 were provided}} |
28 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
29 |
| - // viable: requires 3 arguments, but 4 were provided}} |
30 |
| -} |
31 | 3 |
|
32 | 4 | int test_select_first_arg_wrong_type(int1 p0, int t0, int f0) {
|
33 | 5 | return select(p0, t0, f0);
|
34 |
| - // expected-error@-1 {{no matching function for call to 'select'}} |
35 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
36 |
| - // viable: no known conversion from 'vector<int, 1>' (vector of 1 'int' value) |
37 |
| - // to 'bool' for 1st argument}} |
38 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: could |
39 |
| - // not match 'vector<T, Sz>' against 'int'}} |
40 | 6 | }
|
41 | 7 |
|
42 | 8 | int1 test_select_bool_vals_diff_vecs(bool p0, int1 t0, int1 f0) {
|
43 | 9 | return select<int1>(p0, t0, f0);
|
44 |
| - // expected-warning@-1 {{implicit conversion truncates vector: |
45 |
| - // 'vector<int, 2>' (vector of 2 'int' values) to 'vector<int, 1>' |
46 |
| - // (vector of 1 'int' value)}} |
47 | 10 | }
|
48 | 11 |
|
49 | 12 | int2 test_select_vector_vals_not_vecs(bool2 p0, int t0,
|
50 | 13 | int f0) {
|
51 | 14 | return select(p0, t0, f0);
|
52 |
| - // expected-error@-1 {{no matching function for call to 'select'}} |
53 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: |
54 |
| - // could not match 'vector<T, Sz>' against 'int'}} |
55 |
| - // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not |
56 |
| - // viable: no known conversion from 'vector<bool, 2>' |
57 |
| - // (vector of 2 'bool' values) to 'bool' for 1st argument}} |
58 | 15 | }
|
59 | 16 |
|
60 | 17 | int1 test_select_vector_vals_wrong_size(bool2 p0, int1 t0, int1 f0) {
|
61 |
| - return select<int,1>(p0, t0, f0); // produce warnings |
62 |
| - // expected-warning@-1 {{implicit conversion truncates vector: |
63 |
| - // 'vector<bool, 2>' (vector of 2 'bool' values) to 'vector<bool, 1>' |
64 |
| - // (vector of 1 'bool' value)}} |
65 |
| - // expected-warning@-2 {{implicit conversion truncates vector: |
66 |
| - // 'vector<int, 2>' (vector of 2 'int' values) to 'vector<int, 1>' |
67 |
| - // (vector of 1 'int' value)}} |
| 18 | + return select<int,1>(p0, t0, f0); // expected-warning{{implicit conversion truncates vector: 'bool2' (aka 'vector<bool, 2>') to 'vector<bool, 1>' (vector of 1 'bool' value)}} |
| 19 | +} |
| 20 | + |
| 21 | +int test_select_no_args() { |
| 22 | + return __builtin_hlsl_select(); // expected-error{{too few arguments to function call, expected 3, have 0}} |
| 23 | +} |
| 24 | + |
| 25 | +int test_select_builtin_wrong_arg_count(bool p0) { |
| 26 | + return __builtin_hlsl_select(p0); // expected-error{{too few arguments to function call, expected 3, have 1}} |
68 | 27 | }
|
69 | 28 |
|
70 | 29 | // __builtin_hlsl_select tests
|
71 |
| -int test_select_builtin_wrong_arg_count(bool p0, int t0) { |
72 |
| - return __builtin_hlsl_select(p0, t0); |
73 |
| - // expected-error@-1 {{too few arguments to function call, expected 3, |
74 |
| - // have 2}} |
| 30 | +int test_select_builtin_wrong_arg_count2(bool p0, int t0) { |
| 31 | + return __builtin_hlsl_select(p0, t0); // expected-error{{too few arguments to function call, expected 3, have 2}} |
| 32 | +} |
| 33 | + |
| 34 | +int test_too_many_args(bool p0, int t0, int f0, int g0) { |
| 35 | + return __builtin_hlsl_select(p0, t0, f0, g0); // expected-error{{too many arguments to function call, expected 3, have 4}} |
75 | 36 | }
|
76 | 37 |
|
77 | 38 | // not a bool or a vector of bool. should be 2 errors.
|
78 | 39 | int test_select_builtin_first_arg_wrong_type1(int p0, int t0, int f0) {
|
79 |
| - return __builtin_hlsl_select(p0, t0, f0); |
80 |
| - // expected-error@-1 {{passing 'int' to parameter of incompatible type |
81 |
| - // 'bool'}} |
82 |
| - // expected-error@-2 {{First argument to __builtin_hlsl_select must be of |
83 |
| - // vector type}} |
84 |
| - } |
| 40 | + return __builtin_hlsl_select(p0, t0, f0); // expected-error{{invalid operand of type 'int' where 'bool' or a vector of such type is required}} |
| 41 | +} |
85 | 42 |
|
86 | 43 | int test_select_builtin_first_arg_wrong_type2(int1 p0, int t0, int f0) {
|
87 |
| - return __builtin_hlsl_select(p0, t0, f0); |
88 |
| - // expected-error@-1 {{passing 'vector<int, 1>' (vector of 1 'int' value) to |
89 |
| - // parameter of incompatible type 'bool'}} |
90 |
| - // expected-error@-2 {{First argument to __builtin_hlsl_select must be of |
91 |
| - // vector type}} |
| 44 | + return __builtin_hlsl_select(p0, t0, f0); // expected-error{{invalid operand of type 'int1' (aka 'vector<int, 1>') where 'bool' or a vector of such type is required}} |
92 | 45 | }
|
93 | 46 |
|
94 | 47 | // if a bool last 2 args are of same type
|
95 | 48 | int test_select_builtin_bool_incompatible_args(bool p0, int t0, double f0) {
|
96 |
| - return __builtin_hlsl_select(p0, t0, f0); |
97 |
| - // expected-error@-1 {{arguments are of different types ('int' vs 'double')}} |
| 49 | + return __builtin_hlsl_select(p0, t0, f0); // expected-error{{arguments are of different types ('int' vs 'double')}} |
98 | 50 | }
|
99 | 51 |
|
100 | 52 | // if a vector second arg isnt a vector
|
101 | 53 | int2 test_select_builtin_second_arg_not_vector(bool2 p0, int t0, int2 f0) {
|
102 | 54 | return __builtin_hlsl_select(p0, t0, f0);
|
103 |
| - // expected-error@-1 {{Second argument to __builtin_hlsl_select must be of |
104 |
| - // vector type}} |
105 | 55 | }
|
106 | 56 |
|
107 | 57 | // if a vector third arg isn't a vector
|
108 | 58 | int2 test_select_builtin_second_arg_not_vector(bool2 p0, int2 t0, int f0) {
|
109 | 59 | return __builtin_hlsl_select(p0, t0, f0);
|
110 |
| - // expected-error@-1 {{Third argument to __builtin_hlsl_select must be of |
111 |
| - // vector type}} |
112 | 60 | }
|
113 | 61 |
|
114 | 62 | // if vector last 2 aren't same type (so both are vectors but wrong type)
|
115 |
| -int2 test_select_builtin_diff_types(bool1 p0, int1 t0, float1 f0) { |
116 |
| - return __builtin_hlsl_select(p0, t0, f0); |
117 |
| - // expected-error@-1 {{arguments are of different types ('vector<int, [...]>' |
118 |
| - // vs 'vector<float, [...]>')}} |
| 63 | +int1 test_select_builtin_diff_types(bool1 p0, int1 t0, float1 f0) { |
| 64 | + return __builtin_hlsl_select(p0, t0, f0); // expected-error{{second and third arguments to __builtin_hlsl_select must be of scalar or vector type with matching scalar element type: 'vector<int, [...]>' vs 'vector<float, [...]>'}} |
119 | 65 | }
|
0 commit comments