1
- // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
1
+ // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected=note
2
2
3
3
float2 test_no_second_arg (float2 p0) {
4
4
return __builtin_hlsl_elementwise_clamp (p0);
@@ -22,52 +22,55 @@ float2 test_clamp_no_second_arg(float2 p0) {
22
22
23
23
float2 test_clamp_vector_size_mismatch (float3 p0, float2 p1) {
24
24
return clamp (p0, p0, p1);
25
- // expected-error@-1 {{call to 'clamp' is ambiguous}}
25
+ // expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
26
+ // expected-warning@-2 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
26
27
}
27
28
28
29
float2 test_clamp_builtin_vector_size_mismatch (float3 p0, float2 p1) {
29
30
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
30
31
// expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type}}
31
32
}
32
33
34
+ // allowed by the overloads in hlsl_compat_overloads.h
35
+ // support for this overload might be removed in a future version of hlsl
33
36
float test_clamp_scalar_mismatch (float p0, half p1) {
34
37
return clamp (p1, p0, p1);
35
- // expected-error@-1 {{call to 'clamp' is ambiguous}}
36
38
}
37
39
40
+ // allowed by the overloads in hlsl_compat_overloads.h
41
+ // support for this overload might be removed in a future version of hlsl
38
42
float2 test_clamp_element_type_mismatch (half2 p0, float2 p1) {
39
43
return clamp (p1, p0, p1);
40
- // expected-error@-1 {{call to 'clamp' is ambiguous}}
41
44
}
42
45
43
46
float2 test_builtin_clamp_float2_splat (float p0, float2 p1) {
44
47
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
45
- // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors }}
48
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
46
49
}
47
50
48
51
float3 test_builtin_clamp_float3_splat (float p0, float3 p1) {
49
52
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
50
- // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors }}
53
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
51
54
}
52
55
53
56
float4 test_builtin_clamp_float4_splat (float p0, float4 p1) {
54
57
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
55
- // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors }}
58
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
56
59
}
57
60
58
61
float2 test_clamp_float2_int_splat (float2 p0, int p1) {
59
62
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
60
- // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors }}
63
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
61
64
}
62
65
63
66
float3 test_clamp_float3_int_splat (float3 p0, int p1) {
64
67
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
65
- // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors }}
68
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
66
69
}
67
70
68
71
float2 test_builtin_clamp_int_vect_to_float_vec_promotion (int2 p0, float p1) {
69
72
return __builtin_hlsl_elementwise_clamp (p0, p1, p1);
70
- // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors }}
73
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
71
74
}
72
75
73
76
float test_builtin_clamp_bool_type_promotion (bool p0) {
@@ -77,15 +80,15 @@ float test_builtin_clamp_bool_type_promotion(bool p0) {
77
80
78
81
float builtin_bool_to_float_type_promotion (float p0, bool p1) {
79
82
return __builtin_hlsl_elementwise_clamp (p0, p0, p1);
80
- // expected-error@-1 {{3rd argument must be a floating point type (was 'bool') }}
83
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
81
84
}
82
85
83
86
float builtin_bool_to_float_type_promotion2 (bool p0, float p1) {
84
87
return __builtin_hlsl_elementwise_clamp (p1, p0, p1);
85
- // expected-error@-1 {{2nd argument must be a floating point type (was 'bool') }}
88
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
86
89
}
87
90
88
91
float builtin_clamp_int_to_float_promotion (float p0, int p1) {
89
92
return __builtin_hlsl_elementwise_clamp (p0, p0, p1);
90
- // expected-error@-1 {{3rd argument must be a floating point type (was 'int') }}
93
+ // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type }}
91
94
}
0 commit comments