Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] Add MC support of RISCV zcmt Extension
This patch add the instructions of zcmt extension. [[ https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.0-RC5.7 | spac is here ]] Which includes two instructions (cm.jt&cm.jalt) and a CSR Reg JVT co-author: @scott Egerton Reviewed By: kito-cheng, craig.topper Differential Revision: https://reviews.llvm.org/D133863
- Loading branch information
1 parent
72f6ea6
commit 9f0d725
Showing
13 changed files
with
151 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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,10 @@ | ||
# RUN: not llvm-mc -triple=riscv32 -mattr=+experimental-zcmt -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ERROR %s | ||
# RUN: not llvm-mc -triple=riscv64 -mattr=+experimental-zcmt -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ERROR %s | ||
|
||
# CHECK-ERROR: error: immediate must be an integer in the range [0, 31] | ||
cm.jt 64 | ||
|
||
# CHECK-ERROR: error: immediate must be an integer in the range [0, 255] | ||
cm.jalt 256 |
This file contains 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,39 @@ | ||
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zcmt\ | ||
# RUN: -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zcmt\ | ||
# RUN: -mattr=m < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zcmt\ | ||
# RUN: -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zcmt\ | ||
# RUN: -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zcmt\ | ||
# RUN: -mattr=m < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zcmt\ | ||
# RUN: -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s | ||
# | ||
# RUN: not llvm-mc -triple riscv32 \ | ||
# RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s | ||
# RUN: not llvm-mc -triple riscv64 \ | ||
# RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s | ||
|
||
# CHECK-ASM-AND-OBJ: cm.jt 1 | ||
# CHECK-ASM: encoding: [0x06,0xa0] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zcmt' (table jump instuctions for code-size reduction){{$}} | ||
cm.jt 1 | ||
|
||
# CHECK-ASM: cm.jalt 1 | ||
# CHECK-OBJ: cm.jt 1 | ||
# CHECK-ASM: encoding: [0x06,0xa0] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zcmt' (table jump instuctions for code-size reduction){{$}} | ||
cm.jalt 1 | ||
|
||
# CHECK-ASM-AND-OBJ: cm.jalt 32 | ||
# CHECK-ASM: encoding: [0x82,0xa0] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zcmt' (table jump instuctions for code-size reduction){{$}} | ||
cm.jalt 32 |
This file contains 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,29 @@ | ||
# RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases -mattr=+experimental-zcmt -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-ENC %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+experimental-zcmt < %s \ | ||
# RUN: | llvm-objdump -d --mattr=+experimental-zcmt - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST-ALIAS %s | ||
# | ||
# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -mattr=+experimental-zcmt -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-ENC %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+experimental-zcmt < %s \ | ||
# RUN: | llvm-objdump -d --mattr=+experimental-zcmt - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST-ALIAS %s | ||
|
||
################################## | ||
# Jump Vector Table CSR | ||
################################## | ||
|
||
# jvt | ||
# name | ||
# CHECK-INST: csrrs t1, jvt, zero | ||
# CHECK-ENC: encoding: [0x73,0x23,0x70,0x01] | ||
# CHECK-INST-ALIAS: csrr t1, jvt | ||
# uimm12 | ||
# CHECK-INST: csrrs t2, jvt, zero | ||
# CHECK-ENC: encoding: [0xf3,0x23,0x70,0x01] | ||
# CHECK-INST-ALIAS: csrr t2, jvt | ||
# name | ||
csrrs t1, jvt, zero | ||
# uimm12 | ||
csrrs t2, 0x017, zero |