diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst --- a/llvm/docs/RISCVUsage.rst +++ b/llvm/docs/RISCVUsage.rst @@ -279,3 +279,6 @@ ``XSfvcp`` LLVM implements `version 1.0.0 of the SiFive Vector Coprocessor Interface (VCIX) Software Specification `_ by SiFive. All instructions are prefixed with `sf.vc.` as described in the specification, and the riscv-toolchain-convention document linked above. + +``XCvmac`` + LLVM implements `version 1.3.1 of the Core-V Multiply-Accumulate (MAC) custom instructions specification `_ by Core-V. All instructions are prefixed with `cv.mac.` as described in the specification. diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp --- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp +++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp @@ -558,6 +558,8 @@ "XTHeadVdot custom opcode table"); TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSfvcp, DecoderTableXSfvcp32, "SiFive VCIX custom opcode table"); + TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXCvmac, DecoderTableCoreVMac32, + "CORE-V Mac extensions custom opcode table"); TRY_TO_DECODE(true, DecoderTable32, "RISCV32 table"); return MCDisassembler::Fail; diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td --- a/llvm/lib/Target/RISCV/RISCVFeatures.td +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td @@ -752,6 +752,13 @@ AssemblerPredicate<(all_of FeatureVendorXSfvcp), "'XSfvcp' (SiFive Custom Vector Coprocessor Interface Instructions)">; +def FeatureVendorXCvmac + : SubtargetFeature<"xcvmac", "HasVendorXCvmac", "true", + "'Xcvmac' (Multiply-Accumulate)">; +def HasVendorXCvmac : Predicate<"Subtarget->hasVendorXCvmac()">, + AssemblerPredicate<(all_of FeatureVendorXCvmac), + "'Xcvmac' (Multiply-Accumulate)">; + //===----------------------------------------------------------------------===// // LLVM specific features and extensions //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -1919,3 +1919,4 @@ include "RISCVInstrInfoXVentana.td" include "RISCVInstrInfoXTHead.td" include "RISCVInstrInfoXSf.td" +include "RISCVInstrInfoXCvmac.td" diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXCvmac.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXCvmac.td new file mode 100644 --- /dev/null +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXCvmac.td @@ -0,0 +1,125 @@ +//===-- RISCVInstrInfoXCvmac.td - CORE-V instructions -------*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file describes the vendor extensions defined by Core-V MAC extension. +// +//===----------------------------------------------------------------------===// + +class CVInstMac funct7, bits<3> funct3, dag outs, dag ins, + string opcodestr, string argstr, list pattern> + : RVInst { + bits<5> rs2; + bits<5> rs1; + bits<5> rd; + + let Inst{31-25} = funct7; + let Inst{24-20} = rs2; + let Inst{19-15} = rs1; + let Inst{14-12} = funct3; + let Inst{11-7} = rd; + let Opcode = OPC_CUSTOM_1.Value; + let DecoderNamespace = "CoreVMac"; +} + +class CVInstMac16I funct2, bits<3> funct3, dag outs, dag ins, + string opcodestr, string argstr, list pattern> + : RVInst { + bits<5> imm5; + bits<5> rs2; + bits<5> rs1; + bits<5> rd; + + let Inst{31-30} = funct2; + let Inst{29-25} = imm5; + let Inst{24-20} = rs2; + let Inst{19-15} = rs1; + let Inst{14-12} = funct3; + let Inst{11-7} = rd; + let Opcode = OPC_CUSTOM_2.Value; + let DecoderNamespace = "CoreVMac"; +} + +let Predicates = [HasVendorXCvmac], hasSideEffects = 0, mayLoad = 0, mayStore = 0, Constraints = "$rd = $rd_wb" in { + // 32x32 bit macs + def CV_MAC : CVInstMac<0b1001000, 0b011, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2), + "cv.mac", "$rd, $rs1, $rs2", []>, + Sched<[]>; + def CV_MSU : CVInstMac<0b1001001, 0b011, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2), + "cv.msu", "$rd, $rs1, $rs2", []>, + Sched<[]>; + + // Signed 16x16 bit macs with imm + def CV_MACSN : CVInstMac16I<0b00, 0b110, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.macsn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MACHHSN : CVInstMac16I<0b01, 0b110, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.machhsn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MACSRN : CVInstMac16I<0b10, 0b110, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.macsrn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MACHHSRN : CVInstMac16I<0b11, 0b110, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.machhsrn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + + // Unsigned 16x16 bit macs with imm + def CV_MACUN : CVInstMac16I<0b00, 0b111, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.macun", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MACHHUN : CVInstMac16I<0b01, 0b111, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.machhun", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MACURN : CVInstMac16I<0b10, 0b111, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.macurn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MACHHURN : CVInstMac16I<0b11, 0b111, (outs GPR:$rd_wb), (ins GPR:$rd, GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.machhurn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; +} // Predicates = [HasVendorXCvmac], hasSideEffects = 0, mayLoad = 0, mayStore = 0, Constraints = "$rd = $rd_wb" + +let Predicates = [HasVendorXCvmac], hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { + // Signed 16x16 bit muls with imm + def CV_MULSN : CVInstMac16I<0b00, 0b100, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulsn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MULHHSN : CVInstMac16I<0b01, 0b100, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulhhsn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MULSRN : CVInstMac16I<0b10, 0b100, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulsrn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MULHHSRN : CVInstMac16I<0b11, 0b100, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulhhsrn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + + + // Unsigned 16x16 bit muls with imm + def CV_MULUN : CVInstMac16I<0b00, 0b101, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulun", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MULHHUN : CVInstMac16I<0b01, 0b101, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulhhun", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MULURN : CVInstMac16I<0b10, 0b101, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulurn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; + def CV_MULHHURN : CVInstMac16I<0b11, 0b101, (outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2, uimm5:$imm5), + "cv.mulhhurn", "$rd, $rs1, $rs2, $imm5", []>, + Sched<[]>; +} // Predicates = [HasVendorXCvmac], hasSideEffects = 0, mayLoad = 0, mayStore = 0 + +let Predicates = [HasVendorXCvmac] in { + // Xcvmac Pseudo Instructions + // Signed 16x16 bit muls + def : InstAlias<"cv.muls $rd1, $rs1, $rs2", (CV_MULSN GPR:$rd1, GPR:$rs1, GPR:$rs2, 0), 0>; + def : InstAlias<"cv.mulhhs $rd1, $rs1, $rs2", (CV_MULHHSN GPR:$rd1, GPR:$rs1, GPR:$rs2, 0), 0>; + + // Unsigned 16x16 bit muls + def : InstAlias<"cv.mulu $rd1, $rs1, $rs2", (CV_MULUN GPR:$rd1, GPR:$rs1, GPR:$rs2, 0), 0>; + def : InstAlias<"cv.mulhhu $rd1, $rs1, $rs2", (CV_MULHHUN GPR:$rd1, GPR:$rs1, GPR:$rs2, 0), 0>; +} // Predicates = [HasVendorXCvmac] \ No newline at end of file diff --git a/llvm/test/MC/RISCV/corev/mac/invalid.s b/llvm/test/MC/RISCV/corev/mac/invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/invalid.s @@ -0,0 +1,72 @@ +# RUN: not llvm-mc -triple=riscv32 %s 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-ERROR + +cv.mac t0, t1, t2 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.msu t0, t1, t2 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +# MUL instructions + +cv.muls t0, t1, t2 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulhhs t0, t1, t2 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulsn t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulhhsn t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulsrn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulhhsrn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulu t0, t1, t2 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulhhu t0, t1, t2 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulun t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulhhun t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulurn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.mulhhurn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +# MAC instructions + +cv.macsn t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.machhsn t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.macsrn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.machhsrn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.macun t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.machhun t0, t1, t2, 0 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.macurn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) + +cv.machhurn t0, t1, t2, 1 +# CHECK-ERROR: instruction requires the following: 'Xcvmac' (Multiply-Accumulate) diff --git a/llvm/test/MC/RISCV/corev/mac/mac-invalid.s b/llvm/test/MC/RISCV/corev/mac/mac-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mac-invalid.s @@ -0,0 +1,17 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mac t0, t1, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mac t0, 0, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mac 0, t1, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mac t0, t1 +# CHECK-ERROR: too few operands for instruction + +cv.mac t0, t1, t2, t4 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mac.s b/llvm/test/MC/RISCV/corev/mac/mac.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mac.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mac t0, t1, t2 +# CHECK-INSTR: cv.mac t0, t1, t2 +# CHECK-ENCODING: [0xab,0x32,0x73,0x90] + +cv.mac t0, t1, zero +# CHECK-INSTR: cv.mac t0, t1, zero +# CHECK-ENCODING: [0xab,0x32,0x03,0x90] diff --git a/llvm/test/MC/RISCV/corev/mac/machhsn-invalid.s b/llvm/test/MC/RISCV/corev/mac/machhsn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhsn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.machhsn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhsn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhsn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhsn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhsn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhsn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhsn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.machhsn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/machhsn.s b/llvm/test/MC/RISCV/corev/mac/machhsn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhsn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.machhsn t0, t1, t2, 0 +# CHECK-INSTR: cv.machhsn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x62,0x73,0x40] + +cv.machhsn t0, t1, zero, 16 +# CHECK-INSTR: cv.machhsn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x62,0x03,0x60] + +cv.machhsn t0, t1, zero, 31 +# CHECK-INSTR: cv.machhsn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x62,0x03,0x7e] diff --git a/llvm/test/MC/RISCV/corev/mac/machhsrn-invalid.s b/llvm/test/MC/RISCV/corev/mac/machhsrn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhsrn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.machhsrn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhsrn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhsrn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhsrn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhsrn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhsrn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhsrn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.machhsrn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/machhsrn.s b/llvm/test/MC/RISCV/corev/mac/machhsrn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhsrn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.machhsrn t0, t1, t2, 0 +# CHECK-INSTR: cv.machhsrn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x62,0x73,0xc0] + +cv.machhsrn t0, t1, zero, 16 +# CHECK-INSTR: cv.machhsrn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x62,0x03,0xe0] + +cv.machhsrn t0, t1, zero, 31 +# CHECK-INSTR: cv.machhsrn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x62,0x03,0xfe] diff --git a/llvm/test/MC/RISCV/corev/mac/machhun-invalid.s b/llvm/test/MC/RISCV/corev/mac/machhun-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhun-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.machhun t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhun t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhun t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhun t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhun t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhun 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhun t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.machhun t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/machhun.s b/llvm/test/MC/RISCV/corev/mac/machhun.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhun.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.machhun t0, t1, t2, 0 +# CHECK-INSTR: cv.machhun t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x72,0x73,0x40] + +cv.machhun t0, t1, zero, 16 +# CHECK-INSTR: cv.machhun t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x72,0x03,0x60] + +cv.machhun t0, t1, zero, 31 +# CHECK-INSTR: cv.machhun t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x72,0x03,0x7e] diff --git a/llvm/test/MC/RISCV/corev/mac/machhurn-invalid.s b/llvm/test/MC/RISCV/corev/mac/machhurn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhurn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.machhurn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhurn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhurn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.machhurn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhurn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhurn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.machhurn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.machhurn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/machhurn.s b/llvm/test/MC/RISCV/corev/mac/machhurn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/machhurn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.machhurn t0, t1, t2, 0 +# CHECK-INSTR: cv.machhurn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x72,0x73,0xc0] + +cv.machhurn t0, t1, zero, 16 +# CHECK-INSTR: cv.machhurn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x72,0x03,0xe0] + +cv.machhurn t0, t1, zero, 31 +# CHECK-INSTR: cv.machhurn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x72,0x03,0xfe] diff --git a/llvm/test/MC/RISCV/corev/mac/macsn-invalid.s b/llvm/test/MC/RISCV/corev/mac/macsn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macsn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.macsn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macsn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macsn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macsn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macsn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macsn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macsn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.macsn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/macsn.s b/llvm/test/MC/RISCV/corev/mac/macsn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macsn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.macsn t0, t1, t2, 0 +# CHECK-INSTR: cv.macsn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x62,0x73,0x00] + +cv.macsn t0, t1, zero, 16 +# CHECK-INSTR: cv.macsn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x62,0x03,0x20] + +cv.macsn t0, t1, zero, 31 +# CHECK-INSTR: cv.macsn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x62,0x03,0x3e] diff --git a/llvm/test/MC/RISCV/corev/mac/macsrn-invalid.s b/llvm/test/MC/RISCV/corev/mac/macsrn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macsrn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.macsrn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macsrn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macsrn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macsrn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macsrn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macsrn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macsrn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.macsrn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/macsrn.s b/llvm/test/MC/RISCV/corev/mac/macsrn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macsrn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.macsrn t0, t1, t2, 0 +# CHECK-INSTR: cv.macsrn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x62,0x73,0x80] + +cv.macsrn t0, t1, zero, 16 +# CHECK-INSTR: cv.macsrn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x62,0x03,0xa0] + +cv.macsrn t0, t1, zero, 31 +# CHECK-INSTR: cv.macsrn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x62,0x03,0xbe] diff --git a/llvm/test/MC/RISCV/corev/mac/macun-invalid.s b/llvm/test/MC/RISCV/corev/mac/macun-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macun-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.macun t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macun t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macun t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macun t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macun t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macun 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macun t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.macun t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/macun.s b/llvm/test/MC/RISCV/corev/mac/macun.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macun.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.macun t0, t1, t2, 0 +# CHECK-INSTR: cv.macun t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x72,0x73,0x00] + +cv.macun t0, t1, zero, 16 +# CHECK-INSTR: cv.macun t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x72,0x03,0x20] + +cv.macun t0, t1, zero, 31 +# CHECK-INSTR: cv.macun t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x72,0x03,0x3e] diff --git a/llvm/test/MC/RISCV/corev/mac/macurn-invalid.s b/llvm/test/MC/RISCV/corev/mac/macurn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macurn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.macurn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macurn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macurn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.macurn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macurn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macurn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.macurn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.macurn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/macurn.s b/llvm/test/MC/RISCV/corev/mac/macurn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/macurn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.macurn t0, t1, t2, 0 +# CHECK-INSTR: cv.macurn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x72,0x73,0x80] + +cv.macurn t0, t1, zero, 16 +# CHECK-INSTR: cv.macurn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x72,0x03,0xa0] + +cv.macurn t0, t1, zero, 31 +# CHECK-INSTR: cv.macurn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x72,0x03,0xbe] diff --git a/llvm/test/MC/RISCV/corev/mac/msu-invalid.s b/llvm/test/MC/RISCV/corev/mac/msu-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/msu-invalid.s @@ -0,0 +1,17 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.msu t0, t1, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.msu t0, 0, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.msu 0, t1, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.msu t0, t1 +# CHECK-ERROR: too few operands for instruction + +cv.msu t0, t1, t2, t4 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/msu.s b/llvm/test/MC/RISCV/corev/mac/msu.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/msu.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.msu t0, t1, t2 +# CHECK-INSTR: cv.msu t0, t1, t2 +# CHECK-ENCODING: [0xab,0x32,0x73,0x92] + +cv.msu t0, t1, zero +# CHECK-INSTR: cv.msu t0, t1, zero +# CHECK-ENCODING: [0xab,0x32,0x03,0x92] diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhs-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulhhs-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhs-invalid.s @@ -0,0 +1,17 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulhhs t0, t1, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhs t0, 0, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhs 0, t1, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhs t0, t1 +# CHECK-ERROR: too few operands for instruction + +cv.mulhhs t0, t1, t2, t4 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhs.s b/llvm/test/MC/RISCV/corev/mac/mulhhs.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhs.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulhhs t0, t1, t2 +# CHECK-INSTR: cv.mulhhsn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x42,0x73,0x40] + +cv.mulhhs t0, t1, zero +# CHECK-INSTR: cv.mulhhsn t0, t1, zero, 0 +# CHECK-ENCODING: [0xdb,0x42,0x03,0x40] diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhsn-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulhhsn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhsn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulhhsn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhsn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhsn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhsn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhsn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhsn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhsn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulhhsn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhsn.s b/llvm/test/MC/RISCV/corev/mac/mulhhsn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhsn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulhhsn t0, t1, t2, 0 +# CHECK-INSTR: cv.mulhhsn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x42,0x73,0x40] + +cv.mulhhsn t0, t1, zero, 16 +# CHECK-INSTR: cv.mulhhsn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x42,0x03,0x60] + +cv.mulhhsn t0, t1, zero, 31 +# CHECK-INSTR: cv.mulhhsn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x42,0x03,0x7e] diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhsrn-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulhhsrn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhsrn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulhhsrn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhsrn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhsrn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhsrn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhsrn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhsrn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhsrn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulhhsrn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhsrn.s b/llvm/test/MC/RISCV/corev/mac/mulhhsrn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhsrn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulhhsrn t0, t1, t2, 0 +# CHECK-INSTR: cv.mulhhsrn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x42,0x73,0xc0] + +cv.mulhhsrn t0, t1, zero, 16 +# CHECK-INSTR: cv.mulhhsrn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x42,0x03,0xe0] + +cv.mulhhsrn t0, t1, zero, 31 +# CHECK-INSTR: cv.mulhhsrn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x42,0x03,0xfe] diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhu-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulhhu-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhu-invalid.s @@ -0,0 +1,17 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulhhu t0, t1, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhu t0, 0, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhu 0, t1, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhu t0, t1 +# CHECK-ERROR: too few operands for instruction + +cv.mulhhu t0, t1, t2, t4 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhu.s b/llvm/test/MC/RISCV/corev/mac/mulhhu.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhu.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulhhu t0, t1, t2 +# CHECK-INSTR: cv.mulhhun t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x52,0x73,0x40] + +cv.mulhhu t0, t1, zero +# CHECK-INSTR: cv.mulhhun t0, t1, zero, 0 +# CHECK-ENCODING: [0xdb,0x52,0x03,0x40] diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhun-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulhhun-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhun-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulhhun t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhun t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhun t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhun t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhun t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhun 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhun t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulhhun t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhun.s b/llvm/test/MC/RISCV/corev/mac/mulhhun.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhun.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulhhun t0, t1, t2, 0 +# CHECK-INSTR: cv.mulhhun t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x52,0x73,0x40] + +cv.mulhhun t0, t1, zero, 16 +# CHECK-INSTR: cv.mulhhun t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x52,0x03,0x60] + +cv.mulhhun t0, t1, zero, 31 +# CHECK-INSTR: cv.mulhhun t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x52,0x03,0x7e] diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhurn-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulhhurn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhurn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulhhurn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhurn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhurn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulhhurn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhurn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhurn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulhhurn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulhhurn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulhhurn.s b/llvm/test/MC/RISCV/corev/mac/mulhhurn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulhhurn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulhhurn t0, t1, t2, 0 +# CHECK-INSTR: cv.mulhhurn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x52,0x73,0xc0] + +cv.mulhhurn t0, t1, zero, 16 +# CHECK-INSTR: cv.mulhhurn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x52,0x03,0xe0] + +cv.mulhhurn t0, t1, zero, 31 +# CHECK-INSTR: cv.mulhhurn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x52,0x03,0xfe] diff --git a/llvm/test/MC/RISCV/corev/mac/muls-invalid.s b/llvm/test/MC/RISCV/corev/mac/muls-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/muls-invalid.s @@ -0,0 +1,17 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.muls t0, t1, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.muls t0, 0, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.muls 0, t1, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.muls t0, t1 +# CHECK-ERROR: too few operands for instruction + +cv.muls t0, t1, t2, t4 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/muls.s b/llvm/test/MC/RISCV/corev/mac/muls.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/muls.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.muls t0, t1, t2 +# CHECK-INSTR: cv.mulsn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x42,0x73,0x00] + +cv.muls t0, t1, zero +# CHECK-INSTR: cv.mulsn t0, t1, zero, 0 +# CHECK-ENCODING: [0xdb,0x42,0x03,0x00] diff --git a/llvm/test/MC/RISCV/corev/mac/mulsn-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulsn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulsn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulsn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulsn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulsn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulsn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulsn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulsn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulsn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulsn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulsn.s b/llvm/test/MC/RISCV/corev/mac/mulsn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulsn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulsn t0, t1, t2, 0 +# CHECK-INSTR: cv.mulsn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x42,0x73,0x00] + +cv.mulsn t0, t1, zero, 16 +# CHECK-INSTR: cv.mulsn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x42,0x03,0x20] + +cv.mulsn t0, t1, zero, 31 +# CHECK-INSTR: cv.mulsn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x42,0x03,0x3e] diff --git a/llvm/test/MC/RISCV/corev/mac/mulsrn-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulsrn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulsrn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulsrn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulsrn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulsrn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulsrn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulsrn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulsrn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulsrn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulsrn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulsrn.s b/llvm/test/MC/RISCV/corev/mac/mulsrn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulsrn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulsrn t0, t1, t2, 0 +# CHECK-INSTR: cv.mulsrn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x42,0x73,0x80] + +cv.mulsrn t0, t1, zero, 16 +# CHECK-INSTR: cv.mulsrn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x42,0x03,0xa0] + +cv.mulsrn t0, t1, zero, 31 +# CHECK-INSTR: cv.mulsrn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x42,0x03,0xbe] diff --git a/llvm/test/MC/RISCV/corev/mac/mulu-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulu-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulu-invalid.s @@ -0,0 +1,17 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulu t0, t1, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulu t0, 0, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mulu 0, t1, t2 +# CHECK-ERROR: invalid operand for instruction + +cv.mulu t0, t1 +# CHECK-ERROR: too few operands for instruction + +cv.mulu t0, t1, t2, t4 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulu.s b/llvm/test/MC/RISCV/corev/mac/mulu.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulu.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulu t0, t1, t2 +# CHECK-INSTR: cv.mulun t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x52,0x73,0x00] + +cv.mulu t0, t1, zero +# CHECK-INSTR: cv.mulun t0, t1, zero, 0 +# CHECK-ENCODING: [0xdb,0x52,0x03,0x00] diff --git a/llvm/test/MC/RISCV/corev/mac/mulun-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulun-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulun-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulun t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulun t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulun t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulun t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulun t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulun 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulun t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulun t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulun.s b/llvm/test/MC/RISCV/corev/mac/mulun.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulun.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulun t0, t1, t2, 0 +# CHECK-INSTR: cv.mulun t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x52,0x73,0x00] + +cv.mulun t0, t1, zero, 16 +# CHECK-INSTR: cv.mulun t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x52,0x03,0x20] + +cv.mulun t0, t1, zero, 31 +# CHECK-INSTR: cv.mulun t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x52,0x03,0x3e] diff --git a/llvm/test/MC/RISCV/corev/mac/mulurn-invalid.s b/llvm/test/MC/RISCV/corev/mac/mulurn-invalid.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulurn-invalid.s @@ -0,0 +1,26 @@ +# RUN: not llvm-mc -triple=riscv32 --mattr=+xcvmac %s 2>&1 \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ERROR + +cv.mulurn t0, t1, t2, -1 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulurn t0, t1, t2, 32 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulurn t0, t1, t2, a0 +# CHECK-ERROR: immediate must be an integer in the range [0, 31] + +cv.mulurn t0, t1, 0, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulurn t0, 0, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulurn 0, t1, t2, 0 +# CHECK-ERROR: invalid operand for instruction + +cv.mulurn t0, t1, t2 +# CHECK-ERROR: too few operands for instruction + +cv.mulurn t0, t1, t2, 0, a0 +# CHECK-ERROR: invalid operand for instruction diff --git a/llvm/test/MC/RISCV/corev/mac/mulurn.s b/llvm/test/MC/RISCV/corev/mac/mulurn.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/corev/mac/mulurn.s @@ -0,0 +1,14 @@ +# RUN: llvm-mc -triple=riscv32 --mattr=+xcvmac -show-encoding %s \ +# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INSTR + +cv.mulurn t0, t1, t2, 0 +# CHECK-INSTR: cv.mulurn t0, t1, t2, 0 +# CHECK-ENCODING: [0xdb,0x52,0x73,0x80] + +cv.mulurn t0, t1, zero, 16 +# CHECK-INSTR: cv.mulurn t0, t1, zero, 16 +# CHECK-ENCODING: [0xdb,0x52,0x03,0xa0] + +cv.mulurn t0, t1, zero, 31 +# CHECK-INSTR: cv.mulurn t0, t1, zero, 31 +# CHECK-ENCODING: [0xdb,0x52,0x03,0xbe]