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
4 ;; Free Software Foundation, Inc.
5 ;; Mostly by William Schelter.
6 ;; x86_64 support added by Jan Hubicka
8 ;; This file is part of GCC.
10 ;; GCC is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; GCC is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GCC; see the file COPYING3. If not see
22 ;; <http://www.gnu.org/licenses/>. */
24 ;; The original PO technology requires these to be ordered by speed,
25 ;; so that assigner will pick the fastest.
27 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 ;; The special asm out single letter directives following a '%' are:
30 ;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of
32 ;; 'L' Print the opcode suffix for a 32-bit integer opcode.
33 ;; 'W' Print the opcode suffix for a 16-bit integer opcode.
34 ;; 'B' Print the opcode suffix for an 8-bit integer opcode.
35 ;; 'Q' Print the opcode suffix for a 64-bit float opcode.
36 ;; 'S' Print the opcode suffix for a 32-bit float opcode.
37 ;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode.
38 ;; 'J' Print the appropriate jump operand.
40 ;; 'b' Print the QImode name of the register for the indicated operand.
41 ;; %b0 would print %al if operands[0] is reg 0.
42 ;; 'w' Likewise, print the HImode name of the register.
43 ;; 'k' Likewise, print the SImode name of the register.
44 ;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.
45 ;; 'y' Print "st(0)" instead of "st" as a register.
50 [; Relocation specifiers
63 (UNSPEC_STACK_ALLOC 11)
65 (UNSPEC_SSE_PROLOGUE_SAVE 13)
69 (UNSPEC_SET_GOT_OFFSET 17)
74 (UNSPEC_TLS_LD_BASE 20)
77 ; Other random patterns
86 (UNSPEC_LD_MPIC 38) ; load_macho_picbase
87 (UNSPEC_TRUNC_NOOP 39)
89 ; For SSE/MMX support:
90 (UNSPEC_FIX_NOTRUNC 40)
108 ; Generic math support
110 (UNSPEC_IEEE_MIN 51) ; not commutative
111 (UNSPEC_IEEE_MAX 52) ; not commutative
126 (UNSPEC_FRNDINT_FLOOR 70)
127 (UNSPEC_FRNDINT_CEIL 71)
128 (UNSPEC_FRNDINT_TRUNC 72)
129 (UNSPEC_FRNDINT_MASK_PM 73)
130 (UNSPEC_FIST_FLOOR 74)
131 (UNSPEC_FIST_CEIL 75)
133 ; x87 Double output FP
134 (UNSPEC_SINCOS_COS 80)
135 (UNSPEC_SINCOS_SIN 81)
136 (UNSPEC_XTRACT_FRACT 84)
137 (UNSPEC_XTRACT_EXP 85)
138 (UNSPEC_FSCALE_FRACT 86)
139 (UNSPEC_FSCALE_EXP 87)
150 (UNSPEC_SP_TLS_SET 102)
151 (UNSPEC_SP_TLS_TEST 103)
161 (UNSPEC_INSERTQI 132)
166 (UNSPEC_INSERTPS 135)
168 (UNSPEC_MOVNTDQA 137)
170 (UNSPEC_PHMINPOSUW 139)
176 (UNSPEC_PCMPESTR 144)
177 (UNSPEC_PCMPISTR 145)
180 (UNSPEC_SSE5_INTRINSIC 150)
181 (UNSPEC_SSE5_UNSIGNED_CMP 151)
182 (UNSPEC_SSE5_TRUEFALSE 152)
183 (UNSPEC_SSE5_PERMUTE 153)
184 (UNSPEC_SSE5_ASHIFT 154)
185 (UNSPEC_SSE5_LSHIFT 155)
187 (UNSPEC_CVTPH2PS 157)
188 (UNSPEC_CVTPS2PH 158)
192 (UNSPEC_AESENCLAST 160)
194 (UNSPEC_AESDECLAST 162)
196 (UNSPEC_AESKEYGENASSIST 164)
203 [(UNSPECV_BLOCKAGE 0)
204 (UNSPECV_STACK_PROBE 1)
213 (UNSPECV_CMPXCHG_1 10)
214 (UNSPECV_CMPXCHG_2 11)
217 (UNSPECV_PROLOGUE_USE 14)
220 ;; Constants to represent pcomtrue/pcomfalse variants
230 ;; Registers by name.
246 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
249 ;; In C guard expressions, put expressions which may be compile-time
250 ;; constants first. This allows for better optimization. For
251 ;; example, write "TARGET_64BIT && reload_completed", not
252 ;; "reload_completed && TARGET_64BIT".
255 ;; Processor type. This attribute must exactly match the processor_type
256 ;; enumeration in i386.h.
257 (define_attr "cpu" "i386,i486,pentium,pentiumpro,geode,k6,athlon,pentium4,k8,
258 nocona,core2,generic32,generic64,amdfam10"
259 (const (symbol_ref "ix86_tune")))
261 ;; A basic instruction type. Refinements due to arguments to be
262 ;; provided in other attributes.
265 alu,alu1,negnot,imov,imovx,lea,
266 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
267 icmp,test,ibr,setcc,icmov,
268 push,pop,call,callv,leave,
270 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
271 sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
272 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
274 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
275 (const_string "other"))
277 ;; Main data type used by the insn
279 "unknown,none,QI,HI,SI,DI,SF,DF,XF,TI,V4SF,V2DF,V2SF,V1DF"
280 (const_string "unknown"))
282 ;; The CPU unit operations uses.
283 (define_attr "unit" "integer,i387,sse,mmx,unknown"
284 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
285 (const_string "i387")
286 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseimul,
287 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,
288 ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
290 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
292 (eq_attr "type" "other")
293 (const_string "unknown")]
294 (const_string "integer")))
296 ;; The (bounding maximum) length of an instruction immediate.
297 (define_attr "length_immediate" ""
298 (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
301 (eq_attr "unit" "i387,sse,mmx")
303 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
305 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
306 (eq_attr "type" "imov,test")
307 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
308 (eq_attr "type" "call")
309 (if_then_else (match_operand 0 "constant_call_address_operand" "")
312 (eq_attr "type" "callv")
313 (if_then_else (match_operand 1 "constant_call_address_operand" "")
316 ;; We don't know the size before shorten_branches. Expect
317 ;; the instruction to fit for better scheduling.
318 (eq_attr "type" "ibr")
321 (symbol_ref "/* Update immediate_length and other attributes! */
322 gcc_unreachable (),1")))
324 ;; The (bounding maximum) length of an instruction address.
325 (define_attr "length_address" ""
326 (cond [(eq_attr "type" "str,other,multi,fxch")
328 (and (eq_attr "type" "call")
329 (match_operand 0 "constant_call_address_operand" ""))
331 (and (eq_attr "type" "callv")
332 (match_operand 1 "constant_call_address_operand" ""))
335 (symbol_ref "ix86_attr_length_address_default (insn)")))
337 ;; Set when length prefix is used.
338 (define_attr "prefix_data16" ""
339 (if_then_else (ior (eq_attr "mode" "HI")
340 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))
344 ;; Set when string REP prefix is used.
345 (define_attr "prefix_rep" ""
346 (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
350 ;; Set when 0f opcode prefix is used.
351 (define_attr "prefix_0f" ""
353 (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
354 (eq_attr "unit" "sse,mmx"))
358 ;; Set when REX opcode prefix is used.
359 (define_attr "prefix_rex" ""
360 (cond [(and (eq_attr "mode" "DI")
361 (eq_attr "type" "!push,pop,call,callv,leave,ibr"))
363 (and (eq_attr "mode" "QI")
364 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
367 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
373 ;; There are also additional prefixes in SSSE3.
374 (define_attr "prefix_extra" "" (const_int 0))
376 ;; Set when modrm byte is used.
377 (define_attr "modrm" ""
378 (cond [(eq_attr "type" "str,leave")
380 (eq_attr "unit" "i387")
382 (and (eq_attr "type" "incdec")
383 (ior (match_operand:SI 1 "register_operand" "")
384 (match_operand:HI 1 "register_operand" "")))
386 (and (eq_attr "type" "push")
387 (not (match_operand 1 "memory_operand" "")))
389 (and (eq_attr "type" "pop")
390 (not (match_operand 0 "memory_operand" "")))
392 (and (eq_attr "type" "imov")
393 (ior (and (match_operand 0 "register_operand" "")
394 (match_operand 1 "immediate_operand" ""))
395 (ior (and (match_operand 0 "ax_reg_operand" "")
396 (match_operand 1 "memory_displacement_only_operand" ""))
397 (and (match_operand 0 "memory_displacement_only_operand" "")
398 (match_operand 1 "ax_reg_operand" "")))))
400 (and (eq_attr "type" "call")
401 (match_operand 0 "constant_call_address_operand" ""))
403 (and (eq_attr "type" "callv")
404 (match_operand 1 "constant_call_address_operand" ""))
409 ;; The (bounding maximum) length of an instruction in bytes.
410 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
411 ;; Later we may want to split them and compute proper length as for
413 (define_attr "length" ""
414 (cond [(eq_attr "type" "other,multi,fistp,frndint")
416 (eq_attr "type" "fcmp")
418 (eq_attr "unit" "i387")
420 (plus (attr "prefix_data16")
421 (attr "length_address")))]
422 (plus (plus (attr "modrm")
423 (plus (attr "prefix_0f")
424 (plus (attr "prefix_rex")
425 (plus (attr "prefix_extra")
427 (plus (attr "prefix_rep")
428 (plus (attr "prefix_data16")
429 (plus (attr "length_immediate")
430 (attr "length_address")))))))
432 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
433 ;; `store' if there is a simple memory reference therein, or `unknown'
434 ;; if the instruction is complex.
436 (define_attr "memory" "none,load,store,both,unknown"
437 (cond [(eq_attr "type" "other,multi,str")
438 (const_string "unknown")
439 (eq_attr "type" "lea,fcmov,fpspc")
440 (const_string "none")
441 (eq_attr "type" "fistp,leave")
442 (const_string "both")
443 (eq_attr "type" "frndint")
444 (const_string "load")
445 (eq_attr "type" "push")
446 (if_then_else (match_operand 1 "memory_operand" "")
447 (const_string "both")
448 (const_string "store"))
449 (eq_attr "type" "pop")
450 (if_then_else (match_operand 0 "memory_operand" "")
451 (const_string "both")
452 (const_string "load"))
453 (eq_attr "type" "setcc")
454 (if_then_else (match_operand 0 "memory_operand" "")
455 (const_string "store")
456 (const_string "none"))
457 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
458 (if_then_else (ior (match_operand 0 "memory_operand" "")
459 (match_operand 1 "memory_operand" ""))
460 (const_string "load")
461 (const_string "none"))
462 (eq_attr "type" "ibr")
463 (if_then_else (match_operand 0 "memory_operand" "")
464 (const_string "load")
465 (const_string "none"))
466 (eq_attr "type" "call")
467 (if_then_else (match_operand 0 "constant_call_address_operand" "")
468 (const_string "none")
469 (const_string "load"))
470 (eq_attr "type" "callv")
471 (if_then_else (match_operand 1 "constant_call_address_operand" "")
472 (const_string "none")
473 (const_string "load"))
474 (and (eq_attr "type" "alu1,negnot,ishift1,sselog1")
475 (match_operand 1 "memory_operand" ""))
476 (const_string "both")
477 (and (match_operand 0 "memory_operand" "")
478 (match_operand 1 "memory_operand" ""))
479 (const_string "both")
480 (match_operand 0 "memory_operand" "")
481 (const_string "store")
482 (match_operand 1 "memory_operand" "")
483 (const_string "load")
485 "!alu1,negnot,ishift1,
486 imov,imovx,icmp,test,bitmanip,
488 sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,
489 sseiadd1,mmx,mmxmov,mmxcmp,mmxcvt")
490 (match_operand 2 "memory_operand" ""))
491 (const_string "load")
492 (and (eq_attr "type" "icmov,ssemuladd,sse4arg")
493 (match_operand 3 "memory_operand" ""))
494 (const_string "load")
496 (const_string "none")))
498 ;; Indicates if an instruction has both an immediate and a displacement.
500 (define_attr "imm_disp" "false,true,unknown"
501 (cond [(eq_attr "type" "other,multi")
502 (const_string "unknown")
503 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
504 (and (match_operand 0 "memory_displacement_operand" "")
505 (match_operand 1 "immediate_operand" "")))
506 (const_string "true")
507 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
508 (and (match_operand 0 "memory_displacement_operand" "")
509 (match_operand 2 "immediate_operand" "")))
510 (const_string "true")
512 (const_string "false")))
514 ;; Indicates if an FP operation has an integer source.
516 (define_attr "fp_int_src" "false,true"
517 (const_string "false"))
519 ;; Defines rounding mode of an FP operation.
521 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
522 (const_string "any"))
524 ;; Describe a user's asm statement.
525 (define_asm_attributes
526 [(set_attr "length" "128")
527 (set_attr "type" "multi")])
529 ;; All integer comparison codes.
530 (define_code_iterator int_cond [ne eq ge gt le lt geu gtu leu ltu ])
532 ;; All floating-point comparison codes.
533 (define_code_iterator fp_cond [unordered ordered
534 uneq unge ungt unle unlt ltgt ])
536 (define_code_iterator plusminus [plus minus])
538 ;; Base name for define_insn and insn mnemonic.
539 (define_code_attr addsub [(plus "add") (minus "sub")])
541 ;; Mark commutative operators as such in constraints.
542 (define_code_attr comm [(plus "%") (minus "")])
544 ;; Mapping of signed max and min
545 (define_code_iterator smaxmin [smax smin])
547 ;; Mapping of unsigned max and min
548 (define_code_iterator umaxmin [umax umin])
550 ;; Base name for integer and FP insn mnemonic
551 (define_code_attr maxminiprefix [(smax "maxs") (smin "mins") (umax "maxu") (umin "minu")])
552 (define_code_attr maxminfprefix [(smax "max") (smin "min")])
554 ;; Mapping of parallel logic operators
555 (define_code_iterator plogic [and ior xor])
557 ;; Base name for insn mnemonic.
558 (define_code_attr plogicprefix [(and "and") (ior "or") (xor "xor")])
560 ;; All single word integer modes.
561 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
563 ;; Instruction suffix for integer modes.
564 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
566 ;; Register class for integer modes.
567 (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")])
569 ;; Immediate operand constraint for integer modes.
570 (define_mode_attr i [(QI "i") (HI "i") (SI "i") (DI "e")])
572 ;; General operand predicate for integer modes.
573 (define_mode_attr general_operand
574 [(QI "general_operand")
575 (HI "general_operand")
576 (SI "general_operand")
577 (DI "x86_64_general_operand")])
579 ;; SSE and x87 SFmode and DFmode floating point modes
580 (define_mode_iterator MODEF [SF DF])
582 ;; All x87 floating point modes
583 (define_mode_iterator X87MODEF [SF DF XF])
585 ;; All integer modes handled by x87 fisttp operator.
586 (define_mode_iterator X87MODEI [HI SI DI])
588 ;; All integer modes handled by integer x87 operators.
589 (define_mode_iterator X87MODEI12 [HI SI])
591 ;; All integer modes handled by SSE cvtts?2si* operators.
592 (define_mode_iterator SSEMODEI24 [SI DI])
594 ;; SSE asm suffix for floating point modes
595 (define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
597 ;; SSE vector mode corresponding to a scalar mode
598 (define_mode_attr ssevecmode
599 [(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (SF "V4SF") (DF "V2DF")])
601 ;; Instruction suffix for REX 64bit operators.
602 (define_mode_attr rex64suffix [(SI "") (DI "{q}")])
604 ;; Scheduling descriptions
606 (include "pentium.md")
609 (include "athlon.md")
613 ;; Operand and operator predicates and constraints
615 (include "predicates.md")
616 (include "constraints.md")
619 ;; Compare instructions.
621 ;; All compare insns have expanders that save the operands away without
622 ;; actually generating RTL. The bCOND or sCOND (emitted immediately
623 ;; after the cmp) will actually emit the cmpM.
625 (define_expand "cmpti"
626 [(set (reg:CC FLAGS_REG)
627 (compare:CC (match_operand:TI 0 "nonimmediate_operand" "")
628 (match_operand:TI 1 "x86_64_general_operand" "")))]
631 if (MEM_P (operands[0]) && MEM_P (operands[1]))
632 operands[0] = force_reg (TImode, operands[0]);
633 ix86_compare_op0 = operands[0];
634 ix86_compare_op1 = operands[1];
638 (define_expand "cmpdi"
639 [(set (reg:CC FLAGS_REG)
640 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
641 (match_operand:DI 1 "x86_64_general_operand" "")))]
644 if (MEM_P (operands[0]) && MEM_P (operands[1]))
645 operands[0] = force_reg (DImode, operands[0]);
646 ix86_compare_op0 = operands[0];
647 ix86_compare_op1 = operands[1];
651 (define_expand "cmpsi"
652 [(set (reg:CC FLAGS_REG)
653 (compare:CC (match_operand:SI 0 "cmpsi_operand" "")
654 (match_operand:SI 1 "general_operand" "")))]
657 if (MEM_P (operands[0]) && MEM_P (operands[1]))
658 operands[0] = force_reg (SImode, operands[0]);
659 ix86_compare_op0 = operands[0];
660 ix86_compare_op1 = operands[1];
664 (define_expand "cmphi"
665 [(set (reg:CC FLAGS_REG)
666 (compare:CC (match_operand:HI 0 "nonimmediate_operand" "")
667 (match_operand:HI 1 "general_operand" "")))]
670 if (MEM_P (operands[0]) && MEM_P (operands[1]))
671 operands[0] = force_reg (HImode, operands[0]);
672 ix86_compare_op0 = operands[0];
673 ix86_compare_op1 = operands[1];
677 (define_expand "cmpqi"
678 [(set (reg:CC FLAGS_REG)
679 (compare:CC (match_operand:QI 0 "nonimmediate_operand" "")
680 (match_operand:QI 1 "general_operand" "")))]
683 if (MEM_P (operands[0]) && MEM_P (operands[1]))
684 operands[0] = force_reg (QImode, operands[0]);
685 ix86_compare_op0 = operands[0];
686 ix86_compare_op1 = operands[1];
690 (define_insn "cmpdi_ccno_1_rex64"
691 [(set (reg FLAGS_REG)
692 (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr")
693 (match_operand:DI 1 "const0_operand" "n,n")))]
694 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
697 cmp{q}\t{%1, %0|%0, %1}"
698 [(set_attr "type" "test,icmp")
699 (set_attr "length_immediate" "0,1")
700 (set_attr "mode" "DI")])
702 (define_insn "*cmpdi_minus_1_rex64"
703 [(set (reg FLAGS_REG)
704 (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r")
705 (match_operand:DI 1 "x86_64_general_operand" "re,mr"))
707 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)"
708 "cmp{q}\t{%1, %0|%0, %1}"
709 [(set_attr "type" "icmp")
710 (set_attr "mode" "DI")])
712 (define_expand "cmpdi_1_rex64"
713 [(set (reg:CC FLAGS_REG)
714 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
715 (match_operand:DI 1 "general_operand" "")))]
719 (define_insn "cmpdi_1_insn_rex64"
720 [(set (reg FLAGS_REG)
721 (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r")
722 (match_operand:DI 1 "x86_64_general_operand" "re,mr")))]
723 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
724 "cmp{q}\t{%1, %0|%0, %1}"
725 [(set_attr "type" "icmp")
726 (set_attr "mode" "DI")])
729 (define_insn "*cmpsi_ccno_1"
730 [(set (reg FLAGS_REG)
731 (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr")
732 (match_operand:SI 1 "const0_operand" "n,n")))]
733 "ix86_match_ccmode (insn, CCNOmode)"
736 cmp{l}\t{%1, %0|%0, %1}"
737 [(set_attr "type" "test,icmp")
738 (set_attr "length_immediate" "0,1")
739 (set_attr "mode" "SI")])
741 (define_insn "*cmpsi_minus_1"
742 [(set (reg FLAGS_REG)
743 (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r")
744 (match_operand:SI 1 "general_operand" "ri,mr"))
746 "ix86_match_ccmode (insn, CCGOCmode)"
747 "cmp{l}\t{%1, %0|%0, %1}"
748 [(set_attr "type" "icmp")
749 (set_attr "mode" "SI")])
751 (define_expand "cmpsi_1"
752 [(set (reg:CC FLAGS_REG)
753 (compare:CC (match_operand:SI 0 "nonimmediate_operand" "")
754 (match_operand:SI 1 "general_operand" "")))]
758 (define_insn "*cmpsi_1_insn"
759 [(set (reg FLAGS_REG)
760 (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r")
761 (match_operand:SI 1 "general_operand" "ri,mr")))]
762 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
763 && ix86_match_ccmode (insn, CCmode)"
764 "cmp{l}\t{%1, %0|%0, %1}"
765 [(set_attr "type" "icmp")
766 (set_attr "mode" "SI")])
768 (define_insn "*cmphi_ccno_1"
769 [(set (reg FLAGS_REG)
770 (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr")
771 (match_operand:HI 1 "const0_operand" "n,n")))]
772 "ix86_match_ccmode (insn, CCNOmode)"
775 cmp{w}\t{%1, %0|%0, %1}"
776 [(set_attr "type" "test,icmp")
777 (set_attr "length_immediate" "0,1")
778 (set_attr "mode" "HI")])
780 (define_insn "*cmphi_minus_1"
781 [(set (reg FLAGS_REG)
782 (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r")
783 (match_operand:HI 1 "general_operand" "ri,mr"))
785 "ix86_match_ccmode (insn, CCGOCmode)"
786 "cmp{w}\t{%1, %0|%0, %1}"
787 [(set_attr "type" "icmp")
788 (set_attr "mode" "HI")])
790 (define_insn "*cmphi_1"
791 [(set (reg FLAGS_REG)
792 (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r")
793 (match_operand:HI 1 "general_operand" "ri,mr")))]
794 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
795 && ix86_match_ccmode (insn, CCmode)"
796 "cmp{w}\t{%1, %0|%0, %1}"
797 [(set_attr "type" "icmp")
798 (set_attr "mode" "HI")])
800 (define_insn "*cmpqi_ccno_1"
801 [(set (reg FLAGS_REG)
802 (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq")
803 (match_operand:QI 1 "const0_operand" "n,n")))]
804 "ix86_match_ccmode (insn, CCNOmode)"
807 cmp{b}\t{$0, %0|%0, 0}"
808 [(set_attr "type" "test,icmp")
809 (set_attr "length_immediate" "0,1")
810 (set_attr "mode" "QI")])
812 (define_insn "*cmpqi_1"
813 [(set (reg FLAGS_REG)
814 (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q")
815 (match_operand:QI 1 "general_operand" "qi,mq")))]
816 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
817 && ix86_match_ccmode (insn, CCmode)"
818 "cmp{b}\t{%1, %0|%0, %1}"
819 [(set_attr "type" "icmp")
820 (set_attr "mode" "QI")])
822 (define_insn "*cmpqi_minus_1"
823 [(set (reg FLAGS_REG)
824 (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q")
825 (match_operand:QI 1 "general_operand" "qi,mq"))
827 "ix86_match_ccmode (insn, CCGOCmode)"
828 "cmp{b}\t{%1, %0|%0, %1}"
829 [(set_attr "type" "icmp")
830 (set_attr "mode" "QI")])
832 (define_insn "*cmpqi_ext_1"
833 [(set (reg FLAGS_REG)
835 (match_operand:QI 0 "general_operand" "Qm")
838 (match_operand 1 "ext_register_operand" "Q")
841 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
842 "cmp{b}\t{%h1, %0|%0, %h1}"
843 [(set_attr "type" "icmp")
844 (set_attr "mode" "QI")])
846 (define_insn "*cmpqi_ext_1_rex64"
847 [(set (reg FLAGS_REG)
849 (match_operand:QI 0 "register_operand" "Q")
852 (match_operand 1 "ext_register_operand" "Q")
855 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
856 "cmp{b}\t{%h1, %0|%0, %h1}"
857 [(set_attr "type" "icmp")
858 (set_attr "mode" "QI")])
860 (define_insn "*cmpqi_ext_2"
861 [(set (reg FLAGS_REG)
865 (match_operand 0 "ext_register_operand" "Q")
868 (match_operand:QI 1 "const0_operand" "n")))]
869 "ix86_match_ccmode (insn, CCNOmode)"
871 [(set_attr "type" "test")
872 (set_attr "length_immediate" "0")
873 (set_attr "mode" "QI")])
875 (define_expand "cmpqi_ext_3"
876 [(set (reg:CC FLAGS_REG)
880 (match_operand 0 "ext_register_operand" "")
883 (match_operand:QI 1 "general_operand" "")))]
887 (define_insn "cmpqi_ext_3_insn"
888 [(set (reg FLAGS_REG)
892 (match_operand 0 "ext_register_operand" "Q")
895 (match_operand:QI 1 "general_operand" "Qmn")))]
896 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
897 "cmp{b}\t{%1, %h0|%h0, %1}"
898 [(set_attr "type" "icmp")
899 (set_attr "mode" "QI")])
901 (define_insn "cmpqi_ext_3_insn_rex64"
902 [(set (reg FLAGS_REG)
906 (match_operand 0 "ext_register_operand" "Q")
909 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
910 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
911 "cmp{b}\t{%1, %h0|%h0, %1}"
912 [(set_attr "type" "icmp")
913 (set_attr "mode" "QI")])
915 (define_insn "*cmpqi_ext_4"
916 [(set (reg FLAGS_REG)
920 (match_operand 0 "ext_register_operand" "Q")
925 (match_operand 1 "ext_register_operand" "Q")
928 "ix86_match_ccmode (insn, CCmode)"
929 "cmp{b}\t{%h1, %h0|%h0, %h1}"
930 [(set_attr "type" "icmp")
931 (set_attr "mode" "QI")])
933 ;; These implement float point compares.
934 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
935 ;; which would allow mix and match FP modes on the compares. Which is what
936 ;; the old patterns did, but with many more of them.
938 (define_expand "cmpxf"
939 [(set (reg:CC FLAGS_REG)
940 (compare:CC (match_operand:XF 0 "nonmemory_operand" "")
941 (match_operand:XF 1 "nonmemory_operand" "")))]
944 ix86_compare_op0 = operands[0];
945 ix86_compare_op1 = operands[1];
949 (define_expand "cmp<mode>"
950 [(set (reg:CC FLAGS_REG)
951 (compare:CC (match_operand:MODEF 0 "cmp_fp_expander_operand" "")
952 (match_operand:MODEF 1 "cmp_fp_expander_operand" "")))]
953 "TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
955 ix86_compare_op0 = operands[0];
956 ix86_compare_op1 = operands[1];
960 ;; FP compares, step 1:
961 ;; Set the FP condition codes.
963 ;; CCFPmode compare with exceptions
964 ;; CCFPUmode compare with no exceptions
966 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
967 ;; used to manage the reg stack popping would not be preserved.
969 (define_insn "*cmpfp_0"
970 [(set (match_operand:HI 0 "register_operand" "=a")
973 (match_operand 1 "register_operand" "f")
974 (match_operand 2 "const0_operand" "X"))]
976 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
977 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
978 "* return output_fp_compare (insn, operands, 0, 0);"
979 [(set_attr "type" "multi")
980 (set_attr "unit" "i387")
982 (cond [(match_operand:SF 1 "" "")
984 (match_operand:DF 1 "" "")
987 (const_string "XF")))])
989 (define_insn_and_split "*cmpfp_0_cc"
990 [(set (reg:CCFP FLAGS_REG)
992 (match_operand 1 "register_operand" "f")
993 (match_operand 2 "const0_operand" "X")))
994 (clobber (match_operand:HI 0 "register_operand" "=a"))]
995 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
996 && TARGET_SAHF && !TARGET_CMOVE
997 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
999 "&& reload_completed"
1002 [(compare:CCFP (match_dup 1)(match_dup 2))]
1004 (set (reg:CC FLAGS_REG)
1005 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1007 [(set_attr "type" "multi")
1008 (set_attr "unit" "i387")
1010 (cond [(match_operand:SF 1 "" "")
1012 (match_operand:DF 1 "" "")
1015 (const_string "XF")))])
1017 (define_insn "*cmpfp_xf"
1018 [(set (match_operand:HI 0 "register_operand" "=a")
1021 (match_operand:XF 1 "register_operand" "f")
1022 (match_operand:XF 2 "register_operand" "f"))]
1025 "* return output_fp_compare (insn, operands, 0, 0);"
1026 [(set_attr "type" "multi")
1027 (set_attr "unit" "i387")
1028 (set_attr "mode" "XF")])
1030 (define_insn_and_split "*cmpfp_xf_cc"
1031 [(set (reg:CCFP FLAGS_REG)
1033 (match_operand:XF 1 "register_operand" "f")
1034 (match_operand:XF 2 "register_operand" "f")))
1035 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1037 && TARGET_SAHF && !TARGET_CMOVE"
1039 "&& reload_completed"
1042 [(compare:CCFP (match_dup 1)(match_dup 2))]
1044 (set (reg:CC FLAGS_REG)
1045 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1047 [(set_attr "type" "multi")
1048 (set_attr "unit" "i387")
1049 (set_attr "mode" "XF")])
1051 (define_insn "*cmpfp_<mode>"
1052 [(set (match_operand:HI 0 "register_operand" "=a")
1055 (match_operand:MODEF 1 "register_operand" "f")
1056 (match_operand:MODEF 2 "nonimmediate_operand" "fm"))]
1059 "* return output_fp_compare (insn, operands, 0, 0);"
1060 [(set_attr "type" "multi")
1061 (set_attr "unit" "i387")
1062 (set_attr "mode" "<MODE>")])
1064 (define_insn_and_split "*cmpfp_<mode>_cc"
1065 [(set (reg:CCFP FLAGS_REG)
1067 (match_operand:MODEF 1 "register_operand" "f")
1068 (match_operand:MODEF 2 "nonimmediate_operand" "fm")))
1069 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1071 && TARGET_SAHF && !TARGET_CMOVE"
1073 "&& reload_completed"
1076 [(compare:CCFP (match_dup 1)(match_dup 2))]
1078 (set (reg:CC FLAGS_REG)
1079 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1081 [(set_attr "type" "multi")
1082 (set_attr "unit" "i387")
1083 (set_attr "mode" "<MODE>")])
1085 (define_insn "*cmpfp_u"
1086 [(set (match_operand:HI 0 "register_operand" "=a")
1089 (match_operand 1 "register_operand" "f")
1090 (match_operand 2 "register_operand" "f"))]
1092 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1093 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1094 "* return output_fp_compare (insn, operands, 0, 1);"
1095 [(set_attr "type" "multi")
1096 (set_attr "unit" "i387")
1098 (cond [(match_operand:SF 1 "" "")
1100 (match_operand:DF 1 "" "")
1103 (const_string "XF")))])
1105 (define_insn_and_split "*cmpfp_u_cc"
1106 [(set (reg:CCFPU FLAGS_REG)
1108 (match_operand 1 "register_operand" "f")
1109 (match_operand 2 "register_operand" "f")))
1110 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1111 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1112 && TARGET_SAHF && !TARGET_CMOVE
1113 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
1115 "&& reload_completed"
1118 [(compare:CCFPU (match_dup 1)(match_dup 2))]
1120 (set (reg:CC FLAGS_REG)
1121 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1123 [(set_attr "type" "multi")
1124 (set_attr "unit" "i387")
1126 (cond [(match_operand:SF 1 "" "")
1128 (match_operand:DF 1 "" "")
1131 (const_string "XF")))])
1133 (define_insn "*cmpfp_<mode>"
1134 [(set (match_operand:HI 0 "register_operand" "=a")
1137 (match_operand 1 "register_operand" "f")
1138 (match_operator 3 "float_operator"
1139 [(match_operand:X87MODEI12 2 "memory_operand" "m")]))]
1141 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1142 && TARGET_USE_<MODE>MODE_FIOP
1143 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1144 "* return output_fp_compare (insn, operands, 0, 0);"
1145 [(set_attr "type" "multi")
1146 (set_attr "unit" "i387")
1147 (set_attr "fp_int_src" "true")
1148 (set_attr "mode" "<MODE>")])
1150 (define_insn_and_split "*cmpfp_<mode>_cc"
1151 [(set (reg:CCFP FLAGS_REG)
1153 (match_operand 1 "register_operand" "f")
1154 (match_operator 3 "float_operator"
1155 [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
1156 (clobber (match_operand:HI 0 "register_operand" "=a"))]
1157 "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
1158 && TARGET_SAHF && !TARGET_CMOVE
1159 && TARGET_USE_<MODE>MODE_FIOP
1160 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
1162 "&& reload_completed"
1167 (match_op_dup 3 [(match_dup 2)]))]
1169 (set (reg:CC FLAGS_REG)
1170 (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
1172 [(set_attr "type" "multi")
1173 (set_attr "unit" "i387")
1174 (set_attr "fp_int_src" "true")
1175 (set_attr "mode" "<MODE>")])
1177 ;; FP compares, step 2
1178 ;; Move the fpsw to ax.
1180 (define_insn "x86_fnstsw_1"
1181 [(set (match_operand:HI 0 "register_operand" "=a")
1182 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
1185 [(set_attr "length" "2")
1186 (set_attr "mode" "SI")
1187 (set_attr "unit" "i387")])
1189 ;; FP compares, step 3
1190 ;; Get ax into flags, general case.
1192 (define_insn "x86_sahf_1"
1193 [(set (reg:CC FLAGS_REG)
1194 (unspec:CC [(match_operand:HI 0 "register_operand" "a")]
1198 #ifdef HAVE_AS_IX86_SAHF
1201 return ".byte\t0x9e";
1204 [(set_attr "length" "1")
1205 (set_attr "athlon_decode" "vector")
1206 (set_attr "amdfam10_decode" "direct")
1207 (set_attr "mode" "SI")])
1209 ;; Pentium Pro can do steps 1 through 3 in one go.
1210 ;; comi*, ucomi*, fcomi*, ficomi*,fucomi* (i387 instructions set condition codes)
1211 (define_insn "*cmpfp_i_mixed"
1212 [(set (reg:CCFP FLAGS_REG)
1213 (compare:CCFP (match_operand 0 "register_operand" "f,x")
1214 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1215 "TARGET_MIX_SSE_I387
1216 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1217 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1218 "* return output_fp_compare (insn, operands, 1, 0);"
1219 [(set_attr "type" "fcmp,ssecomi")
1221 (if_then_else (match_operand:SF 1 "" "")
1223 (const_string "DF")))
1224 (set_attr "athlon_decode" "vector")
1225 (set_attr "amdfam10_decode" "direct")])
1227 (define_insn "*cmpfp_i_sse"
1228 [(set (reg:CCFP FLAGS_REG)
1229 (compare:CCFP (match_operand 0 "register_operand" "x")
1230 (match_operand 1 "nonimmediate_operand" "xm")))]
1232 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1233 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1234 "* return output_fp_compare (insn, operands, 1, 0);"
1235 [(set_attr "type" "ssecomi")
1237 (if_then_else (match_operand:SF 1 "" "")
1239 (const_string "DF")))
1240 (set_attr "athlon_decode" "vector")
1241 (set_attr "amdfam10_decode" "direct")])
1243 (define_insn "*cmpfp_i_i387"
1244 [(set (reg:CCFP FLAGS_REG)
1245 (compare:CCFP (match_operand 0 "register_operand" "f")
1246 (match_operand 1 "register_operand" "f")))]
1247 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1249 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1250 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1251 "* return output_fp_compare (insn, operands, 1, 0);"
1252 [(set_attr "type" "fcmp")
1254 (cond [(match_operand:SF 1 "" "")
1256 (match_operand:DF 1 "" "")
1259 (const_string "XF")))
1260 (set_attr "athlon_decode" "vector")
1261 (set_attr "amdfam10_decode" "direct")])
1263 (define_insn "*cmpfp_iu_mixed"
1264 [(set (reg:CCFPU FLAGS_REG)
1265 (compare:CCFPU (match_operand 0 "register_operand" "f,x")
1266 (match_operand 1 "nonimmediate_operand" "f,xm")))]
1267 "TARGET_MIX_SSE_I387
1268 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1269 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1270 "* return output_fp_compare (insn, operands, 1, 1);"
1271 [(set_attr "type" "fcmp,ssecomi")
1273 (if_then_else (match_operand:SF 1 "" "")
1275 (const_string "DF")))
1276 (set_attr "athlon_decode" "vector")
1277 (set_attr "amdfam10_decode" "direct")])
1279 (define_insn "*cmpfp_iu_sse"
1280 [(set (reg:CCFPU FLAGS_REG)
1281 (compare:CCFPU (match_operand 0 "register_operand" "x")
1282 (match_operand 1 "nonimmediate_operand" "xm")))]
1284 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1285 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1286 "* return output_fp_compare (insn, operands, 1, 1);"
1287 [(set_attr "type" "ssecomi")
1289 (if_then_else (match_operand:SF 1 "" "")
1291 (const_string "DF")))
1292 (set_attr "athlon_decode" "vector")
1293 (set_attr "amdfam10_decode" "direct")])
1295 (define_insn "*cmpfp_iu_387"
1296 [(set (reg:CCFPU FLAGS_REG)
1297 (compare:CCFPU (match_operand 0 "register_operand" "f")
1298 (match_operand 1 "register_operand" "f")))]
1299 "X87_FLOAT_MODE_P (GET_MODE (operands[0]))
1301 && !(SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && TARGET_SSE_MATH)
1302 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1303 "* return output_fp_compare (insn, operands, 1, 1);"
1304 [(set_attr "type" "fcmp")
1306 (cond [(match_operand:SF 1 "" "")
1308 (match_operand:DF 1 "" "")
1311 (const_string "XF")))
1312 (set_attr "athlon_decode" "vector")
1313 (set_attr "amdfam10_decode" "direct")])
1315 ;; Move instructions.
1317 ;; General case of fullword move.
1319 (define_expand "movsi"
1320 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1321 (match_operand:SI 1 "general_operand" ""))]
1323 "ix86_expand_move (SImode, operands); DONE;")
1325 ;; Push/pop instructions. They are separate since autoinc/dec is not a
1328 ;; %%% We don't use a post-inc memory reference because x86 is not a
1329 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1330 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1331 ;; targets without our curiosities, and it is just as easy to represent
1332 ;; this differently.
1334 (define_insn "*pushsi2"
1335 [(set (match_operand:SI 0 "push_operand" "=<")
1336 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1339 [(set_attr "type" "push")
1340 (set_attr "mode" "SI")])
1342 ;; For 64BIT abi we always round up to 8 bytes.
1343 (define_insn "*pushsi2_rex64"
1344 [(set (match_operand:SI 0 "push_operand" "=X")
1345 (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1348 [(set_attr "type" "push")
1349 (set_attr "mode" "SI")])
1351 (define_insn "*pushsi2_prologue"
1352 [(set (match_operand:SI 0 "push_operand" "=<")
1353 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1354 (clobber (mem:BLK (scratch)))]
1357 [(set_attr "type" "push")
1358 (set_attr "mode" "SI")])
1360 (define_insn "*popsi1_epilogue"
1361 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1362 (mem:SI (reg:SI SP_REG)))
1363 (set (reg:SI SP_REG)
1364 (plus:SI (reg:SI SP_REG) (const_int 4)))
1365 (clobber (mem:BLK (scratch)))]
1368 [(set_attr "type" "pop")
1369 (set_attr "mode" "SI")])
1371 (define_insn "popsi1"
1372 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1373 (mem:SI (reg:SI SP_REG)))
1374 (set (reg:SI SP_REG)
1375 (plus:SI (reg:SI SP_REG) (const_int 4)))]
1378 [(set_attr "type" "pop")
1379 (set_attr "mode" "SI")])
1381 (define_insn "*movsi_xor"
1382 [(set (match_operand:SI 0 "register_operand" "=r")
1383 (match_operand:SI 1 "const0_operand" "i"))
1384 (clobber (reg:CC FLAGS_REG))]
1385 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1387 [(set_attr "type" "alu1")
1388 (set_attr "mode" "SI")
1389 (set_attr "length_immediate" "0")])
1391 (define_insn "*movsi_or"
1392 [(set (match_operand:SI 0 "register_operand" "=r")
1393 (match_operand:SI 1 "immediate_operand" "i"))
1394 (clobber (reg:CC FLAGS_REG))]
1396 && operands[1] == constm1_rtx
1397 && (TARGET_MOVE_M1_VIA_OR || optimize_size)"
1399 operands[1] = constm1_rtx;
1400 return "or{l}\t{%1, %0|%0, %1}";
1402 [(set_attr "type" "alu1")
1403 (set_attr "mode" "SI")
1404 (set_attr "length_immediate" "1")])
1406 (define_insn "*movsi_1"
1407 [(set (match_operand:SI 0 "nonimmediate_operand"
1408 "=r ,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
1409 (match_operand:SI 1 "general_operand"
1410 "rinm,rin,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))]
1411 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1413 switch (get_attr_type (insn))
1416 if (get_attr_mode (insn) == MODE_TI)
1417 return "pxor\t%0, %0";
1418 return "xorps\t%0, %0";
1421 switch (get_attr_mode (insn))
1424 return "movdqa\t{%1, %0|%0, %1}";
1426 return "movaps\t{%1, %0|%0, %1}";
1428 return "movd\t{%1, %0|%0, %1}";
1430 return "movss\t{%1, %0|%0, %1}";
1436 return "pxor\t%0, %0";
1439 if (get_attr_mode (insn) == MODE_DI)
1440 return "movq\t{%1, %0|%0, %1}";
1441 return "movd\t{%1, %0|%0, %1}";
1444 return "lea{l}\t{%1, %0|%0, %1}";
1447 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
1448 return "mov{l}\t{%1, %0|%0, %1}";
1452 (cond [(eq_attr "alternative" "2")
1453 (const_string "mmxadd")
1454 (eq_attr "alternative" "3,4,5")
1455 (const_string "mmxmov")
1456 (eq_attr "alternative" "6")
1457 (const_string "sselog1")
1458 (eq_attr "alternative" "7,8,9,10,11")
1459 (const_string "ssemov")
1460 (match_operand:DI 1 "pic_32bit_operand" "")
1461 (const_string "lea")
1463 (const_string "imov")))
1465 (cond [(eq_attr "alternative" "2,3")
1467 (eq_attr "alternative" "6,7")
1469 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
1470 (const_string "V4SF")
1471 (const_string "TI"))
1472 (and (eq_attr "alternative" "8,9,10,11")
1473 (eq (symbol_ref "TARGET_SSE2") (const_int 0)))
1476 (const_string "SI")))])
1478 ;; Stores and loads of ax to arbitrary constant address.
1479 ;; We fake an second form of instruction to force reload to load address
1480 ;; into register when rax is not available
1481 (define_insn "*movabssi_1_rex64"
1482 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1483 (match_operand:SI 1 "nonmemory_operand" "a,er"))]
1484 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1486 movabs{l}\t{%1, %P0|%P0, %1}
1487 mov{l}\t{%1, %a0|%a0, %1}"
1488 [(set_attr "type" "imov")
1489 (set_attr "modrm" "0,*")
1490 (set_attr "length_address" "8,0")
1491 (set_attr "length_immediate" "0,*")
1492 (set_attr "memory" "store")
1493 (set_attr "mode" "SI")])
1495 (define_insn "*movabssi_2_rex64"
1496 [(set (match_operand:SI 0 "register_operand" "=a,r")
1497 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1498 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1500 movabs{l}\t{%P1, %0|%0, %P1}
1501 mov{l}\t{%a1, %0|%0, %a1}"
1502 [(set_attr "type" "imov")
1503 (set_attr "modrm" "0,*")
1504 (set_attr "length_address" "8,0")
1505 (set_attr "length_immediate" "0")
1506 (set_attr "memory" "load")
1507 (set_attr "mode" "SI")])
1509 (define_insn "*swapsi"
1510 [(set (match_operand:SI 0 "register_operand" "+r")
1511 (match_operand:SI 1 "register_operand" "+r"))
1516 [(set_attr "type" "imov")
1517 (set_attr "mode" "SI")
1518 (set_attr "pent_pair" "np")
1519 (set_attr "athlon_decode" "vector")
1520 (set_attr "amdfam10_decode" "double")])
1522 (define_expand "movhi"
1523 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1524 (match_operand:HI 1 "general_operand" ""))]
1526 "ix86_expand_move (HImode, operands); DONE;")
1528 (define_insn "*pushhi2"
1529 [(set (match_operand:HI 0 "push_operand" "=X")
1530 (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))]
1533 [(set_attr "type" "push")
1534 (set_attr "mode" "SI")])
1536 ;; For 64BIT abi we always round up to 8 bytes.
1537 (define_insn "*pushhi2_rex64"
1538 [(set (match_operand:HI 0 "push_operand" "=X")
1539 (match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))]
1542 [(set_attr "type" "push")
1543 (set_attr "mode" "DI")])
1545 (define_insn "*movhi_1"
1546 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
1547 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
1548 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1550 switch (get_attr_type (insn))
1553 /* movzwl is faster than movw on p2 due to partial word stalls,
1554 though not as fast as an aligned movl. */
1555 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1557 if (get_attr_mode (insn) == MODE_SI)
1558 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1560 return "mov{w}\t{%1, %0|%0, %1}";
1564 (cond [(ne (symbol_ref "optimize_size") (const_int 0))
1565 (const_string "imov")
1566 (and (eq_attr "alternative" "0")
1567 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1569 (eq (symbol_ref "TARGET_HIMODE_MATH")
1571 (const_string "imov")
1572 (and (eq_attr "alternative" "1,2")
1573 (match_operand:HI 1 "aligned_operand" ""))
1574 (const_string "imov")
1575 (and (ne (symbol_ref "TARGET_MOVX")
1577 (eq_attr "alternative" "0,2"))
1578 (const_string "imovx")
1580 (const_string "imov")))
1582 (cond [(eq_attr "type" "imovx")
1584 (and (eq_attr "alternative" "1,2")
1585 (match_operand:HI 1 "aligned_operand" ""))
1587 (and (eq_attr "alternative" "0")
1588 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1590 (eq (symbol_ref "TARGET_HIMODE_MATH")
1594 (const_string "HI")))])
1596 ;; Stores and loads of ax to arbitrary constant address.
1597 ;; We fake an second form of instruction to force reload to load address
1598 ;; into register when rax is not available
1599 (define_insn "*movabshi_1_rex64"
1600 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1601 (match_operand:HI 1 "nonmemory_operand" "a,er"))]
1602 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1604 movabs{w}\t{%1, %P0|%P0, %1}
1605 mov{w}\t{%1, %a0|%a0, %1}"
1606 [(set_attr "type" "imov")
1607 (set_attr "modrm" "0,*")
1608 (set_attr "length_address" "8,0")
1609 (set_attr "length_immediate" "0,*")
1610 (set_attr "memory" "store")
1611 (set_attr "mode" "HI")])
1613 (define_insn "*movabshi_2_rex64"
1614 [(set (match_operand:HI 0 "register_operand" "=a,r")
1615 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1616 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1618 movabs{w}\t{%P1, %0|%0, %P1}
1619 mov{w}\t{%a1, %0|%0, %a1}"
1620 [(set_attr "type" "imov")
1621 (set_attr "modrm" "0,*")
1622 (set_attr "length_address" "8,0")
1623 (set_attr "length_immediate" "0")
1624 (set_attr "memory" "load")
1625 (set_attr "mode" "HI")])
1627 (define_insn "*swaphi_1"
1628 [(set (match_operand:HI 0 "register_operand" "+r")
1629 (match_operand:HI 1 "register_operand" "+r"))
1632 "!TARGET_PARTIAL_REG_STALL || optimize_size"
1634 [(set_attr "type" "imov")
1635 (set_attr "mode" "SI")
1636 (set_attr "pent_pair" "np")
1637 (set_attr "athlon_decode" "vector")
1638 (set_attr "amdfam10_decode" "double")])
1640 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
1641 (define_insn "*swaphi_2"
1642 [(set (match_operand:HI 0 "register_operand" "+r")
1643 (match_operand:HI 1 "register_operand" "+r"))
1646 "TARGET_PARTIAL_REG_STALL"
1648 [(set_attr "type" "imov")
1649 (set_attr "mode" "HI")
1650 (set_attr "pent_pair" "np")
1651 (set_attr "athlon_decode" "vector")])
1653 (define_expand "movstricthi"
1654 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1655 (match_operand:HI 1 "general_operand" ""))]
1656 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1658 /* Don't generate memory->memory moves, go through a register */
1659 if (MEM_P (operands[0]) && MEM_P (operands[1]))
1660 operands[1] = force_reg (HImode, operands[1]);
1663 (define_insn "*movstricthi_1"
1664 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1665 (match_operand:HI 1 "general_operand" "rn,m"))]
1666 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1667 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1668 "mov{w}\t{%1, %0|%0, %1}"
1669 [(set_attr "type" "imov")
1670 (set_attr "mode" "HI")])
1672 (define_insn "*movstricthi_xor"
1673 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1674 (match_operand:HI 1 "const0_operand" "i"))
1675 (clobber (reg:CC FLAGS_REG))]
1677 && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"
1679 [(set_attr "type" "alu1")
1680 (set_attr "mode" "HI")
1681 (set_attr "length_immediate" "0")])
1683 (define_expand "movqi"
1684 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1685 (match_operand:QI 1 "general_operand" ""))]
1687 "ix86_expand_move (QImode, operands); DONE;")
1689 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1690 ;; "push a byte". But actually we use pushl, which has the effect
1691 ;; of rounding the amount pushed up to a word.
1693 (define_insn "*pushqi2"
1694 [(set (match_operand:QI 0 "push_operand" "=X")
1695 (match_operand:QI 1 "nonmemory_no_elim_operand" "rn"))]
1698 [(set_attr "type" "push")
1699 (set_attr "mode" "SI")])
1701 ;; For 64BIT abi we always round up to 8 bytes.
1702 (define_insn "*pushqi2_rex64"
1703 [(set (match_operand:QI 0 "push_operand" "=X")
1704 (match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))]
1707 [(set_attr "type" "push")
1708 (set_attr "mode" "DI")])
1710 ;; Situation is quite tricky about when to choose full sized (SImode) move
1711 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1712 ;; partial register dependency machines (such as AMD Athlon), where QImode
1713 ;; moves issue extra dependency and for partial register stalls machines
1714 ;; that don't use QImode patterns (and QImode move cause stall on the next
1717 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1718 ;; register stall machines with, where we use QImode instructions, since
1719 ;; partial register stall can be caused there. Then we use movzx.
1720 (define_insn "*movqi_1"
1721 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1722 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1723 "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
1725 switch (get_attr_type (insn))
1728 gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
1729 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1731 if (get_attr_mode (insn) == MODE_SI)
1732 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1734 return "mov{b}\t{%1, %0|%0, %1}";
1738 (cond [(and (eq_attr "alternative" "5")
1739 (not (match_operand:QI 1 "aligned_operand" "")))
1740 (const_string "imovx")
1741 (ne (symbol_ref "optimize_size") (const_int 0))
1742 (const_string "imov")
1743 (and (eq_attr "alternative" "3")
1744 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1746 (eq (symbol_ref "TARGET_QIMODE_MATH")
1748 (const_string "imov")
1749 (eq_attr "alternative" "3,5")
1750 (const_string "imovx")
1751 (and (ne (symbol_ref "TARGET_MOVX")
1753 (eq_attr "alternative" "2"))
1754 (const_string "imovx")
1756 (const_string "imov")))
1758 (cond [(eq_attr "alternative" "3,4,5")
1760 (eq_attr "alternative" "6")
1762 (eq_attr "type" "imovx")
1764 (and (eq_attr "type" "imov")
1765 (and (eq_attr "alternative" "0,1")
1766 (and (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
1768 (and (eq (symbol_ref "optimize_size")
1770 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1773 ;; Avoid partial register stalls when not using QImode arithmetic
1774 (and (eq_attr "type" "imov")
1775 (and (eq_attr "alternative" "0,1")
1776 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
1778 (eq (symbol_ref "TARGET_QIMODE_MATH")
1782 (const_string "QI")))])
1784 (define_expand "reload_outqi"
1785 [(parallel [(match_operand:QI 0 "" "=m")
1786 (match_operand:QI 1 "register_operand" "r")
1787 (match_operand:QI 2 "register_operand" "=&q")])]
1791 op0 = operands[0]; op1 = operands[1]; op2 = operands[2];
1793 gcc_assert (!reg_overlap_mentioned_p (op2, op0));
1794 if (! q_regs_operand (op1, QImode))
1796 emit_insn (gen_movqi (op2, op1));
1799 emit_insn (gen_movqi (op0, op1));
1803 (define_insn "*swapqi_1"
1804 [(set (match_operand:QI 0 "register_operand" "+r")
1805 (match_operand:QI 1 "register_operand" "+r"))
1808 "!TARGET_PARTIAL_REG_STALL || optimize_size"
1810 [(set_attr "type" "imov")
1811 (set_attr "mode" "SI")
1812 (set_attr "pent_pair" "np")
1813 (set_attr "athlon_decode" "vector")
1814 (set_attr "amdfam10_decode" "vector")])
1816 ;; Not added amdfam10_decode since TARGET_PARTIAL_REG_STALL is disabled for AMDFAM10
1817 (define_insn "*swapqi_2"
1818 [(set (match_operand:QI 0 "register_operand" "+q")
1819 (match_operand:QI 1 "register_operand" "+q"))
1822 "TARGET_PARTIAL_REG_STALL"
1824 [(set_attr "type" "imov")
1825 (set_attr "mode" "QI")
1826 (set_attr "pent_pair" "np")
1827 (set_attr "athlon_decode" "vector")])
1829 (define_expand "movstrictqi"
1830 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1831 (match_operand:QI 1 "general_operand" ""))]
1832 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1834 /* Don't generate memory->memory moves, go through a register. */
1835 if (MEM_P (operands[0]) && MEM_P (operands[1]))
1836 operands[1] = force_reg (QImode, operands[1]);
1839 (define_insn "*movstrictqi_1"
1840 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
1841 (match_operand:QI 1 "general_operand" "*qn,m"))]
1842 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1843 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
1844 "mov{b}\t{%1, %0|%0, %1}"
1845 [(set_attr "type" "imov")
1846 (set_attr "mode" "QI")])
1848 (define_insn "*movstrictqi_xor"
1849 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
1850 (match_operand:QI 1 "const0_operand" "i"))
1851 (clobber (reg:CC FLAGS_REG))]
1852 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1854 [(set_attr "type" "alu1")
1855 (set_attr "mode" "QI")
1856 (set_attr "length_immediate" "0")])
1858 (define_insn "*movsi_extv_1"
1859 [(set (match_operand:SI 0 "register_operand" "=R")
1860 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
1864 "movs{bl|x}\t{%h1, %0|%0, %h1}"
1865 [(set_attr "type" "imovx")
1866 (set_attr "mode" "SI")])
1868 (define_insn "*movhi_extv_1"
1869 [(set (match_operand:HI 0 "register_operand" "=R")
1870 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
1874 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
1875 [(set_attr "type" "imovx")
1876 (set_attr "mode" "SI")])
1878 (define_insn "*movqi_extv_1"
1879 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
1880 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1885 switch (get_attr_type (insn))
1888 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1890 return "mov{b}\t{%h1, %0|%0, %h1}";
1894 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1895 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1896 (ne (symbol_ref "TARGET_MOVX")
1898 (const_string "imovx")
1899 (const_string "imov")))
1901 (if_then_else (eq_attr "type" "imovx")
1903 (const_string "QI")))])
1905 (define_insn "*movqi_extv_1_rex64"
1906 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1907 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1912 switch (get_attr_type (insn))
1915 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1917 return "mov{b}\t{%h1, %0|%0, %h1}";
1921 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1922 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1923 (ne (symbol_ref "TARGET_MOVX")
1925 (const_string "imovx")
1926 (const_string "imov")))
1928 (if_then_else (eq_attr "type" "imovx")
1930 (const_string "QI")))])
1932 ;; Stores and loads of ax to arbitrary constant address.
1933 ;; We fake an second form of instruction to force reload to load address
1934 ;; into register when rax is not available
1935 (define_insn "*movabsqi_1_rex64"
1936 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1937 (match_operand:QI 1 "nonmemory_operand" "a,er"))]
1938 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1940 movabs{b}\t{%1, %P0|%P0, %1}
1941 mov{b}\t{%1, %a0|%a0, %1}"
1942 [(set_attr "type" "imov")
1943 (set_attr "modrm" "0,*")
1944 (set_attr "length_address" "8,0")
1945 (set_attr "length_immediate" "0,*")
1946 (set_attr "memory" "store")
1947 (set_attr "mode" "QI")])
1949 (define_insn "*movabsqi_2_rex64"
1950 [(set (match_operand:QI 0 "register_operand" "=a,r")
1951 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1952 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1954 movabs{b}\t{%P1, %0|%0, %P1}
1955 mov{b}\t{%a1, %0|%0, %a1}"
1956 [(set_attr "type" "imov")
1957 (set_attr "modrm" "0,*")
1958 (set_attr "length_address" "8,0")
1959 (set_attr "length_immediate" "0")
1960 (set_attr "memory" "load")
1961 (set_attr "mode" "QI")])
1963 (define_insn "*movdi_extzv_1"
1964 [(set (match_operand:DI 0 "register_operand" "=R")
1965 (zero_extract:DI (match_operand 1 "ext_register_operand" "Q")
1969 "movz{bl|x}\t{%h1, %k0|%k0, %h1}"
1970 [(set_attr "type" "imovx")
1971 (set_attr "mode" "DI")])
1973 (define_insn "*movsi_extzv_1"
1974 [(set (match_operand:SI 0 "register_operand" "=R")
1975 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
1979 "movz{bl|x}\t{%h1, %0|%0, %h1}"
1980 [(set_attr "type" "imovx")
1981 (set_attr "mode" "SI")])
1983 (define_insn "*movqi_extzv_2"
1984 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
1985 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1990 switch (get_attr_type (insn))
1993 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1995 return "mov{b}\t{%h1, %0|%0, %h1}";
1999 (if_then_else (and (match_operand:QI 0 "register_operand" "")
2000 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2001 (ne (symbol_ref "TARGET_MOVX")
2003 (const_string "imovx")
2004 (const_string "imov")))
2006 (if_then_else (eq_attr "type" "imovx")
2008 (const_string "QI")))])
2010 (define_insn "*movqi_extzv_2_rex64"
2011 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
2012 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
2017 switch (get_attr_type (insn))
2020 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
2022 return "mov{b}\t{%h1, %0|%0, %h1}";
2026 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
2027 (ne (symbol_ref "TARGET_MOVX")
2029 (const_string "imovx")
2030 (const_string "imov")))
2032 (if_then_else (eq_attr "type" "imovx")
2034 (const_string "QI")))])
2036 (define_insn "movsi_insv_1"
2037 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2040 (match_operand:SI 1 "general_operand" "Qmn"))]
2042 "mov{b}\t{%b1, %h0|%h0, %b1}"
2043 [(set_attr "type" "imov")
2044 (set_attr "mode" "QI")])
2046 (define_insn "*movsi_insv_1_rex64"
2047 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2050 (match_operand:SI 1 "nonmemory_operand" "Qn"))]
2052 "mov{b}\t{%b1, %h0|%h0, %b1}"
2053 [(set_attr "type" "imov")
2054 (set_attr "mode" "QI")])
2056 (define_insn "movdi_insv_1_rex64"
2057 [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
2060 (match_operand:DI 1 "nonmemory_operand" "Qn"))]
2062 "mov{b}\t{%b1, %h0|%h0, %b1}"
2063 [(set_attr "type" "imov")
2064 (set_attr "mode" "QI")])
2066 (define_insn "*movqi_insv_2"
2067 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
2070 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
2073 "mov{b}\t{%h1, %h0|%h0, %h1}"
2074 [(set_attr "type" "imov")
2075 (set_attr "mode" "QI")])
2077 (define_expand "movdi"
2078 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2079 (match_operand:DI 1 "general_operand" ""))]
2081 "ix86_expand_move (DImode, operands); DONE;")
2083 (define_insn "*pushdi"
2084 [(set (match_operand:DI 0 "push_operand" "=<")
2085 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
2089 (define_insn "*pushdi2_rex64"
2090 [(set (match_operand:DI 0 "push_operand" "=<,!<")
2091 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
2096 [(set_attr "type" "push,multi")
2097 (set_attr "mode" "DI")])
2099 ;; Convert impossible pushes of immediate to existing instructions.
2100 ;; First try to get scratch register and go through it. In case this
2101 ;; fails, push sign extended lower part first and then overwrite
2102 ;; upper part by 32bit move.
2104 [(match_scratch:DI 2 "r")
2105 (set (match_operand:DI 0 "push_operand" "")
2106 (match_operand:DI 1 "immediate_operand" ""))]
2107 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2108 && !x86_64_immediate_operand (operands[1], DImode)"
2109 [(set (match_dup 2) (match_dup 1))
2110 (set (match_dup 0) (match_dup 2))]
2113 ;; We need to define this as both peepholer and splitter for case
2114 ;; peephole2 pass is not run.
2115 ;; "&& 1" is needed to keep it from matching the previous pattern.
2117 [(set (match_operand:DI 0 "push_operand" "")
2118 (match_operand:DI 1 "immediate_operand" ""))]
2119 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2120 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2121 [(set (match_dup 0) (match_dup 1))
2122 (set (match_dup 2) (match_dup 3))]
2123 "split_di (operands + 1, 1, operands + 2, operands + 3);
2124 operands[1] = gen_lowpart (DImode, operands[2]);
2125 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2130 [(set (match_operand:DI 0 "push_operand" "")
2131 (match_operand:DI 1 "immediate_operand" ""))]
2132 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2133 ? epilogue_completed : reload_completed)
2134 && !symbolic_operand (operands[1], DImode)
2135 && !x86_64_immediate_operand (operands[1], DImode)"
2136 [(set (match_dup 0) (match_dup 1))
2137 (set (match_dup 2) (match_dup 3))]
2138 "split_di (operands + 1, 1, operands + 2, operands + 3);
2139 operands[1] = gen_lowpart (DImode, operands[2]);
2140 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
2144 (define_insn "*pushdi2_prologue_rex64"
2145 [(set (match_operand:DI 0 "push_operand" "=<")
2146 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
2147 (clobber (mem:BLK (scratch)))]
2150 [(set_attr "type" "push")
2151 (set_attr "mode" "DI")])
2153 (define_insn "*popdi1_epilogue_rex64"
2154 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2155 (mem:DI (reg:DI SP_REG)))
2156 (set (reg:DI SP_REG)
2157 (plus:DI (reg:DI SP_REG) (const_int 8)))
2158 (clobber (mem:BLK (scratch)))]
2161 [(set_attr "type" "pop")
2162 (set_attr "mode" "DI")])
2164 (define_insn "popdi1"
2165 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
2166 (mem:DI (reg:DI SP_REG)))
2167 (set (reg:DI SP_REG)
2168 (plus:DI (reg:DI SP_REG) (const_int 8)))]
2171 [(set_attr "type" "pop")
2172 (set_attr "mode" "DI")])
2174 (define_insn "*movdi_xor_rex64"
2175 [(set (match_operand:DI 0 "register_operand" "=r")
2176 (match_operand:DI 1 "const0_operand" "i"))
2177 (clobber (reg:CC FLAGS_REG))]
2178 "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size)
2179 && reload_completed"
2181 [(set_attr "type" "alu1")
2182 (set_attr "mode" "SI")
2183 (set_attr "length_immediate" "0")])
2185 (define_insn "*movdi_or_rex64"
2186 [(set (match_operand:DI 0 "register_operand" "=r")
2187 (match_operand:DI 1 "const_int_operand" "i"))
2188 (clobber (reg:CC FLAGS_REG))]
2189 "TARGET_64BIT && (TARGET_MOVE_M1_VIA_OR || optimize_size)
2191 && operands[1] == constm1_rtx"
2193 operands[1] = constm1_rtx;
2194 return "or{q}\t{%1, %0|%0, %1}";
2196 [(set_attr "type" "alu1")
2197 (set_attr "mode" "DI")
2198 (set_attr "length_immediate" "1")])
2200 (define_insn "*movdi_2"
2201 [(set (match_operand:DI 0 "nonimmediate_operand"
2202 "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x")
2203 (match_operand:DI 1 "general_operand"
2204 "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))]
2205 "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2210 movq\t{%1, %0|%0, %1}
2211 movq\t{%1, %0|%0, %1}
2213 movq\t{%1, %0|%0, %1}
2214 movdqa\t{%1, %0|%0, %1}
2215 movq\t{%1, %0|%0, %1}
2217 movlps\t{%1, %0|%0, %1}
2218 movaps\t{%1, %0|%0, %1}
2219 movlps\t{%1, %0|%0, %1}"
2220 [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov")
2221 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")])
2224 [(set (match_operand:DI 0 "push_operand" "")
2225 (match_operand:DI 1 "general_operand" ""))]
2226 "!TARGET_64BIT && reload_completed
2227 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2229 "ix86_split_long_move (operands); DONE;")
2231 ;; %%% This multiword shite has got to go.
2233 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2234 (match_operand:DI 1 "general_operand" ""))]
2235 "!TARGET_64BIT && reload_completed
2236 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
2237 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
2239 "ix86_split_long_move (operands); DONE;")
2241 (define_insn "*movdi_1_rex64"
2242 [(set (match_operand:DI 0 "nonimmediate_operand"
2243 "=r,r ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
2244 (match_operand:DI 1 "general_operand"
2245 "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r ,m ,C ,*x,*Yi,*x,r ,m ,*Ym,*x"))]
2246 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2248 switch (get_attr_type (insn))
2251 if (SSE_REG_P (operands[0]))
2252 return "movq2dq\t{%1, %0|%0, %1}";
2254 return "movdq2q\t{%1, %0|%0, %1}";
2257 if (get_attr_mode (insn) == MODE_TI)
2258 return "movdqa\t{%1, %0|%0, %1}";
2262 /* Moves from and into integer register is done using movd
2263 opcode with REX prefix. */
2264 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
2265 return "movd\t{%1, %0|%0, %1}";
2266 return "movq\t{%1, %0|%0, %1}";
2270 return "pxor\t%0, %0";
2276 return "lea{q}\t{%a1, %0|%0, %a1}";
2279 gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
2280 if (get_attr_mode (insn) == MODE_SI)
2281 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2282 else if (which_alternative == 2)
2283 return "movabs{q}\t{%1, %0|%0, %1}";
2285 return "mov{q}\t{%1, %0|%0, %1}";
2289 (cond [(eq_attr "alternative" "5")
2290 (const_string "mmxadd")
2291 (eq_attr "alternative" "6,7,8,9,10")
2292 (const_string "mmxmov")
2293 (eq_attr "alternative" "11")
2294 (const_string "sselog1")
2295 (eq_attr "alternative" "12,13,14,15,16")
2296 (const_string "ssemov")
2297 (eq_attr "alternative" "17,18")
2298 (const_string "ssecvt")
2299 (eq_attr "alternative" "4")
2300 (const_string "multi")
2301 (match_operand:DI 1 "pic_32bit_operand" "")
2302 (const_string "lea")
2304 (const_string "imov")))
2305 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*")
2306 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*")
2307 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
2309 ;; Stores and loads of ax to arbitrary constant address.
2310 ;; We fake an second form of instruction to force reload to load address
2311 ;; into register when rax is not available
2312 (define_insn "*movabsdi_1_rex64"
2313 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2314 (match_operand:DI 1 "nonmemory_operand" "a,er"))]
2315 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2317 movabs{q}\t{%1, %P0|%P0, %1}
2318 mov{q}\t{%1, %a0|%a0, %1}"
2319 [(set_attr "type" "imov")
2320 (set_attr "modrm" "0,*")
2321 (set_attr "length_address" "8,0")
2322 (set_attr "length_immediate" "0,*")
2323 (set_attr "memory" "store")
2324 (set_attr "mode" "DI")])
2326 (define_insn "*movabsdi_2_rex64"
2327 [(set (match_operand:DI 0 "register_operand" "=a,r")
2328 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2329 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2331 movabs{q}\t{%P1, %0|%0, %P1}
2332 mov{q}\t{%a1, %0|%0, %a1}"
2333 [(set_attr "type" "imov")
2334 (set_attr "modrm" "0,*")
2335 (set_attr "length_address" "8,0")
2336 (set_attr "length_immediate" "0")
2337 (set_attr "memory" "load")
2338 (set_attr "mode" "DI")])
2340 ;; Convert impossible stores of immediate to existing instructions.
2341 ;; First try to get scratch register and go through it. In case this
2342 ;; fails, move by 32bit parts.
2344 [(match_scratch:DI 2 "r")
2345 (set (match_operand:DI 0 "memory_operand" "")
2346 (match_operand:DI 1 "immediate_operand" ""))]
2347 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2348 && !x86_64_immediate_operand (operands[1], DImode)"
2349 [(set (match_dup 2) (match_dup 1))
2350 (set (match_dup 0) (match_dup 2))]
2353 ;; We need to define this as both peepholer and splitter for case
2354 ;; peephole2 pass is not run.
2355 ;; "&& 1" is needed to keep it from matching the previous pattern.
2357 [(set (match_operand:DI 0 "memory_operand" "")
2358 (match_operand:DI 1 "immediate_operand" ""))]
2359 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2360 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2361 [(set (match_dup 2) (match_dup 3))
2362 (set (match_dup 4) (match_dup 5))]
2363 "split_di (operands, 2, operands + 2, operands + 4);")
2366 [(set (match_operand:DI 0 "memory_operand" "")
2367 (match_operand:DI 1 "immediate_operand" ""))]
2368 "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
2369 ? epilogue_completed : reload_completed)
2370 && !symbolic_operand (operands[1], DImode)
2371 && !x86_64_immediate_operand (operands[1], DImode)"
2372 [(set (match_dup 2) (match_dup 3))
2373 (set (match_dup 4) (match_dup 5))]
2374 "split_di (operands, 2, operands + 2, operands + 4);")
2376 (define_insn "*swapdi_rex64"
2377 [(set (match_operand:DI 0 "register_operand" "+r")
2378 (match_operand:DI 1 "register_operand" "+r"))
2383 [(set_attr "type" "imov")
2384 (set_attr "mode" "DI")
2385 (set_attr "pent_pair" "np")
2386 (set_attr "athlon_decode" "vector")
2387 (set_attr "amdfam10_decode" "double")])
2389 (define_expand "movti"
2390 [(set (match_operand:TI 0 "nonimmediate_operand" "")
2391 (match_operand:TI 1 "nonimmediate_operand" ""))]
2392 "TARGET_SSE || TARGET_64BIT"
2395 ix86_expand_move (TImode, operands);
2396 else if (push_operand (operands[0], TImode))
2397 ix86_expand_push (TImode, operands[1]);
2399 ix86_expand_vector_move (TImode, operands);
2403 (define_insn "*movti_internal"
2404 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
2405 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
2406 "TARGET_SSE && !TARGET_64BIT
2407 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2409 switch (which_alternative)
2412 if (get_attr_mode (insn) == MODE_V4SF)
2413 return "xorps\t%0, %0";
2415 return "pxor\t%0, %0";
2418 /* TDmode values are passed as TImode on the stack. Moving them
2419 to stack may result in unaligned memory access. */
2420 if (misaligned_operand (operands[0], TImode)
2421 || misaligned_operand (operands[1], TImode))
2423 if (get_attr_mode (insn) == MODE_V4SF)
2424 return "movups\t{%1, %0|%0, %1}";
2426 return "movdqu\t{%1, %0|%0, %1}";
2430 if (get_attr_mode (insn) == MODE_V4SF)
2431 return "movaps\t{%1, %0|%0, %1}";
2433 return "movdqa\t{%1, %0|%0, %1}";
2439 [(set_attr "type" "sselog1,ssemov,ssemov")
2441 (cond [(ior (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2442 (ne (symbol_ref "optimize_size") (const_int 0)))
2443 (const_string "V4SF")
2444 (and (eq_attr "alternative" "2")
2445 (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2447 (const_string "V4SF")]
2448 (const_string "TI")))])
2450 (define_insn "*movti_rex64"
2451 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,x,xm")
2452 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
2454 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
2456 switch (which_alternative)
2462 if (get_attr_mode (insn) == MODE_V4SF)
2463 return "xorps\t%0, %0";
2465 return "pxor\t%0, %0";
2468 /* TDmode values are passed as TImode on the stack. Moving them
2469 to stack may result in unaligned memory access. */
2470 if (misaligned_operand (operands[0], TImode)
2471 || misaligned_operand (operands[1], TImode))
2473 if (get_attr_mode (insn) == MODE_V4SF)
2474 return "movups\t{%1, %0|%0, %1}";
2476 return "movdqu\t{%1, %0|%0, %1}";
2480 if (get_attr_mode (insn) == MODE_V4SF)
2481 return "movaps\t{%1, %0|%0, %1}";
2483 return "movdqa\t{%1, %0|%0, %1}";
2489 [(set_attr "type" "*,*,sselog1,ssemov,ssemov")
2491 (cond [(eq_attr "alternative" "2,3")
2493 (ne (symbol_ref "optimize_size")
2495 (const_string "V4SF")
2496 (const_string "TI"))
2497 (eq_attr "alternative" "4")
2499 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
2501 (ne (symbol_ref "optimize_size")
2503 (const_string "V4SF")
2504 (const_string "TI"))]
2505 (const_string "DI")))])
2508 [(set (match_operand:TI 0 "nonimmediate_operand" "")
2509 (match_operand:TI 1 "general_operand" ""))]
2510 "reload_completed && !SSE_REG_P (operands[0])
2511 && !SSE_REG_P (operands[1])"
2513 "ix86_split_long_move (operands); DONE;")
2515 ;; This expands to what emit_move_complex would generate if we didn't
2516 ;; have a movti pattern. Having this avoids problems with reload on
2517 ;; 32-bit targets when SSE is present, but doesn't seem to be harmful
2518 ;; to have around all the time.
2519 (define_expand "movcdi"
2520 [(set (match_operand:CDI 0 "nonimmediate_operand" "")
2521 (match_operand:CDI 1 "general_operand" ""))]
2524 if (push_operand (operands[0], CDImode))
2525 emit_move_complex_push (CDImode, operands[0], operands[1]);
2527 emit_move_complex_parts (operands[0], operands[1]);
2531 (define_expand "movsf"
2532 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2533 (match_operand:SF 1 "general_operand" ""))]
2535 "ix86_expand_move (SFmode, operands); DONE;")
2537 (define_insn "*pushsf"
2538 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2539 (match_operand:SF 1 "general_no_elim_operand" "f,rFm,x"))]
2542 /* Anything else should be already split before reg-stack. */
2543 gcc_assert (which_alternative == 1);
2544 return "push{l}\t%1";
2546 [(set_attr "type" "multi,push,multi")
2547 (set_attr "unit" "i387,*,*")
2548 (set_attr "mode" "SF,SI,SF")])
2550 (define_insn "*pushsf_rex64"
2551 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2552 (match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,x"))]
2555 /* Anything else should be already split before reg-stack. */
2556 gcc_assert (which_alternative == 1);
2557 return "push{q}\t%q1";
2559 [(set_attr "type" "multi,push,multi")
2560 (set_attr "unit" "i387,*,*")
2561 (set_attr "mode" "SF,DI,SF")])
2564 [(set (match_operand:SF 0 "push_operand" "")
2565 (match_operand:SF 1 "memory_operand" ""))]
2567 && MEM_P (operands[1])
2568 && (operands[2] = find_constant_src (insn))"
2573 ;; %%% Kill this when call knows how to work this out.
2575 [(set (match_operand:SF 0 "push_operand" "")
2576 (match_operand:SF 1 "any_fp_register_operand" ""))]
2578 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
2579 (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
2582 [(set (match_operand:SF 0 "push_operand" "")
2583 (match_operand:SF 1 "any_fp_register_operand" ""))]
2585 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2586 (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
2588 (define_insn "*movsf_1"
2589 [(set (match_operand:SF 0 "nonimmediate_operand"
2590 "=f,m,f,r ,m ,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r")
2591 (match_operand:SF 1 "general_operand"
2592 "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))]
2593 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
2594 && (reload_in_progress || reload_completed
2595 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2596 || (!TARGET_SSE_MATH && optimize_size
2597 && standard_80387_constant_p (operands[1]))
2598 || GET_CODE (operands[1]) != CONST_DOUBLE
2599 || memory_operand (operands[0], SFmode))"
2601 switch (which_alternative)
2605 return output_387_reg_move (insn, operands);
2608 return standard_80387_constant_opcode (operands[1]);
2612 return "mov{l}\t{%1, %0|%0, %1}";
2614 if (get_attr_mode (insn) == MODE_TI)
2615 return "pxor\t%0, %0";
2617 return "xorps\t%0, %0";
2619 if (get_attr_mode (insn) == MODE_V4SF)
2620 return "movaps\t{%1, %0|%0, %1}";
2622 return "movss\t{%1, %0|%0, %1}";
2624 return "movss\t{%1, %0|%0, %1}";
2627 case 12: case 13: case 14: case 15:
2628 return "movd\t{%1, %0|%0, %1}";
2631 return "movq\t{%1, %0|%0, %1}";
2637 [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov,ssemov,ssemov,mmxmov,mmxmov")
2639 (cond [(eq_attr "alternative" "3,4,9,10")
2641 (eq_attr "alternative" "5")
2643 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2645 (ne (symbol_ref "TARGET_SSE2")
2647 (eq (symbol_ref "optimize_size")
2650 (const_string "V4SF"))
2651 /* For architectures resolving dependencies on
2652 whole SSE registers use APS move to break dependency
2653 chains, otherwise use short move to avoid extra work.
2655 Do the same for architectures resolving dependencies on
2656 the parts. While in DF mode it is better to always handle
2657 just register parts, the SF mode is different due to lack
2658 of instructions to load just part of the register. It is
2659 better to maintain the whole registers in single format
2660 to avoid problems on using packed logical operations. */
2661 (eq_attr "alternative" "6")
2663 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2665 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2667 (const_string "V4SF")
2668 (const_string "SF"))
2669 (eq_attr "alternative" "11")
2670 (const_string "DI")]
2671 (const_string "SF")))])
2673 (define_insn "*swapsf"
2674 [(set (match_operand:SF 0 "fp_register_operand" "+f")
2675 (match_operand:SF 1 "fp_register_operand" "+f"))
2678 "reload_completed || TARGET_80387"
2680 if (STACK_TOP_P (operands[0]))
2685 [(set_attr "type" "fxch")
2686 (set_attr "mode" "SF")])
2688 (define_expand "movdf"
2689 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2690 (match_operand:DF 1 "general_operand" ""))]
2692 "ix86_expand_move (DFmode, operands); DONE;")
2694 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2695 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2696 ;; On the average, pushdf using integers can be still shorter. Allow this
2697 ;; pattern for optimize_size too.
2699 (define_insn "*pushdf_nointeger"
2700 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2701 (match_operand:DF 1 "general_no_elim_operand" "f,Fo,*r,Y2"))]
2702 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
2704 /* This insn should be already split before reg-stack. */
2707 [(set_attr "type" "multi")
2708 (set_attr "unit" "i387,*,*,*")
2709 (set_attr "mode" "DF,SI,SI,DF")])
2711 (define_insn "*pushdf_integer"
2712 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2713 (match_operand:DF 1 "general_no_elim_operand" "f,rFo,Y2"))]
2714 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2716 /* This insn should be already split before reg-stack. */
2719 [(set_attr "type" "multi")
2720 (set_attr "unit" "i387,*,*")
2721 (set_attr "mode" "DF,SI,DF")])
2723 ;; %%% Kill this when call knows how to work this out.
2725 [(set (match_operand:DF 0 "push_operand" "")
2726 (match_operand:DF 1 "any_fp_register_operand" ""))]
2727 "!TARGET_64BIT && reload_completed"
2728 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
2729 (set (mem:DF (reg:SI SP_REG)) (match_dup 1))]
2733 [(set (match_operand:DF 0 "push_operand" "")
2734 (match_operand:DF 1 "any_fp_register_operand" ""))]
2735 "TARGET_64BIT && reload_completed"
2736 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2737 (set (mem:DF (reg:DI SP_REG)) (match_dup 1))]
2741 [(set (match_operand:DF 0 "push_operand" "")
2742 (match_operand:DF 1 "general_operand" ""))]
2745 "ix86_split_long_move (operands); DONE;")
2747 ;; Moving is usually shorter when only FP registers are used. This separate
2748 ;; movdf pattern avoids the use of integer registers for FP operations
2749 ;; when optimizing for size.
2751 (define_insn "*movdf_nointeger"
2752 [(set (match_operand:DF 0 "nonimmediate_operand"
2753 "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ")
2754 (match_operand:DF 1 "general_operand"
2755 "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))]
2756 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
2757 && ((optimize_size || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
2758 && (reload_in_progress || reload_completed
2759 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2760 || (!(TARGET_SSE2 && TARGET_SSE_MATH) && optimize_size
2761 && !memory_operand (operands[0], DFmode)
2762 && standard_80387_constant_p (operands[1]))
2763 || GET_CODE (operands[1]) != CONST_DOUBLE
2765 || !TARGET_MEMORY_MISMATCH_STALL
2766 || reload_in_progress || reload_completed)
2767 && memory_operand (operands[0], DFmode)))"
2769 switch (which_alternative)
2773 return output_387_reg_move (insn, operands);
2776 return standard_80387_constant_opcode (operands[1]);
2782 switch (get_attr_mode (insn))
2785 return "xorps\t%0, %0";
2787 return "xorpd\t%0, %0";
2789 return "pxor\t%0, %0";
2796 switch (get_attr_mode (insn))
2799 return "movaps\t{%1, %0|%0, %1}";
2801 return "movapd\t{%1, %0|%0, %1}";
2803 return "movdqa\t{%1, %0|%0, %1}";
2805 return "movq\t{%1, %0|%0, %1}";
2807 return "movsd\t{%1, %0|%0, %1}";
2809 return "movlpd\t{%1, %0|%0, %1}";
2811 return "movlps\t{%1, %0|%0, %1}";
2820 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
2822 (cond [(eq_attr "alternative" "0,1,2")
2824 (eq_attr "alternative" "3,4")
2827 /* For SSE1, we have many fewer alternatives. */
2828 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2829 (cond [(eq_attr "alternative" "5,6")
2830 (const_string "V4SF")
2832 (const_string "V2SF"))
2834 /* xorps is one byte shorter. */
2835 (eq_attr "alternative" "5")
2836 (cond [(ne (symbol_ref "optimize_size")
2838 (const_string "V4SF")
2839 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2843 (const_string "V2DF"))
2845 /* For architectures resolving dependencies on
2846 whole SSE registers use APD move to break dependency
2847 chains, otherwise use short move to avoid extra work.
2849 movaps encodes one byte shorter. */
2850 (eq_attr "alternative" "6")
2852 [(ne (symbol_ref "optimize_size")
2854 (const_string "V4SF")
2855 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2857 (const_string "V2DF")
2859 (const_string "DF"))
2860 /* For architectures resolving dependencies on register
2861 parts we may avoid extra work to zero out upper part
2863 (eq_attr "alternative" "7")
2865 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2867 (const_string "V1DF")
2868 (const_string "DF"))
2870 (const_string "DF")))])
2872 (define_insn "*movdf_integer_rex64"
2873 [(set (match_operand:DF 0 "nonimmediate_operand"
2874 "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ")
2875 (match_operand:DF 1 "general_operand"
2876 "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))]
2877 "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
2878 && (reload_in_progress || reload_completed
2879 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2880 || (!(TARGET_SSE2 && TARGET_SSE_MATH) && optimize_size
2881 && standard_80387_constant_p (operands[1]))
2882 || GET_CODE (operands[1]) != CONST_DOUBLE
2883 || memory_operand (operands[0], DFmode))"
2885 switch (which_alternative)
2889 return output_387_reg_move (insn, operands);
2892 return standard_80387_constant_opcode (operands[1]);
2899 switch (get_attr_mode (insn))
2902 return "xorps\t%0, %0";
2904 return "xorpd\t%0, %0";
2906 return "pxor\t%0, %0";
2913 switch (get_attr_mode (insn))
2916 return "movaps\t{%1, %0|%0, %1}";
2918 return "movapd\t{%1, %0|%0, %1}";
2920 return "movdqa\t{%1, %0|%0, %1}";
2922 return "movq\t{%1, %0|%0, %1}";
2924 return "movsd\t{%1, %0|%0, %1}";
2926 return "movlpd\t{%1, %0|%0, %1}";
2928 return "movlps\t{%1, %0|%0, %1}";
2935 return "movd\t{%1, %0|%0, %1}";
2941 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
2943 (cond [(eq_attr "alternative" "0,1,2")
2945 (eq_attr "alternative" "3,4,9,10")
2948 /* For SSE1, we have many fewer alternatives. */
2949 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2950 (cond [(eq_attr "alternative" "5,6")
2951 (const_string "V4SF")
2953 (const_string "V2SF"))
2955 /* xorps is one byte shorter. */
2956 (eq_attr "alternative" "5")
2957 (cond [(ne (symbol_ref "optimize_size")
2959 (const_string "V4SF")
2960 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2964 (const_string "V2DF"))
2966 /* For architectures resolving dependencies on
2967 whole SSE registers use APD move to break dependency
2968 chains, otherwise use short move to avoid extra work.
2970 movaps encodes one byte shorter. */
2971 (eq_attr "alternative" "6")
2973 [(ne (symbol_ref "optimize_size")
2975 (const_string "V4SF")
2976 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2978 (const_string "V2DF")
2980 (const_string "DF"))
2981 /* For architectures resolving dependencies on register
2982 parts we may avoid extra work to zero out upper part
2984 (eq_attr "alternative" "7")
2986 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2988 (const_string "V1DF")
2989 (const_string "DF"))
2991 (const_string "DF")))])
2993 (define_insn "*movdf_integer"
2994 [(set (match_operand:DF 0 "nonimmediate_operand"
2995 "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ")
2996 (match_operand:DF 1 "general_operand"
2997 "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))]
2998 "!(MEM_P (operands[0]) && MEM_P (operands[1]))
2999 && !optimize_size && TARGET_INTEGER_DFMODE_MOVES
3000 && (reload_in_progress || reload_completed
3001 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3002 || (!(TARGET_SSE2 && TARGET_SSE_MATH) && optimize_size
3003 && standard_80387_constant_p (operands[1]))
3004 || GET_CODE (operands[1]) != CONST_DOUBLE
3005 || memory_operand (operands[0], DFmode))"
3007 switch (which_alternative)
3011 return output_387_reg_move (insn, operands);
3014 return standard_80387_constant_opcode (operands[1]);
3021 switch (get_attr_mode (insn))
3024 return "xorps\t%0, %0";
3026 return "xorpd\t%0, %0";
3028 return "pxor\t%0, %0";
3035 switch (get_attr_mode (insn))
3038 return "movaps\t{%1, %0|%0, %1}";
3040 return "movapd\t{%1, %0|%0, %1}";
3042 return "movdqa\t{%1, %0|%0, %1}";
3044 return "movq\t{%1, %0|%0, %1}";
3046 return "movsd\t{%1, %0|%0, %1}";
3048 return "movlpd\t{%1, %0|%0, %1}";
3050 return "movlps\t{%1, %0|%0, %1}";
3059 [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov")
3061 (cond [(eq_attr "alternative" "0,1,2")
3063 (eq_attr "alternative" "3,4")
3066 /* For SSE1, we have many fewer alternatives. */
3067 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
3068 (cond [(eq_attr "alternative" "5,6")
3069 (const_string "V4SF")
3071 (const_string "V2SF"))
3073 /* xorps is one byte shorter. */
3074 (eq_attr "alternative" "5")
3075 (cond [(ne (symbol_ref "optimize_size")
3077 (const_string "V4SF")
3078 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
3082 (const_string "V2DF"))
3084 /* For architectures resolving dependencies on
3085 whole SSE registers use APD move to break dependency
3086 chains, otherwise use short move to avoid extra work.
3088 movaps encodes one byte shorter. */
3089 (eq_attr "alternative" "6")
3091 [(ne (symbol_ref "optimize_size")
3093 (const_string "V4SF")
3094 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
3096 (const_string "V2DF")
3098 (const_string "DF"))
3099 /* For architectures resolving dependencies on register
3100 parts we may avoid extra work to zero out upper part
3102 (eq_attr "alternative" "7")
3104 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
3106 (const_string "V1DF")
3107 (const_string "DF"))
3109 (const_string "DF")))])
3112 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3113 (match_operand:DF 1 "general_operand" ""))]
3115 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3116 && ! (ANY_FP_REG_P (operands[0]) ||
3117 (GET_CODE (operands[0]) == SUBREG
3118 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3119 && ! (ANY_FP_REG_P (operands[1]) ||
3120 (GET_CODE (operands[1]) == SUBREG
3121 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3123 "ix86_split_long_move (operands); DONE;")
3125 (define_insn "*swapdf"
3126 [(set (match_operand:DF 0 "fp_register_operand" "+f")
3127 (match_operand:DF 1 "fp_register_operand" "+f"))
3130 "reload_completed || TARGET_80387"
3132 if (STACK_TOP_P (operands[0]))
3137 [(set_attr "type" "fxch")
3138 (set_attr "mode" "DF")])
3140 (define_expand "movxf"
3141 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3142 (match_operand:XF 1 "general_operand" ""))]
3144 "ix86_expand_move (XFmode, operands); DONE;")
3146 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
3147 ;; Size of pushdf using integer instructions is 3+3*memory operand size
3148 ;; Pushing using integer instructions is longer except for constants
3149 ;; and direct memory references.
3150 ;; (assuming that any given constant is pushed only once, but this ought to be
3151 ;; handled elsewhere).
3153 (define_insn "*pushxf_nointeger"
3154 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
3155 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
3158 /* This insn should be already split before reg-stack. */
3161 [(set_attr "type" "multi")
3162 (set_attr "unit" "i387,*,*")
3163 (set_attr "mode" "XF,SI,SI")])
3165 (define_insn "*pushxf_integer"
3166 [(set (match_operand:XF 0 "push_operand" "=<,<")
3167 (match_operand:XF 1 "general_no_elim_operand" "f,ro"))]
3170 /* This insn should be already split before reg-stack. */
3173 [(set_attr "type" "multi")
3174 (set_attr "unit" "i387,*")
3175 (set_attr "mode" "XF,SI")])
3178 [(set (match_operand 0 "push_operand" "")
3179 (match_operand 1 "general_operand" ""))]
3181 && (GET_MODE (operands[0]) == XFmode
3182 || GET_MODE (operands[0]) == DFmode)
3183 && !ANY_FP_REG_P (operands[1])"
3185 "ix86_split_long_move (operands); DONE;")
3188 [(set (match_operand:XF 0 "push_operand" "")
3189 (match_operand:XF 1 "any_fp_register_operand" ""))]
3191 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
3192 (set (mem:XF (reg:SI SP_REG)) (match_dup 1))]
3193 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3196 [(set (match_operand:XF 0 "push_operand" "")
3197 (match_operand:XF 1 "any_fp_register_operand" ""))]
3199 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
3200 (set (mem:XF (reg:DI SP_REG)) (match_dup 1))]
3201 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3203 ;; Do not use integer registers when optimizing for size
3204 (define_insn "*movxf_nointeger"
3205 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
3206 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
3208 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3209 && (reload_in_progress || reload_completed
3210 || (optimize_size && standard_80387_constant_p (operands[1]))
3211 || GET_CODE (operands[1]) != CONST_DOUBLE
3212 || memory_operand (operands[0], XFmode))"
3214 switch (which_alternative)
3218 return output_387_reg_move (insn, operands);
3221 return standard_80387_constant_opcode (operands[1]);
3229 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3230 (set_attr "mode" "XF,XF,XF,SI,SI")])
3232 (define_insn "*movxf_integer"
3233 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,r,o")
3234 (match_operand:XF 1 "general_operand" "fm,f,G,roF,Fr"))]
3236 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3237 && (reload_in_progress || reload_completed
3238 || (optimize_size && standard_80387_constant_p (operands[1]))
3239 || GET_CODE (operands[1]) != CONST_DOUBLE
3240 || memory_operand (operands[0], XFmode))"
3242 switch (which_alternative)
3246 return output_387_reg_move (insn, operands);
3249 return standard_80387_constant_opcode (operands[1]);
3258 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3259 (set_attr "mode" "XF,XF,XF,SI,SI")])
3261 (define_expand "movtf"
3262 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3263 (match_operand:TF 1 "nonimmediate_operand" ""))]
3266 ix86_expand_move (TFmode, operands);
3270 (define_insn "*movtf_internal"
3271 [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o")
3272 (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))]
3274 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
3276 switch (which_alternative)
3280 if (get_attr_mode (insn) == MODE_V4SF)
3281 return "movaps\t{%1, %0|%0, %1}";
3283 return "movdqa\t{%1, %0|%0, %1}";
3285 if (get_attr_mode (insn) == MODE_V4SF)
3286 return "xorps\t%0, %0";
3288 return "pxor\t%0, %0";
3296 [(set_attr "type" "ssemov,ssemov,sselog1,*,*")
3298 (cond [(eq_attr "alternative" "0,2")
3300 (ne (symbol_ref "optimize_size")
3302 (const_string "V4SF")
3303 (const_string "TI"))
3304 (eq_attr "alternative" "1")
3306 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
3308 (ne (symbol_ref "optimize_size")
3310 (const_string "V4SF")
3311 (const_string "TI"))]
3312 (const_string "DI")))])
3315 [(set (match_operand 0 "nonimmediate_operand" "")
3316 (match_operand 1 "general_operand" ""))]
3318 && !(MEM_P (operands[0]) && MEM_P (operands[1]))
3319 && GET_MODE (operands[0]) == XFmode
3320 && ! (ANY_FP_REG_P (operands[0]) ||
3321 (GET_CODE (operands[0]) == SUBREG
3322 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3323 && ! (ANY_FP_REG_P (operands[1]) ||
3324 (GET_CODE (operands[1]) == SUBREG
3325 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3327 "ix86_split_long_move (operands); DONE;")
3330 [(set (match_operand 0 "register_operand" "")
3331 (match_operand 1 "memory_operand" ""))]
3333 && MEM_P (operands[1])
3334 && (GET_MODE (operands[0]) == TFmode
3335 || GET_MODE (operands[0]) == XFmode
3336 || GET_MODE (operands[0]) == SFmode
3337 || GET_MODE (operands[0]) == DFmode)
3338 && (operands[2] = find_constant_src (insn))"
3339 [(set (match_dup 0) (match_dup 2))]
3341 rtx c = operands[2];
3342 rtx r = operands[0];
3344 if (GET_CODE (r) == SUBREG)