-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmetic) extension #124706
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
81d1b62
[RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmetic) extension
b9501ff
Add support for Operand Imm32
hchandel 34f05e8
Update RISCVISAInfo.cpp
hchandel 09c3c2d
Merge branch 'main' into xqcilia
hchandel 71206e8
Change Imm32 to SImm32
hchandel 1df40d1
Fix SImm32
hchandel c315e7b
Resolve merge conflicts
hchandel 0b40481
Fix Indentation
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
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,117 @@ | ||
# Xqcilia - Qualcomm uC Large Immediate Arithmetic extension | ||
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-xqcilia < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-PLUS,CHECK-IMM %s | ||
# RUN: not llvm-mc -triple riscv32 -mattr=-experimental-xqcilia < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-MINUS,CHECK-EXT %s | ||
|
||
# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:12: error: invalid operand for instruction | ||
qc.e.addai 9, 33554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.addai x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:16: error: immediate must be an integer in the range [-2147483648, 4294967295] | ||
qc.e.addai x9, 20485546494 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.addai x9, 33554432 | ||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:16: error: invalid operand for instruction | ||
qc.e.addi x10, 9, 554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.addi x10, x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-33554432, 33554431] | ||
qc.e.addi x10, x9, 335544312 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.addi x10, x9, 554432 | ||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:12: error: invalid operand for instruction | ||
qc.e.andai 9, 33554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.andai x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:16: error: immediate must be an integer in the range [-2147483648, 4294967295] | ||
qc.e.andai x9, 20494437494 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.andai x9, 33554432 | ||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:16: error: invalid operand for instruction | ||
qc.e.andi x10, 9, 554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.andi x10, x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-33554432, 33554431] | ||
qc.e.andi x10, x9, 335544312 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.andi x10, x9, 554432 | ||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:11: error: invalid operand for instruction | ||
qc.e.orai 9, 33554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.orai x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:15: error: immediate must be an integer in the range [-2147483648, 4294967295] | ||
qc.e.orai x9, 20494437494 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.orai x9, 33554432 | ||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:15: error: invalid operand for instruction | ||
qc.e.ori x10, 9, 554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.ori x10, x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-33554432, 33554431] | ||
qc.e.ori x10, x9, 335544312 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.ori x10, x9, 554432 | ||
|
||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:12: error: invalid operand for instruction | ||
qc.e.xorai 9, 33554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.xorai x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:16: error: immediate must be an integer in the range [-2147483648, 4294967295] | ||
qc.e.xorai x9, 20494437494 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.xorai x9, 33554432 | ||
|
||
|
||
# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0) | ||
# CHECK-MINUS: :[[@LINE+1]]:16: error: invalid operand for instruction | ||
qc.e.xori x10, 9, 554432 | ||
|
||
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction | ||
qc.e.xori x10, x9 | ||
|
||
# CHECK-IMM: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-33554432, 33554431] | ||
qc.e.xori x10, x9, 335544312 | ||
|
||
# CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension) | ||
qc.e.xori x10, x9, 554432 |
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,82 @@ | ||
# Xqcilia - Qualcomm uC Large Immediate Arithmetic extension | ||
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-xqcilia -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ENC,CHECK-INST %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+experimental-xqcilia < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-xqcilia -M no-aliases --no-print-imm-hex -d - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST %s | ||
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-xqcilia -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ENC,CHECK-INST %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+experimental-xqcilia < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-xqcilia --no-print-imm-hex -d - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST %s | ||
|
||
# CHECK-INST: qc.e.addai s1, -1 | ||
# CHECK-ENC: encoding: [0x9f,0x24,0xff,0xff,0xff,0xff] | ||
qc.e.addai x9, 4294967295 | ||
|
||
# CHECK-INST: qc.e.addai s1, -2147483648 | ||
# CHECK-ENC: encoding: [0x9f,0x24,0x00,0x00,0x00,0x80] | ||
qc.e.addai x9, -2147483648 | ||
|
||
|
||
# CHECK-INST: qc.e.addi a0, s1, -33554432 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0x04,0x80,0x00,0x80] | ||
qc.e.addi x10, x9, -33554432 | ||
|
||
# CHECK-INST: qc.e.addi a0, s1, 33554431 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0xf4,0xbf,0xff,0x7f] | ||
qc.e.addi x10, x9, 33554431 | ||
|
||
|
||
# CHECK-INST: qc.e.andai s1, -1 | ||
# CHECK-ENC: encoding: [0x9f,0xa4,0xff,0xff,0xff,0xff] | ||
qc.e.andai x9, 4294967295 | ||
|
||
# CHECK-INST: qc.e.andai s1, -2147483648 | ||
# CHECK-ENC: encoding: [0x9f,0xa4,0x00,0x00,0x00,0x80] | ||
qc.e.andai x9, -2147483648 | ||
|
||
|
||
# CHECK-INST: qc.e.andi a0, s1, -33554432 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0x04,0xc0,0x00,0x80] | ||
qc.e.andi x10, x9, -33554432 | ||
|
||
# CHECK-INST: qc.e.andi a0, s1, 33554431 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0xf4,0xff,0xff,0x7f] | ||
qc.e.andi x10, x9, 33554431 | ||
|
||
|
||
# CHECK-INST: qc.e.orai s1, -1 | ||
# CHECK-ENC: encoding: [0x9f,0x94,0xff,0xff,0xff,0xff] | ||
qc.e.orai x9, 4294967295 | ||
|
||
# CHECK-INST: qc.e.orai s1, -2147483648 | ||
# CHECK-ENC: encoding: [0x9f,0x94,0x00,0x00,0x00,0x80] | ||
qc.e.orai x9, -2147483648 | ||
|
||
|
||
# CHECK-INST: qc.e.ori a0, s1, -33554432 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0x04,0x40,0x00,0x80] | ||
qc.e.ori x10, x9, -33554432 | ||
|
||
# CHECK-INST: qc.e.ori a0, s1, 33554431 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0xf4,0x7f,0xff,0x7f] | ||
qc.e.ori x10, x9, 33554431 | ||
|
||
|
||
# CHECK-INST: qc.e.xorai s1, -1 | ||
# CHECK-ENC: encoding: [0x9f,0x14,0xff,0xff,0xff,0xff] | ||
qc.e.xorai x9, 4294967295 | ||
|
||
# CHECK-INST: qc.e.xorai s1, -2147483648 | ||
# CHECK-ENC: encoding: [0x9f,0x14,0x00,0x00,0x00,0x80] | ||
qc.e.xorai x9, -2147483648 | ||
|
||
|
||
# CHECK-INST: qc.e.xori a0, s1, -33554432 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0x04,0x00,0x00,0x80] | ||
qc.e.xori x10, x9, -33554432 | ||
|
||
# CHECK-INST: qc.e.xori a0, s1, 33554431 | ||
# CHECK-ENC: encoding: [0x1f,0xb5,0xf4,0x3f,0xff,0x7f] | ||
qc.e.xori x10, x9, 33554431 |
Oops, something went wrong.
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.
@lenary I just noticed this error isn't worded well when the user didn't provide a register. Maybe we "operand must a GPR register excluding zero (x0)" would be better?
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 one of the reasons I intend to work on the DiagnosticPredicate use in RISC-V, but I haven't yet got back to it.
AArch64, where they use diagnosticpredicates, they will give you guidance if you're a register, or say "invalid operand for instruction" if you give an immediate where only a register is allowed.
My work on this has slowed as we're doing our own release work, but I hope to get back to it.