Skip to content

Commit 322bb3c

Browse files
committed
SPV attributes
1 parent 729fbf3 commit 322bb3c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

clang/test/CodeGenHLSL/builtins/refract.hlsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ half test_refract_half(half I, half N, half ETA) {
7070
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <2 x half> @_Z18test_refract_half2Dv2_DhS_Dh(
7171
// 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]+]] {
7272
// SPVCHECK: [[ENTRY:.*:]]
73-
// 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 %{{.*}})
73+
// 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 %{{.*}})
7474
// SPVCHECK: ret <2 x half> [[SPV_REFRACT_I]]
7575
//
7676
half2 test_refract_half2(half2 I, half2 N, half ETA) {
@@ -100,7 +100,7 @@ half2 test_refract_half2(half2 I, half2 N, half ETA) {
100100
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <3 x half> @_Z18test_refract_half3Dv3_DhS_Dh(
101101
// 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]+]] {
102102
// SPVCHECK: [[ENTRY:.*:]]
103-
// 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 %{{.*}})
103+
// 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 %{{.*}})
104104
// SPVCHECK: ret <3 x half> [[SPV_REFRACT_I]]
105105
//
106106
half3 test_refract_half3(half3 I, half3 N, half ETA) {
@@ -130,7 +130,7 @@ half3 test_refract_half3(half3 I, half3 N, half ETA) {
130130
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <4 x half> @_Z18test_refract_half4Dv4_DhS_Dh(
131131
// 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]+]] {
132132
// SPVCHECK: [[ENTRY:.*:]]
133-
// 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 %{{.*}})
133+
// 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 %{{.*}})
134134
// SPVCHECK: ret <4 x half> [[SPV_REFRACT_I]]
135135
//
136136
half4 test_refract_half4(half4 I, half4 N, half ETA) {
@@ -203,7 +203,7 @@ float test_refract_float(float I, float N, float ETA) {
203203
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <2 x float> @_Z19test_refract_float2Dv2_fS_f(
204204
// 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]+]] {
205205
// SPVCHECK: [[ENTRY:.*:]]
206-
// 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 %{{.*}})
206+
// 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 %{{.*}})
207207
// SPVCHECK: ret <2 x float> [[SPV_REFRACT_I]]
208208
//
209209
float2 test_refract_float2(float2 I, float2 N, float ETA) {
@@ -233,7 +233,7 @@ float2 test_refract_float2(float2 I, float2 N, float ETA) {
233233
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <3 x float> @_Z19test_refract_float3Dv3_fS_f(
234234
// 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]+]] {
235235
// SPVCHECK: [[ENTRY:.*:]]
236-
// 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 %{{.*}})
236+
// 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 %{{.*}})
237237
// SPVCHECK: ret <3 x float> [[SPV_REFRACT_I]]
238238
//
239239
float3 test_refract_float3(float3 I, float3 N, float ETA) {
@@ -263,7 +263,7 @@ float3 test_refract_float3(float3 I, float3 N, float ETA) {
263263
// SPVCHECK-LABEL: define hidden spir_func noundef nofpclass(nan inf) <4 x float> @_Z19test_refract_float4Dv4_fS_f(
264264
// SPVCHECK-SAME: <4 x float> noundef nofpclass(nan inf) %{{.*}}, <4 x float> noundef nofpclass(nan inf) %{{.*}}, float noundef nofpclass(nan inf) %{{.*}}) #[[ATTR0:[0-9]+]] {
265265
// SPVCHECK: [[ENTRY:.*:]]
266-
// 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 %{{.*}})
266+
// 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 %{{.*}})
267267
// SPVCHECK: ret <4 x float> [[SPV_REFRACT_I]]
268268
//
269269
float4 test_refract_float4(float4 I, float4 N, float ETA) {

clang/test/CodeGenSPIRV/Builtins/refract.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ typedef float float4 __attribute__((ext_vector_type(4)));
77
// CHECK-LABEL: define spir_func <2 x float> @test_refract_float2(
88
// CHECK-SAME: <2 x float> noundef [[I:%.*]], <2 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
99
// CHECK-NEXT: [[ENTRY:.*:]]
10-
// CHECK: [[SPV_REFRACT:%.*]] = tail call <2 x float> @llvm.spv.refract.v2f32.f32(<2 x float> [[I]], <2 x float> [[N]], float [[ETA]])
10+
// CHECK: [[SPV_REFRACT:%.*]] = tail call <2 x float> @llvm.spv.refract.v2f32(<2 x float> [[I]], <2 x float> [[N]], float [[ETA]])
1111
// CHECK-NEXT: ret <2 x float> [[SPV_REFRACT]]
1212
//
1313
float2 test_refract_float2(float2 I, float2 N, float eta) { return __builtin_spirv_refract(I, N, eta); }
1414

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

2323
// CHECK-LABEL: define spir_func <4 x float> @test_refract_float4(
2424
// CHECK-SAME: <4 x float> noundef [[I:%.*]], <4 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] {
2525
// CHECK-NEXT: [[ENTRY:.*:]]
26-
// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <4 x float> @llvm.spv.refract.v4f32.f32(<4 x float> [[I]], <4 x float> [[N]], float [[ETA]])
26+
// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <4 x float> @llvm.spv.refract.v4f32(<4 x float> [[I]], <4 x float> [[N]], float [[ETA]])
2727
// CHECK-NEXT: ret <4 x float> [[SPV_REFRACT]]
2828
//
2929
float4 test_refract_float4(float4 I, float4 N, float eta) { return __builtin_spirv_refract(I, N, eta); }

llvm/include/llvm/IR/IntrinsicsSPIRV.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ let TargetPrefix = "spv" in {
7575
[IntrNoMem] >;
7676
def int_spv_length : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
7777
def int_spv_normalize : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
78+
def int_spv_reflect : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>], [IntrNoMem]>;
7879
def int_spv_refract
7980
: DefaultAttrsIntrinsic<[LLVMMatchType<0>],
8081
[llvm_anyfloat_ty, LLVMMatchType<0>,
81-
llvm_anyfloat_ty],
82+
LLVMVectorElementType<0>],
8283
[IntrNoMem]>;
83-
def int_spv_reflect : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>], [IntrNoMem]>;
84-
def int_spv_rsqrt : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
84+
def int_spv_rsqrt : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
8585
def int_spv_saturate : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
8686
def int_spv_smoothstep : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
8787
def int_spv_step : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [LLVMMatchType<0>, llvm_anyfloat_ty], [IntrNoMem]>;

0 commit comments

Comments
 (0)