Skip to content

Commit d664541

Browse files
committed
[RISCV] Remove zvk uimm constraints
Since the spec doesn't describe these behaviors as invalid, the llvm-mc should just make them take care by hardware. Differential Revision: https://reviews.llvm.org/D155669
1 parent cf119df commit d664541

File tree

6 files changed

+21
-25
lines changed

6 files changed

+21
-25
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,15 +1546,6 @@ bool RISCVAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
15461546
case Match_InvalidRnumArg: {
15471547
return generateImmOutOfRangeError(Operands, ErrorInfo, 0, 10);
15481548
}
1549-
case Match_InvalidRnumArg_0_7: {
1550-
return generateImmOutOfRangeError(Operands, ErrorInfo, 0, 7);
1551-
}
1552-
case Match_InvalidRnumArg_1_10: {
1553-
return generateImmOutOfRangeError(Operands, ErrorInfo, 1, 10);
1554-
}
1555-
case Match_InvalidRnumArg_2_14: {
1556-
return generateImmOutOfRangeError(Operands, ErrorInfo, 2, 14);
1557-
}
15581549
}
15591550

15601551
llvm_unreachable("Unknown match type detected!");

llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ let Predicates = [HasStdExtZvkned], RVVConstraint = NoConstraint in {
174174
defm VAESDM : VAES_MV_V_S<0b101000, 0b101001, 0b00000, OPMVV, "vaesdm">;
175175
defm VAESEF : VAES_MV_V_S<0b101000, 0b101001, 0b00011, OPMVV, "vaesef">;
176176
defm VAESEM : VAES_MV_V_S<0b101000, 0b101001, 0b00010, OPMVV, "vaesem">;
177-
def VAESKF1_VI : VAESKF_MV_I<0b100010, "vaeskf1.vi", rnum_1_10>;
178-
def VAESKF2_VI : VAESKF_MV_I<0b101010, "vaeskf2.vi", rnum_2_14>;
177+
def VAESKF1_VI : VAESKF_MV_I<0b100010, "vaeskf1.vi", uimm5>;
178+
def VAESKF2_VI : VAESKF_MV_I<0b101010, "vaeskf2.vi", uimm5>;
179179
def VAESZ_VS : PALUVs2NoVm<0b101001, 0b00111, OPMVV, "vaesz.vs">;
180180
} // Predicates = [HasStdExtZvkned]
181181

182182
let Predicates = [HasStdExtZvksed], RVVConstraint = NoConstraint in {
183-
def VSM4K_VI : PALUVINoVm<0b100001, "vsm4k.vi", rnum_0_7>;
183+
def VSM4K_VI : PALUVINoVm<0b100001, "vsm4k.vi", uimm5>;
184184
defm VSM4R : VAES_MV_V_S<0b101000, 0b101001, 0b10000, OPMVV, "vsm4r">;
185185
} // Predicates = [HasStdExtZvksed]
186186

llvm/test/MC/RISCV/rvv/zvkned-invalid.s

Lines changed: 0 additions & 8 deletions
This file was deleted.

llvm/test/MC/RISCV/rvv/zvkned.s

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,24 @@ vaeskf1.vi v10, v9, 1
6262
# CHECK-ERROR: instruction requires the following: 'Zvkned' (Vector AES Encryption & Decryption (Single Round)){{$}}
6363
# CHECK-UNKNOWN: 77 a5 90 8a <unknown>
6464

65+
vaeskf1.vi v10, v9, 31
66+
# CHECK-INST: vaeskf1.vi v10, v9, 31
67+
# CHECK-ENCODING: [0x77,0xa5,0x9f,0x8a]
68+
# CHECK-ERROR: instruction requires the following: 'Zvkned' (Vector AES Encryption & Decryption (Single Round)){{$}}
69+
# CHECK-UNKNOWN: 77 a5 9f 8a <unknown>
70+
6571
vaeskf2.vi v10, v9, 2
6672
# CHECK-INST: vaeskf2.vi v10, v9, 2
6773
# CHECK-ENCODING: [0x77,0x25,0x91,0xaa]
6874
# CHECK-ERROR: instruction requires the following: 'Zvkned' (Vector AES Encryption & Decryption (Single Round)){{$}}
6975
# CHECK-UNKNOWN: 77 25 91 aa <unknown>
7076

77+
vaeskf2.vi v10, v9, 31
78+
# CHECK-INST: vaeskf2.vi v10, v9, 31
79+
# CHECK-ENCODING: [0x77,0xa5,0x9f,0xaa]
80+
# CHECK-ERROR: instruction requires the following: 'Zvkned' (Vector AES Encryption & Decryption (Single Round)){{$}}
81+
# CHECK-UNKNOWN: 77 a5 9f aa <unknown>
82+
7183
vaesz.vs v10, v9
7284
# CHECK-INST: vaesz.vs v10, v9
7385
# CHECK-ENCODING: [0x77,0xa5,0x93,0xa6]

llvm/test/MC/RISCV/rvv/zvksed-invalid.s

Lines changed: 0 additions & 5 deletions
This file was deleted.

llvm/test/MC/RISCV/rvv/zvksed.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ vsm4k.vi v10, v9, 7
1414
# CHECK-ERROR: instruction requires the following: 'Zvksed' (SM4 Block Cipher Instructions){{$}}
1515
# CHECK-UNKNOWN: 77 a5 93 86 <unknown>
1616

17+
vsm4k.vi v10, v9, 31
18+
# CHECK-INST: vsm4k.vi v10, v9, 31
19+
# CHECK-ENCODING: [0x77,0xa5,0x9f,0x86]
20+
# CHECK-ERROR: instruction requires the following: 'Zvksed' (SM4 Block Cipher Instructions){{$}}
21+
# CHECK-UNKNOWN: 77 a5 9f 86 <unknown>
22+
1723
vsm4r.vv v10, v9
1824
# CHECK-INST: vsm4r.vv v10, v9
1925
# CHECK-ENCODING: [0x77,0x25,0x98,0xa2]

0 commit comments

Comments
 (0)