Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,42 @@
# RUN: llvm-mc %s -filetype=obj -triple=riscv32 | llvm-readobj -h \
# RUN: | FileCheck -check-prefix=RV32 %s
# RUN: llvm-mc %s -filetype=obj -triple=riscv64 | llvm-readobj -h \
# RUN: | FileCheck -check-prefix=RV64 %s
# RV32: Format: ELF32-riscv
# RV32: Arch: riscv32
# RV32: AddressSize: 32bit
# RV32: ElfHeader {
# RV32: Ident {
# RV32: Magic: (7F 45 4C 46)
# RV32: Class: 32-bit (0x1)
# RV32: DataEncoding: LittleEndian (0x1)
# RV32: FileVersion: 1
# RV32: OS/ABI: SystemV (0x0)
# RV32: ABIVersion: 0
# RV32: }
# RV32: Type: Relocatable (0x1)
# RV32: Machine: EM_RISCV (0xF3)
# RV32: Version: 1
# RV32: Flags [ (0x0)
# RV32: ]
# RV32: }
# RV64: Format: ELF64-riscv
# RV64: Arch: riscv64
# RV64: AddressSize: 64bit
# RV64: ElfHeader {
# RV64: Ident {
# RV64: Magic: (7F 45 4C 46)
# RV64: Class: 64-bit (0x2)
# RV64: DataEncoding: LittleEndian (0x1)
# RV64: FileVersion: 1
# RV64: OS/ABI: SystemV (0x0)
# RV64: ABIVersion: 0
# RV64: }
# RV64: Type: Relocatable (0x1)
# RV64: Machine: EM_RISCV (0xF3)
# RV64: Version: 1
# RV64: Flags [ (0x0)
# RV64: ]
# RV64: }

View File

@@ -0,0 +1,18 @@
# RUN: llvm-mc %s -triple riscv32 -mattr=+c -show-encoding \
# RUN: | FileCheck -check-prefix=CHECK-FIXUP %s
# RUN: llvm-mc -triple riscv32 -filetype=obj -mattr=+c < %s \
# RUN: | llvm-objdump -mattr=+c -d - | FileCheck -check-prefix=CHECK-INSTR %s
.LBB0_2:
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0_2, kind: fixup_riscv_rvc_jump
# CHECK-INSTR: c.j 0
c.j .LBB0_2
# CHECK: fixup A - offset: 0, value: func1, kind: fixup_riscv_rvc_jump
# CHECK-INSTR: c.jal 0
c.jal func1
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0_2, kind: fixup_riscv_rvc_branch
# CHECK-INSTR: c.beqz a3, -4
c.beqz a3, .LBB0_2
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0_2, kind: fixup_riscv_rvc_branch
# CHECK-INSTR: c.bnez a5, -6
c.bnez a5, .LBB0_2

View File

@@ -0,0 +1,18 @@
# RUN: not llvm-mc -triple riscv32 -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s
jal a0, far_distant # CHECK: :[[@LINE]]:3: error: fixup value out of range
jal a0, unaligned # CHECK: :[[@LINE]]:3: error: fixup value must be 2-byte aligned
beq a0, a1, distant # CHECK: :[[@LINE]]:3: error: fixup value out of range
blt t0, t1, unaligned # CHECK: :[[@LINE]]:3: error: fixup value must be 2-byte aligned
.byte 0
unaligned:
.byte 0
.byte 0
.byte 0
.space 1<<12
distant:
.space 1<<20
far_distant:

View File

@@ -0,0 +1,50 @@
# RUN: llvm-mc -triple riscv32 -riscv-no-aliases < %s -show-encoding \
# RUN: | FileCheck -check-prefix=CHECK-FIXUP %s
# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
# RUN: | llvm-objdump -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INSTR %s
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s \
# RUN: | llvm-readobj -r | FileCheck %s -check-prefix=CHECK-REL
# Checks that fixups that can be resolved within the same object file are
# applied correctly
.LBB0:
lui t1, %hi(val)
# CHECK-FIXUP: fixup A - offset: 0, value: %hi(val), kind: fixup_riscv_hi20
# CHECK-INSTR: lui t1, 74565
lw a0, %lo(val)(t1)
# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_i
# CHECK-INSTR: lw a0, 1656(t1)
addi a1, t1, %lo(val)
# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_i
# CHECK-INSTR: addi a1, t1, 1656
sw a0, %lo(val)(t1)
# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_s
# CHECK-INSTR: sw a0, 1656(t1)
jal zero, .LBB0
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_riscv_jal
# CHECK-INSTR: jal zero, -16
jal zero, .LBB2
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB2, kind: fixup_riscv_jal
# CHECK-INSTR: jal zero, 330996
beq a0, a1, .LBB0
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_riscv_branch
# CHECK-INSTR: beq a0, a1, -24
blt a0, a1, .LBB1
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB1, kind: fixup_riscv_branch
# CHECK-INSTR: blt a0, a1, 1108
.fill 1104
.LBB1:
.fill 329876
addi zero, zero, 0
.LBB2:
.set val, 0x12345678
# CHECK-REL-NOT: R_RISCV

View File

@@ -0,0 +1,39 @@
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s \
# RUN: | llvm-objdump -d - | FileCheck %s -check-prefix=CHECK-INSTR
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s \
# RUN: | llvm-readobj -r | FileCheck %s -check-prefix=CHECK-REL
# Check the assembler can handle hi and lo expressions with a constant
# address, and constant expressions involving labels. Test case derived from
# test/MC/Mips/hilo-addressing.s
# Check that 1 is added to the high 20 bits if bit 11 of the low part is 1.
.equ addr, 0xdeadbeef
lui t0, %hi(addr)
lw ra, %lo(addr)(t0)
# CHECK-INSTR: lui t0, 912092
# CHECK-INSTR: lw ra, -273(t0)
# Check that assembler can handle %hi(label1 - label2) and %lo(label1 - label2)
# expressions.
tmp1:
# Emit zeros so that difference between tmp1 and tmp3 is 0x30124 bytes.
.fill 0x30124-8
tmp2:
lui t0, %hi(tmp3-tmp1)
lw ra, %lo(tmp3-tmp1)(t0)
# CHECK-INSTR: lui t0, 48
# CHECK-INSTR: lw ra, 292(t0)
tmp3:
lui t1, %hi(tmp2-tmp3)
lw sp, %lo(tmp2-tmp3)(t1)
# CHECK-INSTR: lui t1, 0
# CHECK-INSTR: lw sp, -8(t1)
# Check that a relocation isn't emitted for %hi(label1 - label2) and
# %lo(label1 - label2) expressions.
# CHECK-REL-NOT: R_RISCV

