1 ;; Support 64-bit operations for AVR 8-bit microcontrollers.
2 ;; Copyright (C) 1998-2025 Free Software Foundation, Inc.
3 ;; Contributed by Georg Lay (avr@gjlay.de)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23 ;; The purpose of this file is to provide a light-weight DImode
24 ;; implementation for AVR. The trouble with DImode is that tree -> RTL
25 ;; lowering leads to really unpleasant code for operations that don't
26 ;; work byte-wise like NEG, PLUS, MINUS, etc. Defining optabs entries for
27 ;; them won't help because the optab machinery assumes these operations
28 ;; are cheap and does not check if a libgcc implementation is available.
30 ;; The DImode insns are all straight forward -- except movdi. The approach
31 ;; of this implementation is to provide DImode insns without the burden of
34 ;; The caveat is that if there are insns for some mode, there must also be a
35 ;; respective move insn that describes reloads. Therefore, this
36 ;; implementation uses an accumulator-based model with two hard-coded,
37 ;; accumulator-like registers
42 ;; so that no DImode insn contains pseudos or needs reloading.
48 ;; Supported modes that are 8 bytes wide
49 (define_mode_iterator ALL8 [DI DQ UDQ DA UDA TA UTA])
51 (define_mode_iterator ALL8U [UDQ UDA UTA])
52 (define_mode_iterator ALL8S [ DQ DA TA])
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62 (define_expand "add<mode>3"
63 [(parallel [(match_operand:ALL8 0 "general_operand" "")
64 (match_operand:ALL8 1 "nop_general_operand")
65 (match_operand:ALL8 2 "nop_general_operand")])]
68 rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
70 avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
71 emit_move_insn (acc_a, operands[1]);
73 if (DImode == <MODE>mode
74 && s8_operand (operands[2], VOIDmode))
76 emit_move_insn (gen_rtx_REG (QImode, REG_X), operands[2]);
77 emit_insn (gen_adddi3_const8_insn ());
79 else if (const_operand (operands[2], GET_MODE (operands[2])))
81 emit_insn (gen_add<mode>3_const_insn (operands[2]));
85 emit_move_insn (gen_rtx_REG (<MODE>mode, ACC_B), operands[2]);
86 emit_insn (gen_add<mode>3_insn ());
89 emit_move_insn (operands[0], acc_a);
94 ;; "adddq3_insn" "addudq3_insn"
95 ;; "addda3_insn" "adduda3_insn"
96 ;; "addta3_insn" "adduta3_insn"
97 (define_insn_and_split "add<mode>3_insn"
98 [(set (reg:ALL8 ACC_A)
99 (plus:ALL8 (reg:ALL8 ACC_A)
103 "&& reload_completed"
104 [(parallel [(set (reg:ALL8 ACC_A)
105 (plus:ALL8 (reg:ALL8 ACC_A)
107 (clobber (reg:CC REG_CC))])])
109 (define_insn "*add<mode>3_insn"
110 [(set (reg:ALL8 ACC_A)
111 (plus:ALL8 (reg:ALL8 ACC_A)
113 (clobber (reg:CC REG_CC))]
114 "avr_have_dimode && reload_completed"
116 [(set_attr "adjust_len" "call")])
118 (define_insn_and_split "adddi3_const8_insn"
120 (plus:DI (reg:DI ACC_A)
121 (sign_extend:DI (reg:QI REG_X))))]
124 "&& reload_completed"
125 [(parallel [(set (reg:DI ACC_A)
126 (plus:DI (reg:DI ACC_A)
127 (sign_extend:DI (reg:QI REG_X))))
128 (clobber (reg:CC REG_CC))])])
130 (define_insn "*adddi3_const8_insn"
132 (plus:DI (reg:DI ACC_A)
133 (sign_extend:DI (reg:QI REG_X))))
134 (clobber (reg:CC REG_CC))]
135 "avr_have_dimode && reload_completed"
137 [(set_attr "adjust_len" "call")])
139 ;; "adddi3_const_insn"
140 ;; "adddq3_const_insn" "addudq3_const_insn"
141 ;; "addda3_const_insn" "adduda3_const_insn"
142 ;; "addta3_const_insn" "adduta3_const_insn"
143 (define_insn_and_split "add<mode>3_const_insn"
144 [(set (reg:ALL8 ACC_A)
145 (plus:ALL8 (reg:ALL8 ACC_A)
146 (match_operand:ALL8 0 "const_operand" "n Ynn")))]
148 && !s8_operand (operands[0], VOIDmode)"
150 "&& reload_completed"
151 [(parallel [(set (reg:ALL8 ACC_A)
152 (plus:ALL8 (reg:ALL8 ACC_A)
154 (clobber (reg:CC REG_CC))])])
156 (define_insn "*add<mode>3_const_insn"
157 [(set (reg:ALL8 ACC_A)
158 (plus:ALL8 (reg:ALL8 ACC_A)
159 (match_operand:ALL8 0 "const_operand" "n Ynn")))
160 (clobber (reg:CC REG_CC))]
162 && !s8_operand (operands[0], VOIDmode)
165 return avr_out_plus (insn, operands);
167 [(set_attr "adjust_len" "plus")])
170 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
172 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
175 ;; "subdq3" "subudq3"
176 ;; "subda3" "subuda3"
177 ;; "subta3" "subuta3"
178 (define_expand "sub<mode>3"
179 [(parallel [(match_operand:ALL8 0 "general_operand" "")
180 (match_operand:ALL8 1 "nop_general_operand")
181 (match_operand:ALL8 2 "nop_general_operand")])]
184 rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
186 avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
187 emit_move_insn (acc_a, operands[1]);
189 if (const_operand (operands[2], GET_MODE (operands[2])))
191 emit_insn (gen_sub<mode>3_const_insn (operands[2]));
195 emit_move_insn (gen_rtx_REG (<MODE>mode, ACC_B), operands[2]);
196 emit_insn (gen_sub<mode>3_insn ());
199 emit_move_insn (operands[0], acc_a);
204 ;; "subdq3_insn" "subudq3_insn"
205 ;; "subda3_insn" "subuda3_insn"
206 ;; "subta3_insn" "subuta3_insn"
207 (define_insn_and_split "sub<mode>3_insn"
208 [(set (reg:ALL8 ACC_A)
209 (minus:ALL8 (reg:ALL8 ACC_A)
213 "&& reload_completed"
214 [(parallel [(set (reg:ALL8 ACC_A)
215 (minus:ALL8 (reg:ALL8 ACC_A)
217 (clobber (reg:CC REG_CC))])])
219 (define_insn "*sub<mode>3_insn"
220 [(set (reg:ALL8 ACC_A)
221 (minus:ALL8 (reg:ALL8 ACC_A)
223 (clobber (reg:CC REG_CC))]
224 "avr_have_dimode && reload_completed"
226 [(set_attr "adjust_len" "call")])
228 ;; "subdi3_const_insn"
229 ;; "subdq3_const_insn" "subudq3_const_insn"
230 ;; "subda3_const_insn" "subuda3_const_insn"
231 ;; "subta3_const_insn" "subuta3_const_insn"
232 (define_insn_and_split "sub<mode>3_const_insn"
233 [(set (reg:ALL8 ACC_A)
234 (minus:ALL8 (reg:ALL8 ACC_A)
235 (match_operand:ALL8 0 "const_operand" "n Ynn")))]
238 "&& reload_completed"
239 [(parallel [(set (reg:ALL8 ACC_A)
240 (minus:ALL8 (reg:ALL8 ACC_A)
242 (clobber (reg:CC REG_CC))])])
244 (define_insn "*sub<mode>3_const_insn"
245 [(set (reg:ALL8 ACC_A)
246 (minus:ALL8 (reg:ALL8 ACC_A)
247 (match_operand:ALL8 0 "const_operand" "n Ynn")))
248 (clobber (reg:CC REG_CC))]
249 "avr_have_dimode && reload_completed"
251 return avr_out_plus (insn, operands);
253 [(set_attr "adjust_len" "plus")])
255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
256 ;; Signed Saturating Addition and Subtraction
257 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
259 (define_expand "<code_stdname><mode>3"
260 [(set (match_operand:ALL8S 0 "general_operand" "")
261 (ss_addsub:ALL8S (match_operand:ALL8S 1 "nop_general_operand")
262 (match_operand:ALL8S 2 "nop_general_operand")))]
265 rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
267 avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
268 emit_move_insn (acc_a, operands[1]);
270 if (const_operand (operands[2], GET_MODE (operands[2])))
272 emit_insn (gen_<code_stdname><mode>3_const_insn (operands[2]));
276 emit_move_insn (gen_rtx_REG (<MODE>mode, ACC_B), operands[2]);
277 emit_insn (gen_<code_stdname><mode>3_insn ());
280 emit_move_insn (operands[0], acc_a);
284 (define_insn_and_split "<code_stdname><mode>3_insn"
285 [(set (reg:ALL8S ACC_A)
286 (ss_addsub:ALL8S (reg:ALL8S ACC_A)
290 "&& reload_completed"
291 [(parallel [(set (reg:ALL8S ACC_A)
292 (ss_addsub:ALL8S (reg:ALL8S ACC_A)
294 (clobber (reg:CC REG_CC))])])
296 (define_insn "*<code_stdname><mode>3_insn"
297 [(set (reg:ALL8S ACC_A)
298 (ss_addsub:ALL8S (reg:ALL8S ACC_A)
300 (clobber (reg:CC REG_CC))]
301 "avr_have_dimode && reload_completed"
302 "%~call __<code_stdname><mode>3"
303 [(set_attr "adjust_len" "call")])
305 (define_insn_and_split "<code_stdname><mode>3_const_insn"
306 [(set (reg:ALL8S ACC_A)
307 (ss_addsub:ALL8S (reg:ALL8S ACC_A)
308 (match_operand:ALL8S 0 "const_operand" "n Ynn")))]
311 "&& reload_completed"
312 [(parallel [(set (reg:ALL8S ACC_A)
313 (ss_addsub:ALL8S (reg:ALL8S ACC_A)
315 (clobber (reg:CC REG_CC))])])
317 (define_insn "*<code_stdname><mode>3_const_insn"
318 [(set (reg:ALL8S ACC_A)
319 (ss_addsub:ALL8S (reg:ALL8S ACC_A)
320 (match_operand:ALL8S 0 "const_operand" "n Ynn")))
321 (clobber (reg:CC REG_CC))]
322 "avr_have_dimode && reload_completed"
324 return avr_out_plus (insn, operands);
326 [(set_attr "adjust_len" "plus")])
328 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
329 ;; Unsigned Saturating Addition and Subtraction
330 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
332 (define_expand "<code_stdname><mode>3"
333 [(set (match_operand:ALL8U 0 "general_operand" "")
334 (us_addsub:ALL8U (match_operand:ALL8U 1 "nop_general_operand")
335 (match_operand:ALL8U 2 "nop_general_operand")))]
338 rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
340 avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
341 emit_move_insn (acc_a, operands[1]);
343 if (const_operand (operands[2], GET_MODE (operands[2])))
345 emit_insn (gen_<code_stdname><mode>3_const_insn (operands[2]));
349 emit_move_insn (gen_rtx_REG (<MODE>mode, ACC_B), operands[2]);
350 emit_insn (gen_<code_stdname><mode>3_insn ());
353 emit_move_insn (operands[0], acc_a);
357 (define_insn_and_split "<code_stdname><mode>3_insn"
358 [(set (reg:ALL8U ACC_A)
359 (us_addsub:ALL8U (reg:ALL8U ACC_A)
363 "&& reload_completed"
364 [(parallel [(set (reg:ALL8U ACC_A)
365 (us_addsub:ALL8U (reg:ALL8U ACC_A)
367 (clobber (reg:CC REG_CC))])])
369 (define_insn "*<code_stdname><mode>3_insn"
370 [(set (reg:ALL8U ACC_A)
371 (us_addsub:ALL8U (reg:ALL8U ACC_A)
373 (clobber (reg:CC REG_CC))]
374 "avr_have_dimode && reload_completed"
375 "%~call __<code_stdname><mode>3"
376 [(set_attr "adjust_len" "call")])
378 (define_insn_and_split "<code_stdname><mode>3_const_insn"
379 [(set (reg:ALL8U ACC_A)
380 (us_addsub:ALL8U (reg:ALL8U ACC_A)
381 (match_operand:ALL8U 0 "const_operand" "n Ynn")))]
384 "&& reload_completed"
385 [(parallel [(set (reg:ALL8U ACC_A)
386 (us_addsub:ALL8U (reg:ALL8U ACC_A)
387 (match_operand:ALL8U 0 "const_operand" "n Ynn")))
388 (clobber (reg:CC REG_CC))])])
390 (define_insn "*<code_stdname><mode>3_const_insn"
391 [(set (reg:ALL8U ACC_A)
392 (us_addsub:ALL8U (reg:ALL8U ACC_A)
393 (match_operand:ALL8U 0 "const_operand" "n Ynn")))
394 (clobber (reg:CC REG_CC))]
395 "avr_have_dimode && reload_completed"
397 return avr_out_plus (insn, operands);
399 [(set_attr "adjust_len" "plus")])
401 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
403 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
405 (define_expand "negdi2"
406 [(parallel [(match_operand:DI 0 "general_operand" "")
407 (match_operand:DI 1 "nop_general_operand")])]
410 rtx acc_a = gen_rtx_REG (DImode, ACC_A);
412 emit_move_insn (acc_a, operands[1]);
413 emit_insn (gen_negdi2_insn ());
414 emit_move_insn (operands[0], acc_a);
418 (define_insn_and_split "negdi2_insn"
420 (neg:DI (reg:DI ACC_A)))]
423 "&& reload_completed"
424 [(parallel [(set (reg:DI ACC_A)
425 (neg:DI (reg:DI ACC_A)))
426 (clobber (reg:CC REG_CC))])])
428 (define_insn "*negdi2_insn"
430 (neg:DI (reg:DI ACC_A)))
431 (clobber (reg:CC REG_CC))]
432 "avr_have_dimode && reload_completed"
434 [(set_attr "adjust_len" "call")])
437 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
439 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
441 (define_expand "conditional_jump"
444 (match_operator 0 "ordered_comparison_operator" [(reg:CC REG_CC)
446 (label_ref (match_operand 1 "" ""))
451 ;; "cbranchdq4" "cbranchudq4"
452 ;; "cbranchda4" "cbranchuda4"
453 ;; "cbranchta4" "cbranchuta4"
454 (define_expand "cbranch<mode>4"
456 (if_then_else (match_operator 0 "ordered_comparison_operator"
457 [(match_operand:ALL8 1 "register_operand")
458 (match_operand:ALL8 2 "nonmemory_operand")])
459 (label_ref (match_operand 3))
463 int icode = (int) GET_CODE (operands[0]);
465 targetm.canonicalize_comparison (&icode, &operands[1], &operands[2], false);
466 operands[0] = gen_rtx_fmt_ee ((rtx_code) icode,
467 VOIDmode, operands[1], operands[2]);
469 rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
471 avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
472 emit_move_insn (acc_a, operands[1]);
474 if (s8_operand (operands[2], VOIDmode))
476 emit_move_insn (gen_rtx_REG (QImode, REG_X), operands[2]);
477 emit_jump_insn (gen_cbranch_const8_di2_split (operands[0], operands[3]));
479 else if (const_operand (operands[2], GET_MODE (operands[2])))
481 emit_jump_insn (gen_cbranch_const_<mode>2_split (operands[0],
487 emit_move_insn (gen_rtx_REG (<MODE>mode, ACC_B), operands[2]);
488 emit_jump_insn (gen_cbranch_<mode>2_split (operands[0], operands[3]));
493 (define_insn_and_split "cbranch_<mode>2_split"
495 (if_then_else (match_operator 0 "ordered_comparison_operator"
498 (label_ref (match_operand 1))
502 "&& reload_completed"
505 emit_insn (gen_compare_<mode>2 ());
506 emit_jump_insn (gen_conditional_jump (operands[0], operands[1]));
511 ;; "compare_dq2" "compare_udq2"
512 ;; "compare_da2" "compare_uda2"
513 ;; "compare_ta2" "compare_uta2"
514 (define_insn "compare_<mode>2"
515 [(set (reg:CC REG_CC)
516 (compare:CC (reg:ALL8 ACC_A)
518 "reload_completed && avr_have_dimode"
520 [(set_attr "adjust_len" "call")])
522 (define_insn_and_split "cbranch_const8_di2_split"
524 (if_then_else (match_operator 0 "ordered_comparison_operator"
526 (sign_extend:DI (reg:QI REG_X))])
527 (label_ref (match_operand 1 "" ""))
531 "&& reload_completed"
534 emit_insn (gen_compare_const8_di2 ());
535 emit_jump_insn (gen_conditional_jump (operands[0], operands[1]));
539 (define_insn "compare_const8_di2"
540 [(set (reg:CC REG_CC)
541 (compare:CC (reg:DI ACC_A)
542 (sign_extend:DI (reg:QI REG_X))))]
543 "reload_completed && avr_have_dimode"
545 [(set_attr "adjust_len" "call")])
547 (define_insn_and_split "cbranch_const_<mode>2_split"
549 (if_then_else (match_operator 0 "ordered_comparison_operator"
551 (match_operand:ALL8 1 "const_operand" "n Ynn")])
552 (label_ref (match_operand 2 "" ""))
554 (clobber (match_scratch:QI 3 "=&d"))]
556 && !s8_operand (operands[1], VOIDmode)"
558 "&& reload_completed"
561 emit_insn (gen_compare_const_<mode>2 (operands[1], operands[3]));
562 emit_jump_insn (gen_conditional_jump (operands[0], operands[2]));
567 ;; "compare_const_di2"
568 ;; "compare_const_dq2" "compare_const_udq2"
569 ;; "compare_const_da2" "compare_const_uda2"
570 ;; "compare_const_ta2" "compare_const_uta2"
571 (define_insn "compare_const_<mode>2"
572 [(set (reg:CC REG_CC)
573 (compare:CC (reg:ALL8 ACC_A)
574 (match_operand:ALL8 0 "const_operand" "n Ynn")))
575 (clobber (match_operand:QI 1 "register_operand" "=&d"))]
578 && !s8_operand (operands[0], VOIDmode)"
580 return avr_out_compare64 (insn, operands, NULL);
582 [(set_attr "adjust_len" "compare64")])
585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
587 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
589 (define_code_iterator di_shifts
590 [ashift ashiftrt lshiftrt rotate])
592 ;; Shift functions from libgcc are called without defining these insns,
593 ;; but with them we can describe their reduced register footprint.
595 ;; "ashldi3" "ashrdi3" "lshrdi3" "rotldi3"
596 ;; "ashldq3" "ashrdq3" "lshrdq3" "rotldq3"
597 ;; "ashlda3" "ashrda3" "lshrda3" "rotlda3"
598 ;; "ashlta3" "ashrta3" "lshrta3" "rotlta3"
599 ;; "ashludq3" "ashrudq3" "lshrudq3" "rotludq3"
600 ;; "ashluda3" "ashruda3" "lshruda3" "rotluda3"
601 ;; "ashluta3" "ashruta3" "lshruta3" "rotluta3"
602 (define_expand "<code_stdname><mode>3"
603 [(parallel [(match_operand:ALL8 0 "general_operand" "")
604 (di_shifts:ALL8 (match_operand:ALL8 1 "nop_general_operand")
605 (match_operand:QI 2 "nop_general_operand"))])]
608 rtx acc_a = gen_rtx_REG (<MODE>mode, ACC_A);
610 avr_fix_inputs (operands, 1 << 2, regmask (<MODE>mode, ACC_A));
611 emit_move_insn (acc_a, operands[1]);
612 emit_move_insn (gen_rtx_REG (QImode, 16), operands[2]);
613 emit_insn (gen_<code_stdname><mode>3_insn ());
614 emit_move_insn (operands[0], acc_a);
618 ;; "ashldi3_insn" "ashrdi3_insn" "lshrdi3_insn" "rotldi3_insn"
619 ;; "ashldq3_insn" "ashrdq3_insn" "lshrdq3_insn" "rotldq3_insn"
620 ;; "ashlda3_insn" "ashrda3_insn" "lshrda3_insn" "rotlda3_insn"
621 ;; "ashlta3_insn" "ashrta3_insn" "lshrta3_insn" "rotlta3_insn"
622 ;; "ashludq3_insn" "ashrudq3_insn" "lshrudq3_insn" "rotludq3_insn"
623 ;; "ashluda3_insn" "ashruda3_insn" "lshruda3_insn" "rotluda3_insn"
624 ;; "ashluta3_insn" "ashruta3_insn" "lshruta3_insn" "rotluta3_insn"
625 (define_insn_and_split "<code_stdname><mode>3_insn"
626 [(set (reg:ALL8 ACC_A)
627 (di_shifts:ALL8 (reg:ALL8 ACC_A)
631 "&& reload_completed"
632 [(parallel [(set (reg:ALL8 ACC_A)
633 (di_shifts:ALL8 (reg:ALL8 ACC_A)
635 (clobber (reg:CC REG_CC))])])
637 (define_insn "*<code_stdname><mode>3_insn"
638 [(set (reg:ALL8 ACC_A)
639 (di_shifts:ALL8 (reg:ALL8 ACC_A)
641 (clobber (reg:CC REG_CC))]
642 "avr_have_dimode && reload_completed"
643 "%~call __<code_stdname>di3"
644 [(set_attr "adjust_len" "call")])
648 (define_expand "<extend_u>mulsidi3"
649 [(parallel [(match_operand:DI 0 "register_operand" "")
650 (match_operand:SI 1 "nop_general_operand")
651 (match_operand:SI 2 "nop_general_operand")
652 ;; Just to mention the iterator
653 (clobber (any_extend:SI (match_dup 1)))])]
657 avr_fix_inputs (operands, 1 << 2, regmask (SImode, 22));
658 emit_move_insn (gen_rtx_REG (SImode, 22), operands[1]);
659 emit_move_insn (gen_rtx_REG (SImode, 18), operands[2]);
660 emit_insn (gen_<extend_u>mulsidi3_insn());
661 // Use emit_move_insn and not open-coded expand because of missing movdi
662 emit_move_insn (operands[0], gen_rtx_REG (DImode, ACC_A));
669 (define_insn_and_split "<extend_u>mulsidi3_insn"
671 (mult:DI (any_extend:DI (reg:SI 18))
672 (any_extend:DI (reg:SI 22))))
673 (clobber (reg:HI REG_X))
674 (clobber (reg:HI REG_Z))]
678 "&& reload_completed"
679 [(parallel [(set (reg:DI ACC_A)
680 (mult:DI (any_extend:DI (reg:SI 18))
681 (any_extend:DI (reg:SI 22))))
682 (clobber (reg:HI REG_X))
683 (clobber (reg:HI REG_Z))
684 (clobber (reg:CC REG_CC))])])
686 (define_insn "*<extend_u>mulsidi3_insn"
688 (mult:DI (any_extend:DI (reg:SI 18))
689 (any_extend:DI (reg:SI 22))))
690 (clobber (reg:HI REG_X))
691 (clobber (reg:HI REG_Z))
692 (clobber (reg:CC REG_CC))]
696 "%~call __<extend_u>mulsidi3"
697 [(set_attr "adjust_len" "call")])