OSDN Git Service

2a313665c159c8d84d43672bbec1015d5f719eae
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / i386.md
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
7 ;;
8 ;; This file is part of GCC.
9 ;;
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)
13 ;; any later version.
14 ;;
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.
19 ;;
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/>.  */
23 ;;
24 ;; The original PO technology requires these to be ordered by speed,
25 ;; so that assigner will pick the fastest.
26 ;;
27 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
28 ;;
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.",
36 ;;      otherwise nothing
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
44 ;;      delimiter.
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).
63
64 ;; UNSPEC usage:
65
66 (define_constants
67   [; Relocation specifiers
68    (UNSPEC_GOT                  0)
69    (UNSPEC_GOTOFF               1)
70    (UNSPEC_GOTPCREL             2)
71    (UNSPEC_GOTTPOFF             3)
72    (UNSPEC_TPOFF                4)
73    (UNSPEC_NTPOFF               5)
74    (UNSPEC_DTPOFF               6)
75    (UNSPEC_GOTNTPOFF            7)
76    (UNSPEC_INDNTPOFF            8)
77    (UNSPEC_PLTOFF               9)
78    (UNSPEC_MACHOPIC_OFFSET      10)
79
80    ; Prologue support
81    (UNSPEC_STACK_ALLOC          11)
82    (UNSPEC_SET_GOT              12)
83    (UNSPEC_SSE_PROLOGUE_SAVE    13)
84    (UNSPEC_REG_SAVE             14)
85    (UNSPEC_DEF_CFA              15)
86    (UNSPEC_SET_RIP              16)
87    (UNSPEC_SET_GOT_OFFSET       17)
88    (UNSPEC_MEMORY_BLOCKAGE      18)
89
90    ; TLS support
91    (UNSPEC_TP                   20)
92    (UNSPEC_TLS_GD               21)
93    (UNSPEC_TLS_LD_BASE          22)
94    (UNSPEC_TLSDESC              23)
95
96    ; Other random patterns
97    (UNSPEC_SCAS                 30)
98    (UNSPEC_FNSTSW               31)
99    (UNSPEC_SAHF                 32)
100    (UNSPEC_FSTCW                33)
101    (UNSPEC_ADD_CARRY            34)
102    (UNSPEC_FLDCW                35)
103    (UNSPEC_REP                  36)
104    (UNSPEC_LD_MPIC              38)     ; load_macho_picbase
105    (UNSPEC_TRUNC_NOOP           39)
106
107    ; For SSE/MMX support:
108    (UNSPEC_FIX_NOTRUNC          40)
109    (UNSPEC_MASKMOV              41)
110    (UNSPEC_MOVMSK               42)
111    (UNSPEC_MOVNT                43)
112    (UNSPEC_MOVU                 44)
113    (UNSPEC_RCP                  45)
114    (UNSPEC_RSQRT                46)
115    (UNSPEC_SFENCE               47)
116    (UNSPEC_PFRCP                49)
117    (UNSPEC_PFRCPIT1             40)
118    (UNSPEC_PFRCPIT2             41)
119    (UNSPEC_PFRSQRT              42)
120    (UNSPEC_PFRSQIT1             43)
121    (UNSPEC_MFENCE               44)
122    (UNSPEC_LFENCE               45)
123    (UNSPEC_PSADBW               46)
124    (UNSPEC_LDDQU                47)
125    (UNSPEC_MS_TO_SYSV_CALL      48)
126
127    ; Generic math support
128    (UNSPEC_COPYSIGN             50)
129    (UNSPEC_IEEE_MIN             51)     ; not commutative
130    (UNSPEC_IEEE_MAX             52)     ; not commutative
131
132    ; x87 Floating point
133    (UNSPEC_SIN                  60)
134    (UNSPEC_COS                  61)
135    (UNSPEC_FPATAN               62)
136    (UNSPEC_FYL2X                63)
137    (UNSPEC_FYL2XP1              64)
138    (UNSPEC_FRNDINT              65)
139    (UNSPEC_FIST                 66)
140    (UNSPEC_F2XM1                67)
141    (UNSPEC_TAN                  68)
142    (UNSPEC_FXAM                 69)
143
144    ; x87 Rounding
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)
151
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)
159    (UNSPEC_FPREM_F              88)
160    (UNSPEC_FPREM_U              89)
161    (UNSPEC_FPREM1_F             90)
162    (UNSPEC_FPREM1_U             91)
163
164    (UNSPEC_C2_FLAG              95)
165    (UNSPEC_FXAM_MEM             96)
166
167    ; SSP patterns
168    (UNSPEC_SP_SET               100)
169    (UNSPEC_SP_TEST              101)
170    (UNSPEC_SP_TLS_SET           102)
171    (UNSPEC_SP_TLS_TEST          103)
172
173    ; SSSE3
174    (UNSPEC_PSHUFB               120)
175    (UNSPEC_PSIGN                121)
176    (UNSPEC_PALIGNR              122)
177
178    ; For SSE4A support
179    (UNSPEC_EXTRQI               130)
180    (UNSPEC_EXTRQ                131)
181    (UNSPEC_INSERTQI             132)
182    (UNSPEC_INSERTQ              133)
183
184    ; For SSE4.1 support
185    (UNSPEC_BLENDV               134)
186    (UNSPEC_INSERTPS             135)
187    (UNSPEC_DP                   136)
188    (UNSPEC_MOVNTDQA             137)
189    (UNSPEC_MPSADBW              138)
190    (UNSPEC_PHMINPOSUW           139)
191    (UNSPEC_PTEST                140)
192    (UNSPEC_ROUND                141)
193
194    ; For SSE4.2 support
195    (UNSPEC_CRC32                143)
196    (UNSPEC_PCMPESTR             144)
197    (UNSPEC_PCMPISTR             145)
198
199    ; For FMA4 support
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)
206    (UNSPEC_FRCZ                 154)
207    (UNSPEC_LLWP_INTRINSIC       155)
208    (UNSPEC_SLWP_INTRINSIC       156)
209    (UNSPECV_LWPVAL_INTRINSIC    157)
210    (UNSPECV_LWPINS_INTRINSIC    158)
211
212    ; For AES support
213    (UNSPEC_AESENC               159)
214    (UNSPEC_AESENCLAST           160)
215    (UNSPEC_AESDEC               161)
216    (UNSPEC_AESDECLAST           162)
217    (UNSPEC_AESIMC               163)
218    (UNSPEC_AESKEYGENASSIST      164)
219
220    ; For PCLMUL support
221    (UNSPEC_PCLMUL               165)
222
223    ; For AVX support
224    (UNSPEC_PCMP                 166)
225    (UNSPEC_VPERMIL              167)
226    (UNSPEC_VPERMIL2F128         168)
227    (UNSPEC_MASKLOAD             169)
228    (UNSPEC_MASKSTORE            170)
229    (UNSPEC_CAST                 171)
230    (UNSPEC_VTESTP               172)
231   ])
232
233 (define_constants
234   [(UNSPECV_BLOCKAGE            0)
235    (UNSPECV_STACK_PROBE         1)
236    (UNSPECV_EMMS                2)
237    (UNSPECV_LDMXCSR             3)
238    (UNSPECV_STMXCSR             4)
239    (UNSPECV_FEMMS               5)
240    (UNSPECV_CLFLUSH             6)
241    (UNSPECV_ALIGN               7)
242    (UNSPECV_MONITOR             8)
243    (UNSPECV_MWAIT               9)
244    (UNSPECV_CMPXCHG             10)
245    (UNSPECV_XCHG                12)
246    (UNSPECV_LOCK                13)
247    (UNSPECV_PROLOGUE_USE        14)
248    (UNSPECV_CLD                 15)
249    (UNSPECV_VZEROALL            16)
250    (UNSPECV_VZEROUPPER          17)
251    (UNSPECV_RDTSC               18)
252    (UNSPECV_RDTSCP              19)
253    (UNSPECV_RDPMC               20)
254    (UNSPECV_VSWAPMOV    21)
255   ])
256
257 ;; Constants to represent pcomtrue/pcomfalse variants
258 (define_constants
259   [(PCOM_FALSE                  0)
260    (PCOM_TRUE                   1)
261    (COM_FALSE_S                 2)
262    (COM_FALSE_P                 3)
263    (COM_TRUE_S                  4)
264    (COM_TRUE_P                  5)
265   ])
266
267 ;; Constants used in the XOP pperm instruction
268 (define_constants
269   [(PPERM_SRC                   0x00)   /* copy source */
270    (PPERM_INVERT                0x20)   /* invert source */
271    (PPERM_REVERSE               0x40)   /* bit reverse source */
272    (PPERM_REV_INV               0x60)   /* bit reverse & invert src */
273    (PPERM_ZERO                  0x80)   /* all 0's */
274    (PPERM_ONES                  0xa0)   /* all 1's */
275    (PPERM_SIGN                  0xc0)   /* propagate sign bit */
276    (PPERM_INV_SIGN              0xe0)   /* invert & propagate sign */
277    (PPERM_SRC1                  0x00)   /* use first source byte */
278    (PPERM_SRC2                  0x10)   /* use second source byte */
279    ])
280
281 ;; Registers by name.
282 (define_constants
283   [(AX_REG                       0)
284    (DX_REG                       1)
285    (CX_REG                       2)
286    (BX_REG                       3)
287    (SI_REG                       4)
288    (DI_REG                       5)
289    (BP_REG                       6)
290    (SP_REG                       7)
291    (ST0_REG                      8)
292    (ST1_REG                      9)
293    (ST2_REG                     10)
294    (ST3_REG                     11)
295    (ST4_REG                     12)
296    (ST5_REG                     13)
297    (ST6_REG                     14)
298    (ST7_REG                     15)
299    (FLAGS_REG                   17)
300    (FPSR_REG                    18)
301    (FPCR_REG                    19)
302    (XMM0_REG                    21)
303    (XMM1_REG                    22)
304    (XMM2_REG                    23)
305    (XMM3_REG                    24)
306    (XMM4_REG                    25)
307    (XMM5_REG                    26)
308    (XMM6_REG                    27)
309    (XMM7_REG                    28)
310    (MM0_REG                     29)
311    (MM1_REG                     30)
312    (MM2_REG                     31)
313    (MM3_REG                     32)
314    (MM4_REG                     33)
315    (MM5_REG                     34)
316    (MM6_REG                     35)
317    (MM7_REG                     36)
318    (R8_REG                      37)
319    (R9_REG                      38)
320    (R10_REG                     39)
321    (R11_REG                     40)
322    (R12_REG                     41)
323    (R13_REG                     42)
324    (XMM8_REG                    45)
325    (XMM9_REG                    46)
326    (XMM10_REG                   47)
327    (XMM11_REG                   48)
328    (XMM12_REG                   49)
329    (XMM13_REG                   50)
330    (XMM14_REG                   51)
331    (XMM15_REG                   52)
332   ])
333
334 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
335 ;; from i386.c.
336
337 ;; In C guard expressions, put expressions which may be compile-time
338 ;; constants first.  This allows for better optimization.  For
339 ;; example, write "TARGET_64BIT && reload_completed", not
340 ;; "reload_completed && TARGET_64BIT".
341
342 \f
343 ;; Processor type.
344 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,atom,
345                     generic64,amdfam10"
346   (const (symbol_ref "ix86_schedule")))
347
348 ;; A basic instruction type.  Refinements due to arguments to be
349 ;; provided in other attributes.
350 (define_attr "type"
351   "other,multi,
352    alu,alu1,negnot,imov,imovx,lea,
353    incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
354    icmp,test,ibr,setcc,icmov,
355    push,pop,call,callv,leave,
356    str,bitmanip,
357    fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
358    sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
359    sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
360    ssemuladd,sse4arg,lwp,
361    mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
362   (const_string "other"))
363
364 ;; Main data type used by the insn
365 (define_attr "mode"
366   "unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF"
367   (const_string "unknown"))
368
369 ;; The CPU unit operations uses.
370 (define_attr "unit" "integer,i387,sse,mmx,unknown"
371   (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
372            (const_string "i387")
373          (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
374                           sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
375                           ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
376            (const_string "sse")
377          (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
378            (const_string "mmx")
379          (eq_attr "type" "other")
380            (const_string "unknown")]
381          (const_string "integer")))
382
383 ;; The (bounding maximum) length of an instruction immediate.
384 (define_attr "length_immediate" ""
385   (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
386                           bitmanip")
387            (const_int 0)
388          (eq_attr "unit" "i387,sse,mmx")
389            (const_int 0)
390          (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
391                           imul,icmp,push,pop")
392            (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
393          (eq_attr "type" "imov,test")
394            (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
395          (eq_attr "type" "call")
396            (if_then_else (match_operand 0 "constant_call_address_operand" "")
397              (const_int 4)
398              (const_int 0))
399          (eq_attr "type" "callv")
400            (if_then_else (match_operand 1 "constant_call_address_operand" "")
401              (const_int 4)
402              (const_int 0))
403          ;; We don't know the size before shorten_branches.  Expect
404          ;; the instruction to fit for better scheduling.
405          (eq_attr "type" "ibr")
406            (const_int 1)
407          ]
408          (symbol_ref "/* Update immediate_length and other attributes! */
409                       gcc_unreachable (),1")))
410
411 ;; The (bounding maximum) length of an instruction address.
412 (define_attr "length_address" ""
413   (cond [(eq_attr "type" "str,other,multi,fxch")
414            (const_int 0)
415          (and (eq_attr "type" "call")
416               (match_operand 0 "constant_call_address_operand" ""))
417              (const_int 0)
418          (and (eq_attr "type" "callv")
419               (match_operand 1 "constant_call_address_operand" ""))
420              (const_int 0)
421          ]
422          (symbol_ref "ix86_attr_length_address_default (insn)")))
423
424 ;; Set when length prefix is used.
425 (define_attr "prefix_data16" ""
426   (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
427            (const_int 0)
428          (eq_attr "mode" "HI")
429            (const_int 1)
430          (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI"))
431            (const_int 1)
432         ]
433         (const_int 0)))
434
435 ;; Set when string REP prefix is used.
436 (define_attr "prefix_rep" ""
437   (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
438            (const_int 0)
439          (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
440            (const_int 1)
441         ]
442         (const_int 0)))
443
444 ;; Set when 0f opcode prefix is used.
445 (define_attr "prefix_0f" ""
446   (if_then_else
447     (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
448          (eq_attr "unit" "sse,mmx"))
449     (const_int 1)
450     (const_int 0)))
451
452 ;; Set when REX opcode prefix is used.
453 (define_attr "prefix_rex" ""
454   (cond [(ne (symbol_ref "!TARGET_64BIT") (const_int 0))
455            (const_int 0)
456          (and (eq_attr "mode" "DI")
457               (and (eq_attr "type" "!push,pop,call,callv,leave,ibr")
458                    (eq_attr "unit" "!mmx")))
459            (const_int 1)
460          (and (eq_attr "mode" "QI")
461               (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
462                   (const_int 0)))
463            (const_int 1)
464          (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
465              (const_int 0))
466            (const_int 1)
467          (and (eq_attr "type" "imovx")
468               (match_operand:QI 1 "ext_QIreg_operand" ""))
469            (const_int 1)
470         ]
471         (const_int 0)))
472
473 ;; There are also additional prefixes in 3DNOW, SSSE3.
474 ;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
475 ;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
476 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
477 (define_attr "prefix_extra" ""
478   (cond [(eq_attr "type" "ssemuladd,sse4arg")
479            (const_int 2)
480          (eq_attr "type" "sseiadd1,ssecvt1")
481            (const_int 1)
482         ]
483         (const_int 0)))
484
485 ;; Prefix used: original, VEX or maybe VEX.
486 (define_attr "prefix" "orig,vex,maybe_vex"
487   (if_then_else (eq_attr "mode" "OI,V8SF,V4DF")
488     (const_string "vex")
489     (const_string "orig")))
490
491 ;; VEX W bit is used.
492 (define_attr "prefix_vex_w" "" (const_int 0))
493
494 ;; The length of VEX prefix
495 ;; Only instructions with 0f prefix can have 2 byte VEX prefix,
496 ;; 0f38/0f3a prefixes can't.  In i386.md 0f3[8a] is
497 ;; still prefix_0f 1, with prefix_extra 1.
498 (define_attr "length_vex" ""
499   (if_then_else (and (eq_attr "prefix_0f" "1")
500                      (eq_attr "prefix_extra" "0"))
501     (if_then_else (eq_attr "prefix_vex_w" "1")
502       (symbol_ref "ix86_attr_length_vex_default (insn, 1, 1)")
503       (symbol_ref "ix86_attr_length_vex_default (insn, 1, 0)"))
504     (if_then_else (eq_attr "prefix_vex_w" "1")
505       (symbol_ref "ix86_attr_length_vex_default (insn, 0, 1)")
506       (symbol_ref "ix86_attr_length_vex_default (insn, 0, 0)"))))
507
508 ;; Set when modrm byte is used.
509 (define_attr "modrm" ""
510   (cond [(eq_attr "type" "str,leave")
511            (const_int 0)
512          (eq_attr "unit" "i387")
513            (const_int 0)
514          (and (eq_attr "type" "incdec")
515               (and (eq (symbol_ref "TARGET_64BIT") (const_int 0))
516                    (ior (match_operand:SI 1 "register_operand" "")
517                         (match_operand:HI 1 "register_operand" ""))))
518            (const_int 0)
519          (and (eq_attr "type" "push")
520               (not (match_operand 1 "memory_operand" "")))
521            (const_int 0)
522          (and (eq_attr "type" "pop")
523               (not (match_operand 0 "memory_operand" "")))
524            (const_int 0)
525          (and (eq_attr "type" "imov")
526               (and (not (eq_attr "mode" "DI"))
527                    (ior (and (match_operand 0 "register_operand" "")
528                              (match_operand 1 "immediate_operand" ""))
529                         (ior (and (match_operand 0 "ax_reg_operand" "")
530                                   (match_operand 1 "memory_displacement_only_operand" ""))
531                              (and (match_operand 0 "memory_displacement_only_operand" "")
532                                   (match_operand 1 "ax_reg_operand" ""))))))
533            (const_int 0)
534          (and (eq_attr "type" "call")
535               (match_operand 0 "constant_call_address_operand" ""))
536              (const_int 0)
537          (and (eq_attr "type" "callv")
538               (match_operand 1 "constant_call_address_operand" ""))
539              (const_int 0)
540          (and (eq_attr "type" "alu,alu1,icmp,test")
541               (match_operand 0 "ax_reg_operand" ""))
542              (symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))")
543          ]
544          (const_int 1)))
545
546 ;; The (bounding maximum) length of an instruction in bytes.
547 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
548 ;; Later we may want to split them and compute proper length as for
549 ;; other insns.
550 (define_attr "length" ""
551   (cond [(eq_attr "type" "other,multi,fistp,frndint")
552            (const_int 16)
553          (eq_attr "type" "fcmp")
554            (const_int 4)
555          (eq_attr "unit" "i387")
556            (plus (const_int 2)
557                  (plus (attr "prefix_data16")
558                        (attr "length_address")))
559          (ior (eq_attr "prefix" "vex")
560               (and (eq_attr "prefix" "maybe_vex")
561                     (ne (symbol_ref "TARGET_AVX") (const_int 0))))
562            (plus (attr "length_vex")
563                  (plus (attr "length_immediate")
564                        (plus (attr "modrm")
565                              (attr "length_address"))))]
566          (plus (plus (attr "modrm")
567                      (plus (attr "prefix_0f")
568                            (plus (attr "prefix_rex")
569                                  (plus (attr "prefix_extra")
570                                        (const_int 1)))))
571                (plus (attr "prefix_rep")
572                      (plus (attr "prefix_data16")
573                            (plus (attr "length_immediate")
574                                  (attr "length_address")))))))
575
576 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
577 ;; `store' if there is a simple memory reference therein, or `unknown'
578 ;; if the instruction is complex.
579
580 (define_attr "memory" "none,load,store,both,unknown"
581   (cond [(eq_attr "type" "other,multi,str")
582            (const_string "unknown")
583          (eq_attr "type" "lea,fcmov,fpspc")
584            (const_string "none")
585          (eq_attr "type" "fistp,leave")
586            (const_string "both")
587          (eq_attr "type" "frndint")
588            (const_string "load")
589          (eq_attr "type" "push")
590            (if_then_else (match_operand 1 "memory_operand" "")
591              (const_string "both")
592              (const_string "store"))
593          (eq_attr "type" "pop")
594            (if_then_else (match_operand 0 "memory_operand" "")
595              (const_string "both")
596              (const_string "load"))
597          (eq_attr "type" "setcc")
598            (if_then_else (match_operand 0 "memory_operand" "")
599              (const_string "store")
600              (const_string "none"))
601          (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
602            (if_then_else (ior (match_operand 0 "memory_operand" "")
603                               (match_operand 1 "memory_operand" ""))
604              (const_string "load")
605              (const_string "none"))
606          (eq_attr "type" "ibr")
607            (if_then_else (match_operand 0 "memory_operand" "")
608              (const_string "load")
609              (const_string "none"))
610          (eq_attr "type" "call")
611            (if_then_else (match_operand 0 "constant_call_address_operand" "")
612              (const_string "none")
613              (const_string "load"))
614          (eq_attr "type" "callv")
615            (if_then_else (match_operand 1 "constant_call_address_operand" "")
616              (const_string "none")
617              (const_string "load"))
618          (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
619               (match_operand 1 "memory_operand" ""))
620            (const_string "both")
621          (and (match_operand 0 "memory_operand" "")
622               (match_operand 1 "memory_operand" ""))
623            (const_string "both")
624          (match_operand 0 "memory_operand" "")
625            (const_string "store")
626          (match_operand 1 "memory_operand" "")
627            (const_string "load")
628          (and (eq_attr "type"
629                  "!alu1,negnot,ishift1,
630                    imov,imovx,icmp,test,bitmanip,
631                    fmov,fcmp,fsgn,
632                    sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
633                    sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
634               (match_operand 2 "memory_operand" ""))
635            (const_string "load")
636          (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
637               (match_operand 3 "memory_operand" ""))
638            (const_string "load")
639         ]
640         (const_string "none")))
641
642 ;; Indicates if an instruction has both an immediate and a displacement.
643
644 (define_attr "imm_disp" "false,true,unknown"
645   (cond [(eq_attr "type" "other,multi")
646            (const_string "unknown")
647          (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
648               (and (match_operand 0 "memory_displacement_operand" "")
649                    (match_operand 1 "immediate_operand" "")))
650            (const_string "true")
651          (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
652               (and (match_operand 0 "memory_displacement_operand" "")
653                    (match_operand 2 "immediate_operand" "")))
654            (const_string "true")
655         ]
656         (const_string "false")))
657
658 ;; Indicates if an FP operation has an integer source.
659
660 (define_attr "fp_int_src" "false,true"
661   (const_string "false"))
662
663 ;; Defines rounding mode of an FP operation.
664
665 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
666   (const_string "any"))
667
668 ;; Define attribute to classify add/sub insns that consumes carry flag (CF)
669 (define_attr "use_carry" "0,1" (const_string "0"))
670
671 ;; Define attribute to indicate unaligned ssemov insns
672 (define_attr "movu" "0,1" (const_string "0"))
673
674 ;; Describe a user's asm statement.
675 (define_asm_attributes
676   [(set_attr "length" "128")
677    (set_attr "type" "multi")])
678
679 ;; All integer comparison codes.
680 (define_code_iterator int_cond [ne eq ge gt le lt geu gtu leu ltu ])
681
682 ;; All floating-point comparison codes.
683 (define_code_iterator fp_cond [unordered ordered
684                                uneq unge ungt unle unlt ltgt ])
685
686 (define_code_iterator plusminus [plus minus])
687
688 (define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus])
689
690 ;; Base name for define_insn
691 (define_code_attr plusminus_insn
692   [(plus "add") (ss_plus "ssadd") (us_plus "usadd")
693    (minus "sub") (ss_minus "sssub") (us_minus "ussub")])
694
695 ;; Base name for insn mnemonic.
696 (define_code_attr plusminus_mnemonic
697   [(plus "add") (ss_plus "adds") (us_plus "addus")
698    (minus "sub") (ss_minus "subs") (us_minus "subus")])
699
700 ;; Mark commutative operators as such in constraints.
701 (define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%")
702                         (minus "") (ss_minus "") (us_minus "")])
703
704 ;; Mapping of signed max and min
705 (define_code_iterator smaxmin [smax smin])
706
707 ;; Mapping of unsigned max and min
708 (define_code_iterator umaxmin [umax umin])
709
710 ;; Mapping of signed/unsigned max and min
711 (define_code_iterator maxmin [smax smin umax umin])
712
713 ;; Base name for integer and FP insn mnemonic
714 (define_code_attr maxminiprefix [(smax "maxs") (smin "mins")
715                                  (umax "maxu") (umin "minu")])
716 (define_code_attr maxminfprefix [(smax "max") (smin "min")])
717
718 ;; Mapping of parallel logic operators
719 (define_code_iterator plogic [and ior xor])
720
721 ;; Base name for insn mnemonic.
722 (define_code_attr plogicprefix [(and "and") (ior "or") (xor "xor")])
723
724 ;; Mapping of abs neg operators
725 (define_code_iterator absneg [abs neg])
726
727 ;; Base name for x87 insn mnemonic.
728 (define_code_attr absnegprefix [(abs "abs") (neg "chs")])
729
730 ;; Used in signed and unsigned widening multiplications.
731 (define_code_iterator any_extend [sign_extend zero_extend])
732
733 ;; Used in signed and unsigned divisions.
734 (define_code_iterator any_div [div udiv])
735
736 ;; Various insn prefixes for signed and unsigned operations.
737 (define_code_attr u [(sign_extend "") (zero_extend "u")
738                      (div "") (udiv "u")])
739 (define_code_attr s [(sign_extend "s") (zero_extend "u")])
740
741 ;; Instruction prefix for signed and unsigned operations.
742 (define_code_attr sgnprefix [(sign_extend "i") (zero_extend "")
743                              (div "i") (udiv "")])
744
745 ;; All single word integer modes.
746 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
747
748 ;; Single word integer modes without QImode.
749 (define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")])
750
751 ;; Single word integer modes without QImode and HImode.
752 (define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")])
753
754 ;; All math-dependant single and double word integer modes.
755 (define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH")
756                              (HI "TARGET_HIMODE_MATH")
757                              SI DI (TI "TARGET_64BIT")])
758
759 ;; Math-dependant single word integer modes.
760 (define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH")
761                             (HI "TARGET_HIMODE_MATH")
762                             SI (DI "TARGET_64BIT")])
763
764 ;; Math-dependant single word integer modes without QImode.
765 (define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH")
766                                SI (DI "TARGET_64BIT")])
767
768 ;; Half mode for double word integer modes.
769 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
770                             (DI "TARGET_64BIT")])
771
772 ;; Double word integer modes.
773 (define_mode_attr DWI [(SI "DI") (DI "TI")])
774 (define_mode_attr dwi [(SI "di") (DI "ti")])
775
776 ;; Instruction suffix for integer modes.
777 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
778
779 ;; Register class for integer modes.
780 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
781
782 ;; Immediate operand constraint for integer modes.
783 (define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")])
784
785 ;; General operand constraint for word modes.
786 (define_mode_attr g [(SI "g") (DI "rme")])
787
788 ;; Immediate operand constraint for double integer modes.
789 (define_mode_attr di [(SI "iF") (DI "e")])
790
791 ;; General operand predicate for integer modes.
792 (define_mode_attr general_operand
793         [(QI "general_operand")
794          (HI "general_operand")
795          (SI "general_operand")
796          (DI "x86_64_general_operand")
797          (TI "x86_64_general_operand")])
798
799 ;; SSE and x87 SFmode and DFmode floating point modes
800 (define_mode_iterator MODEF [SF DF])
801
802 ;; All x87 floating point modes
803 (define_mode_iterator X87MODEF [SF DF XF])
804
805 ;; All integer modes handled by x87 fisttp operator.
806 (define_mode_iterator X87MODEI [HI SI DI])
807
808 ;; All integer modes handled by integer x87 operators.
809 (define_mode_iterator X87MODEI12 [HI SI])
810
811 ;; All integer modes handled by SSE cvtts?2si* operators.
812 (define_mode_iterator SSEMODEI24 [SI DI])
813
814 ;; SSE asm suffix for floating point modes
815 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
816
817 ;; SSE vector mode corresponding to a scalar mode
818 (define_mode_attr ssevecmode
819   [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
820
821 ;; Instruction suffix for REX 64bit operators.
822 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
823
824 ;; This mode iterator allows :P to be used for patterns that operate on
825 ;; pointer-sized quantities.  Exactly one of the two alternatives will match.
826 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
827 \f
828 ;; Scheduling descriptions
829
830 (include "pentium.md")
831 (include "ppro.md")
832 (include "k6.md")
833 (include "athlon.md")
834 (include "geode.md")
835 (include "atom.md")
836
837 \f
838 ;; Operand and operator predicates and constraints
839
840 (include "predicates.md")
841 (include "constraints.md")
842
843 \f
844 ;; Compare and branch/compare and store instructions.
845
846 (define_expand "cbranchti4"
847   [(set (reg:CC FLAGS_REG)
848         (compare:CC (match_operand:TI 1 "nonimmediate_operand" "")
849                     (match_operand:TI 2 "x86_64_general_operand" "")))
850    (set (pc) (if_then_else
851               (match_operator 0 "comparison_operator"
852                [(reg:CC FLAGS_REG)
853                 (const_int 0)])
854               (label_ref (match_operand 3 "" ""))
855               (pc)))]
856   "TARGET_64BIT"
857 {
858   if (MEM_P (operands[1]) && MEM_P (operands[2]))
859     operands[1] = force_reg (TImode, operands[1]);
860   ix86_compare_op0 = operands[1];
861   ix86_compare_op1 = operands[2];
862   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
863   DONE;
864 })
865
866 (define_expand "cbranchdi4"
867   [(set (reg:CC FLAGS_REG)
868         (compare:CC (match_operand:DI 1 "nonimmediate_operand" "")
869                     (match_operand:DI 2 "x86_64_general_operand" "")))
870    (set (pc) (if_then_else
871               (match_operator 0 "comparison_operator"
872                [(reg:CC FLAGS_REG)
873                 (const_int 0)])
874               (label_ref (match_operand 3 "" ""))
875               (pc)))]
876   ""
877 {
878   if (MEM_P (operands[1]) && MEM_P (operands[2]))
879     operands[1] = force_reg (DImode, operands[1]);
880   ix86_compare_op0 = operands[1];
881   ix86_compare_op1 = operands[2];
882   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
883   DONE;
884 })
885
886 (define_expand "cstoredi4"
887   [(set (reg:CC FLAGS_REG)
888         (compare:CC (match_operand:DI 2 "nonimmediate_operand" "")
889                     (match_operand:DI 3 "x86_64_general_operand" "")))
890    (set (match_operand:QI 0 "register_operand" "")
891               (match_operator 1 "comparison_operator"
892                [(reg:CC FLAGS_REG)
893                 (const_int 0)]))]
894   "TARGET_64BIT"
895 {
896   if (MEM_P (operands[2]) && MEM_P (operands[3]))
897     operands[2] = force_reg (DImode, operands[2]);
898   ix86_compare_op0 = operands[2];
899   ix86_compare_op1 = operands[3];
900   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
901   DONE;
902 })
903
904 (define_expand "cbranchsi4"
905   [(set (reg:CC FLAGS_REG)
906         (compare:CC (match_operand:SI 1 "cmpsi_operand" "")
907                     (match_operand:SI 2 "general_operand" "")))
908    (set (pc) (if_then_else
909               (match_operator 0 "comparison_operator"
910                [(reg:CC FLAGS_REG)
911                 (const_int 0)])
912               (label_ref (match_operand 3 "" ""))
913               (pc)))]
914   ""
915 {
916   if (MEM_P (operands[1]) && MEM_P (operands[2]))
917     operands[1] = force_reg (SImode, operands[1]);
918   ix86_compare_op0 = operands[1];
919   ix86_compare_op1 = operands[2];
920   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
921   DONE;
922 })
923
924 (define_expand "cstoresi4"
925   [(set (reg:CC FLAGS_REG)
926         (compare:CC (match_operand:SI 2 "cmpsi_operand" "")
927                     (match_operand:SI 3 "general_operand" "")))
928    (set (match_operand:QI 0 "register_operand" "")
929               (match_operator 1 "comparison_operator"
930                [(reg:CC FLAGS_REG)
931                 (const_int 0)]))]
932   ""
933 {
934   if (MEM_P (operands[2]) && MEM_P (operands[3]))
935     operands[2] = force_reg (SImode, operands[2]);
936   ix86_compare_op0 = operands[2];
937   ix86_compare_op1 = operands[3];
938   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
939   DONE;
940 })
941
942 (define_expand "cbranchhi4"
943   [(set (reg:CC FLAGS_REG)
944         (compare:CC (match_operand:HI 1 "nonimmediate_operand" "")
945                     (match_operand:HI 2 "general_operand" "")))
946    (set (pc) (if_then_else
947               (match_operator 0 "comparison_operator"
948                [(reg:CC FLAGS_REG)
949                 (const_int 0)])
950               (label_ref (match_operand 3 "" ""))
951               (pc)))]
952   ""
953 {
954   if (MEM_P (operands[1]) && MEM_P (operands[2]))
955     operands[1] = force_reg (HImode, operands[1]);
956   ix86_compare_op0 = operands[1];
957   ix86_compare_op1 = operands[2];
958   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
959   DONE;
960 })
961
962 (define_expand "cstorehi4"
963   [(set (reg:CC FLAGS_REG)
964         (compare:CC (match_operand:HI 2 "nonimmediate_operand" "")
965                     (match_operand:HI 3 "general_operand" "")))
966    (set (match_operand:QI 0 "register_operand" "")
967               (match_operator 1 "comparison_operator"
968                [(reg:CC FLAGS_REG)
969                 (const_int 0)]))]
970   ""
971 {
972   if (MEM_P (operands[2]) && MEM_P (operands[3]))
973     operands[2] = force_reg (HImode, operands[2]);
974   ix86_compare_op0 = operands[2];
975   ix86_compare_op1 = operands[3];
976   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
977   DONE;
978 })
979
980
981 (define_expand "cbranchqi4"
982   [(set (reg:CC FLAGS_REG)
983         (compare:CC (match_operand:QI 1 "nonimmediate_operand" "")
984                     (match_operand:QI 2 "general_operand" "")))
985    (set (pc) (if_then_else
986               (match_operator 0 "comparison_operator"
987                [(reg:CC FLAGS_REG)
988                 (const_int 0)])
989               (label_ref (match_operand 3 "" ""))
990               (pc)))]
991   ""
992 {
993   if (MEM_P (operands[1]) && MEM_P (operands[2]))
994     operands[1] = force_reg (QImode, operands[1]);
995   ix86_compare_op0 = operands[1];
996   ix86_compare_op1 = operands[2];
997   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
998   DONE;
999 })
1000
1001
1002 (define_expand "cstoreqi4"
1003   [(set (reg:CC FLAGS_REG)
1004         (compare:CC (match_operand:QI 2 "nonimmediate_operand" "")
1005                     (match_operand:QI 3 "general_operand" "")))
1006    (set (match_operand:QI 0 "register_operand" "")
1007               (match_operator 1 "comparison_operator"
1008                [(reg:CC FLAGS_REG)
1009                 (const_int 0)]))]
1010   ""
1011 {
1012   if (MEM_P (operands[2]) && MEM_P (operands[3]))
1013     operands[2] = force_reg (QImode, operands[2]);
1014   ix86_compare_op0 = operands[2];
1015   ix86_compare_op1 = operands[3];
1016   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1017   DONE;
1018 })
1019
1020
1021 (define_insn "cmpdi_ccno_1_rex64"
1022   [(set (reg FLAGS_REG)
1023         (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr")
1024                  (match_operand:DI 1 "const0_operand" "")))]
1025   "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
1026   "@
1027    test{q}\t%0, %0
1028    cmp{q}\t{%1, %0|%0, %1}"
1029   [(set_attr "type" "test,icmp")
1030    (set_attr "length_immediate" "0,1")
1031    (set_attr "mode" "DI")])
1032
1033 (define_insn "*cmpdi_minus_1_rex64"
1034   [(set (reg FLAGS_REG)
1035         (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r")
1036                            (match_operand:DI 1 "x86_64_general_operand" "re,mr"))
1037                  (const_int 0)))]
1038   "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)"
1039   "cmp{q}\t{%1, %0|%0, %1}"
1040   [(set_attr "type" "icmp")
1041    (set_attr "mode" "DI")])
1042
1043 (define_expand "cmpdi_1_rex64"
1044   [(set (reg:CC FLAGS_REG)
1045         (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
1046                     (match_operand:DI 1 "general_operand" "")))]
1047   "TARGET_64BIT"
1048   "")
1049
1050 (define_insn "cmpdi_1_insn_rex64"
1051   [(set (reg FLAGS_REG)
1052         (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r")
1053                  (match_operand:DI 1 "x86_64_general_operand" "re,mr")))]
1054   "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1055   "cmp{q}\t{%1, %0|%0, %1}"
1056   [(set_attr "type" "icmp")
1057    (set_attr "mode" "DI")])
1058
1059
1060 (define_insn "*cmpsi_ccno_1"
1061   [(set (reg FLAGS_REG)
1062         (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr")
1063                  (match_operand:SI 1 "const0_operand" "")))]
1064   "ix86_match_ccmode (insn, CCNOmode)"
1065   "@
1066    test{l}\t%0, %0
1067    cmp{l}\t{%1, %0|%0, %1}"
1068   [(set_attr "type" "test,icmp")
1069    (set_attr "length_immediate" "0,1")
1070    (set_attr "mode" "SI")])
1071
1072 (define_insn "*cmpsi_minus_1"
1073   [(set (reg FLAGS_REG)
1074         (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r")
1075                            (match_operand:SI 1 "general_operand" "ri,mr"))
1076                  (const_int 0)))]
1077   "ix86_match_ccmode (insn, CCGOCmode)"
1078   "cmp{l}\t{%1, %0|%0, %1}"
1079   [(set_attr "type" "icmp")
1080    (set_attr "mode" "SI")])
1081
1082 (define_expand "cmpsi_1"
1083   [(set (reg:CC FLAGS_REG)
1084         (compare:CC (match_operand:SI 0 "nonimmediate_operand" "")
1085                     (match_operand:SI 1 "general_operand" "")))]
1086   ""
1087   "")
1088
1089 (define_insn "*cmpsi_1_insn"
1090   [(set (reg FLAGS_REG)
1091         (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r")
1092                  (match_operand:SI 1 "general_operand" "ri,mr")))]
1093   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
1094     && ix86_match_ccmode (insn, CCmode)"
1095   "cmp{l}\t{%1, %0|%0, %1}"
1096   [(set_attr "type" "icmp")
1097    (set_attr "mode" "SI")])
1098
1099 (define_insn "*cmphi_ccno_1"
1100   [(set (reg FLAGS_REG)
1101         (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr")
1102                  (match_operand:HI 1 "const0_operand" "")))]
1103   "ix86_match_ccmode (insn, CCNOmode)"
1104   "@
1105    test{w}\t%0, %0
1106    cmp{w}\t{%1, %0|%0, %1}"
1107   [(set_attr "type" "test,icmp")
1108    (set_attr "length_immediate" "0,1")
1109    (set_attr "mode" "HI")])
1110
1111 (define_insn "*cmphi_minus_1"
1112   [(set (reg FLAGS_REG)
1113         (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r")
1114                            (match_operand:HI 1 "general_operand" "rn,mr"))
1115                  (const_int 0)))]
1116   "ix86_match_ccmode (insn, CCGOCmode)"
1117   "cmp{w}\t{%1, %0|%0, %1}"
1118   [(set_attr "type" "icmp")
1119    (set_attr "mode" "HI")])
1120
1121 (define_insn "*cmphi_1"
1122   [(set (reg FLAGS_REG)
1123         (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r")
1124                  (match_operand:HI 1 "general_operand" "rn,mr")))]
1125   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
1126    && ix86_match_ccmode (insn, CCmode)"
1127   "cmp{w}\t{%1, %0|%0, %1}"
1128   [(set_attr "type" "icmp")
1129    (set_attr "mode" "HI")])
1130
1131 (define_insn "*cmpqi_ccno_1"
1132   [(set (reg FLAGS_REG)
1133         (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq")
1134                  (match_operand:QI 1 "const0_operand" "")))]
1135   "ix86_match_ccmode (insn, CCNOmode)"
1136   "@
1137    test{b}\t%0, %0
1138    cmp{b}\t{$0, %0|%0, 0}"
1139   [(set_attr "type" "test,icmp")
1140    (set_attr "length_immediate" "0,1")
1141    (set_attr "mode" "QI")])
1142
1143 (define_insn "*cmpqi_1"
1144   [(set (reg FLAGS_REG)
1145         (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q")
1146                  (match_operand:QI 1 "general_operand" "qn,mq")))]
1147   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
1148     && ix86_match_ccmode (insn, CCmode)"
1149   "cmp{b}\t{%1, %0|%0, %1}"
1150   [(set_attr "type" "icmp")
1151    (set_attr "mode" "QI")])
1152
1153 (define_insn "*cmpqi_minus_1"
1154   [(set (reg FLAGS_REG)
1155         (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q")
1156                            (match_operand:QI 1 "general_operand" "qn,mq"))
1157                  (const_int 0)))]
1158   "ix86_match_ccmode (insn, CCGOCmode)"
1159   "cmp{b}\t{%1, %0|%0, %1}"
1160   [(set_attr "type" "icmp")
1161    (set_attr "mode" "QI")])
1162
1163 (define_insn "*cmpqi_ext_1"
1164   [(set (reg FLAGS_REG)
1165         (compare
1166           (match_operand:QI 0 "general_operand" "Qm")
1167           (subreg:QI
1168             (zero_extract:SI
1169               (match_operand 1 "ext_register_operand" "Q")
1170               (const_int 8)
1171               (const_int 8)) 0)))]
1172   "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1173   "cmp{b}\t{%h1, %0|%0, %h1}"
1174   [(set_attr "type" "icmp")
1175    (set_attr "mode" "QI")])
1176
1177 (define_insn "*cmpqi_ext_1_rex64"
1178   [(set (reg FLAGS_REG)
1179         (compare
1180           (match_operand:QI 0 "register_operand" "Q")
1181           (subreg:QI
1182             (zero_extract:SI
1183               (match_operand 1 "ext_register_operand" "Q")
1184               (const_int 8)
1185               (const_int 8)) 0)))]
1186   "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1187   "cmp{b}\t{%h1, %0|%0, %h1}"
1188   [(set_attr "type" "icmp")
1189    (set_attr "mode" "QI")])
1190
1191 (define_insn "*cmpqi_ext_2"
1192   [(set (reg FLAGS_REG)
1193         (compare
1194           (subreg:QI
1195             (zero_extract:SI
1196               (match_operand 0 "ext_register_operand" "Q")
1197               (const_int 8)
1198               (const_int 8)) 0)
1199           (match_operand:QI 1 "const0_operand" "")))]
1200   "ix86_match_ccmode (insn, CCNOmode)"
1201   "test{b}\t%h0, %h0"
1202   [(set_attr "type" "test")
1203    (set_attr "length_immediate" "0")
1204    (set_attr "mode" "QI")])
1205
1206 (define_expand "cmpqi_ext_3"
1207   [(set (reg:CC FLAGS_REG)
1208         (compare:CC
1209           (subreg:QI
1210             (zero_extract:SI
1211               (match_operand 0 "ext_register_operand" "")
1212               (const_int 8)
1213               (const_int 8)) 0)
1214           (match_operand:QI 1 "general_operand" "")))]
1215   ""
1216   "")
1217
1218 (define_insn "cmpqi_ext_3_insn"
1219   [(set (reg FLAGS_REG)
1220         (compare
1221           (subreg:QI
1222             (zero_extract:SI
1223               (match_operand 0 "ext_register_operand" "Q")
1224               (const_int 8)
1225               (const_int 8)) 0)
1226           (match_operand:QI 1 "general_operand" "Qmn")))]
1227   "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1228   "cmp{b}\t{%1, %h0|%h0, %1}"
1229   [(set_attr "type" "icmp")
1230    (set_attr "modrm" "1")
1231    (set_attr "mode" "QI")])
1232
1233 (define_insn "cmpqi_ext_3_insn_rex64"
1234   [(set (reg FLAGS_REG)
1235         (compare
1236           (subreg:QI
1237             (zero_extract:SI
1238               (match_operand 0 "ext_register_operand" "Q")
1239               (const_int 8)
1240               (const_int 8)) 0)
1241           (match_operand:QI 1 "nonmemory_operand" "Qn")))]
1242   "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
1243   "cmp{b}\t{%1, %h0|%h0, %1}"
1244   [(set_attr "type" "icmp")
1245    (set_attr "modrm" "1")
1246    (set_attr "mode" "QI")])
1247
1248 (define_insn "*cmpqi_ext_4"
1249   [(set (reg FLAGS_REG)
1250         (compare
1251           (subreg:QI
1252             (zero_extract:SI
1253               (match_operand 0 "ext_register_operand" "Q")
1254               (const_int 8)
1255               (const_int 8)) 0)
1256           (subreg:QI
1257             (zero_extract:SI
1258               (match_operand 1 "ext_register_operand" "Q")
1259               (const_int 8)
1260               (const_int 8)) 0)))]
1261   "ix86_match_ccmode (insn, CCmode)"
1262   "cmp{b}\t{%h1, %h0|%h0, %h1}"
1263   [(set_attr "type" "icmp")
1264    (set_attr "mode" "QI")])
1265
1266 ;; These implement float point compares.
1267 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
1268 ;; which would allow mix and match FP modes on the compares.  Which is what
1269 ;; the old patterns did, but with many more of them.
1270
1271 (define_expand "cbranchxf4"
1272   [(set (reg:CC FLAGS_REG)
1273         (compare:CC (match_operand:XF 1 "nonmemory_operand" "")
1274                     (match_operand:XF 2 "nonmemory_operand" "")))
1275    (set (pc) (if_then_else
1276               (match_operator 0 "ix86_fp_comparison_operator"
1277                [(reg:CC FLAGS_REG)
1278                 (const_int 0)])
1279               (label_ref (match_operand 3 "" ""))
1280               (pc)))]
1281   "TARGET_80387"
1282 {
1283   ix86_compare_op0 = operands[1];
1284   ix86_compare_op1 = operands[2];
1285   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1286   DONE;
1287 })
1288
1289 (define_expand "cstorexf4"
1290   [(set (reg:CC FLAGS_REG)
1291         (compare:CC (match_operand:XF 2 "nonmemory_operand" "")
1292                     (match_operand:XF 3 "nonmemory_operand" "")))
1293    (set (match_operand:QI 0 "register_operand" "")
1294               (match_operator 1 "ix86_fp_comparison_operator"
1295                [(reg:CC FLAGS_REG)
1296                 (const_int 0)]))]
1297   "TARGET_80387"
1298 {
1299   ix86_compare_op0 = operands[2];
1300   ix86_compare_op1 = operands[3];
1301   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1302   DONE;
1303 })
1304
1305 (define_expand "cbranch<mode>4"
1306   [(set (reg:CC FLAGS_REG)
1307         (compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
1308                     (match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
1309    (set (pc) (if_then_else
1310               (match_operator 0 "ix86_fp_comparison_operator"
1311                [(reg:CC FLAGS_REG)
1312                 (const_int 0)])
1313               (label_ref (match_operand 3 "" ""))
1314               (pc)))]
1315   "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1316 {
1317   ix86_compare_op0 = operands[1];
1318   ix86_compare_op1 = operands[2];
1319   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1320   DONE;
1321 })
1322
1323 (define_expand "cstore<mode>4"
1324   [(set (reg:CC FLAGS_REG)
1325         (compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
1326                     (match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
1327    (set (match_operand:QI 0 "register_operand" "")
1328               (match_operator 1 "ix86_fp_comparison_operator"
1329                [(reg:CC FLAGS_REG)
1330                 (const_int 0)]))]
1331   "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
1332 {
1333   ix86_compare_op0 = operands[2];
1334   ix86_compare_op1 = operands[3];
1335   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1336   DONE;
1337 })
1338
1339 (define_expand "cbranchcc4"
1340   [(set (pc) (if_then_else
1341               (match_operator 0 "comparison_operator"
1342                [(match_operand 1 "flags_reg_operand" "")
1343                 (match_operand 2 "const0_operand" "")])
1344               (label_ref (match_operand 3 "" ""))
1345               (pc)))]
1346   ""
1347 {
1348   ix86_compare_op0 = operands[1];
1349   ix86_compare_op1 = operands[2];
1350   ix86_expand_branch (GET_CODE (operands[0]), operands[3]);
1351   DONE;
1352 })
1353
1354 (define_expand "cstorecc4"
1355   [(set (match_operand:QI 0 "register_operand" "")
1356               (match_operator 1 "comparison_operator"
1357                [(match_operand 2 "flags_reg_operand" "")
1358                 (match_operand 3 "const0_operand" "")]))]
1359   ""
1360 {
1361   ix86_compare_op0 = operands[2];
1362   ix86_compare_op1 = operands[3];
1363   ix86_expand_setcc (GET_CODE (operands[1]), operands[0]);
1364   DONE;
1365 })
1366
1367
1368 ;; FP compares, step 1:
1369 ;; Set the FP condition codes.
1370 ;;
1371 ;; CCFPmode     compare with exceptions
1372 ;; CCFPUmode    compare with no exceptions
1373
1374 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
1375 ;; used to manage the reg stack popping would not be preserved.
1376
1377 (define_insn "*cmpfp_0"
1378   [(set (match_operand:HI 0 "register_operand" "=a")
1379         (unspec:HI
1380           [(compare:CCFP
1381              (match_operand 1 "register_operand" "f")
1382              (match_operand 2 "const0_operand" ""))]
1383         UNSPEC_FNSTSW))]
1384   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1385    && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1386   "* return output_fp_compare (insn, operands, 0, 0);"
1387   [(set_attr "type" "multi")
1388    (set_attr "unit" "i387")
1389    (set (attr "mode")
1390      (cond [(match_operand:SF 1 "" "")
1391               (const_string "SF")
1392             (match_operand:DF 1 "" "")
1393               (const_string "DF")
1394            ]
1395            (const_string "XF")))])
1396
1397 (define_insn_and_split "*cmpfp_0_cc"
1398   [(set (reg:CCFP FLAGS_REG)
1399         (compare:CCFP
1400           (match_operand 1 "register_operand" "f")
1401           (match_operand 2 "const0_operand" "")))
1402    (clobber (match_operand:HI 0 "register_operand" "=a"))]
1403   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1404    && TARGET_SAHF && !TARGET_CMOVE
1405    && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1406   "#"
1407   "&& reload_completed"
1408   [(set (match_dup 0)
1409         (unspec:HI
1410           [(compare:CCFP (match_dup 1)(match_dup 2))]
1411         UNSPEC_FNSTSW))
1412    (set (reg:CC FLAGS_REG)
1413         (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1414   ""
1415   [(set_attr "type" "multi")
1416    (set_attr "unit" "i387")
1417    (set (attr "mode")
1418      (cond [(match_operand:SF 1 "" "")
1419               (const_string "SF")
1420             (match_operand:DF 1 "" "")
1421               (const_string "DF")
1422            ]
1423            (const_string "XF")))])
1424
1425 (define_insn "*cmpfp_xf"
1426   [(set (match_operand:HI 0 "register_operand" "=a")
1427         (unspec:HI
1428           [(compare:CCFP
1429              (match_operand:XF 1 "register_operand" "f")
1430              (match_operand:XF 2 "register_operand" "f"))]
1431           UNSPEC_FNSTSW))]
1432   "TARGET_80387"
1433   "* return output_fp_compare (insn, operands, 0, 0);"
1434   [(set_attr "type" "multi")
1435    (set_attr "unit" "i387")
1436    (set_attr "mode" "XF")])
1437
1438 (define_insn_and_split "*cmpfp_xf_cc"
1439   [(set (reg:CCFP FLAGS_REG)
1440         (compare:CCFP
1441           (match_operand:XF 1 "register_operand" "f")
1442           (match_operand:XF 2 "register_operand" "f")))
1443    (clobber (match_operand:HI 0 "register_operand" "=a"))]
1444   "TARGET_80387
1445    && TARGET_SAHF && !TARGET_CMOVE"
1446   "#"
1447   "&& reload_completed"
1448   [(set (match_dup 0)
1449         (unspec:HI
1450           [(compare:CCFP (match_dup 1)(match_dup 2))]
1451         UNSPEC_FNSTSW))
1452    (set (reg:CC FLAGS_REG)
1453         (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1454   ""
1455   [(set_attr "type" "multi")
1456    (set_attr "unit" "i387")
1457    (set_attr "mode" "XF")])
1458
1459 (define_insn "*cmpfp_<mode>"
1460   [(set (match_operand:HI 0 "register_operand" "=a")
1461         (unspec:HI
1462           [(compare:CCFP
1463              (match_operand:MODEF 1 "register_operand" "f")
1464              (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1465           UNSPEC_FNSTSW))]
1466   "TARGET_80387"
1467   "* return output_fp_compare (insn, operands, 0, 0);"
1468   [(set_attr "type" "multi")
1469    (set_attr "unit" "i387")
1470    (set_attr "mode" "<MODE>")])
1471
1472 (define_insn_and_split "*cmpfp_<mode>_cc"
1473   [(set (reg:CCFP FLAGS_REG)
1474         (compare:CCFP
1475           (match_operand:MODEF 1 "register_operand" "f")
1476           (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1477    (clobber (match_operand:HI 0 "register_operand" "=a"))]
1478   "TARGET_80387
1479    && TARGET_SAHF && !TARGET_CMOVE"
1480   "#"
1481   "&& reload_completed"
1482   [(set (match_dup 0)
1483         (unspec:HI
1484           [(compare:CCFP (match_dup 1)(match_dup 2))]
1485         UNSPEC_FNSTSW))
1486    (set (reg:CC FLAGS_REG)
1487         (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1488   ""
1489   [(set_attr "type" "multi")
1490    (set_attr "unit" "i387")
1491    (set_attr "mode" "<MODE>")])
1492
1493 (define_insn "*cmpfp_u"
1494   [(set (match_operand:HI 0 "register_operand" "=a")
1495         (unspec:HI
1496           [(compare:CCFPU
1497              (match_operand 1 "register_operand" "f")
1498              (match_operand 2 "register_operand" "f"))]
1499           UNSPEC_FNSTSW))]
1500   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1501    && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1502   "* return output_fp_compare (insn, operands, 0, 1);"
1503   [(set_attr "type" "multi")
1504    (set_attr "unit" "i387")
1505    (set (attr "mode")
1506      (cond [(match_operand:SF 1 "" "")
1507               (const_string "SF")
1508             (match_operand:DF 1 "" "")
1509               (const_string "DF")
1510            ]
1511            (const_string "XF")))])
1512
1513 (define_insn_and_split "*cmpfp_u_cc"
1514   [(set (reg:CCFPU FLAGS_REG)
1515         (compare:CCFPU
1516           (match_operand 1 "register_operand" "f")
1517           (match_operand 2 "register_operand" "f")))
1518    (clobber (match_operand:HI 0 "register_operand" "=a"))]
1519   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1520    && TARGET_SAHF && !TARGET_CMOVE
1521    && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1522   "#"
1523   "&& reload_completed"
1524   [(set (match_dup 0)
1525         (unspec:HI
1526           [(compare:CCFPU (match_dup 1)(match_dup 2))]
1527         UNSPEC_FNSTSW))
1528    (set (reg:CC FLAGS_REG)
1529         (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1530   ""
1531   [(set_attr "type" "multi")
1532    (set_attr "unit" "i387")
1533    (set (attr "mode")
1534      (cond [(match_operand:SF 1 "" "")
1535               (const_string "SF")
1536             (match_operand:DF 1 "" "")
1537               (const_string "DF")
1538            ]
1539            (const_string "XF")))])
1540
1541 (define_insn "*cmpfp_<mode>"
1542   [(set (match_operand:HI 0 "register_operand" "=a")
1543         (unspec:HI
1544           [(compare:CCFP
1545              (match_operand 1 "register_operand" "f")
1546              (match_operator 3 "float_operator"
1547                [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1548           UNSPEC_FNSTSW))]
1549   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1550    && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1551    && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1552   "* return output_fp_compare (insn, operands, 0, 0);"
1553   [(set_attr "type" "multi")
1554    (set_attr "unit" "i387")
1555    (set_attr "fp_int_src" "true")
1556    (set_attr "mode" "<MODE>")])
1557
1558 (define_insn_and_split "*cmpfp_<mode>_cc"
1559   [(set (reg:CCFP FLAGS_REG)
1560         (compare:CCFP
1561           (match_operand 1 "register_operand" "f")
1562           (match_operator 3 "float_operator"
1563             [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1564    (clobber (match_operand:HI 0 "register_operand" "=a"))]
1565   "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1566    && TARGET_SAHF && !TARGET_CMOVE
1567    && (TARGET_USE_<MODE>MODE_FIOP || optimize_function_for_size_p (cfun))
1568    && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1569   "#"
1570   "&& reload_completed"
1571   [(set (match_dup 0)
1572         (unspec:HI
1573           [(compare:CCFP
1574              (match_dup 1)
1575              (match_op_dup 3 [(match_dup 2)]))]
1576         UNSPEC_FNSTSW))
1577    (set (reg:CC FLAGS_REG)
1578         (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1579   ""
1580   [(set_attr "type" "multi")
1581    (set_attr "unit" "i387")
1582    (set_attr "fp_int_src" "true")
1583    (set_attr "mode" "<MODE>")])
1584
1585 ;; FP compares, step 2
1586 ;; Move the fpsw to ax.
1587
1588 (define_insn "x86_fnstsw_1"
1589   [(set (match_operand:HI 0 "register_operand" "=a")
1590         (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1591   "TARGET_80387"
1592   "fnstsw\t%0"
1593   [(set (attr "length") (symbol_ref "ix86_attr_length_address_default (insn) + 2"))
1594    (set_attr "mode" "SI")
1595    (set_attr "unit" "i387")])
1596
1597 ;; FP compares, step 3
1598 ;; Get ax into flags, general case.
1599
1600 (define_insn "x86_sahf_1"
1601   [(set (reg:CC FLAGS_REG)
1602         (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1603                    UNSPEC_SAHF))]
1604   "TARGET_SAHF"
1605 {
1606 #ifdef HAVE_AS_IX86_SAHF
1607   return "sahf";
1608 #else
1609   return ASM_BYTE "0x9e";
1610 #endif
1611 }
1612   [(set_attr "length" "1")
1613    (set_attr "athlon_decode" "vector")
1614    (set_attr "amdfam10_decode" "direct")
1615    (set_attr "mode" "SI")])
1616
1617 ;; Pentium Pro can do steps 1 through 3 in one go.
1618 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1619 (define_insn "*cmpfp_i_mixed"
1620   [(set (reg:CCFP FLAGS_REG)
1621         (compare:CCFP (match_operand 0 "register_operand" "f,x")
1622                       (match_operand 1 "nonimmediate_operand" "f,xm")))]
1623   "TARGET_MIX_SSE_I387
1624    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1625    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1626   "* return output_fp_compare (insn, operands, 1, 0);"
1627   [(set_attr "type" "fcmp,ssecomi")
1628    (set_attr "prefix" "orig,maybe_vex")
1629    (set (attr "mode")
1630      (if_then_else (match_operand:SF 1 "" "")
1631         (const_string "SF")
1632         (const_string "DF")))
1633    (set (attr "prefix_rep")
1634         (if_then_else (eq_attr "type" "ssecomi")
1635                       (const_string "0")
1636                       (const_string "*")))
1637    (set (attr "prefix_data16")
1638         (cond [(eq_attr "type" "fcmp")
1639                  (const_string "*")
1640                (eq_attr "mode" "DF")
1641                  (const_string "1")
1642               ]
1643               (const_string "0")))
1644    (set_attr "athlon_decode" "vector")
1645    (set_attr "amdfam10_decode" "direct")])
1646
1647 (define_insn "*cmpfp_i_sse"
1648   [(set (reg:CCFP FLAGS_REG)
1649         (compare:CCFP (match_operand 0 "register_operand" "x")
1650                       (match_operand 1 "nonimmediate_operand" "xm")))]
1651   "TARGET_SSE_MATH
1652    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1653    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1654   "* return output_fp_compare (insn, operands, 1, 0);"
1655   [(set_attr "type" "ssecomi")
1656    (set_attr "prefix" "maybe_vex")
1657    (set (attr "mode")
1658      (if_then_else (match_operand:SF 1 "" "")
1659         (const_string "SF")
1660         (const_string "DF")))
1661    (set_attr "prefix_rep" "0")
1662    (set (attr "prefix_data16")
1663         (if_then_else (eq_attr "mode" "DF")
1664                       (const_string "1")
1665                       (const_string "0")))
1666    (set_attr "athlon_decode" "vector")
1667    (set_attr "amdfam10_decode" "direct")])
1668
1669 (define_insn "*cmpfp_i_i387"
1670   [(set (reg:CCFP FLAGS_REG)
1671         (compare:CCFP (match_operand 0 "register_operand" "f")
1672                       (match_operand 1 "register_operand" "f")))]
1673   "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1674    && TARGET_CMOVE
1675    && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1676    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1677   "* return output_fp_compare (insn, operands, 1, 0);"
1678   [(set_attr "type" "fcmp")
1679    (set (attr "mode")
1680      (cond [(match_operand:SF 1 "" "")
1681               (const_string "SF")
1682             (match_operand:DF 1 "" "")
1683               (const_string "DF")
1684            ]
1685            (const_string "XF")))
1686    (set_attr "athlon_decode" "vector")
1687    (set_attr "amdfam10_decode" "direct")])
1688
1689 (define_insn "*cmpfp_iu_mixed"
1690   [(set (reg:CCFPU FLAGS_REG)
1691         (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1692                        (match_operand 1 "nonimmediate_operand" "f,xm")))]
1693   "TARGET_MIX_SSE_I387
1694    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1695    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1696   "* return output_fp_compare (insn, operands, 1, 1);"
1697   [(set_attr "type" "fcmp,ssecomi")
1698    (set_attr "prefix" "orig,maybe_vex")
1699    (set (attr "mode")
1700      (if_then_else (match_operand:SF 1 "" "")
1701         (const_string "SF")
1702         (const_string "DF")))
1703    (set (attr "prefix_rep")
1704         (if_then_else (eq_attr "type" "ssecomi")
1705                       (const_string "0")
1706                       (const_string "*")))
1707    (set (attr "prefix_data16")
1708         (cond [(eq_attr "type" "fcmp")
1709                  (const_string "*")
1710                (eq_attr "mode" "DF")
1711                  (const_string "1")
1712               ]
1713               (const_string "0")))
1714    (set_attr "athlon_decode" "vector")
1715    (set_attr "amdfam10_decode" "direct")])
1716
1717 (define_insn "*cmpfp_iu_sse"
1718   [(set (reg:CCFPU FLAGS_REG)
1719         (compare:CCFPU (match_operand 0 "register_operand" "x")
1720                        (match_operand 1 "nonimmediate_operand" "xm")))]
1721   "TARGET_SSE_MATH
1722    && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1723    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1724   "* return output_fp_compare (insn, operands, 1, 1);"
1725   [(set_attr "type" "ssecomi")
1726    (set_attr "prefix" "maybe_vex")
1727    (set (attr "mode")
1728      (if_then_else (match_operand:SF 1 "" "")
1729         (const_string "SF")
1730         (const_string "DF")))
1731    (set_attr "prefix_rep" "0")
1732    (set (attr "prefix_data16")
1733         (if_then_else (eq_attr "mode" "DF")
1734                       (const_string "1")
1735                       (const_string "0")))
1736    (set_attr "athlon_decode" "vector")
1737    (set_attr "amdfam10_decode" "direct")])
1738
1739 (define_insn "*cmpfp_iu_387"
1740   [(set (reg:CCFPU FLAGS_REG)
1741         (compare:CCFPU (match_operand 0 "register_operand" "f")
1742                        (match_operand 1 "register_operand" "f")))]
1743   "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1744    && TARGET_CMOVE
1745    && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1746    && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1747   "* return output_fp_compare (insn, operands, 1, 1);"
1748   [(set_attr "type" "fcmp")
1749    (set (attr "mode")
1750      (cond [(match_operand:SF 1 "" "")
1751               (const_string "SF")
1752             (match_operand:DF 1 "" "")
1753               (const_string "DF")
1754            ]
1755            (const_string "XF")))
1756    (set_attr "athlon_decode" "vector")
1757    (set_attr "amdfam10_decode" "direct")])
1758 \f
1759 ;; Move instructions.
1760
1761 ;; General case of fullword move.
1762
1763 (define_expand "movsi"
1764   [(set (match_operand:SI 0 "nonimmediate_operand" "")
1765         (match_operand:SI 1 "general_operand" ""))]
1766   ""
1767   "ix86_expand_move (SImode, operands); DONE;")
1768
1769 ;; Push/pop instructions.  They are separate since autoinc/dec is not a
1770 ;; general_operand.
1771 ;;
1772 ;; %%% We don't use a post-inc memory reference because x86 is not a
1773 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1774 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1775 ;; targets without our curiosities, and it is just as easy to represent
1776 ;; this differently.
1777
1778 (define_insn "*pushsi2"
1779   [(set (match_operand:SI 0 "push_operand" "=<")
1780         (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1781   "!TARGET_64BIT"
1782   "push{l}\t%1"
1783   [(set_attr "type" "push")
1784    (set_attr "mode" "SI")])
1785
1786 ;; For 64BIT abi we always round up to 8 bytes.
1787 (define_insn "*pushsi2_rex64"
1788   [(set (match_operand:SI 0 "push_operand" "=X")
1789         (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1790   "TARGET_64BIT"
1791   "push{q}\t%q1"
1792   [(set_attr "type" "push")
1793    (set_attr "mode" "SI")])
1794
1795 (define_insn "*pushsi2_prologue"
1796   [(set (match_operand:SI 0 "push_operand" "=<")
1797         (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1798    (clobber (mem:BLK (scratch)))]
1799   "!TARGET_64BIT"
1800   "push{l}\t%1"
1801   [(set_attr "type" "push")
1802    (set_attr "mode" "SI")])
1803
1804 (define_insn "*popsi1_epilogue"
1805   [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1806         (mem:SI (reg:SI SP_REG)))
1807    (set (reg:SI SP_REG)
1808         (plus:SI (reg:SI SP_REG) (const_int 4)))
1809    (clobber (mem:BLK (scratch)))]
1810   "!TARGET_64BIT"
1811   "pop{l}\t%0"
1812   [(set_attr "type" "pop")
1813    (set_attr "mode" "SI")])
1814
1815 (define_insn "popsi1"
1816   [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1817         (mem:SI (reg:SI SP_REG)))
1818    (set (reg:SI SP_REG)
1819         (plus:SI (reg:SI SP_REG) (const_int 4)))]
1820   "!TARGET_64BIT"
1821   "pop{l}\t%0"
1822   [(set_attr "type" "pop")
1823    (set_attr "mode" "SI")])
1824
1825 (define_insn "*movsi_xor"
1826   [(set (match_operand:SI 0 "register_operand" "=r")
1827         (match_operand:SI 1 "const0_operand" ""))
1828    (clobber (reg:CC FLAGS_REG))]
1829   "reload_completed"
1830   "xor{l}\t%0, %0"
1831   [(set_attr "type" "alu1")
1832    (set_attr "mode" "SI")
1833    (set_attr "length_immediate" "0")])
1834
1835 (define_insn "*movsi_or"
1836   [(set (match_operand:SI 0 "register_operand" "=r")
1837         (match_operand:SI 1 "immediate_operand" "i"))
1838    (clobber (reg:CC FLAGS_REG))]
1839   "reload_completed
1840    && operands[1] == constm1_rtx"
1841 {
1842   operands[1] = constm1_rtx;
1843   return "or{l}\t{%1, %0|%0, %1}";
1844 }
1845   [(set_attr "type" "alu1")
1846    (set_attr "mode" "SI")
1847    (set_attr "length_immediate" "1")])
1848
1849 (define_insn "*movsi_1"
1850   [(set (match_operand:SI 0 "nonimmediate_operand"
1851                         "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
1852         (match_operand:SI 1 "general_operand"
1853                         "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r   ,m "))]
1854   "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1855 {
1856   switch (get_attr_type (insn))
1857     {
1858     case TYPE_SSELOG1:
1859       if (get_attr_mode (insn) == MODE_TI)
1860         return "%vpxor\t%0, %d0";
1861       return "%vxorps\t%0, %d0";
1862
1863     case TYPE_SSEMOV:
1864       switch (get_attr_mode (insn))
1865         {
1866         case MODE_TI:
1867           return "%vmovdqa\t{%1, %0|%0, %1}";
1868         case MODE_V4SF:
1869           return "%vmovaps\t{%1, %0|%0, %1}";
1870         case MODE_SI:
1871           return "%vmovd\t{%1, %0|%0, %1}";
1872         case MODE_SF:
1873           return "%vmovss\t{%1, %0|%0, %1}";
1874         default:
1875           gcc_unreachable ();
1876         }
1877
1878     case TYPE_MMX:
1879       return "pxor\t%0, %0";
1880
1881     case TYPE_MMXMOV:
1882       if (get_attr_mode (insn) == MODE_DI)
1883         return "movq\t{%1, %0|%0, %1}";
1884       return "movd\t{%1, %0|%0, %1}";
1885
1886     case TYPE_LEA:
1887       return "lea{l}\t{%1, %0|%0, %1}";
1888
1889     default:
1890       gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
1891       return "mov{l}\t{%1, %0|%0, %1}";
1892     }
1893 }
1894   [(set (attr "type")
1895      (cond [(eq_attr "alternative" "2")
1896               (const_string "mmx")
1897             (eq_attr "alternative" "3,4,5")
1898               (const_string "mmxmov")
1899             (eq_attr "alternative" "6")
1900               (const_string "sselog1")
1901             (eq_attr "alternative" "7,8,9,10,11")
1902               (const_string "ssemov")
1903             (match_operand:DI 1 "pic_32bit_operand" "")
1904               (const_string "lea")
1905            ]
1906            (const_string "imov")))
1907    (set (attr "prefix")
1908      (if_then_else (eq_attr "alternative" "0,1,2,3,4,5")
1909        (const_string "orig")
1910        (const_string "maybe_vex")))
1911    (set (attr "prefix_data16")
1912      (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI"))
1913        (const_string "1")
1914        (const_string "*")))
1915    (set (attr "mode")
1916      (cond [(eq_attr "alternative" "2,3")
1917               (const_string "DI")
1918             (eq_attr "alternative" "6,7")
1919               (if_then_else
1920                 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1921                 (const_string "V4SF")
1922                 (const_string "TI"))
1923             (and (eq_attr "alternative" "8,9,10,11")
1924                  (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
1925               (const_string "SF")
1926            ]
1927            (const_string "SI")))])
1928
1929 ;; Stores and loads of ax to arbitrary constant address.
1930 ;; We fake an second form of instruction to force reload to load address
1931 ;; into register when rax is not available
1932 (define_insn "*movabssi_1_rex64"
1933   [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1934         (match_operand:SI 1 "nonmemory_operand" "a,er"))]
1935   "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1936   "@
1937    movabs{l}\t{%1, %P0|%P0, %1}
1938    mov{l}\t{%1, %a0|%a0, %1}"
1939   [(set_attr "type" "imov")
1940    (set_attr "modrm" "0,*")
1941    (set_attr "length_address" "8,0")
1942    (set_attr "length_immediate" "0,*")
1943    (set_attr "memory" "store")
1944    (set_attr "mode" "SI")])
1945
1946 (define_insn "*movabssi_2_rex64"
1947   [(set (match_operand:SI 0 "register_operand" "=a,r")
1948         (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1949   "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1950   "@
1951    movabs{l}\t{%P1, %0|%0, %P1}
1952    mov{l}\t{%a1, %0|%0, %a1}"
1953   [(set_attr "type" "imov")
1954    (set_attr "modrm" "0,*")
1955    (set_attr "length_address" "8,0")
1956    (set_attr "length_immediate" "0")
1957    (set_attr "memory" "load")
1958    (set_attr "mode" "SI")])
1959
1960 (define_insn "*swapsi"
1961   [(set (match_operand:SI 0 "register_operand" "+r")
1962         (match_operand:SI 1 "register_operand" "+r"))
1963    (set (match_dup 1)
1964         (match_dup 0))]
1965   ""
1966   "xchg{l}\t%1, %0"
1967   [(set_attr "type" "imov")
1968    (set_attr "mode" "SI")
1969    (set_attr "pent_pair" "np")
1970    (set_attr "athlon_decode" "vector")
1971    (set_attr "amdfam10_decode" "double")])
1972
1973 (define_expand "movhi"
1974   [(set (match_operand:HI 0 "nonimmediate_operand" "")
1975         (match_operand:HI 1 "general_operand" ""))]
1976   ""
1977   "ix86_expand_move (HImode, operands); DONE;")
1978
1979 (define_insn "*pushhi2"
1980   [(set (match_operand:HI 0 "push_operand" "=X")
1981         (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1982   "!TARGET_64BIT"
1983   "push{l}\t%k1"
1984   [(set_attr "type" "push")
1985    (set_attr "mode" "SI")])
1986
1987 ;; For 64BIT abi we always round up to 8 bytes.
1988 (define_insn "*pushhi2_rex64"
1989   [(set (match_operand:HI 0 "push_operand" "=X")
1990         (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1991   "TARGET_64BIT"
1992   "push{q}\t%q1"
1993   [(set_attr "type" "push")
1994    (set_attr "mode" "DI")])
1995
1996 (define_insn "*movhi_1"
1997   [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
1998         (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
1999   "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2000 {
2001   switch (get_attr_type (insn))
2002     {
2003     case TYPE_IMOVX:
2004       /* movzwl is faster than movw on p2 due to partial word stalls,
2005          though not as fast as an aligned movl.  */
2006       return "movz{wl|x}\t{%1, %k0|%k0, %1}";
2007     default:
2008       if (get_attr_mode (insn) == MODE_SI)
2009         return "mov{l}\t{%k1, %k0|%k0, %k1}";
2010       else
2011         return "mov{w}\t{%1, %0|%0, %1}";
2012     }
2013 }
2014   [(set (attr "type")
2015      (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
2016               (const_string "imov")
2017             (and (eq_attr "alternative" "0")
2018                  (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2019                           (const_int 0))
2020                       (eq (symbol_ref "TARGET_HIMODE_MATH")
2021                           (const_int 0))))
2022               (const_string "imov")
2023             (and (eq_attr "alternative" "1,2")
2024                  (match_operand:HI 1 "aligned_operand" ""))
2025               (const_string "imov")
2026             (and (ne (symbol_ref "TARGET_MOVX")
2027                      (const_int 0))
2028                  (eq_attr "alternative" "0,2"))
2029               (const_string "imovx")
2030            ]
2031            (const_string "imov")))
2032     (set (attr "mode")
2033       (cond [(eq_attr "type" "imovx")
2034                (const_string "SI")
2035              (and (eq_attr "alternative" "1,2")
2036                   (match_operand:HI 1 "aligned_operand" ""))
2037                (const_string "SI")
2038              (and (eq_attr "alternative" "0")
2039                   (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2040                            (const_int 0))
2041                        (eq (symbol_ref "TARGET_HIMODE_MATH")
2042                            (const_int 0))))
2043                (const_string "SI")
2044             ]
2045             (const_string "HI")))])
2046
2047 ;; Stores and loads of ax to arbitrary constant address.
2048 ;; We fake an second form of instruction to force reload to load address
2049 ;; into register when rax is not available
2050 (define_insn "*movabshi_1_rex64"
2051   [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2052         (match_operand:HI 1 "nonmemory_operand" "a,er"))]
2053   "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2054   "@
2055    movabs{w}\t{%1, %P0|%P0, %1}
2056    mov{w}\t{%1, %a0|%a0, %1}"
2057   [(set_attr "type" "imov")
2058    (set_attr "modrm" "0,*")
2059    (set_attr "length_address" "8,0")
2060    (set_attr "length_immediate" "0,*")
2061    (set_attr "memory" "store")
2062    (set_attr "mode" "HI")])
2063
2064 (define_insn "*movabshi_2_rex64"
2065   [(set (match_operand:HI 0 "register_operand" "=a,r")
2066         (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2067   "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2068   "@
2069    movabs{w}\t{%P1, %0|%0, %P1}
2070    mov{w}\t{%a1, %0|%0, %a1}"
2071   [(set_attr "type" "imov")
2072    (set_attr "modrm" "0,*")
2073    (set_attr "length_address" "8,0")
2074    (set_attr "length_immediate" "0")
2075    (set_attr "memory" "load")
2076    (set_attr "mode" "HI")])
2077
2078 (define_insn "*swaphi_1"
2079   [(set (match_operand:HI 0 "register_operand" "+r")
2080         (match_operand:HI 1 "register_operand" "+r"))
2081    (set (match_dup 1)
2082         (match_dup 0))]
2083   "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2084   "xchg{l}\t%k1, %k0"
2085   [(set_attr "type" "imov")
2086    (set_attr "mode" "SI")
2087    (set_attr "pent_pair" "np")
2088    (set_attr "athlon_decode" "vector")
2089    (set_attr "amdfam10_decode" "double")])
2090
2091 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
2092 (define_insn "*swaphi_2"
2093   [(set (match_operand:HI 0 "register_operand" "+r")
2094         (match_operand:HI 1 "register_operand" "+r"))
2095    (set (match_dup 1)
2096         (match_dup 0))]
2097   "TARGET_PARTIAL_REG_STALL"
2098   "xchg{w}\t%1, %0"
2099   [(set_attr "type" "imov")
2100    (set_attr "mode" "HI")
2101    (set_attr "pent_pair" "np")
2102    (set_attr "athlon_decode" "vector")])
2103
2104 (define_expand "movstricthi"
2105   [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
2106         (match_operand:HI 1 "general_operand" ""))]
2107   ""
2108 {
2109   if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2110     FAIL;
2111   /* Don't generate memory->memory moves, go through a register */
2112   if (MEM_P (operands[0]) && MEM_P (operands[1]))
2113     operands[1] = force_reg (HImode, operands[1]);
2114 })
2115
2116 (define_insn "*movstricthi_1"
2117   [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
2118         (match_operand:HI 1 "general_operand" "rn,m"))]
2119   "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2120    && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2121   "mov{w}\t{%1, %0|%0, %1}"
2122   [(set_attr "type" "imov")
2123    (set_attr "mode" "HI")])
2124
2125 (define_insn "*movstricthi_xor"
2126   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
2127         (match_operand:HI 1 "const0_operand" ""))
2128    (clobber (reg:CC FLAGS_REG))]
2129   "reload_completed"
2130   "xor{w}\t%0, %0"
2131   [(set_attr "type" "alu1")
2132    (set_attr "mode" "HI")
2133    (set_attr "length_immediate" "0")])
2134
2135 (define_expand "movqi"
2136   [(set (match_operand:QI 0 "nonimmediate_operand" "")
2137         (match_operand:QI 1 "general_operand" ""))]
2138   ""
2139   "ix86_expand_move (QImode, operands); DONE;")
2140
2141 ;; emit_push_insn when it calls move_by_pieces requires an insn to
2142 ;; "push a byte".  But actually we use pushl, which has the effect
2143 ;; of rounding the amount pushed up to a word.
2144
2145 (define_insn "*pushqi2"
2146   [(set (match_operand:QI 0 "push_operand" "=X")
2147         (match_operand:QI 1 "nonmemory_no_elim_operand" "rn"))]
2148   "!TARGET_64BIT"
2149   "push{l}\t%k1"
2150   [(set_attr "type" "push")
2151    (set_attr "mode" "SI")])
2152
2153 ;; For 64BIT abi we always round up to 8 bytes.
2154 (define_insn "*pushqi2_rex64"
2155   [(set (match_operand:QI 0 "push_operand" "=X")
2156         (match_operand:QI 1 "nonmemory_no_elim_operand" "qn"))]
2157   "TARGET_64BIT"
2158   "push{q}\t%q1"
2159   [(set_attr "type" "push")
2160    (set_attr "mode" "DI")])
2161
2162 ;; Situation is quite tricky about when to choose full sized (SImode) move
2163 ;; over QImode moves.  For Q_REG -> Q_REG move we use full size only for
2164 ;; partial register dependency machines (such as AMD Athlon), where QImode
2165 ;; moves issue extra dependency and for partial register stalls machines
2166 ;; that don't use QImode patterns (and QImode move cause stall on the next
2167 ;; instruction).
2168 ;;
2169 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
2170 ;; register stall machines with, where we use QImode instructions, since
2171 ;; partial register stall can be caused there.  Then we use movzx.
2172 (define_insn "*movqi_1"
2173   [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
2174         (match_operand:QI 1 "general_operand"      " q,qn,qm,q,rn,qm,qn"))]
2175   "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
2176 {
2177   switch (get_attr_type (insn))
2178     {
2179     case TYPE_IMOVX:
2180       gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
2181       return "movz{bl|x}\t{%1, %k0|%k0, %1}";
2182     default:
2183       if (get_attr_mode (insn) == MODE_SI)
2184         return "mov{l}\t{%k1, %k0|%k0, %k1}";
2185       else
2186         return "mov{b}\t{%1, %0|%0, %1}";
2187     }
2188 }
2189   [(set (attr "type")
2190      (cond [(and (eq_attr "alternative" "5")
2191                  (not (match_operand:QI 1 "aligned_operand" "")))
2192               (const_string "imovx")
2193             (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0))
2194               (const_string "imov")
2195             (and (eq_attr "alternative" "3")
2196                  (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2197                           (const_int 0))
2198                       (eq (symbol_ref "TARGET_QIMODE_MATH")
2199                           (const_int 0))))
2200               (const_string "imov")
2201             (eq_attr "alternative" "3,5")
2202               (const_string "imovx")
2203             (and (ne (symbol_ref "TARGET_MOVX")
2204                      (const_int 0))
2205                  (eq_attr "alternative" "2"))
2206               (const_string "imovx")
2207            ]
2208            (const_string "imov")))
2209    (set (attr "mode")
2210       (cond [(eq_attr "alternative" "3,4,5")
2211                (const_string "SI")
2212              (eq_attr "alternative" "6")
2213                (const_string "QI")
2214              (eq_attr "type" "imovx")
2215                (const_string "SI")
2216              (and (eq_attr "type" "imov")
2217                   (and (eq_attr "alternative" "0,1")
2218                        (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
2219                                 (const_int 0))
2220                             (and (eq (symbol_ref "optimize_function_for_size_p (cfun)")
2221                                      (const_int 0))
2222                                  (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
2223                                      (const_int 0))))))
2224                (const_string "SI")
2225              ;; Avoid partial register stalls when not using QImode arithmetic
2226              (and (eq_attr "type" "imov")
2227                   (and (eq_attr "alternative" "0,1")
2228                        (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
2229                                 (const_int 0))
2230                             (eq (symbol_ref "TARGET_QIMODE_MATH")
2231                                 (const_int 0)))))
2232                (const_string "SI")
2233            ]
2234            (const_string "QI")))])
2235
2236 (define_insn "*swapqi_1"
2237   [(set (match_operand:QI 0 "register_operand" "+r")
2238         (match_operand:QI 1 "register_operand" "+r"))
2239    (set (match_dup 1)
2240         (match_dup 0))]
2241   "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
2242   "xchg{l}\t%k1, %k0"
2243   [(set_attr "type" "imov")
2244    (set_attr "mode" "SI")
2245    (set_attr "pent_pair" "np")
2246    (set_attr "athlon_decode" "vector")
2247    (set_attr "amdfam10_decode" "vector")])
2248
2249 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
2250 (define_insn "*swapqi_2"
2251   [(set (match_operand:QI 0 "register_operand" "+q")
2252         (match_operand:QI 1 "register_operand" "+q"))
2253    (set (match_dup 1)
2254         (match_dup 0))]
2255   "TARGET_PARTIAL_REG_STALL"
2256   "xchg{b}\t%1, %0"
2257   [(set_attr "type" "imov")
2258    (set_attr "mode" "QI")
2259    (set_attr "pent_pair" "np")
2260    (set_attr "athlon_decode" "vector")])
2261
2262 (define_expand "movstrictqi"
2263   [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
2264         (match_operand:QI 1 "general_operand" ""))]
2265   ""
2266 {
2267   if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun))
2268     FAIL;
2269   /* Don't generate memory->memory moves, go through a register.  */
2270   if (MEM_P (operands[0]) && MEM_P (operands[1]))
2271     operands[1] = force_reg (QImode, operands[1]);
2272 })
2273
2274 (define_insn "*movstrictqi_1"
2275   [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
2276         (match_operand:QI 1 "general_operand" "*qn,m"))]
2277   "(! TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
2278    && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2279   "mov{b}\t{%1, %0|%0, %1}"
2280   [(set_attr "type" "imov")
2281    (set_attr "mode" "QI")])
2282
2283 (define_insn "*movstrictqi_xor"
2284   [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
2285         (match_operand:QI 1 "const0_operand" ""))
2286    (clobber (reg:CC FLAGS_REG))]
2287   "reload_completed"
2288   "xor{b}\t%0, %0"
2289   [(set_attr "type" "alu1")
2290    (set_attr "mode" "QI")
2291    (set_attr "length_immediate" "0")])
2292
2293 (define_insn "*movsi_extv_1"
2294   [(set (match_operand:SI 0 "register_operand" "=R")
2295         (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
2296                          (const_int 8)
2297                          (const_int 8)))]
2298   ""
2299   "movs{bl|x}\t{%h1, %0|%0, %h1}"
2300   [(set_attr "type" "imovx")
2301    (set_attr "mode" "SI")])
2302
2303 (define_insn "*movhi_extv_1"
2304   [(set (match_operand:HI 0 "register_operand" "=R")
2305         (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
2306                          (const_int 8)
2307                          (const_int 8)))]
2308   ""
2309   "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
2310   [(set_attr "type" "imovx")
2311    (set_attr "mode" "SI")])
2312
2313 (define_insn "*movqi_extv_1"
2314   [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
2315         (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2316                          (const_int 8)
2317                          (const_int 8)))]
2318   "!TARGET_64BIT"
2319 {
2320   switch (get_attr_type (insn))
2321     {
2322     case TYPE_IMOVX:
2323       return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2324     default:
2325       return "mov{b}\t{%h1, %0|%0, %h1}";
2326     }
2327 }
2328   [(set (attr "type")
2329      (if_then_else (and (match_operand:QI 0 "register_operand" "")
2330                         (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2331                              (ne (symbol_ref "TARGET_MOVX")
2332                                  (const_int 0))))
2333         (const_string "imovx")
2334         (const_string "imov")))
2335    (set (attr "mode")
2336      (if_then_else (eq_attr "type" "imovx")
2337         (const_string "SI")
2338         (const_string "QI")))])
2339
2340 (define_insn "*movqi_extv_1_rex64"
2341   [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2342         (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
2343                          (const_int 8)
2344                          (const_int 8)))]
2345   "TARGET_64BIT"
2346 {
2347   switch (get_attr_type (insn))
2348     {
2349     case TYPE_IMOVX:
2350       return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
2351     default:
2352       return "mov{b}\t{%h1, %0|%0, %h1}";
2353     }
2354 }
2355   [(set (attr "type")
2356      (if_then_else (and (match_operand:QI 0 "register_operand" "")
2357                         (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2358                              (ne (symbol_ref "TARGET_MOVX")
2359                                  (const_int 0))))
2360         (const_string "imovx")
2361         (const_string "imov")))
2362    (set (attr "mode")
2363      (if_then_else (eq_attr "type" "imovx")
2364         (const_string "SI")
2365         (const_string "QI")))])
2366
2367 ;; Stores and loads of ax to arbitrary constant address.
2368 ;; We fake an second form of instruction to force reload to load address
2369 ;; into register when rax is not available
2370 (define_insn "*movabsqi_1_rex64"
2371   [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2372         (match_operand:QI 1 "nonmemory_operand" "a,er"))]
2373   "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2374   "@
2375    movabs{b}\t{%1, %P0|%P0, %1}
2376    mov{b}\t{%1, %a0|%a0, %1}"
2377   [(set_attr "type" "imov")
2378    (set_attr "modrm" "0,*")
2379    (set_attr "length_address" "8,0")
2380    (set_attr "length_immediate" "0,*")
2381    (set_attr "memory" "store")
2382    (set_attr "mode" "QI")])
2383
2384 (define_insn "*movabsqi_2_rex64"
2385   [(set (match_operand:QI 0 "register_operand" "=a,r")
2386         (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2387   "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2388   "@
2389    movabs{b}\t{%P1, %0|%0, %P1}
2390    mov{b}\t{%a1, %0|%0, %a1}"
2391   [(set_attr "type" "imov")
2392    (set_attr "modrm" "0,*")
2393    (set_attr "length_address" "8,0")
2394    (set_attr "length_immediate" "0")
2395    (set_attr "memory" "load")
2396    (set_attr "mode" "QI")])
2397
2398 (define_insn "*movdi_extzv_1"
2399   [(set (match_operand:DI 0 "register_operand" "=R")
2400         (zero_extract:DI (match_operand 1 "ext_register_operand" "Q")
2401                          (const_int 8)
2402                          (const_int 8)))]
2403   "TARGET_64BIT"
2404   "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
2405   [(set_attr "type" "imovx")
2406    (set_attr "mode" "SI")])
2407
2408 (define_insn "*movsi_extzv_1"
2409   [(set (match_operand:SI 0 "register_operand" "=R")
2410         (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
2411                          (const_int 8)
2412                          (const_int 8)))]
2413   ""
2414   "movz{bl|x}\t{%h1, %0|%0, %h1}"
2415   [(set_attr "type" "imovx")
2416    (set_attr "mode" "SI")])
2417
2418 (define_insn "*movqi_extzv_2"
2419   [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
2420         (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2421                                     (const_int 8)
2422                                     (const_int 8)) 0))]
2423   "!TARGET_64BIT"
2424 {
2425   switch (get_attr_type (insn))
2426     {
2427     case TYPE_IMOVX:
2428       return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2429     default:
2430       return "mov{b}\t{%h1, %0|%0, %h1}";
2431     }
2432 }
2433   [(set (attr "type")
2434      (if_then_else (and (match_operand:QI 0 "register_operand" "")
2435                         (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2436                              (ne (symbol_ref "TARGET_MOVX")
2437                                  (const_int 0))))
2438         (const_string "imovx")
2439         (const_string "imov")))
2440    (set (attr "mode")
2441      (if_then_else (eq_attr "type" "imovx")
2442         (const_string "SI")
2443         (const_string "QI")))])
2444
2445 (define_insn "*movqi_extzv_2_rex64"
2446   [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2447         (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2448                                     (const_int 8)
2449                                     (const_int 8)) 0))]
2450   "TARGET_64BIT"
2451 {
2452   switch (get_attr_type (insn))
2453     {
2454     case TYPE_IMOVX:
2455       return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2456     default:
2457       return "mov{b}\t{%h1, %0|%0, %h1}";
2458     }
2459 }
2460   [(set (attr "type")
2461      (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2462                         (ne (symbol_ref "TARGET_MOVX")
2463                             (const_int 0)))
2464         (const_string "imovx")
2465         (const_string "imov")))
2466    (set (attr "mode")
2467      (if_then_else (eq_attr "type" "imovx")
2468         (const_string "SI")
2469         (const_string "QI")))])
2470
2471 (define_insn "movsi_insv_1"
2472   [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2473                          (const_int 8)
2474                          (const_int 8))
2475         (match_operand:SI 1 "general_operand" "Qmn"))]
2476   "!TARGET_64BIT"
2477   "mov{b}\t{%b1, %h0|%h0, %b1}"
2478   [(set_attr "type" "imov")
2479    (set_attr "mode" "QI")])
2480
2481 (define_insn "*movsi_insv_1_rex64"
2482   [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2483                          (const_int 8)
2484                          (const_int 8))
2485         (match_operand:SI 1 "nonmemory_operand" "Qn"))]
2486   "TARGET_64BIT"
2487   "mov{b}\t{%b1, %h0|%h0, %b1}"
2488   [(set_attr "type" "imov")
2489    (set_attr "mode" "QI")])
2490
2491 (define_insn "movdi_insv_1_rex64"
2492   [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
2493                          (const_int 8)
2494                          (const_int 8))
2495         (match_operand:DI 1 "nonmemory_operand" "Qn"))]
2496   "TARGET_64BIT"
2497   "mov{b}\t{%b1, %h0|%h0, %b1}"
2498   [(set_attr "type" "imov")
2499    (set_attr "mode" "QI")])
2500
2501 (define_insn "*movqi_insv_2"
2502   [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2503                          (const_int 8)
2504                          (const_int 8))
2505         (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2506                      (const_int 8)))]
2507   ""
2508   "mov{b}\t{%h1, %h0|%h0, %h1}"
2509   [(set_attr "type" "imov")
2510    (set_attr "mode" "QI")])
2511
2512 (define_expand "movdi"
2513   [(set (match_operand:DI 0 "nonimmediate_operand" "")
2514         (match_operand:DI 1 "general_operand" ""))]
2515   ""
2516   "ix86_expand_move (DImode, operands); DONE;")
2517
2518 (define_insn "*pushdi"
2519   [(set (match_operand:DI 0 "push_operand" "=<")
2520         (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
2521   "!TARGET_64BIT"
2522   "#")
2523
2524 (define_insn "*pushdi2_rex64"
2525   [(set (match_operand:DI 0 "push_operand" "=<,!<")
2526         (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
2527   "TARGET_64BIT"
2528   "@
2529    push{q}\t%1
2530    #"
2531   [(set_attr "type" "push,multi")
2532    (set_attr "mode" "DI")])
2533
2534 ;; Convert impossible pushes of immediate to existing instructions.
2535 ;; First try to get scratch register and go through it.  In case this
2536 ;; fails, push sign extended lower part first and then overwrite
2537 ;; upper part by 32bit move.
2538 (define_peephole2
2539   [(match_scratch:DI 2 "r")
2540    (set (match_operand:DI 0 "push_operand" "")
2541         (match_operand:DI 1 "immediate_operand" ""))]
2542   "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2543    && !x86_64_immediate_operand (operands[1], DImode)"
2544   [(set (match_dup 2) (match_dup 1))
2545    (set (match_dup 0) (match_dup 2))]
2546   "")
2547
2548 ;; We need to define this as both peepholer and splitter for case
2549 ;; peephole2 pass is not run.
2550 ;; "&& 1" is needed to keep it from matching the previous pattern.
2551 (define_peephole2
2552   [(set (match_operand:DI 0 "push_operand" "")
2553         (match_operand:DI 1 "immediate_operand" ""))]
2554   "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2555    && !x86_64_immediate_operand (operands[1], DImode) && 1"
2556   [(set (match_dup 0) (match_dup 1))
2557    (set (match_dup 2) (match_dup 3))]
2558   "split_di (&operands[1], 1, &operands[2], &operands[3]);
2559    operands[1] = gen_lowpart (DImode, operands[2]);
2560    operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2561                                                     GEN_INT (4)));
2562   ")
2563
2564 (define_split
2565   [(set (match_operand:DI 0 "push_operand" "")
2566         (match_operand:DI 1 "immediate_operand" ""))]
2567   "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2568                     ? epilogue_completed : reload_completed)
2569    && !symbolic_operand (operands[1], DImode)
2570    && !x86_64_immediate_operand (operands[1], DImode)"
2571   [(set (match_dup 0) (match_dup 1))
2572    (set (match_dup 2) (match_dup 3))]
2573   "split_di (&operands[1], 1, &operands[2], &operands[3]);
2574    operands[1] = gen_lowpart (DImode, operands[2]);
2575    operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2576                                                     GEN_INT (4)));
2577   ")
2578
2579 (define_insn "*pushdi2_prologue_rex64"
2580   [(set (match_operand:DI 0 "push_operand" "=<")
2581         (match_operand:DI 1 "general_no_elim_operand" "re*m"))
2582    (clobber (mem:BLK (scratch)))]
2583   "TARGET_64BIT"
2584   "push{q}\t%1"
2585   [(set_attr "type" "push")
2586    (set_attr "mode" "DI")])
2587
2588 (define_insn "*popdi1_epilogue_rex64"
2589   [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2590         (mem:DI (reg:DI SP_REG)))
2591    (set (reg:DI SP_REG)
2592         (plus:DI (reg:DI SP_REG) (const_int 8)))
2593    (clobber (mem:BLK (scratch)))]
2594   "TARGET_64BIT"
2595   "pop{q}\t%0"
2596   [(set_attr "type" "pop")
2597    (set_attr "mode" "DI")])
2598
2599 (define_insn "popdi1"
2600   [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2601         (mem:DI (reg:DI SP_REG)))
2602    (set (reg:DI SP_REG)
2603         (plus:DI (reg:DI SP_REG) (const_int 8)))]
2604   "TARGET_64BIT"
2605   "pop{q}\t%0"
2606   [(set_attr "type" "pop")
2607    (set_attr "mode" "DI")])
2608
2609 (define_insn "*movdi_xor_rex64"
2610   [(set (match_operand:DI 0 "register_operand" "=r")
2611         (match_operand:DI 1 "const0_operand" ""))
2612    (clobber (reg:CC FLAGS_REG))]
2613   "TARGET_64BIT
2614    && reload_completed"
2615   "xor{l}\t%k0, %k0";
2616   [(set_attr "type" "alu1")
2617    (set_attr "mode" "SI")
2618    (set_attr "length_immediate" "0")])
2619
2620 (define_insn "*movdi_or_rex64"
2621   [(set (match_operand:DI 0 "register_operand" "=r")
2622         (match_operand:DI 1 "const_int_operand" "i"))
2623    (clobber (reg:CC FLAGS_REG))]
2624   "TARGET_64BIT
2625    && reload_completed
2626    && operands[1] == constm1_rtx"
2627 {
2628   operands[1] = constm1_rtx;
2629   return "or{q}\t{%1, %0|%0, %1}";
2630 }
2631   [(set_attr "type" "alu1")
2632    (set_attr "mode" "DI")
2633    (set_attr "length_immediate" "1")])
2634
2635 (define_insn "*movdi_2"
2636   [(set (match_operand:DI 0 "nonimmediate_operand"
2637                         "=r  ,o  ,*y,m*y,*y,*Y2,m  ,*Y2,*Y2,*x,m ,*x,*x")
2638         (match_operand:DI 1 "general_operand"
2639                         "riFo,riF,C ,*y ,m ,C  ,*Y2,*Y2,m  ,C ,*x,*x,m "))]
2640   "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2641   "@
2642    #
2643    #
2644    pxor\t%0, %0
2645    movq\t{%1, %0|%0, %1}
2646    movq\t{%1, %0|%0, %1}
2647    %vpxor\t%0, %d0
2648    %vmovq\t{%1, %0|%0, %1}
2649    %vmovdqa\t{%1, %0|%0, %1}
2650    %vmovq\t{%1, %0|%0, %1}
2651    xorps\t%0, %0
2652    movlps\t{%1, %0|%0, %1}
2653    movaps\t{%1, %0|%0, %1}
2654    movlps\t{%1, %0|%0, %1}"
2655   [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2656    (set (attr "prefix")
2657      (if_then_else (eq_attr "alternative" "5,6,7,8")
2658        (const_string "vex")
2659        (const_string "orig")))
2660    (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2661
2662 (define_split
2663   [(set (match_operand:DI 0 "push_operand" "")
2664         (match_operand:DI 1 "general_operand" ""))]
2665   "!TARGET_64BIT && reload_completed
2666    && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2667   [(const_int 0)]
2668   "ix86_split_long_move (operands); DONE;")
2669
2670 ;; %%% This multiword shite has got to go.
2671 (define_split
2672   [(set (match_operand:DI 0 "nonimmediate_operand" "")
2673         (match_operand:DI 1 "general_operand" ""))]
2674   "!TARGET_64BIT && reload_completed
2675    && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
2676    && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2677   [(const_int 0)]
2678   "ix86_split_long_move (operands); DONE;")
2679
2680 (define_insn "*movdi_1_rex64"
2681   [(set (match_operand:DI 0 "nonimmediate_operand"
2682           "=r,r  ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
2683         (match_operand:DI 1 "general_operand"
2684           "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r   ,m  ,C ,*x,*Yi,*x,r  ,m ,*Ym,*x"))]
2685   "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2686 {
2687   switch (get_attr_type (insn))
2688     {
2689     case TYPE_SSECVT:
2690       if (SSE_REG_P (operands[0]))
2691         return "movq2dq\t{%1, %0|%0, %1}";
2692       else
2693         return "movdq2q\t{%1, %0|%0, %1}";
2694
2695     case TYPE_SSEMOV:
2696       if (TARGET_AVX)
2697         {
2698           if (get_attr_mode (insn) == MODE_TI)
2699             return "vmovdqa\t{%1, %0|%0, %1}";
2700           else
2701             return "vmovq\t{%1, %0|%0, %1}";
2702         }
2703
2704       if (get_attr_mode (insn) == MODE_TI)
2705         return "movdqa\t{%1, %0|%0, %1}";
2706       /* FALLTHRU */
2707
2708     case TYPE_MMXMOV:
2709       /* Moves from and into integer register is done using movd
2710          opcode with REX prefix.  */
2711       if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
2712         return "movd\t{%1, %0|%0, %1}";
2713       return "movq\t{%1, %0|%0, %1}";
2714
2715     case TYPE_SSELOG1:
2716       return "%vpxor\t%0, %d0";
2717
2718     case TYPE_MMX:
2719       return "pxor\t%0, %0";
2720
2721     case TYPE_MULTI:
2722       return "#";
2723
2724     case TYPE_LEA:
2725       return "lea{q}\t{%a1, %0|%0, %a1}";
2726
2727     default:
2728       gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2729       if (get_attr_mode (insn) == MODE_SI)
2730         return "mov{l}\t{%k1, %k0|%k0, %k1}";
2731       else if (which_alternative == 2)
2732         return "movabs{q}\t{%1, %0|%0, %1}";
2733       else
2734         return "mov{q}\t{%1, %0|%0, %1}";
2735     }
2736 }
2737   [(set (attr "type")
2738      (cond [(eq_attr "alternative" "5")
2739               (const_string "mmx")
2740             (eq_attr "alternative" "6,7,8,9,10")
2741               (const_string "mmxmov")
2742             (eq_attr "alternative" "11")
2743               (const_string "sselog1")
2744             (eq_attr "alternative" "12,13,14,15,16")
2745               (const_string "ssemov")
2746             (eq_attr "alternative" "17,18")
2747               (const_string "ssecvt")
2748             (eq_attr "alternative" "4")
2749               (const_string "multi")
2750             (match_operand:DI 1 "pic_32bit_operand" "")
2751               (const_string "lea")
2752            ]
2753            (const_string "imov")))
2754    (set (attr "modrm")
2755      (if_then_else
2756        (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2757          (const_string "0")
2758          (const_string "*")))
2759    (set (attr "length_immediate")
2760      (if_then_else
2761        (and (eq_attr "alternative" "2") (eq_attr "type" "imov"))
2762          (const_string "8")
2763          (const_string "*")))
2764    (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*")
2765    (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*")
2766    (set (attr "prefix")
2767      (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
2768        (const_string "maybe_vex")
2769        (const_string "orig")))
2770    (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2771
2772 ;; Stores and loads of ax to arbitrary constant address.
2773 ;; We fake an second form of instruction to force reload to load address
2774 ;; into register when rax is not available
2775 (define_insn "*movabsdi_1_rex64"
2776   [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2777         (match_operand:DI 1 "nonmemory_operand" "a,er"))]
2778   "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2779   "@
2780    movabs{q}\t{%1, %P0|%P0, %1}
2781    mov{q}\t{%1, %a0|%a0, %1}"
2782   [(set_attr "type" "imov")
2783    (set_attr "modrm" "0,*")
2784    (set_attr "length_address" "8,0")
2785    (set_attr "length_immediate" "0,*")
2786    (set_attr "memory" "store")
2787    (set_attr "mode" "DI")])
2788
2789 (define_insn "*movabsdi_2_rex64"
2790   [(set (match_operand:DI 0 "register_operand" "=a,r")
2791         (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2792   "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2793   "@
2794    movabs{q}\t{%P1, %0|%0, %P1}
2795    mov{q}\t{%a1, %0|%0, %a1}"
2796   [(set_attr "type" "imov")
2797    (set_attr "modrm" "0,*")
2798    (set_attr "length_address" "8,0")
2799    (set_attr "length_immediate" "0")
2800    (set_attr "memory" "load")
2801    (set_attr "mode" "DI")])
2802
2803 ;; Convert impossible stores of immediate to existing instructions.
2804 ;; First try to get scratch register and go through it.  In case this
2805 ;; fails, move by 32bit parts.
2806 (define_peephole2
2807   [(match_scratch:DI 2 "r")
2808    (set (match_operand:DI 0 "memory_operand" "")
2809         (match_operand:DI 1 "immediate_operand" ""))]
2810   "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2811    && !x86_64_immediate_operand (operands[1], DImode)"
2812   [(set (match_dup 2) (match_dup 1))
2813    (set (match_dup 0) (match_dup 2))]
2814   "")
2815
2816 ;; We need to define this as both peepholer and splitter for case
2817 ;; peephole2 pass is not run.
2818 ;; "&& 1" is needed to keep it from matching the previous pattern.
2819 (define_peephole2
2820   [(set (match_operand:DI 0 "memory_operand" "")
2821         (match_operand:DI 1 "immediate_operand" ""))]
2822   "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2823    && !x86_64_immediate_operand (operands[1], DImode) && 1"
2824   [(set (match_dup 2) (match_dup 3))
2825    (set (match_dup 4) (match_dup 5))]
2826   "split_di (&operands[0], 2, &operands[2], &operands[4]);")
2827
2828 (define_split
2829   [(set (match_operand:DI 0 "memory_operand" "")
2830         (match_operand:DI 1 "immediate_operand" ""))]
2831   "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2832                     ? epilogue_completed : reload_completed)
2833    && !symbolic_operand (operands[1], DImode)
2834    && !x86_64_immediate_operand (operands[1], DImode)"
2835   [(set (match_dup 2) (match_dup 3))
2836    (set (match_dup 4) (match_dup 5))]
2837   "split_di (&operands[0], 2, &operands[2], &operands[4]);")
2838
2839 (define_insn "*swapdi_rex64"
2840   [(set (match_operand:DI 0 "register_operand" "+r")
2841         (match_operand:DI 1 "register_operand" "+r"))
2842    (set (match_dup 1)
2843         (match_dup 0))]
2844   "TARGET_64BIT"
2845   "xchg{q}\t%1, %0"
2846   [(set_attr "type" "imov")
2847    (set_attr "mode" "DI")
2848    (set_attr "pent_pair" "np")
2849    (set_attr "athlon_decode" "vector")
2850    (set_attr "amdfam10_decode" "double")])
2851
2852 (define_expand "movoi"
2853   [(set (match_operand:OI 0 "nonimmediate_operand" "")
2854         (match_operand:OI 1 "general_operand" ""))]
2855   "TARGET_AVX"
2856   "ix86_expand_move (OImode, operands); DONE;")
2857
2858 (define_insn "*movoi_internal"
2859   [(set (match_operand:OI 0 "nonimmediate_operand" "=x,x,m")
2860         (match_operand:OI 1 "vector_move_operand" "C,xm,x"))]
2861   "TARGET_AVX
2862    && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2863 {
2864   switch (which_alternative)
2865     {
2866     case 0:
2867       return "vxorps\t%0, %0, %0";
2868     case 1:
2869     case 2:
2870       if (misaligned_operand (operands[0], OImode)
2871           || misaligned_operand (operands[1], OImode))
2872         return "vmovdqu\t{%1, %0|%0, %1}";
2873       else
2874         return "vmovdqa\t{%1, %0|%0, %1}";
2875     default:
2876       gcc_unreachable ();
2877     }
2878 }
2879   [(set_attr "type" "sselog1,ssemov,ssemov")
2880    (set_attr "prefix" "vex")
2881    (set_attr "mode" "OI")])
2882
2883 (define_expand "movti"
2884   [(set (match_operand:TI 0 "nonimmediate_operand" "")
2885         (match_operand:TI 1 "nonimmediate_operand" ""))]
2886   "TARGET_SSE || TARGET_64BIT"
2887 {
2888   if (TARGET_64BIT)
2889     ix86_expand_move (TImode, operands);
2890   else if (push_operand (operands[0], TImode))
2891     ix86_expand_push (TImode, operands[1]);
2892   else
2893     ix86_expand_vector_move (TImode, operands);
2894   DONE;
2895 })
2896
2897 (define_insn "*movti_internal"
2898   [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
2899         (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
2900   "TARGET_SSE && !TARGET_64BIT
2901    && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2902 {
2903   switch (which_alternative)
2904     {
2905     case 0:
2906       if (get_attr_mode (insn) == MODE_V4SF)
2907         return "%vxorps\t%0, %d0";
2908       else
2909         return "%vpxor\t%0, %d0";
2910     case 1:
2911     case 2:
2912       /* TDmode values are passed as TImode on the stack.  Moving them
2913          to stack may result in unaligned memory access.  */
2914       if (misaligned_operand (operands[0], TImode)
2915           || misaligned_operand (operands[1], TImode))
2916         {
2917           if (get_attr_mode (insn) == MODE_V4SF)
2918             return "%vmovups\t{%1, %0|%0, %1}";
2919          else
2920            return "%vmovdqu\t{%1, %0|%0, %1}";
2921         }
2922       else
2923         {
2924           if (get_attr_mode (insn) == MODE_V4SF)
2925             return "%vmovaps\t{%1, %0|%0, %1}";
2926          else
2927            return "%vmovdqa\t{%1, %0|%0, %1}";
2928         }
2929     default:
2930       gcc_unreachable ();
2931     }
2932 }
2933   [(set_attr "type" "sselog1,ssemov,ssemov")
2934    (set_attr "prefix" "maybe_vex")
2935    (set (attr "mode")
2936         (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2937                     (ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0)))
2938                  (const_string "V4SF")
2939                (and (eq_attr "alternative" "2")
2940                     (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2941                         (const_int 0)))
2942                  (const_string "V4SF")]
2943               (const_string "TI")))])
2944
2945 (define_insn "*movti_rex64"
2946   [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm")
2947         (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
2948   "TARGET_64BIT
2949    && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2950 {
2951   switch (which_alternative)
2952     {
2953     case 0:
2954     case 1:
2955       return "#";
2956     case 2:
2957       if (get_attr_mode (insn) == MODE_V4SF)
2958         return "%vxorps\t%0, %d0";
2959       else
2960         return "%vpxor\t%0, %d0";
2961     case 3:
2962     case 4:
2963       /* TDmode values are passed as TImode on the stack.  Moving them
2964          to stack may result in unaligned memory access.  */
2965       if (misaligned_operand (operands[0], TImode)
2966           || misaligned_operand (operands[1], TImode))
2967         {
2968           if (get_attr_mode (insn) == MODE_V4SF)
2969             return "%vmovups\t{%1, %0|%0, %1}";
2970          else
2971            return "%vmovdqu\t{%1, %0|%0, %1}";
2972         }
2973       else
2974         {
2975           if (get_attr_mode (insn) == MODE_V4SF)
2976             return "%vmovaps\t{%1, %0|%0, %1}";
2977          else
2978            return "%vmovdqa\t{%1, %0|%0, %1}";
2979         }
2980     default:
2981       gcc_unreachable ();
2982     }
2983 }
2984   [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
2985    (set_attr "prefix" "*,*,maybe_vex,maybe_vex,maybe_vex")
2986    (set (attr "mode")
2987         (cond [(eq_attr "alternative" "2,3")
2988                  (if_then_else
2989                    (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2990                        (const_int 0))
2991                    (const_string "V4SF")
2992                    (const_string "TI"))
2993                (eq_attr "alternative" "4")
2994                  (if_then_else
2995                    (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2996                             (const_int 0))
2997                         (ne (symbol_ref "optimize_function_for_size_p (cfun)")
2998                             (const_int 0)))
2999                    (const_string "V4SF")
3000                    (const_string "TI"))]
3001                (const_string "DI")))])
3002
3003 (define_split
3004   [(set (match_operand:TI 0 "nonimmediate_operand" "")
3005         (match_operand:TI 1 "general_operand" ""))]
3006   "reload_completed && !SSE_REG_P (operands[0])
3007    && !SSE_REG_P (operands[1])"
3008   [(const_int 0)]
3009   "ix86_split_long_move (operands); DONE;")
3010
3011 ;; This expands to what emit_move_complex would generate if we didn't
3012 ;; have a movti pattern.  Having this avoids problems with reload on
3013 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
3014 ;; to have around all the time.
3015 (define_expand "movcdi"
3016   [(set (match_operand:CDI 0 "nonimmediate_operand" "")
3017         (match_operand:CDI 1 "general_operand" ""))]
3018   ""
3019 {
3020   if (push_operand (operands[0], CDImode))
3021     emit_move_complex_push (CDImode, operands[0], operands[1]);
3022   else
3023     emit_move_complex_parts (operands[0], operands[1]);
3024   DONE;
3025 })
3026
3027 (define_expand "movsf"
3028   [(set (match_operand:SF 0 "nonimmediate_operand" "")
3029         (match_operand:SF 1 "general_operand" ""))]
3030   ""
3031   "ix86_expand_move (SFmode, operands); DONE;")
3032
3033 (define_insn "*pushsf"
3034   [(set (match_operand:SF 0 "push_operand" "=<,<,<")
3035         (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
3036   "!TARGET_64BIT"
3037 {
3038   /* Anything else should be already split before reg-stack.  */
3039   gcc_assert (which_alternative == 1);
3040   return "push{l}\t%1";
3041 }
3042   [(set_attr "type" "multi,push,multi")
3043    (set_attr "unit" "i387,*,*")
3044    (set_attr "mode" "SF,SI,SF")])
3045
3046 (define_insn "*pushsf_rex64"
3047   [(set (match_operand:SF 0 "push_operand" "=X,X,X")
3048         (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
3049   "TARGET_64BIT"
3050 {
3051   /* Anything else should be already split before reg-stack.  */
3052   gcc_assert (which_alternative == 1);
3053   return "push{q}\t%q1";
3054 }
3055   [(set_attr "type" "multi,push,multi")
3056    (set_attr "unit" "i387,*,*")
3057    (set_attr "mode" "SF,DI,SF")])
3058
3059 (define_split
3060   [(set (match_operand:SF 0 "push_operand" "")
3061         (match_operand:SF 1 "memory_operand" ""))]
3062   "reload_completed
3063    && MEM_P (operands[1])
3064    && (operands[2] = find_constant_src (insn))"
3065   [(set (match_dup 0)
3066         (match_dup 2))])
3067
3068 ;; %%% Kill this when call knows how to work this out.
3069 (define_split
3070   [(set (match_operand:SF 0 "push_operand" "")
3071         (match_operand:SF 1 "any_fp_register_operand" ""))]
3072   "!TARGET_64BIT"
3073   [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
3074    (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
3075
3076 (define_split
3077   [(set (match_operand:SF 0 "push_operand" "")
3078         (match_operand:SF 1 "any_fp_register_operand" ""))]
3079   "TARGET_64BIT"
3080   [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
3081    (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
3082
3083 (define_insn "*movsf_1"
3084   [(set (match_operand:SF 0 "nonimmediate_operand"
3085           "=f,m,f,r  ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
3086         (match_operand:SF 1 "general_operand"
3087           "fm,f,G,rmF,Fr,C,x,xm,x,m  ,*y,*y ,r  ,Yi,r   ,*Ym"))]
3088   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3089    && (reload_in_progress || reload_completed
3090        || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3091        || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun)
3092            && standard_80387_constant_p (operands[1]))
3093        || GET_CODE (operands[1]) != CONST_DOUBLE
3094        || memory_operand (operands[0], SFmode))"
3095 {
3096   switch (which_alternative)
3097     {
3098     case 0:
3099     case 1:
3100       return output_387_reg_move (insn, operands);
3101
3102     case 2:
3103       return standard_80387_constant_opcode (operands[1]);
3104
3105     case 3:
3106     case 4:
3107       return "mov{l}\t{%1, %0|%0, %1}";
3108     case 5:
3109       if (get_attr_mode (insn) == MODE_TI)
3110         return "%vpxor\t%0, %d0";
3111       else
3112         return "%vxorps\t%0, %d0";
3113     case 6:
3114       if (get_attr_mode (insn) == MODE_V4SF)
3115         return "%vmovaps\t{%1, %0|%0, %1}";
3116       else
3117         return "%vmovss\t{%1, %d0|%d0, %1}";
3118     case 7:
3119       if (TARGET_AVX)
3120         return REG_P (operands[1]) ? "vmovss\t{%1, %0, %0|%0, %0, %1}"
3121                                    : "vmovss\t{%1, %0|%0, %1}";
3122       else
3123         return "movss\t{%1, %0|%0, %1}";
3124     case 8:
3125       return "%vmovss\t{%1, %0|%0, %1}";
3126
3127     case 9: case 10: case 14: case 15:
3128       return "movd\t{%1, %0|%0, %1}";
3129     case 12: case 13:
3130       return "%vmovd\t{%1, %0|%0, %1}";
3131
3132     case 11:
3133       return "movq\t{%1, %0|%0, %1}";
3134
3135     default:
3136       gcc_unreachable ();
3137     }
3138 }
3139   [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
3140    (set (attr "prefix")
3141      (if_then_else (eq_attr "alternative" "5,6,7,8,12,13")
3142        (const_string "maybe_vex")
3143        (const_string "orig")))
3144    (set (attr "mode")
3145         (cond [(eq_attr "alternative" "3,4,9,10")
3146                  (const_string "SI")
3147                (eq_attr "alternative" "5")
3148                  (if_then_else
3149                    (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3150                                  (const_int 0))
3151                              (ne (symbol_ref "TARGET_SSE2")
3152                                  (const_int 0)))
3153                         (eq (symbol_ref "optimize_function_for_size_p (cfun)")
3154                             (const_int 0)))
3155                    (const_string "TI")
3156                    (const_string "V4SF"))
3157                /* For architectures resolving dependencies on
3158                   whole SSE registers use APS move to break dependency
3159                   chains, otherwise use short move to avoid extra work.
3160
3161                   Do the same for architectures resolving dependencies on
3162                   the parts.  While in DF mode it is better to always handle
3163                   just register parts, the SF mode is different due to lack
3164                   of instructions to load just part of the register.  It is
3165                   better to maintain the whole registers in single format
3166                   to avoid problems on using packed logical operations.  */
3167                (eq_attr "alternative" "6")
3168                  (if_then_else
3169                    (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3170                             (const_int 0))
3171                         (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3172                             (const_int 0)))
3173                    (const_string "V4SF")
3174                    (const_string "SF"))
3175                (eq_attr "alternative" "11")
3176                  (const_string "DI")]
3177                (const_string "SF")))])
3178
3179 (define_insn "*swapsf"
3180   [(set (match_operand:SF 0 "fp_register_operand" "+f")
3181         (match_operand:SF 1 "fp_register_operand" "+f"))
3182    (set (match_dup 1)
3183         (match_dup 0))]
3184   "reload_completed || TARGET_80387"
3185 {
3186   if (STACK_TOP_P (operands[0]))
3187     return "fxch\t%1";
3188   else
3189     return "fxch\t%0";
3190 }
3191   [(set_attr "type" "fxch")
3192    (set_attr "mode" "SF")])
3193
3194 (define_expand "movdf"
3195   [(set (match_operand:DF 0 "nonimmediate_operand" "")
3196         (match_operand:DF 1 "general_operand" ""))]
3197   ""
3198   "ix86_expand_move (DFmode, operands); DONE;")
3199
3200 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
3201 ;; Size of pushdf using integer instructions is 2+2*memory operand size
3202 ;; On the average, pushdf using integers can be still shorter.  Allow this
3203 ;; pattern for optimize_size too.
3204
3205 (define_insn "*pushdf_nointeger"
3206   [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
3207         (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
3208   "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
3209 {
3210   /* This insn should be already split before reg-stack.  */
3211   gcc_unreachable ();
3212 }
3213   [(set_attr "type" "multi")
3214    (set_attr "unit" "i387,*,*,*")
3215    (set_attr "mode" "DF,SI,SI,DF")])
3216
3217 (define_insn "*pushdf_integer"
3218   [(set (match_operand:DF 0 "push_operand" "=<,<,<")
3219         (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
3220   "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
3221 {
3222   /* This insn should be already split before reg-stack.  */
3223   gcc_unreachable ();
3224 }
3225   [(set_attr "type" "multi")
3226    (set_attr "unit" "i387,*,*")
3227    (set_attr "mode" "DF,SI,DF")])
3228
3229 ;; %%% Kill this when call knows how to work this out.
3230 (define_split
3231   [(set (match_operand:DF 0 "push_operand" "")
3232         (match_operand:DF 1 "any_fp_register_operand" ""))]
3233   "reload_completed"
3234   [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
3235    (set (mem:DF (reg:P SP_REG)) (match_dup 1))]
3236   "")
3237
3238 (define_split
3239   [(set (match_operand:DF 0 "push_operand" "")
3240         (match_operand:DF 1 "general_operand" ""))]
3241   "reload_completed"
3242   [(const_int 0)]
3243   "ix86_split_long_move (operands); DONE;")
3244
3245 ;; Moving is usually shorter when only FP registers are used. This separate
3246 ;; movdf pattern avoids the use of integer registers for FP operations
3247 ;; when optimizing for size.
3248
3249 (define_insn "*movdf_nointeger"
3250   [(set (match_operand:DF 0 "nonimmediate_operand"
3251                         "=f,m,f,*r  ,o  ,Y2*x,Y2*x,Y2*x ,m  ")
3252         (match_operand:DF 1 "general_operand"
3253                         "fm,f,G,*roF,*Fr,C   ,Y2*x,mY2*x,Y2*x"))]
3254   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3255    && ((optimize_function_for_size_p (cfun)
3256        || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
3257    && (reload_in_progress || reload_completed
3258        || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3259        || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3260            && optimize_function_for_size_p (cfun)
3261            && !memory_operand (operands[0], DFmode)
3262            && standard_80387_constant_p (operands[1]))
3263        || GET_CODE (operands[1]) != CONST_DOUBLE
3264        || ((optimize_function_for_size_p (cfun)
3265             || !TARGET_MEMORY_MISMATCH_STALL
3266             || reload_in_progress || reload_completed)
3267            && memory_operand (operands[0], DFmode)))"
3268 {
3269   switch (which_alternative)
3270     {
3271     case 0:
3272     case 1:
3273       return output_387_reg_move (insn, operands);
3274
3275     case 2:
3276       return standard_80387_constant_opcode (operands[1]);
3277
3278     case 3:
3279     case 4:
3280       return "#";
3281     case 5:
3282       switch (get_attr_mode (insn))
3283         {
3284         case MODE_V4SF:
3285           return "%vxorps\t%0, %d0";
3286         case MODE_V2DF:
3287           return "%vxorpd\t%0, %d0";
3288         case MODE_TI:
3289           return "%vpxor\t%0, %d0";
3290         default:
3291           gcc_unreachable ();
3292         }
3293     case 6:
3294     case 7:
3295     case 8:
3296       switch (get_attr_mode (insn))
3297         {
3298         case MODE_V4SF:
3299           return "%vmovaps\t{%1, %0|%0, %1}";
3300         case MODE_V2DF:
3301           return "%vmovapd\t{%1, %0|%0, %1}";
3302         case MODE_TI:
3303           return "%vmovdqa\t{%1, %0|%0, %1}";
3304         case MODE_DI:
3305           return "%vmovq\t{%1, %0|%0, %1}";
3306         case MODE_DF:
3307           if (TARGET_AVX)
3308             {
3309               if (REG_P (operands[0]) && REG_P (operands[1]))
3310                 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3311               else
3312                 return "vmovsd\t{%1, %0|%0, %1}";
3313             }
3314           else
3315             return "movsd\t{%1, %0|%0, %1}";
3316         case MODE_V1DF:
3317           if (TARGET_AVX)
3318             {
3319               if (REG_P (operands[0]))
3320                 return "vmovlpd\t{%1, %0, %0|%0, %0, %1}";
3321               else
3322                 return "vmovlpd\t{%1, %0|%0, %1}";
3323             }
3324           else
3325             return "movlpd\t{%1, %0|%0, %1}";
3326         case MODE_V2SF:
3327           if (TARGET_AVX)
3328             {
3329               if (REG_P (operands[0]))
3330                 return "vmovlps\t{%1, %0, %0|%0, %0, %1}";
3331               else
3332                 return "vmovlps\t{%1, %0|%0, %1}";
3333             }
3334           else
3335             return "movlps\t{%1, %0|%0, %1}";
3336         default:
3337           gcc_unreachable ();
3338         }
3339
3340     default:
3341       gcc_unreachable ();
3342     }
3343 }
3344   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3345    (set (attr "prefix")
3346      (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3347        (const_string "orig")
3348        (const_string "maybe_vex")))
3349    (set (attr "prefix_data16")
3350      (if_then_else (eq_attr "mode" "V1DF")
3351        (const_string "1")
3352        (const_string "*")))
3353    (set (attr "mode")
3354         (cond [(eq_attr "alternative" "0,1,2")
3355                  (const_string "DF")
3356                (eq_attr "alternative" "3,4")
3357                  (const_string "SI")
3358
3359                /* For SSE1, we have many fewer alternatives.  */
3360                (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3361                  (cond [(eq_attr "alternative" "5,6")
3362                           (const_string "V4SF")
3363                        ]
3364                    (const_string "V2SF"))
3365
3366                /* xorps is one byte shorter.  */
3367                (eq_attr "alternative" "5")
3368                  (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3369                             (const_int 0))
3370                           (const_string "V4SF")
3371                         (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3372                             (const_int 0))
3373                           (const_string "TI")
3374                        ]
3375                        (const_string "V2DF"))
3376
3377                /* For architectures resolving dependencies on
3378                   whole SSE registers use APD move to break dependency
3379                   chains, otherwise use short move to avoid extra work.
3380
3381                   movaps encodes one byte shorter.  */
3382                (eq_attr "alternative" "6")
3383                  (cond
3384                    [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3385                         (const_int 0))
3386                       (const_string "V4SF")
3387                     (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3388                         (const_int 0))
3389                       (const_string "V2DF")
3390                    ]
3391                    (const_string "DF"))
3392                /* For architectures resolving dependencies on register
3393                   parts we may avoid extra work to zero out upper part
3394                   of register.  */
3395                (eq_attr "alternative" "7")
3396                  (if_then_else
3397                    (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3398                        (const_int 0))
3399                    (const_string "V1DF")
3400                    (const_string "DF"))
3401               ]
3402               (const_string "DF")))])
3403
3404 (define_insn "*movdf_integer_rex64"
3405   [(set (match_operand:DF 0 "nonimmediate_operand"
3406                 "=f,m,f,r  ,m ,Y2*x,Y2*x,Y2*x,m   ,Yi,r ")
3407         (match_operand:DF 1 "general_operand"
3408                 "fm,f,G,rmF,Fr,C   ,Y2*x,m   ,Y2*x,r ,Yi"))]
3409   "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3410    && (reload_in_progress || reload_completed
3411        || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3412        || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3413            && optimize_function_for_size_p (cfun)
3414            && standard_80387_constant_p (operands[1]))
3415        || GET_CODE (operands[1]) != CONST_DOUBLE
3416        || memory_operand (operands[0], DFmode))"
3417 {
3418   switch (which_alternative)
3419     {
3420     case 0:
3421     case 1:
3422       return output_387_reg_move (insn, operands);
3423
3424     case 2:
3425       return standard_80387_constant_opcode (operands[1]);
3426
3427     case 3:
3428     case 4:
3429       return "#";
3430
3431     case 5:
3432       switch (get_attr_mode (insn))
3433         {
3434         case MODE_V4SF:
3435           return "%vxorps\t%0, %d0";
3436         case MODE_V2DF:
3437           return "%vxorpd\t%0, %d0";
3438         case MODE_TI:
3439           return "%vpxor\t%0, %d0";
3440         default:
3441           gcc_unreachable ();
3442         }
3443     case 6:
3444     case 7:
3445     case 8:
3446       switch (get_attr_mode (insn))
3447         {
3448         case MODE_V4SF:
3449           return "%vmovaps\t{%1, %0|%0, %1}";
3450         case MODE_V2DF:
3451           return "%vmovapd\t{%1, %0|%0, %1}";
3452         case MODE_TI:
3453           return "%vmovdqa\t{%1, %0|%0, %1}";
3454         case MODE_DI:
3455           return "%vmovq\t{%1, %0|%0, %1}";
3456         case MODE_DF:
3457           if (TARGET_AVX)
3458             {
3459               if (REG_P (operands[0]) && REG_P (operands[1]))
3460                 return "vmovsd\t{%1, %0, %0|%0, %0, %1}";
3461               else
3462                 return "vmovsd\t{%1, %0|%0, %1}";
3463             }
3464           else
3465             return "movsd\t{%1, %0|%0, %1}";
3466         case MODE_V1DF:
3467           return "%vmovlpd\t{%1, %d0|%d0, %1}";
3468         case MODE_V2SF:
3469           return "%vmovlps\t{%1, %d0|%d0, %1}";
3470         default:
3471           gcc_unreachable ();
3472         }
3473
3474     case 9:
3475     case 10:
3476     return "%vmovd\t{%1, %0|%0, %1}";
3477
3478     default:
3479       gcc_unreachable();
3480     }
3481 }
3482   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
3483    (set (attr "prefix")
3484      (if_then_else (eq_attr "alternative" "0,1,2,3,4")
3485        (const_string "orig")
3486        (const_string "maybe_vex")))
3487    (set (attr "prefix_data16")
3488      (if_then_else (eq_attr "mode" "V1DF")
3489        (const_string "1")
3490        (const_string "*")))
3491    (set (attr "mode")
3492         (cond [(eq_attr "alternative" "0,1,2")
3493                  (const_string "DF")
3494                (eq_attr "alternative" "3,4,9,10")
3495                  (const_string "DI")
3496
3497                /* For SSE1, we have many fewer alternatives.  */
3498                (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3499                  (cond [(eq_attr "alternative" "5,6")
3500                           (const_string "V4SF")
3501                        ]
3502                    (const_string "V2SF"))
3503
3504                /* xorps is one byte shorter.  */
3505                (eq_attr "alternative" "5")
3506                  (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3507                             (const_int 0))
3508                           (const_string "V4SF")
3509                         (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3510                             (const_int 0))
3511                           (const_string "TI")
3512                        ]
3513                        (const_string "V2DF"))
3514
3515                /* For architectures resolving dependencies on
3516                   whole SSE registers use APD move to break dependency
3517                   chains, otherwise use short move to avoid extra work.
3518
3519                   movaps encodes one byte shorter.  */
3520                (eq_attr "alternative" "6")
3521                  (cond
3522                    [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3523                         (const_int 0))
3524                       (const_string "V4SF")
3525                     (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3526                         (const_int 0))
3527                       (const_string "V2DF")
3528                    ]
3529                    (const_string "DF"))
3530                /* For architectures resolving dependencies on register
3531                   parts we may avoid extra work to zero out upper part
3532                   of register.  */
3533                (eq_attr "alternative" "7")
3534                  (if_then_else
3535                    (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3536                        (const_int 0))
3537                    (const_string "V1DF")
3538                    (const_string "DF"))
3539               ]
3540               (const_string "DF")))])
3541
3542 (define_insn "*movdf_integer"
3543   [(set (match_operand:DF 0 "nonimmediate_operand"
3544                 "=f,m,f,r  ,o ,Y2*x,Y2*x,Y2*x,m   ")
3545         (match_operand:DF 1 "general_operand"
3546                 "fm,f,G,roF,Fr,C   ,Y2*x,m   ,Y2*x"))]
3547   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
3548    && optimize_function_for_speed_p (cfun)
3549    && TARGET_INTEGER_DFMODE_MOVES
3550    && (reload_in_progress || reload_completed
3551        || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3552        || (!(TARGET_SSE2 && TARGET_SSE_MATH)
3553            && optimize_function_for_size_p (cfun)
3554            && standard_80387_constant_p (operands[1]))
3555        || GET_CODE (operands[1]) != CONST_DOUBLE
3556        || memory_operand (operands[0], DFmode))"
3557 {
3558   switch (which_alternative)
3559     {
3560     case 0:
3561     case 1:
3562       return output_387_reg_move (insn, operands);
3563
3564     case 2:
3565       return standard_80387_constant_opcode (operands[1]);
3566
3567     case 3:
3568     case 4:
3569       return "#";
3570
3571     case 5:
3572       switch (get_attr_mode (insn))
3573         {
3574         case MODE_V4SF:
3575           return "xorps\t%0, %0";
3576         case MODE_V2DF:
3577           return "xorpd\t%0, %0";
3578         case MODE_TI:
3579           return "pxor\t%0, %0";
3580         default:
3581           gcc_unreachable ();
3582         }
3583     case 6:
3584     case 7:
3585     case 8:
3586       switch (get_attr_mode (insn))
3587         {
3588         case MODE_V4SF:
3589           return "movaps\t{%1, %0|%0, %1}";
3590         case MODE_V2DF:
3591           return "movapd\t{%1, %0|%0, %1}";
3592         case MODE_TI:
3593           return "movdqa\t{%1, %0|%0, %1}";
3594         case MODE_DI:
3595           return "movq\t{%1, %0|%0, %1}";
3596         case MODE_DF:
3597           return "movsd\t{%1, %0|%0, %1}";
3598         case MODE_V1DF:
3599           return "movlpd\t{%1, %0|%0, %1}";
3600         case MODE_V2SF:
3601           return "movlps\t{%1, %0|%0, %1}";
3602         default:
3603           gcc_unreachable ();
3604         }
3605
3606     default:
3607       gcc_unreachable();
3608     }
3609 }
3610   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3611    (set (attr "prefix_data16")
3612      (if_then_else (eq_attr "mode" "V1DF")
3613        (const_string "1")
3614        (const_string "*")))
3615    (set (attr "mode")
3616         (cond [(eq_attr "alternative" "0,1,2")
3617                  (const_string "DF")
3618                (eq_attr "alternative" "3,4")
3619                  (const_string "SI")
3620
3621                /* For SSE1, we have many fewer alternatives.  */
3622                (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3623                  (cond [(eq_attr "alternative" "5,6")
3624                           (const_string "V4SF")
3625                        ]
3626                    (const_string "V2SF"))
3627
3628                /* xorps is one byte shorter.  */
3629                (eq_attr "alternative" "5")
3630                  (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3631                             (const_int 0))
3632                           (const_string "V4SF")
3633                         (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3634                             (const_int 0))
3635                           (const_string "TI")
3636                        ]
3637                        (const_string "V2DF"))
3638
3639                /* For architectures resolving dependencies on
3640                   whole SSE registers use APD move to break dependency
3641                   chains, otherwise use short move to avoid extra work.
3642
3643                   movaps encodes one byte shorter.  */
3644                (eq_attr "alternative" "6")
3645                  (cond
3646                    [(ne (symbol_ref "optimize_function_for_size_p (cfun)")
3647                         (const_int 0))
3648                       (const_string "V4SF")
3649                     (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3650                         (const_int 0))
3651                       (const_string "V2DF")
3652                    ]
3653                    (const_string "DF"))
3654                /* For architectures resolving dependencies on register
3655                   parts we may avoid extra work to zero out upper part
3656                   of register.  */
3657                (eq_attr "alternative" "7")
3658                  (if_then_else
3659                    (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3660                        (const_int 0))
3661                    (const_string "V1DF")
3662                    (const_string "DF"))
3663               ]
3664               (const_string "DF")))])
3665
3666 (define_split
3667   [(set (match_operand:DF 0 "nonimmediate_operand" "")
3668         (match_operand:DF 1 "general_operand" ""))]
3669   "reload_completed
3670    && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3671    && ! (ANY_FP_REG_P (operands[0]) ||
3672          (GET_CODE (operands[0]) == SUBREG
3673           && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3674    && ! (ANY_FP_REG_P (operands[1]) ||
3675          (GET_CODE (operands[1]) == SUBREG
3676           && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3677   [(const_int 0)]
3678   "ix86_split_long_move (operands); DONE;")
3679
3680 (define_insn "*swapdf"
3681   [(set (match_operand:DF 0 "fp_register_operand" "+f")
3682         (match_operand:DF 1 "fp_register_operand" "+f"))
3683    (set (match_dup 1)
3684         (match_dup 0))]
3685   "reload_completed || TARGET_80387"
3686 {
3687   if (STACK_TOP_P (operands[0]))
3688     return "fxch\t%1";
3689   else
3690     return "fxch\t%0";
3691 }
3692   [(set_attr "type" "fxch")
3693    (set_attr "mode" "DF")])
3694
3695 (define_expand "movxf"
3696   [(set (match_operand:XF 0 "nonimmediate_operand" "")
3697         (match_operand:XF 1 "general_operand" ""))]
3698   ""
3699   "ix86_expand_move (XFmode, operands); DONE;")
3700
3701 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
3702 ;; Size of pushdf using integer instructions is 3+3*memory operand size
3703 ;; Pushing using integer instructions is longer except for constants
3704 ;; and direct memory references.
3705 ;; (assuming that any given constant is pushed only once, but this ought to be
3706 ;;  handled elsewhere).
3707
3708 (define_insn "*pushxf_nointeger"
3709   [(set (match_operand:XF 0 "push_operand" "=X,X,X")
3710         (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
3711   "optimize_function_for_size_p (cfun)"
3712 {
3713   /* This insn should be already split before reg-stack.  */
3714   gcc_unreachable ();
3715 }
3716   [(set_attr "type" "multi")
3717    (set_attr "unit" "i387,*,*")
3718    (set_attr "mode" "XF,SI,SI")])
3719
3720 (define_insn "*pushxf_integer"
3721   [(set (match_operand:XF 0 "push_operand" "=<,<")
3722         (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
3723   "optimize_function_for_speed_p (cfun)"
3724 {
3725   /* This insn should be already split before reg-stack.  */
3726   gcc_unreachable ();
3727 }
3728   [(set_attr "type" "multi")
3729    (set_attr "unit" "i387,*")
3730    (set_attr "mode" "XF,SI")])
3731
3732 (define_split
3733   [(set (match_operand 0 "push_operand" "")
3734         (match_operand 1 "general_operand" ""))]
3735   "reload_completed
3736    && (GET_MODE (operands[0]) == XFmode
3737        || GET_MODE (operands[0]) == DFmode)
3738    && !ANY_FP_REG_P (operands[1])"
3739   [(const_int 0)]
3740   "ix86_split_long_move (operands); DONE;")
3741
3742 (define_split
3743   [(set (match_operand:XF 0 "push_operand" "")
3744         (match_operand:XF 1 "any_fp_register_operand" ""))]
3745   ""
3746   [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
3747    (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
3748   "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3749
3750 ;; Do not use integer registers when optimizing for size
3751 (define_insn "*movxf_nointeger"
3752   [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
3753         (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
3754   "optimize_function_for_size_p (cfun)
3755    && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3756    && (reload_in_progress || reload_completed
3757        || standard_80387_constant_p (operands[1])
3758        || GET_CODE (operands[1]) != CONST_DOUBLE
3759        || memory_operand (operands[0], XFmode))"
3760 {
3761   switch (which_alternative)
3762     {
3763     case 0:
3764     case 1:
3765       return output_387_reg_move (insn, operands);
3766
3767     case 2:
3768       return standard_80387_constant_opcode (operands[1]);
3769
3770     case 3: case 4:
3771       return "#";
3772     default:
3773       gcc_unreachable ();
3774     }
3775 }
3776   [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3777    (set_attr "mode" "XF,XF,XF,SI,SI")])
3778
3779 (define_insn "*movxf_integer"
3780   [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
3781         (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
3782   "optimize_function_for_speed_p (cfun)
3783    && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3784    && (reload_in_progress || reload_completed
3785        || GET_CODE (operands[1]) != CONST_DOUBLE
3786        || memory_operand (operands[0], XFmode))"
3787 {
3788   switch (which_alternative)
3789     {
3790     case 0:
3791     case 1:
3792       return output_387_reg_move (insn, operands);
3793
3794     case 2:
3795       return standard_80387_constant_opcode (operands[1]);
3796
3797     case 3: case 4:
3798       return "#";
3799
3800     default:
3801       gcc_unreachable ();
3802     }
3803 }
3804   [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3805    (set_attr "mode" "XF,XF,XF,SI,SI")])
3806
3807 (define_expand "movtf"
3808   [(set (match_operand:TF 0 "nonimmediate_operand" "")
3809         (match_operand:TF 1 "nonimmediate_operand" ""))]
3810   "TARGET_SSE2"
3811 {
3812   ix86_expand_move (TFmode, operands);
3813   DONE;
3814 })
3815
3816 (define_insn "*movtf_internal"
3817   [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
3818         (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
3819   "TARGET_SSE2
3820    && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
3821 {
3822   switch (which_alternative)
3823     {
3824     case 0:
3825     case 1:
3826       if (get_attr_mode (insn) == MODE_V4SF)
3827         return "%vmovaps\t{%1, %0|%0, %1}";
3828       else
3829         return "%vmovdqa\t{%1, %0|%0, %1}";
3830     case 2:
3831       if (get_attr_mode (insn) == MODE_V4SF)
3832         return "%vxorps\t%0, %d0";
3833       else
3834         return "%vpxor\t%0, %d0";
3835     case 3:
3836     case 4:
3837         return "#";
3838     default:
3839       gcc_unreachable ();
3840     }
3841 }
3842   [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
3843    (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,*,*")
3844    (set (attr "mode")
3845         (cond [(eq_attr "alternative" "0,2")
3846                  (if_then_else
3847                    (ne (symbol_ref "optimize_function_for_size_p (cfun)")
3848                        (const_int 0))
3849                    (const_string "V4SF")
3850                    (const_string "TI"))
3851                (eq_attr "alternative" "1")
3852                  (if_then_else
3853                    (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
3854                             (const_int 0))
3855                         (ne (symbol_ref "optimize_function_for_size_p (cfun)")
3856                             (const_int 0)))
3857                    (const_string "V4SF")
3858                    (const_string "TI"))]
3859                (const_string "DI")))])
3860
3861 (define_insn "*pushtf_sse"
3862   [(set (match_operand:TF 0 "push_operand" "=<,<,<")
3863         (match_operand:TF 1 "general_no_elim_operand" "x,Fo,*r"))]
3864   "TARGET_SSE2"
3865 {
3866   /* This insn should be already split before reg-stack.  */
3867   gcc_unreachable ();
3868 }
3869   [(set_attr "type" "multi")
3870    (set_attr "unit" "sse,*,*")
3871    (set_attr "mode" "TF,SI,SI")])
3872
3873 (define_split