View File

@@ -0,0 +1,3 @@
if not 'RISCV' in config.root.targets:
config.unsupported = True

View File

@@ -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, a1, a2 # CHECK: :[[@LINE]]:22: error: invalid operand for instruction
sfence.vma a0, 0x10 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction

View File

@@ -0,0 +1,34 @@
# 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 -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
# RUN: | llvm-objdump -riscv-no-aliases -d - \
# RUN: | 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

View File

@@ -0,0 +1,75 @@
# RUN: llvm-mc -triple riscv32 -mattr=+c -riscv-no-aliases < %s -show-encoding \
# RUN: | FileCheck -check-prefix=INSTR -check-prefix=FIXUP %s
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s \
# RUN: | llvm-readobj -r | FileCheck -check-prefix=RELOC %s
# Check prefixes:
# RELOC - Check the relocation in the object.
# FIXUP - Check the fixup on the instruction.
# INSTR - Check the instruction is handled properly by the ASMPrinter
.long foo
# RELOC: R_RISCV_32 foo
.quad foo
# RELOC: R_RISCV_64 foo
lui t1, %hi(foo)
# RELOC: R_RISCV_HI20 foo 0x0
# INSTR: lui t1, %hi(foo)
# FIXUP: fixup A - offset: 0, value: %hi(foo), kind: fixup_riscv_hi20
lui t1, %hi(foo+4)
# RELOC: R_RISCV_HI20 foo 0x4
# INSTR: lui t1, %hi(foo+4)
# FIXUP: fixup A - offset: 0, value: %hi(foo+4), kind: fixup_riscv_hi20
addi t1, t1, %lo(foo)
# RELOC: R_RISCV_LO12_I foo 0x0
# INSTR: addi t1, t1, %lo(foo)
# FIXUP: fixup A - offset: 0, value: %lo(foo), kind: fixup_riscv_lo12_i
addi t1, t1, %lo(foo+4)
# RELOC: R_RISCV_LO12_I foo 0x4
# INSTR: addi t1, t1, %lo(foo+4)
# FIXUP: fixup A - offset: 0, value: %lo(foo+4), kind: fixup_riscv_lo12_i
sb t1, %lo(foo)(a2)
# RELOC: R_RISCV_LO12_S foo 0x0
# INSTR: sb t1, %lo(foo)(a2)
# FIXUP: fixup A - offset: 0, value: %lo(foo), kind: fixup_riscv_lo12_s
sb t1, %lo(foo+4)(a2)
# RELOC: R_RISCV_LO12_S foo 0x4
# INSTR: sb t1, %lo(foo+4)(a2)
# FIXUP: fixup A - offset: 0, value: %lo(foo+4), kind: fixup_riscv_lo12_s
auipc t1, %pcrel_hi(foo)
# RELOC: R_RISCV_PCREL_HI20 foo 0x0
# INSTR: auipc t1, %pcrel_hi(foo)
# FIXUP: fixup A - offset: 0, value: %pcrel_hi(foo), kind: fixup_riscv_pcrel_hi20
auipc t1, %pcrel_hi(foo+4)
# RELOC: R_RISCV_PCREL_HI20 foo 0x4
# INSTR: auipc t1, %pcrel_hi(foo+4)
# FIXUP: fixup A - offset: 0, value: %pcrel_hi(foo+4), kind: fixup_riscv_pcrel_hi20
jal zero, foo
# RELOC: R_RISCV_JAL
# INSTR: jal zero, foo
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_jal
bgeu a0, a1, foo
# RELOC: R_RISCV_BRANCH
# INSTR: bgeu a0, a1, foo
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_branch
c.jal foo
# RELOC: R_RISCV_RVC_JUMP
# INSTR: c.jal foo
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_rvc_jump
c.bnez a0, foo
# RELOC: R_RISCV_RVC_BRANCH
# INSTR: c.bnez a0, foo
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_rvc_branch

View File

@@ -0,0 +1,17 @@
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 | FileCheck %s
# Final operand must have parentheses
amoswap.w a1, a2, a3 # CHECK: :[[@LINE]]:19: error: invalid operand for instruction
amomin.w a1, a2, 1 # CHECK: :[[@LINE]]:18: error: invalid operand for instruction
lr.w a4, a5 # CHECK: :[[@LINE]]:10: error: invalid operand for instruction
# Only .aq, .rl, and .aqrl suffixes are valid
amoxor.w.rlqa a2, a3, (a4) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
amoor.w.aq.rl a4, a5, (a6) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
amoor.w. a4, a5, (a6) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
# lr only takes two operands
lr.w s0, (s1), s2 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction
# Note: errors for use of RV64A instructions for RV32 are checked in
# rv64a-valid.s

View File

