-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[RISCV][MC] Add assembler support for XRivosVisni #128773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,46 @@ | |
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| class RVInstVXI<bits<6> funct6, RISCVVFormat opv, dag outs, dag ins, | ||
| string opcodestr, string argstr> | ||
| : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR> { | ||
| bits<5> imm; | ||
| bits<5> rs1; | ||
| bits<5> vd; | ||
| bit vm; | ||
|
|
||
| let Inst{31-26} = funct6; | ||
| let Inst{25} = vm; | ||
| let Inst{24-20} = imm; | ||
| let Inst{19-15} = rs1; | ||
| let Inst{14-12} = opv.Value; | ||
| let Inst{11-7} = vd; | ||
| let Inst{6-0} = OPC_OP_V.Value; | ||
|
||
|
|
||
| let Uses = [VTYPE, VL]; | ||
| let RVVConstraint = VMConstraint; | ||
| } | ||
|
|
||
| class RVInstXVI<bits<6> funct6, RISCVVFormat opv, dag outs, dag ins, | ||
| string opcodestr, string argstr> | ||
| : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR> { | ||
| bits<5> imm; | ||
| bits<5> vs2; | ||
| bits<5> rd; | ||
| bit vm; | ||
|
|
||
| let Inst{31-26} = funct6; | ||
| let Inst{25} = vm; | ||
| let Inst{24-20} = vs2; | ||
| let Inst{19-15} = imm; | ||
| let Inst{14-12} = opv.Value; | ||
| let Inst{11-7} = rd; | ||
| let Inst{6-0} = OPC_OP_V.Value; | ||
|
|
||
| let Uses = [VTYPE, VL]; | ||
| let RVVConstraint = VMConstraint; | ||
| } | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // XRivosVizip | ||
| //===----------------------------------------------------------------------===// | ||
|
|
@@ -25,3 +65,27 @@ defm RI_VZIP2B_V : VALU_IV_V<"ri.vzip2b", 0b010100>; | |
| defm RI_VUNZIP2A_V : VALU_IV_V<"ri.vunzip2a", 0b001000>; | ||
| defm RI_VUNZIP2B_V : VALU_IV_V<"ri.vunzip2b", 0b011000>; | ||
| } | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // XRivosVisni | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| let Predicates = [HasVendorXRivosVisni], DecoderNamespace = "XRivos", | ||
| Inst<6-0> = OPC_CUSTOM_2.Value, mayLoad = false, mayStore = false, | ||
| hasSideEffects = false in { | ||
|
|
||
| let isReMaterializable = 1, isAsCheapAsAMove = 1, vm = 0, vs2=0 in | ||
| def RI_VZERO : RVInstV<0b000000, 0b00000, OPCFG, (outs VR:$vd), | ||
| (ins), "ri.vzero", "$vd">; | ||
preames marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| let vm = 0, Constraints = "$vd = $vd_wb", RVVConstraint = NoConstraint in | ||
| def RI_VINSERT : RVInstVXI<0b010000, OPMVX, (outs VR:$vd_wb), | ||
| (ins VR:$vd, GPR:$rs1, uimm5:$imm), | ||
| "ri.vinsert.v.x", "$vd, $rs1, $imm">; | ||
|
|
||
| let vm = 1, RVVConstraint = NoConstraint in | ||
| def RI_VEXTRACT : RVInstXVI<0b010111, OPMVV, (outs GPR:$rd), | ||
| (ins VR:$vs2, uimm5:$imm), | ||
| "ri.vextract.x.v", "$rd, $vs2, $imm">; | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-xrivosvisni -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-xrivosvisni < %s \ | ||
| # RUN: | llvm-objdump --mattr=+experimental-xrivosvisni -M no-aliases --no-print-imm-hex -d -r - \ | ||
| # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
| # RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-xrivosvisni -riscv-no-aliases -show-encoding \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
| # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-xrivosvisni < %s \ | ||
| # RUN: | llvm-objdump --mattr=+experimental-xrivosvisni -M no-aliases --no-print-imm-hex -d -r - \ | ||
| # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
|
|
||
| # CHECK-ASM-AND-OBJ: ri.vzero v1 | ||
| # CHECK-ASM: encoding: [0xdb,0x70,0x00,0x00] | ||
| ri.vzero v1 | ||
| # CHECK-ASM-AND-OBJ: vzero v2 | ||
| # CHECK-ASM: encoding: [0x5b,0x71,0x00,0x00] | ||
| ri.vzero v2 | ||
| # CHECK-ASM-AND-OBJ: vzero v3 | ||
| # CHECK-ASM: encoding: [0xdb,0x71,0x00,0x00] | ||
| ri.vzero v3 | ||
|
|
||
| # CHECK-ASM-AND-OBJ: ri.vinsert.v.x v0, zero, 0 | ||
| # CHECK-ASM: encoding: [0x5b,0x60,0x00,0x40] | ||
| ri.vinsert.v.x v0, x0, 0 | ||
| # CHECK-ASM-AND-OBJ: ri.vinsert.v.x v1, s4, 13 | ||
| # CHECK-ASM: encoding: [0xdb,0x60,0xda,0x40] | ||
| ri.vinsert.v.x v1, x20, 13 | ||
| # CHECK-ASM-AND-OBJ: ri.vinsert.v.x v1, zero, 1 | ||
| # CHECK-ASM: encoding: [0xdb,0x60,0x10,0x40] | ||
| ri.vinsert.v.x v1, x0, 1 | ||
| # CHECK-ASM-AND-OBJ: ri.vinsert.v.x v23, ra, 1 | ||
| # CHECK-ASM: encoding: [0xdb,0xeb,0x10,0x40] | ||
| ri.vinsert.v.x v23, x1, 1 | ||
|
|
||
| # CHECK-ASM-AND-OBJ: ri.vextract.x.v s4, v1, 13 | ||
| # CHECK-ASM: encoding: [0x5b,0xaa,0x16,0x5e] | ||
| ri.vextract.x.v x20, v1, 13 | ||
| # CHECK-ASM-AND-OBJ: ri.vextract.x.v s5, v2, 31 | ||
| # CHECK-ASM: encoding: [0xdb,0xaa,0x2f,0x5e] | ||
| ri.vextract.x.v x21, v2, 31 |
Uh oh!
There was an error while loading. Please reload this page.