7 (CCDSP_EF_REGNUM 187)])
9 ;; This mode macro allows si, v2hi, v4qi for all possible modes in DSP ASE.
10 (define_mode_macro DSP [(SI "TARGET_DSP")
14 ;; This mode macro allows v2hi, v4qi for vector/SIMD data.
15 (define_mode_macro DSPV [(V2HI "TARGET_DSP")
18 ;; This mode macro allows si, v2hi for Q31 and V2Q15 fixed-point data.
19 (define_mode_macro DSPQ [(SI "TARGET_DSP")
22 ;; DSP instructions use q for fixed-point data, and u for integer in the infix.
23 (define_mode_attr dspfmt1 [(SI "q") (V2HI "q") (V4QI "u")])
25 ;; DSP instructions use nothing for fixed-point data, and u for integer in
27 (define_mode_attr dspfmt1_1 [(SI "") (V2HI "") (V4QI "u")])
29 ;; DSP instructions use w, ph, qb in the postfix.
30 (define_mode_attr dspfmt2 [(SI "w") (V2HI "ph") (V4QI "qb")])
32 ;; DSP shift masks for SI, V2HI, V4QI.
33 (define_mode_attr dspshift_mask [(SI "0x1f") (V2HI "0xf") (V4QI "0x7")])
35 ;; MIPS DSP ASE Revision 0.98 3/24/2005
36 ;; Table 2-1. MIPS DSP ASE Instructions: Arithmetic
38 (define_insn "add<DSPV:mode>3"
40 [(set (match_operand:DSPV 0 "register_operand" "=d")
41 (plus:DSPV (match_operand:DSPV 1 "register_operand" "d")
42 (match_operand:DSPV 2 "register_operand" "d")))
43 (set (reg:CCDSP CCDSP_OU_REGNUM)
44 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDQ))])]
46 "add<DSPV:dspfmt1>.<DSPV:dspfmt2>\t%0,%1,%2"
47 [(set_attr "type" "arith")
48 (set_attr "mode" "SI")])
50 (define_insn "mips_add<DSP:dspfmt1>_s_<DSP:dspfmt2>"
52 [(set (match_operand:DSP 0 "register_operand" "=d")
53 (unspec:DSP [(match_operand:DSP 1 "register_operand" "d")
54 (match_operand:DSP 2 "register_operand" "d")]
56 (set (reg:CCDSP CCDSP_OU_REGNUM)
57 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDQ_S))])]
59 "add<DSP:dspfmt1>_s.<DSP:dspfmt2>\t%0,%1,%2"
60 [(set_attr "type" "arith")
61 (set_attr "mode" "SI")])
64 (define_insn "sub<DSPV:mode>3"
66 [(set (match_operand:DSPV 0 "register_operand" "=d")
67 (minus:DSPV (match_operand:DSPV 1 "register_operand" "d")
68 (match_operand:DSPV 2 "register_operand" "d")))
69 (set (reg:CCDSP CCDSP_OU_REGNUM)
70 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBQ))])]
72 "sub<DSPV:dspfmt1>.<DSPV:dspfmt2>\t%0,%1,%2"
73 [(set_attr "type" "arith")
74 (set_attr "mode" "SI")])
76 (define_insn "mips_sub<DSP:dspfmt1>_s_<DSP:dspfmt2>"
78 [(set (match_operand:DSP 0 "register_operand" "=d")
79 (unspec:DSP [(match_operand:DSP 1 "register_operand" "d")
80 (match_operand:DSP 2 "register_operand" "d")]
82 (set (reg:CCDSP CCDSP_OU_REGNUM)
83 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBQ_S))])]
85 "sub<DSP:dspfmt1>_s.<DSP:dspfmt2>\t%0,%1,%2"
86 [(set_attr "type" "arith")
87 (set_attr "mode" "SI")])
90 (define_insn "mips_addsc"
92 [(set (match_operand:SI 0 "register_operand" "=d")
93 (unspec:SI [(match_operand:SI 1 "register_operand" "d")
94 (match_operand:SI 2 "register_operand" "d")]
96 (set (reg:CCDSP CCDSP_CA_REGNUM)
97 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDSC))])]
100 [(set_attr "type" "arith")
101 (set_attr "mode" "SI")])
104 (define_insn "mips_addwc"
106 [(set (match_operand:SI 0 "register_operand" "=d")
107 (unspec:SI [(match_operand:SI 1 "register_operand" "d")
108 (match_operand:SI 2 "register_operand" "d")
109 (reg:CCDSP CCDSP_CA_REGNUM)]
111 (set (reg:CCDSP CCDSP_OU_REGNUM)
112 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDWC))])]
115 [(set_attr "type" "arith")
116 (set_attr "mode" "SI")])
119 (define_insn "mips_modsub"
120 [(set (match_operand:SI 0 "register_operand" "=d")
121 (unspec:SI [(match_operand:SI 1 "register_operand" "d")
122 (match_operand:SI 2 "register_operand" "d")]
126 [(set_attr "type" "arith")
127 (set_attr "mode" "SI")])
130 (define_insn "mips_raddu_w_qb"
131 [(set (match_operand:SI 0 "register_operand" "=d")
132 (unspec:SI [(match_operand:V4QI 1 "register_operand" "d")]
136 [(set_attr "type" "arith")
137 (set_attr "mode" "SI")])
140 (define_insn "mips_absq_s_<DSPQ:dspfmt2>"
142 [(set (match_operand:DSPQ 0 "register_operand" "=d")
143 (unspec:DSPQ [(match_operand:DSPQ 1 "register_operand" "d")]
145 (set (reg:CCDSP CCDSP_OU_REGNUM)
146 (unspec:CCDSP [(match_dup 1)] UNSPEC_ABSQ_S))])]
148 "absq_s.<DSPQ:dspfmt2>\t%0,%1"
149 [(set_attr "type" "arith")
150 (set_attr "mode" "SI")])
153 (define_insn "mips_precrq_qb_ph"
154 [(set (match_operand:V4QI 0 "register_operand" "=d")
155 (unspec:V4QI [(match_operand:V2HI 1 "register_operand" "d")
156 (match_operand:V2HI 2 "register_operand" "d")]
157 UNSPEC_PRECRQ_QB_PH))]
159 "precrq.qb.ph\t%0,%1,%2"
160 [(set_attr "type" "arith")
161 (set_attr "mode" "SI")])
163 (define_insn "mips_precrq_ph_w"
164 [(set (match_operand:V2HI 0 "register_operand" "=d")
165 (unspec:V2HI [(match_operand:SI 1 "register_operand" "d")
166 (match_operand:SI 2 "register_operand" "d")]
167 UNSPEC_PRECRQ_PH_W))]
169 "precrq.ph.w\t%0,%1,%2"
170 [(set_attr "type" "arith")
171 (set_attr "mode" "SI")])
173 (define_insn "mips_precrq_rs_ph_w"
175 [(set (match_operand:V2HI 0 "register_operand" "=d")
176 (unspec:V2HI [(match_operand:SI 1 "register_operand" "d")
177 (match_operand:SI 2 "register_operand" "d")]
178 UNSPEC_PRECRQ_RS_PH_W))
179 (set (reg:CCDSP CCDSP_OU_REGNUM)
180 (unspec:CCDSP [(match_dup 1) (match_dup 2)]
181 UNSPEC_PRECRQ_RS_PH_W))])]
183 "precrq_rs.ph.w\t%0,%1,%2"
184 [(set_attr "type" "arith")
185 (set_attr "mode" "SI")])
188 (define_insn "mips_precrqu_s_qb_ph"
190 [(set (match_operand:V4QI 0 "register_operand" "=d")
191 (unspec:V4QI [(match_operand:V2HI 1 "register_operand" "d")
192 (match_operand:V2HI 2 "register_operand" "d")]
193 UNSPEC_PRECRQU_S_QB_PH))
194 (set (reg:CCDSP CCDSP_OU_REGNUM)
195 (unspec:CCDSP [(match_dup 1) (match_dup 2)]
196 UNSPEC_PRECRQU_S_QB_PH))])]
198 "precrqu_s.qb.ph\t%0,%1,%2"
199 [(set_attr "type" "arith")
200 (set_attr "mode" "SI")])
203 (define_insn "mips_preceq_w_phl"
204 [(set (match_operand:SI 0 "register_operand" "=d")
205 (unspec:SI [(match_operand:V2HI 1 "register_operand" "d")]
206 UNSPEC_PRECEQ_W_PHL))]
208 "preceq.w.phl\t%0,%1"
209 [(set_attr "type" "arith")
210 (set_attr "mode" "SI")])
212 (define_insn "mips_preceq_w_phr"
213 [(set (match_operand:SI 0 "register_operand" "=d")
214 (unspec:SI [(match_operand:V2HI 1 "register_operand" "d")]
215 UNSPEC_PRECEQ_W_PHR))]
217 "preceq.w.phr\t%0,%1"
218 [(set_attr "type" "arith")
219 (set_attr "mode" "SI")])
222 (define_insn "mips_precequ_ph_qbl"
223 [(set (match_operand:V2HI 0 "register_operand" "=d")
224 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
225 UNSPEC_PRECEQU_PH_QBL))]
227 "precequ.ph.qbl\t%0,%1"
228 [(set_attr "type" "arith")
229 (set_attr "mode" "SI")])
231 (define_insn "mips_precequ_ph_qbr"
232 [(set (match_operand:V2HI 0 "register_operand" "=d")
233 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
234 UNSPEC_PRECEQU_PH_QBR))]
236 "precequ.ph.qbr\t%0,%1"
237 [(set_attr "type" "arith")
238 (set_attr "mode" "SI")])
240 (define_insn "mips_precequ_ph_qbla"
241 [(set (match_operand:V2HI 0 "register_operand" "=d")
242 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
243 UNSPEC_PRECEQU_PH_QBLA))]
245 "precequ.ph.qbla\t%0,%1"
246 [(set_attr "type" "arith")
247 (set_attr "mode" "SI")])
249 (define_insn "mips_precequ_ph_qbra"
250 [(set (match_operand:V2HI 0 "register_operand" "=d")
251 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
252 UNSPEC_PRECEQU_PH_QBRA))]
254 "precequ.ph.qbra\t%0,%1"
255 [(set_attr "type" "arith")
256 (set_attr "mode" "SI")])
259 (define_insn "mips_preceu_ph_qbl"
260 [(set (match_operand:V2HI 0 "register_operand" "=d")
261 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
262 UNSPEC_PRECEU_PH_QBL))]
264 "preceu.ph.qbl\t%0,%1"
265 [(set_attr "type" "arith")
266 (set_attr "mode" "SI")])
268 (define_insn "mips_preceu_ph_qbr"
269 [(set (match_operand:V2HI 0 "register_operand" "=d")
270 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
271 UNSPEC_PRECEU_PH_QBR))]
273 "preceu.ph.qbr\t%0,%1"
274 [(set_attr "type" "arith")
275 (set_attr "mode" "SI")])
277 (define_insn "mips_preceu_ph_qbla"
278 [(set (match_operand:V2HI 0 "register_operand" "=d")
279 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
280 UNSPEC_PRECEU_PH_QBLA))]
282 "preceu.ph.qbla\t%0,%1"
283 [(set_attr "type" "arith")
284 (set_attr "mode" "SI")])
286 (define_insn "mips_preceu_ph_qbra"
287 [(set (match_operand:V2HI 0 "register_operand" "=d")
288 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")]
289 UNSPEC_PRECEU_PH_QBRA))]
291 "preceu.ph.qbra\t%0,%1"
292 [(set_attr "type" "arith")
293 (set_attr "mode" "SI")])
295 ;; Table 2-2. MIPS DSP ASE Instructions: Shift
297 (define_insn "mips_shll_<DSPV:dspfmt2>"
299 [(set (match_operand:DSPV 0 "register_operand" "=d,d")
300 (unspec:DSPV [(match_operand:DSPV 1 "register_operand" "d,d")
301 (match_operand:SI 2 "arith_operand" "I,d")]
303 (set (reg:CCDSP CCDSP_OU_REGNUM)
304 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SHLL))])]
307 if (which_alternative == 0)
309 if (INTVAL (operands[2])
310 & ~(unsigned HOST_WIDE_INT) <DSPV:dspshift_mask>)
311 operands[2] = GEN_INT (INTVAL (operands[2]) & <DSPV:dspshift_mask>);
312 return "shll.<DSPV:dspfmt2>\t%0,%1,%2";
314 return "shllv.<DSPV:dspfmt2>\t%0,%1,%2";
316 [(set_attr "type" "shift")
317 (set_attr "mode" "SI")])
319 (define_insn "mips_shll_s_<DSPQ:dspfmt2>"
321 [(set (match_operand:DSPQ 0 "register_operand" "=d,d")
322 (unspec:DSPQ [(match_operand:DSPQ 1 "register_operand" "d,d")
323 (match_operand:SI 2 "arith_operand" "I,d")]
325 (set (reg:CCDSP CCDSP_OU_REGNUM)
326 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SHLL_S))])]
329 if (which_alternative == 0)
331 if (INTVAL (operands[2])
332 & ~(unsigned HOST_WIDE_INT) <DSPQ:dspshift_mask>)
333 operands[2] = GEN_INT (INTVAL (operands[2]) & <DSPQ:dspshift_mask>);
334 return "shll_s.<DSPQ:dspfmt2>\t%0,%1,%2";
336 return "shllv_s.<DSPQ:dspfmt2>\t%0,%1,%2";
338 [(set_attr "type" "shift")
339 (set_attr "mode" "SI")])
342 (define_insn "mips_shrl_qb"
343 [(set (match_operand:V4QI 0 "register_operand" "=d,d")
344 (unspec:V4QI [(match_operand:V4QI 1 "register_operand" "d,d")
345 (match_operand:SI 2 "arith_operand" "I,d")]
349 if (which_alternative == 0)
351 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x7)
352 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x7);
353 return "shrl.qb\t%0,%1,%2";
355 return "shrlv.qb\t%0,%1,%2";
357 [(set_attr "type" "shift")
358 (set_attr "mode" "SI")])
361 (define_insn "mips_shra_ph"
362 [(set (match_operand:V2HI 0 "register_operand" "=d,d")
363 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "d,d")
364 (match_operand:SI 2 "arith_operand" "I,d")]
368 if (which_alternative == 0)
370 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0xf)
371 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xf);
372 return "shra.ph\t%0,%1,%2";
374 return "shrav.ph\t%0,%1,%2";
376 [(set_attr "type" "shift")
377 (set_attr "mode" "SI")])
379 (define_insn "mips_shra_r_<DSPQ:dspfmt2>"
380 [(set (match_operand:DSPQ 0 "register_operand" "=d,d")
381 (unspec:DSPQ [(match_operand:DSPQ 1 "register_operand" "d,d")
382 (match_operand:SI 2 "arith_operand" "I,d")]
386 if (which_alternative == 0)
388 if (INTVAL (operands[2])
389 & ~(unsigned HOST_WIDE_INT) <DSPQ:dspshift_mask>)
390 operands[2] = GEN_INT (INTVAL (operands[2]) & <DSPQ:dspshift_mask>);
391 return "shra_r.<DSPQ:dspfmt2>\t%0,%1,%2";
393 return "shrav_r.<DSPQ:dspfmt2>\t%0,%1,%2";
395 [(set_attr "type" "shift")
396 (set_attr "mode" "SI")])
398 ;; Table 2-3. MIPS DSP ASE Instructions: Multiply
400 (define_insn "mips_muleu_s_ph_qbl"
402 [(set (match_operand:V2HI 0 "register_operand" "=d")
403 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")
404 (match_operand:V2HI 2 "register_operand" "d")]
405 UNSPEC_MULEU_S_PH_QBL))
406 (set (reg:CCDSP CCDSP_OU_REGNUM)
407 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_MULEU_S_PH_QBL))
408 (clobber (match_scratch:DI 3 "=x"))])]
410 "muleu_s.ph.qbl\t%0,%1,%2"
411 [(set_attr "type" "imul3")
412 (set_attr "mode" "SI")])
414 (define_insn "mips_muleu_s_ph_qbr"
416 [(set (match_operand:V2HI 0 "register_operand" "=d")
417 (unspec:V2HI [(match_operand:V4QI 1 "register_operand" "d")
418 (match_operand:V2HI 2 "register_operand" "d")]
419 UNSPEC_MULEU_S_PH_QBR))
420 (set (reg:CCDSP CCDSP_OU_REGNUM)
421 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_MULEU_S_PH_QBR))
422 (clobber (match_scratch:DI 3 "=x"))])]
424 "muleu_s.ph.qbr\t%0,%1,%2"
425 [(set_attr "type" "imul3")
426 (set_attr "mode" "SI")])
429 (define_insn "mips_mulq_rs_ph"
431 [(set (match_operand:V2HI 0 "register_operand" "=d")
432 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "d")
433 (match_operand:V2HI 2 "register_operand" "d")]
435 (set (reg:CCDSP CCDSP_OU_REGNUM)
436 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_MULQ_RS_PH))
437 (clobber (match_scratch:DI 3 "=x"))])]
439 "mulq_rs.ph\t%0,%1,%2"
440 [(set_attr "type" "imul3")
441 (set_attr "mode" "SI")])
444 (define_insn "mips_muleq_s_w_phl"
446 [(set (match_operand:SI 0 "register_operand" "=d")
447 (unspec:SI [(match_operand:V2HI 1 "register_operand" "d")
448 (match_operand:V2HI 2 "register_operand" "d")]
449 UNSPEC_MULEQ_S_W_PHL))
450 (set (reg:CCDSP CCDSP_OU_REGNUM)
451 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_MULEQ_S_W_PHL))
452 (clobber (match_scratch:DI 3 "=x"))])]
454 "muleq_s.w.phl\t%0,%1,%2"
455 [(set_attr "type" "imul3")
456 (set_attr "mode" "SI")])
458 (define_insn "mips_muleq_s_w_phr"
460 [(set (match_operand:SI 0 "register_operand" "=d")
461 (unspec:SI [(match_operand:V2HI 1 "register_operand" "d")
462 (match_operand:V2HI 2 "register_operand" "d")]
463 UNSPEC_MULEQ_S_W_PHR))
464 (set (reg:CCDSP CCDSP_OU_REGNUM)
465 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_MULEQ_S_W_PHR))
466 (clobber (match_scratch:DI 3 "=x"))])]
468 "muleq_s.w.phr\t%0,%1,%2"
469 [(set_attr "type" "imul3")
470 (set_attr "mode" "SI")])
473 (define_insn "mips_dpau_h_qbl"
474 [(set (match_operand:DI 0 "register_operand" "=a")
475 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
476 (match_operand:V4QI 2 "register_operand" "d")
477 (match_operand:V4QI 3 "register_operand" "d")]
479 "TARGET_DSP && !TARGET_64BIT"
480 "dpau.h.qbl\t%q0,%2,%3"
481 [(set_attr "type" "imadd")
482 (set_attr "mode" "SI")])
484 (define_insn "mips_dpau_h_qbr"
485 [(set (match_operand:DI 0 "register_operand" "=a")
486 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
487 (match_operand:V4QI 2 "register_operand" "d")
488 (match_operand:V4QI 3 "register_operand" "d")]
490 "TARGET_DSP && !TARGET_64BIT"
491 "dpau.h.qbr\t%q0,%2,%3"
492 [(set_attr "type" "imadd")
493 (set_attr "mode" "SI")])
496 (define_insn "mips_dpsu_h_qbl"
497 [(set (match_operand:DI 0 "register_operand" "=a")
498 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
499 (match_operand:V4QI 2 "register_operand" "d")
500 (match_operand:V4QI 3 "register_operand" "d")]
502 "TARGET_DSP && !TARGET_64BIT"
503 "dpsu.h.qbl\t%q0,%2,%3"
504 [(set_attr "type" "imadd")
505 (set_attr "mode" "SI")])
507 (define_insn "mips_dpsu_h_qbr"
508 [(set (match_operand:DI 0 "register_operand" "=a")
509 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
510 (match_operand:V4QI 2 "register_operand" "d")
511 (match_operand:V4QI 3 "register_operand" "d")]
513 "TARGET_DSP && !TARGET_64BIT"
514 "dpsu.h.qbr\t%q0,%2,%3"
515 [(set_attr "type" "imadd")
516 (set_attr "mode" "SI")])
519 (define_insn "mips_dpaq_s_w_ph"
521 [(set (match_operand:DI 0 "register_operand" "=a")
522 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
523 (match_operand:V2HI 2 "register_operand" "d")
524 (match_operand:V2HI 3 "register_operand" "d")]
526 (set (reg:CCDSP CCDSP_OU_REGNUM)
527 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
528 UNSPEC_DPAQ_S_W_PH))])]
529 "TARGET_DSP && !TARGET_64BIT"
530 "dpaq_s.w.ph\t%q0,%2,%3"
531 [(set_attr "type" "imadd")
532 (set_attr "mode" "SI")])
535 (define_insn "mips_dpsq_s_w_ph"
537 [(set (match_operand:DI 0 "register_operand" "=a")
538 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
539 (match_operand:V2HI 2 "register_operand" "d")
540 (match_operand:V2HI 3 "register_operand" "d")]
542 (set (reg:CCDSP CCDSP_OU_REGNUM)
543 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
544 UNSPEC_DPSQ_S_W_PH))])]
545 "TARGET_DSP && !TARGET_64BIT"
546 "dpsq_s.w.ph\t%q0,%2,%3"
547 [(set_attr "type" "imadd")
548 (set_attr "mode" "SI")])
551 (define_insn "mips_mulsaq_s_w_ph"
553 [(set (match_operand:DI 0 "register_operand" "=a")
554 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
555 (match_operand:V2HI 2 "register_operand" "d")
556 (match_operand:V2HI 3 "register_operand" "d")]
557 UNSPEC_MULSAQ_S_W_PH))
558 (set (reg:CCDSP CCDSP_OU_REGNUM)
559 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
560 UNSPEC_MULSAQ_S_W_PH))])]
561 "TARGET_DSP && !TARGET_64BIT"
562 "mulsaq_s.w.ph\t%q0,%2,%3"
563 [(set_attr "type" "imadd")
564 (set_attr "mode" "SI")])
567 (define_insn "mips_dpaq_sa_l_w"
569 [(set (match_operand:DI 0 "register_operand" "=a")
570 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
571 (match_operand:SI 2 "register_operand" "d")
572 (match_operand:SI 3 "register_operand" "d")]
574 (set (reg:CCDSP CCDSP_OU_REGNUM)
575 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
576 UNSPEC_DPAQ_SA_L_W))])]
577 "TARGET_DSP && !TARGET_64BIT"
578 "dpaq_sa.l.w\t%q0,%2,%3"
579 [(set_attr "type" "imadd")
580 (set_attr "mode" "SI")])
583 (define_insn "mips_dpsq_sa_l_w"
585 [(set (match_operand:DI 0 "register_operand" "=a")
586 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
587 (match_operand:SI 2 "register_operand" "d")
588 (match_operand:SI 3 "register_operand" "d")]
590 (set (reg:CCDSP CCDSP_OU_REGNUM)
591 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
592 UNSPEC_DPSQ_SA_L_W))])]
593 "TARGET_DSP && !TARGET_64BIT"
594 "dpsq_sa.l.w\t%q0,%2,%3"
595 [(set_attr "type" "imadd")
596 (set_attr "mode" "SI")])
599 (define_insn "mips_maq_s_w_phl"
601 [(set (match_operand:DI 0 "register_operand" "=a")
602 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
603 (match_operand:V2HI 2 "register_operand" "d")
604 (match_operand:V2HI 3 "register_operand" "d")]
606 (set (reg:CCDSP CCDSP_OU_REGNUM)
607 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
608 UNSPEC_MAQ_S_W_PHL))])]
609 "TARGET_DSP && !TARGET_64BIT"
610 "maq_s.w.phl\t%q0,%2,%3"
611 [(set_attr "type" "imadd")
612 (set_attr "mode" "SI")])
614 (define_insn "mips_maq_s_w_phr"
616 [(set (match_operand:DI 0 "register_operand" "=a")
617 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
618 (match_operand:V2HI 2 "register_operand" "d")
619 (match_operand:V2HI 3 "register_operand" "d")]
621 (set (reg:CCDSP CCDSP_OU_REGNUM)
622 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
623 UNSPEC_MAQ_S_W_PHR))])]
624 "TARGET_DSP && !TARGET_64BIT"
625 "maq_s.w.phr\t%q0,%2,%3"
626 [(set_attr "type" "imadd")
627 (set_attr "mode" "SI")])
630 (define_insn "mips_maq_sa_w_phl"
632 [(set (match_operand:DI 0 "register_operand" "=a")
633 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
634 (match_operand:V2HI 2 "register_operand" "d")
635 (match_operand:V2HI 3 "register_operand" "d")]
636 UNSPEC_MAQ_SA_W_PHL))
637 (set (reg:CCDSP CCDSP_OU_REGNUM)
638 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
639 UNSPEC_MAQ_SA_W_PHL))])]
640 "TARGET_DSP && !TARGET_64BIT"
641 "maq_sa.w.phl\t%q0,%2,%3"
642 [(set_attr "type" "imadd")
643 (set_attr "mode" "SI")])
645 (define_insn "mips_maq_sa_w_phr"
647 [(set (match_operand:DI 0 "register_operand" "=a")
648 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
649 (match_operand:V2HI 2 "register_operand" "d")
650 (match_operand:V2HI 3 "register_operand" "d")]
651 UNSPEC_MAQ_SA_W_PHR))
652 (set (reg:CCDSP CCDSP_OU_REGNUM)
653 (unspec:CCDSP [(match_dup 1) (match_dup 2) (match_dup 3)]
654 UNSPEC_MAQ_SA_W_PHR))])]
655 "TARGET_DSP && !TARGET_64BIT"
656 "maq_sa.w.phr\t%q0,%2,%3"
657 [(set_attr "type" "imadd")
658 (set_attr "mode" "SI")])
660 ;; Table 2-4. MIPS DSP ASE Instructions: General Bit/Manipulation
662 (define_insn "mips_bitrev"
663 [(set (match_operand:SI 0 "register_operand" "=d")
664 (unspec:SI [(match_operand:SI 1 "register_operand" "d")]
668 [(set_attr "type" "arith")
669 (set_attr "mode" "SI")])
672 (define_insn "mips_insv"
673 [(set (match_operand:SI 0 "register_operand" "=d")
674 (unspec:SI [(match_operand:SI 1 "register_operand" "0")
675 (match_operand:SI 2 "register_operand" "d")
676 (reg:CCDSP CCDSP_SC_REGNUM)
677 (reg:CCDSP CCDSP_PO_REGNUM)]
681 [(set_attr "type" "arith")
682 (set_attr "mode" "SI")])
685 (define_insn "mips_repl_qb"
686 [(set (match_operand:V4QI 0 "register_operand" "=d,d")
687 (unspec:V4QI [(match_operand:SI 1 "arith_operand" "I,d")]
691 if (which_alternative == 0)
693 if (INTVAL (operands[1]) & ~(unsigned HOST_WIDE_INT) 0xff)
694 operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
695 return "repl.qb\t%0,%1";
697 return "replv.qb\t%0,%1";
699 [(set_attr "type" "arith")
700 (set_attr "mode" "SI")])
702 (define_insn "mips_repl_ph"
703 [(set (match_operand:V2HI 0 "register_operand" "=d,d")
704 (unspec:V2HI [(match_operand:SI 1 "reg_imm10_operand" "YB,d")]
710 [(set_attr "type" "arith")
711 (set_attr "mode" "SI")])
713 ;; Table 2-5. MIPS DSP ASE Instructions: Compare-Pick
715 (define_insn "mips_cmp<DSPV:dspfmt1_1>_eq_<DSPV:dspfmt2>"
716 [(set (reg:CCDSP CCDSP_CC_REGNUM)
717 (unspec:CCDSP [(match_operand:DSPV 0 "register_operand" "d")
718 (match_operand:DSPV 1 "register_operand" "d")
719 (reg:CCDSP CCDSP_CC_REGNUM)]
722 "cmp<DSPV:dspfmt1_1>.eq.<DSPV:dspfmt2>\t%0,%1"
723 [(set_attr "type" "arith")
724 (set_attr "mode" "SI")])
726 (define_insn "mips_cmp<DSPV:dspfmt1_1>_lt_<DSPV:dspfmt2>"
727 [(set (reg:CCDSP CCDSP_CC_REGNUM)
728 (unspec:CCDSP [(match_operand:DSPV 0 "register_operand" "d")
729 (match_operand:DSPV 1 "register_operand" "d")
730 (reg:CCDSP CCDSP_CC_REGNUM)]
733 "cmp<DSPV:dspfmt1_1>.lt.<DSPV:dspfmt2>\t%0,%1"
734 [(set_attr "type" "arith")
735 (set_attr "mode" "SI")])
737 (define_insn "mips_cmp<DSPV:dspfmt1_1>_le_<DSPV:dspfmt2>"
738 [(set (reg:CCDSP CCDSP_CC_REGNUM)
739 (unspec:CCDSP [(match_operand:DSPV 0 "register_operand" "d")
740 (match_operand:DSPV 1 "register_operand" "d")
741 (reg:CCDSP CCDSP_CC_REGNUM)]
744 "cmp<DSPV:dspfmt1_1>.le.<DSPV:dspfmt2>\t%0,%1"
745 [(set_attr "type" "arith")
746 (set_attr "mode" "SI")])
748 (define_insn "mips_cmpgu_eq_qb"
749 [(set (match_operand:SI 0 "register_operand" "=d")
750 (unspec:SI [(match_operand:V4QI 1 "register_operand" "d")
751 (match_operand:V4QI 2 "register_operand" "d")]
752 UNSPEC_CMPGU_EQ_QB))]
754 "cmpgu.eq.qb\t%0,%1,%2"
755 [(set_attr "type" "arith")
756 (set_attr "mode" "SI")])
758 (define_insn "mips_cmpgu_lt_qb"
759 [(set (match_operand:SI 0 "register_operand" "=d")
760 (unspec:SI [(match_operand:V4QI 1 "register_operand" "d")
761 (match_operand:V4QI 2 "register_operand" "d")]
762 UNSPEC_CMPGU_LT_QB))]
764 "cmpgu.lt.qb\t%0,%1,%2"
765 [(set_attr "type" "arith")
766 (set_attr "mode" "SI")])
768 (define_insn "mips_cmpgu_le_qb"
769 [(set (match_operand:SI 0 "register_operand" "=d")
770 (unspec:SI [(match_operand:V4QI 1 "register_operand" "d")
771 (match_operand:V4QI 2 "register_operand" "d")]
772 UNSPEC_CMPGU_LE_QB))]
774 "cmpgu.le.qb\t%0,%1,%2"
775 [(set_attr "type" "arith")
776 (set_attr "mode" "SI")])
779 (define_insn "mips_pick_<DSPV:dspfmt2>"
780 [(set (match_operand:DSPV 0 "register_operand" "=d")
781 (unspec:DSPV [(match_operand:DSPV 1 "register_operand" "d")
782 (match_operand:DSPV 2 "register_operand" "d")
783 (reg:CCDSP CCDSP_CC_REGNUM)]
786 "pick.<DSPV:dspfmt2>\t%0,%1,%2"
787 [(set_attr "type" "arith")
788 (set_attr "mode" "SI")])
791 (define_insn "mips_packrl_ph"
792 [(set (match_operand:V2HI 0 "register_operand" "=d")
793 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "d")
794 (match_operand:V2HI 2 "register_operand" "d")]
797 "packrl.ph\t%0,%1,%2"
798 [(set_attr "type" "arith")
799 (set_attr "mode" "SI")])
801 ;; Table 2-6. MIPS DSP ASE Instructions: Accumulator and DSPControl Access
803 (define_insn "mips_extr_w"
805 [(set (match_operand:SI 0 "register_operand" "=d,d")
806 (unspec:SI [(match_operand:DI 1 "register_operand" "a,a")
807 (match_operand:SI 2 "arith_operand" "I,d")]
809 (set (reg:CCDSP CCDSP_OU_REGNUM)
810 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_EXTR_W))])]
811 "TARGET_DSP && !TARGET_64BIT"
813 if (which_alternative == 0)
815 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x1f)
816 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
817 return "extr.w\t%0,%q1,%2";
819 return "extrv.w\t%0,%q1,%2";
821 [(set_attr "type" "mfhilo")
822 (set_attr "mode" "SI")])
824 (define_insn "mips_extr_r_w"
826 [(set (match_operand:SI 0 "register_operand" "=d,d")
827 (unspec:SI [(match_operand:DI 1 "register_operand" "a,a")
828 (match_operand:SI 2 "arith_operand" "I,d")]
830 (set (reg:CCDSP CCDSP_OU_REGNUM)
831 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_EXTR_R_W))])]
832 "TARGET_DSP && !TARGET_64BIT"
834 if (which_alternative == 0)
836 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x1f)
837 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
838 return "extr_r.w\t%0,%q1,%2";
840 return "extrv_r.w\t%0,%q1,%2";
842 [(set_attr "type" "mfhilo")
843 (set_attr "mode" "SI")])
845 (define_insn "mips_extr_rs_w"
847 [(set (match_operand:SI 0 "register_operand" "=d,d")
848 (unspec:SI [(match_operand:DI 1 "register_operand" "a,a")
849 (match_operand:SI 2 "arith_operand" "I,d")]
851 (set (reg:CCDSP CCDSP_OU_REGNUM)
852 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_EXTR_RS_W))])]
853 "TARGET_DSP && !TARGET_64BIT"
855 if (which_alternative == 0)
857 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x1f)
858 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
859 return "extr_rs.w\t%0,%q1,%2";
861 return "extrv_rs.w\t%0,%q1,%2";
863 [(set_attr "type" "mfhilo")
864 (set_attr "mode" "SI")])
867 (define_insn "mips_extr_s_h"
869 [(set (match_operand:SI 0 "register_operand" "=d,d")
870 (unspec:SI [(match_operand:DI 1 "register_operand" "a,a")
871 (match_operand:SI 2 "arith_operand" "I,d")]
873 (set (reg:CCDSP CCDSP_OU_REGNUM)
874 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_EXTR_S_H))])]
875 "TARGET_DSP && !TARGET_64BIT"
877 if (which_alternative == 0)
879 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x1f)
880 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
881 return "extr_s.h\t%0,%q1,%2";
883 return "extrv_s.h\t%0,%q1,%2";
885 [(set_attr "type" "mfhilo")
886 (set_attr "mode" "SI")])
889 (define_insn "mips_extp"
891 [(set (match_operand:SI 0 "register_operand" "=d,d")
892 (unspec:SI [(match_operand:DI 1 "register_operand" "a,a")
893 (match_operand:SI 2 "arith_operand" "I,d")
894 (reg:CCDSP CCDSP_PO_REGNUM)]
896 (set (reg:CCDSP CCDSP_EF_REGNUM)
897 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_EXTP))])]
898 "TARGET_DSP && !TARGET_64BIT"
900 if (which_alternative == 0)
902 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x1f)
903 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
904 return "extp\t%0,%q1,%2";
906 return "extpv\t%0,%q1,%2";
908 [(set_attr "type" "mfhilo")
909 (set_attr "mode" "SI")])
911 (define_insn "mips_extpdp"
913 [(set (match_operand:SI 0 "register_operand" "=d,d")
914 (unspec:SI [(match_operand:DI 1 "register_operand" "a,a")
915 (match_operand:SI 2 "arith_operand" "I,d")
916 (reg:CCDSP CCDSP_PO_REGNUM)]
918 (set (reg:CCDSP CCDSP_PO_REGNUM)
919 (unspec:CCDSP [(match_dup 1) (match_dup 2)
920 (reg:CCDSP CCDSP_PO_REGNUM)] UNSPEC_EXTPDP))
921 (set (reg:CCDSP CCDSP_EF_REGNUM)
922 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_EXTPDP))])]
923 "TARGET_DSP && !TARGET_64BIT"
925 if (which_alternative == 0)
927 if (INTVAL (operands[2]) & ~(unsigned HOST_WIDE_INT) 0x1f)
928 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
929 return "extpdp\t%0,%q1,%2";
931 return "extpdpv\t%0,%q1,%2";
933 [(set_attr "type" "mfhilo")
934 (set_attr "mode" "SI")])
937 (define_insn "mips_shilo"
938 [(set (match_operand:DI 0 "register_operand" "=a,a")
939 (unspec:DI [(match_operand:DI 1 "register_operand" "0,0")
940 (match_operand:SI 2 "arith_operand" "I,d")]
942 "TARGET_DSP && !TARGET_64BIT"
944 if (which_alternative == 0)
946 if (INTVAL (operands[2]) < -32 || INTVAL (operands[2]) > 31)
947 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
948 return "shilo\t%q0,%2";
950 return "shilov\t%q0,%2";
952 [(set_attr "type" "mfhilo")
953 (set_attr "mode" "SI")])
956 (define_insn "mips_mthlip"
958 [(set (match_operand:DI 0 "register_operand" "=a")
959 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
960 (match_operand:SI 2 "register_operand" "d")
961 (reg:CCDSP CCDSP_PO_REGNUM)]
963 (set (reg:CCDSP CCDSP_PO_REGNUM)
964 (unspec:CCDSP [(match_dup 1) (match_dup 2)
965 (reg:CCDSP CCDSP_PO_REGNUM)] UNSPEC_MTHLIP))])]
966 "TARGET_DSP && !TARGET_64BIT"
968 [(set_attr "type" "mfhilo")
969 (set_attr "mode" "SI")])
972 (define_insn "mips_wrdsp"
974 [(set (reg:CCDSP CCDSP_PO_REGNUM)
975 (unspec:CCDSP [(match_operand:SI 0 "register_operand" "d")
976 (match_operand:SI 1 "const_uimm6_operand" "YA")]
978 (set (reg:CCDSP CCDSP_SC_REGNUM)
979 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))
980 (set (reg:CCDSP CCDSP_CA_REGNUM)
981 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))
982 (set (reg:CCDSP CCDSP_OU_REGNUM)
983 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))
984 (set (reg:CCDSP CCDSP_CC_REGNUM)
985 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))
986 (set (reg:CCDSP CCDSP_EF_REGNUM)
987 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))])]
990 [(set_attr "type" "arith")
991 (set_attr "mode" "SI")])
994 (define_insn "mips_rddsp"
995 [(set (match_operand:SI 0 "register_operand" "=d")
996 (unspec:SI [(match_operand:SI 1 "const_uimm6_operand" "YA")
997 (reg:CCDSP CCDSP_PO_REGNUM)
998 (reg:CCDSP CCDSP_SC_REGNUM)
999 (reg:CCDSP CCDSP_CA_REGNUM)
1000 (reg:CCDSP CCDSP_OU_REGNUM)
1001 (reg:CCDSP CCDSP_CC_REGNUM)
1002 (reg:CCDSP CCDSP_EF_REGNUM)]
1006 [(set_attr "type" "arith")
1007 (set_attr "mode" "SI")])
1009 ;; Table 2-7. MIPS DSP ASE Instructions: Indexed-Load
1011 (define_insn "mips_lbux"
1012 [(set (match_operand:SI 0 "register_operand" "=d")
1013 (zero_extend:SI (mem:QI (plus:SI (match_operand:SI 1
1014 "register_operand" "d")
1016 "register_operand" "d")))))]
1019 [(set_attr "type" "load")
1020 (set_attr "mode" "SI")
1021 (set_attr "length" "4")])
1023 (define_insn "mips_lhx"
1024 [(set (match_operand:SI 0 "register_operand" "=d")
1025 (sign_extend:SI (mem:HI (plus:SI (match_operand:SI 1
1026 "register_operand" "d")
1028 "register_operand" "d")))))]
1031 [(set_attr "type" "load")
1032 (set_attr "mode" "SI")
1033 (set_attr "length" "4")])
1035 (define_insn "mips_lwx"
1036 [(set (match_operand:SI 0 "register_operand" "=d")
1037 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "d")
1038 (match_operand:SI 2 "register_operand" "d"))))]
1041 [(set_attr "type" "load")
1042 (set_attr "mode" "SI")
1043 (set_attr "length" "4")])
1045 ;; Table 2-8. MIPS DSP ASE Instructions: Branch
1047 (define_insn "mips_bposge"
1050 (ge:CCDSP (reg:CCDSP CCDSP_PO_REGNUM)
1051 (match_operand:SI 0 "immediate_operand" "I"))
1052 (label_ref (match_operand 1 "" ""))
1056 [(set_attr "type" "branch")
1057 (set_attr "mode" "none")])