@@ -0,0 +1,148 @@
# RUN: llvm-mc %s -triple=riscv32 -mattr=+a -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc %s -triple=riscv64 -mattr=+a -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+a < %s \
# RUN: | llvm-objdump -mattr=+a -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+a < %s \
# RUN: | llvm-objdump -mattr=+a -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# CHECK-INST: lr.w t0, (t1)
# CHECK: encoding: [0xaf,0x22,0x03,0x10]
lr.w t0, (t1)
# CHECK-INST: lr.w.aq t1, (t2)
# CHECK: encoding: [0x2f,0xa3,0x03,0x14]
lr.w.aq t1, (t2)
# CHECK-INST: lr.w.rl t2, (t3)
# CHECK: encoding: [0xaf,0x23,0x0e,0x12]
lr.w.rl t2, (t3)
# CHECK-INST: lr.w.aqrl t3, (t4)
# CHECK: encoding: [0x2f,0xae,0x0e,0x16]
lr.w.aqrl t3, (t4)
# CHECK-INST: sc.w t6, t5, (t4)
# CHECK: encoding: [0xaf,0xaf,0xee,0x19]
sc.w t6, t5, (t4)
# CHECK-INST: sc.w.aq t5, t4, (t3)
# CHECK: encoding: [0x2f,0x2f,0xde,0x1d]
sc.w.aq t5, t4, (t3)
# CHECK-INST: sc.w.rl t4, t3, (t2)
# CHECK: encoding: [0xaf,0xae,0xc3,0x1b]
sc.w.rl t4, t3, (t2)
# CHECK-INST: sc.w.aqrl t3, t2, (t1)
# CHECK: encoding: [0x2f,0x2e,0x73,0x1e]
sc.w.aqrl t3, t2, (t1)
# CHECK-INST: amoswap.w a4, ra, (s0)
# CHECK: encoding: [0x2f,0x27,0x14,0x08]
amoswap.w a4, ra, (s0)
# CHECK-INST: amoadd.w a1, a2, (a3)
# CHECK: encoding: [0xaf,0xa5,0xc6,0x00]
amoadd.w a1, a2, (a3)
# CHECK-INST: amoxor.w a2, a3, (a4)
# CHECK: encoding: [0x2f,0x26,0xd7,0x20]
amoxor.w a2, a3, (a4)
# CHECK-INST: amoand.w a3, a4, (a5)
# CHECK: encoding: [0xaf,0xa6,0xe7,0x60]
amoand.w a3, a4, (a5)
# CHECK-INST: amoor.w a4, a5, (a6)
# CHECK: encoding: [0x2f,0x27,0xf8,0x40]
amoor.w a4, a5, (a6)
# CHECK-INST: amomin.w a5, a6, (a7)
# CHECK: encoding: [0xaf,0xa7,0x08,0x81]
amomin.w a5, a6, (a7)
# CHECK-INST: amomax.w s7, s6, (s5)
# CHECK: encoding: [0xaf,0xab,0x6a,0xa1]
amomax.w s7, s6, (s5)
# CHECK-INST: amominu.w s6, s5, (s4)
# CHECK: encoding: [0x2f,0x2b,0x5a,0xc1]
amominu.w s6, s5, (s4)
# CHECK-INST: amomaxu.w s5, s4, (s3)
# CHECK: encoding: [0xaf,0xaa,0x49,0xe1]
amomaxu.w s5, s4, (s3)
# CHECK-INST: amoswap.w.aq a4, ra, (s0)
# CHECK: encoding: [0x2f,0x27,0x14,0x0c]
amoswap.w.aq a4, ra, (s0)
# CHECK-INST: amoadd.w.aq a1, a2, (a3)
# CHECK: encoding: [0xaf,0xa5,0xc6,0x04]
amoadd.w.aq a1, a2, (a3)
# CHECK-INST: amoxor.w.aq a2, a3, (a4)
# CHECK: encoding: [0x2f,0x26,0xd7,0x24]
amoxor.w.aq a2, a3, (a4)
# CHECK-INST: amoand.w.aq a3, a4, (a5)
# CHECK: encoding: [0xaf,0xa6,0xe7,0x64]
amoand.w.aq a3, a4, (a5)
# CHECK-INST: amoor.w.aq a4, a5, (a6)
# CHECK: encoding: [0x2f,0x27,0xf8,0x44]
amoor.w.aq a4, a5, (a6)
# CHECK-INST: amomin.w.aq a5, a6, (a7)
# CHECK: encoding: [0xaf,0xa7,0x08,0x85]
amomin.w.aq a5, a6, (a7)
# CHECK-INST: amomax.w.aq s7, s6, (s5)
# CHECK: encoding: [0xaf,0xab,0x6a,0xa5]
amomax.w.aq s7, s6, (s5)
# CHECK-INST: amominu.w.aq s6, s5, (s4)
# CHECK: encoding: [0x2f,0x2b,0x5a,0xc5]
amominu.w.aq s6, s5, (s4)
# CHECK-INST: amomaxu.w.aq s5, s4, (s3)
# CHECK: encoding: [0xaf,0xaa,0x49,0xe5]
amomaxu.w.aq s5, s4, (s3)
# CHECK-INST: amoswap.w.rl a4, ra, (s0)
# CHECK: encoding: [0x2f,0x27,0x14,0x0a]
amoswap.w.rl a4, ra, (s0)
# CHECK-INST: amoadd.w.rl a1, a2, (a3)
# CHECK: encoding: [0xaf,0xa5,0xc6,0x02]
amoadd.w.rl a1, a2, (a3)
# CHECK-INST: amoxor.w.rl a2, a3, (a4)
# CHECK: encoding: [0x2f,0x26,0xd7,0x22]
amoxor.w.rl a2, a3, (a4)
# CHECK-INST: amoand.w.rl a3, a4, (a5)
# CHECK: encoding: [0xaf,0xa6,0xe7,0x62]
amoand.w.rl a3, a4, (a5)
# CHECK-INST: amoor.w.rl a4, a5, (a6)
# CHECK: encoding: [0x2f,0x27,0xf8,0x42]
amoor.w.rl a4, a5, (a6)
# CHECK-INST: amomin.w.rl a5, a6, (a7)
# CHECK: encoding: [0xaf,0xa7,0x08,0x83]
amomin.w.rl a5, a6, (a7)
# CHECK-INST: amomax.w.rl s7, s6, (s5)
# CHECK: encoding: [0xaf,0xab,0x6a,0xa3]
amomax.w.rl s7, s6, (s5)
# CHECK-INST: amominu.w.rl s6, s5, (s4)
# CHECK: encoding: [0x2f,0x2b,0x5a,0xc3]
amominu.w.rl s6, s5, (s4)
# CHECK-INST: amomaxu.w.rl s5, s4, (s3)
# CHECK: encoding: [0xaf,0xaa,0x49,0xe3]
amomaxu.w.rl s5, s4, (s3)
# CHECK-INST: amoswap.w.aqrl a4, ra, (s0)
# CHECK: encoding: [0x2f,0x27,0x14,0x0e]
amoswap.w.aqrl a4, ra, (s0)
# CHECK-INST: amoadd.w.aqrl a1, a2, (a3)
# CHECK: encoding: [0xaf,0xa5,0xc6,0x06]
amoadd.w.aqrl a1, a2, (a3)
# CHECK-INST: amoxor.w.aqrl a2, a3, (a4)
# CHECK: encoding: [0x2f,0x26,0xd7,0x26]
amoxor.w.aqrl a2, a3, (a4)
# CHECK-INST: amoand.w.aqrl a3, a4, (a5)
# CHECK: encoding: [0xaf,0xa6,0xe7,0x66]
amoand.w.aqrl a3, a4, (a5)
# CHECK-INST: amoor.w.aqrl a4, a5, (a6)
# CHECK: encoding: [0x2f,0x27,0xf8,0x46]
amoor.w.aqrl a4, a5, (a6)
# CHECK-INST: amomin.w.aqrl a5, a6, (a7)
# CHECK: encoding: [0xaf,0xa7,0x08,0x87]
amomin.w.aqrl a5, a6, (a7)
# CHECK-INST: amomax.w.aqrl s7, s6, (s5)
# CHECK: encoding: [0xaf,0xab,0x6a,0xa7]
amomax.w.aqrl s7, s6, (s5)
# CHECK-INST: amominu.w.aqrl s6, s5, (s4)
# CHECK: encoding: [0x2f,0x2b,0x5a,0xc7]
amominu.w.aqrl s6, s5, (s4)
# CHECK-INST: amomaxu.w.aqrl s5, s4, (s3)
# CHECK: encoding: [0xaf,0xaa,0x49,0xe7]
amomaxu.w.aqrl s5, s4, (s3)

