-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] MC layer support for the instructions added in the privileged…
… spec Adds support for the instructions added in the RISC-V privileged ISA (https://content.riscv.org/wp-content/uploads/2017/05/riscv-privileged-v1.10.pdf): uret, sret, mret, wfi, and sfence.vma. Note from the committer: I made very minor formatting changes prior to commit, which didn't seem worth creating another review round-trip for. Differential Revision: https://reviews.llvm.org/D40383 Patch by David Craven. llvm-svn: 320484
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # RUN: not llvm-mc -triple riscv32 < %s 2>&1 | FileCheck %s | ||
|
|
||
| mret 0x10 # CHECK: :[[@LINE]]:6: error: invalid operand for instruction | ||
|
|
||
| sfence.vma zero # CHECK: :[[@LINE]]:1: error: too few operands for instruction | ||
|
|
||
| sfence.vma a0, 0x10 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction |
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,32 @@ | ||
| # RUN: llvm-mc %s -triple=riscv32 -show-encoding \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s | ||
| # RUN: llvm-mc %s -triple=riscv64 -show-encoding \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s | ||
| # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ | ||
| # RUN: | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s | ||
| # RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ | ||
| # RUN: | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s | ||
|
|
||
| # CHECK-INST: uret | ||
| # CHECK: encoding: [0x73,0x00,0x20,0x00] | ||
| uret | ||
|
|
||
| # CHECK-INST: sret | ||
| # CHECK: encoding: [0x73,0x00,0x20,0x10] | ||
| sret | ||
|
|
||
| # CHECK-INST: mret | ||
| # CHECK: encoding: [0x73,0x00,0x20,0x30] | ||
| mret | ||
|
|
||
| # CHECK-INST: wfi | ||
| # CHECK: encoding: [0x73,0x00,0x50,0x10] | ||
| wfi | ||
|
|
||
| # CHECK-INST: sfence.vma zero, zero | ||
| # CHECK: encoding: [0x73,0x00,0x00,0x12] | ||
| sfence.vma zero, zero | ||
|
|
||
| # CHECK-INST: sfence.vma a0, a1 | ||
| # CHECK: encoding: [0x73,0x00,0xb5,0x12] | ||
| sfence.vma a0, a1 |