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).
66 [; Relocation specifiers
77 (UNSPEC_MACHOPIC_OFFSET 10)
80 (UNSPEC_STACK_ALLOC 11)
82 (UNSPEC_SSE_PROLOGUE_SAVE 13)
86 (UNSPEC_SET_GOT_OFFSET 17)
87 (UNSPEC_MEMORY_BLOCKAGE 18)
92 (UNSPEC_TLS_LD_BASE 22)
95 ; Other random patterns
100 (UNSPEC_ADD_CARRY 34)
103 (UNSPEC_LD_MPIC 38) ; load_macho_picbase
104 (UNSPEC_TRUNC_NOOP 39)
106 ; For SSE/MMX support:
107 (UNSPEC_FIX_NOTRUNC 40)
124 (UNSPEC_MS_TO_SYSV_CALL 48)
126 ; Generic math support
128 (UNSPEC_IEEE_MIN 51) ; not commutative
129 (UNSPEC_IEEE_MAX 52) ; not commutative
144 (UNSPEC_FRNDINT_FLOOR 70)
145 (UNSPEC_FRNDINT_CEIL 71)
146 (UNSPEC_FRNDINT_TRUNC 72)
147 (UNSPEC_FRNDINT_MASK_PM 73)
148 (UNSPEC_FIST_FLOOR 74)
149 (UNSPEC_FIST_CEIL 75)
151 ; x87 Double output FP
152 (UNSPEC_SINCOS_COS 80)
153 (UNSPEC_SINCOS_SIN 81)
154 (UNSPEC_XTRACT_FRACT 84)
155 (UNSPEC_XTRACT_EXP 85)
156 (UNSPEC_FSCALE_FRACT 86)
157 (UNSPEC_FSCALE_EXP 87)
169 (UNSPEC_SP_TLS_SET 102)
170 (UNSPEC_SP_TLS_TEST 103)
180 (UNSPEC_INSERTQI 132)
185 (UNSPEC_INSERTPS 135)
187 (UNSPEC_MOVNTDQA 137)
189 (UNSPEC_PHMINPOSUW 139)
195 (UNSPEC_PCMPESTR 144)
196 (UNSPEC_PCMPISTR 145)
199 (UNSPEC_FMA4_INTRINSIC 150)
200 (UNSPEC_FMA4_FMADDSUB 151)
201 (UNSPEC_FMA4_FMSUBADD 152)
202 (UNSPEC_XOP_UNSIGNED_CMP 151)
203 (UNSPEC_XOP_TRUEFALSE 152)
204 (UNSPEC_XOP_PERMUTE 153)
209 (UNSPEC_AESENCLAST 160)
211 (UNSPEC_AESDECLAST 162)
213 (UNSPEC_AESKEYGENASSIST 164)
221 (UNSPEC_VPERMIL2 168)
222 (UNSPEC_VPERMIL2F128 169)
223 (UNSPEC_MASKLOAD 170)
224 (UNSPEC_MASKSTORE 171)
230 [(UNSPECV_BLOCKAGE 0)
231 (UNSPECV_STACK_PROBE 1)
243 (UNSPECV_PROLOGUE_USE 14)
245 (UNSPECV_VZEROALL 16)
246 (UNSPECV_VZEROUPPER 17)
250 (UNSPECV_VSWAPMOV 21)
251 (UNSPECV_LLWP_INTRINSIC 22)
252 (UNSPECV_SLWP_INTRINSIC 23)
253 (UNSPECV_LWPVAL_INTRINSIC 24)
254 (UNSPECV_LWPINS_INTRINSIC 25)
257 ;; Constants to represent pcomtrue/pcomfalse variants
267 ;; Constants used in the XOP pperm instruction
269 [(PPERM_SRC 0x00) /* copy source */
270 (PPERM_INVERT 0x20) /* invert source */
271 (PPERM_REVERSE 0x40) /* bit reverse source */
272 (PPERM_REV_INV 0x60) /* bit reverse & invert src */
273 (PPERM_ZERO 0x80) /* all 0's */
274 (PPERM_ONES 0xa0) /* all 1's */
275 (PPERM_SIGN 0xc0) /* propagate sign bit */
276 (PPERM_INV_SIGN 0xe0) /* invert & propagate sign */
277 (PPERM_SRC1 0x00) /* use first source byte */
278 (PPERM_SRC2 0x10) /* use second source byte */
281 ;; Registers by name.
334 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
337 ;; In C guard expressions, put expressions which may be compile-time
338 ;; constants first. This allows for better optimization. For
339 ;; example, write "TARGET_64BIT && reload_completed", not
340 ;; "reload_completed && TARGET_64BIT".
344 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,atom,
346 (const (symbol_ref "ix86_schedule")))
348 ;; A basic instruction type. Refinements due to arguments to be
349 ;; provided in other attributes.
352 alu,alu1,negnot,imov,imovx,lea,
353 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
354 icmp,test,ibr,setcc,icmov,
355 push,pop,call,callv,leave,
357 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
358 sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
359 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
360 ssemuladd,sse4arg,lwp,
361 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
362 (const_string "other"))
364 ;; Main data type used by the insn
366 "unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF"
367 (const_string "unknown"))
369 ;; The CPU unit operations uses.
370 (define_attr "unit" "integer,i387,sse,mmx,unknown"
371 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
372 (const_string "i387")
373 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
374 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
375 ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
377 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
379 (eq_attr "type" "other")
380 (const_string "unknown")]
381 (const_string "integer")))
383 ;; The (bounding maximum) length of an instruction immediate.
384 (define_attr "length_immediate" ""
385 (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
388 (eq_attr "unit" "i387,sse,mmx")
390 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
392 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
393 (eq_attr "type" "imov,test")
394 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
395 (eq_attr "type" "call")
396 (if_then_else (match_operand 0 "constant_call_address_operand" "")
399 (eq_attr "type" "callv")
400 (if_then_else (match_operand 1 "constant_call_address_operand" "")
403 ;; We don't know the size before shorten_branches. Expect
404 ;; the instruction to fit for better scheduling.
405 (eq_attr "type" "ibr")
408 (symbol_ref "/* Update immediate_length and other attributes! */
409 gcc_unreachable (),1")))
411 ;; The (bounding maximum) length of an instruction address.
412 (define_attr "length_address" ""
413 (cond [(eq_attr "type" "str,other,multi,fxch")
415 (and (eq_attr "type" "call")
416 (match_operand 0 "constant_call_address_operand" ""))
418 (and (eq_attr "type" "callv")
419 (match_operand 1 "constant_call_address_operand" ""))
422 (symbol_ref "ix86_attr_length_address_default (insn)")))
424 ;; Set when length prefix is used.
425 (define_attr "prefix_data16" ""
426 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
428 (eq_attr "mode" "HI")
430 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI"))
435 ;; Set when string REP prefix is used.
436 (define_attr "prefix_rep" ""
437 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
439 (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
444 ;; Set when 0f opcode prefix is used.
445 (define_attr "prefix_0f" ""
447 (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
448 (eq_attr "unit" "sse,mmx"))
452 ;; Set when REX opcode prefix is used.
453 (define_attr "prefix_rex" ""
454 (cond [(ne (symbol_ref "!TARGET_64BIT") (const_int 0))
456 (and (eq_attr "mode" "DI")
457 (and (eq_attr "type" "!push,pop,call,callv,leave,ibr")
458 (eq_attr "unit" "!mmx")))
460 (and (eq_attr "mode" "QI")
461 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
464 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
467 (and (eq_attr "type" "imovx")
468 (match_operand:QI 1 "ext_QIreg_operand" ""))
473 ;; There are also additional prefixes in 3DNOW, SSSE3.
474 ;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
475 ;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
476 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
477 (define_attr "prefix_extra" ""
478 (cond [(eq_attr "type" "ssemuladd,sse4arg")
480 (eq_attr "type" "sseiadd1,ssecvt1")
485 ;; Prefix used: original, VEX or maybe VEX.
486 (define_attr "prefix" "orig,vex,maybe_vex"
487 (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
489 (const_string "orig")))
491 ;; VEX W bit is used.
492 (define_attr "prefix_vex_w" "" (const_int 0))
494 ;; The length of VEX prefix
495 ;; Only instructions with 0f prefix can have 2 byte VEX prefix,
496 ;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is
497 ;; still prefix_0f 1, with prefix_extra 1.
498 (define_attr "length_vex" ""
499 (if_then_else (and (eq_attr "prefix_0f" "1")
500 (eq_attr "prefix_extra" "0"))
501 (if_then_else (eq_attr "prefix_vex_w" "1")
502 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
503 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
504 (if_then_else (eq_attr "prefix_vex_w" "1")
505 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
506 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
508 ;; Set when modrm byte is used.
509 (define_attr "modrm" ""
510 (cond [(eq_attr "type" "str,leave")
512 (eq_attr "unit" "i387")
514 (and (eq_attr "type" "incdec")
515 (and (eq (symbol_ref "TARGET_64BIT") (const_int 0))
516 (ior (match_operand:SI 1 "register_operand" "")
517 (match_operand:HI 1 "register_operand" ""))))
519 (and (eq_attr "type" "push")
520 (not (match_operand 1 "memory_operand" "")))
522 (and (eq_attr "type" "pop")
523 (not (match_operand 0 "memory_operand" "")))
525 (and (eq_attr "type" "imov")
526 (and (not (eq_attr "mode" "DI"))
527 (ior (and (match_operand 0 "register_operand" "")
528 (match_operand 1 "immediate_operand" ""))
529 (ior (and (match_operand 0 "ax_reg_operand" "")
530 (match_operand 1 "memory_displacement_only_operand" ""))
531 (and (match_operand 0 "memory_displacement_only_operand" "")
532 (match_operand 1 "ax_reg_operand" ""))))))
534 (and (eq_attr "type" "call")
535 (match_operand 0 "constant_call_address_operand" ""))
537 (and (eq_attr "type" "callv")
538 (match_operand 1 "constant_call_address_operand" ""))
540 (and (eq_attr "type" "alu,alu1,icmp,test")
541 (match_operand 0 "ax_reg_operand" ""))
542 (symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))")
546 ;; The (bounding maximum) length of an instruction in bytes.
547 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
548 ;; Later we may want to split them and compute proper length as for
550 (define_attr "length" ""
551 (cond [(eq_attr "type" "other,multi,fistp,frndint")
553 (eq_attr "type" "fcmp")
555 (eq_attr "unit" "i387")
557 (plus (attr "prefix_data16")
558 (attr "length_address")))
559 (ior (eq_attr "prefix" "vex")
560 (and (eq_attr "prefix" "maybe_vex")
561 (ne (symbol_ref "TARGET_AVX") (const_int 0))))
562 (plus (attr "length_vex")
563 (plus (attr "length_immediate")
565 (attr "length_address"))))]
566 (plus (plus (attr "modrm")
567 (plus (attr "prefix_0f")
568 (plus (attr "prefix_rex")
569 (plus (attr "prefix_extra")
571 (plus (attr "prefix_rep")
572 (plus (attr "prefix_data16")
573 (plus (attr "length_immediate")
574 (attr "length_address")))))))
576 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
577 ;; `store' if there is a simple memory reference therein, or `unknown'
578 ;; if the instruction is complex.
580 (define_attr "memory" "none,load,store,both,unknown"
581 (cond [(eq_attr "type" "other,multi,str,lwp")
582 (const_string "unknown")
583 (eq_attr "type" "lea,fcmov,fpspc")
584 (const_string "none")
585 (eq_attr "type" "fistp,leave")
586 (const_string "both")
587 (eq_attr "type" "frndint")
588 (const_string "load")
589 (eq_attr "type" "push")
590 (if_then_else (match_operand 1 "memory_operand" "")
591 (const_string "both")
592 (const_string "store"))
593 (eq_attr "type" "pop")
594 (if_then_else (match_operand 0 "memory_operand" "")
595 (const_string "both")
596 (const_string "load"))
597 (eq_attr "type" "setcc")
598 (if_then_else (match_operand 0 "memory_operand" "")
599 (const_string "store")
600 (const_string "none"))
601 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
602 (if_then_else (ior (match_operand 0 "memory_operand" "")
603 (match_operand 1 "memory_operand" ""))
604 (const_string "load")
605 (const_string "none"))
606 (eq_attr "type" "ibr")
607 (if_then_else (match_operand 0 "memory_operand" "")
608 (const_string "load")
609 (const_string "none"))
610 (eq_attr "type" "call")
611 (if_then_else (match_operand 0 "constant_call_address_operand" "")
612 (const_string "none")
613 (const_string "load"))
614 (eq_attr "type" "callv")
615 (if_then_else (match_operand 1 "constant_call_address_operand" "")
616 (const_string "none")
617 (const_string "load"))
618 (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
619 (match_operand 1 "memory_operand" ""))
620 (const_string "both")
621 (and (match_operand 0 "memory_operand" "")
622 (match_operand 1 "memory_operand" ""))
623 (const_string "both")
624 (match_operand 0 "memory_operand" "")
625 (const_string "store")
626 (match_operand 1 "memory_operand" "")
627 (const_string "load")
629 "!alu1,negnot,ishift1,
630 imov,imovx,icmp,test,bitmanip,
632 sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
633 sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
634 (match_operand 2 "memory_operand" ""))
635 (const_string "load")
636 (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
637 (match_operand 3 "memory_operand" ""))
638 (const_string "load")
640 (const_string "none")))
642 ;; Indicates if an instruction has both an immediate and a displacement.
644 (define_attr "imm_disp" "false,true,unknown"
645 (cond [(eq_attr "type" "other,multi")
646 (const_string "unknown")
647 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
648 (and (match_operand 0 "memory_displacement_operand" "")
649 (match_operand 1 "immediate_operand" "")))
650 (const_string "true")
651 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
652 (and (match_operand 0 "memory_displacement_operand" "")
653 (match_operand 2 "immediate_operand" "")))
654 (const_string "true")
656 (const_string "false")))
658 ;; Indicates if an FP operation has an integer source.
660 (define_attr "fp_int_src" "false,true"
661 (const_string "false"))
663 ;; Defines rounding mode of an FP operation.
665 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
666 (const_string "any"))
668 ;; Define attribute to classify add/sub insns that consumes carry flag (CF)
669 (define_attr "use_carry" "0,1" (const_string "0"))
671 ;; Define attribute to indicate unaligned ssemov insns
672 (define_attr "movu" "0,1" (const_string "0"))
674 ;; Describe a user's asm statement.
675 (define_asm_attributes
676 [(set_attr "length" "128")
677 (set_attr "type" "multi")])
679 ;; All integer comparison codes.
680 (define_code_iterator int_cond [ne eq ge gt le lt geu gtu leu ltu])
682 ;; All floating-point comparison codes.
683 (define_code_iterator fp_cond [unordered ordered
684 uneq unge ungt unle unlt ltgt])
686 (define_code_iterator plusminus [plus minus])
688 (define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus])
690 ;; Base name for define_insn
691 (define_code_attr plusminus_insn
692 [(plus "add") (ss_plus "ssadd") (us_plus "usadd")
693 (minus "sub") (ss_minus "sssub") (us_minus "ussub")])
695 ;; Base name for insn mnemonic.
696 (define_code_attr plusminus_mnemonic
697 [(plus "add") (ss_plus "adds") (us_plus "addus")
698 (minus "sub") (ss_minus "subs") (us_minus "subus")])
699 (define_code_attr plusminus_carry_mnemonic
700 [(plus "adc") (minus "sbb")])
702 ;; Mark commutative operators as such in constraints.
703 (define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%")
704 (minus "") (ss_minus "") (us_minus "")])
706 ;; Mapping of signed max and min
707 (define_code_iterator smaxmin [smax smin])
709 ;; Mapping of unsigned max and min
710 (define_code_iterator umaxmin [umax umin])
712 ;; Mapping of signed/unsigned max and min
713 (define_code_iterator maxmin [smax smin umax umin])
715 ;; Base name for integer and FP insn mnemonic
716 (define_code_attr maxminiprefix [(smax "maxs") (smin "mins")
717 (umax "maxu") (umin "minu")])
718 (define_code_attr maxminfprefix [(smax "max") (smin "min")])
720 ;; Mapping of logic operators
721 (define_code_iterator any_logic [and ior xor])
722 (define_code_iterator any_or [ior xor])
724 ;; Base name for insn mnemonic.
725 (define_code_attr logicprefix [(and "and") (ior "or") (xor "xor")])
727 ;; Mapping of abs neg operators
728 (define_code_iterator absneg [abs neg])
730 ;; Base name for x87 insn mnemonic.
731 (define_code_attr absnegprefix [(abs "abs") (neg "chs")])
733 ;; Used in signed and unsigned widening multiplications.
734 (define_code_iterator any_extend [sign_extend zero_extend])
736 ;; Various insn prefixes for signed and unsigned operations.
737 (define_code_attr u [(sign_extend "") (zero_extend "u")
738 (div "") (udiv "u")])
739 (define_code_attr s [(sign_extend "s") (zero_extend "u")])
741 ;; Used in signed and unsigned divisions.
742 (define_code_iterator any_div [div udiv])
744 ;; Instruction prefix for signed and unsigned operations.
745 (define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
746 (div "i") (udiv "")])
748 ;; All single word integer modes.
749 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
751 ;; Single word integer modes without DImode.
752 (define_mode_iterator SWI124 [QI HI SI])
754 ;; Single word integer modes without QImode.
755 (define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
757 ;; Single word integer modes without QImode and HImode.
758 (define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")])
760 ;; All math-dependant single and double word integer modes.
761 (define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH")
762 (HI "TARGET_HIMODE_MATH")
763 SI DI (TI "TARGET_64BIT")])
765 ;; Math-dependant single word integer modes.
766 (define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH")
767 (HI "TARGET_HIMODE_MATH")
768 SI (DI "TARGET_64BIT")])
770 ;; Math-dependant single word integer modes without QImode.
771 (define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH")
772 SI (DI "TARGET_64BIT")])
774 ;; Double word integer modes.
775 (define_mode_iterator DWI [(DI "!TARGET_64BIT")
776 (TI "TARGET_64BIT")])
778 ;; Double word integer modes as mode attribute.
779 (define_mode_attr DWI [(SI "DI") (DI "TI")])
780 (define_mode_attr dwi [(SI "di") (DI "ti")])
782 ;; Half mode for double word integer modes.
783 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
784 (DI "TARGET_64BIT")])
786 ;; Instruction suffix for integer modes.
787 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
789 ;; Register class for integer modes.
790 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
792 ;; Immediate operand constraint for integer modes.
793 (define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")])
795 ;; General operand constraint for word modes.
796 (define_mode_attr g [(QI "qmn") (HI "rmn") (SI "g") (DI "rme")])
798 ;; Immediate operand constraint for double integer modes.
799 (define_mode_attr di [(SI "iF") (DI "e")])
801 ;; Immediate operand constraint for shifts.
802 (define_mode_attr S [(QI "I") (HI "I") (SI "I") (DI "J") (TI "O")])
804 ;; General operand predicate for integer modes.
805 (define_mode_attr general_operand
806 [(QI "general_operand")
807 (HI "general_operand")
808 (SI "general_operand")
809 (DI "x86_64_general_operand")
810 (TI "x86_64_general_operand")])
812 ;; General sign/zero extend operand predicate for integer modes.
813 (define_mode_attr general_szext_operand
814 [(QI "general_operand")
815 (HI "general_operand")
816 (SI "general_operand")
817 (DI "x86_64_szext_general_operand")])
819 ;; Operand predicate for shifts.
820 (define_mode_attr shift_operand
821 [(QI "nonimmediate_operand")
822 (HI "nonimmediate_operand")
823 (SI "nonimmediate_operand")
824 (DI "shiftdi_operand")
825 (TI "register_operand")])
827 ;; Operand predicate for shift argument.
828 (define_mode_attr shift_immediate_operand
829 [(QI "const_1_to_31_operand")
830 (HI "const_1_to_31_operand")
831 (SI "const_1_to_31_operand")
832 (DI "const_1_to_63_operand")])
834 ;; Input operand predicate for arithmetic left shifts.
835 (define_mode_attr ashl_input_operand
836 [(QI "nonimmediate_operand")
837 (HI "nonimmediate_operand")
838 (SI "nonimmediate_operand")
839 (DI "ashldi_input_operand")
840 (TI "reg_or_pm1_operand")])
842 ;; SSE and x87 SFmode and DFmode floating point modes
843 (define_mode_iterator MODEF [SF DF])
845 ;; All x87 floating point modes
846 (define_mode_iterator X87MODEF [SF DF XF])
848 ;; All integer modes handled by x87 fisttp operator.
849 (define_mode_iterator X87MODEI [HI SI DI])
851 ;; All integer modes handled by integer x87 operators.
852 (define_mode_iterator X87MODEI12 [HI SI])
854 ;; All integer modes handled by SSE cvtts?2si* operators.
855 (define_mode_iterator SSEMODEI24 [SI DI])
857 ;; SSE asm suffix for floating point modes
858 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
860 ;; SSE vector mode corresponding to a scalar mode
861 (define_mode_attr ssevecmode
862 [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
864 ;; Instruction suffix for REX 64bit operators.
865 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
867 ;; This mode iterator allows :P to be used for patterns that operate on
868 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
869 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
871 ;; Scheduling descriptions
873 (include "pentium.md")
876 (include "athlon.md")
881 ;; Operand and operator predicates and constraints
883 (include "predicates.md")
884 (include "constraints.md")
887 ;; Compare and branch/compare and store instructions.
889 (define_expand "cbranch<mode>4"
890 [(set (reg:CC FLAGS_REG)
891 (compare:CC (match_operand:SDWIM 1 "nonimmediate_operand" "")
892 (match_operand:SDWIM 2 "<general_operand>" "")))
893 (set (pc) (if_then_else
894 (match_operator 0 "comparison_operator"
895 [(reg:CC FLAGS_REG) (const_int 0)])
896 (label_ref (match_operand 3 "" ""))
900 if (MEM_P (operands[1]) && MEM_P (operands[2]))
901 operands[1] = force_reg (<MODE>mode, operands[1]);
902 ix86_compare_op0 = operands[1];
903 ix86_compare_op1 = operands[2];
904 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
908 (define_expand "cstore<mode>4"
909 [(set (reg:CC FLAGS_REG)
910 (compare:CC (match_operand:SWIM 2 "nonimmediate_operand" "")
911 (match_operand:SWIM 3 "<general_operand>" "")))
912 (set (match_operand:QI 0 "register_operand" "")
913 (match_operator 1 "comparison_operator"
914 [(reg:CC FLAGS_REG) (const_int 0)]))]
917 if (MEM_P (operands[2]) && MEM_P (operands[3]))
918 operands[2] = force_reg (<MODE>mode, operands[2]);
919 ix86_compare_op0 = operands[2];
920 ix86_compare_op1 = operands[3];
921 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
925 (define_expand "cmp<mode>_1"
926 [(set (reg:CC FLAGS_REG)
927 (compare:CC (match_operand:SWI48 0 "nonimmediate_operand" "")
928 (match_operand:SWI48 1 "<general_operand>" "")))]
932 (define_insn "*cmp<mode>_ccno_1"
933 [(set (reg FLAGS_REG)
934 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>,?m<r>")
935 (match_operand:SWI 1 "const0_operand" "")))]
936 "ix86_match_ccmode (insn, CCNOmode)"
938 test{<imodesuffix>}\t%0, %0
939 cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
940 [(set_attr "type" "test,icmp")
941 (set_attr "length_immediate" "0,1")
942 (set_attr "mode" "<MODE>")])
944 (define_insn "*cmp<mode>_1"
945 [(set (reg FLAGS_REG)
946 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
947 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")))]
948 "ix86_match_ccmode (insn, CCmode)"
949 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
950 [(set_attr "type" "icmp")
951 (set_attr "mode" "<MODE>")])
953 (define_insn "*cmp<mode>_minus_1"
954 [(set (reg FLAGS_REG)
956 (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
957 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
959 "ix86_match_ccmode (insn, CCGOCmode)"
960 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
961 [(set_attr "type" "icmp")
962 (set_attr "mode" "<MODE>")])
964 (define_insn "*cmpqi_ext_1"
965 [(set (reg FLAGS_REG)
967 (match_operand:QI 0 "general_operand" "Qm")
970 (match_operand 1 "ext_register_operand" "Q")
973 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
974 "cmp{b}\t{%h1, %0|%0, %h1}"
975 [(set_attr "type" "icmp")
976 (set_attr "mode" "QI")])
978 (define_insn "*cmpqi_ext_1_rex64"
979 [(set (reg FLAGS_REG)
981 (match_operand:QI 0 "register_operand" "Q")
984 (match_operand 1 "ext_register_operand" "Q")
987 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
988 "cmp{b}\t{%h1, %0|%0, %h1}"
989 [(set_attr "type" "icmp")
990 (set_attr "mode" "QI")])
992 (define_insn "*cmpqi_ext_2"
993 [(set (reg FLAGS_REG)
997 (match_operand 0 "ext_register_operand" "Q")
1000 (match_operand:QI 1 "const0_operand" "")))]
1001 "ix86_match_ccmode (insn, CCNOmode)"
1003 [(set_attr "type" "test")
1004 (set_attr "length_immediate" "0")
1005 (set_attr "mode" "QI")])
1007 (define_expand "cmpqi_ext_3"
1008 [(set (reg:CC FLAGS_REG)
1012 (match_operand 0 "ext_register_operand" "")
1015 (match_operand:QI 1 "immediate_operand" "")))]
1019 (define_insn "*cmpqi_ext_3_insn"
1020 [(set (reg FLAGS_REG)
1024 (match_operand 0 "ext_register_operand" "Q")
1027 (match_operand:QI 1 "general_operand" "Qmn")))]
1028 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1029 "cmp{b}\t{%1, %h0|%h0, %1}"
1030 [(set_attr "type" "icmp")
1031 (set_attr "modrm" "1")
1032 (set_attr "mode" "QI")])
1034 (define_insn "*cmpqi_ext_3_insn_rex64"
1035 [(set (reg FLAGS_REG)
1039 (match_operand 0 "ext_register_operand" "Q")
1042 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
1043 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1044 "cmp{b}\t{%1, %h0|%h0, %1}"
1045 [(set_attr "type" "icmp")
1046 (set_attr "modrm" "1")
1047 (set_attr "mode" "QI")])
1049 (define_insn "*cmpqi_ext_4"
1050 [(set (reg FLAGS_REG)
1054 (match_operand 0 "ext_register_operand" "Q")
1059 (match_operand 1 "ext_register_operand" "Q")
1061 (const_int 8)) 0)))]
1062 "ix86_match_ccmode (insn, CCmode)"
1063 "cmp{b}\t{%h1, %h0|%h0, %h1}"
1064 [(set_attr "type" "icmp")
1065 (set_attr "mode" "QI")])
1067 ;; These implement float point compares.
1068 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
1069 ;; which would allow mix and match FP modes on the compares. Which is what
1070 ;; the old patterns did, but with many more of them.
1072 (define_expand "cbranchxf4"
1073 [(set (reg:CC FLAGS_REG)
1074 (compare:CC (match_operand:XF 1 "nonmemory_operand" "")
1075 (match_operand:XF 2 "nonmemory_operand" "")))
1076 (set (pc) (if_then_else
1077 (match_operator 0 "ix86_fp_comparison_operator"
1080 (label_ref (match_operand 3 "" ""))
1084 ix86_compare_op0 = operands[1];
1085 ix86_compare_op1 = operands[2];
1086 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1090 (define_expand "cstorexf4"
1091 [(set (reg:CC FLAGS_REG)
1092 (compare:CC (match_operand:XF 2 "nonmemory_operand" "")
1093 (match_operand:XF 3 "nonmemory_operand" "")))
1094 (set (match_operand:QI 0 "register_operand" "")
1095 (match_operator 1 "ix86_fp_comparison_operator"
1100 ix86_compare_op0 = operands[2];
1101 ix86_compare_op1 = operands[3];
1102 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1106 (define_expand "cbranch<mode>4"
1107 [(set (reg:CC FLAGS_REG)
1108 (compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
1109 (match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
1110 (set (pc) (if_then_else
1111 (match_operator 0 "ix86_fp_comparison_operator"
1114 (label_ref (match_operand 3 "" ""))
1116 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1118 ix86_compare_op0 = operands[1];
1119 ix86_compare_op1 = operands[2];
1120 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1124 (define_expand "cstore<mode>4"
1125 [(set (reg:CC FLAGS_REG)
1126 (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
1127 (match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
1128 (set (match_operand:QI 0 "register_operand" "")
1129 (match_operator 1 "ix86_fp_comparison_operator"
1132 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1134 ix86_compare_op0 = operands[2];
1135 ix86_compare_op1 = operands[3];
1136 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1140 (define_expand "cbranchcc4"
1141 [(set (pc) (if_then_else
1142 (match_operator 0 "comparison_operator"
1143 [(match_operand 1 "flags_reg_operand" "")
1144 (match_operand 2 "const0_operand" "")])
1145 (label_ref (match_operand 3 "" ""))
1149 ix86_compare_op0 = operands[1];
1150 ix86_compare_op1 = operands[2];
1151 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1155 (define_expand "cstorecc4"
1156 [(set (match_operand:QI 0 "register_operand" "")
1157 (match_operator 1 "comparison_operator"
1158 [(match_operand 2 "flags_reg_operand" "")
1159 (match_operand 3 "const0_operand" "")]))]
1162 ix86_compare_op0 = operands[2];
1163 ix86_compare_op1 = operands[3];
1164 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1169 ;; FP compares, step 1:
1170 ;; Set the FP condition codes.
1172 ;; CCFPmode compare with exceptions
1173 ;; CCFPUmode compare with no exceptions
1175 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
1176 ;; used to manage the reg stack popping would not be preserved.
1178 (define_insn "*cmpfp_0"
1179 [(set (match_operand:HI 0 "register_operand" "=a")
1182 (match_operand 1 "register_operand" "f")
1183 (match_operand 2 "const0_operand" ""))]
1185 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1186 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1187 "* return output_fp_compare (insn, operands, 0, 0);"
1188 [(set_attr "type" "multi")
1189 (set_attr "unit" "i387")
1191 (cond [(match_operand:SF 1 "" "")
1193 (match_operand:DF 1 "" "")
1196 (const_string "XF")))])
1198 (define_insn_and_split "*cmpfp_0_cc"
1199 [(set (reg:CCFP FLAGS_REG)
1201 (match_operand 1 "register_operand" "f")
1202 (match_operand 2 "const0_operand" "")))
1203 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1204 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1205 && TARGET_SAHF && !TARGET_CMOVE
1206 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1208 "&& reload_completed"
1211 [(compare:CCFP (match_dup 1)(match_dup 2))]
1213 (set (reg:CC FLAGS_REG)
1214 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1216 [(set_attr "type" "multi")
1217 (set_attr "unit" "i387")
1219 (cond [(match_operand:SF 1 "" "")
1221 (match_operand:DF 1 "" "")
1224 (const_string "XF")))])
1226 (define_insn "*cmpfp_xf"
1227 [(set (match_operand:HI 0 "register_operand" "=a")
1230 (match_operand:XF 1 "register_operand" "f")
1231 (match_operand:XF 2 "register_operand" "f"))]
1234 "* return output_fp_compare (insn, operands, 0, 0);"
1235 [(set_attr "type" "multi")
1236 (set_attr "unit" "i387")
1237 (set_attr "mode" "XF")])
1239 (define_insn_and_split "*cmpfp_xf_cc"
1240 [(set (reg:CCFP FLAGS_REG)
1242 (match_operand:XF 1 "register_operand" "f")
1243 (match_operand:XF 2 "register_operand" "f")))
1244 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1246 && TARGET_SAHF && !TARGET_CMOVE"
1248 "&& reload_completed"
1251 [(compare:CCFP (match_dup 1)(match_dup 2))]
1253 (set (reg:CC FLAGS_REG)
1254 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1256 [(set_attr "type" "multi")
1257 (set_attr "unit" "i387")
1258 (set_attr "mode" "XF")])
1260 (define_insn "*cmpfp_<mode>"
1261 [(set (match_operand:HI 0 "register_operand" "=a")
1264 (match_operand:MODEF 1 "register_operand" "f")
1265 (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1268 "* return output_fp_compare (insn, operands, 0, 0);"
1269 [(set_attr "type" "multi")
1270 (set_attr "unit" "i387")
1271 (set_attr "mode" "<MODE>")])
1273 (define_insn_and_split "*cmpfp_<mode>_cc"
1274 [(set (reg:CCFP FLAGS_REG)
1276 (match_operand:MODEF 1 "register_operand" "f")
1277 (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1278 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1280 && TARGET_SAHF && !TARGET_CMOVE"
1282 "&& reload_completed"
1285 [(compare:CCFP (match_dup 1)(match_dup 2))]
1287 (set (reg:CC FLAGS_REG)
1288 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1290 [(set_attr "type" "multi")
1291 (set_attr "unit" "i387")
1292 (set_attr "mode" "<MODE>")])
1294 (define_insn "*cmpfp_u"
1295 [(set (match_operand:HI 0 "register_operand" "=a")
1298 (match_operand 1 "register_operand" "f")
1299 (match_operand 2 "register_operand" "f"))]
1301 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1302 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1303 "* return output_fp_compare (insn, operands, 0, 1);"
1304 [(set_attr "type" "multi")
1305 (set_attr "unit" "i387")
1307 (cond [(match_operand:SF 1 "" "")
1309 (match_operand:DF 1 "" "")
1312 (const_string "XF")))])
1314 (define_insn_and_split "*cmpfp_u_cc"
1315 [(set (reg:CCFPU FLAGS_REG)
1317 (match_operand 1 "register_operand" "f")
1318 (match_operand 2 "register_operand" "f")))
1319 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1320 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1321 && TARGET_SAHF && !TARGET_CMOVE
1322 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1324 "&& reload_completed"
1327 [(compare:CCFPU (match_dup 1)(match_dup 2))]
1329 (set (reg:CC FLAGS_REG)
1330 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1332 [(set_attr "type" "multi")
1333 (set_attr "unit" "i387")
1335 (cond [(match_operand:SF 1 "" "")
1337 (match_operand:DF 1 "" "")
1340 (const_string "XF")))])
1342 (define_insn "*cmpfp_<mode>"
1343 [(set (match_operand:HI 0 "register_operand" "=a")
1346 (match_operand 1 "register_operand" "f")
1347 (match_operator 3 "float_operator"
1348 [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1350 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1351 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1352 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1353 "* return output_fp_compare (insn, operands, 0, 0);"
1354 [(set_attr "type" "multi")
1355 (set_attr "unit" "i387")
1356 (set_attr "fp_int_src" "true")
1357 (set_attr "mode" "<MODE>")])
1359 (define_insn_and_split "*cmpfp_<mode>_cc"
1360 [(set (reg:CCFP FLAGS_REG)
1362 (match_operand 1 "register_operand" "f")
1363 (match_operator 3 "float_operator"
1364 [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1365 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1366 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1367 && TARGET_SAHF && !TARGET_CMOVE
1368 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1369 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1371 "&& reload_completed"
1376 (match_op_dup 3 [(match_dup 2)]))]
1378 (set (reg:CC FLAGS_REG)
1379 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1381 [(set_attr "type" "multi")
1382 (set_attr "unit" "i387")
1383 (set_attr "fp_int_src" "true")
1384 (set_attr "mode" "<MODE>")])
1386 ;; FP compares, step 2
1387 ;; Move the fpsw to ax.
1389 (define_insn "x86_fnstsw_1"
1390 [(set (match_operand:HI 0 "register_operand" "=a")
1391 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1394 [(set (attr "length") (symbol_ref "ix86_attr_length_address_default (insn) + 2"))
1395 (set_attr "mode" "SI")
1396 (set_attr "unit" "i387")])
1398 ;; FP compares, step 3
1399 ;; Get ax into flags, general case.
1401 (define_insn "x86_sahf_1"
1402 [(set (reg:CC FLAGS_REG)
1403 (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1407 #ifdef HAVE_AS_IX86_SAHF
1410 return ASM_BYTE "0x9e";
1413 [(set_attr "length" "1")
1414 (set_attr "athlon_decode" "vector")
1415 (set_attr "amdfam10_decode" "direct")
1416 (set_attr "mode" "SI")])
1418 ;; Pentium Pro can do steps 1 through 3 in one go.
1419 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1420 (define_insn "*cmpfp_i_mixed"
1421 [(set (reg:CCFP FLAGS_REG)
1422 (compare:CCFP (match_operand 0 "register_operand" "f,x")
1423 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1424 "TARGET_MIX_SSE_I387
1425 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1426 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1427 "* return output_fp_compare (insn, operands, 1, 0);"
1428 [(set_attr "type" "fcmp,ssecomi")
1429 (set_attr "prefix" "orig,maybe_vex")
1431 (if_then_else (match_operand:SF 1 "" "")
1433 (const_string "DF")))
1434 (set (attr "prefix_rep")
1435 (if_then_else (eq_attr "type" "ssecomi")
1437 (const_string "*")))
1438 (set (attr "prefix_data16")
1439 (cond [(eq_attr "type" "fcmp")
1441 (eq_attr "mode" "DF")
1444 (const_string "0")))
1445 (set_attr "athlon_decode" "vector")
1446 (set_attr "amdfam10_decode" "direct")])
1448 (define_insn "*cmpfp_i_sse"
1449 [(set (reg:CCFP FLAGS_REG)
1450 (compare:CCFP (match_operand 0 "register_operand" "x")
1451 (match_operand 1 "nonimmediate_operand" "xm")))]
1453 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1454 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1455 "* return output_fp_compare (insn, operands, 1, 0);"
1456 [(set_attr "type" "ssecomi")
1457 (set_attr "prefix" "maybe_vex")
1459 (if_then_else (match_operand:SF 1 "" "")
1461 (const_string "DF")))
1462 (set_attr "prefix_rep" "0")
1463 (set (attr "prefix_data16")
1464 (if_then_else (eq_attr "mode" "DF")
1466 (const_string "0")))
1467 (set_attr "athlon_decode" "vector")
1468 (set_attr "amdfam10_decode" "direct")])
1470 (define_insn "*cmpfp_i_i387"
1471 [(set (reg:CCFP FLAGS_REG)
1472 (compare:CCFP (match_operand 0 "register_operand" "f")
1473 (match_operand 1 "register_operand" "f")))]
1474 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1476 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1477 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1478 "* return output_fp_compare (insn, operands, 1, 0);"
1479 [(set_attr "type" "fcmp")
1481 (cond [(match_operand:SF 1 "" "")
1483 (match_operand:DF 1 "" "")
1486 (const_string "XF")))
1487 (set_attr "athlon_decode" "vector")
1488 (set_attr "amdfam10_decode" "direct")])
1490 (define_insn "*cmpfp_iu_mixed"
1491 [(set (reg:CCFPU FLAGS_REG)
1492 (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1493 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1494 "TARGET_MIX_SSE_I387
1495 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1496 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1497 "* return output_fp_compare (insn, operands, 1, 1);"
1498 [(set_attr "type" "fcmp,ssecomi")
1499 (set_attr "prefix" "orig,maybe_vex")
1501 (if_then_else (match_operand:SF 1 "" "")
1503 (const_string "DF")))
1504 (set (attr "prefix_rep")
1505 (if_then_else (eq_attr "type" "ssecomi")
1507 (const_string "*")))
1508 (set (attr "prefix_data16")
1509 (cond [(eq_attr "type" "fcmp")
1511 (eq_attr "mode" "DF")
1514 (const_string "0")))
1515 (set_attr "athlon_decode" "vector")
1516 (set_attr "amdfam10_decode" "direct")])
1518 (define_insn "*cmpfp_iu_sse"
1519 [(set (reg:CCFPU FLAGS_REG)
1520 (compare:CCFPU (match_operand 0 "register_operand" "x")
1521 (match_operand 1 "nonimmediate_operand" "xm")))]
1523 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1524 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1525 "* return output_fp_compare (insn, operands, 1, 1);"
1526 [(set_attr "type" "ssecomi")
1527 (set_attr "prefix" "maybe_vex")
1529 (if_then_else (match_operand:SF 1 "" "")
1531 (const_string "DF")))
1532 (set_attr "prefix_rep" "0")
1533 (set (attr "prefix_data16")
1534 (if_then_else (eq_attr "mode" "DF")
1536 (const_string "0")))
1537 (set_attr "athlon_decode" "vector")
1538 (set_attr "amdfam10_decode" "direct")])
1540 (define_insn "*cmpfp_iu_387"
1541 [(set (reg:CCFPU FLAGS_REG)
1542 (compare:CCFPU (match_operand 0 "register_operand" "f")
1543 (match_operand 1 "register_operand" "f")))]
1544 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1546 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1547 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1548 "* return output_fp_compare (insn, operands, 1, 1);"
1549 [(set_attr "type" "fcmp")
1551 (cond [(match_operand:SF 1 "" "")
1553 (match_operand:DF 1 "" "")
1556 (const_string "XF")))
1557 (set_attr "athlon_decode" "vector")
1558 (set_attr "amdfam10_decode" "direct")])
1560 ;; Move instructions.
1562 ;; General case of fullword move.
1564 (define_expand "movsi"
1565 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1566 (match_operand:SI 1 "general_operand" ""))]
1568 "ix86_expand_move (SImode, operands); DONE;")
1570 ;; Push/pop instructions. They are separate since autoinc/dec is not a
1573 ;; %%% We don't use a post-inc memory reference because x86 is not a
1574 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1575 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1576 ;; targets without our curiosities, and it is just as easy to represent
1577 ;; this differently.
1579 (define_insn "*pushsi2"
1580 [(set (match_operand:SI 0 "push_operand" "=<")
1581 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1584 [(set_attr "type" "push")
1585 (set_attr "mode" "SI")])
1587 ;; For 64BIT abi we always round up to 8 bytes.
1588 (define_insn "*pushsi2_rex64"
1589 [(set (match_operand:SI 0 "push_operand" "=X")
1590 (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1593 [(set_attr "type" "push")
1594 (set_attr "mode" "SI")])
1596 (define_insn "*pushsi2_prologue"
1597 [(set (match_operand:SI 0 "push_operand" "=<")
1598 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1599 (clobber (mem:BLK (scratch)))]
1602 [(set_attr "type" "push")
1603 (set_attr "mode" "SI")])
1605 (define_insn "*popsi1_epilogue"
1606 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1607 (mem:SI (reg:SI SP_REG)))
1608 (set (reg:SI SP_REG)
1609 (plus:SI (reg:SI SP_REG) (const_int 4)))
1610 (clobber (mem:BLK (scratch)))]
1613 [(set_attr "type" "pop")
1614 (set_attr "mode" "SI")])
1616 (define_insn "popsi1"
1617 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1618 (mem:SI (reg:SI SP_REG)))
1619 (set (reg:SI SP_REG)
1620 (plus:SI (reg:SI SP_REG) (const_int 4)))]
1623 [(set_attr "type" "pop")
1624 (set_attr "mode" "SI")])
1626 (define_insn "*movsi_xor"
1627 [(set (match_operand:SI 0 "register_operand" "=r")
1628 (match_operand:SI 1 "const0_operand" ""))
1629 (clobber (reg:CC FLAGS_REG))]
1632 [(set_attr "type" "alu1")
1633 (set_attr "mode" "SI")
1634 (set_attr "length_immediate" "0")])
1636 (define_insn "*movsi_or"
1637 [(set (match_operand:SI 0 "register_operand" "=r")
1638 (match_operand:SI 1 "immediate_operand" "i"))
1639 (clobber (reg:CC FLAGS_REG))]
1641 && operands[1] == constm1_rtx"
1643 operands[1] = constm1_rtx;
1644 return "or{l}\t{%1, %0|%0, %1}";
1646 [(set_attr "type" "alu1")
1647 (set_attr "mode" "SI")
1648 (set_attr "length_immediate" "1")])
1650 (define_insn "*movsi_1"
1651 [(set (match_operand:SI 0 "nonimmediate_operand"
1652 "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
1653 (match_operand:SI 1 "general_operand"
1654 "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))]
1655 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1657 switch (get_attr_type (insn))
1660 if (get_attr_mode (insn) == MODE_TI)
1661 return "%vpxor\t%0, %d0";
1662 return "%vxorps\t%0, %d0";
1665 switch (get_attr_mode (insn))
1668 return "%vmovdqa\t{%1, %0|%0, %1}";
1670 return "%vmovaps\t{%1, %0|%0, %1}";
1672 return "%vmovd\t{%1, %0|%0, %1}";
1674 return "%vmovss\t{%1, %0|%0, %1}";
1680 return "pxor\t%0, %0";
1683 if (get_attr_mode (insn) == MODE_DI)
1684 return "movq\t{%1, %0|%0, %1}";
1685 return "movd\t{%1, %0|%0, %1}";
1688 return "lea{l}\t{%1, %0|%0, %1}";
1691 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
1692 return "mov{l}\t{%1, %0|%0, %1}";
1696 (cond [(eq_attr "alternative" "2")
1697 (const_string "mmx")
1698 (eq_attr "alternative" "3,4,5")
1699 (const_string "mmxmov")
1700 (eq_attr "alternative" "6")
1701 (const_string "sselog1")
1702 (eq_attr "alternative" "7,8,9,10,11")
1703 (const_string "ssemov")
1704 (match_operand:DI 1 "pic_32bit_operand" "")
1705 (const_string "lea")
1707 (const_string "imov")))
1708 (set (attr "prefix")
1709 (if_then_else (eq_attr "alternative" "0,1,2,3,4,5")
1710 (const_string "orig")
1711 (const_string "maybe_vex")))
1712 (set (attr "prefix_data16")
1713 (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI"))
1715 (const_string "*")))
1717 (cond [(eq_attr "alternative" "2,3")
1719 (eq_attr "alternative" "6,7")
1721 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1722 (const_string "V4SF")
1723 (const_string "TI"))
1724 (and (eq_attr "alternative" "8,9,10,11")
1725 (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
1728 (const_string "SI")))])
1730 ;; Stores and loads of ax to arbitrary constant address.
1731 ;; We fake an second form of instruction to force reload to load address
1732 ;; into register when rax is not available
1733 (define_insn "*movabssi_1_rex64"
1734 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1735 (match_operand:SI 1 "nonmemory_operand" "a,er"))]
1736 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1738 movabs{l}\t{%1, %P0|%P0, %1}
1739 mov{l}\t{%1, %a0|%a0, %1}"
1740 [(set_attr "type" "imov")
1741 (set_attr "modrm" "0,*")
1742 (set_attr "length_address" "8,0")
1743 (set_attr "length_immediate" "0,*")
1744 (set_attr "memory" "store")
1745 (set_attr "mode" "SI")])
1747 (define_insn "*movabssi_2_rex64"
1748 [(set (match_operand:SI 0 "register_operand" "=a,r")
1749 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1750 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1752 movabs{l}\t{%P1, %0|%0, %P1}
1753 mov{l}\t{%a1, %0|%0, %a1}"
1754 [(set_attr "type" "imov")
1755 (set_attr "modrm" "0,*")
1756 (set_attr "length_address" "8,0")
1757 (set_attr "length_immediate" "0")
1758 (set_attr "memory" "load")
1759 (set_attr "mode" "SI")])
1761 (define_insn "*swapsi"
1762 [(set (match_operand:SI 0 "register_operand" "+r")
1763 (match_operand:SI 1 "register_operand" "+r"))
1768 [(set_attr "type" "imov")
1769 (set_attr "mode" "SI")
1770 (set_attr "pent_pair" "np")
1771 (set_attr "athlon_decode" "vector")
1772 (set_attr "amdfam10_decode" "double")])
1774 (define_expand "movhi"
1775 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1776 (match_operand:HI 1 "general_operand" ""))]
1778 "ix86_expand_move (HImode, operands); DONE;")
1780 (define_insn "*pushhi2"
1781 [(set (match_operand:HI 0 "push_operand" "=X")
1782 (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1785 [(set_attr "type" "push")
1786 (set_attr "mode" "SI")])
1788 ;; For 64BIT abi we always round up to 8 bytes.
1789 (define_insn "*pushhi2_rex64"
1790 [(set (match_operand:HI 0 "push_operand" "=X")
1791 (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1794 [(set_attr "type" "push")
1795 (set_attr "mode" "DI")])
1797 (define_insn "*movhi_1"
1798 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
1799 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
1800 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1802 switch (get_attr_type (insn))
1805 /* movzwl is faster than movw on p2 due to partial word stalls,
1806 though not as fast as an aligned movl. */
1807 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1809 if (get_attr_mode (insn) == MODE_SI)
1810 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1812 return "mov{w}\t{%1, %0|%0, %1}";
1816 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
1817 (const_string "imov")
1818 (and (eq_attr "alternative" "0")
1819 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1821 (eq (symbol_ref "TARGET_HIMODE_MATH")
1823 (const_string "imov")
1824 (and (eq_attr "alternative" "1,2")
1825 (match_operand:HI 1 "aligned_operand" ""))
1826 (const_string "imov")
1827 (and (ne (symbol_ref "TARGET_MOVX")
1829 (eq_attr "alternative" "0,2"))
1830 (const_string "imovx")
1832 (const_string "imov")))
1834 (cond [(eq_attr "type" "imovx")
1836 (and (eq_attr "alternative" "1,2")
1837 (match_operand:HI 1 "aligned_operand" ""))
1839 (and (eq_attr "alternative" "0")
1840 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1842 (eq (symbol_ref "TARGET_HIMODE_MATH")
1846 (const_string "HI")))])
1848 ;; Stores and loads of ax to arbitrary constant address.
1849 ;; We fake an second form of instruction to force reload to load address
1850 ;; into register when rax is not available
1851 (define_insn "*movabshi_1_rex64"
1852 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1853 (match_operand:HI 1 "nonmemory_operand" "a,er"))]
1854 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1856 movabs{w}\t{%1, %P0|%P0, %1}
1857 mov{w}\t{%1, %a0|%a0, %1}"
1858 [(set_attr "type" "imov")
1859 (set_attr "modrm" "0,*")
1860 (set_attr "length_address" "8,0")
1861 (set_attr "length_immediate" "0,*")
1862 (set_attr "memory" "store")
1863 (set_attr "mode" "HI")])
1865 (define_insn "*movabshi_2_rex64"
1866 [(set (match_operand:HI 0 "register_operand" "=a,r")
1867 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1868 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1870 movabs{w}\t{%P1, %0|%0, %P1}
1871 mov{w}\t{%a1, %0|%0, %a1}"
1872 [(set_attr "type" "imov")
1873 (set_attr "modrm" "0,*")
1874 (set_attr "length_address" "8,0")
1875 (set_attr "length_immediate" "0")
1876 (set_attr "memory" "load")
1877 (set_attr "mode" "HI")])
1879 (define_insn "*swaphi_1"
1880 [(set (match_operand:HI 0 "register_operand" "+r")
1881 (match_operand:HI 1 "register_operand" "+r"))
1884 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
1886 [(set_attr "type" "imov")
1887 (set_attr "mode" "SI")
1888 (set_attr "pent_pair" "np")
1889 (set_attr "athlon_decode" "vector")
1890 (set_attr "amdfam10_decode" "double")])
1892 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
1893 (define_insn "*swaphi_2"
1894 [(set (match_operand:HI 0 "register_operand" "+r")
1895 (match_operand:HI 1 "register_operand" "+r"))
1898 "TARGET_PARTIAL_REG_STALL"
1900 [(set_attr "type" "imov")
1901 (set_attr "mode" "HI")
1902 (set_attr "pent_pair" "np")
1903 (set_attr "athlon_decode" "vector")])
1905 (define_expand "movstricthi"
1906 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1907 (match_operand:HI 1 "general_operand" ""))]
1910 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
1912 /* Don't generate memory->memory moves, go through a register */
1913 if (MEM_P (operands[0]) && MEM_P (operands[1]))
1914 operands[1] = force_reg (HImode, operands[1]);
1917 (define_insn "*movstricthi_1"
1918 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1919 (match_operand:HI 1 "general_operand" "rn,m"))]
1920 "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
1921 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1922 "mov{w}\t{%1, %0|%0, %1}"
1923 [(set_attr "type" "imov")
1924 (set_attr "mode" "HI")])
1926 (define_insn "*movstricthi_xor"
1927 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1928 (match_operand:HI 1 "const0_operand" ""))
1929 (clobber (reg:CC FLAGS_REG))]
1932 [(set_attr "type" "alu1")
1933 (set_attr "mode" "HI")
1934 (set_attr "length_immediate" "0")])
1936 (define_expand "movqi"
1937 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1938 (match_operand:QI 1 "general_operand" ""))]
1940 "ix86_expand_move (QImode, operands); DONE;")
1942 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1943 ;; "push a byte". But actually we use pushl, which has the effect
1944 ;; of rounding the amount pushed up to a word.
1946 (define_insn "*pushqi2"
1947 [(set (match_operand:QI 0 "push_operand" "=X")
1948 (match_operand:QI 1 "nonmemory_no_elim_operand" "rn"))]
1951 [(set_attr "type" "push")
1952 (set_attr "mode" "SI")])
1954 ;; For 64BIT abi we always round up to 8 bytes.
1955 (define_insn "*pushqi2_rex64"
1956 [(set (match_operand:QI 0 "push_operand" "=X")
1957 (match_operand:QI 1 "nonmemory_no_elim_operand" "qn"))]
1960 [(set_attr "type" "push")
1961 (set_attr "mode" "DI")])
1963 ;; Situation is quite tricky about when to choose full sized (SImode) move
1964 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1965 ;; partial register dependency machines (such as AMD Athlon), where QImode
1966 ;; moves issue extra dependency and for partial register stalls machines
1967 ;; that don't use QImode patterns (and QImode move cause stall on the next
1970 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1971 ;; register stall machines with, where we use QImode instructions, since
1972 ;; partial register stall can be caused there. Then we use movzx.
1973 (define_insn "*movqi_1"
1974 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1975 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1976 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1978 switch (get_attr_type (insn))
1981 gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
1982 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1984 if (get_attr_mode (insn) == MODE_SI)
1985 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1987 return "mov{b}\t{%1, %0|%0, %1}";
1991 (cond [(and (eq_attr "alternative" "5")
1992 (not (match_operand:QI 1 "aligned_operand" "")))
1993 (const_string "imovx")
1994 (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
1995 (const_string "imov")
1996 (and (eq_attr "alternative" "3")
1997 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1999 (eq (symbol_ref "TARGET_QIMODE_MATH")
2001 (const_string "imov")
2002 (eq_attr "alternative" "3,5")
2003 (const_string "imovx")
2004 (and (ne (symbol_ref "TARGET_MOVX")
2006 (eq_attr "alternative" "2"))
2007 (const_string "imovx")
2009 (const_string "imov")))
2011 (cond [(eq_attr "alternative" "3,4,5")
2013 (eq_attr "alternative" "6")
2015 (eq_attr "type" "imovx")
2017 (and (eq_attr "type" "imov")
2018 (and (eq_attr "alternative" "0,1")
2019 (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
2021 (and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2023 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2026 ;; Avoid partial register stalls when not using QImode arithmetic
2027 (and (eq_attr "type" "imov")
2028 (and (eq_attr "alternative" "0,1")
2029 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
2031 (eq (symbol_ref "TARGET_QIMODE_MATH")
2035 (const_string "QI")))])
2037 (define_insn "*swapqi_1"
2038 [(set (match_operand:QI 0 "register_operand" "+r")
2039 (match_operand:QI 1 "register_operand" "+r"))
2042 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2044 [(set_attr "type" "imov")
2045 (set_attr "mode" "SI")
2046 (set_attr "pent_pair" "np")
2047 (set_attr "athlon_decode" "vector")
2048 (set_attr "amdfam10_decode" "vector")])
2050 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
2051 (define_insn "*swapqi_2"
2052 [(set (match_operand:QI 0 "register_operand" "+q")
2053 (match_operand:QI 1 "register_operand" "+q"))
2056 "TARGET_PARTIAL_REG_STALL"
2058 [(set_attr "type" "imov")
2059 (set_attr "mode" "QI")
2060 (set_attr "pent_pair" "np")
2061 (set_attr "athlon_decode" "vector")])
2063 (define_expand "movstrictqi"
2064 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
2065 (match_operand:QI 1 "general_operand" ""))]
2068 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2070 /* Don't generate memory->memory moves, go through a register. */
2071 if (MEM_P (operands[0]) && MEM_P (operands[1]))
2072 operands[1] = force_reg (QImode, operands[1]);
2075 (define_insn "*movstrictqi_1"
2076 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
2077 (match_operand:QI 1 "general_operand" "*qn,m"))]
2078 "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2079 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2080 "mov{b}\t{%1, %0|%0, %1}"
2081 [(set_attr "type" "imov")
2082 (set_attr "mode" "QI")])
2084 (define_insn "*movstrictqi_xor"
2085 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
2086 (match_operand:QI 1 "const0_operand" ""))
2087 (clobber (reg:CC FLAGS_REG))]
2090 [(set_attr "type" "alu1")
2091 (set_attr "mode" "QI")
2092 (set_attr "length_immediate" "0")])
2094 (define_insn "*movsi_extv_1"
2095 [(set (match_operand:SI 0 "register_operand" "=R")
2096 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
2100 "movs{bl|x}\t{%h1, %0|%0, %h1}"
2101 [(set_attr "type" "imovx")
2102 (set_attr "mode" "SI")])
2104 (define_insn "*movhi_extv_1"
2105 [(set (match_operand:HI 0 "register_operand" "=R")
2106 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
2110 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
2111 [(set_attr "type" "imovx")
2112 (set_attr "mode" "SI")])
2114 (define_insn "*movqi_extv_1"
2115 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
2116 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2121 switch (get_attr_type (insn))
2124 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2126 return "mov{b}\t{%h1, %0|%0, %h1}";
2130 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2131 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2132 (ne (symbol_ref "TARGET_MOVX")
2134 (const_string "imovx")
2135 (const_string "imov")))
2137 (if_then_else (eq_attr "type" "imovx")
2139 (const_string "QI")))])
2141 (define_insn "*movqi_extv_1_rex64"
2142 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2143 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2148 switch (get_attr_type (insn))
2151 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2153 return "mov{b}\t{%h1, %0|%0, %h1}";
2157 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2158 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2159 (ne (symbol_ref "TARGET_MOVX")
2161 (const_string "imovx")
2162 (const_string "imov")))
2164 (if_then_else (eq_attr "type" "imovx")
2166 (const_string "QI")))])
2168 ;; Stores and loads of ax to arbitrary constant address.
2169 ;; We fake an second form of instruction to force reload to load address
2170 ;; into register when rax is not available
2171 (define_insn "*movabsqi_1_rex64"
2172 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2173 (match_operand:QI 1 "nonmemory_operand" "a,er"))]
2174 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2176 movabs{b}\t{%1, %P0|%P0, %1}
2177 mov{b}\t{%1, %a0|%a0, %1}"
2178 [(set_attr "type" "imov")
2179 (set_attr "modrm" "0,*")
2180 (set_attr "length_address" "8,0")
2181 (set_attr "length_immediate" "0,*")
2182 (set_attr "memory" "store")
2183 (set_attr "mode" "QI")])
2185 (define_insn "*movabsqi_2_rex64"
2186 [(set (match_operand:QI 0 "register_operand" "=a,r")
2187 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2188 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2190 movabs{b}\t{%P1, %0|%0, %P1}
2191 mov{b}\t{%a1, %0|%0, %a1}"
2192 [(set_attr "type" "imov")
2193 (set_attr "modrm" "0,*")
2194 (set_attr "length_address" "8,0")
2195 (set_attr "length_immediate" "0")
2196 (set_attr "memory" "load")
2197 (set_attr "mode" "QI")])
2199 (define_insn "*movdi_extzv_1"
2200 [(set (match_operand:DI 0 "register_operand" "=R")
2201 (zero_extract:DI (match_operand 1 "ext_register_operand" "Q")
2205 "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
2206 [(set_attr "type" "imovx")
2207 (set_attr "mode" "SI")])
2209 (define_insn "*movsi_extzv_1"
2210 [(set (match_operand:SI 0 "register_operand" "=R")
2211 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
2215 "movz{bl|x}\t{%h1, %0|%0, %h1}"
2216 [(set_attr "type" "imovx")
2217 (set_attr "mode" "SI")])
2219 (define_insn "*movqi_extzv_2"
2220 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
2221 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2226 switch (get_attr_type (insn))
2229 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2231 return "mov{b}\t{%h1, %0|%0, %h1}";
2235 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2236 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2237 (ne (symbol_ref "TARGET_MOVX")
2239 (const_string "imovx")
2240 (const_string "imov")))
2242 (if_then_else (eq_attr "type" "imovx")
2244 (const_string "QI")))])
2246 (define_insn "*movqi_extzv_2_rex64"
2247 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2248 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2253 switch (get_attr_type (insn))
2256 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2258 return "mov{b}\t{%h1, %0|%0, %h1}";
2262 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2263 (ne (symbol_ref "TARGET_MOVX")
2265 (const_string "imovx")
2266 (const_string "imov")))
2268 (if_then_else (eq_attr "type" "imovx")
2270 (const_string "QI")))])
2272 (define_insn "movsi_insv_1"
2273 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2276 (match_operand:SI 1 "general_operand" "Qmn"))]
2278 "mov{b}\t{%b1, %h0|%h0, %b1}"
2279 [(set_attr "type" "imov")
2280 (set_attr "mode" "QI")])
2282 (define_insn "*movsi_insv_1_rex64"
2283 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2286 (match_operand:SI 1 "nonmemory_operand" "Qn"))]
2288 "mov{b}\t{%b1, %h0|%h0, %b1}"
2289 [(set_attr "type" "imov")
2290 (set_attr "mode" "QI")])
2292 (define_insn "movdi_insv_1_rex64"
2293 [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
2296 (match_operand:DI 1 "nonmemory_operand" "Qn"))]
2298 "mov{b}\t{%b1, %h0|%h0, %b1}"
2299 [(set_attr "type" "imov")
2300 (set_attr "mode" "QI")])
2302 (define_insn "*movqi_insv_2"
2303 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2306 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2309 "mov{b}\t{%h1, %h0|%h0, %h1}"
2310 [(set_attr "type" "imov")
2311 (set_attr "mode" "QI")])
2313 (define_expand "movdi"
2314 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2315 (match_operand:DI 1 "general_operand" ""))]
2317 "ix86_expand_move (DImode, operands); DONE;")
2319 (define_insn "*pushdi"
2320 [(set (match_operand:DI 0 "push_operand" "=<")
2321 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
2325 (define_insn "*pushdi2_rex64"
2326 [(set (match_operand:DI 0 "push_operand" "=<,!<")
2327 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
2332 [(set_attr "type" "push,multi")
2333 (set_attr "mode" "DI")])
2335 ;; Convert impossible pushes of immediate to existing instructions.
2336 ;; First try to get scratch register and go through it. In case this
2337 ;; fails, push sign extended lower part first and then overwrite
2338 ;; upper part by 32bit move.
2340 [(match_scratch:DI 2 "r")
2341 (set (match_operand:DI 0 "push_operand" "")
2342 (match_operand:DI 1 "immediate_operand" ""))]
2343 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2344 && !x86_64_immediate_operand (operands[1], DImode)"
2345 [(set (match_dup 2) (match_dup 1))
2346 (set (match_dup 0) (match_dup 2))]
2349 ;; We need to define this as both peepholer and splitter for case
2350 ;; peephole2 pass is not run.
2351 ;; "&& 1" is needed to keep it from matching the previous pattern.
2353 [(set (match_operand:DI 0 "push_operand" "")
2354 (match_operand:DI 1 "immediate_operand" ""))]
2355 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2356 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2357 [(set (match_dup 0) (match_dup 1))
2358 (set (match_dup 2) (match_dup 3))]
2359 "split_di (&operands[1], 1, &operands[2], &operands[3]);
2360 operands[1] = gen_lowpart (DImode, operands[2]);
2361 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2366 [(set (match_operand:DI 0 "push_operand" "")
2367 (match_operand:DI 1 "immediate_operand" ""))]
2368 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2369 ? epilogue_completed : reload_completed)
2370 && !symbolic_operand (operands[1], DImode)
2371 && !x86_64_immediate_operand (operands[1], DImode)"
2372 [(set (match_dup 0) (match_dup 1))
2373 (set (match_dup 2) (match_dup 3))]
2374 "split_di (&operands[1], 1, &operands[2], &operands[3]);
2375 operands[1] = gen_lowpart (DImode, operands[2]);
2376 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2380 (define_insn "*pushdi2_prologue_rex64"
2381 [(set (match_operand:DI 0 "push_operand" "=<")
2382 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
2383 (clobber (mem:BLK (scratch)))]
2386 [(set_attr "type" "push")
2387 (set_attr "mode" "DI")])
2389 (define_insn "*popdi1_epilogue_rex64"
2390 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2391 (mem:DI (reg:DI SP_REG)))
2392 (set (reg:DI SP_REG)
2393 (plus:DI (reg:DI SP_REG) (const_int 8)))
2394 (clobber (mem:BLK (scratch)))]
2397 [(set_attr "type" "pop")
2398 (set_attr "mode" "DI")])
2400 (define_insn "popdi1"
2401 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2402 (mem:DI (reg:DI SP_REG)))
2403 (set (reg:DI SP_REG)
2404 (plus:DI (reg:DI SP_REG) (const_int 8)))]
2407 [(set_attr "type" "pop")
2408 (set_attr "mode" "DI")])
2410 (define_insn "*movdi_xor_rex64"
2411 [(set (match_operand:DI 0 "register_operand" "=r")
2412 (match_operand:DI 1 "const0_operand" ""))
2413 (clobber (reg:CC FLAGS_REG))]
2415 && reload_completed"
2417 [(set_attr "type" "alu1")
2418 (set_attr "mode" "SI")
2419 (set_attr "length_immediate" "0")])
2421 (define_insn "*movdi_or_rex64"
2422 [(set (match_operand:DI 0 "register_operand" "=r")
2423 (match_operand:DI 1 "const_int_operand" "i"))
2424 (clobber (reg:CC FLAGS_REG))]
2427 && operands[1] == constm1_rtx"
2429 operands[1] = constm1_rtx;
2430 return "or{q}\t{%1, %0|%0, %1}";
2432 [(set_attr "type" "alu1")
2433 (set_attr "mode" "DI")
2434 (set_attr "length_immediate" "1")])
2436 (define_insn "*movdi_2"
2437 [(set (match_operand:DI 0 "nonimmediate_operand"
2438 "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
2439 (match_operand:DI 1 "general_operand"
2440 "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
2441 "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2446 movq\t{%1, %0|%0, %1}
2447 movq\t{%1, %0|%0, %1}
2449 %vmovq\t{%1, %0|%0, %1}
2450 %vmovdqa\t{%1, %0|%0, %1}
2451 %vmovq\t{%1, %0|%0, %1}
2453 movlps\t{%1, %0|%0, %1}
2454 movaps\t{%1, %0|%0, %1}
2455 movlps\t{%1, %0|%0, %1}"
2456 [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2457 (set (attr "prefix")
2458 (if_then_else (eq_attr "alternative" "5,6,7,8")
2459 (const_string "vex")
2460 (const_string "orig")))
2461 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2464 [(set (match_operand:DI 0 "push_operand" "")
2465 (match_operand:DI 1 "general_operand" ""))]
2466 "!TARGET_64BIT && reload_completed
2467 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2469 "ix86_split_long_move (operands); DONE;")
2471 ;; %%% This multiword shite has got to go.
2473 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2474 (match_operand:DI 1 "general_operand" ""))]
2475 "!TARGET_64BIT && reload_completed
2476 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
2477 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2479 "ix86_split_long_move (operands); DONE;")
2481 (define_insn "*movdi_1_rex64"
2482 [(set (match_operand:DI 0 "nonimmediate_operand"
2483 "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
2484 (match_operand:DI 1 "general_operand"
2485 "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
2486 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2488 switch (get_attr_type (insn))
2491 if (SSE_REG_P (operands[0]))
2492 return "movq2dq\t{%1, %0|%0, %1}";
2494 return "movdq2q\t{%1, %0|%0, %1}";
2499 if (get_attr_mode (insn) == MODE_TI)
2500 return "vmovdqa\t{%1, %0|%0, %1}";
2502 return "vmovq\t{%1, %0|%0, %1}";
2505 if (get_attr_mode (insn) == MODE_TI)
2506 return "movdqa\t{%1, %0|%0, %1}";
2510 /* Moves from and into integer register is done using movd
2511 opcode with REX prefix. */
2512 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
2513 return "movd\t{%1, %0|%0, %1}";
2514 return "movq\t{%1, %0|%0, %1}";
2517 return "%vpxor\t%0, %d0";
2520 return "pxor\t%0, %0";
2526 return "lea{q}\t{%a1, %0|%0, %a1}";
2529 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2530 if (get_attr_mode (insn) == MODE_SI)
2531 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2532 else if (which_alternative == 2)
2533 return "movabs{q}\t{%1, %0|%0, %1}";
2535 return "mov{q}\t{%1, %0|%0, %1}";
2539 (cond [(eq_attr "alternative" "5")
2540 (const_string "mmx")
2541 (eq_attr "alternative" "6,7,8,9,10")
2542 (const_string "mmxmov")
2543 (eq_attr "alternative" "11")
2544 (const_string "sselog1")
2545 (eq_attr "alternative" "12,13,14,15,16")
2546 (const_string "ssemov")
2547 (eq_attr "alternative" "17,18")
2548 (const_string "ssecvt")
2549 (eq_attr "alternative" "4")
2550 (const_string "multi")
2551 (match_operand:DI 1 "pic_32bit_operand" "")
2552 (const_string "lea")
2554 (const_string "imov")))
2557 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2559 (const_string "*")))
2560 (set (attr "length_immediate")
2562 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2564 (const_string "*")))
2565 (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
2566 (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
2567 (set (attr "prefix")
2568 (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
2569 (const_string "maybe_vex")
2570 (const_string "orig")))
2571 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2573 ;; Stores and loads of ax to arbitrary constant address.
2574 ;; We fake an second form of instruction to force reload to load address
2575 ;; into register when rax is not available
2576 (define_insn "*movabsdi_1_rex64"
2577 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2578 (match_operand:DI 1 "nonmemory_operand" "a,er"))]
2579 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2581 movabs{q}\t{%1, %P0|%P0, %1}
2582 mov{q}\t{%1, %a0|%a0, %1}"
2583 [(set_attr "type" "imov")
2584 (set_attr "modrm" "0,*")
2585 (set_attr "length_address" "8,0")
2586 (set_attr "length_immediate" "0,*")
2587 (set_attr "memory" "store")
2588 (set_attr "mode" "DI")])
2590 (define_insn "*movabsdi_2_rex64"
2591 [(set (match_operand:DI 0 "register_operand" "=a,r")
2592 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2593 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2595 movabs{q}\t{%P1, %0|%0, %P1}
2596 mov{q}\t{%a1, %0|%0, %a1}"
2597 [(set_attr "type" "imov")
2598 (set_attr "modrm" "0,*")
2599 (set_attr "length_address" "8,0")
2600 (set_attr "length_immediate" "0")
2601 (set_attr "memory" "load")
2602 (set_attr "mode" "DI")])
2604 ;; Convert impossible stores of immediate to existing instructions.
2605 ;; First try to get scratch register and go through it. In case this
2606 ;; fails, move by 32bit parts.
2608 [(match_scratch:DI 2 "r")
2609 (set (match_operand:DI 0 "memory_operand" "")
2610 (match_operand:DI 1 "immediate_operand" ""))]
2611 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2612 && !x86_64_immediate_operand (operands[1], DImode)"
2613 [(set (match_dup 2) (match_dup 1))
2614 (set (match_dup 0) (match_dup 2))]
2617 ;; We need to define this as both peepholer and splitter for case
2618 ;; peephole2 pass is not run.
2619 ;; "&& 1" is needed to keep it from matching the previous pattern.
2621 [(set (match_operand:DI 0 "memory_operand" "")
2622 (match_operand:DI 1 "immediate_operand" ""))]
2623 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2624 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2625 [(set (match_dup 2) (match_dup 3))
2626 (set (match_dup 4) (match_dup 5))]
2627 "split_di (&operands[0], 2, &operands[2], &operands[4]);")
2630 [(set (match_operand:DI 0 "memory_operand" "")
2631 (match_operand:DI 1 "immediate_operand" ""))]
2632 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2633 ? epilogue_completed : reload_completed)
2634 && !symbolic_operand (operands[1], DImode)
2635 && !x86_64_immediate_operand (operands[1], DImode)"
2636 [(set (match_dup 2) (match_dup 3))
2637 (set (match_dup 4) (match_dup 5))]
2638 "split_di (&operands[0], 2, &operands[2], &operands[4]);")
2640 (define_insn "*swapdi_rex64"
2641 [(set (match_operand:DI 0 "register_operand" "+r")
2642 (match_operand:DI 1 "register_operand" "+r"))
2647 [(set_attr "type" "imov")
2648 (set_attr "mode" "DI")
2649 (set_attr "pent_pair" "np")
2650 (set_attr "athlon_decode" "vector")
2651 (set_attr "amdfam10_decode" "double")])
2653 (define_expand "movoi"
2654 [(set (match_operand:OI 0 "nonimmediate_operand" "")
2655 (match_operand:OI 1 "general_operand" ""))]
2657 "ix86_expand_move (OImode, operands); DONE;")
2659 (define_insn "*movoi_internal"
2660 [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
2661 (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
2663 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2665 switch (which_alternative)
2668 return "vxorps\t%0, %0, %0";
2671 if (misaligned_operand (operands[0], OImode)
2672 || misaligned_operand (operands[1], OImode))
2673 return "vmovdqu\t{%1, %0|%0, %1}";
2675 return "vmovdqa\t{%1, %0|%0, %1}";
2680 [(set_attr "type" "sselog1,ssemov,ssemov")
2681 (set_attr "prefix" "vex")
2682 (set_attr "mode" "OI")])
2684 (define_expand "movti"
2685 [(set (match_operand:TI 0 "nonimmediate_operand" "")
2686 (match_operand:TI 1 "nonimmediate_operand" ""))]
2687 "TARGET_SSE || TARGET_64BIT"
2690 ix86_expand_move (TImode, operands);
2691 else if (push_operand (operands[0], TImode))
2692 ix86_expand_push (TImode, operands[1]);
2694 ix86_expand_vector_move (TImode, operands);
2698 (define_insn "*movti_internal"
2699 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
2700 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
2701 "TARGET_SSE && !TARGET_64BIT
2702 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2704 switch (which_alternative)
2707 if (get_attr_mode (insn) == MODE_V4SF)
2708 return "%vxorps\t%0, %d0";
2710 return "%vpxor\t%0, %d0";
2713 /* TDmode values are passed as TImode on the stack. Moving them
2714 to stack may result in unaligned memory access. */
2715 if (misaligned_operand (operands[0], TImode)
2716 || misaligned_operand (operands[1], TImode))
2718 if (get_attr_mode (insn) == MODE_V4SF)
2719 return "%vmovups\t{%1, %0|%0, %1}";
2721 return "%vmovdqu\t{%1, %0|%0, %1}";
2725 if (get_attr_mode (insn) == MODE_V4SF)
2726 return "%vmovaps\t{%1, %0|%0, %1}";
2728 return "%vmovdqa\t{%1, %0|%0, %1}";
2734 [(set_attr "type" "sselog1,ssemov,ssemov")
2735 (set_attr "prefix" "maybe_vex")
2737 (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2738 (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0)))
2739 (const_string "V4SF")
2740 (and (eq_attr "alternative" "2")
2741 (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2743 (const_string "V4SF")]
2744 (const_string "TI")))])
2746 (define_insn "*movti_rex64"
2747 [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
2748 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
2750 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2752 switch (which_alternative)
2758 if (get_attr_mode (insn) == MODE_V4SF)
2759 return "%vxorps\t%0, %d0";
2761 return "%vpxor\t%0, %d0";
2764 /* TDmode values are passed as TImode on the stack. Moving them
2765 to stack may result in unaligned memory access. */
2766 if (misaligned_operand (operands[0], TImode)
2767 || misaligned_operand (operands[1], TImode))
2769 if (get_attr_mode (insn) == MODE_V4SF)
2770 return "%vmovups\t{%1, %0|%0, %1}";
2772 return "%vmovdqu\t{%1, %0|%0, %1}";
2776 if (get_attr_mode (insn) == MODE_V4SF)
2777 return "%vmovaps\t{%1, %0|%0, %1}";
2779 return "%vmovdqa\t{%1, %0|%0, %1}";
2785 [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
2786 (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
2788 (cond [(eq_attr "alternative" "2,3")
2790 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2792 (const_string "V4SF")
2793 (const_string "TI"))
2794 (eq_attr "alternative" "4")
2796 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2798 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2800 (const_string "V4SF")
2801 (const_string "TI"))]
2802 (const_string "DI")))])
2805 [(set (match_operand:TI 0 "nonimmediate_operand" "")
2806 (match_operand:TI 1 "general_operand" ""))]
2807 "reload_completed && !SSE_REG_P (operands[0])
2808 && !SSE_REG_P (operands[1])"
2810 "ix86_split_long_move (operands); DONE;")
2812 ;; This expands to what emit_move_complex would generate if we didn't
2813 ;; have a movti pattern. Having this avoids problems with reload on
2814 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
2815 ;; to have around all the time.
2816 (define_expand "movcdi"
2817 [(set (match_operand:CDI 0 "nonimmediate_operand" "")
2818 (match_operand:CDI 1 "general_operand" ""))]
2821 if (push_operand (operands[0], CDImode))
2822 emit_move_complex_push (CDImode, operands[0], operands[1]);
2824 emit_move_complex_parts (operands[0], operands[1]);
2828 (define_expand "movsf"
2829 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2830 (match_operand:SF 1 "general_operand" ""))]
2832 "ix86_expand_move (SFmode, operands); DONE;")
2834 (define_insn "*pushsf"
2835 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2836 (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
2839 /* Anything else should be already split before reg-stack. */
2840 gcc_assert (which_alternative == 1);
2841 return "push{l}\t%1";
2843 [(set_attr "type" "multi,push,multi")
2844 (set_attr "unit" "i387,*,*")
2845 (set_attr "mode" "SF,SI,SF")])
2847 (define_insn "*pushsf_rex64"
2848 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2849 (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
2852 /* Anything else should be already split before reg-stack. */
2853 gcc_assert (which_alternative == 1);
2854 return "push{q}\t%q1";
2856 [(set_attr "type" "multi,push,multi")
2857 (set_attr "unit" "i387,*,*")
2858 (set_attr "mode" "SF,DI,SF")])
2861 [(set (match_operand:SF 0 "push_operand" "")
2862 (match_operand:SF 1 "memory_operand" ""))]
2864 && MEM_P (operands[1])
2865 && (operands[2] = find_constant_src (insn))"
2869 ;; %%% Kill this when call knows how to work this out.
2871 [(set (match_operand:SF 0 "push_operand" "")
2872 (match_operand:SF 1 "any_fp_register_operand" ""))]
2874 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
2875 (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
2878 [(set (match_operand:SF 0 "push_operand" "")
2879 (match_operand:SF 1 "any_fp_register_operand" ""))]
2881 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2882 (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
2884 (define_insn "*movsf_1"
2885 [(set (match_operand:SF 0 "nonimmediate_operand"
2886 "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
2887 (match_operand:SF 1 "general_operand"
2888 "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
2889 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
2890 && (reload_in_progress || reload_completed
2891 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2892 || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
2893 && standard_80387_constant_p (operands[1]))
2894 || GET_CODE (operands[1]) != CONST_DOUBLE
2895 || memory_operand (operands[0], SFmode))"
2897 switch (which_alternative)
2901 return output_387_reg_move (insn, operands);
2904 return standard_80387_constant_opcode (operands[1]);
2908 return "mov{l}\t{%1, %0|%0, %1}";
2910 if (get_attr_mode (insn) == MODE_TI)
2911 return "%vpxor\t%0, %d0";
2913 return "%vxorps\t%0, %d0";
2915 if (get_attr_mode (insn) == MODE_V4SF)
2916 return "%vmovaps\t{%1, %0|%0, %1}";
2918 return "%vmovss\t{%1, %d0|%d0, %1}";
2921 return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
2922 : "vmovss\t{%1, %0|%0, %1}";
2924 return "movss\t{%1, %0|%0, %1}";
2926 return "%vmovss\t{%1, %0|%0, %1}";
2928 case 9: case 10: case 14: case 15:
2929 return "movd\t{%1, %0|%0, %1}";
2931 return "%vmovd\t{%1, %0|%0, %1}";
2934 return "movq\t{%1, %0|%0, %1}";
2940 [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
2941 (set (attr "prefix")
2942 (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
2943 (const_string "maybe_vex")
2944 (const_string "orig")))
2946 (cond [(eq_attr "alternative" "3,4,9,10")
2948 (eq_attr "alternative" "5")
2950 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2952 (ne (symbol_ref "TARGET_SSE2")
2954 (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2957 (const_string "V4SF"))
2958 /* For architectures resolving dependencies on
2959 whole SSE registers use APS move to break dependency
2960 chains, otherwise use short move to avoid extra work.
2962 Do the same for architectures resolving dependencies on
2963 the parts. While in DF mode it is better to always handle
2964 just register parts, the SF mode is different due to lack
2965 of instructions to load just part of the register. It is
2966 better to maintain the whole registers in single format
2967 to avoid problems on using packed logical operations. */
2968 (eq_attr "alternative" "6")
2970 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2972 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2974 (const_string "V4SF")
2975 (const_string "SF"))
2976 (eq_attr "alternative" "11")
2977 (const_string "DI")]
2978 (const_string "SF")))])
2980 (define_insn "*swapsf"
2981 [(set (match_operand:SF 0 "fp_register_operand" "+f")
2982 (match_operand:SF 1 "fp_register_operand" "+f"))
2985 "reload_completed || TARGET_80387"
2987 if (STACK_TOP_P (operands[0]))
2992 [(set_attr "type" "fxch")
2993 (set_attr "mode" "SF")])
2995 (define_expand "movdf"
2996 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2997 (match_operand:DF 1 "general_operand" ""))]
2999 "ix86_expand_move (DFmode, operands); DONE;")
3001 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
3002 ;; Size of pushdf using integer instructions is 2+2*memory operand size
3003 ;; On the average, pushdf using integers can be still shorter. Allow this
3004 ;; pattern for optimize_size too.
3006 (define_insn "*pushdf_nointeger"
3007 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
3008 (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
3009 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
3011 /* This insn should be already split before reg-stack. */
3014 [(set_attr "type" "multi")
3015 (set_attr "unit" "i387,*,*,*")
3016 (set_attr "mode" "DF,SI,SI,DF")])
3018 (define_insn "*pushdf_integer"
3019 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
3020 (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
3021 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
3023 /* This insn should be already split before reg-stack. */
3026 [(set_attr "type" "multi")
3027 (set_attr "unit" "i387,*,*")
3028 (set_attr "mode" "DF,SI,DF")])
3030 ;; %%% Kill this when call knows how to work this out.
3032 [(set (match_operand:DF 0 "push_operand" "")
3033 (match_operand:DF 1 "any_fp_register_operand" ""))]
3035 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
3036 (set (mem:DF (reg:P SP_REG)) (match_dup 1))]
3040 [(set (match_operand:DF 0 "push_operand" "")
3041 (match_operand:DF 1 "general_operand" ""))]
3044 "ix86_split_long_move (operands); DONE;")
3046 ;; Moving is usually shorter when only FP registers are used. This separate
3047 ;; movdf pattern avoids the use of integer registers for FP operations
3048 ;; when optimizing for size.
3050 (define_insn "*movdf_nointeger"
3051 [(set (match_operand:DF 0 "nonimmediate_operand"
3052 "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
3053 (match_operand:DF 1 "general_operand"
3054 "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
3055 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3056 && ((optimize_function_for_size_p (cfun)
3057 || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
3058 && (reload_in_progress || reload_completed
3059 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3060 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3061 && optimize_function_for_size_p (cfun)
3062 && !memory_operand (operands[0], DFmode)
3063 && standard_80387_constant_p (operands[1]))
3064 || GET_CODE (operands[1]) != CONST_DOUBLE
3065 || ((optimize_function_for_size_p (cfun)
3066 || !TARGET_MEMORY_MISMATCH_STALL
3067 || reload_in_progress || reload_completed)
3068 && memory_operand (operands[0], DFmode)))"
3070 switch (which_alternative)
3074 return output_387_reg_move (insn, operands);
3077 return standard_80387_constant_opcode (operands[1]);
3083 switch (get_attr_mode (insn))
3086 return "%vxorps\t%0, %d0";
3088 return "%vxorpd\t%0, %d0";
3090 return "%vpxor\t%0, %d0";
3097 switch (get_attr_mode (insn))
3100 return "%vmovaps\t{%1, %0|%0, %1}";
3102 return "%vmovapd\t{%1, %0|%0, %1}";
3104 return "%vmovdqa\t{%1, %0|%0, %1}";
3106 return "%vmovq\t{%1, %0|%0, %1}";
3110 if (REG_P (operands[0]) && REG_P (operands[1]))
3111 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3113 return "vmovsd\t{%1, %0|%0, %1}";
3116 return "movsd\t{%1, %0|%0, %1}";
3120 if (REG_P (operands[0]))
3121 return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
3123 return "vmovlpd\t{%1, %0|%0, %1}";
3126 return "movlpd\t{%1, %0|%0, %1}";
3130 if (REG_P (operands[0]))
3131 return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
3133 return "vmovlps\t{%1, %0|%0, %1}";
3136 return "movlps\t{%1, %0|%0, %1}";
3145 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3146 (set (attr "prefix")
3147 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3148 (const_string "orig")
3149 (const_string "maybe_vex")))
3150 (set (attr "prefix_data16")
3151 (if_then_else (eq_attr "mode" "V1DF")
3153 (const_string "*")))
3155 (cond [(eq_attr "alternative" "0,1,2")
3157 (eq_attr "alternative" "3,4")
3160 /* For SSE1, we have many fewer alternatives. */
3161 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3162 (cond [(eq_attr "alternative" "5,6")
3163 (const_string "V4SF")
3165 (const_string "V2SF"))
3167 /* xorps is one byte shorter. */
3168 (eq_attr "alternative" "5")
3169 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3171 (const_string "V4SF")
3172 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3176 (const_string "V2DF"))
3178 /* For architectures resolving dependencies on
3179 whole SSE registers use APD move to break dependency
3180 chains, otherwise use short move to avoid extra work.
3182 movaps encodes one byte shorter. */
3183 (eq_attr "alternative" "6")
3185 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3187 (const_string "V4SF")
3188 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3190 (const_string "V2DF")
3192 (const_string "DF"))
3193 /* For architectures resolving dependencies on register
3194 parts we may avoid extra work to zero out upper part
3196 (eq_attr "alternative" "7")
3198 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3200 (const_string "V1DF")
3201 (const_string "DF"))
3203 (const_string "DF")))])
3205 (define_insn "*movdf_integer_rex64"
3206 [(set (match_operand:DF 0 "nonimmediate_operand"
3207 "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
3208 (match_operand:DF 1 "general_operand"
3209 "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
3210 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3211 && (reload_in_progress || reload_completed
3212 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3213 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3214 && optimize_function_for_size_p (cfun)
3215 && standard_80387_constant_p (operands[1]))
3216 || GET_CODE (operands[1]) != CONST_DOUBLE
3217 || memory_operand (operands[0], DFmode))"
3219 switch (which_alternative)
3223 return output_387_reg_move (insn, operands);
3226 return standard_80387_constant_opcode (operands[1]);
3233 switch (get_attr_mode (insn))
3236 return "%vxorps\t%0, %d0";
3238 return "%vxorpd\t%0, %d0";
3240 return "%vpxor\t%0, %d0";
3247 switch (get_attr_mode (insn))
3250 return "%vmovaps\t{%1, %0|%0, %1}";
3252 return "%vmovapd\t{%1, %0|%0, %1}";
3254 return "%vmovdqa\t{%1, %0|%0, %1}";
3256 return "%vmovq\t{%1, %0|%0, %1}";
3260 if (REG_P (operands[0]) && REG_P (operands[1]))
3261 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3263 return "vmovsd\t{%1, %0|%0, %1}";
3266 return "movsd\t{%1, %0|%0, %1}";
3268 return "%vmovlpd\t{%1, %d0|%d0, %1}";
3270 return "%vmovlps\t{%1, %d0|%d0, %1}";
3277 return "%vmovd\t{%1, %0|%0, %1}";
3283 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
3284 (set (attr "prefix")
3285 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3286 (const_string "orig")
3287 (const_string "maybe_vex")))
3288 (set (attr "prefix_data16")
3289 (if_then_else (eq_attr "mode" "V1DF")
3291 (const_string "*")))
3293 (cond [(eq_attr "alternative" "0,1,2")
3295 (eq_attr "alternative" "3,4,9,10")
3298 /* For SSE1, we have many fewer alternatives. */
3299 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3300 (cond [(eq_attr "alternative" "5,6")
3301 (const_string "V4SF")
3303 (const_string "V2SF"))
3305 /* xorps is one byte shorter. */
3306 (eq_attr "alternative" "5")
3307 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3309 (const_string "V4SF")
3310 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3314 (const_string "V2DF"))
3316 /* For architectures resolving dependencies on
3317 whole SSE registers use APD move to break dependency
3318 chains, otherwise use short move to avoid extra work.
3320 movaps encodes one byte shorter. */
3321 (eq_attr "alternative" "6")
3323 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3325 (const_string "V4SF")
3326 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3328 (const_string "V2DF")
3330 (const_string "DF"))
3331 /* For architectures resolving dependencies on register
3332 parts we may avoid extra work to zero out upper part
3334 (eq_attr "alternative" "7")
3336 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3338 (const_string "V1DF")
3339 (const_string "DF"))
3341 (const_string "DF")))])
3343 (define_insn "*movdf_integer"
3344 [(set (match_operand:DF 0 "nonimmediate_operand"
3345 "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
3346 (match_operand:DF 1 "general_operand"
3347 "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
3348 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3349 && optimize_function_for_speed_p (cfun)
3350 && TARGET_INTEGER_DFMODE_MOVES
3351 && (reload_in_progress || reload_completed
3352 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3353 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3354 && optimize_function_for_size_p (cfun)
3355 && standard_80387_constant_p (operands[1]))
3356 || GET_CODE (operands[1]) != CONST_DOUBLE
3357 || memory_operand (operands[0], DFmode))"
3359 switch (which_alternative)
3363 return output_387_reg_move (insn, operands);
3366 return standard_80387_constant_opcode (operands[1]);
3373 switch (get_attr_mode (insn))
3376 return "xorps\t%0, %0";
3378 return "xorpd\t%0, %0";
3380 return "pxor\t%0, %0";
3387 switch (get_attr_mode (insn))
3390 return "movaps\t{%1, %0|%0, %1}";
3392 return "movapd\t{%1, %0|%0, %1}";
3394 return "movdqa\t{%1, %0|%0, %1}";
3396 return "movq\t{%1, %0|%0, %1}";
3398 return "movsd\t{%1, %0|%0, %1}";
3400 return "movlpd\t{%1, %0|%0, %1}";
3402 return "movlps\t{%1, %0|%0, %1}";
3411 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3412 (set (attr "prefix_data16")
3413 (if_then_else (eq_attr "mode" "V1DF")
3415 (const_string "*")))
3417 (cond [(eq_attr "alternative" "0,1,2")
3419 (eq_attr "alternative" "3,4")
3422 /* For SSE1, we have many fewer alternatives. */
3423 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3424 (cond [(eq_attr "alternative" "5,6")
3425 (const_string "V4SF")
3427 (const_string "V2SF"))
3429 /* xorps is one byte shorter. */
3430 (eq_attr "alternative" "5")
3431 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3433 (const_string "V4SF")
3434 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3438 (const_string "V2DF"))
3440 /* For architectures resolving dependencies on
3441 whole SSE registers use APD move to break dependency
3442 chains, otherwise use short move to avoid extra work.
3444 movaps encodes one byte shorter. */
3445 (eq_attr "alternative" "6")
3447 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3449 (const_string "V4SF")
3450 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3452 (const_string "V2DF")
3454 (const_string "DF"))
3455 /* For architectures resolving dependencies on register
3456 parts we may avoid extra work to zero out upper part
3458 (eq_attr "alternative" "7")
3460 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3462 (const_string "V1DF")
3463 (const_string "DF"))
3465 (const_string "DF")))])
3468 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3469 (match_operand:DF 1 "general_operand" ""))]
3471 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3472 && ! (ANY_FP_REG_P (operands[0]) ||
3473 (GET_CODE (operands[0]) == SUBREG
3474 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3475 && ! (ANY_FP_REG_P (operands[1]) ||
3476 (GET_CODE (operands[1]) == SUBREG
3477 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3479 "ix86_split_long_move (operands); DONE;")
3481 (define_insn "*swapdf"
3482 [(set (match_operand:DF 0 "fp_register_operand" "+f")
3483 (match_operand:DF 1 "fp_register_operand" "+f"))
3486 "reload_completed || TARGET_80387"
3488 if (STACK_TOP_P (operands[0]))
3493 [(set_attr "type" "fxch")
3494 (set_attr "mode" "DF")])
3496 (define_expand "movxf"
3497 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3498 (match_operand:XF 1 "general_operand" ""))]
3500 "ix86_expand_move (XFmode, operands); DONE;")
3502 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
3503 ;; Size of pushdf using integer instructions is 3+3*memory operand size
3504 ;; Pushing using integer instructions is longer except for constants
3505 ;; and direct memory references.
3506 ;; (assuming that any given constant is pushed only once, but this ought to be
3507 ;; handled elsewhere).
3509 (define_insn "*pushxf_nointeger"
3510 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
3511 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
3512 "optimize_function_for_size_p (cfun)"
3514 /* This insn should be already split before reg-stack. */
3517 [(set_attr "type" "multi")
3518 (set_attr "unit" "i387,*,*")
3519 (set_attr "mode" "XF,SI,SI")])
3521 (define_insn "*pushxf_integer"
3522 [(set (match_operand:XF 0 "push_operand" "=<,<")
3523 (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
3524 "optimize_function_for_speed_p (cfun)"
3526 /* This insn should be already split before reg-stack. */
3529 [(set_attr "type" "multi")
3530 (set_attr "unit" "i387,*")
3531 (set_attr "mode" "XF,SI")])
3534 [(set (match_operand 0 "push_operand" "")
3535 (match_operand 1 "general_operand" ""))]
3537 && (GET_MODE (operands[0]) == XFmode
3538 || GET_MODE (operands[0]) == DFmode)
3539 && !ANY_FP_REG_P (operands[1])"
3541 "ix86_split_long_move (operands); DONE;")
3544 [(set (match_operand:XF 0 "push_operand" "")
3545 (match_operand:XF 1 "any_fp_register_operand" ""))]
3547 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
3548 (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
3549 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3551 ;; Do not use integer registers when optimizing for size
3552 (define_insn "*movxf_nointeger"
3553 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
3554 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
3555 "optimize_function_for_size_p (cfun)
3556 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3557 && (reload_in_progress || reload_completed
3558 || standard_80387_constant_p (operands[1])
3559 || GET_CODE (operands[1]) != CONST_DOUBLE
3560 || memory_operand (operands[0], XFmode))"
3562 switch (which_alternative)
3566 return output_387_reg_move (insn, operands);
3569 return standard_80387_constant_opcode (operands[1]);
3577 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3578 (set_attr "mode" "XF,XF,XF,SI,SI")])
3580 (define_insn "*movxf_integer"
3581 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
3582 (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
3583 "optimize_function_for_speed_p (cfun)
3584 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3585 && (reload_in_progress || reload_completed
3586 || GET_CODE (operands[1]) != CONST_DOUBLE
3587 || memory_operand (operands[0], XFmode))"
3589 switch (which_alternative)
3593 return output_387_reg_move (insn, operands);
3596 return standard_80387_constant_opcode (operands[1]);
3605 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3606 (set_attr "mode" "XF,XF,XF,SI,SI")])
3608 (define_expand "movtf"
3609 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3610 (match_operand:TF 1 "nonimmediate_operand" ""))]
3613 ix86_expand_move (TFmode, operands);
3617 (define_insn "*movtf_internal"
3618 [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
3619 (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
3621 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
3623 switch (which_alternative)
3627 if (get_attr_mode (insn) == MODE_V4SF)
3628 return "%vmovaps\t{%1, %0|%0, %1}";
3630 return "%vmovdqa\t{%1, %0|%0, %1}";
3632 if (get_attr_mode (insn) == MODE_V4SF)
3633 return "%vxorps\t%0, %d0";
3635 return "%vpxor\t%0, %d0";
3643 [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
3644 (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
3646 (cond [(eq_attr "alternative" "0,2")
3648 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
3650 (const_string "V4SF")
3651 (const_string "TI"))
3652 (eq_attr "alternative" "1")
3654 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
3656 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
3658 (const_string "V4SF")
3659 (const_string "TI"))]
3660 (const_string "DI")))])
3662 (define_insn "*pushtf_sse"
3663 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
3664 (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
3667 /* This insn should be already split before reg-stack. */
3670 [(set_attr "type" "multi")
3671 (set_attr "unit" "sse,*,*")
3672 (set_attr "mode" "TF,SI,SI")])
3675 [(set (match_operand:TF 0 "push_operand" "")
3676 (match_operand:TF 1 "general_operand" ""))]
3677 "TARGET_SSE2 && reload_completed
3678 && !SSE_REG_P (operands[1])"
3680 "ix86_split_long_move (operands); DONE;")
3683 [(set (match_operand:TF 0 "push_operand" "")
3684 (match_operand:TF 1 "any_fp_register_operand" ""))]
3686 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
3687 (set (mem:TF (reg:P SP_REG)) (match_dup 1))]
3691 [(set (match_operand 0 "nonimmediate_operand" "")
3692 (match_operand 1 "general_operand" ""))]
3694 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3695 && GET_MODE (operands[0]) == XFmode
3696 && ! (ANY_FP_REG_P (operands[0]) ||
3697 (GET_CODE (operands[0]) == SUBREG
3698 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3699 && ! (ANY_FP_REG_P (operands[1]) ||
3700 (GET_CODE (operands[1]) == SUBREG
3701 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3703 "ix86_split_long_move (operands); DONE;")
3706 [(set (match_operand 0 "register_operand" "")
3707 (match_operand 1 "memory_operand" ""))]
3709 && MEM_P (operands[1])
3710 && (GET_MODE (operands[0]) == TFmode
3711 || GET_MODE (operands[0]) == XFmode
3712 || GET_MODE (operands[0]) == SFmode
3713 || GET_MODE (operands[0]) == DFmode)
3714 && (operands[2] = find_constant_src (insn))"
3715 [(set (match_dup 0) (match_dup 2))]
3717 rtx c = operands[2];
3718 rtx r = operands[0];
3720 if (GET_CODE (r) == SUBREG)
3725 if (!standard_sse_constant_p (c))
3728 else if (FP_REG_P (r))
3730 if (!standard_80387_constant_p (c))
3733 else if (MMX_REG_P (r))
3738 [(set (match_operand 0 "register_operand" "")
3739 (float_extend (match_operand 1 "memory_operand" "")))]
3741 && MEM_P (operands[1])
3742 && (GET_MODE (operands[0]) == TFmode
3743 || GET_MODE (operands[0]) == XFmode
3744 || GET_MODE (operands[0]) == SFmode
3745 || GET_MODE (operands[0]) == DFmode)
3746 && (operands[2] = find_constant_src (insn))"
3747 [(set (match_dup 0) (match_dup 2))]
3749 rtx c = operands[2];
3750 rtx r = operands[0];
3752 if (GET_CODE (r) == SUBREG)
3757 if (!standard_sse_constant_p (c))
3760 else if (FP_REG_P (r))
3762 if (!standard_80387_constant_p (c))
3765 else if (MMX_REG_P (r))
3769 (define_insn "swapxf"
3770 [(set (match_operand:XF 0 "register_operand" "+f")
3771 (match_operand:XF 1 "register_operand" "+f"))
3776 if (STACK_TOP_P (operands[0]))
3781 [(set_attr "type" "fxch")
3782 (set_attr "mode" "XF")])
3784 ;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
3786 [(set (match_operand:X87MODEF 0 "register_operand" "")
3787 (match_operand:X87MODEF 1 "immediate_operand" ""))]
3788 "reload_completed && FP_REGNO_P (REGNO (operands[0]))
3789 && (standard_80387_constant_p (operands[1]) == 8
3790 || standard_80387_constant_p (operands[1]) == 9)"
3791 [(set (match_dup 0)(match_dup 1))
3793 (neg:X87MODEF (match_dup 0)))]
3797 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
3798 if (real_isnegzero (&r))
3799 operands[1] = CONST0_RTX (<MODE>mode);
3801 operands[1] = CONST1_RTX (<MODE>mode);
3805 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3806 (match_operand:TF 1 "general_operand" ""))]
3808 && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
3810 "ix86_split_long_move (operands); DONE;")
3812 ;; Zero extension instructions
3814 (define_expand "zero_extendhisi2"
3815 [(set (match_operand:SI 0 "register_operand" "")
3816 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3819 if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3821 operands[1] = force_reg (HImode, operands[1]);
3822 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
3827 (define_insn "zero_extendhisi2_and"
3828 [(set (match_operand:SI 0 "register_operand" "=r")
3829 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
3830 (clobber (reg:CC FLAGS_REG))]
3831 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3833 [(set_attr "type" "alu1")
3834 (set_attr "mode" "SI")])
3837 [(set (match_operand:SI 0 "register_operand" "")
3838 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
3839 (clobber (reg:CC FLAGS_REG))]
3840 "reload_completed && TARGET_ZERO_EXTEND_WITH_AND
3841 && optimize_function_for_speed_p (cfun)"
3842 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
3843 (clobber (reg:CC FLAGS_REG))])]
3846 (define_insn "*zero_extendhisi2_movzwl"
3847 [(set (match_operand:SI 0 "register_operand" "=r")
3848 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3849 "!TARGET_ZERO_EXTEND_WITH_AND
3850 || optimize_function_for_size_p (cfun)"
3851 "movz{wl|x}\t{%1, %0|%0, %1}"
3852 [(set_attr "type" "imovx")
3853 (set_attr "mode" "SI")])
3855 (define_expand "zero_extendqihi2"
3857 [(set (match_operand:HI 0 "register_operand" "")
3858 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3859 (clobber (reg:CC FLAGS_REG))])]
3863 (define_insn "*zero_extendqihi2_and"
3864 [(set (match_operand:HI 0 "register_operand" "=r,?&q")
3865 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3866 (clobber (reg:CC FLAGS_REG))]
3867 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3869 [(set_attr "type" "alu1")
3870 (set_attr "mode" "HI")])
3872 (define_insn "*zero_extendqihi2_movzbw_and"
3873 [(set (match_operand:HI 0 "register_operand" "=r,r")
3874 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3875 (clobber (reg:CC FLAGS_REG))]
3876 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun)"
3878 [(set_attr "type" "imovx,alu1")
3879 (set_attr "mode" "HI")])
3881 ; zero extend to SImode here to avoid partial register stalls
3882 (define_insn "*zero_extendqihi2_movzbl"
3883 [(set (match_operand:HI 0 "register_operand" "=r")
3884 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3885 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_