1 ;;- Machine description for Blackfin for GNU compiler
2 ;; Copyright 2005, 2006, 2007, 2008 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 3, 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 COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ; operand punctuation marks:
23 ; X -- integer value printed as log2
24 ; Y -- integer value printed as log2(~value) - for bitclear
25 ; h -- print half word register, low part
26 ; d -- print half word register, high part
27 ; D -- print operand as dregs pairs
28 ; w -- print operand as accumulator register word (a0w, a1w)
29 ; H -- high part of double mode operand
30 ; T -- byte register representation Oct. 02 2001
32 ; constant operand classes
34 ; J 2**N 5bit imm scaled
35 ; Ks7 -64 .. 63 signed 7bit imm
36 ; Ku5 0..31 unsigned 5bit imm
37 ; Ks4 -8 .. 7 signed 4bit imm
38 ; Ks3 -4 .. 3 signed 3bit imm
39 ; Ku3 0 .. 7 unsigned 3bit imm
40 ; Pn 0, 1, 2 constants 0, 1 or 2, corresponding to n
49 ; c (i0..i3,m0..m3) CIRCREGS
56 ;; Define constants for hard registers.
123 ;; Constants used in UNSPECs and UNSPEC_VOLATILEs.
126 [(UNSPEC_CBRANCH_TAKEN 0)
127 (UNSPEC_CBRANCH_NOPS 1)
130 (UNSPEC_LIBRARY_OFFSET 4)
131 (UNSPEC_PUSH_MULTIPLE 5)
132 ;; Multiply or MAC with extra CONST_INT operand specifying the macflag
133 (UNSPEC_MUL_WITH_FLAG 6)
134 (UNSPEC_MAC_WITH_FLAG 7)
135 (UNSPEC_MOVE_FDPIC 8)
136 (UNSPEC_FUNCDESC_GOT17M4 9)
137 (UNSPEC_LSETUP_END 10)
138 ;; Distinguish a 32-bit version of an insn from a 16-bit version.
145 [(UNSPEC_VOLATILE_CSYNC 1)
146 (UNSPEC_VOLATILE_SSYNC 2)
147 (UNSPEC_VOLATILE_LOAD_FUNCDESC 3)
148 (UNSPEC_VOLATILE_STORE_EH_HANDLER 4)
149 (UNSPEC_VOLATILE_DUMMY 5)
150 (UNSPEC_VOLATILE_STALL 6)])
167 "move,movcc,mvi,mcld,mcst,dsp32,dsp32shiftimm,mult,alu0,shft,brcc,br,call,misc,sync,compare,dummy,stall"
168 (const_string "misc"))
170 (define_attr "addrtype" "32bit,preg,spreg,ireg"
171 (cond [(and (eq_attr "type" "mcld")
172 (and (match_operand 0 "dp_register_operand" "")
173 (match_operand 1 "mem_p_address_operand" "")))
174 (const_string "preg")
175 (and (eq_attr "type" "mcld")
176 (and (match_operand 0 "dp_register_operand" "")
177 (match_operand 1 "mem_spfp_address_operand" "")))
178 (const_string "spreg")
179 (and (eq_attr "type" "mcld")
180 (and (match_operand 0 "dp_register_operand" "")
181 (match_operand 1 "mem_i_address_operand" "")))
182 (const_string "ireg")
183 (and (eq_attr "type" "mcst")
184 (and (match_operand 1 "dp_register_operand" "")
185 (match_operand 0 "mem_p_address_operand" "")))
186 (const_string "preg")
187 (and (eq_attr "type" "mcst")
188 (and (match_operand 1 "dp_register_operand" "")
189 (match_operand 0 "mem_spfp_address_operand" "")))
190 (const_string "spreg")
191 (and (eq_attr "type" "mcst")
192 (and (match_operand 1 "dp_register_operand" "")
193 (match_operand 0 "mem_i_address_operand" "")))
194 (const_string "ireg")]
195 (const_string "32bit")))
197 (define_attr "storereg" "preg,other"
198 (cond [(and (eq_attr "type" "mcst")
199 (match_operand 1 "p_register_operand" ""))
200 (const_string "preg")]
201 (const_string "other")))
203 ;; Scheduling definitions
205 (define_automaton "bfin")
207 (define_cpu_unit "slot0" "bfin")
208 (define_cpu_unit "slot1" "bfin")
209 (define_cpu_unit "slot2" "bfin")
211 ;; Three units used to enforce parallel issue restrictions:
212 ;; only one of the 16-bit slots can use a P register in an address,
213 ;; and only one them can be a store.
214 (define_cpu_unit "store" "bfin")
215 (define_cpu_unit "pregs" "bfin")
217 ;; A dummy unit used to delay scheduling of loads after a conditional
219 (define_cpu_unit "load" "bfin")
221 ;; A logical unit used to work around anomaly 05000074.
222 (define_cpu_unit "anomaly_05000074" "bfin")
224 (define_reservation "core" "slot0+slot1+slot2")
226 (define_insn_reservation "alu" 1
227 (eq_attr "type" "move,movcc,mvi,alu0,shft,brcc,br,call,misc,sync,compare")
230 (define_insn_reservation "imul" 3
231 (eq_attr "type" "mult")
234 (define_insn_reservation "dsp32" 1
235 (eq_attr "type" "dsp32")
238 (define_insn_reservation "dsp32shiftimm" 1
239 (and (eq_attr "type" "dsp32shiftimm")
240 (eq (symbol_ref "ENABLE_WA_05000074")
244 (define_insn_reservation "dsp32shiftimm_anomaly_05000074" 1
245 (and (eq_attr "type" "dsp32shiftimm")
246 (ne (symbol_ref "ENABLE_WA_05000074")
248 "slot0+anomaly_05000074")
250 (define_insn_reservation "load32" 1
251 (and (not (eq_attr "seq_insns" "multi"))
252 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "32bit")))
255 (define_insn_reservation "loadp" 1
256 (and (not (eq_attr "seq_insns" "multi"))
257 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "preg")))
260 (define_insn_reservation "loadsp" 1
261 (and (not (eq_attr "seq_insns" "multi"))
262 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "spreg")))
265 (define_insn_reservation "loadi" 1
266 (and (not (eq_attr "seq_insns" "multi"))
267 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "ireg")))
268 "(slot1|slot2)+load")
270 (define_insn_reservation "store32" 1
271 (and (not (eq_attr "seq_insns" "multi"))
272 (and (eq_attr "type" "mcst") (eq_attr "addrtype" "32bit")))
275 (define_insn_reservation "storep" 1
276 (and (and (not (eq_attr "seq_insns" "multi"))
277 (and (eq_attr "type" "mcst")
278 (ior (eq_attr "addrtype" "preg")
279 (eq_attr "addrtype" "spreg"))))
280 (ior (eq (symbol_ref "ENABLE_WA_05000074")
282 (eq_attr "storereg" "other")))
285 (define_insn_reservation "storep_anomaly_05000074" 1
286 (and (and (not (eq_attr "seq_insns" "multi"))
287 (and (eq_attr "type" "mcst")
288 (ior (eq_attr "addrtype" "preg")
289 (eq_attr "addrtype" "spreg"))))
290 (and (ne (symbol_ref "ENABLE_WA_05000074")
292 (eq_attr "storereg" "preg")))
293 "slot1+anomaly_05000074+pregs+store")
295 (define_insn_reservation "storei" 1
296 (and (and (not (eq_attr "seq_insns" "multi"))
297 (and (eq_attr "type" "mcst") (eq_attr "addrtype" "ireg")))
298 (ior (eq (symbol_ref "ENABLE_WA_05000074")
300 (eq_attr "storereg" "other")))
301 "(slot1|slot2)+store")
303 (define_insn_reservation "storei_anomaly_05000074" 1
304 (and (and (not (eq_attr "seq_insns" "multi"))
305 (and (eq_attr "type" "mcst") (eq_attr "addrtype" "ireg")))
306 (and (ne (symbol_ref "ENABLE_WA_05000074")
308 (eq_attr "storereg" "preg")))
309 "((slot1+anomaly_05000074)|slot2)+store")
311 (define_insn_reservation "multi" 2
312 (eq_attr "seq_insns" "multi")
315 (define_insn_reservation "load_stall1" 1
316 (and (eq_attr "type" "stall")
317 (match_operand 0 "const1_operand" ""))
320 (define_insn_reservation "load_stall3" 1
321 (and (eq_attr "type" "stall")
322 (match_operand 0 "const3_operand" ""))
325 (absence_set "slot0" "slot1,slot2")
326 (absence_set "slot1" "slot2")
328 ;; Make sure genautomata knows about the maximum latency that can be produced
329 ;; by the adjust_cost function.
330 (define_insn_reservation "dummy" 5
331 (eq_attr "type" "dummy")
334 ;; Operand and operator predicates
336 (include "predicates.md")
337 (include "constraints.md")
339 ;;; FRIO branches have been optimized for code density
340 ;;; this comes at a slight cost of complexity when
341 ;;; a compiler needs to generate branches in the general
342 ;;; case. In order to generate the correct branching
343 ;;; mechanisms the compiler needs keep track of instruction
344 ;;; lengths. The follow table describes how to count instructions
345 ;;; for the FRIO architecture.
347 ;;; unconditional br are 12-bit imm pcrelative branches *2
348 ;;; conditional br are 10-bit imm pcrelative branches *2
350 ;;; 1024 10-bit imm *2 is 2048 (-1024..1022)
352 ;;; 4096 12-bit imm *2 is 8192 (-4096..4094)
353 ;;; NOTE : For brcc we generate instructions such as
354 ;;; if cc jmp; jump.[sl] offset
355 ;;; offset of jump.[sl] is from the jump instruction but
356 ;;; gcc calculates length from the if cc jmp instruction
357 ;;; furthermore gcc takes the end address of the branch instruction
358 ;;; as (pc) for a forward branch
359 ;;; hence our range is (-4094, 4092) instead of (-4096, 4094) for a br
361 ;;; The way the (pc) rtx works in these calculations is somewhat odd;
362 ;;; for backward branches it's the address of the current instruction,
363 ;;; for forward branches it's the previously known address of the following
364 ;;; instruction - we have to take this into account by reducing the range
365 ;;; for a forward branch.
367 ;; Lengths for type "mvi" insns are always defined by the instructions
369 (define_attr "length" ""
370 (cond [(eq_attr "type" "mcld")
371 (if_then_else (match_operand 1 "effective_address_32bit_p" "")
372 (const_int 4) (const_int 2))
374 (eq_attr "type" "mcst")
375 (if_then_else (match_operand 0 "effective_address_32bit_p" "")
376 (const_int 4) (const_int 2))
378 (eq_attr "type" "move") (const_int 2)
380 (eq_attr "type" "dsp32") (const_int 4)
381 (eq_attr "type" "dsp32shiftimm") (const_int 4)
382 (eq_attr "type" "call") (const_int 4)
384 (eq_attr "type" "br")
386 (le (minus (match_dup 0) (pc)) (const_int 4092))
387 (ge (minus (match_dup 0) (pc)) (const_int -4096)))
391 (eq_attr "type" "brcc")
393 (le (minus (match_dup 3) (pc)) (const_int 1020))
394 (ge (minus (match_dup 3) (pc)) (const_int -1024)))
397 (le (minus (match_dup 3) (pc)) (const_int 4092))
398 (ge (minus (match_dup 3) (pc)) (const_int -4094)))
405 ;; Classify the insns into those that are one instruction and those that
406 ;; are more than one in sequence.
407 (define_attr "seq_insns" "single,multi"
408 (const_string "single"))
410 ;; Describe a user's asm statement.
411 (define_asm_attributes
412 [(set_attr "type" "misc")
413 (set_attr "seq_insns" "multi")
414 (set_attr "length" "4")])
418 (define_expand "movsicc"
419 [(set (match_operand:SI 0 "register_operand" "")
420 (if_then_else:SI (match_operand 1 "comparison_operator" "")
421 (match_operand:SI 2 "register_operand" "")
422 (match_operand:SI 3 "register_operand" "")))]
425 operands[1] = bfin_gen_compare (operands[1], SImode);
428 (define_insn "*movsicc_insn1"
429 [(set (match_operand:SI 0 "register_operand" "=da,da,da")
431 (eq:BI (match_operand:BI 3 "register_operand" "C,C,C")
433 (match_operand:SI 1 "register_operand" "da,0,da")
434 (match_operand:SI 2 "register_operand" "0,da,da")))]
437 if !cc %0 =%1; /* movsicc-1a */
438 if cc %0 =%2; /* movsicc-1b */
439 if !cc %0 =%1; if cc %0=%2; /* movsicc-1 */"
440 [(set_attr "length" "2,2,4")
441 (set_attr "type" "movcc")
442 (set_attr "seq_insns" "*,*,multi")])
444 (define_insn "*movsicc_insn2"
445 [(set (match_operand:SI 0 "register_operand" "=da,da,da")
447 (ne:BI (match_operand:BI 3 "register_operand" "C,C,C")
449 (match_operand:SI 1 "register_operand" "0,da,da")
450 (match_operand:SI 2 "register_operand" "da,0,da")))]
453 if !cc %0 =%2; /* movsicc-2b */
454 if cc %0 =%1; /* movsicc-2a */
455 if cc %0 =%1; if !cc %0=%2; /* movsicc-1 */"
456 [(set_attr "length" "2,2,4")
457 (set_attr "type" "movcc")
458 (set_attr "seq_insns" "*,*,multi")])
460 ;; Insns to load HIGH and LO_SUM
462 (define_insn "movsi_high"
463 [(set (match_operand:SI 0 "register_operand" "=x")
464 (high:SI (match_operand:SI 1 "immediate_operand" "i")))]
467 [(set_attr "type" "mvi")
468 (set_attr "length" "4")])
470 (define_insn "movstricthi_high"
471 [(set (match_operand:SI 0 "register_operand" "+x")
472 (ior:SI (and:SI (match_dup 0) (const_int 65535))
473 (match_operand:SI 1 "immediate_operand" "i")))]
476 [(set_attr "type" "mvi")
477 (set_attr "length" "4")])
479 (define_insn "movsi_low"
480 [(set (match_operand:SI 0 "register_operand" "=x")
481 (lo_sum:SI (match_operand:SI 1 "register_operand" "0")
482 (match_operand:SI 2 "immediate_operand" "i")))]
485 [(set_attr "type" "mvi")
486 (set_attr "length" "4")])
488 (define_insn "movsi_high_pic"
489 [(set (match_operand:SI 0 "register_operand" "=x")
490 (high:SI (unspec:SI [(match_operand:SI 1 "" "")]
494 [(set_attr "type" "mvi")
495 (set_attr "length" "4")])
497 (define_insn "movsi_low_pic"
498 [(set (match_operand:SI 0 "register_operand" "=x")
499 (lo_sum:SI (match_operand:SI 1 "register_operand" "0")
500 (unspec:SI [(match_operand:SI 2 "" "")]
503 "%h0 = %h2@GOT_HIGH;"
504 [(set_attr "type" "mvi")
505 (set_attr "length" "4")])
507 ;;; Move instructions
509 (define_insn_and_split "movdi_insn"
510 [(set (match_operand:DI 0 "nonimmediate_operand" "=x,mx,r")
511 (match_operand:DI 1 "general_operand" "iFx,r,mx"))]
512 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
515 [(set (match_dup 2) (match_dup 3))
516 (set (match_dup 4) (match_dup 5))]
518 rtx lo_half[2], hi_half[2];
519 split_di (operands, 2, lo_half, hi_half);
521 if (reg_overlap_mentioned_p (lo_half[0], hi_half[1]))
523 operands[2] = hi_half[0];
524 operands[3] = hi_half[1];
525 operands[4] = lo_half[0];
526 operands[5] = lo_half[1];
530 operands[2] = lo_half[0];
531 operands[3] = lo_half[1];
532 operands[4] = hi_half[0];
533 operands[5] = hi_half[1];
538 [(set (match_operand:BI 0 "nonimmediate_operand" "=x,x,d,md,C,d,C,P1")
539 (match_operand:BI 1 "general_operand" "x,xKs3,md,d,d,C,P0,P1"))]
551 [(set_attr "type" "move,mvi,mcld,mcst,compare,compare,compare,compare")
552 (set_attr "length" "2,2,*,*,2,2,2,2")
553 (set_attr "seq_insns" "*,*,*,*,*,*,*,*")])
555 (define_insn "movpdi"
556 [(set (match_operand:PDI 0 "nonimmediate_operand" "=e,<,e")
557 (match_operand:PDI 1 "general_operand" " e,e,>"))]
563 [(set_attr "type" "move,mcst,mcld")
564 (set_attr "seq_insns" "*,multi,multi")])
566 (define_insn "load_accumulator"
567 [(set (match_operand:PDI 0 "register_operand" "=e")
568 (sign_extend:PDI (match_operand:SI 1 "register_operand" "d")))]
571 [(set_attr "type" "move")])
573 (define_insn_and_split "load_accumulator_pair"
574 [(set (match_operand:V2PDI 0 "register_operand" "=e")
575 (sign_extend:V2PDI (vec_concat:V2SI
576 (match_operand:SI 1 "register_operand" "d")
577 (match_operand:SI 2 "register_operand" "d"))))]
581 [(set (match_dup 3) (sign_extend:PDI (match_dup 1)))
582 (set (match_dup 4) (sign_extend:PDI (match_dup 2)))]
584 operands[3] = gen_rtx_REG (PDImode, REGNO (operands[0]));
585 operands[4] = gen_rtx_REG (PDImode, REGNO (operands[0]) + 1);
588 (define_insn "*pushsi_insn"
589 [(set (mem:SI (pre_dec:SI (reg:SI REG_SP)))
590 (match_operand:SI 0 "register_operand" "xy"))]
593 [(set_attr "type" "mcst")
594 (set_attr "addrtype" "32bit")
595 (set_attr "length" "2")])
597 (define_insn "*popsi_insn"
598 [(set (match_operand:SI 0 "register_operand" "=d,xy")
599 (mem:SI (post_inc:SI (reg:SI REG_SP))))]
602 [(set_attr "type" "mcld")
603 (set_attr "addrtype" "preg,32bit")
604 (set_attr "length" "2")])
606 ;; The first alternative is used to make reload choose a limited register
607 ;; class when faced with a movsi_insn that had its input operand replaced
608 ;; with a PLUS. We generally require fewer secondary reloads this way.
610 (define_insn "*movsi_insn"
611 [(set (match_operand:SI 0 "nonimmediate_operand" "=da,x,da,y,da,x,x,x,da,mr")
612 (match_operand:SI 1 "general_operand" "da,x,y,da,xKs7,xKsh,xKuh,ix,mr,da"))]
613 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
625 [(set_attr "type" "move,move,move,move,mvi,mvi,mvi,*,mcld,mcst")
626 (set_attr "length" "2,2,2,2,2,4,4,*,*,*")])
628 (define_insn "*movsi_insn32"
629 [(set (match_operand:SI 0 "register_operand" "=d,d")
630 (unspec:SI [(match_operand:SI 1 "nonmemory_operand" "d,P0")] UNSPEC_32BIT))]
635 [(set_attr "type" "dsp32shiftimm,dsp32")])
638 [(set (match_operand:SI 0 "d_register_operand" "")
640 "splitting_for_sched && !optimize_size"
641 [(set (match_dup 0) (unspec:SI [(const_int 0)] UNSPEC_32BIT))])
644 [(set (match_operand:SI 0 "d_register_operand" "")
645 (match_operand:SI 1 "d_register_operand" ""))]
646 "splitting_for_sched && !optimize_size"
647 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_32BIT))])
649 (define_insn_and_split "*movv2hi_insn"
650 [(set (match_operand:V2HI 0 "nonimmediate_operand" "=da,da,d,dm")
651 (match_operand:V2HI 1 "general_operand" "i,di,md,d"))]
653 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
659 "reload_completed && GET_CODE (operands[1]) == CONST_VECTOR"
660 [(set (match_dup 0) (high:SI (match_dup 2)))
661 (set (match_dup 0) (lo_sum:SI (match_dup 0) (match_dup 3)))]
663 HOST_WIDE_INT intval = INTVAL (XVECEXP (operands[1], 0, 1)) << 16;
664 intval |= INTVAL (XVECEXP (operands[1], 0, 0)) & 0xFFFF;
666 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));
667 operands[2] = operands[3] = GEN_INT (trunc_int_for_mode (intval, SImode));
669 [(set_attr "type" "move,move,mcld,mcst")
670 (set_attr "length" "2,2,*,*")])
672 (define_insn "*movhi_insn"
673 [(set (match_operand:HI 0 "nonimmediate_operand" "=x,da,x,d,mr")
674 (match_operand:HI 1 "general_operand" "x,xKs7,xKsh,mr,d"))]
675 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
677 static const char *templates[] = {
686 int alt = which_alternative;
687 rtx mem = (MEM_P (operands[0]) ? operands[0]
688 : MEM_P (operands[1]) ? operands[1] : NULL_RTX);
689 if (mem && bfin_dsp_memref_p (mem))
691 return templates[alt];
693 [(set_attr "type" "move,mvi,mvi,mcld,mcst")
694 (set_attr "length" "2,2,4,*,*")])
696 (define_insn "*movqi_insn"
697 [(set (match_operand:QI 0 "nonimmediate_operand" "=x,da,x,d,mr")
698 (match_operand:QI 1 "general_operand" "x,xKs7,xKsh,mr,d"))]
699 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
706 [(set_attr "type" "move,mvi,mvi,mcld,mcst")
707 (set_attr "length" "2,2,4,*,*")])
709 (define_insn "*movsf_insn"
710 [(set (match_operand:SF 0 "nonimmediate_operand" "=x,x,da,mr")
711 (match_operand:SF 1 "general_operand" "x,Fx,mr,da"))]
712 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
718 [(set_attr "type" "move,*,mcld,mcst")])
720 (define_insn_and_split "movdf_insn"
721 [(set (match_operand:DF 0 "nonimmediate_operand" "=x,mx,r")
722 (match_operand:DF 1 "general_operand" "iFx,r,mx"))]
723 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
726 [(set (match_dup 2) (match_dup 3))
727 (set (match_dup 4) (match_dup 5))]
729 rtx lo_half[2], hi_half[2];
730 split_di (operands, 2, lo_half, hi_half);
732 if (reg_overlap_mentioned_p (lo_half[0], hi_half[1]))
734 operands[2] = hi_half[0];
735 operands[3] = hi_half[1];
736 operands[4] = lo_half[0];
737 operands[5] = lo_half[1];
741 operands[2] = lo_half[0];
742 operands[3] = lo_half[1];
743 operands[4] = hi_half[0];
744 operands[5] = hi_half[1];
748 ;; Storing halfwords.
749 (define_insn "*movsi_insv"
750 [(set (zero_extract:SI (match_operand 0 "register_operand" "+d,x")
753 (match_operand:SI 1 "nonmemory_operand" "d,n"))]
758 [(set_attr "type" "dsp32shiftimm,mvi")])
760 (define_expand "insv"
761 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
762 (match_operand:SI 1 "immediate_operand" "")
763 (match_operand:SI 2 "immediate_operand" ""))
764 (match_operand:SI 3 "nonmemory_operand" ""))]
767 if (INTVAL (operands[1]) != 16 || INTVAL (operands[2]) != 16)
770 /* From mips.md: insert_bit_field doesn't verify that our source
771 matches the predicate, so check it again here. */
772 if (! register_operand (operands[0], VOIDmode))
776 ;; This is the main "hook" for PIC code. When generating
777 ;; PIC, movsi is responsible for determining when the source address
778 ;; needs PIC relocation and appropriately calling legitimize_pic_address
779 ;; to perform the actual relocation.
781 (define_expand "movsi"
782 [(set (match_operand:SI 0 "nonimmediate_operand" "")
783 (match_operand:SI 1 "general_operand" ""))]
786 if (expand_move (operands, SImode))
790 (define_expand "movv2hi"
791 [(set (match_operand:V2HI 0 "nonimmediate_operand" "")
792 (match_operand:V2HI 1 "general_operand" ""))]
794 "expand_move (operands, V2HImode);")
796 (define_expand "movdi"
797 [(set (match_operand:DI 0 "nonimmediate_operand" "")
798 (match_operand:DI 1 "general_operand" ""))]
800 "expand_move (operands, DImode);")
802 (define_expand "movsf"
803 [(set (match_operand:SF 0 "nonimmediate_operand" "")
804 (match_operand:SF 1 "general_operand" ""))]
806 "expand_move (operands, SFmode);")
808 (define_expand "movdf"
809 [(set (match_operand:DF 0 "nonimmediate_operand" "")
810 (match_operand:DF 1 "general_operand" ""))]
812 "expand_move (operands, DFmode);")
814 (define_expand "movhi"
815 [(set (match_operand:HI 0 "nonimmediate_operand" "")
816 (match_operand:HI 1 "general_operand" ""))]
818 "expand_move (operands, HImode);")
820 (define_expand "movqi"
821 [(set (match_operand:QI 0 "nonimmediate_operand" "")
822 (match_operand:QI 1 "general_operand" ""))]
824 " expand_move (operands, QImode); ")
826 ;; Some define_splits to break up SI/SFmode loads of immediate constants.
829 [(set (match_operand:SI 0 "register_operand" "")
830 (match_operand:SI 1 "symbolic_or_const_operand" ""))]
832 /* Always split symbolic operands; split integer constants that are
833 too large for a single instruction. */
834 && (GET_CODE (operands[1]) != CONST_INT
835 || (INTVAL (operands[1]) < -32768
836 || INTVAL (operands[1]) >= 65536
837 || (INTVAL (operands[1]) >= 32768 && PREG_P (operands[0]))))"
838 [(set (match_dup 0) (high:SI (match_dup 1)))
839 (set (match_dup 0) (lo_sum:SI (match_dup 0) (match_dup 1)))]
841 if (GET_CODE (operands[1]) == CONST_INT
842 && split_load_immediate (operands))
844 /* ??? Do something about TARGET_LOW_64K. */
848 [(set (match_operand:SF 0 "register_operand" "")
849 (match_operand:SF 1 "immediate_operand" ""))]
851 [(set (match_dup 2) (high:SI (match_dup 3)))
852 (set (match_dup 2) (lo_sum:SI (match_dup 2) (match_dup 3)))]
855 REAL_VALUE_TYPE value;
857 gcc_assert (GET_CODE (operands[1]) == CONST_DOUBLE);
859 REAL_VALUE_FROM_CONST_DOUBLE (value, operands[1]);
860 REAL_VALUE_TO_TARGET_SINGLE (value, values);
862 operands[2] = gen_rtx_REG (SImode, true_regnum (operands[0]));
863 operands[3] = GEN_INT (trunc_int_for_mode (values, SImode));
864 if (values >= -32768 && values < 65536)
866 emit_move_insn (operands[2], operands[3]);
869 if (split_load_immediate (operands + 2))
873 ;; Sadly, this can't be a proper named movstrict pattern, since the compiler
874 ;; expects to be able to use registers for operand 1.
875 ;; Note that the asm instruction is defined by the manual to take an unsigned
876 ;; constant, but it doesn't matter to the assembler, and the compiler only
877 ;; deals with sign-extended constants. Hence "Ksh".
878 (define_insn "movstricthi_1"
879 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+x"))
880 (match_operand:HI 1 "immediate_operand" "Ksh"))]
883 [(set_attr "type" "mvi")
884 (set_attr "length" "4")])
886 ;; Sign and zero extensions
888 (define_insn_and_split "extendhisi2"
889 [(set (match_operand:SI 0 "register_operand" "=d, d")
890 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d, m")))]
895 "reload_completed && bfin_dsp_memref_p (operands[1])"
896 [(set (match_dup 2) (match_dup 1))
897 (set (match_dup 0) (sign_extend:SI (match_dup 2)))]
899 operands[2] = gen_lowpart (HImode, operands[0]);
901 [(set_attr "type" "alu0,mcld")])
903 (define_insn_and_split "zero_extendhisi2"
904 [(set (match_operand:SI 0 "register_operand" "=d, d")
905 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d, m")))]
910 "reload_completed && bfin_dsp_memref_p (operands[1])"
911 [(set (match_dup 2) (match_dup 1))
912 (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
914 operands[2] = gen_lowpart (HImode, operands[0]);
916 [(set_attr "type" "alu0,mcld")])
918 (define_insn "zero_extendbisi2"
919 [(set (match_operand:SI 0 "register_operand" "=d")
920 (zero_extend:SI (match_operand:BI 1 "nonimmediate_operand" "C")))]
923 [(set_attr "type" "compare")])
925 (define_insn "extendqihi2"
926 [(set (match_operand:HI 0 "register_operand" "=d, d")
927 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
932 [(set_attr "type" "mcld,alu0")])
934 (define_insn "extendqisi2"
935 [(set (match_operand:SI 0 "register_operand" "=d, d")
936 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
941 [(set_attr "type" "mcld,alu0")])
944 (define_insn "zero_extendqihi2"
945 [(set (match_operand:HI 0 "register_operand" "=d, d")
946 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
951 [(set_attr "type" "mcld,alu0")])
954 (define_insn "zero_extendqisi2"
955 [(set (match_operand:SI 0 "register_operand" "=d, d")
956 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
961 [(set_attr "type" "mcld,alu0")])
963 ;; DImode logical operations
965 (define_code_iterator any_logical [and ior xor])
966 (define_code_attr optab [(and "and")
969 (define_code_attr op [(and "&")
972 (define_code_attr high_result [(and "0")
976 ;; Keep this pattern around to avoid generating NO_CONFLICT blocks.
977 (define_expand "<optab>di3"
978 [(set (match_operand:DI 0 "register_operand" "=d")
979 (any_logical:DI (match_operand:DI 1 "register_operand" "0")
980 (match_operand:DI 2 "general_operand" "d")))]
983 rtx hi_half[3], lo_half[3];
984 enum insn_code icode = CODE_FOR_<optab>si3;
985 if (!reg_overlap_mentioned_p (operands[0], operands[1])
986 && !reg_overlap_mentioned_p (operands[0], operands[2]))
987 emit_clobber (operands[0]);
988 split_di (operands, 3, lo_half, hi_half);
989 if (!(*insn_data[icode].operand[2].predicate) (lo_half[2], SImode))
990 lo_half[2] = force_reg (SImode, lo_half[2]);
991 emit_insn (GEN_FCN (icode) (lo_half[0], lo_half[1], lo_half[2]));
992 if (!(*insn_data[icode].operand[2].predicate) (hi_half[2], SImode))
993 hi_half[2] = force_reg (SImode, hi_half[2]);
994 emit_insn (GEN_FCN (icode) (hi_half[0], hi_half[1], hi_half[2]));
998 (define_insn "zero_extendqidi2"
999 [(set (match_operand:DI 0 "register_operand" "=d")
1000 (zero_extend:DI (match_operand:QI 1 "register_operand" "d")))]
1002 "%0 = %T1 (Z);\\n\\t%H0 = 0;"
1003 [(set_attr "length" "4")
1004 (set_attr "seq_insns" "multi")])
1006 (define_insn "zero_extendhidi2"
1007 [(set (match_operand:DI 0 "register_operand" "=d")
1008 (zero_extend:DI (match_operand:HI 1 "register_operand" "d")))]
1010 "%0 = %h1 (Z);\\n\\t%H0 = 0;"
1011 [(set_attr "length" "4")
1012 (set_attr "seq_insns" "multi")])
1014 (define_insn_and_split "extendsidi2"
1015 [(set (match_operand:DI 0 "register_operand" "=d")
1016 (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))]
1020 [(set (match_dup 3) (match_dup 1))
1021 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
1023 split_di (operands, 1, operands + 2, operands + 3);
1024 if (REGNO (operands[0]) != REGNO (operands[1]))
1025 emit_move_insn (operands[2], operands[1]);
1028 (define_insn_and_split "extendqidi2"
1029 [(set (match_operand:DI 0 "register_operand" "=d")
1030 (sign_extend:DI (match_operand:QI 1 "register_operand" "d")))]
1034 [(set (match_dup 2) (sign_extend:SI (match_dup 1)))
1035 (set (match_dup 3) (sign_extend:SI (match_dup 1)))
1036 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
1038 split_di (operands, 1, operands + 2, operands + 3);
1041 (define_insn_and_split "extendhidi2"
1042 [(set (match_operand:DI 0 "register_operand" "=d")
1043 (sign_extend:DI (match_operand:HI 1 "register_operand" "d")))]
1047 [(set (match_dup 2) (sign_extend:SI (match_dup 1)))
1048 (set (match_dup 3) (sign_extend:SI (match_dup 1)))
1049 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
1051 split_di (operands, 1, operands + 2, operands + 3);
1054 ;; DImode arithmetic operations
1056 (define_insn "add_with_carry"
1057 [(set (match_operand:SI 0 "register_operand" "=d,d")
1058 (plus:SI (match_operand:SI 1 "register_operand" "%0,d")
1059 (match_operand:SI 2 "nonmemory_operand" "Ks7,d")))
1060 (set (match_operand:BI 3 "register_operand" "=C,C")
1061 (ltu:BI (not:SI (match_dup 1)) (match_dup 2)))]
1065 %0 = %1 + %2; cc = ac0;"
1066 [(set_attr "type" "alu0")
1067 (set_attr "length" "4")
1068 (set_attr "seq_insns" "multi")])
1070 (define_insn "sub_with_carry"
1071 [(set (match_operand:SI 0 "register_operand" "=d")
1072 (minus:SI (match_operand:SI 1 "register_operand" "%d")
1073 (match_operand:SI 2 "nonmemory_operand" "d")))
1074 (set (match_operand:BI 3 "register_operand" "=C")
1075 (leu:BI (match_dup 2) (match_dup 1)))]
1077 "%0 = %1 - %2; cc = ac0;"
1078 [(set_attr "type" "alu0")
1079 (set_attr "length" "4")
1080 (set_attr "seq_insns" "multi")])
1082 (define_expand "adddi3"
1083 [(set (match_operand:DI 0 "register_operand" "")
1084 (plus:DI (match_operand:DI 1 "register_operand" "")
1085 (match_operand:DI 2 "nonmemory_operand" "")))
1086 (clobber (match_scratch:SI 3 ""))
1087 (clobber (reg:CC 34))]
1091 xops[0] = gen_lowpart (SImode, operands[0]);
1092 xops[1] = simplify_gen_subreg (SImode, operands[0], DImode, 4);
1093 xops[2] = gen_lowpart (SImode, operands[1]);
1094 xops[3] = simplify_gen_subreg (SImode, operands[1], DImode, 4);
1095 xops[4] = gen_lowpart (SImode, operands[2]);
1096 xops[5] = simplify_gen_subreg (SImode, operands[2], DImode, 4);
1097 xops[6] = gen_reg_rtx (SImode);
1098 xops[7] = gen_rtx_REG (BImode, REG_CC);
1099 if (!register_operand (xops[4], SImode)
1100 && (GET_CODE (xops[4]) != CONST_INT
1101 || !satisfies_constraint_Ks7 (xops[4])))
1102 xops[4] = force_reg (SImode, xops[4]);
1103 if (!reg_overlap_mentioned_p (operands[0], operands[1])
1104 && !reg_overlap_mentioned_p (operands[0], operands[2]))
1105 emit_clobber (operands[0]);
1106 emit_insn (gen_add_with_carry (xops[0], xops[2], xops[4], xops[7]));
1107 emit_insn (gen_movbisi (xops[6], xops[7]));
1108 if (!register_operand (xops[5], SImode)
1109 && (GET_CODE (xops[5]) != CONST_INT
1110 || !satisfies_constraint_Ks7 (xops[5])))
1111 xops[5] = force_reg (SImode, xops[5]);
1112 if (xops[5] != const0_rtx)
1113 emit_insn (gen_addsi3 (xops[1], xops[3], xops[5]));
1115 emit_move_insn (xops[1], xops[3]);
1116 emit_insn (gen_addsi3 (xops[1], xops[1], xops[6]));
1120 (define_expand "subdi3"
1121 [(set (match_operand:DI 0 "register_operand" "")
1122 (minus:DI (match_operand:DI 1 "register_operand" "")
1123 (match_operand:DI 2 "register_operand" "")))
1124 (clobber (reg:CC 34))]
1128 xops[0] = gen_lowpart (SImode, operands[0]);
1129 xops[1] = simplify_gen_subreg (SImode, operands[0], DImode, 4);
1130 xops[2] = gen_lowpart (SImode, operands[1]);
1131 xops[3] = simplify_gen_subreg (SImode, operands[1], DImode, 4);
1132 xops[4] = gen_lowpart (SImode, operands[2]);
1133 xops[5] = simplify_gen_subreg (SImode, operands[2], DImode, 4);
1134 xops[6] = gen_reg_rtx (SImode);
1135 xops[7] = gen_rtx_REG (BImode, REG_CC);
1136 if (!reg_overlap_mentioned_p (operands[0], operands[1])
1137 && !reg_overlap_mentioned_p (operands[0], operands[2]))
1138 emit_clobber (operands[0]);
1139 emit_insn (gen_sub_with_carry (xops[0], xops[2], xops[4], xops[7]));
1140 emit_insn (gen_notbi (xops[7], xops[7]));
1141 emit_insn (gen_movbisi (xops[6], xops[7]));
1142 emit_insn (gen_subsi3 (xops[1], xops[3], xops[5]));
1143 emit_insn (gen_subsi3 (xops[1], xops[1], xops[6]));
1147 ;; Combined shift/add instructions
1150 [(set (match_operand:SI 0 "register_operand" "=a,d")
1151 (ashift:SI (plus:SI (match_operand:SI 1 "register_operand" "%0,0")
1152 (match_operand:SI 2 "register_operand" "a,d"))
1153 (match_operand:SI 3 "pos_scale_operand" "P1P2,P1P2")))]
1155 "%0 = (%0 + %2) << %3;" /* "shadd %0,%2,%3;" */
1156 [(set_attr "type" "alu0")])
1159 [(set (match_operand:SI 0 "register_operand" "=a")
1160 (plus:SI (match_operand:SI 1 "register_operand" "a")
1161 (mult:SI (match_operand:SI 2 "register_operand" "a")
1162 (match_operand:SI 3 "scale_by_operand" "i"))))]
1164 "%0 = %1 + (%2 << %X3);"
1165 [(set_attr "type" "alu0")])
1168 [(set (match_operand:SI 0 "register_operand" "=a")
1169 (plus:SI (match_operand:SI 1 "register_operand" "a")
1170 (ashift:SI (match_operand:SI 2 "register_operand" "a")
1171 (match_operand:SI 3 "pos_scale_operand" "i"))))]
1173 "%0 = %1 + (%2 << %3);"
1174 [(set_attr "type" "alu0")])
1177 [(set (match_operand:SI 0 "register_operand" "=a")
1178 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "a")
1179 (match_operand:SI 2 "scale_by_operand" "i"))
1180 (match_operand:SI 3 "register_operand" "a")))]
1182 "%0 = %3 + (%1 << %X2);"
1183 [(set_attr "type" "alu0")])
1186 [(set (match_operand:SI 0 "register_operand" "=a")
1187 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "a")
1188 (match_operand:SI 2 "pos_scale_operand" "i"))
1189 (match_operand:SI 3 "register_operand" "a")))]
1191 "%0 = %3 + (%1 << %2);"
1192 [(set_attr "type" "alu0")])
1194 (define_insn "mulhisi3"
1195 [(set (match_operand:SI 0 "register_operand" "=d")
1196 (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%d"))
1197 (sign_extend:SI (match_operand:HI 2 "register_operand" "d"))))]
1199 "%0 = %h1 * %h2 (IS)%!"
1200 [(set_attr "type" "dsp32")])
1202 (define_insn "umulhisi3"
1203 [(set (match_operand:SI 0 "register_operand" "=d")
1204 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%d"))
1205 (zero_extend:SI (match_operand:HI 2 "register_operand" "d"))))]
1207 "%0 = %h1 * %h2 (FU)%!"
1208 [(set_attr "type" "dsp32")])
1210 (define_insn "usmulhisi3"
1211 [(set (match_operand:SI 0 "register_operand" "=W")
1212 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "W"))
1213 (sign_extend:SI (match_operand:HI 2 "register_operand" "W"))))]
1215 "%0 = %h2 * %h1 (IS,M)%!"
1216 [(set_attr "type" "dsp32")])
1218 ;; The processor also supports ireg += mreg or ireg -= mreg, but these
1219 ;; are unusable if we don't ensure that the corresponding lreg is zero.
1220 ;; The same applies to the add/subtract constant versions involving
1223 (define_insn "addsi3"
1224 [(set (match_operand:SI 0 "register_operand" "=ad,a,d")
1225 (plus:SI (match_operand:SI 1 "register_operand" "%0, a,d")
1226 (match_operand:SI 2 "reg_or_7bit_operand" "Ks7, a,d")))]
1232 [(set_attr "type" "alu0")
1233 (set_attr "length" "2,2,2")])
1235 (define_insn "ssaddsi3"
1236 [(set (match_operand:SI 0 "register_operand" "=d")
1237 (ss_plus:SI (match_operand:SI 1 "register_operand" "d")
1238 (match_operand:SI 2 "register_operand" "d")))]
1240 "%0 = %1 + %2 (S)%!"
1241 [(set_attr "type" "dsp32")])
1243 (define_insn "subsi3"
1244 [(set (match_operand:SI 0 "register_operand" "=da,d,a")
1245 (minus:SI (match_operand:SI 1 "register_operand" "0,d,0")
1246 (match_operand:SI 2 "reg_or_neg7bit_operand" "KN7,d,a")))]
1249 static const char *const strings_subsi3[] = {
1255 if (CONSTANT_P (operands[2]) && INTVAL (operands[2]) < 0) {
1256 rtx tmp_op = operands[2];
1257 operands[2] = GEN_INT (-INTVAL (operands[2]));
1258 output_asm_insn ("%0 += %2;", operands);
1259 operands[2] = tmp_op;
1263 return strings_subsi3[which_alternative];
1265 [(set_attr "type" "alu0")])
1267 (define_insn "sssubsi3"
1268 [(set (match_operand:SI 0 "register_operand" "=d")
1269 (ss_minus:SI (match_operand:SI 1 "register_operand" "d")
1270 (match_operand:SI 2 "register_operand" "d")))]
1272 "%0 = %1 - %2 (S)%!"
1273 [(set_attr "type" "dsp32")])
1275 ;; Accumulator addition
1277 (define_insn "addpdi3"
1278 [(set (match_operand:PDI 0 "register_operand" "=A")
1279 (ss_plus:PDI (match_operand:PDI 1 "register_operand" "%0")
1280 (match_operand:PDI 2 "nonmemory_operand" "B")))]
1283 [(set_attr "type" "dsp32")])
1285 (define_insn "sum_of_accumulators"
1286 [(set (match_operand:SI 0 "register_operand" "=d")
1288 (ss_plus:PDI (match_operand:PDI 2 "register_operand" "1")
1289 (match_operand:PDI 3 "register_operand" "B"))))
1290 (set (match_operand:PDI 1 "register_operand" "=A")
1291 (ss_plus:PDI (match_dup 2) (match_dup 3)))]
1294 [(set_attr "type" "dsp32")])
1296 (define_insn "us_truncpdisi2"
1297 [(set (match_operand:SI 0 "register_operand" "=D,W")
1298 (us_truncate:SI (match_operand:PDI 1 "register_operand" "A,B")))]
1301 [(set_attr "type" "dsp32")])
1303 ;; Bit test instructions
1305 (define_insn "*not_bittst"
1306 [(set (match_operand:BI 0 "register_operand" "=C")
1307 (eq:BI (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1309 (match_operand:SI 2 "immediate_operand" "Ku5"))
1312 "cc = !BITTST (%1,%2);"
1313 [(set_attr "type" "alu0")])
1315 (define_insn "*bittst"
1316 [(set (match_operand:BI 0 "register_operand" "=C")
1317 (ne:BI (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1319 (match_operand:SI 2 "immediate_operand" "Ku5"))
1322 "cc = BITTST (%1,%2);"
1323 [(set_attr "type" "alu0")])
1325 (define_insn_and_split "*bit_extract"
1326 [(set (match_operand:SI 0 "register_operand" "=d")
1327 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1329 (match_operand:SI 2 "immediate_operand" "Ku5")))
1330 (clobber (reg:BI REG_CC))]
1334 [(set (reg:BI REG_CC)
1335 (ne:BI (zero_extract:SI (match_dup 1) (const_int 1) (match_dup 2))
1338 (ne:SI (reg:BI REG_CC) (const_int 0)))])
1340 (define_insn_and_split "*not_bit_extract"
1341 [(set (match_operand:SI 0 "register_operand" "=d")
1342 (zero_extract:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
1344 (match_operand:SI 2 "immediate_operand" "Ku5")))
1345 (clobber (reg:BI REG_CC))]
1349 [(set (reg:BI REG_CC)
1350 (eq:BI (zero_extract:SI (match_dup 1) (const_int 1) (match_dup 2))
1353 (ne:SI (reg:BI REG_CC) (const_int 0)))])
1355 (define_insn "*andsi_insn"
1356 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
1357 (and:SI (match_operand:SI 1 "register_operand" "%0,d,d,d")
1358 (match_operand:SI 2 "rhs_andsi3_operand" "L,M1,M2,d")))]
1365 [(set_attr "type" "alu0")])
1367 (define_expand "andsi3"
1368 [(set (match_operand:SI 0 "register_operand" "")
1369 (and:SI (match_operand:SI 1 "register_operand" "")
1370 (match_operand:SI 2 "general_operand" "")))]
1373 if (highbits_operand (operands[2], SImode))
1375 operands[2] = GEN_INT (exact_log2 (-INTVAL (operands[2])));
1376 emit_insn (gen_ashrsi3 (operands[0], operands[1], operands[2]));
1377 emit_insn (gen_ashlsi3 (operands[0], operands[0], operands[2]));
1380 if (! rhs_andsi3_operand (operands[2], SImode))
1381 operands[2] = force_reg (SImode, operands[2]);
1384 (define_insn "iorsi3"
1385 [(set (match_operand:SI 0 "register_operand" "=d,d")
1386 (ior:SI (match_operand:SI 1 "register_operand" "%0,d")
1387 (match_operand:SI 2 "regorlog2_operand" "J,d")))]
1392 [(set_attr "type" "alu0")])
1394 (define_insn "xorsi3"
1395 [(set (match_operand:SI 0 "register_operand" "=d,d")
1396 (xor:SI (match_operand:SI 1 "register_operand" "%0,d")
1397 (match_operand:SI 2 "regorlog2_operand" "J,d")))]
1402 [(set_attr "type" "alu0")])
1405 [(set (match_operand:HI 0 "register_operand" "=d")
1406 (unspec:HI [(match_operand:SI 1 "register_operand" "d")]
1410 [(set_attr "type" "alu0")])
1412 (define_insn "smaxsi3"
1413 [(set (match_operand:SI 0 "register_operand" "=d")
1414 (smax:SI (match_operand:SI 1 "register_operand" "d")
1415 (match_operand:SI 2 "register_operand" "d")))]
1418 [(set_attr "type" "dsp32")])
1420 (define_insn "sminsi3"
1421 [(set (match_operand:SI 0 "register_operand" "=d")
1422 (smin:SI (match_operand:SI 1 "register_operand" "d")
1423 (match_operand:SI 2 "register_operand" "d")))]
1426 [(set_attr "type" "dsp32")])
1428 (define_insn "abssi2"
1429 [(set (match_operand:SI 0 "register_operand" "=d")
1430 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
1433 [(set_attr "type" "dsp32")])
1435 (define_insn "ssabssi2"
1436 [(set (match_operand:SI 0 "register_operand" "=d")
1437 (ss_abs:SI (match_operand:SI 1 "register_operand" "d")))]
1440 [(set_attr "type" "dsp32")])
1442 (define_insn "negsi2"
1443 [(set (match_operand:SI 0 "register_operand" "=d")
1444 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1447 [(set_attr "type" "alu0")])
1449 (define_insn "ssnegsi2"
1450 [(set (match_operand:SI 0 "register_operand" "=d")
1451 (ss_neg:SI (match_operand:SI 1 "register_operand" "d")))]
1454 [(set_attr "type" "dsp32")])
1456 (define_insn "one_cmplsi2"
1457 [(set (match_operand:SI 0 "register_operand" "=d")
1458 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1461 [(set_attr "type" "alu0")])
1463 (define_insn "signbitssi2"
1464 [(set (match_operand:HI 0 "register_operand" "=d")
1466 (lt (match_operand:SI 1 "register_operand" "d") (const_int 0))
1467 (clz:HI (not:SI (match_dup 1)))
1468 (clz:HI (match_dup 1))))]
1470 "%h0 = signbits %1%!"
1471 [(set_attr "type" "dsp32")])
1473 (define_insn "ssroundsi2"
1474 [(set (match_operand:HI 0 "register_operand" "=d")
1476 (lshiftrt:SI (ss_plus:SI (match_operand:SI 1 "register_operand" "d")
1481 [(set_attr "type" "dsp32")])
1483 (define_insn "smaxhi3"
1484 [(set (match_operand:HI 0 "register_operand" "=d")
1485 (smax:HI (match_operand:HI 1 "register_operand" "d")
1486 (match_operand:HI 2 "register_operand" "d")))]
1488 "%0 = max(%1,%2) (V)%!"
1489 [(set_attr "type" "dsp32")])
1491 (define_insn "sminhi3"
1492 [(set (match_operand:HI 0 "register_operand" "=d")
1493 (smin:HI (match_operand:HI 1 "register_operand" "d")
1494 (match_operand:HI 2 "register_operand" "d")))]
1496 "%0 = min(%1,%2) (V)%!"
1497 [(set_attr "type" "dsp32")])
1499 (define_insn "abshi2"
1500 [(set (match_operand:HI 0 "register_operand" "=d")
1501 (abs:HI (match_operand:HI 1 "register_operand" "d")))]
1504 [(set_attr "type" "dsp32")])
1506 (define_insn "neghi2"
1507 [(set (match_operand:HI 0 "register_operand" "=d")
1508 (neg:HI (match_operand:HI 1 "register_operand" "d")))]
1511 [(set_attr "type" "alu0")])
1513 (define_insn "ssneghi2"
1514 [(set (match_operand:HI 0 "register_operand" "=d")
1515 (ss_neg:HI (match_operand:HI 1 "register_operand" "d")))]
1518 [(set_attr "type" "dsp32")])
1520 (define_insn "signbitshi2"
1521 [(set (match_operand:HI 0 "register_operand" "=d")
1523 (lt (match_operand:HI 1 "register_operand" "d") (const_int 0))
1524 (clz:HI (not:HI (match_dup 1)))
1525 (clz:HI (match_dup 1))))]
1527 "%h0 = signbits %h1%!"
1528 [(set_attr "type" "dsp32")])
1530 (define_insn "mulsi3"
1531 [(set (match_operand:SI 0 "register_operand" "=d")
1532 (mult:SI (match_operand:SI 1 "register_operand" "%0")
1533 (match_operand:SI 2 "register_operand" "d")))]
1536 [(set_attr "type" "mult")])
1538 (define_expand "umulsi3_highpart"
1540 [(set (match_operand:SI 0 "register_operand" "")
1543 (mult:DI (zero_extend:DI
1544 (match_operand:SI 1 "nonimmediate_operand" ""))
1546 (match_operand:SI 2 "register_operand" "")))
1548 (clobber (reg:PDI REG_A0))
1549 (clobber (reg:PDI REG_A1))])]
1554 rtx a1reg = gen_rtx_REG (PDImode, REG_A1);
1555 rtx a0reg = gen_rtx_REG (PDImode, REG_A0);
1556 emit_insn (gen_flag_macinit1hi (a1reg,
1557 gen_lowpart (HImode, operands[1]),
1558 gen_lowpart (HImode, operands[2]),
1559 GEN_INT (MACFLAG_FU)));
1560 emit_insn (gen_lshrpdi3 (a1reg, a1reg, GEN_INT (16)));
1561 emit_insn (gen_flag_mul_macv2hi_parts_acconly (a0reg, a1reg,
1562 gen_lowpart (V2HImode, operands[1]),
1563 gen_lowpart (V2HImode, operands[2]),
1564 const1_rtx, const1_rtx,
1565 const1_rtx, const0_rtx, a1reg,
1566 const0_rtx, GEN_INT (MACFLAG_FU),
1567 GEN_INT (MACFLAG_FU)));
1568 emit_insn (gen_flag_machi_parts_acconly (a1reg,
1569 gen_lowpart (V2HImode, operands[2]),
1570 gen_lowpart (V2HImode, operands[1]),
1571 const1_rtx, const0_rtx,
1572 a1reg, const0_rtx, GEN_INT (MACFLAG_FU)));
1573 emit_insn (gen_lshrpdi3 (a1reg, a1reg, GEN_INT (16)));
1574 emit_insn (gen_addpdi3 (a0reg, a0reg, a1reg));
1575 emit_insn (gen_us_truncpdisi2 (operands[0], a0reg));
1579 rtx umulsi3_highpart_libfunc
1580 = init_one_libfunc ("__umulsi3_highpart");
1582 emit_library_call_value (umulsi3_highpart_libfunc,
1583 operands[0], LCT_NORMAL, SImode,
1584 2, operands[1], SImode, operands[2], SImode);
1589 (define_expand "smulsi3_highpart"
1591 [(set (match_operand:SI 0 "register_operand" "")
1594 (mult:DI (sign_extend:DI
1595 (match_operand:SI 1 "nonimmediate_operand" ""))
1597 (match_operand:SI 2 "register_operand" "")))
1599 (clobber (reg:PDI REG_A0))
1600 (clobber (reg:PDI REG_A1))])]
1605 rtx a1reg = gen_rtx_REG (PDImode, REG_A1);
1606 rtx a0reg = gen_rtx_REG (PDImode, REG_A0);
1607 emit_insn (gen_flag_macinit1hi (a1reg,
1608 gen_lowpart (HImode, operands[1]),
1609 gen_lowpart (HImode, operands[2]),
1610 GEN_INT (MACFLAG_FU)));
1611 emit_insn (gen_lshrpdi3 (a1reg, a1reg, GEN_INT (16)));
1612 emit_insn (gen_flag_mul_macv2hi_parts_acconly (a0reg, a1reg,
1613 gen_lowpart (V2HImode, operands[1]),
1614 gen_lowpart (V2HImode, operands[2]),
1615 const1_rtx, const1_rtx,
1616 const1_rtx, const0_rtx, a1reg,
1617 const0_rtx, GEN_INT (MACFLAG_IS),
1618 GEN_INT (MACFLAG_IS_M)));
1619 emit_insn (gen_flag_machi_parts_acconly (a1reg,
1620 gen_lowpart (V2HImode, operands[2]),
1621 gen_lowpart (V2HImode, operands[1]),
1622 const1_rtx, const0_rtx,
1623 a1reg, const0_rtx, GEN_INT (MACFLAG_IS_M)));
1624 emit_insn (gen_ashrpdi3 (a1reg, a1reg, GEN_INT (16)));
1625 emit_insn (gen_sum_of_accumulators (operands[0], a0reg, a0reg, a1reg));
1629 rtx smulsi3_highpart_libfunc
1630 = init_one_libfunc ("__smulsi3_highpart");
1632 emit_library_call_value (smulsi3_highpart_libfunc,
1633 operands[0], LCT_NORMAL, SImode,
1634 2, operands[1], SImode, operands[2], SImode);
1639 (define_expand "ashlsi3"
1640 [(set (match_operand:SI 0 "register_operand" "")
1641 (ashift:SI (match_operand:SI 1 "register_operand" "")
1642 (match_operand:SI 2 "nonmemory_operand" "")))]
1645 if (GET_CODE (operands[2]) == CONST_INT
1646 && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
1648 emit_insn (gen_movsi (operands[0], const0_rtx));
1653 (define_insn_and_split "*ashlsi3_insn"
1654 [(set (match_operand:SI 0 "register_operand" "=d,d,a,a,a")
1655 (ashift:SI (match_operand:SI 1 "register_operand" "0,d,a,a,a")
1656 (match_operand:SI 2 "nonmemory_operand" "dKu5,Ku5,P1,P2,?P3P4")))]
1664 "PREG_P (operands[0]) && INTVAL (operands[2]) > 2"
1665 [(set (match_dup 0) (ashift:SI (match_dup 1) (const_int 2)))
1666 (set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 3)))]
1667 "operands[3] = GEN_INT (INTVAL (operands[2]) - 2);"
1668 [(set_attr "type" "shft,dsp32shiftimm,shft,shft,*")])
1670 (define_insn "ashrsi3"
1671 [(set (match_operand:SI 0 "register_operand" "=d,d")
1672 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,d")
1673 (match_operand:SI 2 "nonmemory_operand" "dKu5,Ku5")))]
1678 [(set_attr "type" "shft,dsp32shiftimm")])
1680 (define_insn "rotl16"
1681 [(set (match_operand:SI 0 "register_operand" "=d")
1682 (rotate:SI (match_operand:SI 1 "register_operand" "d")
1685 "%0 = PACK (%h1, %d1)%!"
1686 [(set_attr "type" "dsp32")])
1688 (define_expand "rotlsi3"
1689 [(set (match_operand:SI 0 "register_operand" "")
1690 (rotate:SI (match_operand:SI 1 "register_operand" "")
1691 (match_operand:SI 2 "immediate_operand" "")))]
1694 if (INTVAL (operands[2]) != 16)
1698 (define_expand "rotrsi3"
1699 [(set (match_operand:SI 0 "register_operand" "")
1700 (rotatert:SI (match_operand:SI 1 "register_operand" "")
1701 (match_operand:SI 2 "immediate_operand" "")))]
1704 if (INTVAL (operands[2]) != 16)
1706 emit_insn (gen_rotl16 (operands[0], operands[1]));
1711 (define_insn "ror_one"
1712 [(set (match_operand:SI 0 "register_operand" "=d")
1713 (ior:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
1714 (ashift:SI (zero_extend:SI (reg:BI REG_CC)) (const_int 31))))
1715 (set (reg:BI REG_CC)
1716 (zero_extract:BI (match_dup 1) (const_int 1) (const_int 0)))]
1718 "%0 = ROT %1 BY -1%!"
1719 [(set_attr "type" "dsp32shiftimm")])
1721 (define_insn "rol_one"
1722 [(set (match_operand:SI 0 "register_operand" "+d")
1723 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
1724 (zero_extend:SI (reg:BI REG_CC))))
1725 (set (reg:BI REG_CC)
1726 (zero_extract:BI (match_dup 1) (const_int 31) (const_int 0)))]
1728 "%0 = ROT %1 BY 1%!"
1729 [(set_attr "type" "dsp32shiftimm")])
1731 (define_expand "lshrdi3"
1732 [(set (match_operand:DI 0 "register_operand" "")
1733 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
1734 (match_operand:DI 2 "general_operand" "")))]
1737 rtx lo_half[2], hi_half[2];
1739 if (operands[2] != const1_rtx)
1741 if (! rtx_equal_p (operands[0], operands[1]))
1742 emit_move_insn (operands[0], operands[1]);
1744 split_di (operands, 2, lo_half, hi_half);
1746 emit_move_insn (bfin_cc_rtx, const0_rtx);
1747 emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
1748 emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
1752 (define_expand "ashrdi3"
1753 [(set (match_operand:DI 0 "register_operand" "")
1754 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
1755 (match_operand:DI 2 "general_operand" "")))]
1758 rtx lo_half[2], hi_half[2];
1760 if (operands[2] != const1_rtx)
1762 if (! rtx_equal_p (operands[0], operands[1]))
1763 emit_move_insn (operands[0], operands[1]);
1765 split_di (operands, 2, lo_half, hi_half);
1767 emit_insn (gen_compare_lt (gen_rtx_REG (BImode, REG_CC),
1768 hi_half[1], const0_rtx));
1769 emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
1770 emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
1774 (define_expand "ashldi3"
1775 [(set (match_operand:DI 0 "register_operand" "")
1776 (ashift:DI (match_operand:DI 1 "register_operand" "")
1777 (match_operand:DI 2 "general_operand" "")))]
1780 rtx lo_half[2], hi_half[2];
1782 if (operands[2] != const1_rtx)
1784 if (! rtx_equal_p (operands[0], operands[1]))
1785 emit_move_insn (operands[0], operands[1]);
1787 split_di (operands, 2, lo_half, hi_half);
1789 emit_move_insn (bfin_cc_rtx, const0_rtx);
1790 emit_insn (gen_rol_one (lo_half[0], lo_half[0]));
1791 emit_insn (gen_rol_one (hi_half[0], hi_half[0]));
1795 (define_insn "lshrsi3"
1796 [(set (match_operand:SI 0 "register_operand" "=d,d,a")
1797 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,d,a")
1798 (match_operand:SI 2 "nonmemory_operand" "dKu5,Ku5,P1P2")))]
1804 [(set_attr "type" "shft,dsp32shiftimm,shft")])
1806 (define_insn "lshrpdi3"
1807 [(set (match_operand:PDI 0 "register_operand" "=e")
1808 (lshiftrt:PDI (match_operand:PDI 1 "register_operand" "0")
1809 (match_operand:SI 2 "nonmemory_operand" "Ku5")))]
1812 [(set_attr "type" "dsp32shiftimm")])
1814 (define_insn "ashrpdi3"
1815 [(set (match_operand:PDI 0 "register_operand" "=e")
1816 (ashiftrt:PDI (match_operand:PDI 1 "register_operand" "0")
1817 (match_operand:SI 2 "nonmemory_operand" "Ku5")))]
1820 [(set_attr "type" "dsp32shiftimm")])
1822 ;; A pattern to reload the equivalent of
1823 ;; (set (Dreg) (plus (FP) (large_constant)))
1825 ;; (set (dagreg) (plus (FP) (arbitrary_constant)))
1826 ;; using a scratch register
1827 (define_expand "reload_insi"
1828 [(parallel [(set (match_operand:SI 0 "register_operand" "=w")
1829 (match_operand:SI 1 "fp_plus_const_operand" ""))
1830 (clobber (match_operand:SI 2 "register_operand" "=&a"))])]
1833 rtx fp_op = XEXP (operands[1], 0);
1834 rtx const_op = XEXP (operands[1], 1);
1835 rtx primary = operands[0];
1836 rtx scratch = operands[2];
1838 emit_move_insn (scratch, const_op);
1839 emit_insn (gen_addsi3 (scratch, scratch, fp_op));
1840 emit_move_insn (primary, scratch);
1844 (define_insn "reload_inpdi"
1845 [(set (match_operand:PDI 0 "register_operand" "=e")
1846 (match_operand:PDI 1 "memory_operand" "m"))
1847 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1851 xops[0] = operands[0];
1852 xops[1] = operands[2];
1853 split_di (operands + 1, 1, xops + 2, xops + 3);
1854 output_asm_insn ("%1 = %2;", xops);
1855 output_asm_insn ("%w0 = %1;", xops);
1856 output_asm_insn ("%1 = %3;", xops);
1857 output_asm_insn ("%x0 = %1;", xops);
1860 [(set_attr "seq_insns" "multi")
1861 (set_attr "type" "mcld")
1862 (set_attr "length" "12")])
1864 (define_insn "reload_outpdi"
1865 [(set (match_operand:PDI 0 "memory_operand" "=m")
1866 (match_operand:PDI 1 "register_operand" "e"))
1867 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1871 xops[0] = operands[1];
1872 xops[1] = operands[2];
1873 split_di (operands, 1, xops + 2, xops + 3);
1874 output_asm_insn ("%1 = %w0;", xops);
1875 output_asm_insn ("%2 = %1;", xops);
1876 output_asm_insn ("%1 = %x0;", xops);
1877 output_asm_insn ("%3 = %1;", xops);
1880 [(set_attr "seq_insns" "multi")
1881 (set_attr "type" "mcld")
1882 (set_attr "length" "12")])
1884 ;; Jump instructions
1888 (label_ref (match_operand 0 "" "")))]
1891 if (get_attr_length (insn) == 2)
1892 return "jump.s %0;";
1894 return "jump.l %0;";
1896 [(set_attr "type" "br")])
1898 (define_insn "indirect_jump"
1900 (match_operand:SI 0 "register_operand" "a"))]
1903 [(set_attr "type" "misc")])
1905 (define_expand "tablejump"
1906 [(parallel [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1907 (use (label_ref (match_operand 1 "" "")))])]
1910 /* In PIC mode, the table entries are stored PC relative.
1911 Convert the relative address to an absolute address. */
1914 rtx op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
1916 operands[0] = expand_simple_binop (Pmode, PLUS, operands[0],
1917 op1, NULL_RTX, 0, OPTAB_DIRECT);
1921 (define_insn "*tablejump_internal"
1922 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1923 (use (label_ref (match_operand 1 "" "")))]
1926 [(set_attr "type" "misc")])
1930 ; operand 0 is the loop count pseudo register
1931 ; operand 1 is the number of loop iterations or 0 if it is unknown
1932 ; operand 2 is the maximum number of loop iterations
1933 ; operand 3 is the number of levels of enclosed loops
1934 ; operand 4 is the label to jump to at the top of the loop
1935 (define_expand "doloop_end"
1936 [(parallel [(set (pc) (if_then_else
1937 (ne (match_operand:SI 0 "" "")
1939 (label_ref (match_operand 4 "" ""))
1942 (plus:SI (match_dup 0)
1944 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1945 (clobber (match_scratch:SI 5 ""))])]
1948 /* The loop optimizer doesn't check the predicates... */
1949 if (GET_MODE (operands[0]) != SImode)
1951 /* Due to limitations in the hardware (an initial loop count of 0
1952 does not loop 2^32 times) we must avoid to generate a hardware
1953 loops when we cannot rule out this case. */
1954 if (!flag_unsafe_loop_optimizations
1955 && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 0xFFFFFFFF)
1957 bfin_hardware_loop ();
1960 (define_insn "loop_end"
1962 (if_then_else (ne (match_operand:SI 0 "nonimmediate_operand" "+a*d,*b*v*f,m")
1964 (label_ref (match_operand 1 "" ""))
1969 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1970 (clobber (match_scratch:SI 2 "=X,&r,&r"))]
1973 /* loop end %0 %l1 */
1976 [(set_attr "length" "6,10,14")])
1980 (if_then_else (ne (match_operand:SI 0 "nondp_reg_or_memory_operand" "")
1982 (label_ref (match_operand 1 "" ""))
1987 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1988 (clobber (match_scratch:SI 2 "=&r"))]
1990 [(set (match_dup 2) (match_dup 0))
1991 (set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
1992 (set (match_dup 0) (match_dup 2))
1993 (set (reg:BI REG_CC) (eq:BI (match_dup 2) (const_int 0)))
1995 (if_then_else (eq (reg:BI REG_CC)
1997 (label_ref (match_dup 1))
2001 (define_insn "lsetup_with_autoinit"
2002 [(set (match_operand:SI 0 "lt_register_operand" "=t")
2003 (label_ref (match_operand 1 "" "")))
2004 (set (match_operand:SI 2 "lb_register_operand" "=u")
2005 (label_ref (match_operand 3 "" "")))
2006 (set (match_operand:SI 4 "lc_register_operand" "=k")
2007 (match_operand:SI 5 "register_operand" "a"))]
2009 "LSETUP (%1, %3) %4 = %5;"
2010 [(set_attr "length" "4")])
2012 (define_insn "lsetup_without_autoinit"
2013 [(set (match_operand:SI 0 "lt_register_operand" "=t")
2014 (label_ref (match_operand 1 "" "")))
2015 (set (match_operand:SI 2 "lb_register_operand" "=u")
2016 (label_ref (match_operand 3 "" "")))
2017 (use (match_operand:SI 4 "lc_register_operand" "k"))]
2019 "LSETUP (%1, %3) %4;"
2020 [(set_attr "length" "4")])
2022 ;; Call instructions..
2024 ;; The explicit MEM inside the UNSPEC prevents the compiler from moving
2025 ;; the load before a branch after a NULL test, or before a store that
2026 ;; initializes a function descriptor.
2028 (define_insn_and_split "load_funcdescsi"
2029 [(set (match_operand:SI 0 "register_operand" "=a")
2030 (unspec_volatile:SI [(mem:SI (match_operand:SI 1 "address_operand" "p"))]
2031 UNSPEC_VOLATILE_LOAD_FUNCDESC))]
2035 [(set (match_dup 0) (mem:SI (match_dup 1)))])
2037 (define_expand "call"
2038 [(parallel [(call (match_operand:SI 0 "" "")
2039 (match_operand 1 "" ""))
2040 (use (match_operand 2 "" ""))])]
2043 bfin_expand_call (NULL_RTX, operands[0], operands[1], operands[2], 0);
2047 (define_expand "sibcall"
2048 [(parallel [(call (match_operand:SI 0 "" "")
2049 (match_operand 1 "" ""))
2050 (use (match_operand 2 "" ""))
2054 bfin_expand_call (NULL_RTX, operands[0], operands[1], operands[2], 1);
2058 (define_expand "call_value"
2059 [(parallel [(set (match_operand 0 "register_operand" "")
2060 (call (match_operand:SI 1 "" "")
2061 (match_operand 2 "" "")))
2062 (use (match_operand 3 "" ""))])]
2065 bfin_expand_call (operands[0], operands[1], operands[2], operands[3], 0);
2069 (define_expand "sibcall_value"
2070 [(parallel [(set (match_operand 0 "register_operand" "")
2071 (call (match_operand:SI 1 "" "")
2072 (match_operand 2 "" "")))
2073 (use (match_operand 3 "" ""))
2077 bfin_expand_call (operands[0], operands[1], operands[2], operands[3], 1);
2081 (define_insn "*call_symbol_fdpic"
2082 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2083 (match_operand 1 "general_operand" "g"))
2084 (use (match_operand:SI 2 "register_operand" "Z"))
2085 (use (match_operand 3 "" ""))
2086 (clobber (reg:SI REG_RETS))]
2087 "! SIBLING_CALL_P (insn)
2088 && GET_CODE (operands[0]) == SYMBOL_REF
2089 && !bfin_longcall_p (operands[0], INTVAL (operands[3]))"
2091 [(set_attr "type" "call")
2092 (set_attr "length" "4")])
2094 (define_insn "*sibcall_symbol_fdpic"
2095 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2096 (match_operand 1 "general_operand" "g"))
2097 (use (match_operand:SI 2 "register_operand" "Z"))
2098 (use (match_operand 3 "" ""))
2100 "SIBLING_CALL_P (insn)
2101 && GET_CODE (operands[0]) == SYMBOL_REF
2102 && !bfin_longcall_p (operands[0], INTVAL (operands[3]))"
2104 [(set_attr "type" "br")
2105 (set_attr "length" "4")])
2107 (define_insn "*call_value_symbol_fdpic"
2108 [(set (match_operand 0 "register_operand" "=d")
2109 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2110 (match_operand 2 "general_operand" "g")))
2111 (use (match_operand:SI 3 "register_operand" "Z"))
2112 (use (match_operand 4 "" ""))
2113 (clobber (reg:SI REG_RETS))]
2114 "! SIBLING_CALL_P (insn)
2115 && GET_CODE (operands[1]) == SYMBOL_REF
2116 && !bfin_longcall_p (operands[1], INTVAL (operands[4]))"
2118 [(set_attr "type" "call")
2119 (set_attr "length" "4")])
2121 (define_insn "*sibcall_value_symbol_fdpic"
2122 [(set (match_operand 0 "register_operand" "=d")
2123 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2124 (match_operand 2 "general_operand" "g")))
2125 (use (match_operand:SI 3 "register_operand" "Z"))
2126 (use (match_operand 4 "" ""))
2128 "SIBLING_CALL_P (insn)
2129 && GET_CODE (operands[1]) == SYMBOL_REF
2130 && !bfin_longcall_p (operands[1], INTVAL (operands[4]))"
2132 [(set_attr "type" "br")
2133 (set_attr "length" "4")])
2135 (define_insn "*call_insn_fdpic"
2136 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "Y"))
2137 (match_operand 1 "general_operand" "g"))
2138 (use (match_operand:SI 2 "register_operand" "Z"))
2139 (use (match_operand 3 "" ""))
2140 (clobber (reg:SI REG_RETS))]
2141 "! SIBLING_CALL_P (insn)"
2143 [(set_attr "type" "call")
2144 (set_attr "length" "2")])
2146 (define_insn "*sibcall_insn_fdpic"
2147 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "Y"))
2148 (match_operand 1 "general_operand" "g"))
2149 (use (match_operand:SI 2 "register_operand" "Z"))
2150 (use (match_operand 3 "" ""))
2152 "SIBLING_CALL_P (insn)"
2154 [(set_attr "type" "br")
2155 (set_attr "length" "2")])
2157 (define_insn "*call_value_insn_fdpic"
2158 [(set (match_operand 0 "register_operand" "=d")
2159 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "Y"))
2160 (match_operand 2 "general_operand" "g")))
2161 (use (match_operand:SI 3 "register_operand" "Z"))
2162 (use (match_operand 4 "" ""))
2163 (clobber (reg:SI REG_RETS))]
2164 "! SIBLING_CALL_P (insn)"
2166 [(set_attr "type" "call")
2167 (set_attr "length" "2")])
2169 (define_insn "*sibcall_value_insn_fdpic"
2170 [(set (match_operand 0 "register_operand" "=d")
2171 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "Y"))
2172 (match_operand 2 "general_operand" "g")))
2173 (use (match_operand:SI 3 "register_operand" "Z"))
2174 (use (match_operand 4 "" ""))
2176 "SIBLING_CALL_P (insn)"
2178 [(set_attr "type" "br")
2179 (set_attr "length" "2")])
2181 (define_insn "*call_symbol"
2182 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2183 (match_operand 1 "general_operand" "g"))
2184 (use (match_operand 2 "" ""))
2185 (clobber (reg:SI REG_RETS))]
2186 "! SIBLING_CALL_P (insn)
2187 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2188 && GET_CODE (operands[0]) == SYMBOL_REF
2189 && !bfin_longcall_p (operands[0], INTVAL (operands[2]))"
2191 [(set_attr "type" "call")
2192 (set_attr "length" "4")])
2194 (define_insn "*sibcall_symbol"
2195 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2196 (match_operand 1 "general_operand" "g"))
2197 (use (match_operand 2 "" ""))
2199 "SIBLING_CALL_P (insn)
2200 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2201 && GET_CODE (operands[0]) == SYMBOL_REF
2202 && !bfin_longcall_p (operands[0], INTVAL (operands[2]))"
2204 [(set_attr "type" "br")
2205 (set_attr "length" "4")])
2207 (define_insn "*call_value_symbol"
2208 [(set (match_operand 0 "register_operand" "=d")
2209 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2210 (match_operand 2 "general_operand" "g")))
2211 (use (match_operand 3 "" ""))
2212 (clobber (reg:SI REG_RETS))]
2213 "! SIBLING_CALL_P (insn)
2214 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2215 && GET_CODE (operands[1]) == SYMBOL_REF
2216 && !bfin_longcall_p (operands[1], INTVAL (operands[3]))"
2218 [(set_attr "type" "call")
2219 (set_attr "length" "4")])
2221 (define_insn "*sibcall_value_symbol"
2222 [(set (match_operand 0 "register_operand" "=d")
2223 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2224 (match_operand 2 "general_operand" "g")))
2225 (use (match_operand 3 "" ""))
2227 "SIBLING_CALL_P (insn)
2228 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2229 && GET_CODE (operands[1]) == SYMBOL_REF
2230 && !bfin_longcall_p (operands[1], INTVAL (operands[3]))"
2232 [(set_attr "type" "br")
2233 (set_attr "length" "4")])
2235 (define_insn "*call_insn"
2236 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "a"))
2237 (match_operand 1 "general_operand" "g"))
2238 (use (match_operand 2 "" ""))
2239 (clobber (reg:SI REG_RETS))]
2240 "! SIBLING_CALL_P (insn)"
2242 [(set_attr "type" "call")
2243 (set_attr "length" "2")])
2245 (define_insn "*sibcall_insn"
2246 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "z"))
2247 (match_operand 1 "general_operand" "g"))
2248 (use (match_operand 2 "" ""))
2250 "SIBLING_CALL_P (insn)"
2252 [(set_attr "type" "br")
2253 (set_attr "length" "2")])
2255 (define_insn "*call_value_insn"
2256 [(set (match_operand 0 "register_operand" "=d")
2257 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "a"))
2258 (match_operand 2 "general_operand" "g")))
2259 (use (match_operand 3 "" ""))
2260 (clobber (reg:SI REG_RETS))]
2261 "! SIBLING_CALL_P (insn)"
2263 [(set_attr "type" "call")
2264 (set_attr "length" "2")])
2266 (define_insn "*sibcall_value_insn"
2267 [(set (match_operand 0 "register_operand" "=d")
2268 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "z"))
2269 (match_operand 2 "general_operand" "g")))
2270 (use (match_operand 3 "" ""))
2272 "SIBLING_CALL_P (insn)"
2274 [(set_attr "type" "br")
2275 (set_attr "length" "2")])
2277 ;; Block move patterns
2279 ;; We cheat. This copies one more word than operand 2 indicates.
2281 (define_insn "rep_movsi"
2282 [(set (match_operand:SI 0 "register_operand" "=&a")
2283 (plus:SI (plus:SI (match_operand:SI 3 "register_operand" "0")
2284 (ashift:SI (match_operand:SI 2 "register_operand" "a")
2287 (set (match_operand:SI 1 "register_operand" "=&b")
2288 (plus:SI (plus:SI (match_operand:SI 4 "register_operand" "1")
2289 (ashift:SI (match_dup 2) (const_int 2)))
2291 (set (mem:BLK (match_dup 3))
2292 (mem:BLK (match_dup 4)))
2294 (clobber (match_scratch:HI 5 "=&d"))
2295 (clobber (reg:SI REG_LT1))
2296 (clobber (reg:SI REG_LC1))
2297 (clobber (reg:SI REG_LB1))]
2299 "%5 = [%4++]; lsetup (1f, 1f) LC1 = %2; 1: MNOP || [%3++] = %5 || %5 = [%4++]; [%3++] = %5;"
2300 [(set_attr "type" "misc")
2301 (set_attr "length" "16")
2302 (set_attr "seq_insns" "multi")])
2304 (define_insn "rep_movhi"
2305 [(set (match_operand:SI 0 "register_operand" "=&a")
2306 (plus:SI (plus:SI (match_operand:SI 3 "register_operand" "0")
2307 (ashift:SI (match_operand:SI 2 "register_operand" "a")
2310 (set (match_operand:SI 1 "register_operand" "=&b")
2311 (plus:SI (plus:SI (match_operand:SI 4 "register_operand" "1")
2312 (ashift:SI (match_dup 2) (const_int 1)))
2314 (set (mem:BLK (match_dup 3))
2315 (mem:BLK (match_dup 4)))
2317 (clobber (match_scratch:HI 5 "=&d"))
2318 (clobber (reg:SI REG_LT1))
2319 (clobber (reg:SI REG_LC1))
2320 (clobber (reg:SI REG_LB1))]
2322 "%h5 = W[%4++]; lsetup (1f, 1f) LC1 = %2; 1: MNOP || W [%3++] = %5 || %h5 = W [%4++]; W [%3++] = %5;"
2323 [(set_attr "type" "misc")
2324 (set_attr "length" "16")
2325 (set_attr "seq_insns" "multi")])
2327 (define_expand "movmemsi"
2328 [(match_operand:BLK 0 "general_operand" "")
2329 (match_operand:BLK 1 "general_operand" "")
2330 (match_operand:SI 2 "const_int_operand" "")
2331 (match_operand:SI 3 "const_int_operand" "")]
2334 if (bfin_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
2339 ;; Conditional branch patterns
2340 ;; The Blackfin has only few condition codes: eq, lt, lte, ltu, leu
2342 (define_insn "compare_eq"
2343 [(set (match_operand:BI 0 "register_operand" "=C,C")
2344 (eq:BI (match_operand:SI 1 "register_operand" "d,a")
2345 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2348 [(set_attr "type" "compare")])
2350 (define_insn "compare_ne"
2351 [(set (match_operand:BI 0 "register_operand" "=C,C")
2352 (ne:BI (match_operand:SI 1 "register_operand" "d,a")
2353 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2356 [(set_attr "type" "compare")])
2358 (define_insn "compare_lt"
2359 [(set (match_operand:BI 0 "register_operand" "=C,C")
2360 (lt:BI (match_operand:SI 1 "register_operand" "d,a")
2361 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2364 [(set_attr "type" "compare")])
2366 (define_insn "compare_le"
2367 [(set (match_operand:BI 0 "register_operand" "=C,C")
2368 (le:BI (match_operand:SI 1 "register_operand" "d,a")
2369 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2372 [(set_attr "type" "compare")])
2374 (define_insn "compare_leu"
2375 [(set (match_operand:BI 0 "register_operand" "=C,C")
2376 (leu:BI (match_operand:SI 1 "register_operand" "d,a")
2377 (match_operand:SI 2 "reg_or_const_int_operand" "dKu3,aKu3")))]
2380 [(set_attr "type" "compare")])
2382 (define_insn "compare_ltu"
2383 [(set (match_operand:BI 0 "register_operand" "=C,C")
2384 (ltu:BI (match_operand:SI 1 "register_operand" "d,a")
2385 (match_operand:SI 2 "reg_or_const_int_operand" "dKu3,aKu3")))]
2388 [(set_attr "type" "compare")])
2390 ;; Same as above, but and CC with the overflow bit generated by the first
2392 (define_insn "flag_mul_macv2hi_parts_acconly_andcc0"
2393 [(set (match_operand:PDI 0 "register_operand" "=B,e,e")
2394 (unspec:PDI [(vec_select:HI
2395 (match_operand:V2HI 2 "register_operand" "d,d,d")
2396 (parallel [(match_operand 4 "const01_operand" "P0P1,P0P1,P0P1")]))
2398 (match_operand:V2HI 3 "register_operand" "d,d,d")
2399 (parallel [(match_operand 6 "const01_operand" "P0P1,P0P1,P0P1")]))
2400 (match_operand 10 "const_int_operand" "PB,PA,PA")]
2401 UNSPEC_MUL_WITH_FLAG))
2402 (set (match_operand:PDI 1 "register_operand" "=B,e,e")
2403 (unspec:PDI [(vec_select:HI
2405 (parallel [(match_operand 5 "const01_operand" "P0P1,P0P1,P0P1")]))
2408 (parallel [(match_operand 7 "const01_operand" "P0P1,P0P1,P0P1")]))
2409 (match_operand:PDI 8 "register_operand" "1,1,1")
2410 (match_operand 9 "const01_operand" "P0P1,P0P1,P0P1")
2411 (match_operand 11 "const_int_operand" "PA,PB,PA")]
2412 UNSPEC_MAC_WITH_FLAG))
2413 (set (reg:BI REG_CC)
2414 (and:BI (reg:BI REG_CC)
2415 (unspec:BI [(vec_select:HI (match_dup 2) (parallel [(match_dup 4)]))
2416 (vec_select:HI (match_dup 3) (parallel [(match_dup 6)]))
2418 UNSPEC_MUL_WITH_FLAG)))]
2419 "MACFLAGS_MATCH_P (INTVAL (operands[10]), INTVAL (operands[11]))"
2422 const char *templates[] = {
2423 "%0 = %h2 * %h3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2424 "%0 = %d2 * %h3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2425 "%0 = %h2 * %h3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2426 "%0 = %d2 * %h3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2427 "%0 = %h2 * %d3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2428 "%0 = %d2 * %d3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2429 "%0 = %h2 * %d3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2430 "%0 = %d2 * %d3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2431 "%0 = %h2 * %h3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2432 "%0 = %d2 * %h3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2433 "%0 = %h2 * %h3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;",
2434 "%0 = %d2 * %h3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;",
2435 "%0 = %h2 * %d3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2436 "%0 = %d2 * %d3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2437 "%0 = %h2 * %d3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;",
2438 "%0 = %d2 * %d3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;" };
2439 int alt = (INTVAL (operands[4]) + (INTVAL (operands[5]) << 1)
2440 + (INTVAL (operands[6]) << 2) + (INTVAL (operands[7]) << 3));
2441 xops[0] = operands[0];
2442 xops[1] = operands[1];
2443 xops[2] = operands[2];
2444 xops[3] = operands[3];
2445 xops[4] = operands[9];
2446 xops[5] = which_alternative == 0 ? operands[10] : operands[11];
2447 output_asm_insn (templates[alt], xops);
2450 [(set_attr "type" "misc")
2451 (set_attr "length" "6")
2452 (set_attr "seq_insns" "multi")])
2454 (define_expand "cbranchsi4"
2456 (if_then_else (match_operator 0 "ordered_comparison_operator"
2457 [(match_operand:SI 1 "register_operand" "")
2458 (match_operand:SI 2 "reg_or_const_int_operand" "")])
2459 (label_ref (match_operand 3 "" ""))
2463 rtx bi_compare = bfin_gen_compare (operands[0], SImode);
2464 emit_jump_insn (gen_cbranchbi4 (bi_compare, bfin_cc_rtx, CONST0_RTX (BImode),
2469 (define_insn "cbranchbi4"
2472 (match_operator 0 "bfin_bimode_comparison_operator"
2473 [(match_operand:BI 1 "register_operand" "C")
2474 (match_operand:BI 2 "immediate_operand" "P0")])
2475 (label_ref (match_operand 3 "" ""))
2479 asm_conditional_branch (insn, operands, 0, 0);
2482 [(set_attr "type" "brcc")])
2484 ;; Special cbranch patterns to deal with the speculative load problem - see
2485 ;; bfin_reorg for details.
2487 (define_insn "cbranch_predicted_taken"
2490 (match_operator 0 "bfin_bimode_comparison_operator"
2491 [(match_operand:BI 1 "register_operand" "C")
2492 (match_operand:BI 2 "immediate_operand" "P0")])
2493 (label_ref (match_operand 3 "" ""))
2495 (unspec [(const_int 0)] UNSPEC_CBRANCH_TAKEN)]
2498 asm_conditional_branch (insn, operands, 0, 1);
2501 [(set_attr "type" "brcc")])
2503 (define_insn "cbranch_with_nops"
2506 (match_operator 0 "bfin_bimode_comparison_operator"
2507 [(match_operand:BI 1 "register_operand" "C")
2508 (match_operand:BI 2 "immediate_operand" "P0")])
2509 (label_ref (match_operand 3 "" ""))
2511 (unspec [(match_operand 4 "immediate_operand" "")] UNSPEC_CBRANCH_NOPS)]
2514 asm_conditional_branch (insn, operands, INTVAL (operands[4]), 0);
2517 [(set_attr "type" "brcc")
2518 (set_attr "length" "8")])
2522 (define_expand "cstorebi4"
2524 (match_operator:BI 1 "bfin_bimode_comparison_operator"
2525 [(match_operand:BI 2 "register_operand" "")
2526 (match_operand:BI 3 "reg_or_const_int_operand" "")]))
2527 (set (match_operand:SI 0 "register_operand" "")
2528 (ne:SI (match_dup 4) (const_int 0)))]
2531 /* It could be expanded as a movbisi instruction, but the portable
2532 alternative produces better code. */
2533 if (GET_CODE (operands[1]) == NE)
2536 operands[4] = bfin_cc_rtx;
2539 (define_expand "cstoresi4"
2540 [(set (match_operand:SI 0 "register_operand")
2541 (match_operator:SI 1 "ordered_comparison_operator"
2542 [(match_operand:SI 2 "register_operand" "")
2543 (match_operand:SI 3 "reg_or_const_int_operand" "")]))]
2546 rtx bi_compare, test;
2548 if (!bfin_direct_comparison_operator (operands[1], SImode))
2550 if (!register_operand (operands[3], SImode)
2551 || GET_CODE (operands[1]) == NE)
2553 test = gen_rtx_fmt_ee (swap_condition (GET_CODE (operands[1])),
2554 SImode, operands[3], operands[2]);
2559 bi_compare = bfin_gen_compare (test, SImode);
2560 gcc_assert (GET_CODE (bi_compare) == NE);
2561 emit_insn (gen_movbisi (operands[0], bfin_cc_rtx));
2570 ;; A nop which stays there when emitted.
2571 (define_insn "forced_nop"
2572 [(unspec [(const_int 0)] UNSPEC_NOP)]
2577 [(unspec [(const_int 0)] UNSPEC_32BIT)]
2580 [(set_attr "type" "dsp32")])
2582 ;;;;;;;;;;;;;;;;;;;; CC2dreg ;;;;;;;;;;;;;;;;;;;;;;;;;
2583 (define_insn "movsibi"
2584 [(set (match_operand:BI 0 "register_operand" "=C")
2585 (ne:BI (match_operand:SI 1 "register_operand" "d")
2589 [(set_attr "length" "2")])
2591 (define_insn_and_split "movbisi"
2592 [(set (match_operand:SI 0 "register_operand" "=d")
2593 (ne:SI (match_operand:BI 1 "register_operand" "C")
2598 [(set (match_operand:SI 0 "register_operand" "")
2599 (zero_extend:SI (match_operand:BI 1 "register_operand" "")))]
2602 (define_insn "notbi"
2603 [(set (match_operand:BI 0 "register_operand" "=C")
2604 (eq:BI (match_operand:BI 1 "register_operand" " 0")
2607 "%0 = ! %0;" /* NOT CC;" */
2608 [(set_attr "type" "compare")])
2610 ;; Vector and DSP insns
2613 [(set (match_operand:SI 0 "register_operand" "=d")
2614 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2616 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2619 "%0 = ALIGN8(%1, %2)%!"
2620 [(set_attr "type" "dsp32")])
2623 [(set (match_operand:SI 0 "register_operand" "=d")
2624 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2626 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2629 "%0 = ALIGN16(%1, %2)%!"
2630 [(set_attr "type" "dsp32")])
2633 [(set (match_operand:SI 0 "register_operand" "=d")
2634 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2636 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2639 "%0 = ALIGN24(%1, %2)%!"
2640 [(set_attr "type" "dsp32")])
2642 ;; Prologue and epilogue.
2644 (define_expand "prologue"
2647 "bfin_expand_prologue (); DONE;")
2649 (define_expand "epilogue"
2652 "bfin_expand_epilogue (1, 0, 0); DONE;")
2654 (define_expand "sibcall_epilogue"
2657 "bfin_expand_epilogue (0, 0, 1); DONE;")
2659 (define_expand "eh_return"
2660 [(use (match_operand:SI 0 "register_operand" ""))]
2663 emit_insn (gen_eh_store_handler (EH_RETURN_HANDLER_RTX, operands[0]));
2664 emit_jump_insn (gen_eh_return_internal ());
2669 (define_insn "eh_store_handler"
2670 [(unspec_volatile [(match_operand:SI 1 "register_operand" "da")]
2671 UNSPEC_VOLATILE_STORE_EH_HANDLER)
2672 (clobber (match_operand:SI 0 "memory_operand" "=m"))]
2675 [(set_attr "type" "mcst")])
2677 (define_insn_and_split "eh_return_internal"
2681 "epilogue_completed"
2683 "bfin_expand_epilogue (1, 1, 0); DONE;")
2686 [(set (mem:SI (plus:SI (reg:SI REG_SP) (const_int -4))) (reg:SI REG_RETS))
2687 (set (mem:SI (plus:SI (reg:SI REG_SP) (const_int -8))) (reg:SI REG_FP))
2688 (set (reg:SI REG_FP)
2689 (plus:SI (reg:SI REG_SP) (const_int -8)))
2690 (set (reg:SI REG_SP)
2691 (plus:SI (reg:SI REG_SP) (match_operand:SI 0 "immediate_operand" "i")))]
2694 [(set_attr "length" "4")])
2696 (define_insn "unlink"
2697 [(set (reg:SI REG_FP) (mem:SI (reg:SI REG_FP)))
2698 (set (reg:SI REG_RETS) (mem:SI (plus:SI (reg:SI REG_FP) (const_int 4))))
2699 (set (reg:SI REG_SP) (plus:SI (reg:SI REG_FP) (const_int 8)))]
2702 [(set_attr "length" "4")])
2704 ;; This pattern is slightly clumsy. The stack adjust must be the final SET in
2705 ;; the pattern, otherwise dwarf2out becomes very confused about which reg goes
2706 ;; where on the stack, since it goes through all elements of the parallel in
2708 (define_insn "push_multiple"
2709 [(match_parallel 0 "push_multiple_operation"
2710 [(unspec [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_PUSH_MULTIPLE)])]
2713 output_push_multiple (insn, operands);
2717 (define_insn "pop_multiple"
2718 [(match_parallel 0 "pop_multiple_operation"
2719 [(set (reg:SI REG_SP)
2720 (plus:SI (reg:SI REG_SP) (match_operand:SI 1 "immediate_operand" "i")))])]
2723 output_pop_multiple (insn, operands);
2727 (define_insn "return_internal"
2729 (use (match_operand 0 "register_operand" ""))]
2732 switch (REGNO (operands[0]))
2746 ;; When used at a location where CC contains 1, causes a speculative load
2747 ;; that is later cancelled. This is used for certain workarounds in
2748 ;; interrupt handler prologues.
2749 (define_insn "dummy_load"
2750 [(unspec_volatile [(match_operand 0 "register_operand" "a")
2751 (match_operand 1 "register_operand" "C")]
2752 UNSPEC_VOLATILE_DUMMY)]
2754 "if cc jump 4;\n\tr7 = [%0];"
2755 [(set_attr "type" "misc")
2756 (set_attr "length" "4")
2757 (set_attr "seq_insns" "multi")])
2759 ;; A placeholder insn inserted before the final scheduling pass. It is used
2760 ;; to improve scheduling of loads when workarounds for speculative loads are
2761 ;; needed, by not placing them in the first few cycles after a conditional
2763 (define_insn "stall"
2764 [(unspec_volatile [(match_operand 0 "const_int_operand" "P1P3")]
2765 UNSPEC_VOLATILE_STALL)]
2768 [(set_attr "type" "stall")])
2770 (define_insn "csync"
2771 [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_CSYNC)]
2774 [(set_attr "type" "sync")])
2776 (define_insn "ssync"
2777 [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_SSYNC)]
2780 [(set_attr "type" "sync")])
2783 [(trap_if (const_int 1) (const_int 3))]
2786 [(set_attr "type" "misc")
2787 (set_attr "length" "2")])
2789 (define_insn "trapifcc"
2790 [(trap_if (reg:BI REG_CC) (const_int 3))]
2792 "if !cc jump 4 (bp); excpt 3;"
2793 [(set_attr "type" "misc")
2794 (set_attr "length" "4")
2795 (set_attr "seq_insns" "multi")])
2797 ;;; Vector instructions
2799 ;; First, all sorts of move variants
2801 (define_insn "movhiv2hi_low"
2802 [(set (match_operand:V2HI 0 "register_operand" "=d")
2804 (match_operand:HI 2 "register_operand" "d")
2805 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2806 (parallel [(const_int 1)]))))]
2809 [(set_attr "type" "dsp32shiftimm")])
2811 (define_insn "movhiv2hi_high"
2812 [(set (match_operand:V2HI 0 "register_operand" "=d")
2814 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2815 (parallel [(const_int 0)]))
2816 (match_operand:HI 2 "register_operand" "d")))]
2819 [(set_attr "type" "dsp32shiftimm")])
2821 ;; No earlyclobber on alternative two since our sequence ought to be safe.
2822 ;; The order of operands is intentional to match the VDSP builtin (high word
2823 ;; is passed first).
2824 (define_insn_and_split "composev2hi"
2825 [(set (match_operand:V2HI 0 "register_operand" "=d,d")
2826 (vec_concat:V2HI (match_operand:HI 2 "register_operand" "0,d")
2827 (match_operand:HI 1 "register_operand" "d,d")))]
2835 (vec_select:HI (match_dup 0) (parallel [(const_int 0)]))
2840 (vec_select:HI (match_dup 0) (parallel [(const_int 1)]))))]
2842 [(set_attr "type" "dsp32shiftimm")])
2844 ; Like composev2hi, but operating on elements of V2HI vectors.
2845 ; Useful on its own, and as a combiner bridge for the multiply and
2847 (define_insn "packv2hi"
2848 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d,d,d,d,d,d")
2849 (vec_concat:V2HI (vec_select:HI
2850 (match_operand:V2HI 1 "register_operand" "0,0,d,d,d,d,d,d")
2851 (parallel [(match_operand 3 "const01_operand" "P0,P0,P0,P1,P0,P1,P0,P1")]))
2853 (match_operand:V2HI 2 "register_operand" "d,d,0,0,d,d,d,d")
2854 (parallel [(match_operand 4 "const01_operand" "P0,P1,P1,P1,P0,P0,P1,P1")]))))]
2861 %0 = PACK (%h2,%h1)%!
2862 %0 = PACK (%h2,%d1)%!
2863 %0 = PACK (%d2,%h1)%!
2864 %0 = PACK (%d2,%d1)%!"
2865 [(set_attr "type" "dsp32shiftimm,dsp32shiftimm,dsp32shiftimm,dsp32shiftimm,dsp32,dsp32,dsp32,dsp32")])
2867 (define_insn "movv2hi_hi"
2868 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
2869 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0,d,d")
2870 (parallel [(match_operand 2 "const01_operand" "P0,P0,P1")])))]
2876 [(set_attr "type" "dsp32shiftimm")])
2878 (define_expand "movv2hi_hi_low"
2879 [(set (match_operand:HI 0 "register_operand" "")
2880 (vec_select:HI (match_operand:V2HI 1 "register_operand" "")
2881 (parallel [(const_int 0)])))]
2885 (define_expand "movv2hi_hi_high"
2886 [(set (match_operand:HI 0 "register_operand" "")
2887 (vec_select:HI (match_operand:V2HI 1 "register_operand" "")
2888 (parallel [(const_int 1)])))]
2892 ;; Unusual arithmetic operations on 16-bit registers.
2894 (define_code_iterator sp_or_sm [ss_plus ss_minus])
2895 (define_code_attr spm_string [(ss_plus "+") (ss_minus "-")])
2896 (define_code_attr spm_name [(ss_plus "add") (ss_minus "sub")])
2898 (define_insn "ss<spm_name>hi3"
2899 [(set (match_operand:HI 0 "register_operand" "=d")
2900 (sp_or_sm:HI (match_operand:HI 1 "register_operand" "d")
2901 (match_operand:HI 2 "register_operand" "d")))]
2903 "%h0 = %h1 <spm_string> %h2 (S)%!"
2904 [(set_attr "type" "dsp32")])
2906 (define_insn "ss<spm_name>hi3_parts"
2907 [(set (match_operand:HI 0 "register_operand" "=d")
2908 (sp_or_sm:HI (vec_select:HI
2909 (match_operand:V2HI 1 "register_operand" "d")
2910 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
2912 (match_operand:V2HI 2 "register_operand" "d")
2913 (parallel [(match_operand 4 "const01_operand" "P0P1")]))))]
2916 const char *templates[] = {
2917 "%h0 = %h1 <spm_string> %h2 (S)%!",
2918 "%h0 = %d1 <spm_string> %h2 (S)%!",
2919 "%h0 = %h1 <spm_string> %d2 (S)%!",
2920 "%h0 = %d1 <spm_string> %d2 (S)%!" };
2921 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
2922 return templates[alt];
2924 [(set_attr "type" "dsp32")])
2926 (define_insn "ss<spm_name>hi3_low_parts"
2927 [(set (match_operand:V2HI 0 "register_operand" "=d")
2929 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2930 (parallel [(const_int 0)]))
2931 (sp_or_sm:HI (vec_select:HI
2932 (match_operand:V2HI 2 "register_operand" "d")
2933 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
2935 (match_operand:V2HI 3 "register_operand" "d")
2936 (parallel [(match_operand 5 "const01_operand" "P0P1")])))))]
2939 const char *templates[] = {
2940 "%h0 = %h2 <spm_string> %h3 (S)%!",
2941 "%h0 = %d2 <spm_string> %h3 (S)%!",
2942 "%h0 = %h2 <spm_string> %d3 (S)%!",
2943 "%h0 = %d2 <spm_string> %d3 (S)%!" };
2944 int alt = INTVAL (operands[4]) + (INTVAL (operands[5]) << 1);
2945 return templates[alt];
2947 [(set_attr "type" "dsp32")])
2949 (define_insn "ss<spm_name>hi3_high_parts"
2950 [(set (match_operand:V2HI 0 "register_operand" "=d")
2952 (sp_or_sm:HI (vec_select:HI
2953 (match_operand:V2HI 2 "register_operand" "d")
2954 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
2956 (match_operand:V2HI 3 "register_operand" "d")
2957 (parallel [(match_operand 5 "const01_operand" "P0P1")])))
2958 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2959 (parallel [(const_int 1)]))))]
2962 const char *templates[] = {
2963 "%d0 = %h2 <spm_string> %h3 (S)%!",
2964 "%d0 = %d2 <spm_string> %h3 (S)%!",
2965 "%d0 = %h2 <spm_string> %d3 (S)%!",
2966 "%d0 = %d2 <spm_string> %d3 (S)%!" };
2967 int alt = INTVAL (operands[4]) + (INTVAL (operands[5]) << 1);
2968 return templates[alt];
2970 [(set_attr "type" "dsp32")])
2972 ;; V2HI vector insns
2974 (define_insn "addv2hi3"
2975 [(set (match_operand:V2HI 0 "register_operand" "=d")
2976 (plus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2977 (match_operand:V2HI 2 "register_operand" "d")))]
2980 [(set_attr "type" "dsp32")])
2982 (define_insn "ssaddv2hi3"
2983 [(set (match_operand:V2HI 0 "register_operand" "=d")
2984 (ss_plus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2985 (match_operand:V2HI 2 "register_operand" "d")))]
2987 "%0 = %1 +|+ %2 (S)%!"
2988 [(set_attr "type" "dsp32")])
2990 (define_insn "subv2hi3"
2991 [(set (match_operand:V2HI 0 "register_operand" "=d")
2992 (minus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2993 (match_operand:V2HI 2 "register_operand" "d")))]
2996 [(set_attr "type" "dsp32")])
2998 (define_insn "sssubv2hi3"
2999 [(set (match_operand:V2HI 0 "register_operand" "=d")
3000 (ss_minus:V2HI (match_operand:V2HI 1 "register_operand" "d")
3001 (match_operand:V2HI 2 "register_operand" "d")))]
3003 "%0 = %1 -|- %2 (S)%!"
3004 [(set_attr "type" "dsp32")])
3006 (define_insn "addsubv2hi3"
3007 [(set (match_operand:V2HI 0 "register_operand" "=d")
3009 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3010 (parallel [(const_int 0)]))
3011 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3012 (parallel [(const_int 0)])))
3013 (minus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3014 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3017 [(set_attr "type" "dsp32")])
3019 (define_insn "subaddv2hi3"
3020 [(set (match_operand:V2HI 0 "register_operand" "=d")
3022 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3023 (parallel [(const_int 0)]))
3024 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3025 (parallel [(const_int 0)])))
3026 (plus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3027 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3030 [(set_attr "type" "dsp32")])
3032 (define_insn "ssaddsubv2hi3"
3033 [(set (match_operand:V2HI 0 "register_operand" "=d")
3035 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3036 (parallel [(const_int 0)]))
3037 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3038 (parallel [(const_int 0)])))
3039 (ss_minus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3040 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3042 "%0 = %1 +|- %2 (S)%!"
3043 [(set_attr "type" "dsp32")])
3045 (define_insn "sssubaddv2hi3"
3046 [(set (match_operand:V2HI 0 "register_operand" "=d")
3048 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3049 (parallel [(const_int 0)]))
3050 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3051 (parallel [(const_int 0)])))
3052 (ss_plus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3053 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3055 "%0 = %1 -|+ %2 (S)%!"
3056 [(set_attr "type" "dsp32")])
3058 (define_insn "sublohiv2hi3"
3059 [(set (match_operand:HI 0 "register_operand" "=d")
3060 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3061 (parallel [(const_int 1)]))
3062 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3063 (parallel [(const_int 0)]))))]
3066 [(set_attr "type" "dsp32")])
3068 (define_insn "subhilov2hi3"
3069 [(set (match_operand:HI 0 "register_operand" "=d")
3070 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3071 (parallel [(const_int 0)]))
3072 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3073 (parallel [(const_int 1)]))))]
3076 [(set_attr "type" "dsp32")])
3078 (define_insn "sssublohiv2hi3"
3079 [(set (match_operand:HI 0 "register_operand" "=d")
3080 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3081 (parallel [(const_int 1)]))
3082 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3083 (parallel [(const_int 0)]))))]
3085 "%h0 = %d1 - %h2 (S)%!"
3086 [(set_attr "type" "dsp32")])
3088 (define_insn "sssubhilov2hi3"
3089 [(set (match_operand:HI 0 "register_operand" "=d")
3090 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3091 (parallel [(const_int 0)]))
3092 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3093 (parallel [(const_int 1)]))))]
3095 "%h0 = %h1 - %d2 (S)%!"
3096 [(set_attr "type" "dsp32")])
3098 (define_insn "addlohiv2hi3"
3099 [(set (match_operand:HI 0 "register_operand" "=d")
3100 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3101 (parallel [(const_int 1)]))
3102 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3103 (parallel [(const_int 0)]))))]
3106 [(set_attr "type" "dsp32")])
3108 (define_insn "addhilov2hi3"
3109 [(set (match_operand:HI 0 "register_operand" "=d")
3110 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3111 (parallel [(const_int 0)]))
3112 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3113 (parallel [(const_int 1)]))))]
3116 [(set_attr "type" "dsp32")])
3118 (define_insn "ssaddlohiv2hi3"
3119 [(set (match_operand:HI 0 "register_operand" "=d")
3120 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3121 (parallel [(const_int 1)]))
3122 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3123 (parallel [(const_int 0)]))))]
3125 "%h0 = %d1 + %h2 (S)%!"
3126 [(set_attr "type" "dsp32")])
3128 (define_insn "ssaddhilov2hi3"
3129 [(set (match_operand:HI 0 "register_operand" "=d")
3130 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3131 (parallel [(const_int 0)]))
3132 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3133 (parallel [(const_int 1)]))))]
3135 "%h0 = %h1 + %d2 (S)%!"
3136 [(set_attr "type" "dsp32")])
3138 (define_insn "sminv2hi3"
3139 [(set (match_operand:V2HI 0 "register_operand" "=d")
3140 (smin:V2HI (match_operand:V2HI 1 "register_operand" "d")
3141 (match_operand:V2HI 2 "register_operand" "d")))]
3143 "%0 = MIN (%1, %2) (V)%!"
3144 [(set_attr "type" "dsp32")])
3146 (define_insn "smaxv2hi3"
3147 [(set (match_operand:V2HI 0 "register_operand" "=d")
3148 (smax:V2HI (match_operand:V2HI 1 "register_operand" "d")
3149 (match_operand:V2HI 2 "register_operand" "d")))]
3151 "%0 = MAX (%1, %2) (V)%!"
3152 [(set_attr "type" "dsp32")])
3156 ;; The Blackfin allows a lot of different options, and we need many patterns to
3157 ;; cover most of the hardware's abilities.
3158 ;; There are a few simple patterns using MULT rtx codes, but most of them use
3159 ;; an unspec with a const_int operand that determines which flag to use in the
3161 ;; There are variants for single and parallel multiplications.
3162 ;; There are variants which just use 16-bit lowparts as inputs, and variants
3163 ;; which allow the user to choose just which halves to use as input values.
3164 ;; There are variants which set D registers, variants which set accumulators,
3165 ;; variants which set both, some of them optionally using the accumulators as
3166 ;; inputs for multiply-accumulate operations.
3168 (define_insn "flag_mulhi"
3169 [(set (match_operand:HI 0 "register_operand" "=d")
3170 (unspec:HI [(match_operand:HI 1 "register_operand" "d")
3171 (match_operand:HI 2 "register_operand" "d")
3172 (match_operand 3 "const_int_operand" "n")]
3173 UNSPEC_MUL_WITH_FLAG))]
3175 "%h0 = %h1 * %h2 %M3%!"
3176 [(set_attr "type" "dsp32")])
3178 (define_insn "flag_mulhi_parts"
3179 [(set (match_operand:HI 0 "register_operand" "=d")
3180 (unspec:HI [(vec_select:HI
3181 (match_operand:V2HI 1 "register_operand" "d")
3182 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3184 (match_operand:V2HI 2 "register_operand" "d")
3185 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
3186 (match_operand 5 "const_int_operand" "n")]
3187 UNSPEC_MUL_WITH_FLAG))]
3190 const char *templates[] = {
3191 "%h0 = %h1 * %h2 %M5%!",
3192 "%h0 = %d1 * %h2 %M5%!",
3193 "%h0 = %h1 * %d2 %M5%!",
3194 "%h0 = %d1 * %d2 %M5%!" };
3195 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
3196 return templates[alt];
3198 [(set_attr "type" "dsp32")])
3200 (define_insn "flag_mulhisi"
3201 [(set (match_operand:SI 0 "register_operand" "=d")
3202 (unspec:SI [(match_operand:HI 1 "register_operand" "d")
3203 (match_operand:HI 2 "register_operand" "d")
3204 (match_operand 3 "const_int_operand" "n")]
3205 UNSPEC_MUL_WITH_FLAG))]
3207 "%0 = %h1 * %h2 %M3%!"
3208 [(set_attr "type" "dsp32")])
3210 (define_insn "flag_mulhisi_parts"
3211 [(set (match_operand:SI 0 "register_operand" "=d")
3212 (unspec:SI [(vec_select:HI
3213 (match_operand:V2HI 1 "register_operand" "d")
3214 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3216 (match_operand:V2HI 2 "register_operand" "d")
3217 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
3218 (match_operand 5 "const_int_operand" "n")]
3219 UNSPEC_MUL_WITH_FLAG))]
3222 const char *templates[] = {
3223 "%0 = %h1 * %h2 %M5%!",
3224 "%0 = %d1 * %h2 %M5%!",
3225 "%0 = %h1 * %d2 %M5%!",
3226 "%0 = %d1 * %d2 %M5%!" };
3227 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
3228 return templates[alt];
3230 [(set_attr "type" "dsp32")])
3232 ;; Three alternatives here to cover all possible allocations:
3233 ;; 0. mac flag is usable only for accumulator 1 - use A1 and odd DREG
3234 ;; 1. mac flag is usable for accumulator 0 - use A0 and even DREG
3235 ;; 2. mac flag is usable in any accumulator - use A1 and odd DREG
3236 ;; Other patterns which don't have a DREG destination can collapse cases
3237 ;; 1 and 2 into one.
3238 (define_insn "flag_machi"
3239 [(set (match_operand:HI 0 "register_operand" "=W,D,W")
3240 (unspec:HI [(match_operand:HI 2 "register_operand" "d,d,d")
3241 (match_operand:HI 3 "register_operand" "d,d,d")
3242 (match_operand 4 "register_operand" "1,1,1")
3243 (match_operand 5 "const01_operand" "P0P1,P0P1,P0P1")
3244 (match_operand 6 "const_int_operand" "PB,PA,PA")]
3245 UNSPEC_MAC_WITH_FLAG))
3246 (set (match_operand:PDI 1 "register_operand" "=B,A,B")
3247 (unspec:PDI [(match_dup 1) (match_dup 2) (match_dup 3)
3248 (match_dup 4) (match_dup 5)]
3249 UNSPEC_MAC_WITH_FLAG))]
3251 "%h0 = (%1 %b5 %h2 * %h3) %M6%!"
3252 [(set_attr "type" "dsp32")])
3254 (define_insn "flag_machi_acconly"
3255 [(set (match_operand:PDI 0 "register_operand" "=B,e")
3256 (unspec:PDI [(match_operand:HI 1 "register_operand" "d,d")
3257 (match_operand:HI 2 "register_operand" "d,d")
3258 (match_operand 3 "register_operand" "0,0")
3259 (match_operand 4 "const01_operand" "P0P1,P0P1")
3260 (match_operand 5 "const_int_operand" "PB,PA")]
3261 UNSPEC_MAC_WITH_FLAG))]
3263 "%0 %b4 %h1 * %h2 %M5%!"
3264 [(set_attr "type" "dsp32")])
3266 (define_insn "flag_machi_parts_acconly"
3267 [(set (match_operand:PDI 0 "register_operand" "=B,e")
3268 (unspec:PDI [(vec_select:HI
3269 (match_operand:V2HI 1 "register_operand" "d,d")
3270 (parallel [(match_operand 3 "const01_operand" "P0P1,P0P1")]))
3272 (match_operand:V2HI 2 "register_operand" "d,d")
3273 (parallel [(match_operand 4 "const01_operand" "P0P1,P0P1")]))
3274 (match_operand:PDI 5 "register_operand" "0,0")
3275 (match_operand 6 "const01_operand" "P0P1,P0P1")
3276 (match_operand 7 "const_int_operand" "PB,PA")]
3277 UNSPEC_MAC_WITH_FLAG))]
3280 const char *templates[] = {
3281 "%0 %b6 %h1 * %h2 %M7%!",
3282 "%0 %b6 %d1 * %h2 %M7%!",
3283 "%0 %b6 %h1 * %d2 %M7%!",
3284 "%0 %b6 %d1 * %d2 %M7%!"
3286 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
3287 return templates[alt];
3289 [(set_attr "type" "dsp32")])
3291 (define_insn "flag_macinithi"
3292 [(set (match_operand:HI 0 "register_operand" "=W,D,W")
3293 (unspec:HI [(match_operand:HI 1 "register_operand" "d,d,d")
3294 (match_operand:HI 2 "register_operand" "d,d,d")
3295 (match_operand 3 "const_int_operand" "PB,PA,PA")]
3296 UNSPEC_MAC_WITH_FLAG))
3297 (set (match_operand:PDI 4 "register_operand" "=B,A,B")
3298 (unspec:PDI [(match_dup 1) (match_dup 2) (match_dup 3)]
3299 UNSPEC_MAC_WITH_FLAG))]
3301 "%h0 = (%4 = %h1 * %h2) %M3%!"
3302 [(set_attr "type" "dsp32")])
3304 (define_insn "flag_macinit1hi"
3305 [(set (match_operand:PDI 0 "register_operand" "=B,e")
3306 (unspec:PDI [(match_operand:HI 1 "register_operand" "d,d")
3307 (match_operand:HI 2 "register_operand" "d,d")
3308 (match_operand 3 "const_int_operand" "PB,PA")]
3309 UNSPEC_MAC_WITH_FLAG))]
3311 "%0 = %h1 * %h2 %M3%!"
3312 [(set_attr "type" "dsp32")])
3314 (define_insn "mulv2hi3"
3315 [(set (match_operand:V2HI 0 "register_operand" "=d")
3316 (mult:V2HI (match_operand:V2HI 1 "register_operand" "d")
3317 (match_operand:V2HI 2 "register_operand" "d")))]
3319 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 (IS)%!"
3320 [(set_attr "type" "dsp32")])
3322 (define_insn "flag_mulv2hi"
3323 [(set (match_operand:V2HI 0 "register_operand" "=d")
3324 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "d")
3325 (match_operand:V2HI 2 "register_operand" "d")
3326 (match_operand 3 "const_int_operand" "n")]
3327 UNSPEC_MUL_WITH_FLAG))]
3329 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 %M3%!"
3330 [(set_attr "type" "dsp32")])
3332 (define_insn "flag_mulv2hi_parts"
3333 [(set (match_operand:V2HI 0 "register_operand" "=d")
3334 (unspec:V2HI [(vec_concat:V2HI
3336 (match_operand:V2HI 1 "register_operand" "d")
3337 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3340 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3342 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3343 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3344 (vec_select:HI (match_dup 2)
3345 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3346 (match_operand 7 "const_int_operand" "n")]
3347 UNSPEC_MUL_WITH_FLAG))]
3350 const char *templates[] = {
3351 "%h0 = %h1 * %h2, %d0 = %h1 * %h2 %M7%!",
3352 "%h0 = %d1 * %h2, %d0 = %h1 * %h2 %M7%!",
3353 "%h0 = %h1 * %h2, %d0 = %d1 * %h2 %M7%!",
3354 "%h0 = %d1 * %h2, %d0 = %d1 * %h2 %M7%!",
3355 "%h0 = %h1 * %d2, %d0 = %h1 * %h2 %M7%!",
3356 "%h0 = %d1 * %d2, %d0 = %h1 * %h2 %M7%!",
3357 "%h0 = %h1 * %d2, %d0 = %d1 * %h2 %M7%!",
3358 "%h0 = %d1 * %d2, %d0 = %d1 * %h2 %M7%!",
3359 "%h0 = %h1 * %h2, %d0 = %h1 * %d2 %M7%!",
3360 "%h0 = %d1 * %h2, %d0 = %h1 * %d2 %M7%!",
3361 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 %M7%!",
3362 "%h0 = %d1 * %h2, %d0 = %d1 * %d2 %M7%!",
3363 "%h0 = %h1 * %d2, %d0 = %h1 * %d2 %M7%!",
3364 "%h0 = %d1 * %d2, %d0 = %h1 * %d2 %M7%!",
3365 "%h0 = %h1 * %d2, %d0 = %d1 * %d2 %M7%!",
3366 "%h0 = %d1 * %d2, %d0 = %d1 * %d2 %M7%!" };
3367 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3368 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3369 return templates[alt];
3371 [(set_attr "type" "dsp32")])
3373 ;; A slightly complicated pattern.
3374 ;; Operand 0 is the halfword output; operand 11 is the accumulator output
3375 ;; Halfword inputs are operands 1 and 2; operands 3, 4, 5 and 6 specify which
3376 ;; parts of these 2x16 bit registers to use.
3377 ;; Operand 7 is the accumulator input.
3378 ;; Operands 8/9 specify whether low/high parts are mac (0) or msu (1)
3379 ;; Operand 10 is the macflag to be used.
3380 (define_insn "flag_macv2hi_parts"
3381 [(set (match_operand:V2HI 0 "register_operand" "=d")
3382 (unspec:V2HI [(vec_concat:V2HI
3384 (match_operand:V2HI 1 "register_operand" "d")
3385 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3388 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3390 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3391 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3392 (vec_select:HI (match_dup 2)
3393 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3394 (match_operand:V2PDI 7 "register_operand" "e")
3395 (match_operand 8 "const01_operand" "P0P1")
3396 (match_operand 9 "const01_operand" "P0P1")
3397 (match_operand 10 "const_int_operand" "n")]
3398 UNSPEC_MAC_WITH_FLAG))
3399 (set (match_operand:V2PDI 11 "register_operand" "=e")
3400 (unspec:V2PDI [(vec_concat:V2HI
3401 (vec_select:HI (match_dup 1) (parallel [(match_dup 3)]))
3402 (vec_select:HI (match_dup 1) (parallel [(match_dup 4)])))
3404 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)]))
3405 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)])))
3406 (match_dup 7) (match_dup 8) (match_dup 9) (match_dup 10)]
3407 UNSPEC_MAC_WITH_FLAG))]
3410 const char *templates[] = {
3411 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3412 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3413 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3414 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3415 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3416 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3417 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3418 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3419 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3420 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3421 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %d1 * %d2) %M10%!",
3422 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %d1 * %d2) %M10%!",
3423 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3424 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3425 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %d1 * %d2) %M10%!",
3426 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %d1 * %d2) %M10%!" };
3427 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3428 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3429 return templates[alt];
3431 [(set_attr "type" "dsp32")])
3433 (define_insn "flag_macv2hi_parts_acconly"
3434 [(set (match_operand:V2PDI 0 "register_operand" "=e")
3435 (unspec:V2PDI [(vec_concat:V2HI
3437 (match_operand:V2HI 1 "register_operand" "d")
3438 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3441 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3443 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3444 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3445 (vec_select:HI (match_dup 2)
3446 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3447 (match_operand:V2PDI 7 "register_operand" "e")
3448 (match_operand 8 "const01_operand" "P0P1")
3449 (match_operand 9 "const01_operand" "P0P1")
3450 (match_operand 10 "const_int_operand" "n")]
3451 UNSPEC_MAC_WITH_FLAG))]
3454 const char *templates[] = {
3455 "A0 %b8 %h1 * %h2, A1 %b9 %h1 * %h2 %M10%!",
3456 "A0 %b8 %d1 * %h2, A1 %b9 %h1 * %h2 %M10%!",
3457 "A0 %b8 %h1 * %h2, A1 %b9 %d1 * %h2 %M10%!",
3458 "A0 %b8 %d1 * %h2, A1 %b9 %d1 * %h2 %M10%!",
3459 "A0 %b8 %h1 * %d2, A1 %b9 %h1 * %h2 %M10%!",
3460 "A0 %b8 %d1 * %d2, A1 %b9 %h1 * %h2 %M10%!",
3461 "A0 %b8 %h1 * %d2, A1 %b9 %d1 * %h2 %M10%!",
3462 "A0 %b8 %d1 * %d2, A1 %b9 %d1 * %h2 %M10%!",
3463 "A0 %b8 %h1 * %h2, A1 %b9 %h1 * %d2 %M10%!",
3464 "A0 %b8 %d1 * %h2, A1 %b9 %h1 * %d2 %M10%!",
3465 "A0 %b8 %h1 * %h2, A1 %b9 %d1 * %d2 %M10%!",
3466 "A0 %b8 %d1 * %h2, A1 %b9 %d1 * %d2 %M10%!",
3467 "A0 %b8 %h1 * %d2, A1 %b9 %h1 * %d2 %M10%!",
3468 "A0 %b8 %d1 * %d2, A1 %b9 %h1 * %d2 %M10%!",
3469 "A0 %b8 %h1 * %d2, A1 %b9 %d1 * %d2 %M10%!",
3470 "A0 %b8 %d1 * %d2, A1 %b9 %d1 * %d2 %M10%!" };
3471 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3472 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3473 return templates[alt];
3475 [(set_attr "type" "dsp32")])
3477 ;; Same as above, but initializing the accumulators and therefore a couple fewer
3478 ;; necessary operands.
3479 (define_insn "flag_macinitv2hi_parts"
3480 [(set (match_operand:V2HI 0 "register_operand" "=d")
3481 (unspec:V2HI [(vec_concat:V2HI
3483 (match_operand:V2HI 1 "register_operand" "d")
3484 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3487 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3489 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3490 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3491 (vec_select:HI (match_dup 2)
3492 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3493 (match_operand 7 "const_int_operand" "n")]
3494 UNSPEC_MAC_WITH_FLAG))
3495 (set (match_operand:V2PDI 8 "register_operand" "=e")
3496 (unspec:V2PDI [(vec_concat:V2HI
3497 (vec_select:HI (match_dup 1) (parallel [(match_dup 3)]))
3498 (vec_select:HI (match_dup 1) (parallel [(match_dup 4)])))
3500 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)]))
3501 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)])))
3503 UNSPEC_MAC_WITH_FLAG))]
3506 const char *templates[] = {
3507 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %h1 * %h2) %M7%!",
3508 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %h1 * %h2) %M7%!",
3509 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %d1 * %h2) %M7%!",
3510 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %d1 * %h2) %M7%!",
3511 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %h1 * %h2) %M7%!",
3512 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %h1 * %h2) %M7%!",
3513 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %d1 * %h2) %M7%!",
3514 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %d1 * %h2) %M7%!",
3515 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %h1 * %d2) %M7%!",
3516 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %h1 * %d2) %M7%!",
3517 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %d1 * %d2) %M7%!",
3518 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %d1 * %d2) %M7%!",
3519 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %h1 * %d2) %M7%!",
3520 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %h1 * %d2) %M7%!",
3521 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %d1 * %d2) %M7%!",
3522 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %d1 * %d2) %M7%!" };
3523 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3524 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3525 return templates[alt];
3527 [(set_attr "type" "dsp32")])
3529 (define_insn "flag_macinit1v2hi_parts"
3530 [(set (match_operand:V2PDI 0 "register_operand" "=e")
3531 (unspec:V2PDI [(vec_concat:V2HI
3533 (match_operand:V2HI 1 "register_operand" "d")
3534 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3537 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3539 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3540 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3541 (vec_select:HI (match_dup 2)
3542 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3543 (match_operand 7 "const_int_operand" "n")]
3544 UNSPEC_MAC_WITH_FLAG))]
3547 const char *templates[] = {
3548 "A0 = %h1 * %h2, A1 = %h1 * %h2 %M7%!",
3549 "A0 = %d1 * %h2, A1 = %h1 * %h2 %M7%!",
3550 "A0 = %h1 * %h2, A1 = %d1 * %h2 %M7%!",
3551 "A0 = %d1 * %h2, A1 = %d1 * %h2 %M7%!",
3552 "A0 = %h1 * %d2, A1 = %h1 * %h2 %M7%!",
3553 "A0 = %d1 * %d2, A1 = %h1 * %h2 %M7%!",
3554 "A0 = %h1 * %d2, A1 = %d1 * %h2 %M7%!",
3555 "A0 = %d1 * %d2, A1 = %d1 * %h2 %M7%!",
3556 "A0 = %h1 * %h2, A1 = %h1 * %d2 %M7%!",
3557 "A0 = %d1 * %h2, A1 = %h1 * %d2 %M7%!",
3558 "A0 = %h1 * %h2, A1 = %d1 * %d2 %M7%!",
3559 "A0 = %d1 * %h2, A1 = %d1 * %d2 %M7%!",
3560 "A0 = %h1 * %d2, A1 = %h1 * %d2 %M7%!",
3561 "A0 = %d1 * %d2, A1 = %h1 * %d2 %M7%!",
3562 "A0 = %h1 * %d2, A1 = %d1 * %d2 %M7%!",
3563 "A0 = %d1 * %d2, A1 = %d1 * %d2 %M7%!" };
3564 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3565 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3566 return templates[alt];
3568 [(set_attr "type" "dsp32")])
3570 ;; A mixture of multiply and multiply-accumulate for when we only want to
3571 ;; initialize one part.
3572 (define_insn "flag_mul_macv2hi_parts_acconly"
3573 [(set (match_operand:PDI 0 "register_operand" "=B,e,e")
3574 (unspec:PDI [(vec_select:HI
3575 (match_operand:V2HI 2 "register_operand" "d,d,d")
3576 (parallel [(match_operand 4 "const01_operand" "P0P1,P0P1,P0P1")]))
3578 (match_operand:V2HI 3 "register_operand" "d,d,d")
3579 (parallel [(match_operand 6 "const01_operand" "P0P1,P0P1,P0P1")]))
3580 (match_operand 10 "const_int_operand" "PB,PA,PA")]
3581 UNSPEC_MUL_WITH_FLAG))
3582 (set (match_operand:PDI 1 "register_operand" "=B,e,e")
3583 (unspec:PDI [(vec_select:HI
3585 (parallel [(match_operand 5 "const01_operand" "P0P1,P0P1,P0P1")]))
3588 (parallel [(match_operand 7 "const01_operand" "P0P1,P0P1,P0P1")]))
3589 (match_operand:PDI 8 "register_operand" "1,1,1")
3590 (match_operand 9 "const01_operand" "P0P1,P0P1,P0P1")
3591 (match_operand 11 "const_int_operand" "PA,PB,PA")]
3592 UNSPEC_MAC_WITH_FLAG))]
3593 "MACFLAGS_MATCH_P (INTVAL (operands[10]), INTVAL (operands[11]))"
3596 const char *templates[] = {
3597 "%0 = %h2 * %h3, %1 %b4 %h2 * %h3 %M5%!",
3598 "%0 = %d2 * %h3, %1 %b4 %h2 * %h3 %M5%!",
3599 "%0 = %h2 * %h3, %1 %b4 %d2 * %h3 %M5%!",
3600 "%0 = %d2 * %h3, %1 %b4 %d2 * %h3 %M5%!",
3601 "%0 = %h2 * %d3, %1 %b4 %h2 * %h3 %M5%!",
3602 "%0 = %d2 * %d3, %1 %b4 %h2 * %h3 %M5%!",
3603 "%0 = %h2 * %d3, %1 %b4 %d2 * %h3 %M5%!",
3604 "%0 = %d2 * %d3, %1 %b4 %d2 * %h3 %M5%!",
3605 "%0 = %h2 * %h3, %1 %b4 %h2 * %d3 %M5%!",
3606 "%0 = %d2 * %h3, %1 %b4 %h2 * %d3 %M5%!",
3607 "%0 = %h2 * %h3, %1 %b4 %d2 * %d3 %M5%!",
3608 "%0 = %d2 * %h3, %1 %b4 %d2 * %d3 %M5%!",
3609 "%0 = %h2 * %d3, %1 %b4 %h2 * %d3 %M5%!",
3610 "%0 = %d2 * %d3, %1 %b4 %h2 * %d3 %M5%!",
3611 "%0 = %h2 * %d3, %1 %b4 %d2 * %d3 %M5%!",
3612 "%0 = %d2 * %d3, %1 %b4 %d2 * %d3 %M5%!" };
3613 int alt = (INTVAL (operands[4]) + (INTVAL (operands[5]) << 1)
3614 + (INTVAL (operands[6]) << 2) + (INTVAL (operands[7]) << 3));
3615 xops[0] = operands[0];
3616 xops[1] = operands[1];
3617 xops[2] = operands[2];
3618 xops[3] = operands[3];
3619 xops[4] = operands[9];
3620 xops[5] = which_alternative == 0 ? operands[10] : operands[11];
3621 output_asm_insn (templates[alt], xops);
3624 [(set_attr "type" "dsp32")])
3627 (define_code_iterator s_or_u [sign_extend zero_extend])
3628 (define_code_attr su_optab [(sign_extend "mul")
3629 (zero_extend "umul")])
3630 (define_code_attr su_modifier [(sign_extend "IS")
3631 (zero_extend "FU")])
3633 (define_insn "<su_optab>hisi_ll"
3634 [(set (match_operand:SI 0 "register_operand" "=d")
3636 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3637 (parallel [(const_int 0)])))
3639 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3640 (parallel [(const_int 0)])))))]
3642 "%0 = %h1 * %h2 (<su_modifier>)%!"
3643 [(set_attr "type" "dsp32")])
3645 (define_insn "<su_optab>hisi_lh"
3646 [(set (match_operand:SI 0 "register_operand" "=d")
3648 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3649 (parallel [(const_int 0)])))
3651 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3652 (parallel [(const_int 1)])))))]
3654 "%0 = %h1 * %d2 (<su_modifier>)%!"
3655 [(set_attr "type" "dsp32")])
3657 (define_insn "<su_optab>hisi_hl"
3658 [(set (match_operand:SI 0 "register_operand" "=d")
3660 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3661 (parallel [(const_int 1)])))
3663 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3664 (parallel [(const_int 0)])))))]
3666 "%0 = %d1 * %h2 (<su_modifier>)%!"
3667 [(set_attr "type" "dsp32")])
3669 (define_insn "<su_optab>hisi_hh"
3670 [(set (match_operand:SI 0 "register_operand" "=d")
3672 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3673 (parallel [(const_int 1)])))
3675 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3676 (parallel [(const_int 1)])))))]
3678 "%0 = %d1 * %d2 (<su_modifier>)%!"
3679 [(set_attr "type" "dsp32")])
3681 ;; Additional variants for signed * unsigned multiply.
3683 (define_insn "usmulhisi_ull"
3684 [(set (match_operand:SI 0 "register_operand" "=W")
3685 (mult:SI (zero_extend:SI
3686 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3687 (parallel [(const_int 0)])))
3689 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3690 (parallel [(const_int 0)])))))]
3692 "%0 = %h2 * %h1 (IS,M)%!"
3693 [(set_attr "type" "dsp32")])
3695 (define_insn "usmulhisi_ulh"
3696 [(set (match_operand:SI 0 "register_operand" "=W")
3697 (mult:SI (zero_extend:SI
3698 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3699 (parallel [(const_int 0)])))
3701 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3702 (parallel [(const_int 1)])))))]
3704 "%0 = %d2 * %h1 (IS,M)%!"
3705 [(set_attr "type" "dsp32")])
3707 (define_insn "usmulhisi_uhl"
3708 [(set (match_operand:SI 0 "register_operand" "=W")
3709 (mult:SI (zero_extend:SI
3710 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3711 (parallel [(const_int 1)])))
3713 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3714 (parallel [(const_int 0)])))))]
3716 "%0 = %h2 * %d1 (IS,M)%!"
3717 [(set_attr "type" "dsp32")])
3719 (define_insn "usmulhisi_uhh"
3720 [(set (match_operand:SI 0 "register_operand" "=W")
3721 (mult:SI (zero_extend:SI
3722 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3723 (parallel [(const_int 1)])))
3725 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3726 (parallel [(const_int 1)])))))]
3728 "%0 = %d2 * %d1 (IS,M)%!"
3729 [(set_attr "type" "dsp32")])
3731 ;; Parallel versions of these operations. First, normal signed or unsigned
3734 (define_insn "<su_optab>hisi_ll_lh"
3735 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3737 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3738 (parallel [(const_int 0)])))
3740 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3741 (parallel [(const_int 0)])))))
3742 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3744 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3746 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3748 "%0 = %h1 * %h2, %3 = %h1 * %d2 (<su_modifier>)%!"
3749 [(set_attr "type" "dsp32")])
3751 (define_insn "<su_optab>hisi_ll_hl"
3752 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3754 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3755 (parallel [(const_int 0)])))
3757 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3758 (parallel [(const_int 0)])))))
3759 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3761 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3763 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3765 "%0 = %h1 * %h2, %3 = %d1 * %h2 (<su_modifier>)%!"
3766 [(set_attr "type" "dsp32")])
3768 (define_insn "<su_optab>hisi_ll_hh"
3769 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3771 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3772 (parallel [(const_int 0)])))
3774 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3775 (parallel [(const_int 0)])))))
3776 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3778 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3780 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3782 "%0 = %h1 * %h2, %3 = %d1 * %d2 (<su_modifier>)%!"
3783 [(set_attr "type" "dsp32")])
3785 (define_insn "<su_optab>hisi_lh_hl"
3786 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3788 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3789 (parallel [(const_int 0)])))
3791 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3792 (parallel [(const_int 1)])))))
3793 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3795 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3797 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3799 "%0 = %h1 * %d2, %3 = %d1 * %h2 (<su_modifier>)%!"
3800 [(set_attr "type" "dsp32")])
3802 (define_insn "<su_optab>hisi_lh_hh"
3803 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3805 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3806 (parallel [(const_int 0)])))
3808 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3809 (parallel [(const_int 1)])))))
3810 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3812 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3814 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3816 "%0 = %h1 * %d2, %3 = %d1 * %d2 (<su_modifier>)%!"
3817 [(set_attr "type" "dsp32")])
3819 (define_insn "<su_optab>hisi_hl_hh"
3820 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3822 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3823 (parallel [(const_int 1)])))
3825 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3826 (parallel [(const_int 0)])))))
3827 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3829 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3831 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3833 "%0 = %d1 * %h2, %3 = %d1 * %d2 (<su_modifier>)%!"
3834 [(set_attr "type" "dsp32")])
3836 ;; Special signed * unsigned variants.
3838 (define_insn "usmulhisi_ll_lul"
3839 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3840 (mult:SI (sign_extend:SI
3841 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3842 (parallel [(const_int 0)])))
3844 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3845 (parallel [(const_int 0)])))))
3846 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3847 (mult:SI (sign_extend:SI
3848 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3850 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3852 "%0 = %h1 * %h2, %3 = %h1 * %h2 (IS,M)%!"
3853 [(set_attr "type" "dsp32")])
3855 (define_insn "usmulhisi_ll_luh"
3856 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3857 (mult:SI (sign_extend:SI
3858 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3859 (parallel [(const_int 0)])))
3861 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3862 (parallel [(const_int 0)])))))
3863 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3864 (mult:SI (sign_extend:SI
3865 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3867 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3869 "%0 = %h1 * %h2, %3 = %h1 * %d2 (IS,M)%!"
3870 [(set_attr "type" "dsp32")])
3872 (define_insn "usmulhisi_ll_hul"
3873 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3874 (mult:SI (sign_extend:SI
3875 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3876 (parallel [(const_int 0)])))
3878 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3879 (parallel [(const_int 0)])))))
3880 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3881 (mult:SI (sign_extend:SI
3882 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3884 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3886 "%0 = %h1 * %h2, %3 = %d1 * %h2 (IS,M)%!"
3887 [(set_attr "type" "dsp32")])
3889 (define_insn "usmulhisi_ll_huh"
3890 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3891 (mult:SI (sign_extend:SI
3892 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3893 (parallel [(const_int 0)])))
3895 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3896 (parallel [(const_int 0)])))))
3897 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3898 (mult:SI (sign_extend:SI
3899 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3901 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3903 "%0 = %h1 * %h2, %3 = %d1 * %d2 (IS,M)%!"
3904 [(set_attr "type" "dsp32")])
3906 (define_insn "usmulhisi_lh_lul"
3907 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3908 (mult:SI (sign_extend:SI
3909 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3910 (parallel [(const_int 0)])))
3912 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3913 (parallel [(const_int 1)])))))
3914 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3915 (mult:SI (sign_extend:SI
3916 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3918 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3920 "%0 = %h1 * %d2, %3 = %h1 * %h2 (IS,M)%!"
3921 [(set_attr "type" "dsp32")])
3923 (define_insn "usmulhisi_lh_luh"
3924 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3925 (mult:SI (sign_extend:SI
3926 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3927 (parallel [(const_int 0)])))
3929 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3930 (parallel [(const_int 1)])))))
3931 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3932 (mult:SI (sign_extend:SI
3933 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3935 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3937 "%0 = %h1 * %d2, %3 = %h1 * %d2 (IS,M)%!"
3938 [(set_attr "type" "dsp32")])
3940 (define_insn "usmulhisi_lh_hul"
3941 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3942 (mult:SI (sign_extend:SI
3943 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3944 (parallel [(const_int 0)])))
3946 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3947 (parallel [(const_int 1)])))))
3948 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3949 (mult:SI (sign_extend:SI
3950 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3952 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3954 "%0 = %h1 * %d2, %3 = %d1 * %h2 (IS,M)%!"
3955 [(set_attr "type" "dsp32")])
3957 (define_insn "usmulhisi_lh_huh"
3958 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3959 (mult:SI (sign_extend:SI
3960 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3961 (parallel [(const_int 0)])))
3963 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3964 (parallel [(const_int 1)])))))
3965 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3966 (mult:SI (sign_extend:SI
3967 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3969 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3971 "%0 = %h1 * %d2, %3 = %d1 * %d2 (IS,M)%!"
3972 [(set_attr "type" "dsp32")])
3974 (define_insn "usmulhisi_hl_lul"
3975 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3976 (mult:SI (sign_extend:SI
3977 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3978 (parallel [(const_int 1)])))
3980 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3981 (parallel [(const_int 0)])))))
3982 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3983 (mult:SI (sign_extend:SI
3984 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3986 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3988 "%0 = %d1 * %h2, %3 = %h1 * %h2 (IS,M)%!"
3989 [(set_attr "type" "dsp32")])
3991 (define_insn "usmulhisi_hl_luh"
3992 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3993 (mult:SI (sign_extend:SI
3994 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3995 (parallel [(const_int 1)])))
3997 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3998 (parallel [(const_int 0)])))))
3999 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4000 (mult:SI (sign_extend:SI
4001 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
4003 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4005 "%0 = %d1 * %h2, %3 = %h1 * %d2 (IS,M)%!"
4006 [(set_attr "type" "dsp32")])
4008 (define_insn "usmulhisi_hl_hul"
4009 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4010 (mult:SI (sign_extend:SI
4011 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4012 (parallel [(const_int 1)])))
4014 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4015 (parallel [(const_int 0)])))))
4016 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4017 (mult:SI (sign_extend:SI
4018 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4020 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
4022 "%0 = %d1 * %h2, %3 = %d1 * %h2 (IS,M)%!"
4023 [(set_attr "type" "dsp32")])
4025 (define_insn "usmulhisi_hl_huh"
4026 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4027 (mult:SI (sign_extend:SI
4028 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4029 (parallel [(const_int 1)])))
4031 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4032 (parallel [(const_int 0)])))))
4033 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4034 (mult:SI (sign_extend:SI
4035 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4037 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4039 "%0 = %d1 * %h2, %3 = %d1 * %d2 (IS,M)%!"
4040 [(set_attr "type" "dsp32")])
4042 (define_insn "usmulhisi_hh_lul"
4043 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4044 (mult:SI (sign_extend:SI
4045 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4046 (parallel [(const_int 1)])))
4048 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4049 (parallel [(const_int 1)])))))
4050 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4051 (mult:SI (sign_extend:SI
4052 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
4054 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
4056 "%0 = %d1 * %d2, %3 = %h1 * %h2 (IS,M)%!"
4057 [(set_attr "type" "dsp32")])
4059 (define_insn "usmulhisi_hh_luh"
4060 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4061 (mult:SI (sign_extend:SI
4062 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4063 (parallel [(const_int 1)])))
4065 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4066 (parallel [(const_int 1)])))))
4067 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4068 (mult:SI (sign_extend:SI
4069 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
4071 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4073 "%0 = %d1 * %d2, %3 = %h1 * %d2 (IS,M)%!"
4074 [(set_attr "type" "dsp32")])
4076 (define_insn "usmulhisi_hh_hul"
4077 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4078 (mult:SI (sign_extend:SI
4079 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4080 (parallel [(const_int 1)])))
4082 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4083 (parallel [(const_int 1)])))))
4084 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4085 (mult:SI (sign_extend:SI
4086 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4088 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
4090 "%0 = %d1 * %d2, %3 = %d1 * %h2 (IS,M)%!"
4091 [(set_attr "type" "dsp32")])
4093 (define_insn "usmulhisi_hh_huh"
4094 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4095 (mult:SI (sign_extend:SI
4096 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4097 (parallel [(const_int 1)])))
4099 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4100 (parallel [(const_int 1)])))))
4101 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4102 (mult:SI (sign_extend:SI
4103 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4105 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4107 "%0 = %d1 * %d2, %3 = %d1 * %d2 (IS,M)%!"
4108 [(set_attr "type" "dsp32")])
4112 (define_insn "ssnegv2hi2"
4113 [(set (match_operand:V2HI 0 "register_operand" "=d")
4114 (ss_neg:V2HI (match_operand:V2HI 1 "register_operand" "d")))]
4117 [(set_attr "type" "dsp32")])
4119 (define_insn "ssabsv2hi2"
4120 [(set (match_operand:V2HI 0 "register_operand" "=d")
4121 (ss_abs:V2HI (match_operand:V2HI 1 "register_operand" "d")))]
4124 [(set_attr "type" "dsp32")])
4128 (define_insn "ssashiftv2hi3"
4129 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d")
4131 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4132 (ashiftrt:V2HI (match_operand:V2HI 1 "register_operand" "d,d,d")
4134 (ss_ashift:V2HI (match_dup 1) (match_dup 2))))]
4137 %0 = ASHIFT %1 BY %h2 (V, S)%!
4138 %0 = %1 << %2 (V,S)%!
4139 %0 = %1 >>> %N2 (V,S)%!"
4140 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4142 (define_insn "ssashifthi3"
4143 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
4145 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4146 (ashiftrt:HI (match_operand:HI 1 "register_operand" "d,d,d")
4148 (ss_ashift:HI (match_dup 1) (match_dup 2))))]
4151 %0 = ASHIFT %1 BY %h2 (V, S)%!
4152 %0 = %1 << %2 (V,S)%!
4153 %0 = %1 >>> %N2 (V,S)%!"
4154 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4156 (define_insn "ssashiftsi3"
4157 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4159 (lt (match_operand:HI 2 "reg_or_const_int_operand" "d,Ku5,Ks5") (const_int 0))
4160 (ashiftrt:SI (match_operand:HI 1 "register_operand" "d,d,d")
4162 (ss_ashift:SI (match_dup 1) (match_dup 2))))]
4165 %0 = ASHIFT %1 BY %h2 (S)%!
4167 %0 = %1 >>> %N2 (S)%!"
4168 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4170 (define_insn "lshiftv2hi3"
4171 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d")
4173 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4174 (lshiftrt:V2HI (match_operand:V2HI 1 "register_operand" "d,d,d")
4176 (ashift:V2HI (match_dup 1) (match_dup 2))))]
4179 %0 = LSHIFT %1 BY %h2 (V)%!
4181 %0 = %1 >> %N2 (V)%!"
4182 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4184 (define_insn "lshifthi3"
4185 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
4187 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4188 (lshiftrt:HI (match_operand:HI 1 "register_operand" "d,d,d")
4190 (ashift:HI (match_dup 1) (match_dup 2))))]
4193 %0 = LSHIFT %1 BY %h2 (V)%!
4195 %0 = %1 >> %N2 (V)%!"
4196 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4198 ;; Load without alignment exception (masking off low bits)
4200 (define_insn "loadbytes"
4201 [(set (match_operand:SI 0 "register_operand" "=d")
4202 (mem:SI (and:SI (match_operand:SI 1 "register_operand" "b")
4205 "DISALGNEXCPT || %0 = [%1];"
4206 [(set_attr "type" "mcld")
4207 (set_attr "length" "8")])