View File

@@ -0,0 +1,76 @@
# RUN: not llvm-mc -triple=riscv32 -mattr=+c < %s 2>&1 | FileCheck %s
## GPRC
.LBB:
c.lw ra, 4(sp) # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
c.sw sp, 4(sp) # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
c.beqz t0, .LBB # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.bnez s8, .LBB # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.addi4spn s4, sp, 12 # CHECK: :[[@LINE]]:13: error: invalid operand for instruction
c.srli s7, 12 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.srai t0, 12 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.andi t1, 12 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.and t1, a0 # CHECK: :[[@LINE]]:8: error: invalid operand for instruction
c.or a0, s8 # CHECK: :[[@LINE]]:12: error: invalid operand for instruction
c.xor t2, a0 # CHECK: :[[@LINE]]:8: error: invalid operand for instruction
c.sub a0, s8 # CHECK: :[[@LINE]]:12: error: invalid operand for instruction
## GPRNoX0
c.lwsp x0, 4(sp) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.lwsp zero, 4(sp) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.jr x0 # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
c.jalr zero # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.addi x0, x0, 1 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.li zero, 2 # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
c.slli zero, zero, 4 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
c.mv zero, s0 # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
c.mv ra, x0 # CHECK: :[[@LINE]]:11: error: invalid operand for instruction
c.add ra, ra, x0 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction
c.add zero, zero, sp # CHECK: :[[@LINE]]:8: error: invalid operand for instruction
## GPRNoX0X2
c.lui x0, 4 # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
c.lui x2, 4 # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
## SP
c.addi4spn a0, a0, 12 # CHECK: :[[@LINE]]:17: error: invalid operand for instruction
c.addi16sp t0, 16 # CHECK: :[[@LINE]]:13: error: invalid operand for instruction
# Out of range immediates
## uimmlog2xlennonzero
c.slli t0, 64 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [1, 31]
c.srli a0, 32 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [1, 31]
c.srai a0, 0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [1, 31]
## simm6
c.li t0, 128 # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-32, 31]
c.addi t0, 32 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [-32, 31]
c.andi a0, -33 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [-32, 31]
## uimm6nonzero
c.lui t0, 64 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [1, 63]
c.lui t0, 0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [1, 63]
## uimm8_lsb00
c.lwsp ra, 256(sp) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 4 bytes in the range [0, 252]
c.swsp ra, -4(sp) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 4 bytes in the range [0, 252]
## uimm7_lsb00
c.lw s0, -4(sp) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 4 bytes in the range [0, 124]
c.sw s0, 128(sp) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 4 bytes in the range [0, 124]
## simm9_lsb0
c.bnez s1, -258 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-256, 254]
c.beqz a0, 256 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-256, 254]
## simm12_lsb0
c.j 2048 # CHECK: :[[@LINE]]:5: error: immediate must be a multiple of 2 bytes in the range [-2048, 2046]
c.jal -2050 # CHECK: :[[@LINE]]:7: error: immediate must be a multiple of 2 bytes in the range [-2048, 2046]
## uimm10_lsb00nonzero
c.addi4spn a0, sp, 0 # CHECK: :[[@LINE]]:21: error: immediate must be a multiple of 4 bytes in the range [4, 1020]
c.addi4spn a0, sp, 1024 # CHECK: :[[@LINE]]:21: error: immediate must be a multiple of 4 bytes in the range [4, 1020]
## simm10_lsb0000
c.addi16sp sp, -528 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 16 bytes in the range [-512, 496]
c.addi16sp sp, 512 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 16 bytes in the range [-512, 496]

View File

@@ -0,0 +1,8 @@
# RUN: llvm-mc -triple=riscv32 -mattr=+c -riscv-no-aliases -show-encoding < %s \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c -riscv-no-aliases < %s \
# RUN: | llvm-objdump -mattr=+c -d - | FileCheck -check-prefix=CHECK-INST %s
# CHECK-INST: c.jal 2046
# CHECK: encoding: [0xfd,0x2f]
c.jal 2046

View File

