Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
According to RISC-V Unprivileged ISA 15.6. Reviewed By: asb Differential Revision: https://reviews.llvm.org/D111866
- Loading branch information
Shao-Ce SUN
committed
Nov 5, 2021
1 parent
4f4c826
commit 5c3d718
Showing
10 changed files
with
145 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zfhmin < %s 2>&1 | \ | ||
# RUN: FileCheck %s | ||
|
||
# Out of range immediates | ||
## simm12 | ||
flh ft1, -2049(a0) # CHECK: :[[@LINE]]:10: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047] | ||
fsh ft2, 2048(a1) # CHECK: :[[@LINE]]:10: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047] | ||
|
||
# Memory operand not formatted correctly | ||
flh ft1, a0, -200 # CHECK: :[[@LINE]]:14: error: invalid operand for instruction | ||
|
||
# Invalid register names | ||
flh ft15, 100(a0) # CHECK: :[[@LINE]]:5: error: invalid operand for instruction | ||
flh ft1, 100(a10) # CHECK: :[[@LINE]]:14: error: expected register | ||
|
||
# Integer registers where FP regs are expected | ||
fmv.x.h fs7, a2 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction | ||
|
||
# FP registers where integer regs are expected | ||
fmv.h.x a8, ft2 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction | ||
|
||
# Zfh instructions | ||
fmadd.h f10, f11, f12, f13, dyn # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zfh' (Half-Precision Floating-Point) |
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,62 @@ | ||
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zfhmin,+d -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zfhmin,+d -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-zfhmin,+d < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zfhmin,+d -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zfhmin,+d < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zfhmin,+d -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
|
||
# CHECK-ASM-AND-OBJ: flh ft0, 12(a0) | ||
# CHECK-ASM: encoding: [0x07,0x10,0xc5,0x00] | ||
flh f0, 12(a0) | ||
# CHECK-ASM-AND-OBJ: flh ft1, 4(ra) | ||
# CHECK-ASM: encoding: [0x87,0x90,0x40,0x00] | ||
flh f1, +4(ra) | ||
# CHECK-ASM-AND-OBJ: flh ft2, -2048(a3) | ||
# CHECK-ASM: encoding: [0x07,0x91,0x06,0x80] | ||
flh f2, -2048(x13) | ||
# CHECK-ASM-AND-OBJ: flh ft3, -2048(s1) | ||
# CHECK-ASM: encoding: [0x87,0x91,0x04,0x80] | ||
flh f3, %lo(2048)(s1) | ||
# CHECK-ASM-AND-OBJ: flh ft4, 2047(s2) | ||
# CHECK-ASM: encoding: [0x07,0x12,0xf9,0x7f] | ||
flh f4, 2047(s2) | ||
# CHECK-ASM-AND-OBJ: flh ft5, 0(s3) | ||
# CHECK-ASM: encoding: [0x87,0x92,0x09,0x00] | ||
flh f5, 0(s3) | ||
|
||
# CHECK-ASM-AND-OBJ: fsh ft6, 2047(s4) | ||
# CHECK-ASM: encoding: [0xa7,0x1f,0x6a,0x7e] | ||
fsh f6, 2047(s4) | ||
# CHECK-ASM-AND-OBJ: fsh ft7, -2048(s5) | ||
# CHECK-ASM: encoding: [0x27,0x90,0x7a,0x80] | ||
fsh f7, -2048(s5) | ||
# CHECK-ASM-AND-OBJ: fsh fs0, -2048(s6) | ||
# CHECK-ASM: encoding: [0x27,0x10,0x8b,0x80] | ||
fsh f8, %lo(2048)(s6) | ||
# CHECK-ASM-AND-OBJ: fsh fs1, 999(s7) | ||
# CHECK-ASM: encoding: [0xa7,0x93,0x9b,0x3e] | ||
fsh f9, 999(s7) | ||
|
||
# CHECK-ASM-AND-OBJ: fmv.x.h a2, fs7 | ||
# CHECK-ASM: encoding: [0x53,0x86,0x0b,0xe4] | ||
fmv.x.h a2, fs7 | ||
# CHECK-ASM-AND-OBJ: fmv.h.x ft1, a6 | ||
# CHECK-ASM: encoding: [0xd3,0x00,0x08,0xf4] | ||
fmv.h.x ft1, a6 | ||
|
||
# CHECK-ASM-AND-OBJ: fcvt.s.h fa0, ft0 | ||
# CHECK-ASM: encoding: [0x53,0x05,0x20,0x40] | ||
fcvt.s.h fa0, ft0 | ||
# CHECK-ASM-AND-OBJ: fcvt.h.s ft2, fa2 | ||
# CHECK-ASM: encoding: [0x53,0x71,0x06,0x44] | ||
fcvt.h.s ft2, fa2 | ||
# CHECK-ASM-AND-OBJ: fcvt.d.h fa0, ft0 | ||
# CHECK-ASM: encoding: [0x53,0x05,0x20,0x42] | ||
fcvt.d.h fa0, ft0 | ||
# CHECK-ASM-AND-OBJ: fcvt.h.d ft2, fa2 | ||
# CHECK-ASM: encoding: [0x53,0x71,0x16,0x44] | ||
fcvt.h.d ft2, fa2 |