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
97 ;; Other random patterns
106 UNSPEC_LD_MPIC ; load_macho_picbase
108 UNSPEC_DIV_ALREADY_SPLIT
109 UNSPEC_CALL_NEEDS_VZEROUPPER
111 ;; For SSE/MMX support:
129 UNSPEC_MS_TO_SYSV_CALL
131 ;; Generic math support
133 UNSPEC_IEEE_MIN ; not commutative
134 UNSPEC_IEEE_MAX ; not commutative
136 ;; x87 Floating point
152 UNSPEC_FRNDINT_MASK_PM
156 ;; x87 Double output FP
188 ;; For SSE4.1 support
198 ;; For SSE4.2 support
205 UNSPEC_XOP_UNSIGNED_CMP
216 UNSPEC_AESKEYGENASSIST
218 ;; For PCLMUL support
237 (define_c_enum "unspecv" [
240 UNSPECV_PROBE_STACK_RANGE
260 UNSPECV_LLWP_INTRINSIC
261 UNSPECV_SLWP_INTRINSIC
262 UNSPECV_LWPVAL_INTRINSIC
263 UNSPECV_LWPINS_INTRINSIC
269 UNSPECV_SPLIT_STACK_RETURN
272 ;; Constants to represent pcomtrue/pcomfalse variants
282 ;; Constants used in the XOP pperm instruction
284 [(PPERM_SRC 0x00) /* copy source */
285 (PPERM_INVERT 0x20) /* invert source */
286 (PPERM_REVERSE 0x40) /* bit reverse source */
287 (PPERM_REV_INV 0x60) /* bit reverse & invert src */
288 (PPERM_ZERO 0x80) /* all 0's */
289 (PPERM_ONES 0xa0) /* all 1's */
290 (PPERM_SIGN 0xc0) /* propagate sign bit */
291 (PPERM_INV_SIGN 0xe0) /* invert & propagate sign */
292 (PPERM_SRC1 0x00) /* use first source byte */
293 (PPERM_SRC2 0x10) /* use second source byte */
296 ;; Registers by name.
349 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
352 ;; In C guard expressions, put expressions which may be compile-time
353 ;; constants first. This allows for better optimization. For
354 ;; example, write "TARGET_64BIT && reload_completed", not
355 ;; "reload_completed && TARGET_64BIT".
359 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,atom,
360 generic64,amdfam10,bdver1"
361 (const (symbol_ref "ix86_schedule")))
363 ;; A basic instruction type. Refinements due to arguments to be
364 ;; provided in other attributes.
367 alu,alu1,negnot,imov,imovx,lea,
368 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
369 icmp,test,ibr,setcc,icmov,
370 push,pop,call,callv,leave,
372 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
373 sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
374 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
375 ssemuladd,sse4arg,lwp,
376 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
377 (const_string "other"))
379 ;; Main data type used by the insn
381 "unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF"
382 (const_string "unknown"))
384 ;; The CPU unit operations uses.
385 (define_attr "unit" "integer,i387,sse,mmx,unknown"
386 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
387 (const_string "i387")
388 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
389 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
390 ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
392 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
394 (eq_attr "type" "other")
395 (const_string "unknown")]
396 (const_string "integer")))
398 ;; The (bounding maximum) length of an instruction immediate.
399 (define_attr "length_immediate" ""
400 (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
403 (eq_attr "unit" "i387,sse,mmx")
405 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
407 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
408 (eq_attr "type" "imov,test")
409 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
410 (eq_attr "type" "call")
411 (if_then_else (match_operand 0 "constant_call_address_operand" "")
414 (eq_attr "type" "callv")
415 (if_then_else (match_operand 1 "constant_call_address_operand" "")
418 ;; We don't know the size before shorten_branches. Expect
419 ;; the instruction to fit for better scheduling.
420 (eq_attr "type" "ibr")
423 (symbol_ref "/* Update immediate_length and other attributes! */
424 gcc_unreachable (),1")))
426 ;; The (bounding maximum) length of an instruction address.
427 (define_attr "length_address" ""
428 (cond [(eq_attr "type" "str,other,multi,fxch")
430 (and (eq_attr "type" "call")
431 (match_operand 0 "constant_call_address_operand" ""))
433 (and (eq_attr "type" "callv")
434 (match_operand 1 "constant_call_address_operand" ""))
437 (symbol_ref "ix86_attr_length_address_default (insn)")))
439 ;; Set when length prefix is used.
440 (define_attr "prefix_data16" ""
441 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
443 (eq_attr "mode" "HI")
445 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI"))
450 ;; Set when string REP prefix is used.
451 (define_attr "prefix_rep" ""
452 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
454 (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
459 ;; Set when 0f opcode prefix is used.
460 (define_attr "prefix_0f" ""
462 (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
463 (eq_attr "unit" "sse,mmx"))
467 ;; Set when REX opcode prefix is used.
468 (define_attr "prefix_rex" ""
469 (cond [(eq (symbol_ref "TARGET_64BIT") (const_int 0))
471 (and (eq_attr "mode" "DI")
472 (and (eq_attr "type" "!push,pop,call,callv,leave,ibr")
473 (eq_attr "unit" "!mmx")))
475 (and (eq_attr "mode" "QI")
476 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
479 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
482 (and (eq_attr "type" "imovx")
483 (match_operand:QI 1 "ext_QIreg_operand" ""))
488 ;; There are also additional prefixes in 3DNOW, SSSE3.
489 ;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
490 ;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
491 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
492 (define_attr "prefix_extra" ""
493 (cond [(eq_attr "type" "ssemuladd,sse4arg")
495 (eq_attr "type" "sseiadd1,ssecvt1")
500 ;; Prefix used: original, VEX or maybe VEX.
501 (define_attr "prefix" "orig,vex,maybe_vex"
502 (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
504 (const_string "orig")))
506 ;; VEX W bit is used.
507 (define_attr "prefix_vex_w" "" (const_int 0))
509 ;; The length of VEX prefix
510 ;; Only instructions with 0f prefix can have 2 byte VEX prefix,
511 ;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is
512 ;; still prefix_0f 1, with prefix_extra 1.
513 (define_attr "length_vex" ""
514 (if_then_else (and (eq_attr "prefix_0f" "1")
515 (eq_attr "prefix_extra" "0"))
516 (if_then_else (eq_attr "prefix_vex_w" "1")
517 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
518 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
519 (if_then_else (eq_attr "prefix_vex_w" "1")
520 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
521 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
523 ;; Set when modrm byte is used.
524 (define_attr "modrm" ""
525 (cond [(eq_attr "type" "str,leave")
527 (eq_attr "unit" "i387")
529 (and (eq_attr "type" "incdec")
530 (and (eq (symbol_ref "TARGET_64BIT") (const_int 0))
531 (ior (match_operand:SI 1 "register_operand" "")
532 (match_operand:HI 1 "register_operand" ""))))
534 (and (eq_attr "type" "push")
535 (not (match_operand 1 "memory_operand" "")))
537 (and (eq_attr "type" "pop")
538 (not (match_operand 0 "memory_operand" "")))
540 (and (eq_attr "type" "imov")
541 (and (not (eq_attr "mode" "DI"))
542 (ior (and (match_operand 0 "register_operand" "")
543 (match_operand 1 "immediate_operand" ""))
544 (ior (and (match_operand 0 "ax_reg_operand" "")
545 (match_operand 1 "memory_displacement_only_operand" ""))
546 (and (match_operand 0 "memory_displacement_only_operand" "")
547 (match_operand 1 "ax_reg_operand" ""))))))
549 (and (eq_attr "type" "call")
550 (match_operand 0 "constant_call_address_operand" ""))
552 (and (eq_attr "type" "callv")
553 (match_operand 1 "constant_call_address_operand" ""))
555 (and (eq_attr "type" "alu,alu1,icmp,test")
556 (match_operand 0 "ax_reg_operand" ""))
557 (symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))")
561 ;; The (bounding maximum) length of an instruction in bytes.
562 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
563 ;; Later we may want to split them and compute proper length as for
565 (define_attr "length" ""
566 (cond [(eq_attr "type" "other,multi,fistp,frndint")
568 (eq_attr "type" "fcmp")
570 (eq_attr "unit" "i387")
572 (plus (attr "prefix_data16")
573 (attr "length_address")))
574 (ior (eq_attr "prefix" "vex")
575 (and (eq_attr "prefix" "maybe_vex")
576 (ne (symbol_ref "TARGET_AVX") (const_int 0))))
577 (plus (attr "length_vex")
578 (plus (attr "length_immediate")
580 (attr "length_address"))))]
581 (plus (plus (attr "modrm")
582 (plus (attr "prefix_0f")
583 (plus (attr "prefix_rex")
584 (plus (attr "prefix_extra")
586 (plus (attr "prefix_rep")
587 (plus (attr "prefix_data16")
588 (plus (attr "length_immediate")
589 (attr "length_address")))))))
591 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
592 ;; `store' if there is a simple memory reference therein, or `unknown'
593 ;; if the instruction is complex.
595 (define_attr "memory" "none,load,store,both,unknown"
596 (cond [(eq_attr "type" "other,multi,str,lwp")
597 (const_string "unknown")
598 (eq_attr "type" "lea,fcmov,fpspc")
599 (const_string "none")
600 (eq_attr "type" "fistp,leave")
601 (const_string "both")
602 (eq_attr "type" "frndint")
603 (const_string "load")
604 (eq_attr "type" "push")
605 (if_then_else (match_operand 1 "memory_operand" "")
606 (const_string "both")
607 (const_string "store"))
608 (eq_attr "type" "pop")
609 (if_then_else (match_operand 0 "memory_operand" "")
610 (const_string "both")
611 (const_string "load"))
612 (eq_attr "type" "setcc")
613 (if_then_else (match_operand 0 "memory_operand" "")
614 (const_string "store")
615 (const_string "none"))
616 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
617 (if_then_else (ior (match_operand 0 "memory_operand" "")
618 (match_operand 1 "memory_operand" ""))
619 (const_string "load")
620 (const_string "none"))
621 (eq_attr "type" "ibr")
622 (if_then_else (match_operand 0 "memory_operand" "")
623 (const_string "load")
624 (const_string "none"))
625 (eq_attr "type" "call")
626 (if_then_else (match_operand 0 "constant_call_address_operand" "")
627 (const_string "none")
628 (const_string "load"))
629 (eq_attr "type" "callv")
630 (if_then_else (match_operand 1 "constant_call_address_operand" "")
631 (const_string "none")
632 (const_string "load"))
633 (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
634 (match_operand 1 "memory_operand" ""))
635 (const_string "both")
636 (and (match_operand 0 "memory_operand" "")
637 (match_operand 1 "memory_operand" ""))
638 (const_string "both")
639 (match_operand 0 "memory_operand" "")
640 (const_string "store")
641 (match_operand 1 "memory_operand" "")
642 (const_string "load")
644 "!alu1,negnot,ishift1,
645 imov,imovx,icmp,test,bitmanip,
647 sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
648 sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
649 (match_operand 2 "memory_operand" ""))
650 (const_string "load")
651 (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
652 (match_operand 3 "memory_operand" ""))
653 (const_string "load")
655 (const_string "none")))
657 ;; Indicates if an instruction has both an immediate and a displacement.
659 (define_attr "imm_disp" "false,true,unknown"
660 (cond [(eq_attr "type" "other,multi")
661 (const_string "unknown")
662 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
663 (and (match_operand 0 "memory_displacement_operand" "")
664 (match_operand 1 "immediate_operand" "")))
665 (const_string "true")
666 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
667 (and (match_operand 0 "memory_displacement_operand" "")
668 (match_operand 2 "immediate_operand" "")))
669 (const_string "true")
671 (const_string "false")))
673 ;; Indicates if an FP operation has an integer source.
675 (define_attr "fp_int_src" "false,true"
676 (const_string "false"))
678 ;; Defines rounding mode of an FP operation.
680 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
681 (const_string "any"))
683 ;; Define attribute to classify add/sub insns that consumes carry flag (CF)
684 (define_attr "use_carry" "0,1" (const_string "0"))
686 ;; Define attribute to indicate unaligned ssemov insns
687 (define_attr "movu" "0,1" (const_string "0"))
689 ;; Describe a user's asm statement.
690 (define_asm_attributes
691 [(set_attr "length" "128")
692 (set_attr "type" "multi")])
694 (define_code_iterator plusminus [plus minus])
696 (define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus])
698 ;; Base name for define_insn
699 (define_code_attr plusminus_insn
700 [(plus "add") (ss_plus "ssadd") (us_plus "usadd")
701 (minus "sub") (ss_minus "sssub") (us_minus "ussub")])
703 ;; Base name for insn mnemonic.
704 (define_code_attr plusminus_mnemonic
705 [(plus "add") (ss_plus "adds") (us_plus "addus")
706 (minus "sub") (ss_minus "subs") (us_minus "subus")])
707 (define_code_attr plusminus_carry_mnemonic
708 [(plus "adc") (minus "sbb")])
710 ;; Mark commutative operators as such in constraints.
711 (define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%")
712 (minus "") (ss_minus "") (us_minus "")])
714 ;; Mapping of signed max and min
715 (define_code_iterator smaxmin [smax smin])
717 ;; Mapping of unsigned max and min
718 (define_code_iterator umaxmin [umax umin])
720 ;; Base name for integer and FP insn mnemonic
721 (define_code_attr maxmin_int [(smax "maxs") (smin "mins")
722 (umax "maxu") (umin "minu")])
723 (define_code_attr maxmin_float [(smax "max") (smin "min")])
725 ;; Mapping of logic operators
726 (define_code_iterator any_logic [and ior xor])
727 (define_code_iterator any_or [ior xor])
729 ;; Base name for insn mnemonic.
730 (define_code_attr logic [(and "and") (ior "or") (xor "xor")])
732 ;; Mapping of shift-right operators
733 (define_code_iterator any_shiftrt [lshiftrt ashiftrt])
735 ;; Base name for define_insn
736 (define_code_attr shiftrt_insn [(lshiftrt "lshr") (ashiftrt "ashr")])
738 ;; Base name for insn mnemonic.
739 (define_code_attr shiftrt [(lshiftrt "shr") (ashiftrt "sar")])
741 ;; Mapping of rotate operators
742 (define_code_iterator any_rotate [rotate rotatert])
744 ;; Base name for define_insn
745 (define_code_attr rotate_insn [(rotate "rotl") (rotatert "rotr")])
747 ;; Base name for insn mnemonic.
748 (define_code_attr rotate [(rotate "rol") (rotatert "ror")])
750 ;; Mapping of abs neg operators
751 (define_code_iterator absneg [abs neg])
753 ;; Base name for x87 insn mnemonic.
754 (define_code_attr absneg_mnemonic [(abs "abs") (neg "chs")])
756 ;; Used in signed and unsigned widening multiplications.
757 (define_code_iterator any_extend [sign_extend zero_extend])
759 ;; Various insn prefixes for signed and unsigned operations.
760 (define_code_attr u [(sign_extend "") (zero_extend "u")
761 (div "") (udiv "u")])
762 (define_code_attr s [(sign_extend "s") (zero_extend "u")])
764 ;; Used in signed and unsigned divisions.
765 (define_code_iterator any_div [div udiv])
767 ;; Instruction prefix for signed and unsigned operations.
768 (define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
769 (div "i") (udiv "")])
771 ;; 64bit single word integer modes.
772 (define_mode_iterator SWI1248x [QI HI SI DI])
774 ;; 64bit single word integer modes without QImode and HImode.
775 (define_mode_iterator SWI48x [SI DI])
777 ;; Single word integer modes.
778 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
780 ;; Single word integer modes without SImode and DImode.
781 (define_mode_iterator SWI12 [QI HI])
783 ;; Single word integer modes without DImode.
784 (define_mode_iterator SWI124 [QI HI SI])
786 ;; Single word integer modes without QImode and DImode.
787 (define_mode_iterator SWI24 [HI SI])
789 ;; Single word integer modes without QImode.
790 (define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
792 ;; Single word integer modes without QImode and HImode.
793 (define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")])
795 ;; All math-dependant single and double word integer modes.
796 (define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH")
797 (HI "TARGET_HIMODE_MATH")
798 SI DI (TI "TARGET_64BIT")])
800 ;; Math-dependant single word integer modes.
801 (define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH")
802 (HI "TARGET_HIMODE_MATH")
803 SI (DI "TARGET_64BIT")])
805 ;; Math-dependant single word integer modes without DImode.
806 (define_mode_iterator SWIM124 [(QI "TARGET_QIMODE_MATH")
807 (HI "TARGET_HIMODE_MATH")
810 ;; Math-dependant single word integer modes without QImode.
811 (define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH")
812 SI (DI "TARGET_64BIT")])
814 ;; Double word integer modes.
815 (define_mode_iterator DWI [(DI "!TARGET_64BIT")
816 (TI "TARGET_64BIT")])
818 ;; Double word integer modes as mode attribute.
819 (define_mode_attr DWI [(SI "DI") (DI "TI")])
820 (define_mode_attr dwi [(SI "di") (DI "ti")])
822 ;; Half mode for double word integer modes.
823 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
824 (DI "TARGET_64BIT")])
826 ;; Instruction suffix for integer modes.
827 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
829 ;; Pointer size prefix for integer modes (Intel asm dialect)
830 (define_mode_attr iptrsize [(QI "BYTE")
835 ;; Register class for integer modes.
836 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
838 ;; Immediate operand constraint for integer modes.
839 (define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")])
841 ;; General operand constraint for word modes.
842 (define_mode_attr g [(QI "qmn") (HI "rmn") (SI "g") (DI "rme")])
844 ;; Immediate operand constraint for double integer modes.
845 (define_mode_attr di [(SI "iF") (DI "e")])
847 ;; Immediate operand constraint for shifts.
848 (define_mode_attr S [(QI "I") (HI "I") (SI "I") (DI "J") (TI "O")])
850 ;; General operand predicate for integer modes.
851 (define_mode_attr general_operand
852 [(QI "general_operand")
853 (HI "general_operand")
854 (SI "general_operand")
855 (DI "x86_64_general_operand")
856 (TI "x86_64_general_operand")])
858 ;; General sign/zero extend operand predicate for integer modes.
859 (define_mode_attr general_szext_operand
860 [(QI "general_operand")
861 (HI "general_operand")
862 (SI "general_operand")
863 (DI "x86_64_szext_general_operand")])
865 ;; Immediate operand predicate for integer modes.
866 (define_mode_attr immediate_operand
867 [(QI "immediate_operand")
868 (HI "immediate_operand")
869 (SI "immediate_operand")
870 (DI "x86_64_immediate_operand")])
872 ;; Nonmemory operand predicate for integer modes.
873 (define_mode_attr nonmemory_operand
874 [(QI "nonmemory_operand")
875 (HI "nonmemory_operand")
876 (SI "nonmemory_operand")
877 (DI "x86_64_nonmemory_operand")])
879 ;; Operand predicate for shifts.
880 (define_mode_attr shift_operand
881 [(QI "nonimmediate_operand")
882 (HI "nonimmediate_operand")
883 (SI "nonimmediate_operand")
884 (DI "shiftdi_operand")
885 (TI "register_operand")])
887 ;; Operand predicate for shift argument.
888 (define_mode_attr shift_immediate_operand
889 [(QI "const_1_to_31_operand")
890 (HI "const_1_to_31_operand")
891 (SI "const_1_to_31_operand")
892 (DI "const_1_to_63_operand")])
894 ;; Input operand predicate for arithmetic left shifts.
895 (define_mode_attr ashl_input_operand
896 [(QI "nonimmediate_operand")
897 (HI "nonimmediate_operand")
898 (SI "nonimmediate_operand")
899 (DI "ashldi_input_operand")
900 (TI "reg_or_pm1_operand")])
902 ;; SSE and x87 SFmode and DFmode floating point modes
903 (define_mode_iterator MODEF [SF DF])
905 ;; All x87 floating point modes
906 (define_mode_iterator X87MODEF [SF DF XF])
908 ;; All integer modes handled by x87 fisttp operator.
909 (define_mode_iterator X87MODEI [HI SI DI])
911 ;; All integer modes handled by integer x87 operators.
912 (define_mode_iterator X87MODEI12 [HI SI])
914 ;; All integer modes handled by SSE cvtts?2si* operators.
915 (define_mode_iterator SSEMODEI24 [SI DI])
917 ;; SSE asm suffix for floating point modes
918 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
920 ;; SSE vector mode corresponding to a scalar mode
921 (define_mode_attr ssevecmode
922 [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
924 ;; Instruction suffix for REX 64bit operators.
925 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
927 ;; This mode iterator allows :P to be used for patterns that operate on
928 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
929 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
931 ;; Scheduling descriptions
933 (include "pentium.md")
936 (include "athlon.md")
937 (include "bdver1.md")
942 ;; Operand and operator predicates and constraints
944 (include "predicates.md")
945 (include "constraints.md")
948 ;; Compare and branch/compare and store instructions.
950 (define_expand "cbranch<mode>4"
951 [(set (reg:CC FLAGS_REG)
952 (compare:CC (match_operand:SDWIM 1 "nonimmediate_operand" "")
953 (match_operand:SDWIM 2 "<general_operand>" "")))
954 (set (pc) (if_then_else
955 (match_operator 0 "ordered_comparison_operator"
956 [(reg:CC FLAGS_REG) (const_int 0)])
957 (label_ref (match_operand 3 "" ""))
961 if (MEM_P (operands[1]) && MEM_P (operands[2]))
962 operands[1] = force_reg (<MODE>mode, operands[1]);
963 ix86_expand_branch (GET_CODE (operands[0]),
964 operands[1], operands[2], operands[3]);
968 (define_expand "cstore<mode>4"
969 [(set (reg:CC FLAGS_REG)
970 (compare:CC (match_operand:SWIM 2 "nonimmediate_operand" "")
971 (match_operand:SWIM 3 "<general_operand>" "")))
972 (set (match_operand:QI 0 "register_operand" "")
973 (match_operator 1 "ordered_comparison_operator"
974 [(reg:CC FLAGS_REG) (const_int 0)]))]
977 if (MEM_P (operands[2]) && MEM_P (operands[3]))
978 operands[2] = force_reg (<MODE>mode, operands[2]);
979 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
980 operands[2], operands[3]);
984 (define_expand "cmp<mode>_1"
985 [(set (reg:CC FLAGS_REG)
986 (compare:CC (match_operand:SWI48 0 "nonimmediate_operand" "")
987 (match_operand:SWI48 1 "<general_operand>" "")))])
989 (define_insn "*cmp<mode>_ccno_1"
990 [(set (reg FLAGS_REG)
991 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>,?m<r>")
992 (match_operand:SWI 1 "const0_operand" "")))]
993 "ix86_match_ccmode (insn, CCNOmode)"
995 test{<imodesuffix>}\t%0, %0
996 cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
997 [(set_attr "type" "test,icmp")
998 (set_attr "length_immediate" "0,1")
999 (set_attr "mode" "<MODE>")])
1001 (define_insn "*cmp<mode>_1"
1002 [(set (reg FLAGS_REG)
1003 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
1004 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")))]
1005 "ix86_match_ccmode (insn, CCmode)"
1006 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1007 [(set_attr "type" "icmp")
1008 (set_attr "mode" "<MODE>")])
1010 (define_insn "*cmp<mode>_minus_1"
1011 [(set (reg FLAGS_REG)
1013 (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
1014 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
1016 "ix86_match_ccmode (insn, CCGOCmode)"
1017 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1018 [(set_attr "type" "icmp")
1019 (set_attr "mode" "<MODE>")])
1021 (define_insn "*cmpqi_ext_1"
1022 [(set (reg FLAGS_REG)
1024 (match_operand:QI 0 "general_operand" "Qm")
1027 (match_operand 1 "ext_register_operand" "Q")
1029 (const_int 8)) 0)))]
1030 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1031 "cmp{b}\t{%h1, %0|%0, %h1}"
1032 [(set_attr "type" "icmp")
1033 (set_attr "mode" "QI")])
1035 (define_insn "*cmpqi_ext_1_rex64"
1036 [(set (reg FLAGS_REG)
1038 (match_operand:QI 0 "register_operand" "Q")
1041 (match_operand 1 "ext_register_operand" "Q")
1043 (const_int 8)) 0)))]
1044 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1045 "cmp{b}\t{%h1, %0|%0, %h1}"
1046 [(set_attr "type" "icmp")
1047 (set_attr "mode" "QI")])
1049 (define_insn "*cmpqi_ext_2"
1050 [(set (reg FLAGS_REG)
1054 (match_operand 0 "ext_register_operand" "Q")
1057 (match_operand:QI 1 "const0_operand" "")))]
1058 "ix86_match_ccmode (insn, CCNOmode)"
1060 [(set_attr "type" "test")
1061 (set_attr "length_immediate" "0")
1062 (set_attr "mode" "QI")])
1064 (define_expand "cmpqi_ext_3"
1065 [(set (reg:CC FLAGS_REG)
1069 (match_operand 0 "ext_register_operand" "")
1072 (match_operand:QI 1 "immediate_operand" "")))])
1074 (define_insn "*cmpqi_ext_3_insn"
1075 [(set (reg FLAGS_REG)
1079 (match_operand 0 "ext_register_operand" "Q")
1082 (match_operand:QI 1 "general_operand" "Qmn")))]
1083 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1084 "cmp{b}\t{%1, %h0|%h0, %1}"
1085 [(set_attr "type" "icmp")
1086 (set_attr "modrm" "1")
1087 (set_attr "mode" "QI")])
1089 (define_insn "*cmpqi_ext_3_insn_rex64"
1090 [(set (reg FLAGS_REG)
1094 (match_operand 0 "ext_register_operand" "Q")
1097 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
1098 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1099 "cmp{b}\t{%1, %h0|%h0, %1}"
1100 [(set_attr "type" "icmp")
1101 (set_attr "modrm" "1")
1102 (set_attr "mode" "QI")])
1104 (define_insn "*cmpqi_ext_4"
1105 [(set (reg FLAGS_REG)
1109 (match_operand 0 "ext_register_operand" "Q")
1114 (match_operand 1 "ext_register_operand" "Q")
1116 (const_int 8)) 0)))]
1117 "ix86_match_ccmode (insn, CCmode)"
1118 "cmp{b}\t{%h1, %h0|%h0, %h1}"
1119 [(set_attr "type" "icmp")
1120 (set_attr "mode" "QI")])
1122 ;; These implement float point compares.
1123 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
1124 ;; which would allow mix and match FP modes on the compares. Which is what
1125 ;; the old patterns did, but with many more of them.
1127 (define_expand "cbranchxf4"
1128 [(set (reg:CC FLAGS_REG)
1129 (compare:CC (match_operand:XF 1 "nonmemory_operand" "")
1130 (match_operand:XF 2 "nonmemory_operand" "")))
1131 (set (pc) (if_then_else
1132 (match_operator 0 "ix86_fp_comparison_operator"
1135 (label_ref (match_operand 3 "" ""))
1139 ix86_expand_branch (GET_CODE (operands[0]),
1140 operands[1], operands[2], operands[3]);
1144 (define_expand "cstorexf4"
1145 [(set (reg:CC FLAGS_REG)
1146 (compare:CC (match_operand:XF 2 "nonmemory_operand" "")
1147 (match_operand:XF 3 "nonmemory_operand" "")))
1148 (set (match_operand:QI 0 "register_operand" "")
1149 (match_operator 1 "ix86_fp_comparison_operator"
1154 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1155 operands[2], operands[3]);
1159 (define_expand "cbranch<mode>4"
1160 [(set (reg:CC FLAGS_REG)
1161 (compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
1162 (match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
1163 (set (pc) (if_then_else
1164 (match_operator 0 "ix86_fp_comparison_operator"
1167 (label_ref (match_operand 3 "" ""))
1169 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1171 ix86_expand_branch (GET_CODE (operands[0]),
1172 operands[1], operands[2], operands[3]);
1176 (define_expand "cstore<mode>4"
1177 [(set (reg:CC FLAGS_REG)
1178 (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
1179 (match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
1180 (set (match_operand:QI 0 "register_operand" "")
1181 (match_operator 1 "ix86_fp_comparison_operator"
1184 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1186 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1187 operands[2], operands[3]);
1191 (define_expand "cbranchcc4"
1192 [(set (pc) (if_then_else
1193 (match_operator 0 "comparison_operator"
1194 [(match_operand 1 "flags_reg_operand" "")
1195 (match_operand 2 "const0_operand" "")])
1196 (label_ref (match_operand 3 "" ""))
1200 ix86_expand_branch (GET_CODE (operands[0]),
1201 operands[1], operands[2], operands[3]);
1205 (define_expand "cstorecc4"
1206 [(set (match_operand:QI 0 "register_operand" "")
1207 (match_operator 1 "comparison_operator"
1208 [(match_operand 2 "flags_reg_operand" "")
1209 (match_operand 3 "const0_operand" "")]))]
1212 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1213 operands[2], operands[3]);
1218 ;; FP compares, step 1:
1219 ;; Set the FP condition codes.
1221 ;; CCFPmode compare with exceptions
1222 ;; CCFPUmode compare with no exceptions
1224 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
1225 ;; used to manage the reg stack popping would not be preserved.
1227 (define_insn "*cmpfp_0"
1228 [(set (match_operand:HI 0 "register_operand" "=a")
1231 (match_operand 1 "register_operand" "f")
1232 (match_operand 2 "const0_operand" ""))]
1234 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1235 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1236 "* return output_fp_compare (insn, operands, 0, 0);"
1237 [(set_attr "type" "multi")
1238 (set_attr "unit" "i387")
1240 (cond [(match_operand:SF 1 "" "")
1242 (match_operand:DF 1 "" "")
1245 (const_string "XF")))])
1247 (define_insn_and_split "*cmpfp_0_cc"
1248 [(set (reg:CCFP FLAGS_REG)
1250 (match_operand 1 "register_operand" "f")
1251 (match_operand 2 "const0_operand" "")))
1252 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1253 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1254 && TARGET_SAHF && !TARGET_CMOVE
1255 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1257 "&& reload_completed"
1260 [(compare:CCFP (match_dup 1)(match_dup 2))]
1262 (set (reg:CC FLAGS_REG)
1263 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1265 [(set_attr "type" "multi")
1266 (set_attr "unit" "i387")
1268 (cond [(match_operand:SF 1 "" "")
1270 (match_operand:DF 1 "" "")
1273 (const_string "XF")))])
1275 (define_insn "*cmpfp_xf"
1276 [(set (match_operand:HI 0 "register_operand" "=a")
1279 (match_operand:XF 1 "register_operand" "f")
1280 (match_operand:XF 2 "register_operand" "f"))]
1283 "* return output_fp_compare (insn, operands, 0, 0);"
1284 [(set_attr "type" "multi")
1285 (set_attr "unit" "i387")
1286 (set_attr "mode" "XF")])
1288 (define_insn_and_split "*cmpfp_xf_cc"
1289 [(set (reg:CCFP FLAGS_REG)
1291 (match_operand:XF 1 "register_operand" "f")
1292 (match_operand:XF 2 "register_operand" "f")))
1293 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1295 && TARGET_SAHF && !TARGET_CMOVE"
1297 "&& reload_completed"
1300 [(compare:CCFP (match_dup 1)(match_dup 2))]
1302 (set (reg:CC FLAGS_REG)
1303 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1305 [(set_attr "type" "multi")
1306 (set_attr "unit" "i387")
1307 (set_attr "mode" "XF")])
1309 (define_insn "*cmpfp_<mode>"
1310 [(set (match_operand:HI 0 "register_operand" "=a")
1313 (match_operand:MODEF 1 "register_operand" "f")
1314 (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1317 "* return output_fp_compare (insn, operands, 0, 0);"
1318 [(set_attr "type" "multi")
1319 (set_attr "unit" "i387")
1320 (set_attr "mode" "<MODE>")])
1322 (define_insn_and_split "*cmpfp_<mode>_cc"
1323 [(set (reg:CCFP FLAGS_REG)
1325 (match_operand:MODEF 1 "register_operand" "f")
1326 (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1327 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1329 && TARGET_SAHF && !TARGET_CMOVE"
1331 "&& reload_completed"
1334 [(compare:CCFP (match_dup 1)(match_dup 2))]
1336 (set (reg:CC FLAGS_REG)
1337 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1339 [(set_attr "type" "multi")
1340 (set_attr "unit" "i387")
1341 (set_attr "mode" "<MODE>")])
1343 (define_insn "*cmpfp_u"
1344 [(set (match_operand:HI 0 "register_operand" "=a")
1347 (match_operand 1 "register_operand" "f")
1348 (match_operand 2 "register_operand" "f"))]
1350 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1351 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1352 "* return output_fp_compare (insn, operands, 0, 1);"
1353 [(set_attr "type" "multi")
1354 (set_attr "unit" "i387")
1356 (cond [(match_operand:SF 1 "" "")
1358 (match_operand:DF 1 "" "")
1361 (const_string "XF")))])
1363 (define_insn_and_split "*cmpfp_u_cc"
1364 [(set (reg:CCFPU FLAGS_REG)
1366 (match_operand 1 "register_operand" "f")
1367 (match_operand 2 "register_operand" "f")))
1368 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1369 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1370 && TARGET_SAHF && !TARGET_CMOVE
1371 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1373 "&& reload_completed"
1376 [(compare:CCFPU (match_dup 1)(match_dup 2))]
1378 (set (reg:CC FLAGS_REG)
1379 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1381 [(set_attr "type" "multi")
1382 (set_attr "unit" "i387")
1384 (cond [(match_operand:SF 1 "" "")
1386 (match_operand:DF 1 "" "")
1389 (const_string "XF")))])
1391 (define_insn "*cmpfp_<mode>"
1392 [(set (match_operand:HI 0 "register_operand" "=a")
1395 (match_operand 1 "register_operand" "f")
1396 (match_operator 3 "float_operator"
1397 [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1399 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1400 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1401 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1402 "* return output_fp_compare (insn, operands, 0, 0);"
1403 [(set_attr "type" "multi")
1404 (set_attr "unit" "i387")
1405 (set_attr "fp_int_src" "true")
1406 (set_attr "mode" "<MODE>")])
1408 (define_insn_and_split "*cmpfp_<mode>_cc"
1409 [(set (reg:CCFP FLAGS_REG)
1411 (match_operand 1 "register_operand" "f")
1412 (match_operator 3 "float_operator"
1413 [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1414 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1415 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1416 && TARGET_SAHF && !TARGET_CMOVE
1417 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1418 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1420 "&& reload_completed"
1425 (match_op_dup 3 [(match_dup 2)]))]
1427 (set (reg:CC FLAGS_REG)
1428 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1430 [(set_attr "type" "multi")
1431 (set_attr "unit" "i387")
1432 (set_attr "fp_int_src" "true")
1433 (set_attr "mode" "<MODE>")])
1435 ;; FP compares, step 2
1436 ;; Move the fpsw to ax.
1438 (define_insn "x86_fnstsw_1"
1439 [(set (match_operand:HI 0 "register_operand" "=a")
1440 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1443 [(set (attr "length") (symbol_ref "ix86_attr_length_address_default (insn) + 2"))
1444 (set_attr "mode" "SI")
1445 (set_attr "unit" "i387")])
1447 ;; FP compares, step 3
1448 ;; Get ax into flags, general case.
1450 (define_insn "x86_sahf_1"
1451 [(set (reg:CC FLAGS_REG)
1452 (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1456 #ifndef HAVE_AS_IX86_SAHF
1458 return ASM_BYTE "0x9e";
1463 [(set_attr "length" "1")
1464 (set_attr "athlon_decode" "vector")
1465 (set_attr "amdfam10_decode" "direct")
1466 (set_attr "bdver1_decode" "direct")
1467 (set_attr "mode" "SI")])
1469 ;; Pentium Pro can do steps 1 through 3 in one go.
1470 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1471 (define_insn "*cmpfp_i_mixed"
1472 [(set (reg:CCFP FLAGS_REG)
1473 (compare:CCFP (match_operand 0 "register_operand" "f,x")
1474 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1475 "TARGET_MIX_SSE_I387
1476 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1477 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1478 "* return output_fp_compare (insn, operands, 1, 0);"
1479 [(set_attr "type" "fcmp,ssecomi")
1480 (set_attr "prefix" "orig,maybe_vex")
1482 (if_then_else (match_operand:SF 1 "" "")
1484 (const_string "DF")))
1485 (set (attr "prefix_rep")
1486 (if_then_else (eq_attr "type" "ssecomi")
1488 (const_string "*")))
1489 (set (attr "prefix_data16")
1490 (cond [(eq_attr "type" "fcmp")
1492 (eq_attr "mode" "DF")
1495 (const_string "0")))
1496 (set_attr "athlon_decode" "vector")
1497 (set_attr "amdfam10_decode" "direct")
1498 (set_attr "bdver1_decode" "double")])
1500 (define_insn "*cmpfp_i_sse"
1501 [(set (reg:CCFP FLAGS_REG)
1502 (compare:CCFP (match_operand 0 "register_operand" "x")
1503 (match_operand 1 "nonimmediate_operand" "xm")))]
1505 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1506 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1507 "* return output_fp_compare (insn, operands, 1, 0);"
1508 [(set_attr "type" "ssecomi")
1509 (set_attr "prefix" "maybe_vex")
1511 (if_then_else (match_operand:SF 1 "" "")
1513 (const_string "DF")))
1514 (set_attr "prefix_rep" "0")
1515 (set (attr "prefix_data16")
1516 (if_then_else (eq_attr "mode" "DF")
1518 (const_string "0")))
1519 (set_attr "athlon_decode" "vector")
1520 (set_attr "amdfam10_decode" "direct")
1521 (set_attr "bdver1_decode" "double")])
1523 (define_insn "*cmpfp_i_i387"
1524 [(set (reg:CCFP FLAGS_REG)
1525 (compare:CCFP (match_operand 0 "register_operand" "f")
1526 (match_operand 1 "register_operand" "f")))]
1527 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1529 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1530 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1531 "* return output_fp_compare (insn, operands, 1, 0);"
1532 [(set_attr "type" "fcmp")
1534 (cond [(match_operand:SF 1 "" "")
1536 (match_operand:DF 1 "" "")
1539 (const_string "XF")))
1540 (set_attr "athlon_decode" "vector")
1541 (set_attr "amdfam10_decode" "direct")
1542 (set_attr "bdver1_decode" "double")])
1544 (define_insn "*cmpfp_iu_mixed"
1545 [(set (reg:CCFPU FLAGS_REG)
1546 (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1547 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1548 "TARGET_MIX_SSE_I387
1549 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1550 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1551 "* return output_fp_compare (insn, operands, 1, 1);"
1552 [(set_attr "type" "fcmp,ssecomi")
1553 (set_attr "prefix" "orig,maybe_vex")
1555 (if_then_else (match_operand:SF 1 "" "")
1557 (const_string "DF")))
1558 (set (attr "prefix_rep")
1559 (if_then_else (eq_attr "type" "ssecomi")
1561 (const_string "*")))
1562 (set (attr "prefix_data16")
1563 (cond [(eq_attr "type" "fcmp")
1565 (eq_attr "mode" "DF")
1568 (const_string "0")))
1569 (set_attr "athlon_decode" "vector")
1570 (set_attr "amdfam10_decode" "direct")
1571 (set_attr "bdver1_decode" "double")])
1573 (define_insn "*cmpfp_iu_sse"
1574 [(set (reg:CCFPU FLAGS_REG)
1575 (compare:CCFPU (match_operand 0 "register_operand" "x")
1576 (match_operand 1 "nonimmediate_operand" "xm")))]
1578 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1579 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1580 "* return output_fp_compare (insn, operands, 1, 1);"
1581 [(set_attr "type" "ssecomi")
1582 (set_attr "prefix" "maybe_vex")
1584 (if_then_else (match_operand:SF 1 "" "")
1586 (const_string "DF")))
1587 (set_attr "prefix_rep" "0")
1588 (set (attr "prefix_data16")
1589 (if_then_else (eq_attr "mode" "DF")
1591 (const_string "0")))
1592 (set_attr "athlon_decode" "vector")
1593 (set_attr "amdfam10_decode" "direct")
1594 (set_attr "bdver1_decode" "double")])
1596 (define_insn "*cmpfp_iu_387"
1597 [(set (reg:CCFPU FLAGS_REG)
1598 (compare:CCFPU (match_operand 0 "register_operand" "f")
1599 (match_operand 1 "register_operand" "f")))]
1600 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1602 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1603 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1604 "* return output_fp_compare (insn, operands, 1, 1);"
1605 [(set_attr "type" "fcmp")
1607 (cond [(match_operand:SF 1 "" "")
1609 (match_operand:DF 1 "" "")
1612 (const_string "XF")))
1613 (set_attr "athlon_decode" "vector")
1614 (set_attr "amdfam10_decode" "direct")
1615 (set_attr "bdver1_decode" "direct")])
1617 ;; Push/pop instructions.
1619 (define_insn "*push<mode>2"
1620 [(set (match_operand:DWI 0 "push_operand" "=<")
1621 (match_operand:DWI 1 "general_no_elim_operand" "riF*m"))]
1626 [(set (match_operand:TI 0 "push_operand" "")
1627 (match_operand:TI 1 "general_operand" ""))]
1628 "TARGET_64BIT && reload_completed
1629 && !SSE_REG_P (operands[1])"
1631 "ix86_split_long_move (operands); DONE;")
1633 (define_insn "*pushdi2_rex64"
1634 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1635 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1640 [(set_attr "type" "push,multi")
1641 (set_attr "mode" "DI")])
1643 ;; Convert impossible pushes of immediate to existing instructions.
1644 ;; First try to get scratch register and go through it. In case this
1645 ;; fails, push sign extended lower part first and then overwrite
1646 ;; upper part by 32bit move.
1648 [(match_scratch:DI 2 "r")
1649 (set (match_operand:DI 0 "push_operand" "")
1650 (match_operand:DI 1 "immediate_operand" ""))]
1651 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1652 && !x86_64_immediate_operand (operands[1], DImode)"
1653 [(set (match_dup 2) (match_dup 1))
1654 (set (match_dup 0) (match_dup 2))])
1656 ;; We need to define this as both peepholer and splitter for case
1657 ;; peephole2 pass is not run.
1658 ;; "&& 1" is needed to keep it from matching the previous pattern.
1660 [(set (match_operand:DI 0 "push_operand" "")
1661 (match_operand:DI 1 "immediate_operand" ""))]
1662 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1663 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1664 [(set (match_dup 0) (match_dup 1))
1665 (set (match_dup 2) (match_dup 3))]
1667 split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]);
1669 operands[1] = gen_lowpart (DImode, operands[2]);
1670 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1675 [(set (match_operand:DI 0 "push_operand" "")
1676 (match_operand:DI 1 "immediate_operand" ""))]
1677 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
1678 ? epilogue_completed : reload_completed)
1679 && !symbolic_operand (operands[1], DImode)
1680 && !x86_64_immediate_operand (operands[1], DImode)"
1681 [(set (match_dup 0) (match_dup 1))
1682 (set (match_dup 2) (match_dup 3))]
1684 split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]);
1686 operands[1] = gen_lowpart (DImode, operands[2]);
1687 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1692 [(set (match_operand:DI 0 "push_operand" "")
1693 (match_operand:DI 1 "general_operand" ""))]
1694 "!TARGET_64BIT && reload_completed
1695 && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
1697 "ix86_split_long_move (operands); DONE;")
1699 (define_insn "*pushsi2"
1700 [(set (match_operand:SI 0 "push_operand" "=<")
1701 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1704 [(set_attr "type" "push")
1705 (set_attr "mode" "SI")])
1707 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1708 ;; "push a byte/word". But actually we use pushl, which has the effect
1709 ;; of rounding the amount pushed up to a word.
1711 ;; For TARGET_64BIT we always round up to 8 bytes.
1712 (define_insn "*push<mode>2_rex64"
1713 [(set (match_operand:SWI124 0 "push_operand" "=X")
1714 (match_operand:SWI124 1 "nonmemory_no_elim_operand" "r<i>"))]
1717 [(set_attr "type" "push")
1718 (set_attr "mode" "DI")])
1720 (define_insn "*push<mode>2"
1721 [(set (match_operand:SWI12 0 "push_operand" "=X")
1722 (match_operand:SWI12 1 "nonmemory_no_elim_operand" "rn"))]
1725 [(set_attr "type" "push")
1726 (set_attr "mode" "SI")])
1728 (define_insn "*push<mode>2_prologue"
1729 [(set (match_operand:P 0 "push_operand" "=<")
1730 (match_operand:P 1 "general_no_elim_operand" "r<i>*m"))
1731 (clobber (mem:BLK (scratch)))]
1733 "push{<imodesuffix>}\t%1"
1734 [(set_attr "type" "push")
1735 (set_attr "mode" "<MODE>")])
1737 (define_insn "*pop<mode>1"
1738 [(set (match_operand:P 0 "nonimmediate_operand" "=r*m")
1739 (match_operand:P 1 "pop_operand" ">"))]
1741 "pop{<imodesuffix>}\t%0"
1742 [(set_attr "type" "pop")
1743 (set_attr "mode" "<MODE>")])
1745 (define_insn "*pop<mode>1_epilogue"
1746 [(set (match_operand:P 0 "nonimmediate_operand" "=r*m")
1747 (match_operand:P 1 "pop_operand" ">"))
1748 (clobber (mem:BLK (scratch)))]
1750 "pop{<imodesuffix>}\t%0"
1751 [(set_attr "type" "pop")
1752 (set_attr "mode" "<MODE>")])
1754 ;; Move instructions.
1756 (define_expand "movoi"
1757 [(set (match_operand:OI 0 "nonimmediate_operand" "")
1758 (match_operand:OI 1 "general_operand" ""))]
1760 "ix86_expand_move (OImode, operands); DONE;")
1762 (define_expand "movti"
1763 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1764 (match_operand:TI 1 "nonimmediate_operand" ""))]
1765 "TARGET_64BIT || TARGET_SSE"
1768 ix86_expand_move (TImode, operands);
1769 else if (push_operand (operands[0], TImode))
1770 ix86_expand_push (TImode, operands[1]);
1772 ix86_expand_vector_move (TImode, operands);
1776 ;; This expands to what emit_move_complex would generate if we didn't
1777 ;; have a movti pattern. Having this avoids problems with reload on
1778 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
1779 ;; to have around all the time.
1780 (define_expand "movcdi"
1781 [(set (match_operand:CDI 0 "nonimmediate_operand" "")
1782 (match_operand:CDI 1 "general_operand" ""))]
1785 if (push_operand (operands[0], CDImode))
1786 emit_move_complex_push (CDImode, operands[0], operands[1]);
1788 emit_move_complex_parts (operands[0], operands[1]);
1792 (define_expand "mov<mode>"
1793 [(set (match_operand:SWI1248x 0 "nonimmediate_operand" "")
1794 (match_operand:SWI1248x 1 "general_operand" ""))]
1796 "ix86_expand_move (<MODE>mode, operands); DONE;")
1798 (define_insn "*mov<mode>_xor"
1799 [(set (match_operand:SWI48 0 "register_operand" "=r")
1800 (match_operand:SWI48 1 "const0_operand" ""))
1801 (clobber (reg:CC FLAGS_REG))]
1804 [(set_attr "type" "alu1")
1805 (set_attr "mode" "SI")
1806 (set_attr "length_immediate" "0")])
1808 (define_insn "*mov<mode>_or"
1809 [(set (match_operand:SWI48 0 "register_operand" "=r")
1810 (match_operand:SWI48 1 "const_int_operand" ""))
1811 (clobber (reg:CC FLAGS_REG))]
1813 && operands[1] == constm1_rtx"
1814 "or{<imodesuffix>}\t{%1, %0|%0, %1}"
1815 [(set_attr "type" "alu1")
1816 (set_attr "mode" "<MODE>")
1817 (set_attr "length_immediate" "1")])
1819 (define_insn "*movoi_internal_avx"
1820 [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
1821 (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
1822 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1824 switch (which_alternative)
1827 return "vxorps\t%0, %0, %0";
1830 if (misaligned_operand (operands[0], OImode)
1831 || misaligned_operand (operands[1], OImode))
1832 return "vmovdqu\t{%1, %0|%0, %1}";
1834 return "vmovdqa\t{%1, %0|%0, %1}";
1839 [(set_attr "type" "sselog1,ssemov,ssemov")
1840 (set_attr "prefix" "vex")
1841 (set_attr "mode" "OI")])
1843 (define_insn "*movti_internal_rex64"
1844 [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
1845 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
1846 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1848 switch (which_alternative)
1854 if (get_attr_mode (insn) == MODE_V4SF)
1855 return "%vxorps\t%0, %d0";
1857 return "%vpxor\t%0, %d0";
1860 /* TDmode values are passed as TImode on the stack. Moving them
1861 to stack may result in unaligned memory access. */
1862 if (misaligned_operand (operands[0], TImode)
1863 || misaligned_operand (operands[1], TImode))
1865 if (get_attr_mode (insn) == MODE_V4SF)
1866 return "%vmovups\t{%1, %0|%0, %1}";
1868 return "%vmovdqu\t{%1, %0|%0, %1}";
1872 if (get_attr_mode (insn) == MODE_V4SF)
1873 return "%vmovaps\t{%1, %0|%0, %1}";
1875 return "%vmovdqa\t{%1, %0|%0, %1}";
1881 [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
1882 (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
1884 (cond [(eq_attr "alternative" "2,3")
1886 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1888 (const_string "V4SF")
1889 (const_string "TI"))
1890 (eq_attr "alternative" "4")
1892 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
1894 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1896 (const_string "V4SF")
1897 (const_string "TI"))]
1898 (const_string "DI")))])
1901 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1902 (match_operand:TI 1 "general_operand" ""))]
1904 && !SSE_REG_P (operands[0]) && !SSE_REG_P (operands[1])"
1906 "ix86_split_long_move (operands); DONE;")
1908 (define_insn "*movti_internal_sse"
1909 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
1910 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
1911 "TARGET_SSE && !TARGET_64BIT
1912 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1914 switch (which_alternative)
1917 if (get_attr_mode (insn) == MODE_V4SF)
1918 return "%vxorps\t%0, %d0";
1920 return "%vpxor\t%0, %d0";
1923 /* TDmode values are passed as TImode on the stack. Moving them
1924 to stack may result in unaligned memory access. */
1925 if (misaligned_operand (operands[0], TImode)
1926 || misaligned_operand (operands[1], TImode))
1928 if (get_attr_mode (insn) == MODE_V4SF)
1929 return "%vmovups\t{%1, %0|%0, %1}";
1931 return "%vmovdqu\t{%1, %0|%0, %1}";
1935 if (get_attr_mode (insn) == MODE_V4SF)
1936 return "%vmovaps\t{%1, %0|%0, %1}";
1938 return "%vmovdqa\t{%1, %0|%0, %1}";
1944 [(set_attr "type" "sselog1,ssemov,ssemov")
1945 (set_attr "prefix" "maybe_vex")
1947 (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1948 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1950 (const_string "V4SF")
1951 (and (eq_attr "alternative" "2")
1952 (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
1954 (const_string "V4SF")]
1955 (const_string "TI")))])
1957 (define_insn "*movdi_internal_rex64"
1958 [(set (match_operand:DI 0 "nonimmediate_operand"
1959 "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
1960 (match_operand:DI 1 "general_operand"
1961 "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
1962 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1964 switch (get_attr_type (insn))
1967 if (SSE_REG_P (operands[0]))
1968 return "movq2dq\t{%1, %0|%0, %1}";
1970 return "movdq2q\t{%1, %0|%0, %1}";
1975 if (get_attr_mode (insn) == MODE_TI)
1976 return "vmovdqa\t{%1, %0|%0, %1}";
1978 return "vmovq\t{%1, %0|%0, %1}";
1981 if (get_attr_mode (insn) == MODE_TI)
1982 return "movdqa\t{%1, %0|%0, %1}";
1986 /* Moves from and into integer register is done using movd
1987 opcode with REX prefix. */
1988 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
1989 return "movd\t{%1, %0|%0, %1}";
1990 return "movq\t{%1, %0|%0, %1}";
1993 return "%vpxor\t%0, %d0";
1996 return "pxor\t%0, %0";
2002 return "lea{q}\t{%a1, %0|%0, %a1}";
2005 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2006 if (get_attr_mode (insn) == MODE_SI)
2007 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2008 else if (which_alternative == 2)
2009 return "movabs{q}\t{%1, %0|%0, %1}";
2011 return "mov{q}\t{%1, %0|%0, %1}";
2015 (cond [(eq_attr "alternative" "5")
2016 (const_string "mmx")
2017 (eq_attr "alternative" "6,7,8,9,10")
2018 (const_string "mmxmov")
2019 (eq_attr "alternative" "11")
2020 (const_string "sselog1")
2021 (eq_attr "alternative" "12,13,14,15,16")
2022 (const_string "ssemov")
2023 (eq_attr "alternative" "17,18")
2024 (const_string "ssecvt")
2025 (eq_attr "alternative" "4")
2026 (const_string "multi")
2027 (match_operand:DI 1 "pic_32bit_operand" "")
2028 (const_string "lea")
2030 (const_string "imov")))
2033 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2035 (const_string "*")))
2036 (set (attr "length_immediate")
2038 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2040 (const_string "*")))
2041 (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
2042 (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
2043 (set (attr "prefix")
2044 (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
2045 (const_string "maybe_vex")
2046 (const_string "orig")))
2047 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2049 ;; Convert impossible stores of immediate to existing instructions.
2050 ;; First try to get scratch register and go through it. In case this
2051 ;; fails, move by 32bit parts.
2053 [(match_scratch:DI 2 "r")
2054 (set (match_operand:DI 0 "memory_operand" "")
2055 (match_operand:DI 1 "immediate_operand" ""))]
2056 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2057 && !x86_64_immediate_operand (operands[1], DImode)"
2058 [(set (match_dup 2) (match_dup 1))
2059 (set (match_dup 0) (match_dup 2))])
2061 ;; We need to define this as both peepholer and splitter for case
2062 ;; peephole2 pass is not run.
2063 ;; "&& 1" is needed to keep it from matching the previous pattern.
2065 [(set (match_operand:DI 0 "memory_operand" "")
2066 (match_operand:DI 1 "immediate_operand" ""))]
2067 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2068 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2069 [(set (match_dup 2) (match_dup 3))
2070 (set (match_dup 4) (match_dup 5))]
2071 "split_double_mode (DImode, &operands[0], 2, &operands[2], &operands[4]);")
2074 [(set (match_operand:DI 0 "memory_operand" "")
2075 (match_operand:DI 1 "immediate_operand" ""))]
2076 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2077 ? epilogue_completed : reload_completed)
2078 && !symbolic_operand (operands[1], DImode)
2079 && !x86_64_immediate_operand (operands[1], DImode)"
2080 [(set (match_dup 2) (match_dup 3))
2081 (set (match_dup 4) (match_dup 5))]
2082 "split_double_mode (DImode, &operands[0], 2, &operands[2], &operands[4]);")
2084 (define_insn "*movdi_internal"
2085 [(set (match_operand:DI 0 "nonimmediate_operand"
2086 "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
2087 (match_operand:DI 1 "general_operand"
2088 "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
2089 "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2094 movq\t{%1, %0|%0, %1}
2095 movq\t{%1, %0|%0, %1}
2097 %vmovq\t{%1, %0|%0, %1}
2098 %vmovdqa\t{%1, %0|%0, %1}
2099 %vmovq\t{%1, %0|%0, %1}
2101 movlps\t{%1, %0|%0, %1}
2102 movaps\t{%1, %0|%0, %1}
2103 movlps\t{%1, %0|%0, %1}"
2104 [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2105 (set (attr "prefix")
2106 (if_then_else (eq_attr "alternative" "5,6,7,8")
2107 (const_string "vex")
2108 (const_string "orig")))
2109 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2112 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2113 (match_operand:DI 1 "general_operand" ""))]
2114 "!TARGET_64BIT && reload_completed
2115 && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))
2116 && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
2118 "ix86_split_long_move (operands); DONE;")
2120 (define_insn "*movsi_internal"
2121 [(set (match_operand:SI 0 "nonimmediate_operand"
2122 "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
2123 (match_operand:SI 1 "general_operand"
2124 "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))]
2125 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2127 switch (get_attr_type (insn))
2130 if (get_attr_mode (insn) == MODE_TI)
2131 return "%vpxor\t%0, %d0";
2132 return "%vxorps\t%0, %d0";
2135 switch (get_attr_mode (insn))
2138 return "%vmovdqa\t{%1, %0|%0, %1}";
2140 return "%vmovaps\t{%1, %0|%0, %1}";
2142 return "%vmovd\t{%1, %0|%0, %1}";
2144 return "%vmovss\t{%1, %0|%0, %1}";
2150 return "pxor\t%0, %0";
2153 if (get_attr_mode (insn) == MODE_DI)
2154 return "movq\t{%1, %0|%0, %1}";
2155 return "movd\t{%1, %0|%0, %1}";
2158 return "lea{l}\t{%a1, %0|%0, %a1}";
2161 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2162 return "mov{l}\t{%1, %0|%0, %1}";
2166 (cond [(eq_attr "alternative" "2")
2167 (const_string "mmx")
2168 (eq_attr "alternative" "3,4,5")
2169 (const_string "mmxmov")
2170 (eq_attr "alternative" "6")
2171 (const_string "sselog1")
2172 (eq_attr "alternative" "7,8,9,10,11")
2173 (const_string "ssemov")
2174 (match_operand:DI 1 "pic_32bit_operand" "")
2175 (const_string "lea")
2177 (const_string "imov")))
2178 (set (attr "prefix")
2179 (if_then_else (eq_attr "alternative" "0,1,2,3,4,5")
2180 (const_string "orig")
2181 (const_string "maybe_vex")))
2182 (set (attr "prefix_data16")
2183 (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI"))
2185 (const_string "*")))
2187 (cond [(eq_attr "alternative" "2,3")
2189 (eq_attr "alternative" "6,7")
2191 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2192 (const_string "V4SF")
2193 (const_string "TI"))
2194 (and (eq_attr "alternative" "8,9,10,11")
2195 (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
2198 (const_string "SI")))])
2200 (define_insn "*movhi_internal"
2201 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
2202 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
2203 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2205 switch (get_attr_type (insn))
2208 /* movzwl is faster than movw on p2 due to partial word stalls,
2209 though not as fast as an aligned movl. */
2210 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
2212 if (get_attr_mode (insn) == MODE_SI)
2213 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2215 return "mov{w}\t{%1, %0|%0, %1}";
2219 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
2221 (const_string "imov")
2222 (and (eq_attr "alternative" "0")
2223 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2225 (eq (symbol_ref "TARGET_HIMODE_MATH")
2227 (const_string "imov")
2228 (and (eq_attr "alternative" "1,2")
2229 (match_operand:HI 1 "aligned_operand" ""))
2230 (const_string "imov")
2231 (and (ne (symbol_ref "TARGET_MOVX")
2233 (eq_attr "alternative" "0,2"))
2234 (const_string "imovx")
2236 (const_string "imov")))
2238 (cond [(eq_attr "type" "imovx")
2240 (and (eq_attr "alternative" "1,2")
2241 (match_operand:HI 1 "aligned_operand" ""))
2243 (and (eq_attr "alternative" "0")
2244 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2246 (eq (symbol_ref "TARGET_HIMODE_MATH")
2250 (const_string "HI")))])
2252 ;; Situation is quite tricky about when to choose full sized (SImode) move
2253 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
2254 ;; partial register dependency machines (such as AMD Athlon), where QImode
2255 ;; moves issue extra dependency and for partial register stalls machines
2256 ;; that don't use QImode patterns (and QImode move cause stall on the next
2259 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
2260 ;; register stall machines with, where we use QImode instructions, since
2261 ;; partial register stall can be caused there. Then we use movzx.
2262 (define_insn "*movqi_internal"
2263 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
2264 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
2265 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2267 switch (get_attr_type (insn))
2270 gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
2271 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
2273 if (get_attr_mode (insn) == MODE_SI)
2274 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2276 return "mov{b}\t{%1, %0|%0, %1}";
2280 (cond [(and (eq_attr "alternative" "5")
2281 (not (match_operand:QI 1 "aligned_operand" "")))
2282 (const_string "imovx")
2283 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2285 (const_string "imov")
2286 (and (eq_attr "alternative" "3")
2287 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2289 (eq (symbol_ref "TARGET_QIMODE_MATH")
2291 (const_string "imov")
2292 (eq_attr "alternative" "3,5")
2293 (const_string "imovx")
2294 (and (ne (symbol_ref "TARGET_MOVX")
2296 (eq_attr "alternative" "2"))
2297 (const_string "imovx")
2299 (const_string "imov")))
2301 (cond [(eq_attr "alternative" "3,4,5")
2303 (eq_attr "alternative" "6")
2305 (eq_attr "type" "imovx")
2307 (and (eq_attr "type" "imov")
2308 (and (eq_attr "alternative" "0,1")
2309 (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
2311 (and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2313 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2316 ;; Avoid partial register stalls when not using QImode arithmetic
2317 (and (eq_attr "type" "imov")
2318 (and (eq_attr "alternative" "0,1")
2319 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
2321 (eq (symbol_ref "TARGET_QIMODE_MATH")
2325 (const_string "QI")))])
2327 ;; Stores and loads of ax to arbitrary constant address.
2328 ;; We fake an second form of instruction to force reload to load address
2329 ;; into register when rax is not available
2330 (define_insn "*movabs<mode>_1"
2331 [(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2332 (match_operand:SWI1248x 1 "nonmemory_operand" "a,er"))]
2333 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2335 movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
2336 mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
2337 [(set_attr "type" "imov")
2338 (set_attr "modrm" "0,*")
2339 (set_attr "length_address" "8,0")
2340 (set_attr "length_immediate" "0,*")
2341 (set_attr "memory" "store")
2342 (set_attr "mode" "<MODE>")])
2344 (define_insn "*movabs<mode>_2"
2345 [(set (match_operand:SWI1248x 0 "register_operand" "=a,r")
2346 (mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2347 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2349 movabs{<imodesuffix>}\t{%P1, %0|%0, %P1}
2350 mov{<imodesuffix>}\t{%a1, %0|%0, %a1}"
2351 [(set_attr "type" "imov")
2352 (set_attr "modrm" "0,*")
2353 (set_attr "length_address" "8,0")
2354 (set_attr "length_immediate" "0")
2355 (set_attr "memory" "load")
2356 (set_attr "mode" "<MODE>")])
2358 (define_insn "*swap<mode>"
2359 [(set (match_operand:SWI48 0 "register_operand" "+r")
2360 (match_operand:SWI48 1 "register_operand" "+r"))
2364 "xchg{<imodesuffix>}\t%1, %0"
2365 [(set_attr "type" "imov")
2366 (set_attr "mode" "<MODE>")
2367 (set_attr "pent_pair" "np")
2368 (set_attr "athlon_decode" "vector")
2369 (set_attr "amdfam10_decode" "double")
2370 (set_attr "bdver1_decode" "double")])
2372 (define_insn "*swap<mode>_1"
2373 [(set (match_operand:SWI12 0 "register_operand" "+r")
2374 (match_operand:SWI12 1 "register_operand" "+r"))
2377 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2379 [(set_attr "type" "imov")
2380 (set_attr "mode" "SI")
2381 (set_attr "pent_pair" "np")
2382 (set_attr "athlon_decode" "vector")
2383 (set_attr "amdfam10_decode" "double")
2384 (set_attr "bdver1_decode" "double")])
2386 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL
2387 ;; is disabled for AMDFAM10
2388 (define_insn "*swap<mode>_2"
2389 [(set (match_operand:SWI12 0 "register_operand" "+<r>")
2390 (match_operand:SWI12 1 "register_operand" "+<r>"))
2393 "TARGET_PARTIAL_REG_STALL"
2394 "xchg{<imodesuffix>}\t%1, %0"
2395 [(set_attr "type" "imov")
2396 (set_attr "mode" "<MODE>")
2397 (set_attr "pent_pair" "np")
2398 (set_attr "athlon_decode" "vector")])
2400 (define_expand "movstrict<mode>"
2401 [(set (strict_low_part (match_operand:SWI12 0 "nonimmediate_operand" ""))
2402 (match_operand:SWI12 1 "general_operand" ""))]
2405 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2407 /* Don't generate memory->memory moves, go through a register */
2408 if (MEM_P (operands[0]) && MEM_P (operands[1]))
2409 operands[1] = force_reg (<MODE>mode, operands[1]);
2412 (define_insn "*movstrict<mode>_1"
2413 [(set (strict_low_part
2414 (match_operand:SWI12 0 "nonimmediate_operand" "+<r>m,<r>"))
2415 (match_operand:SWI12 1 "general_operand" "<r>n,m"))]
2416 "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2417 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2418 "mov{<imodesuffix>}\t{%1, %0|%0, %1}"
2419 [(set_attr "type" "imov")
2420 (set_attr "mode" "<MODE>")])
2422 (define_insn "*movstrict<mode>_xor"
2423 [(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>"))
2424 (match_operand:SWI12 1 "const0_operand" ""))
2425 (clobber (reg:CC FLAGS_REG))]
2427 "xor{<imodesuffix>}\t%0, %0"
2428 [(set_attr "type" "alu1")
2429 (set_attr "mode" "<MODE>")
2430 (set_attr "length_immediate" "0")])
2432 (define_insn "*mov<mode>_extv_1"
2433 [(set (match_operand:SWI24 0 "register_operand" "=R")
2434 (sign_extract:SWI24 (match_operand 1 "ext_register_operand" "Q")
2438 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
2439 [(set_attr "type" "imovx")
2440 (set_attr "mode" "SI")])
2442 (define_insn "*movqi_extv_1_rex64"
2443 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2444 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2449 switch (get_attr_type (insn))
2452 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2454 return "mov{b}\t{%h1, %0|%0, %h1}";
2458 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2459 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2460 (ne (symbol_ref "TARGET_MOVX")
2462 (const_string "imovx")
2463 (const_string "imov")))
2465 (if_then_else (eq_attr "type" "imovx")
2467 (const_string "QI")))])
2469 (define_insn "*movqi_extv_1"
2470 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
2471 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2476 switch (get_attr_type (insn))
2479 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2481 return "mov{b}\t{%h1, %0|%0, %h1}";
2485 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2486 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2487 (ne (symbol_ref "TARGET_MOVX")
2489 (const_string "imovx")
2490 (const_string "imov")))
2492 (if_then_else (eq_attr "type" "imovx")
2494 (const_string "QI")))])
2496 (define_insn "*mov<mode>_extzv_1"
2497 [(set (match_operand:SWI48 0 "register_operand" "=R")
2498 (zero_extract:SWI48 (match_operand 1 "ext_register_operand" "Q")
2502 "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
2503 [(set_attr "type" "imovx")
2504 (set_attr "mode" "SI")])
2506 (define_insn "*movqi_extzv_2_rex64"
2507 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2509 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2514 switch (get_attr_type (insn))
2517 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2519 return "mov{b}\t{%h1, %0|%0, %h1}";
2523 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2524 (ne (symbol_ref "TARGET_MOVX")
2526 (const_string "imovx")
2527 (const_string "imov")))
2529 (if_then_else (eq_attr "type" "imovx")
2531 (const_string "QI")))])
2533 (define_insn "*movqi_extzv_2"
2534 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
2536 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2541 switch (get_attr_type (insn))
2544 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2546 return "mov{b}\t{%h1, %0|%0, %h1}";
2550 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2551 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2552 (ne (symbol_ref "TARGET_MOVX")
2554 (const_string "imovx")
2555 (const_string "imov")))
2557 (if_then_else (eq_attr "type" "imovx")
2559 (const_string "QI")))])
2561 (define_expand "mov<mode>_insv_1"
2562 [(set (zero_extract:SWI48 (match_operand 0 "ext_register_operand" "")
2565 (match_operand:SWI48 1 "nonmemory_operand" ""))])
2567 (define_insn "*mov<mode>_insv_1_rex64"
2568 [(set (zero_extract:SWI48x (match_operand 0 "ext_register_operand" "+Q")
2571 (match_operand:SWI48x 1 "nonmemory_operand" "Qn"))]
2573 "mov{b}\t{%b1, %h0|%h0, %b1}"
2574 [(set_attr "type" "imov")
2575 (set_attr "mode" "QI")])
2577 (define_insn "*movsi_insv_1"
2578 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2581 (match_operand:SI 1 "general_operand" "Qmn"))]
2583 "mov{b}\t{%b1, %h0|%h0, %b1}"
2584 [(set_attr "type" "imov")
2585 (set_attr "mode" "QI")])
2587 (define_insn "*movqi_insv_2"
2588 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2591 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2594 "mov{b}\t{%h1, %h0|%h0, %h1}"
2595 [(set_attr "type" "imov")
2596 (set_attr "mode" "QI")])
2598 ;; Floating point push instructions.
2600 (define_insn "*pushtf"
2601 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
2602 (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
2605 /* This insn should be already split before reg-stack. */
2608 [(set_attr "type" "multi")
2609 (set_attr "unit" "sse,*,*")
2610 (set_attr "mode" "TF,SI,SI")])
2613 [(set (match_operand:TF 0 "push_operand" "")
2614 (match_operand:TF 1 "sse_reg_operand" ""))]
2615 "TARGET_SSE2 && reload_completed"
2616 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
2617 (set (mem:TF (reg:P SP_REG)) (match_dup 1))])
2620 [(set (match_operand:TF 0 "push_operand" "")
2621 (match_operand:TF 1 "general_operand" ""))]
2622 "TARGET_SSE2 && reload_completed
2623 && !SSE_REG_P (operands[1])"
2625 "ix86_split_long_move (operands); DONE;")
2627 (define_insn "*pushxf"
2628 [(set (match_operand:XF 0 "push_operand" "=<,<")
2629 (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
2630 "optimize_function_for_speed_p (cfun)"
2632 /* This insn should be already split before reg-stack. */
2635 [(set_attr "type" "multi")
2636 (set_attr "unit" "i387,*")
2637 (set_attr "mode" "XF,SI")])
2639 ;; Size of pushxf is 3 (for sub) + 2 (for fstp) + memory operand size.
2640 ;; Size of pushxf using integer instructions is 3+3*memory operand size
2641 ;; Pushing using integer instructions is longer except for constants
2642 ;; and direct memory references (assuming that any given constant is pushed
2643 ;; only once, but this ought to be handled elsewhere).
2645 (define_insn "*pushxf_nointeger"
2646 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2647 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2648 "optimize_function_for_size_p (cfun)"
2650 /* This insn should be already split before reg-stack. */
2653 [(set_attr "type" "multi")
2654 (set_attr "unit" "i387,*,*")
2655 (set_attr "mode" "XF,SI,SI")])
2658 [(set (match_operand:XF 0 "push_operand" "")
2659 (match_operand:XF 1 "fp_register_operand" ""))]
2661 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
2662 (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
2663 "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
2666 [(set (match_operand:XF 0 "push_operand" "")
2667 (match_operand:XF 1 "general_operand" ""))]
2669 && !FP_REG_P (operands[1])"
2671 "ix86_split_long_move (operands); DONE;")
2673 (define_insn "*pushdf"
2674 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2675 (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
2676 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2678 /* This insn should be already split before reg-stack. */
2681 [(set_attr "type" "multi")
2682 (set_attr "unit" "i387,*,*")
2683 (set_attr "mode" "DF,SI,DF")])
2685 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2686 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2687 ;; On the average, pushdf using integers can be still shorter. Allow this
2688 ;; pattern for optimize_size too.
2690 (define_insn "*pushdf_nointeger"
2691 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2692 (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
2693 "!(TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES)"
2695 /* This insn should be already split before reg-stack. */
2698 [(set_attr "type" "multi")
2699 (set_attr "unit" "i387,*,*,*")
2700 (set_attr "mode" "DF,SI,SI,DF")])
2702 ;; %%% Kill this when call knows how to work this out.
2704 [(set (match_operand:DF 0 "push_operand" "")
2705 (match_operand:DF 1 "any_fp_register_operand" ""))]
2707 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
2708 (set (mem:DF (reg:P SP_REG)) (match_dup 1))])
2711 [(set (match_operand:DF 0 "push_operand" "")
2712 (match_operand:DF 1 "general_operand" ""))]
2714 && !ANY_FP_REG_P (operands[1])"
2716 "ix86_split_long_move (operands); DONE;")
2718 (define_insn "*pushsf_rex64"
2719 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2720 (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
2723 /* Anything else should be already split before reg-stack. */
2724 gcc_assert (which_alternative == 1);
2725 return "push{q}\t%q1";
2727 [(set_attr "type" "multi,push,multi")
2728 (set_attr "unit" "i387,*,*")
2729 (set_attr "mode" "SF,DI,SF")])
2731 (define_insn "*pushsf"
2732 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2733 (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
2736 /* Anything else should be already split before reg-stack. */
2737 gcc_assert (which_alternative == 1);
2738 return "push{l}\t%1";
2740 [(set_attr "type" "multi,push,multi")
2741 (set_attr "unit" "i387,*,*")
2742 (set_attr "mode" "SF,SI,SF")])
2745 [(set (match_operand:SF 0 "push_operand" "")
2746 (match_operand:SF 1 "memory_operand" ""))]
2748 && MEM_P (operands[1])
2749 && (operands[2] = find_constant_src (insn))"
2753 ;; %%% Kill this when call knows how to work this out.
2755 [(set (match_operand:SF 0 "push_operand" "")
2756 (match_operand:SF 1 "any_fp_register_operand" ""))]
2758 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
2759 (set (mem:SF (reg:P SP_REG)) (match_dup 1))]
2760 "operands[2] = GEN_INT (-GET_MODE_SIZE (<MODE>mode));")
2762 ;; Floating point move instructions.
2764 (define_expand "movtf"
2765 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2766 (match_operand:TF 1 "nonimmediate_operand" ""))]
2769 ix86_expand_move (TFmode, operands);
2773 (define_expand "mov<mode>"
2774 [(set (match_operand:X87MODEF 0 "nonimmediate_operand" "")
2775 (match_operand:X87MODEF 1 "general_operand" ""))]
2777 "ix86_expand_move (<MODE>mode, operands); DONE;")
2779 (define_insn "*movtf_internal"
2780 [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
2781 (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
2783 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2785 switch (which_alternative)
2789 if (get_attr_mode (insn) == MODE_V4SF)
2790 return "%vmovaps\t{%1, %0|%0, %1}";
2792 return "%vmovdqa\t{%1, %0|%0, %1}";
2794 if (get_attr_mode (insn) == MODE_V4SF)
2795 return "%vxorps\t%0, %d0";
2797 return "%vpxor\t%0, %d0";
2805 [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
2806 (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
2808 (cond [(eq_attr "alternative" "0,2")
2810 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2812 (const_string "V4SF")
2813 (const_string "TI"))
2814 (eq_attr "alternative" "1")
2816 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2818 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2820 (const_string "V4SF")
2821 (const_string "TI"))]
2822 (const_string "DI")))])
2825 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2826 (match_operand:TF 1 "general_operand" ""))]
2828 && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
2830 "ix86_split_long_move (operands); DONE;")
2832 (define_insn "*movxf_internal"
2833 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
2834 (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
2835 "optimize_function_for_speed_p (cfun)
2836 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2837 && (reload_in_progress || reload_completed
2838 || GET_CODE (operands[1]) != CONST_DOUBLE
2839 || memory_operand (operands[0], XFmode))"
2841 switch (which_alternative)
2845 return output_387_reg_move (insn, operands);
2848 return standard_80387_constant_opcode (operands[1]);
2857 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2858 (set_attr "mode" "XF,XF,XF,SI,SI")])
2860 ;; Do not use integer registers when optimizing for size
2861 (define_insn "*movxf_internal_nointeger"
2862 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2863 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2864 "optimize_function_for_size_p (cfun)
2865 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2866 && (reload_in_progress || reload_completed
2867 || standard_80387_constant_p (operands[1])
2868 || GET_CODE (operands[1]) != CONST_DOUBLE
2869 || memory_operand (operands[0], XFmode))"
2871 switch (which_alternative)
2875 return output_387_reg_move (insn, operands);
2878 return standard_80387_constant_opcode (operands[1]);
2886 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2887 (set_attr "mode" "XF,XF,XF,SI,SI")])
2890 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2891 (match_operand:XF 1 "general_operand" ""))]
2893 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2894 && ! (FP_REG_P (operands[0]) ||
2895 (GET_CODE (operands[0]) == SUBREG
2896 && FP_REG_P (SUBREG_REG (operands[0]))))
2897 && ! (FP_REG_P (operands[1]) ||
2898 (GET_CODE (operands[1]) == SUBREG
2899 && FP_REG_P (SUBREG_REG (operands[1]))))"
2901 "ix86_split_long_move (operands); DONE;")
2903 (define_insn "*movdf_internal_rex64"
2904 [(set (match_operand:DF 0 "nonimmediate_operand"
2905 "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
2906 (match_operand:DF 1 "general_operand"
2907 "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
2908 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2909 && (reload_in_progress || reload_completed
2910 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2911 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
2912 && optimize_function_for_size_p (cfun)
2913 && standard_80387_constant_p (operands[1]))
2914 || GET_CODE (operands[1]) != CONST_DOUBLE
2915 || memory_operand (operands[0], DFmode))"
2917 switch (which_alternative)
2921 return output_387_reg_move (insn, operands);
2924 return standard_80387_constant_opcode (operands[1]);
2931 switch (get_attr_mode (insn))
2934 return "%vxorps\t%0, %d0";
2936 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2937 return "%vxorps\t%0, %d0";
2939 return "%vxorpd\t%0, %d0";
2941 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2942 return "%vxorps\t%0, %d0";
2944 return "%vpxor\t%0, %d0";
2951 switch (get_attr_mode (insn))
2954 return "%vmovaps\t{%1, %0|%0, %1}";
2956 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2957 return "%vmovaps\t{%1, %0|%0, %1}";
2959 return "%vmovapd\t{%1, %0|%0, %1}";
2961 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2962 return "%vmovaps\t{%1, %0|%0, %1}";
2964 return "%vmovdqa\t{%1, %0|%0, %1}";
2966 return "%vmovq\t{%1, %0|%0, %1}";
2970 if (REG_P (operands[0]) && REG_P (operands[1]))
2971 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
2973 return "vmovsd\t{%1, %0|%0, %1}";
2976 return "movsd\t{%1, %0|%0, %1}";
2978 return "%vmovlpd\t{%1, %d0|%d0, %1}";
2980 return "%vmovlps\t{%1, %d0|%d0, %1}";
2987 return "%vmovd\t{%1, %0|%0, %1}";
2993 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
2994 (set (attr "prefix")
2995 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
2996 (const_string "orig")
2997 (const_string "maybe_vex")))
2998 (set (attr "prefix_data16")
2999 (if_then_else (eq_attr "mode" "V1DF")
3001 (const_string "*")))
3003 (cond [(eq_attr "alternative" "0,1,2")
3005 (eq_attr "alternative" "3,4,9,10")
3008 /* For SSE1, we have many fewer alternatives. */
3009 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3010 (cond [(eq_attr "alternative" "5,6")
3011 (const_string "V4SF")
3013 (const_string "V2SF"))
3015 /* xorps is one byte shorter. */
3016 (eq_attr "alternative" "5")
3017 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3019 (const_string "V4SF")
3020 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3024 (const_string "V2DF"))
3026 /* For architectures resolving dependencies on
3027 whole SSE registers use APD move to break dependency
3028 chains, otherwise use short move to avoid extra work.
3030 movaps encodes one byte shorter. */
3031 (eq_attr "alternative" "6")
3033 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3035 (const_string "V4SF")
3036 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3038 (const_string "V2DF")
3040 (const_string "DF"))
3041 /* For architectures resolving dependencies on register
3042 parts we may avoid extra work to zero out upper part
3044 (eq_attr "alternative" "7")
3046 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3048 (const_string "V1DF")
3049 (const_string "DF"))
3051 (const_string "DF")))])
3053 (define_insn "*movdf_internal"
3054 [(set (match_operand:DF 0 "nonimmediate_operand"
3055 "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
3056 (match_operand:DF 1 "general_operand"
3057 "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
3058 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3059 && optimize_function_for_speed_p (cfun)
3060 && TARGET_INTEGER_DFMODE_MOVES
3061 && (reload_in_progress || reload_completed
3062 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3063 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3064 && optimize_function_for_size_p (cfun)
3065 && standard_80387_constant_p (operands[1]))
3066 || GET_CODE (operands[1]) != CONST_DOUBLE
3067 || memory_operand (operands[0], DFmode))"
3069 switch (which_alternative)
3073 return output_387_reg_move (insn, operands);
3076 return standard_80387_constant_opcode (operands[1]);
3083 switch (get_attr_mode (insn))
3086 return "xorps\t%0, %0";
3088 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3089 return "xorps\t%0, %0";
3091 return "xorpd\t%0, %0";
3093 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3094 return "xorps\t%0, %0";
3096 return "pxor\t%0, %0";
3103 switch (get_attr_mode (insn))
3106 return "movaps\t{%1, %0|%0, %1}";
3108 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3109 return "movaps\t{%1, %0|%0, %1}";
3111 return "movapd\t{%1, %0|%0, %1}";
3113 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3114 return "movaps\t{%1, %0|%0, %1}";
3116 return "movdqa\t{%1, %0|%0, %1}";
3118 return "movq\t{%1, %0|%0, %1}";
3120 return "movsd\t{%1, %0|%0, %1}";
3122 return "movlpd\t{%1, %0|%0, %1}";
3124 return "movlps\t{%1, %0|%0, %1}";
3133 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3134 (set (attr "prefix_data16")
3135 (if_then_else (eq_attr "mode" "V1DF")
3137 (const_string "*")))
3139 (cond [(eq_attr "alternative" "0,1,2")
3141 (eq_attr "alternative" "3,4")
3144 /* For SSE1, we have many fewer alternatives. */
3145 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3146 (cond [(eq_attr "alternative" "5,6")
3147 (const_string "V4SF")
3149 (const_string "V2SF"))
3151 /* xorps is one byte shorter. */
3152 (eq_attr "alternative" "5")
3153 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3155 (const_string "V4SF")
3156 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3160 (const_string "V2DF"))
3162 /* For architectures resolving dependencies on
3163 whole SSE registers use APD move to break dependency
3164 chains, otherwise use short move to avoid extra work.
3166 movaps encodes one byte shorter. */
3167 (eq_attr "alternative" "6")
3169 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3171 (const_string "V4SF")
3172 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3174 (const_string "V2DF")
3176 (const_string "DF"))
3177 /* For architectures resolving dependencies on register
3178 parts we may avoid extra work to zero out upper part
3180 (eq_attr "alternative" "7")
3182 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3184 (const_string "V1DF")
3185 (const_string "DF"))
3187 (const_string "DF")))])
3189 ;; Moving is usually shorter when only FP registers are used. This separate
3190 ;; movdf pattern avoids the use of integer registers for FP operations
3191 ;; when optimizing for size.
3193 (define_insn "*movdf_internal_nointeger"
3194 [(set (match_operand:DF 0 "nonimmediate_operand"
3195 "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
3196 (match_operand:DF 1 "general_operand"
3197 "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
3198 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3199 && ((optimize_function_for_size_p (cfun)
3200 || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
3201 && (reload_in_progress || reload_completed
3202 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3203 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3204 && optimize_function_for_size_p (cfun)
3205 && !memory_operand (operands[0], DFmode)
3206 && standard_80387_constant_p (operands[1]))
3207 || GET_CODE (operands[1]) != CONST_DOUBLE
3208 || ((optimize_function_for_size_p (cfun)
3209 || !TARGET_MEMORY_MISMATCH_STALL
3210 || reload_in_progress || reload_completed)
3211 && memory_operand (operands[0], DFmode)))"
3213 switch (which_alternative)
3217 return output_387_reg_move (insn, operands);
3220 return standard_80387_constant_opcode (operands[1]);
3227 switch (get_attr_mode (insn))
3230 return "%vxorps\t%0, %d0";
3232 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3233 return "%vxorps\t%0, %d0";
3235 return "%vxorpd\t%0, %d0";
3237 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3238 return "%vxorps\t%0, %d0";
3240 return "%vpxor\t%0, %d0";
3247 switch (get_attr_mode (insn))
3250 return "%vmovaps\t{%1, %0|%0, %1}";
3252 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3253 return "%vmovaps\t{%1, %0|%0, %1}";
3255 return "%vmovapd\t{%1, %0|%0, %1}";
3257 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3258 return "%vmovaps\t{%1, %0|%0, %1}";
3260 return "%vmovdqa\t{%1, %0|%0, %1}";
3262 return "%vmovq\t{%1, %0|%0, %1}";
3266 if (REG_P (operands[0]) && REG_P (operands[1]))
3267 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3269 return "vmovsd\t{%1, %0|%0, %1}";
3272 return "movsd\t{%1, %0|%0, %1}";
3276 if (REG_P (operands[0]))
3277 return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
3279 return "vmovlpd\t{%1, %0|%0, %1}";
3282 return "movlpd\t{%1, %0|%0, %1}";
3286 if (REG_P (operands[0]))
3287 return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
3289 return "vmovlps\t{%1, %0|%0, %1}";
3292 return "movlps\t{%1, %0|%0, %1}";
3301 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3302 (set (attr "prefix")
3303 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3304 (const_string "orig")
3305 (const_string "maybe_vex")))
3306 (set (attr "prefix_data16")
3307 (if_then_else (eq_attr "mode" "V1DF")
3309 (const_string "*")))
3311 (cond [(eq_attr "alternative" "0,1,2")
3313 (eq_attr "alternative" "3,4")
3316 /* For SSE1, we have many fewer alternatives. */
3317 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3318 (cond [(eq_attr "alternative" "5,6")
3319 (const_string "V4SF")
3321 (const_string "V2SF"))
3323 /* xorps is one byte shorter. */
3324 (eq_attr "alternative" "5")
3325 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3327 (const_string "V4SF")
3328 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3332 (const_string "V2DF"))
3334 /* For architectures resolving dependencies on
3335 whole SSE registers use APD move to break dependency
3336 chains, otherwise use short move to avoid extra work.
3338 movaps encodes one byte shorter. */
3339 (eq_attr "alternative" "6")
3341 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3343 (const_string "V4SF")
3344 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3346 (const_string "V2DF")
3348 (const_string "DF"))
3349 /* For architectures resolving dependencies on register
3350 parts we may avoid extra work to zero out upper part
3352 (eq_attr "alternative" "7")
3354 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3356 (const_string "V1DF")
3357 (const_string "DF"))
3359 (const_string "DF")))])
3362 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3363 (match_operand:DF 1 "general_operand" ""))]
3365 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3366 && ! (ANY_FP_REG_P (operands[0]) ||
3367 (GET_CODE (operands[0]) == SUBREG
3368 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3369 && ! (ANY_FP_REG_P (operands[1]) ||
3370 (GET_CODE (operands[1]) == SUBREG
3371 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3373 "ix86_split_long_move (operands); DONE;")
3375 (define_insn "*movsf_internal"
3376 [(set (match_operand:SF 0 "nonimmediate_operand"
3377 "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
3378 (match_operand:SF 1 "general_operand"
3379 "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
3380 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3381 && (reload_in_progress || reload_completed
3382 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3383 || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
3384 && standard_80387_constant_p (operands[1]))
3385 || GET_CODE (operands[1]) != CONST_DOUBLE
3386 || memory_operand (operands[0], SFmode))"
3388 switch (which_alternative)
3392 return output_387_reg_move (insn, operands);
3395 return standard_80387_constant_opcode (operands[1]);
3399 return "mov{l}\t{%1, %0|%0, %1}";
3401 if (get_attr_mode (insn) == MODE_TI)
3402 return "%vpxor\t%0, %d0";
3404 return "%vxorps\t%0, %d0";
3406 if (get_attr_mode (insn) == MODE_V4SF)
3407 return "%vmovaps\t{%1, %0|%0, %1}";
3409 return "%vmovss\t{%1, %d0|%d0, %1}";
3412 return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
3413 : "vmovss\t{%1, %0|%0, %1}";
3415 return "movss\t{%1, %0|%0, %1}";
3417 return "%vmovss\t{%1, %0|%0, %1}";
3419 case 9: case 10: case 14: case 15:
3420 return "movd\t{%1, %0|%0, %1}";
3422 return "%vmovd\t{%1, %0|%0, %1}";
3425 return "movq\t{%1, %0|%0, %1}";
3431 [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
3432 (set (attr "prefix")
3433 (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
3434 (const_string "maybe_vex")
3435 (const_string "orig")))
3437 (cond [(eq_attr "alternative" "3,4,9,10")
3439 (eq_attr "alternative" "5")
3441 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3443 (ne (symbol_ref "TARGET_SSE2")
3445 (eq (symbol_ref "optimize_function_for_size_p (cfun)")
3448 (const_string "V4SF"))
3449 /* For architectures resolving dependencies on
3450 whole SSE registers use APS move to break dependency
3451 chains, otherwise use short move to avoid extra work.
3453 Do the same for architectures resolving dependencies on
3454 the parts. While in DF mode it is better to always handle
3455 just register parts, the SF mode is different due to lack
3456 of instructions to load just part of the register. It is
3457 better to maintain the whole registers in single format
3458 to avoid problems on using packed logical operations. */
3459 (eq_attr "alternative" "6")
3461 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3463 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3465 (const_string "V4SF")
3466 (const_string "SF"))
3467 (eq_attr "alternative" "11")
3468 (const_string "DI")]
3469 (const_string "SF")))])
3472 [(set (match_operand 0 "register_operand" "")
3473 (match_operand 1 "memory_operand" ""))]
3475 && MEM_P (operands[1])
3476 && (GET_MODE (operands[0]) == TFmode
3477 || GET_MODE (operands[0]) == XFmode
3478 || GET_MODE (operands[0]) == DFmode
3479 || GET_MODE (operands[0]) == SFmode)
3480 && (operands[2] = find_constant_src (insn))"
3481 [(set (match_dup 0) (match_dup 2))]
3483 rtx c = operands[2];
3484 rtx r = operands[0];
3486 if (GET_CODE (r) == SUBREG)
3491 if (!standard_sse_constant_p (c))
3494 else if (FP_REG_P (r))
3496 if (!standard_80387_constant_p (c))
3499 else if (MMX_REG_P (r))
3504 [(set (match_operand 0 "register_operand" "")
3505 (float_extend (match_operand 1 "memory_operand" "")))]
3507 && MEM_P (operands[1])
3508 && (GET_MODE (operands[0]) == TFmode
3509 || GET_MODE (operands[0]) == XFmode
3510 || GET_MODE (operands[0]) == DFmode
3511 || GET_MODE (operands[0]) == SFmode)
3512 && (operands[2] = find_constant_src (insn))"
3513 [(set (match_dup 0) (match_dup 2))]
3515 rtx c = operands[2];
3516 rtx r = operands[0];
3518 if (GET_CODE (r) == SUBREG)
3523 if (!standard_sse_constant_p (c))
3526 else if (FP_REG_P (r))
3528 if (!standard_80387_constant_p (c))
3531 else if (MMX_REG_P (r))
3535 ;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
3537 [(set (match_operand:X87MODEF 0 "register_operand" "")
3538 (match_operand:X87MODEF 1 "immediate_operand" ""))]
3539 "reload_completed && FP_REGNO_P (REGNO (operands[0]))
3540 && (standard_80387_constant_p (operands[1]) == 8
3541 || standard_80387_constant_p (operands[1]) == 9)"
3542 [(set (match_dup 0)(match_dup 1))
3544 (neg:X87MODEF (match_dup 0)))]
3548 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
3549 if (real_isnegzero (&r))
3550 operands[1] = CONST0_RTX (<MODE>mode);
3552 operands[1] = CONST1_RTX (<MODE>mode);
3555 (define_insn "swapxf"
3556 [(set (match_operand:XF 0 "register_operand" "+f")
3557 (match_operand:XF 1 "register_operand" "+f"))
3562 if (STACK_TOP_P (operands[0]))
3567 [(set_attr "type" "fxch")
3568 (set_attr "mode" "XF")])
3570 (define_insn "*swap<mode>"
3571 [(set (match_operand:MODEF 0 "fp_register_operand" "+f")
3572 (match_operand:MODEF 1 "fp_register_operand" "+f"))
3575 "TARGET_80387 || reload_completed"
3577 if (STACK_TOP_P (operands[0]))
3582 [(set_attr "type" "fxch")
3583 (set_attr "mode" "<MODE>")])
3585 ;; Zero extension instructions
3587 (define_expand "zero_extendsidi2"
3588 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3589 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
3594 emit_insn (gen_zero_extendsidi2_1 (operands[0], operands[1]));
3599 (define_insn "*zero_extendsidi2_rex64"
3600 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,?*Ym,?*y,?*Yi,*Y2")
3602 (match_operand:SI 1 "nonimmediate_operand" "rm,0,r ,m ,r ,m")))]
3605 mov\t{%k1, %k0|%k0, %k1}
3607 movd\t{%1, %0|%0, %1}
3608 movd\t{%1, %0|%0, %1}
3609 %vmovd\t{%1, %0|%0, %1}
3610 %vmovd\t{%1, %0|%0, %1}"
3611 [(set_attr "type" "imovx,imov,mmxmov,mmxmov,ssemov,ssemov")
3612 (set_attr "prefix" "orig,*,orig,orig,maybe_vex,maybe_vex")
3613 (set_attr "prefix_0f" "0,*,*,*,*,*")
3614 (set_attr "mode" "SI,DI,DI,DI,TI,TI")])
3617 [(set (match_operand:DI 0 "memory_operand" "")
3618 (zero_extend:DI (match_dup 0)))]
3620 [(set (match_dup 4) (const_int 0))]
3621 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3623 ;; %%% Kill me once multi-word ops are sane.
3624 (define_insn "zero_extendsidi2_1"
3625 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?*y,?*Yi,*Y2")
3627 (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r ,m ,r ,m")))
3628 (clobber (reg:CC FLAGS_REG))]
3634 movd\t{%1, %0|%0, %1}
3635 movd\t{%1, %0|%0, %1}
3636 %vmovd\t{%1, %0|%0, %1}
3637 %vmovd\t{%1, %0|%0, %1}"
3638 [(set_attr "type" "multi,multi,multi,mmxmov,mmxmov,ssemov,ssemov")
3639 (set_attr "prefix" "*,*,*,orig,orig,maybe_vex,maybe_vex")
3640 (set_attr "mode" "SI,SI,SI,DI,DI,TI,TI")])
3643 [(set (match_operand:DI 0 "register_operand" "")
3644 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3645 (clobber (reg:CC FLAGS_REG))]
3646 "!TARGET_64BIT && reload_completed
3647 && true_regnum (operands[0]) == true_regnum (operands[1])"
3648 [(set (match_dup 4) (const_int 0))]
3649 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3652 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3653 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3654 (clobber (reg:CC FLAGS_REG))]
3655 "!TARGET_64BIT && reload_completed
3656 && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))"
3657 [(set (match_dup 3) (match_dup 1))
3658 (set (match_dup 4) (const_int 0))]
3659 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3661 (define_insn "zero_extend<mode>di2"
3662 [(set (match_operand:DI 0 "register_operand" "=r")
3664 (match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))]
3666 "movz{<imodesuffix>l|x}\t{%1, %k0|%k0, %1}"
3667 [(set_attr "type" "imovx")
3668 (set_attr "mode" "SI")])
3670 (define_expand "zero_extendhisi2"
3671 [(set (match_operand:SI 0 "register_operand" "")
3672 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3675 if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3677 operands[1] = force_reg (HImode, operands[1]);
3678 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
3683 (define_insn_and_split "zero_extendhisi2_and"
3684 [(set (match_operand:SI 0 "register_operand" "=r")
3685 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
3686 (clobber (reg:CC FLAGS_REG))]
3687 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3689 "&& reload_completed"
3690 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
3691 (clobber (reg:CC FLAGS_REG))])]
3693 [(set_attr "type" "alu1")
3694 (set_attr "mode" "SI")])
3696 (define_insn "*zero_extendhisi2_movzwl"
3697 [(set (match_operand:SI 0 "register_operand" "=r")
3698 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3699 "!TARGET_ZERO_EXTEND_WITH_AND
3700 || optimize_function_for_size_p (cfun)"
3701 "movz{wl|x}\t{%1, %0|%0, %1}"
3702 [(set_attr "type" "imovx")
3703 (set_attr "mode" "SI")])
3705 (define_expand "zero_extendqi<mode>2"
3707 [(set (match_operand:SWI24 0 "register_operand" "")
3708 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3709 (clobber (reg:CC FLAGS_REG))])])
3711 (define_insn "*zero_extendqi<mode>2_and"
3712 [(set (match_operand:SWI24 0 "register_operand" "=r,?&q")
3713 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3714 (clobber (reg:CC FLAGS_REG))]
3715 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3717 [(set_attr "type" "alu1")
3718 (set_attr "mode" "<MODE>")])
3720 ;; When source and destination does not overlap, clear destination
3721 ;; first and then do the movb
3723 [(set (match_operand:SWI24 0 "register_operand" "")
3724 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3725 (clobber (reg:CC FLAGS_REG))]
3727 && (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3728 && ANY_QI_REG_P (operands[0])
3729 && (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]))
3730 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3731 [(set (strict_low_part (match_dup 2)) (match_dup 1))]
3733 operands[2] = gen_lowpart (QImode, operands[0]);
3734 ix86_expand_clear (operands[0]);
3737 (define_insn "*zero_extendqi<mode>2_movzbl_and"
3738 [(set (match_operand:SWI24 0 "register_operand" "=r,r")
3739 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3740 (clobber (reg:CC FLAGS_REG))]
3741 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun)"
3743 [(set_attr "type" "imovx,alu1")
3744 (set_attr "mode" "<MODE>")])
3746 ;; For the movzbl case strip only the clobber
3748 [(set (match_operand:SWI24 0 "register_operand" "")
3749 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3750 (clobber (reg:CC FLAGS_REG))]
3752 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))
3753 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3755 (zero_extend:SWI24 (match_dup 1)))])
3757 ; zero extend to SImode to avoid partial register stalls
3758 (define_insn "*zero_extendqi<mode>2_movzbl"
3759 [(set (match_operand:SWI24 0 "register_operand" "=r")
3760 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3762 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))"
3763 "movz{bl|x}\t{%1, %k0|%k0, %1}"
3764 [(set_attr "type" "imovx")
3765 (set_attr "mode" "SI")])
3767 ;; Rest is handled by single and.
3769 [(set (match_operand:SWI24 0 "register_operand" "")
3770 (zero_extend:SWI24 (match_operand:QI 1 "register_operand" "")))
3771 (clobber (reg:CC FLAGS_REG))]
3773 && true_regnum (operands[0]) == true_regnum (operands[1])"
3774 [(parallel [(set (match_dup 0) (and:SWI24 (match_dup 0) (const_int 255)))
3775 (clobber (reg:CC FLAGS_REG))])])
3777 ;; Sign extension instructions
3779 (define_expand "extendsidi2"
3780 [(set (match_operand:DI 0 "register_operand" "")
3781 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))]
3786 emit_insn (gen_extendsidi2_1 (operands[0], operands[1]));
3791 (define_insn "*extendsidi2_rex64"
3792 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3793 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3797 movs{lq|x}\t{%1, %0|%0, %1}"
3798 [(set_attr "type" "imovx")
3799 (set_attr "mode" "DI")
3800 (set_attr "prefix_0f" "0")
3801 (set_attr "modrm" "0,1")])
3803 (define_insn "extendsidi2_1"
3804 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3805 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3806 (clobber (reg:CC FLAGS_REG))
3807 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3811 ;; Extend to memory case when source register does die.
3813 [(set (match_operand:DI 0 "memory_operand" "")
3814 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3815 (clobber (reg:CC FLAGS_REG))
3816 (clobber (match_operand:SI 2 "register_operand" ""))]
3818 && dead_or_set_p (insn, operands[1])
3819 && !reg_mentioned_p (operands[1], operands[0]))"
3820 [(set (match_dup 3) (match_dup 1))
3821 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3822 (clobber (reg:CC FLAGS_REG))])
3823 (set (match_dup 4) (match_dup 1))]
3824 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3826 ;; Extend to memory case when source register does not die.
3828 [(set (match_operand:DI 0 "memory_operand" "")
3829 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3830 (clobber (reg:CC FLAGS_REG))
3831 (clobber (match_operand:SI 2 "register_operand" ""))]
3835 split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);
3837 emit_move_insn (operands[3], operands[1]);
3839 /* Generate a cltd if possible and doing so it profitable. */
3840 if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)
3841 && true_regnum (operands[1]) == AX_REG
3842 && true_regnum (operands[2]) == DX_REG)
3844 emit_insn (gen_ashrsi3_cvt (operands[2], operands[1], GEN_INT (31)));
3848 emit_move_insn (operands[2], operands[1]);
3849 emit_insn (gen_ashrsi3_cvt (operands[2], operands[2], GEN_INT (31)));
3851 emit_move_insn (operands[4], operands[2]);
3855 ;; Extend to register case. Optimize case where source and destination
3856 ;; registers match and cases where we can use cltd.
3858 [(set (match_operand:DI 0 "register_operand" "")
3859 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3860 (clobber (reg:CC FLAGS_REG))
3861 (clobber (match_scratch:SI 2 ""))]
3865 split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);
3867 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3868 emit_move_insn (operands[3], operands[1]);
3870 /* Generate a cltd if possible and doing so it profitable. */
3871 if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)
3872 && true_regnum (operands[3]) == AX_REG
3873 && true_regnum (operands[4]) == DX_REG)
3875 emit_insn (gen_ashrsi3_cvt (operands[4], operands[3], GEN_INT (31)));
3879 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3880 emit_move_insn (operands[4], operands[1]);
3882 emit_insn (gen_ashrsi3_cvt (operands[4], operands[4], GEN_INT (31)));
3886 (define_insn "extend<mode>di2"
3887 [(set (match_operand:DI 0 "register_operand" "=r")
3889 (match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))]
3891 "movs{<imodesuffix>q|x}\t{%1, %0|%0, %1}"
3892 [(set_attr "type" "imovx")
3893 (set_attr "mode" "DI")])
3895 (define_insn "extendhisi2"
3896 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3897 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3900 switch (get_attr_prefix_0f (insn))
3903 return "{cwtl|cwde}";
3905 return "movs{wl|x}\t{%1, %0|%0, %1}";
3908 [(set_attr "type" "imovx")