Skip to content

Commit 3c20a15

Browse files
committed
fix spirv tests
1 parent 40a7d31 commit 3c20a15

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

clang/lib/CodeGen/TargetBuiltins/SPIR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID,
8080
E->getArg(2)->getType()->hasFloatingRepresentation() &&
8181
"FaceForward operands must have a float representation");
8282
return Builder.CreateIntrinsic(
83-
/*ReturnType=*/N->getType(), Intrinsic::spv_smoothstep,
83+
/*ReturnType=*/N->getType(), Intrinsic::spv_faceforward,
8484
ArrayRef<Value *>{N, I, Ng}, /*FMFSource=*/nullptr, "spv.faceforward");
8585
}
8686
}

clang/test/CodeGenHLSL/builtins/faceforward.hlsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, half %{{.*}}, half %fneg.i
1313
// CHECK: ret half %hlsl.select.i
1414
// SPVCHECK-LABEL: test_faceforward_half
15-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef half @llvm.spv.smoothstep.f16(half %{{.*}}, half %{{.*}}, half %{{.*}})
15+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef half @llvm.spv.faceforward.f16(half %{{.*}}, half %{{.*}}, half %{{.*}})
1616
// SPVCHECK: ret half %spv.faceforward.i
1717
half test_faceforward_half(half N, half I, half Ng) { return faceforward(N, I, Ng); }
1818

@@ -23,7 +23,7 @@ half test_faceforward_half(half N, half I, half Ng) { return faceforward(N, I, N
2323
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, <2 x half> %{{.*}}, <2 x half> %fneg.i
2424
// CHECK: ret <2 x half> %hlsl.select.i
2525
// SPVCHECK-LABEL: test_faceforward_half2
26-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <2 x half> @llvm.spv.smoothstep.v2f16(<2 x half> %{{.*}}, <2 x half> %{{.*}}, <2 x half> %{{.*}})
26+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <2 x half> @llvm.spv.faceforward.v2f16(<2 x half> %{{.*}}, <2 x half> %{{.*}}, <2 x half> %{{.*}})
2727
// SPVCHECK: ret <2 x half> %spv.faceforward.i
2828
half2 test_faceforward_half2(half2 N, half2 I, half2 Ng) { return faceforward(N, I, Ng); }
2929

@@ -34,7 +34,7 @@ half2 test_faceforward_half2(half2 N, half2 I, half2 Ng) { return faceforward(N,
3434
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, <3 x half> %{{.*}}, <3 x half> %fneg.i
3535
// CHECK: ret <3 x half> %hlsl.select.i
3636
// SPVCHECK-LABEL: test_faceforward_half3
37-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <3 x half> @llvm.spv.smoothstep.v3f16(<3 x half> %{{.*}}, <3 x half> %{{.*}}, <3 x half> %{{.*}})
37+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <3 x half> @llvm.spv.faceforward.v3f16(<3 x half> %{{.*}}, <3 x half> %{{.*}}, <3 x half> %{{.*}})
3838
// SPVCHECK: ret <3 x half> %spv.faceforward.i
3939
half3 test_faceforward_half3(half3 N, half3 I, half3 Ng) { return faceforward(N, I, Ng); }
4040

@@ -45,7 +45,7 @@ half3 test_faceforward_half3(half3 N, half3 I, half3 Ng) { return faceforward(N,
4545
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, <4 x half> %{{.*}}, <4 x half> %fneg.i
4646
// CHECK: ret <4 x half> %hlsl.select.i
4747
// SPVCHECK-LABEL: test_faceforward_half4
48-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <4 x half> @llvm.spv.smoothstep.v4f16(<4 x half> %{{.*}}, <4 x half> %{{.*}}, <4 x half> %{{.*}})
48+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <4 x half> @llvm.spv.faceforward.v4f16(<4 x half> %{{.*}}, <4 x half> %{{.*}}, <4 x half> %{{.*}})
4949
// SPVCHECK: ret <4 x half> %spv.faceforward.i
5050
half4 test_faceforward_half4(half4 N, half4 I, half4 Ng) { return faceforward(N, I, Ng); }
5151

@@ -56,7 +56,7 @@ half4 test_faceforward_half4(half4 N, half4 I, half4 Ng) { return faceforward(N,
5656
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, float %{{.*}}, float %fneg.i
5757
// CHECK: ret float %hlsl.select.i
5858
// SPVCHECK-LABEL: test_faceforward_float
59-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef float @llvm.spv.smoothstep.f32(float %{{.*}}, float %{{.*}}, float %{{.*}})
59+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef float @llvm.spv.faceforward.f32(float %{{.*}}, float %{{.*}}, float %{{.*}})
6060
// SPVCHECK: ret float %spv.faceforward.i
6161
float test_faceforward_float(float N, float I, float Ng) { return faceforward(N, I, Ng); }
6262

@@ -67,7 +67,7 @@ float test_faceforward_float(float N, float I, float Ng) { return faceforward(N,
6767
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, <2 x float> %{{.*}}, <2 x float> %fneg.i
6868
// CHECK: ret <2 x float> %hlsl.select.i
6969
// SPVCHECK-LABEL: test_faceforward_float2
70-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <2 x float> @llvm.spv.smoothstep.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}})
70+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <2 x float> @llvm.spv.faceforward.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}})
7171
// SPVCHECK: ret <2 x float> %spv.faceforward.i
7272
float2 test_faceforward_float2(float2 N, float2 I, float2 Ng) { return faceforward(N, I, Ng); }
7373

@@ -78,7 +78,7 @@ float2 test_faceforward_float2(float2 N, float2 I, float2 Ng) { return faceforwa
7878
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, <3 x float> %{{.*}}, <3 x float> %fneg.i
7979
// CHECK: ret <3 x float> %hlsl.select.i
8080
// SPVCHECK-LABEL: test_faceforward_float3
81-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <3 x float> @llvm.spv.smoothstep.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}})
81+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <3 x float> @llvm.spv.faceforward.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}})
8282
// SPVCHECK: ret <3 x float> %spv.faceforward.i
8383
float3 test_faceforward_float3(float3 N, float3 I, float3 Ng) { return faceforward(N, I, Ng); }
8484

