1 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
3 ;; This file is free software; you can redistribute it and/or modify it under
4 ;; the terms of the GNU General Public License as published by the Free
5 ;; Software Foundation; either version 3 of the License, or (at your option)
8 ;; This file is distributed in the hope that it will be useful, but WITHOUT
9 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 ;; You should have received a copy of the GNU General Public License
14 ;; along with GCC; see the file COPYING3. If not see
15 ;; <http://www.gnu.org/licenses/>.
18 ;; This includes expands for all the intrinsics.
19 ;; spu_expand_builtin looks at the mode of match_operand.
24 (define_expand "spu_lqd"
25 [(set (match_operand:TI 0 "spu_reg_operand" "")
26 (mem:TI (and:SI (plus:SI (match_operand:SI 1 "spu_reg_operand" "")
27 (match_operand:SI 2 "spu_nonmem_operand" ""))
31 if (GET_CODE (operands[2]) == CONST_INT
32 && (INTVAL (operands[2]) & 15) != 0)
33 operands[2] = GEN_INT (INTVAL (operands[2]) & -16);
34 if (GET_CODE (operands[2]) != CONST_INT)
36 rtx op2 = operands[2];
37 operands[2] = force_reg (Pmode, operands[2]);
38 if (!ALIGNED_SYMBOL_REF_P (op2))
39 emit_insn (gen_andsi3 (operands[2], operands[2], GEN_INT (-16)));
43 (define_expand "spu_lqx"
44 [(set (match_operand:TI 0 "spu_reg_operand" "")
45 (mem:TI (and:SI (plus:SI (match_operand:SI 1 "spu_reg_operand" "")
46 (match_operand:SI 2 "spu_reg_operand" ""))
51 (define_expand "spu_lqa"
52 [(set (match_operand:TI 0 "spu_reg_operand" "")
53 (mem:TI (and:SI (match_operand:SI 1 "immediate_operand" "")
57 if (GET_CODE (operands[1]) == CONST_INT
58 && (INTVAL (operands[1]) & 15) != 0)
59 operands[1] = GEN_INT (INTVAL (operands[1]) & -16);
62 (define_expand "spu_lqr"
63 [(set (match_operand:TI 0 "spu_reg_operand" "")
64 (mem:TI (and:SI (match_operand:SI 1 "address_operand" "")
69 (define_expand "spu_stqd"
70 [(set (mem:TI (and:SI (plus:SI (match_operand:SI 1 "spu_reg_operand" "")
71 (match_operand:SI 2 "spu_nonmem_operand" ""))
73 (match_operand:TI 0 "spu_reg_operand" "r,r"))]
76 if (GET_CODE (operands[2]) == CONST_INT
77 && (INTVAL (operands[2]) & 15) != 0)
78 operands[2] = GEN_INT (INTVAL (operands[2]) & -16);
79 if (GET_CODE (operands[2]) != CONST_INT)
81 rtx op2 = operands[2];
82 operands[2] = force_reg (Pmode, operands[2]);
83 if (!ALIGNED_SYMBOL_REF_P (op2))
84 emit_insn (gen_andsi3 (operands[2], operands[2], GEN_INT (-16)));
88 (define_expand "spu_stqx"
89 [(set (mem:TI (and:SI (plus:SI (match_operand:SI 1 "spu_reg_operand" "")
90 (match_operand:SI 2 "spu_reg_operand" ""))
92 (match_operand:TI 0 "spu_reg_operand" "r"))]
96 (define_expand "spu_stqa"
97 [(set (mem:TI (and:SI (match_operand:SI 1 "immediate_operand" "")
99 (match_operand:TI 0 "spu_reg_operand" "r"))]
102 if (GET_CODE (operands[1]) == CONST_INT
103 && (INTVAL (operands[1]) & 15) != 0)
104 operands[1] = GEN_INT (INTVAL (operands[1]) & -16);
107 (define_expand "spu_stqr"
108 [(set (mem:TI (and:SI (match_operand:SI 1 "address_operand" "")
110 (match_operand:TI 0 "spu_reg_operand" ""))]
115 ;; generate control word
117 (define_expand "spu_cbx"
118 [(set (match_operand:TI 0 "spu_reg_operand" "")
119 (unspec:TI [(match_operand:SI 1 "spu_reg_operand" "")
120 (match_operand:SI 2 "spu_nonmem_operand" "")
121 (const_int 1)] UNSPEC_CPAT))]
125 (define_expand "spu_chx"
126 [(set (match_operand:TI 0 "spu_reg_operand" "")
127 (unspec:TI [(match_operand:SI 1 "spu_reg_operand" "")
128 (match_operand:SI 2 "spu_nonmem_operand" "")
129 (const_int 2)] UNSPEC_CPAT))]
133 (define_expand "spu_cwx"
134 [(set (match_operand:TI 0 "spu_reg_operand" "")
135 (unspec:TI [(match_operand:SI 1 "spu_reg_operand" "")
136 (match_operand:SI 2 "spu_nonmem_operand" "")
137 (const_int 4)] UNSPEC_CPAT))]
141 (define_expand "spu_cdx"
142 [(set (match_operand:TI 0 "spu_reg_operand" "")
143 (unspec:TI [(match_operand:SI 1 "spu_reg_operand" "")
144 (match_operand:SI 2 "spu_nonmem_operand" "")
145 (const_int 8)] UNSPEC_CPAT))]
151 ;; Constant formation
153 (define_expand "spu_ilhu"
154 [(set (match_operand:V4SI 0 "spu_reg_operand" "")
155 (const_vector:V4SI [(match_operand:SI 1 "immediate_operand" "")]))]
157 "{ emit_insn(gen_movv4si(operands[0], spu_const(V4SImode, (INTVAL(operands[1]) << 16))));
163 (define_expand "spu_sfh"
164 [(set (match_operand:V8HI 0 "spu_reg_operand" "")
165 (minus:V8HI (match_operand:V8HI 2 "spu_nonmem_operand" "")
166 (match_operand:V8HI 1 "spu_reg_operand" "")))]
170 (define_expand "spu_sf"
171 [(set (match_operand:V4SI 0 "spu_reg_operand" "")
172 (minus:V4SI (match_operand:V4SI 2 "spu_nonmem_operand" "")
173 (match_operand:V4SI 1 "spu_reg_operand" "")))]
177 (define_expand "spu_sfx"
178 [(set (match_operand:V4SI 0 "spu_reg_operand" "")
179 (unspec:V4SI [(match_operand:V4SI 2 "spu_reg_operand" "")
180 (match_operand:V4SI 1 "spu_reg_operand" "")
181 (match_operand:V4SI 3 "spu_reg_operand" "")] UNSPEC_SFX))]
185 (define_expand "spu_bg"
186 [(set (match_operand:V4SI 0 "spu_reg_operand" "")
187 (unspec:V4SI [(match_operand:V4SI 2 "spu_reg_operand" "")
188 (match_operand:V4SI 1 "spu_reg_operand" "")] UNSPEC_BG))]
192 (define_expand "spu_bgx"
193 [(set (match_operand:V4SI 0 "spu_reg_operand" "")
194 (unspec:V4SI [(match_operand:V4SI 2 "spu_reg_operand" "")
195 (match_operand:V4SI 1 "spu_reg_operand" "")
196 (match_operand:V4SI 3 "spu_reg_operand" "")] UNSPEC_BGX))]
201 (define_insn "spu_mpy"
202 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r,r")
206 (match_operand:V8HI 1 "spu_reg_operand" "r,r")
207 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)])))
210 (match_operand:V8HI 2 "spu_arith_operand" "r,B")
211 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)])))))]
216 [(set_attr "type" "fp7")])
218 (define_insn "spu_mpyu"
219 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r,r")
223 (match_operand:V8HI 1 "spu_reg_operand" "r,r")
224 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)])))
227 (match_operand:V8HI 2 "spu_arith_operand" "r,B")
228 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)])))))]
233 [(set_attr "type" "fp7")])
235 (define_insn "spu_mpya"
236 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
241 (match_operand:V8HI 1 "spu_reg_operand" "r")
242 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)])))
245 (match_operand:V8HI 2 "spu_reg_operand" "r")
246 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)]))))
247 (match_operand:V4SI 3 "spu_reg_operand" "r")))]
250 [(set_attr "type" "fp7")])
252 (define_insn "spu_mpyh"
253 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
258 (match_operand:V8HI 1 "spu_reg_operand" "r")
259 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))
262 (match_operand:V8HI 2 "spu_reg_operand" "r")
263 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)]))))
264 (const_vector:V4SI [(const_int 16)(const_int 16)(const_int 16)(const_int 16)])))]
267 [(set_attr "type" "fp7")])
269 (define_insn "spu_mpys"
270 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
275 (match_operand:V8HI 1 "spu_reg_operand" "r")
276 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)])))
279 (match_operand:V8HI 2 "spu_reg_operand" "r")
280 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)]))))
281 (const_vector:V4SI [(const_int 16)(const_int 16)(const_int 16)(const_int 16)])))]
284 [(set_attr "type" "fp7")])
286 (define_insn "spu_mpyhhu"
287 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
291 (match_operand:V8HI 1 "spu_reg_operand" "r")
292 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))
295 (match_operand:V8HI 2 "spu_reg_operand" "r")
296 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))))]
299 [(set_attr "type" "fp7")])
301 (define_insn "spu_mpyhh"
302 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
306 (match_operand:V8HI 1 "spu_reg_operand" "r")
307 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))
310 (match_operand:V8HI 2 "spu_reg_operand" "r")
311 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))))]
314 [(set_attr "type" "fp7")])
316 (define_insn "spu_mpyhhau"
317 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
322 (match_operand:V8HI 1 "spu_reg_operand" "r")
323 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))
326 (match_operand:V8HI 2 "spu_reg_operand" "r")
327 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)]))))
328 (match_operand:V4SI 3 "spu_reg_operand" "0")))]
331 [(set_attr "type" "fp7")])
333 (define_insn "spu_mpyhha"
334 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
339 (match_operand:V8HI 1 "spu_reg_operand" "r")
340 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)])))
343 (match_operand:V8HI 2 "spu_reg_operand" "r")
344 (parallel [(const_int 0)(const_int 2)(const_int 4)(const_int 6)]))))
345 (match_operand:V4SI 3 "spu_reg_operand" "0")))]
348 [(set_attr "type" "fp7")])
351 (define_insn "spu_fsmb"
352 [(set (match_operand:V16QI 0 "spu_reg_operand" "=r,r")
353 (unspec:V16QI [(match_operand:SI 1 "spu_nonmem_operand" "r,MN")] UNSPEC_FSMB))]
358 [(set_attr "type" "shuf")])
360 (define_insn "spu_fsmh"
361 [(set (match_operand:V8HI 0 "spu_reg_operand" "=r")
362 (unspec:V8HI [(match_operand:SI 1 "spu_reg_operand" "r")] UNSPEC_FSMH))]
365 [(set_attr "type" "shuf")])
367 (define_insn "spu_fsm"
368 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
369 (unspec:V4SI [(match_operand:SI 1 "spu_reg_operand" "r")] UNSPEC_FSM))]
372 [(set_attr "type" "shuf")])
376 (define_insn "spu_gbb"
377 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
378 (unspec:V4SI [(match_operand:V16QI 1 "spu_reg_operand" "r")] UNSPEC_GBB))]
381 [(set_attr "type" "shuf")])
383 (define_insn "spu_gbh"
384 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
385 (unspec:V4SI [(match_operand:V8HI 1 "spu_reg_operand" "r")] UNSPEC_GBH))]
388 [(set_attr "type" "shuf")])
390 (define_insn "spu_gb"
391 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
392 (unspec:V4SI [(match_operand:V4SI 1 "spu_reg_operand" "r")] UNSPEC_GB))]
395 [(set_attr "type" "shuf")])
397 ;; misc byte operations
398 (define_insn "spu_avgb"
399 [(set (match_operand:V16QI 0 "spu_reg_operand" "=r")
400 (unspec:V16QI [(match_operand:V16QI 1 "spu_reg_operand" "r")
401 (match_operand:V16QI 2 "spu_reg_operand" "r")] UNSPEC_AVGB))]
404 [(set_attr "type" "fxb")])
406 (define_insn "spu_absdb"
407 [(set (match_operand:V16QI 0 "spu_reg_operand" "=r")
408 (unspec:V16QI [(match_operand:V16QI 1 "spu_reg_operand" "r")
409 (match_operand:V16QI 2 "spu_reg_operand" "r")] UNSPEC_ABSDB))]
412 [(set_attr "type" "fxb")])
414 (define_insn "spu_sumb"
415 [(set (match_operand:V8HI 0 "spu_reg_operand" "=r")
416 (unspec:V8HI [(match_operand:V16QI 1 "spu_reg_operand" "r")
417 (match_operand:V16QI 2 "spu_reg_operand" "r")] UNSPEC_SUMB))]
420 [(set_attr "type" "fxb")])
423 (define_insn "spu_xsbh"
424 [(set (match_operand:V8HI 0 "spu_reg_operand" "=r")
427 (match_operand:V16QI 1 "spu_reg_operand" "r")
428 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)
429 (const_int 9)(const_int 11)(const_int 13)(const_int 15)]))))]
433 (define_insn "spu_xshw"
434 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
437 (match_operand:V8HI 1 "spu_reg_operand" "r")
438 (parallel [(const_int 1)(const_int 3)(const_int 5)(const_int 7)]))))]
442 (define_insn "spu_xswd"
443 [(set (match_operand:V2DI 0 "spu_reg_operand" "=r")
446 (match_operand:V4SI 1 "spu_reg_operand" "r")
447 (parallel [(const_int 1)(const_int 3)]))))]
453 (define_insn "spu_orx"
454 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
455 (unspec:V4SI [(match_operand:V4SI 1 "spu_reg_operand" "r")] UNSPEC_ORX))]
461 (define_insn "spu_heq"
462 [(unspec_volatile [(match_operand:SI 0 "spu_reg_operand" "r,r")
463 (match_operand:SI 1 "spu_nonmem_operand" "r,K")] UNSPEC_HEQ)]
469 (define_insn "spu_hgt"
470 [(unspec_volatile [(match_operand:SI 0 "spu_reg_operand" "r,r")
471 (match_operand:SI 1 "spu_nonmem_operand" "r,K")] UNSPEC_HGT)]
477 (define_insn "spu_hlgt"
478 [(unspec_volatile [(match_operand:SI 0 "spu_reg_operand" "r,r")
479 (match_operand:SI 1 "spu_nonmem_operand" "r,K")] UNSPEC_HLGT)]
487 ;; The description below hides the fact that bisled conditionally
488 ;; executes the call depending on the value in channel 0. This was
489 ;; done so that the description would conform to the format of a call
490 ;; insn. Otherwise (if this were not part of call insn), the link
491 ;; register, $lr, would not be saved/restored in the prologue/epilogue.
493 (define_insn "spu_bisled"
495 [(call (mem:QI (match_operand:SI 0 "spu_reg_operand" "r"))
498 (clobber (reg:SI 130))
499 (use (match_operand:SI 1 "address_operand" ""))
500 (use (const_int 0))])]
503 [(set_attr "type" "br")])
505 (define_insn "spu_bisledd"
507 [(call (mem:QI (match_operand:SI 0 "spu_reg_operand" "r"))
510 (clobber (reg:SI 130))
511 (use (match_operand:SI 1 "address_operand" ""))
512 (use (const_int 1))])]
515 [(set_attr "type" "br")])
517 (define_insn "spu_bislede"
519 [(call (mem:QI (match_operand:SI 0 "spu_reg_operand" "r"))
522 (clobber (reg:SI 130))
523 (use (match_operand:SI 1 "address_operand" ""))
524 (use (const_int 2))])]
527 [(set_attr "type" "br")])
530 (define_insn "spu_csflt"
531 [(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
532 (unspec:V4SF [(match_operand:V4SI 1 "spu_reg_operand" "r")
533 (match_operand:SI 2 "immediate_operand" "K")] UNSPEC_CSFLT ))]
536 [(set_attr "type" "fp7")])
538 (define_insn "spu_cflts"
539 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
540 (unspec:V4SI [(match_operand:V4SF 1 "spu_reg_operand" "r")
541 (match_operand:SI 2 "immediate_operand" "J")] UNSPEC_CFLTS ))]
544 [(set_attr "type" "fp7")])
546 (define_insn "spu_cuflt"
547 [(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
548 (unspec:V4SF [(match_operand:V4SI 1 "spu_reg_operand" "r")
549 (match_operand:SI 2 "immediate_operand" "K")] UNSPEC_CUFLT ))]
552 [(set_attr "type" "fp7")])
554 (define_insn "spu_cfltu"
555 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
556 (unspec:V4SI [(match_operand:V4SF 1 "spu_reg_operand" "r")
557 (match_operand:SI 2 "immediate_operand" "J")] UNSPEC_CFLTU ))]
560 [(set_attr "type" "fp7")])
562 (define_expand "spu_frds"
563 [(set (match_operand:V4SF 0 "spu_reg_operand" "")
566 (float_truncate:V2SF (match_operand:V2DF 1 "spu_reg_operand" ""))
568 (parallel [(const_int 0)(const_int 2)(const_int 1)(const_int 3)])))]
570 "operands[2] = spu_const(V2SFmode, 0);")
573 [(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
576 (float_truncate:V2SF (match_operand:V2DF 1 "spu_reg_operand" "r"))
577 (match_operand:V2SF 2 "vec_imm_operand" "i"))
578 (parallel [(const_int 0)(const_int 2)(const_int 1)(const_int 3)])))]
581 [(set_attr "type" "fpd")])
583 (define_insn "spu_fesd"
584 [(set (match_operand:V2DF 0 "spu_reg_operand" "=r")
587 (match_operand:V4SF 1 "spu_reg_operand" "r")
588 (parallel [(const_int 0)(const_int 2)]))))]
591 [(set_attr "type" "fpd")])
594 (define_insn "spu_stop"
595 [(unspec_volatile [(match_operand:SI 0 "immediate_operand" "M")] UNSPEC_STOP)]
598 [(set_attr "type" "br")])
600 (define_insn "spu_stopd"
601 [(unspec_volatile [(match_operand:SI 0 "spu_reg_operand" "r")
602 (match_operand:SI 1 "spu_reg_operand" "r")
603 (match_operand:SI 2 "spu_reg_operand" "r")] UNSPEC_STOPD)]
606 [(set_attr "type" "br")])
608 ;; interrupt disable/enable
609 (define_expand "spu_idisable"
611 [(unspec_volatile [(const_int 0)] UNSPEC_SET_INTR)
612 (clobber (match_dup:SI 0))
613 (clobber (mem:BLK (scratch)))])]
615 "operands[0] = gen_reg_rtx (SImode);")
617 (define_expand "spu_ienable"
619 [(unspec_volatile [(const_int 1)] UNSPEC_SET_INTR)
620 (clobber (match_dup:SI 0))
621 (clobber (mem:BLK (scratch)))])]
623 "operands[0] = gen_reg_rtx (SImode);")
625 (define_insn "set_intr"
626 [(unspec_volatile [(match_operand 1 "const_int_operand" "i")] UNSPEC_SET_INTR)
627 (clobber (match_operand:SI 0 "spu_reg_operand" "=&r"))
628 (clobber (mem:BLK (scratch)))]
630 "ila\t%0,.+8\;bi%I1\t%0"
631 [(set_attr "length" "8")
632 (set_attr "type" "multi0")])
634 (define_insn "set_intr_pic"
635 [(unspec_volatile [(match_operand 1 "const_int_operand" "i")] UNSPEC_SET_INTR)
636 (clobber (match_operand:SI 0 "spu_reg_operand" "=&r"))
637 (clobber (mem:BLK (scratch)))]
639 "brsl\t%0,.+4\;ai\t%0,%0,8\;bi%I1\t%0"
640 [(set_attr "length" "12")
641 (set_attr "type" "multi1")])
643 (define_insn "set_intr_cc"
644 [(cond_exec (match_operator 1 "branch_comparison_operator"
645 [(match_operand 2 "spu_reg_operand" "r")
647 (parallel [(unspec_volatile [(match_operand:SI 3 "const_int_operand" "i")] UNSPEC_SET_INTR)
648 (clobber (match_operand:SI 0 "spu_reg_operand" "=&r"))
649 (clobber (mem:BLK (scratch)))]))]
651 "ila\t%0,.+8\;bi%b2%b1z%I3\t%2,%0"
652 [(set_attr "length" "8")
653 (set_attr "type" "multi0")])
655 (define_insn "set_intr_cc_pic"
656 [(cond_exec (match_operator 1 "branch_comparison_operator"
657 [(match_operand 2 "spu_reg_operand" "r")
659 (parallel [(unspec_volatile [(match_operand:SI 3 "const_int_operand" "i")] UNSPEC_SET_INTR)
660 (clobber (match_operand:SI 0 "spu_reg_operand" "=&r"))
661 (clobber (mem:BLK (scratch)))]))]
663 "brsl\t%0,.+4\;ai\t%0,%0,8\;bi%b2%b1z%I3\t%2,%0"
664 [(set_attr "length" "12")
665 (set_attr "type" "multi1")])
667 (define_insn "set_intr_return"
668 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")] UNSPEC_SET_INTR)
672 [(set_attr "type" "br")])
676 [(unspec_volatile [(match_operand:SI 0 "const_int_operand")] UNSPEC_SET_INTR)
677 (clobber (match_operand:SI 1 "spu_reg_operand"))
678 (clobber (mem:BLK (scratch)))])
684 [(unspec_volatile [(match_dup:SI 0)] UNSPEC_SET_INTR)
688 ;; special purpose registers
689 (define_insn "spu_fscrrd"
690 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
691 (unspec_volatile:V4SI [(const_int 6)] UNSPEC_FSCRRD))]
694 [(set_attr "type" "spr")])
696 (define_insn "spu_fscrwr"
697 [(unspec_volatile [(match_operand:V4SI 0 "spu_reg_operand" "r")] UNSPEC_FSCRWR)]
700 [(set_attr "type" "spr")])
702 (define_insn "spu_mfspr"
703 [(set (match_operand:SI 0 "spu_reg_operand" "=r")
704 (unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "J")] UNSPEC_MFSPR))]
707 [(set_attr "type" "spr")])
709 (define_insn "spu_mtspr"
710 [(unspec_volatile [(match_operand:SI 0 "immediate_operand" "J")
711 (match_operand:SI 1 "spu_reg_operand" "r")] UNSPEC_MTSPR)]
714 [(set_attr "type" "spr")])
717 (define_expand "spu_rdch"
718 [(set (match_operand:V4SI 0 "spu_reg_operand" "")
719 (unspec_volatile:V4SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_RDCH))]
722 if (spu_safe_dma (INTVAL (operands[1])))
724 emit_insn (gen_spu_rdch_clobber (operands[0], operands[1]));
729 (define_expand "spu_rchcnt"
730 [(set (match_operand:SI 0 "spu_reg_operand" "")
731 (unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_RCHCNT))]
734 if (spu_safe_dma (INTVAL (operands[1])))
736 emit_insn (gen_spu_rchcnt_clobber (operands[0], operands[1]));
741 (define_expand "spu_wrch"
742 [(unspec_volatile [(match_operand:SI 0 "immediate_operand" "")
743 (match_operand:V4SI 1 "spu_reg_operand" "")] UNSPEC_WRCH)]
746 if (spu_safe_dma (INTVAL (operands[0])))
748 emit_insn (gen_spu_wrch_clobber (operands[0], operands[1]));
753 (define_insn "spu_rdch_noclobber"
754 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
755 (unspec_volatile:V4SI [(match_operand:SI 1 "immediate_operand" "J")] UNSPEC_RDCH))]
758 [(set_attr "type" "spr")])
760 (define_insn "spu_rchcnt_noclobber"
761 [(set (match_operand:SI 0 "spu_reg_operand" "=r")
762 (unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "J")] UNSPEC_RCHCNT))]
765 [(set_attr "type" "spr")])
767 (define_insn "spu_wrch_noclobber"
768 [(unspec_volatile [(match_operand:SI 0 "immediate_operand" "J")
769 (match_operand:V4SI 1 "spu_reg_operand" "r")] UNSPEC_WRCH)]
772 [(set_attr "type" "spr")])
774 (define_insn "spu_rdch_clobber"
775 [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
776 (unspec_volatile:V4SI [(match_operand:SI 1 "immediate_operand" "J")] UNSPEC_RDCH))
777 (clobber (mem:BLK (scratch)))]
780 [(set_attr "type" "spr")])
782 (define_insn "spu_rchcnt_clobber"
783 [(set (match_operand:SI 0 "spu_reg_operand" "=r")
784 (unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "J")] UNSPEC_RCHCNT))
785 (clobber (mem:BLK (scratch)))]
788 [(set_attr "type" "spr")])
790 (define_insn "spu_wrch_clobber"
791 [(unspec_volatile [(match_operand:SI 0 "immediate_operand" "J")
792 (match_operand:V4SI 1 "spu_reg_operand" "r")] UNSPEC_WRCH)
793 (clobber (mem:BLK (scratch)))]
796 [(set_attr "type" "spr")])
798 (define_expand "spu_splats"
799 [(set (match_operand 0 "spu_reg_operand" "")
800 (vec_duplicate (match_operand 1 "spu_nonmem_operand" "")))]
803 spu_builtin_splats(operands);
807 (define_expand "spu_extract"
808 [(set (match_operand 0 "spu_reg_operand" "")
809 (unspec [(match_operand 1 "spu_reg_operand" "")
810 (match_operand 2 "spu_nonmem_operand" "")] 0))]
813 spu_builtin_extract (operands);
817 (define_expand "spu_insert"
818 [(set (match_operand 0 "spu_reg_operand" "")
819 (unspec [(match_operand 1 "spu_reg_operand" "")
820 (match_operand 2 "spu_reg_operand" "")
821 (match_operand:SI 3 "spu_nonmem_operand" "")] 0))]
824 spu_builtin_insert(operands);
828 (define_expand "spu_promote"
829 [(set (match_operand 0 "spu_reg_operand" "")
830 (unspec [(match_operand 1 "spu_reg_operand" "")
831 (match_operand:SI 2 "immediate_operand" "")] 0))]
834 spu_builtin_promote(operands);
838 ;; Currently doing nothing with this but expanding its args.
839 (define_expand "spu_align_hint"
840 [(unspec [(match_operand:SI 0 "address_operand" "")
841 (match_operand:SI 1 "immediate_operand" "")
842 (match_operand:SI 2 "immediate_operand" "")] 0)]