-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[GlobalISel] Import samesign flag #113090
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
6 commits
Select commit
Hold shift + click to select a range
92ebfd8
[GlobalIsel] Import samesign flag
tschuett 8f4bc64
add poison flag
tschuett 20018c1
address review comments
tschuett d85aaab
address review comments II
tschuett f37bb86
fix typos
tschuett 3affb7c
move file
tschuett 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
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
69 changes: 69 additions & 0 deletions
69
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-samesign.ll
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,69 @@ | ||||
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 | ||||
; RUN: llc -global-isel -mtriple=aarch64-linux-gnu -O0 -stop-after=irtranslator < %s | FileCheck %s | ||||
|
||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
define <2 x i1> @call_icmp_samesign_vector(<2 x i32> %a, <2 x i32> %b) { | ||||
; CHECK-LABEL: name: call_icmp_samesign_vector | ||||
; CHECK: bb.1.entry: | ||||
; CHECK-NEXT: liveins: $d0, $d1 | ||||
; CHECK-NEXT: {{ $}} | ||||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0 | ||||
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1 | ||||
; CHECK-NEXT: %2:_(<2 x s1>) = samesign G_ICMP intpred(ult), [[COPY]](<2 x s32>), [[COPY1]] | ||||
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<2 x s32>) = G_ANYEXT %2(<2 x s1>) | ||||
; CHECK-NEXT: $d0 = COPY [[ANYEXT]](<2 x s32>) | ||||
; CHECK-NEXT: RET_ReallyLR implicit $d0 | ||||
entry: | ||||
%result = icmp samesign ult <2 x i32> %a, %b | ||||
ret <2 x i1> %result | ||||
} | ||||
|
||||
define <2 x i1> @call_icmp_vector(<2 x i32> %a, <2 x i32> %b) { | ||||
; CHECK-LABEL: name: call_icmp_vector | ||||
; CHECK: bb.1.entry: | ||||
; CHECK-NEXT: liveins: $d0, $d1 | ||||
; CHECK-NEXT: {{ $}} | ||||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0 | ||||
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1 | ||||
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s1>) = G_ICMP intpred(ult), [[COPY]](<2 x s32>), [[COPY1]] | ||||
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<2 x s32>) = G_ANYEXT [[ICMP]](<2 x s1>) | ||||
; CHECK-NEXT: $d0 = COPY [[ANYEXT]](<2 x s32>) | ||||
; CHECK-NEXT: RET_ReallyLR implicit $d0 | ||||
entry: | ||||
%result = icmp ult <2 x i32> %a, %b | ||||
ret <2 x i1> %result | ||||
} | ||||
|
||||
define i1 @call_icmp(i32 %a) { | ||||
; CHECK-LABEL: name: call_icmp | ||||
; CHECK: bb.1.entry: | ||||
; CHECK-NEXT: liveins: $w0 | ||||
; CHECK-NEXT: {{ $}} | ||||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0 | ||||
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3 | ||||
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[COPY]](s32), [[C]] | ||||
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT [[ICMP]](s1) | ||||
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ZEXT]](s8) | ||||
; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32) | ||||
; CHECK-NEXT: RET_ReallyLR implicit $w0 | ||||
entry: | ||||
%result = icmp ult i32 %a, 3 | ||||
ret i1 %result | ||||
} | ||||
|
||||
define i1 @call_icmp_samesign(i32 %a) { | ||||
; CHECK-LABEL: name: call_icmp_samesign | ||||
; CHECK: bb.1.entry: | ||||
; CHECK-NEXT: liveins: $w0 | ||||
; CHECK-NEXT: {{ $}} | ||||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0 | ||||
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3 | ||||
; CHECK-NEXT: %2:_(s1) = samesign G_ICMP intpred(ult), [[COPY]](s32), [[C]] | ||||
; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT %2(s1) | ||||
; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ZEXT]](s8) | ||||
; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32) | ||||
; CHECK-NEXT: RET_ReallyLR implicit $w0 | ||||
entry: | ||||
%result = icmp samesign ult i32 %a, 3 | ||||
ret i1 %result | ||||
} |
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,50 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple aarch64 -run-pass=none -verify-machineinstrs %s -o - | FileCheck %s | ||
|
||
|
||
--- | ||
name: icmp_samesign | ||
body: | | ||
bb.0: | ||
liveins: $w0, $w1 | ||
|
||
; CHECK-LABEL: name: icmp_samesign | ||
; CHECK: liveins: $w0, $w1 | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: %x:_(s32) = COPY $w0 | ||
; CHECK-NEXT: %y:_(s32) = COPY $w1 | ||
; CHECK-NEXT: %cmp:_(s1) = samesign G_ICMP intpred(eq), %y(s32), %y | ||
; CHECK-NEXT: %zext:_(s32) = G_ZEXT %cmp(s1) | ||
; CHECK-NEXT: $w0 = COPY %zext(s32) | ||
; CHECK-NEXT: RET_ReallyLR implicit $w0 | ||
%x:_(s32) = COPY $w0 | ||
%y:_(s32) = COPY $w1 | ||
%cmp:_(s1) = samesign G_ICMP intpred(eq), %y:_(s32), %y:_ | ||
%zext:_(s32) = G_ZEXT %cmp:_(s1) | ||
$w0 = COPY %zext | ||
RET_ReallyLR implicit $w0 | ||
|
||
|
||
... | ||
--- | ||
name: icmp_differentsign | ||
body: | | ||
bb.0: | ||
liveins: $w0, $w1 | ||
|
||
; CHECK-LABEL: name: icmp_differentsign | ||
; CHECK: liveins: $w0, $w1 | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: %x:_(s32) = COPY $w0 | ||
; CHECK-NEXT: %y:_(s32) = COPY $w1 | ||
; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), %y | ||
; CHECK-NEXT: %zext:_(s32) = G_ZEXT %cmp(s1) | ||
; CHECK-NEXT: $w0 = COPY %zext(s32) | ||
; CHECK-NEXT: RET_ReallyLR implicit $w0 | ||
%x:_(s32) = COPY $w0 | ||
%y:_(s32) = COPY $w1 | ||
%cmp:_(s1) = G_ICMP intpred(eq), %y:_(s32), %y:_ | ||
%zext:_(s32) = G_ZEXT %cmp:_(s1) | ||
$w0 = COPY %zext | ||
RET_ReallyLR implicit $w0 | ||
--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test needs to go under |
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.