[RISCV] Add register overlap checks to the assembler for some Zvk* instructions. (#86745)
From the spec | Instruction | Register | Cannot Overlap | | ----------- | -------- | -------------- | | vaes*.vs | vs2 | vd | | vsm4r.vs | vs2 | vd | | vsha2c[hl] | vs1, vs2 | vd | | vsha2ms | vs1, vs2 | vd | | sm3me | vs2 | vd | | vsm3c | vs2 | vd |
This commit is contained in:
parent
a7ac0dd624
commit
ecf6bb2b4d
@ -109,6 +109,8 @@ def Vrgather : RISCVVConstraint<!or(VS2Constraint.Value,
|
||||
VMConstraint.Value)>;
|
||||
def Vcompress : RISCVVConstraint<!or(VS2Constraint.Value,
|
||||
VS1Constraint.Value)>;
|
||||
def Sha2Constraint : RISCVVConstraint<!or(VS2Constraint.Value,
|
||||
VS1Constraint.Value)>;
|
||||
|
||||
// The following opcode names match those given in Table 19.1 in the
|
||||
// RISC-V User-level ISA specification ("RISC-V base opcode map").
|
||||
|
||||
@ -82,7 +82,9 @@ class PALUVs2NoVm<bits<6> funct6, bits<5> vs1, RISCVVFormat opv, string opcodest
|
||||
|
||||
multiclass VAES_MV_V_S<bits<6> funct6_vv, bits<6> funct6_vs, bits<5> vs1,
|
||||
RISCVVFormat opv, string opcodestr> {
|
||||
let RVVConstraint = NoConstraint in
|
||||
def NAME # _VV : PALUVs2NoVm<funct6_vv, vs1, opv, opcodestr # ".vv">;
|
||||
let RVVConstraint = VS2Constraint in
|
||||
def NAME # _VS : PALUVs2NoVm<funct6_vs, vs1, opv, opcodestr # ".vs">;
|
||||
}
|
||||
} // hasSideEffects = 0, mayLoad = 0, mayStore = 0
|
||||
@ -118,28 +120,30 @@ let Predicates = [HasStdExtZvkg], RVVConstraint = NoConstraint in {
|
||||
def VGMUL_VV : PALUVs2NoVm<0b101000, 0b10001, OPMVV, "vgmul.vv">;
|
||||
} // Predicates = [HasStdExtZvkg]
|
||||
|
||||
let Predicates = [HasStdExtZvknhaOrZvknhb], RVVConstraint = NoConstraint in {
|
||||
let Predicates = [HasStdExtZvknhaOrZvknhb], RVVConstraint = Sha2Constraint in {
|
||||
def VSHA2CH_VV : PALUVVNoVm<0b101110, OPMVV, "vsha2ch.vv">;
|
||||
def VSHA2CL_VV : PALUVVNoVm<0b101111, OPMVV, "vsha2cl.vv">;
|
||||
def VSHA2MS_VV : PALUVVNoVm<0b101101, OPMVV, "vsha2ms.vv">;
|
||||
} // Predicates = [HasStdExtZvknhaOrZvknhb]
|
||||
|
||||
let Predicates = [HasStdExtZvkned], RVVConstraint = NoConstraint in {
|
||||
let Predicates = [HasStdExtZvkned]in {
|
||||
defm VAESDF : VAES_MV_V_S<0b101000, 0b101001, 0b00001, OPMVV, "vaesdf">;
|
||||
defm VAESDM : VAES_MV_V_S<0b101000, 0b101001, 0b00000, OPMVV, "vaesdm">;
|
||||
defm VAESEF : VAES_MV_V_S<0b101000, 0b101001, 0b00011, OPMVV, "vaesef">;
|
||||
defm VAESEM : VAES_MV_V_S<0b101000, 0b101001, 0b00010, OPMVV, "vaesem">;
|
||||
def VAESKF1_VI : PALUVINoVm<0b100010, "vaeskf1.vi", uimm5>;
|
||||
def VAESKF2_VI : PALUVINoVm<0b101010, "vaeskf2.vi", uimm5>;
|
||||
let RVVConstraint = VS2Constraint in
|
||||
def VAESZ_VS : PALUVs2NoVm<0b101001, 0b00111, OPMVV, "vaesz.vs">;
|
||||
} // Predicates = [HasStdExtZvkned]
|
||||
|
||||
let Predicates = [HasStdExtZvksed], RVVConstraint = NoConstraint in {
|
||||
let Predicates = [HasStdExtZvksed] in {
|
||||
let RVVConstraint = NoConstraint in
|
||||
def VSM4K_VI : PALUVINoVm<0b100001, "vsm4k.vi", uimm5>;
|
||||
defm VSM4R : VAES_MV_V_S<0b101000, 0b101001, 0b10000, OPMVV, "vsm4r">;
|
||||
} // Predicates = [HasStdExtZvksed]
|
||||
|
||||
let Predicates = [HasStdExtZvksh], RVVConstraint = NoConstraint in {
|
||||
let Predicates = [HasStdExtZvksh], RVVConstraint = VS2Constraint in {
|
||||
def VSM3C_VI : PALUVINoVm<0b101011, "vsm3c.vi", uimm5>;
|
||||
def VSM3ME_VV : PALUVVNoVm<0b100000, OPMVV, "vsm3me.vv">;
|
||||
} // Predicates = [HasStdExtZvksh]
|
||||
|
||||
23
llvm/test/MC/RISCV/rvv/zvkned-invalid.s
Normal file
23
llvm/test/MC/RISCV/rvv/zvkned-invalid.s
Normal file
@ -0,0 +1,23 @@
|
||||
# RUN: not llvm-mc -triple=riscv64 --mattr=+zve64x --mattr=+zvkned %s 2>&1 \
|
||||
# RUN: | FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
vaesdf.vs v10, v10
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vaesdf.vs v10, v10
|
||||
|
||||
vaesef.vs v11, v11
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vaesef.vs v11, v11
|
||||
|
||||
vaesdm.vs v12, v12
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vaesdm.vs v12, v12
|
||||
|
||||
vaesem.vs v13, v13
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vaesem.vs v13, v13
|
||||
|
||||
vaesz.vs v14, v14
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vaesz.vs v14, v14
|
||||
|
||||
26
llvm/test/MC/RISCV/rvv/zvknh-invalid.s
Normal file
26
llvm/test/MC/RISCV/rvv/zvknh-invalid.s
Normal file
@ -0,0 +1,26 @@
|
||||
# RUN: not llvm-mc -triple=riscv64 --mattr=+zve64x --mattr=+zvknha %s 2>&1 \
|
||||
# RUN: | FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
vsha2ms.vv v10, v10, v11
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsha2ms.vv v10, v10, v11
|
||||
|
||||
vsha2ms.vv v11, v10, v11
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsha2ms.vv v11, v10, v11
|
||||
|
||||
vsha2ch.vv v12, v12, v11
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsha2ch.vv v12, v12, v11
|
||||
|
||||
vsha2ch.vv v11, v12, v11
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsha2ch.vv v11, v12, v11
|
||||
|
||||
vsha2cl.vv v13, v13, v15
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsha2cl.vv v13, v13, v15
|
||||
|
||||
vsha2cl.vv v15, v13, v15
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsha2cl.vv v15, v13, v15
|
||||
6
llvm/test/MC/RISCV/rvv/zvksed-invalid.s
Normal file
6
llvm/test/MC/RISCV/rvv/zvksed-invalid.s
Normal file
@ -0,0 +1,6 @@
|
||||
# RUN: not llvm-mc -triple=riscv64 --mattr=+zve64x --mattr=+zvksed %s 2>&1 \
|
||||
# RUN: | FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
vsm4r.vs v10, v10
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsm4r.vs v10, v10
|
||||
10
llvm/test/MC/RISCV/rvv/zvksh-invalid.s
Normal file
10
llvm/test/MC/RISCV/rvv/zvksh-invalid.s
Normal file
@ -0,0 +1,10 @@
|
||||
# RUN: not llvm-mc -triple=riscv64 --mattr=+zve64x --mattr=+zvksh %s 2>&1 \
|
||||
# RUN: | FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
vsm3me.vv v10, v10, v8
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsm3me.vv v10, v10, v8
|
||||
|
||||
vsm3c.vi v9, v9, 7
|
||||
# CHECK-ERROR: The destination vector register group cannot overlap the source vector register group.
|
||||
# CHECK-ERROR-LABEL: vsm3c.vi v9, v9, 7
|
||||
@ -19,3 +19,10 @@ vsm3me.vv v10, v9, v8
|
||||
# CHECK-ENCODING: [0x77,0x25,0x94,0x82]
|
||||
# CHECK-ERROR: instruction requires the following: 'Zvksh' (SM3 Hash Function Instructions){{$}}
|
||||
# CHECK-UNKNOWN: 77 25 94 82 <unknown>
|
||||
|
||||
# vs1 is allowed to overlap, but not vs2.
|
||||
vsm3me.vv v10, v9, v10
|
||||
# CHECK-INST: vsm3me.vv v10, v9, v10
|
||||
# CHECK-ENCODING: [0x77,0x25,0x95,0x82]
|
||||
# CHECK-ERROR: instruction requires the following: 'Zvksh' (SM3 Hash Function Instructions){{$}}
|
||||
# CHECK-UNKNOWN: 77 25 95 82 <unknown>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user