@@ -196,10 +196,7 @@ static DecodeStatus DecodeVRRegisterClass(MCInst &Inst, uint32_t RegNo,
196
196
static DecodeStatus DecodeVRM2RegisterClass (MCInst &Inst, uint32_t RegNo,
197
197
uint64_t Address,
198
198
const MCDisassembler *Decoder) {
199
- if (RegNo >= 32 )
200
- return MCDisassembler::Fail;
201
-
202
- if (RegNo % 2 )
199
+ if (RegNo >= 32 || RegNo % 2 )
203
200
return MCDisassembler::Fail;
204
201
205
202
const RISCVDisassembler *Dis =
@@ -216,10 +213,7 @@ static DecodeStatus DecodeVRM2RegisterClass(MCInst &Inst, uint32_t RegNo,
216
213
static DecodeStatus DecodeVRM4RegisterClass (MCInst &Inst, uint32_t RegNo,
217
214
uint64_t Address,
218
215
const MCDisassembler *Decoder) {
219
- if (RegNo >= 32 )
220
- return MCDisassembler::Fail;
221
-
222
- if (RegNo % 4 )
216
+ if (RegNo >= 32 || RegNo % 4 )
223
217
return MCDisassembler::Fail;
224
218
225
219
const RISCVDisassembler *Dis =
@@ -236,10 +230,7 @@ static DecodeStatus DecodeVRM4RegisterClass(MCInst &Inst, uint32_t RegNo,
236
230
static DecodeStatus DecodeVRM8RegisterClass (MCInst &Inst, uint32_t RegNo,
237
231
uint64_t Address,
238
232
const MCDisassembler *Decoder) {
239
- if (RegNo >= 32 )
240
- return MCDisassembler::Fail;
241
-
242
- if (RegNo % 8 )
233
+ if (RegNo >= 32 || RegNo % 8 )
243
234
return MCDisassembler::Fail;
244
235
245
236
const RISCVDisassembler *Dis =
@@ -256,16 +247,11 @@ static DecodeStatus DecodeVRM8RegisterClass(MCInst &Inst, uint32_t RegNo,
256
247
static DecodeStatus decodeVMaskReg (MCInst &Inst, uint64_t RegNo,
257
248
uint64_t Address,
258
249
const MCDisassembler *Decoder) {
259
- MCRegister Reg = RISCV::NoRegister;
260
- switch (RegNo) {
261
- default :
250
+ if (RegNo > 2 ) {
262
251
return MCDisassembler::Fail;
263
- case 0 :
264
- Reg = RISCV::V0;
265
- break ;
266
- case 1 :
267
- break ;
268
252
}
253
+ MCRegister Reg = (RegNo == 0 ) ? RISCV::V0 : RISCV::NoRegister;
254
+
269
255
Inst.addOperand (MCOperand::createReg (Reg));
270
256
return MCDisassembler::Success;
271
257
}
0 commit comments