Skip to content

Commit c6a6963

Browse files
committed
[HLSL] Implement a header only distance intrinsic
Addressing RFC comments, replace LangBuiltin with TargetBuiltin
1 parent 222ff18 commit c6a6963

File tree

8 files changed

+264
-3
lines changed

8 files changed

+264
-3
lines changed

clang/include/clang/Basic/BuiltinsSPIRV.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ def SPIRVDistance : Builtin {
1313
let Attributes = [NoThrow, Const];
1414
let Prototype = "void(...)";
1515
}
16+
17+
def SPIRVLength : Builtin {
18+
let Spellings = ["__builtin_spirv_length"];
19+
let Attributes = [NoThrow, Const];
20+
let Prototype = "void(...)";
21+
}

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20487,6 +20487,16 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID,
2048720487
/*ReturnType=*/X->getType()->getScalarType(), Intrinsic::spv_distance,
2048820488
ArrayRef<Value *>{X, Y}, nullptr, "spv.distance");
2048920489
}
20490+
case SPIRV::BI__builtin_spirv_length: {
20491+
Value *X = EmitScalarExpr(E->getArg(0));
20492+
assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
20493+
"length operand must have a float representation");
20494+
assert(E->getArg(0)->getType()->isVectorType() &&
20495+
"length operand must be a vector");
20496+
return Builder.CreateIntrinsic(
20497+
/*ReturnType=*/X->getType()->getScalarType(), Intrinsic::spv_length,
20498+
ArrayRef<Value *>{X}, nullptr, "hlsl.length");
20499+
}
2049020500
}
2049120501
return nullptr;
2049220502
}

clang/lib/Headers/hlsl/hlsl_detail.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,32 @@ length_impl(T X) {
4848
}
4949

5050
template <typename T, int N>
51-
enable_if_t<is_same<float, T>::value || is_same<half, T>::value, T>
51+
constexpr enable_if_t<is_same<float, T>::value || is_same<half, T>::value, T>
5252
length_vec_impl(vector<T, N> X) {
53+
#if (__has_builtin(__builtin_spirv_length))
54+
return __builtin_spirv_length(X);
55+
#else
5356
vector<T, N> XSquared = X * X;
5457
T XSquaredSum = XSquared[0];
5558
[unroll] for (int i = 1; i < N; ++i) XSquaredSum += XSquared[i];
5659
return __builtin_elementwise_sqrt(XSquaredSum);
60+
#endif
61+
}
62+
63+
template <typename T>
64+
constexpr enable_if_t<is_same<float, T>::value || is_same<half, T>::value, T>
65+
distance_impl(T X, T Y) {
66+
return length_impl(X - Y);
67+
}
68+
69+
template <typename T, int N>
70+
constexpr enable_if_t<is_same<float, T>::value || is_same<half, T>::value, T>
71+
distance_vec_impl(vector<T, N> X, vector<T, N> Y) {
72+
#if (__has_builtin(__builtin_spirv_distance))
73+
return __builtin_spirv_distance(X, Y);
74+
#else
75+
return length_vec_impl(X - Y);
76+
#endif
5777
}
5878

5979
} // namespace __detail

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,34 @@ float3 degrees(float3);
871871
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees)
872872
float4 degrees(float4);
873873

