1 ;; GCC machine description for IA-32 and x86-64.
2 ;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 ;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
5 ;; Mostly by William Schelter.
6 ;; x86_64 support added by Jan Hubicka
8 ;; This file is part of GCC.
10 ;; GCC 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 3, or (at your option)
15 ;; GCC 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 GCC; see the file COPYING3. If not see
22 ;; <http://www.gnu.org/licenses/>. */
24 ;; The original PO technology requires these to be ordered by speed,
25 ;; so that assigner will pick the fastest.
27 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 ;; The special asm out single letter directives following a '%' are:
30 ;; L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
31 ;; C -- print opcode suffix for set/cmov insn.
32 ;; c -- like C, but print reversed condition
33 ;; F,f -- likewise, but for floating-point.
34 ;; O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.",
36 ;; R -- print the prefix for register names.
37 ;; z -- print the opcode suffix for the size of the current operand.
38 ;; Z -- likewise, with special suffixes for x87 instructions.
39 ;; * -- print a star (in certain assembler syntax)
40 ;; A -- print an absolute memory reference.
41 ;; w -- print the operand as if it's a "word" (HImode) even if it isn't.
42 ;; s -- print a shift double count, followed by the assemblers argument
44 ;; b -- print the QImode name of the register for the indicated operand.
45 ;; %b0 would print %al if operands[0] is reg 0.
46 ;; w -- likewise, print the HImode name of the register.
47 ;; k -- likewise, print the SImode name of the register.
48 ;; q -- likewise, print the DImode name of the register.
49 ;; x -- likewise, print the V4SFmode name of the register.
50 ;; t -- likewise, print the V8SFmode name of the register.
51 ;; h -- print the QImode name for a "high" register, either ah, bh, ch or dh.
52 ;; y -- print "st(0)" instead of "st" as a register.
53 ;; d -- print duplicated register operand for AVX instruction.
54 ;; D -- print condition for SSE cmp instruction.
55 ;; P -- if PIC, print an @PLT suffix.
56 ;; X -- don't print any sort of PIC '@' suffix for a symbol.
57 ;; & -- print some in-use local-dynamic symbol name.
58 ;; H -- print a memory address offset by 8; used for sse high-parts
59 ;; Y -- print condition for XOP pcom* instruction.
60 ;; + -- print a branch hint as 'cs' or 'ds' prefix
61 ;; ; -- print a semicolon (after prefixes due to bug in older gas).
62 ;; @ -- print a segment register of thread base pointer load
66 (define_c_enum "unspec" [
67 ;; Relocation specifiers
78 UNSPEC_MACHOPIC_OFFSET
88 UNSPEC_MEMORY_BLOCKAGE
98 ;; Other random patterns
107 UNSPEC_LD_MPIC ; load_macho_picbase
109 UNSPEC_DIV_ALREADY_SPLIT
110 UNSPEC_CALL_NEEDS_VZEROUPPER
112 ;; For SSE/MMX support:
130 UNSPEC_MS_TO_SYSV_CALL
132 ;; Generic math support
134 UNSPEC_IEEE_MIN ; not commutative
135 UNSPEC_IEEE_MAX ; not commutative
137 ;; x87 Floating point
153 UNSPEC_FRNDINT_MASK_PM
157 ;; x87 Double output FP
189 ;; For SSE4.1 support
199 ;; For SSE4.2 support
206 UNSPEC_XOP_UNSIGNED_CMP
217 UNSPEC_AESKEYGENASSIST
219 ;; For PCLMUL support
237 ;; For RDRAND support
241 (define_c_enum "unspecv" [
244 UNSPECV_PROBE_STACK_RANGE
264 UNSPECV_LLWP_INTRINSIC
265 UNSPECV_SLWP_INTRINSIC
266 UNSPECV_LWPVAL_INTRINSIC
267 UNSPECV_LWPINS_INTRINSIC
272 UNSPECV_SPLIT_STACK_RETURN
275 ;; Constants to represent pcomtrue/pcomfalse variants
285 ;; Constants used in the XOP pperm instruction
287 [(PPERM_SRC 0x00) /* copy source */
288 (PPERM_INVERT 0x20) /* invert source */
289 (PPERM_REVERSE 0x40) /* bit reverse source */
290 (PPERM_REV_INV 0x60) /* bit reverse & invert src */
291 (PPERM_ZERO 0x80) /* all 0's */
292 (PPERM_ONES 0xa0) /* all 1's */
293 (PPERM_SIGN 0xc0) /* propagate sign bit */
294 (PPERM_INV_SIGN 0xe0) /* invert & propagate sign */
295 (PPERM_SRC1 0x00) /* use first source byte */
296 (PPERM_SRC2 0x10) /* use second source byte */
299 ;; Registers by name.
352 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
355 ;; In C guard expressions, put expressions which may be compile-time
356 ;; constants first. This allows for better optimization. For
357 ;; example, write "TARGET_64BIT && reload_completed", not
358 ;; "reload_completed && TARGET_64BIT".
362 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,corei7,
363 atom,generic64,amdfam10,bdver1"
364 (const (symbol_ref "ix86_schedule")))
366 ;; A basic instruction type. Refinements due to arguments to be
367 ;; provided in other attributes.
370 alu,alu1,negnot,imov,imovx,lea,
371 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
372 icmp,test,ibr,setcc,icmov,
373 push,pop,call,callv,leave,
375 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
376 sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
377 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
378 ssemuladd,sse4arg,lwp,
379 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
380 (const_string "other"))
382 ;; Main data type used by the insn
384 "unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF"
385 (const_string "unknown"))
387 ;; The CPU unit operations uses.
388 (define_attr "unit" "integer,i387,sse,mmx,unknown"
389 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
390 (const_string "i387")
391 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
392 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
393 ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
395 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
397 (eq_attr "type" "other")
398 (const_string "unknown")]
399 (const_string "integer")))
401 ;; The (bounding maximum) length of an instruction immediate.
402 (define_attr "length_immediate" ""
403 (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
406 (eq_attr "unit" "i387,sse,mmx")
408 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
410 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
411 (eq_attr "type" "imov,test")
412 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
413 (eq_attr "type" "call")
414 (if_then_else (match_operand 0 "constant_call_address_operand" "")
417 (eq_attr "type" "callv")
418 (if_then_else (match_operand 1 "constant_call_address_operand" "")
421 ;; We don't know the size before shorten_branches. Expect
422 ;; the instruction to fit for better scheduling.
423 (eq_attr "type" "ibr")
426 (symbol_ref "/* Update immediate_length and other attributes! */
427 gcc_unreachable (),1")))
429 ;; The (bounding maximum) length of an instruction address.
430 (define_attr "length_address" ""
431 (cond [(eq_attr "type" "str,other,multi,fxch")
433 (and (eq_attr "type" "call")
434 (match_operand 0 "constant_call_address_operand" ""))
436 (and (eq_attr "type" "callv")
437 (match_operand 1 "constant_call_address_operand" ""))
440 (symbol_ref "ix86_attr_length_address_default (insn)")))
442 ;; Set when length prefix is used.
443 (define_attr "prefix_data16" ""
444 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
446 (eq_attr "mode" "HI")
448 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI"))
453 ;; Set when string REP prefix is used.
454 (define_attr "prefix_rep" ""
455 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
457 (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
462 ;; Set when 0f opcode prefix is used.
463 (define_attr "prefix_0f" ""
465 (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
466 (eq_attr "unit" "sse,mmx"))
470 ;; Set when REX opcode prefix is used.
471 (define_attr "prefix_rex" ""
472 (cond [(eq (symbol_ref "TARGET_64BIT") (const_int 0))
474 (and (eq_attr "mode" "DI")
475 (and (eq_attr "type" "!push,pop,call,callv,leave,ibr")
476 (eq_attr "unit" "!mmx")))
478 (and (eq_attr "mode" "QI")
479 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
482 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
485 (and (eq_attr "type" "imovx")
486 (match_operand:QI 1 "ext_QIreg_operand" ""))
491 ;; There are also additional prefixes in 3DNOW, SSSE3.
492 ;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
493 ;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
494 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
495 (define_attr "prefix_extra" ""
496 (cond [(eq_attr "type" "ssemuladd,sse4arg")
498 (eq_attr "type" "sseiadd1,ssecvt1")
503 ;; Prefix used: original, VEX or maybe VEX.
504 (define_attr "prefix" "orig,vex,maybe_vex"
505 (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
507 (const_string "orig")))
509 ;; VEX W bit is used.
510 (define_attr "prefix_vex_w" "" (const_int 0))
512 ;; The length of VEX prefix
513 ;; Only instructions with 0f prefix can have 2 byte VEX prefix,
514 ;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is
515 ;; still prefix_0f 1, with prefix_extra 1.
516 (define_attr "length_vex" ""
517 (if_then_else (and (eq_attr "prefix_0f" "1")
518 (eq_attr "prefix_extra" "0"))
519 (if_then_else (eq_attr "prefix_vex_w" "1")
520 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
521 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
522 (if_then_else (eq_attr "prefix_vex_w" "1")
523 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
524 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
526 ;; Set when modrm byte is used.
527 (define_attr "modrm" ""
528 (cond [(eq_attr "type" "str,leave")
530 (eq_attr "unit" "i387")
532 (and (eq_attr "type" "incdec")
533 (and (eq (symbol_ref "TARGET_64BIT") (const_int 0))
534 (ior (match_operand:SI 1 "register_operand" "")
535 (match_operand:HI 1 "register_operand" ""))))
537 (and (eq_attr "type" "push")
538 (not (match_operand 1 "memory_operand" "")))
540 (and (eq_attr "type" "pop")
541 (not (match_operand 0 "memory_operand" "")))
543 (and (eq_attr "type" "imov")
544 (and (not (eq_attr "mode" "DI"))
545 (ior (and (match_operand 0 "register_operand" "")
546 (match_operand 1 "immediate_operand" ""))
547 (ior (and (match_operand 0 "ax_reg_operand" "")
548 (match_operand 1 "memory_displacement_only_operand" ""))
549 (and (match_operand 0 "memory_displacement_only_operand" "")
550 (match_operand 1 "ax_reg_operand" ""))))))
552 (and (eq_attr "type" "call")
553 (match_operand 0 "constant_call_address_operand" ""))
555 (and (eq_attr "type" "callv")
556 (match_operand 1 "constant_call_address_operand" ""))
558 (and (eq_attr "type" "alu,alu1,icmp,test")
559 (match_operand 0 "ax_reg_operand" ""))
560 (symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))")
564 ;; The (bounding maximum) length of an instruction in bytes.
565 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
566 ;; Later we may want to split them and compute proper length as for
568 (define_attr "length" ""
569 (cond [(eq_attr "type" "other,multi,fistp,frndint")
571 (eq_attr "type" "fcmp")
573 (eq_attr "unit" "i387")
575 (plus (attr "prefix_data16")
576 (attr "length_address")))
577 (ior (eq_attr "prefix" "vex")
578 (and (eq_attr "prefix" "maybe_vex")
579 (ne (symbol_ref "TARGET_AVX") (const_int 0))))
580 (plus (attr "length_vex")
581 (plus (attr "length_immediate")
583 (attr "length_address"))))]
584 (plus (plus (attr "modrm")
585 (plus (attr "prefix_0f")
586 (plus (attr "prefix_rex")
587 (plus (attr "prefix_extra")
589 (plus (attr "prefix_rep")
590 (plus (attr "prefix_data16")
591 (plus (attr "length_immediate")
592 (attr "length_address")))))))
594 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
595 ;; `store' if there is a simple memory reference therein, or `unknown'
596 ;; if the instruction is complex.
598 (define_attr "memory" "none,load,store,both,unknown"
599 (cond [(eq_attr "type" "other,multi,str,lwp")
600 (const_string "unknown")
601 (eq_attr "type" "lea,fcmov,fpspc")
602 (const_string "none")
603 (eq_attr "type" "fistp,leave")
604 (const_string "both")
605 (eq_attr "type" "frndint")
606 (const_string "load")
607 (eq_attr "type" "push")
608 (if_then_else (match_operand 1 "memory_operand" "")
609 (const_string "both")
610 (const_string "store"))
611 (eq_attr "type" "pop")
612 (if_then_else (match_operand 0 "memory_operand" "")
613 (const_string "both")
614 (const_string "load"))
615 (eq_attr "type" "setcc")
616 (if_then_else (match_operand 0 "memory_operand" "")
617 (const_string "store")
618 (const_string "none"))
619 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
620 (if_then_else (ior (match_operand 0 "memory_operand" "")
621 (match_operand 1 "memory_operand" ""))
622 (const_string "load")
623 (const_string "none"))
624 (eq_attr "type" "ibr")
625 (if_then_else (match_operand 0 "memory_operand" "")
626 (const_string "load")
627 (const_string "none"))
628 (eq_attr "type" "call")
629 (if_then_else (match_operand 0 "constant_call_address_operand" "")
630 (const_string "none")
631 (const_string "load"))
632 (eq_attr "type" "callv")
633 (if_then_else (match_operand 1 "constant_call_address_operand" "")
634 (const_string "none")
635 (const_string "load"))
636 (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
637 (match_operand 1 "memory_operand" ""))
638 (const_string "both")
639 (and (match_operand 0 "memory_operand" "")
640 (match_operand 1 "memory_operand" ""))
641 (const_string "both")
642 (match_operand 0 "memory_operand" "")
643 (const_string "store")
644 (match_operand 1 "memory_operand" "")
645 (const_string "load")
647 "!alu1,negnot,ishift1,
648 imov,imovx,icmp,test,bitmanip,
650 sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
651 sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
652 (match_operand 2 "memory_operand" ""))
653 (const_string "load")
654 (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
655 (match_operand 3 "memory_operand" ""))
656 (const_string "load")
658 (const_string "none")))
660 ;; Indicates if an instruction has both an immediate and a displacement.
662 (define_attr "imm_disp" "false,true,unknown"
663 (cond [(eq_attr "type" "other,multi")
664 (const_string "unknown")
665 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
666 (and (match_operand 0 "memory_displacement_operand" "")
667 (match_operand 1 "immediate_operand" "")))
668 (const_string "true")
669 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
670 (and (match_operand 0 "memory_displacement_operand" "")
671 (match_operand 2 "immediate_operand" "")))
672 (const_string "true")
674 (const_string "false")))
676 ;; Indicates if an FP operation has an integer source.
678 (define_attr "fp_int_src" "false,true"
679 (const_string "false"))
681 ;; Defines rounding mode of an FP operation.
683 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
684 (const_string "any"))
686 ;; Define attribute to classify add/sub insns that consumes carry flag (CF)
687 (define_attr "use_carry" "0,1" (const_string "0"))
689 ;; Define attribute to indicate unaligned ssemov insns
690 (define_attr "movu" "0,1" (const_string "0"))
692 ;; Describe a user's asm statement.
693 (define_asm_attributes
694 [(set_attr "length" "128")
695 (set_attr "type" "multi")])
697 (define_code_iterator plusminus [plus minus])
699 (define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus])
701 ;; Base name for define_insn
702 (define_code_attr plusminus_insn
703 [(plus "add") (ss_plus "ssadd") (us_plus "usadd")
704 (minus "sub") (ss_minus "sssub") (us_minus "ussub")])
706 ;; Base name for insn mnemonic.
707 (define_code_attr plusminus_mnemonic
708 [(plus "add") (ss_plus "adds") (us_plus "addus")
709 (minus "sub") (ss_minus "subs") (us_minus "subus")])
710 (define_code_attr plusminus_carry_mnemonic
711 [(plus "adc") (minus "sbb")])
713 ;; Mark commutative operators as such in constraints.
714 (define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%")
715 (minus "") (ss_minus "") (us_minus "")])
717 ;; Mapping of signed max and min
718 (define_code_iterator smaxmin [smax smin])
720 ;; Mapping of unsigned max and min
721 (define_code_iterator umaxmin [umax umin])
723 ;; Base name for integer and FP insn mnemonic
724 (define_code_attr maxmin_int [(smax "maxs") (smin "mins")
725 (umax "maxu") (umin "minu")])
726 (define_code_attr maxmin_float [(smax "max") (smin "min")])
728 ;; Mapping of logic operators
729 (define_code_iterator any_logic [and ior xor])
730 (define_code_iterator any_or [ior xor])
732 ;; Base name for insn mnemonic.
733 (define_code_attr logic [(and "and") (ior "or") (xor "xor")])
735 ;; Mapping of shift-right operators
736 (define_code_iterator any_shiftrt [lshiftrt ashiftrt])
738 ;; Base name for define_insn
739 (define_code_attr shiftrt_insn [(lshiftrt "lshr") (ashiftrt "ashr")])
741 ;; Base name for insn mnemonic.
742 (define_code_attr shiftrt [(lshiftrt "shr") (ashiftrt "sar")])
744 ;; Mapping of rotate operators
745 (define_code_iterator any_rotate [rotate rotatert])
747 ;; Base name for define_insn
748 (define_code_attr rotate_insn [(rotate "rotl") (rotatert "rotr")])
750 ;; Base name for insn mnemonic.
751 (define_code_attr rotate [(rotate "rol") (rotatert "ror")])
753 ;; Mapping of abs neg operators
754 (define_code_iterator absneg [abs neg])
756 ;; Base name for x87 insn mnemonic.
757 (define_code_attr absneg_mnemonic [(abs "abs") (neg "chs")])
759 ;; Used in signed and unsigned widening multiplications.
760 (define_code_iterator any_extend [sign_extend zero_extend])
762 ;; Various insn prefixes for signed and unsigned operations.
763 (define_code_attr u [(sign_extend "") (zero_extend "u")
764 (div "") (udiv "u")])
765 (define_code_attr s [(sign_extend "s") (zero_extend "u")])
767 ;; Used in signed and unsigned divisions.
768 (define_code_iterator any_div [div udiv])
770 ;; Instruction prefix for signed and unsigned operations.
771 (define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
772 (div "i") (udiv "")])
774 ;; 64bit single word integer modes.
775 (define_mode_iterator SWI1248x [QI HI SI DI])
777 ;; 64bit single word integer modes without QImode and HImode.
778 (define_mode_iterator SWI48x [SI DI])
780 ;; Single word integer modes.
781 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
783 ;; Single word integer modes without SImode and DImode.
784 (define_mode_iterator SWI12 [QI HI])
786 ;; Single word integer modes without DImode.
787 (define_mode_iterator SWI124 [QI HI SI])
789 ;; Single word integer modes without QImode and DImode.
790 (define_mode_iterator SWI24 [HI SI])
792 ;; Single word integer modes without QImode.
793 (define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
795 ;; Single word integer modes without QImode and HImode.
796 (define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")])
798 ;; All math-dependant single and double word integer modes.
799 (define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH")
800 (HI "TARGET_HIMODE_MATH")
801 SI DI (TI "TARGET_64BIT")])
803 ;; Math-dependant single word integer modes.
804 (define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH")
805 (HI "TARGET_HIMODE_MATH")
806 SI (DI "TARGET_64BIT")])
808 ;; Math-dependant single word integer modes without DImode.
809 (define_mode_iterator SWIM124 [(QI "TARGET_QIMODE_MATH")
810 (HI "TARGET_HIMODE_MATH")
813 ;; Math-dependant single word integer modes without QImode.
814 (define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH")
815 SI (DI "TARGET_64BIT")])
817 ;; Double word integer modes.
818 (define_mode_iterator DWI [(DI "!TARGET_64BIT")
819 (TI "TARGET_64BIT")])
821 ;; Double word integer modes as mode attribute.
822 (define_mode_attr DWI [(SI "DI") (DI "TI")])
823 (define_mode_attr dwi [(SI "di") (DI "ti")])
825 ;; Half mode for double word integer modes.
826 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
827 (DI "TARGET_64BIT")])
829 ;; Instruction suffix for integer modes.
830 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
832 ;; Pointer size prefix for integer modes (Intel asm dialect)
833 (define_mode_attr iptrsize [(QI "BYTE")
838 ;; Register class for integer modes.
839 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
841 ;; Immediate operand constraint for integer modes.
842 (define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")])
844 ;; General operand constraint for word modes.
845 (define_mode_attr g [(QI "qmn") (HI "rmn") (SI "g") (DI "rme")])
847 ;; Immediate operand constraint for double integer modes.
848 (define_mode_attr di [(SI "iF") (DI "e")])
850 ;; Immediate operand constraint for shifts.
851 (define_mode_attr S [(QI "I") (HI "I") (SI "I") (DI "J") (TI "O")])
853 ;; General operand predicate for integer modes.
854 (define_mode_attr general_operand
855 [(QI "general_operand")
856 (HI "general_operand")
857 (SI "general_operand")
858 (DI "x86_64_general_operand")
859 (TI "x86_64_general_operand")])
861 ;; General sign/zero extend operand predicate for integer modes.
862 (define_mode_attr general_szext_operand
863 [(QI "general_operand")
864 (HI "general_operand")
865 (SI "general_operand")
866 (DI "x86_64_szext_general_operand")])
868 ;; Immediate operand predicate for integer modes.
869 (define_mode_attr immediate_operand
870 [(QI "immediate_operand")
871 (HI "immediate_operand")
872 (SI "immediate_operand")
873 (DI "x86_64_immediate_operand")])
875 ;; Nonmemory operand predicate for integer modes.
876 (define_mode_attr nonmemory_operand
877 [(QI "nonmemory_operand")
878 (HI "nonmemory_operand")
879 (SI "nonmemory_operand")
880 (DI "x86_64_nonmemory_operand")])
882 ;; Operand predicate for shifts.
883 (define_mode_attr shift_operand
884 [(QI "nonimmediate_operand")
885 (HI "nonimmediate_operand")
886 (SI "nonimmediate_operand")
887 (DI "shiftdi_operand")
888 (TI "register_operand")])
890 ;; Operand predicate for shift argument.
891 (define_mode_attr shift_immediate_operand
892 [(QI "const_1_to_31_operand")
893 (HI "const_1_to_31_operand")
894 (SI "const_1_to_31_operand")
895 (DI "const_1_to_63_operand")])
897 ;; Input operand predicate for arithmetic left shifts.
898 (define_mode_attr ashl_input_operand
899 [(QI "nonimmediate_operand")
900 (HI "nonimmediate_operand")
901 (SI "nonimmediate_operand")
902 (DI "ashldi_input_operand")
903 (TI "reg_or_pm1_operand")])
905 ;; SSE and x87 SFmode and DFmode floating point modes
906 (define_mode_iterator MODEF [SF DF])
908 ;; All x87 floating point modes
909 (define_mode_iterator X87MODEF [SF DF XF])
911 ;; All integer modes handled by x87 fisttp operator.
912 (define_mode_iterator X87MODEI [HI SI DI])
914 ;; All integer modes handled by integer x87 operators.
915 (define_mode_iterator X87MODEI12 [HI SI])
917 ;; All integer modes handled by SSE cvtts?2si* operators.
918 (define_mode_iterator SSEMODEI24 [SI DI])
920 ;; SSE asm suffix for floating point modes
921 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
923 ;; SSE vector mode corresponding to a scalar mode
924 (define_mode_attr ssevecmode
925 [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
927 ;; Instruction suffix for REX 64bit operators.
928 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
930 ;; This mode iterator allows :P to be used for patterns that operate on
931 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
932 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
934 ;; Scheduling descriptions
936 (include "pentium.md")
939 (include "athlon.md")
940 (include "bdver1.md")
946 ;; Operand and operator predicates and constraints
948 (include "predicates.md")
949 (include "constraints.md")
952 ;; Compare and branch/compare and store instructions.
954 (define_expand "cbranch<mode>4"
955 [(set (reg:CC FLAGS_REG)
956 (compare:CC (match_operand:SDWIM 1 "nonimmediate_operand" "")
957 (match_operand:SDWIM 2 "<general_operand>" "")))
958 (set (pc) (if_then_else
959 (match_operator 0 "ordered_comparison_operator"
960 [(reg:CC FLAGS_REG) (const_int 0)])
961 (label_ref (match_operand 3 "" ""))
965 if (MEM_P (operands[1]) && MEM_P (operands[2]))
966 operands[1] = force_reg (<MODE>mode, operands[1]);
967 ix86_expand_branch (GET_CODE (operands[0]),
968 operands[1], operands[2], operands[3]);
972 (define_expand "cstore<mode>4"
973 [(set (reg:CC FLAGS_REG)
974 (compare:CC (match_operand:SWIM 2 "nonimmediate_operand" "")
975 (match_operand:SWIM 3 "<general_operand>" "")))
976 (set (match_operand:QI 0 "register_operand" "")
977 (match_operator 1 "ordered_comparison_operator"
978 [(reg:CC FLAGS_REG) (const_int 0)]))]
981 if (MEM_P (operands[2]) && MEM_P (operands[3]))
982 operands[2] = force_reg (<MODE>mode, operands[2]);
983 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
984 operands[2], operands[3]);
988 (define_expand "cmp<mode>_1"
989 [(set (reg:CC FLAGS_REG)
990 (compare:CC (match_operand:SWI48 0 "nonimmediate_operand" "")
991 (match_operand:SWI48 1 "<general_operand>" "")))])
993 (define_insn "*cmp<mode>_ccno_1"
994 [(set (reg FLAGS_REG)
995 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>,?m<r>")
996 (match_operand:SWI 1 "const0_operand" "")))]
997 "ix86_match_ccmode (insn, CCNOmode)"
999 test{<imodesuffix>}\t%0, %0
1000 cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1001 [(set_attr "type" "test,icmp")
1002 (set_attr "length_immediate" "0,1")
1003 (set_attr "mode" "<MODE>")])
1005 (define_insn "*cmp<mode>_1"
1006 [(set (reg FLAGS_REG)
1007 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
1008 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")))]
1009 "ix86_match_ccmode (insn, CCmode)"
1010 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1011 [(set_attr "type" "icmp")
1012 (set_attr "mode" "<MODE>")])
1014 (define_insn "*cmp<mode>_minus_1"
1015 [(set (reg FLAGS_REG)
1017 (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
1018 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
1020 "ix86_match_ccmode (insn, CCGOCmode)"
1021 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1022 [(set_attr "type" "icmp")
1023 (set_attr "mode" "<MODE>")])
1025 (define_insn "*cmpqi_ext_1"
1026 [(set (reg FLAGS_REG)
1028 (match_operand:QI 0 "general_operand" "Qm")
1031 (match_operand 1 "ext_register_operand" "Q")
1033 (const_int 8)) 0)))]
1034 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1035 "cmp{b}\t{%h1, %0|%0, %h1}"
1036 [(set_attr "type" "icmp")
1037 (set_attr "mode" "QI")])
1039 (define_insn "*cmpqi_ext_1_rex64"
1040 [(set (reg FLAGS_REG)
1042 (match_operand:QI 0 "register_operand" "Q")
1045 (match_operand 1 "ext_register_operand" "Q")
1047 (const_int 8)) 0)))]
1048 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1049 "cmp{b}\t{%h1, %0|%0, %h1}"
1050 [(set_attr "type" "icmp")
1051 (set_attr "mode" "QI")])
1053 (define_insn "*cmpqi_ext_2"
1054 [(set (reg FLAGS_REG)
1058 (match_operand 0 "ext_register_operand" "Q")
1061 (match_operand:QI 1 "const0_operand" "")))]
1062 "ix86_match_ccmode (insn, CCNOmode)"
1064 [(set_attr "type" "test")
1065 (set_attr "length_immediate" "0")
1066 (set_attr "mode" "QI")])
1068 (define_expand "cmpqi_ext_3"
1069 [(set (reg:CC FLAGS_REG)
1073 (match_operand 0 "ext_register_operand" "")
1076 (match_operand:QI 1 "immediate_operand" "")))])
1078 (define_insn "*cmpqi_ext_3_insn"
1079 [(set (reg FLAGS_REG)
1083 (match_operand 0 "ext_register_operand" "Q")
1086 (match_operand:QI 1 "general_operand" "Qmn")))]
1087 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1088 "cmp{b}\t{%1, %h0|%h0, %1}"
1089 [(set_attr "type" "icmp")
1090 (set_attr "modrm" "1")
1091 (set_attr "mode" "QI")])
1093 (define_insn "*cmpqi_ext_3_insn_rex64"
1094 [(set (reg FLAGS_REG)
1098 (match_operand 0 "ext_register_operand" "Q")
1101 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
1102 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1103 "cmp{b}\t{%1, %h0|%h0, %1}"
1104 [(set_attr "type" "icmp")
1105 (set_attr "modrm" "1")
1106 (set_attr "mode" "QI")])
1108 (define_insn "*cmpqi_ext_4"
1109 [(set (reg FLAGS_REG)
1113 (match_operand 0 "ext_register_operand" "Q")
1118 (match_operand 1 "ext_register_operand" "Q")
1120 (const_int 8)) 0)))]
1121 "ix86_match_ccmode (insn, CCmode)"
1122 "cmp{b}\t{%h1, %h0|%h0, %h1}"
1123 [(set_attr "type" "icmp")
1124 (set_attr "mode" "QI")])
1126 ;; These implement float point compares.
1127 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
1128 ;; which would allow mix and match FP modes on the compares. Which is what
1129 ;; the old patterns did, but with many more of them.
1131 (define_expand "cbranchxf4"
1132 [(set (reg:CC FLAGS_REG)
1133 (compare:CC (match_operand:XF 1 "nonmemory_operand" "")
1134 (match_operand:XF 2 "nonmemory_operand" "")))
1135 (set (pc) (if_then_else
1136 (match_operator 0 "ix86_fp_comparison_operator"
1139 (label_ref (match_operand 3 "" ""))
1143 ix86_expand_branch (GET_CODE (operands[0]),
1144 operands[1], operands[2], operands[3]);
1148 (define_expand "cstorexf4"
1149 [(set (reg:CC FLAGS_REG)
1150 (compare:CC (match_operand:XF 2 "nonmemory_operand" "")
1151 (match_operand:XF 3 "nonmemory_operand" "")))
1152 (set (match_operand:QI 0 "register_operand" "")
1153 (match_operator 1 "ix86_fp_comparison_operator"
1158 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1159 operands[2], operands[3]);
1163 (define_expand "cbranch<mode>4"
1164 [(set (reg:CC FLAGS_REG)
1165 (compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
1166 (match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
1167 (set (pc) (if_then_else
1168 (match_operator 0 "ix86_fp_comparison_operator"
1171 (label_ref (match_operand 3 "" ""))
1173 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1175 ix86_expand_branch (GET_CODE (operands[0]),
1176 operands[1], operands[2], operands[3]);
1180 (define_expand "cstore<mode>4"
1181 [(set (reg:CC FLAGS_REG)
1182 (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
1183 (match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
1184 (set (match_operand:QI 0 "register_operand" "")
1185 (match_operator 1 "ix86_fp_comparison_operator"
1188 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1190 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1191 operands[2], operands[3]);
1195 (define_expand "cbranchcc4"
1196 [(set (pc) (if_then_else
1197 (match_operator 0 "comparison_operator"
1198 [(match_operand 1 "flags_reg_operand" "")
1199 (match_operand 2 "const0_operand" "")])
1200 (label_ref (match_operand 3 "" ""))
1204 ix86_expand_branch (GET_CODE (operands[0]),
1205 operands[1], operands[2], operands[3]);
1209 (define_expand "cstorecc4"
1210 [(set (match_operand:QI 0 "register_operand" "")
1211 (match_operator 1 "comparison_operator"
1212 [(match_operand 2 "flags_reg_operand" "")
1213 (match_operand 3 "const0_operand" "")]))]
1216 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1217 operands[2], operands[3]);
1222 ;; FP compares, step 1:
1223 ;; Set the FP condition codes.
1225 ;; CCFPmode compare with exceptions
1226 ;; CCFPUmode compare with no exceptions
1228 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
1229 ;; used to manage the reg stack popping would not be preserved.
1231 (define_insn "*cmpfp_0"
1232 [(set (match_operand:HI 0 "register_operand" "=a")
1235 (match_operand 1 "register_operand" "f")
1236 (match_operand 2 "const0_operand" ""))]
1238 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1239 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1240 "* return output_fp_compare (insn, operands, 0, 0);"
1241 [(set_attr "type" "multi")
1242 (set_attr "unit" "i387")
1244 (cond [(match_operand:SF 1 "" "")
1246 (match_operand:DF 1 "" "")
1249 (const_string "XF")))])
1251 (define_insn_and_split "*cmpfp_0_cc"
1252 [(set (reg:CCFP FLAGS_REG)
1254 (match_operand 1 "register_operand" "f")
1255 (match_operand 2 "const0_operand" "")))
1256 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1257 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1258 && TARGET_SAHF && !TARGET_CMOVE
1259 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1261 "&& reload_completed"
1264 [(compare:CCFP (match_dup 1)(match_dup 2))]
1266 (set (reg:CC FLAGS_REG)
1267 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1269 [(set_attr "type" "multi")
1270 (set_attr "unit" "i387")
1272 (cond [(match_operand:SF 1 "" "")
1274 (match_operand:DF 1 "" "")
1277 (const_string "XF")))])
1279 (define_insn "*cmpfp_xf"
1280 [(set (match_operand:HI 0 "register_operand" "=a")
1283 (match_operand:XF 1 "register_operand" "f")
1284 (match_operand:XF 2 "register_operand" "f"))]
1287 "* return output_fp_compare (insn, operands, 0, 0);"
1288 [(set_attr "type" "multi")
1289 (set_attr "unit" "i387")
1290 (set_attr "mode" "XF")])
1292 (define_insn_and_split "*cmpfp_xf_cc"
1293 [(set (reg:CCFP FLAGS_REG)
1295 (match_operand:XF 1 "register_operand" "f")
1296 (match_operand:XF 2 "register_operand" "f")))
1297 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1299 && TARGET_SAHF && !TARGET_CMOVE"
1301 "&& reload_completed"
1304 [(compare:CCFP (match_dup 1)(match_dup 2))]
1306 (set (reg:CC FLAGS_REG)
1307 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1309 [(set_attr "type" "multi")
1310 (set_attr "unit" "i387")
1311 (set_attr "mode" "XF")])
1313 (define_insn "*cmpfp_<mode>"
1314 [(set (match_operand:HI 0 "register_operand" "=a")
1317 (match_operand:MODEF 1 "register_operand" "f")
1318 (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1321 "* return output_fp_compare (insn, operands, 0, 0);"
1322 [(set_attr "type" "multi")
1323 (set_attr "unit" "i387")
1324 (set_attr "mode" "<MODE>")])
1326 (define_insn_and_split "*cmpfp_<mode>_cc"
1327 [(set (reg:CCFP FLAGS_REG)
1329 (match_operand:MODEF 1 "register_operand" "f")
1330 (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1331 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1333 && TARGET_SAHF && !TARGET_CMOVE"
1335 "&& reload_completed"
1338 [(compare:CCFP (match_dup 1)(match_dup 2))]
1340 (set (reg:CC FLAGS_REG)
1341 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1343 [(set_attr "type" "multi")
1344 (set_attr "unit" "i387")
1345 (set_attr "mode" "<MODE>")])
1347 (define_insn "*cmpfp_u"
1348 [(set (match_operand:HI 0 "register_operand" "=a")
1351 (match_operand 1 "register_operand" "f")
1352 (match_operand 2 "register_operand" "f"))]
1354 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1355 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1356 "* return output_fp_compare (insn, operands, 0, 1);"
1357 [(set_attr "type" "multi")
1358 (set_attr "unit" "i387")
1360 (cond [(match_operand:SF 1 "" "")
1362 (match_operand:DF 1 "" "")
1365 (const_string "XF")))])
1367 (define_insn_and_split "*cmpfp_u_cc"
1368 [(set (reg:CCFPU FLAGS_REG)
1370 (match_operand 1 "register_operand" "f")
1371 (match_operand 2 "register_operand" "f")))
1372 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1373 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1374 && TARGET_SAHF && !TARGET_CMOVE
1375 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1377 "&& reload_completed"
1380 [(compare:CCFPU (match_dup 1)(match_dup 2))]
1382 (set (reg:CC FLAGS_REG)
1383 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1385 [(set_attr "type" "multi")
1386 (set_attr "unit" "i387")
1388 (cond [(match_operand:SF 1 "" "")
1390 (match_operand:DF 1 "" "")
1393 (const_string "XF")))])
1395 (define_insn "*cmpfp_<mode>"
1396 [(set (match_operand:HI 0 "register_operand" "=a")
1399 (match_operand 1 "register_operand" "f")
1400 (match_operator 3 "float_operator"
1401 [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1403 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1404 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1405 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1406 "* return output_fp_compare (insn, operands, 0, 0);"
1407 [(set_attr "type" "multi")
1408 (set_attr "unit" "i387")
1409 (set_attr "fp_int_src" "true")
1410 (set_attr "mode" "<MODE>")])
1412 (define_insn_and_split "*cmpfp_<mode>_cc"
1413 [(set (reg:CCFP FLAGS_REG)
1415 (match_operand 1 "register_operand" "f")
1416 (match_operator 3 "float_operator"
1417 [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1418 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1419 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1420 && TARGET_SAHF && !TARGET_CMOVE
1421 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1422 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1424 "&& reload_completed"
1429 (match_op_dup 3 [(match_dup 2)]))]
1431 (set (reg:CC FLAGS_REG)
1432 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1434 [(set_attr "type" "multi")
1435 (set_attr "unit" "i387")
1436 (set_attr "fp_int_src" "true")
1437 (set_attr "mode" "<MODE>")])
1439 ;; FP compares, step 2
1440 ;; Move the fpsw to ax.
1442 (define_insn "x86_fnstsw_1"
1443 [(set (match_operand:HI 0 "register_operand" "=a")
1444 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1447 [(set (attr "length") (symbol_ref "ix86_attr_length_address_default (insn) + 2"))
1448 (set_attr "mode" "SI")
1449 (set_attr "unit" "i387")])
1451 ;; FP compares, step 3
1452 ;; Get ax into flags, general case.
1454 (define_insn "x86_sahf_1"
1455 [(set (reg:CC FLAGS_REG)
1456 (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1460 #ifndef HAVE_AS_IX86_SAHF
1462 return ASM_BYTE "0x9e";
1467 [(set_attr "length" "1")
1468 (set_attr "athlon_decode" "vector")
1469 (set_attr "amdfam10_decode" "direct")
1470 (set_attr "bdver1_decode" "direct")
1471 (set_attr "mode" "SI")])
1473 ;; Pentium Pro can do steps 1 through 3 in one go.
1474 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1475 (define_insn "*cmpfp_i_mixed"
1476 [(set (reg:CCFP FLAGS_REG)
1477 (compare:CCFP (match_operand 0 "register_operand" "f,x")
1478 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1479 "TARGET_MIX_SSE_I387
1480 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1481 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1482 "* return output_fp_compare (insn, operands, 1, 0);"
1483 [(set_attr "type" "fcmp,ssecomi")
1484 (set_attr "prefix" "orig,maybe_vex")
1486 (if_then_else (match_operand:SF 1 "" "")
1488 (const_string "DF")))
1489 (set (attr "prefix_rep")
1490 (if_then_else (eq_attr "type" "ssecomi")
1492 (const_string "*")))
1493 (set (attr "prefix_data16")
1494 (cond [(eq_attr "type" "fcmp")
1496 (eq_attr "mode" "DF")
1499 (const_string "0")))
1500 (set_attr "athlon_decode" "vector")
1501 (set_attr "amdfam10_decode" "direct")
1502 (set_attr "bdver1_decode" "double")])
1504 (define_insn "*cmpfp_i_sse"
1505 [(set (reg:CCFP FLAGS_REG)
1506 (compare:CCFP (match_operand 0 "register_operand" "x")
1507 (match_operand 1 "nonimmediate_operand" "xm")))]
1509 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1510 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1511 "* return output_fp_compare (insn, operands, 1, 0);"
1512 [(set_attr "type" "ssecomi")
1513 (set_attr "prefix" "maybe_vex")
1515 (if_then_else (match_operand:SF 1 "" "")
1517 (const_string "DF")))
1518 (set_attr "prefix_rep" "0")
1519 (set (attr "prefix_data16")
1520 (if_then_else (eq_attr "mode" "DF")
1522 (const_string "0")))
1523 (set_attr "athlon_decode" "vector")
1524 (set_attr "amdfam10_decode" "direct")
1525 (set_attr "bdver1_decode" "double")])
1527 (define_insn "*cmpfp_i_i387"
1528 [(set (reg:CCFP FLAGS_REG)
1529 (compare:CCFP (match_operand 0 "register_operand" "f")
1530 (match_operand 1 "register_operand" "f")))]
1531 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1533 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1534 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1535 "* return output_fp_compare (insn, operands, 1, 0);"
1536 [(set_attr "type" "fcmp")
1538 (cond [(match_operand:SF 1 "" "")
1540 (match_operand:DF 1 "" "")
1543 (const_string "XF")))
1544 (set_attr "athlon_decode" "vector")
1545 (set_attr "amdfam10_decode" "direct")
1546 (set_attr "bdver1_decode" "double")])
1548 (define_insn "*cmpfp_iu_mixed"
1549 [(set (reg:CCFPU FLAGS_REG)
1550 (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1551 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1552 "TARGET_MIX_SSE_I387
1553 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1554 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1555 "* return output_fp_compare (insn, operands, 1, 1);"
1556 [(set_attr "type" "fcmp,ssecomi")
1557 (set_attr "prefix" "orig,maybe_vex")
1559 (if_then_else (match_operand:SF 1 "" "")
1561 (const_string "DF")))
1562 (set (attr "prefix_rep")
1563 (if_then_else (eq_attr "type" "ssecomi")
1565 (const_string "*")))
1566 (set (attr "prefix_data16")
1567 (cond [(eq_attr "type" "fcmp")
1569 (eq_attr "mode" "DF")
1572 (const_string "0")))
1573 (set_attr "athlon_decode" "vector")
1574 (set_attr "amdfam10_decode" "direct")
1575 (set_attr "bdver1_decode" "double")])
1577 (define_insn "*cmpfp_iu_sse"
1578 [(set (reg:CCFPU FLAGS_REG)
1579 (compare:CCFPU (match_operand 0 "register_operand" "x")
1580 (match_operand 1 "nonimmediate_operand" "xm")))]
1582 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1583 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1584 "* return output_fp_compare (insn, operands, 1, 1);"
1585 [(set_attr "type" "ssecomi")
1586 (set_attr "prefix" "maybe_vex")
1588 (if_then_else (match_operand:SF 1 "" "")
1590 (const_string "DF")))
1591 (set_attr "prefix_rep" "0")
1592 (set (attr "prefix_data16")
1593 (if_then_else (eq_attr "mode" "DF")
1595 (const_string "0")))
1596 (set_attr "athlon_decode" "vector")
1597 (set_attr "amdfam10_decode" "direct")
1598 (set_attr "bdver1_decode" "double")])
1600 (define_insn "*cmpfp_iu_387"
1601 [(set (reg:CCFPU FLAGS_REG)
1602 (compare:CCFPU (match_operand 0 "register_operand" "f")
1603 (match_operand 1 "register_operand" "f")))]
1604 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1606 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1607 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1608 "* return output_fp_compare (insn, operands, 1, 1);"
1609 [(set_attr "type" "fcmp")
1611 (cond [(match_operand:SF 1 "" "")
1613 (match_operand:DF 1 "" "")
1616 (const_string "XF")))
1617 (set_attr "athlon_decode" "vector")
1618 (set_attr "amdfam10_decode" "direct")
1619 (set_attr "bdver1_decode" "direct")])
1621 ;; Push/pop instructions.
1623 (define_insn "*push<mode>2"
1624 [(set (match_operand:DWI 0 "push_operand" "=<")
1625 (match_operand:DWI 1 "general_no_elim_operand" "riF*m"))]
1630 [(set (match_operand:TI 0 "push_operand" "")
1631 (match_operand:TI 1 "general_operand" ""))]
1632 "TARGET_64BIT && reload_completed
1633 && !SSE_REG_P (operands[1])"
1635 "ix86_split_long_move (operands); DONE;")
1637 (define_insn "*pushdi2_rex64"
1638 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1639 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1644 [(set_attr "type" "push,multi")
1645 (set_attr "mode" "DI")])
1647 ;; Convert impossible pushes of immediate to existing instructions.
1648 ;; First try to get scratch register and go through it. In case this
1649 ;; fails, push sign extended lower part first and then overwrite
1650 ;; upper part by 32bit move.
1652 [(match_scratch:DI 2 "r")
1653 (set (match_operand:DI 0 "push_operand" "")
1654 (match_operand:DI 1 "immediate_operand" ""))]
1655 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1656 && !x86_64_immediate_operand (operands[1], DImode)"
1657 [(set (match_dup 2) (match_dup 1))
1658 (set (match_dup 0) (match_dup 2))])
1660 ;; We need to define this as both peepholer and splitter for case
1661 ;; peephole2 pass is not run.
1662 ;; "&& 1" is needed to keep it from matching the previous pattern.
1664 [(set (match_operand:DI 0 "push_operand" "")
1665 (match_operand:DI 1 "immediate_operand" ""))]
1666 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1667 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1668 [(set (match_dup 0) (match_dup 1))
1669 (set (match_dup 2) (match_dup 3))]
1671 split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]);
1673 operands[1] = gen_lowpart (DImode, operands[2]);
1674 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1679 [(set (match_operand:DI 0 "push_operand" "")
1680 (match_operand:DI 1 "immediate_operand" ""))]
1681 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
1682 ? epilogue_completed : reload_completed)
1683 && !symbolic_operand (operands[1], DImode)
1684 && !x86_64_immediate_operand (operands[1], DImode)"
1685 [(set (match_dup 0) (match_dup 1))
1686 (set (match_dup 2) (match_dup 3))]
1688 split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]);
1690 operands[1] = gen_lowpart (DImode, operands[2]);
1691 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1696 [(set (match_operand:DI 0 "push_operand" "")
1697 (match_operand:DI 1 "general_operand" ""))]
1698 "!TARGET_64BIT && reload_completed
1699 && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
1701 "ix86_split_long_move (operands); DONE;")
1703 (define_insn "*pushsi2"
1704 [(set (match_operand:SI 0 "push_operand" "=<")
1705 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1708 [(set_attr "type" "push")
1709 (set_attr "mode" "SI")])
1711 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1712 ;; "push a byte/word". But actually we use pushl, which has the effect
1713 ;; of rounding the amount pushed up to a word.
1715 ;; For TARGET_64BIT we always round up to 8 bytes.
1716 (define_insn "*push<mode>2_rex64"
1717 [(set (match_operand:SWI124 0 "push_operand" "=X")
1718 (match_operand:SWI124 1 "nonmemory_no_elim_operand" "r<i>"))]
1721 [(set_attr "type" "push")
1722 (set_attr "mode" "DI")])
1724 (define_insn "*push<mode>2"
1725 [(set (match_operand:SWI12 0 "push_operand" "=X")
1726 (match_operand:SWI12 1 "nonmemory_no_elim_operand" "rn"))]
1729 [(set_attr "type" "push")
1730 (set_attr "mode" "SI")])
1732 (define_insn "*push<mode>2_prologue"
1733 [(set (match_operand:P 0 "push_operand" "=<")
1734 (match_operand:P 1 "general_no_elim_operand" "r<i>*m"))
1735 (clobber (mem:BLK (scratch)))]
1737 "push{<imodesuffix>}\t%1"
1738 [(set_attr "type" "push")
1739 (set_attr "mode" "<MODE>")])
1741 (define_insn "*pop<mode>1"
1742 [(set (match_operand:P 0 "nonimmediate_operand" "=r*m")
1743 (match_operand:P 1 "pop_operand" ">"))]
1745 "pop{<imodesuffix>}\t%0"
1746 [(set_attr "type" "pop")
1747 (set_attr "mode" "<MODE>")])
1749 (define_insn "*pop<mode>1_epilogue"
1750 [(set (match_operand:P 0 "nonimmediate_operand" "=r*m")
1751 (match_operand:P 1 "pop_operand" ">"))
1752 (clobber (mem:BLK (scratch)))]
1754 "pop{<imodesuffix>}\t%0"
1755 [(set_attr "type" "pop")
1756 (set_attr "mode" "<MODE>")])
1758 ;; Move instructions.
1760 (define_expand "movoi"
1761 [(set (match_operand:OI 0 "nonimmediate_operand" "")
1762 (match_operand:OI 1 "general_operand" ""))]
1764 "ix86_expand_move (OImode, operands); DONE;")
1766 (define_expand "movti"
1767 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1768 (match_operand:TI 1 "nonimmediate_operand" ""))]
1769 "TARGET_64BIT || TARGET_SSE"
1772 ix86_expand_move (TImode, operands);
1773 else if (push_operand (operands[0], TImode))
1774 ix86_expand_push (TImode, operands[1]);
1776 ix86_expand_vector_move (TImode, operands);
1780 ;; This expands to what emit_move_complex would generate if we didn't
1781 ;; have a movti pattern. Having this avoids problems with reload on
1782 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
1783 ;; to have around all the time.
1784 (define_expand "movcdi"
1785 [(set (match_operand:CDI 0 "nonimmediate_operand" "")
1786 (match_operand:CDI 1 "general_operand" ""))]
1789 if (push_operand (operands[0], CDImode))
1790 emit_move_complex_push (CDImode, operands[0], operands[1]);
1792 emit_move_complex_parts (operands[0], operands[1]);
1796 (define_expand "mov<mode>"
1797 [(set (match_operand:SWI1248x 0 "nonimmediate_operand" "")
1798 (match_operand:SWI1248x 1 "general_operand" ""))]
1800 "ix86_expand_move (<MODE>mode, operands); DONE;")
1802 (define_insn "*mov<mode>_xor"
1803 [(set (match_operand:SWI48 0 "register_operand" "=r")
1804 (match_operand:SWI48 1 "const0_operand" ""))
1805 (clobber (reg:CC FLAGS_REG))]
1808 [(set_attr "type" "alu1")
1809 (set_attr "mode" "SI")
1810 (set_attr "length_immediate" "0")])
1812 (define_insn "*mov<mode>_or"
1813 [(set (match_operand:SWI48 0 "register_operand" "=r")
1814 (match_operand:SWI48 1 "const_int_operand" ""))
1815 (clobber (reg:CC FLAGS_REG))]
1817 && operands[1] == constm1_rtx"
1818 "or{<imodesuffix>}\t{%1, %0|%0, %1}"
1819 [(set_attr "type" "alu1")
1820 (set_attr "mode" "<MODE>")
1821 (set_attr "length_immediate" "1")])
1823 (define_insn "*movoi_internal_avx"
1824 [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
1825 (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
1826 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1828 switch (which_alternative)
1831 return "vxorps\t%0, %0, %0";
1834 if (misaligned_operand (operands[0], OImode)
1835 || misaligned_operand (operands[1], OImode))
1836 return "vmovdqu\t{%1, %0|%0, %1}";
1838 return "vmovdqa\t{%1, %0|%0, %1}";
1843 [(set_attr "type" "sselog1,ssemov,ssemov")
1844 (set_attr "prefix" "vex")
1845 (set_attr "mode" "OI")])
1847 (define_insn "*movti_internal_rex64"
1848 [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
1849 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
1850 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1852 switch (which_alternative)
1858 if (get_attr_mode (insn) == MODE_V4SF)
1859 return "%vxorps\t%0, %d0";
1861 return "%vpxor\t%0, %d0";
1864 /* TDmode values are passed as TImode on the stack. Moving them
1865 to stack may result in unaligned memory access. */
1866 if (misaligned_operand (operands[0], TImode)
1867 || misaligned_operand (operands[1], TImode))
1869 if (get_attr_mode (insn) == MODE_V4SF)
1870 return "%vmovups\t{%1, %0|%0, %1}";
1872 return "%vmovdqu\t{%1, %0|%0, %1}";
1876 if (get_attr_mode (insn) == MODE_V4SF)
1877 return "%vmovaps\t{%1, %0|%0, %1}";
1879 return "%vmovdqa\t{%1, %0|%0, %1}";
1885 [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
1886 (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
1888 (cond [(eq_attr "alternative" "2,3")
1890 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1892 (const_string "V4SF")
1893 (const_string "TI"))
1894 (eq_attr "alternative" "4")
1896 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
1898 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1900 (const_string "V4SF")
1901 (const_string "TI"))]
1902 (const_string "DI")))])
1905 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1906 (match_operand:TI 1 "general_operand" ""))]
1908 && !SSE_REG_P (operands[0]) && !SSE_REG_P (operands[1])"
1910 "ix86_split_long_move (operands); DONE;")
1912 (define_insn "*movti_internal_sse"
1913 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
1914 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
1915 "TARGET_SSE && !TARGET_64BIT
1916 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1918 switch (which_alternative)
1921 if (get_attr_mode (insn) == MODE_V4SF)
1922 return "%vxorps\t%0, %d0";
1924 return "%vpxor\t%0, %d0";
1927 /* TDmode values are passed as TImode on the stack. Moving them
1928 to stack may result in unaligned memory access. */
1929 if (misaligned_operand (operands[0], TImode)
1930 || misaligned_operand (operands[1], TImode))
1932 if (get_attr_mode (insn) == MODE_V4SF)
1933 return "%vmovups\t{%1, %0|%0, %1}";
1935 return "%vmovdqu\t{%1, %0|%0, %1}";
1939 if (get_attr_mode (insn) == MODE_V4SF)
1940 return "%vmovaps\t{%1, %0|%0, %1}";
1942 return "%vmovdqa\t{%1, %0|%0, %1}";
1948 [(set_attr "type" "sselog1,ssemov,ssemov")
1949 (set_attr "prefix" "maybe_vex")
1951 (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1952 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1954 (const_string "V4SF")
1955 (and (eq_attr "alternative" "2")
1956 (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
1958 (const_string "V4SF")]
1959 (const_string "TI")))])
1961 (define_insn "*movdi_internal_rex64"
1962 [(set (match_operand:DI 0 "nonimmediate_operand"
1963 "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
1964 (match_operand:DI 1 "general_operand"
1965 "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
1966 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1968 switch (get_attr_type (insn))
1971 if (SSE_REG_P (operands[0]))
1972 return "movq2dq\t{%1, %0|%0, %1}";
1974 return "movdq2q\t{%1, %0|%0, %1}";
1979 if (get_attr_mode (insn) == MODE_TI)
1980 return "vmovdqa\t{%1, %0|%0, %1}";
1982 return "vmovq\t{%1, %0|%0, %1}";
1985 if (get_attr_mode (insn) == MODE_TI)
1986 return "movdqa\t{%1, %0|%0, %1}";
1990 /* Moves from and into integer register is done using movd
1991 opcode with REX prefix. */
1992 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
1993 return "movd\t{%1, %0|%0, %1}";
1994 return "movq\t{%1, %0|%0, %1}";
1997 return "%vpxor\t%0, %d0";
2000 return "pxor\t%0, %0";
2006 return "lea{q}\t{%a1, %0|%0, %a1}";
2009 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2010 if (get_attr_mode (insn) == MODE_SI)
2011 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2012 else if (which_alternative == 2)
2013 return "movabs{q}\t{%1, %0|%0, %1}";
2015 return "mov{q}\t{%1, %0|%0, %1}";
2019 (cond [(eq_attr "alternative" "5")
2020 (const_string "mmx")
2021 (eq_attr "alternative" "6,7,8,9,10")
2022 (const_string "mmxmov")
2023 (eq_attr "alternative" "11")
2024 (const_string "sselog1")
2025 (eq_attr "alternative" "12,13,14,15,16")
2026 (const_string "ssemov")
2027 (eq_attr "alternative" "17,18")
2028 (const_string "ssecvt")
2029 (eq_attr "alternative" "4")
2030 (const_string "multi")
2031 (match_operand:DI 1 "pic_32bit_operand" "")
2032 (const_string "lea")
2034 (const_string "imov")))
2037 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2039 (const_string "*")))
2040 (set (attr "length_immediate")
2042 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2044 (const_string "*")))
2045 (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
2046 (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
2047 (set (attr "prefix")
2048 (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
2049 (const_string "maybe_vex")
2050 (const_string "orig")))
2051 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2053 ;; Convert impossible stores of immediate to existing instructions.
2054 ;; First try to get scratch register and go through it. In case this
2055 ;; fails, move by 32bit parts.
2057 [(match_scratch:DI 2 "r")
2058 (set (match_operand:DI 0 "memory_operand" "")
2059 (match_operand:DI 1 "immediate_operand" ""))]
2060 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2061 && !x86_64_immediate_operand (operands[1], DImode)"
2062 [(set (match_dup 2) (match_dup 1))
2063 (set (match_dup 0) (match_dup 2))])
2065 ;; We need to define this as both peepholer and splitter for case
2066 ;; peephole2 pass is not run.
2067 ;; "&& 1" is needed to keep it from matching the previous pattern.
2069 [(set (match_operand:DI 0 "memory_operand" "")
2070 (match_operand:DI 1 "immediate_operand" ""))]
2071 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2072 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2073 [(set (match_dup 2) (match_dup 3))
2074 (set (match_dup 4) (match_dup 5))]
2075 "split_double_mode (DImode, &operands[0], 2, &operands[2], &operands[4]);")
2078 [(set (match_operand:DI 0 "memory_operand" "")
2079 (match_operand:DI 1 "immediate_operand" ""))]
2080 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2081 ? epilogue_completed : reload_completed)
2082 && !symbolic_operand (operands[1], DImode)
2083 && !x86_64_immediate_operand (operands[1], DImode)"
2084 [(set (match_dup 2) (match_dup 3))
2085 (set (match_dup 4) (match_dup 5))]
2086 "split_double_mode (DImode, &operands[0], 2, &operands[2], &operands[4]);")
2088 (define_insn "*movdi_internal"
2089 [(set (match_operand:DI 0 "nonimmediate_operand"
2090 "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
2091 (match_operand:DI 1 "general_operand"
2092 "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
2093 "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2098 movq\t{%1, %0|%0, %1}
2099 movq\t{%1, %0|%0, %1}
2101 %vmovq\t{%1, %0|%0, %1}
2102 %vmovdqa\t{%1, %0|%0, %1}
2103 %vmovq\t{%1, %0|%0, %1}
2105 movlps\t{%1, %0|%0, %1}
2106 movaps\t{%1, %0|%0, %1}
2107 movlps\t{%1, %0|%0, %1}"
2108 [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2109 (set (attr "prefix")
2110 (if_then_else (eq_attr "alternative" "5,6,7,8")
2111 (const_string "vex")
2112 (const_string "orig")))
2113 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2116 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2117 (match_operand:DI 1 "general_operand" ""))]
2118 "!TARGET_64BIT && reload_completed
2119 && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))
2120 && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
2122 "ix86_split_long_move (operands); DONE;")
2124 (define_insn "*movsi_internal"
2125 [(set (match_operand:SI 0 "nonimmediate_operand"
2126 "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
2127 (match_operand:SI 1 "general_operand"
2128 "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))]
2129 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2131 switch (get_attr_type (insn))
2134 if (get_attr_mode (insn) == MODE_TI)
2135 return "%vpxor\t%0, %d0";
2136 return "%vxorps\t%0, %d0";
2139 switch (get_attr_mode (insn))
2142 return "%vmovdqa\t{%1, %0|%0, %1}";
2144 return "%vmovaps\t{%1, %0|%0, %1}";
2146 return "%vmovd\t{%1, %0|%0, %1}";
2148 return "%vmovss\t{%1, %0|%0, %1}";
2154 return "pxor\t%0, %0";
2157 if (get_attr_mode (insn) == MODE_DI)
2158 return "movq\t{%1, %0|%0, %1}";
2159 return "movd\t{%1, %0|%0, %1}";
2162 return "lea{l}\t{%a1, %0|%0, %a1}";
2165 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2166 return "mov{l}\t{%1, %0|%0, %1}";
2170 (cond [(eq_attr "alternative" "2")
2171 (const_string "mmx")
2172 (eq_attr "alternative" "3,4,5")
2173 (const_string "mmxmov")
2174 (eq_attr "alternative" "6")
2175 (const_string "sselog1")
2176 (eq_attr "alternative" "7,8,9,10,11")
2177 (const_string "ssemov")
2178 (match_operand:DI 1 "pic_32bit_operand" "")
2179 (const_string "lea")
2181 (const_string "imov")))
2182 (set (attr "prefix")
2183 (if_then_else (eq_attr "alternative" "0,1,2,3,4,5")
2184 (const_string "orig")
2185 (const_string "maybe_vex")))
2186 (set (attr "prefix_data16")
2187 (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI"))
2189 (const_string "*")))
2191 (cond [(eq_attr "alternative" "2,3")
2193 (eq_attr "alternative" "6,7")
2195 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2196 (const_string "V4SF")
2197 (const_string "TI"))
2198 (and (eq_attr "alternative" "8,9,10,11")
2199 (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
2202 (const_string "SI")))])
2204 (define_insn "*movhi_internal"
2205 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
2206 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
2207 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2209 switch (get_attr_type (insn))
2212 /* movzwl is faster than movw on p2 due to partial word stalls,
2213 though not as fast as an aligned movl. */
2214 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
2216 if (get_attr_mode (insn) == MODE_SI)
2217 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2219 return "mov{w}\t{%1, %0|%0, %1}";
2223 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
2225 (const_string "imov")
2226 (and (eq_attr "alternative" "0")
2227 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2229 (eq (symbol_ref "TARGET_HIMODE_MATH")
2231 (const_string "imov")
2232 (and (eq_attr "alternative" "1,2")
2233 (match_operand:HI 1 "aligned_operand" ""))
2234 (const_string "imov")
2235 (and (ne (symbol_ref "TARGET_MOVX")
2237 (eq_attr "alternative" "0,2"))
2238 (const_string "imovx")
2240 (const_string "imov")))
2242 (cond [(eq_attr "type" "imovx")
2244 (and (eq_attr "alternative" "1,2")
2245 (match_operand:HI 1 "aligned_operand" ""))
2247 (and (eq_attr "alternative" "0")
2248 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2250 (eq (symbol_ref "TARGET_HIMODE_MATH")
2254 (const_string "HI")))])
2256 ;; Situation is quite tricky about when to choose full sized (SImode) move
2257 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
2258 ;; partial register dependency machines (such as AMD Athlon), where QImode
2259 ;; moves issue extra dependency and for partial register stalls machines
2260 ;; that don't use QImode patterns (and QImode move cause stall on the next
2263 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
2264 ;; register stall machines with, where we use QImode instructions, since
2265 ;; partial register stall can be caused there. Then we use movzx.
2266 (define_insn "*movqi_internal"
2267 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
2268 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
2269 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2271 switch (get_attr_type (insn))
2274 gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
2275 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
2277 if (get_attr_mode (insn) == MODE_SI)
2278 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2280 return "mov{b}\t{%1, %0|%0, %1}";
2284 (cond [(and (eq_attr "alternative" "5")
2285 (not (match_operand:QI 1 "aligned_operand" "")))
2286 (const_string "imovx")
2287 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2289 (const_string "imov")
2290 (and (eq_attr "alternative" "3")
2291 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2293 (eq (symbol_ref "TARGET_QIMODE_MATH")
2295 (const_string "imov")
2296 (eq_attr "alternative" "3,5")
2297 (const_string "imovx")
2298 (and (ne (symbol_ref "TARGET_MOVX")
2300 (eq_attr "alternative" "2"))
2301 (const_string "imovx")
2303 (const_string "imov")))
2305 (cond [(eq_attr "alternative" "3,4,5")
2307 (eq_attr "alternative" "6")
2309 (eq_attr "type" "imovx")
2311 (and (eq_attr "type" "imov")
2312 (and (eq_attr "alternative" "0,1")
2313 (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
2315 (and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2317 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2320 ;; Avoid partial register stalls when not using QImode arithmetic
2321 (and (eq_attr "type" "imov")
2322 (and (eq_attr "alternative" "0,1")
2323 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
2325 (eq (symbol_ref "TARGET_QIMODE_MATH")
2329 (const_string "QI")))])
2331 ;; Stores and loads of ax to arbitrary constant address.
2332 ;; We fake an second form of instruction to force reload to load address
2333 ;; into register when rax is not available
2334 (define_insn "*movabs<mode>_1"
2335 [(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2336 (match_operand:SWI1248x 1 "nonmemory_operand" "a,er"))]
2337 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2339 movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
2340 mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
2341 [(set_attr "type" "imov")
2342 (set_attr "modrm" "0,*")
2343 (set_attr "length_address" "8,0")
2344 (set_attr "length_immediate" "0,*")
2345 (set_attr "memory" "store")
2346 (set_attr "mode" "<MODE>")])
2348 (define_insn "*movabs<mode>_2"
2349 [(set (match_operand:SWI1248x 0 "register_operand" "=a,r")
2350 (mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2351 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2353 movabs{<imodesuffix>}\t{%P1, %0|%0, %P1}
2354 mov{<imodesuffix>}\t{%a1, %0|%0, %a1}"
2355 [(set_attr "type" "imov")
2356 (set_attr "modrm" "0,*")
2357 (set_attr "length_address" "8,0")
2358 (set_attr "length_immediate" "0")
2359 (set_attr "memory" "load")
2360 (set_attr "mode" "<MODE>")])
2362 (define_insn "*swap<mode>"
2363 [(set (match_operand:SWI48 0 "register_operand" "+r")
2364 (match_operand:SWI48 1 "register_operand" "+r"))
2368 "xchg{<imodesuffix>}\t%1, %0"
2369 [(set_attr "type" "imov")
2370 (set_attr "mode" "<MODE>")
2371 (set_attr "pent_pair" "np")
2372 (set_attr "athlon_decode" "vector")
2373 (set_attr "amdfam10_decode" "double")
2374 (set_attr "bdver1_decode" "double")])
2376 (define_insn "*swap<mode>_1"
2377 [(set (match_operand:SWI12 0 "register_operand" "+r")
2378 (match_operand:SWI12 1 "register_operand" "+r"))
2381 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2383 [(set_attr "type" "imov")
2384 (set_attr "mode" "SI")
2385 (set_attr "pent_pair" "np")
2386 (set_attr "athlon_decode" "vector")
2387 (set_attr "amdfam10_decode" "double")
2388 (set_attr "bdver1_decode" "double")])
2390 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL
2391 ;; is disabled for AMDFAM10
2392 (define_insn "*swap<mode>_2"
2393 [(set (match_operand:SWI12 0 "register_operand" "+<r>")
2394 (match_operand:SWI12 1 "register_operand" "+<r>"))
2397 "TARGET_PARTIAL_REG_STALL"
2398 "xchg{<imodesuffix>}\t%1, %0"
2399 [(set_attr "type" "imov")
2400 (set_attr "mode" "<MODE>")
2401 (set_attr "pent_pair" "np")
2402 (set_attr "athlon_decode" "vector")])
2404 (define_expand "movstrict<mode>"
2405 [(set (strict_low_part (match_operand:SWI12 0 "nonimmediate_operand" ""))
2406 (match_operand:SWI12 1 "general_operand" ""))]
2409 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2411 /* Don't generate memory->memory moves, go through a register */
2412 if (MEM_P (operands[0]) && MEM_P (operands[1]))
2413 operands[1] = force_reg (<MODE>mode, operands[1]);
2416 (define_insn "*movstrict<mode>_1"
2417 [(set (strict_low_part
2418 (match_operand:SWI12 0 "nonimmediate_operand" "+<r>m,<r>"))
2419 (match_operand:SWI12 1 "general_operand" "<r>n,m"))]
2420 "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2421 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2422 "mov{<imodesuffix>}\t{%1, %0|%0, %1}"
2423 [(set_attr "type" "imov")
2424 (set_attr "mode" "<MODE>")])
2426 (define_insn "*movstrict<mode>_xor"
2427 [(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>"))
2428 (match_operand:SWI12 1 "const0_operand" ""))
2429 (clobber (reg:CC FLAGS_REG))]
2431 "xor{<imodesuffix>}\t%0, %0"
2432 [(set_attr "type" "alu1")
2433 (set_attr "mode" "<MODE>")
2434 (set_attr "length_immediate" "0")])
2436 (define_insn "*mov<mode>_extv_1"
2437 [(set (match_operand:SWI24 0 "register_operand" "=R")
2438 (sign_extract:SWI24 (match_operand 1 "ext_register_operand" "Q")
2442 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
2443 [(set_attr "type" "imovx")
2444 (set_attr "mode" "SI")])
2446 (define_insn "*movqi_extv_1_rex64"
2447 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2448 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2453 switch (get_attr_type (insn))
2456 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2458 return "mov{b}\t{%h1, %0|%0, %h1}";
2462 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2463 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2464 (ne (symbol_ref "TARGET_MOVX")
2466 (const_string "imovx")
2467 (const_string "imov")))
2469 (if_then_else (eq_attr "type" "imovx")
2471 (const_string "QI")))])
2473 (define_insn "*movqi_extv_1"
2474 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
2475 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2480 switch (get_attr_type (insn))
2483 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2485 return "mov{b}\t{%h1, %0|%0, %h1}";
2489 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2490 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2491 (ne (symbol_ref "TARGET_MOVX")
2493 (const_string "imovx")
2494 (const_string "imov")))
2496 (if_then_else (eq_attr "type" "imovx")
2498 (const_string "QI")))])
2500 (define_insn "*mov<mode>_extzv_1"
2501 [(set (match_operand:SWI48 0 "register_operand" "=R")
2502 (zero_extract:SWI48 (match_operand 1 "ext_register_operand" "Q")
2506 "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
2507 [(set_attr "type" "imovx")
2508 (set_attr "mode" "SI")])
2510 (define_insn "*movqi_extzv_2_rex64"
2511 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2513 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2518 switch (get_attr_type (insn))
2521 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2523 return "mov{b}\t{%h1, %0|%0, %h1}";
2527 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2528 (ne (symbol_ref "TARGET_MOVX")
2530 (const_string "imovx")
2531 (const_string "imov")))
2533 (if_then_else (eq_attr "type" "imovx")
2535 (const_string "QI")))])
2537 (define_insn "*movqi_extzv_2"
2538 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
2540 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2545 switch (get_attr_type (insn))
2548 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2550 return "mov{b}\t{%h1, %0|%0, %h1}";
2554 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2555 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2556 (ne (symbol_ref "TARGET_MOVX")
2558 (const_string "imovx")
2559 (const_string "imov")))
2561 (if_then_else (eq_attr "type" "imovx")
2563 (const_string "QI")))])
2565 (define_expand "mov<mode>_insv_1"
2566 [(set (zero_extract:SWI48 (match_operand 0 "ext_register_operand" "")
2569 (match_operand:SWI48 1 "nonmemory_operand" ""))])
2571 (define_insn "*mov<mode>_insv_1_rex64"
2572 [(set (zero_extract:SWI48x (match_operand 0 "ext_register_operand" "+Q")
2575 (match_operand:SWI48x 1 "nonmemory_operand" "Qn"))]
2577 "mov{b}\t{%b1, %h0|%h0, %b1}"
2578 [(set_attr "type" "imov")
2579 (set_attr "mode" "QI")])
2581 (define_insn "*movsi_insv_1"
2582 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2585 (match_operand:SI 1 "general_operand" "Qmn"))]
2587 "mov{b}\t{%b1, %h0|%h0, %b1}"
2588 [(set_attr "type" "imov")
2589 (set_attr "mode" "QI")])
2591 (define_insn "*movqi_insv_2"
2592 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2595 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2598 "mov{b}\t{%h1, %h0|%h0, %h1}"
2599 [(set_attr "type" "imov")
2600 (set_attr "mode" "QI")])
2602 ;; Floating point push instructions.
2604 (define_insn "*pushtf"
2605 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
2606 (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
2609 /* This insn should be already split before reg-stack. */
2612 [(set_attr "type" "multi")
2613 (set_attr "unit" "sse,*,*")
2614 (set_attr "mode" "TF,SI,SI")])
2617 [(set (match_operand:TF 0 "push_operand" "")
2618 (match_operand:TF 1 "sse_reg_operand" ""))]
2619 "TARGET_SSE2 && reload_completed"
2620 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
2621 (set (mem:TF (reg:P SP_REG)) (match_dup 1))])
2624 [(set (match_operand:TF 0 "push_operand" "")
2625 (match_operand:TF 1 "general_operand" ""))]
2626 "TARGET_SSE2 && reload_completed
2627 && !SSE_REG_P (operands[1])"
2629 "ix86_split_long_move (operands); DONE;")
2631 (define_insn "*pushxf"
2632 [(set (match_operand:XF 0 "push_operand" "=<,<")
2633 (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
2634 "optimize_function_for_speed_p (cfun)"
2636 /* This insn should be already split before reg-stack. */
2639 [(set_attr "type" "multi")
2640 (set_attr "unit" "i387,*")
2641 (set_attr "mode" "XF,SI")])
2643 ;; Size of pushxf is 3 (for sub) + 2 (for fstp) + memory operand size.
2644 ;; Size of pushxf using integer instructions is 3+3*memory operand size
2645 ;; Pushing using integer instructions is longer except for constants
2646 ;; and direct memory references (assuming that any given constant is pushed
2647 ;; only once, but this ought to be handled elsewhere).
2649 (define_insn "*pushxf_nointeger"
2650 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2651 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2652 "optimize_function_for_size_p (cfun)"
2654 /* This insn should be already split before reg-stack. */
2657 [(set_attr "type" "multi")
2658 (set_attr "unit" "i387,*,*")
2659 (set_attr "mode" "XF,SI,SI")])
2662 [(set (match_operand:XF 0 "push_operand" "")
2663 (match_operand:XF 1 "fp_register_operand" ""))]
2665 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
2666 (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
2667 "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
2670 [(set (match_operand:XF 0 "push_operand" "")
2671 (match_operand:XF 1 "general_operand" ""))]
2673 && !FP_REG_P (operands[1])"
2675 "ix86_split_long_move (operands); DONE;")
2677 (define_insn "*pushdf"
2678 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2679 (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
2680 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2682 /* This insn should be already split before reg-stack. */
2685 [(set_attr "type" "multi")
2686 (set_attr "unit" "i387,*,*")
2687 (set_attr "mode" "DF,SI,DF")])
2689 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2690 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2691 ;; On the average, pushdf using integers can be still shorter. Allow this
2692 ;; pattern for optimize_size too.
2694 (define_insn "*pushdf_nointeger"
2695 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2696 (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
2697 "!(TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES)"
2699 /* This insn should be already split before reg-stack. */
2702 [(set_attr "type" "multi")
2703 (set_attr "unit" "i387,*,*,*")
2704 (set_attr "mode" "DF,SI,SI,DF")])
2706 ;; %%% Kill this when call knows how to work this out.
2708 [(set (match_operand:DF 0 "push_operand" "")
2709 (match_operand:DF 1 "any_fp_register_operand" ""))]
2711 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
2712 (set (mem:DF (reg:P SP_REG)) (match_dup 1))])
2715 [(set (match_operand:DF 0 "push_operand" "")
2716 (match_operand:DF 1 "general_operand" ""))]
2718 && !ANY_FP_REG_P (operands[1])"
2720 "ix86_split_long_move (operands); DONE;")
2722 (define_insn "*pushsf_rex64"
2723 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2724 (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
2727 /* Anything else should be already split before reg-stack. */
2728 gcc_assert (which_alternative == 1);
2729 return "push{q}\t%q1";
2731 [(set_attr "type" "multi,push,multi")
2732 (set_attr "unit" "i387,*,*")
2733 (set_attr "mode" "SF,DI,SF")])
2735 (define_insn "*pushsf"
2736 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2737 (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
2740 /* Anything else should be already split before reg-stack. */
2741 gcc_assert (which_alternative == 1);
2742 return "push{l}\t%1";
2744 [(set_attr "type" "multi,push,multi")
2745 (set_attr "unit" "i387,*,*")
2746 (set_attr "mode" "SF,SI,SF")])
2749 [(set (match_operand:SF 0 "push_operand" "")
2750 (match_operand:SF 1 "memory_operand" ""))]
2752 && MEM_P (operands[1])
2753 && (operands[2] = find_constant_src (insn))"
2757 ;; %%% Kill this when call knows how to work this out.
2759 [(set (match_operand:SF 0 "push_operand" "")
2760 (match_operand:SF 1 "any_fp_register_operand" ""))]
2762 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
2763 (set (mem:SF (reg:P SP_REG)) (match_dup 1))]
2764 "operands[2] = GEN_INT (-GET_MODE_SIZE (<MODE>mode));")
2766 ;; Floating point move instructions.
2768 (define_expand "movtf"
2769 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2770 (match_operand:TF 1 "nonimmediate_operand" ""))]
2773 ix86_expand_move (TFmode, operands);
2777 (define_expand "mov<mode>"
2778 [(set (match_operand:X87MODEF 0 "nonimmediate_operand" "")
2779 (match_operand:X87MODEF 1 "general_operand" ""))]
2781 "ix86_expand_move (<MODE>mode, operands); DONE;")
2783 (define_insn "*movtf_internal"
2784 [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
2785 (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
2787 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2789 switch (which_alternative)
2793 if (get_attr_mode (insn) == MODE_V4SF)
2794 return "%vmovaps\t{%1, %0|%0, %1}";
2796 return "%vmovdqa\t{%1, %0|%0, %1}";
2798 if (get_attr_mode (insn) == MODE_V4SF)
2799 return "%vxorps\t%0, %d0";
2801 return "%vpxor\t%0, %d0";
2809 [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
2810 (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
2812 (cond [(eq_attr "alternative" "0,2")
2814 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2816 (const_string "V4SF")
2817 (const_string "TI"))
2818 (eq_attr "alternative" "1")
2820 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2822 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2824 (const_string "V4SF")
2825 (const_string "TI"))]
2826 (const_string "DI")))])
2829 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2830 (match_operand:TF 1 "general_operand" ""))]
2832 && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
2834 "ix86_split_long_move (operands); DONE;")
2836 (define_insn "*movxf_internal"
2837 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
2838 (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
2839 "optimize_function_for_speed_p (cfun)
2840 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2841 && (reload_in_progress || reload_completed
2842 || GET_CODE (operands[1]) != CONST_DOUBLE
2843 || memory_operand (operands[0], XFmode))"
2845 switch (which_alternative)
2849 return output_387_reg_move (insn, operands);
2852 return standard_80387_constant_opcode (operands[1]);
2861 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2862 (set_attr "mode" "XF,XF,XF,SI,SI")])
2864 ;; Do not use integer registers when optimizing for size
2865 (define_insn "*movxf_internal_nointeger"
2866 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2867 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2868 "optimize_function_for_size_p (cfun)
2869 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2870 && (reload_in_progress || reload_completed
2871 || standard_80387_constant_p (operands[1])
2872 || GET_CODE (operands[1]) != CONST_DOUBLE
2873 || memory_operand (operands[0], XFmode))"
2875 switch (which_alternative)
2879 return output_387_reg_move (insn, operands);
2882 return standard_80387_constant_opcode (operands[1]);
2890 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2891 (set_attr "mode" "XF,XF,XF,SI,SI")])
2894 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2895 (match_operand:XF 1 "general_operand" ""))]
2897 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2898 && ! (FP_REG_P (operands[0]) ||
2899 (GET_CODE (operands[0]) == SUBREG
2900 && FP_REG_P (SUBREG_REG (operands[0]))))
2901 && ! (FP_REG_P (operands[1]) ||
2902 (GET_CODE (operands[1]) == SUBREG
2903 && FP_REG_P (SUBREG_REG (operands[1]))))"
2905 "ix86_split_long_move (operands); DONE;")
2907 (define_insn "*movdf_internal_rex64"
2908 [(set (match_operand:DF 0 "nonimmediate_operand"
2909 "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
2910 (match_operand:DF 1 "general_operand"
2911 "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
2912 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2913 && (reload_in_progress || reload_completed
2914 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2915 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
2916 && optimize_function_for_size_p (cfun)
2917 && standard_80387_constant_p (operands[1]))
2918 || GET_CODE (operands[1]) != CONST_DOUBLE
2919 || memory_operand (operands[0], DFmode))"
2921 switch (which_alternative)
2925 return output_387_reg_move (insn, operands);
2928 return standard_80387_constant_opcode (operands[1]);
2935 switch (get_attr_mode (insn))
2938 return "%vxorps\t%0, %d0";
2940 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2941 return "%vxorps\t%0, %d0";
2943 return "%vxorpd\t%0, %d0";
2945 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2946 return "%vxorps\t%0, %d0";
2948 return "%vpxor\t%0, %d0";
2955 switch (get_attr_mode (insn))
2958 return "%vmovaps\t{%1, %0|%0, %1}";
2960 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2961 return "%vmovaps\t{%1, %0|%0, %1}";
2963 return "%vmovapd\t{%1, %0|%0, %1}";
2965 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2966 return "%vmovaps\t{%1, %0|%0, %1}";
2968 return "%vmovdqa\t{%1, %0|%0, %1}";
2970 return "%vmovq\t{%1, %0|%0, %1}";
2974 if (REG_P (operands[0]) && REG_P (operands[1]))
2975 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
2977 return "vmovsd\t{%1, %0|%0, %1}";
2980 return "movsd\t{%1, %0|%0, %1}";
2982 return "%vmovlpd\t{%1, %d0|%d0, %1}";
2984 return "%vmovlps\t{%1, %d0|%d0, %1}";
2991 return "%vmovd\t{%1, %0|%0, %1}";
2997 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
2998 (set (attr "prefix")
2999 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3000 (const_string "orig")
3001 (const_string "maybe_vex")))
3002 (set (attr "prefix_data16")
3003 (if_then_else (eq_attr "mode" "V1DF")
3005 (const_string "*")))
3007 (cond [(eq_attr "alternative" "0,1,2")
3009 (eq_attr "alternative" "3,4,9,10")
3012 /* For SSE1, we have many fewer alternatives. */
3013 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3014 (cond [(eq_attr "alternative" "5,6")
3015 (const_string "V4SF")
3017 (const_string "V2SF"))
3019 /* xorps is one byte shorter. */
3020 (eq_attr "alternative" "5")
3021 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3023 (const_string "V4SF")
3024 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3028 (const_string "V2DF"))
3030 /* For architectures resolving dependencies on
3031 whole SSE registers use APD move to break dependency
3032 chains, otherwise use short move to avoid extra work.
3034 movaps encodes one byte shorter. */
3035 (eq_attr "alternative" "6")
3037 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3039 (const_string "V4SF")
3040 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3042 (const_string "V2DF")
3044 (const_string "DF"))
3045 /* For architectures resolving dependencies on register
3046 parts we may avoid extra work to zero out upper part
3048 (eq_attr "alternative" "7")
3050 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3052 (const_string "V1DF")
3053 (const_string "DF"))
3055 (const_string "DF")))])
3057 (define_insn "*movdf_internal"
3058 [(set (match_operand:DF 0 "nonimmediate_operand"
3059 "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
3060 (match_operand:DF 1 "general_operand"
3061 "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
3062 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3063 && optimize_function_for_speed_p (cfun)
3064 && TARGET_INTEGER_DFMODE_MOVES
3065 && (reload_in_progress || reload_completed
3066 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3067 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3068 && optimize_function_for_size_p (cfun)
3069 && standard_80387_constant_p (operands[1]))
3070 || GET_CODE (operands[1]) != CONST_DOUBLE
3071 || memory_operand (operands[0], DFmode))"
3073 switch (which_alternative)
3077 return output_387_reg_move (insn, operands);
3080 return standard_80387_constant_opcode (operands[1]);
3087 switch (get_attr_mode (insn))
3090 return "xorps\t%0, %0";
3092 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3093 return "xorps\t%0, %0";
3095 return "xorpd\t%0, %0";
3097 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3098 return "xorps\t%0, %0";
3100 return "pxor\t%0, %0";
3107 switch (get_attr_mode (insn))
3110 return "movaps\t{%1, %0|%0, %1}";
3112 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3113 return "movaps\t{%1, %0|%0, %1}";
3115 return "movapd\t{%1, %0|%0, %1}";
3117 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3118 return "movaps\t{%1, %0|%0, %1}";
3120 return "movdqa\t{%1, %0|%0, %1}";
3122 return "movq\t{%1, %0|%0, %1}";
3124 return "movsd\t{%1, %0|%0, %1}";
3126 return "movlpd\t{%1, %0|%0, %1}";
3128 return "movlps\t{%1, %0|%0, %1}";
3137 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3138 (set (attr "prefix_data16")
3139 (if_then_else (eq_attr "mode" "V1DF")
3141 (const_string "*")))
3143 (cond [(eq_attr "alternative" "0,1,2")
3145 (eq_attr "alternative" "3,4")
3148 /* For SSE1, we have many fewer alternatives. */
3149 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3150 (cond [(eq_attr "alternative" "5,6")
3151 (const_string "V4SF")
3153 (const_string "V2SF"))
3155 /* xorps is one byte shorter. */
3156 (eq_attr "alternative" "5")
3157 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3159 (const_string "V4SF")
3160 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3164 (const_string "V2DF"))
3166 /* For architectures resolving dependencies on
3167 whole SSE registers use APD move to break dependency
3168 chains, otherwise use short move to avoid extra work.
3170 movaps encodes one byte shorter. */
3171 (eq_attr "alternative" "6")
3173 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3175 (const_string "V4SF")
3176 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3178 (const_string "V2DF")
3180 (const_string "DF"))
3181 /* For architectures resolving dependencies on register
3182 parts we may avoid extra work to zero out upper part
3184 (eq_attr "alternative" "7")
3186 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3188 (const_string "V1DF")
3189 (const_string "DF"))
3191 (const_string "DF")))])
3193 ;; Moving is usually shorter when only FP registers are used. This separate
3194 ;; movdf pattern avoids the use of integer registers for FP operations
3195 ;; when optimizing for size.
3197 (define_insn "*movdf_internal_nointeger"
3198 [(set (match_operand:DF 0 "nonimmediate_operand"
3199 "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
3200 (match_operand:DF 1 "general_operand"
3201 "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
3202 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3203 && ((optimize_function_for_size_p (cfun)
3204 || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
3205 && (reload_in_progress || reload_completed
3206 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3207 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3208 && optimize_function_for_size_p (cfun)
3209 && !memory_operand (operands[0], DFmode)
3210 && standard_80387_constant_p (operands[1]))
3211 || GET_CODE (operands[1]) != CONST_DOUBLE
3212 || ((optimize_function_for_size_p (cfun)
3213 || !TARGET_MEMORY_MISMATCH_STALL
3214 || reload_in_progress || reload_completed)
3215 && memory_operand (operands[0], DFmode)))"
3217 switch (which_alternative)
3221 return output_387_reg_move (insn, operands);
3224 return standard_80387_constant_opcode (operands[1]);
3231 switch (get_attr_mode (insn))
3234 return "%vxorps\t%0, %d0";
3236 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3237 return "%vxorps\t%0, %d0";
3239 return "%vxorpd\t%0, %d0";
3241 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3242 return "%vxorps\t%0, %d0";
3244 return "%vpxor\t%0, %d0";
3251 switch (get_attr_mode (insn))
3254 return "%vmovaps\t{%1, %0|%0, %1}";
3256 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3257 return "%vmovaps\t{%1, %0|%0, %1}";
3259 return "%vmovapd\t{%1, %0|%0, %1}";
3261 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3262 return "%vmovaps\t{%1, %0|%0, %1}";
3264 return "%vmovdqa\t{%1, %0|%0, %1}";
3266 return "%vmovq\t{%1, %0|%0, %1}";
3270 if (REG_P (operands[0]) && REG_P (operands[1]))
3271 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3273 return "vmovsd\t{%1, %0|%0, %1}";
3276 return "movsd\t{%1, %0|%0, %1}";
3280 if (REG_P (operands[0]))
3281 return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
3283 return "vmovlpd\t{%1, %0|%0, %1}";
3286 return "movlpd\t{%1, %0|%0, %1}";
3290 if (REG_P (operands[0]))
3291 return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
3293 return "vmovlps\t{%1, %0|%0, %1}";
3296 return "movlps\t{%1, %0|%0, %1}";
3305 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3306 (set (attr "prefix")
3307 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3308 (const_string "orig")
3309 (const_string "maybe_vex")))
3310 (set (attr "prefix_data16")
3311 (if_then_else (eq_attr "mode" "V1DF")
3313 (const_string "*")))
3315 (cond [(eq_attr "alternative" "0,1,2")
3317 (eq_attr "alternative" "3,4")
3320 /* For SSE1, we have many fewer alternatives. */
3321 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3322 (cond [(eq_attr "alternative" "5,6")
3323 (const_string "V4SF")
3325 (const_string "V2SF"))
3327 /* xorps is one byte shorter. */
3328 (eq_attr "alternative" "5")
3329 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3331 (const_string "V4SF")
3332 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3336 (const_string "V2DF"))
3338 /* For architectures resolving dependencies on
3339 whole SSE registers use APD move to break dependency
3340 chains, otherwise use short move to avoid extra work.
3342 movaps encodes one byte shorter. */
3343 (eq_attr "alternative" "6")
3345 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3347 (const_string "V4SF")
3348 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3350 (const_string "V2DF")
3352 (const_string "DF"))
3353 /* For architectures resolving dependencies on register
3354 parts we may avoid extra work to zero out upper part
3356 (eq_attr "alternative" "7")
3358 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3360 (const_string "V1DF")
3361 (const_string "DF"))
3363 (const_string "DF")))])
3366 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3367 (match_operand:DF 1 "general_operand" ""))]
3369 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3370 && ! (ANY_FP_REG_P (operands[0]) ||
3371 (GET_CODE (operands[0]) == SUBREG
3372 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3373 && ! (ANY_FP_REG_P (operands[1]) ||
3374 (GET_CODE (operands[1]) == SUBREG
3375 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3377 "ix86_split_long_move (operands); DONE;")
3379 (define_insn "*movsf_internal"
3380 [(set (match_operand:SF 0 "nonimmediate_operand"
3381 "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
3382 (match_operand:SF 1 "general_operand"
3383 "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
3384 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3385 && (reload_in_progress || reload_completed
3386 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3387 || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
3388 && standard_80387_constant_p (operands[1]))
3389 || GET_CODE (operands[1]) != CONST_DOUBLE
3390 || memory_operand (operands[0], SFmode))"
3392 switch (which_alternative)
3396 return output_387_reg_move (insn, operands);
3399 return standard_80387_constant_opcode (operands[1]);
3403 return "mov{l}\t{%1, %0|%0, %1}";
3405 if (get_attr_mode (insn) == MODE_TI)
3406 return "%vpxor\t%0, %d0";
3408 return "%vxorps\t%0, %d0";
3410 if (get_attr_mode (insn) == MODE_V4SF)
3411 return "%vmovaps\t{%1, %0|%0, %1}";
3413 return "%vmovss\t{%1, %d0|%d0, %1}";
3416 return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
3417 : "vmovss\t{%1, %0|%0, %1}";
3419 return "movss\t{%1, %0|%0, %1}";
3421 return "%vmovss\t{%1, %0|%0, %1}";
3423 case 9: case 10: case 14: case 15:
3424 return "movd\t{%1, %0|%0, %1}";
3426 return "%vmovd\t{%1, %0|%0, %1}";
3429 return "movq\t{%1, %0|%0, %1}";
3435 [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
3436 (set (attr "prefix")
3437 (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
3438 (const_string "maybe_vex")
3439 (const_string "orig")))
3441 (cond [(eq_attr "alternative" "3,4,9,10")
3443 (eq_attr "alternative" "5")
3445 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3447 (ne (symbol_ref "TARGET_SSE2")
3449 (eq (symbol_ref "optimize_function_for_size_p (cfun)")
3452 (const_string "V4SF"))
3453 /* For architectures resolving dependencies on
3454 whole SSE registers use APS move to break dependency
3455 chains, otherwise use short move to avoid extra work.
3457 Do the same for architectures resolving dependencies on
3458 the parts. While in DF mode it is better to always handle
3459 just register parts, the SF mode is different due to lack
3460 of instructions to load just part of the register. It is
3461 better to maintain the whole registers in single format
3462 to avoid problems on using packed logical operations. */
3463 (eq_attr "alternative" "6")
3465 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3467 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3469 (const_string "V4SF")
3470 (const_string "SF"))
3471 (eq_attr "alternative" "11")
3472 (const_string "DI")]
3473 (const_string "SF")))])
3476 [(set (match_operand 0 "register_operand" "")
3477 (match_operand 1 "memory_operand" ""))]
3479 && MEM_P (operands[1])
3480 && (GET_MODE (operands[0]) == TFmode
3481 || GET_MODE (operands[0]) == XFmode
3482 || GET_MODE (operands[0]) == DFmode
3483 || GET_MODE (operands[0]) == SFmode)
3484 && (operands[2] = find_constant_src (insn))"
3485 [(set (match_dup 0) (match_dup 2))]
3487 rtx c = operands[2];
3488 rtx r = operands[0];
3490 if (GET_CODE (r) == SUBREG)
3495 if (!standard_sse_constant_p (c))
3498 else if (FP_REG_P (r))
3500 if (!standard_80387_constant_p (c))
3503 else if (MMX_REG_P (r))
3508 [(set (match_operand 0 "register_operand" "")
3509 (float_extend (match_operand 1 "memory_operand" "")))]
3511 && MEM_P (operands[1])
3512 && (GET_MODE (operands[0]) == TFmode
3513 || GET_MODE (operands[0]) == XFmode
3514 || GET_MODE (operands[0]) == DFmode
3515 || GET_MODE (operands[0]) == SFmode)
3516 && (operands[2] = find_constant_src (insn))"
3517 [(set (match_dup 0) (match_dup 2))]
3519 rtx c = operands[2];
3520 rtx r = operands[0];
3522 if (GET_CODE (r) == SUBREG)
3527 if (!standard_sse_constant_p (c))
3530 else if (FP_REG_P (r))
3532 if (!standard_80387_constant_p (c))
3535 else if (MMX_REG_P (r))
3539 ;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
3541 [(set (match_operand:X87MODEF 0 "register_operand" "")
3542 (match_operand:X87MODEF 1 "immediate_operand" ""))]
3543 "reload_completed && FP_REGNO_P (REGNO (operands[0]))
3544 && (standard_80387_constant_p (operands[1]) == 8
3545 || standard_80387_constant_p (operands[1]) == 9)"
3546 [(set (match_dup 0)(match_dup 1))
3548 (neg:X87MODEF (match_dup 0)))]
3552 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
3553 if (real_isnegzero (&r))
3554 operands[1] = CONST0_RTX (<MODE>mode);
3556 operands[1] = CONST1_RTX (<MODE>mode);
3559 (define_insn "swapxf"
3560 [(set (match_operand:XF 0 "register_operand" "+f")
3561 (match_operand:XF 1 "register_operand" "+f"))
3566 if (STACK_TOP_P (operands[0]))
3571 [(set_attr "type" "fxch")
3572 (set_attr "mode" "XF")])
3574 (define_insn "*swap<mode>"
3575 [(set (match_operand:MODEF 0 "fp_register_operand" "+f")
3576 (match_operand:MODEF 1 "fp_register_operand" "+f"))
3579 "TARGET_80387 || reload_completed"
3581 if (STACK_TOP_P (operands[0]))
3586 [(set_attr "type" "fxch")
3587 (set_attr "mode" "<MODE>")])
3589 ;; Zero extension instructions
3591 (define_expand "zero_extendsidi2"
3592 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3593 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
3598 emit_insn (gen_zero_extendsidi2_1 (operands[0], operands[1]));
3603 (define_insn "*zero_extendsidi2_rex64"
3604 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,?*Ym,?*y,?*Yi,*Y2")
3606 (match_operand:SI 1 "nonimmediate_operand" "rm,0,r ,m ,r ,m")))]
3609 mov\t{%k1, %k0|%k0, %k1}
3611 movd\t{%1, %0|%0, %1}
3612 movd\t{%1, %0|%0, %1}
3613 %vmovd\t{%1, %0|%0, %1}
3614 %vmovd\t{%1, %0|%0, %1}"
3615 [(set_attr "type" "imovx,imov,mmxmov,mmxmov,ssemov,ssemov")
3616 (set_attr "prefix" "orig,*,orig,orig,maybe_vex,maybe_vex")
3617 (set_attr "prefix_0f" "0,*,*,*,*,*")
3618 (set_attr "mode" "SI,DI,DI,DI,TI,TI")])
3621 [(set (match_operand:DI 0 "memory_operand" "")
3622 (zero_extend:DI (match_dup 0)))]
3624 [(set (match_dup 4) (const_int 0))]
3625 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3627 ;; %%% Kill me once multi-word ops are sane.
3628 (define_insn "zero_extendsidi2_1"
3629 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?*y,?*Yi,*Y2")
3631 (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r ,m ,r ,m")))
3632 (clobber (reg:CC FLAGS_REG))]
3638 movd\t{%1, %0|%0, %1}
3639 movd\t{%1, %0|%0, %1}
3640 %vmovd\t{%1, %0|%0, %1}
3641 %vmovd\t{%1, %0|%0, %1}"
3642 [(set_attr "type" "multi,multi,multi,mmxmov,mmxmov,ssemov,ssemov")
3643 (set_attr "prefix" "*,*,*,orig,orig,maybe_vex,maybe_vex")
3644 (set_attr "mode" "SI,SI,SI,DI,DI,TI,TI")])
3647 [(set (match_operand:DI 0 "register_operand" "")
3648 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3649 (clobber (reg:CC FLAGS_REG))]
3650 "!TARGET_64BIT && reload_completed
3651 && true_regnum (operands[0]) == true_regnum (operands[1])"
3652 [(set (match_dup 4) (const_int 0))]
3653 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3656 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3657 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3658 (clobber (reg:CC FLAGS_REG))]
3659 "!TARGET_64BIT && reload_completed
3660 && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))"
3661 [(set (match_dup 3) (match_dup 1))
3662 (set (match_dup 4) (const_int 0))]
3663 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3665 (define_insn "zero_extend<mode>di2"
3666 [(set (match_operand:DI 0 "register_operand" "=r")
3668 (match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))]
3670 "movz{<imodesuffix>l|x}\t{%1, %k0|%k0, %1}"
3671 [(set_attr "type" "imovx")
3672 (set_attr "mode" "SI")])
3674 (define_expand "zero_extendhisi2"
3675 [(set (match_operand:SI 0 "register_operand" "")
3676 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3679 if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3681 operands[1] = force_reg (HImode, operands[1]);
3682 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
3687 (define_insn_and_split "zero_extendhisi2_and"
3688 [(set (match_operand:SI 0 "register_operand" "=r")
3689 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
3690 (clobber (reg:CC FLAGS_REG))]
3691 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3693 "&& reload_completed"
3694 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
3695 (clobber (reg:CC FLAGS_REG))])]
3697 [(set_attr "type" "alu1")
3698 (set_attr "mode" "SI")])
3700 (define_insn "*zero_extendhisi2_movzwl"
3701 [(set (match_operand:SI 0 "register_operand" "=r")
3702 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3703 "!TARGET_ZERO_EXTEND_WITH_AND
3704 || optimize_function_for_size_p (cfun)"
3705 "movz{wl|x}\t{%1, %0|%0, %1}"
3706 [(set_attr "type" "imovx")
3707 (set_attr "mode" "SI")])
3709 (define_expand "zero_extendqi<mode>2"
3711 [(set (match_operand:SWI24 0 "register_operand" "")
3712 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3713 (clobber (reg:CC FLAGS_REG))])])
3715 (define_insn "*zero_extendqi<mode>2_and"
3716 [(set (match_operand:SWI24 0 "register_operand" "=r,?&q")
3717 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3718 (clobber (reg:CC FLAGS_REG))]
3719 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3721 [(set_attr "type" "alu1")
3722 (set_attr "mode" "<MODE>")])
3724 ;; When source and destination does not overlap, clear destination
3725 ;; first and then do the movb
3727 [(set (match_operand:SWI24 0 "register_operand" "")
3728 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3729 (clobber (reg:CC FLAGS_REG))]
3731 && (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3732 && ANY_QI_REG_P (operands[0])
3733 && (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]))
3734 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3735 [(set (strict_low_part (match_dup 2)) (match_dup 1))]
3737 operands[2] = gen_lowpart (QImode, operands[0]);
3738 ix86_expand_clear (operands[0]);
3741 (define_insn "*zero_extendqi<mode>2_movzbl_and"
3742 [(set (match_operand:SWI24 0 "register_operand" "=r,r")
3743 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3744 (clobber (reg:CC FLAGS_REG))]
3745 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun)"
3747 [(set_attr "type" "imovx,alu1")
3748 (set_attr "mode" "<MODE>")])
3750 ;; For the movzbl case strip only the clobber
3752 [(set (match_operand:SWI24 0 "register_operand" "")
3753 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3754 (clobber (reg:CC FLAGS_REG))]
3756 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))
3757 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3759 (zero_extend:SWI24 (match_dup 1)))])
3761 ; zero extend to SImode to avoid partial register stalls
3762 (define_insn "*zero_extendqi<mode>2_movzbl"
3763 [(set (match_operand:SWI24 0 "register_operand" "=r")
3764 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3766 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))"
3767 "movz{bl|x}\t{%1, %k0|%k0, %1}"
3768 [(set_attr "type" "imovx")
3769 (set_attr "mode" "SI")])
3771 ;; Rest is handled by single and.
3773 [(set (match_operand:SWI24 0 "register_operand" "")
3774 (zero_extend:SWI24 (match_operand:QI 1 "register_operand" "")))
3775 (clobber (reg:CC FLAGS_REG))]
3777 && true_regnum (operands[0]) == true_regnum (operands[1])"
3778 [(parallel [(set (match_dup 0) (and:SWI24 (match_dup 0) (const_int 255)))
3779 (clobber (reg:CC FLAGS_REG))])])
3781 ;; Sign extension instructions
3783 (define_expand "extendsidi2"
3784 [(set (match_operand:DI 0 "register_operand" "")
3785 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))]
3790 emit_insn (gen_extendsidi2_1 (operands[0], operands[1]));
3795 (define_insn "*extendsidi2_rex64"
3796 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3797 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3801 movs{lq|x}\t{%1, %0|%0, %1}"
3802 [(set_attr "type" "imovx")
3803 (set_attr "mode" "DI")
3804 (set_attr "prefix_0f" "0")
3805 (set_attr "modrm" "0,1")])
3807 (define_insn "extendsidi2_1"
3808 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3809 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3810 (clobber (reg:CC FLAGS_REG))
3811 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3815 ;; Extend to memory case when source register does die.
3817 [(set (match_operand:DI 0 "memory_operand" "")
3818 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3819 (clobber (reg:CC FLAGS_REG))
3820 (clobber (match_operand:SI 2 "register_operand" ""))]
3822 && dead_or_set_p (insn, operands[1])
3823 && !reg_mentioned_p (operands[1], operands[0]))"
3824 [(set (match_dup 3) (match_dup 1))
3825 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3826 (clobber (reg:CC FLAGS_REG))])
3827 (set (match_dup 4) (match_dup 1))]
3828 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3830 ;; Extend to memory case when source register does not die.
3832 [(set (match_operand:DI 0 "memory_operand" "")
3833 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3834 (clobber (reg:CC FLAGS_REG))
3835 (clobber (match_operand:SI 2 "register_operand" ""))]
3839 split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);
3841 emit_move_insn (operands[3], operands[1]);
3843 /* Generate a cltd if possible and doing so it profitable. */
3844 if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)
3845 && true_regnum (operands[1]) == AX_REG
3846 && true_regnum (operands[2]) == DX_REG)
3848 emit_insn (gen_ashrsi3_cvt (operands[2], operands[1], GEN_INT (31)));
3852 emit_move_insn (operands[2], operands[1]);
3853 emit_insn (gen_ashrsi3_cvt (operands[2], operands[2], GEN_INT (31)));
3855 emit_move_insn (operands[4], operands[2]);
3859 ;; Extend to register case. Optimize case where source and destination
3860 ;; registers match and cases where we can use cltd.
3862 [(set (match_operand:DI 0 "register_operand" "")
3863 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3864 (clobber (reg:CC FLAGS_REG))
3865 (clobber (match_scratch:SI 2 ""))]
3869 split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);
3871 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3872 emit_move_insn (operands[3], operands[1]);
3874 /* Generate a cltd if possible and doing so it profitable. */
3875 if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)
3876 && true_regnum (operands[3]) == AX_REG
3877 && true_regnum (operands[4]) == DX_REG)
3879 emit_insn (gen_ashrsi3_cvt (operands[4], operands[3], GEN_INT (31)));
3883 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3884 emit_move_insn (operands[4], operands[1]);
3886 emit_insn (gen_ashrsi3_cvt (operands[4], operands[4], GEN_INT (31)));
3890 (define_insn "extend<mode>di2"
3891 [(set (match_operand:DI 0 "register_operand" "=r")
3893 (match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))]
3895 "movs{<imodesuffix>q|x}\t{%1, %0|%0, %1}"
3896 [(set_attr "type" "imovx")
3897 (set_attr "mode" "DI")])
3899 (define_insn "extendhisi2"
3900 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3901 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3904 switch (get_attr_prefix_0f (insn))
3907 return "{cwtl|cwde}";