1 ;;- Machine description for Blackfin for GNU compiler
2 ;; Copyright 2005, 2006 Free Software Foundation, Inc.
3 ;; Contributed by Analog Devices.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 ;; Boston, MA 02110-1301, USA.
22 ; operand punctuation marks:
24 ; X -- integer value printed as log2
25 ; Y -- integer value printed as log2(~value) - for bitclear
26 ; h -- print half word register, low part
27 ; d -- print half word register, high part
28 ; D -- print operand as dregs pairs
29 ; w -- print operand as accumulator register word (a0w, a1w)
30 ; H -- high part of double mode operand
31 ; T -- byte register representation Oct. 02 2001
33 ; constant operand classes
35 ; J 2**N 5bit imm scaled
36 ; Ks7 -64 .. 63 signed 7bit imm
37 ; Ku5 0..31 unsigned 5bit imm
38 ; Ks4 -8 .. 7 signed 4bit imm
39 ; Ks3 -4 .. 3 signed 3bit imm
40 ; Ku3 0 .. 7 unsigned 3bit imm
41 ; Pn 0, 1, 2 constants 0, 1 or 2, corresponding to n
50 ; c (i0..i3,m0..m3) CIRCREGS
57 ;; Define constants for hard registers.
124 ;; Constants used in UNSPECs and UNSPEC_VOLATILEs.
127 [(UNSPEC_CBRANCH_TAKEN 0)
128 (UNSPEC_CBRANCH_NOPS 1)
131 (UNSPEC_LIBRARY_OFFSET 4)
132 (UNSPEC_PUSH_MULTIPLE 5)
133 ;; Multiply or MAC with extra CONST_INT operand specifying the macflag
134 (UNSPEC_MUL_WITH_FLAG 6)
135 (UNSPEC_MAC_WITH_FLAG 7)
136 (UNSPEC_MOVE_FDPIC 8)
137 (UNSPEC_FUNCDESC_GOT17M4 9)
138 (UNSPEC_LSETUP_END 10)])
141 [(UNSPEC_VOLATILE_EH_RETURN 0)
142 (UNSPEC_VOLATILE_CSYNC 1)
143 (UNSPEC_VOLATILE_SSYNC 2)
144 (UNSPEC_VOLATILE_LOAD_FUNCDESC 3)])
160 "move,mvi,mcld,mcst,dsp32,mult,alu0,shft,brcc,br,call,misc,sync,compare,dummy"
161 (const_string "misc"))
163 ;; Scheduling definitions
165 (define_automaton "bfin")
167 (define_cpu_unit "core" "bfin")
169 (define_insn_reservation "alu" 1
170 (eq_attr "type" "move,mvi,mcst,dsp32,alu0,shft,brcc,br,call,misc,sync,compare")
173 (define_insn_reservation "imul" 3
174 (eq_attr "type" "mult")
177 (define_insn_reservation "load" 1
178 (eq_attr "type" "mcld")
181 ;; Make sure genautomata knows about the maximum latency that can be produced
182 ;; by the adjust_cost function.
183 (define_insn_reservation "dummy" 5
184 (eq_attr "type" "mcld")
187 ;; Operand and operator predicates
189 (include "predicates.md")
192 ;;; FRIO branches have been optimized for code density
193 ;;; this comes at a slight cost of complexity when
194 ;;; a compiler needs to generate branches in the general
195 ;;; case. In order to generate the correct branching
196 ;;; mechanisms the compiler needs keep track of instruction
197 ;;; lengths. The follow table describes how to count instructions
198 ;;; for the FRIO architecture.
200 ;;; unconditional br are 12-bit imm pcrelative branches *2
201 ;;; conditional br are 10-bit imm pcrelative branches *2
203 ;;; 1024 10-bit imm *2 is 2048 (-1024..1022)
205 ;;; 4096 12-bit imm *2 is 8192 (-4096..4094)
206 ;;; NOTE : For brcc we generate instructions such as
207 ;;; if cc jmp; jump.[sl] offset
208 ;;; offset of jump.[sl] is from the jump instruction but
209 ;;; gcc calculates length from the if cc jmp instruction
210 ;;; furthermore gcc takes the end address of the branch instruction
211 ;;; as (pc) for a forward branch
212 ;;; hence our range is (-4094, 4092) instead of (-4096, 4094) for a br
214 ;;; The way the (pc) rtx works in these calculations is somewhat odd;
215 ;;; for backward branches it's the address of the current instruction,
216 ;;; for forward branches it's the previously known address of the following
217 ;;; instruction - we have to take this into account by reducing the range
218 ;;; for a forward branch.
220 ;; Lengths for type "mvi" insns are always defined by the instructions
222 (define_attr "length" ""
223 (cond [(eq_attr "type" "mcld")
224 (if_then_else (match_operand 1 "effective_address_32bit_p" "")
225 (const_int 4) (const_int 2))
227 (eq_attr "type" "mcst")
228 (if_then_else (match_operand 0 "effective_address_32bit_p" "")
229 (const_int 4) (const_int 2))
231 (eq_attr "type" "move") (const_int 2)
233 (eq_attr "type" "dsp32") (const_int 4)
234 (eq_attr "type" "call") (const_int 4)
236 (eq_attr "type" "br")
238 (le (minus (match_dup 0) (pc)) (const_int 4092))
239 (ge (minus (match_dup 0) (pc)) (const_int -4096)))
243 (eq_attr "type" "brcc")
245 (le (minus (match_dup 3) (pc)) (const_int 1020))
246 (ge (minus (match_dup 3) (pc)) (const_int -1024)))
249 (le (minus (match_dup 3) (pc)) (const_int 4092))
250 (ge (minus (match_dup 3) (pc)) (const_int -4094)))
258 ;; Classify the insns into those that are one instruction and those that
259 ;; are more than one in sequence.
260 (define_attr "seq_insns" "single,multi"
261 (const_string "single"))
265 (define_expand "movsicc"
266 [(set (match_operand:SI 0 "register_operand" "")
267 (if_then_else:SI (match_operand 1 "comparison_operator" "")
268 (match_operand:SI 2 "register_operand" "")
269 (match_operand:SI 3 "register_operand" "")))]
272 operands[1] = bfin_gen_compare (operands[1], SImode);
275 (define_insn "*movsicc_insn1"
276 [(set (match_operand:SI 0 "register_operand" "=da,da,da")
278 (eq:BI (match_operand:BI 3 "register_operand" "C,C,C")
280 (match_operand:SI 1 "register_operand" "da,0,da")
281 (match_operand:SI 2 "register_operand" "0,da,da")))]
284 if !cc %0 =%1; /* movsicc-1a */
285 if cc %0 =%2; /* movsicc-1b */
286 if !cc %0 =%1; if cc %0=%2; /* movsicc-1 */"
287 [(set_attr "length" "2,2,4")
288 (set_attr "type" "move")
289 (set_attr "seq_insns" "*,*,multi")])
291 (define_insn "*movsicc_insn2"
292 [(set (match_operand:SI 0 "register_operand" "=da,da,da")
294 (ne:BI (match_operand:BI 3 "register_operand" "C,C,C")
296 (match_operand:SI 1 "register_operand" "0,da,da")
297 (match_operand:SI 2 "register_operand" "da,0,da")))]
300 if !cc %0 =%2; /* movsicc-2b */
301 if cc %0 =%1; /* movsicc-2a */
302 if cc %0 =%1; if !cc %0=%2; /* movsicc-1 */"
303 [(set_attr "length" "2,2,4")
304 (set_attr "type" "move")
305 (set_attr "seq_insns" "*,*,multi")])
307 ;; Insns to load HIGH and LO_SUM
309 (define_insn "movsi_high"
310 [(set (match_operand:SI 0 "register_operand" "=x")
311 (high:SI (match_operand:SI 1 "immediate_operand" "i")))]
314 [(set_attr "type" "mvi")
315 (set_attr "length" "4")])
317 (define_insn "movstricthi_high"
318 [(set (match_operand:SI 0 "register_operand" "+x")
319 (ior:SI (and:SI (match_dup 0) (const_int 65535))
320 (match_operand:SI 1 "immediate_operand" "i")))]
323 [(set_attr "type" "mvi")
324 (set_attr "length" "4")])
326 (define_insn "movsi_low"
327 [(set (match_operand:SI 0 "register_operand" "=x")
328 (lo_sum:SI (match_operand:SI 1 "register_operand" "0")
329 (match_operand:SI 2 "immediate_operand" "i")))]
332 [(set_attr "type" "mvi")
333 (set_attr "length" "4")])
335 (define_insn "movsi_high_pic"
336 [(set (match_operand:SI 0 "register_operand" "=x")
337 (high:SI (unspec:SI [(match_operand:SI 1 "" "")]
341 [(set_attr "type" "mvi")
342 (set_attr "length" "4")])
344 (define_insn "movsi_low_pic"
345 [(set (match_operand:SI 0 "register_operand" "=x")
346 (lo_sum:SI (match_operand:SI 1 "register_operand" "0")
347 (unspec:SI [(match_operand:SI 2 "" "")]
350 "%h0 = %h2@GOT_HIGH;"
351 [(set_attr "type" "mvi")
352 (set_attr "length" "4")])
354 ;;; Move instructions
356 (define_insn_and_split "movdi_insn"
357 [(set (match_operand:DI 0 "nonimmediate_operand" "=x,mx,r")
358 (match_operand:DI 1 "general_operand" "iFx,r,mx"))]
359 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
362 [(set (match_dup 2) (match_dup 3))
363 (set (match_dup 4) (match_dup 5))]
365 rtx lo_half[2], hi_half[2];
366 split_di (operands, 2, lo_half, hi_half);
368 if (reg_overlap_mentioned_p (lo_half[0], hi_half[1]))
370 operands[2] = hi_half[0];
371 operands[3] = hi_half[1];
372 operands[4] = lo_half[0];
373 operands[5] = lo_half[1];
377 operands[2] = lo_half[0];
378 operands[3] = lo_half[1];
379 operands[4] = hi_half[0];
380 operands[5] = hi_half[1];
385 [(set (match_operand:BI 0 "nonimmediate_operand" "=x,x,d,md,C,d,C")
386 (match_operand:BI 1 "general_operand" "x,xKs3,md,d,d,C,P0"))]
396 R0 = R0 | R0; CC = AC0;"
397 [(set_attr "type" "move,mvi,mcld,mcst,compare,compare,alu0")
398 (set_attr "length" "2,2,*,*,2,2,4")
399 (set_attr "seq_insns" "*,*,*,*,*,*,multi")])
401 (define_insn "movpdi"
402 [(set (match_operand:PDI 0 "nonimmediate_operand" "=e,<,e")
403 (match_operand:PDI 1 "general_operand" " e,e,>"))]
409 [(set_attr "type" "move,mcst,mcld")
410 (set_attr "seq_insns" "*,multi,multi")])
412 (define_insn "load_accumulator"
413 [(set (match_operand:PDI 0 "register_operand" "=e")
414 (sign_extend:PDI (match_operand:SI 1 "register_operand" "d")))]
417 [(set_attr "type" "move")])
419 (define_insn_and_split "load_accumulator_pair"
420 [(set (match_operand:V2PDI 0 "register_operand" "=e")
421 (sign_extend:V2PDI (vec_concat:V2SI
422 (match_operand:SI 1 "register_operand" "d")
423 (match_operand:SI 2 "register_operand" "d"))))]
427 [(set (match_dup 3) (sign_extend:PDI (match_dup 1)))
428 (set (match_dup 4) (sign_extend:PDI (match_dup 2)))]
430 operands[3] = gen_rtx_REG (PDImode, REGNO (operands[0]));
431 operands[4] = gen_rtx_REG (PDImode, REGNO (operands[0]) + 1);
434 (define_insn "*pushsi_insn"
435 [(set (mem:SI (pre_dec:SI (reg:SI REG_SP)))
436 (match_operand:SI 0 "register_operand" "xy"))]
439 [(set_attr "type" "mcst")
440 (set_attr "length" "2")])
442 (define_insn "*popsi_insn"
443 [(set (match_operand:SI 0 "register_operand" "=xy")
444 (mem:SI (post_inc:SI (reg:SI REG_SP))))]
447 [(set_attr "type" "mcld")
448 (set_attr "length" "2")])
450 ;; The first alternative is used to make reload choose a limited register
451 ;; class when faced with a movsi_insn that had its input operand replaced
452 ;; with a PLUS. We generally require fewer secondary reloads this way.
454 (define_insn "*movsi_insn"
455 [(set (match_operand:SI 0 "nonimmediate_operand" "=da,x*y,*k,da,da,x,x,x,da,mr")
456 (match_operand:SI 1 "general_operand" "da,x*y,da,*k,xKs7,xKsh,xKuh,ix,mr,da"))]
457 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
469 [(set_attr "type" "move,move,move,move,mvi,mvi,mvi,*,mcld,mcst")
470 (set_attr "length" "2,2,2,2,2,4,4,*,*,*")])
472 (define_insn_and_split "*movv2hi_insn"
473 [(set (match_operand:V2HI 0 "nonimmediate_operand" "=da,da,d,dm")
474 (match_operand:V2HI 1 "general_operand" "i,di,md,d"))]
476 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
482 "reload_completed && GET_CODE (operands[1]) == CONST_VECTOR"
483 [(set (match_dup 0) (high:SI (match_dup 2)))
484 (set (match_dup 0) (lo_sum:SI (match_dup 0) (match_dup 3)))]
486 HOST_WIDE_INT intval = INTVAL (XVECEXP (operands[1], 0, 1)) << 16;
487 intval |= INTVAL (XVECEXP (operands[1], 0, 0)) & 0xFFFF;
489 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));
490 operands[2] = operands[3] = GEN_INT (trunc_int_for_mode (intval, SImode));
492 [(set_attr "type" "move,move,mcld,mcst")
493 (set_attr "length" "2,2,*,*")])
495 (define_insn "*movhi_insn"
496 [(set (match_operand:HI 0 "nonimmediate_operand" "=x,da,x,d,mr")
497 (match_operand:HI 1 "general_operand" "x,xKs7,xKsh,mr,d"))]
498 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
500 static const char *templates[] = {
509 int alt = which_alternative;
510 rtx mem = (MEM_P (operands[0]) ? operands[0]
511 : MEM_P (operands[1]) ? operands[1] : NULL_RTX);
512 if (mem && bfin_dsp_memref_p (mem))
514 return templates[alt];
516 [(set_attr "type" "move,mvi,mvi,mcld,mcst")
517 (set_attr "length" "2,2,4,*,*")])
519 (define_insn "*movqi_insn"
520 [(set (match_operand:QI 0 "nonimmediate_operand" "=x,da,x,d,mr")
521 (match_operand:QI 1 "general_operand" "x,xKs7,xKsh,mr,d"))]
522 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
529 [(set_attr "type" "move,mvi,mvi,mcld,mcst")
530 (set_attr "length" "2,2,4,*,*")])
532 (define_insn "*movsf_insn"
533 [(set (match_operand:SF 0 "nonimmediate_operand" "=x,x,da,mr")
534 (match_operand:SF 1 "general_operand" "x,Fx,mr,da"))]
535 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
541 [(set_attr "type" "move,*,mcld,mcst")])
543 (define_insn_and_split "movdf_insn"
544 [(set (match_operand:DF 0 "nonimmediate_operand" "=x,mx,r")
545 (match_operand:DF 1 "general_operand" "iFx,r,mx"))]
546 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
549 [(set (match_dup 2) (match_dup 3))
550 (set (match_dup 4) (match_dup 5))]
552 rtx lo_half[2], hi_half[2];
553 split_di (operands, 2, lo_half, hi_half);
555 if (reg_overlap_mentioned_p (lo_half[0], hi_half[1]))
557 operands[2] = hi_half[0];
558 operands[3] = hi_half[1];
559 operands[4] = lo_half[0];
560 operands[5] = lo_half[1];
564 operands[2] = lo_half[0];
565 operands[3] = lo_half[1];
566 operands[4] = hi_half[0];
567 operands[5] = hi_half[1];
571 ;; Storing halfwords.
572 (define_insn "*movsi_insv"
573 [(set (zero_extract:SI (match_operand 0 "register_operand" "+d,x")
576 (match_operand:SI 1 "nonmemory_operand" "d,n"))]
581 [(set_attr "type" "dsp32,mvi")])
583 (define_expand "insv"
584 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
585 (match_operand:SI 1 "immediate_operand" "")
586 (match_operand:SI 2 "immediate_operand" ""))
587 (match_operand:SI 3 "nonmemory_operand" ""))]
590 if (INTVAL (operands[1]) != 16 || INTVAL (operands[2]) != 16)
593 /* From mips.md: insert_bit_field doesn't verify that our source
594 matches the predicate, so check it again here. */
595 if (! register_operand (operands[0], VOIDmode))
599 ;; This is the main "hook" for PIC code. When generating
600 ;; PIC, movsi is responsible for determining when the source address
601 ;; needs PIC relocation and appropriately calling legitimize_pic_address
602 ;; to perform the actual relocation.
604 (define_expand "movsi"
605 [(set (match_operand:SI 0 "nonimmediate_operand" "")
606 (match_operand:SI 1 "general_operand" ""))]
608 "expand_move (operands, SImode);")
610 (define_expand "movv2hi"
611 [(set (match_operand:V2HI 0 "nonimmediate_operand" "")
612 (match_operand:V2HI 1 "general_operand" ""))]
614 "expand_move (operands, V2HImode);")
616 (define_expand "movdi"
617 [(set (match_operand:DI 0 "nonimmediate_operand" "")
618 (match_operand:DI 1 "general_operand" ""))]
620 "expand_move (operands, DImode);")
622 (define_expand "movsf"
623 [(set (match_operand:SF 0 "nonimmediate_operand" "")
624 (match_operand:SF 1 "general_operand" ""))]
626 "expand_move (operands, SFmode);")
628 (define_expand "movdf"
629 [(set (match_operand:DF 0 "nonimmediate_operand" "")
630 (match_operand:DF 1 "general_operand" ""))]
632 "expand_move (operands, DFmode);")
634 (define_expand "movhi"
635 [(set (match_operand:HI 0 "nonimmediate_operand" "")
636 (match_operand:HI 1 "general_operand" ""))]
638 "expand_move (operands, HImode);")
640 (define_expand "movqi"
641 [(set (match_operand:QI 0 "nonimmediate_operand" "")
642 (match_operand:QI 1 "general_operand" ""))]
644 " expand_move (operands, QImode); ")
646 ;; Some define_splits to break up SI/SFmode loads of immediate constants.
649 [(set (match_operand:SI 0 "register_operand" "")
650 (match_operand:SI 1 "symbolic_or_const_operand" ""))]
652 /* Always split symbolic operands; split integer constants that are
653 too large for a single instruction. */
654 && (GET_CODE (operands[1]) != CONST_INT
655 || (INTVAL (operands[1]) < -32768
656 || INTVAL (operands[1]) >= 65536
657 || (INTVAL (operands[1]) >= 32768 && PREG_P (operands[0]))))"
658 [(set (match_dup 0) (high:SI (match_dup 1)))
659 (set (match_dup 0) (lo_sum:SI (match_dup 0) (match_dup 1)))]
661 if (GET_CODE (operands[1]) == CONST_INT
662 && split_load_immediate (operands))
664 /* ??? Do something about TARGET_LOW_64K. */
668 [(set (match_operand:SF 0 "register_operand" "")
669 (match_operand:SF 1 "immediate_operand" ""))]
671 [(set (match_dup 2) (high:SI (match_dup 3)))
672 (set (match_dup 2) (lo_sum:SI (match_dup 2) (match_dup 3)))]
675 REAL_VALUE_TYPE value;
677 gcc_assert (GET_CODE (operands[1]) == CONST_DOUBLE);
679 REAL_VALUE_FROM_CONST_DOUBLE (value, operands[1]);
680 REAL_VALUE_TO_TARGET_SINGLE (value, values);
682 operands[2] = gen_rtx_REG (SImode, true_regnum (operands[0]));
683 operands[3] = GEN_INT (trunc_int_for_mode (values, SImode));
684 if (values >= -32768 && values < 65536)
686 emit_move_insn (operands[2], operands[3]);
689 if (split_load_immediate (operands + 2))
693 ;; Sadly, this can't be a proper named movstrict pattern, since the compiler
694 ;; expects to be able to use registers for operand 1.
695 ;; Note that the asm instruction is defined by the manual to take an unsigned
696 ;; constant, but it doesn't matter to the assembler, and the compiler only
697 ;; deals with sign-extended constants. Hence "Ksh".
698 (define_insn "movstricthi_1"
699 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+x"))
700 (match_operand:HI 1 "immediate_operand" "Ksh"))]
703 [(set_attr "type" "mvi")
704 (set_attr "length" "4")])
706 ;; Sign and zero extensions
708 (define_insn_and_split "extendhisi2"
709 [(set (match_operand:SI 0 "register_operand" "=d, d")
710 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d, m")))]
715 "reload_completed && bfin_dsp_memref_p (operands[1])"
716 [(set (match_dup 2) (match_dup 1))
717 (set (match_dup 0) (sign_extend:SI (match_dup 2)))]
719 operands[2] = gen_lowpart (HImode, operands[0]);
721 [(set_attr "type" "alu0,mcld")])
723 (define_insn_and_split "zero_extendhisi2"
724 [(set (match_operand:SI 0 "register_operand" "=d, d")
725 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d, m")))]
730 "reload_completed && bfin_dsp_memref_p (operands[1])"
731 [(set (match_dup 2) (match_dup 1))
732 (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
734 operands[2] = gen_lowpart (HImode, operands[0]);
736 [(set_attr "type" "alu0,mcld")])
738 (define_insn "zero_extendbisi2"
739 [(set (match_operand:SI 0 "register_operand" "=d")
740 (zero_extend:SI (match_operand:BI 1 "nonimmediate_operand" "C")))]
743 [(set_attr "type" "compare")])
745 (define_insn "extendqihi2"
746 [(set (match_operand:HI 0 "register_operand" "=d, d")
747 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
752 [(set_attr "type" "mcld,alu0")])
754 (define_insn "extendqisi2"
755 [(set (match_operand:SI 0 "register_operand" "=d, d")
756 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
761 [(set_attr "type" "mcld,alu0")])
764 (define_insn "zero_extendqihi2"
765 [(set (match_operand:HI 0 "register_operand" "=d, d")
766 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
771 [(set_attr "type" "mcld,alu0")])
774 (define_insn "zero_extendqisi2"
775 [(set (match_operand:SI 0 "register_operand" "=d, d")
776 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
781 [(set_attr "type" "mcld,alu0")])
783 ;; DImode logical operations
785 (define_code_macro any_logical [and ior xor])
786 (define_code_attr optab [(and "and")
789 (define_code_attr op [(and "&")
792 (define_code_attr high_result [(and "0")
796 (define_insn "<optab>di3"
797 [(set (match_operand:DI 0 "register_operand" "=d")
798 (any_logical:DI (match_operand:DI 1 "register_operand" "0")
799 (match_operand:DI 2 "register_operand" "d")))]
801 "%0 = %1 <op> %2;\\n\\t%H0 = %H1 <op> %H2;"
802 [(set_attr "length" "4")
803 (set_attr "seq_insns" "multi")])
805 (define_insn "*<optab>di_zesidi_di"
806 [(set (match_operand:DI 0 "register_operand" "=d")
807 (any_logical:DI (zero_extend:DI
808 (match_operand:SI 2 "register_operand" "d"))
809 (match_operand:DI 1 "register_operand" "d")))]
811 "%0 = %1 <op> %2;\\n\\t%H0 = <high_result>;"
812 [(set_attr "length" "4")
813 (set_attr "seq_insns" "multi")])
815 (define_insn "*<optab>di_sesdi_di"
816 [(set (match_operand:DI 0 "register_operand" "=d")
817 (any_logical:DI (sign_extend:DI
818 (match_operand:SI 2 "register_operand" "d"))
819 (match_operand:DI 1 "register_operand" "0")))
820 (clobber (match_scratch:SI 3 "=&d"))]
822 "%0 = %1 <op> %2;\\n\\t%3 = %2;\\n\\t%3 >>>= 31;\\n\\t%H0 = %H1 <op> %3;"
823 [(set_attr "length" "8")
824 (set_attr "seq_insns" "multi")])
826 (define_insn "negdi2"
827 [(set (match_operand:DI 0 "register_operand" "=d")
828 (neg:DI (match_operand:DI 1 "register_operand" "d")))
829 (clobber (match_scratch:SI 2 "=&d"))
830 (clobber (reg:CC REG_CC))]
832 "%2 = 0; %2 = %2 - %1; cc = ac0; cc = !cc; %2 = cc;\\n\\t%0 = -%1; %H0 = -%H1; %H0 = %H0 - %2;"
833 [(set_attr "length" "16")
834 (set_attr "seq_insns" "multi")])
836 (define_insn "one_cmpldi2"
837 [(set (match_operand:DI 0 "register_operand" "=d")
838 (not:DI (match_operand:DI 1 "register_operand" "d")))]
840 "%0 = ~%1;\\n\\t%H0 = ~%H1;"
841 [(set_attr "length" "4")
842 (set_attr "seq_insns" "multi")])
844 ;; DImode zero and sign extend patterns
846 (define_insn_and_split "zero_extendsidi2"
847 [(set (match_operand:DI 0 "register_operand" "=d")
848 (zero_extend:DI (match_operand:SI 1 "register_operand" "d")))]
852 [(set (match_dup 3) (const_int 0))]
854 split_di (operands, 1, operands + 2, operands + 3);
855 if (REGNO (operands[0]) != REGNO (operands[1]))
856 emit_move_insn (operands[2], operands[1]);
859 (define_insn "zero_extendqidi2"
860 [(set (match_operand:DI 0 "register_operand" "=d")
861 (zero_extend:DI (match_operand:QI 1 "register_operand" "d")))]
863 "%0 = %T1 (Z);\\n\\t%H0 = 0;"
864 [(set_attr "length" "4")
865 (set_attr "seq_insns" "multi")])
867 (define_insn "zero_extendhidi2"
868 [(set (match_operand:DI 0 "register_operand" "=d")
869 (zero_extend:DI (match_operand:HI 1 "register_operand" "d")))]
871 "%0 = %h1 (Z);\\n\\t%H0 = 0;"
872 [(set_attr "length" "4")
873 (set_attr "seq_insns" "multi")])
875 (define_insn_and_split "extendsidi2"
876 [(set (match_operand:DI 0 "register_operand" "=d")
877 (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))]
881 [(set (match_dup 3) (match_dup 1))
882 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
884 split_di (operands, 1, operands + 2, operands + 3);
885 if (REGNO (operands[0]) != REGNO (operands[1]))
886 emit_move_insn (operands[2], operands[1]);
889 (define_insn_and_split "extendqidi2"
890 [(set (match_operand:DI 0 "register_operand" "=d")
891 (sign_extend:DI (match_operand:QI 1 "register_operand" "d")))]
895 [(set (match_dup 2) (sign_extend:SI (match_dup 1)))
896 (set (match_dup 3) (sign_extend:SI (match_dup 1)))
897 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
899 split_di (operands, 1, operands + 2, operands + 3);
902 (define_insn_and_split "extendhidi2"
903 [(set (match_operand:DI 0 "register_operand" "=d")
904 (sign_extend:DI (match_operand:HI 1 "register_operand" "d")))]
908 [(set (match_dup 2) (sign_extend:SI (match_dup 1)))
909 (set (match_dup 3) (sign_extend:SI (match_dup 1)))
910 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
912 split_di (operands, 1, operands + 2, operands + 3);
915 ;; DImode arithmetic operations
917 (define_insn "adddi3"
918 [(set (match_operand:DI 0 "register_operand" "=&d,&d,&d")
919 (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0")
920 (match_operand:DI 2 "nonmemory_operand" "Kn7,Ks7,d")))
921 (clobber (match_scratch:SI 3 "=&d,&d,&d"))
922 (clobber (reg:CC 34))]
925 %0 += %2; cc = ac0; %3 = cc; %H0 += -1; %H0 = %H0 + %3;
926 %0 += %2; cc = ac0; %3 = cc; %H0 = %H0 + %3;
927 %0 = %0 + %2; cc = ac0; %3 = cc; %H0 = %H0 + %H2; %H0 = %H0 + %3;"
928 [(set_attr "type" "alu0")
929 (set_attr "length" "10,8,10")
930 (set_attr "seq_insns" "multi,multi,multi")])
932 (define_insn "subdi3"
933 [(set (match_operand:DI 0 "register_operand" "=&d")
934 (minus:DI (match_operand:DI 1 "register_operand" "0")
935 (match_operand:DI 2 "register_operand" "d")))
936 (clobber (reg:CC 34))]
938 "%0 = %1-%2;\\n\\tcc = ac0;\\n\\t%H0 = %H1-%H2;\\n\\tif cc jump 1f;\\n\\t%H0 += -1;\\n\\t1:"
939 [(set_attr "length" "10")
940 (set_attr "seq_insns" "multi")])
942 (define_insn "*subdi_di_zesidi"
943 [(set (match_operand:DI 0 "register_operand" "=d")
944 (minus:DI (match_operand:DI 1 "register_operand" "0")
946 (match_operand:SI 2 "register_operand" "d"))))
947 (clobber (match_scratch:SI 3 "=&d"))
948 (clobber (reg:CC 34))]
950 "%0 = %1 - %2;\\n\\tcc = ac0;\\n\\tcc = ! cc;\\n\\t%3 = cc;\\n\\t%H0 = %H1 - %3;"
951 [(set_attr "length" "10")
952 (set_attr "seq_insns" "multi")])
954 (define_insn "*subdi_zesidi_di"
955 [(set (match_operand:DI 0 "register_operand" "=d")
956 (minus:DI (zero_extend:DI
957 (match_operand:SI 2 "register_operand" "d"))
958 (match_operand:DI 1 "register_operand" "0")))
959 (clobber (match_scratch:SI 3 "=&d"))
960 (clobber (reg:CC 34))]
962 "%0 = %2 - %1;\\n\\tcc = ac0;\\n\\tcc = ! cc;\\n\\t%3 = cc;\\n\\t%3 = -%3;\\n\\t%H0 = %3 - %H1"
963 [(set_attr "length" "12")
964 (set_attr "seq_insns" "multi")])
966 (define_insn "*subdi_di_sesidi"
967 [(set (match_operand:DI 0 "register_operand" "=d")
968 (minus:DI (match_operand:DI 1 "register_operand" "0")
970 (match_operand:SI 2 "register_operand" "d"))))
971 (clobber (match_scratch:SI 3 "=&d"))
972 (clobber (reg:CC 34))]
974 "%0 = %1 - %2;\\n\\tcc = ac0;\\n\\t%3 = %2;\\n\\t%3 >>>= 31;\\n\\t%H0 = %H1 - %3;\\n\\tif cc jump 1f;\\n\\t%H0 += -1;\\n\\t1:"
975 [(set_attr "length" "14")
976 (set_attr "seq_insns" "multi")])
978 (define_insn "*subdi_sesidi_di"
979 [(set (match_operand:DI 0 "register_operand" "=d")
980 (minus:DI (sign_extend:DI
981 (match_operand:SI 2 "register_operand" "d"))
982 (match_operand:DI 1 "register_operand" "0")))
983 (clobber (match_scratch:SI 3 "=&d"))
984 (clobber (reg:CC 34))]
986 "%0 = %2 - %1;\\n\\tcc = ac0;\\n\\t%3 = %2;\\n\\t%3 >>>= 31;\\n\\t%H0 = %3 - %H1;\\n\\tif cc jump 1f;\\n\\t%H0 += -1;\\n\\t1:"
987 [(set_attr "length" "14")
988 (set_attr "seq_insns" "multi")])
990 ;; Combined shift/add instructions
993 [(set (match_operand:SI 0 "register_operand" "=a,d")
994 (ashift:SI (plus:SI (match_operand:SI 1 "register_operand" "%0,0")
995 (match_operand:SI 2 "register_operand" "a,d"))
996 (match_operand:SI 3 "pos_scale_operand" "P1P2,P1P2")))]
998 "%0 = (%0 + %2) << %3;" /* "shadd %0,%2,%3;" */
999 [(set_attr "type" "alu0")])
1002 [(set (match_operand:SI 0 "register_operand" "=a")
1003 (plus:SI (match_operand:SI 1 "register_operand" "a")
1004 (mult:SI (match_operand:SI 2 "register_operand" "a")
1005 (match_operand:SI 3 "scale_by_operand" "i"))))]
1007 "%0 = %1 + (%2 << %X3);"
1008 [(set_attr "type" "alu0")])
1011 [(set (match_operand:SI 0 "register_operand" "=a")
1012 (plus:SI (match_operand:SI 1 "register_operand" "a")
1013 (ashift:SI (match_operand:SI 2 "register_operand" "a")
1014 (match_operand:SI 3 "pos_scale_operand" "i"))))]
1016 "%0 = %1 + (%2 << %3);"
1017 [(set_attr "type" "alu0")])
1020 [(set (match_operand:SI 0 "register_operand" "=a")
1021 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "a")
1022 (match_operand:SI 2 "scale_by_operand" "i"))
1023 (match_operand:SI 3 "register_operand" "a")))]
1025 "%0 = %3 + (%1 << %X2);"
1026 [(set_attr "type" "alu0")])
1029 [(set (match_operand:SI 0 "register_operand" "=a")
1030 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "a")
1031 (match_operand:SI 2 "pos_scale_operand" "i"))
1032 (match_operand:SI 3 "register_operand" "a")))]
1034 "%0 = %3 + (%1 << %2);"
1035 [(set_attr "type" "alu0")])
1037 (define_insn "mulhisi3"
1038 [(set (match_operand:SI 0 "register_operand" "=d")
1039 (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%d"))
1040 (sign_extend:SI (match_operand:HI 2 "register_operand" "d"))))]
1042 "%0 = %h1 * %h2 (IS);"
1043 [(set_attr "type" "dsp32")])
1045 (define_insn "umulhisi3"
1046 [(set (match_operand:SI 0 "register_operand" "=d")
1047 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%d"))
1048 (zero_extend:SI (match_operand:HI 2 "register_operand" "d"))))]
1050 "%0 = %h1 * %h2 (FU);"
1051 [(set_attr "type" "dsp32")])
1053 (define_insn "usmulhisi3"
1054 [(set (match_operand:SI 0 "register_operand" "=W")
1055 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "W"))
1056 (sign_extend:SI (match_operand:HI 2 "register_operand" "W"))))]
1058 "%0 = %h2 * %h1 (IS,M);"
1059 [(set_attr "type" "dsp32")])
1061 ;; The processor also supports ireg += mreg or ireg -= mreg, but these
1062 ;; are unusable if we don't ensure that the corresponding lreg is zero.
1063 ;; The same applies to the add/subtract constant versions involving
1066 (define_insn "addsi3"
1067 [(set (match_operand:SI 0 "register_operand" "=ad,a,d")
1068 (plus:SI (match_operand:SI 1 "register_operand" "%0, a,d")
1069 (match_operand:SI 2 "reg_or_7bit_operand" "Ks7, a,d")))]
1075 [(set_attr "type" "alu0")
1076 (set_attr "length" "2,2,2")])
1078 (define_insn "ssaddsi3"
1079 [(set (match_operand:SI 0 "register_operand" "=d")
1080 (ss_plus:SI (match_operand:SI 1 "register_operand" "d")
1081 (match_operand:SI 2 "register_operand" "d")))]
1084 [(set_attr "type" "dsp32")])
1086 (define_insn "subsi3"
1087 [(set (match_operand:SI 0 "register_operand" "=da,d,a")
1088 (minus:SI (match_operand:SI 1 "register_operand" "0,d,0")
1089 (match_operand:SI 2 "reg_or_neg7bit_operand" "KN7,d,a")))]
1092 static const char *const strings_subsi3[] = {
1098 if (CONSTANT_P (operands[2]) && INTVAL (operands[2]) < 0) {
1099 rtx tmp_op = operands[2];
1100 operands[2] = GEN_INT (-INTVAL (operands[2]));
1101 output_asm_insn ("%0 += %2;", operands);
1102 operands[2] = tmp_op;
1106 return strings_subsi3[which_alternative];
1108 [(set_attr "type" "alu0")])
1110 (define_insn "sssubsi3"
1111 [(set (match_operand:SI 0 "register_operand" "=d")
1112 (ss_minus:SI (match_operand:SI 1 "register_operand" "d")
1113 (match_operand:SI 2 "register_operand" "d")))]
1116 [(set_attr "type" "dsp32")])
1118 ;; Bit test instructions
1120 (define_insn "*not_bittst"
1121 [(set (match_operand:BI 0 "register_operand" "=C")
1122 (eq:BI (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1124 (match_operand:SI 2 "immediate_operand" "Ku5"))
1127 "cc = !BITTST (%1,%2);"
1128 [(set_attr "type" "alu0")])
1130 (define_insn "*bittst"
1131 [(set (match_operand:BI 0 "register_operand" "=C")
1132 (ne:BI (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1134 (match_operand:SI 2 "immediate_operand" "Ku5"))
1137 "cc = BITTST (%1,%2);"
1138 [(set_attr "type" "alu0")])
1140 (define_insn_and_split "*bit_extract"
1141 [(set (match_operand:SI 0 "register_operand" "=d")
1142 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1144 (match_operand:SI 2 "immediate_operand" "Ku5")))
1145 (clobber (reg:BI REG_CC))]
1149 [(set (reg:BI REG_CC)
1150 (ne:BI (zero_extract:SI (match_dup 1) (const_int 1) (match_dup 2))
1153 (ne:SI (reg:BI REG_CC) (const_int 0)))])
1155 (define_insn_and_split "*not_bit_extract"
1156 [(set (match_operand:SI 0 "register_operand" "=d")
1157 (zero_extract:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
1159 (match_operand:SI 2 "immediate_operand" "Ku5")))
1160 (clobber (reg:BI REG_CC))]
1164 [(set (reg:BI REG_CC)
1165 (eq:BI (zero_extract:SI (match_dup 1) (const_int 1) (match_dup 2))
1168 (ne:SI (reg:BI REG_CC) (const_int 0)))])
1170 (define_insn "*andsi_insn"
1171 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
1172 (and:SI (match_operand:SI 1 "register_operand" "%0,d,d,d")
1173 (match_operand:SI 2 "rhs_andsi3_operand" "L,M1,M2,d")))]
1180 [(set_attr "type" "alu0")])
1182 (define_expand "andsi3"
1183 [(set (match_operand:SI 0 "register_operand" "")
1184 (and:SI (match_operand:SI 1 "register_operand" "")
1185 (match_operand:SI 2 "general_operand" "")))]
1188 if (highbits_operand (operands[2], SImode))
1190 operands[2] = GEN_INT (exact_log2 (-INTVAL (operands[2])));
1191 emit_insn (gen_ashrsi3 (operands[0], operands[1], operands[2]));
1192 emit_insn (gen_ashlsi3 (operands[0], operands[0], operands[2]));
1195 if (! rhs_andsi3_operand (operands[2], SImode))
1196 operands[2] = force_reg (SImode, operands[2]);
1199 (define_insn "iorsi3"
1200 [(set (match_operand:SI 0 "register_operand" "=d,d")
1201 (ior:SI (match_operand:SI 1 "register_operand" "%0,d")
1202 (match_operand:SI 2 "regorlog2_operand" "J,d")))]
1207 [(set_attr "type" "alu0")])
1209 (define_insn "xorsi3"
1210 [(set (match_operand:SI 0 "register_operand" "=d,d")
1211 (xor:SI (match_operand:SI 1 "register_operand" "%0,d")
1212 (match_operand:SI 2 "regorlog2_operand" "J,d")))]
1217 [(set_attr "type" "alu0")])
1219 (define_insn "smaxsi3"
1220 [(set (match_operand:SI 0 "register_operand" "=d")
1221 (smax:SI (match_operand:SI 1 "register_operand" "d")
1222 (match_operand:SI 2 "register_operand" "d")))]
1225 [(set_attr "type" "dsp32")])
1227 (define_insn "sminsi3"
1228 [(set (match_operand:SI 0 "register_operand" "=d")
1229 (smin:SI (match_operand:SI 1 "register_operand" "d")
1230 (match_operand:SI 2 "register_operand" "d")))]
1233 [(set_attr "type" "dsp32")])
1235 (define_insn "abssi2"
1236 [(set (match_operand:SI 0 "register_operand" "=d")
1237 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
1240 [(set_attr "type" "dsp32")])
1242 (define_insn "negsi2"
1243 [(set (match_operand:SI 0 "register_operand" "=d")
1244 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1247 [(set_attr "type" "alu0")])
1249 (define_insn "ssnegsi2"
1250 [(set (match_operand:SI 0 "register_operand" "=d")
1251 (ss_neg:SI (match_operand:SI 1 "register_operand" "d")))]
1254 [(set_attr "type" "dsp32")])
1256 (define_insn "one_cmplsi2"
1257 [(set (match_operand:SI 0 "register_operand" "=d")
1258 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1261 [(set_attr "type" "alu0")])
1263 (define_insn "signbitssi2"
1264 [(set (match_operand:HI 0 "register_operand" "=d")
1266 (lt (match_operand:SI 1 "register_operand" "d") (const_int 0))
1267 (clz:HI (not:SI (match_dup 1)))
1268 (clz:HI (match_dup 1))))]
1270 "%h0 = signbits %1;"
1271 [(set_attr "type" "dsp32")])
1273 (define_insn "smaxhi3"
1274 [(set (match_operand:HI 0 "register_operand" "=d")
1275 (smax:HI (match_operand:HI 1 "register_operand" "d")
1276 (match_operand:HI 2 "register_operand" "d")))]
1278 "%0 = max(%1,%2) (V);"
1279 [(set_attr "type" "dsp32")])
1281 (define_insn "sminhi3"
1282 [(set (match_operand:HI 0 "register_operand" "=d")
1283 (smin:HI (match_operand:HI 1 "register_operand" "d")
1284 (match_operand:HI 2 "register_operand" "d")))]
1286 "%0 = min(%1,%2) (V);"
1287 [(set_attr "type" "dsp32")])
1289 (define_insn "abshi2"
1290 [(set (match_operand:HI 0 "register_operand" "=d")
1291 (abs:HI (match_operand:HI 1 "register_operand" "d")))]
1294 [(set_attr "type" "dsp32")])
1296 (define_insn "neghi2"
1297 [(set (match_operand:HI 0 "register_operand" "=d")
1298 (neg:HI (match_operand:HI 1 "register_operand" "d")))]
1301 [(set_attr "type" "dsp32")])
1303 (define_insn "ssneghi2"
1304 [(set (match_operand:HI 0 "register_operand" "=d")
1305 (ss_neg:HI (match_operand:HI 1 "register_operand" "d")))]
1308 [(set_attr "type" "dsp32")])
1310 (define_insn "signbitshi2"
1311 [(set (match_operand:HI 0 "register_operand" "=d")
1313 (lt (match_operand:HI 1 "register_operand" "d") (const_int 0))
1314 (clz:HI (not:HI (match_dup 1)))
1315 (clz:HI (match_dup 1))))]
1317 "%h0 = signbits %h1;"
1318 [(set_attr "type" "dsp32")])
1320 (define_insn "mulsi3"
1321 [(set (match_operand:SI 0 "register_operand" "=d")
1322 (mult:SI (match_operand:SI 1 "register_operand" "%0")
1323 (match_operand:SI 2 "register_operand" "d")))]
1326 [(set_attr "type" "mult")])
1328 (define_expand "ashlsi3"
1329 [(set (match_operand:SI 0 "register_operand" "")
1330 (ashift:SI (match_operand:SI 1 "register_operand" "")
1331 (match_operand:SI 2 "nonmemory_operand" "")))]
1334 if (GET_CODE (operands[2]) == CONST_INT
1335 && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
1337 emit_insn (gen_movsi (operands[0], const0_rtx));
1342 (define_insn_and_split "*ashlsi3_insn"
1343 [(set (match_operand:SI 0 "register_operand" "=d,a,a,a")
1344 (ashift:SI (match_operand:SI 1 "register_operand" "0,a,a,a")
1345 (match_operand:SI 2 "nonmemory_operand" "dKu5,P1,P2,?P3P4")))]
1352 "PREG_P (operands[0]) && INTVAL (operands[2]) > 2"
1353 [(set (match_dup 0) (ashift:SI (match_dup 1) (const_int 2)))
1354 (set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 3)))]
1355 "operands[3] = GEN_INT (INTVAL (operands[2]) - 2);"
1356 [(set_attr "type" "shft")])
1358 (define_insn "ashrsi3"
1359 [(set (match_operand:SI 0 "register_operand" "=d")
1360 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
1361 (match_operand:SI 2 "nonmemory_operand" "dKu5")))]
1364 [(set_attr "type" "shft")])
1366 (define_insn "ror_one"
1367 [(set (match_operand:SI 0 "register_operand" "=d")
1368 (ior:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
1369 (ashift:SI (zero_extend:SI (reg:BI REG_CC)) (const_int 31))))
1370 (set (reg:BI REG_CC)
1371 (zero_extract:BI (match_dup 1) (const_int 1) (const_int 0)))]
1373 "%0 = ROT %1 BY -1;"
1374 [(set_attr "type" "shft")
1375 (set_attr "length" "4")])
1377 (define_insn "rol_one"
1378 [(set (match_operand:SI 0 "register_operand" "+d")
1379 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
1380 (zero_extend:SI (reg:BI REG_CC))))
1381 (set (reg:BI REG_CC)
1382 (zero_extract:BI (match_dup 1) (const_int 31) (const_int 0)))]
1385 [(set_attr "type" "shft")
1386 (set_attr "length" "4")])
1388 (define_expand "lshrdi3"
1389 [(set (match_operand:DI 0 "register_operand" "")
1390 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
1391 (match_operand:DI 2 "general_operand" "")))]
1394 rtx lo_half[2], hi_half[2];
1396 if (operands[2] != const1_rtx)
1398 if (! rtx_equal_p (operands[0], operands[1]))
1399 emit_move_insn (operands[0], operands[1]);
1401 split_di (operands, 2, lo_half, hi_half);
1403 emit_move_insn (bfin_cc_rtx, const0_rtx);
1404 emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
1405 emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
1409 (define_expand "ashrdi3"
1410 [(set (match_operand:DI 0 "register_operand" "")
1411 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
1412 (match_operand:DI 2 "general_operand" "")))]
1415 rtx lo_half[2], hi_half[2];
1417 if (operands[2] != const1_rtx)
1419 if (! rtx_equal_p (operands[0], operands[1]))
1420 emit_move_insn (operands[0], operands[1]);
1422 split_di (operands, 2, lo_half, hi_half);
1424 emit_insn (gen_compare_lt (gen_rtx_REG (BImode, REG_CC),
1425 hi_half[1], const0_rtx));
1426 emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
1427 emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
1431 (define_expand "ashldi3"
1432 [(set (match_operand:DI 0 "register_operand" "")
1433 (ashift:DI (match_operand:DI 1 "register_operand" "")
1434 (match_operand:DI 2 "general_operand" "")))]
1437 rtx lo_half[2], hi_half[2];
1439 if (operands[2] != const1_rtx)
1441 if (! rtx_equal_p (operands[0], operands[1]))
1442 emit_move_insn (operands[0], operands[1]);
1444 split_di (operands, 2, lo_half, hi_half);
1446 emit_move_insn (bfin_cc_rtx, const0_rtx);
1447 emit_insn (gen_rol_one (lo_half[0], lo_half[0]));
1448 emit_insn (gen_rol_one (hi_half[0], hi_half[0]));
1452 (define_insn "lshrsi3"
1453 [(set (match_operand:SI 0 "register_operand" "=d,a")
1454 (lshiftrt:SI (match_operand:SI 1 "register_operand" " 0,a")
1455 (match_operand:SI 2 "nonmemory_operand" "dKu5,P1P2")))]
1460 [(set_attr "type" "shft")])
1462 ;; A pattern to reload the equivalent of
1463 ;; (set (Dreg) (plus (FP) (large_constant)))
1465 ;; (set (dagreg) (plus (FP) (arbitrary_constant)))
1466 ;; using a scratch register
1467 (define_expand "reload_insi"
1468 [(parallel [(set (match_operand:SI 0 "register_operand" "=w")
1469 (match_operand:SI 1 "fp_plus_const_operand" ""))
1470 (clobber (match_operand:SI 2 "register_operand" "=&a"))])]
1473 rtx fp_op = XEXP (operands[1], 0);
1474 rtx const_op = XEXP (operands[1], 1);
1475 rtx primary = operands[0];
1476 rtx scratch = operands[2];
1478 emit_move_insn (scratch, const_op);
1479 emit_insn (gen_addsi3 (scratch, scratch, fp_op));
1480 emit_move_insn (primary, scratch);
1484 ;; Jump instructions
1488 (label_ref (match_operand 0 "" "")))]
1491 if (get_attr_length (insn) == 2)
1492 return "jump.s %0;";
1494 return "jump.l %0;";
1496 [(set_attr "type" "br")])
1498 (define_insn "indirect_jump"
1500 (match_operand:SI 0 "register_operand" "a"))]
1503 [(set_attr "type" "misc")])
1505 (define_expand "tablejump"
1506 [(parallel [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1507 (use (label_ref (match_operand 1 "" "")))])]
1510 /* In PIC mode, the table entries are stored PC relative.
1511 Convert the relative address to an absolute address. */
1514 rtx op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
1516 operands[0] = expand_simple_binop (Pmode, PLUS, operands[0],
1517 op1, NULL_RTX, 0, OPTAB_DIRECT);
1521 (define_insn "*tablejump_internal"
1522 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1523 (use (label_ref (match_operand 1 "" "")))]
1526 [(set_attr "type" "misc")])
1530 ; operand 0 is the loop count pseudo register
1531 ; operand 1 is the number of loop iterations or 0 if it is unknown
1532 ; operand 2 is the maximum number of loop iterations
1533 ; operand 3 is the number of levels of enclosed loops
1534 ; operand 4 is the label to jump to at the top of the loop
1535 (define_expand "doloop_end"
1536 [(parallel [(set (pc) (if_then_else
1537 (ne (match_operand:SI 0 "" "")
1539 (label_ref (match_operand 4 "" ""))
1542 (plus:SI (match_dup 0)
1544 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1545 (clobber (match_scratch:SI 5 ""))])]
1547 {bfin_hardware_loop ();})
1549 (define_insn "loop_end"
1551 (if_then_else (ne (match_operand:SI 0 "nonimmediate_operand" "+a*d,*b*v*f,m")
1553 (label_ref (match_operand 1 "" ""))
1558 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1559 (clobber (match_scratch:SI 2 "=X,&r,&r"))]
1562 /* loop end %0 %l1 */
1565 [(set_attr "length" "6,10,14")])
1569 (if_then_else (ne (match_operand:SI 0 "nondp_reg_or_memory_operand" "")
1571 (label_ref (match_operand 1 "" ""))
1576 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1577 (clobber (match_scratch:SI 2 "=&r"))]
1579 [(set (match_dup 2) (match_dup 0))
1580 (set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
1581 (set (match_dup 0) (match_dup 2))
1582 (set (reg:BI REG_CC) (eq:BI (match_dup 2) (const_int 0)))
1584 (if_then_else (eq (reg:BI REG_CC)
1586 (label_ref (match_dup 1))
1590 (define_insn "lsetup_with_autoinit"
1591 [(set (match_operand:SI 0 "lt_register_operand" "=t")
1592 (label_ref (match_operand 1 "" "")))
1593 (set (match_operand:SI 2 "lb_register_operand" "=u")
1594 (label_ref (match_operand 3 "" "")))
1595 (set (match_operand:SI 4 "lc_register_operand" "=k")
1596 (match_operand:SI 5 "register_operand" "a"))]
1598 "LSETUP (%1, %3) %4 = %5;"
1599 [(set_attr "length" "4")])
1601 (define_insn "lsetup_without_autoinit"
1602 [(set (match_operand:SI 0 "lt_register_operand" "=t")
1603 (label_ref (match_operand 1 "" "")))
1604 (set (match_operand:SI 2 "lb_register_operand" "=u")
1605 (label_ref (match_operand 3 "" "")))
1606 (use (match_operand:SI 4 "lc_register_operand" "k"))]
1608 "LSETUP (%1, %3) %4;"
1609 [(set_attr "length" "4")])
1611 ;; Call instructions..
1613 ;; The explicit MEM inside the UNSPEC prevents the compiler from moving
1614 ;; the load before a branch after a NULL test, or before a store that
1615 ;; initializes a function descriptor.
1617 (define_insn_and_split "load_funcdescsi"
1618 [(set (match_operand:SI 0 "register_operand" "=a")
1619 (unspec_volatile:SI [(mem:SI (match_operand:SI 1 "address_operand" "p"))]
1620 UNSPEC_VOLATILE_LOAD_FUNCDESC))]
1624 [(set (match_dup 0) (mem:SI (match_dup 1)))])
1626 (define_expand "call"
1627 [(parallel [(call (match_operand:SI 0 "" "")
1628 (match_operand 1 "" ""))
1629 (use (match_operand 2 "" ""))])]
1632 bfin_expand_call (NULL_RTX, operands[0], operands[1], operands[2], 0);
1636 (define_expand "sibcall"
1637 [(parallel [(call (match_operand:SI 0 "" "")
1638 (match_operand 1 "" ""))
1639 (use (match_operand 2 "" ""))
1643 bfin_expand_call (NULL_RTX, operands[0], operands[1], operands[2], 1);
1647 (define_expand "call_value"
1648 [(parallel [(set (match_operand 0 "register_operand" "")
1649 (call (match_operand:SI 1 "" "")
1650 (match_operand 2 "" "")))
1651 (use (match_operand 3 "" ""))])]
1654 bfin_expand_call (operands[0], operands[1], operands[2], operands[3], 0);
1658 (define_expand "sibcall_value"
1659 [(parallel [(set (match_operand 0 "register_operand" "")
1660 (call (match_operand:SI 1 "" "")
1661 (match_operand 2 "" "")))
1662 (use (match_operand 3 "" ""))
1666 bfin_expand_call (operands[0], operands[1], operands[2], operands[3], 1);
1670 (define_insn "*call_symbol_fdpic"
1671 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
1672 (match_operand 1 "general_operand" "g"))
1673 (use (match_operand:SI 2 "register_operand" "Z"))
1674 (use (match_operand 3 "" ""))]
1675 "! SIBLING_CALL_P (insn)
1676 && GET_CODE (operands[0]) == SYMBOL_REF
1677 && !bfin_longcall_p (operands[0], INTVAL (operands[3]))"
1679 [(set_attr "type" "call")
1680 (set_attr "length" "4")])
1682 (define_insn "*sibcall_symbol_fdpic"
1683 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
1684 (match_operand 1 "general_operand" "g"))
1685 (use (match_operand:SI 2 "register_operand" "Z"))
1686 (use (match_operand 3 "" ""))
1688 "SIBLING_CALL_P (insn)
1689 && GET_CODE (operands[0]) == SYMBOL_REF
1690 && !bfin_longcall_p (operands[0], INTVAL (operands[3]))"
1692 [(set_attr "type" "br")
1693 (set_attr "length" "4")])
1695 (define_insn "*call_value_symbol_fdpic"
1696 [(set (match_operand 0 "register_operand" "=d")
1697 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
1698 (match_operand 2 "general_operand" "g")))
1699 (use (match_operand:SI 3 "register_operand" "Z"))
1700 (use (match_operand 4 "" ""))]
1701 "! SIBLING_CALL_P (insn)
1702 && GET_CODE (operands[1]) == SYMBOL_REF
1703 && !bfin_longcall_p (operands[1], INTVAL (operands[4]))"
1705 [(set_attr "type" "call")
1706 (set_attr "length" "4")])
1708 (define_insn "*sibcall_value_symbol_fdpic"
1709 [(set (match_operand 0 "register_operand" "=d")
1710 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
1711 (match_operand 2 "general_operand" "g")))
1712 (use (match_operand:SI 3 "register_operand" "Z"))
1713 (use (match_operand 4 "" ""))
1715 "SIBLING_CALL_P (insn)
1716 && GET_CODE (operands[1]) == SYMBOL_REF
1717 && !bfin_longcall_p (operands[1], INTVAL (operands[4]))"
1719 [(set_attr "type" "br")
1720 (set_attr "length" "4")])
1722 (define_insn "*call_insn_fdpic"
1723 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "Y"))
1724 (match_operand 1 "general_operand" "g"))
1725 (use (match_operand:SI 2 "register_operand" "Z"))
1726 (use (match_operand 3 "" ""))]
1727 "! SIBLING_CALL_P (insn)"
1729 [(set_attr "type" "call")
1730 (set_attr "length" "2")])
1732 (define_insn "*sibcall_insn_fdpic"
1733 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "Y"))
1734 (match_operand 1 "general_operand" "g"))
1735 (use (match_operand:SI 2 "register_operand" "Z"))
1736 (use (match_operand 3 "" ""))
1738 "SIBLING_CALL_P (insn)"
1740 [(set_attr "type" "br")
1741 (set_attr "length" "2")])
1743 (define_insn "*call_value_insn_fdpic"
1744 [(set (match_operand 0 "register_operand" "=d")
1745 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "Y"))
1746 (match_operand 2 "general_operand" "g")))
1747 (use (match_operand:SI 3 "register_operand" "Z"))
1748 (use (match_operand 4 "" ""))]
1749 "! SIBLING_CALL_P (insn)"
1751 [(set_attr "type" "call")
1752 (set_attr "length" "2")])
1754 (define_insn "*sibcall_value_insn_fdpic"
1755 [(set (match_operand 0 "register_operand" "=d")
1756 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "Y"))
1757 (match_operand 2 "general_operand" "g")))
1758 (use (match_operand:SI 3 "register_operand" "Z"))
1759 (use (match_operand 4 "" ""))
1761 "SIBLING_CALL_P (insn)"
1763 [(set_attr "type" "br")
1764 (set_attr "length" "2")])
1766 (define_insn "*call_symbol"
1767 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
1768 (match_operand 1 "general_operand" "g"))
1769 (use (match_operand 2 "" ""))]
1770 "! SIBLING_CALL_P (insn)
1771 && !TARGET_ID_SHARED_LIBRARY
1772 && GET_CODE (operands[0]) == SYMBOL_REF
1773 && !bfin_longcall_p (operands[0], INTVAL (operands[2]))"
1775 [(set_attr "type" "call")
1776 (set_attr "length" "4")])
1778 (define_insn "*sibcall_symbol"
1779 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
1780 (match_operand 1 "general_operand" "g"))
1781 (use (match_operand 2 "" ""))
1783 "SIBLING_CALL_P (insn)
1784 && !TARGET_ID_SHARED_LIBRARY
1785 && GET_CODE (operands[0]) == SYMBOL_REF
1786 && !bfin_longcall_p (operands[0], INTVAL (operands[2]))"
1788 [(set_attr "type" "br")
1789 (set_attr "length" "4")])
1791 (define_insn "*call_value_symbol"
1792 [(set (match_operand 0 "register_operand" "=d")
1793 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
1794 (match_operand 2 "general_operand" "g")))
1795 (use (match_operand 3 "" ""))]
1796 "! SIBLING_CALL_P (insn)
1797 && !TARGET_ID_SHARED_LIBRARY
1798 && GET_CODE (operands[1]) == SYMBOL_REF
1799 && !bfin_longcall_p (operands[1], INTVAL (operands[3]))"
1801 [(set_attr "type" "call")
1802 (set_attr "length" "4")])
1804 (define_insn "*sibcall_value_symbol"
1805 [(set (match_operand 0 "register_operand" "=d")
1806 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
1807 (match_operand 2 "general_operand" "g")))
1808 (use (match_operand 3 "" ""))
1810 "SIBLING_CALL_P (insn)
1811 && !TARGET_ID_SHARED_LIBRARY
1812 && GET_CODE (operands[1]) == SYMBOL_REF
1813 && !bfin_longcall_p (operands[1], INTVAL (operands[3]))"
1815 [(set_attr "type" "br")
1816 (set_attr "length" "4")])
1818 (define_insn "*call_insn"
1819 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "a"))
1820 (match_operand 1 "general_operand" "g"))
1821 (use (match_operand 2 "" ""))]
1822 "! SIBLING_CALL_P (insn)"
1824 [(set_attr "type" "call")
1825 (set_attr "length" "2")])
1827 (define_insn "*sibcall_insn"
1828 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "z"))
1829 (match_operand 1 "general_operand" "g"))
1830 (use (match_operand 2 "" ""))
1832 "SIBLING_CALL_P (insn)"
1834 [(set_attr "type" "br")
1835 (set_attr "length" "2")])
1837 (define_insn "*call_value_insn"
1838 [(set (match_operand 0 "register_operand" "=d")
1839 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "a"))
1840 (match_operand 2 "general_operand" "g")))
1841 (use (match_operand 3 "" ""))]
1842 "! SIBLING_CALL_P (insn)"
1844 [(set_attr "type" "call")
1845 (set_attr "length" "2")])
1847 (define_insn "*sibcall_value_insn"
1848 [(set (match_operand 0 "register_operand" "=d")
1849 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "z"))
1850 (match_operand 2 "general_operand" "g")))
1851 (use (match_operand 3 "" ""))
1853 "SIBLING_CALL_P (insn)"
1855 [(set_attr "type" "br")
1856 (set_attr "length" "2")])
1858 ;; Block move patterns
1860 ;; We cheat. This copies one more word than operand 2 indicates.
1862 (define_insn "rep_movsi"
1863 [(set (match_operand:SI 0 "register_operand" "=&a")
1864 (plus:SI (plus:SI (match_operand:SI 3 "register_operand" "0")
1865 (ashift:SI (match_operand:SI 2 "register_operand" "a")
1868 (set (match_operand:SI 1 "register_operand" "=&b")
1869 (plus:SI (plus:SI (match_operand:SI 4 "register_operand" "1")
1870 (ashift:SI (match_dup 2) (const_int 2)))
1872 (set (mem:BLK (match_dup 3))
1873 (mem:BLK (match_dup 4)))
1875 (clobber (match_scratch:HI 5 "=&d"))
1876 (clobber (reg:SI REG_LT1))
1877 (clobber (reg:SI REG_LC1))
1878 (clobber (reg:SI REG_LB1))]
1880 "%5 = [%4++]; lsetup (1f, 1f) LC1 = %2; 1: MNOP || [%3++] = %5 || %5 = [%4++]; [%3++] = %5;"
1881 [(set_attr "type" "misc")
1882 (set_attr "length" "16")
1883 (set_attr "seq_insns" "multi")])
1885 (define_insn "rep_movhi"
1886 [(set (match_operand:SI 0 "register_operand" "=&a")
1887 (plus:SI (plus:SI (match_operand:SI 3 "register_operand" "0")
1888 (ashift:SI (match_operand:SI 2 "register_operand" "a")
1891 (set (match_operand:SI 1 "register_operand" "=&b")
1892 (plus:SI (plus:SI (match_operand:SI 4 "register_operand" "1")
1893 (ashift:SI (match_dup 2) (const_int 1)))
1895 (set (mem:BLK (match_dup 3))
1896 (mem:BLK (match_dup 4)))
1898 (clobber (match_scratch:HI 5 "=&d"))
1899 (clobber (reg:SI REG_LT1))
1900 (clobber (reg:SI REG_LC1))
1901 (clobber (reg:SI REG_LB1))]
1903 "%h5 = W[%4++]; lsetup (1f, 1f) LC1 = %2; 1: MNOP || W [%3++] = %5 || %h5 = W [%4++]; W [%3++] = %5;"
1904 [(set_attr "type" "misc")
1905 (set_attr "length" "16")
1906 (set_attr "seq_insns" "multi")])
1908 (define_expand "movmemsi"
1909 [(match_operand:BLK 0 "general_operand" "")
1910 (match_operand:BLK 1 "general_operand" "")
1911 (match_operand:SI 2 "const_int_operand" "")
1912 (match_operand:SI 3 "const_int_operand" "")]
1915 if (bfin_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
1920 ;; Conditional branch patterns
1921 ;; The Blackfin has only few condition codes: eq, lt, lte, ltu, leu
1923 ;; The only outcome of this pattern is that global variables
1924 ;; bfin_compare_op[01] are set for use in bcond patterns.
1926 (define_expand "cmpbi"
1927 [(set (cc0) (compare (match_operand:BI 0 "register_operand" "")
1928 (match_operand:BI 1 "immediate_operand" "")))]
1931 bfin_compare_op0 = operands[0];
1932 bfin_compare_op1 = operands[1];
1936 (define_expand "cmpsi"
1937 [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
1938 (match_operand:SI 1 "reg_or_const_int_operand" "")))]
1941 bfin_compare_op0 = operands[0];
1942 bfin_compare_op1 = operands[1];
1946 (define_insn "compare_eq"
1947 [(set (match_operand:BI 0 "register_operand" "=C,C")
1948 (eq:BI (match_operand:SI 1 "register_operand" "d,a")
1949 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
1952 [(set_attr "type" "compare")])
1954 (define_insn "compare_ne"
1955 [(set (match_operand:BI 0 "register_operand" "=C,C")
1956 (ne:BI (match_operand:SI 1 "register_operand" "d,a")
1957 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
1960 [(set_attr "type" "compare")])
1962 (define_insn "compare_lt"
1963 [(set (match_operand:BI 0 "register_operand" "=C,C")
1964 (lt:BI (match_operand:SI 1 "register_operand" "d,a")
1965 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
1968 [(set_attr "type" "compare")])
1970 (define_insn "compare_le"
1971 [(set (match_operand:BI 0 "register_operand" "=C,C")
1972 (le:BI (match_operand:SI 1 "register_operand" "d,a")
1973 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
1976 [(set_attr "type" "compare")])
1978 (define_insn "compare_leu"
1979 [(set (match_operand:BI 0 "register_operand" "=C,C")
1980 (leu:BI (match_operand:SI 1 "register_operand" "d,a")
1981 (match_operand:SI 2 "reg_or_const_int_operand" "dKu3,aKu3")))]
1984 [(set_attr "type" "compare")])
1986 (define_insn "compare_ltu"
1987 [(set (match_operand:BI 0 "register_operand" "=C,C")
1988 (ltu:BI (match_operand:SI 1 "register_operand" "d,a")
1989 (match_operand:SI 2 "reg_or_const_int_operand" "dKu3,aKu3")))]
1992 [(set_attr "type" "compare")])
1994 (define_expand "beq"
1995 [(set (match_dup 1) (match_dup 2))
1997 (if_then_else (match_dup 3)
1998 (label_ref (match_operand 0 "" ""))
2002 rtx op0 = bfin_compare_op0, op1 = bfin_compare_op1;
2003 operands[1] = bfin_cc_rtx; /* hard register: CC */
2004 operands[2] = gen_rtx_EQ (BImode, op0, op1);
2005 /* If we have a BImode input, then we already have a compare result, and
2006 do not need to emit another comparison. */
2007 if (GET_MODE (bfin_compare_op0) == BImode)
2009 gcc_assert (bfin_compare_op1 == const0_rtx);
2010 emit_insn (gen_cbranchbi4 (operands[2], op0, op1, operands[0]));
2014 operands[3] = gen_rtx_NE (BImode, operands[1], const0_rtx);
2017 (define_expand "bne"
2018 [(set (match_dup 1) (match_dup 2))
2020 (if_then_else (match_dup 3)
2021 (label_ref (match_operand 0 "" ""))
2025 rtx op0 = bfin_compare_op0, op1 = bfin_compare_op1;
2026 /* If we have a BImode input, then we already have a compare result, and
2027 do not need to emit another comparison. */
2028 if (GET_MODE (bfin_compare_op0) == BImode)
2030 rtx cmp = gen_rtx_NE (BImode, op0, op1);
2032 gcc_assert (bfin_compare_op1 == const0_rtx);
2033 emit_insn (gen_cbranchbi4 (cmp, op0, op1, operands[0]));
2037 operands[1] = bfin_cc_rtx; /* hard register: CC */
2038 operands[2] = gen_rtx_EQ (BImode, op0, op1);
2039 operands[3] = gen_rtx_EQ (BImode, operands[1], const0_rtx);
2042 (define_expand "bgt"
2043 [(set (match_dup 1) (match_dup 2))
2045 (if_then_else (match_dup 3)
2046 (label_ref (match_operand 0 "" ""))
2050 operands[1] = bfin_cc_rtx;
2051 operands[2] = gen_rtx_LE (BImode, bfin_compare_op0, bfin_compare_op1);
2052 operands[3] = gen_rtx_EQ (BImode, operands[1], const0_rtx);
2055 (define_expand "bgtu"
2056 [(set (match_dup 1) (match_dup 2))
2058 (if_then_else (match_dup 3)
2059 (label_ref (match_operand 0 "" ""))
2063 operands[1] = bfin_cc_rtx;
2064 operands[2] = gen_rtx_LEU (BImode, bfin_compare_op0, bfin_compare_op1);
2065 operands[3] = gen_rtx_EQ (BImode, operands[1], const0_rtx);
2068 (define_expand "blt"
2069 [(set (match_dup 1) (match_dup 2))
2071 (if_then_else (match_dup 3)
2072 (label_ref (match_operand 0 "" ""))
2076 operands[1] = bfin_cc_rtx;
2077 operands[2] = gen_rtx_LT (BImode, bfin_compare_op0, bfin_compare_op1);
2078 operands[3] = gen_rtx_NE (BImode, operands[1], const0_rtx);
2081 (define_expand "bltu"
2082 [(set (match_dup 1) (match_dup 2))
2084 (if_then_else (match_dup 3)
2085 (label_ref (match_operand 0 "" ""))
2089 operands[1] = bfin_cc_rtx;
2090 operands[2] = gen_rtx_LTU (BImode, bfin_compare_op0, bfin_compare_op1);
2091 operands[3] = gen_rtx_NE (BImode, operands[1], const0_rtx);
2095 (define_expand "bge"
2096 [(set (match_dup 1) (match_dup 2))
2098 (if_then_else (match_dup 3)
2099 (label_ref (match_operand 0 "" ""))
2103 operands[1] = bfin_cc_rtx;
2104 operands[2] = gen_rtx_LT (BImode, bfin_compare_op0, bfin_compare_op1);
2105 operands[3] = gen_rtx_EQ (BImode, operands[1], const0_rtx);
2108 (define_expand "bgeu"
2109 [(set (match_dup 1) (match_dup 2))
2111 (if_then_else (match_dup 3)
2112 (label_ref (match_operand 0 "" ""))
2116 operands[1] = bfin_cc_rtx;
2117 operands[2] = gen_rtx_LTU (BImode, bfin_compare_op0, bfin_compare_op1);
2118 operands[3] = gen_rtx_EQ (BImode, operands[1], const0_rtx);
2121 (define_expand "ble"
2122 [(set (match_dup 1) (match_dup 2))
2124 (if_then_else (match_dup 3)
2125 (label_ref (match_operand 0 "" ""))
2129 operands[1] = bfin_cc_rtx;
2130 operands[2] = gen_rtx_LE (BImode, bfin_compare_op0, bfin_compare_op1);
2131 operands[3] = gen_rtx_NE (BImode, operands[1], const0_rtx);
2134 (define_expand "bleu"
2135 [(set (match_dup 1) (match_dup 2))
2137 (if_then_else (match_dup 3)
2138 (label_ref (match_operand 0 "" ""))
2143 operands[1] = bfin_cc_rtx;
2144 operands[2] = gen_rtx_LEU (BImode, bfin_compare_op0, bfin_compare_op1);
2145 operands[3] = gen_rtx_NE (BImode, operands[1], const0_rtx);
2148 (define_insn "cbranchbi4"
2151 (match_operator 0 "bfin_cbranch_operator"
2152 [(match_operand:BI 1 "register_operand" "C")
2153 (match_operand:BI 2 "immediate_operand" "P0")])
2154 (label_ref (match_operand 3 "" ""))
2158 asm_conditional_branch (insn, operands, 0, 0);
2161 [(set_attr "type" "brcc")])
2163 ;; Special cbranch patterns to deal with the speculative load problem - see
2164 ;; bfin_reorg for details.
2166 (define_insn "cbranch_predicted_taken"
2169 (match_operator 0 "bfin_cbranch_operator"
2170 [(match_operand:BI 1 "register_operand" "C")
2171 (match_operand:BI 2 "immediate_operand" "P0")])
2172 (label_ref (match_operand 3 "" ""))
2174 (unspec [(const_int 0)] UNSPEC_CBRANCH_TAKEN)]
2177 asm_conditional_branch (insn, operands, 0, 1);
2180 [(set_attr "type" "brcc")])
2182 (define_insn "cbranch_with_nops"
2185 (match_operator 0 "bfin_cbranch_operator"
2186 [(match_operand:BI 1 "register_operand" "C")
2187 (match_operand:BI 2 "immediate_operand" "P0")])
2188 (label_ref (match_operand 3 "" ""))
2190 (unspec [(match_operand 4 "immediate_operand" "")] UNSPEC_CBRANCH_NOPS)]
2193 asm_conditional_branch (insn, operands, INTVAL (operands[4]), 0);
2196 [(set_attr "type" "brcc")
2197 (set_attr "length" "6")])
2200 (define_expand "seq"
2201 [(set (match_dup 1) (eq:BI (match_dup 2) (match_dup 3)))
2202 (set (match_operand:SI 0 "register_operand" "")
2203 (ne:SI (match_dup 1) (const_int 0)))]
2206 operands[2] = bfin_compare_op0;
2207 operands[3] = bfin_compare_op1;
2208 operands[1] = bfin_cc_rtx;
2211 (define_expand "slt"
2212 [(set (match_dup 1) (lt:BI (match_dup 2) (match_dup 3)))
2213 (set (match_operand:SI 0 "register_operand" "")
2214 (ne:SI (match_dup 1) (const_int 0)))]
2217 operands[2] = bfin_compare_op0;
2218 operands[3] = bfin_compare_op1;
2219 operands[1] = bfin_cc_rtx;
2222 (define_expand "sle"
2223 [(set (match_dup 1) (le:BI (match_dup 2) (match_dup 3)))
2224 (set (match_operand:SI 0 "register_operand" "")
2225 (ne:SI (match_dup 1) (const_int 0)))]
2228 operands[2] = bfin_compare_op0;
2229 operands[3] = bfin_compare_op1;
2230 operands[1] = bfin_cc_rtx;
2233 (define_expand "sltu"
2234 [(set (match_dup 1) (ltu:BI (match_dup 2) (match_dup 3)))
2235 (set (match_operand:SI 0 "register_operand" "")
2236 (ne:SI (match_dup 1) (const_int 0)))]
2239 operands[2] = bfin_compare_op0;
2240 operands[3] = bfin_compare_op1;
2241 operands[1] = bfin_cc_rtx;
2244 (define_expand "sleu"
2245 [(set (match_dup 1) (leu:BI (match_dup 2) (match_dup 3)))
2246 (set (match_operand:SI 0 "register_operand" "")
2247 (ne:SI (match_dup 1) (const_int 0)))]
2250 operands[2] = bfin_compare_op0;
2251 operands[3] = bfin_compare_op1;
2252 operands[1] = bfin_cc_rtx;
2260 ;;;;;;;;;;;;;;;;;;;; CC2dreg ;;;;;;;;;;;;;;;;;;;;;;;;;
2261 (define_insn "movsibi"
2262 [(set (match_operand:BI 0 "register_operand" "=C")
2263 (ne:BI (match_operand:SI 1 "register_operand" "d")
2267 [(set_attr "length" "2")])
2269 (define_insn "movbisi"
2270 [(set (match_operand:SI 0 "register_operand" "=d")
2271 (ne:SI (match_operand:BI 1 "register_operand" "C")
2275 [(set_attr "length" "2")])
2278 [(set (match_operand:BI 0 "register_operand" "=C")
2279 (eq:BI (match_operand:BI 1 "register_operand" " 0")
2282 "%0 = ! %0;" /* NOT CC;" */
2283 [(set_attr "type" "compare")])
2285 ;; Vector and DSP insns
2288 [(set (match_operand:SI 0 "register_operand" "=d")
2289 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2291 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2294 "%0 = ALIGN8(%1, %2);"
2295 [(set_attr "type" "dsp32")])
2298 [(set (match_operand:SI 0 "register_operand" "=d")
2299 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2301 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2304 "%0 = ALIGN16(%1, %2);"
2305 [(set_attr "type" "dsp32")])
2308 [(set (match_operand:SI 0 "register_operand" "=d")
2309 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2311 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2314 "%0 = ALIGN24(%1, %2);"
2315 [(set_attr "type" "dsp32")])
2317 ;; Prologue and epilogue.
2319 (define_expand "prologue"
2322 "bfin_expand_prologue (); DONE;")
2324 (define_expand "epilogue"
2327 "bfin_expand_epilogue (1, 0); DONE;")
2329 (define_expand "sibcall_epilogue"
2332 "bfin_expand_epilogue (0, 0); DONE;")
2334 (define_expand "eh_return"
2335 [(unspec_volatile [(match_operand:SI 0 "register_operand" "")]
2336 UNSPEC_VOLATILE_EH_RETURN)]
2339 emit_move_insn (EH_RETURN_HANDLER_RTX, operands[0]);
2340 emit_jump_insn (gen_eh_return_internal ());
2345 (define_insn_and_split "eh_return_internal"
2347 (unspec_volatile [(reg:SI REG_P2)] UNSPEC_VOLATILE_EH_RETURN))]
2352 "bfin_expand_epilogue (1, 1); DONE;")
2355 [(set (mem:SI (plus:SI (reg:SI REG_SP) (const_int -4))) (reg:SI REG_RETS))
2356 (set (mem:SI (plus:SI (reg:SI REG_SP) (const_int -8))) (reg:SI REG_FP))
2357 (set (reg:SI REG_FP)
2358 (plus:SI (reg:SI REG_SP) (const_int -8)))
2359 (set (reg:SI REG_SP)
2360 (plus:SI (reg:SI REG_SP) (match_operand:SI 0 "immediate_operand" "i")))]
2363 [(set_attr "length" "4")])
2365 (define_insn "unlink"
2366 [(set (reg:SI REG_FP) (mem:SI (reg:SI REG_FP)))
2367 (set (reg:SI REG_RETS) (mem:SI (plus:SI (reg:SI REG_FP) (const_int 4))))
2368 (set (reg:SI REG_SP) (plus:SI (reg:SI REG_FP) (const_int 8)))]
2371 [(set_attr "length" "4")])
2373 ;; This pattern is slightly clumsy. The stack adjust must be the final SET in
2374 ;; the pattern, otherwise dwarf2out becomes very confused about which reg goes
2375 ;; where on the stack, since it goes through all elements of the parallel in
2377 (define_insn "push_multiple"
2378 [(match_parallel 0 "push_multiple_operation"
2379 [(unspec [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_PUSH_MULTIPLE)])]
2382 output_push_multiple (insn, operands);
2386 (define_insn "pop_multiple"
2387 [(match_parallel 0 "pop_multiple_operation"
2388 [(set (reg:SI REG_SP)
2389 (plus:SI (reg:SI REG_SP) (match_operand:SI 1 "immediate_operand" "i")))])]
2392 output_pop_multiple (insn, operands);
2396 (define_insn "return_internal"
2398 (unspec [(match_operand 0 "immediate_operand" "i")] UNSPEC_RETURN)]
2401 switch (INTVAL (operands[0]))
2407 case INTERRUPT_HANDLER:
2415 (define_insn "csync"
2416 [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_CSYNC)]
2419 [(set_attr "type" "sync")])
2421 (define_insn "ssync"
2422 [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_SSYNC)]
2425 [(set_attr "type" "sync")])
2428 [(trap_if (const_int 1) (const_int 3))]
2431 [(set_attr "type" "misc")
2432 (set_attr "length" "2")])
2434 (define_insn "trapifcc"
2435 [(trap_if (reg:BI REG_CC) (const_int 3))]
2437 "if !cc jump 4 (bp); excpt 3;"
2438 [(set_attr "type" "misc")
2439 (set_attr "length" "4")
2440 (set_attr "seq_insns" "multi")])
2442 ;;; Vector instructions
2444 ;; First, all sorts of move variants
2446 (define_insn "movhi_low2high"
2447 [(set (match_operand:V2HI 0 "register_operand" "=d")
2449 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2450 (parallel [(const_int 0)]))
2451 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2452 (parallel [(const_int 0)]))))]
2455 [(set_attr "type" "dsp32")])
2457 (define_insn "movhi_high2high"
2458 [(set (match_operand:V2HI 0 "register_operand" "=d")
2460 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2461 (parallel [(const_int 0)]))
2462 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2463 (parallel [(const_int 1)]))))]
2466 [(set_attr "type" "dsp32")])
2468 (define_insn "movhi_low2low"
2469 [(set (match_operand:V2HI 0 "register_operand" "=d")
2471 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2472 (parallel [(const_int 0)]))
2473 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2474 (parallel [(const_int 1)]))))]
2477 [(set_attr "type" "dsp32")])
2479 (define_insn "movhi_high2low"
2480 [(set (match_operand:V2HI 0 "register_operand" "=d")
2482 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2483 (parallel [(const_int 1)]))
2484 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2485 (parallel [(const_int 1)]))))]
2488 [(set_attr "type" "dsp32")])
2490 (define_insn "movhiv2hi_low"
2491 [(set (match_operand:V2HI 0 "register_operand" "=d")
2493 (match_operand:HI 2 "register_operand" "d")
2494 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2495 (parallel [(const_int 1)]))))]
2498 [(set_attr "type" "dsp32")])
2500 (define_insn "movhiv2hi_high"
2501 [(set (match_operand:V2HI 0 "register_operand" "=d")
2503 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2504 (parallel [(const_int 0)]))
2505 (match_operand:HI 2 "register_operand" "d")))]
2508 [(set_attr "type" "dsp32")])
2510 ;; No earlyclobber on alternative two since our sequence ought to be safe.
2511 ;; The order of operands is intentional to match the VDSP builtin (high word
2512 ;; is passed first).
2513 (define_insn_and_split "composev2hi"
2514 [(set (match_operand:V2HI 0 "register_operand" "=d,d")
2515 (vec_concat:V2HI (match_operand:HI 2 "register_operand" "0,d")
2516 (match_operand:HI 1 "register_operand" "d,d")))]
2524 (vec_select:HI (match_dup 0) (parallel [(const_int 0)]))
2529 (vec_select:HI (match_dup 0) (parallel [(const_int 1)]))))]
2531 [(set_attr "type" "dsp32")])
2533 ; Like composev2hi, but operating on elements of V2HI vectors.
2534 ; Useful on its own, and as a combiner bridge for the multiply and
2536 (define_insn "packv2hi"
2537 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d,d")
2538 (vec_concat:V2HI (vec_select:HI
2539 (match_operand:V2HI 1 "register_operand" "d,d,d,d")
2540 (parallel [(match_operand 3 "const01_operand" "P0,P1,P0,P1")]))
2542 (match_operand:V2HI 2 "register_operand" "d,d,d,d")
2543 (parallel [(match_operand 4 "const01_operand" "P0,P0,P1,P1")]))))]
2546 %0 = PACK (%h2,%h1);
2547 %0 = PACK (%h2,%d1);
2548 %0 = PACK (%d2,%h1);
2549 %0 = PACK (%d2,%d1);"
2550 [(set_attr "type" "dsp32")])
2552 (define_insn "movv2hi_hi"
2553 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
2554 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0,d,d")
2555 (parallel [(match_operand 2 "const01_operand" "P0,P0,P1")])))]
2561 [(set_attr "type" "dsp32")])
2563 (define_expand "movv2hi_hi_low"
2564 [(set (match_operand:HI 0 "register_operand" "")
2565 (vec_select:HI (match_operand:V2HI 1 "register_operand" "")
2566 (parallel [(const_int 0)])))]
2570 (define_expand "movv2hi_hi_high"
2571 [(set (match_operand:HI 0 "register_operand" "")
2572 (vec_select:HI (match_operand:V2HI 1 "register_operand" "")
2573 (parallel [(const_int 1)])))]
2577 ;; Unusual arithmetic operations on 16 bit registers.
2579 (define_insn "ssaddhi3"
2580 [(set (match_operand:HI 0 "register_operand" "=d")
2581 (ss_plus:HI (match_operand:HI 1 "register_operand" "d")
2582 (match_operand:HI 2 "register_operand" "d")))]
2584 "%h0 = %h1 + %h2 (S);"
2585 [(set_attr "type" "dsp32")])
2587 (define_insn "sssubhi3"
2588 [(set (match_operand:HI 0 "register_operand" "=d")
2589 (ss_minus:HI (match_operand:HI 1 "register_operand" "d")
2590 (match_operand:HI 2 "register_operand" "d")))]
2592 "%h0 = %h1 - %h2 (S);"
2593 [(set_attr "type" "dsp32")])
2595 ;; V2HI vector insns
2597 (define_insn "addv2hi3"
2598 [(set (match_operand:V2HI 0 "register_operand" "=d")
2599 (plus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2600 (match_operand:V2HI 2 "register_operand" "d")))]
2603 [(set_attr "type" "dsp32")])
2605 (define_insn "ssaddv2hi3"
2606 [(set (match_operand:V2HI 0 "register_operand" "=d")
2607 (ss_plus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2608 (match_operand:V2HI 2 "register_operand" "d")))]
2610 "%0 = %1 +|+ %2 (S);"
2611 [(set_attr "type" "dsp32")])
2613 (define_insn "subv2hi3"
2614 [(set (match_operand:V2HI 0 "register_operand" "=d")
2615 (minus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2616 (match_operand:V2HI 2 "register_operand" "d")))]
2619 [(set_attr "type" "dsp32")])
2621 (define_insn "sssubv2hi3"
2622 [(set (match_operand:V2HI 0 "register_operand" "=d")
2623 (ss_minus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2624 (match_operand:V2HI 2 "register_operand" "d")))]
2626 "%0 = %1 -|- %2 (S);"
2627 [(set_attr "type" "dsp32")])
2629 (define_insn "addsubv2hi3"
2630 [(set (match_operand:V2HI 0 "register_operand" "=d")
2632 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2633 (parallel [(const_int 0)]))
2634 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2635 (parallel [(const_int 0)])))
2636 (minus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
2637 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
2640 [(set_attr "type" "dsp32")])
2642 (define_insn "subaddv2hi3"
2643 [(set (match_operand:V2HI 0 "register_operand" "=d")
2645 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2646 (parallel [(const_int 0)]))
2647 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2648 (parallel [(const_int 0)])))
2649 (plus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
2650 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
2653 [(set_attr "type" "dsp32")])
2655 (define_insn "ssaddsubv2hi3"
2656 [(set (match_operand:V2HI 0 "register_operand" "=d")
2658 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2659 (parallel [(const_int 0)]))
2660 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2661 (parallel [(const_int 0)])))
2662 (ss_minus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
2663 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
2665 "%0 = %1 +|- %2 (S);"
2666 [(set_attr "type" "dsp32")])
2668 (define_insn "sssubaddv2hi3"
2669 [(set (match_operand:V2HI 0 "register_operand" "=d")
2671 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2672 (parallel [(const_int 0)]))
2673 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2674 (parallel [(const_int 0)])))
2675 (ss_plus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
2676 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
2678 "%0 = %1 -|+ %2 (S);"
2679 [(set_attr "type" "dsp32")])
2681 (define_insn "sublohiv2hi3"
2682 [(set (match_operand:HI 0 "register_operand" "=d")
2683 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2684 (parallel [(const_int 1)]))
2685 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2686 (parallel [(const_int 0)]))))]
2689 [(set_attr "type" "dsp32")])
2691 (define_insn "subhilov2hi3"
2692 [(set (match_operand:HI 0 "register_operand" "=d")
2693 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2694 (parallel [(const_int 0)]))
2695 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2696 (parallel [(const_int 1)]))))]
2699 [(set_attr "type" "dsp32")])
2701 (define_insn "sssublohiv2hi3"
2702 [(set (match_operand:HI 0 "register_operand" "=d")
2703 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2704 (parallel [(const_int 1)]))
2705 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2706 (parallel [(const_int 0)]))))]
2708 "%h0 = %d1 - %h2 (S);"
2709 [(set_attr "type" "dsp32")])
2711 (define_insn "sssubhilov2hi3"
2712 [(set (match_operand:HI 0 "register_operand" "=d")
2713 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2714 (parallel [(const_int 0)]))
2715 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2716 (parallel [(const_int 1)]))))]
2718 "%h0 = %h1 - %d2 (S);"
2719 [(set_attr "type" "dsp32")])
2721 (define_insn "addlohiv2hi3"
2722 [(set (match_operand:HI 0 "register_operand" "=d")
2723 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2724 (parallel [(const_int 1)]))
2725 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2726 (parallel [(const_int 0)]))))]
2729 [(set_attr "type" "dsp32")])
2731 (define_insn "addhilov2hi3"
2732 [(set (match_operand:HI 0 "register_operand" "=d")
2733 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2734 (parallel [(const_int 0)]))
2735 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2736 (parallel [(const_int 1)]))))]
2739 [(set_attr "type" "dsp32")])
2741 (define_insn "ssaddlohiv2hi3"
2742 [(set (match_operand:HI 0 "register_operand" "=d")
2743 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2744 (parallel [(const_int 1)]))
2745 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2746 (parallel [(const_int 0)]))))]
2748 "%h0 = %d1 + %h2 (S);"
2749 [(set_attr "type" "dsp32")])
2751 (define_insn "ssaddhilov2hi3"
2752 [(set (match_operand:HI 0 "register_operand" "=d")
2753 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
2754 (parallel [(const_int 0)]))
2755 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2756 (parallel [(const_int 1)]))))]
2758 "%h0 = %h1 + %d2 (S);"
2759 [(set_attr "type" "dsp32")])
2761 (define_insn "sminv2hi3"
2762 [(set (match_operand:V2HI 0 "register_operand" "=d")
2763 (smin:V2HI (match_operand:V2HI 1 "register_operand" "d")
2764 (match_operand:V2HI 2 "register_operand" "d")))]
2766 "%0 = MIN (%1, %2) (V);"
2767 [(set_attr "type" "dsp32")])
2769 (define_insn "smaxv2hi3"
2770 [(set (match_operand:V2HI 0 "register_operand" "=d")
2771 (smax:V2HI (match_operand:V2HI 1 "register_operand" "d")
2772 (match_operand:V2HI 2 "register_operand" "d")))]
2774 "%0 = MAX (%1, %2) (V);"
2775 [(set_attr "type" "dsp32")])
2779 ;; The Blackfin allows a lot of different options, and we need many patterns to
2780 ;; cover most of the hardware's abilities.
2781 ;; There are a few simple patterns using MULT rtx codes, but most of them use
2782 ;; an unspec with a const_int operand that determines which flag to use in the
2784 ;; There are variants for single and parallel multiplications.
2785 ;; There are variants which just use 16 bit lowparts as inputs, and variants
2786 ;; which allow the user to choose just which halves to use as input values.
2787 ;; There are variants which set D registers, variants which set accumulators,
2788 ;; variants which set both, some of them optionally using the accumulators as
2789 ;; inputs for multiply-accumulate operations.
2791 (define_insn "flag_mulhi"
2792 [(set (match_operand:HI 0 "register_operand" "=d")
2793 (unspec:HI [(match_operand:HI 1 "register_operand" "d")
2794 (match_operand:HI 2 "register_operand" "d")
2795 (match_operand 3 "const_int_operand" "n")]
2796 UNSPEC_MUL_WITH_FLAG))]
2798 "%h0 = %h1 * %h2 %M3;"
2799 [(set_attr "type" "dsp32")])
2801 (define_insn "flag_mulhisi"
2802 [(set (match_operand:SI 0 "register_operand" "=d")
2803 (unspec:SI [(match_operand:HI 1 "register_operand" "d")
2804 (match_operand:HI 2 "register_operand" "d")
2805 (match_operand 3 "const_int_operand" "n")]
2806 UNSPEC_MUL_WITH_FLAG))]
2808 "%0 = %h1 * %h2 %M3;"
2809 [(set_attr "type" "dsp32")])
2811 (define_insn "flag_mulhisi_parts"
2812 [(set (match_operand:SI 0 "register_operand" "=d")
2813 (unspec:SI [(vec_select:HI
2814 (match_operand:V2HI 1 "register_operand" "d")
2815 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
2817 (match_operand:V2HI 2 "register_operand" "d")
2818 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
2819 (match_operand 5 "const_int_operand" "n")]
2820 UNSPEC_MUL_WITH_FLAG))]
2823 const char *templates[] = {
2824 "%0 = %h1 * %h2 %M5;",
2825 "%0 = %d1 * %h2 %M5;",
2826 "%0 = %h1 * %d2 %M5;",
2827 "%0 = %d1 * %d2 %M5;" };
2828 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
2829 return templates[alt];
2831 [(set_attr "type" "dsp32")])
2833 (define_insn "flag_machi"
2834 [(set (match_operand:HI 0 "register_operand" "=d")
2835 (unspec:HI [(match_operand:HI 1 "register_operand" "d")
2836 (match_operand:HI 2 "register_operand" "d")
2837 (match_operand 3 "register_operand" "A")
2838 (match_operand 4 "const01_operand" "P0P1")
2839 (match_operand 5 "const_int_operand" "n")]
2840 UNSPEC_MAC_WITH_FLAG))
2841 (set (match_operand:PDI 6 "register_operand" "=A")
2842 (unspec:PDI [(match_dup 1) (match_dup 2) (match_dup 3)
2843 (match_dup 4) (match_dup 5)]
2844 UNSPEC_MAC_WITH_FLAG))]
2846 "%h0 = (A0 %b4 %h1 * %h2) %M6;"
2847 [(set_attr "type" "dsp32")])
2849 (define_insn "flag_machi_acconly"
2850 [(set (match_operand:PDI 0 "register_operand" "=e")
2851 (unspec:PDI [(match_operand:HI 1 "register_operand" "d")
2852 (match_operand:HI 2 "register_operand" "d")
2853 (match_operand 3 "register_operand" "A")
2854 (match_operand 4 "const01_operand" "P0P1")
2855 (match_operand 5 "const_int_operand" "n")]
2856 UNSPEC_MAC_WITH_FLAG))]
2858 "%0 %b4 %h1 * %h2 %M6;"
2859 [(set_attr "type" "dsp32")])
2861 (define_insn "flag_macinithi"
2862 [(set (match_operand:HI 0 "register_operand" "=d")
2863 (unspec:HI [(match_operand:HI 1 "register_operand" "d")
2864 (match_operand:HI 2 "register_operand" "d")
2865 (match_operand 3 "const_int_operand" "n")]
2866 UNSPEC_MAC_WITH_FLAG))
2867 (set (match_operand:PDI 4 "register_operand" "=A")
2868 (unspec:PDI [(match_dup 1) (match_dup 2) (match_dup 3)]
2869 UNSPEC_MAC_WITH_FLAG))]
2871 "%h0 = (A0 = %h1 * %h2) %M3;"
2872 [(set_attr "type" "dsp32")])
2874 (define_insn "flag_macinit1hi"
2875 [(set (match_operand:PDI 0 "register_operand" "=e")
2876 (unspec:PDI [(match_operand:HI 1 "register_operand" "d")
2877 (match_operand:HI 2 "register_operand" "d")
2878 (match_operand 3 "const_int_operand" "n")]
2879 UNSPEC_MAC_WITH_FLAG))]
2881 "%0 = %h1 * %h2 %M3;"
2882 [(set_attr "type" "dsp32")])
2884 (define_insn "mulv2hi3"
2885 [(set (match_operand:V2HI 0 "register_operand" "=d")
2886 (mult:V2HI (match_operand:V2HI 1 "register_operand" "d")
2887 (match_operand:V2HI 2 "register_operand" "d")))]
2889 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 (IS);"
2890 [(set_attr "type" "dsp32")])
2892 (define_insn "flag_mulv2hi"
2893 [(set (match_operand:V2HI 0 "register_operand" "=d")
2894 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "d")
2895 (match_operand:V2HI 2 "register_operand" "d")
2896 (match_operand 3 "const_int_operand" "n")]
2897 UNSPEC_MUL_WITH_FLAG))]
2899 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 %M3;"
2900 [(set_attr "type" "dsp32")])
2902 (define_insn "flag_mulv2hi_parts"
2903 [(set (match_operand:V2HI 0 "register_operand" "=d")
2904 (unspec:V2HI [(vec_concat:V2HI
2906 (match_operand:V2HI 1 "register_operand" "d")
2907 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
2910 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
2912 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2913 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
2914 (vec_select:HI (match_dup 2)
2915 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
2916 (match_operand 7 "const_int_operand" "n")]
2917 UNSPEC_MUL_WITH_FLAG))]
2920 const char *templates[] = {
2921 "%h0 = %h1 * %h2, %d0 = %h1 * %h2 %M7;",
2922 "%h0 = %d1 * %h2, %d0 = %h1 * %h2 %M7;",
2923 "%h0 = %h1 * %h2, %d0 = %d1 * %h2 %M7;",
2924 "%h0 = %d1 * %h2, %d0 = %d1 * %h2 %M7;",
2925 "%h0 = %h1 * %d2, %d0 = %h1 * %h2 %M7;",
2926 "%h0 = %d1 * %d2, %d0 = %h1 * %h2 %M7;",
2927 "%h0 = %h1 * %d2, %d0 = %d1 * %h2 %M7;",
2928 "%h0 = %d1 * %d2, %d0 = %d1 * %h2 %M7;",
2929 "%h0 = %h1 * %h2, %d0 = %h1 * %d2 %M7;",
2930 "%h0 = %d1 * %h2, %d0 = %h1 * %d2 %M7;",
2931 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 %M7;",
2932 "%h0 = %d1 * %h2, %d0 = %d1 * %d2 %M7;",
2933 "%h0 = %h1 * %d2, %d0 = %h1 * %d2 %M7;",
2934 "%h0 = %d1 * %d2, %d0 = %h1 * %d2 %M7;",
2935 "%h0 = %h1 * %d2, %d0 = %d1 * %d2 %M7;",
2936 "%h0 = %d1 * %d2, %d0 = %d1 * %d2 %M7;" };
2937 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
2938 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
2939 return templates[alt];
2941 [(set_attr "type" "dsp32")])
2943 ;; A slightly complicated pattern.
2944 ;; Operand 0 is the halfword output; operand 11 is the accumulator output
2945 ;; Halfword inputs are operands 1 and 2; operands 3, 4, 5 and 6 specify which
2946 ;; parts of these 2x16 bit registers to use.
2947 ;; Operand 7 is the accumulator input.
2948 ;; Operands 8/9 specify whether low/high parts are mac (0) or msu (1)
2949 ;; Operand 10 is the macflag to be used.
2950 (define_insn "flag_macv2hi_parts"
2951 [(set (match_operand:V2HI 0 "register_operand" "=d")
2952 (unspec:V2HI [(vec_concat:V2HI
2954 (match_operand:V2HI 1 "register_operand" "d")
2955 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
2958 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
2960 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
2961 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
2962 (vec_select:HI (match_dup 2)
2963 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
2964 (match_operand:V2PDI 7 "register_operand" "e")
2965 (match_operand 8 "const01_operand" "P0P1")
2966 (match_operand 9 "const01_operand" "P0P1")
2967 (match_operand 10 "const_int_operand" "n")]
2968 UNSPEC_MAC_WITH_FLAG))
2969 (set (match_operand:V2PDI 11 "register_operand" "=e")
2970 (unspec:V2PDI [(vec_concat:V2HI
2971 (vec_select:HI (match_dup 1) (parallel [(match_dup 3)]))
2972 (vec_select:HI (match_dup 1) (parallel [(match_dup 4)])))
2974 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)]))
2975 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)])))
2976 (match_dup 7) (match_dup 8) (match_dup 9) (match_dup 10)]
2977 UNSPEC_MAC_WITH_FLAG))]
2980 const char *templates[] = {
2981 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %h1 * %h2) %M10;",
2982 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %h1 * %h2) %M10;",
2983 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %d1 * %h2) %M10;",
2984 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %d1 * %h2) %M10;",
2985 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %h1 * %h2) %M10;",
2986 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %h1 * %h2) %M10;",
2987 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %d1 * %h2) %M10;",
2988 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %d1 * %h2) %M10;",
2989 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %h1 * %d2) %M10;",
2990 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %h1 * %d2) %M10;",
2991 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %d1 * %d2) %M10;",
2992 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %d1 * %d2) %M10;",
2993 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %h1 * %d2) %M10;",
2994 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %h1 * %d2) %M10;",
2995 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %d1 * %d2) %M10;",
2996 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %d1 * %d2) %M10;" };
2997 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
2998 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
2999 return templates[alt];
3001 [(set_attr "type" "dsp32")])
3003 (define_insn "flag_macv2hi_parts_acconly"
3004 [(set (match_operand:V2PDI 0 "register_operand" "=e")
3005 (unspec:V2PDI [(vec_concat:V2HI
3007 (match_operand:V2HI 1 "register_operand" "d")
3008 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3011 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3013 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3014 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3015 (vec_select:HI (match_dup 2)
3016 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3017 (match_operand:V2PDI 7 "register_operand" "e")
3018 (match_operand 8 "const01_operand" "P0P1")
3019 (match_operand 9 "const01_operand" "P0P1")
3020 (match_operand 10 "const_int_operand" "n")]
3021 UNSPEC_MAC_WITH_FLAG))]
3024 const char *templates[] = {
3025 "A0 %b8 %h1 * %h2, A1 %b9 %h1 * %h2 %M10;",
3026 "A0 %b8 %d1 * %h2, A1 %b9 %h1 * %h2 %M10;",
3027 "A0 %b8 %h1 * %h2, A1 %b9 %d1 * %h2 %M10;",
3028 "A0 %b8 %d1 * %h2, A1 %b9 %d1 * %h2 %M10;",
3029 "A0 %b8 %h1 * %d2, A1 %b9 %h1 * %h2 %M10;",
3030 "A0 %b8 %d1 * %d2, A1 %b9 %h1 * %h2 %M10;",
3031 "A0 %b8 %h1 * %d2, A1 %b9 %d1 * %h2 %M10;",
3032 "A0 %b8 %d1 * %d2, A1 %b9 %d1 * %h2 %M10;",
3033 "A0 %b8 %h1 * %h2, A1 %b9 %h1 * %d2 %M10;",
3034 "A0 %b8 %d1 * %h2, A1 %b9 %h1 * %d2 %M10;",
3035 "A0 %b8 %h1 * %h2, A1 %b9 %d1 * %d2 %M10;",
3036 "A0 %b8 %d1 * %h2, A1 %b9 %d1 * %d2 %M10;",
3037 "A0 %b8 %h1 * %d2, A1 %b9 %h1 * %d2 %M10;",
3038 "A0 %b8 %d1 * %d2, A1 %b9 %h1 * %d2 %M10;",
3039 "A0 %b8 %h1 * %d2, A1 %b9 %d1 * %d2 %M10;",
3040 "A0 %b8 %d1 * %d2, A1 %b9 %d1 * %d2 %M10;" };
3041 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3042 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3043 return templates[alt];
3045 [(set_attr "type" "dsp32")])
3047 ;; Same as above, but initializing the accumulators and therefore a couple fewer
3048 ;; necessary operands.
3049 (define_insn "flag_macinitv2hi_parts"
3050 [(set (match_operand:V2HI 0 "register_operand" "=d")
3051 (unspec:V2HI [(vec_concat:V2HI
3053 (match_operand:V2HI 1 "register_operand" "d")
3054 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3057 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3059 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3060 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3061 (vec_select:HI (match_dup 2)
3062 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3063 (match_operand 7 "const_int_operand" "n")]
3064 UNSPEC_MAC_WITH_FLAG))
3065 (set (match_operand:V2PDI 8 "register_operand" "=e")
3066 (unspec:V2PDI [(vec_concat:V2HI
3067 (vec_select:HI (match_dup 1) (parallel [(match_dup 3)]))
3068 (vec_select:HI (match_dup 1) (parallel [(match_dup 4)])))
3070 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)]))
3071 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)])))
3073 UNSPEC_MAC_WITH_FLAG))]
3076 const char *templates[] = {
3077 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %h1 * %h2) %M7;",
3078 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %h1 * %h2) %M7;",
3079 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %d1 * %h2) %M7;",
3080 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %d1 * %h2) %M7;",
3081 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %h1 * %h2) %M7;",
3082 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %h1 * %h2) %M7;",
3083 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %d1 * %h2) %M7;",
3084 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %d1 * %h2) %M7;",
3085 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %h1 * %d2) %M7;",
3086 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %h1 * %d2) %M7;",
3087 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %d1 * %d2) %M7;",
3088 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %d1 * %d2) %M7;",
3089 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %h1 * %d2) %M7;",
3090 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %h1 * %d2) %M7;",
3091 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %d1 * %d2) %M7;",
3092 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %d1 * %d2) %M7;" };
3093 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3094 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3095 return templates[alt];
3097 [(set_attr "type" "dsp32")])
3099 (define_insn "flag_macinit1v2hi_parts"
3100 [(set (match_operand:V2PDI 0 "register_operand" "=e")
3101 (unspec:V2PDI [(vec_concat:V2HI
3103 (match_operand:V2HI 1 "register_operand" "d")
3104 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3107 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3109 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3110 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3111 (vec_select:HI (match_dup 2)
3112 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3113 (match_operand 7 "const_int_operand" "n")]
3114 UNSPEC_MAC_WITH_FLAG))]
3117 const char *templates[] = {
3118 "A0 = %h1 * %h2, A1 = %h1 * %h2 %M7;",
3119 "A0 = %d1 * %h2, A1 = %h1 * %h2 %M7;",
3120 "A0 = %h1 * %h2, A1 = %d1 * %h2 %M7;",
3121 "A0 = %d1 * %h2, A1 = %d1 * %h2 %M7;",
3122 "A0 = %h1 * %d2, A1 = %h1 * %h2 %M7;",
3123 "A0 = %d1 * %d2, A1 = %h1 * %h2 %M7;",
3124 "A0 = %h1 * %d2, A1 = %d1 * %h2 %M7;",
3125 "A0 = %d1 * %d2, A1 = %d1 * %h2 %M7;",
3126 "A0 = %h1 * %h2, A1 = %h1 * %d2 %M7;",
3127 "A0 = %d1 * %h2, A1 = %h1 * %d2 %M7;",
3128 "A0 = %h1 * %h2, A1 = %d1 * %d2 %M7;",
3129 "A0 = %d1 * %h2, A1 = %d1 * %d2 %M7;",
3130 "A0 = %h1 * %d2, A1 = %h1 * %d2 %M7;",
3131 "A0 = %d1 * %d2, A1 = %h1 * %d2 %M7;",
3132 "A0 = %h1 * %d2, A1 = %d1 * %d2 %M7;",
3133 "A0 = %d1 * %d2, A1 = %d1 * %d2 %M7;" };
3134 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3135 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3136 return templates[alt];
3138 [(set_attr "type" "dsp32")])
3140 (define_insn "mulhisi_ll"
3141 [(set (match_operand:SI 0 "register_operand" "=d")
3142 (mult:SI (sign_extend:SI
3143 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3144 (parallel [(const_int 0)])))
3146 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3147 (parallel [(const_int 0)])))))]
3149 "%0 = %h1 * %h2 (IS);"
3150 [(set_attr "type" "dsp32")])
3152 (define_insn "mulhisi_lh"
3153 [(set (match_operand:SI 0 "register_operand" "=d")
3154 (mult:SI (sign_extend:SI
3155 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3156 (parallel [(const_int 0)])))
3158 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3159 (parallel [(const_int 1)])))))]
3161 "%0 = %h1 * %d2 (IS);"
3162 [(set_attr "type" "dsp32")])
3164 (define_insn "mulhisi_hl"
3165 [(set (match_operand:SI 0 "register_operand" "=d")
3166 (mult:SI (sign_extend:SI
3167 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3168 (parallel [(const_int 1)])))
3170 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3171 (parallel [(const_int 0)])))))]
3173 "%0 = %d1 * %h2 (IS);"
3174 [(set_attr "type" "dsp32")])
3176 (define_insn "mulhisi_hh"
3177 [(set (match_operand:SI 0 "register_operand" "=d")
3178 (mult:SI (sign_extend:SI
3179 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3180 (parallel [(const_int 1)])))
3182 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3183 (parallel [(const_int 1)])))))]
3185 "%0 = %d1 * %d2 (IS);"
3186 [(set_attr "type" "dsp32")])
3188 (define_insn "ssnegv2hi2"
3189 [(set (match_operand:V2HI 0 "register_operand" "=d")
3190 (ss_neg:V2HI (match_operand:V2HI 1 "register_operand" "d")))]
3193 [(set_attr "type" "dsp32")])
3195 (define_insn "absv2hi2"
3196 [(set (match_operand:V2HI 0 "register_operand" "=d")
3197 (abs:V2HI (match_operand:V2HI 1 "register_operand" "d")))]
3200 [(set_attr "type" "dsp32")])
3204 (define_insn "ssashiftv2hi3"
3205 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d")
3207 (lt (match_operand:SI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
3208 (ashiftrt:V2HI (match_operand:V2HI 1 "register_operand" "d,d,d")
3210 (ss_ashift:V2HI (match_dup 1) (match_dup 2))))]
3213 %0 = ASHIFT %1 BY %2 (V, S);
3214 %0 = %1 >>> %2 (V,S);
3215 %0 = %1 << %2 (V,S);"
3216 [(set_attr "type" "dsp32")])
3218 (define_insn "ssashifthi3"
3219 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
3221 (lt (match_operand:SI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
3222 (ashiftrt:HI (match_operand:HI 1 "register_operand" "d,d,d")
3224 (ss_ashift:HI (match_dup 1) (match_dup 2))))]
3227 %0 = ASHIFT %1 BY %2 (V, S);
3228 %0 = %1 >>> %2 (V,S);
3229 %0 = %1 << %2 (V,S);"
3230 [(set_attr "type" "dsp32")])
3232 (define_insn "lshiftv2hi3"
3233 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d")
3235 (lt (match_operand:SI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
3236 (lshiftrt:V2HI (match_operand:V2HI 1 "register_operand" "d,d,d")
3238 (ashift:V2HI (match_dup 1) (match_dup 2))))]
3241 %0 = LSHIFT %1 BY %2 (V);
3244 [(set_attr "type" "dsp32")])
3246 (define_insn "lshifthi3"
3247 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
3249 (lt (match_operand:SI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
3250 (lshiftrt:HI (match_operand:HI 1 "register_operand" "d,d,d")
3252 (ashift:HI (match_dup 1) (match_dup 2))))]
3255 %0 = LSHIFT %1 BY %2 (V);
3258 [(set_attr "type" "dsp32")])