1 ;; GCC machine description for Hitachi H8/
300
2 ;; Copyright (C)
1992,
1993,
1994,
1995,
1996,
1997,
1998,
1999,
2000,
3 ;;
2001 Free Software Foundation, Inc.
5 ;; Contributed by Steve Chamberlain (sac@cygnus.com),
6 ;; Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
8 ;; This file is part of GNU CC.
10 ;; GNU CC is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version
2, or (at your option)
15 ;; GNU CC is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU CC; see the file COPYING. If not, write to
22 ;; the Free Software Foundation,
59 Temple Place - Suite
330,
23 ;; Boston, MA
02111-
1307, USA.
25 ;; The original PO technology requires these to be ordered by speed,
26 ;; so that assigner will pick the fastest.
28 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 (define_attr "cpu" "h8300,h8300h"
31 (const (symbol_ref "cpu_type")))
33 ;; Many logical operations should have "bit" variants if only one
34 ;; bit is going to be operated on.
36 ;; (and (logical op) (const_int X))
37 ;; If const_int only specifies a few bits (like a single byte in a
4 byte
38 ;; operation, then it's more efficient to only apply the and and logical_op
39 ;; to the bits we care about.
41 ;; Some of the extend instructions accept a general_operand_src, which
42 ;; allows all the normal memory addressing modes. The length computations
43 ;; don't take this into account. The lengths in the MD file should be
44 ;; "worst case" and then be adjusted to their correct values by
45 ;; h8300_adjust_insn_length.
47 ;; On the h8300h, adds/subs operate on the
32bit "er" registers. Right
48 ;; now GCC doesn't expose the "e" half to the compiler, so using add/subs
49 ;; for addhi and subhi is safe.
50 ;; Long term, we want to expose the "e" half to the compiler (gives us
51 ;;
8 more
16bit registers). At that point addhi and subhi can't use adds/subs.
53 ;; There's currently no way to have a insv/extzv expander for the H8/
300H
54 ;; because word_mode is different for the H8/
300 and H8/
300H.
56 ;; Shifts/rotates by small constants should be handled by special
57 ;; patterns so we get the length and cc status correct.
59 ;; Bitfield operations no longer accept memory operands. We need
60 ;; to add variants which operate on memory back to the MD.
62 ;; ??? Implement remaining bit ops available on the h8300
64 (define_attr "type" "branch,arith"
65 (const_string "arith"))
67 ;; The size of instructions in bytes.
69 (define_attr "length" ""
70 (cond [(eq_attr "type" "branch")
71 (if_then_else (and (ge (minus (pc) (match_dup
0))
73 (le (minus (pc) (match_dup
0))
76 (if_then_else (and (eq_attr "cpu" "h8300h")
77 (and (ge (minus (pc) (match_dup
0))
79 (le (minus (pc) (match_dup
0))
85 ;; The necessity of instruction length adjustment.
87 (define_attr "adjust_length" "yes,no"
88 (cond [(eq_attr "type" "branch") (const_string "no")]
89 (const_string "yes")))
91 ;; Condition code settings.
92 ;; none - insn does not affect cc
93 ;; none_0hit - insn does not affect cc but it does modify operand
0
94 ;; This attribute is used to keep track of when operand
0 changes.
95 ;; See the description of NOTICE_UPDATE_CC for more info.
96 ;; set_znv - insn sets z,n,v to usable values (like a tst insn); c is unknown.
97 ;; set_zn - insn sets z,n to usable values; v,c are unknown.
98 ;; compare - compare instruction
99 ;; clobber - value of cc is unknown
100 (define_attr "cc" "none,none_0hit,set_znv,set_zn,compare,clobber"
101 (const_string "clobber"))
103 ;; ----------------------------------------------------------------------
105 ;; ----------------------------------------------------------------------
109 (define_insn "movqi_push"
110 [(set (match_operand:QI
0 "push_operand" "=<")
111 (match_operand:QI
1 "register_operand" "r"))]
116 return
\"push.w %T1
\";
118 return
\"push.l %S1
\";
120 [(set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int
2) (const_int
4)))
121 (set_attr "cc" "set_znv")])
124 [(set (match_operand:QI
0 "general_operand_dst" "=r,r,<,r,r,m")
125 (match_operand:QI
1 "general_operand_src" "I,r>,r,n,m,r"))]
126 "register_operand (operands[
0],QImode)
127 || register_operand (operands[
1], QImode)"
135 [(set_attr_alternative "length"
136 [(const_int
2) (const_int
2) (const_int
2) (const_int
2)
137 (if_then_else (eq_attr "cpu" "h8300") (const_int
4) (const_int
8))
138 (if_then_else (eq_attr "cpu" "h8300") (const_int
4) (const_int
8))])
139 (set_attr "cc" "set_zn,set_znv,set_znv,set_znv,set_znv,set_znv")])
141 (define_expand "movqi"
142 [(set (match_operand:QI
0 "general_operand_dst" "")
143 (match_operand:QI
1 "general_operand_src" ""))]
147 /* One of the ops has to be in a register. */
148 if (!register_operand (operand0, QImode)
149 && !register_operand (operand1, QImode))
151 operands[
1] = copy_to_mode_reg (QImode, operand1);
155 (define_insn "movstrictqi"
156 [(set (strict_low_part (match_operand:QI
0 "general_operand_dst" "+r,r,r,r"))
157 (match_operand:QI
1 "general_operand_src" "I,r,n,m"))]
164 [(set_attr_alternative "length"
165 [(const_int
2) (const_int
2) (const_int
2)
166 (if_then_else (eq_attr "cpu" "h8300") (const_int
4) (const_int
8))])
167 (set_attr "cc" "set_zn,set_znv,set_znv,set_znv")])
171 ;; ??? We use push.l on the h8300h to push a
16bit value?!? We have
173 (define_insn "movhi_push"
174 [(set (match_operand:HI
0 "push_operand" "=<")
175 (match_operand:HI
1 "register_operand" "r"))]
180 return
\"push.w %T1
\";
182 return
\"push.l %S1
\";
184 [(set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int
2) (const_int
4)))
185 (set_attr "cc" "set_znv")])
188 [(set (match_operand:HI
0 "general_operand_dst" "=r,r,<,r,r,m")
189 (match_operand:HI
1 "general_operand_src" "I,r>,r,i,m,r"))]
190 "register_operand (operands[
0],HImode)
191 || register_operand (operands[
1], HImode)"
199 [(set_attr_alternative "length"
200 [(const_int
2) (const_int
2) (const_int
2) (const_int
4)
201 (if_then_else (eq_attr "cpu" "h8300") (const_int
4) (const_int
8))
202 (if_then_else (eq_attr "cpu" "h8300") (const_int
4) (const_int
8))])
203 (set_attr "cc" "set_zn,set_znv,set_znv,set_znv,set_znv,set_znv")])
205 (define_expand "movhi"
206 [(set (match_operand:HI
0 "general_operand_dst" "")
207 (match_operand:HI
1 "general_operand_src" ""))]
211 /* One of the ops has to be in a register. */
212 if (!register_operand (operand1, HImode)
213 && !register_operand (operand0, HImode))
215 operands[
1] = copy_to_mode_reg (HImode, operand1);
219 (define_insn "movstricthi"
220 [(set (strict_low_part (match_operand:HI
0 "general_operand_dst" "+r,r,r,r"))
221 (match_operand:HI
1 "general_operand_src" "I,r,i,m"))]
228 [(set_attr_alternative "length"
229 [(const_int
2) (const_int
2) (const_int
4)
230 (if_then_else (eq_attr "cpu" "h8300") (const_int
4) (const_int
8))])
231 (set_attr "cc" "set_zn,set_znv,set_znv,set_znv")])
235 (define_expand "movsi"
236 [(set (match_operand:SI
0 "general_operand_dst" "")
237 (match_operand:SI
1 "general_operand_src" ""))]
243 if (do_movsi (operands))
248 /* One of the ops has to be in a register. */
249 if (!register_operand (operand1, SImode)
250 && !register_operand (operand0, SImode))
252 operands[
1] = copy_to_mode_reg (SImode, operand1);
257 (define_expand "movsf"
258 [(set (match_operand:SF
0 "general_operand_dst" "")
259 (match_operand:SF
1 "general_operand_src" ""))]
265 if (do_movsi (operands))
270 /* One of the ops has to be in a register. */
271 if (!register_operand (operand1, SFmode)
272 && !register_operand (operand0, SFmode))
274 operands[
1] = copy_to_mode_reg (SFmode, operand1);
279 (define_insn "movsi_h8300"
280 [(set (match_operand:SI
0 "general_operand_dst" "=r,r,r,o,<,r")
281 (match_operand:SI
1 "general_operand_src" "I,r,io,r,r,>"))]
283 && (register_operand (operands[
0], SImode)
284 || register_operand (operands[
1], SImode))"
288 switch (which_alternative)
291 return
\"sub.w %e0,%e0\;sub.w %f0,%f0
\";
293 if (REGNO (operands[
0]) < REGNO (operands[
1]))
294 return
\"mov.w %e1,%e0\;mov.w %f1,%f0
\";
296 return
\"mov.w %f1,%f0\;mov.w %e1,%e0
\";
298 /* Make sure we don't trample the register we index with. */
299 if (GET_CODE (operands[
1]) == MEM)
301 rtx inside = XEXP (operands[
1],
0);
306 else if (GET_CODE (inside) == PLUS)
308 rtx lhs = XEXP (inside,
0);
309 rtx rhs = XEXP (inside,
1);
310 if (REG_P (lhs)) rn = REGNO (lhs);
311 if (REG_P (rhs)) rn = REGNO (rhs);
314 if (rn == REGNO (operands[
0]))
316 /* Move the second word first. */
317 return
\"mov.w %f1,%f0\;mov.w %e1,%e0
\";
321 /* See if either half is zero. If so, use sub.w to clear
323 if (GET_CODE (operands[
1]) == CONST_INT)
325 if ((INTVAL (operands[
1]) &
0xffff) ==
0)
326 return
\"mov.w %e1,%e0\;sub.w %f0,%f0
\";
327 if (((INTVAL (operands[
1]) >>
16) &
0xffff) ==
0)
328 return
\"sub.w %e0,%e0\;mov.w %f1,%f0
\";
330 return
\"mov.w %e1,%e0\;mov.w %f1,%f0
\";
333 return
\"mov.w %e1,%e0\;mov.w %f1,%f0
\";
335 return
\"mov.w %f1,%T0\;mov.w %e1,%T0
\";
337 return
\"mov.w %T1,%e0\;mov.w %T1,%f0
\";
342 [(set_attr "length" "
4,
4,
8,
8,
4,
4")
343 (set_attr "cc" "clobber")])
345 (define_insn "movsf_h8300"
346 [(set (match_operand:SF
0 "general_operand_dst" "=r,r,r,o,<,r")
347 (match_operand:SF
1 "general_operand_src" "I,r,io,r,r,>"))]
349 && (register_operand (operands[
0], SFmode)
350 || register_operand (operands[
1], SFmode))"
353 /* Copy of the movsi stuff. */
355 switch (which_alternative)
358 return
\"sub.w %e0,%e0\;sub.w %f0,%f0
\";
360 if (REGNO (operands[
0]) < REGNO (operands[
1]))
361 return
\"mov.w %e1,%e0\;mov.w %f1,%f0
\";
363 return
\"mov.w %f1,%f0\;mov.w %e1,%e0
\";
365 /* Make sure we don't trample the register we index with. */
366 if (GET_CODE (operands[
1]) == MEM)
368 rtx inside = XEXP (operands[
1],
0);
373 else if (GET_CODE (inside) == PLUS)
375 rtx lhs = XEXP (inside,
0);
376 rtx rhs = XEXP (inside,
1);
377 if (REG_P (lhs)) rn = REGNO (lhs);
378 if (REG_P (rhs)) rn = REGNO (rhs);
381 if (rn == REGNO (operands[
0]))
382 /* Move the second word first. */
383 return
\"mov.w %f1,%f0\;mov.w %e1,%e0
\";
385 /* Move the first word first. */
386 return
\"mov.w %e1,%e0\;mov.w %f1,%f0
\";
389 return
\"mov.w %e1,%e0\;mov.w %f1,%f0
\";
391 return
\"mov.w %f1,%T0\;mov.w %e1,%T0
\";
393 return
\"mov.w %T1,%e0\;mov.w %T1,%f0
\";
398 [(set_attr "length" "
4,
4,
8,
8,
4,
4")
399 (set_attr "cc" "clobber")])
401 (define_insn "movsi_h8300hs"
402 [(set (match_operand:SI
0 "general_operand_dst" "=r,r,r,r,m,<,r,*a,*a,r")
403 (match_operand:SI
1 "general_operand_src" "I,r,i,m,r,r,>,I,r,*a"))]
404 "(TARGET_H8300S || TARGET_H8300H)
405 && (register_operand (operands[
0], SImode)
406 || register_operand (operands[
1], SImode))"
409 switch (which_alternative)
412 return
\"sub.l %S0,%S0
\";
416 return
\"clrmac\;ldmac %
1,macl
\";
418 return
\"stmac macl,%
0\";
420 if (GET_CODE (operands[
1]) == CONST_INT)
422 int val = INTVAL (operands[
1]);
424 /* Look for constants which can be made by adding an
8-bit
425 number to zero in one of the two low bytes. */
426 if (val == (val &
0xff))
428 operands[
1] = GEN_INT ((char) val &
0xff);
429 return
\"sub.l
\\t%S0,%S0\;add.b
\\t%
1,%w0
\";
432 if (val == (val &
0xff00))
434 operands[
1] = GEN_INT ((char) (val >>
8) &
0xff);
435 return
\"sub.l
\\t%S0,%S0\;add.b
\\t%
1,%x0
\";
438 /* Now look for small negative numbers. We can subtract them
439 from zero to get the desired constant. */
440 if (val == -
4 || val == -
2 || val == -
1)
442 operands[
1] = GEN_INT (-INTVAL (operands[
1]));
443 return
\"sub.l
\\t%S0,%S0\;subs
\\t%
1,%S0
\";
447 return
\"mov.l %S1,%S0
\";
449 [(set_attr "length" "
2,
2,
10,
10,
10,
4,
4,
2,
6,
4")
450 (set_attr "cc" "set_zn,set_znv,clobber,set_znv,set_znv,set_znv,set_znv,none_0hit,none_0hit,set_znv")])
452 (define_insn "movsf_h8300h"
453 [(set (match_operand:SF
0 "general_operand_dst" "=r,r,r,m,<,r")
454 (match_operand:SF
1 "general_operand_src" "I,r,im,r,r,>"))]
455 "(TARGET_H8300H || TARGET_H8300S)
456 && (register_operand (operands[
0], SFmode)
457 || register_operand (operands[
1], SFmode))"
465 [(set_attr "length" "
2,
2,
10,
10,
4,
4")
466 (set_attr "cc" "set_zn,set_znv,set_znv,set_znv,set_znv,set_znv")])
468 ;; ----------------------------------------------------------------------
470 ;; ----------------------------------------------------------------------
473 [(set (cc0) (zero_extract:QI (match_operand:QI
0 "bit_memory_operand" "rU")
475 (match_operand:QI
1 "const_int_operand" "n")))]
478 [(set_attr "length" "
2")
479 (set_attr "cc" "set_zn")])
482 [(set (cc0) (zero_extract:HI (match_operand:QI
0 "bit_memory_operand" "rU")
484 (match_operand:QI
1 "const_int_operand" "n")))]
487 [(set_attr "length" "
2")
488 (set_attr "cc" "set_zn")])
491 [(set (cc0) (zero_extract:SI (match_operand:QI
0 "bit_memory_operand" "rU")
493 (match_operand:QI
1 "const_int_operand" "n")))]
496 [(set_attr "length" "
2")
497 (set_attr "cc" "set_zn")])
500 [(set (cc0) (zero_extract:QI (match_operand:HI
0 "register_operand" "r")
502 (match_operand:HI
1 "const_int_operand" "n")))]
505 [(set_attr "length" "
2")
506 (set_attr "cc" "set_zn")])
509 [(set (cc0) (zero_extract:HI (match_operand:HI
0 "register_operand" "r")
511 (match_operand:HI
1 "const_int_operand" "n")))]
514 [(set_attr "length" "
2")
515 (set_attr "cc" "set_zn")])
518 [(set (cc0) (zero_extract:SI (match_operand:HI
0 "register_operand" "r")
520 (match_operand:HI
1 "const_int_operand" "n")))]
523 [(set_attr "length" "
2")
524 (set_attr "cc" "set_zn")])
527 [(set (cc0) (match_operand:QI
0 "register_operand" "r"))]
530 [(set_attr "length" "
2")
531 (set_attr "cc" "set_znv")])
534 [(set (cc0) (match_operand:HI
0 "register_operand" "r"))]
537 [(set_attr "length" "
2")
538 (set_attr "cc" "set_znv")])
541 [(set (cc0) (match_operand:SI
0 "register_operand" "r"))]
542 "TARGET_H8300H || TARGET_H8300S"
544 [(set_attr "length" "
2")
545 (set_attr "cc" "set_znv")])
549 (compare:QI (match_operand:QI
0 "register_operand" "r")
550 (match_operand:QI
1 "nonmemory_operand" "rn")))]
553 [(set_attr "length" "
2")
554 (set_attr "cc" "compare")])
556 (define_expand "cmphi"
558 (compare:HI (match_operand:HI
0 "register_operand" "")
559 (match_operand:HI
1 "nonmemory_operand" "")))]
563 /* Force operand1 into a register if we're compiling
565 if (GET_CODE (operands[
1]) != REG && TARGET_H8300)
566 operands[
1] = force_reg (HImode, operands[
1]);
571 (compare:HI (match_operand:HI
0 "register_operand" "r")
572 (match_operand:HI
1 "register_operand" "r")))]
575 [(set_attr "length" "
2")
576 (set_attr "cc" "compare")])
580 (compare:HI (match_operand:HI
0 "register_operand" "r,r")
581 (match_operand:HI
1 "nonmemory_operand" "r,n")))]
582 "TARGET_H8300H || TARGET_H8300S"
584 [(set_attr "length" "
2,
4")
585 (set_attr "cc" "compare,compare")])
589 (compare:SI (match_operand:SI
0 "register_operand" "r,r")
590 (match_operand:SI
1 "nonmemory_operand" "r,i")))]
591 "TARGET_H8300H || TARGET_H8300S"
593 [(set_attr "length" "
2,
6")
594 (set_attr "cc" "compare,compare")])
596 ;; ----------------------------------------------------------------------
598 ;; ----------------------------------------------------------------------
600 (define_insn "addqi3"
601 [(set (match_operand:QI
0 "register_operand" "=r")
602 (plus:QI (match_operand:QI
1 "register_operand" "%
0")
603 (match_operand:QI
2 "nonmemory_operand" "rn")))]
606 [(set_attr "length" "
2")
607 (set_attr "cc" "set_zn")])
609 (define_expand "addhi3"
610 [(set (match_operand:HI
0 "register_operand" "")
611 (plus:HI (match_operand:HI
1 "register_operand" "")
612 (match_operand:HI
2 "nonmemory_operand" "")))]
617 [(set (match_operand:HI
0 "register_operand" "=r,r,r,r,&r")
618 (plus:HI (match_operand:HI
1 "register_operand" "%
0,
0,
0,
0,g")
619 (match_operand:HI
2 "nonmemory_operand" "L,N,n,r,r")))]
624 add.b %s2,%s0\;addx %t2,%t0
626 mov.w %T1,%T0\;add.w %T2,%T0"
627 [(set_attr "length" "
2,
2,
4,
2,
6")
628 (set_attr "cc" "none_0hit,none_0hit,clobber,set_zn,set_zn")])
631 [(set (match_operand:HI
0 "register_operand" "=r,r,r,r,r,r")
632 (plus:HI (match_operand:HI
1 "register_operand" "%
0,
0,
0,
0,
0,
0")
633 (match_operand:HI
2 "nonmemory_operand" "K,T,L,N,n,r")))]
634 "TARGET_H8300H || TARGET_H8300S"
642 [(set_attr "length" "
2,
2,
2,
2,
4,
2")
643 (set_attr "cc" "set_znv,set_znv,none_0hit,none_0hit,set_zn,set_zn")])
646 [(set (match_operand:HI
0 "register_operand" "")
647 (plus:HI (match_dup
0)
648 (match_operand:HI
1 "two_insn_adds_subs_operand" "")))]
651 "split_adds_subs (HImode, operands); DONE;")
653 (define_expand "addsi3"
654 [(set (match_operand:SI
0 "register_operand" "")
655 (plus:SI (match_operand:SI
1 "register_operand" "")
656 (match_operand:SI
2 "nonmemory_operand" "")))]
660 (define_insn "addsi_h8300"
661 [(set (match_operand:SI
0 "register_operand" "=r,r,&r")
662 (plus:SI (match_operand:SI
1 "register_operand" "%
0,
0,r")
663 (match_operand:SI
2 "nonmemory_operand" "n,r,r")))]
666 add %w2,%w0\;addx %x2,%x0\;addx %y2,%y0\;addx %z2,%z0
667 add.w %f2,%f0\;addx %y2,%y0\;addx %z2,%z0
668 mov.w %f1,%f0\;mov.w %e1,%e0\;add.w %f2,%f0\;addx %y2,%y0\;addx %z2,%z0"
669 [(set_attr "length" "
8,
6,
10")
670 (set_attr "cc" "clobber")])
672 (define_insn "addsi_h8300h"
673 [(set (match_operand:SI
0 "register_operand" "=r,r,r,r,r,r")
674 (plus:SI (match_operand:SI
1 "register_operand" "%
0,
0,
0,
0,
0,
0")
675 (match_operand:SI
2 "nonmemory_operand" "K,T,L,N,i,r")))]
676 "TARGET_H8300H || TARGET_H8300S"
684 [(set_attr "length" "
2,
2,
2,
2,
6,
2")
685 (set_attr "cc" "set_znv,set_znv,none_0hit,none_0hit,set_zn,set_zn")])
688 [(set (match_operand:SI
0 "register_operand" "")
689 (plus:SI (match_dup
0)
690 (match_operand:SI
1 "two_insn_adds_subs_operand" "")))]
691 "TARGET_H8300H || TARGET_H8300S"
693 "split_adds_subs (SImode, operands); DONE;")
695 ;; ----------------------------------------------------------------------
696 ;; SUBTRACT INSTRUCTIONS
697 ;; ----------------------------------------------------------------------
699 (define_insn "subqi3"
700 [(set (match_operand:QI
0 "register_operand" "=r,r")
701 (minus:QI (match_operand:QI
1 "register_operand" "
0,
0")
702 (match_operand:QI
2 "nonmemory_operand" "r,n")))]
707 [(set_attr "length" "
2")
708 (set_attr "cc" "set_zn")])
710 (define_expand "subhi3"
711 [(set (match_operand:HI
0 "register_operand" "")
712 (minus:HI (match_operand:HI
1 "general_operand" "")
713 (match_operand:HI
2 "nonmemory_operand" "")))]
718 [(set (match_operand:HI
0 "register_operand" "=r,&r")
719 (minus:HI (match_operand:HI
1 "general_operand" "
0,
0")
720 (match_operand:HI
2 "nonmemory_operand" "r,n")))]
724 add.b %E2,%s0\;addx %F2,%t0"
725 [(set_attr "length" "
2,
4")
726 (set_attr "cc" "set_zn,clobber")])
729 [(set (match_operand:HI
0 "register_operand" "=r,&r")
730 (minus:HI (match_operand:HI
1 "general_operand" "
0,
0")
731 (match_operand:HI
2 "nonmemory_operand" "r,n")))]
732 "TARGET_H8300H || TARGET_H8300S"
736 [(set_attr "length" "
2,
4")
737 (set_attr "cc" "set_zn,set_zn")])
739 (define_expand "subsi3"
740 [(set (match_operand:SI
0 "register_operand" "")
741 (minus:SI (match_operand:SI
1 "register_operand" "")
742 (match_operand:SI
2 "nonmemory_operand" "")))]
746 (define_insn "subsi3_h8300"
747 [(set (match_operand:SI
0 "register_operand" "=r")
748 (minus:SI (match_operand:SI
1 "register_operand" "
0")
749 (match_operand:SI
2 "register_operand" "r")))]
751 "sub.w %f2,%f0\;subx %y2,%y0\;subx %z2,%z0"
752 [(set_attr "length" "
6")
753 (set_attr "cc" "clobber")])
755 (define_insn "subsi3_h8300h"
756 [(set (match_operand:SI
0 "register_operand" "=r,r")
757 (minus:SI (match_operand:SI
1 "general_operand" "
0,
0")
758 (match_operand:SI
2 "nonmemory_operand" "r,i")))]
759 "TARGET_H8300H || TARGET_H8300S"
763 [(set_attr "length" "
2,
6")
764 (set_attr "cc" "set_zn,set_zn")])
766 ;; ----------------------------------------------------------------------
767 ;; MULTIPLY INSTRUCTIONS
768 ;; ----------------------------------------------------------------------
770 ;; Note that the H8/
300 can only handle umulqihi3.
772 (define_insn "mulqihi3"
773 [(set (match_operand:HI
0 "register_operand" "=r")
774 (mult:HI (sign_extend:HI (match_operand:QI
1 "general_operand" "%
0"))
775 (sign_extend:HI (match_operand:QI
2 "register_operand" "r"))))]
776 "TARGET_H8300H || TARGET_H8300S"
778 [(set_attr "length" "
4")
779 (set_attr "cc" "set_zn")])
781 (define_insn "mulhisi3"
782 [(set (match_operand:SI
0 "register_operand" "=r")
783 (mult:SI (sign_extend:SI (match_operand:HI
1 "general_operand" "%
0"))
784 (sign_extend:SI (match_operand:HI
2 "register_operand" "r"))))]
785 "TARGET_H8300H || TARGET_H8300S"
787 [(set_attr "length" "
4")
788 (set_attr "cc" "set_zn")])
790 (define_insn "umulqihi3"
791 [(set (match_operand:HI
0 "register_operand" "=r")
792 (mult:HI (zero_extend:HI (match_operand:QI
1 "general_operand" "%
0"))
793 (zero_extend:HI (match_operand:QI
2 "register_operand" "r"))))]
796 [(set_attr "length" "
2")
797 (set_attr "cc" "none_0hit")])
799 (define_insn "umulhisi3"
800 [(set (match_operand:SI
0 "register_operand" "=r")
801 (mult:SI (zero_extend:SI (match_operand:HI
1 "general_operand" "%
0"))
802 (zero_extend:SI (match_operand:HI
2 "register_operand" "r"))))]
803 "TARGET_H8300H || TARGET_H8300S"
805 [(set_attr "length" "
2")
806 (set_attr "cc" "none_0hit")])
808 ;; This is a "bridge" instruction. Combine can't cram enough insns
809 ;; together to crate a MAC instruction directly, but it can create
810 ;; this instruction, which then allows combine to create the real
813 ;; Unfortunately, if combine doesn't create a MAC instruction, this
814 ;; insn must generate reasonably correct code. Egad.
816 [(set (match_operand:SI
0 "register_operand" "=a")
819 (mem:HI (post_inc:SI (match_operand:SI
1 "register_operand" "r"))))
821 (mem:HI (post_inc:SI (match_operand:SI
2 "register_operand" "r"))))))]
823 "clrmac\;mac @%
2+,@%
1+"
824 [(set_attr "length" "
6")
825 (set_attr "cc" "none_0hit")])
828 [(set (match_operand:SI
0 "register_operand" "=a")
830 (sign_extend:SI (mem:HI
831 (post_inc:SI (match_operand:SI
1 "register_operand" "r"))))
832 (sign_extend:SI (mem:HI
833 (post_inc:SI (match_operand:SI
2 "register_operand" "r")))))
834 (match_operand:SI
3 "register_operand" "
0")))]
837 [(set_attr "length" "
4")
838 (set_attr "cc" "none_0hit")])
840 ;; ----------------------------------------------------------------------
841 ;; DIVIDE INSTRUCTIONS
842 ;; ----------------------------------------------------------------------
844 (define_insn "udivqi3"
845 [(set (match_operand:QI
0 "register_operand" "=r")
848 (match_operand:HI
1 "general_operand" "
0")
849 (zero_extend:HI (match_operand:QI
2 "register_operand" "r")))))]
852 [(set_attr "length" "
2")
853 (set_attr "cc" "clobber")])
855 ;; ??? Will divxu always work here?
857 (define_insn "divqi3"
858 [(set (match_operand:QI
0 "register_operand" "=r")
861 (match_operand:HI
1 "general_operand" "
0")
862 (sign_extend:HI (match_operand:QI
2 "register_operand" "r")))))]
865 [(set_attr "length" "
2")
866 (set_attr "cc" "clobber")])
868 (define_insn "udivhi3"
869 [(set (match_operand:HI
0 "register_operand" "=r")
872 (match_operand:SI
1 "general_operand" "
0")
873 (zero_extend:SI (match_operand:HI
2 "register_operand" "r")))))]
874 "TARGET_H8300H || TARGET_H8300S"
876 [(set_attr "length" "
2")
877 (set_attr "cc" "clobber")])
879 (define_insn "divhi3"
880 [(set (match_operand:HI
0 "register_operand" "=r")
883 (match_operand:SI
1 "general_operand" "
0")
884 (sign_extend:SI (match_operand:HI
2 "register_operand" "r")))))]
885 "TARGET_H8300H || TARGET_H8300S"
887 [(set_attr "length" "
4")
888 (set_attr "cc" "clobber")])
890 ;; ----------------------------------------------------------------------
892 ;; ----------------------------------------------------------------------
894 (define_insn "umodqi3"
895 [(set (match_operand:QI
0 "register_operand" "=r")
898 (match_operand:HI
1 "general_operand" "
0")
899 (zero_extend:HI (match_operand:QI
2 "register_operand" "r")))))]
901 "divxu %X2,%T0\;mov %t0,%s0"
902 [(set_attr "length" "
4")
903 (set_attr "cc" "clobber")])
905 (define_insn "modqi3"
906 [(set (match_operand:QI
0 "register_operand" "=r")
909 (match_operand:HI
1 "general_operand" "
0")
910 (sign_extend:HI (match_operand:QI
2 "register_operand" "r")))))]
911 "TARGET_H8300H || TARGET_H8300S"
912 "divxs.b %X2,%T0\;mov %t0,%s0"
913 [(set_attr "length" "
6")
914 (set_attr "cc" "clobber")])
916 (define_insn "umodhi3"
917 [(set (match_operand:HI
0 "register_operand" "=r")
920 (match_operand:SI
1 "general_operand" "
0")
921 (zero_extend:SI (match_operand:HI
2 "register_operand" "r")))))]
922 "TARGET_H8300H || TARGET_H8300S"
923 "divxu.w %T2,%S0\;mov %e0,%f0"
924 [(set_attr "length" "
4")
925 (set_attr "cc" "clobber")])
927 (define_insn "modhi3"
928 [(set (match_operand:HI
0 "register_operand" "=r")
931 (match_operand:SI
1 "general_operand" "
0")
932 (sign_extend:SI (match_operand:HI
2 "register_operand" "r")))))]
933 "TARGET_H8300H || TARGET_H8300S"
934 "divxs.w %T2,%S0\;mov %e0,%f0"
935 [(set_attr "length" "
6")
936 (set_attr "cc" "clobber")])
938 ;; ----------------------------------------------------------------------
940 ;; ----------------------------------------------------------------------
943 [(set (match_operand:QI
0 "bit_operand" "=r,U")
944 (and:QI (match_operand:QI
1 "bit_operand" "%
0,
0")
945 (match_operand:QI
2 "nonmemory_operand" "rn,O")))]
946 "register_operand (operands[
0], QImode) || o_operand (operands[
2], QImode)"
950 [(set_attr "length" "
2,
4")
951 (set_attr "adjust_length" "no")
952 (set_attr "cc" "set_znv,none_0hit")])
954 (define_expand "andqi3"
955 [(set (match_operand:QI
0 "bit_operand" "")
956 (and:QI (match_operand:QI
1 "bit_operand" "")
957 (match_operand:QI
2 "nonmemory_operand" "")))]
961 if (fix_bit_operand (operands, 'O', AND))
965 (define_insn "andhi3"
966 [(set (match_operand:HI
0 "register_operand" "=r")
967 (and:HI (match_operand:HI
1 "register_operand" "%
0")
968 (match_operand:HI
2 "nonmemory_operand" "rn")))]
972 if (GET_CODE (operands[
2]) == CONST_INT)
974 int i = INTVAL (operands[
2]);
976 if ((i &
0x00ff) !=
0x00ff)
977 output_asm_insn (
\"and %s2,%s0
\", operands);
978 if ((i &
0xff00) !=
0xff00)
979 output_asm_insn (
\"and %t2,%t0
\", operands);
982 if (TARGET_H8300H || TARGET_H8300S)
983 return
\"and.w %T2,%T0
\";
984 return
\"and %s2,%s0\;and %t2,%t0;
\";
986 [(set_attr "length" "
4")
987 (set_attr "cc" "clobber")])
989 (define_insn "andsi3"
990 [(set (match_operand:SI
0 "register_operand" "=r")
991 (and:SI (match_operand:SI
1 "register_operand" "%
0")
992 (match_operand:SI
2 "nonmemory_operand" "rn")))]
996 if (GET_CODE (operands[
2]) == CONST_INT)
998 int i = INTVAL (operands[
2]);
999 int upper_cleared, lower_cleared;
1001 /* The h8300h can't do byte-wise operations on the
1002 upper
16bits of
32bit registers. However, if
1003 those bits aren't going to change, or they're
1004 going to be zero'd out, then we can work on the
1006 if ((TARGET_H8300H || TARGET_H8300S)
1007 && ((i &
0xffff0000) !=
0xffff0000
1008 || (i &
0xffff0000) ==
0x00000000))
1009 return
\"and.l %S2,%S0
\";
1012 if ((i &
0x0000ffff) ==
0x00000000)
1014 output_asm_insn (
\"sub.w %f0,%f0
\", operands);
1019 if ((i &
0xffff0000) ==
0x00000000)
1021 output_asm_insn (
\"sub.w %e0,%e0
\", operands);
1025 if ((i &
0x000000ff) !=
0x000000ff && !lower_cleared)
1026 output_asm_insn (
\"and %w2,%w0
\", operands);
1027 if ((i &
0x0000ff00) !=
0x0000ff00 && !lower_cleared)
1028 output_asm_insn (
\"and %x2,%x0
\", operands);
1029 if ((i &
0x00ff0000) !=
0x00ff0000 && !upper_cleared)
1030 output_asm_insn (
\"and %y2,%y0
\", operands);
1031 if ((i &
0xff000000) !=
0xff000000 && !upper_cleared)
1032 output_asm_insn (
\"and %z2,%z0
\", operands);
1035 if (TARGET_H8300H || TARGET_H8300S)
1036 return
\"and.l %S2,%S0
\";
1037 return
\"and %w2,%w0\;and %x2,%x0\;and %y2,%y0\;and %z2,%z0
\";
1039 [(set_attr "length" "
8")
1040 (set_attr "cc" "clobber")])
1043 ;; ----------------------------------------------------------------------
1045 ;; ----------------------------------------------------------------------
1048 [(set (match_operand:QI
0 "bit_operand" "=r,U")
1049 (ior:QI (match_operand:QI
1 "bit_operand" "%
0,
0")
1050 (match_operand:QI
2 "nonmemory_operand" "rn,P")))]
1051 "register_operand (operands[
0], QImode) || p_operand (operands[
2], QImode)"
1055 [(set_attr "length" "
2,
4")
1056 (set_attr "adjust_length" "no")
1057 (set_attr "cc" "set_znv,none_0hit")])
1059 (define_expand "iorqi3"
1060 [(set (match_operand:QI
0 "bit_operand" "=r,U")
1061 (ior:QI (match_operand:QI
1 "bit_operand" "%
0,
0")
1062 (match_operand:QI
2 "nonmemory_operand" "rn,P")))]
1066 if (fix_bit_operand (operands, 'P', IOR))
1070 (define_insn "iorhi3"
1071 [(set (match_operand:HI
0 "general_operand" "=r,r")
1072 (ior:HI (match_operand:HI
1 "general_operand" "%
0,
0")
1073 (match_operand:HI
2 "general_operand" "J,rn")))]
1077 if (GET_CODE (operands[
2]) == CONST_INT)
1079 int i = INTVAL (operands[
2]);
1081 if ((i &
0x00ff) !=
0)
1082 output_asm_insn (
\"or %s2,%s0
\", operands);
1083 if ((i &
0xff00) !=
0)
1084 output_asm_insn (
\"or %t2,%t0
\", operands);
1087 if (TARGET_H8300H || TARGET_H8300S)
1088 return
\"or.w %T2,%T0
\";
1089 return
\"or %s2,%s0\;or %t2,%t0; %
2 or2
\";
1091 [(set_attr "length" "
2,
4")
1092 (set_attr "cc" "clobber,clobber")])
1094 (define_insn "iorsi3"
1095 [(set (match_operand:SI
0 "register_operand" "=r,r")
1096 (ior:SI (match_operand:SI
1 "register_operand" "%
0,
0")
1097 (match_operand:SI
2 "nonmemory_operand" "J,rn")))]
1101 if (GET_CODE (operands[
2]) == CONST_INT)
1103 int i = INTVAL (operands[
2]);
1105 /* The h8300h can't do byte-wise operations on the
1106 upper
16bits of
32bit registers. However, if
1107 those bits aren't going to change, then we can
1108 work on the low-order bits. */
1109 if ((TARGET_H8300H || TARGET_H8300S)
1110 && (i &
0xffff0000) !=
0x00000000)
1111 return
\"or.l %S2,%S0
\";
1113 if ((i &
0x000000ff) !=
0)
1114 output_asm_insn (
\"or %w2,%w0
\", operands);
1115 if ((i &
0x0000ff00) !=
0)
1116 output_asm_insn (
\"or %x2,%x0
\", operands);
1117 if ((i &
0x00ff0000) !=
0)
1118 output_asm_insn (
\"or %y2,%y0
\", operands);
1119 if ((i &
0xff000000) !=
0)
1120 output_asm_insn (
\"or %z2,%z0
\", operands);
1123 if (TARGET_H8300H || TARGET_H8300S)
1124 return
\"or.l %S2,%S0
\";
1125 return
\"or %w2,%w0\;or %x2,%x0\;or %y2,%y0\;or %z2,%z0
\";
1127 [(set_attr "length" "
2,
8")
1128 (set_attr "cc" "clobber,clobber")])
1130 ;; ----------------------------------------------------------------------
1132 ;; ----------------------------------------------------------------------
1135 [(set (match_operand:QI
0 "bit_operand" "=r,U")
1136 (xor:QI (match_operand:QI
1 "bit_operand" "%
0,
0")
1137 (match_operand:QI
2 "nonmemory_operand" "rn,P")))]
1138 "register_operand (operands[
0], QImode) || p_operand (operands[
2], QImode)"
1142 [(set_attr "length" "
2,
4")
1143 (set_attr "adjust_length" "no")
1144 (set_attr "cc" "set_znv,none_0hit")])
1146 (define_expand "xorqi3"
1147 [(set (match_operand:QI
0 "bit_operand" "=r,U")
1148 (xor:QI (match_operand:QI
1 "bit_operand" "%
0,
0")
1149 (match_operand:QI
2 "nonmemory_operand" "rn,O")))]
1153 if (fix_bit_operand (operands, 'O', XOR))
1157 (define_insn "xorhi3"
1158 [(set (match_operand:HI
0 "register_operand" "=r,r")
1159 (xor:HI (match_operand:HI
1 "general_operand" "%
0,
0")
1160 (match_operand:HI
2 "nonmemory_operand" "J,rn")))]
1164 if (GET_CODE (operands[
2]) == CONST_INT)
1166 int i = INTVAL (operands[
2]);
1168 if ((i &
0x00ff) !=
0)
1169 output_asm_insn (
\"xor %s2,%s0
\", operands);
1170 if ((i &
0xff00) !=
0)
1171 output_asm_insn (
\"xor %t2,%t0
\", operands);
1174 if (TARGET_H8300H || TARGET_H8300S)
1175 return
\"xor.w %T2,%T0
\";
1176 return
\"xor %s2,%s0\;xor %t2,%t0
\";
1178 [(set_attr "length" "
2,
4")
1179 (set_attr "cc" "clobber,clobber")])
1181 (define_insn "xorsi3"
1182 [(set (match_operand:SI
0 "register_operand" "=r,r")
1183 (xor:SI (match_operand:SI
1 "register_operand" "%
0,
0")
1184 (match_operand:SI
2 "nonmemory_operand" "J,rn")))]
1188 if (GET_CODE (operands[
2]) == CONST_INT)
1190 int i = INTVAL (operands[
2]);
1192 /* The h8300h can't do byte-wise operations on the
1193 upper
16bits of
32bit registers. However, if
1194 those bits aren't going to change, then we can
1195 work on the low-order bits. */
1196 if ((TARGET_H8300H || TARGET_H8300S)
1197 && (i &
0xffff0000) !=
0x00000000)
1198 return
\"xor.l %S2,%S0
\";
1200 if ((i &
0x000000ff) !=
0)
1201 output_asm_insn (
\"xor %w2,%w0
\", operands);
1202 if ((i &
0x0000ff00) !=
0)
1203 output_asm_insn (
\"xor %x2,%x0
\", operands);
1204 if ((i &
0x00ff0000) !=
0)
1205 output_asm_insn (
\"xor %y2,%y0
\", operands);
1206 if ((i &
0xff000000) !=
0)
1207 output_asm_insn (
\"xor %z2,%z0
\", operands);
1210 if (TARGET_H8300H || TARGET_H8300S)
1211 return
\"xor.l %S2,%S0
\";
1212 return
\"xor %w2,%w0\;xor %x2,%x0\;xor %y2,%y0\;xor %z2,%z0
\";
1214 [(set_attr "length" "
2,
8")
1215 (set_attr "cc" "clobber,clobber")])
1217 ;; ----------------------------------------------------------------------
1218 ;; NEGATION INSTRUCTIONS
1219 ;; ----------------------------------------------------------------------
1221 (define_insn "negqi2"
1222 [(set (match_operand:QI
0 "register_operand" "=r")
1223 (neg:QI (match_operand:QI
1 "general_operand" "
0")))]
1226 [(set_attr "length" "
2")
1227 (set_attr "cc" "set_zn")])
1229 (define_expand "neghi2"
1230 [(set (match_operand:HI
0 "register_operand" "=r")
1231 (neg:HI (match_operand:HI
1 "general_operand" "
0")))]
1237 emit_insn (gen_neghi2_h8300 (operands[
0], operands[
1]));
1242 (define_expand "neghi2_h8300"
1244 (not:HI (match_operand:HI
1 "register_operand" "r")))
1245 (set (match_dup
2) (plus:HI (match_dup
2) (const_int
1)))
1246 (set (match_operand:HI
0 "register_operand" "=r")
1249 "{ operands[
2] = gen_reg_rtx (HImode); }")
1251 (define_insn "neghi2_h8300h"
1252 [(set (match_operand:HI
0 "register_operand" "=r")
1253 (neg:HI (match_operand:HI
1 "general_operand" "
0")))]
1254 "TARGET_H8300H || TARGET_H8300S"
1256 [(set_attr "length" "
2")
1257 (set_attr "cc" "set_zn")])
1259 (define_expand "negsi2"
1260 [(set (match_operand:SI
0 "register_operand" "=r")
1261 (neg:SI (match_operand:SI
1 "general_operand" "
0")))]
1267 emit_insn (gen_negsi2_h8300 (operands[
0], operands[
1]));
1272 (define_expand "negsi2_h8300"
1274 (not:SI (match_operand:SI
1 "register_operand" "r")))
1275 (set (match_dup
2) (plus:SI (match_dup
2) (const_int
1)))
1276 (set (match_operand:SI
0 "register_operand" "=r")
1279 "{ operands[
2] = gen_reg_rtx(SImode); }")
1281 (define_insn "negsi2_h8300h"
1282 [(set (match_operand:SI
0 "register_operand" "=r")
1283 (neg:SI (match_operand:SI
1 "general_operand" "
0")))]
1284 "TARGET_H8300H || TARGET_H8300S"
1286 [(set_attr "length" "
2")
1287 (set_attr "cc" "set_zn")])
1289 ;; ----------------------------------------------------------------------
1291 ;; ----------------------------------------------------------------------
1293 (define_insn "one_cmplqi2"
1294 [(set (match_operand:QI
0 "register_operand" "=r")
1295 (not:QI (match_operand:QI
1 "general_operand" "
0")))]
1298 [(set_attr "length" "
2")
1299 (set_attr "cc" "set_znv")])
1301 (define_insn "one_cmplhi2"
1302 [(set (match_operand:HI
0 "register_operand" "=r")
1303 (not:HI (match_operand:HI
1 "general_operand" "
0")))]
1308 return
\"not %s0\;not %t0
\";
1312 [(set_attr "cc" "clobber")
1313 (set (attr "length")
1314 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
1319 (define_insn "one_cmplsi2"
1320 [(set (match_operand:SI
0 "register_operand" "=r")
1321 (not:SI (match_operand:SI
1 "general_operand" "
0")))]
1326 return
\"not %w0\;not %x0\;not %y0\;not %z0
\";
1330 [(set_attr "cc" "clobber")
1331 (set (attr "length")
1332 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
1337 ;; ----------------------------------------------------------------------
1338 ;; JUMP INSTRUCTIONS
1339 ;; ----------------------------------------------------------------------
1341 ;; Conditional jump instructions
1343 (define_expand "ble"
1345 (if_then_else (le (cc0)
1347 (label_ref (match_operand
0 "" ""))
1352 (define_expand "bleu"
1354 (if_then_else (leu (cc0)
1356 (label_ref (match_operand
0 "" ""))
1361 (define_expand "bge"
1363 (if_then_else (ge (cc0)
1365 (label_ref (match_operand
0 "" ""))
1370 (define_expand "bgeu"
1372 (if_then_else (geu (cc0)
1374 (label_ref (match_operand
0 "" ""))
1379 (define_expand "blt"
1381 (if_then_else (lt (cc0)
1383 (label_ref (match_operand
0 "" ""))
1388 (define_expand "bltu"
1390 (if_then_else (ltu (cc0)
1392 (label_ref (match_operand
0 "" ""))
1397 (define_expand "bgt"
1399 (if_then_else (gt (cc0)
1401 (label_ref (match_operand
0 "" ""))
1406 (define_expand "bgtu"
1408 (if_then_else (gtu (cc0)
1410 (label_ref (match_operand
0 "" ""))
1415 (define_expand "beq"
1417 (if_then_else (eq (cc0)
1419 (label_ref (match_operand
0 "" ""))
1424 (define_expand "bne"
1426 (if_then_else (ne (cc0)
1428 (label_ref (match_operand
0 "" ""))
1433 (define_insn "branch_true"
1435 (if_then_else (match_operator
1 "comparison_operator"
1436 [(cc0) (const_int
0)])
1437 (label_ref (match_operand
0 "" ""))
1442 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) !=
0
1443 && (GET_CODE (operands[
1]) == GT
1444 || GET_CODE (operands[
1]) == GE
1445 || GET_CODE (operands[
1]) == LE
1446 || GET_CODE (operands[
1]) == LT))
1448 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
1452 if (get_attr_length (insn) ==
2)
1453 return
\"b%j1 %l0
\";
1454 else if (get_attr_length (insn) ==
4)
1455 return
\"b%j1 %l0:
16\";
1457 return
\"b%k1 .Lh8BR%=\;jmp @%l0
\\n.Lh8BR%=:
\";
1459 [(set_attr "type" "branch")
1460 (set_attr "cc" "none")])
1462 (define_insn "branch_false"
1464 (if_then_else (match_operator
1 "comparison_operator"
1465 [(cc0) (const_int
0)])
1467 (label_ref (match_operand
0 "" ""))))]
1471 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) !=
0
1472 && (GET_CODE (operands[
1]) == GT
1473 || GET_CODE (operands[
1]) == GE
1474 || GET_CODE (operands[
1]) == LE
1475 || GET_CODE (operands[
1]) == LT))
1477 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
1481 if (get_attr_length (insn) ==
2)
1482 return
\"b%k1 %l0
\";
1483 else if (get_attr_length (insn) ==
4)
1484 return
\"b%k1 %l0:
16\";
1486 return
\"b%j1 .Lh8BR%=\;jmp @%l0
\\n.Lh8BR%=:
\";
1488 [(set_attr "type" "branch")
1489 (set_attr "cc" "none")])
1491 ;; Unconditional and other jump instructions.
1495 (label_ref (match_operand
0 "" "")))]
1499 if (get_attr_length (insn) ==
2)
1501 else if (get_attr_length (insn) ==
4)
1502 return
\"bra %l0:
16\";
1504 return
\"jmp @%l0
\";
1506 [(set_attr "type" "branch")
1507 (set_attr "cc" "none")])
1509 ;; This is a define expand, because pointers may be either
16 or
32 bits.
1511 (define_expand "tablejump"
1512 [(parallel [(set (pc) (match_operand
0 "register_operand" "r"))
1513 (use (label_ref (match_operand
1 "" "")))])]
1517 (define_insn "tablejump_h8300"
1518 [(set (pc) (match_operand:HI
0 "register_operand" "r"))
1519 (use (label_ref (match_operand
1 "" "")))]
1522 [(set_attr "cc" "none")
1523 (set_attr "length" "
2")])
1525 (define_insn "tablejump_h8300h"
1526 [(set (pc) (match_operand:SI
0 "register_operand" "r"))
1527 (use (label_ref (match_operand
1 "" "")))]
1528 "TARGET_H8300H || TARGET_H8300S"
1530 [(set_attr "cc" "none")
1531 (set_attr "length" "
2")])
1533 ;; This is a define expand, because pointers may be either
16 or
32 bits.
1535 (define_expand "indirect_jump"
1536 [(set (pc) (match_operand
0 "jump_address_operand" ""))]
1540 (define_insn "indirect_jump_h8300"
1541 [(set (pc) (match_operand:HI
0 "jump_address_operand" "Vr"))]
1544 [(set_attr "cc" "none")
1545 (set_attr "length" "
2")])
1547 (define_insn "indirect_jump_h8300h"
1548 [(set (pc) (match_operand:SI
0 "jump_address_operand" "Vr"))]
1549 "TARGET_H8300H || TARGET_H8300S"
1551 [(set_attr "cc" "none")
1552 (set_attr "length" "
2")])
1554 ;; Call subroutine with no return value.
1556 ;; ??? Even though we use HImode here, this works for the
300h.
1559 [(call (match_operand:QI
0 "call_insn_operand" "or")
1560 (match_operand:HI
1 "general_operand" "g"))]
1564 if (GET_CODE (XEXP (operands[
0],
0)) == SYMBOL_REF
1565 && SYMBOL_REF_FLAG (XEXP (operands[
0],
0)))
1566 return
\"jsr
\\t\@%
0:
8\";
1568 return
\"jsr
\\t%
0\";
1570 [(set_attr "cc" "clobber")
1571 (set (attr "length")
1572 (if_then_else (match_operand:QI
0 "small_call_insn_operand" "")
1576 ;; Call subroutine, returning value in operand
0
1577 ;; (which must be a hard register).
1579 ;; ??? Even though we use HImode here, this works on the
300h.
1581 (define_insn "call_value"
1582 [(set (match_operand
0 "" "=r")
1583 (call (match_operand:QI
1 "call_insn_operand" "or")
1584 (match_operand:HI
2 "general_operand" "g")))]
1588 if (GET_CODE (XEXP (operands[
1],
0)) == SYMBOL_REF
1589 && SYMBOL_REF_FLAG (XEXP (operands[
1],
0)))
1590 return
\"jsr
\\t\@%
1:
8\";
1592 return
\"jsr
\\t%
1\";
1594 [(set_attr "cc" "clobber")
1595 (set (attr "length")
1596 (if_then_else (match_operand:QI
0 "small_call_insn_operand" "")
1604 [(set_attr "cc" "none")
1605 (set_attr "length" "
2")])
1607 ;; ----------------------------------------------------------------------
1608 ;; EXTEND INSTRUCTIONS
1609 ;; ----------------------------------------------------------------------
1611 (define_insn "zero_extendqihi2"
1612 [(set (match_operand:HI
0 "register_operand" "=r,r")
1613 (zero_extend:HI (match_operand:QI
1 "general_operand_src" "
0,g>")))]
1617 mov.b %R1,%s0\;mov.b #
0,%t0"
1618 [(set_attr "length" "
2,
4")
1619 (set_attr "cc" "clobber,clobber")])
1621 ;; The compiler can synthesize a
300H variant of this which is
1622 ;; just as efficient as one that we'd create
1623 (define_insn "zero_extendqisi2"
1624 [(set (match_operand:SI
0 "register_operand" "=r,r")
1625 (zero_extend:SI (match_operand:QI
1 "general_operand_src" "
0,g>")))]
1628 mov.b #
0,%x0\;sub.w %e0,%e0
1629 mov.b %R1,%w0\;mov.b #
0,%x0\;sub.w %e0,%e0"
1630 [(set_attr "length" "
4,
6")
1631 (set_attr "cc" "clobber,clobber")])
1633 (define_expand "zero_extendhisi2"
1634 [(set (match_operand:SI
0 "register_operand" "")
1635 (zero_extend:SI (match_operand:HI
1 "register_operand" "")))]
1639 ;; %e prints the high part of a CONST_INT, not the low part. Arggh.
1641 [(set (match_operand:SI
0 "register_operand" "=r,r,r")
1642 (zero_extend:SI (match_operand:HI
1 "general_operand_src" "
0,i,g>")))]
1646 mov.w %f1,%f0\;sub.w %e0,%e0
1647 mov.w %e1,%f0\;sub.w %e0,%e0"
1648 [(set_attr "length" "
2,
4,
4")
1649 (set_attr "cc" "clobber,clobber,clobber")])
1652 [(set (match_operand:SI
0 "register_operand" "=r")
1653 (zero_extend:SI (match_operand:HI
1 "register_operand" "
0")))]
1654 "TARGET_H8300H || TARGET_H8300S"
1656 [(set_attr "length" "
2")
1657 (set_attr "cc" "set_znv")])
1659 (define_expand "extendqihi2"
1660 [(set (match_operand:HI
0 "register_operand" "")
1661 (sign_extend:HI (match_operand:QI
1 "register_operand" "")))]
1666 [(set (match_operand:HI
0 "register_operand" "=r,r")
1667 (sign_extend:HI (match_operand:QI
1 "general_operand_src" "
0,g>")))]
1670 bld #
7,%s0\;subx %t0,%t0
1671 mov.b %R1,%s0\;bld #
7,%s0\;subx %t0,%t0"
1672 [(set_attr "length" "
4,
6")
1673 (set_attr "cc" "clobber,clobber")])
1676 [(set (match_operand:HI
0 "register_operand" "=r")
1677 (sign_extend:HI (match_operand:QI
1 "register_operand" "
0")))]
1678 "TARGET_H8300H || TARGET_H8300S"
1680 [(set_attr "length" "
2")
1681 (set_attr "cc" "set_znv")])
1683 ;; The compiler can synthesize a
300H variant of this which is
1684 ;; just as efficient as one that we'd create
1685 (define_insn "extendqisi2"
1686 [(set (match_operand:SI
0 "register_operand" "=r,r")
1687 (sign_extend:SI (match_operand:QI
1 "general_operand_src" "
0,g>")))]
1690 bld #
7,%w0\;subx %x0,%x0\;subx %y0,%y0\;subx %z0,%z0
1691 mov.b %R1,%w0\;bld #
7,%w0\;subx %x0,%x0\;subx %y0,%y0\;subx %z0,%z0"
1692 [(set_attr "length" "
8,
10")
1693 (set_attr "cc" "clobber,clobber")])
1695 (define_expand "extendhisi2"
1696 [(set (match_operand:SI
0 "register_operand" "")
1697 (sign_extend:SI (match_operand:HI
1 "register_operand" "")))]
1702 [(set (match_operand:SI
0 "register_operand" "=r,r")
1703 (sign_extend:SI (match_operand:HI
1 "general_operand_src" "
0,g>")))]
1706 bld #
7,%x0\;subx %y0,%y0\;subx %z0,%z0
1707 mov.w %T1,%f0\;bld #
7,%x0\;subx %y0,%y0\;subx %z0,%z0"
1708 [(set_attr "length" "
6,
8")
1709 (set_attr "cc" "clobber,clobber")])
1712 [(set (match_operand:SI
0 "register_operand" "=r")
1713 (sign_extend:SI (match_operand:HI
1 "register_operand" "
0")))]
1714 "TARGET_H8300H || TARGET_H8300S"
1716 [(set_attr "length" "
2")
1717 (set_attr "cc" "set_znv")])
1719 ;; ----------------------------------------------------------------------
1721 ;; ----------------------------------------------------------------------
1723 ;; We make some attempt to provide real efficient shifting. One example is
1724 ;; doing an
8 bit shift of a
16 bit value by moving a byte reg into the other
1725 ;; reg and moving
0 into the former reg.
1727 ;; We also try to achieve this in a uniform way. IE: We don't try to achieve
1728 ;; this in both rtl and at insn emit time. Ideally, we'd use rtl as that would
1729 ;; give the optimizer more cracks at the code. However, we wish to do things
1730 ;; like optimizing shifting the sign bit to bit
0 by rotating the other way.
1731 ;; There is rtl to handle this (rotate + and), but the H8/
300 doesn't handle
1732 ;;
16 bit rotates. Also, if we emit complicated rtl, combine may not be able
1733 ;; to detect cases it can optimize.
1735 ;; For these and other fuzzy reasons, I've decided to go the less pretty but
1736 ;; easier "do it at insn emit time" route.
1740 (define_expand "ashlqi3"
1741 [(set (match_operand:QI
0 "register_operand" "")
1742 (ashift:QI (match_operand:QI
1 "register_operand" "")
1743 (match_operand:QI
2 "nonmemory_operand" "")))]
1745 "if (expand_a_shift (QImode, ASHIFT, operands)) DONE;else FAIL;")
1747 (define_expand "ashrqi3"
1748 [(set (match_operand:QI
0 "register_operand" "")
1749 (ashiftrt:QI (match_operand:QI
1 "register_operand" "")
1750 (match_operand:QI
2 "nonmemory_operand" "")))]
1752 "if (expand_a_shift (QImode, ASHIFTRT, operands)) DONE;else FAIL;")
1754 (define_expand "lshrqi3"
1755 [(set (match_operand:QI
0 "register_operand" "")
1756 (lshiftrt:QI (match_operand:QI
1 "register_operand" "")
1757 (match_operand:QI
2 "nonmemory_operand" "")))]
1759 "if (expand_a_shift (QImode, LSHIFTRT, operands)) DONE;else FAIL;")
1762 [(set (match_operand:QI
0 "register_operand" "=r,r")
1763 (match_operator:QI
3 "nshift_operator"
1764 [ (match_operand:QI
1 "register_operand" "
0,
0")
1765 (match_operand:QI
2 "nonmemory_operand" "KM,rn")]))
1766 (clobber (match_scratch:QI
4 "=X,&r"))]
1768 "* return emit_a_shift (insn, operands);"
1769 [(set_attr "length" "
20")
1770 (set_attr "cc" "clobber")])
1774 (define_expand "ashlhi3"
1775 [(set (match_operand:HI
0 "register_operand" "")
1776 (ashift:HI (match_operand:HI
1 "nonmemory_operand" "")
1777 (match_operand:QI
2 "nonmemory_operand" "")))]
1779 "if (expand_a_shift (HImode, ASHIFT, operands)) DONE;else FAIL;")
1781 (define_expand "lshrhi3"
1782 [(set (match_operand:HI
0 "register_operand" "")
1783 (lshiftrt:HI (match_operand:HI
1 "general_operand" "")
1784 (match_operand:QI
2 "nonmemory_operand" "")))]
1786 "if (expand_a_shift (HImode, LSHIFTRT, operands)) DONE;else FAIL;")
1788 (define_expand "ashrhi3"
1789 [(set (match_operand:HI
0 "register_operand" "")
1790 (ashiftrt:HI (match_operand:HI
1 "register_operand" "")
1791 (match_operand:QI
2 "nonmemory_operand" "")))]
1793 "if (expand_a_shift (HImode, ASHIFTRT, operands)) DONE;else FAIL;")
1796 [(set (match_operand:HI
0 "register_operand" "=r,r")
1797 (match_operator:HI
3 "nshift_operator"
1798 [ (match_operand:HI
1 "register_operand" "
0,
0")
1799 (match_operand:QI
2 "nonmemory_operand" "KM,rn")]))
1800 (clobber (match_scratch:QI
4 "=X,&r"))]
1802 "* return emit_a_shift (insn, operands);"
1803 [(set_attr "length" "
20")
1804 (set_attr "cc" "clobber")])
1808 (define_expand "ashlsi3"
1809 [(set (match_operand:SI
0 "register_operand" "")
1811 (match_operand:SI
1 "general_operand" "")
1812 (match_operand:QI
2 "nonmemory_operand" "")))]
1814 "if (expand_a_shift (SImode, ASHIFT, operands)) DONE;else FAIL;")
1816 (define_expand "lshrsi3"
1817 [(set (match_operand:SI
0 "register_operand" "")
1819 (match_operand:SI
1 "general_operand" "")
1820 (match_operand:QI
2 "nonmemory_operand" "")))]
1822 "if (expand_a_shift (SImode, LSHIFTRT, operands)) DONE;else FAIL;")
1824 (define_expand "ashrsi3"
1825 [(set (match_operand:SI
0 "register_operand" "")
1827 (match_operand:SI
1 "general_operand" "")
1828 (match_operand:QI
2 "nonmemory_operand" "")))]
1830 "if (expand_a_shift (SImode, ASHIFTRT, operands)) DONE;else FAIL;")
1833 [(set (match_operand:SI
0 "register_operand" "=r,r")
1834 (match_operator:SI
3 "nshift_operator"
1835 [ (match_operand:SI
1 "register_operand" "
0,
0")
1836 (match_operand:QI
2 "nonmemory_operand" "K,rn")]))
1837 (clobber (match_scratch:QI
4 "=X,&r"))]
1839 "* return emit_a_shift (insn, operands);"
1840 [(set_attr "length" "
20")
1841 (set_attr "cc" "clobber")])
1843 ;; ----------------------------------------------------------------------
1845 ;; ----------------------------------------------------------------------
1847 (define_expand "rotlqi3"
1848 [(set (match_operand:QI
0 "register_operand" "")
1849 (rotate:QI (match_operand:QI
1 "register_operand" "")
1850 (match_operand:QI
2 "nonmemory_operand" "")))]
1852 "if (expand_a_rotate (ROTATE, operands)) DONE;else FAIL;")
1854 (define_insn "*rotlqi3_1"
1855 [(set (match_operand:QI
0 "register_operand" "=r")
1856 (rotate:QI (match_operand:QI
1 "register_operand" "
0")
1857 (match_operand:QI
2 "immediate_operand" "")))]
1859 "* return emit_a_rotate (ROTATE, operands);"
1860 [(set_attr "length" "
20")
1861 (set_attr "cc" "clobber")])
1863 (define_expand "rotlhi3"
1864 [(set (match_operand:HI
0 "register_operand" "")
1865 (rotate:HI (match_operand:HI
1 "register_operand" "")
1866 (match_operand:QI
2 "nonmemory_operand" "")))]
1868 "if (expand_a_rotate (ROTATE, operands)) DONE;else FAIL;")
1870 (define_insn "*rotlhi3_1"
1871 [(set (match_operand:HI
0 "register_operand" "=r")
1872 (rotate:HI (match_operand:HI
1 "register_operand" "
0")
1873 (match_operand:QI
2 "immediate_operand" "")))]
1875 "* return emit_a_rotate (ROTATE, operands);"
1876 [(set_attr "length" "
20")
1877 (set_attr "cc" "clobber")])
1879 (define_expand "rotlsi3"
1880 [(set (match_operand:SI
0 "register_operand" "")
1881 (rotate:SI (match_operand:SI
1 "register_operand" "")
1882 (match_operand:QI
2 "nonmemory_operand" "")))]
1883 "TARGET_H8300H || TARGET_H8300S"
1884 "if (expand_a_rotate (ROTATE, operands)) DONE;else FAIL;")
1886 (define_insn "*rotlsi3_1"
1887 [(set (match_operand:SI
0 "register_operand" "=r")
1888 (rotate:SI (match_operand:SI
1 "register_operand" "
0")
1889 (match_operand:QI
2 "immediate_operand" "")))]
1890 "TARGET_H8300H || TARGET_H8300S"
1891 "* return emit_a_rotate (ROTATE, operands);"
1892 [(set_attr "length" "
20")
1893 (set_attr "cc" "clobber")])
1895 ;; -----------------------------------------------------------------
1897 ;; -----------------------------------------------------------------
1898 ;; The H8/
300 has given
1/
8th of its opcode space to bitfield
1899 ;; instructions so let's use them as well as we can.
1901 ;; You'll never believe all these patterns perform one basic action --
1902 ;; load a bit from the source, optionally invert the bit, then store it
1903 ;; in the destination (which is known to be zero).
1905 ;; Combine obviously need some work to better identify this situation and
1906 ;; canonicalize the form better.
1909 ;; Normal loads with a
16bit destination.
1911 ;; Yes, both cases are needed.
1914 [(set (match_operand:HI
0 "register_operand" "=&r")
1915 (zero_extract:HI (match_operand:HI
1 "register_operand" "r")
1917 (match_operand:HI
2 "immediate_operand" "n")))]
1919 "sub.w %
0,%
0\;bld %Z2,%Y1\;bst #
0,%X0"
1920 [(set_attr "cc" "clobber")
1921 (set_attr "length" "
6")])
1924 [(set (match_operand:HI
0 "register_operand" "=&r")
1925 (subreg:HI (zero_extract:SI
1926 (match_operand:HI
1 "register_operand" "r")
1928 (match_operand:HI
2 "immediate_operand" "n"))
2))]
1930 "sub.w %
0,%
0\;bld %Z2,%Y1\;bst #
0,%X0"
1931 [(set_attr "cc" "clobber")
1932 (set_attr "length" "
6")])
1935 ;; Inverted loads with a
16bit destination.
1937 ;; Yes, all four cases are needed.
1941 [(set (match_operand:HI
0 "register_operand" "=&r")
1942 (zero_extract:HI (xor:HI (match_operand:HI
1 "register_operand" "r")
1943 (match_operand:HI
3 "p_operand" "P"))
1945 (match_operand:HI
2 "const_int_operand" "n")))]
1946 "(
1 << INTVAL (operands[
2])) == INTVAL (operands[
3])"
1947 "sub.w %
0,%
0\;bild %Z2,%Y1\;bst #
0,%X0"
1948 [(set_attr "cc" "clobber")
1949 (set_attr "length" "
8")])
1952 [(set (match_operand:HI
0 "register_operand" "=&r")
1955 (match_operand:HI
1 "bit_operand" "Ur")
1956 (match_operand:HI
2 "const_int_operand" "n")))
1959 "sub.w %
0,%
0\;bild %Z2,%Y1\;bst #
0,%X0"
1960 [(set_attr "cc" "clobber")
1961 (set_attr "length" "
8")])
1964 [(set (match_operand:HI
0 "register_operand" "=&r")
1968 (match_operand:SI
1 "register_operand" "Ur")
1969 (match_operand:SI
2 "const_int_operand" "n"))
2))
1971 "INTVAL (operands[
2]) <
16"
1972 "sub.w %
0,%
0\;bild %Z2,%Y1\;bst #
0,%X0"
1973 [(set_attr "cc" "clobber")
1974 (set_attr "length" "
8")])
1977 [(set (match_operand:HI
0 "register_operand" "=&r")
1981 (match_operand:SI
1 "bit_operand" "Ur")
1982 (match_operand:SI
2 "const_int_operand" "n"))
0))
1984 "(TARGET_H8300H || TARGET_H8300S)
1985 && INTVAL (operands[
2]) <
16"
1986 "sub.w %
0,%
0\;bild %Z2,%Y1\;bst #
0,%X0"
1987 [(set_attr "cc" "clobber")
1988 (set_attr "length" "
8")])
1991 ;; Normal loads with a
32bit destination.
1993 ;; Yes, all three cases are needed.
1996 [(set (match_operand:SI
0 "register_operand" "=&r")
1997 (zero_extract:SI (match_operand:HI
1 "register_operand" "r")
1999 (match_operand:HI
2 "const_int_operand" "n")))]
2001 "* return output_simode_bld (
0,
0, operands);"
2002 [(set_attr "cc" "clobber")
2003 (set (attr "length")
2004 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2010 [(set (match_operand:SI
0 "register_operand" "=&r")
2011 (and:SI (zero_extend:SI
2013 (match_operand:QI
1 "bit_operand" "Ur")
2014 (match_operand:QI
2 "const_int_operand" "n")))
2017 "* return output_simode_bld (
0,
0, operands);"
2018 [(set_attr "cc" "clobber")
2019 (set (attr "length")
2020 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2026 [(set (match_operand:SI
0 "register_operand" "=&r")
2027 (and:SI (zero_extend:SI
2029 (match_operand:HI
1 "bit_operand" "Ur")
2030 (match_operand:HI
2 "const_int_operand" "n")))
2033 "* return output_simode_bld (
0,
0, operands);"
2034 [(set_attr "cc" "clobber")
2035 (set (attr "length")
2036 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2042 ;; Inverted loads with a
32bit destination.
2044 ;; Yes, all seven cases are needed.
2047 [(set (match_operand:SI
0 "register_operand" "=&r")
2049 (zero_extend:SI (match_operand:HI
1 "register_operand" "r")))
2050 (match_operand:SI
2 "p_operand" "P")))]
2052 "* return output_simode_bld (
1,
1, operands);"
2053 [(set_attr "cc" "clobber")
2054 (set (attr "length")
2055 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2060 [(set (match_operand:SI
0 "register_operand" "=&r")
2063 (lshiftrt:HI (match_operand:HI
1 "bit_operand" "Ur")
2064 (match_operand:HI
2 "const_int_operand" "n"))))
2067 "* return output_simode_bld (
1,
0, operands);"
2068 [(set_attr "cc" "clobber")
2069 (set (attr "length")
2070 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2076 [(set (match_operand:SI
0 "register_operand" "=&r")
2078 (zero_extend:SI (match_operand:QI
1 "register_operand" "r")))
2079 (match_operand:SI
2 "p_operand" "P")))]
2081 "* return output_simode_bld (
1,
1, operands);"
2082 [(set_attr "cc" "clobber")
2083 (set (attr "length")
2084 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2089 [(set (match_operand:SI
0 "register_operand" "=&r")
2092 (lshiftrt:QI (match_operand:QI
1 "bit_operand" "Ur")
2093 (match_operand:QI
2 "const_int_operand" "n"))))
2096 "* return output_simode_bld (
1,
0, operands);"
2097 [(set_attr "cc" "clobber")
2098 (set (attr "length")
2099 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2105 [(set (match_operand:SI
0 "register_operand" "=&r")
2109 (match_operand:HI
1 "bit_operand" "Ur")
2110 (match_operand:HI
2 "const_int_operand" "n"))
0))
2113 "* return output_simode_bld (
1,
0, operands);"
2114 [(set_attr "cc" "clobber")
2115 (set (attr "length")
2116 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2122 [(set (match_operand:SI
0 "register_operand" "=&r")
2126 (match_operand:QI
1 "bit_operand" "Ur")
2127 (match_operand:QI
2 "const_int_operand" "n"))
0))
2130 "* return output_simode_bld (
1,
0, operands);"
2131 [(set_attr "cc" "clobber")
2132 (set (attr "length")
2133 (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
2139 [(set (match_operand:SI
0 "register_operand" "=&r")
2140 (zero_extract:SI (xor:HI (match_operand:HI
1 "register_operand" "r")
2141 (match_operand:HI
3 "p_operand" "P"))
2143 (match_operand:HI
2 "const_int_operand" "n")))]
2144 "(
1 << INTVAL (operands[
2])) == INTVAL (operands[
3])"
2145 "sub.w %
0,%
0\;bild %Z2,%Y1\;bst #
0,%X0"
2146 [(set_attr "cc" "clobber")
2147 (set_attr "length" "
8")])
2149 (define_expand "insv"
2150 [(set (zero_extract:HI (match_operand:HI
0 "general_operand" "")
2151 (match_operand:HI
1 "general_operand" "")
2152 (match_operand:HI
2 "general_operand" ""))
2153 (match_operand:HI
3 "general_operand" ""))]
2157 /* We only have single bit bitfield instructions. */
2158 if (INTVAL (operands[
1]) !=
1)
2161 /* For now, we don't allow memory operands. */
2162 if (GET_CODE (operands[
0]) == MEM
2163 || GET_CODE (operands[
3]) == MEM)
2168 [(set (zero_extract:HI (match_operand:HI
0 "register_operand" "+r")
2170 (match_operand:HI
1 "immediate_operand" "n"))
2171 (match_operand:HI
2 "register_operand" "r"))]
2173 "bld #
0,%R2\;bst %Z1,%Y0 ; i1"
2174 [(set_attr "cc" "clobber")
2175 (set_attr "length" "
4")])
2177 (define_expand "extzv"
2178 [(set (match_operand:HI
0 "register_operand" "")
2179 (zero_extract:HI (match_operand:HI
1 "bit_operand" "")
2180 (match_operand:HI
2 "general_operand" "")
2181 (match_operand:HI
3 "general_operand" "")))]
2185 /* We only have single bit bitfield instructions. */
2186 if (INTVAL (operands[
2]) !=
1)
2189 /* For now, we don't allow memory operands. */
2190 if (GET_CODE (operands[
1]) == MEM)
2194 ;; BAND, BOR, and BXOR patterns
2197 [(set (match_operand:HI
0 "bit_operand" "=Ur")
2198 (match_operator:HI
4 "bit_operator"
2199 [(zero_extract:HI (match_operand:HI
1 "register_operand" "r")
2201 (match_operand:HI
2 "immediate_operand" "n"))
2202 (match_operand:HI
3 "bit_operand" "
0")]))]
2204 "bld %Z2,%Y1\;%b4 #
0,%R0\;bst #
0,%R0; bl1"
2205 [(set_attr "cc" "clobber")
2206 (set_attr "length" "
6")
2207 (set_attr "adjust_length" "no")])
2210 [(set (match_operand:HI
0 "bit_operand" "=Ur")
2211 (match_operator:HI
5 "bit_operator"
2212 [(zero_extract:HI (match_operand:HI
1 "register_operand" "r")
2214 (match_operand:HI
2 "immediate_operand" "n"))
2215 (zero_extract:HI (match_operand:HI
3 "register_operand" "r")
2217 (match_operand:HI
4 "immediate_operand" "n"))]))]
2219 "bld %Z2,%Y1\;%b5 %Z4,%Y3\;bst #
0,%R0; bl3"
2220 [(set_attr "cc" "clobber")
2221 (set_attr "length" "
6")
2222 (set_attr "adjust_length" "no")])