874+
//===----------------------------------------------------------------------===//
875+
// distance builtins
876+
//===----------------------------------------------------------------------===//
877+
878+
/// \fn K distance(T X, T Y)
879+
/// \brief Returns a distance scalar between two vectors of \a X and \a Y.
880+
/// \param X The X input value.
881+
/// \param Y The Y input value.
882+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
883+
const inline half distance(half X, half Y) {
884+
return __detail::distance_impl(X, Y);
885+
}
886+
887+
const inline float distance(float X, float Y) {
888+
return __detail::distance_impl(X, Y);
889+
}
890+
891+
template <int N>
892+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
893+
const inline half distance(vector<half, N> X, vector<half, N> Y) {
894+
return __detail::distance_vec_impl(X, Y);
895+
}
896+
897+
template <int N>
898+
const inline float distance(vector<float, N> X, vector<float, N> Y) {
899+
return __detail::distance_vec_impl(X, Y);
900+
}
901+
874902
//===----------------------------------------------------------------------===//
875903
// dot product builtins
876904
//===----------------------------------------------------------------------===//
@@ -1296,11 +1324,13 @@ float4 lerp(float4, float4, float4);
12961324
/// \param x [in] The vector of floats, or a scalar float.
12971325
///
12981326
/// Length is based on the following formula: sqrt(x[0]^2 + x[1]^2 + ...).
1299-
1327+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
13001328
const inline half length(half X) { return __detail::length_impl(X); }
13011329
const inline float length(float X) { return __detail::length_impl(X); }
13021330

1303-
template <int N> const inline half length(vector<half, N> X) {
1331+
template <int N>
1332+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1333+
const inline half length(vector<half, N> X) {
13041334
return __detail::length_vec_impl(X);
13051335
}
13061336

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "clang/Basic/DiagnosticSema.h"
2424
#include "clang/Basic/LLVM.h"
2525
#include "clang/Basic/SourceLocation.h"
26+
#include "clang/Basic/TargetBuiltins.h"
2627
#include "clang/Basic/TargetInfo.h"
2728
#include "clang/Sema/Initialization.h"
2829
#include "clang/Sema/ParsedAttr.h"
@@ -2202,6 +2203,8 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
22022203
return true;
22032204
break;
22042205
}
2206+
case SPIRV::BI__builtin_spirv_distance:
2207+
case SPIRV::BI__builtin_spirv_length:
22052208
case Builtin::BI__builtin_elementwise_acos:
22062209
case Builtin::BI__builtin_elementwise_asin:
22072210
case Builtin::BI__builtin_elementwise_atan:

