-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RISCV] Add changes to have better coverage for qc.insb and qc.insbi #154135
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 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8a73933
[RISCV] Add changes to have better coverage for qc.insb and qc.insbi
hchandel e4f25a4
fixup! Remove Redundant checks
hchandel 9da2bdf
Merge branch 'main' into xqcibm_insert
hchandel 5a308b2
fixup! Address comments
hchandel 98fde9a
Merge branch 'main' into xqcibm_insert
hchandel 6401ada
Merge branch 'main' into xqcibm_insert
hchandel b519505
Merge branch 'main' into xqcibm_insert
hchandel 857817b
fixup! Address Comments
hchandel e9a4a1f
fixup! Address comment
hchandel 15a00a7
Merge branch 'main' into xqcibm_insert
hchandel e83a5cd
fixup! Move ComputeKnownBits to after the other checks
hchandel 7886a00
Merge branch 'main' into xqcibm_insert
hchandel 817777c
fixup! Use DAG.MaskedValueIsZero
hchandel 253d600
Merge branch 'main' into xqcibm_insert
hchandel eff65c4
Merge branch 'main' into xqcibm_insert
hchandel 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16059,6 +16059,45 @@ static SDValue combineOrOfCZERO(SDNode *N, SDValue N0, SDValue N1, | |||||
| return DAG.getNode(ISD::XOR, DL, VT, NewOr, TrueV.getOperand(1)); | ||||||
| } | ||||||
|
|
||||||
| // (xor X, (and(xor X, Y), C2)) | ||||||
| // ->(qc_insb X, (sra Y, ShAmt), Width, ShAmt) | ||||||
| // where C2 is a shifted mask with width = Width and shift = ShAmt | ||||||
| // qc_insb might become qc.insb or qc.insbi depending on the operands. | ||||||
| static SDValue combineXorToBitfieldInsert(SDNode *N, SelectionDAG &DAG, | ||||||
| const RISCVSubtarget &Subtarget) { | ||||||
| if (!Subtarget.hasVendorXqcibm()) | ||||||
| return SDValue(); | ||||||
|
|
||||||
| using namespace SDPatternMatch; | ||||||
|
|
||||||
| SDValue Base, Inserted; | ||||||
| APInt CMask; | ||||||
| if (!sd_match(N, m_Xor(m_Value(Base), | ||||||
| m_OneUse(m_And(m_OneUse(m_Xor(m_Deferred(Base), | ||||||
| m_Value(Inserted))), | ||||||
| m_ConstInt(CMask)))))) | ||||||
| return SDValue(); | ||||||
|
|
||||||
| if (N->getValueType(0) != MVT::i32 || Base.getValueType() != MVT::i32 || | ||||||
| Inserted.getValueType() != MVT::i32) | ||||||
| return SDValue(); | ||||||
|
|
||||||
| unsigned Width, ShAmt; | ||||||
| if (!CMask.isShiftedMask(ShAmt, Width)) | ||||||
| return SDValue(); | ||||||
|
|
||||||
| SDLoc DL(N); | ||||||
|
|
||||||
| // `Inserted` needs to be right - shifted before it is put into the | ||||||
|
||||||
| // `Inserted` needs to be right - shifted before it is put into the | |
| // `Inserted` needs to be right shifted before it is put into the |
Contributor
Author
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.
Done
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.
Since you are't looking through at extends or truncates, the
N->getValueType() != MVT::i32should be enough.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.
This is my fault, I was ensuring that the combine was conservative, and wasn't sure how much these could change.
Do we want to work harder to delay this combine until after (type?) legalisation? I wasn't sure because not many other combines do so, but I see you made some changes in that direction today.
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.
Done. Removed the extra checks.