-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[HLSL] Make lerp overload tests stricter. NFC #137898
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
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,108 +1,160 @@ | ||
| // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK \ | ||
| // RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx | ||
| // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ | ||
| // RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK \ | ||
| // RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv | ||
|
|
||
| // CHECK-LABEL: test_lerp_double | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) | ||
| // CHECK: ret float %hlsl.lerp | ||
| // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -emit-llvm -O1 -o - | FileCheck %s --check-prefixes=CHECK -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx | ||
| // RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple spirv-unknown-vulkan-compute %s -emit-llvm -O1 -o - | FileCheck %s --check-prefixes=CHECK -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv | ||
|
|
||
| // CHECK: define [[FNATTRS]] float @_Z16test_lerp_doubled( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = fptrunc {{.*}} double [[P0:%.*]] to float | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} float @llvm.[[TARGET]].lerp.f32(float [[CONV]], float [[CONV]], float [[CONV]]) | ||
| // CHECK-NEXT: ret float [[LERP]] | ||
| float test_lerp_double(double p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_double2 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <2 x float> @_Z17test_lerp_double2Dv2_d( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = fptrunc {{.*}} <2 x double> [[P0:%.*]] to <2 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> [[CONV]], <2 x float> [[CONV]], <2 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <2 x float> [[LERP]] | ||
| float2 test_lerp_double2(double2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_double3 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <3 x float> @_Z17test_lerp_double3Dv3_d( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = fptrunc {{.*}} <3 x double> [[P0:%.*]] to <3 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> [[CONV]], <3 x float> [[CONV]], <3 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <3 x float> [[LERP]] | ||
| // | ||
| float3 test_lerp_double3(double3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_double4 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <4 x float> @_Z17test_lerp_double4Dv4_d( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = fptrunc {{.*}} <4 x double> [[P0:%.*]] to <4 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> [[CONV]], <4 x float> [[CONV]], <4 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <4 x float> [[LERP]] | ||
| // | ||
| float4 test_lerp_double4(double4 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) | ||
| // CHECK: ret float %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] float @_Z13test_lerp_inti( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[P0:%.*]] to float | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} float @llvm.[[TARGET]].lerp.f32(float [[CONV]], float [[CONV]], float [[CONV]]) | ||
| // CHECK-NEXT: ret float [[LERP]] | ||
| // | ||
| float test_lerp_int(int p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int2 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <2 x float> @_Z14test_lerp_int2Dv2_i( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp <2 x i32> [[P0:%.*]] to <2 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> [[CONV]], <2 x float> [[CONV]], <2 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <2 x float> [[LERP]] | ||
| // | ||
| float2 test_lerp_int2(int2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int3 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <3 x float> @_Z14test_lerp_int3Dv3_i( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp <3 x i32> [[P0:%.*]] to <3 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> [[CONV]], <3 x float> [[CONV]], <3 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <3 x float> [[LERP]] | ||
| // | ||
| float3 test_lerp_int3(int3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int4 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <4 x float> @_Z14test_lerp_int4Dv4_i( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp <4 x i32> [[P0:%.*]] to <4 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> [[CONV]], <4 x float> [[CONV]], <4 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <4 x float> [[LERP]] | ||
| // | ||
| float4 test_lerp_int4(int4 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) | ||
| // CHECK: ret float %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] float @_Z14test_lerp_uintj( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp i32 [[P0:%.*]] to float | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} float @llvm.[[TARGET]].lerp.f32(float [[CONV]], float [[CONV]], float [[CONV]]) | ||
| // CHECK-NEXT: ret float [[LERP]] | ||
| // | ||
| float test_lerp_uint(uint p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint2 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <2 x float> @_Z15test_lerp_uint2Dv2_j( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp <2 x i32> [[P0:%.*]] to <2 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> [[CONV]], <2 x float> [[CONV]], <2 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <2 x float> [[LERP]] | ||
| // | ||
| float2 test_lerp_uint2(uint2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint3 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <3 x float> @_Z15test_lerp_uint3Dv3_j( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp <3 x i32> [[P0:%.*]] to <3 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> [[CONV]], <3 x float> [[CONV]], <3 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <3 x float> [[LERP]] | ||
| // | ||
| float3 test_lerp_uint3(uint3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint4 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <4 x float> @_Z15test_lerp_uint4Dv4_j( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp <4 x i32> [[P0:%.*]] to <4 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> [[CONV]], <4 x float> [[CONV]], <4 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <4 x float> [[LERP]] | ||
| // | ||
| float4 test_lerp_uint4(uint4 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int64_t | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) | ||
| // CHECK: ret float %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] float @_Z17test_lerp_int64_tl( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp i64 [[P0:%.*]] to float | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} float @llvm.[[TARGET]].lerp.f32(float [[CONV]], float [[CONV]], float [[CONV]]) | ||
| // CHECK-NEXT: ret float [[LERP]] | ||
| // | ||
| float test_lerp_int64_t(int64_t p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int64_t2 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <2 x float> @_Z18test_lerp_int64_t2Dv2_l( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp <2 x i64> [[P0:%.*]] to <2 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> [[CONV]], <2 x float> [[CONV]], <2 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <2 x float> [[LERP]] | ||
| // | ||
| float2 test_lerp_int64_t2(int64_t2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int64_t3 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <3 x float> @_Z18test_lerp_int64_t3Dv3_l( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp <3 x i64> [[P0:%.*]] to <3 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> [[CONV]], <3 x float> [[CONV]], <3 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <3 x float> [[LERP]] | ||
| // | ||
| float3 test_lerp_int64_t3(int64_t3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_int64_t4 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <4 x float> @_Z18test_lerp_int64_t4Dv4_l( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = sitofp <4 x i64> [[P0:%.*]] to <4 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> [[CONV]], <4 x float> [[CONV]], <4 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <4 x float> [[LERP]] | ||
| // | ||
| float4 test_lerp_int64_t4(int64_t4 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint64_t | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) | ||
| // CHECK: ret float %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] float @_Z18test_lerp_uint64_tm( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp i64 [[P0:%.*]] to float | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} float @llvm.[[TARGET]].lerp.f32(float [[CONV]], float [[CONV]], float [[CONV]]) | ||
| // CHECK-NEXT: ret float [[LERP]] | ||
| // | ||
| float test_lerp_uint64_t(uint64_t p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint64_t2 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <2 x float> @_Z19test_lerp_uint64_t2Dv2_m( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp <2 x i64> [[P0:%.*]] to <2 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> [[CONV]], <2 x float> [[CONV]], <2 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <2 x float> [[LERP]] | ||
| // | ||
| float2 test_lerp_uint64_t2(uint64_t2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint64_t3 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <3 x float> @_Z19test_lerp_uint64_t3Dv3_m( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp <3 x i64> [[P0:%.*]] to <3 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> [[CONV]], <3 x float> [[CONV]], <3 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <3 x float> [[LERP]] | ||
| // | ||
| float3 test_lerp_uint64_t3(uint64_t3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // CHECK-LABEL: test_lerp_uint64_t4 | ||
| // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| // CHECK: define [[FNATTRS]] <4 x float> @_Z19test_lerp_uint64_t4Dv4_m( | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[CONV:%.*]] = uitofp <4 x i64> [[P0:%.*]] to <4 x float> | ||
| // CHECK-NEXT: [[LERP:%.*]] = tail call {{.*}} <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> [[CONV]], <4 x float> [[CONV]], <4 x float> [[CONV]]) | ||
| // CHECK-NEXT: ret <4 x float> [[LERP]] | ||
| // | ||
| float4 test_lerp_uint64_t4(uint64_t4 p0) { return lerp(p0, p0, p0); } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need O1 for this you can check for
fptruncoruitofpwithout you just can't do CHECK-NEXT it would have to be all CHECK calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
-disable-llvm-passeswe're testing IR that looks like this:The first check matched the start of the
@_Z16test_lerp_doubledfunction, and the second check matched the second last instruction in@_ZN4hlsl4lerpEddd. This relies on the called function happening to come immediately after the caller, and of course it breaks if we have two tests that call the same overload. In this case we happened not to be.Arguably, we could do
-O0instead and test the following:In this case I could check for fptrunc. Of course, if I want to check that that fptrunc feeds to the call to lerp I need to check for 3 of them.
With
-O1we can write checks that this gives us precisely what we expect in a way that's easy to read, understand, and verify is correct.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is that we would have tests dependent on optimization level. I think in practice these are theoretical concerns but i’m going to make them anyway. First while unlikely this could obscure bugs in our implementation. I would want to confirm these test are correct before optimizations. Second while rare That could mean the next time someone changes what passes run as part of O1 that could change our tests.
We have been doing -O0 for other hlsl source dependent tests so we can take advantage of constexprs. I don’t know why that would be problematic here.
Why cant you just do a CHECK-COUNT?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, these tests are checking that a single function maps to a single intrinsic - unless we start adding passes that replace a target specific intrinsic with another I don't see what could possibly change here.
These are really tests that we have the right set of overloads, and that they map to the obvious implementation. Most, if not all, of the logic that's interesting for these tests is in Sema anyway. The only other kind of bug that these are likely to catch in practice is that we literally lower to the wrong operation. "If you pass in these arguments, it generates something sane - if you pass in those, it's an error".
I guess I'm fine with changing these to be
-O0tests, but that's mostly because I'm 100% convinced it doesn't matter. I definitely do not agree that those prove anything that these don't, and the tests are enough harder to read and write that I do think they're worse from the point of view of reviewability and understanding the code via the tests.FWIW, it's incredibly prevalent in the clang CodeGen tests to use
-O1so that the tests are more readable (as the allocas for stack variables are just generally noisy):Because you can't capture 3 patterns with
CHECK-COUNT? As written, the tests pattern match the result of the fptrunc and make sure it's used in the call to the intrinsic. Since it's the same argument across the board, this keeps things concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline with @farzonl - I've opted to switch this to
-O0to be consistent with many of the other hlsl builtins tests