1 ;; Machine Description for TI MSP43* processors
2 ;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
3 ;; Contributed by Red Hat.
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/>.
29 (define_c_enum "unspec"
31 UNS_PROLOGUE_START_MARKER
32 UNS_PROLOGUE_END_MARKER
33 UNS_EPILOGUE_START_MARKER
61 ;; This is an approximation.
62 (define_attr "length" "" (const_int 4))
64 (include "predicates.md")
65 (include "constraints.md")
67 (define_mode_iterator QHI [QI HI PSI])
69 ;; There are two basic "family" tests we do here:
71 ;; msp430x - true if 430X instructions are available.
72 ;; TARGET_LARGE - true if pointers are 20-bits
74 ;; Note that there are three supported cases, since the base 430
75 ;; doesn't have 20-bit pointers:
77 ;; 1. MSP430 cpu, small model
78 ;; 2. MSP430X cpu, small model.
79 ;; 3. MSP430X cpu, large model.
81 ;;------------------------------------------------------------
84 ;; Push/Pop must be before the generic move patterns
87 [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNO)))
88 (match_operand:HI 0 "register_operand" "r"))]
94 [(set (mem:PSI (pre_dec:PSI (reg:PSI SP_REGNO)))
95 (match_operand:PSI 0 "register_operand" "r"))]
101 [(unspec_volatile [(match_operand 0 "register_operand" "r")
102 (match_operand 1 "immediate_operand" "n")] UNS_PUSHM)]
108 [(set (match_operand:HI 0 "register_operand" "=r")
109 (mem:HI (post_inc:HI (reg:HI SP_REGNO))))]
115 [(set (match_operand:PSI 0 "register_operand" "=r")
116 (mem:PSI (post_inc:PSI (reg:PSI SP_REGNO))))]
121 ;; This is nasty. Operand0 is bogus. It is only there so that we can get a
122 ;; mode for the %b0 to work. We should use operand1 for this, but that does
125 ;; Operand1 is actually a register, but we cannot accept (REG...) because the
126 ;; cprop_hardreg pass can and will renumber registers even inside
127 ;; unspec_volatiles. So we take an integer register number parameter and
128 ;; fudge it to be a register name when we generate the assembler.
130 ;; The pushm pattern does not have this problem because of all of the
131 ;; frame info cruft attached to it, so cprop_hardreg leaves it alone.
133 [(unspec_volatile [(match_operand 0 "register_operand" "r")
134 (match_operand 1 "immediate_operand" "i")
135 (match_operand 2 "immediate_operand" "i")] UNS_POPM)]
140 ;; The next two patterns are here to support a "feature" of how GCC implements
141 ;; varargs. When a function uses varargs and the *second* to last named
142 ;; argument is split between argument registers and the stack, gcc expects the
143 ;; callee to allocate space on the stack that can contain the register-based
144 ;; part of the argument. This space *has* to be just before the remaining
145 ;; arguments (ie the ones that are fully on the stack).
147 ;; The problem is that the MSP430 CALL instruction pushes the return address
148 ;; onto the stack in the exact place where the callee wants to allocate
149 ;; this extra space. So we need a sequence of instructions that can allocate
150 ;; the extra space and then move the return address down the stack, so that
151 ;; the extra space is now adjacent to the remaining arguments.
153 ;; This could be constructed through regular insns, but they might be split up
154 ;; by a misguided optimization, so an unspec volatile is used instead.
156 (define_insn "grow_and_swap"
157 [(unspec_volatile [(const_int 0)] UNS_GROW_AND_SWAP)]
161 return \"SUBA\t#2, r1 { MOVX.A\t2(r1), 0(r1)\";
162 return \"SUB\t#2, r1 { MOV.W\t2(r1), 0(r1)\";
166 (define_insn "swap_and_shrink"
167 [(unspec_volatile [(const_int 0)] UNS_SWAP_AND_SHRINK)]
169 "* return TARGET_LARGE
170 ? \"MOVX.A\t0(r1), 2(r1) { ADDA\t#2, SP\"
171 : \"MOV.W\t0(r1), 2(r1) { ADD\t#2, SP\";
174 ; I set LOAD_EXTEND_OP and WORD_REGISTER_OPERATIONS, but gcc puts in a
175 ; zero_extend anyway. Catch it here.
176 (define_insn "movqihi"
177 [(set (match_operand:HI 0 "register_operand" "=r,r")
178 (zero_extend:HI (match_operand:QI 1 "memory_operand" "Ys,m")))]
185 (define_insn "movqi_topbyte"
186 [(set (match_operand:QI 0 "msp_nonimmediate_operand" "=r")
187 (subreg:QI (match_operand:PSI 1 "msp_general_operand" "r") 2))]
189 "PUSHM.A\t#1,%1 { POPM.W\t#1,%0 { POPM.W\t#1,%0"
193 [(set (match_operand:QI 0 "msp_nonimmediate_operand" "=rYs,rm")
194 (match_operand:QI 1 "msp_general_operand" "riYs,rmi"))]
202 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=r,rYs,rm")
203 (match_operand:HI 1 "msp_general_operand" "N,riYs,rmi"))]
211 (define_expand "movsi"
212 [(set (match_operand:SI 0 "nonimmediate_operand")
213 (match_operand:SI 1 "general_operand"))]
218 (define_insn_and_split "movsi_s"
219 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
220 (subreg:SI (match_operand:PSI 1 "msp430_symbol_operand" "i") 0))]
224 [(set (match_operand:HI 2 "nonimmediate_operand")
225 (match_operand:HI 4 "general_operand"))
226 (set (match_operand:HI 3 "nonimmediate_operand")
227 (match_operand:HI 5 "general_operand"))]
228 "msp430_split_movsi (operands);"
231 (define_insn_and_split "movsi_x"
232 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
233 (match_operand:SI 1 "general_operand" "rmi"))]
237 [(set (match_operand:HI 2 "nonimmediate_operand")
238 (match_operand:HI 4 "general_operand"))
239 (set (match_operand:HI 3 "nonimmediate_operand")
240 (match_operand:HI 5 "general_operand"))]
241 "msp430_split_movsi (operands);"
244 ;; Some MOVX.A cases can be done with MOVA, this is only a few of them.
245 (define_insn "movpsi"
246 [(set (match_operand:PSI 0 "msp_nonimmediate_operand" "=r,r,r,Ya,rm")
247 (match_operand:PSI 1 "msp_general_operand" "N,O,riYa,r,rmi"))]
256 ; This pattern is identical to the truncsipsi2 pattern except
257 ; that it uses a SUBREG instead of a TRUNC. It is needed in
258 ; order to prevent reload from converting (set:SI (SUBREG:PSI (SI)))
259 ; into (SET:PSI (PSI)).
261 ; Note: using POPM.A #1 is two bytes smaller than using POPX.A....
263 (define_insn "movsipsi2"
264 [(set (match_operand:PSI 0 "register_operand" "=r")
265 (subreg:PSI (match_operand:SI 1 "register_operand" "r") 0))]
267 "PUSH.W\t%H1 { PUSH.W\t%L1 { POPM.A #1, %0 ; Move reg-pair %L1:%H1 into pointer %0"
270 ;; Produced when converting a pointer to an integer via a union, eg gcc.dg/pr47201.c.
271 (define_insn "*movpsihi2_lo"
272 [(set (match_operand:HI 0 "register_operand" "=r")
273 (subreg:HI (match_operand:PSI 1 "msp430_symbol_operand" "i") 0))]
278 ;;------------------------------------------------------------
281 (define_insn "addpsi3"
282 [(set (match_operand:PSI 0 "msp_nonimmediate_operand" "=r,rm")
283 (plus:PSI (match_operand:PSI 1 "msp_nonimmediate_operand" "%0,0")
284 (match_operand:PSI 2 "msp_general_operand" "rLs,rmi")))]
291 (define_insn "addqi3"
292 [(set (match_operand:QI 0 "msp_nonimmediate_operand" "=rYs,rm")
293 (plus:QI (match_operand:QI 1 "msp_nonimmediate_operand" "%0,0")
294 (match_operand:QI 2 "msp_general_operand" "riYs,rmi")))]
301 (define_insn "addhi3"
302 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=rYs,rm")
303 (plus:HI (match_operand:HI 1 "msp_nonimmediate_operand" "%0,0")
304 (match_operand:HI 2 "msp_general_operand" "riYs,rmi")))]
311 ; This pattern is needed in order to avoid reload problems.
312 ; It takes an SI pair of registers, adds a value to them, and
313 ; then converts them into a single PSI register.
315 (define_insn "addsipsi3"
316 [(set (subreg:SI (match_operand:PSI 0 "register_operand" "=&r") 0)
317 (plus:SI (match_operand:SI 1 "register_operand" "0")
318 (match_operand 2 "general_operand" "rmi")))]
320 "ADD.W\t%L2, %L0 { ADDC.W\t%H2, %H0 { PUSH.W\t%H0 { PUSH.W\t%L0 { POPM.A\t#1, %0"
323 (define_insn "addsi3"
324 [(set (match_operand:SI 0 "nonimmediate_operand" "=&r,rm")
325 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
326 (match_operand:SI 2 "general_operand" "r,mi")))]
329 ADD\t%L2, %L0 { ADDC\t%H2, %H0
330 ADD%X0\t%L2, %L0 { ADDC%X0\t%H2, %H0"
333 ; Version of addhi that exposes the carry operations, for SImode adds.
335 ; NOTE - we are playing a dangerous game with GCC here. We have these two
336 ; add patterns and the splitter that follows because our tests have shown
337 ; that this results in a significant reduction in code size - because GCC is
338 ; able to discard any unused part of the addition. We have to annotate the
339 ; patterns with the set and use of the carry flag because otherwise GCC will
340 ; discard parts of the addition when they are actually needed. But we have
341 ; not annotated all the other patterns that set the CARRY flag as doing so
342 ; results in an overall increase in code size[1]. Instead we just *hope*
343 ; that GCC will not move a carry-setting instruction in between the first
346 ; So far our experiments have shown that GCC is likely to move MOV and CMP
347 ; instructions in between the two adds, but not other instructions. MOV is
348 ; safe, CMP is not. So we have annotated the CMP patterns and left the
349 ; subtract, shift and other add patterns alone. At the moment this is
350 ; working, but with future changes to the generic parts of GCC that might
353 ; [1] It is not clear exactly why the code size increases. The cause appears
354 ; to be that reload is more prevelent to spilling a variable onto the stack
355 ; but why it does this is unknown. Possibly the additional CLOBBERs necessary
356 ; to correctly annotate the other patterns makes reload think that there is
357 ; increased register pressure. Or possibly reload does not handle ADD patterns
358 ; that are not single_set() very well.
360 (define_insn "addhi3_cy"
361 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=r,rm")
362 (plus:HI (match_operand:HI 1 "msp_nonimmediate_operand" "%0,0")
363 (match_operand:HI 2 "msp_nonimmediate_operand" "r,rm")))
365 (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1))
366 (zero_extend:SI (match_dup 2)))
375 (define_insn "addhi3_cy_i"
376 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
377 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
378 (match_operand:HI 2 "immediate_operand" "i,i")))
380 (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1))
381 (match_operand 3 "immediate_operand" "i,i"))
390 ; Version of addhi that adds the carry, for SImode adds.
391 (define_insn "addchi4_cy"
392 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=r,rm")
393 (plus:HI (plus:HI (match_operand:HI 1 "msp_nonimmediate_operand" "%0,0")
394 (match_operand:HI 2 "msp_general_operand" "ri,rmi"))
395 (zero_extend:HI (reg:BI CARRY))))
403 ; Split an SImode add into two HImode adds, keeping track of the carry
404 ; so that gcc knows when it can and can't optimize away the two
407 [(set (match_operand:SI 0 "msp430_nonsubreg_operand")
408 (plus:SI (match_operand:SI 1 "msp430_nonsubreg_operand")
409 (match_operand:SI 2 "msp430_nonsubreg_or_imm_operand")))
412 [(parallel [(set (match_operand:HI 3 "nonimmediate_operand" "=&rm")
413 (plus:HI (match_dup 4)
416 (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 4))
420 (set (match_operand:HI 6 "nonimmediate_operand" "=&rm")
421 (plus:HI (plus:HI (match_dup 7)
423 (zero_extend:HI (reg:BI CARRY))))
426 operands[3] = msp430_subreg (HImode, operands[0], SImode, 0);
427 operands[4] = msp430_subreg (HImode, operands[1], SImode, 0);
428 operands[5] = msp430_subreg (HImode, operands[2], SImode, 0);
429 operands[6] = msp430_subreg (HImode, operands[0], SImode, 2);
430 operands[7] = msp430_subreg (HImode, operands[1], SImode, 2);
431 operands[8] = msp430_subreg (HImode, operands[2], SImode, 2);
433 /* BZ 64160: Do not use this splitter when the dest partially overlaps the source. */
434 if (reg_overlap_mentioned_p (operands[3], operands[7])
435 || reg_overlap_mentioned_p (operands[3], operands[8]))
438 if (GET_CODE (operands[5]) == CONST_INT)
439 operands[9] = GEN_INT (INTVAL (operands[5]) & 0xffff);
441 operands[9] = gen_rtx_ZERO_EXTEND (SImode, operands[5]);
446 ;; Alternatives 2 and 3 are to handle cases generated by reload.
447 (define_insn "subpsi3"
448 [(set (match_operand:PSI 0 "nonimmediate_operand" "=r, rm, &?r, ?&r")
449 (minus:PSI (match_operand:PSI 1 "general_operand" "0, 0, !r, !i")
450 (match_operand:PSI 2 "general_operand" "rLs, rmi, rmi, r")))]
455 MOVX.A\t%1, %0 { SUBX.A\t%2, %0
456 MOVX.A\t%1, %0 { SUBA\t%2, %0"
459 ;; Alternatives 2 and 3 are to handle cases generated by reload.
460 (define_insn "subqi3"
461 [(set (match_operand:QI 0 "nonimmediate_operand" "=rYs, rm, &?r, ?&r")
462 (minus:QI (match_operand:QI 1 "general_operand" "0, 0, !r, !i")
463 (match_operand:QI 2 "general_operand" " riYs, rmi, rmi, r")))]
468 MOV%X0.B\t%1, %0 { SUB%X0.B\t%2, %0
469 MOV%X0.B\t%1, %0 { SUB%X0.B\t%2, %0"
472 ;; Alternatives 2 and 3 are to handle cases generated by reload.
473 (define_insn "subhi3"
474 [(set (match_operand:HI 0 "nonimmediate_operand" "=rYs, rm, &?r, ?&r")
475 (minus:HI (match_operand:HI 1 "general_operand" "0, 0, !r, !i")
476 (match_operand:HI 2 "general_operand" " riYs, rmi, rmi, r")))]
481 MOV%X0.W\t%1, %0 { SUB%X0.W\t%2, %0
482 MOV%X0.W\t%1, %0 { SUB%X0.W\t%2, %0"
485 (define_insn "subsi3"
486 [(set (match_operand:SI 0 "nonimmediate_operand" "=&rm")
487 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
488 (match_operand:SI 2 "general_operand" "rmi")))]
490 "SUB%X0\t%L2, %L0 { SUBC%X0\t%H2, %H0"
493 (define_insn "*bic<mode>_cg"
494 [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,m")
495 (and:QHI (match_operand:QHI 1 "msp_general_operand" "0,0")
496 (match_operand 2 "msp430_inv_constgen_operator" "n,n")))]
503 (define_insn "bic<mode>3"
504 [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,rm")
505 (and:QHI (not:QHI (match_operand:QHI 1 "msp_general_operand" "rYs,rmn"))
506 (match_operand:QHI 2 "msp_nonimmediate_operand" "0,0")))]
513 (define_insn "and<mode>3"
514 [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=r,rYs,rm")
515 (and:QHI (match_operand:QHI 1 "msp_nonimmediate_operand" "%0,0,0")
516 (match_operand:QHI 2 "msp_general_operand" "N,riYs,rmi")))]
524 (define_insn "ior<mode>3"
525 [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,rm")
526 (ior:QHI (match_operand:QHI 1 "msp_nonimmediate_operand" "%0,0")
527 (match_operand:QHI 2 "msp_general_operand" "riYs,rmi")))]
534 (define_insn "xor<mode>3"
535 [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,rm")
536 (xor:QHI (match_operand:QHI 1 "msp_nonimmediate_operand" "%0,0")
537 (match_operand:QHI 2 "msp_general_operand" "riYs,rmi")))]
544 ;; Macro : XOR #~0, %0
545 (define_insn "one_cmpl<mode>2"
546 [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,m")
547 (not:QHI (match_operand:QHI 1 "msp_nonimmediate_operand" "0,0")))]
554 (define_insn "extendqihi2"
555 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=rYs,m")
556 (sign_extend:HI (match_operand:QI 1 "msp_nonimmediate_operand" "0,0")))]
563 (define_insn "zero_extendqihi2"
564 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=rYs,r,r,m")
565 (zero_extend:HI (match_operand:QI 1 "msp_nonimmediate_operand" "0,rYs,m,0")))]
574 ;; Eliminate extraneous zero-extends mysteriously created by gcc.
576 [(set (match_operand:HI 0 "register_operand")
577 (zero_extend:HI (match_operand:QI 1 "general_operand")))
578 (set (match_operand:HI 2 "register_operand")
579 (zero_extend:HI (match_operand:QI 3 "register_operand")))]
580 "REGNO (operands[0]) == REGNO (operands[2]) && REGNO (operands[2]) == REGNO (operands[3])"
582 (zero_extend:HI (match_dup 1)))]
585 (define_insn "zero_extendhipsi2"
586 [(set (match_operand:PSI 0 "msp_nonimmediate_operand" "=r,m")
587 (zero_extend:PSI (match_operand:HI 1 "msp_nonimmediate_operand" "rm,r")))]
594 (define_insn "truncpsihi2"
595 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=rm")
596 (truncate:HI (match_operand:PSI 1 "register_operand" "r")))]
601 (define_insn "extendhisi2"
602 [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
603 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r")))]
605 { return msp430x_extendhisi (operands); }
608 (define_insn "extendhipsi2"
609 [(set (match_operand:PSI 0 "nonimmediate_operand" "=r")
610 (subreg:PSI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0")) 0))]
612 "RLAM.A #4, %0 { RRAM.A #4, %0"
615 ;; Look for cases where integer/pointer conversions are suboptimal due
616 ;; to missing patterns, despite us not having opcodes for these
617 ;; patterns. Doing these manually allows for alternate optimization
620 (define_insn "zero_extendqisi2"
621 [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
622 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
624 "MOV.B\t%1,%L0 { CLR\t%H0"
627 (define_insn "zero_extendhisi2"
628 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
629 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r")))]
633 MOV.W\t%1,%L0 { MOV.W\t#0,%H0"
636 (define_insn "zero_extendhisipsi2"
637 [(set (match_operand:PSI 0 "nonimmediate_operand" "=r,r")
638 (subreg:PSI (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r")) 0))]
645 (define_insn "extend_and_shift1_hipsi2"
646 [(set (subreg:SI (match_operand:PSI 0 "nonimmediate_operand" "=r") 0)
647 (ashift:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0"))
650 "RLAM.A #4, %0 { RRAM.A #3, %0"
653 (define_insn "extend_and_shift2_hipsi2"
654 [(set (subreg:SI (match_operand:PSI 0 "nonimmediate_operand" "=r") 0)
655 (ashift:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0"))
658 "RLAM.A #4, %0 { RRAM.A #2, %0"
661 ; Nasty - we are sign-extending a 20-bit PSI value in one register into
662 ; two adjacent 16-bit registers to make an SI value. There is no MSP430X
663 ; instruction that will do this, so we push the 20-bit value onto the stack
664 ; and then pop it off as two 16-bit values.
666 ; FIXME: The MSP430X documentation does not specify if zero-extension or
667 ; sign-extension happens when the 20-bit value is pushed onto the stack.
668 ; It is probably zero-extension, but if not this pattern will not work
669 ; when the PSI value is negative..
671 ; Note: using PUSHM.A #1 is two bytes smaller than using PUSHX.A....
673 ; Note: We use a + constraint on operand 0 as otherwise GCC gets confused
674 ; about extending a single PSI mode register into a pair of SImode registers
675 ; with the same starting register. It thinks that the upper register of
676 ; the pair is unused and so it can clobber it. Try compiling 20050826-2.c
677 ; at -O2 to see this.
679 (define_insn "zero_extendpsisi2"
680 [(set (match_operand:SI 0 "register_operand" "+r")
681 (zero_extend:SI (match_operand:PSI 1 "register_operand" "r")))]
684 if (REGNO (operands[1]) == SP_REGNO)
685 /* If the source register is the stack pointer, the value
686 stored in the stack slot will be the value *after* the
687 stack pointer has been decremented. So allow for that
689 return \"PUSHM.A\t#1, %1 { ADDX.W\t#4, @r1 { POPX.W\t%L0 { POPX.W\t%H0 ; get stack pointer into %L0:%H0\";
691 return \"PUSHM.A\t#1, %1 { POPX.W\t%L0 { POPX.W\t%H0 ; move pointer in %1 into reg-pair %L0:%H0\";
695 ;; We also need to be able to sign-extend pointer types (eg ptrdiff_t).
696 ;; Since (we assume) pushing a 20-bit value onto the stack zero-extends
697 ;; it, we use a different method here.
699 (define_insn "extendpsisi2"
700 [(set (match_operand:SI 0 "register_operand" "=r")
701 (sign_extend:SI (match_operand:PSI 1 "register_operand" "r")))]
704 /* The intention here is that we copy the bottom 16-bits of
705 %1 into %L0 (zeroing the top four bits). Then we copy the
706 entire 20-bits of %1 into %H0 and then arithmetically shift
707 it right by 16 bits, to get the top four bits of the pointer
708 sign-extended in %H0. */
709 if (REGNO (operands[0]) == REGNO (operands[1]))
710 return \"MOVX.A\t%1, %H0 { MOV.W\t%1, %L0 { RPT\t#16 { RRAX.A\t%H0 ; sign extend pointer in %1 into %L0:%H0\";
712 return \"MOV.W\t%1, %L0 { MOVX.A\t%1, %H0 { RPT\t#16 { RRAX.A\t%H0 ; sign extend pointer in %1 into %L0:%H0\";
716 ; See the movsipsi2 pattern above for another way that GCC performs this
718 (define_insn "truncsipsi2"
719 [(set (match_operand:PSI 0 "register_operand" "=r")
720 (truncate:PSI (match_operand:SI 1 "register_operand" "r")))]
722 "PUSH.W\t%H1 { PUSH.W\t%L1 { POPM.A\t#1, %L0"
725 ;;------------------------------------------------------------
728 ;; Note: We do not use the RPT ... SHIFT instruction sequence
729 ;; when the repeat count is in a register, because even though RPT
730 ;; accepts counts in registers, it does not work if the count is
731 ;; zero, and the actual count in the register has to be one less
732 ;; than the required number of iterations. We could encode a
733 ;; seqeunce like this:
743 ;; But is longer than calling a helper function, and we are mostly
744 ;; concerned with code size. FIXME: Maybe enable a sequence like
745 ;; this at -O3 and above ?
747 ;; Note - we ignore shift counts of less than one or more than 15.
748 ;; This is permitted by the ISO C99 standard as such shifts result
749 ;; in "undefined" behavior. [6.5.7 (3)]
753 (define_expand "ashlhi3"
754 [(set (match_operand:HI 0 "nonimmediate_operand")
755 (ashift:HI (match_operand:HI 1 "general_operand")
756 (match_operand:HI 2 "general_operand")))]
759 if ((GET_CODE (operands[1]) == SUBREG
760 && REG_P (XEXP (operands[1], 0)))
761 || MEM_P (operands[1]))
762 operands[1] = force_reg (HImode, operands[1]);
764 && REG_P (operands[0])
765 && REG_P (operands[1])
766 && CONST_INT_P (operands[2]))
767 emit_insn (gen_430x_shift_left (operands[0], operands[1], operands[2]));
768 else if (CONST_INT_P (operands[2])
769 && INTVAL (operands[2]) == 1)
770 emit_insn (gen_slli_1 (operands[0], operands[1]));
772 /* The const variants of mspabi shifts have larger code size than the
773 generic version, so use the generic version if optimizing for
775 msp430_expand_helper (operands, \"__mspabi_slli\", !optimize_size);
780 (define_insn "slli_1"
781 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
782 (ashift:HI (match_operand:HI 1 "general_operand" "0")
785 "RLA.W\t%0" ;; Note - this is a macro for ADD
788 (define_insn "430x_shift_left"
789 [(set (match_operand:HI 0 "register_operand" "=r")
790 (ashift:HI (match_operand:HI 1 "register_operand" "0")
791 (match_operand 2 "immediate_operand" "n")))]
794 if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 16)
795 return \"rpt\t%2 { rlax.w\t%0\";
796 return \"# nop left shift\";
800 (define_insn "slll_1"
801 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
802 (ashift:SI (match_operand:SI 1 "general_operand" "0")
805 "RLA.W\t%L0 { RLC.W\t%H0"
808 (define_insn "slll_2"
809 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
810 (ashift:SI (match_operand:SI 1 "general_operand" "0")
813 "RLA.W\t%L0 { RLC.W\t%H0 { RLA.W\t%L0 { RLC.W\t%H0"
816 (define_expand "ashlsi3"
817 [(set (match_operand:SI 0 "nonimmediate_operand")
818 (ashift:SI (match_operand:SI 1 "general_operand")
819 (match_operand:SI 2 "general_operand")))]
821 "msp430_expand_helper (operands, \"__mspabi_slll\", !optimize_size);
829 (define_expand "ashrhi3"
830 [(set (match_operand:HI 0 "nonimmediate_operand")
831 (ashiftrt:HI (match_operand:HI 1 "general_operand")
832 (match_operand:HI 2 "general_operand")))]
835 if ((GET_CODE (operands[1]) == SUBREG
836 && REG_P (XEXP (operands[1], 0)))
837 || MEM_P (operands[1]))
838 operands[1] = force_reg (HImode, operands[1]);
840 && REG_P (operands[0])
841 && REG_P (operands[1])
842 && CONST_INT_P (operands[2]))
843 emit_insn (gen_430x_arithmetic_shift_right (operands[0], operands[1], operands[2]));
844 else if (CONST_INT_P (operands[2])
845 && INTVAL (operands[2]) == 1)
846 emit_insn (gen_srai_1 (operands[0], operands[1]));
848 msp430_expand_helper (operands, \"__mspabi_srai\", !optimize_size);
853 (define_insn "srai_1"
854 [(set (match_operand:HI 0 "msp_nonimmediate_operand" "=rm")
855 (ashiftrt:HI (match_operand:HI 1 "msp_general_operand" "0")
861 (define_insn "430x_arithmetic_shift_right"
862 [(set (match_operand:HI 0 "register_operand" "=r")
863 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
864 (match_operand 2 "immediate_operand" "n")))]
867 if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 16)
868 return \"rpt\t%2 { rrax.w\t%0\";
869 return \"# nop arith right shift\";
873 (define_insn "srap_1"
874 [(set (match_operand:PSI 0 "register_operand" "=r")
875 (ashiftrt:PSI (match_operand:PSI 1 "general_operand" "0")
881 (define_insn "srap_2"
882 [(set (match_operand:PSI 0 "register_operand" "=r")
883 (ashiftrt:PSI (match_operand:PSI 1 "general_operand" "0")
889 (define_insn "sral_1"
890 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
891 (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
894 "RRA.W\t%H0 { RRC.W\t%L0"
897 (define_insn "sral_2"
898 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
899 (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
902 "RRA.W\t%H0 { RRC.W\t%L0 { RRA.W\t%H0 { RRC.W\t%L0"
905 (define_expand "ashrsi3"
906 [(set (match_operand:SI 0 "nonimmediate_operand")
907 (ashiftrt:SI (match_operand:SI 1 "general_operand")
908 (match_operand:SI 2 "general_operand")))]
910 "msp430_expand_helper (operands, \"__mspabi_sral\", !optimize_size);
918 (define_expand "lshrhi3"
919 [(set (match_operand:HI 0 "nonimmediate_operand")
920 (lshiftrt:HI (match_operand:HI 1 "general_operand")
921 (match_operand:HI 2 "general_operand")))]
924 if ((GET_CODE (operands[1]) == SUBREG
925 && REG_P (XEXP (operands[1], 0)))
926 || MEM_P (operands[1]))
927 operands[1] = force_reg (HImode, operands[1]);
929 && REG_P (operands[0])
930 && REG_P (operands[1])
931 && CONST_INT_P (operands[2]))
932 emit_insn (gen_430x_logical_shift_right (operands[0], operands[1], operands[2]));
933 else if (CONST_INT_P (operands[2])
934 && INTVAL (operands[2]) == 1)
935 emit_insn (gen_srli_1 (operands[0], operands[1]));
937 msp430_expand_helper (operands, \"__mspabi_srli\", !optimize_size);
942 (define_insn "srli_1"
943 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
944 (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
950 (define_insn "430x_logical_shift_right"
951 [(set (match_operand:HI 0 "register_operand" "=r")
952 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
953 (match_operand 2 "immediate_operand" "n")))]
956 return msp430x_logical_shift_right (operands[2]);
960 (define_insn "srlp_1"
961 [(set (match_operand:PSI 0 "register_operand" "=r")
962 (lshiftrt:PSI (match_operand:PSI 1 "general_operand" "0")
968 (define_insn "srll_1"
969 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
970 (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
973 "CLRC { RRC.W\t%H0 { RRC.W\t%L0"
976 (define_insn "srll_2x"
977 [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
978 (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
981 "RRUX.W\t%H0 { RRC.W\t%L0 { RRUX.W\t%H0 { RRC.W\t%L0"
984 (define_expand "lshrsi3"
985 [(set (match_operand:SI 0 "nonimmediate_operand")
986 (lshiftrt:SI (match_operand:SI 1 "general_operand")
987 (match_operand:SI 2 "general_operand")))]
989 "msp430_expand_helper (operands, \"__mspabi_srll\", !optimize_size);
993 ;;------------------------------------------------------------
994 ;; Function Entry/Exit
996 (define_expand "prologue"
999 "msp430_expand_prologue (); DONE;"
1002 (define_expand "epilogue"
1005 "msp430_expand_epilogue (0); DONE;"
1008 (define_insn "epilogue_helper"
1009 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")] UNS_EPILOGUE_HELPER)]
1011 "BR%Q0\t#__mspabi_func_epilog_%J0"
1014 (define_insn "prologue_start_marker"
1015 [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_START_MARKER)]
1017 "; start of prologue"
1020 (define_insn "prologue_end_marker"
1021 [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_END_MARKER)]
1026 (define_insn "epilogue_start_marker"
1027 [(unspec_volatile [(const_int 0)] UNS_EPILOGUE_START_MARKER)]
1029 "; start of epilogue"
1032 ;; This makes the linker add a call to exit() after the call to main()
1034 (define_insn "msp430_refsym_need_exit"
1035 [(unspec_volatile [(const_int 0)] UNS_REFSYM_NEED_EXIT)]
1037 ".refsym\t__crt0_call_exit"
1040 ;;------------------------------------------------------------
1043 (define_expand "call"
1044 [(call:HI (match_operand 0 "")
1045 (match_operand 1 ""))]
1050 (define_insn "call_internal"
1051 [(call (mem:HI (match_operand 0 "general_operand" "rYci"))
1052 (match_operand 1 ""))]
1057 (define_expand "call_value"
1058 [(set (match_operand 0 "register_operand")
1059 (call:HI (match_operand 1 "general_operand")
1060 (match_operand 2 "")))]
1065 (define_insn "call_value_internal"
1066 [(set (match_operand 0 "register_operand" "=r")
1067 (call (mem:HI (match_operand 1 "general_operand" "rYci"))
1068 (match_operand 2 "")))]
1073 (define_insn "msp_return"
1076 { return msp430_is_interrupt_func () ? "RETI" : (TARGET_LARGE ? "RETA" : "RET"); }
1079 ;; This pattern is NOT, as expected, a return pattern. It's called
1080 ;; before reload and must only store its operands, and emit a
1081 ;; placeholder where the epilog needs to be. AFTER reload, the
1082 ;; placeholder should get expanded into a regular-type epilogue that
1083 ;; also does the EH return.
1084 (define_expand "eh_return"
1085 [(match_operand:HI 0 "")]
1087 "msp430_expand_eh_return (operands[0]);
1088 emit_jump_insn (gen_msp430_eh_epilogue ());
1093 ;; This is the actual EH epilogue. We emit it in the pattern above,
1094 ;; before reload, and convert it to a real epilogue after reload.
1095 (define_insn_and_split "msp430_eh_epilogue"
1101 "msp430_expand_epilogue (1); DONE;"
1106 (label_ref (match_operand 0 "" "")))]
1111 ;; FIXME: GCC currently (8/feb/2013) cannot handle symbol_refs
1112 ;; in indirect jumps (cf gcc.c-torture/compile/991213-3.c).
1113 (define_insn "indirect_jump"
1115 (match_operand 0 "nonimmediate_operand" "rYl"))]
1120 ;;------------------------------------------------------------
1121 ;; Various Conditionals
1123 (define_expand "cbranch<mode>4"
1124 [(parallel [(set (pc) (if_then_else
1125 (match_operator 0 ""
1126 [(match_operand:QHI 1 "nonimmediate_operand")
1127 (match_operand:QHI 2 "general_operand")])
1128 (label_ref (match_operand 3 "" ""))
1130 (clobber (reg:BI CARRY))]
1133 "msp430_fixup_compare_operands (<MODE>mode, operands);"
1136 (define_insn "cbranchpsi4_real"
1137 [(set (pc) (if_then_else
1138 (match_operator 0 "msp430_cmp_operator"
1139 [(match_operand:PSI 1 "nonimmediate_operand" "r,rYs,rm")
1140 (match_operand:PSI 2 "general_operand" "rLs,rYsi,rmi")])
1141 (label_ref (match_operand 3 "" ""))
1143 (clobber (reg:BI CARRY))
1147 CMP%Q0\t%2, %1 { J%0\t%l3
1148 CMPX.A\t%2, %1 { J%0\t%l3
1149 CMPX.A\t%2, %1 { J%0\t%l3"
1152 (define_insn "cbranchqi4_real"
1153 [(set (pc) (if_then_else
1154 (match_operator 0 "msp430_cmp_operator"
1155 [(match_operand:QI 1 "nonimmediate_operand" "rYs,rm")
1156 (match_operand:QI 2 "general_operand" "rYsi,rmi")])
1157 (label_ref (match_operand 3 "" ""))
1159 (clobber (reg:BI CARRY))
1163 CMP.B\t%2, %1 { J%0\t%l3
1164 CMP%X0.B\t%2, %1 { J%0\t%l3"
1167 (define_insn "cbranchhi4_real"
1168 [(set (pc) (if_then_else
1169 (match_operator 0 "msp430_cmp_operator"
1170 [(match_operand:HI 1 "nonimmediate_operand" "rYs,rm")
1171 (match_operand:HI 2 "general_operand" "rYsi,rmi")])
1172 (label_ref (match_operand 3 "" ""))
1174 (clobber (reg:BI CARRY))
1178 /* This is nasty. If we are splitting code between low and high memory
1179 then we do not want the linker to increase the size of sections by
1180 relaxing out of range jump instructions. (Since relaxation occurs
1181 after section placement). So we have to generate pessimal branches
1182 here. But we only want to do this when really necessary.
1184 FIXME: Do we need code in the other cbranch patterns ? */
1185 if (msp430_do_not_relax_short_jumps () && get_attr_length (insn) > 6)
1187 return which_alternative == 0 ?
1188 \"CMP.W\t%2, %1 { J%r0 1f { BRA #%l3 { 1:\" :
1189 \"CMP%X0.W\t%2, %1 { J%r0 1f { BRA #%l3 { 1:\";
1192 return which_alternative == 0 ?
1193 \"CMP.W\t%2, %1 { J%0\t%l3\" :
1194 \"CMP%X0.W\t%2, %1 { J%0\t%l3\";
1196 [(set (attr "length")
1198 (and (ge (minus (match_dup 3) (pc)) (const_int -510))
1199 (le (minus (match_dup 3) (pc)) (const_int 510)))
1205 (define_insn "cbranchpsi4_reversed"
1206 [(set (pc) (if_then_else
1207 (match_operator 0 "msp430_reversible_cmp_operator"
1208 [(match_operand:PSI 1 "general_operand" "rLs,rYsi,rmi")
1209 (match_operand:PSI 2 "general_operand" "r,rYs,rm")])
1210 (label_ref (match_operand 3 "" ""))
1212 (clobber (reg:BI CARRY))
1216 CMP%Q0\t%1, %2 { J%R0\t%l3
1217 CMPX.A\t%1, %2 { J%R0\t%l3
1218 CMPX.A\t%1, %2 { J%R0\t%l3"
1221 (define_insn "cbranchqi4_reversed"
1222 [(set (pc) (if_then_else
1223 (match_operator 0 "msp430_reversible_cmp_operator"
1224 [(match_operand:QI 1 "general_operand" "rYsi,rmi")
1225 (match_operand:QI 2 "general_operand" "rYs,rm")])
1226 (label_ref (match_operand 3 "" ""))
1228 (clobber (reg:BI CARRY))
1232 CMP.B\t%1, %2 { J%R0\t%l3
1233 CMP%X0.B\t%1, %2 { J%R0\t%l3"
1236 (define_insn "cbranchhi4_reversed"
1237 [(set (pc) (if_then_else
1238 (match_operator 0 "msp430_reversible_cmp_operator"
1239 [(match_operand:HI 1 "general_operand" "rYsi,rmi")
1240 (match_operand:HI 2 "general_operand" "rYs,rm")])
1241 (label_ref (match_operand 3 "" ""))
1243 (clobber (reg:BI CARRY))
1247 CMP.W\t%1, %2 { J%R0\t%l3
1248 CMP%X0.W\t%1, %2 { J%R0\t%l3"
1251 (define_insn "*bitbranch<mode>4"
1252 [(set (pc) (if_then_else
1253 (ne (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rYs,rm")
1254 (match_operand:QHI 1 "msp_general_operand" "rYsi,rmi"))
1256 (label_ref (match_operand 2 "" ""))
1258 (clobber (reg:BI CARRY))
1262 BIT%x0%b0\t%1, %0 { JNE\t%l2
1263 BIT%X0%b0\t%1, %0 { JNE\t%l2"
1266 (define_insn "*bitbranch<mode>4"
1267 [(set (pc) (if_then_else
1268 (eq (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
1269 (match_operand:QHI 1 "msp_general_operand" "rmi"))
1271 (label_ref (match_operand 2 "" ""))
1273 (clobber (reg:BI CARRY))
1276 "BIT%x0%b0\t%1, %0 { JEQ\t%l2"
1279 (define_insn "*bitbranch<mode>4"
1280 [(set (pc) (if_then_else
1281 (eq (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
1282 (match_operand:QHI 1 "msp_general_operand" "rmi"))
1285 (label_ref (match_operand 2 "" ""))))
1286 (clobber (reg:BI CARRY))
1289 "BIT%X0%b0\t%1, %0 { JNE\t%l2"
1292 (define_insn "*bitbranch<mode>4"
1293 [(set (pc) (if_then_else
1294 (ne (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
1295 (match_operand:QHI 1 "msp_general_operand" "rmi"))
1298 (label_ref (match_operand 2 "" ""))))
1299 (clobber (reg:BI CARRY))
1302 "BIT%X0%b0\t%1, %0 { JEQ\t%l2"
1305 ;;------------------------------------------------------------
1306 ;; zero-extract versions of the above
1308 (define_insn "*bitbranch<mode>4_z"
1309 [(set (pc) (if_then_else
1310 (ne (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rYs,rm")
1312 (match_operand 1 "msp430_bitpos" "i,i"))
1314 (label_ref (match_operand 2 "" ""))
1316 (clobber (reg:BI CARRY))
1320 BIT%x0%b0\t%p1, %0 { JNE\t%l2
1321 BIT%X0%b0\t%p1, %0 { JNE\t%l2"
1324 (define_insn "*bitbranch<mode>4_z"
1325 [(set (pc) (if_then_else
1326 (eq (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
1328 (match_operand 1 "msp430_bitpos" "i"))
1330 (label_ref (match_operand 2 "" ""))
1332 (clobber (reg:BI CARRY))
1335 "BIT%x0%X0%b0\t%p1, %0 { JEQ\t%l2"
1338 (define_insn "*bitbranch<mode>4_z"
1339 [(set (pc) (if_then_else
1340 (eq (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
1342 (match_operand 1 "msp430_bitpos" "i"))
1345 (label_ref (match_operand 2 "" ""))))
1346 (clobber (reg:BI CARRY))
1349 "BIT%X0%b0\t%p1, %0 { JNE\t%l2"
1352 (define_insn "*bitbranch<mode>4_z"
1353 [(set (pc) (if_then_else
1354 (ne (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
1356 (match_operand 1 "msp430_bitpos" "i"))
1359 (label_ref (match_operand 2 "" ""))))
1360 (clobber (reg:BI CARRY))
1363 "BIT%X0%b0\t%p1, %0 { JEQ\t%l2"
1366 ;;------------------------------------------------------------
1375 (define_insn "disable_interrupts"
1376 [(unspec_volatile [(const_int 0)] UNS_DINT)]
1381 (define_insn "enable_interrupts"
1382 [(unspec_volatile [(const_int 0)] UNS_EINT)]
1387 (define_insn "push_intr_state"
1388 [(unspec_volatile [(const_int 0)] UNS_PUSH_INTR)]
1393 (define_insn "pop_intr_state"
1394 [(unspec_volatile [(const_int 0)] UNS_POP_INTR)]
1399 ;; Clear bits in the copy of the status register that is currently
1400 ;; saved on the stack at the top of the interrupt handler.
1401 (define_insn "bic_SR"
1402 [(unspec_volatile [(match_operand 0 "nonmemory_operand" "ir")] UNS_BIC_SR)]
1404 "BIC.W\t%0, %O0(SP)"
1407 ;; Set bits in the copy of the status register that is currently
1408 ;; saved on the stack at the top of the interrupt handler.
1409 (define_insn "bis_SR"
1410 [(unspec_volatile [(match_operand 0 "nonmemory_operand" "ir")] UNS_BIS_SR)]
1412 "BIS.W\t%0, %O0(SP)"
1415 ;; For some reason GCC is generating (set (reg) (and (neg (reg)) (int)))
1416 ;; very late on in the compilation and not splitting it into separate
1417 ;; instructions, so we provide a pattern to support it here.
1418 (define_insn "andneghi3"
1419 [(set (match_operand:HI 0 "register_operand" "=r")
1420 (and:HI (neg:HI (match_operand:HI 1 "register_operand" "r"))
1421 (match_operand 2 "immediate_operand" "n")))]
1424 if (REGNO (operands[0]) != REGNO (operands[1]))
1425 return \"MOV.W\t%1, %0 { INV.W\t%0 { INC.W\t%0 { AND.W\t%2, %0\";
1427 return \"INV.W\t%0 { INC.W\t%0 { AND.W\t%2, %0\";
1431 (define_insn "delay_cycles_start"
1432 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
1435 "; Begin %J0 cycle delay"
1438 (define_insn "delay_cycles_end"
1439 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
1442 "; End %J0 cycle delay"
1445 (define_insn "delay_cycles_32"
1446 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")
1447 (match_operand 1 "immediate_operand" "i")
1463 (define_insn "delay_cycles_32x"
1464 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")
1465 (match_operand 1 "immediate_operand" "i")
1479 (define_insn "delay_cycles_16"
1480 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")
1481 (match_operand 1 "immediate_operand" "i")
1491 (define_insn "delay_cycles_16x"
1492 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")
1493 (match_operand 1 "immediate_operand" "i")
1503 (define_insn "delay_cycles_2"
1504 [(unspec_volatile [(const_int 0) ] UNS_DELAY_2)]
1509 (define_insn "delay_cycles_1"
1510 [(unspec_volatile [(const_int 0) ] UNS_DELAY_1)]
1515 (define_insn "mulhisi3"
1516 [(set (match_operand:SI 0 "register_operand" "=r")
1517 (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%0"))
1518 (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
1519 "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
1521 if (msp430_use_f5_series_hwmult ())
1522 return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C2 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\";
1524 return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x0132 { MOV.W %2, &0x0138 { MOV.W &0x013A, %L0 { MOV.W &0x013C, %H0 { POP.W sr\";
1528 (define_insn "umulhisi3"
1529 [(set (match_operand:SI 0 "register_operand" "=r")
1530 (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%0"))
1531 (zero_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
1532 "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
1534 if (msp430_use_f5_series_hwmult ())
1535 return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x04C0 { MOV.W %2, &0x04C8 { MOV.W &0x04CA, %L0 { MOV.W &0x04CC, %H0 { POP.W sr\";
1537 return \"PUSH.W sr { DINT { NOP { MOV.W %1, &0x0130 { MOV.W %2, &0x0138 { MOV.W &0x013A, %L0 { MOV.W &0x013C, %H0 { POP.W sr\";
1541 (define_insn "mulsidi3"
1542 [(set (match_operand:DI 0 "register_operand" "=r")
1543 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%0"))
1544 (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
1545 "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
1547 if (msp430_use_f5_series_hwmult ())
1548 return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D4 { MOV.W %H1, &0x04D6 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\";
1550 return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x0144 { MOV.W %H1, &0x0146 { MOV.W %L2, &0x0150 { MOV.W %H2, &0x0152 { MOV.W &0x0154, %A0 { MOV.W &0x0156, %B0 { MOV.W &0x0158, %C0 { MOV.W &0x015A, %D0 { POP.W sr\";
1554 (define_insn "umulsidi3"
1555 [(set (match_operand:DI 0 "register_operand" "=r")
1556 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
1557 (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
1558 "optimize > 2 && msp430_hwmult_type != MSP430_HWMULT_NONE"
1560 if (msp430_use_f5_series_hwmult ())
1561 return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x04D0 { MOV.W %H1, &0x04D2 { MOV.W %L2, &0x04E0 { MOV.W %H2, &0x04E2 { MOV.W &0x04E4, %A0 { MOV.W &0x04E6, %B0 { MOV.W &0x04E8, %C0 { MOV.W &0x04EA, %D0 { POP.W sr\";
1563 return \"PUSH.W sr { DINT { NOP { MOV.W %L1, &0x0140 { MOV.W %H1, &0x0142 { MOV.W %L2, &0x0150 { MOV.W %H2, &0x0152 { MOV.W &0x0154, %A0 { MOV.W &0x0156, %B0 { MOV.W &0x0158, %C0 { MOV.W &0x015A, %D0 { POP.W sr\";