-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[HLSL] Implement support for HLSL intrinsic - select #107129
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 all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3e0cd3c
implement select intrinsic
spall 52f4f39
tests for select intrinsic
spall 7ff44a8
fix bugs revealed during testing
spall 735b085
move select case above saturate case so saturate falls through correc…
spall f8f4a4e
remove no longer needed todo comments.
spall 4803c5b
address comments on PR. Simplify codegen of hlsl_select because llvm …
spall dc67f0c
remove use of vector from hlsl test code and use corresponding types …
spall 44685a3
address PR comments
spall bdafa1e
make clang-format happy
spall 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
farzonl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
// RUN: -o - | FileCheck %s --check-prefixes=CHECK | ||
|
||
// CHECK-LABEL: test_select_bool_int | ||
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, i32 {{%.*}}, i32 {{%.*}} | ||
// CHECK: ret i32 [[SELECT]] | ||
int test_select_bool_int(bool cond0, int tVal, int fVal) { | ||
return select<int>(cond0, tVal, fVal); | ||
} | ||
|
||
struct S { int a; }; | ||
// CHECK-LABEL: test_select_infer | ||
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, ptr {{%.*}}, ptr {{%.*}} | ||
// CHECK: store ptr [[SELECT]] | ||
// CHECK: ret void | ||
struct S test_select_infer(bool cond0, struct S tVal, struct S fVal) { | ||
return select(cond0, tVal, fVal); | ||
} | ||
|
||
// CHECK-LABEL: test_select_bool_vector | ||
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> {{%.*}} | ||
// CHECK: ret <2 x i32> [[SELECT]] | ||
int2 test_select_bool_vector(bool cond0, int2 tVal, int2 fVal) { | ||
return select<int2>(cond0, tVal, fVal); | ||
} | ||
|
||
// CHECK-LABEL: test_select_vector_1 | ||
// CHECK: [[SELECT:%.*]] = select <1 x i1> {{%.*}}, <1 x i32> {{%.*}}, <1 x i32> {{%.*}} | ||
// CHECK: ret <1 x i32> [[SELECT]] | ||
int1 test_select_vector_1(bool1 cond0, int1 tVals, int1 fVals) { | ||
return select<int,1>(cond0, tVals, fVals); | ||
} | ||
|
||
// CHECK-LABEL: test_select_vector_2 | ||
// CHECK: [[SELECT:%.*]] = select <2 x i1> {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> {{%.*}} | ||
// CHECK: ret <2 x i32> [[SELECT]] | ||
int2 test_select_vector_2(bool2 cond0, int2 tVals, int2 fVals) { | ||
return select<int,2>(cond0, tVals, fVals); | ||
} | ||
|
||
// CHECK-LABEL: test_select_vector_3 | ||
// CHECK: [[SELECT:%.*]] = select <3 x i1> {{%.*}}, <3 x i32> {{%.*}}, <3 x i32> {{%.*}} | ||
// CHECK: ret <3 x i32> [[SELECT]] | ||
int3 test_select_vector_3(bool3 cond0, int3 tVals, int3 fVals) { | ||
return select<int,3>(cond0, tVals, fVals); | ||
} | ||
|
||
// CHECK-LABEL: test_select_vector_4 | ||
// CHECK: [[SELECT:%.*]] = select <4 x i1> {{%.*}}, <4 x i32> {{%.*}}, <4 x i32> {{%.*}} | ||
// CHECK: ret <4 x i32> [[SELECT]] | ||
int4 test_select_vector_4(bool4 cond0, int4 tVals, int4 fVals) { | ||
return select(cond0, tVals, fVals); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.