@@ -0,0 +1,99 @@
# RUN: llvm-mc -triple=riscv32 -mattr=+c -riscv-no-aliases -show-encoding < %s \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -triple=riscv64 -mattr=+c -riscv-no-aliases -show-encoding < %s \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s \
# RUN: | llvm-objdump -mattr=+c -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+c < %s \
# RUN: | llvm-objdump -mattr=+c -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# TODO: more exhaustive testing of immediate encoding.
# CHECK-INST: c.lwsp ra, 0(sp)
# CHECK: encoding: [0x82,0x40]
c.lwsp ra, 0(sp)
# CHECK-INST: c.swsp ra, 252(sp)
# CHECK: encoding: [0x86,0xdf]
c.swsp ra, 252(sp)
# CHECK-INST: c.lw a2, 0(a0)
# CHECK: encoding: [0x10,0x41]
c.lw a2, 0(a0)
# CHECK-INST: c.sw a5, 124(a3)
# CHECK: encoding: [0xfc,0xde]
c.sw a5, 124(a3)
# CHECK-INST: c.j -2048
# CHECK: encoding: [0x01,0xb0]
c.j -2048
# CHECK-INST: c.jr a7
# CHECK: encoding: [0x82,0x88]
c.jr a7
# CHECK-INST: c.jalr a1
# CHECK: encoding: [0x82,0x95]
c.jalr a1
# CHECK-INST: c.beqz a3, -256
# CHECK: encoding: [0x81,0xd2]
c.beqz a3, -256
# CHECK-INST: c.bnez a5, 254
# CHECK: encoding: [0xfd,0xef]
c.bnez a5, 254
# CHECK-INST: c.li a7, 31
# CHECK: encoding: [0xfd,0x48]
c.li a7, 31
# CHECK-INST: c.addi a3, -32
# CHECK: encoding: [0x81,0x16]
c.addi a3, -32
# CHECK-INST: c.addi16sp sp, -512
# CHECK: encoding: [0x01,0x71]
c.addi16sp sp, -512
# CHECK-INST: c.addi16sp sp, 496
# CHECK: encoding: [0x7d,0x61]
c.addi16sp sp, 496
# CHECK-INST: c.addi4spn a3, sp, 1020
# CHECK: encoding: [0xf4,0x1f]
c.addi4spn a3, sp, 1020
# CHECK-INST: c.addi4spn a3, sp, 4
# CHECK: encoding: [0x54,0x00]
c.addi4spn a3, sp, 4
# CHECK-INST: c.slli a1, 1
# CHECK: encoding: [0x86,0x05]
c.slli a1, 1
# CHECK-INST: c.srli a3, 31
# CHECK: encoding: [0xfd,0x82]
c.srli a3, 31
# CHECK-INST: c.srai a4, 2
# CHECK: encoding: [0x09,0x87]
c.srai a4, 2
# CHECK-INST: c.andi a5, 15
# CHECK: encoding: [0xbd,0x8b]
c.andi a5, 15
# CHECK-INST: c.mv a7, s0
# CHECK: encoding: [0xa2,0x88]
c.mv a7, s0
# CHECK-INST: c.and a1, a2
# CHECK: encoding: [0xf1,0x8d]
c.and a1, a2
# CHECK-INST: c.or a2, a3
# CHECK: encoding: [0x55,0x8e]
c.or a2, a3
# CHECK-INST: c.xor a3, a4
# CHECK: encoding: [0xb9,0x8e]
c.xor a3, a4
# CHECK-INST: c.sub a4, a5
# CHECK: encoding: [0x1d,0x8f]
c.sub a4, a5
# CHECK-INST: c.nop
# CHECK: encoding: [0x01,0x00]
c.nop
# CHECK-INST: c.ebreak
# CHECK: encoding: [0x02,0x90]
c.ebreak
# CHECK-INST: c.lui s0, 1
# CHECK: encoding: [0x05,0x64]
c.lui s0, 1
# CHECK-INST: c.lui s0, 63
# CHECK: encoding: [0x7d,0x74]
c.lui s0, 63

View File

@@ -0,0 +1,21 @@
# RUN: not llvm-mc -triple riscv32 -mattr=+d < %s 2>&1 | FileCheck %s
# Out of range immediates
## simm12
fld ft1, -2049(a0) # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
fsd ft2, 2048(a1) # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
# Memory operand not formatted correctly
fld ft1, a0, -200 # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
fsd ft2, a1, 100 # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
# Invalid register names
fld ft15, 100(a0) # CHECK: :[[@LINE]]:5: error: invalid operand for instruction
fld ft1, 100(a10) # CHECK: :[[@LINE]]:14: error: expected register
fsgnjn.d fa100, fa2, fa3 # CHECK: :[[@LINE]]:10: error: invalid operand for instruction
# Integer registers where FP regs are expected
fadd.d a2, a1, a0 # CHECK: :[[@LINE]]:8: error: invalid operand for instruction
# FP registers where integer regs are expected
fcvt.wu.d ft2, a1 # CHECK: :[[@LINE]]:11: error: invalid operand for instruction

View File

