Skip to content

Commit 225cc50

Browse files
committed
fixup! Add RVPTernary_rrr for the instructions that read the destination register.
1 parent 0669cad commit 225cc50

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoP.td

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ class RVPBinary_rr<bits<4> f, bits<2> w, bits<3> funct3, string opcodestr>
158158
let Inst{26-25} = w;
159159
}
160160

161+
let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
162+
class RVPTernary_rrr<bits<4> f, bits<2> w, bits<3> funct3, string opcodestr>
163+
: RVInstRBase<funct3, OPC_OP_32, (outs GPR:$rd_wb),
164+
(ins GPR:$rd, GPR:$rs1, GPR:$rs2), opcodestr, "$rd, $rs1, $rs2"> {
165+
let Inst{31} = 0b1;
166+
let Inst{30-27} = f;
167+
let Inst{26-25} = w;
168+
169+
let Constraints = "$rd = $rd_wb";
170+
}
171+
161172
//===----------------------------------------------------------------------===//
162173
// Instructions
163174
//===----------------------------------------------------------------------===//
@@ -383,37 +394,37 @@ let Predicates = [HasStdExtP] in {
383394

384395
def PMUL_H_B01 : RVPBinary_rr<0b0010, 0b00, 0b001, "pmul.h.b01">;
385396

386-
def MVM : RVPBinary_rr<0b0101, 0b00, 0b001, "mvm">;
387-
def MVMN : RVPBinary_rr<0b0101, 0b01, 0b001, "mvmn">;
388-
def MERGE : RVPBinary_rr<0b0101, 0b10, 0b001, "merge">;
389-
def SRX : RVPBinary_rr<0b0101, 0b11, 0b001, "srx">;
397+
def MVM : RVPTernary_rrr<0b0101, 0b00, 0b001, "mvm">;
398+
def MVMN : RVPTernary_rrr<0b0101, 0b01, 0b001, "mvmn">;
399+
def MERGE : RVPTernary_rrr<0b0101, 0b10, 0b001, "merge">;
400+
def SRX : RVPTernary_rrr<0b0101, 0b11, 0b001, "srx">;
390401

391402
def PMULU_H_B01 : RVPBinary_rr<0b0110, 0b00, 0b001, "pmulu.h.b01">;
392403
def PDIFSUMU_B : RVPBinary_rr<0b0110, 0b10, 0b001, "pdifsumu.b">;
393404

394-
def PDIFSUMAU_B : RVPBinary_rr<0b0111, 0b10, 0b001, "pdifsumau.b">;
405+
def PDIFSUMAU_B : RVPTernary_rrr<0b0111, 0b10, 0b001, "pdifsumau.b">;
395406
} // Predicates = [HasStdExtP]
396407
let Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only" in {
397408
def MUL_H01 : RVPBinary_rr<0b0010, 0b01, 0b001, "mul.h01">;
398409

399-
def MACC_H01 : RVPBinary_rr<0b0011, 0b01, 0b001, "macc.h01">;
410+
def MACC_H01 : RVPTernary_rrr<0b0011, 0b01, 0b001, "macc.h01">;
400411

401412
def MULU_H01 : RVPBinary_rr<0b0110, 0b01, 0b001, "mulu.h01">;
402413

403-
def MACCU_H01 : RVPBinary_rr<0b0111, 0b01, 0b001, "maccu.h01">;
414+
def MACCU_H01 : RVPTernary_rrr<0b0111, 0b01, 0b001, "maccu.h01">;
404415
} // Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only"
405416
let Predicates = [HasStdExtP, IsRV64] in {
406417
def PMUL_W_H01 : RVPBinary_rr<0b0010, 0b01, 0b001, "pmul.w.h01">;
407418
def MUL_W01 : RVPBinary_rr<0b0010, 0b11, 0b001, "mul.w01">;
408419

409-
def PMACC_W_H01 : RVPBinary_rr<0b0011, 0b01, 0b001, "pmacc.w.h01">;
410-
def MACC_W01 : RVPBinary_rr<0b0011, 0b11, 0b001, "macc.w01">;
420+
def PMACC_W_H01 : RVPTernary_rrr<0b0011, 0b01, 0b001, "pmacc.w.h01">;
421+
def MACC_W01 : RVPTernary_rrr<0b0011, 0b11, 0b001, "macc.w01">;
411422

412423
def PMULU_W_H01 : RVPBinary_rr<0b0110, 0b01, 0b001, "pmulu.w.h01">;
413424
def MULU_W01 : RVPBinary_rr<0b0110, 0b11, 0b001, "mulu.w01">;
414425

415-
def PMACCU_W_H01 : RVPBinary_rr<0b0111, 0b01, 0b001, "pmaccu.w.h01">;
416-
def MACCU_W01 : RVPBinary_rr<0b0111, 0b11, 0b001, "maccu.w01">;
426+
def PMACCU_W_H01 : RVPTernary_rrr<0b0111, 0b01, 0b001, "pmaccu.w.h01">;
427+
def MACCU_W01 : RVPTernary_rrr<0b0111, 0b11, 0b001, "maccu.w01">;
417428
} // Predicates = [HasStdExtP, IsRV64]
418429

