Skip to content

[HLSL][DXIL] Implement refract intrinsic #147342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions clang/lib/CodeGen/TargetBuiltins/SPIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID,
E->getArg(1)->getType()->hasFloatingRepresentation() &&
E->getArg(2)->getType()->isFloatingType() &&
"refract operands must have a float representation");
assert(E->getArg(0)->getType()->isVectorType() &&
E->getArg(1)->getType()->isVectorType() &&
"refract I and N operands must be a vector");
return Builder.CreateIntrinsic(
/*ReturnType=*/I->getType(), Intrinsic::spv_refract,
ArrayRef<Value *>{I, N, eta}, nullptr, "spv.refract");
Expand Down
8 changes: 0 additions & 8 deletions clang/lib/Headers/hlsl/hlsl_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ template <typename T> struct is_arithmetic {
static const bool Value = __is_arithmetic(T);
};

template <typename T> struct is_vector {
static const bool value = false;
};

template <typename T, int N> struct is_vector<vector<T, N>> {
static const bool value = true;
};

template <typename T, int N>
using HLSL_FIXED_VECTOR =
vector<__detail::enable_if_t<(N > 1 && N <= 4), T>, N>;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ constexpr vector<T, L> reflect_vec_impl(vector<T, L> I, vector<T, L> N) {

template <typename T, typename U> constexpr T refract_impl(T I, T N, U Eta) {
#if (__has_builtin(__builtin_spirv_refract))
if (is_vector<T>::value)
return __builtin_spirv_refract(I, N, Eta);
return __builtin_spirv_refract(I, N, Eta);
#endif
T Mul = dot(N, I);
T K = 1 - Eta * Eta * (1 - Mul * Mul);
Expand Down
21 changes: 21 additions & 0 deletions clang/lib/Sema/SemaSPIRV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,27 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(const TargetInfo &TI,
if (CheckAllArgTypesAreCorrect(&SemaRef, TheCall,
llvm::ArrayRef(ChecksArr)))
return true;
// Check that first two arguments are vectors of the same type
QualType Arg0Type = TheCall->getArg(0)->getType();
if (!SemaRef.getASTContext().hasSameUnqualifiedType(
Arg0Type, TheCall->getArg(1)->getType()))
return SemaRef.Diag(TheCall->getBeginLoc(),
diag::err_vec_builtin_incompatible_vector)
<< TheCall->getDirectCallee() << /* first two */ 0
<< SourceRange(TheCall->getArg(0)->getBeginLoc(),
TheCall->getArg(1)->getEndLoc());

// Check that scalar type of 3rd arg is same as base type of first two args
clang::QualType BaseType =
Arg0Type->isVectorType()
? Arg0Type->castAs<clang::VectorType>()->getElementType()
: Arg0Type;
if (!SemaRef.getASTContext().hasSameUnqualifiedType(
BaseType, TheCall->getArg(2)->getType()))
return SemaRef.Diag(TheCall->getBeginLoc(),
diag::err_hlsl_builtin_scalar_vector_mismatch)
<< /* all */ 0 << TheCall->getDirectCallee() << Arg0Type
<< TheCall->getArg(2)->getType();

QualType RetTy = TheCall->getArg(0)->getType();
TheCall->setType(RetTy);
Expand Down
47 changes: 10 additions & 37 deletions clang/test/CodeGenHLSL/builtins/refract.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,8 @@
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) half @_Z17test_refract_halfDhDhDh(
// SPVCHECK-SAME: half noundef nofpclass(nan inf) [[I:%.*]], half noundef nofpclass(nan inf) [[N:%.*]], half noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]]
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[MUL_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half %{{.*}}, %{{.*}}
// SPVCHECK: [[MUL1_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half %{{.*}}, %{{.*}}
// SPVCHECK: [[MUL2_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half %{{.*}}, %{{.*}}
// SPVCHECK: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn half 0xH3C00, [[MUL2_I]]
// SPVCHECK: [[MUL3_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half [[MUL1_I]], [[SUB_I]]
// SPVCHECK: [[SUB4_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn half 0xH3C00, [[MUL3_I]]
// SPVCHECK: [[MUL5_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half %{{.*}}, %{{.*}}
// SPVCHECK: [[MUL6_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half %{{.*}}, %{{.*}}
// SPVCHECK: [[TMP18:%.*]] = call reassoc nnan ninf nsz arcp afn half @llvm.sqrt.f16(half %{{.*}})
// SPVCHECK: [[ADD_I:%.*]] = fadd reassoc nnan ninf nsz arcp afn half [[MUL6_I]], [[TMP18]]
// SPVCHECK: [[MUL7_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn half [[ADD_I]], %{{.*}}
// SPVCHECK: [[SUB8_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn half [[MUL5_I]], [[MUL7_I]]
// SPVCHECK: [[CMP_I:%.*]] = fcmp reassoc nnan ninf nsz arcp afn olt half %{{.*}}, 0xH0000
// SPVCHECK: [[HLSL_SELECT_I:%.*]] = select reassoc nnan ninf nsz arcp afn i1 [[CMP_I]], half 0xH0000, half %{{.*}}
// SPVCHECK: ret half [[HLSL_SELECT_I]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef half @llvm.spv.refract.f16.f16(half %{{.*}}, half %{{.*}}, half %{{.*}})
// SPVCHECK: ret half [[SPV_REFRACT_I]]
//
half test_refract_half(half I, half N, half ETA) {
return refract(I, N, ETA);
Expand Down Expand Up @@ -70,7 +57,7 @@ half test_refract_half(half I, half N, half ETA) {
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <2 x half> @_Z18test_refract_half2Dv2_DhS_Dh(
// SPVCHECK-SAME: <2 x half> noundef nofpclass(nan inf) [[I:%.*]], <2 x half> noundef nofpclass(nan inf) [[N:%.*]], half noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <2 x half> @llvm.spv.refract.v2f16(<2 x half> %{{.*}}, <2 x half> %{{.*}}, half %{{.*}})
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <2 x half> @llvm.spv.refract.v2f16.f16(<2 x half> %{{.*}}, <2 x half> %{{.*}}, half %{{.*}})
// SPVCHECK: ret <2 x half> [[SPV_REFRACT_I]]
//
half2 test_refract_half2(half2 I, half2 N, half ETA) {
Expand Down Expand Up @@ -100,7 +87,7 @@ half2 test_refract_half2(half2 I, half2 N, half ETA) {
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <3 x half> @_Z18test_refract_half3Dv3_DhS_Dh(
// SPVCHECK-SAME: <3 x half> noundef nofpclass(nan inf) [[I:%.*]], <3 x half> noundef nofpclass(nan inf) [[N:%.*]], half noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <3 x half> @llvm.spv.refract.v3f16(<3 x half> %{{.*}}, <3 x half> %{{.*}}, half %{{.*}})
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <3 x half> @llvm.spv.refract.v3f16.f16(<3 x half> %{{.*}}, <3 x half> %{{.*}}, half %{{.*}})
// SPVCHECK: ret <3 x half> [[SPV_REFRACT_I]]
//
half3 test_refract_half3(half3 I, half3 N, half ETA) {
Expand Down Expand Up @@ -130,7 +117,7 @@ half3 test_refract_half3(half3 I, half3 N, half ETA) {
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <4 x half> @_Z18test_refract_half4Dv4_DhS_Dh(
// SPVCHECK-SAME: <4 x half> noundef nofpclass(nan inf) [[I:%.*]], <4 x half> noundef nofpclass(nan inf) [[N:%.*]], half noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <4 x half> @llvm.spv.refract.v4f16(<4 x half> %{{.*}}, <4 x half> %{{.*}}, half %{{.*}})
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <4 x half> @llvm.spv.refract.v4f16.f16(<4 x half> %{{.*}}, <4 x half> %{{.*}}, half %{{.*}})
// SPVCHECK: ret <4 x half> [[SPV_REFRACT_I]]
//
half4 test_refract_half4(half4 I, half4 N, half ETA) {
Expand All @@ -156,25 +143,11 @@ half4 test_refract_half4(half4 I, half4 N, half ETA) {
// CHECK: [[HLSL_SELECT_I:%.*]] = select reassoc nnan ninf nsz arcp afn i1 [[CMP_I]], float 0.000000e+00, float %{{.*}}
// CHECK: ret float [[HLSL_SELECT_I]]
//
//
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) float @_Z18test_refract_floatfff(
// SPVCHECK-SAME: float noundef nofpclass(nan inf) [[I:%.*]], float noundef nofpclass(nan inf) [[N:%.*]], float noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[MUL_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, %{{.*}}
// SPVCHECK: [[MUL1_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, %{{.*}}
// SPVCHECK: [[MUL2_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, %{{.*}}
// SPVCHECK: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn float 1.000000e+00, [[MUL2_I]]
// SPVCHECK: [[MUL3_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[MUL1_I]], [[SUB_I]]
// SPVCHECK: [[SUB4_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn float 1.000000e+00, [[MUL3_I]]
// SPVCHECK: [[MUL5_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, %{{.*}}
// SPVCHECK: [[MUL6_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, %{{.*}}
// SPVCHECK: [[TMP18:%.*]] = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32(float %{{.*}})
// SPVCHECK: [[ADD_I:%.*]] = fadd reassoc nnan ninf nsz arcp afn float [[MUL6_I]], [[TMP18]]
// SPVCHECK: [[MUL7_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[ADD_I]], %{{.*}}
// SPVCHECK: [[SUB8_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn float [[MUL5_I]], [[MUL7_I]]
// SPVCHECK: [[CMP_I:%.*]] = fcmp reassoc nnan ninf nsz arcp afn olt float %{{.*}}, 0.000000e+00
// SPVCHECK: [[HLSL_SELECT_I:%.*]] = select reassoc nnan ninf nsz arcp afn i1 [[CMP_I]], float 0.000000e+00, float %{{.*}}
// SPVCHECK: ret float [[HLSL_SELECT_I]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef float @llvm.spv.refract.f32.f32(float %{{.*}}, float %{{.*}}, float %{{.*}})
// SPVCHECK: ret float [[SPV_REFRACT_I]]
//
float test_refract_float(float I, float N, float ETA) {
return refract(I, N, ETA);
Expand Down Expand Up @@ -203,7 +176,7 @@ float test_refract_float(float I, float N, float ETA) {
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <2 x float> @_Z19test_refract_float2Dv2_fS_f(
// SPVCHECK-SAME: <2 x float> noundef nofpclass(nan inf) [[I:%.*]], <2 x float> noundef nofpclass(nan inf) [[N:%.*]], float noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <2 x float> @llvm.spv.refract.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, float %{{.*}})
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <2 x float> @llvm.spv.refract.v2f32.f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, float %{{.*}})
// SPVCHECK: ret <2 x float> [[SPV_REFRACT_I]]
//
float2 test_refract_float2(float2 I, float2 N, float ETA) {
Expand Down Expand Up @@ -233,7 +206,7 @@ float2 test_refract_float2(float2 I, float2 N, float ETA) {
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <3 x float> @_Z19test_refract_float3Dv3_fS_f(
// SPVCHECK-SAME: <3 x float> noundef nofpclass(nan inf) [[I:%.*]], <3 x float> noundef nofpclass(nan inf) [[N:%.*]], float noundef nofpclass(nan inf) [[ETA:%.*]]) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <3 x float> @llvm.spv.refract.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, float %{{.*}})
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <3 x float> @llvm.spv.refract.v3f32.f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, float %{{.*}})
// SPVCHECK: ret <3 x float> [[SPV_REFRACT_I]]
//
float3 test_refract_float3(float3 I, float3 N, float ETA) {
Expand Down Expand Up @@ -263,7 +236,7 @@ float3 test_refract_float3(float3 I, float3 N, float ETA) {
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <4 x float> @_Z19test_refract_float4Dv4_fS_f(
// SPVCHECK-SAME: <4 x float> noundef nofpclass(nan inf) %{{.*}}, <4 x float> noundef nofpclass(nan inf) %{{.*}}, float noundef nofpclass(nan inf) %{{.*}}) #[[ATTR0:[0-9]+]] {
// SPVCHECK: [[ENTRY:.*:]]
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <4 x float> @llvm.spv.refract.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, float %{{.*}})
// SPVCHECK: [[SPV_REFRACT_I:%.*]] = call reassoc nnan ninf nsz arcp afn noundef <4 x float> @llvm.spv.refract.v4f32.f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, float %{{.*}})
// SPVCHECK: ret <4 x float> [[SPV_REFRACT_I]]
//
float4 test_refract_float4(float4 I, float4 N, float ETA) {
Expand Down
6 changes: 3 additions & 3 deletions clang/test/CodeGenSPIRV/Builtins/refract.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ typedef float float4 __attribute__((ext_vector_type(4)));
// CHECK-LABEL: define spir_func <2 x float> @test_refract_float2(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spall should we add f16 tests to this file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah thats probably a good idea to ensure the _Float16 is handled properly in codegen.

// CHECK-SAME: <2 x float> noundef [[I:%.*]], <2 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK: [[SPV_REFRACT:%.*]] = tail call <2 x float> @llvm.spv.refract.v2f32(<2 x float> [[I]], <2 x float> [[N]], float [[ETA]])
// CHECK: [[SPV_REFRACT:%.*]] = tail call <2 x float> @llvm.spv.refract.v2f32.f32(<2 x float> [[I]], <2 x float> [[N]], float [[ETA]])
// CHECK-NEXT: ret <2 x float> [[SPV_REFRACT]]
//
float2 test_refract_float2(float2 I, float2 N, float eta) { return __builtin_spirv_refract(I, N, eta); }

// CHECK-LABEL: define spir_func <3 x float> @test_refract_float3(
// CHECK-SAME: <3 x float> noundef [[I:%.*]], <3 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <3 x float> @llvm.spv.refract.v3f32(<3 x float> [[I]], <3 x float> [[N]], float [[ETA]])
// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <3 x float> @llvm.spv.refract.v3f32.f32(<3 x float> [[I]], <3 x float> [[N]], float [[ETA]])
// CHECK-NEXT: ret <3 x float> [[SPV_REFRACT]]
//
float3 test_refract_float3(float3 I, float3 N, float eta) { return __builtin_spirv_refract(I, N, eta); }

// CHECK-LABEL: define spir_func <4 x float> @test_refract_float4(
// CHECK-SAME: <4 x float> noundef [[I:%.*]], <4 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <4 x float> @llvm.spv.refract.v4f32(<4 x float> [[I]], <4 x float> [[N]], float [[ETA]])
// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <4 x float> @llvm.spv.refract.v4f32.f32(<4 x float> [[I]], <4 x float> [[N]], float [[ETA]])
// CHECK-NEXT: ret <4 x float> [[SPV_REFRACT]]
//
float4 test_refract_float4(float4 I, float4 N, float eta) { return __builtin_spirv_refract(I, N, eta); }
4 changes: 0 additions & 4 deletions clang/test/SemaHLSL/BuiltIns/refract-errors.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ float3 test_mixed_datatype_inputs(float3 p0, float3 p1, half p2) {
return refract(p0, p1, p2);
}

half3 test_mixed_datatype_inputs(half3 p0, half3 p1, float p2) {
return refract(p0, p1, p2);
}

typedef float float5 __attribute__((ext_vector_type(5)));

float5 test_vec5_inputs(float5 p0, float5 p1, float p2) {
Expand Down
18 changes: 18 additions & 0 deletions clang/test/SemaSPIRV/BuiltIns/refract-errors.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 %s -triple spirv-pc-vulkan-compute -verify

typedef float float2 __attribute__((ext_vector_type(2)));
typedef float float3 __attribute__((ext_vector_type(3)));
typedef _Float16 half;
typedef half half2 __attribute__((ext_vector_type(2)));

float2 test_no_third_arg(float2 p0) {
return __builtin_spirv_refract(p0, p0);
Expand All @@ -21,3 +24,18 @@ float test_int_scalar_inputs(int p0, int p1, int p2) {
return __builtin_spirv_refract(p0, p1, p2);
// expected-error@-1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'int')}}
}

float test_float_and_half_inputs(float2 p0, half2 p1, float p2) {
return __builtin_spirv_refract(p0, p1, p2);
// expected-error@-1 {{2nd argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'half2' (vector of 2 'half' values))}}
}

float test_float_and_half_2_inputs(float2 p0, float2 p1, half p2) {
return __builtin_spirv_refract(p0, p1, p2);
// expected-error@-1 {{3rd argument must be a scalar 16 or 32 bit floating-point type (was 'half' (aka '_Float16'))}}
}

float2 test_mismatch_vector_size_inputs(float2 p0, float3 p1, float p2) {
return __builtin_spirv_refract(p0, p1, p2);
// expected-error@-1 {{first two arguments to '__builtin_spirv_refract' must have the same type}}
}
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/IntrinsicsSPIRV.td
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let TargetPrefix = "spv" in {
def int_spv_refract
: DefaultAttrsIntrinsic<[LLVMMatchType<0>],
[llvm_anyfloat_ty, LLVMMatchType<0>,
LLVMVectorElementType<0>],
llvm_anyfloat_ty],
[IntrNoMem]>;
def int_spv_rsqrt : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
def int_spv_saturate : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/SPIRV/hlsl-intrinsics/refract.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: llc -O0 -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}

; Make sure SPIRV operation function calls for refract are lowered correctly.

Expand Down
Loading