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
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 ;; E,e -- likewise, but for compare-and-branch fused insn.
34 ;; F,f -- likewise, but for floating-point.
35 ;; O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.",
37 ;; R -- print the prefix for register names.
38 ;; z -- print the opcode suffix for the size of the current operand.
39 ;; Z -- likewise, with special suffixes for x87 instructions.
40 ;; * -- print a star (in certain assembler syntax)
41 ;; A -- print an absolute memory reference.
42 ;; w -- print the operand as if it's a "word" (HImode) even if it isn't.
43 ;; s -- print a shift double count, followed by the assemblers argument
45 ;; b -- print the QImode name of the register for the indicated operand.
46 ;; %b0 would print %al if operands[0] is reg 0.
47 ;; w -- likewise, print the HImode name of the register.
48 ;; k -- likewise, print the SImode name of the register.
49 ;; q -- likewise, print the DImode name of the register.
50 ;; x -- likewise, print the V4SFmode name of the register.
51 ;; t -- likewise, print the V8SFmode name of the register.
52 ;; h -- print the QImode name for a "high" register, either ah, bh, ch or dh.
53 ;; y -- print "st(0)" instead of "st" as a register.
54 ;; d -- print duplicated register operand for AVX instruction.
55 ;; D -- print condition for SSE cmp instruction.
56 ;; P -- if PIC, print an @PLT suffix.
57 ;; X -- don't print any sort of PIC '@' suffix for a symbol.
58 ;; & -- print some in-use local-dynamic symbol name.
59 ;; H -- print a memory address offset by 8; used for sse high-parts
60 ;; Y -- print condition for XOP pcom* instruction.
61 ;; + -- print a branch hint as 'cs' or 'ds' prefix
62 ;; ; -- print a semicolon (after prefixes due to bug in older gas).
67 [; Relocation specifiers
78 (UNSPEC_MACHOPIC_OFFSET 10)
81 (UNSPEC_STACK_ALLOC 11)
83 (UNSPEC_SSE_PROLOGUE_SAVE 13)
87 (UNSPEC_SET_GOT_OFFSET 17)
88 (UNSPEC_MEMORY_BLOCKAGE 18)
93 (UNSPEC_TLS_LD_BASE 22)
96 ; Other random patterns
101 (UNSPEC_ADD_CARRY 34)
104 (UNSPEC_LD_MPIC 38) ; load_macho_picbase
105 (UNSPEC_TRUNC_NOOP 39)
107 ; For SSE/MMX support:
108 (UNSPEC_FIX_NOTRUNC 40)
125 (UNSPEC_MS_TO_SYSV_CALL 48)
127 ; Generic math support
129 (UNSPEC_IEEE_MIN 51) ; not commutative
130 (UNSPEC_IEEE_MAX 52) ; not commutative
145 (UNSPEC_FRNDINT_FLOOR 70)
146 (UNSPEC_FRNDINT_CEIL 71)
147 (UNSPEC_FRNDINT_TRUNC 72)
148 (UNSPEC_FRNDINT_MASK_PM 73)
149 (UNSPEC_FIST_FLOOR 74)
150 (UNSPEC_FIST_CEIL 75)
152 ; x87 Double output FP
153 (UNSPEC_SINCOS_COS 80)
154 (UNSPEC_SINCOS_SIN 81)
155 (UNSPEC_XTRACT_FRACT 84)
156 (UNSPEC_XTRACT_EXP 85)
157 (UNSPEC_FSCALE_FRACT 86)
158 (UNSPEC_FSCALE_EXP 87)
170 (UNSPEC_SP_TLS_SET 102)
171 (UNSPEC_SP_TLS_TEST 103)
181 (UNSPEC_INSERTQI 132)
186 (UNSPEC_INSERTPS 135)
188 (UNSPEC_MOVNTDQA 137)
190 (UNSPEC_PHMINPOSUW 139)
196 (UNSPEC_PCMPESTR 144)
197 (UNSPEC_PCMPISTR 145)
200 (UNSPEC_FMA4_INTRINSIC 150)
201 (UNSPEC_FMA4_FMADDSUB 151)
202 (UNSPEC_FMA4_FMSUBADD 152)
203 (UNSPEC_XOP_UNSIGNED_CMP 151)
204 (UNSPEC_XOP_TRUEFALSE 152)
205 (UNSPEC_XOP_PERMUTE 153)
210 (UNSPEC_AESENCLAST 160)
212 (UNSPEC_AESDECLAST 162)
214 (UNSPEC_AESKEYGENASSIST 164)
222 (UNSPEC_VPERMIL2 168)
223 (UNSPEC_VPERMIL2F128 169)
224 (UNSPEC_MASKLOAD 170)
225 (UNSPEC_MASKSTORE 171)
231 [(UNSPECV_BLOCKAGE 0)
232 (UNSPECV_STACK_PROBE 1)
244 (UNSPECV_PROLOGUE_USE 14)
246 (UNSPECV_VZEROALL 16)
247 (UNSPECV_VZEROUPPER 17)
251 (UNSPECV_VSWAPMOV 21)
252 (UNSPECV_LLWP_INTRINSIC 22)
253 (UNSPECV_SLWP_INTRINSIC 23)
254 (UNSPECV_LWPVAL_INTRINSIC 24)
255 (UNSPECV_LWPINS_INTRINSIC 25)
258 ;; Constants to represent pcomtrue/pcomfalse variants
268 ;; Constants used in the XOP pperm instruction
270 [(PPERM_SRC 0x00) /* copy source */
271 (PPERM_INVERT 0x20) /* invert source */
272 (PPERM_REVERSE 0x40) /* bit reverse source */
273 (PPERM_REV_INV 0x60) /* bit reverse & invert src */
274 (PPERM_ZERO 0x80) /* all 0's */
275 (PPERM_ONES 0xa0) /* all 1's */
276 (PPERM_SIGN 0xc0) /* propagate sign bit */
277 (PPERM_INV_SIGN 0xe0) /* invert & propagate sign */
278 (PPERM_SRC1 0x00) /* use first source byte */
279 (PPERM_SRC2 0x10) /* use second source byte */
282 ;; Registers by name.
335 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
338 ;; In C guard expressions, put expressions which may be compile-time
339 ;; constants first. This allows for better optimization. For
340 ;; example, write "TARGET_64BIT && reload_completed", not
341 ;; "reload_completed && TARGET_64BIT".
345 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,atom,
347 (const (symbol_ref "ix86_schedule")))
349 ;; A basic instruction type. Refinements due to arguments to be
350 ;; provided in other attributes.
353 alu,alu1,negnot,imov,imovx,lea,
354 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
355 icmp,test,ibr,setcc,icmov,
356 push,pop,call,callv,leave,
358 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
359 sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
360 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
361 ssemuladd,sse4arg,lwp,
362 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
363 (const_string "other"))
365 ;; Main data type used by the insn
367 "unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF"
368 (const_string "unknown"))
370 ;; The CPU unit operations uses.
371 (define_attr "unit" "integer,i387,sse,mmx,unknown"
372 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
373 (const_string "i387")
374 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
375 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
376 ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
378 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
380 (eq_attr "type" "other")
381 (const_string "unknown")]
382 (const_string "integer")))
384 ;; The (bounding maximum) length of an instruction immediate.
385 (define_attr "length_immediate" ""
386 (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
389 (eq_attr "unit" "i387,sse,mmx")
391 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
393 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
394 (eq_attr "type" "imov,test")
395 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
396 (eq_attr "type" "call")
397 (if_then_else (match_operand 0 "constant_call_address_operand" "")
400 (eq_attr "type" "callv")
401 (if_then_else (match_operand 1 "constant_call_address_operand" "")
404 ;; We don't know the size before shorten_branches. Expect
405 ;; the instruction to fit for better scheduling.
406 (eq_attr "type" "ibr")
409 (symbol_ref "/* Update immediate_length and other attributes! */
410 gcc_unreachable (),1")))
412 ;; The (bounding maximum) length of an instruction address.
413 (define_attr "length_address" ""
414 (cond [(eq_attr "type" "str,other,multi,fxch")
416 (and (eq_attr "type" "call")
417 (match_operand 0 "constant_call_address_operand" ""))
419 (and (eq_attr "type" "callv")
420 (match_operand 1 "constant_call_address_operand" ""))
423 (symbol_ref "ix86_attr_length_address_default (insn)")))
425 ;; Set when length prefix is used.
426 (define_attr "prefix_data16" ""
427 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
429 (eq_attr "mode" "HI")
431 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI"))
436 ;; Set when string REP prefix is used.
437 (define_attr "prefix_rep" ""
438 (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
440 (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
445 ;; Set when 0f opcode prefix is used.
446 (define_attr "prefix_0f" ""
448 (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
449 (eq_attr "unit" "sse,mmx"))
453 ;; Set when REX opcode prefix is used.
454 (define_attr "prefix_rex" ""
455 (cond [(ne (symbol_ref "!TARGET_64BIT") (const_int 0))
457 (and (eq_attr "mode" "DI")
458 (and (eq_attr "type" "!push,pop,call,callv,leave,ibr")
459 (eq_attr "unit" "!mmx")))
461 (and (eq_attr "mode" "QI")
462 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
465 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
468 (and (eq_attr "type" "imovx")
469 (match_operand:QI 1 "ext_QIreg_operand" ""))
474 ;; There are also additional prefixes in 3DNOW, SSSE3.
475 ;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
476 ;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
477 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
478 (define_attr "prefix_extra" ""
479 (cond [(eq_attr "type" "ssemuladd,sse4arg")
481 (eq_attr "type" "sseiadd1,ssecvt1")
486 ;; Prefix used: original, VEX or maybe VEX.
487 (define_attr "prefix" "orig,vex,maybe_vex"
488 (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
490 (const_string "orig")))
492 ;; VEX W bit is used.
493 (define_attr "prefix_vex_w" "" (const_int 0))
495 ;; The length of VEX prefix
496 ;; Only instructions with 0f prefix can have 2 byte VEX prefix,
497 ;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is
498 ;; still prefix_0f 1, with prefix_extra 1.
499 (define_attr "length_vex" ""
500 (if_then_else (and (eq_attr "prefix_0f" "1")
501 (eq_attr "prefix_extra" "0"))
502 (if_then_else (eq_attr "prefix_vex_w" "1")
503 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
504 (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
505 (if_then_else (eq_attr "prefix_vex_w" "1")
506 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
507 (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
509 ;; Set when modrm byte is used.
510 (define_attr "modrm" ""
511 (cond [(eq_attr "type" "str,leave")
513 (eq_attr "unit" "i387")
515 (and (eq_attr "type" "incdec")
516 (and (eq (symbol_ref "TARGET_64BIT") (const_int 0))
517 (ior (match_operand:SI 1 "register_operand" "")
518 (match_operand:HI 1 "register_operand" ""))))
520 (and (eq_attr "type" "push")
521 (not (match_operand 1 "memory_operand" "")))
523 (and (eq_attr "type" "pop")
524 (not (match_operand 0 "memory_operand" "")))
526 (and (eq_attr "type" "imov")
527 (and (not (eq_attr "mode" "DI"))
528 (ior (and (match_operand 0 "register_operand" "")
529 (match_operand 1 "immediate_operand" ""))
530 (ior (and (match_operand 0 "ax_reg_operand" "")
531 (match_operand 1 "memory_displacement_only_operand" ""))
532 (and (match_operand 0 "memory_displacement_only_operand" "")
533 (match_operand 1 "ax_reg_operand" ""))))))
535 (and (eq_attr "type" "call")
536 (match_operand 0 "constant_call_address_operand" ""))
538 (and (eq_attr "type" "callv")
539 (match_operand 1 "constant_call_address_operand" ""))
541 (and (eq_attr "type" "alu,alu1,icmp,test")
542 (match_operand 0 "ax_reg_operand" ""))
543 (symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))")
547 ;; The (bounding maximum) length of an instruction in bytes.
548 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
549 ;; Later we may want to split them and compute proper length as for
551 (define_attr "length" ""
552 (cond [(eq_attr "type" "other,multi,fistp,frndint")
554 (eq_attr "type" "fcmp")
556 (eq_attr "unit" "i387")
558 (plus (attr "prefix_data16")
559 (attr "length_address")))
560 (ior (eq_attr "prefix" "vex")
561 (and (eq_attr "prefix" "maybe_vex")
562 (ne (symbol_ref "TARGET_AVX") (const_int 0))))
563 (plus (attr "length_vex")
564 (plus (attr "length_immediate")
566 (attr "length_address"))))]
567 (plus (plus (attr "modrm")
568 (plus (attr "prefix_0f")
569 (plus (attr "prefix_rex")
570 (plus (attr "prefix_extra")
572 (plus (attr "prefix_rep")
573 (plus (attr "prefix_data16")
574 (plus (attr "length_immediate")
575 (attr "length_address")))))))
577 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
578 ;; `store' if there is a simple memory reference therein, or `unknown'
579 ;; if the instruction is complex.
581 (define_attr "memory" "none,load,store,both,unknown"
582 (cond [(eq_attr "type" "other,multi,str,lwp")
583 (const_string "unknown")
584 (eq_attr "type" "lea,fcmov,fpspc")
585 (const_string "none")
586 (eq_attr "type" "fistp,leave")
587 (const_string "both")
588 (eq_attr "type" "frndint")
589 (const_string "load")
590 (eq_attr "type" "push")
591 (if_then_else (match_operand 1 "memory_operand" "")
592 (const_string "both")
593 (const_string "store"))
594 (eq_attr "type" "pop")
595 (if_then_else (match_operand 0 "memory_operand" "")
596 (const_string "both")
597 (const_string "load"))
598 (eq_attr "type" "setcc")
599 (if_then_else (match_operand 0 "memory_operand" "")
600 (const_string "store")
601 (const_string "none"))
602 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
603 (if_then_else (ior (match_operand 0 "memory_operand" "")
604 (match_operand 1 "memory_operand" ""))
605 (const_string "load")
606 (const_string "none"))
607 (eq_attr "type" "ibr")
608 (if_then_else (match_operand 0 "memory_operand" "")
609 (const_string "load")
610 (const_string "none"))
611 (eq_attr "type" "call")
612 (if_then_else (match_operand 0 "constant_call_address_operand" "")
613 (const_string "none")
614 (const_string "load"))
615 (eq_attr "type" "callv")
616 (if_then_else (match_operand 1 "constant_call_address_operand" "")
617 (const_string "none")
618 (const_string "load"))
619 (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
620 (match_operand 1 "memory_operand" ""))
621 (const_string "both")
622 (and (match_operand 0 "memory_operand" "")
623 (match_operand 1 "memory_operand" ""))
624 (const_string "both")
625 (match_operand 0 "memory_operand" "")
626 (const_string "store")
627 (match_operand 1 "memory_operand" "")
628 (const_string "load")
630 "!alu1,negnot,ishift1,
631 imov,imovx,icmp,test,bitmanip,
633 sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
634 sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
635 (match_operand 2 "memory_operand" ""))
636 (const_string "load")
637 (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
638 (match_operand 3 "memory_operand" ""))
639 (const_string "load")
641 (const_string "none")))
643 ;; Indicates if an instruction has both an immediate and a displacement.
645 (define_attr "imm_disp" "false,true,unknown"
646 (cond [(eq_attr "type" "other,multi")
647 (const_string "unknown")
648 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
649 (and (match_operand 0 "memory_displacement_operand" "")
650 (match_operand 1 "immediate_operand" "")))
651 (const_string "true")
652 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
653 (and (match_operand 0 "memory_displacement_operand" "")
654 (match_operand 2 "immediate_operand" "")))
655 (const_string "true")
657 (const_string "false")))
659 ;; Indicates if an FP operation has an integer source.
661 (define_attr "fp_int_src" "false,true"
662 (const_string "false"))
664 ;; Defines rounding mode of an FP operation.
666 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
667 (const_string "any"))
669 ;; Define attribute to classify add/sub insns that consumes carry flag (CF)
670 (define_attr "use_carry" "0,1" (const_string "0"))
672 ;; Define attribute to indicate unaligned ssemov insns
673 (define_attr "movu" "0,1" (const_string "0"))
675 ;; Describe a user's asm statement.
676 (define_asm_attributes
677 [(set_attr "length" "128")
678 (set_attr "type" "multi")])
680 ;; All integer comparison codes.
681 (define_code_iterator int_cond [ne eq ge gt le lt geu gtu leu ltu])
683 ;; All floating-point comparison codes.
684 (define_code_iterator fp_cond [unordered ordered
685 uneq unge ungt unle unlt ltgt])
687 (define_code_iterator plusminus [plus minus])
689 (define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus])
691 ;; Base name for define_insn
692 (define_code_attr plusminus_insn
693 [(plus "add") (ss_plus "ssadd") (us_plus "usadd")
694 (minus "sub") (ss_minus "sssub") (us_minus "ussub")])
696 ;; Base name for insn mnemonic.
697 (define_code_attr plusminus_mnemonic
698 [(plus "add") (ss_plus "adds") (us_plus "addus")
699 (minus "sub") (ss_minus "subs") (us_minus "subus")])
700 (define_code_attr plusminus_carry_mnemonic
701 [(plus "adc") (minus "sbb")])
703 ;; Mark commutative operators as such in constraints.
704 (define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%")
705 (minus "") (ss_minus "") (us_minus "")])
707 ;; Mapping of signed max and min
708 (define_code_iterator smaxmin [smax smin])
710 ;; Mapping of unsigned max and min
711 (define_code_iterator umaxmin [umax umin])
713 ;; Mapping of signed/unsigned max and min
714 (define_code_iterator maxmin [smax smin umax umin])
716 ;; Base name for integer and FP insn mnemonic
717 (define_code_attr maxminiprefix [(smax "maxs") (smin "mins")
718 (umax "maxu") (umin "minu")])
719 (define_code_attr maxminfprefix [(smax "max") (smin "min")])
721 ;; Mapping of logic operators
722 (define_code_iterator any_logic [and ior xor])
723 (define_code_iterator any_or [ior xor])
725 ;; Base name for insn mnemonic.
726 (define_code_attr logicprefix [(and "and") (ior "or") (xor "xor")])
728 ;; Mapping of abs neg operators
729 (define_code_iterator absneg [abs neg])
731 ;; Base name for x87 insn mnemonic.
732 (define_code_attr absnegprefix [(abs "abs") (neg "chs")])
734 ;; Used in signed and unsigned widening multiplications.
735 (define_code_iterator any_extend [sign_extend zero_extend])
737 ;; Various insn prefixes for signed and unsigned operations.
738 (define_code_attr u [(sign_extend "") (zero_extend "u")
739 (div "") (udiv "u")])
740 (define_code_attr s [(sign_extend "s") (zero_extend "u")])
742 ;; Used in signed and unsigned divisions.
743 (define_code_iterator any_div [div udiv])
745 ;; Instruction prefix for signed and unsigned operations.
746 (define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
747 (div "i") (udiv "")])
749 ;; All single word integer modes.
750 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
752 ;; Single word integer modes without DImode.
753 (define_mode_iterator SWI124 [QI HI SI])
755 ;; Single word integer modes without QImode.
756 (define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
758 ;; Single word integer modes without QImode and HImode.
759 (define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")])
761 ;; All math-dependant single and double word integer modes.
762 (define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH")
763 (HI "TARGET_HIMODE_MATH")
764 SI DI (TI "TARGET_64BIT")])
766 ;; Math-dependant single word integer modes.
767 (define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH")
768 (HI "TARGET_HIMODE_MATH")
769 SI (DI "TARGET_64BIT")])
771 ;; Math-dependant single word integer modes without QImode.
772 (define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH")
773 SI (DI "TARGET_64BIT")])
775 ;; Half mode for double word integer modes.
776 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
777 (DI "TARGET_64BIT")])
779 ;; Double word integer modes.
780 (define_mode_attr DWI [(SI "DI") (DI "TI")])
781 (define_mode_attr dwi [(SI "di") (DI "ti")])
783 ;; Instruction suffix for integer modes.
784 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
786 ;; Register class for integer modes.
787 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
789 ;; Immediate operand constraint for integer modes.
790 (define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")])
792 ;; General operand constraint for word modes.
793 (define_mode_attr g [(QI "qmn") (HI "rmn") (SI "g") (DI "rme")])
795 ;; Immediate operand constraint for double integer modes.
796 (define_mode_attr di [(SI "iF") (DI "e")])
798 ;; General operand predicate for integer modes.
799 (define_mode_attr general_operand
800 [(QI "general_operand")
801 (HI "general_operand")
802 (SI "general_operand")
803 (DI "x86_64_general_operand")
804 (TI "x86_64_general_operand")])
806 ;; General sign/zero extend operand predicate for integer modes.
807 (define_mode_attr general_szext_operand
808 [(QI "general_operand")
809 (HI "general_operand")
810 (SI "general_operand")
811 (DI "x86_64_szext_general_operand")])
813 ;; SSE and x87 SFmode and DFmode floating point modes
814 (define_mode_iterator MODEF [SF DF])
816 ;; All x87 floating point modes
817 (define_mode_iterator X87MODEF [SF DF XF])
819 ;; All integer modes handled by x87 fisttp operator.
820 (define_mode_iterator X87MODEI [HI SI DI])
822 ;; All integer modes handled by integer x87 operators.
823 (define_mode_iterator X87MODEI12 [HI SI])
825 ;; All integer modes handled by SSE cvtts?2si* operators.
826 (define_mode_iterator SSEMODEI24 [SI DI])
828 ;; SSE asm suffix for floating point modes
829 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
831 ;; SSE vector mode corresponding to a scalar mode
832 (define_mode_attr ssevecmode
833 [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
835 ;; Instruction suffix for REX 64bit operators.
836 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
838 ;; This mode iterator allows :P to be used for patterns that operate on
839 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
840 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
842 ;; Scheduling descriptions
844 (include "pentium.md")
847 (include "athlon.md")
852 ;; Operand and operator predicates and constraints
854 (include "predicates.md")
855 (include "constraints.md")
858 ;; Compare and branch/compare and store instructions.
860 (define_expand "cbranch<mode>4"
861 [(set (reg:CC FLAGS_REG)
862 (compare:CC (match_operand:SDWIM 1 "nonimmediate_operand" "")
863 (match_operand:SDWIM 2 "<general_operand>" "")))
864 (set (pc) (if_then_else
865 (match_operator 0 "comparison_operator"
866 [(reg:CC FLAGS_REG) (const_int 0)])
867 (label_ref (match_operand 3 "" ""))
871 if (MEM_P (operands[1]) && MEM_P (operands[2]))
872 operands[1] = force_reg (<MODE>mode, operands[1]);
873 ix86_compare_op0 = operands[1];
874 ix86_compare_op1 = operands[2];
875 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
879 (define_expand "cstore<mode>4"
880 [(set (reg:CC FLAGS_REG)
881 (compare:CC (match_operand:SWIM 2 "nonimmediate_operand" "")
882 (match_operand:SWIM 3 "<general_operand>" "")))
883 (set (match_operand:QI 0 "register_operand" "")
884 (match_operator 1 "comparison_operator"
885 [(reg:CC FLAGS_REG) (const_int 0)]))]
888 if (MEM_P (operands[2]) && MEM_P (operands[3]))
889 operands[2] = force_reg (<MODE>mode, operands[2]);
890 ix86_compare_op0 = operands[2];
891 ix86_compare_op1 = operands[3];
892 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
896 (define_expand "cmp<mode>_1"
897 [(set (reg:CC FLAGS_REG)
898 (compare:CC (match_operand:SWI48 0 "nonimmediate_operand" "")
899 (match_operand:SWI48 1 "<general_operand>" "")))]
903 (define_insn "*cmp<mode>_ccno_1"
904 [(set (reg FLAGS_REG)
905 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>,?m<r>")
906 (match_operand:SWI 1 "const0_operand" "")))]
907 "ix86_match_ccmode (insn, CCNOmode)"
909 test{<imodesuffix>}\t%0, %0
910 cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
911 [(set_attr "type" "test,icmp")
912 (set_attr "length_immediate" "0,1")
913 (set_attr "mode" "<MODE>")])
915 (define_insn "*cmp<mode>_1"
916 [(set (reg FLAGS_REG)
917 (compare (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
918 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")))]
919 "ix86_match_ccmode (insn, CCmode)"
920 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
921 [(set_attr "type" "icmp")
922 (set_attr "mode" "<MODE>")])
924 (define_insn "*cmp<mode>_minus_1"
925 [(set (reg FLAGS_REG)
927 (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
928 (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
930 "ix86_match_ccmode (insn, CCGOCmode)"
931 "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
932 [(set_attr "type" "icmp")
933 (set_attr "mode" "<MODE>")])
935 (define_insn "*cmpqi_ext_1"
936 [(set (reg FLAGS_REG)
938 (match_operand:QI 0 "general_operand" "Qm")
941 (match_operand 1 "ext_register_operand" "Q")
944 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
945 "cmp{b}\t{%h1, %0|%0, %h1}"
946 [(set_attr "type" "icmp")
947 (set_attr "mode" "QI")])
949 (define_insn "*cmpqi_ext_1_rex64"
950 [(set (reg FLAGS_REG)
952 (match_operand:QI 0 "register_operand" "Q")
955 (match_operand 1 "ext_register_operand" "Q")
958 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
959 "cmp{b}\t{%h1, %0|%0, %h1}"
960 [(set_attr "type" "icmp")
961 (set_attr "mode" "QI")])
963 (define_insn "*cmpqi_ext_2"
964 [(set (reg FLAGS_REG)
968 (match_operand 0 "ext_register_operand" "Q")
971 (match_operand:QI 1 "const0_operand" "")))]
972 "ix86_match_ccmode (insn, CCNOmode)"
974 [(set_attr "type" "test")
975 (set_attr "length_immediate" "0")
976 (set_attr "mode" "QI")])
978 (define_expand "cmpqi_ext_3"
979 [(set (reg:CC FLAGS_REG)
983 (match_operand 0 "ext_register_operand" "")
986 (match_operand:QI 1 "immediate_operand" "")))]
990 (define_insn "*cmpqi_ext_3_insn"
991 [(set (reg FLAGS_REG)
995 (match_operand 0 "ext_register_operand" "Q")
998 (match_operand:QI 1 "general_operand" "Qmn")))]
999 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1000 "cmp{b}\t{%1, %h0|%h0, %1}"
1001 [(set_attr "type" "icmp")
1002 (set_attr "modrm" "1")
1003 (set_attr "mode" "QI")])
1005 (define_insn "*cmpqi_ext_3_insn_rex64"
1006 [(set (reg FLAGS_REG)
1010 (match_operand 0 "ext_register_operand" "Q")
1013 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
1014 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1015 "cmp{b}\t{%1, %h0|%h0, %1}"
1016 [(set_attr "type" "icmp")
1017 (set_attr "modrm" "1")
1018 (set_attr "mode" "QI")])
1020 (define_insn "*cmpqi_ext_4"
1021 [(set (reg FLAGS_REG)
1025 (match_operand 0 "ext_register_operand" "Q")
1030 (match_operand 1 "ext_register_operand" "Q")
1032 (const_int 8)) 0)))]
1033 "ix86_match_ccmode (insn, CCmode)"
1034 "cmp{b}\t{%h1, %h0|%h0, %h1}"
1035 [(set_attr "type" "icmp")
1036 (set_attr "mode" "QI")])
1038 ;; These implement float point compares.
1039 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
1040 ;; which would allow mix and match FP modes on the compares. Which is what
1041 ;; the old patterns did, but with many more of them.
1043 (define_expand "cbranchxf4"
1044 [(set (reg:CC FLAGS_REG)
1045 (compare:CC (match_operand:XF 1 "nonmemory_operand" "")
1046 (match_operand:XF 2 "nonmemory_operand" "")))
1047 (set (pc) (if_then_else
1048 (match_operator 0 "ix86_fp_comparison_operator"
1051 (label_ref (match_operand 3 "" ""))
1055 ix86_compare_op0 = operands[1];
1056 ix86_compare_op1 = operands[2];
1057 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1061 (define_expand "cstorexf4"
1062 [(set (reg:CC FLAGS_REG)
1063 (compare:CC (match_operand:XF 2 "nonmemory_operand" "")
1064 (match_operand:XF 3 "nonmemory_operand" "")))
1065 (set (match_operand:QI 0 "register_operand" "")
1066 (match_operator 1 "ix86_fp_comparison_operator"
1071 ix86_compare_op0 = operands[2];
1072 ix86_compare_op1 = operands[3];
1073 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1077 (define_expand "cbranch<mode>4"
1078 [(set (reg:CC FLAGS_REG)
1079 (compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
1080 (match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
1081 (set (pc) (if_then_else
1082 (match_operator 0 "ix86_fp_comparison_operator"
1085 (label_ref (match_operand 3 "" ""))
1087 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1089 ix86_compare_op0 = operands[1];
1090 ix86_compare_op1 = operands[2];
1091 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1095 (define_expand "cstore<mode>4"
1096 [(set (reg:CC FLAGS_REG)
1097 (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
1098 (match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
1099 (set (match_operand:QI 0 "register_operand" "")
1100 (match_operator 1 "ix86_fp_comparison_operator"
1103 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1105 ix86_compare_op0 = operands[2];
1106 ix86_compare_op1 = operands[3];
1107 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1111 (define_expand "cbranchcc4"
1112 [(set (pc) (if_then_else
1113 (match_operator 0 "comparison_operator"
1114 [(match_operand 1 "flags_reg_operand" "")
1115 (match_operand 2 "const0_operand" "")])
1116 (label_ref (match_operand 3 "" ""))
1120 ix86_compare_op0 = operands[1];
1121 ix86_compare_op1 = operands[2];
1122 ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1126 (define_expand "cstorecc4"
1127 [(set (match_operand:QI 0 "register_operand" "")
1128 (match_operator 1 "comparison_operator"
1129 [(match_operand 2 "flags_reg_operand" "")
1130 (match_operand 3 "const0_operand" "")]))]
1133 ix86_compare_op0 = operands[2];
1134 ix86_compare_op1 = operands[3];
1135 ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1140 ;; FP compares, step 1:
1141 ;; Set the FP condition codes.
1143 ;; CCFPmode compare with exceptions
1144 ;; CCFPUmode compare with no exceptions
1146 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
1147 ;; used to manage the reg stack popping would not be preserved.
1149 (define_insn "*cmpfp_0"
1150 [(set (match_operand:HI 0 "register_operand" "=a")
1153 (match_operand 1 "register_operand" "f")
1154 (match_operand 2 "const0_operand" ""))]
1156 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1157 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1158 "* return output_fp_compare (insn, operands, 0, 0);"
1159 [(set_attr "type" "multi")
1160 (set_attr "unit" "i387")
1162 (cond [(match_operand:SF 1 "" "")
1164 (match_operand:DF 1 "" "")
1167 (const_string "XF")))])
1169 (define_insn_and_split "*cmpfp_0_cc"
1170 [(set (reg:CCFP FLAGS_REG)
1172 (match_operand 1 "register_operand" "f")
1173 (match_operand 2 "const0_operand" "")))
1174 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1175 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1176 && TARGET_SAHF && !TARGET_CMOVE
1177 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1179 "&& reload_completed"
1182 [(compare:CCFP (match_dup 1)(match_dup 2))]
1184 (set (reg:CC FLAGS_REG)
1185 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1187 [(set_attr "type" "multi")
1188 (set_attr "unit" "i387")
1190 (cond [(match_operand:SF 1 "" "")
1192 (match_operand:DF 1 "" "")
1195 (const_string "XF")))])
1197 (define_insn "*cmpfp_xf"
1198 [(set (match_operand:HI 0 "register_operand" "=a")
1201 (match_operand:XF 1 "register_operand" "f")
1202 (match_operand:XF 2 "register_operand" "f"))]
1205 "* return output_fp_compare (insn, operands, 0, 0);"
1206 [(set_attr "type" "multi")
1207 (set_attr "unit" "i387")
1208 (set_attr "mode" "XF")])
1210 (define_insn_and_split "*cmpfp_xf_cc"
1211 [(set (reg:CCFP FLAGS_REG)
1213 (match_operand:XF 1 "register_operand" "f")
1214 (match_operand:XF 2 "register_operand" "f")))
1215 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1217 && TARGET_SAHF && !TARGET_CMOVE"
1219 "&& reload_completed"
1222 [(compare:CCFP (match_dup 1)(match_dup 2))]
1224 (set (reg:CC FLAGS_REG)
1225 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1227 [(set_attr "type" "multi")
1228 (set_attr "unit" "i387")
1229 (set_attr "mode" "XF")])
1231 (define_insn "*cmpfp_<mode>"
1232 [(set (match_operand:HI 0 "register_operand" "=a")
1235 (match_operand:MODEF 1 "register_operand" "f")
1236 (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1239 "* return output_fp_compare (insn, operands, 0, 0);"
1240 [(set_attr "type" "multi")
1241 (set_attr "unit" "i387")
1242 (set_attr "mode" "<MODE>")])
1244 (define_insn_and_split "*cmpfp_<mode>_cc"
1245 [(set (reg:CCFP FLAGS_REG)
1247 (match_operand:MODEF 1 "register_operand" "f")
1248 (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1249 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1251 && TARGET_SAHF && !TARGET_CMOVE"
1253 "&& reload_completed"
1256 [(compare:CCFP (match_dup 1)(match_dup 2))]
1258 (set (reg:CC FLAGS_REG)
1259 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1261 [(set_attr "type" "multi")
1262 (set_attr "unit" "i387")
1263 (set_attr "mode" "<MODE>")])
1265 (define_insn "*cmpfp_u"
1266 [(set (match_operand:HI 0 "register_operand" "=a")
1269 (match_operand 1 "register_operand" "f")
1270 (match_operand 2 "register_operand" "f"))]
1272 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1273 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1274 "* return output_fp_compare (insn, operands, 0, 1);"
1275 [(set_attr "type" "multi")
1276 (set_attr "unit" "i387")
1278 (cond [(match_operand:SF 1 "" "")
1280 (match_operand:DF 1 "" "")
1283 (const_string "XF")))])
1285 (define_insn_and_split "*cmpfp_u_cc"
1286 [(set (reg:CCFPU FLAGS_REG)
1288 (match_operand 1 "register_operand" "f")
1289 (match_operand 2 "register_operand" "f")))
1290 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1291 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1292 && TARGET_SAHF && !TARGET_CMOVE
1293 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1295 "&& reload_completed"
1298 [(compare:CCFPU (match_dup 1)(match_dup 2))]
1300 (set (reg:CC FLAGS_REG)
1301 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1303 [(set_attr "type" "multi")
1304 (set_attr "unit" "i387")
1306 (cond [(match_operand:SF 1 "" "")
1308 (match_operand:DF 1 "" "")
1311 (const_string "XF")))])
1313 (define_insn "*cmpfp_<mode>"
1314 [(set (match_operand:HI 0 "register_operand" "=a")
1317 (match_operand 1 "register_operand" "f")
1318 (match_operator 3 "float_operator"
1319 [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1321 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1322 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1323 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1324 "* return output_fp_compare (insn, operands, 0, 0);"
1325 [(set_attr "type" "multi")
1326 (set_attr "unit" "i387")
1327 (set_attr "fp_int_src" "true")
1328 (set_attr "mode" "<MODE>")])
1330 (define_insn_and_split "*cmpfp_<mode>_cc"
1331 [(set (reg:CCFP FLAGS_REG)
1333 (match_operand 1 "register_operand" "f")
1334 (match_operator 3 "float_operator"
1335 [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1336 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1337 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1338 && TARGET_SAHF && !TARGET_CMOVE
1339 && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1340 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1342 "&& reload_completed"
1347 (match_op_dup 3 [(match_dup 2)]))]
1349 (set (reg:CC FLAGS_REG)
1350 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1352 [(set_attr "type" "multi")
1353 (set_attr "unit" "i387")
1354 (set_attr "fp_int_src" "true")
1355 (set_attr "mode" "<MODE>")])
1357 ;; FP compares, step 2
1358 ;; Move the fpsw to ax.
1360 (define_insn "x86_fnstsw_1"
1361 [(set (match_operand:HI 0 "register_operand" "=a")
1362 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1365 [(set (attr "length") (symbol_ref "ix86_attr_length_address_default (insn) + 2"))
1366 (set_attr "mode" "SI")
1367 (set_attr "unit" "i387")])
1369 ;; FP compares, step 3
1370 ;; Get ax into flags, general case.
1372 (define_insn "x86_sahf_1"
1373 [(set (reg:CC FLAGS_REG)
1374 (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1378 #ifdef HAVE_AS_IX86_SAHF
1381 return ASM_BYTE "0x9e";
1384 [(set_attr "length" "1")
1385 (set_attr "athlon_decode" "vector")
1386 (set_attr "amdfam10_decode" "direct")
1387 (set_attr "mode" "SI")])
1389 ;; Pentium Pro can do steps 1 through 3 in one go.
1390 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1391 (define_insn "*cmpfp_i_mixed"
1392 [(set (reg:CCFP FLAGS_REG)
1393 (compare:CCFP (match_operand 0 "register_operand" "f,x")
1394 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1395 "TARGET_MIX_SSE_I387
1396 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1397 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1398 "* return output_fp_compare (insn, operands, 1, 0);"
1399 [(set_attr "type" "fcmp,ssecomi")
1400 (set_attr "prefix" "orig,maybe_vex")
1402 (if_then_else (match_operand:SF 1 "" "")
1404 (const_string "DF")))
1405 (set (attr "prefix_rep")
1406 (if_then_else (eq_attr "type" "ssecomi")
1408 (const_string "*")))
1409 (set (attr "prefix_data16")
1410 (cond [(eq_attr "type" "fcmp")
1412 (eq_attr "mode" "DF")
1415 (const_string "0")))
1416 (set_attr "athlon_decode" "vector")
1417 (set_attr "amdfam10_decode" "direct")])
1419 (define_insn "*cmpfp_i_sse"
1420 [(set (reg:CCFP FLAGS_REG)
1421 (compare:CCFP (match_operand 0 "register_operand" "x")
1422 (match_operand 1 "nonimmediate_operand" "xm")))]
1424 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1425 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1426 "* return output_fp_compare (insn, operands, 1, 0);"
1427 [(set_attr "type" "ssecomi")
1428 (set_attr "prefix" "maybe_vex")
1430 (if_then_else (match_operand:SF 1 "" "")
1432 (const_string "DF")))
1433 (set_attr "prefix_rep" "0")
1434 (set (attr "prefix_data16")
1435 (if_then_else (eq_attr "mode" "DF")
1437 (const_string "0")))
1438 (set_attr "athlon_decode" "vector")
1439 (set_attr "amdfam10_decode" "direct")])
1441 (define_insn "*cmpfp_i_i387"
1442 [(set (reg:CCFP FLAGS_REG)
1443 (compare:CCFP (match_operand 0 "register_operand" "f")
1444 (match_operand 1 "register_operand" "f")))]
1445 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1447 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1448 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1449 "* return output_fp_compare (insn, operands, 1, 0);"
1450 [(set_attr "type" "fcmp")
1452 (cond [(match_operand:SF 1 "" "")
1454 (match_operand:DF 1 "" "")
1457 (const_string "XF")))
1458 (set_attr "athlon_decode" "vector")
1459 (set_attr "amdfam10_decode" "direct")])
1461 (define_insn "*cmpfp_iu_mixed"
1462 [(set (reg:CCFPU FLAGS_REG)
1463 (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1464 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1465 "TARGET_MIX_SSE_I387
1466 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1467 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1468 "* return output_fp_compare (insn, operands, 1, 1);"
1469 [(set_attr "type" "fcmp,ssecomi")
1470 (set_attr "prefix" "orig,maybe_vex")
1472 (if_then_else (match_operand:SF 1 "" "")
1474 (const_string "DF")))
1475 (set (attr "prefix_rep")
1476 (if_then_else (eq_attr "type" "ssecomi")
1478 (const_string "*")))
1479 (set (attr "prefix_data16")
1480 (cond [(eq_attr "type" "fcmp")
1482 (eq_attr "mode" "DF")
1485 (const_string "0")))
1486 (set_attr "athlon_decode" "vector")
1487 (set_attr "amdfam10_decode" "direct")])
1489 (define_insn "*cmpfp_iu_sse"
1490 [(set (reg:CCFPU FLAGS_REG)
1491 (compare:CCFPU (match_operand 0 "register_operand" "x")
1492 (match_operand 1 "nonimmediate_operand" "xm")))]
1494 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1495 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1496 "* return output_fp_compare (insn, operands, 1, 1);"
1497 [(set_attr "type" "ssecomi")
1498 (set_attr "prefix" "maybe_vex")
1500 (if_then_else (match_operand:SF 1 "" "")
1502 (const_string "DF")))
1503 (set_attr "prefix_rep" "0")
1504 (set (attr "prefix_data16")
1505 (if_then_else (eq_attr "mode" "DF")
1507 (const_string "0")))
1508 (set_attr "athlon_decode" "vector")
1509 (set_attr "amdfam10_decode" "direct")])
1511 (define_insn "*cmpfp_iu_387"
1512 [(set (reg:CCFPU FLAGS_REG)
1513 (compare:CCFPU (match_operand 0 "register_operand" "f")
1514 (match_operand 1 "register_operand" "f")))]
1515 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1517 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1518 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1519 "* return output_fp_compare (insn, operands, 1, 1);"
1520 [(set_attr "type" "fcmp")
1522 (cond [(match_operand:SF 1 "" "")
1524 (match_operand:DF 1 "" "")
1527 (const_string "XF")))
1528 (set_attr "athlon_decode" "vector")
1529 (set_attr "amdfam10_decode" "direct")])
1531 ;; Move instructions.
1533 ;; General case of fullword move.
1535 (define_expand "movsi"
1536 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1537 (match_operand:SI 1 "general_operand" ""))]
1539 "ix86_expand_move (SImode, operands); DONE;")
1541 ;; Push/pop instructions. They are separate since autoinc/dec is not a
1544 ;; %%% We don't use a post-inc memory reference because x86 is not a
1545 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1546 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1547 ;; targets without our curiosities, and it is just as easy to represent
1548 ;; this differently.
1550 (define_insn "*pushsi2"
1551 [(set (match_operand:SI 0 "push_operand" "=<")
1552 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1555 [(set_attr "type" "push")
1556 (set_attr "mode" "SI")])
1558 ;; For 64BIT abi we always round up to 8 bytes.
1559 (define_insn "*pushsi2_rex64"
1560 [(set (match_operand:SI 0 "push_operand" "=X")
1561 (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1564 [(set_attr "type" "push")
1565 (set_attr "mode" "SI")])
1567 (define_insn "*pushsi2_prologue"
1568 [(set (match_operand:SI 0 "push_operand" "=<")
1569 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1570 (clobber (mem:BLK (scratch)))]
1573 [(set_attr "type" "push")
1574 (set_attr "mode" "SI")])
1576 (define_insn "*popsi1_epilogue"
1577 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1578 (mem:SI (reg:SI SP_REG)))
1579 (set (reg:SI SP_REG)
1580 (plus:SI (reg:SI SP_REG) (const_int 4)))
1581 (clobber (mem:BLK (scratch)))]
1584 [(set_attr "type" "pop")
1585 (set_attr "mode" "SI")])
1587 (define_insn "popsi1"
1588 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1589 (mem:SI (reg:SI SP_REG)))
1590 (set (reg:SI SP_REG)
1591 (plus:SI (reg:SI SP_REG) (const_int 4)))]
1594 [(set_attr "type" "pop")
1595 (set_attr "mode" "SI")])
1597 (define_insn "*movsi_xor"
1598 [(set (match_operand:SI 0 "register_operand" "=r")
1599 (match_operand:SI 1 "const0_operand" ""))
1600 (clobber (reg:CC FLAGS_REG))]
1603 [(set_attr "type" "alu1")
1604 (set_attr "mode" "SI")
1605 (set_attr "length_immediate" "0")])
1607 (define_insn "*movsi_or"
1608 [(set (match_operand:SI 0 "register_operand" "=r")
1609 (match_operand:SI 1 "immediate_operand" "i"))
1610 (clobber (reg:CC FLAGS_REG))]
1612 && operands[1] == constm1_rtx"
1614 operands[1] = constm1_rtx;
1615 return "or{l}\t{%1, %0|%0, %1}";
1617 [(set_attr "type" "alu1")
1618 (set_attr "mode" "SI")
1619 (set_attr "length_immediate" "1")])
1621 (define_insn "*movsi_1"
1622 [(set (match_operand:SI 0 "nonimmediate_operand"
1623 "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
1624 (match_operand:SI 1 "general_operand"
1625 "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))]
1626 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1628 switch (get_attr_type (insn))
1631 if (get_attr_mode (insn) == MODE_TI)
1632 return "%vpxor\t%0, %d0";
1633 return "%vxorps\t%0, %d0";
1636 switch (get_attr_mode (insn))
1639 return "%vmovdqa\t{%1, %0|%0, %1}";
1641 return "%vmovaps\t{%1, %0|%0, %1}";
1643 return "%vmovd\t{%1, %0|%0, %1}";
1645 return "%vmovss\t{%1, %0|%0, %1}";
1651 return "pxor\t%0, %0";
1654 if (get_attr_mode (insn) == MODE_DI)
1655 return "movq\t{%1, %0|%0, %1}";
1656 return "movd\t{%1, %0|%0, %1}";
1659 return "lea{l}\t{%1, %0|%0, %1}";
1662 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
1663 return "mov{l}\t{%1, %0|%0, %1}";
1667 (cond [(eq_attr "alternative" "2")
1668 (const_string "mmx")
1669 (eq_attr "alternative" "3,4,5")
1670 (const_string "mmxmov")
1671 (eq_attr "alternative" "6")
1672 (const_string "sselog1")
1673 (eq_attr "alternative" "7,8,9,10,11")
1674 (const_string "ssemov")
1675 (match_operand:DI 1 "pic_32bit_operand" "")
1676 (const_string "lea")
1678 (const_string "imov")))
1679 (set (attr "prefix")
1680 (if_then_else (eq_attr "alternative" "0,1,2,3,4,5")
1681 (const_string "orig")
1682 (const_string "maybe_vex")))
1683 (set (attr "prefix_data16")
1684 (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI"))
1686 (const_string "*")))
1688 (cond [(eq_attr "alternative" "2,3")
1690 (eq_attr "alternative" "6,7")
1692 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1693 (const_string "V4SF")
1694 (const_string "TI"))
1695 (and (eq_attr "alternative" "8,9,10,11")
1696 (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
1699 (const_string "SI")))])
1701 ;; Stores and loads of ax to arbitrary constant address.
1702 ;; We fake an second form of instruction to force reload to load address
1703 ;; into register when rax is not available
1704 (define_insn "*movabssi_1_rex64"
1705 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1706 (match_operand:SI 1 "nonmemory_operand" "a,er"))]
1707 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1709 movabs{l}\t{%1, %P0|%P0, %1}
1710 mov{l}\t{%1, %a0|%a0, %1}"
1711 [(set_attr "type" "imov")
1712 (set_attr "modrm" "0,*")
1713 (set_attr "length_address" "8,0")
1714 (set_attr "length_immediate" "0,*")
1715 (set_attr "memory" "store")
1716 (set_attr "mode" "SI")])
1718 (define_insn "*movabssi_2_rex64"
1719 [(set (match_operand:SI 0 "register_operand" "=a,r")
1720 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1721 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1723 movabs{l}\t{%P1, %0|%0, %P1}
1724 mov{l}\t{%a1, %0|%0, %a1}"
1725 [(set_attr "type" "imov")
1726 (set_attr "modrm" "0,*")
1727 (set_attr "length_address" "8,0")
1728 (set_attr "length_immediate" "0")
1729 (set_attr "memory" "load")
1730 (set_attr "mode" "SI")])
1732 (define_insn "*swapsi"
1733 [(set (match_operand:SI 0 "register_operand" "+r")
1734 (match_operand:SI 1 "register_operand" "+r"))
1739 [(set_attr "type" "imov")
1740 (set_attr "mode" "SI")
1741 (set_attr "pent_pair" "np")
1742 (set_attr "athlon_decode" "vector")
1743 (set_attr "amdfam10_decode" "double")])
1745 (define_expand "movhi"
1746 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1747 (match_operand:HI 1 "general_operand" ""))]
1749 "ix86_expand_move (HImode, operands); DONE;")
1751 (define_insn "*pushhi2"
1752 [(set (match_operand:HI 0 "push_operand" "=X")
1753 (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1756 [(set_attr "type" "push")
1757 (set_attr "mode" "SI")])
1759 ;; For 64BIT abi we always round up to 8 bytes.
1760 (define_insn "*pushhi2_rex64"
1761 [(set (match_operand:HI 0 "push_operand" "=X")
1762 (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1765 [(set_attr "type" "push")
1766 (set_attr "mode" "DI")])
1768 (define_insn "*movhi_1"
1769 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
1770 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
1771 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1773 switch (get_attr_type (insn))
1776 /* movzwl is faster than movw on p2 due to partial word stalls,
1777 though not as fast as an aligned movl. */
1778 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1780 if (get_attr_mode (insn) == MODE_SI)
1781 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1783 return "mov{w}\t{%1, %0|%0, %1}";
1787 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
1788 (const_string "imov")
1789 (and (eq_attr "alternative" "0")
1790 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1792 (eq (symbol_ref "TARGET_HIMODE_MATH")
1794 (const_string "imov")
1795 (and (eq_attr "alternative" "1,2")
1796 (match_operand:HI 1 "aligned_operand" ""))
1797 (const_string "imov")
1798 (and (ne (symbol_ref "TARGET_MOVX")
1800 (eq_attr "alternative" "0,2"))
1801 (const_string "imovx")
1803 (const_string "imov")))
1805 (cond [(eq_attr "type" "imovx")
1807 (and (eq_attr "alternative" "1,2")
1808 (match_operand:HI 1 "aligned_operand" ""))
1810 (and (eq_attr "alternative" "0")
1811 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1813 (eq (symbol_ref "TARGET_HIMODE_MATH")
1817 (const_string "HI")))])
1819 ;; Stores and loads of ax to arbitrary constant address.
1820 ;; We fake an second form of instruction to force reload to load address
1821 ;; into register when rax is not available
1822 (define_insn "*movabshi_1_rex64"
1823 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1824 (match_operand:HI 1 "nonmemory_operand" "a,er"))]
1825 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1827 movabs{w}\t{%1, %P0|%P0, %1}
1828 mov{w}\t{%1, %a0|%a0, %1}"
1829 [(set_attr "type" "imov")
1830 (set_attr "modrm" "0,*")
1831 (set_attr "length_address" "8,0")
1832 (set_attr "length_immediate" "0,*")
1833 (set_attr "memory" "store")
1834 (set_attr "mode" "HI")])
1836 (define_insn "*movabshi_2_rex64"
1837 [(set (match_operand:HI 0 "register_operand" "=a,r")
1838 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1839 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1841 movabs{w}\t{%P1, %0|%0, %P1}
1842 mov{w}\t{%a1, %0|%0, %a1}"
1843 [(set_attr "type" "imov")
1844 (set_attr "modrm" "0,*")
1845 (set_attr "length_address" "8,0")
1846 (set_attr "length_immediate" "0")
1847 (set_attr "memory" "load")
1848 (set_attr "mode" "HI")])
1850 (define_insn "*swaphi_1"
1851 [(set (match_operand:HI 0 "register_operand" "+r")
1852 (match_operand:HI 1 "register_operand" "+r"))
1855 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
1857 [(set_attr "type" "imov")
1858 (set_attr "mode" "SI")
1859 (set_attr "pent_pair" "np")
1860 (set_attr "athlon_decode" "vector")
1861 (set_attr "amdfam10_decode" "double")])
1863 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
1864 (define_insn "*swaphi_2"
1865 [(set (match_operand:HI 0 "register_operand" "+r")
1866 (match_operand:HI 1 "register_operand" "+r"))
1869 "TARGET_PARTIAL_REG_STALL"
1871 [(set_attr "type" "imov")
1872 (set_attr "mode" "HI")
1873 (set_attr "pent_pair" "np")
1874 (set_attr "athlon_decode" "vector")])
1876 (define_expand "movstricthi"
1877 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1878 (match_operand:HI 1 "general_operand" ""))]
1881 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
1883 /* Don't generate memory->memory moves, go through a register */
1884 if (MEM_P (operands[0]) && MEM_P (operands[1]))
1885 operands[1] = force_reg (HImode, operands[1]);
1888 (define_insn "*movstricthi_1"
1889 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1890 (match_operand:HI 1 "general_operand" "rn,m"))]
1891 "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
1892 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1893 "mov{w}\t{%1, %0|%0, %1}"
1894 [(set_attr "type" "imov")
1895 (set_attr "mode" "HI")])
1897 (define_insn "*movstricthi_xor"
1898 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1899 (match_operand:HI 1 "const0_operand" ""))
1900 (clobber (reg:CC FLAGS_REG))]
1903 [(set_attr "type" "alu1")
1904 (set_attr "mode" "HI")
1905 (set_attr "length_immediate" "0")])
1907 (define_expand "movqi"
1908 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1909 (match_operand:QI 1 "general_operand" ""))]
1911 "ix86_expand_move (QImode, operands); DONE;")
1913 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1914 ;; "push a byte". But actually we use pushl, which has the effect
1915 ;; of rounding the amount pushed up to a word.
1917 (define_insn "*pushqi2"
1918 [(set (match_operand:QI 0 "push_operand" "=X")
1919 (match_operand:QI 1 "nonmemory_no_elim_operand" "rn"))]
1922 [(set_attr "type" "push")
1923 (set_attr "mode" "SI")])
1925 ;; For 64BIT abi we always round up to 8 bytes.
1926 (define_insn "*pushqi2_rex64"
1927 [(set (match_operand:QI 0 "push_operand" "=X")
1928 (match_operand:QI 1 "nonmemory_no_elim_operand" "qn"))]
1931 [(set_attr "type" "push")
1932 (set_attr "mode" "DI")])
1934 ;; Situation is quite tricky about when to choose full sized (SImode) move
1935 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1936 ;; partial register dependency machines (such as AMD Athlon), where QImode
1937 ;; moves issue extra dependency and for partial register stalls machines
1938 ;; that don't use QImode patterns (and QImode move cause stall on the next
1941 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1942 ;; register stall machines with, where we use QImode instructions, since
1943 ;; partial register stall can be caused there. Then we use movzx.
1944 (define_insn "*movqi_1"
1945 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1946 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1947 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1949 switch (get_attr_type (insn))
1952 gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
1953 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1955 if (get_attr_mode (insn) == MODE_SI)
1956 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1958 return "mov{b}\t{%1, %0|%0, %1}";
1962 (cond [(and (eq_attr "alternative" "5")
1963 (not (match_operand:QI 1 "aligned_operand" "")))
1964 (const_string "imovx")
1965 (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
1966 (const_string "imov")
1967 (and (eq_attr "alternative" "3")
1968 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1970 (eq (symbol_ref "TARGET_QIMODE_MATH")
1972 (const_string "imov")
1973 (eq_attr "alternative" "3,5")
1974 (const_string "imovx")
1975 (and (ne (symbol_ref "TARGET_MOVX")
1977 (eq_attr "alternative" "2"))
1978 (const_string "imovx")
1980 (const_string "imov")))
1982 (cond [(eq_attr "alternative" "3,4,5")
1984 (eq_attr "alternative" "6")
1986 (eq_attr "type" "imovx")
1988 (and (eq_attr "type" "imov")
1989 (and (eq_attr "alternative" "0,1")
1990 (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
1992 (and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
1994 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1997 ;; Avoid partial register stalls when not using QImode arithmetic
1998 (and (eq_attr "type" "imov")
1999 (and (eq_attr "alternative" "0,1")
2000 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
2002 (eq (symbol_ref "TARGET_QIMODE_MATH")
2006 (const_string "QI")))])
2008 (define_insn "*swapqi_1"
2009 [(set (match_operand:QI 0 "register_operand" "+r")
2010 (match_operand:QI 1 "register_operand" "+r"))
2013 "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2015 [(set_attr "type" "imov")
2016 (set_attr "mode" "SI")
2017 (set_attr "pent_pair" "np")
2018 (set_attr "athlon_decode" "vector")
2019 (set_attr "amdfam10_decode" "vector")])
2021 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
2022 (define_insn "*swapqi_2"
2023 [(set (match_operand:QI 0 "register_operand" "+q")
2024 (match_operand:QI 1 "register_operand" "+q"))
2027 "TARGET_PARTIAL_REG_STALL"
2029 [(set_attr "type" "imov")
2030 (set_attr "mode" "QI")
2031 (set_attr "pent_pair" "np")
2032 (set_attr "athlon_decode" "vector")])
2034 (define_expand "movstrictqi"
2035 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
2036 (match_operand:QI 1 "general_operand" ""))]
2039 if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2041 /* Don't generate memory->memory moves, go through a register. */
2042 if (MEM_P (operands[0]) && MEM_P (operands[1]))
2043 operands[1] = force_reg (QImode, operands[1]);
2046 (define_insn "*movstrictqi_1"
2047 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
2048 (match_operand:QI 1 "general_operand" "*qn,m"))]
2049 "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2050 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2051 "mov{b}\t{%1, %0|%0, %1}"
2052 [(set_attr "type" "imov")
2053 (set_attr "mode" "QI")])
2055 (define_insn "*movstrictqi_xor"
2056 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
2057 (match_operand:QI 1 "const0_operand" ""))
2058 (clobber (reg:CC FLAGS_REG))]
2061 [(set_attr "type" "alu1")
2062 (set_attr "mode" "QI")
2063 (set_attr "length_immediate" "0")])
2065 (define_insn "*movsi_extv_1"
2066 [(set (match_operand:SI 0 "register_operand" "=R")
2067 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
2071 "movs{bl|x}\t{%h1, %0|%0, %h1}"
2072 [(set_attr "type" "imovx")
2073 (set_attr "mode" "SI")])
2075 (define_insn "*movhi_extv_1"
2076 [(set (match_operand:HI 0 "register_operand" "=R")
2077 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
2081 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
2082 [(set_attr "type" "imovx")
2083 (set_attr "mode" "SI")])
2085 (define_insn "*movqi_extv_1"
2086 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
2087 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2092 switch (get_attr_type (insn))
2095 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2097 return "mov{b}\t{%h1, %0|%0, %h1}";
2101 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2102 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2103 (ne (symbol_ref "TARGET_MOVX")
2105 (const_string "imovx")
2106 (const_string "imov")))
2108 (if_then_else (eq_attr "type" "imovx")
2110 (const_string "QI")))])
2112 (define_insn "*movqi_extv_1_rex64"
2113 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2114 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2119 switch (get_attr_type (insn))
2122 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2124 return "mov{b}\t{%h1, %0|%0, %h1}";
2128 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2129 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2130 (ne (symbol_ref "TARGET_MOVX")
2132 (const_string "imovx")
2133 (const_string "imov")))
2135 (if_then_else (eq_attr "type" "imovx")
2137 (const_string "QI")))])
2139 ;; Stores and loads of ax to arbitrary constant address.
2140 ;; We fake an second form of instruction to force reload to load address
2141 ;; into register when rax is not available
2142 (define_insn "*movabsqi_1_rex64"
2143 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2144 (match_operand:QI 1 "nonmemory_operand" "a,er"))]
2145 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2147 movabs{b}\t{%1, %P0|%P0, %1}
2148 mov{b}\t{%1, %a0|%a0, %1}"
2149 [(set_attr "type" "imov")
2150 (set_attr "modrm" "0,*")
2151 (set_attr "length_address" "8,0")
2152 (set_attr "length_immediate" "0,*")
2153 (set_attr "memory" "store")
2154 (set_attr "mode" "QI")])
2156 (define_insn "*movabsqi_2_rex64"
2157 [(set (match_operand:QI 0 "register_operand" "=a,r")
2158 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2159 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2161 movabs{b}\t{%P1, %0|%0, %P1}
2162 mov{b}\t{%a1, %0|%0, %a1}"
2163 [(set_attr "type" "imov")
2164 (set_attr "modrm" "0,*")
2165 (set_attr "length_address" "8,0")
2166 (set_attr "length_immediate" "0")
2167 (set_attr "memory" "load")
2168 (set_attr "mode" "QI")])
2170 (define_insn "*movdi_extzv_1"
2171 [(set (match_operand:DI 0 "register_operand" "=R")
2172 (zero_extract:DI (match_operand 1 "ext_register_operand" "Q")
2176 "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
2177 [(set_attr "type" "imovx")
2178 (set_attr "mode" "SI")])
2180 (define_insn "*movsi_extzv_1"
2181 [(set (match_operand:SI 0 "register_operand" "=R")
2182 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
2186 "movz{bl|x}\t{%h1, %0|%0, %h1}"
2187 [(set_attr "type" "imovx")
2188 (set_attr "mode" "SI")])
2190 (define_insn "*movqi_extzv_2"
2191 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
2192 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2197 switch (get_attr_type (insn))
2200 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2202 return "mov{b}\t{%h1, %0|%0, %h1}";
2206 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2207 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2208 (ne (symbol_ref "TARGET_MOVX")
2210 (const_string "imovx")
2211 (const_string "imov")))
2213 (if_then_else (eq_attr "type" "imovx")
2215 (const_string "QI")))])
2217 (define_insn "*movqi_extzv_2_rex64"
2218 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2219 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2224 switch (get_attr_type (insn))
2227 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2229 return "mov{b}\t{%h1, %0|%0, %h1}";
2233 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2234 (ne (symbol_ref "TARGET_MOVX")
2236 (const_string "imovx")
2237 (const_string "imov")))
2239 (if_then_else (eq_attr "type" "imovx")
2241 (const_string "QI")))])
2243 (define_insn "movsi_insv_1"
2244 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2247 (match_operand:SI 1 "general_operand" "Qmn"))]
2249 "mov{b}\t{%b1, %h0|%h0, %b1}"
2250 [(set_attr "type" "imov")
2251 (set_attr "mode" "QI")])
2253 (define_insn "*movsi_insv_1_rex64"
2254 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2257 (match_operand:SI 1 "nonmemory_operand" "Qn"))]
2259 "mov{b}\t{%b1, %h0|%h0, %b1}"
2260 [(set_attr "type" "imov")
2261 (set_attr "mode" "QI")])
2263 (define_insn "movdi_insv_1_rex64"
2264 [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
2267 (match_operand:DI 1 "nonmemory_operand" "Qn"))]
2269 "mov{b}\t{%b1, %h0|%h0, %b1}"
2270 [(set_attr "type" "imov")
2271 (set_attr "mode" "QI")])
2273 (define_insn "*movqi_insv_2"
2274 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2277 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2280 "mov{b}\t{%h1, %h0|%h0, %h1}"
2281 [(set_attr "type" "imov")
2282 (set_attr "mode" "QI")])
2284 (define_expand "movdi"
2285 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2286 (match_operand:DI 1 "general_operand" ""))]
2288 "ix86_expand_move (DImode, operands); DONE;")
2290 (define_insn "*pushdi"
2291 [(set (match_operand:DI 0 "push_operand" "=<")
2292 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
2296 (define_insn "*pushdi2_rex64"
2297 [(set (match_operand:DI 0 "push_operand" "=<,!<")
2298 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
2303 [(set_attr "type" "push,multi")
2304 (set_attr "mode" "DI")])
2306 ;; Convert impossible pushes of immediate to existing instructions.
2307 ;; First try to get scratch register and go through it. In case this
2308 ;; fails, push sign extended lower part first and then overwrite
2309 ;; upper part by 32bit move.
2311 [(match_scratch:DI 2 "r")
2312 (set (match_operand:DI 0 "push_operand" "")
2313 (match_operand:DI 1 "immediate_operand" ""))]
2314 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2315 && !x86_64_immediate_operand (operands[1], DImode)"
2316 [(set (match_dup 2) (match_dup 1))
2317 (set (match_dup 0) (match_dup 2))]
2320 ;; We need to define this as both peepholer and splitter for case
2321 ;; peephole2 pass is not run.
2322 ;; "&& 1" is needed to keep it from matching the previous pattern.
2324 [(set (match_operand:DI 0 "push_operand" "")
2325 (match_operand:DI 1 "immediate_operand" ""))]
2326 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2327 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2328 [(set (match_dup 0) (match_dup 1))
2329 (set (match_dup 2) (match_dup 3))]
2330 "split_di (&operands[1], 1, &operands[2], &operands[3]);
2331 operands[1] = gen_lowpart (DImode, operands[2]);
2332 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2337 [(set (match_operand:DI 0 "push_operand" "")
2338 (match_operand:DI 1 "immediate_operand" ""))]
2339 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2340 ? epilogue_completed : reload_completed)
2341 && !symbolic_operand (operands[1], DImode)
2342 && !x86_64_immediate_operand (operands[1], DImode)"
2343 [(set (match_dup 0) (match_dup 1))
2344 (set (match_dup 2) (match_dup 3))]
2345 "split_di (&operands[1], 1, &operands[2], &operands[3]);
2346 operands[1] = gen_lowpart (DImode, operands[2]);
2347 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2351 (define_insn "*pushdi2_prologue_rex64"
2352 [(set (match_operand:DI 0 "push_operand" "=<")
2353 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
2354 (clobber (mem:BLK (scratch)))]
2357 [(set_attr "type" "push")
2358 (set_attr "mode" "DI")])
2360 (define_insn "*popdi1_epilogue_rex64"
2361 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2362 (mem:DI (reg:DI SP_REG)))
2363 (set (reg:DI SP_REG)
2364 (plus:DI (reg:DI SP_REG) (const_int 8)))
2365 (clobber (mem:BLK (scratch)))]
2368 [(set_attr "type" "pop")
2369 (set_attr "mode" "DI")])
2371 (define_insn "popdi1"
2372 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2373 (mem:DI (reg:DI SP_REG)))
2374 (set (reg:DI SP_REG)
2375 (plus:DI (reg:DI SP_REG) (const_int 8)))]
2378 [(set_attr "type" "pop")
2379 (set_attr "mode" "DI")])
2381 (define_insn "*movdi_xor_rex64"
2382 [(set (match_operand:DI 0 "register_operand" "=r")
2383 (match_operand:DI 1 "const0_operand" ""))
2384 (clobber (reg:CC FLAGS_REG))]
2386 && reload_completed"
2388 [(set_attr "type" "alu1")
2389 (set_attr "mode" "SI")
2390 (set_attr "length_immediate" "0")])
2392 (define_insn "*movdi_or_rex64"
2393 [(set (match_operand:DI 0 "register_operand" "=r")
2394 (match_operand:DI 1 "const_int_operand" "i"))
2395 (clobber (reg:CC FLAGS_REG))]
2398 && operands[1] == constm1_rtx"
2400 operands[1] = constm1_rtx;
2401 return "or{q}\t{%1, %0|%0, %1}";
2403 [(set_attr "type" "alu1")
2404 (set_attr "mode" "DI")
2405 (set_attr "length_immediate" "1")])
2407 (define_insn "*movdi_2"
2408 [(set (match_operand:DI 0 "nonimmediate_operand"
2409 "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
2410 (match_operand:DI 1 "general_operand"
2411 "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
2412 "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2417 movq\t{%1, %0|%0, %1}
2418 movq\t{%1, %0|%0, %1}
2420 %vmovq\t{%1, %0|%0, %1}
2421 %vmovdqa\t{%1, %0|%0, %1}
2422 %vmovq\t{%1, %0|%0, %1}
2424 movlps\t{%1, %0|%0, %1}
2425 movaps\t{%1, %0|%0, %1}
2426 movlps\t{%1, %0|%0, %1}"
2427 [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2428 (set (attr "prefix")
2429 (if_then_else (eq_attr "alternative" "5,6,7,8")
2430 (const_string "vex")
2431 (const_string "orig")))
2432 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2435 [(set (match_operand:DI 0 "push_operand" "")
2436 (match_operand:DI 1 "general_operand" ""))]
2437 "!TARGET_64BIT && reload_completed
2438 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2440 "ix86_split_long_move (operands); DONE;")
2442 ;; %%% This multiword shite has got to go.
2444 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2445 (match_operand:DI 1 "general_operand" ""))]
2446 "!TARGET_64BIT && reload_completed
2447 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
2448 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2450 "ix86_split_long_move (operands); DONE;")
2452 (define_insn "*movdi_1_rex64"
2453 [(set (match_operand:DI 0 "nonimmediate_operand"
2454 "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
2455 (match_operand:DI 1 "general_operand"
2456 "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
2457 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2459 switch (get_attr_type (insn))
2462 if (SSE_REG_P (operands[0]))
2463 return "movq2dq\t{%1, %0|%0, %1}";
2465 return "movdq2q\t{%1, %0|%0, %1}";
2470 if (get_attr_mode (insn) == MODE_TI)
2471 return "vmovdqa\t{%1, %0|%0, %1}";
2473 return "vmovq\t{%1, %0|%0, %1}";
2476 if (get_attr_mode (insn) == MODE_TI)
2477 return "movdqa\t{%1, %0|%0, %1}";
2481 /* Moves from and into integer register is done using movd
2482 opcode with REX prefix. */
2483 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
2484 return "movd\t{%1, %0|%0, %1}";
2485 return "movq\t{%1, %0|%0, %1}";
2488 return "%vpxor\t%0, %d0";
2491 return "pxor\t%0, %0";
2497 return "lea{q}\t{%a1, %0|%0, %a1}";
2500 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2501 if (get_attr_mode (insn) == MODE_SI)
2502 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2503 else if (which_alternative == 2)
2504 return "movabs{q}\t{%1, %0|%0, %1}";
2506 return "mov{q}\t{%1, %0|%0, %1}";
2510 (cond [(eq_attr "alternative" "5")
2511 (const_string "mmx")
2512 (eq_attr "alternative" "6,7,8,9,10")
2513 (const_string "mmxmov")
2514 (eq_attr "alternative" "11")
2515 (const_string "sselog1")
2516 (eq_attr "alternative" "12,13,14,15,16")
2517 (const_string "ssemov")
2518 (eq_attr "alternative" "17,18")
2519 (const_string "ssecvt")
2520 (eq_attr "alternative" "4")
2521 (const_string "multi")
2522 (match_operand:DI 1 "pic_32bit_operand" "")
2523 (const_string "lea")
2525 (const_string "imov")))
2528 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2530 (const_string "*")))
2531 (set (attr "length_immediate")
2533 (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2535 (const_string "*")))
2536 (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
2537 (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
2538 (set (attr "prefix")
2539 (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
2540 (const_string "maybe_vex")
2541 (const_string "orig")))
2542 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2544 ;; Stores and loads of ax to arbitrary constant address.
2545 ;; We fake an second form of instruction to force reload to load address
2546 ;; into register when rax is not available
2547 (define_insn "*movabsdi_1_rex64"
2548 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2549 (match_operand:DI 1 "nonmemory_operand" "a,er"))]
2550 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2552 movabs{q}\t{%1, %P0|%P0, %1}
2553 mov{q}\t{%1, %a0|%a0, %1}"
2554 [(set_attr "type" "imov")
2555 (set_attr "modrm" "0,*")
2556 (set_attr "length_address" "8,0")
2557 (set_attr "length_immediate" "0,*")
2558 (set_attr "memory" "store")
2559 (set_attr "mode" "DI")])
2561 (define_insn "*movabsdi_2_rex64"
2562 [(set (match_operand:DI 0 "register_operand" "=a,r")
2563 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2564 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2566 movabs{q}\t{%P1, %0|%0, %P1}
2567 mov{q}\t{%a1, %0|%0, %a1}"
2568 [(set_attr "type" "imov")
2569 (set_attr "modrm" "0,*")
2570 (set_attr "length_address" "8,0")
2571 (set_attr "length_immediate" "0")
2572 (set_attr "memory" "load")
2573 (set_attr "mode" "DI")])
2575 ;; Convert impossible stores of immediate to existing instructions.
2576 ;; First try to get scratch register and go through it. In case this
2577 ;; fails, move by 32bit parts.
2579 [(match_scratch:DI 2 "r")
2580 (set (match_operand:DI 0 "memory_operand" "")
2581 (match_operand:DI 1 "immediate_operand" ""))]
2582 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2583 && !x86_64_immediate_operand (operands[1], DImode)"
2584 [(set (match_dup 2) (match_dup 1))
2585 (set (match_dup 0) (match_dup 2))]
2588 ;; We need to define this as both peepholer and splitter for case
2589 ;; peephole2 pass is not run.
2590 ;; "&& 1" is needed to keep it from matching the previous pattern.
2592 [(set (match_operand:DI 0 "memory_operand" "")
2593 (match_operand:DI 1 "immediate_operand" ""))]
2594 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2595 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2596 [(set (match_dup 2) (match_dup 3))
2597 (set (match_dup 4) (match_dup 5))]
2598 "split_di (&operands[0], 2, &operands[2], &operands[4]);")
2601 [(set (match_operand:DI 0 "memory_operand" "")
2602 (match_operand:DI 1 "immediate_operand" ""))]
2603 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2604 ? epilogue_completed : reload_completed)
2605 && !symbolic_operand (operands[1], DImode)
2606 && !x86_64_immediate_operand (operands[1], DImode)"
2607 [(set (match_dup 2) (match_dup 3))
2608 (set (match_dup 4) (match_dup 5))]
2609 "split_di (&operands[0], 2, &operands[2], &operands[4]);")
2611 (define_insn "*swapdi_rex64"
2612 [(set (match_operand:DI 0 "register_operand" "+r")
2613 (match_operand:DI 1 "register_operand" "+r"))
2618 [(set_attr "type" "imov")
2619 (set_attr "mode" "DI")
2620 (set_attr "pent_pair" "np")
2621 (set_attr "athlon_decode" "vector")
2622 (set_attr "amdfam10_decode" "double")])
2624 (define_expand "movoi"
2625 [(set (match_operand:OI 0 "nonimmediate_operand" "")
2626 (match_operand:OI 1 "general_operand" ""))]
2628 "ix86_expand_move (OImode, operands); DONE;")
2630 (define_insn "*movoi_internal"
2631 [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
2632 (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
2634 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2636 switch (which_alternative)
2639 return "vxorps\t%0, %0, %0";
2642 if (misaligned_operand (operands[0], OImode)
2643 || misaligned_operand (operands[1], OImode))
2644 return "vmovdqu\t{%1, %0|%0, %1}";
2646 return "vmovdqa\t{%1, %0|%0, %1}";
2651 [(set_attr "type" "sselog1,ssemov,ssemov")
2652 (set_attr "prefix" "vex")
2653 (set_attr "mode" "OI")])
2655 (define_expand "movti"
2656 [(set (match_operand:TI 0 "nonimmediate_operand" "")
2657 (match_operand:TI 1 "nonimmediate_operand" ""))]
2658 "TARGET_SSE || TARGET_64BIT"
2661 ix86_expand_move (TImode, operands);
2662 else if (push_operand (operands[0], TImode))
2663 ix86_expand_push (TImode, operands[1]);
2665 ix86_expand_vector_move (TImode, operands);
2669 (define_insn "*movti_internal"
2670 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
2671 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
2672 "TARGET_SSE && !TARGET_64BIT
2673 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2675 switch (which_alternative)
2678 if (get_attr_mode (insn) == MODE_V4SF)
2679 return "%vxorps\t%0, %d0";
2681 return "%vpxor\t%0, %d0";
2684 /* TDmode values are passed as TImode on the stack. Moving them
2685 to stack may result in unaligned memory access. */
2686 if (misaligned_operand (operands[0], TImode)
2687 || misaligned_operand (operands[1], TImode))
2689 if (get_attr_mode (insn) == MODE_V4SF)
2690 return "%vmovups\t{%1, %0|%0, %1}";
2692 return "%vmovdqu\t{%1, %0|%0, %1}";
2696 if (get_attr_mode (insn) == MODE_V4SF)
2697 return "%vmovaps\t{%1, %0|%0, %1}";
2699 return "%vmovdqa\t{%1, %0|%0, %1}";
2705 [(set_attr "type" "sselog1,ssemov,ssemov")
2706 (set_attr "prefix" "maybe_vex")
2708 (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2709 (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0)))
2710 (const_string "V4SF")
2711 (and (eq_attr "alternative" "2")
2712 (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2714 (const_string "V4SF")]
2715 (const_string "TI")))])
2717 (define_insn "*movti_rex64"
2718 [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
2719 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
2721 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2723 switch (which_alternative)
2729 if (get_attr_mode (insn) == MODE_V4SF)
2730 return "%vxorps\t%0, %d0";
2732 return "%vpxor\t%0, %d0";
2735 /* TDmode values are passed as TImode on the stack. Moving them
2736 to stack may result in unaligned memory access. */
2737 if (misaligned_operand (operands[0], TImode)
2738 || misaligned_operand (operands[1], TImode))
2740 if (get_attr_mode (insn) == MODE_V4SF)
2741 return "%vmovups\t{%1, %0|%0, %1}";
2743 return "%vmovdqu\t{%1, %0|%0, %1}";
2747 if (get_attr_mode (insn) == MODE_V4SF)
2748 return "%vmovaps\t{%1, %0|%0, %1}";
2750 return "%vmovdqa\t{%1, %0|%0, %1}";
2756 [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
2757 (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
2759 (cond [(eq_attr "alternative" "2,3")
2761 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2763 (const_string "V4SF")
2764 (const_string "TI"))
2765 (eq_attr "alternative" "4")
2767 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2769 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2771 (const_string "V4SF")
2772 (const_string "TI"))]
2773 (const_string "DI")))])
2776 [(set (match_operand:TI 0 "nonimmediate_operand" "")
2777 (match_operand:TI 1 "general_operand" ""))]
2778 "reload_completed && !SSE_REG_P (operands[0])
2779 && !SSE_REG_P (operands[1])"
2781 "ix86_split_long_move (operands); DONE;")
2783 ;; This expands to what emit_move_complex would generate if we didn't
2784 ;; have a movti pattern. Having this avoids problems with reload on
2785 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
2786 ;; to have around all the time.
2787 (define_expand "movcdi"
2788 [(set (match_operand:CDI 0 "nonimmediate_operand" "")
2789 (match_operand:CDI 1 "general_operand" ""))]
2792 if (push_operand (operands[0], CDImode))
2793 emit_move_complex_push (CDImode, operands[0], operands[1]);
2795 emit_move_complex_parts (operands[0], operands[1]);
2799 (define_expand "movsf"
2800 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2801 (match_operand:SF 1 "general_operand" ""))]
2803 "ix86_expand_move (SFmode, operands); DONE;")
2805 (define_insn "*pushsf"
2806 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2807 (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
2810 /* Anything else should be already split before reg-stack. */
2811 gcc_assert (which_alternative == 1);
2812 return "push{l}\t%1";
2814 [(set_attr "type" "multi,push,multi")
2815 (set_attr "unit" "i387,*,*")
2816 (set_attr "mode" "SF,SI,SF")])
2818 (define_insn "*pushsf_rex64"
2819 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2820 (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
2823 /* Anything else should be already split before reg-stack. */
2824 gcc_assert (which_alternative == 1);
2825 return "push{q}\t%q1";
2827 [(set_attr "type" "multi,push,multi")
2828 (set_attr "unit" "i387,*,*")
2829 (set_attr "mode" "SF,DI,SF")])
2832 [(set (match_operand:SF 0 "push_operand" "")
2833 (match_operand:SF 1 "memory_operand" ""))]
2835 && MEM_P (operands[1])
2836 && (operands[2] = find_constant_src (insn))"
2840 ;; %%% Kill this when call knows how to work this out.
2842 [(set (match_operand:SF 0 "push_operand" "")
2843 (match_operand:SF 1 "any_fp_register_operand" ""))]
2845 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
2846 (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
2849 [(set (match_operand:SF 0 "push_operand" "")
2850 (match_operand:SF 1 "any_fp_register_operand" ""))]
2852 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2853 (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
2855 (define_insn "*movsf_1"
2856 [(set (match_operand:SF 0 "nonimmediate_operand"
2857 "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
2858 (match_operand:SF 1 "general_operand"
2859 "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
2860 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
2861 && (reload_in_progress || reload_completed
2862 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2863 || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
2864 && standard_80387_constant_p (operands[1]))
2865 || GET_CODE (operands[1]) != CONST_DOUBLE
2866 || memory_operand (operands[0], SFmode))"
2868 switch (which_alternative)
2872 return output_387_reg_move (insn, operands);
2875 return standard_80387_constant_opcode (operands[1]);
2879 return "mov{l}\t{%1, %0|%0, %1}";
2881 if (get_attr_mode (insn) == MODE_TI)
2882 return "%vpxor\t%0, %d0";
2884 return "%vxorps\t%0, %d0";
2886 if (get_attr_mode (insn) == MODE_V4SF)
2887 return "%vmovaps\t{%1, %0|%0, %1}";
2889 return "%vmovss\t{%1, %d0|%d0, %1}";
2892 return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
2893 : "vmovss\t{%1, %0|%0, %1}";
2895 return "movss\t{%1, %0|%0, %1}";
2897 return "%vmovss\t{%1, %0|%0, %1}";
2899 case 9: case 10: case 14: case 15:
2900 return "movd\t{%1, %0|%0, %1}";
2902 return "%vmovd\t{%1, %0|%0, %1}";
2905 return "movq\t{%1, %0|%0, %1}";
2911 [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
2912 (set (attr "prefix")
2913 (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
2914 (const_string "maybe_vex")
2915 (const_string "orig")))
2917 (cond [(eq_attr "alternative" "3,4,9,10")
2919 (eq_attr "alternative" "5")
2921 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2923 (ne (symbol_ref "TARGET_SSE2")
2925 (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2928 (const_string "V4SF"))
2929 /* For architectures resolving dependencies on
2930 whole SSE registers use APS move to break dependency
2931 chains, otherwise use short move to avoid extra work.
2933 Do the same for architectures resolving dependencies on
2934 the parts. While in DF mode it is better to always handle
2935 just register parts, the SF mode is different due to lack
2936 of instructions to load just part of the register. It is
2937 better to maintain the whole registers in single format
2938 to avoid problems on using packed logical operations. */
2939 (eq_attr "alternative" "6")
2941 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2943 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2945 (const_string "V4SF")
2946 (const_string "SF"))
2947 (eq_attr "alternative" "11")
2948 (const_string "DI")]
2949 (const_string "SF")))])
2951 (define_insn "*swapsf"
2952 [(set (match_operand:SF 0 "fp_register_operand" "+f")
2953 (match_operand:SF 1 "fp_register_operand" "+f"))
2956 "reload_completed || TARGET_80387"
2958 if (STACK_TOP_P (operands[0]))
2963 [(set_attr "type" "fxch")
2964 (set_attr "mode" "SF")])
2966 (define_expand "movdf"
2967 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2968 (match_operand:DF 1 "general_operand" ""))]
2970 "ix86_expand_move (DFmode, operands); DONE;")
2972 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2973 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2974 ;; On the average, pushdf using integers can be still shorter. Allow this
2975 ;; pattern for optimize_size too.
2977 (define_insn "*pushdf_nointeger"
2978 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2979 (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
2980 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
2982 /* This insn should be already split before reg-stack. */
2985 [(set_attr "type" "multi")
2986 (set_attr "unit" "i387,*,*,*")
2987 (set_attr "mode" "DF,SI,SI,DF")])
2989 (define_insn "*pushdf_integer"
2990 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2991 (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
2992 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2994 /* This insn should be already split before reg-stack. */
2997 [(set_attr "type" "multi")
2998 (set_attr "unit" "i387,*,*")
2999 (set_attr "mode" "DF,SI,DF")])
3001 ;; %%% Kill this when call knows how to work this out.
3003 [(set (match_operand:DF 0 "push_operand" "")
3004 (match_operand:DF 1 "any_fp_register_operand" ""))]
3006 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
3007 (set (mem:DF (reg:P SP_REG)) (match_dup 1))]
3011 [(set (match_operand:DF 0 "push_operand" "")
3012 (match_operand:DF 1 "general_operand" ""))]
3015 "ix86_split_long_move (operands); DONE;")
3017 ;; Moving is usually shorter when only FP registers are used. This separate
3018 ;; movdf pattern avoids the use of integer registers for FP operations
3019 ;; when optimizing for size.
3021 (define_insn "*movdf_nointeger"
3022 [(set (match_operand:DF 0 "nonimmediate_operand"
3023 "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
3024 (match_operand:DF 1 "general_operand"
3025 "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
3026 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3027 && ((optimize_function_for_size_p (cfun)
3028 || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
3029 && (reload_in_progress || reload_completed
3030 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3031 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3032 && optimize_function_for_size_p (cfun)
3033 && !memory_operand (operands[0], DFmode)
3034 && standard_80387_constant_p (operands[1]))
3035 || GET_CODE (operands[1]) != CONST_DOUBLE
3036 || ((optimize_function_for_size_p (cfun)
3037 || !TARGET_MEMORY_MISMATCH_STALL
3038 || reload_in_progress || reload_completed)
3039 && memory_operand (operands[0], DFmode)))"
3041 switch (which_alternative)
3045 return output_387_reg_move (insn, operands);
3048 return standard_80387_constant_opcode (operands[1]);
3054 switch (get_attr_mode (insn))
3057 return "%vxorps\t%0, %d0";
3059 return "%vxorpd\t%0, %d0";
3061 return "%vpxor\t%0, %d0";
3068 switch (get_attr_mode (insn))
3071 return "%vmovaps\t{%1, %0|%0, %1}";
3073 return "%vmovapd\t{%1, %0|%0, %1}";
3075 return "%vmovdqa\t{%1, %0|%0, %1}";
3077 return "%vmovq\t{%1, %0|%0, %1}";
3081 if (REG_P (operands[0]) && REG_P (operands[1]))
3082 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3084 return "vmovsd\t{%1, %0|%0, %1}";
3087 return "movsd\t{%1, %0|%0, %1}";
3091 if (REG_P (operands[0]))
3092 return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
3094 return "vmovlpd\t{%1, %0|%0, %1}";
3097 return "movlpd\t{%1, %0|%0, %1}";
3101 if (REG_P (operands[0]))
3102 return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
3104 return "vmovlps\t{%1, %0|%0, %1}";
3107 return "movlps\t{%1, %0|%0, %1}";
3116 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3117 (set (attr "prefix")
3118 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3119 (const_string "orig")
3120 (const_string "maybe_vex")))
3121 (set (attr "prefix_data16")
3122 (if_then_else (eq_attr "mode" "V1DF")
3124 (const_string "*")))
3126 (cond [(eq_attr "alternative" "0,1,2")
3128 (eq_attr "alternative" "3,4")
3131 /* For SSE1, we have many fewer alternatives. */
3132 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3133 (cond [(eq_attr "alternative" "5,6")
3134 (const_string "V4SF")
3136 (const_string "V2SF"))
3138 /* xorps is one byte shorter. */
3139 (eq_attr "alternative" "5")
3140 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3142 (const_string "V4SF")
3143 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3147 (const_string "V2DF"))
3149 /* For architectures resolving dependencies on
3150 whole SSE registers use APD move to break dependency
3151 chains, otherwise use short move to avoid extra work.
3153 movaps encodes one byte shorter. */
3154 (eq_attr "alternative" "6")
3156 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3158 (const_string "V4SF")
3159 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3161 (const_string "V2DF")
3163 (const_string "DF"))
3164 /* For architectures resolving dependencies on register
3165 parts we may avoid extra work to zero out upper part
3167 (eq_attr "alternative" "7")
3169 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3171 (const_string "V1DF")
3172 (const_string "DF"))
3174 (const_string "DF")))])
3176 (define_insn "*movdf_integer_rex64"
3177 [(set (match_operand:DF 0 "nonimmediate_operand"
3178 "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
3179 (match_operand:DF 1 "general_operand"
3180 "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
3181 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3182 && (reload_in_progress || reload_completed
3183 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3184 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3185 && optimize_function_for_size_p (cfun)
3186 && standard_80387_constant_p (operands[1]))
3187 || GET_CODE (operands[1]) != CONST_DOUBLE
3188 || memory_operand (operands[0], DFmode))"
3190 switch (which_alternative)
3194 return output_387_reg_move (insn, operands);
3197 return standard_80387_constant_opcode (operands[1]);
3204 switch (get_attr_mode (insn))
3207 return "%vxorps\t%0, %d0";
3209 return "%vxorpd\t%0, %d0";
3211 return "%vpxor\t%0, %d0";
3218 switch (get_attr_mode (insn))
3221 return "%vmovaps\t{%1, %0|%0, %1}";
3223 return "%vmovapd\t{%1, %0|%0, %1}";
3225 return "%vmovdqa\t{%1, %0|%0, %1}";
3227 return "%vmovq\t{%1, %0|%0, %1}";
3231 if (REG_P (operands[0]) && REG_P (operands[1]))
3232 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3234 return "vmovsd\t{%1, %0|%0, %1}";
3237 return "movsd\t{%1, %0|%0, %1}";
3239 return "%vmovlpd\t{%1, %d0|%d0, %1}";
3241 return "%vmovlps\t{%1, %d0|%d0, %1}";
3248 return "%vmovd\t{%1, %0|%0, %1}";
3254 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
3255 (set (attr "prefix")
3256 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3257 (const_string "orig")
3258 (const_string "maybe_vex")))
3259 (set (attr "prefix_data16")
3260 (if_then_else (eq_attr "mode" "V1DF")
3262 (const_string "*")))
3264 (cond [(eq_attr "alternative" "0,1,2")
3266 (eq_attr "alternative" "3,4,9,10")
3269 /* For SSE1, we have many fewer alternatives. */
3270 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3271 (cond [(eq_attr "alternative" "5,6")
3272 (const_string "V4SF")
3274 (const_string "V2SF"))
3276 /* xorps is one byte shorter. */
3277 (eq_attr "alternative" "5")
3278 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3280 (const_string "V4SF")
3281 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3285 (const_string "V2DF"))
3287 /* For architectures resolving dependencies on
3288 whole SSE registers use APD move to break dependency
3289 chains, otherwise use short move to avoid extra work.
3291 movaps encodes one byte shorter. */
3292 (eq_attr "alternative" "6")
3294 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3296 (const_string "V4SF")
3297 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3299 (const_string "V2DF")
3301 (const_string "DF"))
3302 /* For architectures resolving dependencies on register
3303 parts we may avoid extra work to zero out upper part
3305 (eq_attr "alternative" "7")
3307 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3309 (const_string "V1DF")
3310 (const_string "DF"))
3312 (const_string "DF")))])
3314 (define_insn "*movdf_integer"
3315 [(set (match_operand:DF 0 "nonimmediate_operand"
3316 "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
3317 (match_operand:DF 1 "general_operand"
3318 "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
3319 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3320 && optimize_function_for_speed_p (cfun)
3321 && TARGET_INTEGER_DFMODE_MOVES
3322 && (reload_in_progress || reload_completed
3323 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3324 || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3325 && optimize_function_for_size_p (cfun)
3326 && standard_80387_constant_p (operands[1]))
3327 || GET_CODE (operands[1]) != CONST_DOUBLE
3328 || memory_operand (operands[0], DFmode))"
3330 switch (which_alternative)
3334 return output_387_reg_move (insn, operands);
3337 return standard_80387_constant_opcode (operands[1]);
3344 switch (get_attr_mode (insn))
3347 return "xorps\t%0, %0";
3349 return "xorpd\t%0, %0";
3351 return "pxor\t%0, %0";
3358 switch (get_attr_mode (insn))
3361 return "movaps\t{%1, %0|%0, %1}";
3363 return "movapd\t{%1, %0|%0, %1}";
3365 return "movdqa\t{%1, %0|%0, %1}";
3367 return "movq\t{%1, %0|%0, %1}";
3369 return "movsd\t{%1, %0|%0, %1}";
3371 return "movlpd\t{%1, %0|%0, %1}";
3373 return "movlps\t{%1, %0|%0, %1}";
3382 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3383 (set (attr "prefix_data16")
3384 (if_then_else (eq_attr "mode" "V1DF")
3386 (const_string "*")))
3388 (cond [(eq_attr "alternative" "0,1,2")
3390 (eq_attr "alternative" "3,4")
3393 /* For SSE1, we have many fewer alternatives. */
3394 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3395 (cond [(eq_attr "alternative" "5,6")
3396 (const_string "V4SF")
3398 (const_string "V2SF"))
3400 /* xorps is one byte shorter. */
3401 (eq_attr "alternative" "5")
3402 (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3404 (const_string "V4SF")
3405 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3409 (const_string "V2DF"))
3411 /* For architectures resolving dependencies on
3412 whole SSE registers use APD move to break dependency
3413 chains, otherwise use short move to avoid extra work.
3415 movaps encodes one byte shorter. */
3416 (eq_attr "alternative" "6")
3418 [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3420 (const_string "V4SF")
3421 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3423 (const_string "V2DF")
3425 (const_string "DF"))
3426 /* For architectures resolving dependencies on register
3427 parts we may avoid extra work to zero out upper part
3429 (eq_attr "alternative" "7")
3431 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3433 (const_string "V1DF")
3434 (const_string "DF"))
3436 (const_string "DF")))])
3439 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3440 (match_operand:DF 1 "general_operand" ""))]
3442 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3443 && ! (ANY_FP_REG_P (operands[0]) ||
3444 (GET_CODE (operands[0]) == SUBREG
3445 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3446 && ! (ANY_FP_REG_P (operands[1]) ||
3447 (GET_CODE (operands[1]) == SUBREG
3448 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3450 "ix86_split_long_move (operands); DONE;")
3452 (define_insn "*swapdf"
3453 [(set (match_operand:DF 0 "fp_register_operand" "+f")
3454 (match_operand:DF 1 "fp_register_operand" "+f"))
3457 "reload_completed || TARGET_80387"
3459 if (STACK_TOP_P (operands[0]))
3464 [(set_attr "type" "fxch")
3465 (set_attr "mode" "DF")])
3467 (define_expand "movxf"
3468 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3469 (match_operand:XF 1 "general_operand" ""))]
3471 "ix86_expand_move (XFmode, operands); DONE;")
3473 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
3474 ;; Size of pushdf using integer instructions is 3+3*memory operand size
3475 ;; Pushing using integer instructions is longer except for constants
3476 ;; and direct memory references.
3477 ;; (assuming that any given constant is pushed only once, but this ought to be
3478 ;; handled elsewhere).
3480 (define_insn "*pushxf_nointeger"
3481 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
3482 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
3483 "optimize_function_for_size_p (cfun)"
3485 /* This insn should be already split before reg-stack. */
3488 [(set_attr "type" "multi")
3489 (set_attr "unit" "i387,*,*")
3490 (set_attr "mode" "XF,SI,SI")])
3492 (define_insn "*pushxf_integer"
3493 [(set (match_operand:XF 0 "push_operand" "=<,<")
3494 (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
3495 "optimize_function_for_speed_p (cfun)"
3497 /* This insn should be already split before reg-stack. */
3500 [(set_attr "type" "multi")
3501 (set_attr "unit" "i387,*")
3502 (set_attr "mode" "XF,SI")])
3505 [(set (match_operand 0 "push_operand" "")
3506 (match_operand 1 "general_operand" ""))]
3508 && (GET_MODE (operands[0]) == XFmode
3509 || GET_MODE (operands[0]) == DFmode)
3510 && !ANY_FP_REG_P (operands[1])"
3512 "ix86_split_long_move (operands); DONE;")
3515 [(set (match_operand:XF 0 "push_operand" "")
3516 (match_operand:XF 1 "any_fp_register_operand" ""))]
3518 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
3519 (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
3520 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3522 ;; Do not use integer registers when optimizing for size
3523 (define_insn "*movxf_nointeger"
3524 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
3525 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
3526 "optimize_function_for_size_p (cfun)
3527 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3528 && (reload_in_progress || reload_completed
3529 || standard_80387_constant_p (operands[1])
3530 || GET_CODE (operands[1]) != CONST_DOUBLE
3531 || memory_operand (operands[0], XFmode))"
3533 switch (which_alternative)
3537 return output_387_reg_move (insn, operands);
3540 return standard_80387_constant_opcode (operands[1]);
3548 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3549 (set_attr "mode" "XF,XF,XF,SI,SI")])
3551 (define_insn "*movxf_integer"
3552 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
3553 (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
3554 "optimize_function_for_speed_p (cfun)
3555 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3556 && (reload_in_progress || reload_completed
3557 || GET_CODE (operands[1]) != CONST_DOUBLE
3558 || memory_operand (operands[0], XFmode))"
3560 switch (which_alternative)
3564 return output_387_reg_move (insn, operands);
3567 return standard_80387_constant_opcode (operands[1]);
3576 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3577 (set_attr "mode" "XF,XF,XF,SI,SI")])
3579 (define_expand "movtf"
3580 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3581 (match_operand:TF 1 "nonimmediate_operand" ""))]
3584 ix86_expand_move (TFmode, operands);
3588 (define_insn "*movtf_internal"
3589 [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
3590 (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
3592 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
3594 switch (which_alternative)
3598 if (get_attr_mode (insn) == MODE_V4SF)
3599 return "%vmovaps\t{%1, %0|%0, %1}";
3601 return "%vmovdqa\t{%1, %0|%0, %1}";
3603 if (get_attr_mode (insn) == MODE_V4SF)
3604 return "%vxorps\t%0, %d0";
3606 return "%vpxor\t%0, %d0";
3614 [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
3615 (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
3617 (cond [(eq_attr "alternative" "0,2")
3619 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
3621 (const_string "V4SF")
3622 (const_string "TI"))
3623 (eq_attr "alternative" "1")
3625 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
3627 (ne (symbol_ref "optimize_function_for_size_p (cfun)")
3629 (const_string "V4SF")
3630 (const_string "TI"))]
3631 (const_string "DI")))])
3633 (define_insn "*pushtf_sse"
3634 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
3635 (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
3638 /* This insn should be already split before reg-stack. */
3641 [(set_attr "type" "multi")
3642 (set_attr "unit" "sse,*,*")
3643 (set_attr "mode" "TF,SI,SI")])
3646 [(set (match_operand:TF 0 "push_operand" "")
3647 (match_operand:TF 1 "general_operand" ""))]
3648 "TARGET_SSE2 && reload_completed
3649 && !SSE_REG_P (operands[1])"
3651 "ix86_split_long_move (operands); DONE;")
3654 [(set (match_operand:TF 0 "push_operand" "")
3655 (match_operand:TF 1 "any_fp_register_operand" ""))]
3657 [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
3658 (set (mem:TF (reg:P SP_REG)) (match_dup 1))]
3662 [(set (match_operand 0 "nonimmediate_operand" "")
3663 (match_operand 1 "general_operand" ""))]
3665 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3666 && GET_MODE (operands[0]) == XFmode
3667 && ! (ANY_FP_REG_P (operands[0]) ||
3668 (GET_CODE (operands[0]) == SUBREG
3669 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3670 && ! (ANY_FP_REG_P (operands[1]) ||
3671 (GET_CODE (operands[1]) == SUBREG
3672 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3674 "ix86_split_long_move (operands); DONE;")
3677 [(set (match_operand 0 "register_operand" "")
3678 (match_operand 1 "memory_operand" ""))]
3680 && MEM_P (operands[1])
3681 && (GET_MODE (operands[0]) == TFmode
3682 || GET_MODE (operands[0]) == XFmode
3683 || GET_MODE (operands[0]) == SFmode
3684 || GET_MODE (operands[0]) == DFmode)
3685 && (operands[2] = find_constant_src (insn))"
3686 [(set (match_dup 0) (match_dup 2))]
3688 rtx c = operands[2];
3689 rtx r = operands[0];
3691 if (GET_CODE (r) == SUBREG)
3696 if (!standard_sse_constant_p (c))
3699 else if (FP_REG_P (r))
3701 if (!standard_80387_constant_p (c))
3704 else if (MMX_REG_P (r))
3709 [(set (match_operand 0 "register_operand" "")
3710 (float_extend (match_operand 1 "memory_operand" "")))]
3712 && MEM_P (operands[1])
3713 && (GET_MODE (operands[0]) == TFmode
3714 || GET_MODE (operands[0]) == XFmode
3715 || GET_MODE (operands[0]) == SFmode
3716 || GET_MODE (operands[0]) == DFmode)
3717 && (operands[2] = find_constant_src (insn))"
3718 [(set (match_dup 0) (match_dup 2))]
3720 rtx c = operands[2];
3721 rtx r = operands[0];
3723 if (GET_CODE (r) == SUBREG)
3728 if (!standard_sse_constant_p (c))
3731 else if (FP_REG_P (r))
3733 if (!standard_80387_constant_p (c))
3736 else if (MMX_REG_P (r))
3740 (define_insn "swapxf"
3741 [(set (match_operand:XF 0 "register_operand" "+f")
3742 (match_operand:XF 1 "register_operand" "+f"))
3747 if (STACK_TOP_P (operands[0]))
3752 [(set_attr "type" "fxch")
3753 (set_attr "mode" "XF")])
3755 ;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence
3757 [(set (match_operand:X87MODEF 0 "register_operand" "")
3758 (match_operand:X87MODEF 1 "immediate_operand" ""))]
3759 "reload_completed && FP_REGNO_P (REGNO (operands[0]))
3760 && (standard_80387_constant_p (operands[1]) == 8
3761 || standard_80387_constant_p (operands[1]) == 9)"
3762 [(set (match_dup 0)(match_dup 1))
3764 (neg:X87MODEF (match_dup 0)))]
3768 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
3769 if (real_isnegzero (&r))
3770 operands[1] = CONST0_RTX (<MODE>mode);
3772 operands[1] = CONST1_RTX (<MODE>mode);
3776 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3777 (match_operand:TF 1 "general_operand" ""))]
3779 && !(SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]))"
3781 "ix86_split_long_move (operands); DONE;")
3783 ;; Zero extension instructions
3785 (define_expand "zero_extendhisi2"
3786 [(set (match_operand:SI 0 "register_operand" "")
3787 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3790 if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))
3792 operands[1] = force_reg (HImode, operands[1]);
3793 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
3798 (define_insn "zero_extendhisi2_and"
3799 [(set (match_operand:SI 0 "register_operand" "=r")
3800 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
3801 (clobber (reg:CC FLAGS_REG))]
3802 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3804 [(set_attr "type" "alu1")
3805 (set_attr "mode" "SI")])
3808 [(set (match_operand:SI 0 "register_operand" "")
3809 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
3810 (clobber (reg:CC FLAGS_REG))]
3811 "reload_completed && TARGET_ZERO_EXTEND_WITH_AND
3812 && optimize_function_for_speed_p (cfun)"
3813 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
3814 (clobber (reg:CC FLAGS_REG))])]
3817 (define_insn "*zero_extendhisi2_movzwl"
3818 [(set (match_operand:SI 0 "register_operand" "=r")
3819 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3820 "!TARGET_ZERO_EXTEND_WITH_AND
3821 || optimize_function_for_size_p (cfun)"
3822 "movz{wl|x}\t{%1, %0|%0, %1}"
3823 [(set_attr "type" "imovx")
3824 (set_attr "mode" "SI")])
3826 (define_expand "zero_extendqihi2"
3828 [(set (match_operand:HI 0 "register_operand" "")
3829 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3830 (clobber (reg:CC FLAGS_REG))])]
3834 (define_insn "*zero_extendqihi2_and"
3835 [(set (match_operand:HI 0 "register_operand" "=r,?&q")
3836 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3837 (clobber (reg:CC FLAGS_REG))]
3838 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)"
3840 [(set_attr "type" "alu1")
3841 (set_attr "mode" "HI")])
3843 (define_insn "*zero_extendqihi2_movzbw_and"
3844 [(set (match_operand:HI 0 "register_operand" "=r,r")
3845 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3846 (clobber (reg:CC FLAGS_REG))]
3847 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun)"
3849 [(set_attr "type" "imovx,alu1")
3850 (set_attr "mode" "HI")])
3852 ; zero extend to SImode here to avoid partial register stalls
3853 (define_insn "*zero_extendqihi2_movzbl"
3854 [(set (match_operand:HI 0 "register_operand" "=r")
3855 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3856 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))
3857 && reload_completed"
3858 "movz{bl|x}\t{%1, %k0|%k0, %1}"
3859 [(set_attr "type" "imovx")
3860 (set_attr "mode" "SI")])
3862 ;; For the movzbw case strip only the clobber
3864 [(set (match_operand:HI 0 "register_operand" "")
3865 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3866 (clobber (reg:CC FLAGS_REG))]
3868 && (!TARGET_ZERO_EXTEND_WITH_AND
3869 || optimize_function_for_size_p (cfun))
3870 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3871 [(set (match_operand:HI 0 "register_operand" "")
3872 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))])
3874 ;; When source and destination does not overlap, clear destination
3875 ;; first and then do the movb
3877 [(set (match_operand:HI 0 "register_operand" "")
3878 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3879 (clobber (reg:CC FLAGS_REG))]
3881 && ANY_QI_REG_P (operands[0])
3882 && (TARGET_ZERO_EXTEND_WITH_AND
3883 && optimize_function_for_speed_p (cfun))
3884 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3885 [(set (strict_low_part (match_dup&