@@ -98,6 +98,24 @@ class PLUI_i<bits<7> funct7, string opcodestr>
9898 let Inst{23-15} = imm10{9-1};
9999}
100100
101+ // Common base for widening binary ops
102+ class RVPWideningBase<bits<2> w, bit arith_shift, string opcodestr>
103+ : RVInst<(outs GPRPairRV32:$rd), (ins GPR:$rs1, GPR:$rs2), opcodestr,
104+ "$rd, $rs1, $rs2", [], InstFormatOther> {
105+ bits<5> rs2;
106+ bits<5> rs1;
107+ bits<5> rd;
108+
109+ let Inst{31} = 0b0;
110+ let Inst{26-25} = w;
111+ let Inst{24-20} = rs2;
112+ let Inst{19-15} = rs1;
113+ let Inst{14-12} = 0b010;
114+ let Inst{11-8} = rd{4-1};
115+ let Inst{7} = arith_shift;
116+ let Inst{6-0} = OPC_OP_32.Value;
117+ }
118+
101119let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
102120class RVPShift_ri<bits<3> f, bits<3> funct3, string opcodestr, Operand ImmType>
103121 : RVInstIBase<funct3, OPC_OP_IMM_32, (outs GPR:$rd),
@@ -140,9 +158,10 @@ class RVPShiftB_ri<bits<3> f, bits<3> funct3, string opcodestr>
140158 let Inst{22-20} = shamt;
141159}
142160
161+ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
143162class RVPWideningShift_ri<bits<3> f, string opcodestr, Operand ImmType>
144163 : RVInst<(outs GPRPairRV32:$rd), (ins GPR:$rs1, ImmType:$shamt), opcodestr,
145- "$rd, $rs1, $shamt"> {
164+ "$rd, $rs1, $shamt", [], InstFormatOther > {
146165 bits<5> rs1;
147166 bits<5> rd;
148167
@@ -184,6 +203,13 @@ class RVPWideningShiftB_ri<bits<3> f, string opcodestr>
184203 let Inst{23-20} = shamt;
185204}
186205
206+ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
207+ class RVPWideningShift_rr<bits<3> f, bits<2> w, string opcodestr>
208+ : RVPWideningBase<w, 0b0, opcodestr> {
209+ let Inst{30-28} = f;
210+ let Inst{27} = 0b1;
211+ }
212+
187213let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
188214class RVPUnary_ri<bits<2> w, bits<5> uf, string opcodestr>
189215 : RVInstIBase<0b010, OPC_OP_IMM_32, (outs GPR:$rd), (ins GPR:$rs1),
@@ -212,6 +238,12 @@ class RVPBinary_rr<bits<4> f, bits<2> w, bits<3> funct3, string opcodestr>
212238 let Inst{26-25} = w;
213239}
214240
241+ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
242+ class RVPWideningBinary_rr<bits<4> f, bits<2> w, string opcodestr>
243+ : RVPWideningBase<w, 0b1, opcodestr> {
244+ let Inst{30-27} = f;
245+ }
246+
215247let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
216248class RVPTernary_rrr<bits<4> f, bits<2> w, bits<3> funct3, string opcodestr>
217249 : RVInstRBase<funct3, OPC_OP_32, (outs GPR:$rd_wb),
@@ -935,11 +967,92 @@ let Predicates = [HasStdExtP, IsRV32] in {
935967}
936968
937969let Predicates = [HasStdExtP, IsRV32] in {
938- def PWSLLI_B : RVPWideningShiftB_ri<0b000, "pwslli.b">;
939- def PWSLLI_H : RVPWideningShiftH_ri<0b000, "pwslli.h">;
940- def WSLLI : RVPWideningShiftW_ri<0b000, "wslli">;
941-
942- def PWSLAI_B : RVPWideningShiftB_ri<0b100, "pwslai.b">;
943- def PWSLAI_H : RVPWideningShiftH_ri<0b100, "pwslai.h">;
944- def WSLAI : RVPWideningShiftW_ri<0b100, "wslai">;
970+ def PWSLLI_B : RVPWideningShiftB_ri<0b000, "pwslli.b">;
971+ def PWSLLI_H : RVPWideningShiftH_ri<0b000, "pwslli.h">;
972+ def WSLLI : RVPWideningShiftW_ri<0b000, "wslli">;
973+
974+ def PWSLAI_B : RVPWideningShiftB_ri<0b100, "pwslai.b">;
975+ def PWSLAI_H : RVPWideningShiftH_ri<0b100, "pwslai.h">;
976+ def WSLAI : RVPWideningShiftW_ri<0b100, "wslai">;
977+
978+ def PWSLL_BS : RVPWideningShift_rr<0b000, 0b00, "pwsll.bs">;
979+ def PWSLL_HS : RVPWideningShift_rr<0b000, 0b01, "pwsll.hs">;
980+ def WSLL : RVPWideningShift_rr<0b000, 0b11, "wsll">;
981+
982+ def PWSLA_BS : RVPWideningShift_rr<0b100, 0b00, "pwsla.bs">;
983+ def PWSLA_HS : RVPWideningShift_rr<0b100, 0b01, "pwsla.hs">;
984+ def WSLA : RVPWideningShift_rr<0b100, 0b11, "wsla">;
985+
986+ def WZIP8P : RVPWideningShift_rr<0b111, 0b00, "wzip8p">;
987+ def WZIP16P : RVPWideningShift_rr<0b111, 0b01, "wzip16p">;
988+
989+ def PWADD_H : RVPWideningBinary_rr<0b0000, 0b00, "pwadd.h">;
990+ def WADD : RVPWideningBinary_rr<0b0000, 0b01, "wadd">;
991+ def PWADD_B : RVPWideningBinary_rr<0b0000, 0b10, "pwadd.b">;
992+ def PW2WADD_H : RVPWideningBinary_rr<0b0000, 0b11, "pw2wadd.h">;
993+
994+ def PWADDA_H : RVPWideningBinary_rr<0b0001, 0b00, "pwadda.h">;
995+ def WADDA : RVPWideningBinary_rr<0b0001, 0b01, "wadda">;
996+ def PWADDA_B : RVPWideningBinary_rr<0b0001, 0b10, "pwadda.b">;
997+ def PW2WADDA_H : RVPWideningBinary_rr<0b0001, 0b11, "pw2wadda.h">;
998+
999+ def PWADDU_H : RVPWideningBinary_rr<0b0010, 0b00, "pwaddu.h">;
1000+ def WADDU : RVPWideningBinary_rr<0b0010, 0b01, "waddu">;
1001+ def PWADDU_B : RVPWideningBinary_rr<0b0010, 0b10, "pwaddu.b">;
1002+ def PW2WADD_HX : RVPWideningBinary_rr<0b0010, 0b11, "pw2wadd.hx">;
1003+
1004+ def PWADDAU_H : RVPWideningBinary_rr<0b0011, 0b00, "pwaddau.h">;
1005+ def WADDAU : RVPWideningBinary_rr<0b0011, 0b01, "waddau">;
1006+ def PWADDAU_B : RVPWideningBinary_rr<0b0011, 0b10, "pwaddau.b">;
1007+ def PW2WADDA_HX : RVPWideningBinary_rr<0b0011, 0b11, "pw2wadda.hx">;
1008+
1009+ def PWMUL_H : RVPWideningBinary_rr<0b0100, 0b00, "pwmul.h">;
1010+ def WMUL : RVPWideningBinary_rr<0b0100, 0b01, "wmul">;
1011+ def PWMUL_B : RVPWideningBinary_rr<0b0100, 0b10, "pwmul.b">;
1012+ def PW2WADDU_H : RVPWideningBinary_rr<0b0100, 0b11, "pw2waddu.h">;
1013+
1014+ def PWMACC_H : RVPWideningBinary_rr<0b0101, 0b00, "pwmacc.h">;
1015+ def WMACC : RVPWideningBinary_rr<0b0101, 0b01, "wmacc">;
1016+ def PM2WADDAU_H : RVPWideningBinary_rr<0b0101, 0b11, "pm2waddau.h">;
1017+
1018+ def PWMULU_H : RVPWideningBinary_rr<0b0110, 0b00, "pwmulu.h">;
1019+ def WMULU : RVPWideningBinary_rr<0b0110, 0b01, "wmulu">;
1020+ def PWMULU_B : RVPWideningBinary_rr<0b0110, 0b10, "pwmulu.b">;
1021+
1022+ def PWMACCU_H : RVPWideningBinary_rr<0b0111, 0b00, "pwmaccu.h">;
1023+ def WMACCU : RVPWideningBinary_rr<0b0111, 0b01, "wmaccu">;
1024+
1025+ def PWSUB_H : RVPWideningBinary_rr<0b1000, 0b00, "pwsub.h">;
1026+ def WSUB : RVPWideningBinary_rr<0b1000, 0b01, "wsub">;
1027+ def PWSUB_B : RVPWideningBinary_rr<0b1000, 0b10, "pwsub.b">;
1028+ def PW2WSUB_H : RVPWideningBinary_rr<0b1000, 0b11, "pw2wsub.h">;
1029+
1030+ def PWSUBA_H : RVPWideningBinary_rr<0b1001, 0b00, "pwsuba.h">;
1031+ def WSUBA : RVPWideningBinary_rr<0b1001, 0b01, "wsuba">;
1032+ def PWSUBA_B : RVPWideningBinary_rr<0b1001, 0b10, "pwsuba.b">;
1033+ def PW2WSUBA_H : RVPWideningBinary_rr<0b1001, 0b11, "pw2wsuba.h">;
1034+
1035+ def PWSUBU_H : RVPWideningBinary_rr<0b1010, 0b00, "pwsubu.h">;
1036+ def WSUBU : RVPWideningBinary_rr<0b1010, 0b01, "wsubu">;
1037+ def PWSUBU_B : RVPWideningBinary_rr<0b1010, 0b10, "pwsubu.b">;
1038+ def PW2WSUB_HX : RVPWideningBinary_rr<0b1010, 0b11, "pw2wsub.hx">;
1039+
1040+ def PWSUBAU_H : RVPWideningBinary_rr<0b1011, 0b00, "pwsubau.h">;
1041+ def WSUBAU : RVPWideningBinary_rr<0b1011, 0b01, "wsubau">;
1042+ def PWSUBAU_B : RVPWideningBinary_rr<0b1011, 0b10, "pwsubau.b">;
1043+ def PW2WSUBA_HX : RVPWideningBinary_rr<0b1011, 0b11, "pw2wsuba.hx">;
1044+
1045+ def PWMULSU_H : RVPWideningBinary_rr<0b1100, 0b00, "pwmulsu.h">;
1046+ def WMULSU : RVPWideningBinary_rr<0b1100, 0b01, "wmulsu">;
1047+ def PWMULSU_B : RVPWideningBinary_rr<0b1100, 0b10, "pwmulsu.b">;
1048+ def PM2WADDSU_H : RVPWideningBinary_rr<0b1100, 0b11, "pm2waddsu.h">;
1049+
1050+ def PWMACCSU_H : RVPWideningBinary_rr<0b1101, 0b00, "pwmaccsu.h">;
1051+ def WMACCSU : RVPWideningBinary_rr<0b1101, 0b01, "wmaccsu">;
1052+ def PM2WADDASU_H : RVPWideningBinary_rr<0b1101, 0b11, "pm2waddasu.h">;
1053+
1054+ def PMQWACC_H : RVPWideningBinary_rr<0b1111, 0b00, "pmqwacc.h">;
1055+ def PMQWACC : RVPWideningBinary_rr<0b1111, 0b01, "pmqwacc">;
1056+ def PMQRWACC_H : RVPWideningBinary_rr<0b1111, 0b10, "pmqrwacc.h">;
1057+ def PMQRWACC : RVPWideningBinary_rr<0b1111, 0b11, "pmqrwacc">;
9451058} // Predicates = [HasStdExtP, IsRV32]
0 commit comments