@@ -0,0 +1,161 @@
# RUN: llvm-mc %s -triple=riscv32 -mattr=+d -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc %s -triple=riscv64 -mattr=+d -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+d < %s \
# RUN: | llvm-objdump -mattr=+d -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+d < %s \
# RUN: | llvm-objdump -mattr=+d -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# Support for the 'D' extension implies support for 'F'
# CHECK-INST: fadd.s fs10, fs11, ft8
# CHECK: encoding: [0x53,0xfd,0xcd,0x01]
fadd.s f26, f27, f28
# CHECK-INST: fld ft0, 12(a0)
# CHECK: encoding: [0x07,0x30,0xc5,0x00]
fld f0, 12(a0)
# CHECK-INST: fld ft1, 4(ra)
# CHECK: encoding: [0x87,0xb0,0x40,0x00]
fld f1, +4(ra)
# CHECK-INST: fld ft2, -2048(a3)
# CHECK: encoding: [0x07,0xb1,0x06,0x80]
fld f2, -2048(x13)
# CHECK-INST: fld ft3, -2048(s1)
# CHECK: encoding: [0x87,0xb1,0x04,0x80]
fld f3, %lo(2048)(s1)
# CHECK-INST: fld ft4, 2047(s2)
# CHECK: encoding: [0x07,0x32,0xf9,0x7f]
fld f4, 2047(s2)
# CHECK-INST: fld ft5, 0(s3)
# CHECK: encoding: [0x87,0xb2,0x09,0x00]
fld f5, 0(s3)
# CHECK-INST: fsd ft6, 2047(s4)
# CHECK: encoding: [0xa7,0x3f,0x6a,0x7e]
fsd f6, 2047(s4)
# CHECK-INST: fsd ft7, -2048(s5)
# CHECK: encoding: [0x27,0xb0,0x7a,0x80]
fsd f7, -2048(s5)
# CHECK-INST: fsd fs0, -2048(s6)
# CHECK: encoding: [0x27,0x30,0x8b,0x80]
fsd f8, %lo(2048)(s6)
# CHECK-INST: fsd fs1, 999(s7)
# CHECK: encoding: [0xa7,0xb3,0x9b,0x3e]
fsd f9, 999(s7)
# CHECK-INST: fmadd.d fa0, fa1, fa2, fa3, dyn
# CHECK: encoding: [0x43,0xf5,0xc5,0x6a]
fmadd.d f10, f11, f12, f13, dyn
# CHECK-INST: fmsub.d fa4, fa5, fa6, fa7, dyn
# CHECK: encoding: [0x47,0xf7,0x07,0x8b]
fmsub.d f14, f15, f16, f17, dyn
# CHECK-INST: fnmsub.d fs2, fs3, fs4, fs5, dyn
# CHECK: encoding: [0x4b,0xf9,0x49,0xab]
fnmsub.d f18, f19, f20, f21, dyn
# CHECK-INST: fnmadd.d fs6, fs7, fs8, fs9, dyn
# CHECK: encoding: [0x4f,0xfb,0x8b,0xcb]
fnmadd.d f22, f23, f24, f25, dyn
# CHECK-INST: fadd.d fs10, fs11, ft8, dyn
# CHECK: encoding: [0x53,0xfd,0xcd,0x03]
fadd.d f26, f27, f28, dyn
# CHECK-INST: fsub.d ft9, ft10, ft11, dyn
# CHECK: encoding: [0xd3,0x7e,0xff,0x0b]
fsub.d f29, f30, f31, dyn
# CHECK-INST: fmul.d ft0, ft1, ft2, dyn
# CHECK: encoding: [0x53,0xf0,0x20,0x12]
fmul.d ft0, ft1, ft2, dyn
# CHECK-INST: fdiv.d ft3, ft4, ft5, dyn
# CHECK: encoding: [0xd3,0x71,0x52,0x1a]
fdiv.d ft3, ft4, ft5, dyn
# CHECK-INST: fsqrt.d ft6, ft7, dyn
# CHECK: encoding: [0x53,0xf3,0x03,0x5a]
fsqrt.d ft6, ft7, dyn
# CHECK-INST: fsgnj.d fs1, fa0, fa1
# CHECK: encoding: [0xd3,0x04,0xb5,0x22]
fsgnj.d fs1, fa0, fa1
# CHECK-INST: fsgnjn.d fa1, fa3, fa4
# CHECK: encoding: [0xd3,0x95,0xe6,0x22]
fsgnjn.d fa1, fa3, fa4
# CHECK-INST: fsgnjx.d fa3, fa2, fa1
# CHECK: encoding: [0xd3,0x26,0xb6,0x22]
fsgnjx.d fa3, fa2, fa1
# CHECK-INST: fmin.d fa5, fa6, fa7
# CHECK: encoding: [0xd3,0x07,0x18,0x2b]
fmin.d fa5, fa6, fa7
# CHECK-INST: fmax.d fs2, fs3, fs4
# CHECK: encoding: [0x53,0x99,0x49,0x2b]
fmax.d fs2, fs3, fs4
# CHECK-INST: fcvt.s.d fs5, fs6, dyn
# CHECK: encoding: [0xd3,0x7a,0x1b,0x40]
fcvt.s.d fs5, fs6, dyn
# CHECK-INST: fcvt.d.s fs7, fs8
# CHECK: encoding: [0xd3,0x0b,0x0c,0x42]
fcvt.d.s fs7, fs8
# CHECK-INST: feq.d a1, fs8, fs9
# CHECK: encoding: [0xd3,0x25,0x9c,0xa3]
feq.d a1, fs8, fs9
# CHECK-INST: flt.d a2, fs10, fs11
# CHECK: encoding: [0x53,0x16,0xbd,0xa3]
flt.d a2, fs10, fs11
# CHECK-INST: fle.d a3, ft8, ft9
# CHECK: encoding: [0xd3,0x06,0xde,0xa3]
fle.d a3, ft8, ft9
# CHECK-INST: fclass.d a3, ft10
# CHECK: encoding: [0xd3,0x16,0x0f,0xe2]
fclass.d a3, ft10
# CHECK-INST: fcvt.w.d a4, ft11, dyn
# CHECK: encoding: [0x53,0xf7,0x0f,0xc2]
fcvt.w.d a4, ft11, dyn
# CHECK-INST: fcvt.d.w ft0, a5
# CHECK: encoding: [0x53,0x80,0x07,0xd2]
fcvt.d.w ft0, a5
# CHECK-INST: fcvt.d.wu ft1, a6
# CHECK: encoding: [0xd3,0x00,0x18,0xd2]
fcvt.d.wu ft1, a6
# Rounding modes
# CHECK-INST: fmadd.d fa0, fa1, fa2, fa3, rne
# CHECK: encoding: [0x43,0x85,0xc5,0x6a]
fmadd.d f10, f11, f12, f13, rne
# CHECK-INST: fmsub.d fa4, fa5, fa6, fa7, rtz
# CHECK: encoding: [0x47,0x97,0x07,0x8b]
fmsub.d f14, f15, f16, f17, rtz
# CHECK-INST: fnmsub.d fs2, fs3, fs4, fs5, rdn
# CHECK: encoding: [0x4b,0xa9,0x49,0xab]
fnmsub.d f18, f19, f20, f21, rdn
# CHECK-INST: fnmadd.d fs6, fs7, fs8, fs9, rup
# CHECK: encoding: [0x4f,0xbb,0x8b,0xcb]
fnmadd.d f22, f23, f24, f25, rup
# CHECK-INST: fadd.d fs10, fs11, ft8, rmm
# CHECK: encoding: [0x53,0xcd,0xcd,0x03]
fadd.d f26, f27, f28, rmm
# CHECK-INST: fsub.d ft9, ft10, ft11
# CHECK: encoding: [0xd3,0x7e,0xff,0x0b]
fsub.d f29, f30, f31, dyn
# CHECK-INST: fmul.d ft0, ft1, ft2, rne
# CHECK: encoding: [0x53,0x80,0x20,0x12]
fmul.d ft0, ft1, ft2, rne
# CHECK-INST: fdiv.d ft3, ft4, ft5, rtz
# CHECK: encoding: [0xd3,0x11,0x52,0x1a]
fdiv.d ft3, ft4, ft5, rtz
# CHECK-INST: fsqrt.d ft6, ft7, rdn
# CHECK: encoding: [0x53,0xa3,0x03,0x5a]
fsqrt.d ft6, ft7, rdn
# CHECK-INST: fcvt.s.d fs5, fs6, rup
# CHECK: encoding: [0xd3,0x3a,0x1b,0x40]
fcvt.s.d fs5, fs6, rup
# CHECK-INST: fcvt.w.d a4, ft11, rmm
# CHECK: encoding: [0x53,0xc7,0x0f,0xc2]
fcvt.w.d a4, ft11, rmm
# CHECK-INST: fcvt.wu.d a5, ft10, dyn
# CHECK: encoding: [0xd3,0x77,0x1f,0xc2]
fcvt.wu.d a5, ft10, dyn

View File

