-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[DirectX] legalize usub.sat #135288
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
[DirectX] legalize usub.sat #135288
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt -S -dxil-intrinsic-expansion -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s | ||
|
||
; Make sure dxil operation function calls for pow are generated. | ||
|
||
define noundef i16 @usub_sat_i16(i16 noundef %a, i16 noundef %b) { | ||
; CHECK-LABEL: define noundef i16 @usub_sat_i16( | ||
; CHECK-SAME: i16 noundef [[A:%.*]], i16 noundef [[B:%.*]]) { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[USUB_CMP:%.*]] = icmp ult i16 [[A]], [[B]] | ||
; CHECK-NEXT: [[USUB_SUB:%.*]] = sub i16 [[A]], [[B]] | ||
; CHECK-NEXT: [[ELT_USUB_SAT:%.*]] = select i1 [[USUB_CMP]], i16 0, i16 [[USUB_SUB]] | ||
; CHECK-NEXT: ret i16 [[ELT_USUB_SAT]] | ||
; | ||
entry: | ||
%elt.usub_sat = call i16 @llvm.usub.sat.i16(i16 %a, i16 %b) | ||
ret i16 %elt.usub_sat | ||
} | ||
|
||
define noundef i32 @usub_sat_i32(i32 noundef %a, i32 noundef %b) { | ||
; CHECK-LABEL: define noundef i32 @usub_sat_i32( | ||
; CHECK-SAME: i32 noundef [[A:%.*]], i32 noundef [[B:%.*]]) { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[USUB_CMP:%.*]] = icmp ult i32 [[A]], [[B]] | ||
; CHECK-NEXT: [[USUB_SUB:%.*]] = sub i32 [[A]], [[B]] | ||
; CHECK-NEXT: [[ELT_USUB_SAT:%.*]] = select i1 [[USUB_CMP]], i32 0, i32 [[USUB_SUB]] | ||
; CHECK-NEXT: ret i32 [[ELT_USUB_SAT]] | ||
; | ||
entry: | ||
%elt.usub_sat = call i32 @llvm.usub.sat.i32(i32 %a, i32 %b) | ||
ret i32 %elt.usub_sat | ||
} | ||
|
||
define noundef i64 @usub_sat_i64(i64 noundef %a, i64 noundef %b) { | ||
; CHECK-LABEL: define noundef i64 @usub_sat_i64( | ||
; CHECK-SAME: i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[USUB_CMP:%.*]] = icmp ult i64 [[A]], [[B]] | ||
; CHECK-NEXT: [[USUB_SUB:%.*]] = sub i64 [[A]], [[B]] | ||
; CHECK-NEXT: [[ELT_USUB_SAT:%.*]] = select i1 [[USUB_CMP]], i64 0, i64 [[USUB_SUB]] | ||
; CHECK-NEXT: ret i64 [[ELT_USUB_SAT]] | ||
; | ||
entry: | ||
%elt.usub_sat = call i64 @llvm.usub.sat.i64(i64 %a, i64 %b) | ||
ret i64 %elt.usub_sat | ||
} | ||
|
||
define noundef <4 x i32> @usub_sat_vec(<4 x i32> noundef %a, <4 x i32> noundef %b) { | ||
; CHECK-LABEL: define noundef <4 x i32> @usub_sat_vec( | ||
; CHECK-SAME: <4 x i32> noundef [[A:%.*]], <4 x i32> noundef [[B:%.*]]) { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[USUB_CMP:%.*]] = icmp ult <4 x i32> [[A]], [[B]] | ||
; CHECK-NEXT: [[USUB_SUB:%.*]] = sub <4 x i32> [[A]], [[B]] | ||
; CHECK-NEXT: [[ELT_USUB_SAT:%.*]] = select <4 x i1> [[USUB_CMP]], <4 x i32> zeroinitializer, <4 x i32> [[USUB_SUB]] | ||
; CHECK-NEXT: ret <4 x i32> [[ELT_USUB_SAT]] | ||
; | ||
entry: | ||
%elt.usub_sat = call <4 x i32> @llvm.usub.sat.v4i32(<4 x i32> %a, <4 x i32> %b) | ||
ret <4 x i32> %elt.usub_sat | ||
} |
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.
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.
Is it possible to make the spacing consistent in these Check lines?
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.
its tool generated. I tried changing it and see if the tool would leave it alone, but the next run of update_test_checks.py changes the formatting back