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
87 UNSPEC_MEMORY_BLOCKAGE
96 ;; Other random patterns
105 UNSPEC_LD_MPIC ; load_macho_picbase
107 UNSPEC_DIV_ALREADY_SPLIT
109 ;; For SSE/MMX support:
127 UNSPEC_MS_TO_SYSV_CALL
129 ;; Generic math support
131 UNSPEC_IEEE_MIN ; not commutative
132 UNSPEC_IEEE_MAX ; not commutative
134 ;; x87 Floating point
150 UNSPEC_FRNDINT_MASK_PM
154 ;; x87 Double output FP
186 ;; For SSE4.1 support
196 ;; For SSE4.2 support
202 UNSPEC_FMA4_INTRINSIC
205 UNSPEC_XOP_UNSIGNED_CMP
216 UNSPEC_AESKEYGENASSIST
218 ;; For PCLMUL support
234 (define_c_enum "unspecv" [
237 UNSPECV_PROBE_STACK_RANGE
257 UNSPECV_LLWP_INTRINSIC
258 UNSPECV_SLWP_INTRINSIC
259 UNSPECV_LWPVAL_INTRINSIC
260 UNSPECV_LWPINS_INTRINSIC
268 ;; Constants to represent pcomtrue/pcomfalse variants
278 ;; Constants used in the XOP pperm instruction
280 [(PPERM_SRC 0x00) /* copy source */
281 (PPERM_INVERT 0x20) /* invert source */
282 (PPERM_REVERSE 0x40) /* bit reverse source */
283 (PPERM_REV_INV 0x60) /* bit reverse & invert src */
284 (PPERM_ZERO 0x80) /* all 0's */
285 (PPERM_ONES 0xa0) /* all 1's */
286 (PPERM_SIGN 0xc0) /* propagate sign bit */
287 (PPERM_INV_SIGN 0xe0) /* invert & propagate sign */
288 (PPERM_SRC1 0x00) /* use first source byte */
289 (PPERM_SRC2 0x10) /* use second source byte */
292 ;; Registers by name.
345 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
348 ;; In C guard expressions, put expressions which may be compile-time
349 ;; constants first. This allows for better optimization. For
350 ;; example, write "TARGET_64BIT && reload_completed", not
351 ;; "reload_completed && TARGET_64BIT".
355 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,atom,
356 generic64,amdfam10,bdver1"
357 (const (symbol_ref "ix86_schedule")))
359 ;; A basic instruction type. Refinements due to arguments to be
360 ;; provided in other attributes.
363 alu,alu1,negnot,imov,imovx,lea,
364 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
365 icmp,test,ibr,setcc,icmov,
366 push,pop,call,callv,leave,
368 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
369 sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
370 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
371 ssemuladd,sse4arg,lwp,
372 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
373 (const_string "other"))
375 ;; Main data type used by the insn
377 "unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF"
378 (const_string "unknown"))
380 ;; The CPU unit operations uses.
381 (define_attr "unit" "integer,i387,sse,mmx,unknown"
382 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
383 (const_string "i387")
384 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
385 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
386 ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
388 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
390 (eq_attr "type" "other")
391 (const_string "unknown")]
392 (const_string "integer")))
394 ;; The (bounding maximum) length of an instruction immediate.
395 (define_attr "length_immediate" ""
396 (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
399 (eq_attr "unit" "i387,sse,mmx")
401 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
403 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
404 (eq_attr "type" "imov,test")
405 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
406 (eq_attr "type" "call")
407 (if_then_else (match_operand 0 "constant_call_address_operand" "")
410 (eq_attr "type" "callv")
411 (if_then_else (match_operand 1 "constant_call_address_operand" "")
414 ;; We don't know the size before shorten_branches. Expect
415 ;; the instruction to fit for better scheduling.
416 (eq_attr "type" "ibr")
419 (symbol_ref "/* Update immediate_length and other attributes! */
420 gcc_unreachable (),1")))
422 ;; The (bounding maximum) length of an instruction address.
423 (define_attr "length_address" ""
424 (cond [(eq_attr "type" "str,other,multi,fxch")
426 (and (eq_attr "type" "call")
427 (match_operand 0 "constant_call_address_operand" ""))
429 (and (eq_attr "type" "callv")
430 (match_operand 1 "constant_call_address_operand" ""))
433 (symbol_ref "ix86_attr_length_address_default (insn)")))
435 ;; Set when length prefix is used.
436 (define_attr "prefix_data16" ""
437 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
439 (eq_attr "mode" "HI")
441 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI"))
446 ;; Set when string REP prefix is used.
447 (define_attr "prefix_rep" ""
448 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
450 (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
455 ;; Set when 0f opcode prefix is used.
456 (define_attr "prefix_0f" ""
458 (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
459 (eq_attr "unit" "sse,mmx"))
463 ;; Set when REX opcode prefix is used.
464 (define_attr "prefix_rex" ""
465 (cond [(eq (symbol_ref "TARGET_64BIT") (const_int 0))
467 (and (eq_attr "mode" "DI")
468 (and (eq_attr "type" "!push,pop,call,callv,leave,ibr")
469 (eq_attr "unit" "!mmx")))
471 (and (eq_attr "mode" "QI")
472 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
475 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
478 (and (eq_attr "type" "imovx")
479 (match_operand:QI 1 "ext_QIreg_operand" ""))
484 ;; There are also additional prefixes in 3DNOW, SSSE3.
485 ;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
486 ;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
487 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
488 (define_attr "prefix_extra" ""
489 (cond [(eq_attr "type" "ssemuladd,sse4arg")
491 (eq_attr "type" "sseiadd1,ssecvt1")
496 ;; Prefix used: original, VEX or maybe VEX.
497 (define_attr "prefix" "orig,vex,maybe_vex"
498 (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
500 (const_string "orig")))
502 ;; VEX W bit is used.
503 (define_attr "prefix_vex_w" "" (const_int 0))
505 ;; The length of VEX prefix
506 ;; Only instructions with 0f prefix can have 2 byte VEX prefix,
507 ;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is
508 ;; still prefix_0f 1, with prefix_extra 1.
509 (define_attr "length_vex" ""
510 (if_then_else (and (eq_attr "prefix_0f" "1")
511 (eq_attr "prefix_extra" "0"))
512 (if_then_else (eq_attr "prefix_vex_w" "1")
513 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
514 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
515 (if_then_else (eq_attr "prefix_vex_w" "1")
516 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
517 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
519 ;; Set when modrm byte is used.
520 (define_attr "modrm" ""
521 (cond [(eq_attr "type" "str,leave")
523 (eq_attr "unit" "i387")
525 (and (eq_attr "type" "incdec")
526 (and (eq (symbol_ref "TARGET_64BIT") (const_int 0))
527 (ior (match_operand:SI 1 "register_operand" "")
528 (match_operand:HI 1 "register_operand" ""))))
530 (and (eq_attr "type" "push")
531 (not (match_operand 1 "memory_operand" "")))
533 (and (eq_attr "type" "pop")
534 (not (match_operand 0 "memory_operand" "")))
536 (and (eq_attr "type" "imov")
537 (and (not (eq_attr "mode" "DI"))
538 (ior (and (match_operand 0 "register_operand" "")
539 (match_operand 1 "immediate_operand" ""))
540 (ior (and (match_operand 0 "ax_reg_operand" "")
541 (match_operand 1 "memory_displacement_only_operand" ""))
542 (and (match_operand 0 "memory_displacement_only_operand" "")
543 (match_operand 1 "ax_reg_operand" ""))))))
545 (and (eq_attr "type" "call")
546 (match_operand 0 "constant_call_address_operand" ""))
548 (and (eq_attr "type" "callv")
549 (match_operand 1 "constant_call_address_operand" ""))
551 (and (eq_attr "type" "alu,alu1,icmp,test")
552 (match_operand 0 "ax_reg_operand" ""))
553 (symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))")
557 ;; The (bounding maximum) length of an instruction in bytes.
558 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
559 ;; Later we may want to split them and compute proper length as for
561 (define_attr "length" ""
562 (cond [(eq_attr "type" "other,multi,fistp,frndint")
564 (eq_attr "type" "fcmp")
566 (eq_attr "unit" "i387")
568 (plus (attr "prefix_data16")
569 (attr "length_address")))
570 (ior (eq_attr "prefix" "vex")
571 (and (eq_attr "prefix" "maybe_vex")
572 (ne (symbol_ref "TARGET_AVX") (const_int 0))))
573 (plus (attr "length_vex")
574 (plus (attr "length_immediate")
576 (attr "length_address"))))]
577 (plus (plus (attr "modrm")
578 (plus (attr "prefix_0f")
579 (plus (attr "prefix_rex")
580 (plus (attr "prefix_extra")
582 (plus (attr "prefix_rep")
583 (plus (attr "prefix_data16")
584 (plus (attr "length_immediate")
585 (attr "length_address")))))))
587 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
588 ;; `store' if there is a simple memory reference therein, or `unknown'
589 ;; if the instruction is complex.
591 (define_attr "memory" "none,load,store,both,unknown"
592 (cond [(eq_attr "type" "other,multi,str,lwp")
593 (const_string "unknown")
594 (eq_attr "type" "lea,fcmov,fpspc")
595 (const_string "none")
596 (eq_attr "type" "fistp,leave")
597 (const_string "both")
598 (eq_attr "type" "frndint")
599 (const_string "load")
600 (eq_attr "type" "push")
601 (if_then_else (match_operand 1 "memory_operand" "")
602 (const_string "both")
603 (const_string "store"))
604 (eq_attr "type" "pop")
605 (if_then_else (match_operand 0 "memory_operand" "")
606 (const_string "both")
607 (const_string "load"))
608 (eq_attr "type" "setcc")
609 (if_then_else (match_operand 0 "memory_operand" "")
610 (const_string "store")
611 (const_string "none"))
612 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
613 (if_then_else (ior (match_operand 0 "memory_operand" "")
614 (match_operand 1 "memory_operand" ""))
615 (const_string "load")
616 (const_string "none"))
617 (eq_attr "type" "ibr")
618 (if_then_else (match_operand 0 "memory_operand" "")
619 (const_string "load")
620 (const_string "none"))
621 (eq_attr "type" "call")
622 (if_then_else (match_operand 0 "constant_call_address_operand" "")
623 (const_string "none")
624 (const_string "load"))
625 (eq_attr "type" "callv")
626 (if_then_else (match_operand 1 "constant_call_address_operand" "")
627 (const_string "none")
628 (const_string "load"))
629 (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
630 (match_operand 1 "memory_operand" ""))
631 (const_string "both")
632 (and (match_operand 0 "memory_operand" "")
633 (match_operand 1 "memory_operand" ""))
634 (const_string "both")
635 (match_operand 0 "memory_operand" "")
636 (const_string "store")
637 (match_operand 1 "memory_operand" "")
638 (const_string "load")
640 "!alu1,negnot,ishift1,
641 imov,imovx,icmp,test,bitmanip,
643 sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
644 sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
645 (match_operand 2 "memory_operand" ""))
646 (const_string "load")
647 (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
648 (match_operand 3 "memory_operand" ""))
649 (const_string "load")
651 (const_string "none")))
653 ;; Indicates if an instruction has both an immediate and a displacement.
655 (define_attr "imm_disp" "false,true,unknown"
656 (cond [(eq_attr "type" "other,multi")
657 (const_string "unknown")
658 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
659 (and (match_operand 0 "memory_displacement_operand" "")
660 (match_operand 1 "immediate_operand" "")))
661 (const_string "true")
662 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
663 (and (match_operand 0 "memory_displacement_operand" "")
664 (match_operand 2 "immediate_operand" "")))
665 (const_string "true")
667 (const_string "false")))
669 ;; Indicates if an FP operation has an integer source.
671 (define_attr "fp_int_src" "false,true"
672 (const_string "false"))
674 ;; Defines rounding mode of an FP operation.
676 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
677 (const_string "any"))
679 ;; Define attribute to classify add/sub insns that consumes carry flag (CF)
680 (define_attr "use_carry" "0,1" (const_string "0"))
682 ;; Define attribute to indicate unaligned ssemov insns
683 (define_attr "movu" "0,1" (const_string "0"))
685 ;; Describe a user's asm statement.
686 (define_asm_attributes
687 [(set_attr "length" "128")
688 (set_attr "type" "multi")])
690 (define_code_iterator plusminus [plus minus])
692 (define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus])
694 ;; Base name for define_insn
695 (define_code_attr plusminus_insn
696 [(plus "add") (ss_plus "ssadd") (us_plus "usadd")
697 (minus "sub") (ss_minus "sssub") (us_minus "ussub")])
699 ;; Base name for insn mnemonic.
700 (define_code_attr plusminus_mnemonic
701 [(plus "add") (ss_plus "adds") (us_plus "addus")
702 (minus "sub") (ss_minus "subs") (us_minus "subus")])
703 (define_code_attr plusminus_carry_mnemonic
704 [(plus "adc") (minus "sbb")])
706 ;; Mark commutative operators as such in constraints.
707 (define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%")
708 (minus "") (ss_minus "") (us_minus "")])
710 ;; Mapping of signed max and min
711 (define_code_iterator smaxmin [smax smin])
713 ;; Mapping of unsigned max and min
714 (define_code_iterator umaxmin [umax umin])
716 ;; Base name for integer and FP insn mnemonic
717 (define_code_attr maxmin_int [(smax "maxs") (smin "mins")
718 (umax "maxu") (umin "minu")])
719 (define_code_attr maxmin_float [(smax "max") (smin "min")])
721 ;; Mapping of logic operators
722 (define_code_iterator any_logic [and ior xor])
723 (define_code_iterator any_or [ior xor])
725 ;; Base name for insn mnemonic.
726 (define_code_attr logic [(and "and") (ior "or") (xor "xor")])
728 ;; Mapping of shift-right operators
729 (define_code_iterator any_shiftrt [lshiftrt ashiftrt])
731 ;; Base name for define_insn
732 (define_code_attr shiftrt_insn [(lshiftrt "lshr") (ashiftrt "ashr")])
734 ;; Base name for insn mnemonic.
735 (define_code_attr shiftrt [(lshiftrt "shr") (ashiftrt "sar")])
737 ;; Mapping of rotate operators
738 (define_code_iterator any_rotate [rotate rotatert])
740 ;; Base name for define_insn
741 (define_code_attr rotate_insn [(rotate "rotl") (rotatert "rotr")])
743 ;; Base name for insn mnemonic.
744 (define_code_attr rotate [(rotate "rol") (rotatert "ror")])
746 ;; Mapping of abs neg operators
747 (define_code_iterator absneg [abs neg])
749 ;; Base name for x87 insn mnemonic.
750 (define_code_attr absneg_mnemonic [(abs "abs") (neg "chs")])
752 ;; Used in signed and unsigned widening multiplications.
753 (define_code_iterator any_extend [sign_extend zero_extend])
755 ;; Various insn prefixes for signed and unsigned operations.
756 (define_code_attr u [(sign_extend "") (zero_extend "u")
757 (div "") (udiv "u")])
758 (define_code_attr s [(sign_extend "s") (zero_extend "u")])
760 ;; Used in signed and unsigned divisions.
761 (define_code_iterator any_div [div udiv])
763 ;; Instruction prefix for signed and unsigned operations.
764 (define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
765 (div "i") (udiv "")])
767 ;; 64bit single word integer modes.
768 (define_mode_iterator SWI1248x [QI HI SI DI])
770 ;; 64bit single word integer modes without QImode and HImode.
771 (define_mode_iterator SWI48x [SI DI])
773 ;; Single word integer modes.
774 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
776 ;; Single word integer modes without SImode and DImode.
777 (define_mode_iterator SWI12 [QI HI])
779 ;; Single word integer modes without DImode.
780 (define_mode_iterator SWI124 [QI HI SI])
782 ;; Single word integer modes without QImode and DImode.
783 (define_mode_iterator SWI24 [HI SI])
785 ;; Single word integer modes without QImode.
786 (define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
788 ;; Single word integer modes without QImode and HImode.
789 (define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")])
791 ;; All math-dependant single and double word integer modes.
792 (define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH")
793 (HI "TARGET_HIMODE_MATH")
794 SI DI (TI "TARGET_64BIT")])
796 ;; Math-dependant single word integer modes.
797 (define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH")
798 (HI "TARGET_HIMODE_MATH")
799 SI (DI "TARGET_64BIT")])
801 ;; Math-dependant single word integer modes without DImode.
802 (define_mode_iterator SWIM124 [(QI "TARGET_QIMODE_MATH")
803 (HI "TARGET_HIMODE_MATH")
806 ;; Math-dependant single word integer modes without QImode.
807 (define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH")
808 SI (DI "TARGET_64BIT")])
810 ;; Double word integer modes.
811 (define_mode_iterator DWI [(DI "!TARGET_64BIT")
812 (TI "TARGET_64BIT")])
814 ;; Double word integer modes as mode attribute.
815 (define_mode_attr DWI [(SI "DI") (DI "TI")])
816 (define_mode_attr dwi [(SI "di") (DI "ti")])
818 ;; Half mode for double word integer modes.
819 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
820 (DI "TARGET_64BIT")])
822 ;; Instruction suffix for integer modes.
823 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
825 ;; Pointer size prefix for integer modes (Intel asm dialect)
826 (define_mode_attr iptrsize [(QI "BYTE")
831 ;; Register class for integer modes.
832 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
834 ;; Immediate operand constraint for integer modes.
835 (define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")])
837 ;; General operand constraint for word modes.
838 (define_mode_attr g [(QI "qmn") (HI "rmn") (SI "g") (DI "rme")])
840 ;; Immediate operand constraint for double integer modes.
841 (define_mode_attr di [(SI "iF") (DI "e")])
843 ;; Immediate operand constraint for shifts.
844 (define_mode_attr S [(QI "I") (HI "I") (SI "I") (DI "J") (TI "O")])
846 ;; General operand predicate for integer modes.
847 (define_mode_attr general_operand
848 [(QI "general_operand")
849 (HI "general_operand")
850 (SI "general_operand")
851 (DI "x86_64_general_operand")
852 (TI "x86_64_general_operand")])
854 ;; General sign/zero extend operand predicate for integer modes.
855 (define_mode_attr general_szext_operand
856 [(QI "general_operand")
857 (HI "general_operand")
858 (SI "general_operand")
859 (DI "x86_64_szext_general_operand")])
861 ;; Immediate operand predicate for integer modes.
862 (define_mode_attr immediate_operand
863 [(QI "immediate_operand")
864 (HI "immediate_operand")
865 (SI "immediate_operand")
866 (DI "x86_64_immediate_operand")])
868 ;; Nonmemory operand predicate for integer modes.
869 (define_mode_attr nonmemory_operand
870 [(QI "nonmemory_operand")
871 (HI "nonmemory_operand")
872 (SI "nonmemory_operand")
873 (DI "x86_64_nonmemory_operand")])
875 ;; Operand predicate for shifts.
876 (define_mode_attr shift_operand
877 [(QI "nonimmediate_operand")
878 (HI "nonimmediate_operand")
879 (SI "nonimmediate_operand")
880 (DI "shiftdi_operand")
881 (TI "register_operand")])
883 ;; Operand predicate for shift argument.
884 (define_mode_attr shift_immediate_operand
885 [(QI "const_1_to_31_operand")
886 (HI "const_1_to_31_operand")
887 (SI "const_1_to_31_operand")
888 (DI "const_1_to_63_operand")])
890 ;; Input operand predicate for arithmetic left shifts.
891 (define_mode_attr ashl_input_operand
892 [(QI "nonimmediate_operand")
893 (HI "nonimmediate_operand")
894 (SI "nonimmediate_operand")
895 (DI "ashldi_input_operand")
896 (TI "reg_or_pm1_operand")])
898 ;; SSE and x87 SFmode and DFmode floating point modes
899 (define_mode_iterator MODEF [SF DF])
901 ;; All x87 floating point modes
902 (define_mode_iterator X87MODEF [SF DF XF])
904 ;; All integer modes handled by x87 fisttp operator.
905 (define_mode_iterator X87MODEI [HI SI DI])
907 ;; All integer modes handled by integer x87 operators.
908 (define_mode_iterator X87MODEI12 [HI SI])
910 ;; All integer modes handled by SSE cvtts?2si* operators.
911 (define_mode_iterator SSEMODEI24 [SI DI])
913 ;; SSE asm suffix for floating point modes
914 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
916 ;; SSE vector mode corresponding to a scalar mode
917 (define_mode_attr ssevecmode
918 [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
920 ;; Instruction suffix for REX 64bit operators.
921 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
923 ;; This mode iterator allows :P to be used for patterns that operate on
924 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
925 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
927 ;; Scheduling descriptions
929 (include "pentium.md")
932 (include "athlon.md")
937 ;; Operand and operator predicates and constraints
939 (include "predicates.md")
940 (include "constraints.md")
943 ;; Compare and branch/compare and store instructions.
945 (define_expand "cbranch<mode>4"
946 [(set (reg:CC FLAGS_REG)
947 (compare:CC (match_operand:SDWIM 1 "nonimmediate_operand" "")
948 (match_operand:SDWIM 2 "<general_operand>" "")))
949 (set (pc) (if_then_else
950 (match_operator 0 "ordered_comparison_operator"
951 [(reg:CC FLAGS_REG) (const_int 0)])
952 (label_ref (match_operand 3 "" ""))
956 if (MEM_P (operands[1]) && MEM_P (operands[2]))
957 operands[1] = force_reg (<MODE>mode, operands[1]);
958 ix86_expand_branch (GET_CODE (operands[0]),
959 operands[1], operands[2], operands[3]);
963 (define_expand "cstore<mode>4"
964 [(set (reg:CC FLAGS_REG)
965 (compare:CC (match_operand:SWIM 2 "nonimmediate_operand" "")
966 (match_operand:SWIM 3 "<general_operand>" "")))
967 (set (match_operand:QI 0 "register_operand" "")
968 (match_operator 1 "ordered_comparison_operator"
969 [(reg:CC FLAGS_REG) (const_int 0)]))]
972 if (MEM_P (operands[2]) && MEM_P (operands[3]))
973 operands[2] = force_reg (<MODE>mode, operands[2]);
974 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
975 operands[2], operands[3]);
979 (define_expand "cmp<mode>_1"
980 [(set (reg:CC FLAGS_REG)
981 (compare:CC (match_operand:SWI48 0 "nonimmediate_operand" "")
982 (match_operand:SWI48 1 "<general_operand>" "")))])
984 (define_insn "*cmp<mode>_ccno_1"
985 [(set (reg FLAGS_REG)
986 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>,?m<r>")
987 (match_operand:SWI 1 "const0_operand" "")))]
988 "ix86_match_ccmode (insn, CCNOmode)"
990 test{<imodesuffix>}\t%0, %0
991 cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
992 [(set_attr "type" "test,icmp")
993 (set_attr "length_immediate" "0,1")
994 (set_attr "mode" "<MODE>")])
996 (define_insn "*cmp<mode>_1"
997 [(set (reg FLAGS_REG)
998 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
999 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")))]
1000 "ix86_match_ccmode (insn, CCmode)"
1001 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1002 [(set_attr "type" "icmp")
1003 (set_attr "mode" "<MODE>")])
1005 (define_insn "*cmp<mode>_minus_1"
1006 [(set (reg FLAGS_REG)
1008 (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
1009 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
1011 "ix86_match_ccmode (insn, CCGOCmode)"
1012 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
1013 [(set_attr "type" "icmp")
1014 (set_attr "mode" "<MODE>")])
1016 (define_insn "*cmpqi_ext_1"
1017 [(set (reg FLAGS_REG)
1019 (match_operand:QI 0 "general_operand" "Qm")
1022 (match_operand 1 "ext_register_operand" "Q")
1024 (const_int 8)) 0)))]
1025 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1026 "cmp{b}\t{%h1, %0|%0, %h1}"
1027 [(set_attr "type" "icmp")
1028 (set_attr "mode" "QI")])
1030 (define_insn "*cmpqi_ext_1_rex64"
1031 [(set (reg FLAGS_REG)
1033 (match_operand:QI 0 "register_operand" "Q")
1036 (match_operand 1 "ext_register_operand" "Q")
1038 (const_int 8)) 0)))]
1039 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1040 "cmp{b}\t{%h1, %0|%0, %h1}"
1041 [(set_attr "type" "icmp")
1042 (set_attr "mode" "QI")])
1044 (define_insn "*cmpqi_ext_2"
1045 [(set (reg FLAGS_REG)
1049 (match_operand 0 "ext_register_operand" "Q")
1052 (match_operand:QI 1 "const0_operand" "")))]
1053 "ix86_match_ccmode (insn, CCNOmode)"
1055 [(set_attr "type" "test")
1056 (set_attr "length_immediate" "0")
1057 (set_attr "mode" "QI")])
1059 (define_expand "cmpqi_ext_3"
1060 [(set (reg:CC FLAGS_REG)
1064 (match_operand 0 "ext_register_operand" "")
1067 (match_operand:QI 1 "immediate_operand" "")))])
1069 (define_insn "*cmpqi_ext_3_insn"
1070 [(set (reg FLAGS_REG)
1074 (match_operand 0 "ext_register_operand" "Q")
1077 (match_operand:QI 1 "general_operand" "Qmn")))]
1078 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1079 "cmp{b}\t{%1, %h0|%h0, %1}"
1080 [(set_attr "type" "icmp")
1081 (set_attr "modrm" "1")
1082 (set_attr "mode" "QI")])
1084 (define_insn "*cmpqi_ext_3_insn_rex64"
1085 [(set (reg FLAGS_REG)
1089 (match_operand 0 "ext_register_operand" "Q")
1092 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
1093 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1094 "cmp{b}\t{%1, %h0|%h0, %1}"
1095 [(set_attr "type" "icmp")
1096 (set_attr "modrm" "1")
1097 (set_attr "mode" "QI")])
1099 (define_insn "*cmpqi_ext_4"
1100 [(set (reg FLAGS_REG)
1104 (match_operand 0 "ext_register_operand" "Q")
1109 (match_operand 1 "ext_register_operand" "Q")
1111 (const_int 8)) 0)))]
1112 "ix86_match_ccmode (insn, CCmode)"
1113 "cmp{b}\t{%h1, %h0|%h0, %h1}"
1114 [(set_attr "type" "icmp")
1115 (set_attr "mode" "QI")])
1117 ;; These implement float point compares.
1118 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
1119 ;; which would allow mix and match FP modes on the compares. Which is what
1120 ;; the old patterns did, but with many more of them.
1122 (define_expand "cbranchxf4"
1123 [(set (reg:CC FLAGS_REG)
1124 (compare:CC (match_operand:XF 1 "nonmemory_operand" "")
1125 (match_operand:XF 2 "nonmemory_operand" "")))
1126 (set (pc) (if_then_else
1127 (match_operator 0 "ix86_fp_comparison_operator"
1130 (label_ref (match_operand 3 "" ""))
1134 ix86_expand_branch (GET_CODE (operands[0]),
1135 operands[1], operands[2], operands[3]);
1139 (define_expand "cstorexf4"
1140 [(set (reg:CC FLAGS_REG)
1141 (compare:CC (match_operand:XF 2 "nonmemory_operand" "")
1142 (match_operand:XF 3 "nonmemory_operand" "")))
1143 (set (match_operand:QI 0 "register_operand" "")
1144 (match_operator 1 "ix86_fp_comparison_operator"
1149 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1150 operands[2], operands[3]);
1154 (define_expand "cbranch<mode>4"
1155 [(set (reg:CC FLAGS_REG)
1156 (compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
1157 (match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
1158 (set (pc) (if_then_else
1159 (match_operator 0 "ix86_fp_comparison_operator"
1162 (label_ref (match_operand 3 "" ""))
1164 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1166 ix86_expand_branch (GET_CODE (operands[0]),
1167 operands[1], operands[2], operands[3]);
1171 (define_expand "cstore<mode>4"
1172 [(set (reg:CC FLAGS_REG)
1173 (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
1174 (match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
1175 (set (match_operand:QI 0 "register_operand" "")
1176 (match_operator 1 "ix86_fp_comparison_operator"
1179 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1181 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1182 operands[2], operands[3]);
1186 (define_expand "cbranchcc4"
1187 [(set (pc) (if_then_else
1188 (match_operator 0 "comparison_operator"
1189 [(match_operand 1 "flags_reg_operand" "")
1190 (match_operand 2 "const0_operand" "")])
1191 (label_ref (match_operand 3 "" ""))
1195 ix86_expand_branch (GET_CODE (operands[0]),
1196 operands[1], operands[2], operands[3]);
1200 (define_expand "cstorecc4"
1201 [(set (match_operand:QI 0 "register_operand" "")
1202 (match_operator 1 "comparison_operator"
1203 [(match_operand 2 "flags_reg_operand" "")
1204 (match_operand 3 "const0_operand" "")]))]
1207 ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
1208 operands[2], operands[3]);
1213 ;; FP compares, step 1:
1214 ;; Set the FP condition codes.
1216 ;; CCFPmode compare with exceptions
1217 ;; CCFPUmode compare with no exceptions
1219 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
1220 ;; used to manage the reg stack popping would not be preserved.
1222 (define_insn "*cmpfp_0"
1223 [(set (match_operand:HI 0 "register_operand" "=a")
1226 (match_operand 1 "register_operand" "f")
1227 (match_operand 2 "const0_operand" ""))]
1229 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1230 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1231 "* return output_fp_compare (insn, operands, 0, 0);"
1232 [(set_attr "type" "multi")
1233 (set_attr "unit" "i387")
1235 (cond [(match_operand:SF 1 "" "")
1237 (match_operand:DF 1 "" "")
1240 (const_string "XF")))])
1242 (define_insn_and_split "*cmpfp_0_cc"
1243 [(set (reg:CCFP FLAGS_REG)
1245 (match_operand 1 "register_operand" "f")
1246 (match_operand 2 "const0_operand" "")))
1247 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1248 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1249 && TARGET_SAHF && !TARGET_CMOVE
1250 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1252 "&& reload_completed"
1255 [(compare:CCFP (match_dup 1)(match_dup 2))]
1257 (set (reg:CC FLAGS_REG)
1258 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1260 [(set_attr "type" "multi")
1261 (set_attr "unit" "i387")
1263 (cond [(match_operand:SF 1 "" "")
1265 (match_operand:DF 1 "" "")
1268 (const_string "XF")))])
1270 (define_insn "*cmpfp_xf"
1271 [(set (match_operand:HI 0 "register_operand" "=a")
1274 (match_operand:XF 1 "register_operand" "f")
1275 (match_operand:XF 2 "register_operand" "f"))]
1278 "* return output_fp_compare (insn, operands, 0, 0);"
1279 [(set_attr "type" "multi")
1280 (set_attr "unit" "i387")
1281 (set_attr "mode" "XF")])
1283 (define_insn_and_split "*cmpfp_xf_cc"
1284 [(set (reg:CCFP FLAGS_REG)
1286 (match_operand:XF 1 "register_operand" "f")
1287 (match_operand:XF 2 "register_operand" "f")))
1288 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1290 && TARGET_SAHF && !TARGET_CMOVE"
1292 "&& reload_completed"
1295 [(compare:CCFP (match_dup 1)(match_dup 2))]
1297 (set (reg:CC FLAGS_REG)
1298 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1300 [(set_attr "type" "multi")
1301 (set_attr "unit" "i387")
1302 (set_attr "mode" "XF")])
1304 (define_insn "*cmpfp_<mode>"
1305 [(set (match_operand:HI 0 "register_operand" "=a")
1308 (match_operand:MODEF 1 "register_operand" "f")
1309 (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1312 "* return output_fp_compare (insn, operands, 0, 0);"
1313 [(set_attr "type" "multi")
1314 (set_attr "unit" "i387")
1315 (set_attr "mode" "<MODE>")])
1317 (define_insn_and_split "*cmpfp_<mode>_cc"
1318 [(set (reg:CCFP FLAGS_REG)
1320 (match_operand:MODEF 1 "register_operand" "f")
1321 (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1322 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1324 && TARGET_SAHF && !TARGET_CMOVE"
1326 "&& reload_completed"
1329 [(compare:CCFP (match_dup 1)(match_dup 2))]
1331 (set (reg:CC FLAGS_REG)
1332 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1334 [(set_attr "type" "multi")
1335 (set_attr "unit" "i387")
1336 (set_attr "mode" "<MODE>")])
1338 (define_insn "*cmpfp_u"
1339 [(set (match_operand:HI 0 "register_operand" "=a")
1342 (match_operand 1 "register_operand" "f")
1343 (match_operand 2 "register_operand" "f"))]
1345 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1346 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1347 "* return output_fp_compare (insn, operands, 0, 1);"
1348 [(set_attr "type" "multi")
1349 (set_attr "unit" "i387")
1351 (cond [(match_operand:SF 1 "" "")
1353 (match_operand:DF 1 "" "")
1356 (const_string "XF")))])
1358 (define_insn_and_split "*cmpfp_u_cc"
1359 [(set (reg:CCFPU FLAGS_REG)
1361 (match_operand 1 "register_operand" "f")
1362 (match_operand 2 "register_operand" "f")))
1363 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1364 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1365 && TARGET_SAHF && !TARGET_CMOVE
1366 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1368 "&& reload_completed"
1371 [(compare:CCFPU (match_dup 1)(match_dup 2))]
1373 (set (reg:CC FLAGS_REG)
1374 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1376 [(set_attr "type" "multi")
1377 (set_attr "unit" "i387")
1379 (cond [(match_operand:SF 1 "" "")
1381 (match_operand:DF 1 "" "")
1384 (const_string "XF")))])
1386 (define_insn "*cmpfp_<mode>"
1387 [(set (match_operand:HI 0 "register_operand" "=a")
1390 (match_operand 1 "register_operand" "f")
1391 (match_operator 3 "float_operator"
1392 [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1394 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1395 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1396 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1397 "* return output_fp_compare (insn, operands, 0, 0);"
1398 [(set_attr "type" "multi")
1399 (set_attr "unit" "i387")
1400 (set_attr "fp_int_src" "true")
1401 (set_attr "mode" "<MODE>")])
1403 (define_insn_and_split "*cmpfp_<mode>_cc"
1404 [(set (reg:CCFP FLAGS_REG)
1406 (match_operand 1 "register_operand" "f")
1407 (match_operator 3 "float_operator"
1408 [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1409 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1410 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1411 && TARGET_SAHF && !TARGET_CMOVE
1412 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1413 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1415 "&& reload_completed"
1420 (match_op_dup 3 [(match_dup 2)]))]
1422 (set (reg:CC FLAGS_REG)
1423 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1425 [(set_attr "type" "multi")
1426 (set_attr "unit" "i387")
1427 (set_attr "fp_int_src" "true")
1428 (set_attr "mode" "<MODE>")])
1430 ;; FP compares, step 2
1431 ;; Move the fpsw to ax.
1433 (define_insn "x86_fnstsw_1"
1434 [(set (match_operand:HI 0 "register_operand" "=a")
1435 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1438 [(set (attr "length") (symbol_ref "ix86_attr_length_address_default (insn) + 2"))
1439 (set_attr "mode" "SI")
1440 (set_attr "unit" "i387")])
1442 ;; FP compares, step 3
1443 ;; Get ax into flags, general case.
1445 (define_insn "x86_sahf_1"
1446 [(set (reg:CC FLAGS_REG)
1447 (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1451 #ifndef HAVE_AS_IX86_SAHF
1453 return ASM_BYTE "0x9e";
1458 [(set_attr "length" "1")
1459 (set_attr "athlon_decode" "vector")
1460 (set_attr "amdfam10_decode" "direct")
1461 (set_attr "mode" "SI")])
1463 ;; Pentium Pro can do steps 1 through 3 in one go.
1464 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1465 (define_insn "*cmpfp_i_mixed"
1466 [(set (reg:CCFP FLAGS_REG)
1467 (compare:CCFP (match_operand 0 "register_operand" "f,x")
1468 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1469 "TARGET_MIX_SSE_I387
1470 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1471 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1472 "* return output_fp_compare (insn, operands, 1, 0);"
1473 [(set_attr "type" "fcmp,ssecomi")
1474 (set_attr "prefix" "orig,maybe_vex")
1476 (if_then_else (match_operand:SF 1 "" "")
1478 (const_string "DF")))
1479 (set (attr "prefix_rep")
1480 (if_then_else (eq_attr "type" "ssecomi")
1482 (const_string "*")))
1483 (set (attr "prefix_data16")
1484 (cond [(eq_attr "type" "fcmp")
1486 (eq_attr "mode" "DF")
1489 (const_string "0")))
1490 (set_attr "athlon_decode" "vector")
1491 (set_attr "amdfam10_decode" "direct")])
1493 (define_insn "*cmpfp_i_sse"
1494 [(set (reg:CCFP FLAGS_REG)
1495 (compare:CCFP (match_operand 0 "register_operand" "x")
1496 (match_operand 1 "nonimmediate_operand" "xm")))]
1498 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1499 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1500 "* return output_fp_compare (insn, operands, 1, 0);"
1501 [(set_attr "type" "ssecomi")
1502 (set_attr "prefix" "maybe_vex")
1504 (if_then_else (match_operand:SF 1 "" "")
1506 (const_string "DF")))
1507 (set_attr "prefix_rep" "0")
1508 (set (attr "prefix_data16")
1509 (if_then_else (eq_attr "mode" "DF")
1511 (const_string "0")))
1512 (set_attr "athlon_decode" "vector")
1513 (set_attr "amdfam10_decode" "direct")])
1515 (define_insn "*cmpfp_i_i387"
1516 [(set (reg:CCFP FLAGS_REG)
1517 (compare:CCFP (match_operand 0 "register_operand" "f")
1518 (match_operand 1 "register_operand" "f")))]
1519 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1521 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1522 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1523 "* return output_fp_compare (insn, operands, 1, 0);"
1524 [(set_attr "type" "fcmp")
1526 (cond [(match_operand:SF 1 "" "")
1528 (match_operand:DF 1 "" "")
1531 (const_string "XF")))
1532 (set_attr "athlon_decode" "vector")
1533 (set_attr "amdfam10_decode" "direct")])
1535 (define_insn "*cmpfp_iu_mixed"
1536 [(set (reg:CCFPU FLAGS_REG)
1537 (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1538 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1539 "TARGET_MIX_SSE_I387
1540 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1541 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1542 "* return output_fp_compare (insn, operands, 1, 1);"
1543 [(set_attr "type" "fcmp,ssecomi")
1544 (set_attr "prefix" "orig,maybe_vex")
1546 (if_then_else (match_operand:SF 1 "" "")
1548 (const_string "DF")))
1549 (set (attr "prefix_rep")
1550 (if_then_else (eq_attr "type" "ssecomi")
1552 (const_string "*")))
1553 (set (attr "prefix_data16")
1554 (cond [(eq_attr "type" "fcmp")
1556 (eq_attr "mode" "DF")
1559 (const_string "0")))
1560 (set_attr "athlon_decode" "vector")
1561 (set_attr "amdfam10_decode" "direct")])
1563 (define_insn "*cmpfp_iu_sse"
1564 [(set (reg:CCFPU FLAGS_REG)
1565 (compare:CCFPU (match_operand 0 "register_operand" "x")
1566 (match_operand 1 "nonimmediate_operand" "xm")))]
1568 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1569 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1570 "* return output_fp_compare (insn, operands, 1, 1);"
1571 [(set_attr "type" "ssecomi")
1572 (set_attr "prefix" "maybe_vex")
1574 (if_then_else (match_operand:SF 1 "" "")
1576 (const_string "DF")))
1577 (set_attr "prefix_rep" "0")
1578 (set (attr "prefix_data16")
1579 (if_then_else (eq_attr "mode" "DF")
1581 (const_string "0")))
1582 (set_attr "athlon_decode" "vector")
1583 (set_attr "amdfam10_decode" "direct")])
1585 (define_insn "*cmpfp_iu_387"
1586 [(set (reg:CCFPU FLAGS_REG)
1587 (compare:CCFPU (match_operand 0 "register_operand" "f")
1588 (match_operand 1 "register_operand" "f")))]
1589 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1591 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1592 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1593 "* return output_fp_compare (insn, operands, 1, 1);"
1594 [(set_attr "type" "fcmp")
1596 (cond [(match_operand:SF 1 "" "")
1598 (match_operand:DF 1 "" "")
1601 (const_string "XF")))
1602 (set_attr "athlon_decode" "vector")
1603 (set_attr "amdfam10_decode" "direct")])
1605 ;; Push/pop instructions.
1607 (define_insn "*pushdi2_rex64"
1608 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1609 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1614 [(set_attr "type" "push,multi")
1615 (set_attr "mode" "DI")])
1617 ;; Convert impossible pushes of immediate to existing instructions.
1618 ;; First try to get scratch register and go through it. In case this
1619 ;; fails, push sign extended lower part first and then overwrite
1620 ;; upper part by 32bit move.
1622 [(match_scratch:DI 2 "r")
1623 (set (match_operand:DI 0 "push_operand" "")
1624 (match_operand:DI 1 "immediate_operand" ""))]
1625 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1626 && !x86_64_immediate_operand (operands[1], DImode)"
1627 [(set (match_dup 2) (match_dup 1))
1628 (set (match_dup 0) (match_dup 2))])
1630 ;; We need to define this as both peepholer and splitter for case
1631 ;; peephole2 pass is not run.
1632 ;; "&& 1" is needed to keep it from matching the previous pattern.
1634 [(set (match_operand:DI 0 "push_operand" "")
1635 (match_operand:DI 1 "immediate_operand" ""))]
1636 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1637 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1638 [(set (match_dup 0) (match_dup 1))
1639 (set (match_dup 2) (match_dup 3))]
1641 split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]);
1643 operands[1] = gen_lowpart (DImode, operands[2]);
1644 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1649 [(set (match_operand:DI 0 "push_operand" "")
1650 (match_operand:DI 1 "immediate_operand" ""))]
1651 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
1652 ? epilogue_completed : reload_completed)
1653 && !symbolic_operand (operands[1], DImode)
1654 && !x86_64_immediate_operand (operands[1], DImode)"
1655 [(set (match_dup 0) (match_dup 1))
1656 (set (match_dup 2) (match_dup 3))]
1658 split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]);
1660 operands[1] = gen_lowpart (DImode, operands[2]);
1661 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1665 (define_insn "*pushdi2"
1666 [(set (match_operand:DI 0 "push_operand" "=<")
1667 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
1672 [(set (match_operand:DI 0 "push_operand" "")
1673 (match_operand:DI 1 "general_operand" ""))]
1674 "!TARGET_64BIT && reload_completed
1675 && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
1677 "ix86_split_long_move (operands); DONE;")
1679 (define_insn "*pushsi2"
1680 [(set (match_operand:SI 0 "push_operand" "=<")
1681 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1684 [(set_attr "type" "push")
1685 (set_attr "mode" "SI")])
1687 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1688 ;; "push a byte/word". But actually we use pushl, which has the effect
1689 ;; of rounding the amount pushed up to a word.
1691 ;; For TARGET_64BIT we always round up to 8 bytes.
1692 (define_insn "*push<mode>2_rex64"
1693 [(set (match_operand:SWI124 0 "push_operand" "=X")
1694 (match_operand:SWI124 1 "nonmemory_no_elim_operand" "r<i>"))]
1697 [(set_attr "type" "push")
1698 (set_attr "mode" "DI")])
1700 (define_insn "*push<mode>2"
1701 [(set (match_operand:SWI12 0 "push_operand" "=X")
1702 (match_operand:SWI12 1 "nonmemory_no_elim_operand" "rn"))]
1705 [(set_attr "type" "push")
1706 (set_attr "mode" "SI")])
1708 (define_insn "*push<mode>2_prologue"
1709 [(set (match_operand:P 0 "push_operand" "=<")
1710 (match_operand:P 1 "general_no_elim_operand" "r<i>*m"))
1711 (clobber (mem:BLK (scratch)))]
1713 "push{<imodesuffix>}\t%1"
1714 [(set_attr "type" "push")
1715 (set_attr "mode" "<MODE>")])
1717 (define_insn "*pop<mode>1"
1718 [(set (match_operand:P 0 "nonimmediate_operand" "=r*m")
1719 (match_operand:P 1 "pop_operand" ">"))]
1721 "pop{<imodesuffix>}\t%0"
1722 [(set_attr "type" "pop")
1723 (set_attr "mode" "<MODE>")])
1725 (define_insn "*pop<mode>1_epilogue"
1726 [(set (match_operand:P 0 "nonimmediate_operand" "=r*m")
1727 (match_operand:P 1 "pop_operand" ">"))
1728 (clobber (mem:BLK (scratch)))]
1730 "pop{<imodesuffix>}\t%0"
1731 [(set_attr "type" "pop")
1732 (set_attr "mode" "<MODE>")])
1734 ;; Move instructions.
1736 (define_expand "movoi"
1737 [(set (match_operand:OI 0 "nonimmediate_operand" "")
1738 (match_operand:OI 1 "general_operand" ""))]
1740 "ix86_expand_move (OImode, operands); DONE;")
1742 (define_expand "movti"
1743 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1744 (match_operand:TI 1 "nonimmediate_operand" ""))]
1745 "TARGET_64BIT || TARGET_SSE"
1748 ix86_expand_move (TImode, operands);
1749 else if (push_operand (operands[0], TImode))
1750 ix86_expand_push (TImode, operands[1]);
1752 ix86_expand_vector_move (TImode, operands);
1756 ;; This expands to what emit_move_complex would generate if we didn't
1757 ;; have a movti pattern. Having this avoids problems with reload on
1758 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
1759 ;; to have around all the time.
1760 (define_expand "movcdi"
1761 [(set (match_operand:CDI 0 "nonimmediate_operand" "")
1762 (match_operand:CDI 1 "general_operand" ""))]
1765 if (push_operand (operands[0], CDImode))
1766 emit_move_complex_push (CDImode, operands[0], operands[1]);
1768 emit_move_complex_parts (operands[0], operands[1]);
1772 (define_expand "mov<mode>"
1773 [(set (match_operand:SWI1248x 0 "nonimmediate_operand" "")
1774 (match_operand:SWI1248x 1 "general_operand" ""))]
1776 "ix86_expand_move (<MODE>mode, operands); DONE;")
1778 (define_insn "*mov<mode>_xor"
1779 [(set (match_operand:SWI48 0 "register_operand" "=r")
1780 (match_operand:SWI48 1 "const0_operand" ""))
1781 (clobber (reg:CC FLAGS_REG))]
1784 [(set_attr "type" "alu1")
1785 (set_attr "mode" "SI")
1786 (set_attr "length_immediate" "0")])
1788 (define_insn "*mov<mode>_or"
1789 [(set (match_operand:SWI48 0 "register_operand" "=r")
1790 (match_operand:SWI48 1 "const_int_operand" ""))
1791 (clobber (reg:CC FLAGS_REG))]
1793 && operands[1] == constm1_rtx"
1794 "or{<imodesuffix>}\t{%1, %0|%0, %1}"
1795 [(set_attr "type" "alu1")
1796 (set_attr "mode" "<MODE>")
1797 (set_attr "length_immediate" "1")])
1799 (define_insn "*movoi_internal_avx"
1800 [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
1801 (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
1802 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1804 switch (which_alternative)
1807 return "vxorps\t%0, %0, %0";
1810 if (misaligned_operand (operands[0], OImode)
1811 || misaligned_operand (operands[1], OImode))
1812 return "vmovdqu\t{%1, %0|%0, %1}";
1814 return "vmovdqa\t{%1, %0|%0, %1}";
1819 [(set_attr "type" "sselog1,ssemov,ssemov")
1820 (set_attr "prefix" "vex")
1821 (set_attr "mode" "OI")])
1823 (define_insn "*movti_internal_rex64"
1824 [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
1825 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
1826 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1828 switch (which_alternative)
1834 if (get_attr_mode (insn) == MODE_V4SF)
1835 return "%vxorps\t%0, %d0";
1837 return "%vpxor\t%0, %d0";
1840 /* TDmode values are passed as TImode on the stack. Moving them
1841 to stack may result in unaligned memory access. */
1842 if (misaligned_operand (operands[0], TImode)
1843 || misaligned_operand (operands[1], TImode))
1845 if (get_attr_mode (insn) == MODE_V4SF)
1846 return "%vmovups\t{%1, %0|%0, %1}";
1848 return "%vmovdqu\t{%1, %0|%0, %1}";
1852 if (get_attr_mode (insn) == MODE_V4SF)
1853 return "%vmovaps\t{%1, %0|%0, %1}";
1855 return "%vmovdqa\t{%1, %0|%0, %1}";
1861 [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
1862 (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
1864 (cond [(eq_attr "alternative" "2,3")
1866 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1868 (const_string "V4SF")
1869 (const_string "TI"))
1870 (eq_attr "alternative" "4")
1872 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
1874 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1876 (const_string "V4SF")
1877 (const_string "TI"))]
1878 (const_string "DI")))])
1881 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1882 (match_operand:TI 1 "general_operand" ""))]
1884 && !SSE_REG_P (operands[0]) && !SSE_REG_P (operands[1])"
1886 "ix86_split_long_move (operands); DONE;")
1888 (define_insn "*movti_internal_sse"
1889 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
1890 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
1891 "TARGET_SSE && !TARGET_64BIT
1892 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1894 switch (which_alternative)
1897 if (get_attr_mode (insn) == MODE_V4SF)
1898 return "%vxorps\t%0, %d0";
1900 return "%vpxor\t%0, %d0";
1903 /* TDmode values are passed as TImode on the stack. Moving them
1904 to stack may result in unaligned memory access. */
1905 if (misaligned_operand (operands[0], TImode)
1906 || misaligned_operand (operands[1], TImode))
1908 if (get_attr_mode (insn) == MODE_V4SF)
1909 return "%vmovups\t{%1, %0|%0, %1}";
1911 return "%vmovdqu\t{%1, %0|%0, %1}";
1915 if (get_attr_mode (insn) == MODE_V4SF)
1916 return "%vmovaps\t{%1, %0|%0, %1}";
1918 return "%vmovdqa\t{%1, %0|%0, %1}";
1924 [(set_attr "type" "sselog1,ssemov,ssemov")
1925 (set_attr "prefix" "maybe_vex")
1927 (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1928 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
1930 (const_string "V4SF")
1931 (and (eq_attr "alternative" "2")
1932 (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
1934 (const_string "V4SF")]
1935 (const_string "TI")))])
1937 (define_insn "*movdi_internal_rex64"
1938 [(set (match_operand:DI 0 "nonimmediate_operand"
1939 "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
1940 (match_operand:DI 1 "general_operand"
1941 "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
1942 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1944 switch (get_attr_type (insn))
1947 if (SSE_REG_P (operands[0]))
1948 return "movq2dq\t{%1, %0|%0, %1}";
1950 return "movdq2q\t{%1, %0|%0, %1}";
1955 if (get_attr_mode (insn) == MODE_TI)
1956 return "vmovdqa\t{%1, %0|%0, %1}";
1958 return "vmovq\t{%1, %0|%0, %1}";
1961 if (get_attr_mode (insn) == MODE_TI)
1962 return "movdqa\t{%1, %0|%0, %1}";
1966 /* Moves from and into integer register is done using movd
1967 opcode with REX prefix. */
1968 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
1969 return "movd\t{%1, %0|%0, %1}";
1970 return "movq\t{%1, %0|%0, %1}";
1973 return "%vpxor\t%0, %d0";
1976 return "pxor\t%0, %0";
1982 return "lea{q}\t{%a1, %0|%0, %a1}";
1985 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
1986 if (get_attr_mode (insn) == MODE_SI)
1987 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1988 else if (which_alternative == 2)
1989 return "movabs{q}\t{%1, %0|%0, %1}";
1991 return "mov{q}\t{%1, %0|%0, %1}";
1995 (cond [(eq_attr "alternative" "5")
1996 (const_string "mmx")
1997 (eq_attr "alternative" "6,7,8,9,10")
1998 (const_string "mmxmov")
1999 (eq_attr "alternative" "11")
2000 (const_string "sselog1")
2001 (eq_attr "alternative" "12,13,14,15,16")
2002 (const_string "ssemov")
2003 (eq_attr "alternative" "17,18")
2004 (const_string "ssecvt")
2005 (eq_attr "alternative" "4")
2006 (const_string "multi")
2007 (match_operand:DI 1 "pic_32bit_operand" "")
2008 (const_string "lea")
2010 (const_string "imov")))
2013 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2015 (const_string "*")))
2016 (set (attr "length_immediate")
2018 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2020 (const_string "*")))
2021 (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
2022 (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
2023 (set (attr "prefix")
2024 (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
2025 (const_string "maybe_vex")
2026 (const_string "orig")))
2027 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2029 ;; Convert impossible stores of immediate to existing instructions.
2030 ;; First try to get scratch register and go through it. In case this
2031 ;; fails, move by 32bit parts.
2033 [(match_scratch:DI 2 "r")
2034 (set (match_operand:DI 0 "memory_operand" "")
2035 (match_operand:DI 1 "immediate_operand" ""))]
2036 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2037 && !x86_64_immediate_operand (operands[1], DImode)"
2038 [(set (match_dup 2) (match_dup 1))
2039 (set (match_dup 0) (match_dup 2))])
2041 ;; We need to define this as both peepholer and splitter for case
2042 ;; peephole2 pass is not run.
2043 ;; "&& 1" is needed to keep it from matching the previous pattern.
2045 [(set (match_operand:DI 0 "memory_operand" "")
2046 (match_operand:DI 1 "immediate_operand" ""))]
2047 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2048 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2049 [(set (match_dup 2) (match_dup 3))
2050 (set (match_dup 4) (match_dup 5))]
2051 "split_double_mode (DImode, &operands[0], 2, &operands[2], &operands[4]);")
2054 [(set (match_operand:DI 0 "memory_operand" "")
2055 (match_operand:DI 1 "immediate_operand" ""))]
2056 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2057 ? epilogue_completed : reload_completed)
2058 && !symbolic_operand (operands[1], DImode)
2059 && !x86_64_immediate_operand (operands[1], DImode)"
2060 [(set (match_dup 2) (match_dup 3))
2061 (set (match_dup 4) (match_dup 5))]
2062 "split_double_mode (DImode, &operands[0], 2, &operands[2], &operands[4]);")
2064 (define_insn "*movdi_internal"
2065 [(set (match_operand:DI 0 "nonimmediate_operand"
2066 "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
2067 (match_operand:DI 1 "general_operand"
2068 "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
2069 "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2074 movq\t{%1, %0|%0, %1}
2075 movq\t{%1, %0|%0, %1}
2077 %vmovq\t{%1, %0|%0, %1}
2078 %vmovdqa\t{%1, %0|%0, %1}
2079 %vmovq\t{%1, %0|%0, %1}
2081 movlps\t{%1, %0|%0, %1}
2082 movaps\t{%1, %0|%0, %1}
2083 movlps\t{%1, %0|%0, %1}"
2084 [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2085 (set (attr "prefix")
2086 (if_then_else (eq_attr "alternative" "5,6,7,8")
2087 (const_string "vex")
2088 (const_string "orig")))
2089 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2092 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2093 (match_operand:DI 1 "general_operand" ""))]
2094 "!TARGET_64BIT && reload_completed
2095 && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))
2096 && !(MMX_REG_P (operands[1]) || SSE_REG_P (operands[1]))"
2098 "ix86_split_long_move (operands); DONE;")
2100 (define_insn "*movsi_internal"
2101 [(set (match_operand:SI 0 "nonimmediate_operand"
2102 "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
2103 (match_operand:SI 1 "general_operand"
2104 "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))]
2105 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2107 switch (get_attr_type (insn))
2110 if (get_attr_mode (insn) == MODE_TI)
2111 return "%vpxor\t%0, %d0";
2112 return "%vxorps\t%0, %d0";
2115 switch (get_attr_mode (insn))
2118 return "%vmovdqa\t{%1, %0|%0, %1}";
2120 return "%vmovaps\t{%1, %0|%0, %1}";
2122 return "%vmovd\t{%1, %0|%0, %1}";
2124 return "%vmovss\t{%1, %0|%0, %1}";
2130 return "pxor\t%0, %0";
2133 if (get_attr_mode (insn) == MODE_DI)
2134 return "movq\t{%1, %0|%0, %1}";
2135 return "movd\t{%1, %0|%0, %1}";
2138 return "lea{l}\t{%a1, %0|%0, %a1}";
2141 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2142 return "mov{l}\t{%1, %0|%0, %1}";
2146 (cond [(eq_attr "alternative" "2")
2147 (const_string "mmx")
2148 (eq_attr "alternative" "3,4,5")
2149 (const_string "mmxmov")
2150 (eq_attr "alternative" "6")
2151 (const_string "sselog1")
2152 (eq_attr "alternative" "7,8,9,10,11")
2153 (const_string "ssemov")
2154 (match_operand:DI 1 "pic_32bit_operand" "")
2155 (const_string "lea")
2157 (const_string "imov")))
2158 (set (attr "prefix")
2159 (if_then_else (eq_attr "alternative" "0,1,2,3,4,5")
2160 (const_string "orig")
2161 (const_string "maybe_vex")))
2162 (set (attr "prefix_data16")
2163 (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI"))
2165 (const_string "*")))
2167 (cond [(eq_attr "alternative" "2,3")
2169 (eq_attr "alternative" "6,7")
2171 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2172 (const_string "V4SF")
2173 (const_string "TI"))
2174 (and (eq_attr "alternative" "8,9,10,11")
2175 (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
2178 (const_string "SI")))])
2180 (define_insn "*movhi_internal"
2181 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
2182 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
2183 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2185 switch (get_attr_type (insn))
2188 /* movzwl is faster than movw on p2 due to partial word stalls,
2189 though not as fast as an aligned movl. */
2190 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
2192 if (get_attr_mode (insn) == MODE_SI)
2193 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2195 return "mov{w}\t{%1, %0|%0, %1}";
2199 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
2201 (const_string "imov")
2202 (and (eq_attr "alternative" "0")
2203 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2205 (eq (symbol_ref "TARGET_HIMODE_MATH")
2207 (const_string "imov")
2208 (and (eq_attr "alternative" "1,2")
2209 (match_operand:HI 1 "aligned_operand" ""))
2210 (const_string "imov")
2211 (and (ne (symbol_ref "TARGET_MOVX")
2213 (eq_attr "alternative" "0,2"))
2214 (const_string "imovx")
2216 (const_string "imov")))
2218 (cond [(eq_attr "type" "imovx")
2220 (and (eq_attr "alternative" "1,2")
2221 (match_operand:HI 1 "aligned_operand" ""))
2223 (and (eq_attr "alternative" "0")
2224 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2226 (eq (symbol_ref "TARGET_HIMODE_MATH")
2230 (const_string "HI")))])
2232 ;; Situation is quite tricky about when to choose full sized (SImode) move
2233 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
2234 ;; partial register dependency machines (such as AMD Athlon), where QImode
2235 ;; moves issue extra dependency and for partial register stalls machines
2236 ;; that don't use QImode patterns (and QImode move cause stall on the next
2239 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
2240 ;; register stall machines with, where we use QImode instructions, since
2241 ;; partial register stall can be caused there. Then we use movzx.
2242 (define_insn "*movqi_internal"
2243 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
2244 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
2245 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2247 switch (get_attr_type (insn))
2250 gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
2251 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
2253 if (get_attr_mode (insn) == MODE_SI)
2254 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2256 return "mov{b}\t{%1, %0|%0, %1}";
2260 (cond [(and (eq_attr "alternative" "5")
2261 (not (match_operand:QI 1 "aligned_operand" "")))
2262 (const_string "imovx")
2263 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2265 (const_string "imov")
2266 (and (eq_attr "alternative" "3")
2267 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2269 (eq (symbol_ref "TARGET_QIMODE_MATH")
2271 (const_string "imov")
2272 (eq_attr "alternative" "3,5")
2273 (const_string "imovx")
2274 (and (ne (symbol_ref "TARGET_MOVX")
2276 (eq_attr "alternative" "2"))
2277 (const_string "imovx")
2279 (const_string "imov")))
2281 (cond [(eq_attr "alternative" "3,4,5")
2283 (eq_attr "alternative" "6")
2285 (eq_attr "type" "imovx")
2287 (and (eq_attr "type" "imov")
2288 (and (eq_attr "alternative" "0,1")
2289 (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
2291 (and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2293 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2296 ;; Avoid partial register stalls when not using QImode arithmetic
2297 (and (eq_attr "type" "imov")
2298 (and (eq_attr "alternative" "0,1")
2299 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
2301 (eq (symbol_ref "TARGET_QIMODE_MATH")
2305 (const_string "QI")))])
2307 ;; Stores and loads of ax to arbitrary constant address.
2308 ;; We fake an second form of instruction to force reload to load address
2309 ;; into register when rax is not available
2310 (define_insn "*movabs<mode>_1"
2311 [(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2312 (match_operand:SWI1248x 1 "nonmemory_operand" "a,er"))]
2313 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2315 movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
2316 mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
2317 [(set_attr "type" "imov")
2318 (set_attr "modrm" "0,*")
2319 (set_attr "length_address" "8,0")
2320 (set_attr "length_immediate" "0,*")
2321 (set_attr "memory" "store")
2322 (set_attr "mode" "<MODE>")])
2324 (define_insn "*movabs<mode>_2"
2325 [(set (match_operand:SWI1248x 0 "register_operand" "=a,r")
2326 (mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2327 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2329 movabs{<imodesuffix>}\t{%P1, %0|%0, %P1}
2330 mov{<imodesuffix>}\t{%a1, %0|%0, %a1}"
2331 [(set_attr "type" "imov")
2332 (set_attr "modrm" "0,*")
2333 (set_attr "length_address" "8,0")
2334 (set_attr "length_immediate" "0")
2335 (set_attr "memory" "load")
2336 (set_attr "mode" "<MODE>")])
2338 (define_insn "*swap<mode>"
2339 [(set (match_operand:SWI48 0 "register_operand" "+r")
2340 (match_operand:SWI48 1 "register_operand" "+r"))
2344 "xchg{<imodesuffix>}\t%1, %0"
2345 [(set_attr "type" "imov")
2346 (set_attr "mode" "<MODE>")
2347 (set_attr "pent_pair" "np")
2348 (set_attr "athlon_decode" "vector")
2349 (set_attr "amdfam10_decode" "double")])
2351 (define_insn "*swap<mode>_1"
2352 [(set (match_operand:SWI12 0 "register_operand" "+r")
2353 (match_operand:SWI12 1 "register_operand" "+r"))
2356 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2358 [(set_attr "type" "imov")
2359 (set_attr "mode" "SI")
2360 (set_attr "pent_pair" "np")
2361 (set_attr "athlon_decode" "vector")
2362 (set_attr "amdfam10_decode" "double")])
2364 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL
2365 ;; is disabled for AMDFAM10
2366 (define_insn "*swap<mode>_2"
2367 [(set (match_operand:SWI12 0 "register_operand" "+<r>")
2368 (match_operand:SWI12 1 "register_operand" "+<r>"))
2371 "TARGET_PARTIAL_REG_STALL"
2372 "xchg{<imodesuffix>}\t%1, %0"
2373 [(set_attr "type" "imov")
2374 (set_attr "mode" "<MODE>")
2375 (set_attr "pent_pair" "np")
2376 (set_attr "athlon_decode" "vector")])
2378 (define_expand "movstrict<mode>"
2379 [(set (strict_low_part (match_operand:SWI12 0 "nonimmediate_operand" ""))
2380 (match_operand:SWI12 1 "general_operand" ""))]
2383 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2385 /* Don't generate memory->memory moves, go through a register */
2386 if (MEM_P (operands[0]) && MEM_P (operands[1]))
2387 operands[1] = force_reg (<MODE>mode, operands[1]);
2390 (define_insn "*movstrict<mode>_1"
2391 [(set (strict_low_part
2392 (match_operand:SWI12 0 "nonimmediate_operand" "+<r>m,<r>"))
2393 (match_operand:SWI12 1 "general_operand" "<r>n,m"))]
2394 "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2395 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2396 "mov{<imodesuffix>}\t{%1, %0|%0, %1}"
2397 [(set_attr "type" "imov")
2398 (set_attr "mode" "<MODE>")])
2400 (define_insn "*movstrict<mode>_xor"
2401 [(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>"))
2402 (match_operand:SWI12 1 "const0_operand" ""))
2403 (clobber (reg:CC FLAGS_REG))]
2405 "xor{<imodesuffix>}\t%0, %0"
2406 [(set_attr "type" "alu1")
2407 (set_attr "mode" "<MODE>")
2408 (set_attr "length_immediate" "0")])
2410 (define_insn "*mov<mode>_extv_1"
2411 [(set (match_operand:SWI24 0 "register_operand" "=R")
2412 (sign_extract:SWI24 (match_operand 1 "ext_register_operand" "Q")
2416 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
2417 [(set_attr "type" "imovx")
2418 (set_attr "mode" "SI")])
2420 (define_insn "*movqi_extv_1_rex64"
2421 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2422 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2427 switch (get_attr_type (insn))
2430 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2432 return "mov{b}\t{%h1, %0|%0, %h1}";
2436 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2437 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2438 (ne (symbol_ref "TARGET_MOVX")
2440 (const_string "imovx")
2441 (const_string "imov")))
2443 (if_then_else (eq_attr "type" "imovx")
2445 (const_string "QI")))])
2447 (define_insn "*movqi_extv_1"
2448 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
2449 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2454 switch (get_attr_type (insn))
2457 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2459 return "mov{b}\t{%h1, %0|%0, %h1}";
2463 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2464 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2465 (ne (symbol_ref "TARGET_MOVX")
2467 (const_string "imovx")
2468 (const_string "imov")))
2470 (if_then_else (eq_attr "type" "imovx")
2472 (const_string "QI")))])
2474 (define_insn "*mov<mode>_extzv_1"
2475 [(set (match_operand:SWI48 0 "register_operand" "=R")
2476 (zero_extract:SWI48 (match_operand 1 "ext_register_operand" "Q")
2480 "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
2481 [(set_attr "type" "imovx")
2482 (set_attr "mode" "SI")])
2484 (define_insn "*movqi_extzv_2_rex64"
2485 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2487 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2492 switch (get_attr_type (insn))
2495 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2497 return "mov{b}\t{%h1, %0|%0, %h1}";
2501 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2502 (ne (symbol_ref "TARGET_MOVX")
2504 (const_string "imovx")
2505 (const_string "imov")))
2507 (if_then_else (eq_attr "type" "imovx")
2509 (const_string "QI")))])
2511 (define_insn "*movqi_extzv_2"
2512 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
2514 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2519 switch (get_attr_type (insn))
2522 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2524 return "mov{b}\t{%h1, %0|%0, %h1}";
2528 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2529 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2530 (ne (symbol_ref "TARGET_MOVX")
2532 (const_string "imovx")
2533 (const_string "imov")))
2535 (if_then_else (eq_attr "type" "imovx")
2537 (const_string "QI")))])
2539 (define_expand "mov<mode>_insv_1"
2540 [(set (zero_extract:SWI48 (match_operand 0 "ext_register_operand" "")
2543 (match_operand:SWI48 1 "nonmemory_operand" ""))])
2545 (define_insn "*mov<mode>_insv_1_rex64"
2546 [(set (zero_extract:SWI48x (match_operand 0 "ext_register_operand" "+Q")
2549 (match_operand:SWI48x 1 "nonmemory_operand" "Qn"))]
2551 "mov{b}\t{%b1, %h0|%h0, %b1}"
2552 [(set_attr "type" "imov")
2553 (set_attr "mode" "QI")])
2555 (define_insn "*movsi_insv_1"
2556 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2559 (match_operand:SI 1 "general_operand" "Qmn"))]
2561 "mov{b}\t{%b1, %h0|%h0, %b1}"
2562 [(set_attr "type" "imov")
2563 (set_attr "mode" "QI")])
2565 (define_insn "*movqi_insv_2"
2566 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2569 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2572 "mov{b}\t{%h1, %h0|%h0, %h1}"
2573 [(set_attr "type" "imov")
2574 (set_attr "mode" "QI")])
2576 ;; Floating point push instructions.
2578 (define_insn "*pushtf"
2579 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
2580 (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
2583 /* This insn should be already split before reg-stack. */
2586 [(set_attr "type" "multi")
2587 (set_attr "unit" "sse,*,*")
2588 (set_attr "mode" "TF,SI,SI")])
2591 [(set (match_operand:TF 0 "push_operand" "")
2592 (match_operand:TF 1 "sse_reg_operand" ""))]
2593 "TARGET_SSE2 && reload_completed"
2594 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
2595 (set (mem:TF (reg:P SP_REG)) (match_dup 1))])
2598 [(set (match_operand:TF 0 "push_operand" "")
2599 (match_operand:TF 1 "general_operand" ""))]
2600 "TARGET_SSE2 && reload_completed
2601 && !SSE_REG_P (operands[1])"
2603 "ix86_split_long_move (operands); DONE;")
2605 (define_insn "*pushxf"
2606 [(set (match_operand:XF 0 "push_operand" "=<,<")
2607 (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
2608 "optimize_function_for_speed_p (cfun)"
2610 /* This insn should be already split before reg-stack. */
2613 [(set_attr "type" "multi")
2614 (set_attr "unit" "i387,*")
2615 (set_attr "mode" "XF,SI")])
2617 ;; Size of pushxf is 3 (for sub) + 2 (for fstp) + memory operand size.
2618 ;; Size of pushxf using integer instructions is 3+3*memory operand size
2619 ;; Pushing using integer instructions is longer except for constants
2620 ;; and direct memory references (assuming that any given constant is pushed
2621 ;; only once, but this ought to be handled elsewhere).
2623 (define_insn "*pushxf_nointeger"
2624 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2625 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2626 "optimize_function_for_size_p (cfun)"
2628 /* This insn should be already split before reg-stack. */
2631 [(set_attr "type" "multi")
2632 (set_attr "unit" "i387,*,*")
2633 (set_attr "mode" "XF,SI,SI")])
2636 [(set (match_operand:XF 0 "push_operand" "")
2637 (match_operand:XF 1 "fp_register_operand" ""))]
2639 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
2640 (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
2641 "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
2644 [(set (match_operand:XF 0 "push_operand" "")
2645 (match_operand:XF 1 "general_operand" ""))]
2647 && !FP_REG_P (operands[1])"
2649 "ix86_split_long_move (operands); DONE;")
2651 (define_insn "*pushdf"
2652 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2653 (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
2654 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2656 /* This insn should be already split before reg-stack. */
2659 [(set_attr "type" "multi")
2660 (set_attr "unit" "i387,*,*")
2661 (set_attr "mode" "DF,SI,DF")])
2663 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2664 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2665 ;; On the average, pushdf using integers can be still shorter. Allow this
2666 ;; pattern for optimize_size too.
2668 (define_insn "*pushdf_nointeger"
2669 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2670 (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
2671 "!(TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES)"
2673 /* This insn should be already split before reg-stack. */
2676 [(set_attr "type" "multi")
2677 (set_attr "unit" "i387,*,*,*")
2678 (set_attr "mode" "DF,SI,SI,DF")])
2680 ;; %%% Kill this when call knows how to work this out.
2682 [(set (match_operand:DF 0 "push_operand" "")
2683 (match_operand:DF 1 "any_fp_register_operand" ""))]
2685 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
2686 (set (mem:DF (reg:P SP_REG)) (match_dup 1))])
2689 [(set (match_operand:DF 0 "push_operand" "")
2690 (match_operand:DF 1 "general_operand" ""))]
2692 && !ANY_FP_REG_P (operands[1])"
2694 "ix86_split_long_move (operands); DONE;")
2696 (define_insn "*pushsf_rex64"
2697 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2698 (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
2701 /* Anything else should be already split before reg-stack. */
2702 gcc_assert (which_alternative == 1);
2703 return "push{q}\t%q1";
2705 [(set_attr "type" "multi,push,multi")
2706 (set_attr "unit" "i387,*,*")
2707 (set_attr "mode" "SF,DI,SF")])
2709 (define_insn "*pushsf"
2710 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2711 (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
2714 /* Anything else should be already split before reg-stack. */
2715 gcc_assert (which_alternative == 1);
2716 return "push{l}\t%1";
2718 [(set_attr "type" "multi,push,multi")
2719 (set_attr "unit" "i387,*,*")
2720 (set_attr "mode" "SF,SI,SF")])
2723 [(set (match_operand:SF 0 "push_operand" "")
2724 (match_operand:SF 1 "memory_operand" ""))]
2726 && MEM_P (operands[1])
2727 && (operands[2] = find_constant_src (insn))"
2731 ;; %%% Kill this when call knows how to work this out.
2733 [(set (match_operand:SF 0 "push_operand" "")
2734 (match_operand:SF 1 "any_fp_register_operand" ""))]
2736 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
2737 (set (mem:SF (reg:P SP_REG)) (match_dup 1))]
2738 "operands[2] = GEN_INT (-GET_MODE_SIZE (<MODE>mode));")
2740 ;; Floating point move instructions.
2742 (define_expand "movtf"
2743 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2744 (match_operand:TF 1 "nonimmediate_operand" ""))]
2747 ix86_expand_move (TFmode, operands);
2751 (define_expand "mov<mode>"
2752 [(set (match_operand:X87MODEF 0 "nonimmediate_operand" "")
2753 (match_operand:X87MODEF 1 "general_operand" ""))]
2755 "ix86_expand_move (<MODE>mode, operands); DONE;")
2757 (define_insn "*movtf_internal"
2758 [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
2759 (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
2761 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2763 switch (which_alternative)
2767 if (get_attr_mode (insn) == MODE_V4SF)
2768 return "%vmovaps\t{%1, %0|%0, %1}";
2770 return "%vmovdqa\t{%1, %0|%0, %1}";
2772 if (get_attr_mode (insn) == MODE_V4SF)
2773 return "%vxorps\t%0, %d0";
2775 return "%vpxor\t%0, %d0";
2783 [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
2784 (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
2786 (cond [(eq_attr "alternative" "0,2")
2788 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2790 (const_string "V4SF")
2791 (const_string "TI"))
2792 (eq_attr "alternative" "1")
2794 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2796 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2798 (const_string "V4SF")
2799 (const_string "TI"))]
2800 (const_string "DI")))])
2803 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2804 (match_operand:TF 1 "general_operand" ""))]
2806 && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
2808 "ix86_split_long_move (operands); DONE;")
2810 (define_insn "*movxf_internal"
2811 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
2812 (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
2813 "optimize_function_for_speed_p (cfun)
2814 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2815 && (reload_in_progress || reload_completed
2816 || GET_CODE (operands[1]) != CONST_DOUBLE
2817 || memory_operand (operands[0], XFmode))"
2819 switch (which_alternative)
2823 return output_387_reg_move (insn, operands);
2826 return standard_80387_constant_opcode (operands[1]);
2835 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2836 (set_attr "mode" "XF,XF,XF,SI,SI")])
2838 ;; Do not use integer registers when optimizing for size
2839 (define_insn "*movxf_internal_nointeger"
2840 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2841 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2842 "optimize_function_for_size_p (cfun)
2843 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2844 && (reload_in_progress || reload_completed
2845 || standard_80387_constant_p (operands[1])
2846 || GET_CODE (operands[1]) != CONST_DOUBLE
2847 || memory_operand (operands[0], XFmode))"
2849 switch (which_alternative)
2853 return output_387_reg_move (insn, operands);
2856 return standard_80387_constant_opcode (operands[1]);
2864 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2865 (set_attr "mode" "XF,XF,XF,SI,SI")])
2868 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2869 (match_operand:XF 1 "general_operand" ""))]
2871 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2872 && ! (FP_REG_P (operands[0]) ||
2873 (GET_CODE (operands[0]) == SUBREG
2874 && FP_REG_P (SUBREG_REG (operands[0]))))
2875 && ! (FP_REG_P (operands[1]) ||
2876 (GET_CODE (operands[1]) == SUBREG
2877 && FP_REG_P (SUBREG_REG (operands[1]))))"
2879 "ix86_split_long_move (operands); DONE;")
2881 (define_insn "*movdf_internal_rex64"
2882 [(set (match_operand:DF 0 "nonimmediate_operand"
2883 "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
2884 (match_operand:DF 1 "general_operand"
2885 "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
2886 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2887 && (reload_in_progress || reload_completed
2888 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2889 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
2890 && optimize_function_for_size_p (cfun)
2891 && standard_80387_constant_p (operands[1]))
2892 || GET_CODE (operands[1]) != CONST_DOUBLE
2893 || memory_operand (operands[0], DFmode))"
2895 switch (which_alternative)
2899 return output_387_reg_move (insn, operands);
2902 return standard_80387_constant_opcode (operands[1]);
2909 switch (get_attr_mode (insn))
2912 return "%vxorps\t%0, %d0";
2914 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2915 return "%vxorps\t%0, %d0";
2917 return "%vxorpd\t%0, %d0";
2919 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2920 return "%vxorps\t%0, %d0";
2922 return "%vpxor\t%0, %d0";
2929 switch (get_attr_mode (insn))
2932 return "%vmovaps\t{%1, %0|%0, %1}";
2934 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2935 return "%vmovaps\t{%1, %0|%0, %1}";
2937 return "%vmovapd\t{%1, %0|%0, %1}";
2939 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
2940 return "%vmovaps\t{%1, %0|%0, %1}";
2942 return "%vmovdqa\t{%1, %0|%0, %1}";
2944 return "%vmovq\t{%1, %0|%0, %1}";
2948 if (REG_P (operands[0]) && REG_P (operands[1]))
2949 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
2951 return "vmovsd\t{%1, %0|%0, %1}";
2954 return "movsd\t{%1, %0|%0, %1}";
2956 return "%vmovlpd\t{%1, %d0|%d0, %1}";
2958 return "%vmovlps\t{%1, %d0|%d0, %1}";
2965 return "%vmovd\t{%1, %0|%0, %1}";
2971 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
2972 (set (attr "prefix")
2973 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
2974 (const_string "orig")
2975 (const_string "maybe_vex")))
2976 (set (attr "prefix_data16")
2977 (if_then_else (eq_attr "mode" "V1DF")
2979 (const_string "*")))
2981 (cond [(eq_attr "alternative" "0,1,2")
2983 (eq_attr "alternative" "3,4,9,10")
2986 /* For SSE1, we have many fewer alternatives. */
2987 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2988 (cond [(eq_attr "alternative" "5,6")
2989 (const_string "V4SF")
2991 (const_string "V2SF"))
2993 /* xorps is one byte shorter. */
2994 (eq_attr "alternative" "5")
2995 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
2997 (const_string "V4SF")
2998 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3002 (const_string "V2DF"))
3004 /* For architectures resolving dependencies on
3005 whole SSE registers use APD move to break dependency
3006 chains, otherwise use short move to avoid extra work.
3008 movaps encodes one byte shorter. */
3009 (eq_attr "alternative" "6")
3011 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3013 (const_string "V4SF")
3014 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3016 (const_string "V2DF")
3018 (const_string "DF"))
3019 /* For architectures resolving dependencies on register
3020 parts we may avoid extra work to zero out upper part
3022 (eq_attr "alternative" "7")
3024 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3026 (const_string "V1DF")
3027 (const_string "DF"))
3029 (const_string "DF")))])
3031 (define_insn "*movdf_internal"
3032 [(set (match_operand:DF 0 "nonimmediate_operand"
3033 "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
3034 (match_operand:DF 1 "general_operand"
3035 "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
3036 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3037 && optimize_function_for_speed_p (cfun)
3038 && TARGET_INTEGER_DFMODE_MOVES
3039 && (reload_in_progress || reload_completed
3040 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3041 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3042 && optimize_function_for_size_p (cfun)
3043 && standard_80387_constant_p (operands[1]))
3044 || GET_CODE (operands[1]) != CONST_DOUBLE
3045 || memory_operand (operands[0], DFmode))"
3047 switch (which_alternative)
3051 return output_387_reg_move (insn, operands);
3054 return standard_80387_constant_opcode (operands[1]);
3061 switch (get_attr_mode (insn))
3064 return "xorps\t%0, %0";
3066 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3067 return "xorps\t%0, %0";
3069 return "xorpd\t%0, %0";
3071 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3072 return "xorps\t%0, %0";
3074 return "pxor\t%0, %0";
3081 switch (get_attr_mode (insn))
3084 return "movaps\t{%1, %0|%0, %1}";
3086 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3087 return "movaps\t{%1, %0|%0, %1}";
3089 return "movapd\t{%1, %0|%0, %1}";
3091 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3092 return "movaps\t{%1, %0|%0, %1}";
3094 return "movdqa\t{%1, %0|%0, %1}";
3096 return "movq\t{%1, %0|%0, %1}";
3098 return "movsd\t{%1, %0|%0, %1}";
3100 return "movlpd\t{%1, %0|%0, %1}";
3102 return "movlps\t{%1, %0|%0, %1}";
3111 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3112 (set (attr "prefix_data16")
3113 (if_then_else (eq_attr "mode" "V1DF")
3115 (const_string "*")))
3117 (cond [(eq_attr "alternative" "0,1,2")
3119 (eq_attr "alternative" "3,4")
3122 /* For SSE1, we have many fewer alternatives. */
3123 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3124 (cond [(eq_attr "alternative" "5,6")
3125 (const_string "V4SF")
3127 (const_string "V2SF"))
3129 /* xorps is one byte shorter. */
3130 (eq_attr "alternative" "5")
3131 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3133 (const_string "V4SF")
3134 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3138 (const_string "V2DF"))
3140 /* For architectures resolving dependencies on
3141 whole SSE registers use APD move to break dependency
3142 chains, otherwise use short move to avoid extra work.
3144 movaps encodes one byte shorter. */
3145 (eq_attr "alternative" "6")
3147 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3149 (const_string "V4SF")
3150 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3152 (const_string "V2DF")
3154 (const_string "DF"))
3155 /* For architectures resolving dependencies on register
3156 parts we may avoid extra work to zero out upper part
3158 (eq_attr "alternative" "7")
3160 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3162 (const_string "V1DF")
3163 (const_string "DF"))
3165 (const_string "DF")))])
3167 ;; Moving is usually shorter when only FP registers are used. This separate
3168 ;; movdf pattern avoids the use of integer registers for FP operations
3169 ;; when optimizing for size.
3171 (define_insn "*movdf_internal_nointeger"
3172 [(set (match_operand:DF 0 "nonimmediate_operand"
3173 "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
3174 (match_operand:DF 1 "general_operand"
3175 "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
3176 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3177 && ((optimize_function_for_size_p (cfun)
3178 || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
3179 && (reload_in_progress || reload_completed
3180 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3181 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3182 && optimize_function_for_size_p (cfun)
3183 && !memory_operand (operands[0], DFmode)
3184 && standard_80387_constant_p (operands[1]))
3185 || GET_CODE (operands[1]) != CONST_DOUBLE
3186 || ((optimize_function_for_size_p (cfun)
3187 || !TARGET_MEMORY_MISMATCH_STALL
3188 || reload_in_progress || reload_completed)
3189 && memory_operand (operands[0], DFmode)))"
3191 switch (which_alternative)
3195 return output_387_reg_move (insn, operands);
3198 return standard_80387_constant_opcode (operands[1]);
3205 switch (get_attr_mode (insn))
3208 return "%vxorps\t%0, %d0";
3210 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3211 return "%vxorps\t%0, %d0";
3213 return "%vxorpd\t%0, %d0";
3215 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3216 return "%vxorps\t%0, %d0";
3218 return "%vpxor\t%0, %d0";
3225 switch (get_attr_mode (insn))
3228 return "%vmovaps\t{%1, %0|%0, %1}";
3230 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3231 return "%vmovaps\t{%1, %0|%0, %1}";
3233 return "%vmovapd\t{%1, %0|%0, %1}";
3235 if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL)
3236 return "%vmovaps\t{%1, %0|%0, %1}";
3238 return "%vmovdqa\t{%1, %0|%0, %1}";
3240 return "%vmovq\t{%1, %0|%0, %1}";
3244 if (REG_P (operands[0]) && REG_P (operands[1]))
3245 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3247 return "vmovsd\t{%1, %0|%0, %1}";
3250 return "movsd\t{%1, %0|%0, %1}";
3254 if (REG_P (operands[0]))
3255 return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
3257 return "vmovlpd\t{%1, %0|%0, %1}";
3260 return "movlpd\t{%1, %0|%0, %1}";
3264 if (REG_P (operands[0]))
3265 return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
3267 return "vmovlps\t{%1, %0|%0, %1}";
3270 return "movlps\t{%1, %0|%0, %1}";
3279 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3280 (set (attr "prefix")
3281 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3282 (const_string "orig")
3283 (const_string "maybe_vex")))
3284 (set (attr "prefix_data16")
3285 (if_then_else (eq_attr "mode" "V1DF")
3287 (const_string "*")))
3289 (cond [(eq_attr "alternative" "0,1,2")
3291 (eq_attr "alternative" "3,4")
3294 /* For SSE1, we have many fewer alternatives. */
3295 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3296 (cond [(eq_attr "alternative" "5,6")
3297 (const_string "V4SF")
3299 (const_string "V2SF"))
3301 /* xorps is one byte shorter. */
3302 (eq_attr "alternative" "5")
3303 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3305 (const_string "V4SF")
3306 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3310 (const_string "V2DF"))
3312 /* For architectures resolving dependencies on
3313 whole SSE registers use APD move to break dependency
3314 chains, otherwise use short move to avoid extra work.
3316 movaps encodes one byte shorter. */
3317 (eq_attr "alternative" "6")
3319 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3321 (const_string "V4SF")
3322 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3324 (const_string "V2DF")
3326 (const_string "DF"))
3327 /* For architectures resolving dependencies on register
3328 parts we may avoid extra work to zero out upper part
3330 (eq_attr "alternative" "7")
3332 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3334 (const_string "V1DF")
3335 (const_string "DF"))
3337 (const_string "DF")))])
3340 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3341 (match_operand:DF 1 "general_operand" ""))]
3343 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3344 && ! (ANY_FP_REG_P (operands[0]) ||
3345 (GET_CODE (operands[0]) == SUBREG
3346 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3347 && ! (ANY_FP_REG_P (operands[1]) ||
3348 (GET_CODE (operands[1]) == SUBREG
3349 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3351 "ix86_split_long_move (operands); DONE;")
3353 (define_insn "*movsf_internal"
3354 [(set (match_operand:SF 0 "nonimmediate_operand"
3355 "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
3356 (match_operand:SF 1 "general_operand"
3357 "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
3358 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3359 && (reload_in_progress || reload_completed
3360 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3361 || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
3362 && standard_80387_constant_p (operands[1]))
3363 || GET_CODE (operands[1]) != CONST_DOUBLE
3364 || memory_operand (operands[0], SFmode))"
3366 switch (which_alternative)
3370 return output_387_reg_move (insn, operands);
3373 return standard_80387_constant_opcode (operands[1]);
3377 return "mov{l}\t{%1, %0|%0, %1}";
3379 if (get_attr_mode (insn) == MODE_TI)
3380 return "%vpxor\t%0, %d0";
3382 return "%vxorps\t%0, %d0";
3384 if (get_attr_mode (insn) == MODE_V4SF)
3385 return "%vmovaps\t{%1, %0|%0, %1}";
3387 return "%vmovss\t{%1, %d0|%d0, %1}";
3390 return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
3391 : "vmovss\t{%1, %0|%0, %1}";
3393 return "movss\t{%1, %0|%0, %1}";
3395 return "%vmovss\t{%1, %0|%0, %1}";
3397 case 9: case 10: case 14: case 15:
3398 return "movd\t{%1, %0|%0, %1}";
3400 return "%vmovd\t{%1, %0|%0, %1}";
3403 return "movq\t{%1, %0|%0, %1}";
3409 [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
3410 (set (attr "prefix")
3411 (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
3412 (const_string "maybe_vex")
3413 (const_string "orig")))
3415 (cond [(eq_attr "alternative" "3,4,9,10")
3417 (eq_attr "alternative" "5")
3419 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3421 (ne (symbol_ref "TARGET_SSE2")
3423 (eq (symbol_ref "optimize_function_for_size_p (cfun)")
3426 (const_string "V4SF"))
3427 /* For architectures resolving dependencies on
3428 whole SSE registers use APS move to break dependency
3429 chains, otherwise use short move to avoid extra work.
3431 Do the same for architectures resolving dependencies on
3432 the parts. While in DF mode it is better to always handle
3433 just register parts, the SF mode is different due to lack
3434 of instructions to load just part of the register. It is
3435 better to maintain the whole registers in single format
3436 to avoid problems on using packed logical operations. */
3437 (eq_attr "alternative" "6")
3439 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3441 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3443 (const_string "V4SF")
3444 (const_string "SF"))
3445 (eq_attr "alternative" "11")
3446 (const_string "DI")]
3447 (const_string "SF")))])
3450 [(set (match_operand 0 "register_operand" "")
3451 (match_operand 1 "memory_operand" ""))]
3453 && MEM_P (operands[1])
3454 && (GET_MODE (operands[0]) == TFmode
3455 || GET_MODE (operands[0]) == XFmode
3456 || GET_MODE (operands[0]) == DFmode
3457 || GET_MODE (operands[0]) == SFmode)
3458 && (operands[2] = find_constant_src (insn))"
3459 [(set (match_dup 0) (match_dup 2))]
3461 rtx c = operands[2];
3462 rtx r = operands[0];
3464 if (GET_CODE (r) == SUBREG)
3469 if (!standard_sse_constant_p (c))
3472 else if (FP_REG_P (r))
3474 if (!standard_80387_constant_p (c))
3477 else if (MMX_REG_P (r))
3482 [(set (match_operand 0 "register_operand" "")
3483 (float_extend (match_operand 1 "memory_operand" "")))]
3485 && MEM_P (operands[1])
3486 && (GET_MODE (operands[0]) == TFmode
3487 || GET_MODE (operands[0]) == XFmode
3488 || GET_MODE (operands[0]) == DFmode
3489 || GET_MODE (operands[0]) == SFmode)
3490 && (operands[2] = find_constant_src (insn))"
3491 [(set (match_dup 0) (match_dup 2))]
3493 rtx c = operands[2];
3494 rtx r = operands[0];
3496 if (GET_CODE (r) == SUBREG)
3501 if (!standard_sse_constant_p (c))
3504 else if (FP_REG_P (r))
3506 if (!standard_80387_constant_p (c))
3509 else if (MMX_REG_P (r))
3513 ;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
3515 [(set (match_operand:X87MODEF 0 "register_operand" "")
3516 (match_operand:X87MODEF 1 "immediate_operand" ""))]
3517 "reload_completed && FP_REGNO_P (REGNO (operands[0]))
3518 && (standard_80387_constant_p (operands[1]) == 8
3519 || standard_80387_constant_p (operands[1]) == 9)"
3520 [(set (match_dup 0)(match_dup 1))
3522 (neg:X87MODEF (match_dup 0)))]
3526 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
3527 if (real_isnegzero (&r))
3528 operands[1] = CONST0_RTX (<MODE>mode);
3530 operands[1] = CONST1_RTX (<MODE>mode);
3533 (define_insn "swapxf"
3534 [(set (match_operand:XF 0 "register_operand" "+f")
3535 (match_operand:XF 1 "register_operand" "+f"))
3540 if (STACK_TOP_P (operands[0]))
3545 [(set_attr "type" "fxch")
3546 (set_attr "mode" "XF")])
3548 (define_insn "*swap<mode>"
3549 [(set (match_operand:MODEF 0 "fp_register_operand" "+f")
3550 (match_operand:MODEF 1 "fp_register_operand" "+f"))
3553 "TARGET_80387 || reload_completed"
3555 if (STACK_TOP_P (operands[0]))
3560 [(set_attr "type" "fxch")
3561 (set_attr "mode" "<MODE>")])
3563 ;; Zero extension instructions
3565 (define_expand "zero_extendsidi2"
3566 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3567 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
3572 emit_insn (gen_zero_extendsidi2_1 (operands[0], operands[1]));
3577 (define_insn "*zero_extendsidi2_rex64"
3578 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,?*Ym,?*y,?*Yi,*Y2")
3580 (match_operand:SI 1 "nonimmediate_operand" "rm,0,r ,m ,r ,m")))]
3583 mov\t{%k1, %k0|%k0, %k1}
3585 movd\t{%1, %0|%0, %1}
3586 movd\t{%1, %0|%0, %1}
3587 %vmovd\t{%1, %0|%0, %1}
3588 %vmovd\t{%1, %0|%0, %1}"
3589 [(set_attr "type" "imovx,imov,mmxmov,mmxmov,ssemov,ssemov")
3590 (set_attr "prefix" "orig,*,orig,orig,maybe_vex,maybe_vex")
3591 (set_attr "prefix_0f" "0,*,*,*,*,*")
3592 (set_attr "mode" "SI,DI,DI,DI,TI,TI")])
3595 [(set (match_operand:DI 0 "memory_operand" "")
3596 (zero_extend:DI (match_dup 0)))]
3598 [(set (match_dup 4) (const_int 0))]
3599 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3601 ;; %%% Kill me once multi-word ops are sane.
3602 (define_insn "zero_extendsidi2_1"
3603 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?*y,?*Yi,*Y2")
3605 (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r ,m ,r ,m")))
3606 (clobber (reg:CC FLAGS_REG))]
3612 movd\t{%1, %0|%0, %1}
3613 movd\t{%1, %0|%0, %1}
3614 %vmovd\t{%1, %0|%0, %1}
3615 %vmovd\t{%1, %0|%0, %1}"
3616 [(set_attr "type" "multi,multi,multi,mmxmov,mmxmov,ssemov,ssemov")
3617 (set_attr "prefix" "*,*,*,orig,orig,maybe_vex,maybe_vex")
3618 (set_attr "mode" "SI,SI,SI,DI,DI,TI,TI")])
3621 [(set (match_operand:DI 0 "register_operand" "")
3622 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3623 (clobber (reg:CC FLAGS_REG))]
3624 "!TARGET_64BIT && reload_completed
3625 && true_regnum (operands[0]) == true_regnum (operands[1])"
3626 [(set (match_dup 4) (const_int 0))]
3627 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3630 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3631 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3632 (clobber (reg:CC FLAGS_REG))]
3633 "!TARGET_64BIT && reload_completed
3634 && !(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))"
3635 [(set (match_dup 3) (match_dup 1))
3636 (set (match_dup 4) (const_int 0))]
3637 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3639 (define_insn "zero_extend<mode>di2"
3640 [(set (match_operand:DI 0 "register_operand" "=r")
3642 (match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))]
3644 "movz{<imodesuffix>l|x}\t{%1, %k0|%k0, %1}"
3645 [(set_attr "type" "imovx")
3646 (set_attr "mode" "SI")])
3648 (define_expand "zero_extendhisi2"
3649 [(set (match_operand:SI 0 "register_operand" "")
3650 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3653 if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3655 operands[1] = force_reg (HImode, operands[1]);
3656 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
3661 (define_insn_and_split "zero_extendhisi2_and"
3662 [(set (match_operand:SI 0 "register_operand" "=r")
3663 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
3664 (clobber (reg:CC FLAGS_REG))]
3665 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3667 "&& reload_completed"
3668 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
3669 (clobber (reg:CC FLAGS_REG))])]
3671 [(set_attr "type" "alu1")
3672 (set_attr "mode" "SI")])
3674 (define_insn "*zero_extendhisi2_movzwl"
3675 [(set (match_operand:SI 0 "register_operand" "=r")
3676 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3677 "!TARGET_ZERO_EXTEND_WITH_AND
3678 || optimize_function_for_size_p (cfun)"
3679 "movz{wl|x}\t{%1, %0|%0, %1}"
3680 [(set_attr "type" "imovx")
3681 (set_attr "mode" "SI")])
3683 (define_expand "zero_extendqi<mode>2"
3685 [(set (match_operand:SWI24 0 "register_operand" "")
3686 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3687 (clobber (reg:CC FLAGS_REG))])])
3689 (define_insn "*zero_extendqi<mode>2_and"
3690 [(set (match_operand:SWI24 0 "register_operand" "=r,?&q")
3691 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3692 (clobber (reg:CC FLAGS_REG))]
3693 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3695 [(set_attr "type" "alu1")
3696 (set_attr "mode" "<MODE>")])
3698 ;; When source and destination does not overlap, clear destination
3699 ;; first and then do the movb
3701 [(set (match_operand:SWI24 0 "register_operand" "")
3702 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3703 (clobber (reg:CC FLAGS_REG))]
3705 && (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3706 && ANY_QI_REG_P (operands[0])
3707 && (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]))
3708 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3709 [(set (strict_low_part (match_dup 2)) (match_dup 1))]
3711 operands[2] = gen_lowpart (QImode, operands[0]);
3712 ix86_expand_clear (operands[0]);
3715 (define_insn "*zero_extendqi<mode>2_movzbl_and"
3716 [(set (match_operand:SWI24 0 "register_operand" "=r,r")
3717 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3718 (clobber (reg:CC FLAGS_REG))]
3719 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun)"
3721 [(set_attr "type" "imovx,alu1")
3722 (set_attr "mode" "<MODE>")])
3724 ;; For the movzbl case strip only the clobber
3726 [(set (match_operand:SWI24 0 "register_operand" "")
3727 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "")))
3728 (clobber (reg:CC FLAGS_REG))]
3730 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))
3731 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3733 (zero_extend:SWI24 (match_dup 1)))])
3735 ; zero extend to SImode to avoid partial register stalls
3736 (define_insn "*zero_extendqi<mode>2_movzbl"
3737 [(set (match_operand:SWI24 0 "register_operand" "=r")
3738 (zero_extend:SWI24 (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3740 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))"
3741 "movz{bl|x}\t{%1, %k0|%k0, %1}"
3742 [(set_attr "type" "imovx")
3743 (set_attr "mode" "SI")])
3745 ;; Rest is handled by single and.
3747 [(set (match_operand:SWI24 0 "register_operand" "")
3748 (zero_extend:SWI24 (match_operand:QI 1 "register_operand" "")))
3749 (clobber (reg:CC FLAGS_REG))]
3751 && true_regnum (operands[0]) == true_regnum (operands[1])"
3752 [(parallel [(set (match_dup 0) (and:SWI24 (match_dup 0) (const_int 255)))
3753 (clobber (reg:CC FLAGS_REG))])])
3755 ;; Sign extension instructions
3757 (define_expand "extendsidi2"
3758 [(set (match_operand:DI 0 "register_operand" "")
3759 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))]
3764 emit_insn (gen_extendsidi2_1 (operands[0], operands[1]));
3769 (define_insn "*extendsidi2_rex64"
3770 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3771 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3775 movs{lq|x}\t{%1, %0|%0, %1}"
3776 [(set_attr "type" "imovx")
3777 (set_attr "mode" "DI")
3778 (set_attr "prefix_0f" "0")
3779 (set_attr "modrm" "0,1")])
3781 (define_insn "extendsidi2_1"
3782 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3783 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3784 (clobber (reg:CC FLAGS_REG))
3785 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3789 ;; Extend to memory case when source register does die.
3791 [(set (match_operand:DI 0 "memory_operand" "")
3792 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3793 (clobber (reg:CC FLAGS_REG))
3794 (clobber (match_operand:SI 2 "register_operand" ""))]
3796 && dead_or_set_p (insn, operands[1])
3797 && !reg_mentioned_p (operands[1], operands[0]))"
3798 [(set (match_dup 3) (match_dup 1))
3799 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3800 (clobber (reg:CC FLAGS_REG))])
3801 (set (match_dup 4) (match_dup 1))]
3802 "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
3804 ;; Extend to memory case when source register does not die.
3806 [(set (match_operand:DI 0 "memory_operand" "")
3807 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3808 (clobber (reg:CC FLAGS_REG))
3809 (clobber (match_operand:SI 2 "register_operand" ""))]
3813 split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);
3815 emit_move_insn (operands[3], operands[1]);
3817 /* Generate a cltd if possible and doing so it profitable. */
3818 if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)
3819 && true_regnum (operands[1]) == AX_REG
3820 && true_regnum (operands[2]) == DX_REG)
3822 emit_insn (gen_ashrsi3_cvt (operands[2], operands[1], GEN_INT (31)));
3826 emit_move_insn (operands[2], operands[1]);
3827 emit_insn (gen_ashrsi3_cvt (operands[2], operands[2], GEN_INT (31)));
3829 emit_move_insn (operands[4], operands[2]);
3833 ;; Extend to register case. Optimize case where source and destination
3834 ;; registers match and cases where we can use cltd.
3836 [(set (match_operand:DI 0 "register_operand" "")
3837 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3838 (clobber (reg:CC FLAGS_REG))
3839 (clobber (match_scratch:SI 2 ""))]
3843 split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);
3845 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3846 emit_move_insn (operands[3], operands[1]);
3848 /* Generate a cltd if possible and doing so it profitable. */
3849 if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)
3850 && true_regnum (operands[3]) == AX_REG
3851 && true_regnum (operands[4]) == DX_REG)
3853 emit_insn (gen_ashrsi3_cvt (operands[4], operands[3], GEN_INT (31)));
3857 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3858 emit_move_insn (operands[4], operands[1]);
3860 emit_insn (gen_ashrsi3_cvt (operands[4], operands[4], GEN_INT (31)));
3864 (define_insn "extend<mode>di2"
3865 [(set (match_operand:DI 0 "register_operand" "=r")
3867 (match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))]
3869 "movs{<imodesuffix>q|x}\t{%1, %0|%0, %1}"
3870 [(set_attr "type" "imovx")
3871 (set_attr "mode" "DI")])
3873 (define_insn "extendhisi2"
3874 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3875 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3878 switch (get_attr_prefix_0f (insn))
3881 return "{cwtl|cwde}";
3883 return "movs{wl|x}\t{%1, %0|%0, %1}";
3886 [(set_attr "type" "imovx")
3887 (set_attr "mode" "SI")
3888 (set (attr "prefix_0f")
3889 ;; movsx is short decodable while cwtl is vector decoded.
3890 (if_then_else (and (eq_attr "cpu" "!k6")
3891 (eq_attr "alternative" "0"))
3893 (const_string "1")))
3895 (if_then_else (eq_attr "prefix_0f" "0")
3897 (const_string "1")))])
3899 (define_insn "*extendhisi2_zext"
3900 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3903 (match_operand:HI 1 "nonimmediate_operand" "*0,rm"))))]
3906 switch (get_attr_prefix_0f (insn))