-
Notifications
You must be signed in to change notification settings - Fork 18k
[GISel] computeKnownBits - add CTLS handling #178063
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
4e451ed
add ctls handling in gisel
stomfaig d6372a0
format
stomfaig ce6ea5b
add tests
stomfaig 4ae324f
more accurate logic
stomfaig 94ab16b
separate out intrinsic tests for cls
stomfaig 8aafe5b
remove unused random imports
stomfaig 6800b31
resolve comments
stomfaig e9e1d39
remove duplicate tests
stomfaig 0bd44dc
No auto
arsenm 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
Some comments aren't visible on the classic Files Changed page.
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
195 changes: 195 additions & 0 deletions
195
llvm/test/CodeGen/AArch64/GlobalISel/knownbits-ctls.mir
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,195 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_givaluetracking_test_checks.py UTC_ARGS: --version 6 | ||
| # RUN: llc -mtriple=aarch64 -passes="print<gisel-value-tracking>" -filetype=null %s 2>&1 | FileCheck %s | ||
|
|
||
| --- | ||
| name: CTLSConst8AmbigousMaxSignbitNum | ||
| body: | | ||
| bb.1: | ||
| ; NOTE: Currently we do not estimate max sign bits in KnownBits, | ||
| ; so while we could get more accurate here, this is currently | ||
| ; not possible. | ||
| ; CHECK-LABEL: name: @CTLSConst8AmbigousMaxSignbitNum | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00110000 SignBits:2 | ||
| ; CHECK-NEXT: %2:_ KnownBits:00001000 SignBits:4 | ||
| ; CHECK-NEXT: %3:_ KnownBits:00??0000 SignBits:2 | ||
| ; CHECK-NEXT: %4:_ KnownBits:00??1000 SignBits:2 | ||
| ; CHECK-NEXT: %5:_ KnownBits:00000??? SignBits:5 | ||
| %0:_(s8) = COPY $b0 | ||
| %1:_(s8) = G_CONSTANT i8 48 | ||
| %2:_(s8) = G_CONSTANT i8 8 | ||
| %3:_(s8) = G_AND %0, %1 | ||
| %4:_(s8) = G_OR %3, %2 | ||
| %5:_(s8) = G_CTLS %4 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSNoKnown8 | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSNoKnown8 | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:0000000000000??? SignBits:13 | ||
| %0:_(s8) = COPY $b0 | ||
| %1:_(s16) = G_CTLS %0 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSNoKnown16 | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSNoKnown16 | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:000000000000???? SignBits:12 | ||
| %0:_(s16) = COPY $h0 | ||
| %1:_(s16) = G_CTLS %0 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSNoKnown32 | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSNoKnown32 | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00000000000????? SignBits:11 | ||
| %0:_(s32) = COPY $s0 | ||
| %1:_(s16) = G_CTLS %0 | ||
| ... | ||
|
|
||
|
|
||
| --- | ||
| name: CTLSHalfKnown8 | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSHalfKnown8 | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00000100 SignBits:5 | ||
| ; CHECK-NEXT: %2:_ KnownBits:00000?00 SignBits:5 | ||
| ; CHECK-NEXT: %3:_ KnownBits:000001?? SignBits:5 | ||
| %0:_(s8) = COPY $b0 | ||
| %1:_(s8) = G_CONSTANT i8 4 | ||
| %2:_(s8) = G_AND %0, %1 | ||
| %3:_(s8) = G_CTLS %2 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSHalfKnown16 | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSHalfKnown16 | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:0000000001000000 SignBits:9 | ||
| ; CHECK-NEXT: %2:_ KnownBits:000000000?000000 SignBits:9 | ||
| ; CHECK-NEXT: %3:_ KnownBits:0000000000001??? SignBits:12 | ||
| %0:_(s16) = COPY $h0 | ||
| %1:_(s16) = G_CONSTANT i16 64 | ||
| %2:_(s16) = G_AND %0, %1 | ||
| %3:_(s16) = G_CTLS %2 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSHalfConst8Zero | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSHalfConst8Zero | ||
| ; CHECK-NEXT: %0:_ KnownBits:00000000 SignBits:8 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00000111 SignBits:5 | ||
| %0:_(s8) = G_CONSTANT i8 0 | ||
| %1:_(s8) = G_CTLS %0 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSHalfConst16Zero | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSHalfConst16Zero | ||
| ; CHECK-NEXT: %0:_ KnownBits:0000000000000000 SignBits:16 | ||
| ; CHECK-NEXT: %1:_ KnownBits:0000000000001111 SignBits:12 | ||
| %0:_(s16) = G_CONSTANT i16 0 | ||
| %1:_(s16) = G_CTLS %0 | ||
| ... | ||
|
|
||
| --- | ||
| name: VectorCTLSConst16Zero | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @VectorCTLSConst16Zero | ||
| ; CHECK-NEXT: %0:_ KnownBits:0000000000000000 SignBits:16 | ||
| ; CHECK-NEXT: %1:_ KnownBits:0000000000000000 SignBits:16 | ||
| ; CHECK-NEXT: %2:_ KnownBits:0000000000001111 SignBits:12 | ||
| %0:_(s16) = G_CONSTANT i16 0 | ||
| %1:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0 | ||
| %3:_(<4 x s16>) = G_CTLS %1 | ||
| ... | ||
|
|
||
| --- | ||
| name: VectorCTLSNoneKnown | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @VectorCTLSNoneKnown | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:0000000000001000 SignBits:12 | ||
| ; CHECK-NEXT: %2:_ KnownBits:???????????????? SignBits:9 | ||
| ; CHECK-NEXT: %3:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %4:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %5:_ KnownBits:000000000000???? SignBits:12 | ||
| %0:_(s16) = COPY $h0 | ||
| %1:_(s16) = G_CONSTANT i16 8 | ||
| %2:_(s16) = G_ASHR %0, %1 | ||
| %3:_(s16) = COPY $h1 | ||
| %4:_(<4 x s16>) = G_BUILD_VECTOR %2, %3, %2, %3 | ||
| %5:_(<4 x s16>) = G_CTLS %4 | ||
| ... | ||
|
|
||
| --- | ||
| name: VectorCTLSHighBitKnown | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @VectorCTLSHighBitKnown | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:0000000000001000 SignBits:12 | ||
| ; CHECK-NEXT: %2:_ KnownBits:???????????????? SignBits:9 | ||
| ; CHECK-NEXT: %3:_ KnownBits:???????????????? SignBits:1 | ||
| ; CHECK-NEXT: %4:_ KnownBits:0000000000001010 SignBits:12 | ||
| ; CHECK-NEXT: %5:_ KnownBits:000000000000???? SignBits:12 | ||
| ; CHECK-NEXT: %6:_ KnownBits:???????????????? SignBits:9 | ||
| ; CHECK-NEXT: %7:_ KnownBits:0000000000001??? SignBits:12 | ||
| %0:_(s16) = COPY $h0 | ||
| %1:_(s16) = G_CONSTANT i16 8 | ||
| %2:_(s16) = G_ASHR %0, %1 | ||
| %3:_(s16) = COPY $h1 | ||
| %4:_(s16) = G_CONSTANT i16 10 | ||
| %5:_(s16) = G_ASHR %4, %5 | ||
| %6:_(<4 x s16>) = G_BUILD_VECTOR %2, %5, %2, %4 | ||
| %7:_(<4 x s16>) = G_CTLS %6 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSLargeEnough | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSLargeEnough | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00000000000000000000000000010000 SignBits:27 | ||
| ; CHECK-NEXT: %2:_ KnownBits:???????????????????????????????? SignBits:17 | ||
| ; CHECK-NEXT: %3:_ KnownBits:0000000000000000000000000001???? SignBits:27 | ||
| %0:_(s32) = COPY $s0 | ||
| %1:_(s32) = G_CONSTANT i32 16 | ||
| %2:_(s32) = G_ASHR %0, %1 | ||
| %3:_(s32) = G_CTLS %2 | ||
| ... | ||
|
|
||
| --- | ||
| name: CTLSTooSmallToTrigger | ||
| body: | | ||
| bb.1: | ||
| ; CHECK-LABEL: name: @CTLSTooSmallToTrigger | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00000000000000000000000000001111 SignBits:28 | ||
| ; CHECK-NEXT: %2:_ KnownBits:???????????????????????????????? SignBits:16 | ||
| ; CHECK-NEXT: %3:_ KnownBits:000000000000000000000000000????? SignBits:27 | ||
| %0:_(s32) = COPY $s0 | ||
| %1:_(s32) = G_CONSTANT i32 15 | ||
| %2:_(s32) = G_ASHR %0, %1 | ||
| %3:_(s32) = G_CTLS %2 | ||
| ... |
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
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.
Can this be different to BitWidth? Does GISel allow mismatching src/dst types?
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.
It should
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.
Sorry, I am not sure if you mean it should allow, or if they should be the same?
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.
The source and dest types should not be assumed to match. G_CTLS is defined with 2 type indexes
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.
In that case, I believe that this mr is ready?