@@ -89,6 +89,6 @@ float3 test_faceforward_float3(float3 N, float3 I, float3 Ng) { return faceforwa
8989
// CHECK: %hlsl.select.i = select reassoc nnan ninf nsz arcp afn i1 %cmp.i, <4 x float> %{{.*}}, <4 x float> %fneg.i
9090
// CHECK: ret <4 x float> %hlsl.select.i
9191
// SPVCHECK-LABEL: test_faceforward_float4
92-
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <4 x float> @llvm.spv.smoothstep.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
92+
// SPVCHECK: %spv.faceforward.i = call reassoc nnan ninf nsz arcp afn noundef <4 x float> @llvm.spv.faceforward.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
9393
// SPVCHECK: ret <4 x float> %spv.faceforward.i
9494
float4 test_faceforward_float4(float4 N, float4 I, float4 Ng) { return faceforward(N, I, Ng); }

clang/test/CodeGenSPIRV/Builtins/faceforward.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,55 +13,55 @@ typedef float float4 __attribute__((ext_vector_type(4)));
1313
// CHECK-LABEL: define spir_func half @test_faceforward_half(
1414
// CHECK-SAME: half noundef [[N:%.*]], half noundef [[I:%.*]], half noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
1515
// CHECK-NEXT: [[ENTRY:.*:]]
16-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call half @llvm.spv.smoothstep.f16(half [[N]], half [[I]], half [[NG]])
16+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call half @llvm.spv.faceforward.f16(half [[N]], half [[I]], half [[NG]])
1717
// CHECK-NEXT: ret half [[SPV_FACEFORWARD]]
1818
half test_faceforward_half(half N, half I, half Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
1919

2020
// CHECK-LABEL: define spir_func <2 x half> @test_faceforward_half2(
2121
// CHECK-SAME: <2 x half> noundef [[N:%.*]], <2 x half> noundef [[I:%.*]], <2 x half> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
2222
// CHECK-NEXT: [[ENTRY:.*:]]
23-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <2 x half> @llvm.spv.smoothstep.v2f16(<2 x half> [[N]], <2 x half> [[I]], <2 x half> [[NG]])
23+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <2 x half> @llvm.spv.faceforward.v2f16(<2 x half> [[N]], <2 x half> [[I]], <2 x half> [[NG]])
2424
// CHECK-NEXT: ret <2 x half> [[SPV_FACEFORWARD]]
2525
half2 test_faceforward_half2(half2 N, half2 I, half2 Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
2626

2727
// CHECK-LABEL: define spir_func <3 x half> @test_faceforward_half3(
2828
// CHECK-SAME: <3 x half> noundef [[N:%.*]], <3 x half> noundef [[I:%.*]], <3 x half> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
2929
// CHECK-NEXT: [[ENTRY:.*:]]
30-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <3 x half> @llvm.spv.smoothstep.v3f16(<3 x half> [[N]], <3 x half> [[I]], <3 x half> [[NG]])
30+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <3 x half> @llvm.spv.faceforward.v3f16(<3 x half> [[N]], <3 x half> [[I]], <3 x half> [[NG]])
3131
// CHECK-NEXT: ret <3 x half> [[SPV_FACEFORWARD]]
3232
half3 test_faceforward_half3(half3 N, half3 I, half3 Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
3333

3434
// CHECK-LABEL: define spir_func <4 x half> @test_faceforward_half4(
3535
// CHECK-SAME: <4 x half> noundef [[N:%.*]], <4 x half> noundef [[I:%.*]], <4 x half> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
3636
// CHECK-NEXT: [[ENTRY:.*:]]
37-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <4 x half> @llvm.spv.smoothstep.v4f16(<4 x half> [[N]], <4 x half> [[I]], <4 x half> [[NG]])
37+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <4 x half> @llvm.spv.faceforward.v4f16(<4 x half> [[N]], <4 x half> [[I]], <4 x half> [[NG]])
3838
// CHECK-NEXT: ret <4 x half> [[SPV_FACEFORWARD]]
3939
half4 test_faceforward_half4(half4 N, half4 I, half4 Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
4040

4141
// CHECK-LABEL: define spir_func float @test_faceforward_float(
4242
// CHECK-SAME: float noundef [[N:%.*]], float noundef [[I:%.*]], float noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
4343
// CHECK-NEXT: [[ENTRY:.*:]]
44-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call float @llvm.spv.smoothstep.f32(float [[N]], float [[I]], float [[NG]])
44+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call float @llvm.spv.faceforward.f32(float [[N]], float [[I]], float [[NG]])
4545
// CHECK-NEXT: ret float [[SPV_FACEFORWARD]]
4646
float test_faceforward_float(float N, float I, float Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
4747

4848
// CHECK-LABEL: define spir_func <2 x float> @test_faceforward_float2(
4949
// CHECK-SAME: <2 x float> noundef [[N:%.*]], <2 x float> noundef [[I:%.*]], <2 x float> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
5050
// CHECK-NEXT: [[ENTRY:.*:]]
51-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <2 x float> @llvm.spv.smoothstep.v2f32(<2 x float> [[N]], <2 x float> [[I]], <2 x float> [[NG]])
51+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <2 x float> @llvm.spv.faceforward.v2f32(<2 x float> [[N]], <2 x float> [[I]], <2 x float> [[NG]])
5252
// CHECK-NEXT: ret <2 x float> [[SPV_FACEFORWARD]]
5353
float2 test_faceforward_float2(float2 N, float2 I, float2 Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
5454

5555
// CHECK-LABEL: define spir_func <3 x float> @test_faceforward_float3(
5656
// CHECK-SAME: <3 x float> noundef [[N:%.*]], <3 x float> noundef [[I:%.*]], <3 x float> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
5757
// CHECK-NEXT: [[ENTRY:.*:]]
58-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <3 x float> @llvm.spv.smoothstep.v3f32(<3 x float> [[N]], <3 x float> [[I]], <3 x float> [[NG]])
58+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <3 x float> @llvm.spv.faceforward.v3f32(<3 x float> [[N]], <3 x float> [[I]], <3 x float> [[NG]])
5959
// CHECK-NEXT: ret <3 x float> [[SPV_FACEFORWARD]]
6060
float3 test_faceforward_float3(float3 N, float3 I, float3 Ng) { return __builtin_spirv_faceforward(N, I, Ng); }
6161

6262
// CHECK-LABEL: define spir_func <4 x float> @test_faceforward_float4(
6363
// CHECK-SAME: <4 x float> noundef [[N:%.*]], <4 x float> noundef [[I:%.*]], <4 x float> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] {
6464
// CHECK-NEXT: [[ENTRY:.*:]]
65-
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <4 x float> @llvm.spv.smoothstep.v4f32(<4 x float> [[N]], <4 x float> [[I]], <4 x float> [[NG]])
65+
// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <4 x float> @llvm.spv.faceforward.v4f32(<4 x float> [[N]], <4 x float> [[I]], <4 x float> [[NG]])
6666
// CHECK-NEXT: ret <4 x float> [[SPV_FACEFORWARD]]
6767
float4 test_faceforward_float4(float4 N, float4 I, float4 Ng) { return __builtin_spirv_faceforward(N, I, Ng); }

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/faceforward.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ entry:
2222
ret half %spv.faceforward
2323
}
2424

25-
define noundef float @smoothstep_float(float noundef %a, float noundef %b, float noundef %c) {
25+
define noundef float @faceforward_float(float noundef %a, float noundef %b, float noundef %c) {
2626
entry:
2727
; CHECK: %[[#]] = OpFunction %[[#float_32]] None %[[#]]
2828
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#float_32]]

0 commit comments

Comments
 (0)