@@ -0,0 +1,12 @@
# RUN: not llvm-mc -triple=riscv32 -mattr=+c,+d < %s 2>&1 | FileCheck %s
## FPRC
c.fld ft3, 8(a5) # CHECK: :[[@LINE]]:8: error: invalid operand for instruction
## uimm9_lsb000
c.fldsp fs1, 512(sp) # CHECK: :[[@LINE]]:15: error: immediate must be a multiple of 8 bytes in the range [0, 504]
c.fsdsp fs2, -8(sp) # CHECK: :[[@LINE]]:15: error: immediate must be a multiple of 8 bytes in the range [0, 504]
## uimm8_lsb000
c.fld fs0, -8(sp) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 8 bytes in the range [0, 248]
c.fsd fs1, 256(sp) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 8 bytes in the range [0, 248]

View File

@@ -0,0 +1,19 @@
# RUN: llvm-mc %s -triple=riscv32 -mattr=+c,+d -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c,+d < %s \
# RUN: | llvm-objdump -mattr=+c,+d -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# CHECK-INST: c.fldsp fs0, 504(sp)
# CHECK: encoding: [0x7e,0x34]
c.fldsp fs0, 504(sp)
# CHECK-INST: c.fsdsp fa7, 504(sp)
# CHECK: encoding: [0xc6,0xbf]
c.fsdsp fa7, 504(sp)
# CHECK-INST: c.fld fa3, 248(a5)
# CHECK: encoding: [0xf4,0x3f]
c.fld fa3, 248(a5)
# CHECK-INST: c.fsd fa2, 248(a1)
# CHECK: encoding: [0xf0,0xbd]
c.fsd fa2, 248(a1)

View File

@@ -0,0 +1,34 @@
# RUN: not llvm-mc -triple riscv32 -mattr=+f < %s 2>&1 | FileCheck %s
# Out of range immediates
## simm12
flw ft1, -2049(a0) # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
fsw ft2, 2048(a1) # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
# Memory operand not formatted correctly
flw ft1, a0, -200 # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
fsw ft2, a1, 100 # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-2048, 2047]
# Invalid register names
flw ft15, 100(a0) # CHECK: :[[@LINE]]:5: error: invalid operand for instruction
flw ft1, 100(a10) # CHECK: :[[@LINE]]:14: error: expected register
fsgnjn.s fa100, fa2, fa3 # CHECK: :[[@LINE]]:10: error: invalid operand for instruction
# Integer registers where FP regs are expected
fmv.x.w fs7, a2 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
# FP registers where integer regs are expected
fmv.w.x a8, ft2 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
# Rounding mode when a register is expected
fmadd.s f10, f11, f12, ree # CHECK: :[[@LINE]]:24: error: invalid operand for instruction
# Invalid rounding modes
fmadd.s f10, f11, f12, f13, ree # CHECK: :[[@LINE]]:29: error: operand must be a valid floating point rounding mode mnemonic
fmsub.s f14, f15, f16, f17, 0 # CHECK: :[[@LINE]]:29: error: operand must be a valid floating point rounding mode mnemonic
fnmsub.s f18, f19, f20, f21, 0b111 # CHECK: :[[@LINE]]:30: error: operand must be a valid floating point rounding mode mnemonic
# Using 'D' instructions for an 'F'-only target
fadd.d ft0, ft1, ft2 # CHECK: :[[@LINE]]:1: error: instruction use requires an option to be enabled
# Using RV64F instructions for RV32 is tested in rv64f-valid.s

View File

