-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[TableGen] Emit integers in GlobalISelMatchTable as unsigned #153391
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 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b8bbbb4
[TableGen][test] Test INT64_MIN literals
pfusik bddfa1b
[TableGen] Make integers in GlobalISelMatchTable unsigned
pfusik ddf173d
[TableGen][NFC] Parenthesize parameters in `GIMT_Encode2/4/8` macros
pfusik e0854e0
[TableGen][test] Update tests
pfusik 2da53ca
[TableGen] Make variable type explicit
pfusik 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // RUN: llvm-tblgen -gen-global-isel -optimize-match-table=false -I %p/../../../include -I %p/../Common %s | FileCheck %s | ||
|
|
||
| include "llvm/Target/Target.td" | ||
| include "GlobalISelEmitterCommon.td" | ||
|
|
||
| def GPR : RegisterClass<"MyTarget", [i64], 64, (add R0)>; | ||
| def ANDI : I<(outs GPR:$dst), (ins GPR:$src1, i64imm:$src2), []>; | ||
|
|
||
| // CHECK-LABEL: GIM_Try, /*On fail goto*//*Label 0*/ GIMT_Encode4(59), // Rule ID 0 // | ||
| // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/3, | ||
| // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_AND), | ||
| // CHECK-NEXT: // MIs[0] DstI[dst] | ||
| // CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s64, | ||
| // CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::GPRRegClassID), | ||
| // CHECK-NEXT: // MIs[0] rs1 | ||
| // CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s64, | ||
| // CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/1, /*RC*/GIMT_Encode2(MyTarget::GPRRegClassID), | ||
| // CHECK-NEXT: // MIs[0] Operand 2 | ||
| // CHECK-NEXT: GIM_RootCheckType, /*Op*/2, /*Type*/GILLT_s64, | ||
| // CHECK-NEXT: GIM_CheckConstantInt, /*MI*/0, /*Op*/2, GIMT_Encode8(9223372036854775808), | ||
| // CHECK-NEXT: // (and:{ *:[i64] } GPR:{ *:[i64] }:$rs1, -9223372036854775808:{ *:[i64] }) => (ANDI:{ *:[i64] } GPR:{ *:[i64] }:$rs1, -9223372036854775808:{ *:[i64] }) | ||
| // CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(MyTarget::ANDI), | ||
| // CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // DstI[dst] | ||
| // CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/1, // rs1 | ||
| // CHECK-NEXT: GIR_AddImm, /*InsnID*/0, /*Imm*/GIMT_Encode8(9223372036854775808), | ||
| // CHECK-NEXT: GIR_RootConstrainSelectedInstOperands, | ||
| // CHECK-NEXT: // GIR_Coverage, 0, | ||
| // CHECK-NEXT: GIR_EraseRootFromParent_Done, | ||
| def : Pat<(and GPR:$rs1, 0x8000000000000000), | ||
| (ANDI GPR:$rs1, 0x8000000000000000)>; |
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
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 probably should be directly writing this string to the stream instead of creating the temporary
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.
I can address that in a future PR, together with the following TODO comment of emitting the bytes directly instead of via
GIMT_Encodemacros.