1 ;;- Machine description for Blackfin for GNU compiler
2 ;; Copyright (C) 2005-2018 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 (not (match_test "ENABLE_WA_05000074")))
243 (define_insn_reservation "dsp32shiftimm_anomaly_05000074" 1
244 (and (eq_attr "type" "dsp32shiftimm")
245 (match_test "ENABLE_WA_05000074"))
246 "slot0+anomaly_05000074")
248 (define_insn_reservation "load32" 1
249 (and (not (eq_attr "seq_insns" "multi"))
250 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "32bit")))
253 (define_insn_reservation "loadp" 1
254 (and (not (eq_attr "seq_insns" "multi"))
255 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "preg")))
258 (define_insn_reservation "loadsp" 1
259 (and (not (eq_attr "seq_insns" "multi"))
260 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "spreg")))
263 (define_insn_reservation "loadi" 1
264 (and (not (eq_attr "seq_insns" "multi"))
265 (and (eq_attr "type" "mcld") (eq_attr "addrtype" "ireg")))
266 "(slot1|slot2)+load")
268 (define_insn_reservation "store32" 1
269 (and (not (eq_attr "seq_insns" "multi"))
270 (and (eq_attr "type" "mcst") (eq_attr "addrtype" "32bit")))
273 (define_insn_reservation "storep" 1
274 (and (and (not (eq_attr "seq_insns" "multi"))
275 (and (eq_attr "type" "mcst")
276 (ior (eq_attr "addrtype" "preg")
277 (eq_attr "addrtype" "spreg"))))
278 (ior (not (match_test "ENABLE_WA_05000074"))
279 (eq_attr "storereg" "other")))
282 (define_insn_reservation "storep_anomaly_05000074" 1
283 (and (and (not (eq_attr "seq_insns" "multi"))
284 (and (eq_attr "type" "mcst")
285 (ior (eq_attr "addrtype" "preg")
286 (eq_attr "addrtype" "spreg"))))
287 (and (match_test "ENABLE_WA_05000074")
288 (eq_attr "storereg" "preg")))
289 "slot1+anomaly_05000074+pregs+store")
291 (define_insn_reservation "storei" 1
292 (and (and (not (eq_attr "seq_insns" "multi"))
293 (and (eq_attr "type" "mcst") (eq_attr "addrtype" "ireg")))
294 (ior (not (match_test "ENABLE_WA_05000074"))
295 (eq_attr "storereg" "other")))
296 "(slot1|slot2)+store")
298 (define_insn_reservation "storei_anomaly_05000074" 1
299 (and (and (not (eq_attr "seq_insns" "multi"))
300 (and (eq_attr "type" "mcst") (eq_attr "addrtype" "ireg")))
301 (and (match_test "ENABLE_WA_05000074")
302 (eq_attr "storereg" "preg")))
303 "((slot1+anomaly_05000074)|slot2)+store")
305 (define_insn_reservation "multi" 2
306 (eq_attr "seq_insns" "multi")
309 (define_insn_reservation "load_stall1" 1
310 (and (eq_attr "type" "stall")
311 (match_operand 0 "const1_operand" ""))
314 (define_insn_reservation "load_stall3" 1
315 (and (eq_attr "type" "stall")
316 (match_operand 0 "const3_operand" ""))
319 (absence_set "slot0" "slot1,slot2")
320 (absence_set "slot1" "slot2")
322 ;; Make sure genautomata knows about the maximum latency that can be produced
323 ;; by the adjust_cost function.
324 (define_insn_reservation "dummy" 5
325 (eq_attr "type" "dummy")
328 ;; Operand and operator predicates
330 (include "predicates.md")
331 (include "constraints.md")
333 ;;; FRIO branches have been optimized for code density
334 ;;; this comes at a slight cost of complexity when
335 ;;; a compiler needs to generate branches in the general
336 ;;; case. In order to generate the correct branching
337 ;;; mechanisms the compiler needs keep track of instruction
338 ;;; lengths. The follow table describes how to count instructions
339 ;;; for the FRIO architecture.
341 ;;; unconditional br are 12-bit imm pcrelative branches *2
342 ;;; conditional br are 10-bit imm pcrelative branches *2
344 ;;; 1024 10-bit imm *2 is 2048 (-1024..1022)
346 ;;; 4096 12-bit imm *2 is 8192 (-4096..4094)
347 ;;; NOTE : For brcc we generate instructions such as
348 ;;; if cc jmp; jump.[sl] offset
349 ;;; offset of jump.[sl] is from the jump instruction but
350 ;;; gcc calculates length from the if cc jmp instruction
351 ;;; furthermore gcc takes the end address of the branch instruction
352 ;;; as (pc) for a forward branch
353 ;;; hence our range is (-4094, 4092) instead of (-4096, 4094) for a br
355 ;;; The way the (pc) rtx works in these calculations is somewhat odd;
356 ;;; for backward branches it's the address of the current instruction,
357 ;;; for forward branches it's the previously known address of the following
358 ;;; instruction - we have to take this into account by reducing the range
359 ;;; for a forward branch.
361 ;; Lengths for type "mvi" insns are always defined by the instructions
363 (define_attr "length" ""
364 (cond [(eq_attr "type" "mcld")
365 (if_then_else (match_operand 1 "effective_address_32bit_p" "")
366 (const_int 4) (const_int 2))
368 (eq_attr "type" "mcst")
369 (if_then_else (match_operand 0 "effective_address_32bit_p" "")
370 (const_int 4) (const_int 2))
372 (eq_attr "type" "move") (const_int 2)
374 (eq_attr "type" "dsp32") (const_int 4)
375 (eq_attr "type" "dsp32shiftimm") (const_int 4)
376 (eq_attr "type" "call") (const_int 4)
378 (eq_attr "type" "br")
380 (le (minus (match_dup 0) (pc)) (const_int 4092))
381 (ge (minus (match_dup 0) (pc)) (const_int -4096)))
385 (eq_attr "type" "brcc")
387 (le (minus (match_dup 3) (pc)) (const_int 1020))
388 (ge (minus (match_dup 3) (pc)) (const_int -1024)))
391 (le (minus (match_dup 3) (pc)) (const_int 4092))
392 (ge (minus (match_dup 3) (pc)) (const_int -4094)))
399 ;; Classify the insns into those that are one instruction and those that
400 ;; are more than one in sequence.
401 (define_attr "seq_insns" "single,multi"
402 (const_string "single"))
404 ;; Describe a user's asm statement.
405 (define_asm_attributes
406 [(set_attr "type" "misc")
407 (set_attr "seq_insns" "multi")
408 (set_attr "length" "4")])
412 (define_mode_iterator CCMOV [QI HI SI])
414 (define_expand "mov<mode>cc"
415 [(set (match_operand:CCMOV 0 "register_operand" "")
416 (if_then_else:CCMOV (match_operand 1 "comparison_operator" "")
417 (match_operand:CCMOV 2 "register_operand" "")
418 (match_operand:CCMOV 3 "register_operand" "")))]
421 operands[1] = bfin_gen_compare (operands[1], <MODE>mode);
424 (define_insn "*mov<mode>cc_insn1"
425 [(set (match_operand:CCMOV 0 "register_operand" "=da,da,da")
427 (eq:BI (match_operand:BI 3 "register_operand" "C,C,C")
429 (match_operand:CCMOV 1 "register_operand" "da,0,da")
430 (match_operand:CCMOV 2 "register_operand" "0,da,da")))]
435 if !cc %0 = %1; if cc %0 = %2;"
436 [(set_attr "length" "2,2,4")
437 (set_attr "type" "movcc")
438 (set_attr "seq_insns" "*,*,multi")])
440 (define_insn "*mov<mode>cc_insn2"
441 [(set (match_operand:CCMOV 0 "register_operand" "=da,da,da")
443 (ne:BI (match_operand:BI 3 "register_operand" "C,C,C")
445 (match_operand:CCMOV 1 "register_operand" "0,da,da")
446 (match_operand:CCMOV 2 "register_operand" "da,0,da")))]
451 if cc %0 = %1; if !cc %0 = %2;"
452 [(set_attr "length" "2,2,4")
453 (set_attr "type" "movcc")
454 (set_attr "seq_insns" "*,*,multi")])
456 ;; Insns to load HIGH and LO_SUM
458 (define_insn "movsi_high"
459 [(set (match_operand:SI 0 "register_operand" "=x")
460 (high:SI (match_operand:SI 1 "immediate_operand" "i")))]
463 [(set_attr "type" "mvi")
464 (set_attr "length" "4")])
466 (define_insn "movstricthi_high"
467 [(set (match_operand:SI 0 "register_operand" "+x")
468 (ior:SI (and:SI (match_dup 0) (const_int 65535))
469 (match_operand:SI 1 "immediate_operand" "i")))]
472 [(set_attr "type" "mvi")
473 (set_attr "length" "4")])
475 (define_insn "movsi_low"
476 [(set (match_operand:SI 0 "register_operand" "=x")
477 (lo_sum:SI (match_operand:SI 1 "register_operand" "0")
478 (match_operand:SI 2 "immediate_operand" "i")))]
481 [(set_attr "type" "mvi")
482 (set_attr "length" "4")])
484 (define_insn "movsi_high_pic"
485 [(set (match_operand:SI 0 "register_operand" "=x")
486 (high:SI (unspec:SI [(match_operand:SI 1 "" "")]
490 [(set_attr "type" "mvi")
491 (set_attr "length" "4")])
493 (define_insn "movsi_low_pic"
494 [(set (match_operand:SI 0 "register_operand" "=x")
495 (lo_sum:SI (match_operand:SI 1 "register_operand" "0")
496 (unspec:SI [(match_operand:SI 2 "" "")]
499 "%h0 = %h2@GOT_HIGH;"
500 [(set_attr "type" "mvi")
501 (set_attr "length" "4")])
503 ;;; Move instructions
505 (define_insn_and_split "movdi_insn"
506 [(set (match_operand:DI 0 "nonimmediate_operand" "=x,mx,r")
507 (match_operand:DI 1 "general_operand" "iFx,r,mx"))]
508 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
511 [(set (match_dup 2) (match_dup 3))
512 (set (match_dup 4) (match_dup 5))]
514 rtx lo_half[2], hi_half[2];
515 split_di (operands, 2, lo_half, hi_half);
517 if (reg_overlap_mentioned_p (lo_half[0], hi_half[1]))
519 operands[2] = hi_half[0];
520 operands[3] = hi_half[1];
521 operands[4] = lo_half[0];
522 operands[5] = lo_half[1];
526 operands[2] = lo_half[0];
527 operands[3] = lo_half[1];
528 operands[4] = hi_half[0];
529 operands[5] = hi_half[1];
534 [(set (match_operand:BI 0 "nonimmediate_operand" "=x,x,d,md,C,d,C,P1")
535 (match_operand:BI 1 "general_operand" "x,xKs3,md,d,d,C,P0,P1"))]
547 [(set_attr "type" "move,mvi,mcld,mcst,compare,compare,compare,compare")
548 (set_attr "length" "2,2,*,*,2,2,2,2")
549 (set_attr "seq_insns" "*,*,*,*,*,*,*,*")])
551 (define_insn "movpdi"
552 [(set (match_operand:PDI 0 "nonimmediate_operand" "=e,<,e")
553 (match_operand:PDI 1 "general_operand" " e,e,>"))]
559 [(set_attr "type" "move,mcst,mcld")
560 (set_attr "seq_insns" "*,multi,multi")])
562 (define_insn "load_accumulator"
563 [(set (match_operand:PDI 0 "register_operand" "=e")
564 (sign_extend:PDI (match_operand:SI 1 "register_operand" "d")))]
567 [(set_attr "type" "move")])
569 (define_insn_and_split "load_accumulator_pair"
570 [(set (match_operand:V2PDI 0 "register_operand" "=e")
571 (sign_extend:V2PDI (vec_concat:V2SI
572 (match_operand:SI 1 "register_operand" "d")
573 (match_operand:SI 2 "register_operand" "d"))))]
577 [(set (match_dup 3) (sign_extend:PDI (match_dup 1)))
578 (set (match_dup 4) (sign_extend:PDI (match_dup 2)))]
580 operands[3] = gen_rtx_REG (PDImode, REGNO (operands[0]));
581 operands[4] = gen_rtx_REG (PDImode, REGNO (operands[0]) + 1);
584 (define_insn "*pushsi_insn"
585 [(set (mem:SI (pre_dec:SI (reg:SI REG_SP)))
586 (match_operand:SI 0 "register_operand" "xy"))]
589 [(set_attr "type" "mcst")
590 (set_attr "addrtype" "32bit")
591 (set_attr "length" "2")])
593 (define_insn "*popsi_insn"
594 [(set (match_operand:SI 0 "register_operand" "=d,xy")
595 (mem:SI (post_inc:SI (reg:SI REG_SP))))]
598 [(set_attr "type" "mcld")
599 (set_attr "addrtype" "preg,32bit")
600 (set_attr "length" "2")])
602 ;; The first alternative is used to make reload choose a limited register
603 ;; class when faced with a movsi_insn that had its input operand replaced
604 ;; with a PLUS. We generally require fewer secondary reloads this way.
606 (define_insn "*movsi_insn"
607 [(set (match_operand:SI 0 "nonimmediate_operand" "=da,x,da,y,da,x,x,x,da,mr")
608 (match_operand:SI 1 "general_operand" "da,x,y,da,xKs7,xKsh,xKuh,ix,mr,da"))]
609 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
621 [(set_attr "type" "move,move,move,move,mvi,mvi,mvi,*,mcld,mcst")
622 (set_attr "length" "2,2,2,2,2,4,4,*,*,*")])
624 (define_insn "*movsi_insn32"
625 [(set (match_operand:SI 0 "register_operand" "=d,d")
626 (unspec:SI [(match_operand:SI 1 "nonmemory_operand" "d,P0")] UNSPEC_32BIT))]
631 [(set_attr "type" "dsp32shiftimm,dsp32")])
634 [(set (match_operand:SI 0 "d_register_operand" "")
636 "splitting_for_sched && !optimize_size"
637 [(set (match_dup 0) (unspec:SI [(const_int 0)] UNSPEC_32BIT))])
640 [(set (match_operand:SI 0 "d_register_operand" "")
641 (match_operand:SI 1 "d_register_operand" ""))]
642 "splitting_for_sched && !optimize_size"
643 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_32BIT))])
645 (define_insn_and_split "*movv2hi_insn"
646 [(set (match_operand:V2HI 0 "nonimmediate_operand" "=da,da,d,dm")
647 (match_operand:V2HI 1 "general_operand" "i,di,md,d"))]
649 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
655 "reload_completed && GET_CODE (operands[1]) == CONST_VECTOR"
656 [(set (match_dup 0) (high:SI (match_dup 2)))
657 (set (match_dup 0) (lo_sum:SI (match_dup 0) (match_dup 3)))]
659 HOST_WIDE_INT intval = INTVAL (XVECEXP (operands[1], 0, 1)) << 16;
660 intval |= INTVAL (XVECEXP (operands[1], 0, 0)) & 0xFFFF;
662 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));
663 operands[2] = operands[3] = GEN_INT (trunc_int_for_mode (intval, SImode));
665 [(set_attr "type" "move,move,mcld,mcst")
666 (set_attr "length" "2,2,*,*")])
668 (define_insn "*movhi_insn"
669 [(set (match_operand:HI 0 "nonimmediate_operand" "=x,da,x,d,mr")
670 (match_operand:HI 1 "general_operand" "x,xKs7,xKsh,mr,d"))]
671 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
673 static const char *templates[] = {
682 int alt = which_alternative;
683 rtx mem = (MEM_P (operands[0]) ? operands[0]
684 : MEM_P (operands[1]) ? operands[1] : NULL_RTX);
685 if (mem && bfin_dsp_memref_p (mem))
687 return templates[alt];
689 [(set_attr "type" "move,mvi,mvi,mcld,mcst")
690 (set_attr "length" "2,2,4,*,*")])
692 (define_insn "*movqi_insn"
693 [(set (match_operand:QI 0 "nonimmediate_operand" "=x,da,x,d,mr")
694 (match_operand:QI 1 "general_operand" "x,xKs7,xKsh,mr,d"))]
695 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
702 [(set_attr "type" "move,mvi,mvi,mcld,mcst")
703 (set_attr "length" "2,2,4,*,*")])
705 (define_insn "*movsf_insn"
706 [(set (match_operand:SF 0 "nonimmediate_operand" "=x,x,da,mr")
707 (match_operand:SF 1 "general_operand" "x,Fx,mr,da"))]
708 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
714 [(set_attr "type" "move,*,mcld,mcst")])
716 (define_insn_and_split "movdf_insn"
717 [(set (match_operand:DF 0 "nonimmediate_operand" "=x,mx,r")
718 (match_operand:DF 1 "general_operand" "iFx,r,mx"))]
719 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
722 [(set (match_dup 2) (match_dup 3))
723 (set (match_dup 4) (match_dup 5))]
725 rtx lo_half[2], hi_half[2];
726 split_di (operands, 2, lo_half, hi_half);
728 if (reg_overlap_mentioned_p (lo_half[0], hi_half[1]))
730 operands[2] = hi_half[0];
731 operands[3] = hi_half[1];
732 operands[4] = lo_half[0];
733 operands[5] = lo_half[1];
737 operands[2] = lo_half[0];
738 operands[3] = lo_half[1];
739 operands[4] = hi_half[0];
740 operands[5] = hi_half[1];
744 ;; Storing halfwords.
745 (define_insn "*movsi_insv"
746 [(set (zero_extract:SI (match_operand 0 "register_operand" "+d,x")
749 (match_operand:SI 1 "nonmemory_operand" "d,n"))]
754 [(set_attr "type" "dsp32shiftimm,mvi")])
756 (define_expand "insv"
757 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
758 (match_operand:SI 1 "immediate_operand" "")
759 (match_operand:SI 2 "immediate_operand" ""))
760 (match_operand:SI 3 "nonmemory_operand" ""))]
763 if (INTVAL (operands[1]) != 16 || INTVAL (operands[2]) != 16)
766 /* From mips.md: insert_bit_field doesn't verify that our source
767 matches the predicate, so check it again here. */
768 if (! register_operand (operands[0], VOIDmode))
772 ;; This is the main "hook" for PIC code. When generating
773 ;; PIC, movsi is responsible for determining when the source address
774 ;; needs PIC relocation and appropriately calling legitimize_pic_address
775 ;; to perform the actual relocation.
777 (define_expand "movsi"
778 [(set (match_operand:SI 0 "nonimmediate_operand" "")
779 (match_operand:SI 1 "general_operand" ""))]
782 if (expand_move (operands, SImode))
786 (define_expand "movv2hi"
787 [(set (match_operand:V2HI 0 "nonimmediate_operand" "")
788 (match_operand:V2HI 1 "general_operand" ""))]
790 "expand_move (operands, V2HImode);")
792 (define_expand "movdi"
793 [(set (match_operand:DI 0 "nonimmediate_operand" "")
794 (match_operand:DI 1 "general_operand" ""))]
796 "expand_move (operands, DImode);")
798 (define_expand "movsf"
799 [(set (match_operand:SF 0 "nonimmediate_operand" "")
800 (match_operand:SF 1 "general_operand" ""))]
802 "expand_move (operands, SFmode);")
804 (define_expand "movdf"
805 [(set (match_operand:DF 0 "nonimmediate_operand" "")
806 (match_operand:DF 1 "general_operand" ""))]
808 "expand_move (operands, DFmode);")
810 (define_expand "movhi"
811 [(set (match_operand:HI 0 "nonimmediate_operand" "")
812 (match_operand:HI 1 "general_operand" ""))]
814 "expand_move (operands, HImode);")
816 (define_expand "movqi"
817 [(set (match_operand:QI 0 "nonimmediate_operand" "")
818 (match_operand:QI 1 "general_operand" ""))]
820 " expand_move (operands, QImode); ")
822 ;; Some define_splits to break up SI/SFmode loads of immediate constants.
825 [(set (match_operand:SI 0 "register_operand" "")
826 (match_operand:SI 1 "symbolic_or_const_operand" ""))]
828 /* Always split symbolic operands; split integer constants that are
829 too large for a single instruction. */
830 && (GET_CODE (operands[1]) != CONST_INT
831 || (INTVAL (operands[1]) < -32768
832 || INTVAL (operands[1]) >= 65536
833 || (INTVAL (operands[1]) >= 32768 && PREG_P (operands[0]))))"
834 [(set (match_dup 0) (high:SI (match_dup 1)))
835 (set (match_dup 0) (lo_sum:SI (match_dup 0) (match_dup 1)))]
837 if (GET_CODE (operands[1]) == CONST_INT
838 && split_load_immediate (operands))
840 /* ??? Do something about TARGET_LOW_64K. */
844 [(set (match_operand:SF 0 "register_operand" "")
845 (match_operand:SF 1 "immediate_operand" ""))]
847 [(set (match_dup 2) (high:SI (match_dup 3)))
848 (set (match_dup 2) (lo_sum:SI (match_dup 2) (match_dup 3)))]
852 gcc_assert (GET_CODE (operands[1]) == CONST_DOUBLE);
854 REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (operands[1]), values);
856 operands[2] = gen_rtx_REG (SImode, true_regnum (operands[0]));
857 operands[3] = GEN_INT (trunc_int_for_mode (values, SImode));
858 if (values >= -32768 && values < 65536)
860 emit_move_insn (operands[2], operands[3]);
863 if (split_load_immediate (operands + 2))
867 ;; Sadly, this can't be a proper named movstrict pattern, since the compiler
868 ;; expects to be able to use registers for operand 1.
869 ;; Note that the asm instruction is defined by the manual to take an unsigned
870 ;; constant, but it doesn't matter to the assembler, and the compiler only
871 ;; deals with sign-extended constants. Hence "Ksh".
872 (define_insn "movstricthi_1"
873 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+x"))
874 (match_operand:HI 1 "immediate_operand" "Ksh"))]
877 [(set_attr "type" "mvi")
878 (set_attr "length" "4")])
880 ;; Sign and zero extensions
882 (define_insn_and_split "extendhisi2"
883 [(set (match_operand:SI 0 "register_operand" "=d, d")
884 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d, m")))]
889 "reload_completed && bfin_dsp_memref_p (operands[1])"
890 [(set (match_dup 2) (match_dup 1))
891 (set (match_dup 0) (sign_extend:SI (match_dup 2)))]
893 operands[2] = gen_lowpart (HImode, operands[0]);
895 [(set_attr "type" "alu0,mcld")])
897 (define_insn_and_split "zero_extendhisi2"
898 [(set (match_operand:SI 0 "register_operand" "=d, d")
899 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d, m")))]
904 "reload_completed && bfin_dsp_memref_p (operands[1])"
905 [(set (match_dup 2) (match_dup 1))
906 (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
908 operands[2] = gen_lowpart (HImode, operands[0]);
910 [(set_attr "type" "alu0,mcld")])
912 (define_insn "zero_extendbisi2"
913 [(set (match_operand:SI 0 "register_operand" "=d")
914 (zero_extend:SI (match_operand:BI 1 "nonimmediate_operand" "C")))]
917 [(set_attr "type" "compare")])
919 (define_insn "extendqihi2"
920 [(set (match_operand:HI 0 "register_operand" "=d, d")
921 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
926 [(set_attr "type" "mcld,alu0")])
928 (define_insn "extendqisi2"
929 [(set (match_operand:SI 0 "register_operand" "=d, d")
930 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
935 [(set_attr "type" "mcld,alu0")])
938 (define_insn "zero_extendqihi2"
939 [(set (match_operand:HI 0 "register_operand" "=d, d")
940 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
945 [(set_attr "type" "mcld,alu0")])
948 (define_insn "zero_extendqisi2"
949 [(set (match_operand:SI 0 "register_operand" "=d, d")
950 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m, d")))]
955 [(set_attr "type" "mcld,alu0")])
957 ;; DImode logical operations
959 (define_code_iterator any_logical [and ior xor])
960 (define_code_attr optab [(and "and")
963 (define_code_attr op [(and "&")
966 (define_code_attr high_result [(and "0")
970 ;; Keep this pattern around to avoid generating NO_CONFLICT blocks.
971 (define_expand "<optab>di3"
972 [(set (match_operand:DI 0 "register_operand" "=d")
973 (any_logical:DI (match_operand:DI 1 "register_operand" "0")
974 (match_operand:DI 2 "general_operand" "d")))]
977 rtx hi_half[3], lo_half[3];
978 enum insn_code icode = CODE_FOR_<optab>si3;
979 if (!reg_overlap_mentioned_p (operands[0], operands[1])
980 && !reg_overlap_mentioned_p (operands[0], operands[2]))
981 emit_clobber (operands[0]);
982 split_di (operands, 3, lo_half, hi_half);
983 if (!(*insn_data[icode].operand[2].predicate) (lo_half[2], SImode))
984 lo_half[2] = force_reg (SImode, lo_half[2]);
985 emit_insn (GEN_FCN (icode) (lo_half[0], lo_half[1], lo_half[2]));
986 if (!(*insn_data[icode].operand[2].predicate) (hi_half[2], SImode))
987 hi_half[2] = force_reg (SImode, hi_half[2]);
988 emit_insn (GEN_FCN (icode) (hi_half[0], hi_half[1], hi_half[2]));
992 (define_insn "zero_extendqidi2"
993 [(set (match_operand:DI 0 "register_operand" "=d")
994 (zero_extend:DI (match_operand:QI 1 "register_operand" "d")))]
996 "%0 = %T1 (Z);\\n\\t%H0 = 0;"
997 [(set_attr "length" "4")
998 (set_attr "seq_insns" "multi")])
1000 (define_insn "zero_extendhidi2"
1001 [(set (match_operand:DI 0 "register_operand" "=d")
1002 (zero_extend:DI (match_operand:HI 1 "register_operand" "d")))]
1004 "%0 = %h1 (Z);\\n\\t%H0 = 0;"
1005 [(set_attr "length" "4")
1006 (set_attr "seq_insns" "multi")])
1008 (define_insn_and_split "extendsidi2"
1009 [(set (match_operand:DI 0 "register_operand" "=d")
1010 (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))]
1014 [(set (match_dup 3) (match_dup 1))
1015 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
1017 split_di (operands, 1, operands + 2, operands + 3);
1018 if (REGNO (operands[0]) != REGNO (operands[1]))
1019 emit_move_insn (operands[2], operands[1]);
1022 (define_insn_and_split "extendqidi2"
1023 [(set (match_operand:DI 0 "register_operand" "=d")
1024 (sign_extend:DI (match_operand:QI 1 "register_operand" "d")))]
1028 [(set (match_dup 2) (sign_extend:SI (match_dup 1)))
1029 (set (match_dup 3) (sign_extend:SI (match_dup 1)))
1030 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
1032 split_di (operands, 1, operands + 2, operands + 3);
1035 (define_insn_and_split "extendhidi2"
1036 [(set (match_operand:DI 0 "register_operand" "=d")
1037 (sign_extend:DI (match_operand:HI 1 "register_operand" "d")))]
1041 [(set (match_dup 2) (sign_extend:SI (match_dup 1)))
1042 (set (match_dup 3) (sign_extend:SI (match_dup 1)))
1043 (set (match_dup 3) (ashiftrt:SI (match_dup 3) (const_int 31)))]
1045 split_di (operands, 1, operands + 2, operands + 3);
1048 ;; DImode arithmetic operations
1050 (define_insn "add_with_carry"
1051 [(set (match_operand:SI 0 "register_operand" "=d,d")
1052 (plus:SI (match_operand:SI 1 "register_operand" "%0,d")
1053 (match_operand:SI 2 "nonmemory_operand" "Ks7,d")))
1054 (set (match_operand:BI 3 "register_operand" "=C,C")
1055 (ltu:BI (not:SI (match_dup 1)) (match_dup 2)))]
1059 %0 = %1 + %2; cc = ac0;"
1060 [(set_attr "type" "alu0")
1061 (set_attr "length" "4")
1062 (set_attr "seq_insns" "multi")])
1064 (define_insn "sub_with_carry"
1065 [(set (match_operand:SI 0 "register_operand" "=d")
1066 (minus:SI (match_operand:SI 1 "register_operand" "%d")
1067 (match_operand:SI 2 "nonmemory_operand" "d")))
1068 (set (match_operand:BI 3 "register_operand" "=C")
1069 (leu:BI (match_dup 2) (match_dup 1)))]
1071 "%0 = %1 - %2; cc = ac0;"
1072 [(set_attr "type" "alu0")
1073 (set_attr "length" "4")
1074 (set_attr "seq_insns" "multi")])
1076 (define_expand "adddi3"
1077 [(set (match_operand:DI 0 "register_operand" "")
1078 (plus:DI (match_operand:DI 1 "register_operand" "")
1079 (match_operand:DI 2 "nonmemory_operand" "")))
1080 (clobber (match_scratch:SI 3 ""))
1081 (clobber (reg:CC 34))]
1085 xops[0] = gen_lowpart (SImode, operands[0]);
1086 xops[1] = simplify_gen_subreg (SImode, operands[0], DImode, 4);
1087 xops[2] = gen_lowpart (SImode, operands[1]);
1088 xops[3] = simplify_gen_subreg (SImode, operands[1], DImode, 4);
1089 xops[4] = gen_lowpart (SImode, operands[2]);
1090 xops[5] = simplify_gen_subreg (SImode, operands[2], DImode, 4);
1091 xops[6] = gen_reg_rtx (SImode);
1092 xops[7] = gen_rtx_REG (BImode, REG_CC);
1093 if (!register_operand (xops[4], SImode)
1094 && (GET_CODE (xops[4]) != CONST_INT
1095 || !satisfies_constraint_Ks7 (xops[4])))
1096 xops[4] = force_reg (SImode, xops[4]);
1097 if (!reg_overlap_mentioned_p (operands[0], operands[1])
1098 && !reg_overlap_mentioned_p (operands[0], operands[2]))
1099 emit_clobber (operands[0]);
1100 emit_insn (gen_add_with_carry (xops[0], xops[2], xops[4], xops[7]));
1101 emit_insn (gen_movbisi (xops[6], xops[7]));
1102 if (!register_operand (xops[5], SImode)
1103 && (GET_CODE (xops[5]) != CONST_INT
1104 || !satisfies_constraint_Ks7 (xops[5])))
1105 xops[5] = force_reg (SImode, xops[5]);
1106 if (xops[5] != const0_rtx)
1107 emit_insn (gen_addsi3 (xops[1], xops[3], xops[5]));
1109 emit_move_insn (xops[1], xops[3]);
1110 emit_insn (gen_addsi3 (xops[1], xops[1], xops[6]));
1114 (define_expand "subdi3"
1115 [(set (match_operand:DI 0 "register_operand" "")
1116 (minus:DI (match_operand:DI 1 "register_operand" "")
1117 (match_operand:DI 2 "register_operand" "")))
1118 (clobber (reg:CC 34))]
1122 xops[0] = gen_lowpart (SImode, operands[0]);
1123 xops[1] = simplify_gen_subreg (SImode, operands[0], DImode, 4);
1124 xops[2] = gen_lowpart (SImode, operands[1]);
1125 xops[3] = simplify_gen_subreg (SImode, operands[1], DImode, 4);
1126 xops[4] = gen_lowpart (SImode, operands[2]);
1127 xops[5] = simplify_gen_subreg (SImode, operands[2], DImode, 4);
1128 xops[6] = gen_reg_rtx (SImode);
1129 xops[7] = gen_rtx_REG (BImode, REG_CC);
1130 if (!reg_overlap_mentioned_p (operands[0], operands[1])
1131 && !reg_overlap_mentioned_p (operands[0], operands[2]))
1132 emit_clobber (operands[0]);
1133 emit_insn (gen_sub_with_carry (xops[0], xops[2], xops[4], xops[7]));
1134 emit_insn (gen_notbi (xops[7], xops[7]));
1135 emit_insn (gen_movbisi (xops[6], xops[7]));
1136 emit_insn (gen_subsi3 (xops[1], xops[3], xops[5]));
1137 emit_insn (gen_subsi3 (xops[1], xops[1], xops[6]));
1141 ;; Combined shift/add instructions
1144 [(set (match_operand:SI 0 "register_operand" "=a,d")
1145 (ashift:SI (plus:SI (match_operand:SI 1 "register_operand" "%0,0")
1146 (match_operand:SI 2 "register_operand" "a,d"))
1147 (match_operand:SI 3 "pos_scale_operand" "P1P2,P1P2")))]
1149 "%0 = (%0 + %2) << %3;" /* "shadd %0,%2,%3;" */
1150 [(set_attr "type" "alu0")])
1153 [(set (match_operand:SI 0 "register_operand" "=a")
1154 (plus:SI (match_operand:SI 1 "register_operand" "a")
1155 (mult:SI (match_operand:SI 2 "register_operand" "a")
1156 (match_operand:SI 3 "scale_by_operand" "i"))))]
1158 "%0 = %1 + (%2 << %X3);"
1159 [(set_attr "type" "alu0")])
1162 [(set (match_operand:SI 0 "register_operand" "=a")
1163 (plus:SI (match_operand:SI 1 "register_operand" "a")
1164 (ashift:SI (match_operand:SI 2 "register_operand" "a")
1165 (match_operand:SI 3 "pos_scale_operand" "i"))))]
1167 "%0 = %1 + (%2 << %3);"
1168 [(set_attr "type" "alu0")])
1171 [(set (match_operand:SI 0 "register_operand" "=a")
1172 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "a")
1173 (match_operand:SI 2 "scale_by_operand" "i"))
1174 (match_operand:SI 3 "register_operand" "a")))]
1176 "%0 = %3 + (%1 << %X2);"
1177 [(set_attr "type" "alu0")])
1180 [(set (match_operand:SI 0 "register_operand" "=a")
1181 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "a")
1182 (match_operand:SI 2 "pos_scale_operand" "i"))
1183 (match_operand:SI 3 "register_operand" "a")))]
1185 "%0 = %3 + (%1 << %2);"
1186 [(set_attr "type" "alu0")])
1188 (define_insn "mulhisi3"
1189 [(set (match_operand:SI 0 "register_operand" "=d")
1190 (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%d"))
1191 (sign_extend:SI (match_operand:HI 2 "register_operand" "d"))))]
1193 "%0 = %h1 * %h2 (IS)%!"
1194 [(set_attr "type" "dsp32")])
1196 (define_insn "umulhisi3"
1197 [(set (match_operand:SI 0 "register_operand" "=d")
1198 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%d"))
1199 (zero_extend:SI (match_operand:HI 2 "register_operand" "d"))))]
1201 "%0 = %h1 * %h2 (FU)%!"
1202 [(set_attr "type" "dsp32")])
1204 (define_insn "usmulhisi3"
1205 [(set (match_operand:SI 0 "register_operand" "=W")
1206 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "W"))
1207 (sign_extend:SI (match_operand:HI 2 "register_operand" "W"))))]
1209 "%0 = %h2 * %h1 (IS,M)%!"
1210 [(set_attr "type" "dsp32")])
1212 ;; The alternative involving IREGS requires that the corresponding L register
1215 (define_insn "addsi3"
1216 [(set (match_operand:SI 0 "register_operand" "=ad,a,d,b")
1217 (plus:SI (match_operand:SI 1 "register_operand" "%0, a,d,0")
1218 (match_operand:SI 2 "reg_or_7bit_operand" "Ks7, a,d,fP2P4")))]
1225 [(set_attr "type" "alu0")
1226 (set_attr "length" "2,2,2,2")])
1228 (define_insn "ssaddsi3"
1229 [(set (match_operand:SI 0 "register_operand" "=d")
1230 (ss_plus:SI (match_operand:SI 1 "register_operand" "d")
1231 (match_operand:SI 2 "register_operand" "d")))]
1233 "%0 = %1 + %2 (S)%!"
1234 [(set_attr "type" "dsp32")])
1236 (define_insn "subsi3"
1237 [(set (match_operand:SI 0 "register_operand" "=da,d,a")
1238 (minus:SI (match_operand:SI 1 "register_operand" "0,d,0")
1239 (match_operand:SI 2 "reg_or_neg7bit_operand" "KN7,d,a")))]
1242 static const char *const strings_subsi3[] = {
1248 if (CONSTANT_P (operands[2]) && INTVAL (operands[2]) < 0) {
1249 rtx tmp_op = operands[2];
1250 operands[2] = GEN_INT (-INTVAL (operands[2]));
1251 output_asm_insn ("%0 += %2;", operands);
1252 operands[2] = tmp_op;
1256 return strings_subsi3[which_alternative];
1258 [(set_attr "type" "alu0")])
1260 (define_insn "sssubsi3"
1261 [(set (match_operand:SI 0 "register_operand" "=d")
1262 (ss_minus:SI (match_operand:SI 1 "register_operand" "d")
1263 (match_operand:SI 2 "register_operand" "d")))]
1265 "%0 = %1 - %2 (S)%!"
1266 [(set_attr "type" "dsp32")])
1268 ;; Accumulator addition
1270 (define_insn "addpdi3"
1271 [(set (match_operand:PDI 0 "register_operand" "=A")
1272 (ss_plus:PDI (match_operand:PDI 1 "register_operand" "%0")
1273 (match_operand:PDI 2 "nonmemory_operand" "B")))]
1276 [(set_attr "type" "dsp32")])
1278 (define_insn "sum_of_accumulators"
1279 [(set (match_operand:SI 0 "register_operand" "=d")
1281 (ss_plus:PDI (match_operand:PDI 2 "register_operand" "1")
1282 (match_operand:PDI 3 "register_operand" "B"))))
1283 (set (match_operand:PDI 1 "register_operand" "=A")
1284 (ss_plus:PDI (match_dup 2) (match_dup 3)))]
1287 [(set_attr "type" "dsp32")])
1289 (define_insn "us_truncpdisi2"
1290 [(set (match_operand:SI 0 "register_operand" "=D,W")
1291 (us_truncate:SI (match_operand:PDI 1 "register_operand" "A,B")))]
1294 [(set_attr "type" "dsp32")])
1296 ;; Bit test instructions
1298 (define_insn "*not_bittst"
1299 [(set (match_operand:BI 0 "register_operand" "=C")
1300 (eq:BI (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1302 (match_operand:SI 2 "immediate_operand" "Ku5"))
1305 "cc = !BITTST (%1,%2);"
1306 [(set_attr "type" "alu0")])
1308 (define_insn "*bittst"
1309 [(set (match_operand:BI 0 "register_operand" "=C")
1310 (ne:BI (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1312 (match_operand:SI 2 "immediate_operand" "Ku5"))
1315 "cc = BITTST (%1,%2);"
1316 [(set_attr "type" "alu0")])
1318 (define_insn_and_split "*bit_extract"
1319 [(set (match_operand:SI 0 "register_operand" "=d")
1320 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1322 (match_operand:SI 2 "immediate_operand" "Ku5")))
1323 (clobber (reg:BI REG_CC))]
1327 [(set (reg:BI REG_CC)
1328 (ne:BI (zero_extract:SI (match_dup 1) (const_int 1) (match_dup 2))
1331 (ne:SI (reg:BI REG_CC) (const_int 0)))])
1333 (define_insn_and_split "*not_bit_extract"
1334 [(set (match_operand:SI 0 "register_operand" "=d")
1335 (zero_extract:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
1337 (match_operand:SI 2 "immediate_operand" "Ku5")))
1338 (clobber (reg:BI REG_CC))]
1342 [(set (reg:BI REG_CC)
1343 (eq:BI (zero_extract:SI (match_dup 1) (const_int 1) (match_dup 2))
1346 (ne:SI (reg:BI REG_CC) (const_int 0)))])
1348 (define_insn "*andsi_insn"
1349 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
1350 (and:SI (match_operand:SI 1 "register_operand" "%0,d,d,d")
1351 (match_operand:SI 2 "rhs_andsi3_operand" "L,M1,M2,d")))]
1358 [(set_attr "type" "alu0")])
1360 (define_expand "andsi3"
1361 [(set (match_operand:SI 0 "register_operand" "")
1362 (and:SI (match_operand:SI 1 "register_operand" "")
1363 (match_operand:SI 2 "general_operand" "")))]
1366 if (highbits_operand (operands[2], SImode))
1368 operands[2] = GEN_INT (exact_log2 (-INTVAL (operands[2])));
1369 emit_insn (gen_ashrsi3 (operands[0], operands[1], operands[2]));
1370 emit_insn (gen_ashlsi3 (operands[0], operands[0], operands[2]));
1373 if (! rhs_andsi3_operand (operands[2], SImode))
1374 operands[2] = force_reg (SImode, operands[2]);
1377 (define_insn "iorsi3"
1378 [(set (match_operand:SI 0 "register_operand" "=d,d")
1379 (ior:SI (match_operand:SI 1 "register_operand" "%0,d")
1380 (match_operand:SI 2 "regorlog2_operand" "J,d")))]
1385 [(set_attr "type" "alu0")])
1387 (define_insn "xorsi3"
1388 [(set (match_operand:SI 0 "register_operand" "=d,d")
1389 (xor:SI (match_operand:SI 1 "register_operand" "%0,d")
1390 (match_operand:SI 2 "regorlog2_operand" "J,d")))]
1395 [(set_attr "type" "alu0")])
1398 [(set (match_operand:HI 0 "register_operand" "=d")
1399 (unspec:HI [(match_operand:SI 1 "register_operand" "d")]
1403 [(set_attr "type" "alu0")])
1405 (define_insn "smaxsi3"
1406 [(set (match_operand:SI 0 "register_operand" "=d")
1407 (smax:SI (match_operand:SI 1 "register_operand" "d")
1408 (match_operand:SI 2 "register_operand" "d")))]
1411 [(set_attr "type" "dsp32")])
1413 (define_insn "sminsi3"
1414 [(set (match_operand:SI 0 "register_operand" "=d")
1415 (smin:SI (match_operand:SI 1 "register_operand" "d")
1416 (match_operand:SI 2 "register_operand" "d")))]
1419 [(set_attr "type" "dsp32")])
1421 (define_insn "abssi2"
1422 [(set (match_operand:SI 0 "register_operand" "=d")
1423 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
1426 [(set_attr "type" "dsp32")])
1428 (define_insn "ssabssi2"
1429 [(set (match_operand:SI 0 "register_operand" "=d")
1430 (ss_abs:SI (match_operand:SI 1 "register_operand" "d")))]
1433 [(set_attr "type" "dsp32")])
1435 (define_insn "negsi2"
1436 [(set (match_operand:SI 0 "register_operand" "=d")
1437 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1440 [(set_attr "type" "alu0")])
1442 (define_insn "ssnegsi2"
1443 [(set (match_operand:SI 0 "register_operand" "=d")
1444 (ss_neg:SI (match_operand:SI 1 "register_operand" "d")))]
1447 [(set_attr "type" "dsp32")])
1449 (define_insn "one_cmplsi2"
1450 [(set (match_operand:SI 0 "register_operand" "=d")
1451 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1454 [(set_attr "type" "alu0")])
1456 (define_expand "clrsbsi2"
1458 (truncate:HI (clrsb:SI (match_operand:SI 1 "register_operand" "d"))))
1459 (set (match_operand:SI 0 "register_operand")
1460 (zero_extend:SI (match_dup 2)))]
1463 operands[2] = gen_reg_rtx (HImode);
1466 (define_insn "signbitssi2"
1467 [(set (match_operand:HI 0 "register_operand" "=d")
1468 (truncate:HI (clrsb:SI (match_operand:SI 1 "register_operand" "d"))))]
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 "clrsbhi2"
1521 [(set (match_operand:HI 0 "register_operand" "=d")
1522 (clrsb:HI (match_operand:HI 1 "register_operand" "d")))]
1524 "%h0 = signbits %h1%!"
1525 [(set_attr "type" "dsp32")])
1527 (define_insn "mulsi3"
1528 [(set (match_operand:SI 0 "register_operand" "=d")
1529 (mult:SI (match_operand:SI 1 "register_operand" "%0")
1530 (match_operand:SI 2 "register_operand" "d")))]
1533 [(set_attr "type" "mult")])
1535 (define_expand "umulsi3_highpart"
1537 [(set (match_operand:SI 0 "register_operand" "")
1540 (mult:DI (zero_extend:DI
1541 (match_operand:SI 1 "nonimmediate_operand" ""))
1543 (match_operand:SI 2 "register_operand" "")))
1545 (clobber (reg:PDI REG_A0))
1546 (clobber (reg:PDI REG_A1))])]
1551 rtx a1reg = gen_rtx_REG (PDImode, REG_A1);
1552 rtx a0reg = gen_rtx_REG (PDImode, REG_A0);
1553 emit_insn (gen_flag_macinit1hi (a1reg,
1554 gen_lowpart (HImode, operands[1]),
1555 gen_lowpart (HImode, operands[2]),
1556 GEN_INT (MACFLAG_FU)));
1557 emit_insn (gen_lshrpdi3 (a1reg, a1reg, GEN_INT (16)));
1558 emit_insn (gen_flag_mul_macv2hi_parts_acconly (a0reg, a1reg,
1559 gen_lowpart (V2HImode, operands[1]),
1560 gen_lowpart (V2HImode, operands[2]),
1561 const1_rtx, const1_rtx,
1562 const1_rtx, const0_rtx, a1reg,
1563 const0_rtx, GEN_INT (MACFLAG_FU),
1564 GEN_INT (MACFLAG_FU)));
1565 emit_insn (gen_flag_machi_parts_acconly (a1reg,
1566 gen_lowpart (V2HImode, operands[2]),
1567 gen_lowpart (V2HImode, operands[1]),
1568 const1_rtx, const0_rtx,
1569 a1reg, const0_rtx, GEN_INT (MACFLAG_FU)));
1570 emit_insn (gen_lshrpdi3 (a1reg, a1reg, GEN_INT (16)));
1571 emit_insn (gen_addpdi3 (a0reg, a0reg, a1reg));
1572 emit_insn (gen_us_truncpdisi2 (operands[0], a0reg));
1576 rtx umulsi3_highpart_libfunc
1577 = init_one_libfunc ("__umulsi3_highpart");
1579 emit_library_call_value (umulsi3_highpart_libfunc,
1580 operands[0], LCT_NORMAL, SImode,
1581 operands[1], SImode, operands[2], SImode);
1586 (define_expand "smulsi3_highpart"
1588 [(set (match_operand:SI 0 "register_operand" "")
1591 (mult:DI (sign_extend:DI
1592 (match_operand:SI 1 "nonimmediate_operand" ""))
1594 (match_operand:SI 2 "register_operand" "")))
1596 (clobber (reg:PDI REG_A0))
1597 (clobber (reg:PDI REG_A1))])]
1602 rtx a1reg = gen_rtx_REG (PDImode, REG_A1);
1603 rtx a0reg = gen_rtx_REG (PDImode, REG_A0);
1604 emit_insn (gen_flag_macinit1hi (a1reg,
1605 gen_lowpart (HImode, operands[1]),
1606 gen_lowpart (HImode, operands[2]),
1607 GEN_INT (MACFLAG_FU)));
1608 emit_insn (gen_lshrpdi3 (a1reg, a1reg, GEN_INT (16)));
1609 emit_insn (gen_flag_mul_macv2hi_parts_acconly (a0reg, a1reg,
1610 gen_lowpart (V2HImode, operands[1]),
1611 gen_lowpart (V2HImode, operands[2]),
1612 const1_rtx, const1_rtx,
1613 const1_rtx, const0_rtx, a1reg,
1614 const0_rtx, GEN_INT (MACFLAG_IS),
1615 GEN_INT (MACFLAG_IS_M)));
1616 emit_insn (gen_flag_machi_parts_acconly (a1reg,
1617 gen_lowpart (V2HImode, operands[2]),
1618 gen_lowpart (V2HImode, operands[1]),
1619 const1_rtx, const0_rtx,
1620 a1reg, const0_rtx, GEN_INT (MACFLAG_IS_M)));
1621 emit_insn (gen_ashrpdi3 (a1reg, a1reg, GEN_INT (16)));
1622 emit_insn (gen_sum_of_accumulators (operands[0], a0reg, a0reg, a1reg));
1626 rtx smulsi3_highpart_libfunc
1627 = init_one_libfunc ("__smulsi3_highpart");
1629 emit_library_call_value (smulsi3_highpart_libfunc,
1630 operands[0], LCT_NORMAL, SImode,
1631 operands[1], SImode, operands[2], SImode);
1636 (define_expand "ashlsi3"
1637 [(set (match_operand:SI 0 "register_operand" "")
1638 (ashift:SI (match_operand:SI 1 "register_operand" "")
1639 (match_operand:SI 2 "nonmemory_operand" "")))]
1642 if (GET_CODE (operands[2]) == CONST_INT
1643 && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
1645 emit_insn (gen_movsi (operands[0], const0_rtx));
1650 (define_insn_and_split "*ashlsi3_insn"
1651 [(set (match_operand:SI 0 "register_operand" "=d,d,a,a,a")
1652 (ashift:SI (match_operand:SI 1 "register_operand" "0,d,a,a,a")
1653 (match_operand:SI 2 "nonmemory_operand" "dKu5,Ku5,P1,P2,?P3P4")))]
1661 "PREG_P (operands[0]) && INTVAL (operands[2]) > 2"
1662 [(set (match_dup 0) (ashift:SI (match_dup 1) (const_int 2)))
1663 (set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 3)))]
1664 "operands[3] = GEN_INT (INTVAL (operands[2]) - 2);"
1665 [(set_attr "type" "shft,dsp32shiftimm,shft,shft,*")])
1667 (define_insn "ashrsi3"
1668 [(set (match_operand:SI 0 "register_operand" "=d,d")
1669 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,d")
1670 (match_operand:SI 2 "nonmemory_operand" "dKu5,Ku5")))]
1675 [(set_attr "type" "shft,dsp32shiftimm")])
1677 (define_insn "rotl16"
1678 [(set (match_operand:SI 0 "register_operand" "=d")
1679 (rotate:SI (match_operand:SI 1 "register_operand" "d")
1682 "%0 = PACK (%h1, %d1)%!"
1683 [(set_attr "type" "dsp32")])
1685 (define_expand "rotlsi3"
1686 [(set (match_operand:SI 0 "register_operand" "")
1687 (rotate:SI (match_operand:SI 1 "register_operand" "")
1688 (match_operand:SI 2 "const_int_operand" "")))]
1691 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 16)
1695 (define_expand "rotrsi3"
1696 [(set (match_operand:SI 0 "register_operand" "")
1697 (rotatert:SI (match_operand:SI 1 "register_operand" "")
1698 (match_operand:SI 2 "const_int_operand" "")))]
1701 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 16)
1703 emit_insn (gen_rotl16 (operands[0], operands[1]));
1708 (define_insn "ror_one"
1709 [(set (match_operand:SI 0 "register_operand" "=d")
1710 (ior:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
1711 (ashift:SI (zero_extend:SI (reg:BI REG_CC)) (const_int 31))))
1712 (set (reg:BI REG_CC)
1713 (zero_extract:BI (match_dup 1) (const_int 1) (const_int 0)))]
1715 "%0 = ROT %1 BY -1%!"
1716 [(set_attr "type" "dsp32shiftimm")])
1718 (define_insn "rol_one"
1719 [(set (match_operand:SI 0 "register_operand" "+d")
1720 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
1721 (zero_extend:SI (reg:BI REG_CC))))
1722 (set (reg:BI REG_CC)
1723 (zero_extract:BI (match_dup 1) (const_int 31) (const_int 0)))]
1725 "%0 = ROT %1 BY 1%!"
1726 [(set_attr "type" "dsp32shiftimm")])
1728 (define_expand "lshrdi3"
1729 [(set (match_operand:DI 0 "register_operand" "")
1730 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
1731 (match_operand:DI 2 "general_operand" "")))]
1734 rtx lo_half[2], hi_half[2];
1736 if (operands[2] != const1_rtx)
1738 if (! rtx_equal_p (operands[0], operands[1]))
1739 emit_move_insn (operands[0], operands[1]);
1741 split_di (operands, 2, lo_half, hi_half);
1743 emit_move_insn (bfin_cc_rtx, const0_rtx);
1744 emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
1745 emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
1749 (define_expand "ashrdi3"
1750 [(set (match_operand:DI 0 "register_operand" "")
1751 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
1752 (match_operand:DI 2 "general_operand" "")))]
1755 rtx lo_half[2], hi_half[2];
1757 if (operands[2] != const1_rtx)
1759 if (! rtx_equal_p (operands[0], operands[1]))
1760 emit_move_insn (operands[0], operands[1]);
1762 split_di (operands, 2, lo_half, hi_half);
1764 emit_insn (gen_compare_lt (gen_rtx_REG (BImode, REG_CC),
1765 hi_half[1], const0_rtx));
1766 emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
1767 emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
1771 (define_expand "ashldi3"
1772 [(set (match_operand:DI 0 "register_operand" "")
1773 (ashift:DI (match_operand:DI 1 "register_operand" "")
1774 (match_operand:DI 2 "general_operand" "")))]
1777 rtx lo_half[2], hi_half[2];
1779 if (operands[2] != const1_rtx)
1781 if (! rtx_equal_p (operands[0], operands[1]))
1782 emit_move_insn (operands[0], operands[1]);
1784 split_di (operands, 2, lo_half, hi_half);
1786 emit_move_insn (bfin_cc_rtx, const0_rtx);
1787 emit_insn (gen_rol_one (lo_half[0], lo_half[0]));
1788 emit_insn (gen_rol_one (hi_half[0], hi_half[0]));
1792 (define_insn "lshrsi3"
1793 [(set (match_operand:SI 0 "register_operand" "=d,d,a")
1794 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,d,a")
1795 (match_operand:SI 2 "nonmemory_operand" "dKu5,Ku5,P1P2")))]
1801 [(set_attr "type" "shft,dsp32shiftimm,shft")])
1803 (define_insn "lshrpdi3"
1804 [(set (match_operand:PDI 0 "register_operand" "=e")
1805 (lshiftrt:PDI (match_operand:PDI 1 "register_operand" "0")
1806 (match_operand:SI 2 "nonmemory_operand" "Ku5")))]
1809 [(set_attr "type" "dsp32shiftimm")])
1811 (define_insn "ashrpdi3"
1812 [(set (match_operand:PDI 0 "register_operand" "=e")
1813 (ashiftrt:PDI (match_operand:PDI 1 "register_operand" "0")
1814 (match_operand:SI 2 "nonmemory_operand" "Ku5")))]
1817 [(set_attr "type" "dsp32shiftimm")])
1819 ;; A pattern to reload the equivalent of
1820 ;; (set (Dreg) (plus (FP) (large_constant)))
1822 ;; (set (dagreg) (plus (FP) (arbitrary_constant)))
1823 ;; using a scratch register
1824 (define_expand "reload_insi"
1825 [(parallel [(set (match_operand:SI 0 "register_operand" "=w")
1826 (match_operand:SI 1 "fp_plus_const_operand" ""))
1827 (clobber (match_operand:SI 2 "register_operand" "=&a"))])]
1830 rtx fp_op = XEXP (operands[1], 0);
1831 rtx const_op = XEXP (operands[1], 1);
1832 rtx primary = operands[0];
1833 rtx scratch = operands[2];
1835 emit_move_insn (scratch, const_op);
1836 emit_insn (gen_addsi3 (scratch, scratch, fp_op));
1837 emit_move_insn (primary, scratch);
1841 (define_mode_iterator AREG [PDI V2PDI])
1843 (define_insn "reload_in<mode>"
1844 [(set (match_operand:AREG 0 "register_operand" "=e")
1845 (match_operand:AREG 1 "memory_operand" "m"))
1846 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1850 xops[0] = operands[0];
1851 xops[1] = operands[2];
1852 split_di (operands + 1, 1, xops + 2, xops + 3);
1853 output_asm_insn ("%1 = %2;", xops);
1854 output_asm_insn ("%w0 = %1;", xops);
1855 output_asm_insn ("%1 = %3;", xops);
1856 output_asm_insn ("%x0 = %1;", xops);
1859 [(set_attr "seq_insns" "multi")
1860 (set_attr "type" "mcld")
1861 (set_attr "length" "12")])
1863 (define_insn "reload_out<mode>"
1864 [(set (match_operand:AREG 0 "memory_operand" "=m")
1865 (match_operand:AREG 1 "register_operand" "e"))
1866 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1870 xops[0] = operands[1];
1871 xops[1] = operands[2];
1872 split_di (operands, 1, xops + 2, xops + 3);
1873 output_asm_insn ("%1 = %w0;", xops);
1874 output_asm_insn ("%2 = %1;", xops);
1875 output_asm_insn ("%1 = %x0;", xops);
1876 output_asm_insn ("%3 = %1;", xops);
1879 [(set_attr "seq_insns" "multi")
1880 (set_attr "type" "mcld")
1881 (set_attr "length" "12")])
1883 ;; Jump instructions
1887 (label_ref (match_operand 0 "" "")))]
1890 if (get_attr_length (insn) == 2)
1891 return "jump.s %0;";
1893 return "jump.l %0;";
1895 [(set_attr "type" "br")])
1897 (define_insn "indirect_jump"
1899 (match_operand:SI 0 "register_operand" "a"))]
1902 [(set_attr "type" "misc")])
1904 (define_expand "tablejump"
1905 [(parallel [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1906 (use (label_ref (match_operand 1 "" "")))])]
1909 /* In PIC mode, the table entries are stored PC relative.
1910 Convert the relative address to an absolute address. */
1913 rtx op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
1915 operands[0] = expand_simple_binop (Pmode, PLUS, operands[0],
1916 op1, NULL_RTX, 0, OPTAB_DIRECT);
1920 (define_insn "*tablejump_internal"
1921 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1922 (use (label_ref (match_operand 1 "" "")))]
1925 [(set_attr "type" "misc")])
1929 ; operand 0 is the loop count pseudo register
1930 ; operand 1 is the label to jump to at the top of the loop
1931 (define_expand "doloop_end"
1932 [(parallel [(set (pc) (if_then_else
1933 (ne (match_operand:SI 0 "" "")
1935 (label_ref (match_operand 1 "" ""))
1938 (plus:SI (match_dup 0)
1940 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1941 (clobber (match_dup 2))])] ; match_scratch
1944 /* The loop optimizer doesn't check the predicates... */
1945 if (GET_MODE (operands[0]) != SImode)
1947 bfin_hardware_loop ();
1948 operands[2] = gen_rtx_SCRATCH (SImode);
1951 (define_insn "loop_end"
1953 (if_then_else (ne (match_operand:SI 2 "nonimmediate_operand" "0,0,0")
1955 (label_ref (match_operand 1 "" ""))
1957 (set (match_operand:SI 0 "nonimmediate_operand" "=a*d,*b*v*f,m")
1960 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1961 (clobber (match_scratch:SI 3 "=X,&r,&r"))]
1964 /* loop end %0 %l1 */
1967 [(set_attr "length" "6,10,14")])
1971 (if_then_else (ne (match_operand:SI 0 "nondp_reg_or_memory_operand")
1973 (label_ref (match_operand 1 ""))
1978 (unspec [(const_int 0)] UNSPEC_LSETUP_END)
1979 (clobber (match_scratch:SI 2))]
1980 "memory_operand (operands[0], SImode) || splitting_loops"
1981 [(set (match_dup 2) (match_dup 0))
1982 (set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
1983 (set (match_dup 0) (match_dup 2))
1984 (set (reg:BI REG_CC) (eq:BI (match_dup 2) (const_int 0)))
1986 (if_then_else (eq (reg:BI REG_CC)
1988 (label_ref (match_dup 1))
1992 (define_insn "lsetup_with_autoinit"
1993 [(set (match_operand:SI 0 "lt_register_operand" "=t")
1994 (label_ref (match_operand 1 "" "")))
1995 (set (match_operand:SI 2 "lb_register_operand" "=u")
1996 (label_ref (match_operand 3 "" "")))
1997 (set (match_operand:SI 4 "lc_register_operand" "=k")
1998 (match_operand:SI 5 "register_operand" "a"))]
2000 "LSETUP (%1, %3) %4 = %5;"
2001 [(set_attr "length" "4")])
2003 (define_insn "lsetup_without_autoinit"
2004 [(set (match_operand:SI 0 "lt_register_operand" "=t")
2005 (label_ref (match_operand 1 "" "")))
2006 (set (match_operand:SI 2 "lb_register_operand" "=u")
2007 (label_ref (match_operand 3 "" "")))
2008 (use (match_operand:SI 4 "lc_register_operand" "k"))]
2010 "LSETUP (%1, %3) %4;"
2011 [(set_attr "length" "4")])
2013 ;; Call instructions..
2015 ;; The explicit MEM inside the UNSPEC prevents the compiler from moving
2016 ;; the load before a branch after a NULL test, or before a store that
2017 ;; initializes a function descriptor.
2019 (define_insn_and_split "load_funcdescsi"
2020 [(set (match_operand:SI 0 "register_operand" "=a")
2021 (unspec_volatile:SI [(mem:SI (match_operand:SI 1 "address_operand" "p"))]
2022 UNSPEC_VOLATILE_LOAD_FUNCDESC))]
2026 [(set (match_dup 0) (mem:SI (match_dup 1)))])
2028 (define_expand "call"
2029 [(parallel [(call (match_operand:SI 0 "" "")
2030 (match_operand 1 "" ""))
2031 (use (match_operand 2 "" ""))])]
2034 bfin_expand_call (NULL_RTX, operands[0], operands[1], operands[2], 0);
2038 (define_expand "sibcall"
2039 [(parallel [(call (match_operand:SI 0 "" "")
2040 (match_operand 1 "" ""))
2041 (use (match_operand 2 "" ""))
2045 bfin_expand_call (NULL_RTX, operands[0], operands[1], operands[2], 1);
2049 (define_expand "call_value"
2050 [(parallel [(set (match_operand 0 "register_operand" "")
2051 (call (match_operand:SI 1 "" "")
2052 (match_operand 2 "" "")))
2053 (use (match_operand 3 "" ""))])]
2056 bfin_expand_call (operands[0], operands[1], operands[2], operands[3], 0);
2060 (define_expand "sibcall_value"
2061 [(parallel [(set (match_operand 0 "register_operand" "")
2062 (call (match_operand:SI 1 "" "")
2063 (match_operand 2 "" "")))
2064 (use (match_operand 3 "" ""))
2068 bfin_expand_call (operands[0], operands[1], operands[2], operands[3], 1);
2072 (define_insn "*call_symbol_fdpic"
2073 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2074 (match_operand 1 "general_operand" "g"))
2075 (use (match_operand:SI 2 "register_operand" "Z"))
2076 (use (match_operand 3 "" ""))
2077 (clobber (reg:SI REG_RETS))]
2078 "! SIBLING_CALL_P (insn)
2079 && GET_CODE (operands[0]) == SYMBOL_REF
2080 && !bfin_longcall_p (operands[0], INTVAL (operands[3]))"
2082 [(set_attr "type" "call")
2083 (set_attr "length" "4")])
2085 (define_insn "*sibcall_symbol_fdpic"
2086 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2087 (match_operand 1 "general_operand" "g"))
2088 (use (match_operand:SI 2 "register_operand" "Z"))
2089 (use (match_operand 3 "" ""))
2091 "SIBLING_CALL_P (insn)
2092 && GET_CODE (operands[0]) == SYMBOL_REF
2093 && !bfin_longcall_p (operands[0], INTVAL (operands[3]))"
2095 [(set_attr "type" "br")
2096 (set_attr "length" "4")])
2098 (define_insn "*call_value_symbol_fdpic"
2099 [(set (match_operand 0 "register_operand" "=d")
2100 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2101 (match_operand 2 "general_operand" "g")))
2102 (use (match_operand:SI 3 "register_operand" "Z"))
2103 (use (match_operand 4 "" ""))
2104 (clobber (reg:SI REG_RETS))]
2105 "! SIBLING_CALL_P (insn)
2106 && GET_CODE (operands[1]) == SYMBOL_REF
2107 && !bfin_longcall_p (operands[1], INTVAL (operands[4]))"
2109 [(set_attr "type" "call")
2110 (set_attr "length" "4")])
2112 (define_insn "*sibcall_value_symbol_fdpic"
2113 [(set (match_operand 0 "register_operand" "=d")
2114 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2115 (match_operand 2 "general_operand" "g")))
2116 (use (match_operand:SI 3 "register_operand" "Z"))
2117 (use (match_operand 4 "" ""))
2119 "SIBLING_CALL_P (insn)
2120 && GET_CODE (operands[1]) == SYMBOL_REF
2121 && !bfin_longcall_p (operands[1], INTVAL (operands[4]))"
2123 [(set_attr "type" "br")
2124 (set_attr "length" "4")])
2126 (define_insn "*call_insn_fdpic"
2127 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "Y"))
2128 (match_operand 1 "general_operand" "g"))
2129 (use (match_operand:SI 2 "register_operand" "Z"))
2130 (use (match_operand 3 "" ""))
2131 (clobber (reg:SI REG_RETS))]
2132 "! SIBLING_CALL_P (insn)"
2134 [(set_attr "type" "call")
2135 (set_attr "length" "2")])
2137 (define_insn "*sibcall_insn_fdpic"
2138 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "Y"))
2139 (match_operand 1 "general_operand" "g"))
2140 (use (match_operand:SI 2 "register_operand" "Z"))
2141 (use (match_operand 3 "" ""))
2143 "SIBLING_CALL_P (insn)"
2145 [(set_attr "type" "br")
2146 (set_attr "length" "2")])
2148 (define_insn "*call_value_insn_fdpic"
2149 [(set (match_operand 0 "register_operand" "=d")
2150 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "Y"))
2151 (match_operand 2 "general_operand" "g")))
2152 (use (match_operand:SI 3 "register_operand" "Z"))
2153 (use (match_operand 4 "" ""))
2154 (clobber (reg:SI REG_RETS))]
2155 "! SIBLING_CALL_P (insn)"
2157 [(set_attr "type" "call")
2158 (set_attr "length" "2")])
2160 (define_insn "*sibcall_value_insn_fdpic"
2161 [(set (match_operand 0 "register_operand" "=d")
2162 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "Y"))
2163 (match_operand 2 "general_operand" "g")))
2164 (use (match_operand:SI 3 "register_operand" "Z"))
2165 (use (match_operand 4 "" ""))
2167 "SIBLING_CALL_P (insn)"
2169 [(set_attr "type" "br")
2170 (set_attr "length" "2")])
2172 (define_insn "*call_symbol"
2173 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2174 (match_operand 1 "general_operand" "g"))
2175 (use (match_operand 2 "" ""))
2176 (clobber (reg:SI REG_RETS))]
2177 "! SIBLING_CALL_P (insn)
2178 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2179 && GET_CODE (operands[0]) == SYMBOL_REF
2180 && !bfin_longcall_p (operands[0], INTVAL (operands[2]))"
2182 [(set_attr "type" "call")
2183 (set_attr "length" "4")])
2185 (define_insn "*sibcall_symbol"
2186 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "Q"))
2187 (match_operand 1 "general_operand" "g"))
2188 (use (match_operand 2 "" ""))
2190 "SIBLING_CALL_P (insn)
2191 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2192 && GET_CODE (operands[0]) == SYMBOL_REF
2193 && !bfin_longcall_p (operands[0], INTVAL (operands[2]))"
2195 [(set_attr "type" "br")
2196 (set_attr "length" "4")])
2198 (define_insn "*call_value_symbol"
2199 [(set (match_operand 0 "register_operand" "=d")
2200 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2201 (match_operand 2 "general_operand" "g")))
2202 (use (match_operand 3 "" ""))
2203 (clobber (reg:SI REG_RETS))]
2204 "! SIBLING_CALL_P (insn)
2205 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2206 && GET_CODE (operands[1]) == SYMBOL_REF
2207 && !bfin_longcall_p (operands[1], INTVAL (operands[3]))"
2209 [(set_attr "type" "call")
2210 (set_attr "length" "4")])
2212 (define_insn "*sibcall_value_symbol"
2213 [(set (match_operand 0 "register_operand" "=d")
2214 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "Q"))
2215 (match_operand 2 "general_operand" "g")))
2216 (use (match_operand 3 "" ""))
2218 "SIBLING_CALL_P (insn)
2219 && (!TARGET_ID_SHARED_LIBRARY || TARGET_LEAF_ID_SHARED_LIBRARY)
2220 && GET_CODE (operands[1]) == SYMBOL_REF
2221 && !bfin_longcall_p (operands[1], INTVAL (operands[3]))"
2223 [(set_attr "type" "br")
2224 (set_attr "length" "4")])
2226 (define_insn "*call_insn"
2227 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "a"))
2228 (match_operand 1 "general_operand" "g"))
2229 (use (match_operand 2 "" ""))
2230 (clobber (reg:SI REG_RETS))]
2231 "! SIBLING_CALL_P (insn)"
2233 [(set_attr "type" "call")
2234 (set_attr "length" "2")])
2236 (define_insn "*sibcall_insn"
2237 [(call (mem:SI (match_operand:SI 0 "register_no_elim_operand" "z"))
2238 (match_operand 1 "general_operand" "g"))
2239 (use (match_operand 2 "" ""))
2241 "SIBLING_CALL_P (insn)"
2243 [(set_attr "type" "br")
2244 (set_attr "length" "2")])
2246 (define_insn "*call_value_insn"
2247 [(set (match_operand 0 "register_operand" "=d")
2248 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "a"))
2249 (match_operand 2 "general_operand" "g")))
2250 (use (match_operand 3 "" ""))
2251 (clobber (reg:SI REG_RETS))]
2252 "! SIBLING_CALL_P (insn)"
2254 [(set_attr "type" "call")
2255 (set_attr "length" "2")])
2257 (define_insn "*sibcall_value_insn"
2258 [(set (match_operand 0 "register_operand" "=d")
2259 (call (mem:SI (match_operand:SI 1 "register_no_elim_operand" "z"))
2260 (match_operand 2 "general_operand" "g")))
2261 (use (match_operand 3 "" ""))
2263 "SIBLING_CALL_P (insn)"
2265 [(set_attr "type" "br")
2266 (set_attr "length" "2")])
2268 ;; Block move patterns
2270 ;; We cheat. This copies one more word than operand 2 indicates.
2272 (define_insn "rep_movsi"
2273 [(set (match_operand:SI 0 "register_operand" "=&a")
2274 (plus:SI (plus:SI (match_operand:SI 3 "register_operand" "0")
2275 (ashift:SI (match_operand:SI 2 "register_operand" "a")
2278 (set (match_operand:SI 1 "register_operand" "=&b")
2279 (plus:SI (plus:SI (match_operand:SI 4 "register_operand" "1")
2280 (ashift:SI (match_dup 2) (const_int 2)))
2282 (set (mem:BLK (match_dup 3))
2283 (mem:BLK (match_dup 4)))
2285 (clobber (match_scratch:HI 5 "=&d"))
2286 (clobber (reg:SI REG_LT1))
2287 (clobber (reg:SI REG_LC1))
2288 (clobber (reg:SI REG_LB1))]
2290 "%5 = [%4++]; lsetup (1f, 1f) LC1 = %2; 1: MNOP || [%3++] = %5 || %5 = [%4++]; [%3++] = %5;"
2291 [(set_attr "type" "misc")
2292 (set_attr "length" "16")
2293 (set_attr "seq_insns" "multi")])
2295 (define_insn "rep_movhi"
2296 [(set (match_operand:SI 0 "register_operand" "=&a")
2297 (plus:SI (plus:SI (match_operand:SI 3 "register_operand" "0")
2298 (ashift:SI (match_operand:SI 2 "register_operand" "a")
2301 (set (match_operand:SI 1 "register_operand" "=&b")
2302 (plus:SI (plus:SI (match_operand:SI 4 "register_operand" "1")
2303 (ashift:SI (match_dup 2) (const_int 1)))
2305 (set (mem:BLK (match_dup 3))
2306 (mem:BLK (match_dup 4)))
2308 (clobber (match_scratch:HI 5 "=&d"))
2309 (clobber (reg:SI REG_LT1))
2310 (clobber (reg:SI REG_LC1))
2311 (clobber (reg:SI REG_LB1))]
2313 "%h5 = W[%4++]; lsetup (1f, 1f) LC1 = %2; 1: MNOP || W [%3++] = %5 || %h5 = W [%4++]; W [%3++] = %5;"
2314 [(set_attr "type" "misc")
2315 (set_attr "length" "16")
2316 (set_attr "seq_insns" "multi")])
2318 (define_expand "movmemsi"
2319 [(match_operand:BLK 0 "general_operand" "")
2320 (match_operand:BLK 1 "general_operand" "")
2321 (match_operand:SI 2 "const_int_operand" "")
2322 (match_operand:SI 3 "const_int_operand" "")]
2325 if (bfin_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
2330 ;; Conditional branch patterns
2331 ;; The Blackfin has only few condition codes: eq, lt, lte, ltu, leu
2333 (define_insn "compare_eq"
2334 [(set (match_operand:BI 0 "register_operand" "=C,C")
2335 (eq:BI (match_operand:SI 1 "register_operand" "d,a")
2336 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2339 [(set_attr "type" "compare")])
2341 (define_insn "compare_ne"
2342 [(set (match_operand:BI 0 "register_operand" "=C,C")
2343 (ne:BI (match_operand:SI 1 "register_operand" "d,a")
2344 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2347 [(set_attr "type" "compare")])
2349 (define_insn "compare_lt"
2350 [(set (match_operand:BI 0 "register_operand" "=C,C")
2351 (lt:BI (match_operand:SI 1 "register_operand" "d,a")
2352 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2355 [(set_attr "type" "compare")])
2357 (define_insn "compare_le"
2358 [(set (match_operand:BI 0 "register_operand" "=C,C")
2359 (le:BI (match_operand:SI 1 "register_operand" "d,a")
2360 (match_operand:SI 2 "reg_or_const_int_operand" "dKs3,aKs3")))]
2363 [(set_attr "type" "compare")])
2365 (define_insn "compare_leu"
2366 [(set (match_operand:BI 0 "register_operand" "=C,C")
2367 (leu:BI (match_operand:SI 1 "register_operand" "d,a")
2368 (match_operand:SI 2 "reg_or_const_int_operand" "dKu3,aKu3")))]
2371 [(set_attr "type" "compare")])
2373 (define_insn "compare_ltu"
2374 [(set (match_operand:BI 0 "register_operand" "=C,C")
2375 (ltu:BI (match_operand:SI 1 "register_operand" "d,a")
2376 (match_operand:SI 2 "reg_or_const_int_operand" "dKu3,aKu3")))]
2379 [(set_attr "type" "compare")])
2381 ;; Same as above, but and CC with the overflow bit generated by the first
2383 (define_insn "flag_mul_macv2hi_parts_acconly_andcc0"
2384 [(set (match_operand:PDI 0 "register_operand" "=B,e,e")
2385 (unspec:PDI [(vec_select:HI
2386 (match_operand:V2HI 2 "register_operand" "d,d,d")
2387 (parallel [(match_operand 4 "const01_operand" "P0P1,P0P1,P0P1")]))
2389 (match_operand:V2HI 3 "register_operand" "d,d,d")
2390 (parallel [(match_operand 6 "const01_operand" "P0P1,P0P1,P0P1")]))
2391 (match_operand 10 "const_int_operand" "PB,PA,PA")]
2392 UNSPEC_MUL_WITH_FLAG))
2393 (set (match_operand:PDI 1 "register_operand" "=B,e,e")
2394 (unspec:PDI [(vec_select:HI
2396 (parallel [(match_operand 5 "const01_operand" "P0P1,P0P1,P0P1")]))
2399 (parallel [(match_operand 7 "const01_operand" "P0P1,P0P1,P0P1")]))
2400 (match_operand:PDI 8 "register_operand" "1,1,1")
2401 (match_operand 9 "const01_operand" "P0P1,P0P1,P0P1")
2402 (match_operand 11 "const_int_operand" "PA,PB,PA")]
2403 UNSPEC_MAC_WITH_FLAG))
2404 (set (reg:BI REG_CC)
2405 (and:BI (reg:BI REG_CC)
2406 (unspec:BI [(vec_select:HI (match_dup 2) (parallel [(match_dup 4)]))
2407 (vec_select:HI (match_dup 3) (parallel [(match_dup 6)]))
2409 UNSPEC_MUL_WITH_FLAG)))]
2410 "MACFLAGS_MATCH_P (INTVAL (operands[10]), INTVAL (operands[11]))"
2413 const char *templates[] = {
2414 "%0 = %h2 * %h3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2415 "%0 = %d2 * %h3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2416 "%0 = %h2 * %h3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2417 "%0 = %d2 * %h3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2418 "%0 = %h2 * %d3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2419 "%0 = %d2 * %d3, %1 %b4 %h2 * %h3 %M5;\n\tCC &= %v0;",
2420 "%0 = %h2 * %d3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2421 "%0 = %d2 * %d3, %1 %b4 %d2 * %h3 %M5;\n\tCC &= %v0;",
2422 "%0 = %h2 * %h3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2423 "%0 = %d2 * %h3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2424 "%0 = %h2 * %h3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;",
2425 "%0 = %d2 * %h3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;",
2426 "%0 = %h2 * %d3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2427 "%0 = %d2 * %d3, %1 %b4 %h2 * %d3 %M5;\n\tCC &= %v0;",
2428 "%0 = %h2 * %d3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;",
2429 "%0 = %d2 * %d3, %1 %b4 %d2 * %d3 %M5;\n\tCC &= %v0;" };
2430 int alt = (INTVAL (operands[4]) + (INTVAL (operands[5]) << 1)
2431 + (INTVAL (operands[6]) << 2) + (INTVAL (operands[7]) << 3));
2432 xops[0] = operands[0];
2433 xops[1] = operands[1];
2434 xops[2] = operands[2];
2435 xops[3] = operands[3];
2436 xops[4] = operands[9];
2437 xops[5] = which_alternative == 0 ? operands[10] : operands[11];
2438 output_asm_insn (templates[alt], xops);
2441 [(set_attr "type" "misc")
2442 (set_attr "length" "6")
2443 (set_attr "seq_insns" "multi")])
2445 (define_expand "cbranchsi4"
2447 (if_then_else (match_operator 0 "ordered_comparison_operator"
2448 [(match_operand:SI 1 "register_operand" "")
2449 (match_operand:SI 2 "reg_or_const_int_operand" "")])
2450 (label_ref (match_operand 3 "" ""))
2454 rtx bi_compare = bfin_gen_compare (operands[0], SImode);
2455 emit_jump_insn (gen_cbranchbi4 (bi_compare, bfin_cc_rtx, CONST0_RTX (BImode),
2460 (define_insn "cbranchbi4"
2463 (match_operator 0 "bfin_bimode_comparison_operator"
2464 [(match_operand:BI 1 "register_operand" "C")
2465 (match_operand:BI 2 "immediate_operand" "P0")])
2466 (label_ref (match_operand 3 "" ""))
2470 asm_conditional_branch (insn, operands, 0, 0);
2473 [(set_attr "type" "brcc")])
2475 ;; Special cbranch patterns to deal with the speculative load problem - see
2476 ;; bfin_reorg for details.
2478 (define_insn "cbranch_predicted_taken"
2481 (match_operator 0 "bfin_bimode_comparison_operator"
2482 [(match_operand:BI 1 "register_operand" "C")
2483 (match_operand:BI 2 "immediate_operand" "P0")])
2484 (label_ref (match_operand 3 "" ""))
2486 (unspec [(const_int 0)] UNSPEC_CBRANCH_TAKEN)]
2489 asm_conditional_branch (insn, operands, 0, 1);
2492 [(set_attr "type" "brcc")])
2494 (define_insn "cbranch_with_nops"
2497 (match_operator 0 "bfin_bimode_comparison_operator"
2498 [(match_operand:BI 1 "register_operand" "C")
2499 (match_operand:BI 2 "immediate_operand" "P0")])
2500 (label_ref (match_operand 3 "" ""))
2502 (unspec [(match_operand 4 "immediate_operand" "")] UNSPEC_CBRANCH_NOPS)]
2505 asm_conditional_branch (insn, operands, INTVAL (operands[4]), 0);
2508 [(set_attr "type" "brcc")
2509 (set_attr "length" "8")])
2513 (define_expand "cstorebi4"
2515 (match_operator:BI 1 "bfin_bimode_comparison_operator"
2516 [(match_operand:BI 2 "register_operand" "")
2517 (match_operand:BI 3 "reg_or_const_int_operand" "")]))
2518 (set (match_operand:SI 0 "register_operand" "")
2519 (ne:SI (match_dup 4) (const_int 0)))]
2522 /* It could be expanded as a movbisi instruction, but the portable
2523 alternative produces better code. */
2524 if (GET_CODE (operands[1]) == NE)
2527 operands[4] = bfin_cc_rtx;
2530 (define_expand "cstoresi4"
2531 [(set (match_operand:SI 0 "register_operand")
2532 (match_operator:SI 1 "ordered_comparison_operator"
2533 [(match_operand:SI 2 "register_operand" "")
2534 (match_operand:SI 3 "reg_or_const_int_operand" "")]))]
2537 rtx bi_compare, test;
2539 if (!bfin_direct_comparison_operator (operands[1], SImode))
2541 if (!register_operand (operands[3], SImode)
2542 || GET_CODE (operands[1]) == NE)
2544 test = gen_rtx_fmt_ee (swap_condition (GET_CODE (operands[1])),
2545 SImode, operands[3], operands[2]);
2550 bi_compare = bfin_gen_compare (test, SImode);
2551 gcc_assert (GET_CODE (bi_compare) == NE);
2552 emit_insn (gen_movbisi (operands[0], bfin_cc_rtx));
2561 ;; A nop which stays there when emitted.
2562 (define_insn "forced_nop"
2563 [(unspec [(const_int 0)] UNSPEC_NOP)]
2568 [(unspec [(const_int 0)] UNSPEC_32BIT)]
2571 [(set_attr "type" "dsp32")])
2573 ;;;;;;;;;;;;;;;;;;;; CC2dreg ;;;;;;;;;;;;;;;;;;;;;;;;;
2574 (define_insn "movsibi"
2575 [(set (match_operand:BI 0 "register_operand" "=C")
2576 (ne:BI (match_operand:SI 1 "register_operand" "d")
2580 [(set_attr "length" "2")])
2582 (define_insn_and_split "movbisi"
2583 [(set (match_operand:SI 0 "register_operand" "=d")
2584 (ne:SI (match_operand:BI 1 "register_operand" "C")
2589 [(set (match_operand:SI 0 "register_operand" "")
2590 (zero_extend:SI (match_operand:BI 1 "register_operand" "")))]
2593 (define_insn "notbi"
2594 [(set (match_operand:BI 0 "register_operand" "=C")
2595 (eq:BI (match_operand:BI 1 "register_operand" " 0")
2598 "%0 = ! %0;" /* NOT CC;" */
2599 [(set_attr "type" "compare")])
2601 ;; Vector and DSP insns
2604 [(set (match_operand:SI 0 "register_operand" "=d")
2605 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2607 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2610 "%0 = ALIGN8(%1, %2)%!"
2611 [(set_attr "type" "dsp32")])
2614 [(set (match_operand:SI 0 "register_operand" "=d")
2615 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2617 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2620 "%0 = ALIGN16(%1, %2)%!"
2621 [(set_attr "type" "dsp32")])
2624 [(set (match_operand:SI 0 "register_operand" "=d")
2625 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d")
2627 (lshiftrt:SI (match_operand:SI 2 "register_operand" "d")
2630 "%0 = ALIGN24(%1, %2)%!"
2631 [(set_attr "type" "dsp32")])
2633 ;; Prologue and epilogue.
2635 (define_expand "prologue"
2638 "bfin_expand_prologue (); DONE;")
2640 (define_expand "epilogue"
2643 "bfin_expand_epilogue (1, 0, 0); DONE;")
2645 (define_expand "sibcall_epilogue"
2648 "bfin_expand_epilogue (0, 0, 1); DONE;")
2650 (define_expand "eh_return"
2651 [(use (match_operand:SI 0 "register_operand" ""))]
2654 emit_insn (gen_eh_store_handler (EH_RETURN_HANDLER_RTX, operands[0]));
2655 emit_jump_insn (gen_eh_return_internal ());
2660 (define_insn "eh_store_handler"
2661 [(unspec_volatile [(match_operand:SI 1 "register_operand" "da")]
2662 UNSPEC_VOLATILE_STORE_EH_HANDLER)
2663 (clobber (match_operand:SI 0 "memory_operand" "=m"))]
2666 [(set_attr "type" "mcst")])
2668 (define_insn_and_split "eh_return_internal"
2672 "epilogue_completed"
2674 "bfin_expand_epilogue (1, 1, 0); DONE;")
2677 [(set (mem:SI (plus:SI (reg:SI REG_SP) (const_int -4))) (reg:SI REG_RETS))
2678 (set (mem:SI (plus:SI (reg:SI REG_SP) (const_int -8))) (reg:SI REG_FP))
2679 (set (reg:SI REG_FP)
2680 (plus:SI (reg:SI REG_SP) (const_int -8)))
2681 (set (reg:SI REG_SP)
2682 (plus:SI (reg:SI REG_SP) (match_operand:SI 0 "immediate_operand" "i")))]
2685 [(set_attr "length" "4")])
2687 (define_insn "unlink"
2688 [(set (reg:SI REG_FP) (mem:SI (reg:SI REG_FP)))
2689 (set (reg:SI REG_RETS) (mem:SI (plus:SI (reg:SI REG_FP) (const_int 4))))
2690 (set (reg:SI REG_SP) (plus:SI (reg:SI REG_FP) (const_int 8)))]
2693 [(set_attr "length" "4")])
2695 ;; This pattern is slightly clumsy. The stack adjust must be the final SET in
2696 ;; the pattern, otherwise dwarf2out becomes very confused about which reg goes
2697 ;; where on the stack, since it goes through all elements of the parallel in
2699 (define_insn "push_multiple"
2700 [(match_parallel 0 "push_multiple_operation"
2701 [(unspec [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_PUSH_MULTIPLE)])]
2704 output_push_multiple (insn, operands);
2708 (define_insn "pop_multiple"
2709 [(match_parallel 0 "pop_multiple_operation"
2710 [(set (reg:SI REG_SP)
2711 (plus:SI (reg:SI REG_SP) (match_operand:SI 1 "immediate_operand" "i")))])]
2714 output_pop_multiple (insn, operands);
2718 (define_insn "return_internal"
2720 (use (match_operand 0 "register_operand" ""))]
2723 switch (REGNO (operands[0]))
2737 ;; When used at a location where CC contains 1, causes a speculative load
2738 ;; that is later cancelled. This is used for certain workarounds in
2739 ;; interrupt handler prologues.
2740 (define_insn "dummy_load"
2741 [(unspec_volatile [(match_operand 0 "register_operand" "a")
2742 (match_operand 1 "register_operand" "C")]
2743 UNSPEC_VOLATILE_DUMMY)]
2745 "if cc jump 4;\n\tr7 = [%0];"
2746 [(set_attr "type" "misc")
2747 (set_attr "length" "4")
2748 (set_attr "seq_insns" "multi")])
2750 ;; A placeholder insn inserted before the final scheduling pass. It is used
2751 ;; to improve scheduling of loads when workarounds for speculative loads are
2752 ;; needed, by not placing them in the first few cycles after a conditional
2754 (define_insn "stall"
2755 [(unspec_volatile [(match_operand 0 "const_int_operand" "P1P3")]
2756 UNSPEC_VOLATILE_STALL)]
2759 [(set_attr "type" "stall")])
2761 (define_insn "csync"
2762 [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_CSYNC)]
2765 [(set_attr "type" "sync")])
2767 (define_insn "ssync"
2768 [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_SSYNC)]
2771 [(set_attr "type" "sync")])
2774 [(trap_if (const_int 1) (const_int 3))]
2777 [(set_attr "type" "misc")
2778 (set_attr "length" "2")])
2780 (define_insn "trapifcc"
2781 [(trap_if (reg:BI REG_CC) (const_int 3))]
2783 "if !cc jump 4 (bp); excpt 3;"
2784 [(set_attr "type" "misc")
2785 (set_attr "length" "4")
2786 (set_attr "seq_insns" "multi")])
2788 ;;; Vector instructions
2790 ;; First, all sorts of move variants
2792 (define_insn "movhiv2hi_low"
2793 [(set (match_operand:V2HI 0 "register_operand" "=d")
2795 (match_operand:HI 2 "register_operand" "d")
2796 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2797 (parallel [(const_int 1)]))))]
2800 [(set_attr "type" "dsp32shiftimm")])
2802 (define_insn "movhiv2hi_high"
2803 [(set (match_operand:V2HI 0 "register_operand" "=d")
2805 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2806 (parallel [(const_int 0)]))
2807 (match_operand:HI 2 "register_operand" "d")))]
2810 [(set_attr "type" "dsp32shiftimm")])
2812 ;; No earlyclobber on alternative two since our sequence ought to be safe.
2813 ;; The order of operands is intentional to match the VDSP builtin (high word
2814 ;; is passed first).
2815 (define_insn_and_split "composev2hi"
2816 [(set (match_operand:V2HI 0 "register_operand" "=d,d")
2817 (vec_concat:V2HI (match_operand:HI 2 "register_operand" "0,d")
2818 (match_operand:HI 1 "register_operand" "d,d")))]
2826 (vec_select:HI (match_dup 0) (parallel [(const_int 0)]))
2831 (vec_select:HI (match_dup 0) (parallel [(const_int 1)]))))]
2833 [(set_attr "type" "dsp32shiftimm")])
2835 ; Like composev2hi, but operating on elements of V2HI vectors.
2836 ; Useful on its own, and as a combiner bridge for the multiply and
2838 (define_insn "packv2hi"
2839 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d,d,d,d,d,d")
2840 (vec_concat:V2HI (vec_select:HI
2841 (match_operand:V2HI 1 "register_operand" "0,0,d,d,d,d,d,d")
2842 (parallel [(match_operand 3 "const01_operand" "P0,P0,P0,P1,P0,P1,P0,P1")]))
2844 (match_operand:V2HI 2 "register_operand" "d,d,0,0,d,d,d,d")
2845 (parallel [(match_operand 4 "const01_operand" "P0,P1,P1,P1,P0,P0,P1,P1")]))))]
2852 %0 = PACK (%h2,%h1)%!
2853 %0 = PACK (%h2,%d1)%!
2854 %0 = PACK (%d2,%h1)%!
2855 %0 = PACK (%d2,%d1)%!"
2856 [(set_attr "type" "dsp32shiftimm,dsp32shiftimm,dsp32shiftimm,dsp32shiftimm,dsp32,dsp32,dsp32,dsp32")])
2858 (define_insn "movv2hi_hi"
2859 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
2860 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0,d,d")
2861 (parallel [(match_operand 2 "const01_operand" "P0,P0,P1")])))]
2867 [(set_attr "type" "dsp32shiftimm")])
2869 (define_expand "movv2hi_hi_low"
2870 [(set (match_operand:HI 0 "register_operand" "")
2871 (vec_select:HI (match_operand:V2HI 1 "register_operand" "")
2872 (parallel [(const_int 0)])))]
2876 (define_expand "movv2hi_hi_high"
2877 [(set (match_operand:HI 0 "register_operand" "")
2878 (vec_select:HI (match_operand:V2HI 1 "register_operand" "")
2879 (parallel [(const_int 1)])))]
2883 ;; Unusual arithmetic operations on 16-bit registers.
2885 (define_code_iterator sp_or_sm [ss_plus ss_minus])
2886 (define_code_attr spm_string [(ss_plus "+") (ss_minus "-")])
2887 (define_code_attr spm_name [(ss_plus "add") (ss_minus "sub")])
2889 (define_insn "ss<spm_name>hi3"
2890 [(set (match_operand:HI 0 "register_operand" "=d")
2891 (sp_or_sm:HI (match_operand:HI 1 "register_operand" "d")
2892 (match_operand:HI 2 "register_operand" "d")))]
2894 "%h0 = %h1 <spm_string> %h2 (S)%!"
2895 [(set_attr "type" "dsp32")])
2897 (define_insn "ss<spm_name>hi3_parts"
2898 [(set (match_operand:HI 0 "register_operand" "=d")
2899 (sp_or_sm:HI (vec_select:HI
2900 (match_operand:V2HI 1 "register_operand" "d")
2901 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
2903 (match_operand:V2HI 2 "register_operand" "d")
2904 (parallel [(match_operand 4 "const01_operand" "P0P1")]))))]
2907 const char *templates[] = {
2908 "%h0 = %h1 <spm_string> %h2 (S)%!",
2909 "%h0 = %d1 <spm_string> %h2 (S)%!",
2910 "%h0 = %h1 <spm_string> %d2 (S)%!",
2911 "%h0 = %d1 <spm_string> %d2 (S)%!" };
2912 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
2913 return templates[alt];
2915 [(set_attr "type" "dsp32")])
2917 (define_insn "ss<spm_name>hi3_low_parts"
2918 [(set (match_operand:V2HI 0 "register_operand" "=d")
2920 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2921 (parallel [(const_int 0)]))
2922 (sp_or_sm:HI (vec_select:HI
2923 (match_operand:V2HI 2 "register_operand" "d")
2924 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
2926 (match_operand:V2HI 3 "register_operand" "d")
2927 (parallel [(match_operand 5 "const01_operand" "P0P1")])))))]
2930 const char *templates[] = {
2931 "%h0 = %h2 <spm_string> %h3 (S)%!",
2932 "%h0 = %d2 <spm_string> %h3 (S)%!",
2933 "%h0 = %h2 <spm_string> %d3 (S)%!",
2934 "%h0 = %d2 <spm_string> %d3 (S)%!" };
2935 int alt = INTVAL (operands[4]) + (INTVAL (operands[5]) << 1);
2936 return templates[alt];
2938 [(set_attr "type" "dsp32")])
2940 (define_insn "ss<spm_name>hi3_high_parts"
2941 [(set (match_operand:V2HI 0 "register_operand" "=d")
2943 (sp_or_sm:HI (vec_select:HI
2944 (match_operand:V2HI 2 "register_operand" "d")
2945 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
2947 (match_operand:V2HI 3 "register_operand" "d")
2948 (parallel [(match_operand 5 "const01_operand" "P0P1")])))
2949 (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
2950 (parallel [(const_int 1)]))))]
2953 const char *templates[] = {
2954 "%d0 = %h2 <spm_string> %h3 (S)%!",
2955 "%d0 = %d2 <spm_string> %h3 (S)%!",
2956 "%d0 = %h2 <spm_string> %d3 (S)%!",
2957 "%d0 = %d2 <spm_string> %d3 (S)%!" };
2958 int alt = INTVAL (operands[4]) + (INTVAL (operands[5]) << 1);
2959 return templates[alt];
2961 [(set_attr "type" "dsp32")])
2963 ;; V2HI vector insns
2965 (define_insn "addv2hi3"
2966 [(set (match_operand:V2HI 0 "register_operand" "=d")
2967 (plus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2968 (match_operand:V2HI 2 "register_operand" "d")))]
2971 [(set_attr "type" "dsp32")])
2973 (define_insn "ssaddv2hi3"
2974 [(set (match_operand:V2HI 0 "register_operand" "=d")
2975 (ss_plus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2976 (match_operand:V2HI 2 "register_operand" "d")))]
2978 "%0 = %1 +|+ %2 (S)%!"
2979 [(set_attr "type" "dsp32")])
2981 (define_insn "subv2hi3"
2982 [(set (match_operand:V2HI 0 "register_operand" "=d")
2983 (minus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2984 (match_operand:V2HI 2 "register_operand" "d")))]
2987 [(set_attr "type" "dsp32")])
2989 (define_insn "sssubv2hi3"
2990 [(set (match_operand:V2HI 0 "register_operand" "=d")
2991 (ss_minus:V2HI (match_operand:V2HI 1 "register_operand" "d")
2992 (match_operand:V2HI 2 "register_operand" "d")))]
2994 "%0 = %1 -|- %2 (S)%!"
2995 [(set_attr "type" "dsp32")])
2997 (define_insn "addsubv2hi3"
2998 [(set (match_operand:V2HI 0 "register_operand" "=d")
3000 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3001 (parallel [(const_int 0)]))
3002 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3003 (parallel [(const_int 0)])))
3004 (minus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3005 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3008 [(set_attr "type" "dsp32")])
3010 (define_insn "subaddv2hi3"
3011 [(set (match_operand:V2HI 0 "register_operand" "=d")
3013 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3014 (parallel [(const_int 0)]))
3015 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3016 (parallel [(const_int 0)])))
3017 (plus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3018 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3021 [(set_attr "type" "dsp32")])
3023 (define_insn "ssaddsubv2hi3"
3024 [(set (match_operand:V2HI 0 "register_operand" "=d")
3026 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3027 (parallel [(const_int 0)]))
3028 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3029 (parallel [(const_int 0)])))
3030 (ss_minus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3031 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3033 "%0 = %1 +|- %2 (S)%!"
3034 [(set_attr "type" "dsp32")])
3036 (define_insn "sssubaddv2hi3"
3037 [(set (match_operand:V2HI 0 "register_operand" "=d")
3039 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3040 (parallel [(const_int 0)]))
3041 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3042 (parallel [(const_int 0)])))
3043 (ss_plus:HI (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))
3044 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3046 "%0 = %1 -|+ %2 (S)%!"
3047 [(set_attr "type" "dsp32")])
3049 (define_insn "sublohiv2hi3"
3050 [(set (match_operand:HI 0 "register_operand" "=d")
3051 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3052 (parallel [(const_int 1)]))
3053 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3054 (parallel [(const_int 0)]))))]
3057 [(set_attr "type" "dsp32")])
3059 (define_insn "subhilov2hi3"
3060 [(set (match_operand:HI 0 "register_operand" "=d")
3061 (minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3062 (parallel [(const_int 0)]))
3063 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3064 (parallel [(const_int 1)]))))]
3067 [(set_attr "type" "dsp32")])
3069 (define_insn "sssublohiv2hi3"
3070 [(set (match_operand:HI 0 "register_operand" "=d")
3071 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3072 (parallel [(const_int 1)]))
3073 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3074 (parallel [(const_int 0)]))))]
3076 "%h0 = %d1 - %h2 (S)%!"
3077 [(set_attr "type" "dsp32")])
3079 (define_insn "sssubhilov2hi3"
3080 [(set (match_operand:HI 0 "register_operand" "=d")
3081 (ss_minus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3082 (parallel [(const_int 0)]))
3083 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3084 (parallel [(const_int 1)]))))]
3086 "%h0 = %h1 - %d2 (S)%!"
3087 [(set_attr "type" "dsp32")])
3089 (define_insn "addlohiv2hi3"
3090 [(set (match_operand:HI 0 "register_operand" "=d")
3091 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3092 (parallel [(const_int 1)]))
3093 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3094 (parallel [(const_int 0)]))))]
3097 [(set_attr "type" "dsp32")])
3099 (define_insn "addhilov2hi3"
3100 [(set (match_operand:HI 0 "register_operand" "=d")
3101 (plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3102 (parallel [(const_int 0)]))
3103 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3104 (parallel [(const_int 1)]))))]
3107 [(set_attr "type" "dsp32")])
3109 (define_insn "ssaddlohiv2hi3"
3110 [(set (match_operand:HI 0 "register_operand" "=d")
3111 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3112 (parallel [(const_int 1)]))
3113 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3114 (parallel [(const_int 0)]))))]
3116 "%h0 = %d1 + %h2 (S)%!"
3117 [(set_attr "type" "dsp32")])
3119 (define_insn "ssaddhilov2hi3"
3120 [(set (match_operand:HI 0 "register_operand" "=d")
3121 (ss_plus:HI (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3122 (parallel [(const_int 0)]))
3123 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3124 (parallel [(const_int 1)]))))]
3126 "%h0 = %h1 + %d2 (S)%!"
3127 [(set_attr "type" "dsp32")])
3129 (define_insn "sminv2hi3"
3130 [(set (match_operand:V2HI 0 "register_operand" "=d")
3131 (smin:V2HI (match_operand:V2HI 1 "register_operand" "d")
3132 (match_operand:V2HI 2 "register_operand" "d")))]
3134 "%0 = MIN (%1, %2) (V)%!"
3135 [(set_attr "type" "dsp32")])
3137 (define_insn "smaxv2hi3"
3138 [(set (match_operand:V2HI 0 "register_operand" "=d")
3139 (smax:V2HI (match_operand:V2HI 1 "register_operand" "d")
3140 (match_operand:V2HI 2 "register_operand" "d")))]
3142 "%0 = MAX (%1, %2) (V)%!"
3143 [(set_attr "type" "dsp32")])
3147 ;; The Blackfin allows a lot of different options, and we need many patterns to
3148 ;; cover most of the hardware's abilities.
3149 ;; There are a few simple patterns using MULT rtx codes, but most of them use
3150 ;; an unspec with a const_int operand that determines which flag to use in the
3152 ;; There are variants for single and parallel multiplications.
3153 ;; There are variants which just use 16-bit lowparts as inputs, and variants
3154 ;; which allow the user to choose just which halves to use as input values.
3155 ;; There are variants which set D registers, variants which set accumulators,
3156 ;; variants which set both, some of them optionally using the accumulators as
3157 ;; inputs for multiply-accumulate operations.
3159 (define_insn "flag_mulhi"
3160 [(set (match_operand:HI 0 "register_operand" "=d")
3161 (unspec:HI [(match_operand:HI 1 "register_operand" "d")
3162 (match_operand:HI 2 "register_operand" "d")
3163 (match_operand 3 "const_int_operand" "n")]
3164 UNSPEC_MUL_WITH_FLAG))]
3166 "%h0 = %h1 * %h2 %M3%!"
3167 [(set_attr "type" "dsp32")])
3169 (define_insn "flag_mulhi_parts"
3170 [(set (match_operand:HI 0 "register_operand" "=d")
3171 (unspec:HI [(vec_select:HI
3172 (match_operand:V2HI 1 "register_operand" "d")
3173 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3175 (match_operand:V2HI 2 "register_operand" "d")
3176 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
3177 (match_operand 5 "const_int_operand" "n")]
3178 UNSPEC_MUL_WITH_FLAG))]
3181 const char *templates[] = {
3182 "%h0 = %h1 * %h2 %M5%!",
3183 "%h0 = %d1 * %h2 %M5%!",
3184 "%h0 = %h1 * %d2 %M5%!",
3185 "%h0 = %d1 * %d2 %M5%!" };
3186 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
3187 return templates[alt];
3189 [(set_attr "type" "dsp32")])
3191 (define_insn "flag_mulhisi"
3192 [(set (match_operand:SI 0 "register_operand" "=d")
3193 (unspec:SI [(match_operand:HI 1 "register_operand" "d")
3194 (match_operand:HI 2 "register_operand" "d")
3195 (match_operand 3 "const_int_operand" "n")]
3196 UNSPEC_MUL_WITH_FLAG))]
3198 "%0 = %h1 * %h2 %M3%!"
3199 [(set_attr "type" "dsp32")])
3201 (define_insn "flag_mulhisi_parts"
3202 [(set (match_operand:SI 0 "register_operand" "=d")
3203 (unspec:SI [(vec_select:HI
3204 (match_operand:V2HI 1 "register_operand" "d")
3205 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3207 (match_operand:V2HI 2 "register_operand" "d")
3208 (parallel [(match_operand 4 "const01_operand" "P0P1")]))
3209 (match_operand 5 "const_int_operand" "n")]
3210 UNSPEC_MUL_WITH_FLAG))]
3213 const char *templates[] = {
3214 "%0 = %h1 * %h2 %M5%!",
3215 "%0 = %d1 * %h2 %M5%!",
3216 "%0 = %h1 * %d2 %M5%!",
3217 "%0 = %d1 * %d2 %M5%!" };
3218 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
3219 return templates[alt];
3221 [(set_attr "type" "dsp32")])
3223 ;; Three alternatives here to cover all possible allocations:
3224 ;; 0. mac flag is usable only for accumulator 1 - use A1 and odd DREG
3225 ;; 1. mac flag is usable for accumulator 0 - use A0 and even DREG
3226 ;; 2. mac flag is usable in any accumulator - use A1 and odd DREG
3227 ;; Other patterns which don't have a DREG destination can collapse cases
3228 ;; 1 and 2 into one.
3229 (define_insn "flag_machi"
3230 [(set (match_operand:HI 0 "register_operand" "=W,D,W")
3231 (unspec:HI [(match_operand:HI 2 "register_operand" "d,d,d")
3232 (match_operand:HI 3 "register_operand" "d,d,d")
3233 (match_operand 4 "register_operand" "1,1,1")
3234 (match_operand 5 "const01_operand" "P0P1,P0P1,P0P1")
3235 (match_operand 6 "const_int_operand" "PB,PA,PA")]
3236 UNSPEC_MAC_WITH_FLAG))
3237 (set (match_operand:PDI 1 "register_operand" "=B,A,B")
3238 (unspec:PDI [(match_dup 1) (match_dup 2) (match_dup 3)
3239 (match_dup 4) (match_dup 5)]
3240 UNSPEC_MAC_WITH_FLAG))]
3242 "%h0 = (%1 %b5 %h2 * %h3) %M6%!"
3243 [(set_attr "type" "dsp32")])
3245 (define_insn "flag_machi_acconly"
3246 [(set (match_operand:PDI 0 "register_operand" "=B,e")
3247 (unspec:PDI [(match_operand:HI 1 "register_operand" "d,d")
3248 (match_operand:HI 2 "register_operand" "d,d")
3249 (match_operand 3 "register_operand" "0,0")
3250 (match_operand 4 "const01_operand" "P0P1,P0P1")
3251 (match_operand 5 "const_int_operand" "PB,PA")]
3252 UNSPEC_MAC_WITH_FLAG))]
3254 "%0 %b4 %h1 * %h2 %M5%!"
3255 [(set_attr "type" "dsp32")])
3257 (define_insn "flag_machi_parts_acconly"
3258 [(set (match_operand:PDI 0 "register_operand" "=B,e")
3259 (unspec:PDI [(vec_select:HI
3260 (match_operand:V2HI 1 "register_operand" "d,d")
3261 (parallel [(match_operand 3 "const01_operand" "P0P1,P0P1")]))
3263 (match_operand:V2HI 2 "register_operand" "d,d")
3264 (parallel [(match_operand 4 "const01_operand" "P0P1,P0P1")]))
3265 (match_operand:PDI 5 "register_operand" "0,0")
3266 (match_operand 6 "const01_operand" "P0P1,P0P1")
3267 (match_operand 7 "const_int_operand" "PB,PA")]
3268 UNSPEC_MAC_WITH_FLAG))]
3271 const char *templates[] = {
3272 "%0 %b6 %h1 * %h2 %M7%!",
3273 "%0 %b6 %d1 * %h2 %M7%!",
3274 "%0 %b6 %h1 * %d2 %M7%!",
3275 "%0 %b6 %d1 * %d2 %M7%!"
3277 int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
3278 return templates[alt];
3280 [(set_attr "type" "dsp32")])
3282 (define_insn "flag_macinithi"
3283 [(set (match_operand:HI 0 "register_operand" "=W,D,W")
3284 (unspec:HI [(match_operand:HI 1 "register_operand" "d,d,d")
3285 (match_operand:HI 2 "register_operand" "d,d,d")
3286 (match_operand 3 "const_int_operand" "PB,PA,PA")]
3287 UNSPEC_MAC_WITH_FLAG))
3288 (set (match_operand:PDI 4 "register_operand" "=B,A,B")
3289 (unspec:PDI [(match_dup 1) (match_dup 2) (match_dup 3)]
3290 UNSPEC_MAC_WITH_FLAG))]
3292 "%h0 = (%4 = %h1 * %h2) %M3%!"
3293 [(set_attr "type" "dsp32")])
3295 (define_insn "flag_macinit1hi"
3296 [(set (match_operand:PDI 0 "register_operand" "=B,e")
3297 (unspec:PDI [(match_operand:HI 1 "register_operand" "d,d")
3298 (match_operand:HI 2 "register_operand" "d,d")
3299 (match_operand 3 "const_int_operand" "PB,PA")]
3300 UNSPEC_MAC_WITH_FLAG))]
3302 "%0 = %h1 * %h2 %M3%!"
3303 [(set_attr "type" "dsp32")])
3305 (define_insn "mulv2hi3"
3306 [(set (match_operand:V2HI 0 "register_operand" "=d")
3307 (mult:V2HI (match_operand:V2HI 1 "register_operand" "d")
3308 (match_operand:V2HI 2 "register_operand" "d")))]
3310 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 (IS)%!"
3311 [(set_attr "type" "dsp32")])
3313 (define_insn "flag_mulv2hi"
3314 [(set (match_operand:V2HI 0 "register_operand" "=d")
3315 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "d")
3316 (match_operand:V2HI 2 "register_operand" "d")
3317 (match_operand 3 "const_int_operand" "n")]
3318 UNSPEC_MUL_WITH_FLAG))]
3320 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 %M3%!"
3321 [(set_attr "type" "dsp32")])
3323 (define_insn "flag_mulv2hi_parts"
3324 [(set (match_operand:V2HI 0 "register_operand" "=d")
3325 (unspec:V2HI [(vec_concat:V2HI
3327 (match_operand:V2HI 1 "register_operand" "d")
3328 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3331 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3333 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3334 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3335 (vec_select:HI (match_dup 2)
3336 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3337 (match_operand 7 "const_int_operand" "n")]
3338 UNSPEC_MUL_WITH_FLAG))]
3341 const char *templates[] = {
3342 "%h0 = %h1 * %h2, %d0 = %h1 * %h2 %M7%!",
3343 "%h0 = %d1 * %h2, %d0 = %h1 * %h2 %M7%!",
3344 "%h0 = %h1 * %h2, %d0 = %d1 * %h2 %M7%!",
3345 "%h0 = %d1 * %h2, %d0 = %d1 * %h2 %M7%!",
3346 "%h0 = %h1 * %d2, %d0 = %h1 * %h2 %M7%!",
3347 "%h0 = %d1 * %d2, %d0 = %h1 * %h2 %M7%!",
3348 "%h0 = %h1 * %d2, %d0 = %d1 * %h2 %M7%!",
3349 "%h0 = %d1 * %d2, %d0 = %d1 * %h2 %M7%!",
3350 "%h0 = %h1 * %h2, %d0 = %h1 * %d2 %M7%!",
3351 "%h0 = %d1 * %h2, %d0 = %h1 * %d2 %M7%!",
3352 "%h0 = %h1 * %h2, %d0 = %d1 * %d2 %M7%!",
3353 "%h0 = %d1 * %h2, %d0 = %d1 * %d2 %M7%!",
3354 "%h0 = %h1 * %d2, %d0 = %h1 * %d2 %M7%!",
3355 "%h0 = %d1 * %d2, %d0 = %h1 * %d2 %M7%!",
3356 "%h0 = %h1 * %d2, %d0 = %d1 * %d2 %M7%!",
3357 "%h0 = %d1 * %d2, %d0 = %d1 * %d2 %M7%!" };
3358 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3359 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3360 return templates[alt];
3362 [(set_attr "type" "dsp32")])
3364 ;; A slightly complicated pattern.
3365 ;; Operand 0 is the halfword output; operand 11 is the accumulator output
3366 ;; Halfword inputs are operands 1 and 2; operands 3, 4, 5 and 6 specify which
3367 ;; parts of these 2x16 bit registers to use.
3368 ;; Operand 7 is the accumulator input.
3369 ;; Operands 8/9 specify whether low/high parts are mac (0) or msu (1)
3370 ;; Operand 10 is the macflag to be used.
3371 (define_insn "flag_macv2hi_parts"
3372 [(set (match_operand:V2HI 0 "register_operand" "=d")
3373 (unspec:V2HI [(vec_concat:V2HI
3375 (match_operand:V2HI 1 "register_operand" "d")
3376 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3379 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3381 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3382 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3383 (vec_select:HI (match_dup 2)
3384 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3385 (match_operand:V2PDI 7 "register_operand" "e")
3386 (match_operand 8 "const01_operand" "P0P1")
3387 (match_operand 9 "const01_operand" "P0P1")
3388 (match_operand 10 "const_int_operand" "n")]
3389 UNSPEC_MAC_WITH_FLAG))
3390 (set (match_operand:V2PDI 11 "register_operand" "=e")
3391 (unspec:V2PDI [(vec_concat:V2HI
3392 (vec_select:HI (match_dup 1) (parallel [(match_dup 3)]))
3393 (vec_select:HI (match_dup 1) (parallel [(match_dup 4)])))
3395 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)]))
3396 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)])))
3397 (match_dup 7) (match_dup 8) (match_dup 9) (match_dup 10)]
3398 UNSPEC_MAC_WITH_FLAG))]
3401 const char *templates[] = {
3402 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3403 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3404 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3405 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3406 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3407 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %h1 * %h2) %M10%!",
3408 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3409 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %d1 * %h2) %M10%!",
3410 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3411 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3412 "%h0 = (A0 %b8 %h1 * %h2), %d0 = (A1 %b9 %d1 * %d2) %M10%!",
3413 "%h0 = (A0 %b8 %d1 * %h2), %d0 = (A1 %b9 %d1 * %d2) %M10%!",
3414 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3415 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %h1 * %d2) %M10%!",
3416 "%h0 = (A0 %b8 %h1 * %d2), %d0 = (A1 %b9 %d1 * %d2) %M10%!",
3417 "%h0 = (A0 %b8 %d1 * %d2), %d0 = (A1 %b9 %d1 * %d2) %M10%!" };
3418 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3419 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3420 return templates[alt];
3422 [(set_attr "type" "dsp32")])
3424 (define_insn "flag_macv2hi_parts_acconly"
3425 [(set (match_operand:V2PDI 0 "register_operand" "=e")
3426 (unspec:V2PDI [(vec_concat:V2HI
3428 (match_operand:V2HI 1 "register_operand" "d")
3429 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3432 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3434 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3435 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3436 (vec_select:HI (match_dup 2)
3437 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3438 (match_operand:V2PDI 7 "register_operand" "e")
3439 (match_operand 8 "const01_operand" "P0P1")
3440 (match_operand 9 "const01_operand" "P0P1")
3441 (match_operand 10 "const_int_operand" "n")]
3442 UNSPEC_MAC_WITH_FLAG))]
3445 const char *templates[] = {
3446 "A0 %b8 %h1 * %h2, A1 %b9 %h1 * %h2 %M10%!",
3447 "A0 %b8 %d1 * %h2, A1 %b9 %h1 * %h2 %M10%!",
3448 "A0 %b8 %h1 * %h2, A1 %b9 %d1 * %h2 %M10%!",
3449 "A0 %b8 %d1 * %h2, A1 %b9 %d1 * %h2 %M10%!",
3450 "A0 %b8 %h1 * %d2, A1 %b9 %h1 * %h2 %M10%!",
3451 "A0 %b8 %d1 * %d2, A1 %b9 %h1 * %h2 %M10%!",
3452 "A0 %b8 %h1 * %d2, A1 %b9 %d1 * %h2 %M10%!",
3453 "A0 %b8 %d1 * %d2, A1 %b9 %d1 * %h2 %M10%!",
3454 "A0 %b8 %h1 * %h2, A1 %b9 %h1 * %d2 %M10%!",
3455 "A0 %b8 %d1 * %h2, A1 %b9 %h1 * %d2 %M10%!",
3456 "A0 %b8 %h1 * %h2, A1 %b9 %d1 * %d2 %M10%!",
3457 "A0 %b8 %d1 * %h2, A1 %b9 %d1 * %d2 %M10%!",
3458 "A0 %b8 %h1 * %d2, A1 %b9 %h1 * %d2 %M10%!",
3459 "A0 %b8 %d1 * %d2, A1 %b9 %h1 * %d2 %M10%!",
3460 "A0 %b8 %h1 * %d2, A1 %b9 %d1 * %d2 %M10%!",
3461 "A0 %b8 %d1 * %d2, A1 %b9 %d1 * %d2 %M10%!" };
3462 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3463 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3464 return templates[alt];
3466 [(set_attr "type" "dsp32")])
3468 ;; Same as above, but initializing the accumulators and therefore a couple fewer
3469 ;; necessary operands.
3470 (define_insn "flag_macinitv2hi_parts"
3471 [(set (match_operand:V2HI 0 "register_operand" "=d")
3472 (unspec:V2HI [(vec_concat:V2HI
3474 (match_operand:V2HI 1 "register_operand" "d")
3475 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3478 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3480 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3481 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3482 (vec_select:HI (match_dup 2)
3483 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3484 (match_operand 7 "const_int_operand" "n")]
3485 UNSPEC_MAC_WITH_FLAG))
3486 (set (match_operand:V2PDI 8 "register_operand" "=e")
3487 (unspec:V2PDI [(vec_concat:V2HI
3488 (vec_select:HI (match_dup 1) (parallel [(match_dup 3)]))
3489 (vec_select:HI (match_dup 1) (parallel [(match_dup 4)])))
3491 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)]))
3492 (vec_select:HI (match_dup 2) (parallel [(match_dup 5)])))
3494 UNSPEC_MAC_WITH_FLAG))]
3497 const char *templates[] = {
3498 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %h1 * %h2) %M7%!",
3499 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %h1 * %h2) %M7%!",
3500 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %d1 * %h2) %M7%!",
3501 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %d1 * %h2) %M7%!",
3502 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %h1 * %h2) %M7%!",
3503 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %h1 * %h2) %M7%!",
3504 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %d1 * %h2) %M7%!",
3505 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %d1 * %h2) %M7%!",
3506 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %h1 * %d2) %M7%!",
3507 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %h1 * %d2) %M7%!",
3508 "%h0 = (A0 = %h1 * %h2), %d0 = (A1 = %d1 * %d2) %M7%!",
3509 "%h0 = (A0 = %d1 * %h2), %d0 = (A1 = %d1 * %d2) %M7%!",
3510 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %h1 * %d2) %M7%!",
3511 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %h1 * %d2) %M7%!",
3512 "%h0 = (A0 = %h1 * %d2), %d0 = (A1 = %d1 * %d2) %M7%!",
3513 "%h0 = (A0 = %d1 * %d2), %d0 = (A1 = %d1 * %d2) %M7%!" };
3514 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3515 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3516 return templates[alt];
3518 [(set_attr "type" "dsp32")])
3520 (define_insn "flag_macinit1v2hi_parts"
3521 [(set (match_operand:V2PDI 0 "register_operand" "=e")
3522 (unspec:V2PDI [(vec_concat:V2HI
3524 (match_operand:V2HI 1 "register_operand" "d")
3525 (parallel [(match_operand 3 "const01_operand" "P0P1")]))
3528 (parallel [(match_operand 4 "const01_operand" "P0P1")])))
3530 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3531 (parallel [(match_operand 5 "const01_operand" "P0P1")]))
3532 (vec_select:HI (match_dup 2)
3533 (parallel [(match_operand 6 "const01_operand" "P0P1")])))
3534 (match_operand 7 "const_int_operand" "n")]
3535 UNSPEC_MAC_WITH_FLAG))]
3538 const char *templates[] = {
3539 "A0 = %h1 * %h2, A1 = %h1 * %h2 %M7%!",
3540 "A0 = %d1 * %h2, A1 = %h1 * %h2 %M7%!",
3541 "A0 = %h1 * %h2, A1 = %d1 * %h2 %M7%!",
3542 "A0 = %d1 * %h2, A1 = %d1 * %h2 %M7%!",
3543 "A0 = %h1 * %d2, A1 = %h1 * %h2 %M7%!",
3544 "A0 = %d1 * %d2, A1 = %h1 * %h2 %M7%!",
3545 "A0 = %h1 * %d2, A1 = %d1 * %h2 %M7%!",
3546 "A0 = %d1 * %d2, A1 = %d1 * %h2 %M7%!",
3547 "A0 = %h1 * %h2, A1 = %h1 * %d2 %M7%!",
3548 "A0 = %d1 * %h2, A1 = %h1 * %d2 %M7%!",
3549 "A0 = %h1 * %h2, A1 = %d1 * %d2 %M7%!",
3550 "A0 = %d1 * %h2, A1 = %d1 * %d2 %M7%!",
3551 "A0 = %h1 * %d2, A1 = %h1 * %d2 %M7%!",
3552 "A0 = %d1 * %d2, A1 = %h1 * %d2 %M7%!",
3553 "A0 = %h1 * %d2, A1 = %d1 * %d2 %M7%!",
3554 "A0 = %d1 * %d2, A1 = %d1 * %d2 %M7%!" };
3555 int alt = (INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
3556 + (INTVAL (operands[5]) << 2) + (INTVAL (operands[6]) << 3));
3557 return templates[alt];
3559 [(set_attr "type" "dsp32")])
3561 ;; A mixture of multiply and multiply-accumulate for when we only want to
3562 ;; initialize one part.
3563 (define_insn "flag_mul_macv2hi_parts_acconly"
3564 [(set (match_operand:PDI 0 "register_operand" "=B,e,e")
3565 (unspec:PDI [(vec_select:HI
3566 (match_operand:V2HI 2 "register_operand" "d,d,d")
3567 (parallel [(match_operand 4 "const01_operand" "P0P1,P0P1,P0P1")]))
3569 (match_operand:V2HI 3 "register_operand" "d,d,d")
3570 (parallel [(match_operand 6 "const01_operand" "P0P1,P0P1,P0P1")]))
3571 (match_operand 10 "const_int_operand" "PB,PA,PA")]
3572 UNSPEC_MUL_WITH_FLAG))
3573 (set (match_operand:PDI 1 "register_operand" "=B,e,e")
3574 (unspec:PDI [(vec_select:HI
3576 (parallel [(match_operand 5 "const01_operand" "P0P1,P0P1,P0P1")]))
3579 (parallel [(match_operand 7 "const01_operand" "P0P1,P0P1,P0P1")]))
3580 (match_operand:PDI 8 "register_operand" "1,1,1")
3581 (match_operand 9 "const01_operand" "P0P1,P0P1,P0P1")
3582 (match_operand 11 "const_int_operand" "PA,PB,PA")]
3583 UNSPEC_MAC_WITH_FLAG))]
3584 "MACFLAGS_MATCH_P (INTVAL (operands[10]), INTVAL (operands[11]))"
3587 const char *templates[] = {
3588 "%0 = %h2 * %h3, %1 %b4 %h2 * %h3 %M5%!",
3589 "%0 = %d2 * %h3, %1 %b4 %h2 * %h3 %M5%!",
3590 "%0 = %h2 * %h3, %1 %b4 %d2 * %h3 %M5%!",
3591 "%0 = %d2 * %h3, %1 %b4 %d2 * %h3 %M5%!",
3592 "%0 = %h2 * %d3, %1 %b4 %h2 * %h3 %M5%!",
3593 "%0 = %d2 * %d3, %1 %b4 %h2 * %h3 %M5%!",
3594 "%0 = %h2 * %d3, %1 %b4 %d2 * %h3 %M5%!",
3595 "%0 = %d2 * %d3, %1 %b4 %d2 * %h3 %M5%!",
3596 "%0 = %h2 * %h3, %1 %b4 %h2 * %d3 %M5%!",
3597 "%0 = %d2 * %h3, %1 %b4 %h2 * %d3 %M5%!",
3598 "%0 = %h2 * %h3, %1 %b4 %d2 * %d3 %M5%!",
3599 "%0 = %d2 * %h3, %1 %b4 %d2 * %d3 %M5%!",
3600 "%0 = %h2 * %d3, %1 %b4 %h2 * %d3 %M5%!",
3601 "%0 = %d2 * %d3, %1 %b4 %h2 * %d3 %M5%!",
3602 "%0 = %h2 * %d3, %1 %b4 %d2 * %d3 %M5%!",
3603 "%0 = %d2 * %d3, %1 %b4 %d2 * %d3 %M5%!" };
3604 int alt = (INTVAL (operands[4]) + (INTVAL (operands[5]) << 1)
3605 + (INTVAL (operands[6]) << 2) + (INTVAL (operands[7]) << 3));
3606 xops[0] = operands[0];
3607 xops[1] = operands[1];
3608 xops[2] = operands[2];
3609 xops[3] = operands[3];
3610 xops[4] = operands[9];
3611 xops[5] = which_alternative == 0 ? operands[10] : operands[11];
3612 output_asm_insn (templates[alt], xops);
3615 [(set_attr "type" "dsp32")])
3618 (define_code_iterator s_or_u [sign_extend zero_extend])
3619 (define_code_attr su_optab [(sign_extend "mul")
3620 (zero_extend "umul")])
3621 (define_code_attr su_modifier [(sign_extend "IS")
3622 (zero_extend "FU")])
3624 (define_insn "<su_optab>hisi_ll"
3625 [(set (match_operand:SI 0 "register_operand" "=d")
3627 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3628 (parallel [(const_int 0)])))
3630 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3631 (parallel [(const_int 0)])))))]
3633 "%0 = %h1 * %h2 (<su_modifier>)%!"
3634 [(set_attr "type" "dsp32")])
3636 (define_insn "<su_optab>hisi_lh"
3637 [(set (match_operand:SI 0 "register_operand" "=d")
3639 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3640 (parallel [(const_int 0)])))
3642 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3643 (parallel [(const_int 1)])))))]
3645 "%0 = %h1 * %d2 (<su_modifier>)%!"
3646 [(set_attr "type" "dsp32")])
3648 (define_insn "<su_optab>hisi_hl"
3649 [(set (match_operand:SI 0 "register_operand" "=d")
3651 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3652 (parallel [(const_int 1)])))
3654 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3655 (parallel [(const_int 0)])))))]
3657 "%0 = %d1 * %h2 (<su_modifier>)%!"
3658 [(set_attr "type" "dsp32")])
3660 (define_insn "<su_optab>hisi_hh"
3661 [(set (match_operand:SI 0 "register_operand" "=d")
3663 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3664 (parallel [(const_int 1)])))
3666 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3667 (parallel [(const_int 1)])))))]
3669 "%0 = %d1 * %d2 (<su_modifier>)%!"
3670 [(set_attr "type" "dsp32")])
3672 ;; Additional variants for signed * unsigned multiply.
3674 (define_insn "usmulhisi_ull"
3675 [(set (match_operand:SI 0 "register_operand" "=W")
3676 (mult:SI (zero_extend:SI
3677 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3678 (parallel [(const_int 0)])))
3680 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3681 (parallel [(const_int 0)])))))]
3683 "%0 = %h2 * %h1 (IS,M)%!"
3684 [(set_attr "type" "dsp32")])
3686 (define_insn "usmulhisi_ulh"
3687 [(set (match_operand:SI 0 "register_operand" "=W")
3688 (mult:SI (zero_extend:SI
3689 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3690 (parallel [(const_int 0)])))
3692 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3693 (parallel [(const_int 1)])))))]
3695 "%0 = %d2 * %h1 (IS,M)%!"
3696 [(set_attr "type" "dsp32")])
3698 (define_insn "usmulhisi_uhl"
3699 [(set (match_operand:SI 0 "register_operand" "=W")
3700 (mult:SI (zero_extend:SI
3701 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d")
3702 (parallel [(const_int 1)])))
3704 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3705 (parallel [(const_int 0)])))))]
3707 "%0 = %h2 * %d1 (IS,M)%!"
3708 [(set_attr "type" "dsp32")])
3710 (define_insn "usmulhisi_uhh"
3711 [(set (match_operand:SI 0 "register_operand" "=W")
3712 (mult:SI (zero_extend:SI
3713 (vec_select:HI (match_operand:V2HI 1 "register_operand" "%d")
3714 (parallel [(const_int 1)])))
3716 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d")
3717 (parallel [(const_int 1)])))))]
3719 "%0 = %d2 * %d1 (IS,M)%!"
3720 [(set_attr "type" "dsp32")])
3722 ;; Parallel versions of these operations. First, normal signed or unsigned
3725 (define_insn "<su_optab>hisi_ll_lh"
3726 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3728 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3729 (parallel [(const_int 0)])))
3731 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3732 (parallel [(const_int 0)])))))
3733 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3735 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3737 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3739 "%0 = %h1 * %h2, %3 = %h1 * %d2 (<su_modifier>)%!"
3740 [(set_attr "type" "dsp32")])
3742 (define_insn "<su_optab>hisi_ll_hl"
3743 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3745 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3746 (parallel [(const_int 0)])))
3748 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3749 (parallel [(const_int 0)])))))
3750 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3752 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3754 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3756 "%0 = %h1 * %h2, %3 = %d1 * %h2 (<su_modifier>)%!"
3757 [(set_attr "type" "dsp32")])
3759 (define_insn "<su_optab>hisi_ll_hh"
3760 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3762 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3763 (parallel [(const_int 0)])))
3765 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3766 (parallel [(const_int 0)])))))
3767 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3769 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3771 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3773 "%0 = %h1 * %h2, %3 = %d1 * %d2 (<su_modifier>)%!"
3774 [(set_attr "type" "dsp32")])
3776 (define_insn "<su_optab>hisi_lh_hl"
3777 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3779 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3780 (parallel [(const_int 0)])))
3782 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3783 (parallel [(const_int 1)])))))
3784 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3786 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3788 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3790 "%0 = %h1 * %d2, %3 = %d1 * %h2 (<su_modifier>)%!"
3791 [(set_attr "type" "dsp32")])
3793 (define_insn "<su_optab>hisi_lh_hh"
3794 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3796 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3797 (parallel [(const_int 0)])))
3799 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3800 (parallel [(const_int 1)])))))
3801 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3803 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3805 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3807 "%0 = %h1 * %d2, %3 = %d1 * %d2 (<su_modifier>)%!"
3808 [(set_attr "type" "dsp32")])
3810 (define_insn "<su_optab>hisi_hl_hh"
3811 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3813 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3814 (parallel [(const_int 1)])))
3816 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3817 (parallel [(const_int 0)])))))
3818 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3820 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3822 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3824 "%0 = %d1 * %h2, %3 = %d1 * %d2 (<su_modifier>)%!"
3825 [(set_attr "type" "dsp32")])
3827 ;; Special signed * unsigned variants.
3829 (define_insn "usmulhisi_ll_lul"
3830 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3831 (mult:SI (sign_extend:SI
3832 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3833 (parallel [(const_int 0)])))
3835 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3836 (parallel [(const_int 0)])))))
3837 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3838 (mult:SI (sign_extend:SI
3839 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3841 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3843 "%0 = %h1 * %h2, %3 = %h1 * %h2 (IS,M)%!"
3844 [(set_attr "type" "dsp32")])
3846 (define_insn "usmulhisi_ll_luh"
3847 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3848 (mult:SI (sign_extend:SI
3849 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3850 (parallel [(const_int 0)])))
3852 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3853 (parallel [(const_int 0)])))))
3854 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3855 (mult:SI (sign_extend:SI
3856 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3858 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3860 "%0 = %h1 * %h2, %3 = %h1 * %d2 (IS,M)%!"
3861 [(set_attr "type" "dsp32")])
3863 (define_insn "usmulhisi_ll_hul"
3864 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3865 (mult:SI (sign_extend:SI
3866 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3867 (parallel [(const_int 0)])))
3869 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3870 (parallel [(const_int 0)])))))
3871 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3872 (mult:SI (sign_extend:SI
3873 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3875 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3877 "%0 = %h1 * %h2, %3 = %d1 * %h2 (IS,M)%!"
3878 [(set_attr "type" "dsp32")])
3880 (define_insn "usmulhisi_ll_huh"
3881 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3882 (mult:SI (sign_extend:SI
3883 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3884 (parallel [(const_int 0)])))
3886 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3887 (parallel [(const_int 0)])))))
3888 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3889 (mult:SI (sign_extend:SI
3890 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3892 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3894 "%0 = %h1 * %h2, %3 = %d1 * %d2 (IS,M)%!"
3895 [(set_attr "type" "dsp32")])
3897 (define_insn "usmulhisi_lh_lul"
3898 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3899 (mult:SI (sign_extend:SI
3900 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3901 (parallel [(const_int 0)])))
3903 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3904 (parallel [(const_int 1)])))))
3905 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3906 (mult:SI (sign_extend:SI
3907 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3909 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3911 "%0 = %h1 * %d2, %3 = %h1 * %h2 (IS,M)%!"
3912 [(set_attr "type" "dsp32")])
3914 (define_insn "usmulhisi_lh_luh"
3915 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3916 (mult:SI (sign_extend:SI
3917 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3918 (parallel [(const_int 0)])))
3920 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3921 (parallel [(const_int 1)])))))
3922 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3923 (mult:SI (sign_extend:SI
3924 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3926 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3928 "%0 = %h1 * %d2, %3 = %h1 * %d2 (IS,M)%!"
3929 [(set_attr "type" "dsp32")])
3931 (define_insn "usmulhisi_lh_hul"
3932 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3933 (mult:SI (sign_extend:SI
3934 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3935 (parallel [(const_int 0)])))
3937 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3938 (parallel [(const_int 1)])))))
3939 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3940 (mult:SI (sign_extend:SI
3941 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3943 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3945 "%0 = %h1 * %d2, %3 = %d1 * %h2 (IS,M)%!"
3946 [(set_attr "type" "dsp32")])
3948 (define_insn "usmulhisi_lh_huh"
3949 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3950 (mult:SI (sign_extend:SI
3951 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3952 (parallel [(const_int 0)])))
3954 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3955 (parallel [(const_int 1)])))))
3956 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3957 (mult:SI (sign_extend:SI
3958 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
3960 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3962 "%0 = %h1 * %d2, %3 = %d1 * %d2 (IS,M)%!"
3963 [(set_attr "type" "dsp32")])
3965 (define_insn "usmulhisi_hl_lul"
3966 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3967 (mult:SI (sign_extend:SI
3968 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3969 (parallel [(const_int 1)])))
3971 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3972 (parallel [(const_int 0)])))))
3973 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3974 (mult:SI (sign_extend:SI
3975 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3977 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
3979 "%0 = %d1 * %h2, %3 = %h1 * %h2 (IS,M)%!"
3980 [(set_attr "type" "dsp32")])
3982 (define_insn "usmulhisi_hl_luh"
3983 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
3984 (mult:SI (sign_extend:SI
3985 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
3986 (parallel [(const_int 1)])))
3988 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
3989 (parallel [(const_int 0)])))))
3990 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
3991 (mult:SI (sign_extend:SI
3992 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
3994 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
3996 "%0 = %d1 * %h2, %3 = %h1 * %d2 (IS,M)%!"
3997 [(set_attr "type" "dsp32")])
3999 (define_insn "usmulhisi_hl_hul"
4000 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4001 (mult:SI (sign_extend:SI
4002 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4003 (parallel [(const_int 1)])))
4005 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4006 (parallel [(const_int 0)])))))
4007 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4008 (mult:SI (sign_extend:SI
4009 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4011 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
4013 "%0 = %d1 * %h2, %3 = %d1 * %h2 (IS,M)%!"
4014 [(set_attr "type" "dsp32")])
4016 (define_insn "usmulhisi_hl_huh"
4017 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4018 (mult:SI (sign_extend:SI
4019 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4020 (parallel [(const_int 1)])))
4022 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4023 (parallel [(const_int 0)])))))
4024 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4025 (mult:SI (sign_extend:SI
4026 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4028 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4030 "%0 = %d1 * %h2, %3 = %d1 * %d2 (IS,M)%!"
4031 [(set_attr "type" "dsp32")])
4033 (define_insn "usmulhisi_hh_lul"
4034 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4035 (mult:SI (sign_extend:SI
4036 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4037 (parallel [(const_int 1)])))
4039 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4040 (parallel [(const_int 1)])))))
4041 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4042 (mult:SI (sign_extend:SI
4043 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
4045 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
4047 "%0 = %d1 * %d2, %3 = %h1 * %h2 (IS,M)%!"
4048 [(set_attr "type" "dsp32")])
4050 (define_insn "usmulhisi_hh_luh"
4051 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4052 (mult:SI (sign_extend:SI
4053 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4054 (parallel [(const_int 1)])))
4056 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4057 (parallel [(const_int 1)])))))
4058 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4059 (mult:SI (sign_extend:SI
4060 (vec_select:HI (match_dup 1) (parallel [(const_int 0)])))
4062 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4064 "%0 = %d1 * %d2, %3 = %h1 * %d2 (IS,M)%!"
4065 [(set_attr "type" "dsp32")])
4067 (define_insn "usmulhisi_hh_hul"
4068 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4069 (mult:SI (sign_extend:SI
4070 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4071 (parallel [(const_int 1)])))
4073 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4074 (parallel [(const_int 1)])))))
4075 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4076 (mult:SI (sign_extend:SI
4077 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4079 (vec_select:HI (match_dup 2) (parallel [(const_int 0)])))))]
4081 "%0 = %d1 * %d2, %3 = %d1 * %h2 (IS,M)%!"
4082 [(set_attr "type" "dsp32")])
4084 (define_insn "usmulhisi_hh_huh"
4085 [(set (match_operand:SI 0 "register_operand" "=q0,q2,q4,q6")
4086 (mult:SI (sign_extend:SI
4087 (vec_select:HI (match_operand:V2HI 1 "register_operand" "d,d,d,d")
4088 (parallel [(const_int 1)])))
4090 (vec_select:HI (match_operand:V2HI 2 "register_operand" "d,d,d,d")
4091 (parallel [(const_int 1)])))))
4092 (set (match_operand:SI 3 "register_operand" "=q1,q3,q5,q7")
4093 (mult:SI (sign_extend:SI
4094 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
4096 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))]
4098 "%0 = %d1 * %d2, %3 = %d1 * %d2 (IS,M)%!"
4099 [(set_attr "type" "dsp32")])
4103 (define_insn "ssnegv2hi2"
4104 [(set (match_operand:V2HI 0 "register_operand" "=d")
4105 (ss_neg:V2HI (match_operand:V2HI 1 "register_operand" "d")))]
4108 [(set_attr "type" "dsp32")])
4110 (define_insn "ssabsv2hi2"
4111 [(set (match_operand:V2HI 0 "register_operand" "=d")
4112 (ss_abs:V2HI (match_operand:V2HI 1 "register_operand" "d")))]
4115 [(set_attr "type" "dsp32")])
4119 (define_insn "ssashiftv2hi3"
4120 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d")
4122 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4123 (ashiftrt:V2HI (match_operand:V2HI 1 "register_operand" "d,d,d")
4125 (ss_ashift:V2HI (match_dup 1) (match_dup 2))))]
4128 %0 = ASHIFT %1 BY %h2 (V, S)%!
4129 %0 = %1 << %2 (V,S)%!
4130 %0 = %1 >>> %N2 (V,S)%!"
4131 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4133 (define_insn "ssashifthi3"
4134 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
4136 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4137 (ashiftrt:HI (match_operand:HI 1 "register_operand" "d,d,d")
4139 (ss_ashift:HI (match_dup 1) (match_dup 2))))]
4142 %0 = ASHIFT %1 BY %h2 (V, S)%!
4143 %0 = %1 << %2 (V,S)%!
4144 %0 = %1 >>> %N2 (V,S)%!"
4145 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4147 (define_insn "ssashiftsi3"
4148 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4150 (lt (match_operand:HI 2 "reg_or_const_int_operand" "d,Ku5,Ks5") (const_int 0))
4151 (ashiftrt:SI (match_operand:HI 1 "register_operand" "d,d,d")
4153 (ss_ashift:SI (match_dup 1) (match_dup 2))))]
4156 %0 = ASHIFT %1 BY %h2 (S)%!
4158 %0 = %1 >>> %N2 (S)%!"
4159 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4161 (define_insn "lshiftv2hi3"
4162 [(set (match_operand:V2HI 0 "register_operand" "=d,d,d")
4164 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4165 (lshiftrt:V2HI (match_operand:V2HI 1 "register_operand" "d,d,d")
4167 (ashift:V2HI (match_dup 1) (match_dup 2))))]
4170 %0 = LSHIFT %1 BY %h2 (V)%!
4172 %0 = %1 >> %N2 (V)%!"
4173 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4175 (define_insn "lshifthi3"
4176 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
4178 (lt (match_operand:HI 2 "vec_shift_operand" "d,Ku4,Ks4") (const_int 0))
4179 (lshiftrt:HI (match_operand:HI 1 "register_operand" "d,d,d")
4181 (ashift:HI (match_dup 1) (match_dup 2))))]
4184 %0 = LSHIFT %1 BY %h2 (V)%!
4186 %0 = %1 >> %N2 (V)%!"
4187 [(set_attr "type" "dsp32,dsp32shiftimm,dsp32shiftimm")])
4189 ;; Load without alignment exception (masking off low bits)
4191 (define_insn "loadbytes"
4192 [(set (match_operand:SI 0 "register_operand" "=d")
4193 (mem:SI (and:SI (match_operand:SI 1 "register_operand" "b")
4196 "DISALGNEXCPT || %0 = [%1];"
4197 [(set_attr "type" "mcld")
4198 (set_attr "length" "8")])