@@ -0,0 +1,166 @@
# RUN: llvm-mc %s -triple=riscv32 -mattr=+f -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc %s -triple=riscv64 -mattr=+f -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+f < %s \
# RUN: | llvm-objdump -mattr=+f -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+f < %s \
# RUN: | llvm-objdump -mattr=+f -riscv-no-aliases -d - \
# RUN: | FileCheck -check-prefix=CHECK-INST %s
# CHECK-INST: flw ft0, 12(a0)
# CHECK: encoding: [0x07,0x20,0xc5,0x00]
flw f0, 12(a0)
# CHECK-INST: flw ft1, 4(ra)
# CHECK: encoding: [0x87,0xa0,0x40,0x00]
flw f1, +4(ra)
# CHECK-INST: flw ft2, -2048(a3)
# CHECK: encoding: [0x07,0xa1,0x06,0x80]
flw f2, -2048(x13)
# CHECK-INST: flw ft3, -2048(s1)
# CHECK: encoding: [0x87,0xa1,0x04,0x80]
flw f3, %lo(2048)(s1)
# CHECK-INST: flw ft4, 2047(s2)
# CHECK: encoding: [0x07,0x22,0xf9,0x7f]
flw f4, 2047(s2)
# CHECK-INST: flw ft5, 0(s3)
# CHECK: encoding: [0x87,0xa2,0x09,0x00]
flw f5, 0(s3)
# CHECK-INST: fsw ft6, 2047(s4)
# CHECK: encoding: [0xa7,0x2f,0x6a,0x7e]
fsw f6, 2047(s4)
# CHECK-INST: fsw ft7, -2048(s5)
# CHECK: encoding: [0x27,0xa0,0x7a,0x80]
fsw f7, -2048(s5)
# CHECK-INST: fsw fs0, -2048(s6)
# CHECK: encoding: [0x27,0x20,0x8b,0x80]
fsw f8, %lo(2048)(s6)
# CHECK-INST: fsw fs1, 999(s7)
# CHECK: encoding: [0xa7,0xa3,0x9b,0x3e]
fsw f9, 999(s7)
# CHECK-INST: fmadd.s fa0, fa1, fa2, fa3, dyn
# CHECK: encoding: [0x43,0xf5,0xc5,0x68]
fmadd.s f10, f11, f12, f13, dyn
# CHECK-INST: fmsub.s fa4, fa5, fa6, fa7, dyn
# CHECK: encoding: [0x47,0xf7,0x07,0x89]
fmsub.s f14, f15, f16, f17, dyn
# CHECK-INST: fnmsub.s fs2, fs3, fs4, fs5, dyn
# CHECK: encoding: [0x4b,0xf9,0x49,0xa9]
fnmsub.s f18, f19, f20, f21, dyn
# CHECK-INST: fnmadd.s fs6, fs7, fs8, fs9, dyn
# CHECK: encoding: [0x4f,0xfb,0x8b,0xc9]
fnmadd.s f22, f23, f24, f25, dyn
# CHECK-INST: fadd.s fs10, fs11, ft8, dyn
# CHECK: encoding: [0x53,0xfd,0xcd,0x01]
fadd.s f26, f27, f28, dyn
# CHECK-INST: fsub.s ft9, ft10, ft11, dyn
# CHECK: encoding: [0xd3,0x7e,0xff,0x09]
fsub.s f29, f30, f31, dyn
# CHECK-INST: fmul.s ft0, ft1, ft2, dyn
# CHECK: encoding: [0x53,0xf0,0x20,0x10]
fmul.s ft0, ft1, ft2, dyn
# CHECK-INST: fdiv.s ft3, ft4, ft5, dyn
# CHECK: encoding: [0xd3,0x71,0x52,0x18]
fdiv.s ft3, ft4, ft5, dyn
# CHECK-INST: fsqrt.s ft6, ft7, dyn
# CHECK: encoding: [0x53,0xf3,0x03,0x58]
fsqrt.s ft6, ft7, dyn
# CHECK-INST: fsgnj.s fs1, fa0, fa1
# CHECK: encoding: [0xd3,0x04,0xb5,0x20]
fsgnj.s fs1, fa0, fa1
# CHECK-INST: fsgnjn.s fa1, fa3, fa4
# CHECK: encoding: [0xd3,0x95,0xe6,0x20]
fsgnjn.s fa1, fa3, fa4
# CHECK-INST: fsgnjx.s fa4, fa3, fa2
# CHECK: encoding: [0x53,0xa7,0xc6,0x20]
fsgnjx.s fa4, fa3, fa2
# CHECK-INST: fmin.s fa5, fa6, fa7
# CHECK: encoding: [0xd3,0x07,0x18,0x29]
fmin.s fa5, fa6, fa7
# CHECK-INST: fmax.s fs2, fs3, fs4
# CHECK: encoding: [0x53,0x99,0x49,0x29]
fmax.s fs2, fs3, fs4
# CHECK-INST: fcvt.w.s a0, fs5, dyn
# CHECK: encoding: [0x53,0xf5,0x0a,0xc0]
fcvt.w.s a0, fs5, dyn
# CHECK-INST: fcvt.wu.s a1, fs6, dyn
# CHECK: encoding: [0xd3,0x75,0x1b,0xc0]
fcvt.wu.s a1, fs6, dyn
# CHECK-INST: fmv.x.w a2, fs7
# CHECK: encoding: [0x53,0x86,0x0b,0xe0]
fmv.x.w a2, fs7
# CHECK-INST: feq.s a1, fs8, fs9
# CHECK: encoding: [0xd3,0x25,0x9c,0xa1]
feq.s a1, fs8, fs9
# CHECK-INST: flt.s a2, fs10, fs11
# CHECK: encoding: [0x53,0x16,0xbd,0xa1]
flt.s a2, fs10, fs11
# CHECK-INST: fle.s a3, ft8, ft9
# CHECK: encoding: [0xd3,0x06,0xde,0xa1]
fle.s a3, ft8, ft9
# CHECK-INST: fclass.s a3, ft10
# CHECK: encoding: [0xd3,0x16,0x0f,0xe0]
fclass.s a3, ft10
# CHECK-INST: fcvt.s.w ft11, a4, dyn
# CHECK: encoding: [0xd3,0x7f,0x07,0xd0]
fcvt.s.w ft11, a4, dyn
# CHECK-INST: fcvt.s.wu ft0, a5, dyn
# CHECK: encoding: [0x53,0xf0,0x17,0xd0]
fcvt.s.wu ft0, a5, dyn
# CHECK-INST: fmv.w.x ft1, a6
# CHECK: encoding: [0xd3,0x00,0x08,0xf0]
fmv.w.x ft1, a6
# Rounding modes
# CHECK-INST: fmadd.s fa0, fa1, fa2, fa3, rne
# CHECK: encoding: [0x43,0x85,0xc5,0x68]
fmadd.s f10, f11, f12, f13, rne
# CHECK-INST: fmsub.s fa4, fa5, fa6, fa7, rtz
# CHECK: encoding: [0x47,0x97,0x07,0x89]
fmsub.s f14, f15, f16, f17, rtz
# CHECK-INST: fnmsub.s fs2, fs3, fs4, fs5, rdn
# CHECK: encoding: [0x4b,0xa9,0x49,0xa9]
fnmsub.s f18, f19, f20, f21, rdn
# CHECK-INST: fnmadd.s fs6, fs7, fs8, fs9, rup
# CHECK: encoding: [0x4f,0xbb,0x8b,0xc9]
fnmadd.s f22, f23, f24, f25, rup
# CHECK-INST: fmadd.s fa0, fa1, fa2, fa3, rmm
# CHECK: encoding: [0x43,0xc5,0xc5,0x68]
fmadd.s f10, f11, f12, f13, rmm
# CHECK-INST: fmsub.s fa4, fa5, fa6, fa7
# CHECK: encoding: [0x47,0xf7,0x07,0x89]
fmsub.s f14, f15, f16, f17, dyn
# CHECK-INST: fadd.s fs10, fs11, ft8, rne
# CHECK: encoding: [0x53,0x8d,0xcd,0x01]
fadd.s f26, f27, f28, rne
# CHECK-INST: fsub.s ft9, ft10, ft11, rtz
# CHECK: encoding: [0xd3,0x1e,0xff,0x09]
fsub.s f29, f30, f31, rtz
# CHECK-INST: fmul.s ft0, ft1, ft2, rdn
# CHECK: encoding: [0x53,0xa0,0x20,0x10]
fmul.s ft0, ft1, ft2, rdn
# CHECK-INST: fdiv.s ft3, ft4, ft5, rup
# CHECK: encoding: [0xd3,0x31,0x52,0x18]
fdiv.s ft3, ft4, ft5, rup
# CHECK-INST: fsqrt.s ft6, ft7, rmm
# CHECK: encoding: [0x53,0xc3,0x03,0x58]
fsqrt.s ft6, ft7, rmm
# CHECK-INST: fcvt.w.s a0, fs5, rup
# CHECK: encoding: [0x53,0xb5,0x0a,0xc0]
fcvt.w.s a0, fs5, rup
# CHECK-INST: fcvt.wu.s a1, fs6, rdn
# CHECK: encoding: [0xd3,0x25,0x1b,0xc0]
fcvt.wu.s a1, fs6, rdn
# CHECK-INST: fcvt.s.w ft11, a4, rtz
# CHECK: encoding: [0xd3,0x1f,0x07,0xd0]
fcvt.s.w ft11, a4, rtz
# CHECK-INST: fcvt.s.wu ft0, a5, rne
# CHECK: encoding: [0x53,0x80,0x17,0xd0]
fcvt.s.wu ft0, a5, rne

Some files were not shown because too many files have changed in this diff Show More