[PATCH] D14527: [mips][microMIPS] Implement PREPEND, RADDU.W.QB, RDDSP, REPL.PH, REPL.QB, REPLV.PH, REPLV.QB and MTHLIP instructions

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 01:47:55 PST 2015


dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM with a possible nit depending on the answer to my question.


================
Comment at: lib/Target/Mips/MicroMipsDSPInstrInfo.td:128-166
@@ -119,3 +127,41 @@
   "shllv_s.w", int_mips_shll_s_w, NoItinerary, GPR32Opnd>, Defs<[DSPOutFlag22]>;
 
-// Instruction defs.
+class RADDU_W_QB_MM_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
+                              InstrItinClass itin, RegisterOperand ROD,
+                              RegisterOperand ROS = ROD> {
+  dag OutOperandList = (outs ROD:$rt);
+  dag InOperandList = (ins ROS:$rs);
+  string AsmString = !strconcat(instr_asm, "\t$rt, $rs");
+  list<dag> Pattern = [(set ROD:$rt, (OpNode ROS:$rs))];
+  InstrItinClass Itinerary = itin;
+  string BaseOpcode = instr_asm;
+}
+
+class RADDU_W_QB_MM_DESC : RADDU_W_QB_MM_DESC_BASE<"raddu.w.qb",
+                                                   int_mips_raddu_w_qb,
+                                                   NoItinerary, GPR32Opnd,
+                                                   DSPROpnd>;
+
+class RDDSP_MM_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
+                         InstrItinClass itin> {
+  dag OutOperandList = (outs GPR32Opnd:$rt);
+  dag InOperandList = (ins uimm16:$mask);
+  string AsmString = !strconcat(instr_asm, "\t$rt, $mask");
+  list<dag> Pattern = [(set GPR32Opnd:$rt, (OpNode immZExt10:$mask))];
+  InstrItinClass Itinerary = itin;
+}
+
+class RDDSP_MM_DESC : RDDSP_MM_DESC_BASE<"rddsp", int_mips_rddsp, NoItinerary>;
+
+class REPL_QB_MM_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
+                           ImmLeaf immPat, InstrItinClass itin,
+                           RegisterOperand RO> {
+  dag OutOperandList = (outs RO:$rt);
+  dag InOperandList = (ins uimm16:$imm);
+  string AsmString = !strconcat(instr_asm, "\t$rt, $imm");
+  list<dag> Pattern = [(set RO:$rt, (OpNode immPat:$imm))];
+  InstrItinClass Itinerary = itin;
+}
+
+class REPL_QB_MM_DESC : REPL_QB_MM_DESC_BASE<"repl.qb", int_mips_repl_qb,
+                                             immZExt8, NoItinerary, DSPROpnd>;
----------------
Will each of these *_DESC_BASE's have more than one subclass? If not, you don't need a *_DESC_BASE and should just have a *_DESC


http://reviews.llvm.org/D14527





More information about the llvm-commits mailing list