-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[GlobalISel] Add G_EXTRACT_VECTOR_ELT for computeKnownBits
#164825
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
8 commits
Select commit
Hold shift + click to select a range
41200f3
[GlobalISel] Add G_EXTRACT_VECTOR_ELT for computeKnownBits
mooori 9a8b6ee
Bail if return_type != elt_type
mooori ab16e2c
Simpler known bits computation
mooori 8972b50
Merge remote-tracking branch 'upstream/main' into gisel-extr-vec
mooori d6c5c6b
fix format
mooori 2b91f9e
Merge remote-tracking branch 'upstream/main' into gisel-extr-vec
mooori 29db457
Remove `{}` and empty line
mooori 836dac5
Merge remote-tracking branch 'upstream/main' into gisel-extr-vec
mooori 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
133 changes: 133 additions & 0 deletions
133
llvm/test/CodeGen/AArch64/GlobalISel/knownbits-extract-vector.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,133 @@ | ||
| # 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>" %s -filetype=null 2>&1 | FileCheck %s | ||
|
|
||
| --- | ||
| name: all_knownbits_const_idx | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @all_knownbits_const_idx | ||
| ; CHECK-NEXT: %0:_ KnownBits:00000011 SignBits:6 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00001010 SignBits:4 | ||
| ; CHECK-NEXT: %2:_ KnownBits:0000?01? SignBits:4 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:0000000000000000000000000000000000000000000000000000000000000001 SignBits:63 | ||
| ; CHECK-NEXT: %4:_ KnownBits:00001010 SignBits:4 | ||
| %0:_(s8) = G_CONSTANT i8 3 | ||
| %1:_(s8) = G_CONSTANT i8 10 | ||
| %2:_(<2 x s8>) = G_BUILD_VECTOR %0, %1 | ||
| %idx:_(s64) = G_CONSTANT i64 1 | ||
| %3:_(s8) = G_EXTRACT_VECTOR_ELT %2, %idx | ||
| ... | ||
| --- | ||
| name: all_knownbits | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @all_knownbits | ||
| ; CHECK-NEXT: %0:_ KnownBits:00000011 SignBits:6 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00001010 SignBits:4 | ||
| ; CHECK-NEXT: %2:_ KnownBits:0000?01? SignBits:4 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:???????????????????????????????????????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %4:_ KnownBits:0000?01? SignBits:4 | ||
| %0:_(s8) = G_CONSTANT i8 3 | ||
| %1:_(s8) = G_CONSTANT i8 10 | ||
| %2:_(<2 x s8>) = G_BUILD_VECTOR %0, %1 | ||
| %idx:_(s64) = COPY $d0 | ||
| %3:_(s8) = G_EXTRACT_VECTOR_ELT %2, %idx | ||
| ... | ||
| --- | ||
| name: no_knownbits_const_idx | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @no_knownbits_const_idx | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:0000000000000000000000000000000000000000000000000000000000000001 SignBits:63 | ||
| ; CHECK-NEXT: %2:_ KnownBits:???????? SignBits:1 | ||
| %0:_(<2 x s8>) = COPY $h0 | ||
| %idx:_(s64) = G_CONSTANT i64 1 | ||
| %1:_(s8) = G_EXTRACT_VECTOR_ELT %0, %idx | ||
| ... | ||
| --- | ||
| name: no_knownbits | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @no_knownbits | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:???????????????????????????????????????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %2:_ KnownBits:???????? SignBits:1 | ||
| %0:_(<2 x s8>) = COPY $h0 | ||
| %idx:_(s64) = COPY $d1 | ||
| %1:_(s8) = G_EXTRACT_VECTOR_ELT %0, %idx | ||
| ... | ||
| --- | ||
| name: zext_const_idx | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @zext_const_idx | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %zext0:_ KnownBits:00000000???????? SignBits:8 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:0000000000000000000000000000000000000000000000000000000000000001 SignBits:63 | ||
| ; CHECK-NEXT: %3:_ KnownBits:00000000???????? SignBits:8 | ||
| %0:_(<2 x s8>) = COPY $h0 | ||
| %zext0:_(<2 x s16>) = G_ZEXT %0 | ||
| %idx:_(s64) = G_CONSTANT i64 1 | ||
| %1:_(s16) = G_EXTRACT_VECTOR_ELT %zext0, %idx | ||
| ... | ||
| --- | ||
| name: zext | ||
| body: | | ||
| bb.0: | ||
|
|
||
| ; CHECK-LABEL: name: @zext | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %zext0:_ KnownBits:00000000???????? SignBits:8 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:???????????????????????????????????????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %3:_ KnownBits:00000000???????? SignBits:8 | ||
| %0:_(<2 x s8>) = COPY $h0 | ||
| %zext0:_(<2 x s16>) = G_ZEXT %0 | ||
| %idx:_(s64) = COPY $d1 | ||
| %1:_(s16) = G_EXTRACT_VECTOR_ELT %zext0, %idx | ||
| ... | ||
| --- | ||
| name: sext_const_idx | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @sext_const_idx | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %sext0:_ KnownBits:???????????????? SignBits:9 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:0000000000000000000000000000000000000000000000000000000000000001 SignBits:63 | ||
| ; CHECK-NEXT: %3:_ KnownBits:???????????????? SignBits:1 | ||
| %0:_(<2 x s8>) = COPY $h0 | ||
| %sext0:_(<2 x s16>) = G_SEXT %0 | ||
| %idx:_(s64) = G_CONSTANT i64 1 | ||
| %1:_(s16) = G_EXTRACT_VECTOR_ELT %sext0, %idx | ||
| ... | ||
| --- | ||
| name: sext | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @sext | ||
| ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1 | ||
| ; CHECK-NEXT: %sext0:_ KnownBits:???????????????? SignBits:9 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:???????????????????????????????????????????????????????????????? SignBits:1 | ||
| ; CHECK-NEXT: %3:_ KnownBits:???????????????? SignBits:1 | ||
| %0:_(<2 x s8>) = COPY $h0 | ||
| %sext0:_(<2 x s16>) = G_SEXT %0 | ||
| %idx:_(s64) = COPY $d1 | ||
| %1:_(s16) = G_EXTRACT_VECTOR_ELT %sext0, %idx | ||
| ... | ||
| --- | ||
| # Verifies known bit computation bails if return type differs from vector | ||
| # element type. Without bailing, the 8 lowest bits of %4 would be known. | ||
| name: bail_on_different_return_type | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: @bail_on_different_return_type | ||
| ; CHECK-NEXT: %0:_ KnownBits:00000011 SignBits:6 | ||
| ; CHECK-NEXT: %1:_ KnownBits:00001010 SignBits:4 | ||
| ; CHECK-NEXT: %2:_ KnownBits:0000?01? SignBits:4 | ||
| ; CHECK-NEXT: %idx:_ KnownBits:0000000000000000000000000000000000000000000000000000000000000001 SignBits:63 | ||
| ; CHECK-NEXT: %4:_ KnownBits:???????????????? SignBits:1 | ||
| %0:_(s8) = G_CONSTANT i8 3 | ||
| %1:_(s8) = G_CONSTANT i8 10 | ||
| %2:_(<2 x s8>) = G_BUILD_VECTOR %0, %1 | ||
| %idx:_(s64) = G_CONSTANT i64 1 | ||
| %3:_(s16) = G_EXTRACT_VECTOR_ELT %2, %idx | ||
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.
We might want to remove this test in the future if it is unsupported.