File: clamp-errors.hlsl

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (91 lines) | stat: -rw-r--r-- 3,734 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// 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

float2 test_no_second_arg(float2 p0) {
  return __builtin_hlsl_elementwise_clamp(p0);
  // expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
}

float2 test_no_third_arg(float2 p0) {
  return __builtin_hlsl_elementwise_clamp(p0, p0);
  // expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
}

float2 test_too_many_arg(float2 p0) {
  return __builtin_hlsl_elementwise_clamp(p0, p0, p0, p0);
  // expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
}

float2 test_clamp_no_second_arg(float2 p0) {
  return clamp(p0);
  // expected-error@-1 {{no matching function for call to 'clamp'}}
}

float2 test_clamp_vector_size_mismatch(float3 p0, float2 p1) {
  return clamp(p0, p0, p1);
  // expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
}

float2 test_clamp_builtin_vector_size_mismatch(float3 p0, float2 p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must have the same type}}
}

float test_clamp_scalar_mismatch(float p0, half p1) {
  return clamp(p1, p0, p1);
  // expected-error@-1 {{call to 'clamp' is ambiguous}}
}

float2 test_clamp_element_type_mismatch(half2 p0, float2 p1) {
  return clamp(p1, p0, p1);
  // expected-error@-1 {{call to 'clamp' is ambiguous}}
}

float2 test_builtin_clamp_float2_splat(float p0, float2 p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}

float3 test_builtin_clamp_float3_splat(float p0, float3 p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}

float4 test_builtin_clamp_float4_splat(float p0, float4 p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}

float2 test_clamp_float2_int_splat(float2 p0, int p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}

float3 test_clamp_float3_int_splat(float3 p0, int p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}

float2 test_builtin_clamp_int_vect_to_float_vec_promotion(int2 p0, float p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p1, p1);
  // expected-error@-1 {{all arguments to '__builtin_hlsl_elementwise_clamp' must be vectors}}
}

float test_builtin_clamp_bool_type_promotion(bool p0) {
  return __builtin_hlsl_elementwise_clamp(p0, p0, p0);
  // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
}

float builtin_bool_to_float_type_promotion(float p0, bool p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p0, p1);
  // expected-error@-1 {{3rd argument must be a floating point type (was 'bool')}}
}

float builtin_bool_to_float_type_promotion2(bool p0, float p1) {
  return __builtin_hlsl_elementwise_clamp(p1, p0, p1);
  // expected-error@-1 {{2nd argument must be a floating point type (was 'bool')}}
}

float builtin_clamp_int_to_float_promotion(float p0, int p1) {
  return __builtin_hlsl_elementwise_clamp(p0, p0, p1);
  // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
}