419430
// Note the spec has a 3-bit f field in bits 30:28 with 0 in bit 27.
@@ -458,64 +469,64 @@ let Predicates = [HasStdExtP] in {
458469
let Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only" in {
459470
def MUL_H00 : RVPBinary_rr<0b0000, 0b01, 0b011, "mul.h00">;
460471

461-
def MACC_H00 : RVPBinary_rr<0b0001, 0b01, 0b011, "macc.h00">;
472+
def MACC_H00 : RVPTernary_rrr<0b0001, 0b01, 0b011, "macc.h00">;
462473

463474
def MUL_H11 : RVPBinary_rr<0b0010, 0b01, 0b011, "mul.h11">;
464475

465-
def MACC_H11 : RVPBinary_rr<0b0011, 0b01, 0b011, "macc.h11">;
476+
def MACC_H11 : RVPTernary_rrr<0b0011, 0b01, 0b011, "macc.h11">;
466477

467478
def MULU_H00 : RVPBinary_rr<0b0100, 0b01, 0b011, "mulu.h00">;
468479

469-
def MACCU_H00 : RVPBinary_rr<0b0101, 0b01, 0b011, "maccu.h00">;
480+
def MACCU_H00 : RVPTernary_rrr<0b0101, 0b01, 0b011, "maccu.h00">;
470481

471482
def MULU_H11 : RVPBinary_rr<0b0110, 0b01, 0b011, "mulu.h11">;
472483

473-
def MACCU_H11 : RVPBinary_rr<0b0111, 0b01, 0b011, "maccu.h11">;
484+
def MACCU_H11 : RVPTernary_rrr<0b0111, 0b01, 0b011, "maccu.h11">;
474485

475486
def MULSU_H00 : RVPBinary_rr<0b1100, 0b01, 0b011, "mulsu.h00">;
476487

477-
def MACCSU_H00 : RVPBinary_rr<0b1101, 0b01, 0b011, "maccsu.h00">;
488+
def MACCSU_H00 : RVPTernary_rrr<0b1101, 0b01, 0b011, "maccsu.h00">;
478489

479490
def MULSU_H11 : RVPBinary_rr<0b1110, 0b01, 0b011, "mulsu.h11">;
480491

481-
def MACCSU_H11 : RVPBinary_rr<0b1111, 0b01, 0b011, "maccsu.h11">;
492+
def MACCSU_H11 : RVPTernary_rrr<0b1111, 0b01, 0b011, "maccsu.h11">;
482493
} // Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only"
483494
let Predicates = [HasStdExtP, IsRV64] in {
484495
def PMUL_W_H00 : RVPBinary_rr<0b0000, 0b01, 0b011, "pmul.w.h00">;
485496
def MUL_W00 : RVPBinary_rr<0b0000, 0b11, 0b011, "mul.w00">;
486497

487-
def PMACC_W_H00 : RVPBinary_rr<0b0001, 0b01, 0b011, "pmacc.w.h00">;
488-
def MACC_W00 : RVPBinary_rr<0b0001, 0b11, 0b011, "macc.w00">;
498+
def PMACC_W_H00 : RVPTernary_rrr<0b0001, 0b01, 0b011, "pmacc.w.h00">;
499+
def MACC_W00 : RVPTernary_rrr<0b0001, 0b11, 0b011, "macc.w00">;
489500

490501
def PMUL_W_H11 : RVPBinary_rr<0b0010, 0b01, 0b011, "pmul.w.h11">;
491502
def MUL_W11 : RVPBinary_rr<0b0010, 0b11, 0b011, "mul.w11">;
492503

493-
def PMACC_W_H11 : RVPBinary_rr<0b0011, 0b01, 0b011, "pmacc.w.h11">;
494-
def MACC_W11 : RVPBinary_rr<0b0011, 0b11, 0b011, "macc.w11">;
504+
def PMACC_W_H11 : RVPTernary_rrr<0b0011, 0b01, 0b011, "pmacc.w.h11">;
505+
def MACC_W11 : RVPTernary_rrr<0b0011, 0b11, 0b011, "macc.w11">;
495506

496507
def PMULU_W_H00 : RVPBinary_rr<0b0100, 0b01, 0b011, "pmulu.w.h00">;
497508
def MULU_W00 : RVPBinary_rr<0b0100, 0b11, 0b011, "mulu.w00">;
498509

499-
def PMACCU_W_H00 : RVPBinary_rr<0b0101, 0b01, 0b011, "pmaccu.w.h00">;
500-
def MACCU_W00 : RVPBinary_rr<0b0101, 0b11, 0b011, "maccu.w00">;
510+
def PMACCU_W_H00 : RVPTernary_rrr<0b0101, 0b01, 0b011, "pmaccu.w.h00">;
511+
def MACCU_W00 : RVPTernary_rrr<0b0101, 0b11, 0b011, "maccu.w00">;
501512

502513
def PMULU_W_H11 : RVPBinary_rr<0b0110, 0b01, 0b011, "pmulu.w.h11">;
503514
def MULU_W11 : RVPBinary_rr<0b0110, 0b11, 0b011, "mulu.w11">;
504515

505-
def PMACCU_W_H11 : RVPBinary_rr<0b0111, 0b01, 0b011, "pmaccu.w.h11">;
506-
def MACCU_W11 : RVPBinary_rr<0b0111, 0b11, 0b011, "maccu.w11">;
516+
def PMACCU_W_H11 : RVPTernary_rrr<0b0111, 0b01, 0b011, "pmaccu.w.h11">;
517+
def MACCU_W11 : RVPTernary_rrr<0b0111, 0b11, 0b011, "maccu.w11">;
507518

508519
def PMULSU_W_H00 : RVPBinary_rr<0b1100, 0b01, 0b011, "pmulsu.w.h00">;
509520
def MULSU_W00 : RVPBinary_rr<0b1100, 0b11, 0b011, "mulsu.w00">;
510521

511-
def PMACCSU_W_H00 : RVPBinary_rr<0b1101, 0b01, 0b011, "pmaccsu.w.h00">;
512-
def MACCSU_W00 : RVPBinary_rr<0b1101, 0b11, 0b011, "maccsu.w00">;
522+
def PMACCSU_W_H00 : RVPTernary_rrr<0b1101, 0b01, 0b011, "pmaccsu.w.h00">;
523+
def MACCSU_W00 : RVPTernary_rrr<0b1101, 0b11, 0b011, "maccsu.w00">;
513524

514525
def PMULSU_W_H11 : RVPBinary_rr<0b1110, 0b01, 0b011, "pmulsu.w.h11">;
515526
def MULSU_W11 : RVPBinary_rr<0b1110, 0b11, 0b011, "mulsu.w11">;
516527

517-
def PMACCSU_W_H11 : RVPBinary_rr<0b1111, 0b01, 0b011, "pmaccsu.w.h11">;
518-
def MACCSU_W11 : RVPBinary_rr<0b1111, 0b11, 0b011, "maccsu.w11">;
528+
def PMACCSU_W_H11 : RVPTernary_rrr<0b1111, 0b01, 0b011, "pmaccsu.w.h11">;
529+
def MACCSU_W11 : RVPTernary_rrr<0b1111, 0b11, 0b011, "maccsu.w11">;
519530
} // Predicates = [HasStdExtP, IsRV64]
520531

521532
// Note the spec has a 3-bit f field in bits 30:28 with 0 in bit 27.

0 commit comments

Comments
 (0)