Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] Support hypervisor extention instructions
According to privileged spec version-20211203 Add the following hypervisor instructions: - HLV.B HLV.BU - HLV.H HLV.HU HLVX.HU - HLV.W HLV.WU HLVX.WU - HLV.D - HSV.B HSV.H HSV.W HSV.D Signed-off-by: eric.tang <eric.tang@starfivetech.com> Differential Revision: https://reviews.llvm.org/D117733
- Loading branch information
1 parent
386c5be
commit b496a17
Showing
6 changed files
with
241 additions
and
2 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,50 @@ | ||
# RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s | ||
# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST %s | ||
|
||
# CHECK-INST: hlv.b a0, (a1) | ||
# CHECK: encoding: [0x73,0xc5,0x05,0x60] | ||
hlv.b a0, 0(a1) | ||
|
||
# CHECK-INST: hlv.bu a0, (a1) | ||
# CHECK: encoding: [0x73,0xc5,0x15,0x60] | ||
hlv.bu a0, 0(a1) | ||
|
||
# CHECK-INST: hlv.h a1, (a2) | ||
# CHECK: encoding: [0xf3,0x45,0x06,0x64] | ||
hlv.h a1, 0(a2) | ||
|
||
# CHECK-INST: hlv.hu a1, (a1) | ||
# CHECK: encoding: [0xf3,0xc5,0x15,0x64] | ||
hlv.hu a1, 0(a1) | ||
|
||
# CHECK-INST: hlvx.hu a1, (a2) | ||
# CHECK: encoding: [0xf3,0x45,0x36,0x64] | ||
hlvx.hu a1, 0(a2) | ||
|
||
# CHECK-INST: hlv.w a2, (a2) | ||
# CHECK: encoding: [0x73,0x46,0x06,0x68] | ||
hlv.w a2, 0(a2) | ||
|
||
# CHECK-INST: hlvx.wu a2, (a3) | ||
# CHECK: encoding: [0x73,0xc6,0x36,0x68] | ||
hlvx.wu a2, 0(a3) | ||
|
||
# CHECK-INST: hsv.b a0, (a1) | ||
# CHECK: encoding: [0x73,0xc0,0xa5,0x62] | ||
hsv.b a0, 0(a1) | ||
|
||
# CHECK-INST: hsv.h a0, (a1) | ||
# CHECK: encoding: [0x73,0xc0,0xa5,0x66] | ||
hsv.h a0, 0(a1) | ||
|
||
# CHECK-INST: hsv.w a0, (a1) | ||
# CHECK: encoding: [0x73,0xc0,0xa5,0x6a] | ||
hsv.w a0, 0(a1) |
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,19 @@ | ||
# RUN: not llvm-mc -triple riscv64 < %s 2>&1 | FileCheck %s | ||
|
||
hlv.wu a0, 0x10 # CHECK: :[[@LINE]]:17: error: expected '(' after optional integer offset | ||
|
||
hlv.wu a0, a1 # CHECK: :[[@LINE]]:12: error: expected '(' or optional integer offset | ||
|
||
hlv.wu a0, 1(a1) # CHECK: :[[@LINE]]:12: error: optional integer offset must be 0 | ||
|
||
hlv.d a0, 0x10 # CHECK: :[[@LINE]]:16: error: expected '(' after optional integer offset | ||
|
||
hlv.d a0, a1 # CHECK: :[[@LINE]]:11: error: expected '(' or optional integer offset | ||
|
||
hlv.d a0, 1(a1) # CHECK: :[[@LINE]]:11: error: optional integer offset must be 0 | ||
|
||
hsv.d a0, 0x10 # CHECK: :[[@LINE]]:16: error: expected '(' after optional integer offset | ||
|
||
hsv.d a0, a1 # CHECK: :[[@LINE]]:11: error: expected '(' or optional integer offset | ||
|
||
hsv.d a0, 1(a1) # CHECK: :[[@LINE]]:11: error: optional integer offset must be 0 |
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,38 @@ | ||
# RUN: llvm-mc %s -triple=riscv64 -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d - \ | ||
# RUN: | FileCheck -check-prefix=CHECK-INST %s | ||
|
||
# RUN: not llvm-mc -triple riscv32 < %s 2>&1 \ | ||
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s | ||
|
||
# CHECK-INST: hlv.wu a0, (a1) | ||
# CHECK: encoding: [0x73,0xc5,0x15,0x68] | ||
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set | ||
hlv.wu a0, (a1) | ||
|
||
# CHECK-INST: hlv.wu a0, (a1) | ||
# CHECK: encoding: [0x73,0xc5,0x15,0x68] | ||
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set | ||
hlv.wu a0, 0(a1) | ||
|
||
# CHECK-INST: hlv.d a0, (a1) | ||
# CHECK: encoding: [0x73,0xc5,0x05,0x6c] | ||
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set | ||
hlv.d a0, (a1) | ||
|
||
# CHECK-INST: hlv.d a0, (a1) | ||
# CHECK: encoding: [0x73,0xc5,0x05,0x6c] | ||
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set | ||
hlv.d a0, 0(a1) | ||
|
||
# CHECK-INST: hsv.d a0, (a1) | ||
# CHECK: encoding: [0x73,0xc0,0xa5,0x6e] | ||
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set | ||
hsv.d a0, (a1) | ||
|
||
# CHECK-INST: hsv.d a0, (a1) | ||
# CHECK: encoding: [0x73,0xc0,0xa5,0x6e] | ||
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set | ||
hsv.d a0, 0(a1) |
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