-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[RISCV] Add Qualcomm uC Xqcilb (Long Branch) extension #131996
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
5 commits
Select commit
Hold shift + click to select a range
e3f9548
[RISCV] Add Qualcomm uC Xqcilb (Long Branch) extension
hchandel be5ad34
fixup! Minor change
hchandel 9db5c77
fixup! Update RISCVFeatures.td
hchandel bbe9a0a
Merge branch 'main' into xqcilb
hchandel 34963ca
fixup! Clang format
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Xqcilb - Qualcomm uC Long Branch Extension | ||
| # RUN: not llvm-mc -triple riscv32 -mattr=+experimental-xqcilb < %s 2>&1 \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK,CHECK-PLUS %s | ||
| # RUN: not llvm-mc -triple riscv32 -mattr=-experimental-xqcilb < %s 2>&1 \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK,CHECK-MINUS %s | ||
|
|
||
| # CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
| qc.e.j | ||
|
|
||
| # CHECK-PLUS: :[[@LINE+1]]:9: error: operand must be a multiple of 2 bytes in the range [-2147483648, 2147483646] | ||
| qc.e.j -2147483649 | ||
|
|
||
| # CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension) | ||
| qc.e.j -2147483648 | ||
|
|
||
|
|
||
| # CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
| qc.e.jal | ||
|
|
||
| # CHECK-PLUS: :[[@LINE+1]]:10: error: operand must be a multiple of 2 bytes in the range [-2147483648, 2147483646] | ||
| qc.e.jal 2147483649 | ||
|
|
||
| # CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension) | ||
| qc.e.jal 2147483640 |
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,26 @@ | ||
| # Xqcilb - Qualcomm uC Long Branch Extension | ||
| # RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-xqcilb -riscv-no-aliases -show-encoding \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK-ENC,CHECK-INST %s | ||
| # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+experimental-xqcilb < %s \ | ||
| # RUN: | llvm-objdump --mattr=+experimental-xqcilb -M no-aliases --no-print-imm-hex -d - \ | ||
| # RUN: | FileCheck -check-prefix=CHECK-OBJ %s | ||
| # RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-xqcilb -show-encoding \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK-ENC,CHECK-INST %s | ||
| # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+experimental-xqcilb < %s \ | ||
| # RUN: | llvm-objdump --mattr=+experimental-xqcilb --no-print-imm-hex -d - \ | ||
| # RUN: | FileCheck -check-prefix=CHECK-OBJ %s | ||
|
|
||
| # CHECK-INST: qc.e.j -2147483648 | ||
| # CHECK-OBJ: qc.e.j 0x80000000 | ||
| # CHECK-ENC: encoding: [0x1f,0x40,0x00,0x00,0x00,0x80] | ||
| qc.e.j -2147483648 | ||
|
|
||
| # CHECK-INST: qc.e.jal 2147483640 | ||
| # CHECK-OBJ: qc.e.jal 0x7ffffffe | ||
| # CHECK-ENC: encoding: [0x9f,0xcc,0x0e,0xfe,0xff,0x7f] | ||
| qc.e.jal 2147483640 | ||
|
|
||
| # CHECK-INST: qc.e.jal -116 | ||
| # CHECK-OBJ: qc.e.jal 0xffffff98 | ||
| # CHECK-ENC: encoding: [0x9f,0xc6,0x0e,0xf8,0xff,0xff] | ||
| qc.e.jal 0xffffff8c |
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.
Why doesn't this check for
MCOp.isBareSymbolRef()like simm13_lsb0 and simm21_lsb0_jal?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 PR adds only support for using explicit immediates in these instructions. We do intend to add support for symbols, but deeper changes are required to how LLVM emits relocations, so we'll do all that support in a follow-up PR.
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.
Are explicit immediates useful? binutils and llvm disagree on how those are treated for the existing branches/jumps. llvm treats them as relative addresses. binutils treats them as absolute addresses.
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.
Well that's a fun assembler difference I didn't know about :(
We've found it useful to write them for testing our assembler/disassembler, but agree that most users will use the symbol versions.