clang/lib/Sema/SemaSPIRV.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID,
5151
TheCall->setType(RetTy);
5252
break;
5353
}
54+
case SPIRV::BI__builtin_spirv_length: {
55+
if (SemaRef.checkArgCount(TheCall, 1))
56+
return true;
57+
ExprResult A = TheCall->getArg(0);
58+
QualType ArgTyA = A.get()->getType();
59+
auto *VTy = ArgTyA->getAs<VectorType>();
60+
if (VTy == nullptr) {
61+
SemaRef.Diag(A.get()->getBeginLoc(),
62+
diag::err_typecheck_convert_incompatible)
63+
<< ArgTyA
64+
<< SemaRef.Context.getVectorType(ArgTyA, 2, VectorKind::Generic) << 1
65+
<< 0 << 0;
66+
return true;
67+
}
68+
QualType RetTy = VTy->getElementType();
69+
TheCall->setType(RetTy);
70+
break;
71+
}
5472
}
5573
return false;
5674
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2+
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
3+
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
4+
// RUN: -emit-llvm -O1 -o - | FileCheck %s
5+
// RUN: %clang_cc1 -finclude-default-header -triple \
6+
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
7+
// RUN: -emit-llvm -O1 -o - | FileCheck %s --check-prefix=SPVCHECK
8+
9+
// CHECK-LABEL: define noundef half @_Z18test_distance_halfDhDh(
10+
// CHECK-SAME: half noundef [[X:%.*]], half noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
11+
// CHECK-NEXT: [[ENTRY:.*:]]
12+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub half [[X]], [[Y]]
13+
// CHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call noundef half @llvm.fabs.f16(half [[SUB_I]])
14+
// CHECK-NEXT: ret half [[ELT_ABS_I]]
15+
//
16+
// SPVCHECK-LABEL: define spir_func noundef half @_Z18test_distance_halfDhDh(
17+
// SPVCHECK-SAME: half noundef [[X:%.*]], half noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
18+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
19+
// SPVCHECK-NEXT: [[SUB_I:%.*]] = fsub half [[X]], [[Y]]
20+
// SPVCHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call noundef half @llvm.fabs.f16(half [[SUB_I]])
21+
// SPVCHECK-NEXT: ret half [[ELT_ABS_I]]
22+
//
23+
half test_distance_half(half X, half Y) { return distance(X, Y); }
24+
25+
// CHECK-LABEL: define noundef half @_Z19test_distance_half2Dv2_DhS_(
26+
// CHECK-SAME: <2 x half> noundef [[X:%.*]], <2 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
27+
// CHECK-NEXT: [[ENTRY:.*:]]
28+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub <2 x half> [[X]], [[Y]]
29+
// CHECK-NEXT: [[MUL_I:%.*]] = fmul <2 x half> [[SUB_I]], [[SUB_I]]
30+
// CHECK-NEXT: [[RDX_FADD_I:%.*]] = tail call half @llvm.vector.reduce.fadd.v2f16(half 0xH0000, <2 x half> [[MUL_I]])
31+
// CHECK-NEXT: [[TMP0:%.*]] = tail call noundef half @llvm.sqrt.f16(half [[RDX_FADD_I]])
32+
// CHECK-NEXT: ret half [[TMP0]]
33+
//
34+
// SPVCHECK-LABEL: define spir_func noundef half @_Z19test_distance_half2Dv2_DhS_(
35+
// SPVCHECK-SAME: <2 x half> noundef [[X:%.*]], <2 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
36+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
37+
// SPVCHECK-NEXT: [[HLSL_DISTANCE_I:%.*]] = tail call noundef half @llvm.spv.distance.v2f16(<2 x half> [[X]], <2 x half> [[Y]])
38+
// SPVCHECK-NEXT: ret half [[HLSL_DISTANCE_I]]
39+
//
40+
half test_distance_half2(half2 X, half2 Y) { return distance(X, Y); }
41+
42+
// CHECK-LABEL: define noundef half @_Z19test_distance_half3Dv3_DhS_(
43+
// CHECK-SAME: <3 x half> noundef [[X:%.*]], <3 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
44+
// CHECK-NEXT: [[ENTRY:.*:]]
45+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub <3 x half> [[X]], [[Y]]
46+
// CHECK-NEXT: [[MUL_I:%.*]] = fmul <3 x half> [[SUB_I]], [[SUB_I]]
47+
// CHECK-NEXT: [[RDX_FADD_I:%.*]] = tail call half @llvm.vector.reduce.fadd.v3f16(half 0xH0000, <3 x half> [[MUL_I]])
48+
// CHECK-NEXT: [[TMP0:%.*]] = tail call noundef half @llvm.sqrt.f16(half [[RDX_FADD_I]])
49+
// CHECK-NEXT: ret half [[TMP0]]
50+
//
51+
// SPVCHECK-LABEL: define spir_func noundef half @_Z19test_distance_half3Dv3_DhS_(
52+
// SPVCHECK-SAME: <3 x half> noundef [[X:%.*]], <3 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
53+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
54+
// SPVCHECK-NEXT: [[HLSL_DISTANCE_I:%.*]] = tail call noundef half @llvm.spv.distance.v3f16(<3 x half> [[X]], <3 x half> [[Y]])
55+
// SPVCHECK-NEXT: ret half [[HLSL_DISTANCE_I]]
56+
//
57+
half test_distance_half3(half3 X, half3 Y) { return distance(X, Y); }
58+
59+
// CHECK-LABEL: define noundef half @_Z19test_distance_half4Dv4_DhS_(
60+
// CHECK-SAME: <4 x half> noundef [[X:%.*]], <4 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
61+
// CHECK-NEXT: [[ENTRY:.*:]]
62+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub <4 x half> [[X]], [[Y]]
63+
// CHECK-NEXT: [[MUL_I:%.*]] = fmul <4 x half> [[SUB_I]], [[SUB_I]]
64+
// CHECK-NEXT: [[RDX_FADD_I:%.*]] = tail call half @llvm.vector.reduce.fadd.v4f16(half 0xH0000, <4 x half> [[MUL_I]])
65+
// CHECK-NEXT: [[TMP0:%.*]] = tail call noundef half @llvm.sqrt.f16(half [[RDX_FADD_I]])
66+
// CHECK-NEXT: ret half [[TMP0]]
67+
//
68+
// SPVCHECK-LABEL: define spir_func noundef half @_Z19test_distance_half4Dv4_DhS_(
69+
// SPVCHECK-SAME: <4 x half> noundef [[X:%.*]], <4 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
70+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
71+
// SPVCHECK-NEXT: [[HLSL_DISTANCE_I:%.*]] = tail call noundef half @llvm.spv.distance.v4f16(<4 x half> [[X]], <4 x half> [[Y]])
72+
// SPVCHECK-NEXT: ret half [[HLSL_DISTANCE_I]]
73+
//
74+
half test_distance_half4(half4 X, half4 Y) { return distance(X, Y); }
75+
76+
// CHECK-LABEL: define noundef float @_Z19test_distance_floatff(
77+
// CHECK-SAME: float noundef [[X:%.*]], float noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
78+
// CHECK-NEXT: [[ENTRY:.*:]]
79+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub float [[X]], [[Y]]
80+
// CHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call noundef float @llvm.fabs.f32(float [[SUB_I]])
81+
// CHECK-NEXT: ret float [[ELT_ABS_I]]
82+
//
83+
// SPVCHECK-LABEL: define spir_func noundef float @_Z19test_distance_floatff(
84+
// SPVCHECK-SAME: float noundef [[X:%.*]], float noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
85+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
86+
// SPVCHECK-NEXT: [[SUB_I:%.*]] = fsub float [[X]], [[Y]]
87+
// SPVCHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call noundef float @llvm.fabs.f32(float [[SUB_I]])
88+
// SPVCHECK-NEXT: ret float [[ELT_ABS_I]]
89+
//
90+
float test_distance_float(float X, float Y) { return distance(X, Y); }
91+
92+
// CHECK-LABEL: define noundef float @_Z20test_distance_float2Dv2_fS_(
93+
// CHECK-SAME: <2 x float> noundef [[X:%.*]], <2 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
94+
// CHECK-NEXT: [[ENTRY:.*:]]
95+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub <2 x float> [[X]], [[Y]]
96+
// CHECK-NEXT: [[MUL_I:%.*]] = fmul <2 x float> [[SUB_I]], [[SUB_I]]
97+
// CHECK-NEXT: [[RDX_FADD_I:%.*]] = tail call float @llvm.vector.reduce.fadd.v2f32(float 0.000000e+00, <2 x float> [[MUL_I]])
98+
// CHECK-NEXT: [[TMP0:%.*]] = tail call noundef float @llvm.sqrt.f32(float [[RDX_FADD_I]])
99+
// CHECK-NEXT: ret float [[TMP0]]
100+
//
101+
// SPVCHECK-LABEL: define spir_func noundef float @_Z20test_distance_float2Dv2_fS_(
102+
// SPVCHECK-SAME: <2 x float> noundef [[X:%.*]], <2 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
103+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
104+
// SPVCHECK-NEXT: [[HLSL_DISTANCE_I:%.*]] = tail call noundef float @llvm.spv.distance.v2f32(<2 x float> [[X]], <2 x float> [[Y]])
105+
// SPVCHECK-NEXT: ret float [[HLSL_DISTANCE_I]]
106+
//
107+
float test_distance_float2(float2 X, float2 Y) { return distance(X, Y); }
108+
109+
// CHECK-LABEL: define noundef float @_Z20test_distance_float3Dv3_fS_(
110+
// CHECK-SAME: <3 x float> noundef [[X:%.*]], <3 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
111+
// CHECK-NEXT: [[ENTRY:.*:]]
112+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub <3 x float> [[X]], [[Y]]
113+
// CHECK-NEXT: [[MUL_I:%.*]] = fmul <3 x float> [[SUB_I]], [[SUB_I]]
114+
// CHECK-NEXT: [[RDX_FADD_I:%.*]] = tail call float @llvm.vector.reduce.fadd.v3f32(float 0.000000e+00, <3 x float> [[MUL_I]])
115+
// CHECK-NEXT: [[TMP0:%.*]] = tail call noundef float @llvm.sqrt.f32(float [[RDX_FADD_I]])
116+
// CHECK-NEXT: ret float [[TMP0]]
117+
//
118+
// SPVCHECK-LABEL: define spir_func noundef float @_Z20test_distance_float3Dv3_fS_(
119+
// SPVCHECK-SAME: <3 x float> noundef [[X:%.*]], <3 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
120+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
121+
// SPVCHECK-NEXT: [[HLSL_DISTANCE_I:%.*]] = tail call noundef float @llvm.spv.distance.v3f32(<3 x float> [[X]], <3 x float> [[Y]])
122+
// SPVCHECK-NEXT: ret float [[HLSL_DISTANCE_I]]
123+
//
124+
float test_distance_float3(float3 X, float3 Y) { return distance(X, Y); }
125+
126+
// CHECK-LABEL: define noundef float @_Z20test_distance_float4Dv4_fS_(
127+
// CHECK-SAME: <4 x float> noundef [[X:%.*]], <4 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
128+
// CHECK-NEXT: [[ENTRY:.*:]]
129+
// CHECK-NEXT: [[SUB_I:%.*]] = fsub <4 x float> [[X]], [[Y]]
130+
// CHECK-NEXT: [[MUL_I:%.*]] = fmul <4 x float> [[SUB_I]], [[SUB_I]]
131+
// CHECK-NEXT: [[RDX_FADD_I:%.*]] = tail call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> [[MUL_I]])
132+
// CHECK-NEXT: [[TMP0:%.*]] = tail call noundef float @llvm.sqrt.f32(float [[RDX_FADD_I]])
133+
// CHECK-NEXT: ret float [[TMP0]]
134+
//
135+
// SPVCHECK-LABEL: define spir_func noundef float @_Z20test_distance_float4Dv4_fS_(
136+
// SPVCHECK-SAME: <4 x float> noundef [[X:%.*]], <4 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
137+
// SPVCHECK-NEXT: [[ENTRY:.*:]]
138+
// SPVCHECK-NEXT: [[HLSL_DISTANCE_I:%.*]] = tail call noundef float @llvm.spv.distance.v4f32(<4 x float> [[X]], <4 x float> [[Y]])
139+
// SPVCHECK-NEXT: ret float [[HLSL_DISTANCE_I]]
140+
//
141+
float test_distance_float4(float4 X, float4 Y) { return distance(X, Y); }
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify
2+
3+
float test_no_second_arg(float2 p0) {
4+
return distance(p0);
5+
// expected-error@-1 {{no matching function for call to 'distance'}}
6+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 1 was provided}}
7+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 1 was provided}}
8+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 1 was provided}}
9+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 1 was provided}}
10+
}
11+
12+
float test_too_many_arg(float2 p0) {
13+
return distance(p0, p0, p0);
14+
// expected-error@-1 {{no matching function for call to 'distance'}}
15+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 3 were provided}}
16+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function not viable: requires 2 arguments, but 3 were provided}}
17+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 3 were provided}}
18+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires 2 arguments, but 3 were provided}}
19+
}
20+
21+
float test_double_inputs(double p0, double p1) {
22+
return distance(p0, p1);
23+
// expected-error@-1 {{call to 'distance' is ambiguous}}
24+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
25+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
26+
}
27+
28+
float test_int_inputs(int p0, int p1) {
29+
return distance(p0, p1);
30+
// expected-error@-1 {{call to 'distance' is ambiguous}}
31+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
32+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function}}
33+
}

0 commit comments

Comments
 (0)