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
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 2, 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 COPYING. If not, write to
22 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA. */
25 ;; The original PO technology requires these to be ordered by speed,
26 ;; so that assigner will pick the fastest.
28 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 ;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register
31 ;; constraint letters.
33 ;; The special asm out single letter directives following a '%' are:
34 ;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of
36 ;; 'L' Print the opcode suffix for a 32-bit integer opcode.
37 ;; 'W' Print the opcode suffix for a 16-bit integer opcode.
38 ;; 'B' Print the opcode suffix for an 8-bit integer opcode.
39 ;; 'Q' Print the opcode suffix for a 64-bit float opcode.
40 ;; 'S' Print the opcode suffix for a 32-bit float opcode.
41 ;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode.
42 ;; 'J' Print the appropriate jump operand.
44 ;; 'b' Print the QImode name of the register for the indicated operand.
45 ;; %b0 would print %al if operands[0] is reg 0.
46 ;; 'w' Likewise, print the HImode name of the register.
47 ;; 'k' Likewise, print the SImode name of the register.
48 ;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.
49 ;; 'y' Print "st(0)" instead of "st" as a register.
54 [; Relocation specifiers
66 (UNSPEC_STACK_ALLOC 11)
68 (UNSPEC_SSE_PROLOGUE_SAVE 13)
73 (UNSPEC_TLS_LD_BASE 17)
75 ; Other random patterns
85 ; For SSE/MMX support:
96 (UNSPEC_NOP 45) ; prevents combiner cleverness
123 ; x87 Double output FP
124 (UNSPEC_SINCOS_COS 80)
125 (UNSPEC_SINCOS_SIN 81)
128 (UNSPEC_XTRACT_FRACT 84)
129 (UNSPEC_XTRACT_EXP 85)
130 (UNSPEC_FSCALE_FRACT 86)
131 (UNSPEC_FSCALE_EXP 87)
138 (UNSPEC_FRNDINT_FLOOR 96)
139 (UNSPEC_FRNDINT_CEIL 97)
140 (UNSPEC_FRNDINT_TRUNC 98)
141 (UNSPEC_FRNDINT_MASK_PM 99)
146 (UNSPEC_EH_RETURN 76)
150 [(UNSPECV_BLOCKAGE 0)
151 (UNSPECV_STACK_PROBE 10)
162 ;; Registers by name.
171 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
174 ;; In C guard expressions, put expressions which may be compile-time
175 ;; constants first. This allows for better optimization. For
176 ;; example, write "TARGET_64BIT && reload_completed", not
177 ;; "reload_completed && TARGET_64BIT".
180 ;; Processor type. This attribute must exactly match the processor_type
181 ;; enumeration in i386.h.
182 (define_attr "cpu" "i386,i486,pentium,pentiumpro,k6,athlon,pentium4,k8,nocona"
183 (const (symbol_ref "ix86_tune")))
185 ;; A basic instruction type. Refinements due to arguments to be
186 ;; provided in other attributes.
189 alu,alu1,negnot,imov,imovx,lea,
190 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
191 icmp,test,ibr,setcc,icmov,
192 push,pop,call,callv,leave,
194 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,frndint,
195 sselog,sseiadd,sseishft,sseimul,
196 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,sseicvt,ssediv,
197 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
198 (const_string "other"))
200 ;; Main data type used by the insn
202 "unknown,none,QI,HI,SI,DI,SF,DF,XF,TI,V4SF,V2DF,V2SF"
203 (const_string "unknown"))
205 ;; The CPU unit operations uses.
206 (define_attr "unit" "integer,i387,sse,mmx,unknown"
207 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,frndint")
208 (const_string "i387")
209 (eq_attr "type" "sselog,sseiadd,sseishft,sseimul,
210 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,sseicvt,ssediv")
212 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
214 (eq_attr "type" "other")
215 (const_string "unknown")]
216 (const_string "integer")))
218 ;; The (bounding maximum) length of an instruction immediate.
219 (define_attr "length_immediate" ""
220 (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv,leave")
222 (eq_attr "unit" "i387,sse,mmx")
224 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
226 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
227 (eq_attr "type" "imov,test")
228 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
229 (eq_attr "type" "call")
230 (if_then_else (match_operand 0 "constant_call_address_operand" "")
233 (eq_attr "type" "callv")
234 (if_then_else (match_operand 1 "constant_call_address_operand" "")
237 ;; We don't know the size before shorten_branches. Expect
238 ;; the instruction to fit for better scheduling.
239 (eq_attr "type" "ibr")
242 (symbol_ref "/* Update immediate_length and other attributes! */
245 ;; The (bounding maximum) length of an instruction address.
246 (define_attr "length_address" ""
247 (cond [(eq_attr "type" "str,cld,other,multi,fxch")
249 (and (eq_attr "type" "call")
250 (match_operand 0 "constant_call_address_operand" ""))
252 (and (eq_attr "type" "callv")
253 (match_operand 1 "constant_call_address_operand" ""))
256 (symbol_ref "ix86_attr_length_address_default (insn)")))
258 ;; Set when length prefix is used.
259 (define_attr "prefix_data16" ""
260 (if_then_else (ior (eq_attr "mode" "HI")
261 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))
265 ;; Set when string REP prefix is used.
266 (define_attr "prefix_rep" ""
267 (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
271 ;; Set when 0f opcode prefix is used.
272 (define_attr "prefix_0f" ""
274 (ior (eq_attr "type" "imovx,setcc,icmov")
275 (eq_attr "unit" "sse,mmx"))
279 ;; Set when REX opcode prefix is used.
280 (define_attr "prefix_rex" ""
281 (cond [(and (eq_attr "mode" "DI")
282 (eq_attr "type" "!push,pop,call,callv,leave,ibr"))
284 (and (eq_attr "mode" "QI")
285 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
288 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
294 ;; Set when modrm byte is used.
295 (define_attr "modrm" ""
296 (cond [(eq_attr "type" "str,cld,leave")
298 (eq_attr "unit" "i387")
300 (and (eq_attr "type" "incdec")
301 (ior (match_operand:SI 1 "register_operand" "")
302 (match_operand:HI 1 "register_operand" "")))
304 (and (eq_attr "type" "push")
305 (not (match_operand 1 "memory_operand" "")))
307 (and (eq_attr "type" "pop")
308 (not (match_operand 0 "memory_operand" "")))
310 (and (eq_attr "type" "imov")
311 (and (match_operand 0 "register_operand" "")
312 (match_operand 1 "immediate_operand" "")))
314 (and (eq_attr "type" "call")
315 (match_operand 0 "constant_call_address_operand" ""))
317 (and (eq_attr "type" "callv")
318 (match_operand 1 "constant_call_address_operand" ""))
323 ;; The (bounding maximum) length of an instruction in bytes.
324 ;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
325 ;; Later we may want to split them and compute proper length as for
327 (define_attr "length" ""
328 (cond [(eq_attr "type" "other,multi,fistp,frndint")
330 (eq_attr "type" "fcmp")
332 (eq_attr "unit" "i387")
334 (plus (attr "prefix_data16")
335 (attr "length_address")))]
336 (plus (plus (attr "modrm")
337 (plus (attr "prefix_0f")
338 (plus (attr "prefix_rex")
340 (plus (attr "prefix_rep")
341 (plus (attr "prefix_data16")
342 (plus (attr "length_immediate")
343 (attr "length_address")))))))
345 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
346 ;; `store' if there is a simple memory reference therein, or `unknown'
347 ;; if the instruction is complex.
349 (define_attr "memory" "none,load,store,both,unknown"
350 (cond [(eq_attr "type" "other,multi,str")
351 (const_string "unknown")
352 (eq_attr "type" "lea,fcmov,fpspc,cld")
353 (const_string "none")
354 (eq_attr "type" "fistp,leave")
355 (const_string "both")
356 (eq_attr "type" "frndint")
357 (const_string "load")
358 (eq_attr "type" "push")
359 (if_then_else (match_operand 1 "memory_operand" "")
360 (const_string "both")
361 (const_string "store"))
362 (eq_attr "type" "pop")
363 (if_then_else (match_operand 0 "memory_operand" "")
364 (const_string "both")
365 (const_string "load"))
366 (eq_attr "type" "setcc")
367 (if_then_else (match_operand 0 "memory_operand" "")
368 (const_string "store")
369 (const_string "none"))
370 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
371 (if_then_else (ior (match_operand 0 "memory_operand" "")
372 (match_operand 1 "memory_operand" ""))
373 (const_string "load")
374 (const_string "none"))
375 (eq_attr "type" "ibr")
376 (if_then_else (match_operand 0 "memory_operand" "")
377 (const_string "load")
378 (const_string "none"))
379 (eq_attr "type" "call")
380 (if_then_else (match_operand 0 "constant_call_address_operand" "")
381 (const_string "none")
382 (const_string "load"))
383 (eq_attr "type" "callv")
384 (if_then_else (match_operand 1 "constant_call_address_operand" "")
385 (const_string "none")
386 (const_string "load"))
387 (and (eq_attr "type" "alu1,negnot,ishift1")
388 (match_operand 1 "memory_operand" ""))
389 (const_string "both")
390 (and (match_operand 0 "memory_operand" "")
391 (match_operand 1 "memory_operand" ""))
392 (const_string "both")
393 (match_operand 0 "memory_operand" "")
394 (const_string "store")
395 (match_operand 1 "memory_operand" "")
396 (const_string "load")
398 "!alu1,negnot,ishift1,
399 imov,imovx,icmp,test,
401 sse,ssemov,ssecmp,ssecomi,ssecvt,sseicvt,
402 mmx,mmxmov,mmxcmp,mmxcvt")
403 (match_operand 2 "memory_operand" ""))
404 (const_string "load")
405 (and (eq_attr "type" "icmov")
406 (match_operand 3 "memory_operand" ""))
407 (const_string "load")
409 (const_string "none")))
411 ;; Indicates if an instruction has both an immediate and a displacement.
413 (define_attr "imm_disp" "false,true,unknown"
414 (cond [(eq_attr "type" "other,multi")
415 (const_string "unknown")
416 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
417 (and (match_operand 0 "memory_displacement_operand" "")
418 (match_operand 1 "immediate_operand" "")))
419 (const_string "true")
420 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
421 (and (match_operand 0 "memory_displacement_operand" "")
422 (match_operand 2 "immediate_operand" "")))
423 (const_string "true")
425 (const_string "false")))
427 ;; Indicates if an FP operation has an integer source.
429 (define_attr "fp_int_src" "false,true"
430 (const_string "false"))
432 ;; Defines rounding mode of an FP operation.
434 (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,uninitialized,any"
435 (const_string "any"))
437 ;; Describe a user's asm statement.
438 (define_asm_attributes
439 [(set_attr "length" "128")
440 (set_attr "type" "multi")])
442 ;; Scheduling descriptions
444 (include "pentium.md")
447 (include "athlon.md")
450 ;; Operand and operator predicates
452 (include "predicates.md")
455 ;; Compare instructions.
457 ;; All compare insns have expanders that save the operands away without
458 ;; actually generating RTL. The bCOND or sCOND (emitted immediately
459 ;; after the cmp) will actually emit the cmpM.
461 (define_expand "cmpdi"
462 [(set (reg:CC FLAGS_REG)
463 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
464 (match_operand:DI 1 "x86_64_general_operand" "")))]
467 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
468 operands[0] = force_reg (DImode, operands[0]);
469 ix86_compare_op0 = operands[0];
470 ix86_compare_op1 = operands[1];
474 (define_expand "cmpsi"
475 [(set (reg:CC FLAGS_REG)
476 (compare:CC (match_operand:SI 0 "cmpsi_operand" "")
477 (match_operand:SI 1 "general_operand" "")))]
480 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
481 operands[0] = force_reg (SImode, operands[0]);
482 ix86_compare_op0 = operands[0];
483 ix86_compare_op1 = operands[1];
487 (define_expand "cmphi"
488 [(set (reg:CC FLAGS_REG)
489 (compare:CC (match_operand:HI 0 "nonimmediate_operand" "")
490 (match_operand:HI 1 "general_operand" "")))]
493 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
494 operands[0] = force_reg (HImode, operands[0]);
495 ix86_compare_op0 = operands[0];
496 ix86_compare_op1 = operands[1];
500 (define_expand "cmpqi"
501 [(set (reg:CC FLAGS_REG)
502 (compare:CC (match_operand:QI 0 "nonimmediate_operand" "")
503 (match_operand:QI 1 "general_operand" "")))]
506 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
507 operands[0] = force_reg (QImode, operands[0]);
508 ix86_compare_op0 = operands[0];
509 ix86_compare_op1 = operands[1];
513 (define_insn "cmpdi_ccno_1_rex64"
514 [(set (reg FLAGS_REG)
515 (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr")
516 (match_operand:DI 1 "const0_operand" "n,n")))]
517 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
519 test{q}\t{%0, %0|%0, %0}
520 cmp{q}\t{%1, %0|%0, %1}"
521 [(set_attr "type" "test,icmp")
522 (set_attr "length_immediate" "0,1")
523 (set_attr "mode" "DI")])
525 (define_insn "*cmpdi_minus_1_rex64"
526 [(set (reg FLAGS_REG)
527 (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r")
528 (match_operand:DI 1 "x86_64_general_operand" "re,mr"))
530 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)"
531 "cmp{q}\t{%1, %0|%0, %1}"
532 [(set_attr "type" "icmp")
533 (set_attr "mode" "DI")])
535 (define_expand "cmpdi_1_rex64"
536 [(set (reg:CC FLAGS_REG)
537 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
538 (match_operand:DI 1 "general_operand" "")))]
542 (define_insn "cmpdi_1_insn_rex64"
543 [(set (reg FLAGS_REG)
544 (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r")
545 (match_operand:DI 1 "x86_64_general_operand" "re,mr")))]
546 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
547 "cmp{q}\t{%1, %0|%0, %1}"
548 [(set_attr "type" "icmp")
549 (set_attr "mode" "DI")])
552 (define_insn "*cmpsi_ccno_1"
553 [(set (reg FLAGS_REG)
554 (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr")
555 (match_operand:SI 1 "const0_operand" "n,n")))]
556 "ix86_match_ccmode (insn, CCNOmode)"
558 test{l}\t{%0, %0|%0, %0}
559 cmp{l}\t{%1, %0|%0, %1}"
560 [(set_attr "type" "test,icmp")
561 (set_attr "length_immediate" "0,1")
562 (set_attr "mode" "SI")])
564 (define_insn "*cmpsi_minus_1"
565 [(set (reg FLAGS_REG)
566 (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r")
567 (match_operand:SI 1 "general_operand" "ri,mr"))
569 "ix86_match_ccmode (insn, CCGOCmode)"
570 "cmp{l}\t{%1, %0|%0, %1}"
571 [(set_attr "type" "icmp")
572 (set_attr "mode" "SI")])
574 (define_expand "cmpsi_1"
575 [(set (reg:CC FLAGS_REG)
576 (compare:CC (match_operand:SI 0 "nonimmediate_operand" "rm,r")
577 (match_operand:SI 1 "general_operand" "ri,mr")))]
581 (define_insn "*cmpsi_1_insn"
582 [(set (reg FLAGS_REG)
583 (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r")
584 (match_operand:SI 1 "general_operand" "ri,mr")))]
585 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
586 && ix86_match_ccmode (insn, CCmode)"
587 "cmp{l}\t{%1, %0|%0, %1}"
588 [(set_attr "type" "icmp")
589 (set_attr "mode" "SI")])
591 (define_insn "*cmphi_ccno_1"
592 [(set (reg FLAGS_REG)
593 (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr")
594 (match_operand:HI 1 "const0_operand" "n,n")))]
595 "ix86_match_ccmode (insn, CCNOmode)"
597 test{w}\t{%0, %0|%0, %0}
598 cmp{w}\t{%1, %0|%0, %1}"
599 [(set_attr "type" "test,icmp")
600 (set_attr "length_immediate" "0,1")
601 (set_attr "mode" "HI")])
603 (define_insn "*cmphi_minus_1"
604 [(set (reg FLAGS_REG)
605 (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r")
606 (match_operand:HI 1 "general_operand" "ri,mr"))
608 "ix86_match_ccmode (insn, CCGOCmode)"
609 "cmp{w}\t{%1, %0|%0, %1}"
610 [(set_attr "type" "icmp")
611 (set_attr "mode" "HI")])
613 (define_insn "*cmphi_1"
614 [(set (reg FLAGS_REG)
615 (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r")
616 (match_operand:HI 1 "general_operand" "ri,mr")))]
617 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
618 && ix86_match_ccmode (insn, CCmode)"
619 "cmp{w}\t{%1, %0|%0, %1}"
620 [(set_attr "type" "icmp")
621 (set_attr "mode" "HI")])
623 (define_insn "*cmpqi_ccno_1"
624 [(set (reg FLAGS_REG)
625 (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq")
626 (match_operand:QI 1 "const0_operand" "n,n")))]
627 "ix86_match_ccmode (insn, CCNOmode)"
629 test{b}\t{%0, %0|%0, %0}
630 cmp{b}\t{$0, %0|%0, 0}"
631 [(set_attr "type" "test,icmp")
632 (set_attr "length_immediate" "0,1")
633 (set_attr "mode" "QI")])
635 (define_insn "*cmpqi_1"
636 [(set (reg FLAGS_REG)
637 (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q")
638 (match_operand:QI 1 "general_operand" "qi,mq")))]
639 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
640 && ix86_match_ccmode (insn, CCmode)"
641 "cmp{b}\t{%1, %0|%0, %1}"
642 [(set_attr "type" "icmp")
643 (set_attr "mode" "QI")])
645 (define_insn "*cmpqi_minus_1"
646 [(set (reg FLAGS_REG)
647 (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q")
648 (match_operand:QI 1 "general_operand" "qi,mq"))
650 "ix86_match_ccmode (insn, CCGOCmode)"
651 "cmp{b}\t{%1, %0|%0, %1}"
652 [(set_attr "type" "icmp")
653 (set_attr "mode" "QI")])
655 (define_insn "*cmpqi_ext_1"
656 [(set (reg FLAGS_REG)
658 (match_operand:QI 0 "general_operand" "Qm")
661 (match_operand 1 "ext_register_operand" "Q")
664 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
665 "cmp{b}\t{%h1, %0|%0, %h1}"
666 [(set_attr "type" "icmp")
667 (set_attr "mode" "QI")])
669 (define_insn "*cmpqi_ext_1_rex64"
670 [(set (reg FLAGS_REG)
672 (match_operand:QI 0 "register_operand" "Q")
675 (match_operand 1 "ext_register_operand" "Q")
678 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
679 "cmp{b}\t{%h1, %0|%0, %h1}"
680 [(set_attr "type" "icmp")
681 (set_attr "mode" "QI")])
683 (define_insn "*cmpqi_ext_2"
684 [(set (reg FLAGS_REG)
688 (match_operand 0 "ext_register_operand" "Q")
691 (match_operand:QI 1 "const0_operand" "n")))]
692 "ix86_match_ccmode (insn, CCNOmode)"
694 [(set_attr "type" "test")
695 (set_attr "length_immediate" "0")
696 (set_attr "mode" "QI")])
698 (define_expand "cmpqi_ext_3"
699 [(set (reg:CC FLAGS_REG)
703 (match_operand 0 "ext_register_operand" "")
706 (match_operand:QI 1 "general_operand" "")))]
710 (define_insn "cmpqi_ext_3_insn"
711 [(set (reg FLAGS_REG)
715 (match_operand 0 "ext_register_operand" "Q")
718 (match_operand:QI 1 "general_operand" "Qmn")))]
719 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
720 "cmp{b}\t{%1, %h0|%h0, %1}"
721 [(set_attr "type" "icmp")
722 (set_attr "mode" "QI")])
724 (define_insn "cmpqi_ext_3_insn_rex64"
725 [(set (reg FLAGS_REG)
729 (match_operand 0 "ext_register_operand" "Q")
732 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
733 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
734 "cmp{b}\t{%1, %h0|%h0, %1}"
735 [(set_attr "type" "icmp")
736 (set_attr "mode" "QI")])
738 (define_insn "*cmpqi_ext_4"
739 [(set (reg FLAGS_REG)
743 (match_operand 0 "ext_register_operand" "Q")
748 (match_operand 1 "ext_register_operand" "Q")
751 "ix86_match_ccmode (insn, CCmode)"
752 "cmp{b}\t{%h1, %h0|%h0, %h1}"
753 [(set_attr "type" "icmp")
754 (set_attr "mode" "QI")])
756 ;; These implement float point compares.
757 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
758 ;; which would allow mix and match FP modes on the compares. Which is what
759 ;; the old patterns did, but with many more of them.
761 (define_expand "cmpxf"
762 [(set (reg:CC FLAGS_REG)
763 (compare:CC (match_operand:XF 0 "cmp_fp_expander_operand" "")
764 (match_operand:XF 1 "cmp_fp_expander_operand" "")))]
767 ix86_compare_op0 = operands[0];
768 ix86_compare_op1 = operands[1];
772 (define_expand "cmpdf"
773 [(set (reg:CC FLAGS_REG)
774 (compare:CC (match_operand:DF 0 "cmp_fp_expander_operand" "")
775 (match_operand:DF 1 "cmp_fp_expander_operand" "")))]
776 "TARGET_80387 || TARGET_SSE2"
778 ix86_compare_op0 = operands[0];
779 ix86_compare_op1 = operands[1];
783 (define_expand "cmpsf"
784 [(set (reg:CC FLAGS_REG)
785 (compare:CC (match_operand:SF 0 "cmp_fp_expander_operand" "")
786 (match_operand:SF 1 "cmp_fp_expander_operand" "")))]
787 "TARGET_80387 || TARGET_SSE"
789 ix86_compare_op0 = operands[0];
790 ix86_compare_op1 = operands[1];
794 ;; FP compares, step 1:
795 ;; Set the FP condition codes.
797 ;; CCFPmode compare with exceptions
798 ;; CCFPUmode compare with no exceptions
800 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
801 ;; used to manage the reg stack popping would not be preserved.
803 (define_insn "*cmpfp_0_sf"
804 [(set (match_operand:HI 0 "register_operand" "=a")
807 (match_operand:SF 1 "register_operand" "f")
808 (match_operand:SF 2 "const0_operand" "X"))]
811 "* return output_fp_compare (insn, operands, 0, 0);"
812 [(set_attr "type" "multi")
813 (set_attr "mode" "SF")])
815 (define_insn "*cmpfp_0_df"
816 [(set (match_operand:HI 0 "register_operand" "=a")
819 (match_operand:DF 1 "register_operand" "f")
820 (match_operand:DF 2 "const0_operand" "X"))]
823 "* return output_fp_compare (insn, operands, 0, 0);"
824 [(set_attr "type" "multi")
825 (set_attr "mode" "DF")])
827 (define_insn "*cmpfp_0_xf"
828 [(set (match_operand:HI 0 "register_operand" "=a")
831 (match_operand:XF 1 "register_operand" "f")
832 (match_operand:XF 2 "const0_operand" "X"))]
835 "* return output_fp_compare (insn, operands, 0, 0);"
836 [(set_attr "type" "multi")
837 (set_attr "mode" "XF")])
839 (define_insn "*cmpfp_sf"
840 [(set (match_operand:HI 0 "register_operand" "=a")
843 (match_operand:SF 1 "register_operand" "f")
844 (match_operand:SF 2 "nonimmediate_operand" "fm"))]
847 "* return output_fp_compare (insn, operands, 0, 0);"
848 [(set_attr "type" "multi")
849 (set_attr "mode" "SF")])
851 (define_insn "*cmpfp_df"
852 [(set (match_operand:HI 0 "register_operand" "=a")
855 (match_operand:DF 1 "register_operand" "f")
856 (match_operand:DF 2 "nonimmediate_operand" "fm"))]
859 "* return output_fp_compare (insn, operands, 0, 0);"
860 [(set_attr "type" "multi")
861 (set_attr "mode" "DF")])
863 (define_insn "*cmpfp_xf"
864 [(set (match_operand:HI 0 "register_operand" "=a")
867 (match_operand:XF 1 "register_operand" "f")
868 (match_operand:XF 2 "register_operand" "f"))]
871 "* return output_fp_compare (insn, operands, 0, 0);"
872 [(set_attr "type" "multi")
873 (set_attr "mode" "XF")])
875 (define_insn "*cmpfp_u"
876 [(set (match_operand:HI 0 "register_operand" "=a")
879 (match_operand 1 "register_operand" "f")
880 (match_operand 2 "register_operand" "f"))]
883 && FLOAT_MODE_P (GET_MODE (operands[1]))
884 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
885 "* return output_fp_compare (insn, operands, 0, 1);"
886 [(set_attr "type" "multi")
888 (cond [(match_operand:SF 1 "" "")
890 (match_operand:DF 1 "" "")
893 (const_string "XF")))])
895 (define_insn "*cmpfp_si"
896 [(set (match_operand:HI 0 "register_operand" "=a")
899 (match_operand 1 "register_operand" "f")
900 (match_operator 3 "float_operator"
901 [(match_operand:SI 2 "memory_operand" "m")]))]
903 "TARGET_80387 && TARGET_USE_FIOP
904 && FLOAT_MODE_P (GET_MODE (operands[1]))
905 && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
906 "* return output_fp_compare (insn, operands, 0, 0);"
907 [(set_attr "type" "multi")
908 (set_attr "fp_int_src" "true")
909 (set_attr "mode" "SI")])
911 ;; FP compares, step 2
912 ;; Move the fpsw to ax.
914 (define_insn "x86_fnstsw_1"
915 [(set (match_operand:HI 0 "register_operand" "=a")
916 (unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))]
919 [(set_attr "length" "2")
920 (set_attr "mode" "SI")
921 (set_attr "unit" "i387")])
923 ;; FP compares, step 3
924 ;; Get ax into flags, general case.
926 (define_insn "x86_sahf_1"
927 [(set (reg:CC FLAGS_REG)
928 (unspec:CC [(match_operand:HI 0 "register_operand" "a")] UNSPEC_SAHF))]
931 [(set_attr "length" "1")
932 (set_attr "athlon_decode" "vector")
933 (set_attr "mode" "SI")])
935 ;; Pentium Pro can do steps 1 through 3 in one go.
937 (define_insn "*cmpfp_i"
938 [(set (reg:CCFP FLAGS_REG)
939 (compare:CCFP (match_operand 0 "register_operand" "f")
940 (match_operand 1 "register_operand" "f")))]
941 "TARGET_80387 && TARGET_CMOVE
942 && !SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
943 && FLOAT_MODE_P (GET_MODE (operands[0]))
944 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
945 "* return output_fp_compare (insn, operands, 1, 0);"
946 [(set_attr "type" "fcmp")
948 (cond [(match_operand:SF 1 "" "")
950 (match_operand:DF 1 "" "")
953 (const_string "XF")))
954 (set_attr "athlon_decode" "vector")])
956 (define_insn "*cmpfp_i_sse"
957 [(set (reg:CCFP FLAGS_REG)
958 (compare:CCFP (match_operand 0 "register_operand" "f#x,x#f")
959 (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))]
961 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
962 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
963 "* return output_fp_compare (insn, operands, 1, 0);"
964 [(set_attr "type" "fcmp,ssecomi")
966 (if_then_else (match_operand:SF 1 "" "")
968 (const_string "DF")))
969 (set_attr "athlon_decode" "vector")])
971 (define_insn "*cmpfp_i_sse_only"
972 [(set (reg:CCFP FLAGS_REG)
973 (compare:CCFP (match_operand 0 "register_operand" "x")
974 (match_operand 1 "nonimmediate_operand" "xm")))]
975 "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
976 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
977 "* return output_fp_compare (insn, operands, 1, 0);"
978 [(set_attr "type" "ssecomi")
980 (if_then_else (match_operand:SF 1 "" "")
982 (const_string "DF")))
983 (set_attr "athlon_decode" "vector")])
985 (define_insn "*cmpfp_iu"
986 [(set (reg:CCFPU FLAGS_REG)
987 (compare:CCFPU (match_operand 0 "register_operand" "f")
988 (match_operand 1 "register_operand" "f")))]
989 "TARGET_80387 && TARGET_CMOVE
990 && !SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
991 && FLOAT_MODE_P (GET_MODE (operands[0]))
992 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
993 "* return output_fp_compare (insn, operands, 1, 1);"
994 [(set_attr "type" "fcmp")
996 (cond [(match_operand:SF 1 "" "")
998 (match_operand:DF 1 "" "")
1001 (const_string "XF")))
1002 (set_attr "athlon_decode" "vector")])
1004 (define_insn "*cmpfp_iu_sse"
1005 [(set (reg:CCFPU FLAGS_REG)
1006 (compare:CCFPU (match_operand 0 "register_operand" "f#x,x#f")
1007 (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))]
1009 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1010 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1011 "* return output_fp_compare (insn, operands, 1, 1);"
1012 [(set_attr "type" "fcmp,ssecomi")
1014 (if_then_else (match_operand:SF 1 "" "")
1016 (const_string "DF")))
1017 (set_attr "athlon_decode" "vector")])
1019 (define_insn "*cmpfp_iu_sse_only"
1020 [(set (reg:CCFPU FLAGS_REG)
1021 (compare:CCFPU (match_operand 0 "register_operand" "x")
1022 (match_operand 1 "nonimmediate_operand" "xm")))]
1023 "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1024 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1025 "* return output_fp_compare (insn, operands, 1, 1);"
1026 [(set_attr "type" "ssecomi")
1028 (if_then_else (match_operand:SF 1 "" "")
1030 (const_string "DF")))
1031 (set_attr "athlon_decode" "vector")])
1033 ;; Move instructions.
1035 ;; General case of fullword move.
1037 (define_expand "movsi"
1038 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1039 (match_operand:SI 1 "general_operand" ""))]
1041 "ix86_expand_move (SImode, operands); DONE;")
1043 ;; Push/pop instructions. They are separate since autoinc/dec is not a
1046 ;; %%% We don't use a post-inc memory reference because x86 is not a
1047 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1048 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1049 ;; targets without our curiosities, and it is just as easy to represent
1050 ;; this differently.
1052 (define_insn "*pushsi2"
1053 [(set (match_operand:SI 0 "push_operand" "=<")
1054 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1057 [(set_attr "type" "push")
1058 (set_attr "mode" "SI")])
1060 ;; For 64BIT abi we always round up to 8 bytes.
1061 (define_insn "*pushsi2_rex64"
1062 [(set (match_operand:SI 0 "push_operand" "=X")
1063 (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1066 [(set_attr "type" "push")
1067 (set_attr "mode" "SI")])
1069 (define_insn "*pushsi2_prologue"
1070 [(set (match_operand:SI 0 "push_operand" "=<")
1071 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1072 (clobber (mem:BLK (scratch)))]
1075 [(set_attr "type" "push")
1076 (set_attr "mode" "SI")])
1078 (define_insn "*popsi1_epilogue"
1079 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1080 (mem:SI (reg:SI SP_REG)))
1081 (set (reg:SI SP_REG)
1082 (plus:SI (reg:SI SP_REG) (const_int 4)))
1083 (clobber (mem:BLK (scratch)))]
1086 [(set_attr "type" "pop")
1087 (set_attr "mode" "SI")])
1089 (define_insn "popsi1"
1090 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1091 (mem:SI (reg:SI SP_REG)))
1092 (set (reg:SI SP_REG)
1093 (plus:SI (reg:SI SP_REG) (const_int 4)))]
1096 [(set_attr "type" "pop")
1097 (set_attr "mode" "SI")])
1099 (define_insn "*movsi_xor"
1100 [(set (match_operand:SI 0 "register_operand" "=r")
1101 (match_operand:SI 1 "const0_operand" "i"))
1102 (clobber (reg:CC FLAGS_REG))]
1103 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1104 "xor{l}\t{%0, %0|%0, %0}"
1105 [(set_attr "type" "alu1")
1106 (set_attr "mode" "SI")
1107 (set_attr "length_immediate" "0")])
1109 (define_insn "*movsi_or"
1110 [(set (match_operand:SI 0 "register_operand" "=r")
1111 (match_operand:SI 1 "immediate_operand" "i"))
1112 (clobber (reg:CC FLAGS_REG))]
1114 && operands[1] == constm1_rtx
1115 && (TARGET_PENTIUM || optimize_size)"
1117 operands[1] = constm1_rtx;
1118 return "or{l}\t{%1, %0|%0, %1}";
1120 [(set_attr "type" "alu1")
1121 (set_attr "mode" "SI")
1122 (set_attr "length_immediate" "1")])
1124 (define_insn "*movsi_1"
1125 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,!*y,!rm,!*y,!*Y,!rm,!*Y")
1126 (match_operand:SI 1 "general_operand" "rinm,rin,*y,*y,rm,*Y,*Y,rm"))]
1127 "(TARGET_INTER_UNIT_MOVES || optimize_size)
1128 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1130 switch (get_attr_type (insn))
1133 if (get_attr_mode (insn) == MODE_TI)
1134 return "movdqa\t{%1, %0|%0, %1}";
1135 return "movd\t{%1, %0|%0, %1}";
1138 if (get_attr_mode (insn) == MODE_DI)
1139 return "movq\t{%1, %0|%0, %1}";
1140 return "movd\t{%1, %0|%0, %1}";
1143 return "lea{l}\t{%1, %0|%0, %1}";
1146 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1148 return "mov{l}\t{%1, %0|%0, %1}";
1152 (cond [(eq_attr "alternative" "2,3,4")
1153 (const_string "mmxmov")
1154 (eq_attr "alternative" "5,6,7")
1155 (const_string "ssemov")
1156 (and (ne (symbol_ref "flag_pic") (const_int 0))
1157 (match_operand:SI 1 "symbolic_operand" ""))
1158 (const_string "lea")
1160 (const_string "imov")))
1161 (set_attr "mode" "SI,SI,DI,SI,SI,TI,SI,SI")])
1163 (define_insn "*movsi_1_nointernunit"
1164 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,!*y,!m,!*y,!*Y,!m,!*Y")
1165 (match_operand:SI 1 "general_operand" "rinm,rin,*y,*y,m,*Y,*Y,m"))]
1166 "(!TARGET_INTER_UNIT_MOVES && !optimize_size)
1167 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1169 switch (get_attr_type (insn))
1172 if (get_attr_mode (insn) == MODE_TI)
1173 return "movdqa\t{%1, %0|%0, %1}";
1174 return "movd\t{%1, %0|%0, %1}";
1177 if (get_attr_mode (insn) == MODE_DI)
1178 return "movq\t{%1, %0|%0, %1}";
1179 return "movd\t{%1, %0|%0, %1}";
1182 return "lea{l}\t{%1, %0|%0, %1}";
1185 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1187 return "mov{l}\t{%1, %0|%0, %1}";
1191 (cond [(eq_attr "alternative" "2,3,4")
1192 (const_string "mmxmov")
1193 (eq_attr "alternative" "5,6,7")
1194 (const_string "ssemov")
1195 (and (ne (symbol_ref "flag_pic") (const_int 0))
1196 (match_operand:SI 1 "symbolic_operand" ""))
1197 (const_string "lea")
1199 (const_string "imov")))
1200 (set_attr "mode" "SI,SI,DI,SI,SI,TI,SI,SI")])
1202 ;; Stores and loads of ax to arbitrary constant address.
1203 ;; We fake an second form of instruction to force reload to load address
1204 ;; into register when rax is not available
1205 (define_insn "*movabssi_1_rex64"
1206 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1207 (match_operand:SI 1 "nonmemory_operand" "a,er"))]
1208 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1210 movabs{l}\t{%1, %P0|%P0, %1}
1211 mov{l}\t{%1, %a0|%a0, %1}"
1212 [(set_attr "type" "imov")
1213 (set_attr "modrm" "0,*")
1214 (set_attr "length_address" "8,0")
1215 (set_attr "length_immediate" "0,*")
1216 (set_attr "memory" "store")
1217 (set_attr "mode" "SI")])
1219 (define_insn "*movabssi_2_rex64"
1220 [(set (match_operand:SI 0 "register_operand" "=a,r")
1221 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1222 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1224 movabs{l}\t{%P1, %0|%0, %P1}
1225 mov{l}\t{%a1, %0|%0, %a1}"
1226 [(set_attr "type" "imov")
1227 (set_attr "modrm" "0,*")
1228 (set_attr "length_address" "8,0")
1229 (set_attr "length_immediate" "0")
1230 (set_attr "memory" "load")
1231 (set_attr "mode" "SI")])
1233 (define_insn "*swapsi"
1234 [(set (match_operand:SI 0 "register_operand" "+r")
1235 (match_operand:SI 1 "register_operand" "+r"))
1240 [(set_attr "type" "imov")
1241 (set_attr "mode" "SI")
1242 (set_attr "pent_pair" "np")
1243 (set_attr "athlon_decode" "vector")])
1245 (define_expand "movhi"
1246 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1247 (match_operand:HI 1 "general_operand" ""))]
1249 "ix86_expand_move (HImode, operands); DONE;")
1251 (define_insn "*pushhi2"
1252 [(set (match_operand:HI 0 "push_operand" "=<,<")
1253 (match_operand:HI 1 "general_no_elim_operand" "n,r*m"))]
1256 push{w}\t{|WORD PTR }%1
1258 [(set_attr "type" "push")
1259 (set_attr "mode" "HI")])
1261 ;; For 64BIT abi we always round up to 8 bytes.
1262 (define_insn "*pushhi2_rex64"
1263 [(set (match_operand:HI 0 "push_operand" "=X")
1264 (match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))]
1267 [(set_attr "type" "push")
1268 (set_attr "mode" "QI")])
1270 (define_insn "*movhi_1"
1271 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
1272 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
1273 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1275 switch (get_attr_type (insn))
1278 /* movzwl is faster than movw on p2 due to partial word stalls,
1279 though not as fast as an aligned movl. */
1280 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1282 if (get_attr_mode (insn) == MODE_SI)
1283 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1285 return "mov{w}\t{%1, %0|%0, %1}";
1289 (cond [(ne (symbol_ref "optimize_size") (const_int 0))
1290 (const_string "imov")
1291 (and (eq_attr "alternative" "0")
1292 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1294 (eq (symbol_ref "TARGET_HIMODE_MATH")
1296 (const_string "imov")
1297 (and (eq_attr "alternative" "1,2")
1298 (match_operand:HI 1 "aligned_operand" ""))
1299 (const_string "imov")
1300 (and (ne (symbol_ref "TARGET_MOVX")
1302 (eq_attr "alternative" "0,2"))
1303 (const_string "imovx")
1305 (const_string "imov")))
1307 (cond [(eq_attr "type" "imovx")
1309 (and (eq_attr "alternative" "1,2")
1310 (match_operand:HI 1 "aligned_operand" ""))
1312 (and (eq_attr "alternative" "0")
1313 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1315 (eq (symbol_ref "TARGET_HIMODE_MATH")
1319 (const_string "HI")))])
1321 ;; Stores and loads of ax to arbitrary constant address.
1322 ;; We fake an second form of instruction to force reload to load address
1323 ;; into register when rax is not available
1324 (define_insn "*movabshi_1_rex64"
1325 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1326 (match_operand:HI 1 "nonmemory_operand" "a,er"))]
1327 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1329 movabs{w}\t{%1, %P0|%P0, %1}
1330 mov{w}\t{%1, %a0|%a0, %1}"
1331 [(set_attr "type" "imov")
1332 (set_attr "modrm" "0,*")
1333 (set_attr "length_address" "8,0")
1334 (set_attr "length_immediate" "0,*")
1335 (set_attr "memory" "store")
1336 (set_attr "mode" "HI")])
1338 (define_insn "*movabshi_2_rex64"
1339 [(set (match_operand:HI 0 "register_operand" "=a,r")
1340 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1341 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1343 movabs{w}\t{%P1, %0|%0, %P1}
1344 mov{w}\t{%a1, %0|%0, %a1}"
1345 [(set_attr "type" "imov")
1346 (set_attr "modrm" "0,*")
1347 (set_attr "length_address" "8,0")
1348 (set_attr "length_immediate" "0")
1349 (set_attr "memory" "load")
1350 (set_attr "mode" "HI")])
1352 (define_insn "*swaphi_1"
1353 [(set (match_operand:HI 0 "register_operand" "+r")
1354 (match_operand:HI 1 "register_operand" "+r"))
1357 "!TARGET_PARTIAL_REG_STALL || optimize_size"
1359 [(set_attr "type" "imov")
1360 (set_attr "mode" "SI")
1361 (set_attr "pent_pair" "np")
1362 (set_attr "athlon_decode" "vector")])
1364 (define_insn "*swaphi_2"
1365 [(set (match_operand:HI 0 "register_operand" "+r")
1366 (match_operand:HI 1 "register_operand" "+r"))
1369 "TARGET_PARTIAL_REG_STALL"
1371 [(set_attr "type" "imov")
1372 (set_attr "mode" "HI")
1373 (set_attr "pent_pair" "np")
1374 (set_attr "athlon_decode" "vector")])
1376 (define_expand "movstricthi"
1377 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1378 (match_operand:HI 1 "general_operand" ""))]
1379 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1381 /* Don't generate memory->memory moves, go through a register */
1382 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1383 operands[1] = force_reg (HImode, operands[1]);
1386 (define_insn "*movstricthi_1"
1387 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1388 (match_operand:HI 1 "general_operand" "rn,m"))]
1389 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1390 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1391 "mov{w}\t{%1, %0|%0, %1}"
1392 [(set_attr "type" "imov")
1393 (set_attr "mode" "HI")])
1395 (define_insn "*movstricthi_xor"
1396 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1397 (match_operand:HI 1 "const0_operand" "i"))
1398 (clobber (reg:CC FLAGS_REG))]
1400 && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"
1401 "xor{w}\t{%0, %0|%0, %0}"
1402 [(set_attr "type" "alu1")
1403 (set_attr "mode" "HI")
1404 (set_attr "length_immediate" "0")])
1406 (define_expand "movqi"
1407 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1408 (match_operand:QI 1 "general_operand" ""))]
1410 "ix86_expand_move (QImode, operands); DONE;")
1412 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1413 ;; "push a byte". But actually we use pushw, which has the effect
1414 ;; of rounding the amount pushed up to a halfword.
1416 (define_insn "*pushqi2"
1417 [(set (match_operand:QI 0 "push_operand" "=X,X")
1418 (match_operand:QI 1 "nonmemory_no_elim_operand" "n,r"))]
1421 push{w}\t{|word ptr }%1
1423 [(set_attr "type" "push")
1424 (set_attr "mode" "HI")])
1426 ;; For 64BIT abi we always round up to 8 bytes.
1427 (define_insn "*pushqi2_rex64"
1428 [(set (match_operand:QI 0 "push_operand" "=X")
1429 (match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))]
1432 [(set_attr "type" "push")
1433 (set_attr "mode" "QI")])
1435 ;; Situation is quite tricky about when to choose full sized (SImode) move
1436 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1437 ;; partial register dependency machines (such as AMD Athlon), where QImode
1438 ;; moves issue extra dependency and for partial register stalls machines
1439 ;; that don't use QImode patterns (and QImode move cause stall on the next
1442 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1443 ;; register stall machines with, where we use QImode instructions, since
1444 ;; partial register stall can be caused there. Then we use movzx.
1445 (define_insn "*movqi_1"
1446 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1447 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1448 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1450 switch (get_attr_type (insn))
1453 if (!ANY_QI_REG_P (operands[1]) && GET_CODE (operands[1]) != MEM)
1455 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1457 if (get_attr_mode (insn) == MODE_SI)
1458 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1460 return "mov{b}\t{%1, %0|%0, %1}";
1464 (cond [(ne (symbol_ref "optimize_size") (const_int 0))
1465 (const_string "imov")
1466 (and (eq_attr "alternative" "3")
1467 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1469 (eq (symbol_ref "TARGET_QIMODE_MATH")
1471 (const_string "imov")
1472 (eq_attr "alternative" "3,5")
1473 (const_string "imovx")
1474 (and (ne (symbol_ref "TARGET_MOVX")
1476 (eq_attr "alternative" "2"))
1477 (const_string "imovx")
1479 (const_string "imov")))
1481 (cond [(eq_attr "alternative" "3,4,5")
1483 (eq_attr "alternative" "6")
1485 (eq_attr "type" "imovx")
1487 (and (eq_attr "type" "imov")
1488 (and (eq_attr "alternative" "0,1,2")
1489 (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
1492 ;; Avoid partial register stalls when not using QImode arithmetic
1493 (and (eq_attr "type" "imov")
1494 (and (eq_attr "alternative" "0,1,2")
1495 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
1497 (eq (symbol_ref "TARGET_QIMODE_MATH")
1501 (const_string "QI")))])
1503 (define_expand "reload_outqi"
1504 [(parallel [(match_operand:QI 0 "" "=m")
1505 (match_operand:QI 1 "register_operand" "r")
1506 (match_operand:QI 2 "register_operand" "=&q")])]
1510 op0 = operands[0]; op1 = operands[1]; op2 = operands[2];
1512 if (reg_overlap_mentioned_p (op2, op0))
1514 if (! q_regs_operand (op1, QImode))
1516 emit_insn (gen_movqi (op2, op1));
1519 emit_insn (gen_movqi (op0, op1));
1523 (define_insn "*swapqi_1"
1524 [(set (match_operand:QI 0 "register_operand" "+r")
1525 (match_operand:QI 1 "register_operand" "+r"))
1528 "!TARGET_PARTIAL_REG_STALL || optimize_size"
1530 [(set_attr "type" "imov")
1531 (set_attr "mode" "SI")
1532 (set_attr "pent_pair" "np")
1533 (set_attr "athlon_decode" "vector")])
1535 (define_insn "*swapqi_2"
1536 [(set (match_operand:QI 0 "register_operand" "+q")
1537 (match_operand:QI 1 "register_operand" "+q"))
1540 "TARGET_PARTIAL_REG_STALL"
1542 [(set_attr "type" "imov")
1543 (set_attr "mode" "QI")
1544 (set_attr "pent_pair" "np")
1545 (set_attr "athlon_decode" "vector")])
1547 (define_expand "movstrictqi"
1548 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1549 (match_operand:QI 1 "general_operand" ""))]
1550 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1552 /* Don't generate memory->memory moves, go through a register. */
1553 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1554 operands[1] = force_reg (QImode, operands[1]);
1557 (define_insn "*movstrictqi_1"
1558 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
1559 (match_operand:QI 1 "general_operand" "*qn,m"))]
1560 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1561 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1562 "mov{b}\t{%1, %0|%0, %1}"
1563 [(set_attr "type" "imov")
1564 (set_attr "mode" "QI")])
1566 (define_insn "*movstrictqi_xor"
1567 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
1568 (match_operand:QI 1 "const0_operand" "i"))
1569 (clobber (reg:CC FLAGS_REG))]
1570 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1571 "xor{b}\t{%0, %0|%0, %0}"
1572 [(set_attr "type" "alu1")
1573 (set_attr "mode" "QI")
1574 (set_attr "length_immediate" "0")])
1576 (define_insn "*movsi_extv_1"
1577 [(set (match_operand:SI 0 "register_operand" "=R")
1578 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
1582 "movs{bl|x}\t{%h1, %0|%0, %h1}"
1583 [(set_attr "type" "imovx")
1584 (set_attr "mode" "SI")])
1586 (define_insn "*movhi_extv_1"
1587 [(set (match_operand:HI 0 "register_operand" "=R")
1588 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
1592 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
1593 [(set_attr "type" "imovx")
1594 (set_attr "mode" "SI")])
1596 (define_insn "*movqi_extv_1"
1597 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
1598 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1603 switch (get_attr_type (insn))
1606 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1608 return "mov{b}\t{%h1, %0|%0, %h1}";
1612 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1613 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1614 (ne (symbol_ref "TARGET_MOVX")
1616 (const_string "imovx")
1617 (const_string "imov")))
1619 (if_then_else (eq_attr "type" "imovx")
1621 (const_string "QI")))])
1623 (define_insn "*movqi_extv_1_rex64"
1624 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1625 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1630 switch (get_attr_type (insn))
1633 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1635 return "mov{b}\t{%h1, %0|%0, %h1}";
1639 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1640 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1641 (ne (symbol_ref "TARGET_MOVX")
1643 (const_string "imovx")
1644 (const_string "imov")))
1646 (if_then_else (eq_attr "type" "imovx")
1648 (const_string "QI")))])
1650 ;; Stores and loads of ax to arbitrary constant address.
1651 ;; We fake an second form of instruction to force reload to load address
1652 ;; into register when rax is not available
1653 (define_insn "*movabsqi_1_rex64"
1654 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1655 (match_operand:QI 1 "nonmemory_operand" "a,er"))]
1656 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1658 movabs{b}\t{%1, %P0|%P0, %1}
1659 mov{b}\t{%1, %a0|%a0, %1}"
1660 [(set_attr "type" "imov")
1661 (set_attr "modrm" "0,*")
1662 (set_attr "length_address" "8,0")
1663 (set_attr "length_immediate" "0,*")
1664 (set_attr "memory" "store")
1665 (set_attr "mode" "QI")])
1667 (define_insn "*movabsqi_2_rex64"
1668 [(set (match_operand:QI 0 "register_operand" "=a,r")
1669 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1670 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1672 movabs{b}\t{%P1, %0|%0, %P1}
1673 mov{b}\t{%a1, %0|%0, %a1}"
1674 [(set_attr "type" "imov")
1675 (set_attr "modrm" "0,*")
1676 (set_attr "length_address" "8,0")
1677 (set_attr "length_immediate" "0")
1678 (set_attr "memory" "load")
1679 (set_attr "mode" "QI")])
1681 (define_insn "*movsi_extzv_1"
1682 [(set (match_operand:SI 0 "register_operand" "=R")
1683 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
1687 "movz{bl|x}\t{%h1, %0|%0, %h1}"
1688 [(set_attr "type" "imovx")
1689 (set_attr "mode" "SI")])
1691 (define_insn "*movqi_extzv_2"
1692 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
1693 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1698 switch (get_attr_type (insn))
1701 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1703 return "mov{b}\t{%h1, %0|%0, %h1}";
1707 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1708 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1709 (ne (symbol_ref "TARGET_MOVX")
1711 (const_string "imovx")
1712 (const_string "imov")))
1714 (if_then_else (eq_attr "type" "imovx")
1716 (const_string "QI")))])
1718 (define_insn "*movqi_extzv_2_rex64"
1719 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1720 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1725 switch (get_attr_type (insn))
1728 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1730 return "mov{b}\t{%h1, %0|%0, %h1}";
1734 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1735 (ne (symbol_ref "TARGET_MOVX")
1737 (const_string "imovx")
1738 (const_string "imov")))
1740 (if_then_else (eq_attr "type" "imovx")
1742 (const_string "QI")))])
1744 (define_insn "movsi_insv_1"
1745 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1748 (match_operand:SI 1 "general_operand" "Qmn"))]
1750 "mov{b}\t{%b1, %h0|%h0, %b1}"
1751 [(set_attr "type" "imov")
1752 (set_attr "mode" "QI")])
1754 (define_insn "movdi_insv_1_rex64"
1755 [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
1758 (match_operand:DI 1 "nonmemory_operand" "Qn"))]
1760 "mov{b}\t{%b1, %h0|%h0, %b1}"
1761 [(set_attr "type" "imov")
1762 (set_attr "mode" "QI")])
1764 (define_insn "*movqi_insv_2"
1765 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1768 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
1771 "mov{b}\t{%h1, %h0|%h0, %h1}"
1772 [(set_attr "type" "imov")
1773 (set_attr "mode" "QI")])
1775 (define_expand "movdi"
1776 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1777 (match_operand:DI 1 "general_operand" ""))]
1779 "ix86_expand_move (DImode, operands); DONE;")
1781 (define_insn "*pushdi"
1782 [(set (match_operand:DI 0 "push_operand" "=<")
1783 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
1787 (define_insn "pushdi2_rex64"
1788 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1789 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1794 [(set_attr "type" "push,multi")
1795 (set_attr "mode" "DI")])
1797 ;; Convert impossible pushes of immediate to existing instructions.
1798 ;; First try to get scratch register and go through it. In case this
1799 ;; fails, push sign extended lower part first and then overwrite
1800 ;; upper part by 32bit move.
1802 [(match_scratch:DI 2 "r")
1803 (set (match_operand:DI 0 "push_operand" "")
1804 (match_operand:DI 1 "immediate_operand" ""))]
1805 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1806 && !x86_64_immediate_operand (operands[1], DImode)"
1807 [(set (match_dup 2) (match_dup 1))
1808 (set (match_dup 0) (match_dup 2))]
1811 ;; We need to define this as both peepholer and splitter for case
1812 ;; peephole2 pass is not run.
1813 ;; "&& 1" is needed to keep it from matching the previous pattern.
1815 [(set (match_operand:DI 0 "push_operand" "")
1816 (match_operand:DI 1 "immediate_operand" ""))]
1817 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1818 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1819 [(set (match_dup 0) (match_dup 1))
1820 (set (match_dup 2) (match_dup 3))]
1821 "split_di (operands + 1, 1, operands + 2, operands + 3);
1822 operands[1] = gen_lowpart (DImode, operands[2]);
1823 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1828 [(set (match_operand:DI 0 "push_operand" "")
1829 (match_operand:DI 1 "immediate_operand" ""))]
1830 "TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)
1831 && !symbolic_operand (operands[1], DImode)
1832 && !x86_64_immediate_operand (operands[1], DImode)"
1833 [(set (match_dup 0) (match_dup 1))
1834 (set (match_dup 2) (match_dup 3))]
1835 "split_di (operands + 1, 1, operands + 2, operands + 3);
1836 operands[1] = gen_lowpart (DImode, operands[2]);
1837 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1841 (define_insn "*pushdi2_prologue_rex64"
1842 [(set (match_operand:DI 0 "push_operand" "=<")
1843 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
1844 (clobber (mem:BLK (scratch)))]
1847 [(set_attr "type" "push")
1848 (set_attr "mode" "DI")])
1850 (define_insn "*popdi1_epilogue_rex64"
1851 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1852 (mem:DI (reg:DI SP_REG)))
1853 (set (reg:DI SP_REG)
1854 (plus:DI (reg:DI SP_REG) (const_int 8)))
1855 (clobber (mem:BLK (scratch)))]
1858 [(set_attr "type" "pop")
1859 (set_attr "mode" "DI")])
1861 (define_insn "popdi1"
1862 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1863 (mem:DI (reg:DI SP_REG)))
1864 (set (reg:DI SP_REG)
1865 (plus:DI (reg:DI SP_REG) (const_int 8)))]
1868 [(set_attr "type" "pop")
1869 (set_attr "mode" "DI")])
1871 (define_insn "*movdi_xor_rex64"
1872 [(set (match_operand:DI 0 "register_operand" "=r")
1873 (match_operand:DI 1 "const0_operand" "i"))
1874 (clobber (reg:CC FLAGS_REG))]
1875 "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size)
1876 && reload_completed"
1877 "xor{l}\t{%k0, %k0|%k0, %k0}"
1878 [(set_attr "type" "alu1")
1879 (set_attr "mode" "SI")
1880 (set_attr "length_immediate" "0")])
1882 (define_insn "*movdi_or_rex64"
1883 [(set (match_operand:DI 0 "register_operand" "=r")
1884 (match_operand:DI 1 "const_int_operand" "i"))
1885 (clobber (reg:CC FLAGS_REG))]
1886 "TARGET_64BIT && (TARGET_PENTIUM || optimize_size)
1888 && operands[1] == constm1_rtx"
1890 operands[1] = constm1_rtx;
1891 return "or{q}\t{%1, %0|%0, %1}";
1893 [(set_attr "type" "alu1")
1894 (set_attr "mode" "DI")
1895 (set_attr "length_immediate" "1")])
1897 (define_insn "*movdi_2"
1898 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!m*y,!*y,!m,!*Y,!*Y")
1899 (match_operand:DI 1 "general_operand" "riFo,riF,*y,m,*Y,*Y,m"))]
1901 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1905 movq\t{%1, %0|%0, %1}
1906 movq\t{%1, %0|%0, %1}
1907 movq\t{%1, %0|%0, %1}
1908 movdqa\t{%1, %0|%0, %1}
1909 movq\t{%1, %0|%0, %1}"
1910 [(set_attr "type" "*,*,mmx,mmx,ssemov,ssemov,ssemov")
1911 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
1914 [(set (match_operand:DI 0 "push_operand" "")
1915 (match_operand:DI 1 "general_operand" ""))]
1916 "!TARGET_64BIT && reload_completed
1917 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1919 "ix86_split_long_move (operands); DONE;")
1921 ;; %%% This multiword shite has got to go.
1923 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1924 (match_operand:DI 1 "general_operand" ""))]
1925 "!TARGET_64BIT && reload_completed
1926 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
1927 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1929 "ix86_split_long_move (operands); DONE;")
1931 (define_insn "*movdi_1_rex64"
1932 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!*y,!rm,!*y,!*Y,!rm,!*Y,!*Y,!*y")
1933 (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,*y,rm,*Y,*Y,rm,*y,*Y"))]
1935 && (TARGET_INTER_UNIT_MOVES || optimize_size)
1936 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1938 switch (get_attr_type (insn))
1941 if (which_alternative == 11)
1942 return "movq2dq\t{%1, %0|%0, %1}";
1944 return "movdq2q\t{%1, %0|%0, %1}";
1946 if (get_attr_mode (insn) == MODE_TI)
1947 return "movdqa\t{%1, %0|%0, %1}";
1950 /* Moves from and into integer register is done using movd opcode with
1952 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
1953 return "movd\t{%1, %0|%0, %1}";
1954 return "movq\t{%1, %0|%0, %1}";
1958 return "lea{q}\t{%a1, %0|%0, %a1}";
1960 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1962 if (get_attr_mode (insn) == MODE_SI)
1963 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1964 else if (which_alternative == 2)
1965 return "movabs{q}\t{%1, %0|%0, %1}";
1967 return "mov{q}\t{%1, %0|%0, %1}";
1971 (cond [(eq_attr "alternative" "5,6,7")
1972 (const_string "mmxmov")
1973 (eq_attr "alternative" "8,9,10")
1974 (const_string "ssemov")
1975 (eq_attr "alternative" "11,12")
1976 (const_string "ssecvt")
1977 (eq_attr "alternative" "4")
1978 (const_string "multi")
1979 (and (ne (symbol_ref "flag_pic") (const_int 0))
1980 (match_operand:DI 1 "symbolic_operand" ""))
1981 (const_string "lea")
1983 (const_string "imov")))
1984 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*,*,*")
1985 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*,*,*")
1986 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI,DI,DI")])
1988 (define_insn "*movdi_1_rex64_nointerunit"
1989 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!*y,!m,!*y,!*Y,!m,!*Y")
1990 (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,*y,m,*Y,*Y,m"))]
1992 && (!TARGET_INTER_UNIT_MOVES && !optimize_size)
1993 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1995 switch (get_attr_type (insn))
1998 if (get_attr_mode (insn) == MODE_TI)
1999 return "movdqa\t{%1, %0|%0, %1}";
2002 return "movq\t{%1, %0|%0, %1}";
2006 return "lea{q}\t{%a1, %0|%0, %a1}";
2008 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
2010 if (get_attr_mode (insn) == MODE_SI)
2011 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2012 else if (which_alternative == 2)
2013 return "movabs{q}\t{%1, %0|%0, %1}";
2015 return "mov{q}\t{%1, %0|%0, %1}";
2019 (cond [(eq_attr "alternative" "5,6,7")
2020 (const_string "mmxmov")
2021 (eq_attr "alternative" "8,9,10")
2022 (const_string "ssemov")
2023 (eq_attr "alternative" "4")
2024 (const_string "multi")
2025 (and (ne (symbol_ref "flag_pic") (const_int 0))
2026 (match_operand:DI 1 "symbolic_operand" ""))
2027 (const_string "lea")
2029 (const_string "imov")))
2030 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*")
2031 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*")
2032 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI")])
2034 ;; Stores and loads of ax to arbitrary constant address.
2035 ;; We fake an second form of instruction to force reload to load address
2036 ;; into register when rax is not available
2037 (define_insn "*movabsdi_1_rex64"
2038 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2039 (match_operand:DI 1 "nonmemory_operand" "a,er"))]
2040 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2042 movabs{q}\t{%1, %P0|%P0, %1}
2043 mov{q}\t{%1, %a0|%a0, %1}"
2044 [(set_attr "type" "imov")
2045 (set_attr "modrm" "0,*")
2046 (set_attr "length_address" "8,0")
2047 (set_attr "length_immediate" "0,*")
2048 (set_attr "memory" "store")
2049 (set_attr "mode" "DI")])
2051 (define_insn "*movabsdi_2_rex64"
2052 [(set (match_operand:DI 0 "register_operand" "=a,r")
2053 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2054 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2056 movabs{q}\t{%P1, %0|%0, %P1}
2057 mov{q}\t{%a1, %0|%0, %a1}"
2058 [(set_attr "type" "imov")
2059 (set_attr "modrm" "0,*")
2060 (set_attr "length_address" "8,0")
2061 (set_attr "length_immediate" "0")
2062 (set_attr "memory" "load")
2063 (set_attr "mode" "DI")])
2065 ;; Convert impossible stores of immediate to existing instructions.
2066 ;; First try to get scratch register and go through it. In case this
2067 ;; fails, move by 32bit parts.
2069 [(match_scratch:DI 2 "r")
2070 (set (match_operand:DI 0 "memory_operand" "")
2071 (match_operand:DI 1 "immediate_operand" ""))]
2072 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2073 && !x86_64_immediate_operand (operands[1], DImode)"
2074 [(set (match_dup 2) (match_dup 1))
2075 (set (match_dup 0) (match_dup 2))]
2078 ;; We need to define this as both peepholer and splitter for case
2079 ;; peephole2 pass is not run.
2080 ;; "&& 1" is needed to keep it from matching the previous pattern.
2082 [(set (match_operand:DI 0 "memory_operand" "")
2083 (match_operand:DI 1 "immediate_operand" ""))]
2084 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2085 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2086 [(set (match_dup 2) (match_dup 3))
2087 (set (match_dup 4) (match_dup 5))]
2088 "split_di (operands, 2, operands + 2, operands + 4);")
2091 [(set (match_operand:DI 0 "memory_operand" "")
2092 (match_operand:DI 1 "immediate_operand" ""))]
2093 "TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)
2094 && !symbolic_operand (operands[1], DImode)
2095 && !x86_64_immediate_operand (operands[1], DImode)"
2096 [(set (match_dup 2) (match_dup 3))
2097 (set (match_dup 4) (match_dup 5))]
2098 "split_di (operands, 2, operands + 2, operands + 4);")
2100 (define_insn "*swapdi_rex64"
2101 [(set (match_operand:DI 0 "register_operand" "+r")
2102 (match_operand:DI 1 "register_operand" "+r"))
2107 [(set_attr "type" "imov")
2108 (set_attr "mode" "DI")
2109 (set_attr "pent_pair" "np")
2110 (set_attr "athlon_decode" "vector")])
2112 (define_expand "movsf"
2113 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2114 (match_operand:SF 1 "general_operand" ""))]
2116 "ix86_expand_move (SFmode, operands); DONE;")
2118 (define_insn "*pushsf"
2119 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2120 (match_operand:SF 1 "general_no_elim_operand" "f#rx,rFm#fx,x#rf"))]
2123 switch (which_alternative)
2126 return "push{l}\t%1";
2129 /* This insn should be already split before reg-stack. */
2133 [(set_attr "type" "multi,push,multi")
2134 (set_attr "mode" "SF,SI,SF")])
2136 (define_insn "*pushsf_rex64"
2137 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2138 (match_operand:SF 1 "nonmemory_no_elim_operand" "f#rx,rF#fx,x#rf"))]
2141 switch (which_alternative)
2144 return "push{q}\t%q1";
2147 /* This insn should be already split before reg-stack. */
2151 [(set_attr "type" "multi,push,multi")
2152 (set_attr "mode" "SF,DI,SF")])
2155 [(set (match_operand:SF 0 "push_operand" "")
2156 (match_operand:SF 1 "memory_operand" ""))]
2158 && GET_CODE (operands[1]) == MEM
2159 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2160 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
2163 "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
2166 ;; %%% Kill this when call knows how to work this out.
2168 [(set (match_operand:SF 0 "push_operand" "")
2169 (match_operand:SF 1 "any_fp_register_operand" ""))]
2171 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
2172 (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
2175 [(set (match_operand:SF 0 "push_operand" "")
2176 (match_operand:SF 1 "any_fp_register_operand" ""))]
2178 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2179 (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
2181 (define_insn "*movsf_1"
2182 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#xr,m,f#xr,r#xf,m,x#rf,x#rf,x#rf,m,!*y,!rm,!*y")
2183 (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,C,x,xm#rf,x#rf,rm,*y,*y"))]
2184 "(TARGET_INTER_UNIT_MOVES || optimize_size)
2185 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2186 && (reload_in_progress || reload_completed
2187 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2188 || GET_CODE (operands[1]) != CONST_DOUBLE
2189 || memory_operand (operands[0], SFmode))"
2191 switch (which_alternative)
2194 return output_387_reg_move (insn, operands);
2197 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2198 return "fstp%z0\t%y0";
2200 return "fst%z0\t%y0";
2203 return standard_80387_constant_opcode (operands[1]);
2207 return "mov{l}\t{%1, %0|%0, %1}";
2209 if (get_attr_mode (insn) == MODE_TI)
2210 return "pxor\t%0, %0";
2212 return "xorps\t%0, %0";
2214 if (get_attr_mode (insn) == MODE_V4SF)
2215 return "movaps\t{%1, %0|%0, %1}";
2217 return "movss\t{%1, %0|%0, %1}";
2220 return "movss\t{%1, %0|%0, %1}";
2224 return "movd\t{%1, %0|%0, %1}";
2227 return "movq\t{%1, %0|%0, %1}";
2233 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2235 (cond [(eq_attr "alternative" "3,4,9,10")
2237 (eq_attr "alternative" "5")
2239 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2241 (ne (symbol_ref "TARGET_SSE2")
2243 (eq (symbol_ref "optimize_size")
2246 (const_string "V4SF"))
2247 /* For architectures resolving dependencies on
2248 whole SSE registers use APS move to break dependency
2249 chains, otherwise use short move to avoid extra work.
2251 Do the same for architectures resolving dependencies on
2252 the parts. While in DF mode it is better to always handle
2253 just register parts, the SF mode is different due to lack
2254 of instructions to load just part of the register. It is
2255 better to maintain the whole registers in single format
2256 to avoid problems on using packed logical operations. */
2257 (eq_attr "alternative" "6")
2259 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2261 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2263 (const_string "V4SF")
2264 (const_string "SF"))
2265 (eq_attr "alternative" "11")
2266 (const_string "DI")]
2267 (const_string "SF")))])
2269 (define_insn "*movsf_1_nointerunit"
2270 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#xr,m,f#xr,r#xf,m,x#rf,x#rf,x#rf,m,!*y,!m,!*y")
2271 (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,C,x,xm#rf,x#rf,m,*y,*y"))]
2272 "(!TARGET_INTER_UNIT_MOVES && !optimize_size)
2273 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2274 && (reload_in_progress || reload_completed
2275 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2276 || GET_CODE (operands[1]) != CONST_DOUBLE
2277 || memory_operand (operands[0], SFmode))"
2279 switch (which_alternative)
2282 return output_387_reg_move (insn, operands);
2285 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2286 return "fstp%z0\t%y0";
2288 return "fst%z0\t%y0";
2291 return standard_80387_constant_opcode (operands[1]);
2295 return "mov{l}\t{%1, %0|%0, %1}";
2297 if (get_attr_mode (insn) == MODE_TI)
2298 return "pxor\t%0, %0";
2300 return "xorps\t%0, %0";
2302 if (get_attr_mode (insn) == MODE_V4SF)
2303 return "movaps\t{%1, %0|%0, %1}";
2305 return "movss\t{%1, %0|%0, %1}";
2308 return "movss\t{%1, %0|%0, %1}";
2312 return "movd\t{%1, %0|%0, %1}";
2315 return "movq\t{%1, %0|%0, %1}";
2321 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2323 (cond [(eq_attr "alternative" "3,4,9,10")
2325 (eq_attr "alternative" "5")
2327 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2329 (ne (symbol_ref "TARGET_SSE2")
2331 (eq (symbol_ref "optimize_size")
2334 (const_string "V4SF"))
2335 /* For architectures resolving dependencies on
2336 whole SSE registers use APS move to break dependency
2337 chains, otherwise use short move to avoid extra work.
2339 Do the same for architectures resolving dependencies on
2340 the parts. While in DF mode it is better to always handle
2341 just register parts, the SF mode is different due to lack
2342 of instructions to load just part of the register. It is
2343 better to maintain the whole registers in single format
2344 to avoid problems on using packed logical operations. */
2345 (eq_attr "alternative" "6")
2347 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2349 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2351 (const_string "V4SF")
2352 (const_string "SF"))
2353 (eq_attr "alternative" "11")
2354 (const_string "DI")]
2355 (const_string "SF")))])
2357 (define_insn "*swapsf"
2358 [(set (match_operand:SF 0 "register_operand" "+f")
2359 (match_operand:SF 1 "register_operand" "+f"))
2362 "reload_completed || !TARGET_SSE"
2364 if (STACK_TOP_P (operands[0]))
2369 [(set_attr "type" "fxch")
2370 (set_attr "mode" "SF")])
2372 (define_expand "movdf"
2373 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2374 (match_operand:DF 1 "general_operand" ""))]
2376 "ix86_expand_move (DFmode, operands); DONE;")
2378 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2379 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2380 ;; On the average, pushdf using integers can be still shorter. Allow this
2381 ;; pattern for optimize_size too.
2383 (define_insn "*pushdf_nointeger"
2384 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2385 (match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))]
2386 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
2388 /* This insn should be already split before reg-stack. */
2391 [(set_attr "type" "multi")
2392 (set_attr "mode" "DF,SI,SI,DF")])
2394 (define_insn "*pushdf_integer"
2395 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2396 (match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))]
2397 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2399 /* This insn should be already split before reg-stack. */
2402 [(set_attr "type" "multi")
2403 (set_attr "mode" "DF,SI,DF")])
2405 ;; %%% Kill this when call knows how to work this out.
2407 [(set (match_operand:DF 0 "push_operand" "")
2408 (match_operand:DF 1 "any_fp_register_operand" ""))]
2409 "!TARGET_64BIT && reload_completed"
2410 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
2411 (set (mem:DF (reg:SI SP_REG)) (match_dup 1))]
2415 [(set (match_operand:DF 0 "push_operand" "")
2416 (match_operand:DF 1 "any_fp_register_operand" ""))]
2417 "TARGET_64BIT && reload_completed"
2418 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2419 (set (mem:DF (reg:DI SP_REG)) (match_dup 1))]
2423 [(set (match_operand:DF 0 "push_operand" "")
2424 (match_operand:DF 1 "general_operand" ""))]
2427 "ix86_split_long_move (operands); DONE;")
2429 ;; Moving is usually shorter when only FP registers are used. This separate
2430 ;; movdf pattern avoids the use of integer registers for FP operations
2431 ;; when optimizing for size.
2433 (define_insn "*movdf_nointeger"
2434 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,m,f#Y,*r,o,Y#f,Y#f,Y#f,m")
2435 (match_operand:DF 1 "general_operand" "fm#Y,f#Y,G,*roF,F*r,C,Y#f,YHm#f,Y#f"))]
2436 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2437 && ((optimize_size || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
2438 && (reload_in_progress || reload_completed
2439 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2440 || GET_CODE (operands[1]) != CONST_DOUBLE
2441 || memory_operand (operands[0], DFmode))"
2443 switch (which_alternative)
2446 return output_387_reg_move (insn, operands);
2449 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2450 return "fstp%z0\t%y0";
2452 return "fst%z0\t%y0";
2455 return standard_80387_constant_opcode (operands[1]);
2461 switch (get_attr_mode (insn))
2464 return "xorps\t%0, %0";
2466 return "xorpd\t%0, %0";
2468 return "pxor\t%0, %0";
2473 switch (get_attr_mode (insn))
2476 return "movaps\t{%1, %0|%0, %1}";
2478 return "movapd\t{%1, %0|%0, %1}";
2480 return "movsd\t{%1, %0|%0, %1}";
2485 if (get_attr_mode (insn) == MODE_V2DF)
2486 return "movlpd\t{%1, %0|%0, %1}";
2488 return "movsd\t{%1, %0|%0, %1}";
2490 return "movsd\t{%1, %0|%0, %1}";
2496 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2498 (cond [(eq_attr "alternative" "3,4")
2500 /* xorps is one byte shorter. */
2501 (eq_attr "alternative" "5")
2502 (cond [(ne (symbol_ref "optimize_size")
2504 (const_string "V4SF")
2505 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2507 (const_string "TI")]
2508 (const_string "V2DF"))
2509 /* For architectures resolving dependencies on
2510 whole SSE registers use APD move to break dependency
2511 chains, otherwise use short move to avoid extra work.
2513 movaps encodes one byte shorter. */
2514 (eq_attr "alternative" "6")
2516 [(ne (symbol_ref "optimize_size")
2518 (const_string "V4SF")
2519 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2521 (const_string "V2DF")]
2522 (const_string "DF"))
2523 /* For architectures resolving dependencies on register
2524 parts we may avoid extra work to zero out upper part
2526 (eq_attr "alternative" "7")
2528 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2530 (const_string "V2DF")
2531 (const_string "DF"))]
2532 (const_string "DF")))])
2534 (define_insn "*movdf_integer"
2535 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Yr,m,f#Yr,r#Yf,o,Y#rf,Y#rf,Y#rf,m")
2536 (match_operand:DF 1 "general_operand" "fm#Yr,f#Yr,G,roF#Yf,Fr#Yf,C,Y#rf,Ym#rf,Y#rf"))]
2537 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2538 && ((!optimize_size && TARGET_INTEGER_DFMODE_MOVES) || TARGET_64BIT)
2539 && (reload_in_progress || reload_completed
2540 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2541 || GET_CODE (operands[1]) != CONST_DOUBLE
2542 || memory_operand (operands[0], DFmode))"
2544 switch (which_alternative)
2547 return output_387_reg_move (insn, operands);
2550 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2551 return "fstp%z0\t%y0";
2553 return "fst%z0\t%y0";
2556 return standard_80387_constant_opcode (operands[1]);
2563 switch (get_attr_mode (insn))
2566 return "xorps\t%0, %0";
2568 return "xorpd\t%0, %0";
2570 return "pxor\t%0, %0";
2575 switch (get_attr_mode (insn))
2578 return "movaps\t{%1, %0|%0, %1}";
2580 return "movapd\t{%1, %0|%0, %1}";
2582 return "movsd\t{%1, %0|%0, %1}";
2587 if (get_attr_mode (insn) == MODE_V2DF)
2588 return "movlpd\t{%1, %0|%0, %1}";
2590 return "movsd\t{%1, %0|%0, %1}";
2592 return "movsd\t{%1, %0|%0, %1}";
2598 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2600 (cond [(eq_attr "alternative" "3,4")
2602 /* xorps is one byte shorter. */
2603 (eq_attr "alternative" "5")
2604 (cond [(ne (symbol_ref "optimize_size")
2606 (const_string "V4SF")
2607 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2609 (const_string "TI")]
2610 (const_string "V2DF"))
2611 /* For architectures resolving dependencies on
2612 whole SSE registers use APD move to break dependency
2613 chains, otherwise use short move to avoid extra work.
2615 movaps encodes one byte shorter. */
2616 (eq_attr "alternative" "6")
2618 [(ne (symbol_ref "optimize_size")
2620 (const_string "V4SF")
2621 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2623 (const_string "V2DF")]
2624 (const_string "DF"))
2625 /* For architectures resolving dependencies on register
2626 parts we may avoid extra work to zero out upper part
2628 (eq_attr "alternative" "7")
2630 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2632 (const_string "V2DF")
2633 (const_string "DF"))]
2634 (const_string "DF")))])
2637 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2638 (match_operand:DF 1 "general_operand" ""))]
2640 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2641 && ! (ANY_FP_REG_P (operands[0]) ||
2642 (GET_CODE (operands[0]) == SUBREG
2643 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2644 && ! (ANY_FP_REG_P (operands[1]) ||
2645 (GET_CODE (operands[1]) == SUBREG
2646 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2648 "ix86_split_long_move (operands); DONE;")
2650 (define_insn "*swapdf"
2651 [(set (match_operand:DF 0 "register_operand" "+f")
2652 (match_operand:DF 1 "register_operand" "+f"))
2655 "reload_completed || !TARGET_SSE2"
2657 if (STACK_TOP_P (operands[0]))
2662 [(set_attr "type" "fxch")
2663 (set_attr "mode" "DF")])
2665 (define_expand "movxf"
2666 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2667 (match_operand:XF 1 "general_operand" ""))]
2669 "ix86_expand_move (XFmode, operands); DONE;")
2671 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2672 ;; Size of pushdf using integer instructions is 3+3*memory operand size
2673 ;; Pushing using integer instructions is longer except for constants
2674 ;; and direct memory references.
2675 ;; (assuming that any given constant is pushed only once, but this ought to be
2676 ;; handled elsewhere).
2678 (define_insn "*pushxf_nointeger"
2679 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2680 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2683 /* This insn should be already split before reg-stack. */
2686 [(set_attr "type" "multi")
2687 (set_attr "mode" "XF,SI,SI")])
2689 (define_insn "*pushxf_integer"
2690 [(set (match_operand:XF 0 "push_operand" "=<,<")
2691 (match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))]
2694 /* This insn should be already split before reg-stack. */
2697 [(set_attr "type" "multi")
2698 (set_attr "mode" "XF,SI")])
2701 [(set (match_operand 0 "push_operand" "")
2702 (match_operand 1 "general_operand" ""))]
2704 && (GET_MODE (operands[0]) == XFmode
2705 || GET_MODE (operands[0]) == DFmode)
2706 && !ANY_FP_REG_P (operands[1])"
2708 "ix86_split_long_move (operands); DONE;")
2711 [(set (match_operand:XF 0 "push_operand" "")
2712 (match_operand:XF 1 "any_fp_register_operand" ""))]
2714 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
2715 (set (mem:XF (reg:SI SP_REG)) (match_dup 1))]
2716 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
2719 [(set (match_operand:XF 0 "push_operand" "")
2720 (match_operand:XF 1 "any_fp_register_operand" ""))]
2722 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
2723 (set (mem:XF (reg:DI SP_REG)) (match_dup 1))]
2724 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
2726 ;; Do not use integer registers when optimizing for size
2727 (define_insn "*movxf_nointeger"
2728 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2729 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2731 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2732 && (reload_in_progress || reload_completed
2733 || GET_CODE (operands[1]) != CONST_DOUBLE
2734 || memory_operand (operands[0], XFmode))"
2736 switch (which_alternative)
2739 return output_387_reg_move (insn, operands);
2742 /* There is no non-popping store to memory for XFmode. So if
2743 we need one, follow the store with a load. */
2744 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2745 return "fstp%z0\t%y0\;fld%z0\t%y0";
2747 return "fstp%z0\t%y0";
2750 return standard_80387_constant_opcode (operands[1]);
2757 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2758 (set_attr "mode" "XF,XF,XF,SI,SI")])
2760 (define_insn "*movxf_integer"
2761 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
2762 (match_operand:XF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
2764 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2765 && (reload_in_progress || reload_completed
2766 || GET_CODE (operands[1]) != CONST_DOUBLE
2767 || memory_operand (operands[0], XFmode))"
2769 switch (which_alternative)
2772 return output_387_reg_move (insn, operands);
2775 /* There is no non-popping store to memory for XFmode. So if
2776 we need one, follow the store with a load. */
2777 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2778 return "fstp%z0\t%y0\;fld%z0\t%y0";
2780 return "fstp%z0\t%y0";
2783 return standard_80387_constant_opcode (operands[1]);
2790 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2791 (set_attr "mode" "XF,XF,XF,SI,SI")])
2794 [(set (match_operand 0 "nonimmediate_operand" "")
2795 (match_operand 1 "general_operand" ""))]
2797 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2798 && GET_MODE (operands[0]) == XFmode
2799 && ! (ANY_FP_REG_P (operands[0]) ||
2800 (GET_CODE (operands[0]) == SUBREG
2801 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2802 && ! (ANY_FP_REG_P (operands[1]) ||
2803 (GET_CODE (operands[1]) == SUBREG
2804 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2806 "ix86_split_long_move (operands); DONE;")
2809 [(set (match_operand 0 "register_operand" "")
2810 (match_operand 1 "memory_operand" ""))]
2812 && GET_CODE (operands[1]) == MEM
2813 && (GET_MODE (operands[0]) == XFmode
2814 || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
2815 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2816 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
2817 [(set (match_dup 0) (match_dup 1))]
2819 rtx c = get_pool_constant (XEXP (operands[1], 0));
2820 rtx r = operands[0];
2822 if (GET_CODE (r) == SUBREG)
2827 if (!standard_sse_constant_p (c))
2830 else if (FP_REG_P (r))
2832 if (!standard_80387_constant_p (c))
2835 else if (MMX_REG_P (r))
2841 (define_insn "swapxf"
2842 [(set (match_operand:XF 0 "register_operand" "+f")
2843 (match_operand:XF 1 "register_operand" "+f"))
2848 if (STACK_TOP_P (operands[0]))
2853 [(set_attr "type" "fxch")
2854 (set_attr "mode" "XF")])
2856 ;; Zero extension instructions
2858 (define_expand "zero_extendhisi2"
2859 [(set (match_operand:SI 0 "register_operand" "")
2860 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
2863 if (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
2865 operands[1] = force_reg (HImode, operands[1]);
2866 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
2871 (define_insn "zero_extendhisi2_and"
2872 [(set (match_operand:SI 0 "register_operand" "=r")
2873 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
2874 (clobber (reg:CC FLAGS_REG))]
2875 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2877 [(set_attr "type" "alu1")
2878 (set_attr "mode" "SI")])
2881 [(set (match_operand:SI 0 "register_operand" "")
2882 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
2883 (clobber (reg:CC FLAGS_REG))]
2884 "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2885 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
2886 (clobber (reg:CC FLAGS_REG))])]
2889 (define_insn "*zero_extendhisi2_movzwl"
2890 [(set (match_operand:SI 0 "register_operand" "=r")
2891 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
2892 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2893 "movz{wl|x}\t{%1, %0|%0, %1}"
2894 [(set_attr "type" "imovx")
2895 (set_attr "mode" "SI")])
2897 (define_expand "zero_extendqihi2"
2899 [(set (match_operand:HI 0 "register_operand" "")
2900 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2901 (clobber (reg:CC FLAGS_REG))])]
2905 (define_insn "*zero_extendqihi2_and"
2906 [(set (match_operand:HI 0 "register_operand" "=r,?&q")
2907 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
2908 (clobber (reg:CC FLAGS_REG))]
2909 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2911 [(set_attr "type" "alu1")
2912 (set_attr "mode" "HI")])
2914 (define_insn "*zero_extendqihi2_movzbw_and"
2915 [(set (match_operand:HI 0 "register_operand" "=r,r")
2916 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
2917 (clobber (reg:CC FLAGS_REG))]
2918 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2920 [(set_attr "type" "imovx,alu1")
2921 (set_attr "mode" "HI")])
2923 (define_insn "*zero_extendqihi2_movzbw"
2924 [(set (match_operand:HI 0 "register_operand" "=r")
2925 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
2926 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
2927 "movz{bw|x}\t{%1, %0|%0, %1}"
2928 [(set_attr "type" "imovx")
2929 (set_attr "mode" "HI")])
2931 ;; For the movzbw case strip only the clobber
2933 [(set (match_operand:HI 0 "register_operand" "")
2934 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2935 (clobber (reg:CC FLAGS_REG))]
2937 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
2938 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
2939 [(set (match_operand:HI 0 "register_operand" "")
2940 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))])
2942 ;; When source and destination does not overlap, clear destination
2943 ;; first and then do the movb
2945 [(set (match_operand:HI 0 "register_operand" "")
2946 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2947 (clobber (reg:CC FLAGS_REG))]
2949 && ANY_QI_REG_P (operands[0])
2950 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
2951 && !reg_overlap_mentioned_p (operands[0], operands[1])"
2952 [(set (match_dup 0) (const_int 0))
2953 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2954 "operands[2] = gen_lowpart (QImode, operands[0]);")
2956 ;; Rest is handled by single and.
2958 [(set (match_operand:HI 0 "register_operand" "")
2959 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))
2960 (clobber (reg:CC FLAGS_REG))]
2962 && true_regnum (operands[0]) == true_regnum (operands[1])"
2963 [(parallel [(set (match_dup 0) (and:HI (match_dup 0) (const_int 255)))
2964 (clobber (reg:CC FLAGS_REG))])]
2967 (define_expand "zero_extendqisi2"
2969 [(set (match_operand:SI 0 "register_operand" "")
2970 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
2971 (clobber (reg:CC FLAGS_REG))])]
2975 (define_insn "*zero_extendqisi2_and"
2976 [(set (match_operand:SI 0 "register_operand" "=r,?&q")
2977 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
2978 (clobber (reg:CC FLAGS_REG))]
2979 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2981 [(set_attr "type" "alu1")
2982 (set_attr "mode" "SI")])
2984 (define_insn "*zero_extendqisi2_movzbw_and"
2985 [(set (match_operand:SI 0 "register_operand" "=r,r")
2986 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
2987 (clobber (reg:CC FLAGS_REG))]
2988 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2990 [(set_attr "type" "imovx,alu1")
2991 (set_attr "mode" "SI")])
2993 (define_insn "*zero_extendqisi2_movzbw"
2994 [(set (match_operand:SI 0 "register_operand" "=r")
2995 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
2996 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
2997 "movz{bl|x}\t{%1, %0|%0, %1}"
2998 [(set_attr "type" "imovx")
2999 (set_attr "mode" "SI")])
3001 ;; For the movzbl case strip only the clobber
3003 [(set (match_operand:SI 0 "register_operand" "")
3004 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3005 (clobber (reg:CC FLAGS_REG))]
3007 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
3008 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3010 (zero_extend:SI (match_dup 1)))])
3012 ;; When source and destination does not overlap, clear destination
3013 ;; first and then do the movb
3015 [(set (match_operand:SI 0 "register_operand" "")
3016 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3017 (clobber (reg:CC FLAGS_REG))]
3019 && ANY_QI_REG_P (operands[0])
3020 && (ANY_QI_REG_P (operands[1]) || GET_CODE (operands[1]) == MEM)
3021 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3022 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3023 [(set (match_dup 0) (const_int 0))
3024 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3025 "operands[2] = gen_lowpart (QImode, operands[0]);")
3027 ;; Rest is handled by single and.
3029 [(set (match_operand:SI 0 "register_operand" "")
3030 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
3031 (clobber (reg:CC FLAGS_REG))]
3033 && true_regnum (operands[0]) == true_regnum (operands[1])"
3034 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 255)))
3035 (clobber (reg:CC FLAGS_REG))])]
3038 ;; %%% Kill me once multi-word ops are sane.
3039 (define_expand "zero_extendsidi2"
3040 [(set (match_operand:DI 0 "register_operand" "=r")
3041 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
3045 emit_insn (gen_zero_extendsidi2_32 (operands[0], operands[1]));
3050 (define_insn "zero_extendsidi2_32"
3051 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o,!?y,!?Y")
3052 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r,m,m")))
3053 (clobber (reg:CC FLAGS_REG))]
3054 "!TARGET_64BIT && !TARGET_INTER_UNIT_MOVES"
3059 movd\t{%1, %0|%0, %1}
3060 movd\t{%1, %0|%0, %1}"
3061 [(set_attr "mode" "SI,SI,SI,DI,TI")
3062 (set_attr "type" "multi,multi,multi,mmxmov,ssemov")])
3064 (define_insn "*zero_extendsidi2_32_1"
3065 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o,!?y,!?Y")
3066 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r,rm,rm")))
3067 (clobber (reg:CC FLAGS_REG))]
3068 "!TARGET_64BIT && TARGET_INTER_UNIT_MOVES"
3073 movd\t{%1, %0|%0, %1}
3074 movd\t{%1, %0|%0, %1}"
3075 [(set_attr "mode" "SI,SI,SI,DI,TI")
3076 (set_attr "type" "multi,multi,multi,mmxmov,ssemov")])
3078 (define_insn "zero_extendsidi2_rex64"
3079 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!?y,!?Y")
3080 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0,m,m")))]
3081 "TARGET_64BIT && !TARGET_INTER_UNIT_MOVES"
3083 mov\t{%k1, %k0|%k0, %k1}
3085 movd\t{%1, %0|%0, %1}
3086 movd\t{%1, %0|%0, %1}"
3087 [(set_attr "type" "imovx,imov,mmxmov,ssemov")
3088 (set_attr "mode" "SI,DI,DI,TI")])
3090 (define_insn "*zero_extendsidi2_rex64_1"
3091 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!?y,!*?")
3092 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0,rm,rm")))]
3093 "TARGET_64BIT && TARGET_INTER_UNIT_MOVES"
3095 mov\t{%k1, %k0|%k0, %k1}
3097 movd\t{%1, %0|%0, %1}
3098 movd\t{%1, %0|%0, %1}"
3099 [(set_attr "type" "imovx,imov,mmxmov,ssemov")
3100 (set_attr "mode" "SI,DI,SI,SI")])
3103 [(set (match_operand:DI 0 "memory_operand" "")
3104 (zero_extend:DI (match_dup 0)))]
3106 [(set (match_dup 4) (const_int 0))]
3107 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3110 [(set (match_operand:DI 0 "register_operand" "")
3111 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3112 (clobber (reg:CC FLAGS_REG))]
3113 "!TARGET_64BIT && reload_completed
3114 && true_regnum (operands[0]) == true_regnum (operands[1])"
3115 [(set (match_dup 4) (const_int 0))]
3116 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3119 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3120 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3121 (clobber (reg:CC FLAGS_REG))]
3122 "!TARGET_64BIT && reload_completed
3123 && !SSE_REG_P (operands[0]) && !MMX_REG_P (operands[0])"
3124 [(set (match_dup 3) (match_dup 1))
3125 (set (match_dup 4) (const_int 0))]
3126 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3128 (define_insn "zero_extendhidi2"
3129 [(set (match_operand:DI 0 "register_operand" "=r,r")
3130 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
3133 movz{wl|x}\t{%1, %k0|%k0, %1}
3134 movz{wq|x}\t{%1, %0|%0, %1}"
3135 [(set_attr "type" "imovx")
3136 (set_attr "mode" "SI,DI")])
3138 (define_insn "zero_extendqidi2"
3139 [(set (match_operand:DI 0 "register_operand" "=r,r")
3140 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "Q,m")))]
3143 movz{bl|x}\t{%1, %k0|%k0, %1}
3144 movz{bq|x}\t{%1, %0|%0, %1}"
3145 [(set_attr "type" "imovx")
3146 (set_attr "mode" "SI,DI")])
3148 ;; Sign extension instructions
3150 (define_expand "extendsidi2"
3151 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3152 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3153 (clobber (reg:CC FLAGS_REG))
3154 (clobber (match_scratch:SI 2 ""))])]
3159 emit_insn (gen_extendsidi2_rex64 (operands[0], operands[1]));
3164 (define_insn "*extendsidi2_1"
3165 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3166 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3167 (clobber (reg:CC FLAGS_REG))
3168 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3172 (define_insn "extendsidi2_rex64"
3173 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3174 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3178 movs{lq|x}\t{%1,%0|%0, %1}"
3179 [(set_attr "type" "imovx")
3180 (set_attr "mode" "DI")
3181 (set_attr "prefix_0f" "0")
3182 (set_attr "modrm" "0,1")])
3184 (define_insn "extendhidi2"
3185 [(set (match_operand:DI 0 "register_operand" "=r")
3186 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3188 "movs{wq|x}\t{%1,%0|%0, %1}"
3189 [(set_attr "type" "imovx")
3190 (set_attr "mode" "DI")])
3192 (define_insn "extendqidi2"
3193 [(set (match_operand:DI 0 "register_operand" "=r")
3194 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3196 "movs{bq|x}\t{%1,%0|%0, %1}"
3197 [(set_attr "type" "imovx")
3198 (set_attr "mode" "DI")])
3200 ;; Extend to memory case when source register does die.
3202 [(set (match_operand:DI 0 "memory_operand" "")
3203 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3204 (clobber (reg:CC FLAGS_REG))
3205 (clobber (match_operand:SI 2 "register_operand" ""))]
3207 && dead_or_set_p (insn, operands[1])
3208 && !reg_mentioned_p (operands[1], operands[0]))"
3209 [(set (match_dup 3) (match_dup 1))
3210 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3211 (clobber (reg:CC FLAGS_REG))])
3212 (set (match_dup 4) (match_dup 1))]
3213 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3215 ;; Extend to memory case when source register does not die.
3217 [(set (match_operand:DI 0 "memory_operand" "")
3218 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3219 (clobber (reg:CC FLAGS_REG))
3220 (clobber (match_operand:SI 2 "register_operand" ""))]
3224 split_di (&operands[0], 1, &operands[3], &operands[4]);
3226 emit_move_insn (operands[3], operands[1]);
3228 /* Generate a cltd if possible and doing so it profitable. */
3229 if (true_regnum (operands[1]) == 0
3230 && true_regnum (operands[2]) == 1
3231 && (optimize_size || TARGET_USE_CLTD))
3233 emit_insn (gen_ashrsi3_31 (operands[2], operands[1], GEN_INT (31)));
3237 emit_move_insn (operands[2], operands[1]);
3238 emit_insn (gen_ashrsi3_31 (operands[2], operands[2], GEN_INT (31)));
3240 emit_move_insn (operands[4], operands[2]);
3244 ;; Extend to register case. Optimize case where source and destination
3245 ;; registers match and cases where we can use cltd.
3247 [(set (match_operand:DI 0 "register_operand" "")
3248 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3249 (clobber (reg:CC FLAGS_REG))
3250 (clobber (match_scratch:SI 2 ""))]
3254 split_di (&operands[0], 1, &operands[3], &operands[4]);
3256 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3257 emit_move_insn (operands[3], operands[1]);
3259 /* Generate a cltd if possible and doing so it profitable. */
3260 if (true_regnum (operands[3]) == 0
3261 && (optimize_size || TARGET_USE_CLTD))
3263 emit_insn (gen_ashrsi3_31 (operands[4], operands[3], GEN_INT (31)));
3267 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3268 emit_move_insn (operands[4], operands[1]);
3270 emit_insn (gen_ashrsi3_31 (operands[4], operands[4], GEN_INT (31)));
3274 (define_insn "extendhisi2"
3275 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3276 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3279 switch (get_attr_prefix_0f (insn))
3282 return "{cwtl|cwde}";
3284 return "movs{wl|x}\t{%1,%0|%0, %1}";
3287 [(set_attr "type" "imovx")
3288 (set_attr "mode" "SI")
3289 (set (attr "prefix_0f")
3290 ;; movsx is short decodable while cwtl is vector decoded.
3291 (if_then_else (and (eq_attr "cpu" "!k6")
3292 (eq_attr "alternative" "0"))
3294 (const_string "1")))
3296 (if_then_else (eq_attr "prefix_0f" "0")
3298 (const_string "1")))])
3300 (define_insn "*extendhisi2_zext"
3301 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3303 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm"))))]
3306 switch (get_attr_prefix_0f (insn))
3309 return "{cwtl|cwde}";
3311 return "movs{wl|x}\t{%1,%k0|%k0, %1}";
3314 [(set_attr "type" "imovx")
3315 (set_attr "mode" "SI")
3316 (set (attr "prefix_0f")
3317 ;; movsx is short decodable while cwtl is vector decoded.
3318 (if_then_else (and (eq_attr "cpu" "!k6")
3319 (eq_attr "alternative" "0"))
3321 (const_string "1")))
3323 (if_then_else (eq_attr "prefix_0f" "0")
3325 (const_string "1")))])
3327 (define_insn "extendqihi2"
3328 [(set (match_operand:HI 0 "register_operand" "=*a,r")
3329 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "*0,qm")))]
3332 switch (get_attr_prefix_0f (insn))
3335 return "{cbtw|cbw}";
3337 return "movs{bw|x}\t{%1,%0|%0, %1}";
3340 [(set_attr "type" "imovx")
3341 (set_attr "mode" "HI")
3342 (set (attr "prefix_0f")
3343 ;; movsx is short decodable while cwtl is vector decoded.
3344 (if_then_else (and (eq_attr "cpu" "!k6")
3345 (eq_attr "alternative" "0"))
3347 (const_string "1")))
3349 (if_then_else (eq_attr "prefix_0f" "0")
3351 (const_string "1")))])
3353 (define_insn "extendqisi2"
3354 [(set (match_operand:SI 0 "register_operand" "=r")
3355 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3357 "movs{bl|x}\t{%1,%0|%0, %1}"
3358 [(set_attr "type" "imovx")
3359 (set_attr "mode" "SI")])
3361 (define_insn "*extendqisi2_zext"
3362 [(set (match_operand:DI 0 "register_operand" "=r")
3364 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm"))))]
3366 "movs{bl|x}\t{%1,%k0|%k0, %1}"
3367 [(set_attr "type" "imovx")
3368 (set_attr "mode" "SI")])
3370 ;; Conversions between float and double.
3372 ;; These are all no-ops in the model used for the 80387. So just
3375 ;; %%% Kill these when call knows how to work out a DFmode push earlier.
3376 (define_insn "*dummy_extendsfdf2"
3377 [(set (match_operand:DF 0 "push_operand" "=<")
3378 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fY")))]
3383 [(set (match_operand:DF 0 "push_operand" "")
3384 (float_extend:DF (match_operand:SF 1 "fp_register_operand" "")))]
3386 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
3387 (set (mem:DF (reg:SI SP_REG)) (float_extend:DF (match_dup 1)))])
3390 [(set (match_operand:DF 0 "push_operand" "")
3391 (float_extend:DF (match_operand:SF 1 "fp_register_operand" "")))]
3393 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
3394 (set (mem:DF (reg:DI SP_REG)) (float_extend:DF (match_dup 1)))])
3396 (define_insn "*dummy_extendsfxf2"
3397 [(set (match_operand:XF 0 "push_operand" "=<")
3398 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "f")))]
3403 [(set (match_operand:XF 0 "push_operand" "")
3404 (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
3406 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
3407 (set (mem:XF (reg:SI SP_REG)) (float_extend:XF (match_dup 1)))]
3408 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3411 [(set (match_operand:XF 0 "push_operand" "")
3412 (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
3414 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
3415 (set (mem:DF (reg:DI SP_REG)) (float_extend:XF (match_dup 1)))]
3416 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3419 [(set (match_operand:XF 0 "push_operand" "")
3420 (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))]
3422 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
3423 (set (mem:DF (reg:SI SP_REG)) (float_extend:XF (match_dup 1)))]
3424 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3427 [(set (match_operand:XF 0 "push_operand" "")
3428 (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))]
3430 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
3431 (set (mem:XF (reg:DI SP_REG)) (float_extend:XF (match_dup 1)))]
3432 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3434 (define_expand "extendsfdf2"
3435 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3436 (float_extend:DF (match_operand:SF 1 "general_operand" "")))]
3437 "TARGET_80387 || TARGET_SSE2"
3439 /* ??? Needed for compress_float_constant since all fp constants
3440 are LEGITIMATE_CONSTANT_P. */
3441 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3442 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3443 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3444 operands[1] = force_reg (SFmode, operands[1]);
3447 (define_insn "*extendsfdf2_1"
3448 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,mf#Y,Y#f")
3449 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm#Y,f#Y,mY#f")))]
3450 "(TARGET_80387 || TARGET_SSE2)
3451 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3453 switch (which_alternative)
3456 return output_387_reg_move (insn, operands);
3459 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3460 return "fstp%z0\t%y0";
3462 return "fst%z0\t%y0";
3465 return "cvtss2sd\t{%1, %0|%0, %1}";
3471 [(set_attr "type" "fmov,fmov,ssecvt")
3472 (set_attr "mode" "SF,XF,DF")])
3474 (define_insn "*extendsfdf2_1_sse_only"
3475 [(set (match_operand:DF 0 "register_operand" "=Y")
3476 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "mY")))]
3477 "!TARGET_80387 && TARGET_SSE2
3478 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3479 "cvtss2sd\t{%1, %0|%0, %1}"
3480 [(set_attr "type" "ssecvt")
3481 (set_attr "mode" "DF")])
3483 (define_expand "extendsfxf2"
3484 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3485 (float_extend:XF (match_operand:SF 1 "general_operand" "")))]
3488 /* ??? Needed for compress_float_constant since all fp constants
3489 are LEGITIMATE_CONSTANT_P. */
3490 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3491 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3492 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3493 operands[1] = force_reg (SFmode, operands[1]);
3496 (define_insn "*extendsfxf2_1"
3497 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3498 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3500 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3502 switch (which_alternative)
3505 return output_387_reg_move (insn, operands);
3508 /* There is no non-popping store to memory for XFmode. So if
3509 we need one, follow the store with a load. */
3510 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3511 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3513 return "fstp%z0\t%y0";
3519 [(set_attr "type" "fmov")
3520 (set_attr "mode" "SF,XF")])
3522 (define_expand "extenddfxf2"
3523 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3524 (float_extend:XF (match_operand:DF 1 "general_operand" "")))]
3527 /* ??? Needed for compress_float_constant since all fp constants
3528 are LEGITIMATE_CONSTANT_P. */
3529 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3530 operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
3531 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3532 operands[1] = force_reg (DFmode, operands[1]);
3535 (define_insn "*extenddfxf2_1"
3536 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3537 (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
3539 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3541 switch (which_alternative)
3544 return output_387_reg_move (insn, operands);
3547 /* There is no non-popping store to memory for XFmode. So if
3548 we need one, follow the store with a load. */
3549 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3550 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3552 return "fstp%z0\t%y0";
3558 [(set_attr "type" "fmov")
3559 (set_attr "mode" "DF,XF")])
3561 ;; %%% This seems bad bad news.
3562 ;; This cannot output into an f-reg because there is no way to be sure
3563 ;; of truncating in that case. Otherwise this is just like a simple move
3564 ;; insn. So we pretend we can output to a reg in order to get better
3565 ;; register preferencing, but we really use a stack slot.
3567 (define_expand "truncdfsf2"
3568 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3570 (match_operand:DF 1 "register_operand" "")))
3571 (clobber (match_dup 2))])]
3572 "TARGET_80387 || TARGET_SSE2"
3576 emit_insn (gen_truncdfsf2_sse_only (operands[0], operands[1]));
3579 else if (flag_unsafe_math_optimizations)
3581 rtx reg = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SFmode);
3582 emit_insn (gen_truncdfsf2_noop (reg, operands[1]));
3583 if (reg != operands[0])
3584 emit_move_insn (operands[0], reg);
3588 operands[2] = assign_386_stack_local (SFmode, 0);
3591 (define_insn "truncdfsf2_noop"
3592 [(set (match_operand:SF 0 "register_operand" "=f")
3593 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
3594 "TARGET_80387 && flag_unsafe_math_optimizations"
3596 return output_387_reg_move (insn, operands);
3598 [(set_attr "type" "fmov")
3599 (set_attr "mode" "SF")])
3601 (define_insn "*truncdfsf2_1"
3602 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3604 (match_operand:DF 1 "register_operand" "f,f,f,f")))
3605 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3606 "TARGET_80387 && !TARGET_SSE2"
3608 switch (which_alternative)
3611 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3612 return "fstp%z0\t%y0";
3614 return "fst%z0\t%y0";
3619 [(set_attr "type" "fmov,multi,multi,multi")
3620 (set_attr "mode" "SF,SF,SF,SF")])
3622 (define_insn "*truncdfsf2_1_sse"
3623 [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m#fxr,?f#xr,?r#fx,?x#fr,Y#fr")
3625 (match_operand:DF 1 "nonimmediate_operand" "f#Y,f#Y,f#Y,f#Y,mY#f")))
3626 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))]
3627 "TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
3629 switch (which_alternative)
3632 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3633 return "fstp%z0\t%y0";
3635 return "fst%z0\t%y0";
3642 [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
3643 (set_attr "mode" "SF,SF,SF,SF,DF")])
3645 (define_insn "*truncdfsf2_1_sse_nooverlap"
3646 [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m,?f#rx,?r#fx,?x#rf,&Y")
3648 (match_operand:DF 1 "nonimmediate_operand" "f#Y,f#Y,f#Y,f#Y,mY#f")))
3649 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))]
3650 "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
3652 switch (which_alternative)
3655 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3656 return "fstp%z0\t%y0";
3658 return "fst%z0\t%y0";
3665 [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
3666 (set_attr "mode" "SF,SF,SF,SF,DF")])
3668 (define_insn "*truncdfsf2_2"
3669 [(set (match_operand:SF 0 "nonimmediate_operand" "=Y,Y,!m")
3671 (match_operand:DF 1 "nonimmediate_operand" "Y,mY,f#Y")))]
3672 "TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS
3673 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3675 switch (which_alternative)
3679 return "cvtsd2ss\t{%1, %0|%0, %1}";
3681 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3682 return "fstp%z0\t%y0";
3684 return "fst%z0\t%y0";
3689 [(set_attr "type" "ssecvt,ssecvt,fmov")
3690 (set_attr "athlon_decode" "vector,double,*")
3691 (set_attr "mode" "SF,SF,SF")])
3693 (define_insn "*truncdfsf2_2_nooverlap"
3694 [(set (match_operand:SF 0 "nonimmediate_operand" "=&Y,!m")
3696 (match_operand:DF 1 "nonimmediate_operand" "mY,f")))]
3697 "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS
3698 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3700 switch (which_alternative)
3705 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3706 return "fstp%z0\t%y0";
3708 return "fst%z0\t%y0";
3713 [(set_attr "type" "ssecvt,fmov")
3714 (set_attr "mode" "DF,SF")])
3716 (define_insn "*truncdfsf2_3"
3717 [(set (match_operand:SF 0 "memory_operand" "=m")
3719 (match_operand:DF 1 "register_operand" "f")))]
3722 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3723 return "fstp%z0\t%y0";
3725 return "fst%z0\t%y0";
3727 [(set_attr "type" "fmov")
3728 (set_attr "mode" "SF")])
3730 (define_insn "truncdfsf2_sse_only"
3731 [(set (match_operand:SF 0 "register_operand" "=Y,Y")
3733 (match_operand:DF 1 "nonimmediate_operand" "Y,mY")))]
3734 "!TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
3735 "cvtsd2ss\t{%1, %0|%0, %1}"
3736 [(set_attr "type" "ssecvt")
3737 (set_attr "athlon_decode" "vector,double")
3738 (set_attr "mode" "SF")])
3740 (define_insn "*truncdfsf2_sse_only_nooverlap"
3741 [(set (match_operand:SF 0 "register_operand" "=&Y")
3743 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
3744 "!TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
3746 [(set_attr "type" "ssecvt")
3747 (set_attr "mode" "DF")])
3750 [(set (match_operand:SF 0 "memory_operand" "")
3752 (match_operand:DF 1 "register_operand" "")))
3753 (clobber (match_operand:SF 2 "memory_operand" ""))]
3755 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3758 ; Avoid possible reformatting penalty on the destination by first
3761 [(set (match_operand:SF 0 "register_operand" "")
3763 (match_operand:DF 1 "nonimmediate_operand" "")))
3764 (clobber (match_operand 2 "" ""))]
3765 "TARGET_80387 && reload_completed
3766 && SSE_REG_P (operands[0])
3767 && !STACK_REG_P (operands[1])"
3771 if (!TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS)
3772 emit_insn (gen_truncdfsf2_sse_only (operands[0], operands[1]));
3775 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
3776 src = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0);
3777 /* simplify_gen_subreg refuses to widen memory references. */
3778 if (GET_CODE (src) == SUBREG)
3779 alter_subreg (&src);
3780 if (reg_overlap_mentioned_p (operands[0], operands[1]))
3782 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
3783 emit_insn (gen_cvtsd2ss (dest, dest, src));
3789 [(set (match_operand:SF 0 "register_operand" "")
3791 (match_operand:DF 1 "nonimmediate_operand" "")))]
3792 "TARGET_80387 && reload_completed
3793 && SSE_REG_P (operands[0]) && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
3797 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
3798 src = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0);
3799 /* simplify_gen_subreg refuses to widen memory references. */
3800 if (GET_CODE (src) == SUBREG)
3801 alter_subreg (&src);
3802 if (reg_overlap_mentioned_p (operands[0], operands[1]))
3804 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
3805 emit_insn (gen_cvtsd2ss (dest, dest, src));
3810 [(set (match_operand:SF 0 "register_operand" "")
3812 (match_operand:DF 1 "fp_register_operand" "")))
3813 (clobber (match_operand:SF 2 "memory_operand" ""))]
3814 "TARGET_80387 && reload_completed"
3815 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
3816 (set (match_dup 0) (match_dup 2))]
3819 (define_expand "truncxfsf2"
3820 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3822 (match_operand:XF 1 "register_operand" "")))
3823 (clobber (match_dup 2))])]
3826 if (flag_unsafe_math_optimizations)
3828 rtx reg = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SFmode);
3829 emit_insn (gen_truncxfsf2_noop (reg, operands[1]));
3830 if (reg != operands[0])
3831 emit_move_insn (operands[0], reg);
3835 operands[2] = assign_386_stack_local (SFmode, 0);
3838 (define_insn "truncxfsf2_noop"
3839 [(set (match_operand:SF 0 "register_operand" "=f")
3840 (float_truncate:SF (match_operand:XF 1 "register_operand" "f")))]
3841 "TARGET_80387 && flag_unsafe_math_optimizations"
3843 return output_387_reg_move (insn, operands);
3845 [(set_attr "type" "fmov")
3846 (set_attr "mode" "SF")])
3848 (define_insn "*truncxfsf2_1"
3849 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3851 (match_operand:XF 1 "register_operand" "f,f,f,f")))
3852 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3855 switch (which_alternative)
3858 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3859 return "fstp%z0\t%y0";
3861 return "fst%z0\t%y0";
3866 [(set_attr "type" "fmov,multi,multi,multi")
3867 (set_attr "mode" "SF")])
3869 (define_insn "*truncxfsf2_2"
3870 [(set (match_operand:SF 0 "memory_operand" "=m")
3872 (match_operand:XF 1 "register_operand" "f")))]
3875 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3876 return "fstp%z0\t%y0";
3878 return "fst%z0\t%y0";
3880 [(set_attr "type" "fmov")
3881 (set_attr "mode" "SF")])
3884 [(set (match_operand:SF 0 "memory_operand" "")
3886 (match_operand:XF 1 "register_operand" "")))
3887 (clobber (match_operand:SF 2 "memory_operand" ""))]
3889 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3893 [(set (match_operand:SF 0 "register_operand" "")
3895 (match_operand:XF 1 "register_operand" "")))
3896 (clobber (match_operand:SF 2 "memory_operand" ""))]
3897 "TARGET_80387 && reload_completed"
3898 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
3899 (set (match_dup 0) (match_dup 2))]
3902 (define_expand "truncxfdf2"
3903 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
3905 (match_operand:XF 1 "register_operand" "")))
3906 (clobber (match_dup 2))])]
3909 if (flag_unsafe_math_optimizations)
3911 rtx reg = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DFmode);
3912 emit_insn (gen_truncxfdf2_noop (reg, operands[1]));
3913 if (reg != operands[0])
3914 emit_move_insn (operands[0], reg);
3918 operands[2] = assign_386_stack_local (DFmode, 0);
3921 (define_insn "truncxfdf2_noop"
3922 [(set (match_operand:DF 0 "register_operand" "=f")
3923 (float_truncate:DF (match_operand:XF 1 "register_operand" "f")))]
3924 "TARGET_80387 && flag_unsafe_math_optimizations"
3926 return output_387_reg_move (insn, operands);
3928 [(set_attr "type" "fmov")
3929 (set_attr "mode" "DF")])
3931 (define_insn "*truncxfdf2_1"
3932 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")
3934 (match_operand:XF 1 "register_operand" "f,f,f,f")))
3935 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))]
3938 switch (which_alternative)
3941 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3942 return "fstp%z0\t%y0";
3944 return "fst%z0\t%y0";
3950 [(set_attr "type" "fmov,multi,multi,multi")
3951 (set_attr "mode" "DF")])
3953 (define_insn "*truncxfdf2_2"
3954 [(set (match_operand:DF 0 "memory_operand" "=m")
3956 (match_operand:XF 1 "register_operand" "f")))]
3959 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3960 return "fstp%z0\t%y0";
3962 return "fst%z0\t%y0";
3964 [(set_attr "type" "fmov")
3965 (set_attr "mode" "DF")])
3968 [(set (match_operand:DF 0 "memory_operand" "")
3970 (match_operand:XF 1 "register_operand" "")))
3971 (clobber (match_operand:DF 2 "memory_operand" ""))]
3973 [(set (match_dup 0) (float_truncate:DF (match_dup 1)))]
3977 [(set (match_operand:DF 0 "register_operand" "")
3979 (match_operand:XF 1 "register_operand" "")))
3980 (clobber (match_operand:DF 2 "memory_operand" ""))]
3981 "TARGET_80387 && reload_completed"
3982 [(set (match_dup 2) (float_truncate:DF (match_dup 1)))
3983 (set (match_dup 0) (match_dup 2))]
3987 ;; %%% Break up all these bad boys.
3989 ;; Signed conversion to DImode.
3991 (define_expand "fix_truncxfdi2"
3992 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
3993 (fix:DI (match_operand:XF 1 "register_operand" "")))
3994 (clobber (reg:CC FLAGS_REG))])]
3998 (define_expand "fix_truncdfdi2"
3999 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
4000 (fix:DI (match_operand:DF 1 "register_operand" "")))
4001 (clobber (reg:CC FLAGS_REG))])]
4002 "TARGET_80387 || (TARGET_SSE2 && TARGET_64BIT)"
4004 if (TARGET_64BIT && TARGET_SSE2)
4006 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4007 emit_insn (gen_fix_truncdfdi_sse (out, operands[1]));
4008 if (out != operands[0])
4009 emit_move_insn (operands[0], out);
4014 (define_expand "fix_truncsfdi2"
4015 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
4016 (fix:DI (match_operand:SF 1 "register_operand" "")))
4017 (clobber (reg:CC FLAGS_REG))])]
4018 "TARGET_80387 || (TARGET_SSE && TARGET_64BIT)"
4020 if (TARGET_SSE && TARGET_64BIT)
4022 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4023 emit_insn (gen_fix_truncsfdi_sse (out, operands[1]));
4024 if (out != operands[0])
4025 emit_move_insn (operands[0], out);
4030 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4031 ;; of the machinery.
4032 (define_insn_and_split "*fix_truncdi_1"
4033 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4034 (fix:DI (match_operand 1 "register_operand" "f,f")))
4035 (clobber (reg:CC FLAGS_REG))]
4036 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4037 && !reload_completed && !reload_in_progress
4038 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4043 ix86_optimize_mode_switching = 1;
4044 operands[2] = assign_386_stack_local (HImode, 1);
4045 operands[3] = assign_386_stack_local (HImode, 2);
4046 if (memory_operand (operands[0], VOIDmode))
4047 emit_insn (gen_fix_truncdi_memory (operands[0], operands[1],
4048 operands[2], operands[3]));
4051 operands[4] = assign_386_stack_local (DImode, 0);
4052 emit_insn (gen_fix_truncdi_nomemory (operands[0], operands[1],
4053 operands[2], operands[3],
4058 [(set_attr "type" "fistp")
4059 (set_attr "i387_cw" "trunc")
4060 (set_attr "mode" "DI")])
4062 (define_insn "fix_truncdi_nomemory"
4063 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4064 (fix:DI (match_operand 1 "register_operand" "f,f")))
4065 (use (match_operand:HI 2 "memory_operand" "m,m"))
4066 (use (match_operand:HI 3 "memory_operand" "m,m"))
4067 (clobber (match_operand:DI 4 "memory_operand" "=m,m"))
4068 (clobber (match_scratch:DF 5 "=&1f,&1f"))]
4069 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4070 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4072 [(set_attr "type" "fistp")
4073 (set_attr "i387_cw" "trunc")
4074 (set_attr "mode" "DI")])
4076 (define_insn "fix_truncdi_memory"
4077 [(set (match_operand:DI 0 "memory_operand" "=m")
4078 (fix:DI (match_operand 1 "register_operand" "f")))
4079 (use (match_operand:HI 2 "memory_operand" "m"))
4080 (use (match_operand:HI 3 "memory_operand" "m"))
4081 (clobber (match_scratch:DF 4 "=&1f"))]
4082 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4083 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4084 "* return output_fix_trunc (insn, operands);"
4085 [(set_attr "type" "fistp")
4086 (set_attr "i387_cw" "trunc")
4087 (set_attr "mode" "DI")])
4090 [(set (match_operand:DI 0 "register_operand" "")
4091 (fix:DI (match_operand 1 "register_operand" "")))
4092 (use (match_operand:HI 2 "memory_operand" ""))
4093 (use (match_operand:HI 3 "memory_operand" ""))
4094 (clobber (match_operand:DI 4 "memory_operand" ""))
4095 (clobber (match_scratch 5 ""))]
4097 [(parallel [(set (match_dup 4) (fix:DI (match_dup 1)))
4100 (clobber (match_dup 5))])
4101 (set (match_dup 0) (match_dup 4))]
4105 [(set (match_operand:DI 0 "memory_operand" "")
4106 (fix:DI (match_operand 1 "register_operand" "")))
4107 (use (match_operand:HI 2 "memory_operand" ""))
4108 (use (match_operand:HI 3 "memory_operand" ""))
4109 (clobber (match_operand:DI 4 "memory_operand" ""))
4110 (clobber (match_scratch 5 ""))]
4112 [(parallel [(set (match_dup 0) (fix:DI (match_dup 1)))
4115 (clobber (match_dup 5))])]
4118 ;; When SSE available, it is always faster to use it!
4119 (define_insn "fix_truncsfdi_sse"
4120 [(set (match_operand:DI 0 "register_operand" "=r,r")
4121 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))]
4122 "TARGET_64BIT && TARGET_SSE"
4123 "cvttss2si{q}\t{%1, %0|%0, %1}"
4124 [(set_attr "type" "sseicvt")
4125 (set_attr "mode" "SF")
4126 (set_attr "athlon_decode" "double,vector")])
4128 ;; Avoid vector decoded form of the instruction.
4130 [(match_scratch:SF 2 "x")
4131 (set (match_operand:DI 0 "register_operand" "")
4132 (fix:DI (match_operand:SF 1 "memory_operand" "")))]
4133 "TARGET_K8 && !optimize_size"
4134 [(set (match_dup 2) (match_dup 1))
4135 (set (match_dup 0) (fix:DI (match_dup 2)))]
4138 (define_insn "fix_truncdfdi_sse"
4139 [(set (match_operand:DI 0 "register_operand" "=r,r")
4140 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))]
4141 "TARGET_64BIT && TARGET_SSE2"
4142 "cvttsd2si{q}\t{%1, %0|%0, %1}"
4143 [(set_attr "type" "sseicvt,sseicvt")
4144 (set_attr "mode" "DF")
4145 (set_attr "athlon_decode" "double,vector")])
4147 ;; Avoid vector decoded form of the instruction.
4149 [(match_scratch:DF 2 "Y")
4150 (set (match_operand:DI 0 "register_operand" "")
4151 (fix:DI (match_operand:DF 1 "memory_operand" "")))]
4152 "TARGET_K8 && !optimize_size"
4153 [(set (match_dup 2) (match_dup 1))
4154 (set (match_dup 0) (fix:DI (match_dup 2)))]
4157 ;; Signed conversion to SImode.
4159 (define_expand "fix_truncxfsi2"
4160 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4161 (fix:SI (match_operand:XF 1 "register_operand" "")))
4162 (clobber (reg:CC FLAGS_REG))])]
4166 (define_expand "fix_truncdfsi2"
4167 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4168 (fix:SI (match_operand:DF 1 "register_operand" "")))
4169 (clobber (reg:CC FLAGS_REG))])]
4170 "TARGET_80387 || TARGET_SSE2"
4174 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4175 emit_insn (gen_fix_truncdfsi_sse (out, operands[1]));
4176 if (out != operands[0])
4177 emit_move_insn (operands[0], out);
4182 (define_expand "fix_truncsfsi2"
4183 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4184 (fix:SI (match_operand:SF 1 "register_operand" "")))
4185 (clobber (reg:CC FLAGS_REG))])]
4186 "TARGET_80387 || TARGET_SSE"
4190 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4191 emit_insn (gen_fix_truncsfsi_sse (out, operands[1]));
4192 if (out != operands[0])
4193 emit_move_insn (operands[0], out);
4198 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4199 ;; of the machinery.
4200 (define_insn_and_split "*fix_truncsi_1"
4201 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4202 (fix:SI (match_operand 1 "register_operand" "f,f")))
4203 (clobber (reg:CC FLAGS_REG))]
4204 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4205 && !reload_completed && !reload_in_progress
4206 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4211 ix86_optimize_mode_switching = 1;
4212 operands[2] = assign_386_stack_local (HImode, 1);
4213 operands[3] = assign_386_stack_local (HImode, 2);
4214 if (memory_operand (operands[0], VOIDmode))
4215 emit_insn (gen_fix_truncsi_memory (operands[0], operands[1],
4216 operands[2], operands[3]));
4219 operands[4] = assign_386_stack_local (SImode, 0);
4220 emit_insn (gen_fix_truncsi_nomemory (operands[0], operands[1],
4221 operands[2], operands[3],
4226 [(set_attr "type" "fistp")
4227 (set_attr "i387_cw" "trunc")
4228 (set_attr "mode" "SI")])
4230 (define_insn "fix_truncsi_nomemory"
4231 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4232 (fix:SI (match_operand 1 "register_operand" "f,f")))
4233 (use (match_operand:HI 2 "memory_operand" "m,m"))
4234 (use (match_operand:HI 3 "memory_operand" "m,m"))
4235 (clobber (match_operand:SI 4 "memory_operand" "=m,m"))]
4236 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4237 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4239 [(set_attr "type" "fistp")
4240 (set_attr "i387_cw" "trunc")
4241 (set_attr "mode" "SI")])
4243 (define_insn "fix_truncsi_memory"
4244 [(set (match_operand:SI 0 "memory_operand" "=m")
4245 (fix:SI (match_operand 1 "register_operand" "f")))
4246 (use (match_operand:HI 2 "memory_operand" "m"))
4247 (use (match_operand:HI 3 "memory_operand" "m"))]
4248 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4249 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4250 "* return output_fix_trunc (insn, operands);"
4251 [(set_attr "type" "fistp")
4252 (set_attr "i387_cw" "trunc")
4253 (set_attr "mode" "SI")])
4255 ;; When SSE available, it is always faster to use it!
4256 (define_insn "fix_truncsfsi_sse"
4257 [(set (match_operand:SI 0 "register_operand" "=r,r")
4258 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))]
4260 "cvttss2si\t{%1, %0|%0, %1}"
4261 [(set_attr "type" "sseicvt")
4262 (set_attr "mode" "DF")
4263 (set_attr "athlon_decode" "double,vector")])
4265 ;; Avoid vector decoded form of the instruction.
4267 [(match_scratch:SF 2 "x")
4268 (set (match_operand:SI 0 "register_operand" "")
4269 (fix:SI (match_operand:SF 1 "memory_operand" "")))]
4270 "TARGET_K8 && !optimize_size"
4271 [(set (match_dup 2) (match_dup 1))
4272 (set (match_dup 0) (fix:SI (match_dup 2)))]
4275 (define_insn "fix_truncdfsi_sse"
4276 [(set (match_operand:SI 0 "register_operand" "=r,r")
4277 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))]
4279 "cvttsd2si\t{%1, %0|%0, %1}"
4280 [(set_attr "type" "sseicvt")
4281 (set_attr "mode" "DF")
4282 (set_attr "athlon_decode" "double,vector")])
4284 ;; Avoid vector decoded form of the instruction.
4286 [(match_scratch:DF 2 "Y")
4287 (set (match_operand:SI 0 "register_operand" "")
4288 (fix:SI (match_operand:DF 1 "memory_operand" "")))]
4289 "TARGET_K8 && !optimize_size"
4290 [(set (match_dup 2) (match_dup 1))
4291 (set (match_dup 0) (fix:SI (match_dup 2)))]
4295 [(set (match_operand:SI 0 "register_operand" "")
4296 (fix:SI (match_operand 1 "register_operand" "")))
4297 (use (match_operand:HI 2 "memory_operand" ""))
4298 (use (match_operand:HI 3 "memory_operand" ""))
4299 (clobber (match_operand:SI 4 "memory_operand" ""))]
4301 [(parallel [(set (match_dup 4) (fix:SI (match_dup 1)))
4303 (use (match_dup 3))])
4304 (set (match_dup 0) (match_dup 4))]
4308 [(set (match_operand:SI 0 "memory_operand" "")
4309 (fix:SI (match_operand 1 "register_operand" "")))
4310 (use (match_operand:HI 2 "memory_operand" ""))
4311 (use (match_operand:HI 3 "memory_operand" ""))
4312 (clobber (match_operand:SI 4 "memory_operand" ""))]
4314 [(parallel [(set (match_dup 0) (fix:SI (match_dup 1)))
4316 (use (match_dup 3))])]
4319 ;; Signed conversion to HImode.
4321 (define_expand "fix_truncxfhi2"
4322 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
4323 (fix:HI (match_operand:XF 1 "register_operand" "")))
4324 (clobber (reg:CC FLAGS_REG))])]
4328 (define_expand "fix_truncdfhi2"
4329 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
4330 (fix:HI (match_operand:DF 1 "register_operand" "")))
4331 (clobber (reg:CC FLAGS_REG))])]
4332 "TARGET_80387 && !TARGET_SSE2"
4335 (define_expand "fix_truncsfhi2"
4336 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
4337 (fix:HI (match_operand:SF 1 "register_operand" "")))
4338 (clobber (reg:CC FLAGS_REG))])]
4339 "TARGET_80387 && !TARGET_SSE"
4342 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4343 ;; of the machinery.
4344 (define_insn_and_split "*fix_trunchi_1"
4345 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4346 (fix:HI (match_operand 1 "register_operand" "f,f")))
4347 (clobber (reg:CC FLAGS_REG))]
4348 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4349 && !reload_completed && !reload_in_progress
4350 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4355 ix86_optimize_mode_switching = 1;
4356 operands[2] = assign_386_stack_local (HImode, 1);
4357 operands[3] = assign_386_stack_local (HImode, 2);
4358 if (memory_operand (operands[0], VOIDmode))
4359 emit_insn (gen_fix_trunchi_memory (operands[0], operands[1],
4360 operands[2], operands[3]));
4363 operands[4] = assign_386_stack_local (HImode, 0);
4364 emit_insn (gen_fix_trunchi_nomemory (operands[0], operands[1],
4365 operands[2], operands[3],
4370 [(set_attr "type" "fistp")
4371 (set_attr "i387_cw" "trunc")
4372 (set_attr "mode" "HI")])
4374 (define_insn "fix_trunchi_nomemory"
4375 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4376 (fix:HI (match_operand 1 "register_operand" "f,f")))
4377 (use (match_operand:HI 2 "memory_operand" "m,m"))
4378 (use (match_operand:HI 3 "memory_operand" "m,m"))
4379 (clobber (match_operand:HI 4 "memory_operand" "=m,m"))]
4380 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4381 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4383 [(set_attr "type" "fistp")
4384 (set_attr "i387_cw" "trunc")
4385 (set_attr "mode" "HI")])
4387 (define_insn "fix_trunchi_memory"
4388 [(set (match_operand:HI 0 "memory_operand" "=m")
4389 (fix:HI (match_operand 1 "register_operand" "f")))
4390 (use (match_operand:HI 2 "memory_operand" "m"))
4391 (use (match_operand:HI 3 "memory_operand" "m"))]
4392 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4393 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4394 "* return output_fix_trunc (insn, operands);"
4395 [(set_attr "type" "fistp")
4396 (set_attr "i387_cw" "trunc")
4397 (set_attr "mode" "HI")])
4400 [(set (match_operand:HI 0 "memory_operand" "")
4401 (fix:HI (match_operand 1 "register_operand" "")))
4402 (use (match_operand:HI 2 "memory_operand" ""))
4403 (use (match_operand:HI 3 "memory_operand" ""))
4404 (clobber (match_operand:HI 4 "memory_operand" ""))]
4406 [(parallel [(set (match_dup 0) (fix:HI (match_dup 1)))
4408 (use (match_dup 3))])]
4412 [(set (match_operand:HI 0 "register_operand" "")
4413 (fix:HI (match_operand 1 "register_operand" "")))
4414 (use (match_operand:HI 2 "memory_operand" ""))
4415 (use (match_operand:HI 3 "memory_operand" ""))
4416 (clobber (match_operand:HI 4 "memory_operand" ""))]
4418 [(parallel [(set (match_dup 4) (fix:HI (match_dup 1)))
4421 (clobber (match_dup 4))])
4422 (set (match_dup 0) (match_dup 4))]
4425 (define_insn "x86_fnstcw_1"
4426 [(set (match_operand:HI 0 "memory_operand" "=m")
4427 (unspec:HI [(reg:HI FPSR_REG)] UNSPEC_FSTCW))]
4430 [(set_attr "length" "2")
4431 (set_attr "mode" "HI")
4432 (set_attr "unit" "i387")])
4434 (define_insn "x86_fldcw_1"
4435 [(set (reg:HI FPSR_REG)
4436 (unspec:HI [(match_operand:HI 0 "memory_operand" "m")] UNSPEC_FLDCW))]
4439 [(set_attr "length" "2")
4440 (set_attr "mode" "HI")
4441 (set_attr "unit" "i387")
4442 (set_attr "athlon_decode" "vector")])
4444 ;; Conversion between fixed point and floating point.
4446 ;; Even though we only accept memory inputs, the backend _really_
4447 ;; wants to be able to do this between registers.
4449 (define_expand "floathisf2"
4450 [(set (match_operand:SF 0 "register_operand" "")
4451 (float:SF (match_operand:HI 1 "nonimmediate_operand" "")))]
4452 "TARGET_80387 || TARGET_SSE_MATH"
4454 if (TARGET_SSE_MATH)
4456 emit_insn (gen_floatsisf2 (operands[0],
4457 convert_to_mode (SImode, operands[1], 0)));
4462 (define_insn "*floathisf2_i387"
4463 [(set (match_operand:SF 0 "register_operand" "=f,f")
4464 (float:SF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))]
4465 "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)"
4469 [(set_attr "type" "fmov,multi")
4470 (set_attr "mode" "SF")
4471 (set_attr "fp_int_src" "true")])
4473 (define_expand "floatsisf2"
4474 [(set (match_operand:SF 0 "register_operand" "")
4475 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
4476 "TARGET_80387 || TARGET_SSE_MATH"
4479 (define_insn "*floatsisf2_mixed"
4480 [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f")
4481 (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))]
4482 "TARGET_MIX_SSE_I387"
4486 cvtsi2ss\t{%1, %0|%0, %1}
4487 cvtsi2ss\t{%1, %0|%0, %1}"
4488 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4489 (set_attr "mode" "SF")
4490 (set_attr "athlon_decode" "*,*,vector,double")
4491 (set_attr "fp_int_src" "true")])
4493 (define_insn "*floatsisf2_sse"
4494 [(set (match_operand:SF 0 "register_operand" "=x,x")
4495 (float:SF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))]
4497 "cvtsi2ss\t{%1, %0|%0, %1}"
4498 [(set_attr "type" "sseicvt")
4499 (set_attr "mode" "SF")
4500 (set_attr "athlon_decode" "vector,double")
4501 (set_attr "fp_int_src" "true")])
4503 ; Avoid possible reformatting penalty on the destination by first
4506 [(set (match_operand:SF 0 "register_operand" "")
4507 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
4509 && TARGET_SSE_MATH && TARGET_SSE_PARTIAL_REGS
4510 && SSE_REG_P (operands[0])"
4514 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
4515 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
4516 emit_insn (gen_cvtsi2ss (dest, dest, operands[1]));
4520 (define_insn "*floatsisf2_i387"
4521 [(set (match_operand:SF 0 "register_operand" "=f,f")
4522 (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,?r")))]
4527 [(set_attr "type" "fmov,multi")
4528 (set_attr "mode" "SF")
4529 (set_attr "fp_int_src" "true")])
4531 (define_expand "floatdisf2"
4532 [(set (match_operand:SF 0 "register_operand" "")
4533 (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
4534 "TARGET_80387 || (TARGET_64BIT && TARGET_SSE_MATH)"
4537 (define_insn "*floatdisf2_mixed"
4538 [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f")
4539 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))]
4540 "TARGET_64BIT && TARGET_MIX_SSE_I387"
4544 cvtsi2ss{q}\t{%1, %0|%0, %1}
4545 cvtsi2ss{q}\t{%1, %0|%0, %1}"
4546 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4547 (set_attr "mode" "SF")
4548 (set_attr "athlon_decode" "*,*,vector,double")
4549 (set_attr "fp_int_src" "true")])
4551 (define_insn "*floatdisf2_sse"
4552 [(set (match_operand:SF 0 "register_operand" "=x,x")
4553 (float:SF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))]
4554 "TARGET_64BIT && TARGET_SSE_MATH"
4555 "cvtsi2ss{q}\t{%1, %0|%0, %1}"
4556 [(set_attr "type" "sseicvt")
4557 (set_attr "mode" "SF")
4558 (set_attr "athlon_decode" "vector,double")
4559 (set_attr "fp_int_src" "true")])
4561 ; Avoid possible reformatting penalty on the destination by first
4564 [(set (match_operand:SF 0 "register_operand" "")
4565 (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
4567 && TARGET_64BIT && TARGET_SSE_MATH && TARGET_SSE_PARTIAL_REGS
4568 && SSE_REG_P (operands[0])"
4572 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
4573 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
4574 emit_insn (gen_cvtsi2ssq (dest, dest, operands[1]));
4578 (define_insn "*floatdisf2_i387"
4579 [(set (match_operand:SF 0 "register_operand" "=f,f")
4580 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,?r")))]
4585 [(set_attr "type" "fmov,multi")
4586 (set_attr "mode" "SF")
4587 (set_attr "fp_int_src" "true")])
4589 (define_expand "floathidf2"
4590 [(set (match_operand:DF 0 "register_operand" "")
4591 (float:DF (match_operand:HI 1 "nonimmediate_operand" "")))]
4592 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
4594 if (TARGET_SSE2 && TARGET_SSE_MATH)
4596 emit_insn (gen_floatsidf2 (operands[0],
4597 convert_to_mode (SImode, operands[1], 0)));
4602 (define_insn "*floathidf2_i387"
4603 [(set (match_operand:DF 0 "register_operand" "=f,f")
4604 (float:DF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))]
4605 "TARGET_80387 && (!(TARGET_SSE2 && TARGET_SSE_MATH) || TARGET_MIX_SSE_I387)"
4609 [(set_attr "type" "fmov,multi")
4610 (set_attr "mode" "DF")
4611 (set_attr "fp_int_src" "true")])
4613 (define_expand "floatsidf2"
4614 [(set (match_operand:DF 0 "register_operand" "")
4615 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))]
4616 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
4619 (define_insn "*floatsidf2_mixed"
4620 [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f")
4621 (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))]
4622 "TARGET_SSE2 && TARGET_MIX_SSE_I387"
4626 cvtsi2sd\t{%1, %0|%0, %1}
4627 cvtsi2sd\t{%1, %0|%0, %1}"
4628 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4629 (set_attr "mode" "DF")
4630 (set_attr "athlon_decode" "*,*,double,direct")
4631 (set_attr "fp_int_src" "true")])
4633 (define_insn "*floatsidf2_sse"
4634 [(set (match_operand:DF 0 "register_operand" "=Y,Y")
4635 (float:DF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))]
4636 "TARGET_SSE2 && TARGET_SSE_MATH"
4637 "cvtsi2sd\t{%1, %0|%0, %1}"
4638 [(set_attr "type" "sseicvt")
4639 (set_attr "mode" "DF")
4640 (set_attr "athlon_decode" "double,direct")
4641 (set_attr "fp_int_src" "true")])
4643 (define_insn "*floatsidf2_i387"
4644 [(set (match_operand:DF 0 "register_operand" "=f,f")
4645 (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,?r")))]
4650 [(set_attr "type" "fmov,multi")
4651 (set_attr "mode" "DF")
4652 (set_attr "fp_int_src" "true")])
4654 (define_expand "floatdidf2"
4655 [(set (match_operand:DF 0 "register_operand" "")
4656 (float:DF (match_operand:DI 1 "nonimmediate_operand" "")))]
4657 "TARGET_80387 || (TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH)"
4660 (define_insn "*floatdidf2_mixed"
4661 [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f")
4662 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))]
4663 "TARGET_64BIT && TARGET_SSE2 && TARGET_MIX_SSE_I387"
4667 cvtsi2sd{q}\t{%1, %0|%0, %1}
4668 cvtsi2sd{q}\t{%1, %0|%0, %1}"
4669 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4670 (set_attr "mode" "DF")
4671 (set_attr "athlon_decode" "*,*,double,direct")
4672 (set_attr "fp_int_src" "true")])
4674 (define_insn "*floatdidf2_sse"
4675 [(set (match_operand:DF 0 "register_operand" "=Y,Y")
4676 (float:DF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))]
4677 "TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH"
4678 "cvtsi2sd{q}\t{%1, %0|%0, %1}"
4679 [(set_attr "type" "sseicvt")
4680 (set_attr "mode" "DF")
4681 (set_attr "athlon_decode" "double,direct")
4682 (set_attr "fp_int_src" "true")])
4684 (define_insn "*floatdidf2_i387"
4685 [(set (match_operand:DF 0 "register_operand" "=f,f")
4686 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,?r")))]
4691 [(set_attr "type" "fmov,multi")
4692 (set_attr "mode" "DF")
4693 (set_attr "fp_int_src" "true")])
4695 (define_insn "floathixf2"
4696 [(set (match_operand:XF 0 "register_operand" "=f,f")
4697 (float:XF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))]
4702 [(set_attr "type" "fmov,multi")
4703 (set_attr "mode" "XF")
4704 (set_attr "fp_int_src" "true")])
4706 (define_insn "floatsixf2"
4707 [(set (match_operand:XF 0 "register_operand" "=f,f")
4708 (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r")))]
4713 [(set_attr "type" "fmov,multi")
4714 (set_attr "mode" "XF")
4715 (set_attr "fp_int_src" "true")])
4717 (define_insn "floatdixf2"
4718 [(set (match_operand:XF 0 "register_operand" "=f,f")
4719 (float:XF (match_operand:DI 1 "nonimmediate_operand" "m,?r")))]
4724 [(set_attr "type" "fmov,multi")
4725 (set_attr "mode" "XF")
4726 (set_attr "fp_int_src" "true")])
4728 ;; %%% Kill these when reload knows how to do it.
4730 [(set (match_operand 0 "fp_register_operand" "")
4731 (float (match_operand 1 "register_operand" "")))]
4734 && FLOAT_MODE_P (GET_MODE (operands[0]))"
4737 operands[2] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
4738 operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);
4739 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[2]));
4740 ix86_free_from_memory (GET_MODE (operands[1]));
4744 (define_expand "floatunssisf2"
4745 [(use (match_operand:SF 0 "register_operand" ""))
4746 (use (match_operand:SI 1 "register_operand" ""))]
4747 "!TARGET_64BIT && TARGET_SSE_MATH"
4748 "x86_emit_floatuns (operands); DONE;")
4750 (define_expand "floatunsdisf2"
4751 [(use (match_operand:SF 0 "register_operand" ""))
4752 (use (match_operand:DI 1 "register_operand" ""))]
4753 "TARGET_64BIT && TARGET_SSE_MATH"
4754 "x86_emit_floatuns (operands); DONE;")
4756 (define_expand "floatunsdidf2"
4757 [(use (match_operand:DF 0 "register_operand" ""))
4758 (use (match_operand:DI 1 "register_operand" ""))]
4759 "TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH"
4760 "x86_emit_floatuns (operands); DONE;")
4762 ;; SSE extract/set expanders
4764 (define_expand "vec_setv2df"
4765 [(match_operand:V2DF 0 "register_operand" "")
4766 (match_operand:DF 1 "register_operand" "")
4767 (match_operand 2 "const_int_operand" "")]
4770 switch (INTVAL (operands[2]))
4773 emit_insn (gen_sse2_movsd (operands[0], operands[0],
4774 simplify_gen_subreg (V2DFmode, operands[1],
4779 rtx op1 = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0);
4781 emit_insn (gen_sse2_unpcklpd (operands[0], operands[0], op1));
4790 (define_expand "vec_extractv2df"
4791 [(match_operand:DF 0 "register_operand" "")
4792 (match_operand:V2DF 1 "register_operand" "")
4793 (match_operand 2 "const_int_operand" "")]
4796 switch (INTVAL (operands[2]))
4799 emit_move_insn (operands[0], gen_lowpart (DFmode, operands[1]));
4803 rtx dest = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
4805 emit_insn (gen_sse2_unpckhpd (dest, operands[1], operands[1]));
4814 (define_expand "vec_initv2df"
4815 [(match_operand:V2DF 0 "register_operand" "")
4816 (match_operand 1 "" "")]
4819 ix86_expand_vector_init (operands[0], operands[1]);
4823 (define_expand "vec_setv4sf"
4824 [(match_operand:V4SF 0 "register_operand" "")
4825 (match_operand:SF 1 "register_operand" "")
4826 (match_operand 2 "const_int_operand" "")]
4829 switch (INTVAL (operands[2]))
4832 emit_insn (gen_sse_movss (operands[0], operands[0],
4833 simplify_gen_subreg (V4SFmode, operands[1],
4838 rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4839 rtx tmp = gen_reg_rtx (V4SFmode);
4841 emit_move_insn (tmp, operands[0]);
4842 emit_insn (gen_sse_unpcklps (operands[0], operands[0], operands[0]));
4843 emit_insn (gen_sse_movss (operands[0], operands[0], op1));
4844 emit_insn (gen_sse_shufps (operands[0], operands[0], tmp,
4845 GEN_INT (1 + (0<<2) + (2<<4) + (3<<6))));
4850 rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4851 rtx tmp = gen_reg_rtx (V4SFmode);
4853 emit_move_insn (tmp, operands[0]);
4854 emit_insn (gen_sse_movss (tmp, tmp, op1));
4855 emit_insn (gen_sse_shufps (operands[0], operands[0], tmp,
4856 GEN_INT (0 + (1<<2) + (0<<4) + (3<<6))));
4861 rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4862 rtx tmp = gen_reg_rtx (V4SFmode);
4864 emit_move_insn (tmp, operands[0]);
4865 emit_insn (gen_sse_movss (tmp, tmp, op1));
4866 emit_insn (gen_sse_shufps (operands[0], operands[0], tmp,
4867 GEN_INT (0 + (1<<2) + (2<<4) + (0<<6))));
4876 (define_expand "vec_extractv4sf"
4877 [(match_operand:SF 0 "register_operand" "")
4878 (match_operand:V4SF 1 "register_operand" "")
4879 (match_operand 2 "const_int_operand" "")]
4882 switch (INTVAL (operands[2]))
4885 emit_move_insn (operands[0], gen_lowpart (SFmode, operands[1]));
4889 rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4890 rtx tmp = gen_reg_rtx (V4SFmode);
4892 emit_move_insn (tmp, operands[1]);
4893 emit_insn (gen_sse_shufps (op0, tmp, tmp,
4899 rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4900 rtx tmp = gen_reg_rtx (V4SFmode);
4902 emit_move_insn (tmp, operands[1]);
4903 emit_insn (gen_sse_unpckhps (op0, tmp, tmp));
4908 rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4909 rtx tmp = gen_reg_rtx (V4SFmode);
4911 emit_move_insn (tmp, operands[1]);
4912 emit_insn (gen_sse_shufps (op0, tmp, tmp,
4922 (define_expand "vec_initv4sf"
4923 [(match_operand:V4SF 0 "register_operand" "")
4924 (match_operand 1 "" "")]
4927 ix86_expand_vector_init (operands[0], operands[1]);
4933 ;; %%% splits for addsidi3
4934 ; [(set (match_operand:DI 0 "nonimmediate_operand" "")
4935 ; (plus:DI (match_operand:DI 1 "general_operand" "")
4936 ; (zero_extend:DI (match_operand:SI 2 "general_operand" ""))))]
4938 (define_expand "adddi3"
4939 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4940 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4941 (match_operand:DI 2 "x86_64_general_operand" "")))
4942 (clobber (reg:CC FLAGS_REG))]
4944 "ix86_expand_binary_operator (PLUS, DImode, operands); DONE;")
4946 (define_insn "*adddi3_1"
4947 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
4948 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4949 (match_operand:DI 2 "general_operand" "roiF,riF")))
4950 (clobber (reg:CC FLAGS_REG))]
4951 "!TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4955 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4956 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4957 (match_operand:DI 2 "general_operand" "")))
4958 (clobber (reg:CC FLAGS_REG))]
4959 "!TARGET_64BIT && reload_completed"
4960 [(parallel [(set (reg:CC FLAGS_REG) (unspec:CC [(match_dup 1) (match_dup 2)]
4962 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
4963 (parallel [(set (match_dup 3)
4964 (plus:SI (plus:SI (ltu:SI (reg:CC FLAGS_REG) (const_int 0))
4967 (clobber (reg:CC FLAGS_REG))])]
4968 "split_di (operands+0, 1, operands+0, operands+3);
4969 split_di (operands+1, 1, operands+1, operands+4);
4970 split_di (operands+2, 1, operands+2, operands+5);")
4972 (define_insn "adddi3_carry_rex64"
4973 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
4974 (plus:DI (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "")
4975 (match_operand:DI 1 "nonimmediate_operand" "%0,0"))
4976 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
4977 (clobber (reg:CC FLAGS_REG))]
4978 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4979 "adc{q}\t{%2, %0|%0, %2}"
4980 [(set_attr "type" "alu")
4981 (set_attr "pent_pair" "pu")
4982 (set_attr "mode" "DI")])
4984 (define_insn "*adddi3_cc_rex64"
4985 [(set (reg:CC FLAGS_REG)
4986 (unspec:CC [(match_operand:DI 1 "nonimmediate_operand" "%0,0")
4987 (match_operand:DI 2 "x86_64_general_operand" "re,rm")]
4989 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
4990 (plus:DI (match_dup 1) (match_dup 2)))]
4991 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4992 "add{q}\t{%2, %0|%0, %2}"
4993 [(set_attr "type" "alu")
4994 (set_attr "mode" "DI")])
4996 (define_insn "addqi3_carry"
4997 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
4998 (plus:QI (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "")
4999 (match_operand:QI 1 "nonimmediate_operand" "%0,0"))
5000 (match_operand:QI 2 "general_operand" "qi,qm")))
5001 (clobber (reg:CC FLAGS_REG))]
5002 "ix86_binary_operator_ok (PLUS, QImode, operands)"
5003 "adc{b}\t{%2, %0|%0, %2}"
5004 [(set_attr "type" "alu")
5005 (set_attr "pent_pair" "pu")
5006 (set_attr "mode" "QI")])
5008 (define_insn "addhi3_carry"
5009 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
5010 (plus:HI (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "")
5011 (match_operand:HI 1 "nonimmediate_operand" "%0,0"))
5012 (match_operand:HI 2 "general_operand" "ri,rm")))
5013 (clobber (reg:CC FLAGS_REG))]
5014 "ix86_binary_operator_ok (PLUS, HImode, operands)"
5015 "adc{w}\t{%2, %0|%0, %2}"
5016 [(set_attr "type" "alu")
5017 (set_attr "pent_pair" "pu")
5018 (set_attr "mode" "HI")])
5020 (define_insn "addsi3_carry"
5021 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
5022 (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
5023 (match_operand:SI 1 "nonimmediate_operand" "%0,0"))
5024 (match_operand:SI 2 "general_operand" "ri,rm")))
5025 (clobber (reg:CC FLAGS_REG))]
5026 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5027 "adc{l}\t{%2, %0|%0, %2}"
5028 [(set_attr "type" "alu")
5029 (set_attr "pent_pair" "pu")
5030 (set_attr "mode" "SI")])
5032 (define_insn "*addsi3_carry_zext"
5033 [(set (match_operand:DI 0 "register_operand" "=r")
5035 (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
5036 (match_operand:SI 1 "nonimmediate_operand" "%0"))
5037 (match_operand:SI 2 "general_operand" "rim"))))
5038 (clobber (reg:CC FLAGS_REG))]
5039 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5040 "adc{l}\t{%2, %k0|%k0, %2}"
5041 [(set_attr "type" "alu")
5042 (set_attr "pent_pair" "pu")
5043 (set_attr "mode" "SI")])
5045 (define_insn "*addsi3_cc"
5046 [(set (reg:CC FLAGS_REG)
5047 (unspec:CC [(match_operand:SI 1 "nonimmediate_operand" "%0,0")
5048 (match_operand:SI 2 "general_operand" "ri,rm")]
5050 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
5051 (plus:SI (match_dup 1) (match_dup 2)))]
5052 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5053 "add{l}\t{%2, %0|%0, %2}"
5054 [(set_attr "type" "alu")
5055 (set_attr "mode" "SI")])
5057 (define_insn "addqi3_cc"
5058 [(set (reg:CC FLAGS_REG)
5059 (unspec:CC [(match_operand:QI 1 "nonimmediate_operand" "%0,0")
5060 (match_operand:QI 2 "general_operand" "qi,qm")]
5062 (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
5063 (plus:QI (match_dup 1) (match_dup 2)))]
5064 "ix86_binary_operator_ok (PLUS, QImode, operands)"
5065 "add{b}\t{%2, %0|%0, %2}"
5066 [(set_attr "type" "alu")
5067 (set_attr "mode" "QI")])
5069 (define_expand "addsi3"
5070 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
5071 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5072 (match_operand:SI 2 "general_operand" "")))
5073 (clobber (reg:CC FLAGS_REG))])]
5075 "ix86_expand_binary_operator (PLUS, SImode, operands); DONE;")
5077 (define_insn "*lea_1"
5078 [(set (match_operand:SI 0 "register_operand" "=r")
5079 (match_operand:SI 1 "no_seg_address_operand" "p"))]
5081 "lea{l}\t{%a1, %0|%0, %a1}"
5082 [(set_attr "type" "lea")
5083 (set_attr "mode" "SI")])
5085 (define_insn "*lea_1_rex64"
5086 [(set (match_operand:SI 0 "register_operand" "=r")
5087 (subreg:SI (match_operand:DI 1 "no_seg_address_operand" "p") 0))]
5089 "lea{l}\t{%a1, %0|%0, %a1}"
5090 [(set_attr "type" "lea")
5091 (set_attr "mode" "SI")])
5093 (define_insn "*lea_1_zext"
5094 [(set (match_operand:DI 0 "register_operand" "=r")
5096 (subreg:SI (match_operand:DI 1 "no_seg_address_operand" "p") 0)))]
5098 "lea{l}\t{%a1, %k0|%k0, %a1}"
5099 [(set_attr "type" "lea")
5100 (set_attr "mode" "SI")])
5102 (define_insn "*lea_2_rex64"
5103 [(set (match_operand:DI 0 "register_operand" "=r")
5104 (match_operand:DI 1 "no_seg_address_operand" "p"))]
5106 "lea{q}\t{%a1, %0|%0, %a1}"
5107 [(set_attr "type" "lea")
5108 (set_attr "mode" "DI")])
5110 ;; The lea patterns for non-Pmodes needs to be matched by several
5111 ;; insns converted to real lea by splitters.
5113 (define_insn_and_split "*lea_general_1"
5114 [(set (match_operand 0 "register_operand" "=r")
5115 (plus (plus (match_operand 1 "index_register_operand" "l")
5116 (match_operand 2 "register_operand" "r"))
5117 (match_operand 3 "immediate_operand" "i")))]
5118 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5119 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5120 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5121 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5122 && GET_MODE (operands[0]) == GET_MODE (operands[2])
5123 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
5124 || GET_MODE (operands[3]) == VOIDmode)"
5126 "&& reload_completed"
5130 operands[0] = gen_lowpart (SImode, operands[0]);
5131 operands[1] = gen_lowpart (Pmode, operands[1]);
5132 operands[2] = gen_lowpart (Pmode, operands[2]);
5133 operands[3] = gen_lowpart (Pmode, operands[3]);
5134 pat = gen_rtx_PLUS (Pmode, gen_rtx_PLUS (Pmode, operands[1], operands[2]),
5136 if (Pmode != SImode)
5137 pat = gen_rtx_SUBREG (SImode, pat, 0);
5138 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5141 [(set_attr "type" "lea")
5142 (set_attr "mode" "SI")])
5144 (define_insn_and_split "*lea_general_1_zext"
5145 [(set (match_operand:DI 0 "register_operand" "=r")
5147 (plus:SI (plus:SI (match_operand:SI 1 "index_register_operand" "l")
5148 (match_operand:SI 2 "register_operand" "r"))
5149 (match_operand:SI 3 "immediate_operand" "i"))))]
5152 "&& reload_completed"
5154 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (match_dup 1)
5156 (match_dup 3)) 0)))]
5158 operands[1] = gen_lowpart (Pmode, operands[1]);
5159 operands[2] = gen_lowpart (Pmode, operands[2]);
5160 operands[3] = gen_lowpart (Pmode, operands[3]);
5162 [(set_attr "type" "lea")
5163 (set_attr "mode" "SI")])
5165 (define_insn_and_split "*lea_general_2"
5166 [(set (match_operand 0 "register_operand" "=r")
5167 (plus (mult (match_operand 1 "index_register_operand" "l")
5168 (match_operand 2 "const248_operand" "i"))
5169 (match_operand 3 "nonmemory_operand" "ri")))]
5170 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5171 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5172 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5173 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5174 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
5175 || GET_MODE (operands[3]) == VOIDmode)"
5177 "&& reload_completed"
5181 operands[0] = gen_lowpart (SImode, operands[0]);
5182 operands[1] = gen_lowpart (Pmode, operands[1]);
5183 operands[3] = gen_lowpart (Pmode, operands[3]);
5184 pat = gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1], operands[2]),
5186 if (Pmode != SImode)
5187 pat = gen_rtx_SUBREG (SImode, pat, 0);
5188 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5191 [(set_attr "type" "lea")
5192 (set_attr "mode" "SI")])
5194 (define_insn_and_split "*lea_general_2_zext"
5195 [(set (match_operand:DI 0 "register_operand" "=r")
5197 (plus:SI (mult:SI (match_operand:SI 1 "index_register_operand" "l")
5198 (match_operand:SI 2 "const248_operand" "n"))
5199 (match_operand:SI 3 "nonmemory_operand" "ri"))))]
5202 "&& reload_completed"
5204 (zero_extend:DI (subreg:SI (plus:DI (mult:DI (match_dup 1)
5206 (match_dup 3)) 0)))]
5208 operands[1] = gen_lowpart (Pmode, operands[1]);
5209 operands[3] = gen_lowpart (Pmode, operands[3]);
5211 [(set_attr "type" "lea")
5212 (set_attr "mode" "SI")])
5214 (define_insn_and_split "*lea_general_3"
5215 [(set (match_operand 0 "register_operand" "=r")
5216 (plus (plus (mult (match_operand 1 "index_register_operand" "l")
5217 (match_operand 2 "const248_operand" "i"))
5218 (match_operand 3 "register_operand" "r"))
5219 (match_operand 4 "immediate_operand" "i")))]
5220 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5221 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5222 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5223 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5224 && GET_MODE (operands[0]) == GET_MODE (operands[3])"
5226 "&& reload_completed"
5230 operands[0] = gen_lowpart (SImode, operands[0]);
5231 operands[1] = gen_lowpart (Pmode, operands[1]);
5232 operands[3] = gen_lowpart (Pmode, operands[3]);
5233 operands[4] = gen_lowpart (Pmode, operands[4]);
5234 pat = gen_rtx_PLUS (Pmode,
5235 gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1],
5239 if (Pmode != SImode)
5240 pat = gen_rtx_SUBREG (SImode, pat, 0);
5241 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5244 [(set_attr "type" "lea")
5245 (set_attr "mode" "SI")])
5247 (define_insn_and_split "*lea_general_3_zext"
5248 [(set (match_operand:DI 0 "register_operand" "=r")
5250 (plus:SI (plus:SI (mult:SI
5251 (match_operand:SI 1 "index_register_operand" "l")
5252 (match_operand:SI 2 "const248_operand" "n"))
5253 (match_operand:SI 3 "register_operand" "r"))
5254 (match_operand:SI 4 "immediate_operand" "i"))))]
5257 "&& reload_completed"
5259 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (mult:DI (match_dup 1)
5262 (match_dup 4)) 0)))]
5264 operands[1] = gen_lowpart (Pmode, operands[1]);
5265 operands[3] = gen_lowpart (Pmode, operands[3]);
5266 operands[4] = gen_lowpart (Pmode, operands[4]);
5268 [(set_attr "type" "lea")
5269 (set_attr "mode" "SI")])
5271 (define_insn "*adddi_1_rex64"
5272 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r")
5273 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,r")
5274 (match_operand:DI 2 "x86_64_general_operand" "rme,re,le")))
5275 (clobber (reg:CC FLAGS_REG))]
5276 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5278 switch (get_attr_type (insn))
5281 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5282 return "lea{q}\t{%a2, %0|%0, %a2}";
5285 if (! rtx_equal_p (operands[0], operands[1]))
5287 if (operands[2] == const1_rtx)
5288 return "inc{q}\t%0";
5289 else if (operands[2] == constm1_rtx)
5290 return "dec{q}\t%0";
5295 if (! rtx_equal_p (operands[0], operands[1]))
5298 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5299 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5300 if (GET_CODE (operands[2]) == CONST_INT
5301 /* Avoid overflows. */
5302 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5303 && (INTVAL (operands[2]) == 128
5304 || (INTVAL (operands[2]) < 0
5305 && INTVAL (operands[2]) != -128)))
5307 operands[2] = GEN_INT (-INTVAL (operands[2]));
5308 return "sub{q}\t{%2, %0|%0, %2}";
5310 return "add{q}\t{%2, %0|%0, %2}";
5314 (cond [(eq_attr "alternative" "2")
5315 (const_string "lea")
5316 ; Current assemblers are broken and do not allow @GOTOFF in
5317 ; ought but a memory context.
5318 (match_operand:DI 2 "pic_symbolic_operand" "")
5319 (const_string "lea")
5320 (match_operand:DI 2 "incdec_operand" "")
5321 (const_string "incdec")
5323 (const_string "alu")))
5324 (set_attr "mode" "DI")])
5326 ;; Convert lea to the lea pattern to avoid flags dependency.
5328 [(set (match_operand:DI 0 "register_operand" "")
5329 (plus:DI (match_operand:DI 1 "register_operand" "")
5330 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
5331 (clobber (reg:CC FLAGS_REG))]
5332 "TARGET_64BIT && reload_completed
5333 && true_regnum (operands[0]) != true_regnum (operands[1])"
5335 (plus:DI (match_dup 1)
5339 (define_insn "*adddi_2_rex64"
5340 [(set (reg FLAGS_REG)
5342 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5343 (match_operand:DI 2 "x86_64_general_operand" "rme,re"))
5345 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
5346 (plus:DI (match_dup 1) (match_dup 2)))]
5347 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5348 && ix86_binary_operator_ok (PLUS, DImode, operands)
5349 /* Current assemblers are broken and do not allow @GOTOFF in
5350 ought but a memory context. */
5351 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5353 switch (get_attr_type (insn))
5356 if (! rtx_equal_p (operands[0], operands[1]))
5358 if (operands[2] == const1_rtx)
5359 return "inc{q}\t%0";
5360 else if (operands[2] == constm1_rtx)
5361 return "dec{q}\t%0";
5366 if (! rtx_equal_p (operands[0], operands[1]))
5368 /* ???? We ought to handle there the 32bit case too
5369 - do we need new constraint? */
5370 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5371 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5372 if (GET_CODE (operands[2]) == CONST_INT
5373 /* Avoid overflows. */
5374 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5375 && (INTVAL (operands[2]) == 128
5376 || (INTVAL (operands[2]) < 0
5377 && INTVAL (operands[2]) != -128)))
5379 operands[2] = GEN_INT (-INTVAL (operands[2]));
5380 return "sub{q}\t{%2, %0|%0, %2}";
5382 return "add{q}\t{%2, %0|%0, %2}";
5386 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5387 (const_string "incdec")
5388 (const_string "alu")))
5389 (set_attr "mode" "DI")])
5391 (define_insn "*adddi_3_rex64"
5392 [(set (reg FLAGS_REG)
5393 (compare (neg:DI (match_operand:DI 2 "x86_64_general_operand" "rme"))
5394 (match_operand:DI 1 "x86_64_general_operand" "%0")))
5395 (clobber (match_scratch:DI 0 "=r"))]
5397 && ix86_match_ccmode (insn, CCZmode)
5398 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5399 /* Current assemblers are broken and do not allow @GOTOFF in
5400 ought but a memory context. */
5401 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5403 switch (get_attr_type (insn))
5406 if (! rtx_equal_p (operands[0], operands[1]))
5408 if (operands[2] == const1_rtx)
5409 return "inc{q}\t%0";
5410 else if (operands[2] == constm1_rtx)
5411 return "dec{q}\t%0";
5416 if (! rtx_equal_p (operands[0], operands[1]))
5418 /* ???? We ought to handle there the 32bit case too
5419 - do we need new constraint? */
5420 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5421 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5422 if (GET_CODE (operands[2]) == CONST_INT
5423 /* Avoid overflows. */
5424 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5425 && (INTVAL (operands[2]) == 128
5426 || (INTVAL (operands[2]) < 0
5427 && INTVAL (operands[2]) != -128)))
5429 operands[2] = GEN_INT (-INTVAL (operands[2]));
5430 return "sub{q}\t{%2, %0|%0, %2}";
5432 return "add{q}\t{%2, %0|%0, %2}";
5436 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5437 (const_string "incdec")
5438 (const_string "alu")))
5439 (set_attr "mode" "DI")])
5441 ; For comparisons against 1, -1 and 128, we may generate better code
5442 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5443 ; is matched then. We can't accept general immediate, because for
5444 ; case of overflows, the result is messed up.
5445 ; This pattern also don't hold of 0x8000000000000000, since the value overflows
5447 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5448 ; only for comparisons not depending on it.
5449 (define_insn "*adddi_4_rex64"
5450 [(set (reg FLAGS_REG)
5451 (compare (match_operand:DI 1 "nonimmediate_operand" "0")
5452 (match_operand:DI 2 "x86_64_immediate_operand" "e")))
5453 (clobber (match_scratch:DI 0 "=rm"))]
5455 && ix86_match_ccmode (insn, CCGCmode)"
5457 switch (get_attr_type (insn))
5460 if (operands[2] == constm1_rtx)
5461 return "inc{q}\t%0";
5462 else if (operands[2] == const1_rtx)
5463 return "dec{q}\t%0";
5468 if (! rtx_equal_p (operands[0], operands[1]))
5470 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5471 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5472 if ((INTVAL (operands[2]) == -128
5473 || (INTVAL (operands[2]) > 0
5474 && INTVAL (operands[2]) != 128))
5475 /* Avoid overflows. */
5476 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))))
5477 return "sub{q}\t{%2, %0|%0, %2}";
5478 operands[2] = GEN_INT (-INTVAL (operands[2]));
5479 return "add{q}\t{%2, %0|%0, %2}";
5483 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5484 (const_string "incdec")
5485 (const_string "alu")))
5486 (set_attr "mode" "DI")])
5488 (define_insn "*adddi_5_rex64"
5489 [(set (reg FLAGS_REG)
5491 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5492 (match_operand:DI 2 "x86_64_general_operand" "rme"))
5494 (clobber (match_scratch:DI 0 "=r"))]
5496 && ix86_match_ccmode (insn, CCGOCmode)
5497 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5498 /* Current assemblers are broken and do not allow @GOTOFF in
5499 ought but a memory context. */
5500 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5502 switch (get_attr_type (insn))
5505 if (! rtx_equal_p (operands[0], operands[1]))
5507 if (operands[2] == const1_rtx)
5508 return "inc{q}\t%0";
5509 else if (operands[2] == constm1_rtx)
5510 return "dec{q}\t%0";
5515 if (! rtx_equal_p (operands[0], operands[1]))
5517 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5518 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5519 if (GET_CODE (operands[2]) == CONST_INT
5520 /* Avoid overflows. */
5521 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5522 && (INTVAL (operands[2]) == 128
5523 || (INTVAL (operands[2]) < 0
5524 && INTVAL (operands[2]) != -128)))
5526 operands[2] = GEN_INT (-INTVAL (operands[2]));
5527 return "sub{q}\t{%2, %0|%0, %2}";
5529 return "add{q}\t{%2, %0|%0, %2}";
5533 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5534 (const_string "incdec")
5535 (const_string "alu")))
5536 (set_attr "mode" "DI")])
5539 (define_insn "*addsi_1"
5540 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r")
5541 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r")
5542 (match_operand:SI 2 "general_operand" "rmni,rni,lni")))
5543 (clobber (reg:CC FLAGS_REG))]
5544 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5546 switch (get_attr_type (insn))
5549 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5550 return "lea{l}\t{%a2, %0|%0, %a2}";
5553 if (! rtx_equal_p (operands[0], operands[1]))
5555 if (operands[2] == const1_rtx)
5556 return "inc{l}\t%0";
5557 else if (operands[2] == constm1_rtx)
5558 return "dec{l}\t%0";
5563 if (! rtx_equal_p (operands[0], operands[1]))
5566 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5567 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5568 if (GET_CODE (operands[2]) == CONST_INT
5569 && (INTVAL (operands[2]) == 128
5570 || (INTVAL (operands[2]) < 0
5571 && INTVAL (operands[2]) != -128)))
5573 operands[2] = GEN_INT (-INTVAL (operands[2]));
5574 return "sub{l}\t{%2, %0|%0, %2}";
5576 return "add{l}\t{%2, %0|%0, %2}";
5580 (cond [(eq_attr "alternative" "2")
5581 (const_string "lea")
5582 ; Current assemblers are broken and do not allow @GOTOFF in
5583 ; ought but a memory context.
5584 (match_operand:SI 2 "pic_symbolic_operand" "")
5585 (const_string "lea")
5586 (match_operand:SI 2 "incdec_operand" "")
5587 (const_string "incdec")
5589 (const_string "alu")))
5590 (set_attr "mode" "SI")])
5592 ;; Convert lea to the lea pattern to avoid flags dependency.
5594 [(set (match_operand 0 "register_operand" "")
5595 (plus (match_operand 1 "register_operand" "")
5596 (match_operand 2 "nonmemory_operand" "")))
5597 (clobber (reg:CC FLAGS_REG))]
5599 && true_regnum (operands[0]) != true_regnum (operands[1])"
5603 /* In -fPIC mode the constructs like (const (unspec [symbol_ref]))
5604 may confuse gen_lowpart. */
5605 if (GET_MODE (operands[0]) != Pmode)
5607 operands[1] = gen_lowpart (Pmode, operands[1]);
5608 operands[2] = gen_lowpart (Pmode, operands[2]);
5610 operands[0] = gen_lowpart (SImode, operands[0]);
5611 pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
5612 if (Pmode != SImode)
5613 pat = gen_rtx_SUBREG (SImode, pat, 0);
5614 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5618 ;; It may seem that nonimmediate operand is proper one for operand 1.
5619 ;; The addsi_1 pattern allows nonimmediate operand at that place and
5620 ;; we take care in ix86_binary_operator_ok to not allow two memory
5621 ;; operands so proper swapping will be done in reload. This allow
5622 ;; patterns constructed from addsi_1 to match.
5623 (define_insn "addsi_1_zext"
5624 [(set (match_operand:DI 0 "register_operand" "=r,r")
5626 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r")
5627 (match_operand:SI 2 "general_operand" "rmni,lni"))))
5628 (clobber (reg:CC FLAGS_REG))]
5629 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5631 switch (get_attr_type (insn))
5634 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5635 return "lea{l}\t{%a2, %k0|%k0, %a2}";
5638 if (operands[2] == const1_rtx)
5639 return "inc{l}\t%k0";
5640 else if (operands[2] == constm1_rtx)
5641 return "dec{l}\t%k0";
5646 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5647 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5648 if (GET_CODE (operands[2]) == CONST_INT
5649 && (INTVAL (operands[2]) == 128
5650 || (INTVAL (operands[2]) < 0
5651 && INTVAL (operands[2]) != -128)))
5653 operands[2] = GEN_INT (-INTVAL (operands[2]));
5654 return "sub{l}\t{%2, %k0|%k0, %2}";
5656 return "add{l}\t{%2, %k0|%k0, %2}";
5660 (cond [(eq_attr "alternative" "1")
5661 (const_string "lea")
5662 ; Current assemblers are broken and do not allow @GOTOFF in
5663 ; ought but a memory context.
5664 (match_operand:SI 2 "pic_symbolic_operand" "")
5665 (const_string "lea")
5666 (match_operand:SI 2 "incdec_operand" "")
5667 (const_string "incdec")
5669 (const_string "alu")))
5670 (set_attr "mode" "SI")])
5672 ;; Convert lea to the lea pattern to avoid flags dependency.
5674 [(set (match_operand:DI 0 "register_operand" "")
5676 (plus:SI (match_operand:SI 1 "register_operand" "")
5677 (match_operand:SI 2 "nonmemory_operand" ""))))
5678 (clobber (reg:CC FLAGS_REG))]
5679 "TARGET_64BIT && reload_completed
5680 && true_regnum (operands[0]) != true_regnum (operands[1])"
5682 (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))]
5684 operands[1] = gen_lowpart (Pmode, operands[1]);
5685 operands[2] = gen_lowpart (Pmode, operands[2]);
5688 (define_insn "*addsi_2"
5689 [(set (reg FLAGS_REG)
5691 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5692 (match_operand:SI 2 "general_operand" "rmni,rni"))
5694 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
5695 (plus:SI (match_dup 1) (match_dup 2)))]
5696 "ix86_match_ccmode (insn, CCGOCmode)
5697 && ix86_binary_operator_ok (PLUS, SImode, operands)
5698 /* Current assemblers are broken and do not allow @GOTOFF in
5699 ought but a memory context. */
5700 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5702 switch (get_attr_type (insn))
5705 if (! rtx_equal_p (operands[0], operands[1]))
5707 if (operands[2] == const1_rtx)
5708 return "inc{l}\t%0";
5709 else if (operands[2] == constm1_rtx)
5710 return "dec{l}\t%0";
5715 if (! rtx_equal_p (operands[0], operands[1]))
5717 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5718 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5719 if (GET_CODE (operands[2]) == CONST_INT
5720 && (INTVAL (operands[2]) == 128
5721 || (INTVAL (operands[2]) < 0
5722 && INTVAL (operands[2]) != -128)))
5724 operands[2] = GEN_INT (-INTVAL (operands[2]));
5725 return "sub{l}\t{%2, %0|%0, %2}";
5727 return "add{l}\t{%2, %0|%0, %2}";
5731 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5732 (const_string "incdec")
5733 (const_string "alu")))
5734 (set_attr "mode" "SI")])
5736 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5737 (define_insn "*addsi_2_zext"
5738 [(set (reg FLAGS_REG)
5740 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5741 (match_operand:SI 2 "general_operand" "rmni"))
5743 (set (match_operand:DI 0 "register_operand" "=r")
5744 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5745 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5746 && ix86_binary_operator_ok (PLUS, SImode, operands)
5747 /* Current assemblers are broken and do not allow @GOTOFF in
5748 ought but a memory context. */
5749 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5751 switch (get_attr_type (insn))
5754 if (operands[2] == const1_rtx)
5755 return "inc{l}\t%k0";
5756 else if (operands[2] == constm1_rtx)
5757 return "dec{l}\t%k0";
5762 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5763 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5764 if (GET_CODE (operands[2]) == CONST_INT
5765 && (INTVAL (operands[2]) == 128
5766 || (INTVAL (operands[2]) < 0
5767 && INTVAL (operands[2]) != -128)))
5769 operands[2] = GEN_INT (-INTVAL (operands[2]));
5770 return "sub{l}\t{%2, %k0|%k0, %2}";
5772 return "add{l}\t{%2, %k0|%k0, %2}";
5776 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5777 (const_string "incdec")
5778 (const_string "alu")))
5779 (set_attr "mode" "SI")])
5781 (define_insn "*addsi_3"
5782 [(set (reg FLAGS_REG)
5783 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5784 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5785 (clobber (match_scratch:SI 0 "=r"))]
5786 "ix86_match_ccmode (insn, CCZmode)
5787 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5788 /* Current assemblers are broken and do not allow @GOTOFF in
5789 ought but a memory context. */
5790 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5792 switch (get_attr_type (insn))
5795 if (! rtx_equal_p (operands[0], operands[1]))
5797 if (operands[2] == const1_rtx)
5798 return "inc{l}\t%0";
5799 else if (operands[2] == constm1_rtx)
5800 return "dec{l}\t%0";
5805 if (! rtx_equal_p (operands[0], operands[1]))
5807 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5808 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5809 if (GET_CODE (operands[2]) == CONST_INT
5810 && (INTVAL (operands[2]) == 128
5811 || (INTVAL (operands[2]) < 0
5812 && INTVAL (operands[2]) != -128)))
5814 operands[2] = GEN_INT (-INTVAL (operands[2]));
5815 return "sub{l}\t{%2, %0|%0, %2}";
5817 return "add{l}\t{%2, %0|%0, %2}";
5821 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5822 (const_string "incdec")
5823 (const_string "alu")))
5824 (set_attr "mode" "SI")])
5826 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5827 (define_insn "*addsi_3_zext"
5828 [(set (reg FLAGS_REG)
5829 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5830 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5831 (set (match_operand:DI 0 "register_operand" "=r")
5832 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5833 "TARGET_64BIT && ix86_match_ccmode (insn, CCZmode)
5834 && ix86_binary_operator_ok (PLUS, SImode, operands)
5835 /* Current assemblers are broken and do not allow @GOTOFF in
5836 ought but a memory context. */
5837 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5839 switch (get_attr_type (insn))
5842 if (operands[2] == const1_rtx)
5843 return "inc{l}\t%k0";
5844 else if (operands[2] == constm1_rtx)
5845 return "dec{l}\t%k0";
5850 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5851 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5852 if (GET_CODE (operands[2]) == CONST_INT
5853 && (INTVAL (operands[2]) == 128
5854 || (INTVAL (operands[2]) < 0
5855 && INTVAL (operands[2]) != -128)))
5857 operands[2] = GEN_INT (-INTVAL (operands[2]));
5858 return "sub{l}\t{%2, %k0|%k0, %2}";
5860 return "add{l}\t{%2, %k0|%k0, %2}";
5864 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5865 (const_string "incdec")
5866 (const_string "alu")))
5867 (set_attr "mode" "SI")])
5869 ; For comparisons against 1, -1 and 128, we may generate better code
5870 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5871 ; is matched then. We can't accept general immediate, because for
5872 ; case of overflows, the result is messed up.
5873 ; This pattern also don't hold of 0x80000000, since the value overflows
5875 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5876 ; only for comparisons not depending on it.
5877 (define_insn "*addsi_4"
5878 [(set (reg FLAGS_REG)
5879 (compare (match_operand:SI 1 "nonimmediate_operand" "0")
5880 (match_operand:SI 2 "const_int_operand" "n")))
5881 (clobber (match_scratch:SI 0 "=rm"))]
5882 "ix86_match_ccmode (insn, CCGCmode)
5883 && (INTVAL (operands[2]) & 0xffffffff) != 0x80000000"
5885 switch (get_attr_type (insn))
5888 if (operands[2] == constm1_rtx)
5889 return "inc{l}\t%0";
5890 else if (operands[2] == const1_rtx)
5891 return "dec{l}\t%0";
5896 if (! rtx_equal_p (operands[0], operands[1]))
5898 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5899 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5900 if ((INTVAL (operands[2]) == -128
5901 || (INTVAL (operands[2]) > 0
5902 && INTVAL (operands[2]) != 128)))
5903 return "sub{l}\t{%2, %0|%0, %2}";
5904 operands[2] = GEN_INT (-INTVAL (operands[2]));
5905 return "add{l}\t{%2, %0|%0, %2}";
5909 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5910 (const_string "incdec")
5911 (const_string "alu")))
5912 (set_attr "mode" "SI")])
5914 (define_insn "*addsi_5"
5915 [(set (reg FLAGS_REG)
5917 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5918 (match_operand:SI 2 "general_operand" "rmni"))
5920 (clobber (match_scratch:SI 0 "=r"))]
5921 "ix86_match_ccmode (insn, CCGOCmode)
5922 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5923 /* Current assemblers are broken and do not allow @GOTOFF in
5924 ought but a memory context. */
5925 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5927 switch (get_attr_type (insn))
5930 if (! rtx_equal_p (operands[0], operands[1]))
5932 if (operands[2] == const1_rtx)
5933 return "inc{l}\t%0";
5934 else if (operands[2] == constm1_rtx)
5935 return "dec{l}\t%0";
5940 if (! rtx_equal_p (operands[0], operands[1]))
5942 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5943 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5944 if (GET_CODE (operands[2]) == CONST_INT
5945 && (INTVAL (operands[2]) == 128
5946 || (INTVAL (operands[2]) < 0
5947 && INTVAL (operands[2]) != -128)))
5949 operands[2] = GEN_INT (-INTVAL (operands[2]));
5950 return "sub{l}\t{%2, %0|%0, %2}";
5952 return "add{l}\t{%2, %0|%0, %2}";
5956 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5957 (const_string "incdec")
5958 (const_string "alu")))
5959 (set_attr "mode" "SI")])
5961 (define_expand "addhi3"
5962 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
5963 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "")
5964 (match_operand:HI 2 "general_operand" "")))
5965 (clobber (reg:CC FLAGS_REG))])]
5966 "TARGET_HIMODE_MATH"
5967 "ix86_expand_binary_operator (PLUS, HImode, operands); DONE;")
5969 ;; %%% After Dave's SUBREG_BYTE stuff goes in, re-enable incb %ah
5970 ;; type optimizations enabled by define-splits. This is not important
5971 ;; for PII, and in fact harmful because of partial register stalls.
5973 (define_insn "*addhi_1_lea"
5974 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
5975 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r")
5976 (match_operand:HI 2 "general_operand" "ri,rm,lni")))
5977 (clobber (reg:CC FLAGS_REG))]
5978 "!TARGET_PARTIAL_REG_STALL
5979 && ix86_binary_operator_ok (PLUS, HImode, operands)"
5981 switch (get_attr_type (insn))
5986 if (operands[2] == const1_rtx)
5987 return "inc{w}\t%0";
5988 else if (operands[2] == constm1_rtx)
5989 return "dec{w}\t%0";
5993 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5994 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5995 if (GET_CODE (operands[2]) == CONST_INT
5996 && (INTVAL (operands[2]) == 128
5997 || (INTVAL (operands[2]) < 0
5998 && INTVAL (operands[2]) != -128)))
6000 operands[2] = GEN_INT (-INTVAL (operands[2]));
6001 return "sub{w}\t{%2, %0|%0, %2}";
6003 return "add{w}\t{%2, %0|%0, %2}";
6007 (if_then_else (eq_attr "alternative" "2")
6008 (const_string "lea")
6009 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6010 (const_string "incdec")
6011 (const_string "alu"))))
6012 (set_attr "mode" "HI,HI,SI")])
6014 (define_insn "*addhi_1"
6015 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6016 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
6017 (match_operand:HI 2 "general_operand" "ri,rm")))
6018 (clobber (reg:CC FLAGS_REG))]
6019 "TARGET_PARTIAL_REG_STALL
6020 && ix86_binary_operator_ok (PLUS, HImode, operands)"
6022 switch (get_attr_type (insn))
6025 if (operands[2] == const1_rtx)
6026 return "inc{w}\t%0";
6027 else if (operands[2] == constm1_rtx)
6028 return "dec{w}\t%0";
6032 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6033 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6034 if (GET_CODE (operands[2]) == CONST_INT
6035 && (INTVAL (operands[2]) == 128
6036 || (INTVAL (operands[2]) < 0
6037 && INTVAL (operands[2]) != -128)))
6039 operands[2] = GEN_INT (-INTVAL (operands[2]));
6040 return "sub{w}\t{%2, %0|%0, %2}";
6042 return "add{w}\t{%2, %0|%0, %2}";
6046 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6047 (const_string "incdec")
6048 (const_string "alu")))
6049 (set_attr "mode" "HI")])
6051 (define_insn "*addhi_2"
6052 [(set (reg FLAGS_REG)
6054 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
6055 (match_operand:HI 2 "general_operand" "rmni,rni"))
6057 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
6058 (plus:HI (match_dup 1) (match_dup 2)))]
6059 "ix86_match_ccmode (insn, CCGOCmode)
6060 && ix86_binary_operator_ok (PLUS, HImode, operands)"
6062 switch (get_attr_type (insn))
6065 if (operands[2] == const1_rtx)
6066 return "inc{w}\t%0";
6067 else if (operands[2] == constm1_rtx)
6068 return "dec{w}\t%0";
6072 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6073 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6074 if (GET_CODE (operands[2]) == CONST_INT
6075 && (INTVAL (operands[2]) == 128
6076 || (INTVAL (operands[2]) < 0
6077 && INTVAL (operands[2]) != -128)))
6079 operands[2] = GEN_INT (-INTVAL (operands[2]));
6080 return "sub{w}\t{%2, %0|%0, %2}";
6082 return "add{w}\t{%2, %0|%0, %2}";
6086 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6087 (const_string "incdec")
6088 (const_string "alu")))
6089 (set_attr "mode" "HI")])
6091 (define_insn "*addhi_3"
6092 [(set (reg FLAGS_REG)
6093 (compare (neg:HI (match_operand:HI 2 "general_operand" "rmni"))
6094 (match_operand:HI 1 "nonimmediate_operand" "%0")))
6095 (clobber (match_scratch:HI 0 "=r"))]
6096 "ix86_match_ccmode (insn, CCZmode)
6097 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6099 switch (get_attr_type (insn))
6102 if (operands[2] == const1_rtx)
6103 return "inc{w}\t%0";
6104 else if (operands[2] == constm1_rtx)
6105 return "dec{w}\t%0";
6109 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6110 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6111 if (GET_CODE (operands[2]) == CONST_INT
6112 && (INTVAL (operands[2]) == 128
6113 || (INTVAL (operands[2]) < 0
6114 && INTVAL (operands[2]) != -128)))
6116 operands[2] = GEN_INT (-INTVAL (operands[2]));
6117 return "sub{w}\t{%2, %0|%0, %2}";
6119 return "add{w}\t{%2, %0|%0, %2}";
6123 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6124 (const_string "incdec")
6125 (const_string "alu")))
6126 (set_attr "mode" "HI")])
6128 ; See comments above addsi_3_imm for details.
6129 (define_insn "*addhi_4"
6130 [(set (reg FLAGS_REG)
6131 (compare (match_operand:HI 1 "nonimmediate_operand" "0")
6132 (match_operand:HI 2 "const_int_operand" "n")))
6133 (clobber (match_scratch:HI 0 "=rm"))]
6134 "ix86_match_ccmode (insn, CCGCmode)
6135 && (INTVAL (operands[2]) & 0xffff) != 0x8000"
6137 switch (get_attr_type (insn))
6140 if (operands[2] == constm1_rtx)
6141 return "inc{w}\t%0";
6142 else if (operands[2] == const1_rtx)
6143 return "dec{w}\t%0";
6148 if (! rtx_equal_p (operands[0], operands[1]))
6150 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6151 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6152 if ((INTVAL (operands[2]) == -128
6153 || (INTVAL (operands[2]) > 0
6154 && INTVAL (operands[2]) != 128)))
6155 return "sub{w}\t{%2, %0|%0, %2}";
6156 operands[2] = GEN_INT (-INTVAL (operands[2]));
6157 return "add{w}\t{%2, %0|%0, %2}";
6161 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6162 (const_string "incdec")
6163 (const_string "alu")))
6164 (set_attr "mode" "SI")])
6167 (define_insn "*addhi_5"
6168 [(set (reg FLAGS_REG)
6170 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
6171 (match_operand:HI 2 "general_operand" "rmni"))
6173 (clobber (match_scratch:HI 0 "=r"))]
6174 "ix86_match_ccmode (insn, CCGOCmode)
6175 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6177 switch (get_attr_type (insn))
6180 if (operands[2] == const1_rtx)
6181 return "inc{w}\t%0";
6182 else if (operands[2] == constm1_rtx)
6183 return "dec{w}\t%0";
6187 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6188 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6189 if (GET_CODE (operands[2]) == CONST_INT
6190 && (INTVAL (operands[2]) == 128
6191 || (INTVAL (operands[2]) < 0
6192 && INTVAL (operands[2]) != -128)))
6194 operands[2] = GEN_INT (-INTVAL (operands[2]));
6195 return "sub{w}\t{%2, %0|%0, %2}";
6197 return "add{w}\t{%2, %0|%0, %2}";
6201 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6202 (const_string "incdec")
6203 (const_string "alu")))
6204 (set_attr "mode" "HI")])
6206 (define_expand "addqi3"
6207 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
6208 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "")
6209 (match_operand:QI 2 "general_operand" "")))
6210 (clobber (reg:CC FLAGS_REG))])]
6211 "TARGET_QIMODE_MATH"
6212 "ix86_expand_binary_operator (PLUS, QImode, operands); DONE;")
6214 ;; %%% Potential partial reg stall on alternative 2. What to do?
6215 (define_insn "*addqi_1_lea"
6216 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r")
6217 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,r")
6218 (match_operand:QI 2 "general_operand" "qn,qmn,rn,ln")))
6219 (clobber (reg:CC FLAGS_REG))]
6220 "!TARGET_PARTIAL_REG_STALL
6221 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6223 int widen = (which_alternative == 2);
6224 switch (get_attr_type (insn))
6229 if (operands[2] == const1_rtx)
6230 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6231 else if (operands[2] == constm1_rtx)
6232 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6236 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6237 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6238 if (GET_CODE (operands[2]) == CONST_INT
6239 && (INTVAL (operands[2]) == 128
6240 || (INTVAL (operands[2]) < 0
6241 && INTVAL (operands[2]) != -128)))
6243 operands[2] = GEN_INT (-INTVAL (operands[2]));
6245 return "sub{l}\t{%2, %k0|%k0, %2}";
6247 return "sub{b}\t{%2, %0|%0, %2}";
6250 return "add{l}\t{%k2, %k0|%k0, %k2}";
6252 return "add{b}\t{%2, %0|%0, %2}";
6256 (if_then_else (eq_attr "alternative" "3")
6257 (const_string "lea")
6258 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6259 (const_string "incdec")
6260 (const_string "alu"))))
6261 (set_attr "mode" "QI,QI,SI,SI")])
6263 (define_insn "*addqi_1"
6264 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
6265 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
6266 (match_operand:QI 2 "general_operand" "qn,qmn,rn")))
6267 (clobber (reg:CC FLAGS_REG))]
6268 "TARGET_PARTIAL_REG_STALL
6269 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6271 int widen = (which_alternative == 2);
6272 switch (get_attr_type (insn))
6275 if (operands[2] == const1_rtx)
6276 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6277 else if (operands[2] == constm1_rtx)
6278 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6282 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6283 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6284 if (GET_CODE (operands[2]) == CONST_INT
6285 && (INTVAL (operands[2]) == 128
6286 || (INTVAL (operands[2]) < 0
6287 && INTVAL (operands[2]) != -128)))
6289 operands[2] = GEN_INT (-INTVAL (operands[2]));
6291 return "sub{l}\t{%2, %k0|%k0, %2}";
6293 return "sub{b}\t{%2, %0|%0, %2}";
6296 return "add{l}\t{%k2, %k0|%k0, %k2}";
6298 return "add{b}\t{%2, %0|%0, %2}";
6302 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6303 (const_string "incdec")
6304 (const_string "alu")))
6305 (set_attr "mode" "QI,QI,SI")])
6307 (define_insn "*addqi_1_slp"
6308 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6309 (plus:QI (match_dup 0)
6310 (match_operand:QI 1 "general_operand" "qn,qnm")))
6311 (clobber (reg:CC FLAGS_REG))]
6312 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6313 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
6315 switch (get_attr_type (insn))
6318 if (operands[1] == const1_rtx)
6319 return "inc{b}\t%0";
6320 else if (operands[1] == constm1_rtx)
6321 return "dec{b}\t%0";
6325 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'. */
6326 if (GET_CODE (operands[1]) == CONST_INT
6327 && INTVAL (operands[1]) < 0)
6329 operands[1] = GEN_INT (-INTVAL (operands[1]));
6330 return "sub{b}\t{%1, %0|%0, %1}";
6332 return "add{b}\t{%1, %0|%0, %1}";
6336 (if_then_else (match_operand:QI 1 "incdec_operand" "")
6337 (const_string "incdec")
6338 (const_string "alu1")))
6339 (set_attr "mode" "QI")])
6341 (define_insn "*addqi_2"
6342 [(set (reg FLAGS_REG)
6344 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
6345 (match_operand:QI 2 "general_operand" "qmni,qni"))
6347 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
6348 (plus:QI (match_dup 1) (match_dup 2)))]
6349 "ix86_match_ccmode (insn, CCGOCmode)
6350 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6352 switch (get_attr_type (insn))
6355 if (operands[2] == const1_rtx)
6356 return "inc{b}\t%0";
6357 else if (operands[2] == constm1_rtx
6358 || (GET_CODE (operands[2]) == CONST_INT
6359 && INTVAL (operands[2]) == 255))
6360 return "dec{b}\t%0";
6364 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6365 if (GET_CODE (operands[2]) == CONST_INT
6366 && INTVAL (operands[2]) < 0)
6368 operands[2] = GEN_INT (-INTVAL (operands[2]));
6369 return "sub{b}\t{%2, %0|%0, %2}";
6371 return "add{b}\t{%2, %0|%0, %2}";
6375 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6376 (const_string "incdec")
6377 (const_string "alu")))
6378 (set_attr "mode" "QI")])
6380 (define_insn "*addqi_3"
6381 [(set (reg FLAGS_REG)
6382 (compare (neg:QI (match_operand:QI 2 "general_operand" "qmni"))
6383 (match_operand:QI 1 "nonimmediate_operand" "%0")))
6384 (clobber (match_scratch:QI 0 "=q"))]
6385 "ix86_match_ccmode (insn, CCZmode)
6386 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6388 switch (get_attr_type (insn))
6391 if (operands[2] == const1_rtx)
6392 return "inc{b}\t%0";
6393 else if (operands[2] == constm1_rtx
6394 || (GET_CODE (operands[2]) == CONST_INT
6395 && INTVAL (operands[2]) == 255))
6396 return "dec{b}\t%0";
6400 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6401 if (GET_CODE (operands[2]) == CONST_INT
6402 && INTVAL (operands[2]) < 0)
6404 operands[2] = GEN_INT (-INTVAL (operands[2]));
6405 return "sub{b}\t{%2, %0|%0, %2}";
6407 return "add{b}\t{%2, %0|%0, %2}";
6411 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6412 (const_string "incdec")
6413 (const_string "alu")))
6414 (set_attr "mode" "QI")])
6416 ; See comments above addsi_3_imm for details.
6417 (define_insn "*addqi_4"
6418 [(set (reg FLAGS_REG)
6419 (compare (match_operand:QI 1 "nonimmediate_operand" "0")
6420 (match_operand:QI 2 "const_int_operand" "n")))
6421 (clobber (match_scratch:QI 0 "=qm"))]
6422 "ix86_match_ccmode (insn, CCGCmode)
6423 && (INTVAL (operands[2]) & 0xff) != 0x80"
6425 switch (get_attr_type (insn))
6428 if (operands[2] == constm1_rtx
6429 || (GET_CODE (operands[2]) == CONST_INT
6430 && INTVAL (operands[2]) == 255))
6431 return "inc{b}\t%0";
6432 else if (operands[2] == const1_rtx)
6433 return "dec{b}\t%0";
6438 if (! rtx_equal_p (operands[0], operands[1]))
6440 if (INTVAL (operands[2]) < 0)
6442 operands[2] = GEN_INT (-INTVAL (operands[2]));
6443 return "add{b}\t{%2, %0|%0, %2}";
6445 return "sub{b}\t{%2, %0|%0, %2}";
6449 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6450 (const_string "incdec")
6451 (const_string "alu")))
6452 (set_attr "mode" "QI")])
6455 (define_insn "*addqi_5"
6456 [(set (reg FLAGS_REG)
6458 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
6459 (match_operand:QI 2 "general_operand" "qmni"))
6461 (clobber (match_scratch:QI 0 "=q"))]
6462 "ix86_match_ccmode (insn, CCGOCmode)
6463 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6465 switch (get_attr_type (insn))
6468 if (operands[2] == const1_rtx)
6469 return "inc{b}\t%0";
6470 else if (operands[2] == constm1_rtx
6471 || (GET_CODE (operands[2]) == CONST_INT
6472 && INTVAL (operands[2]) == 255))
6473 return "dec{b}\t%0";
6477 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6478 if (GET_CODE (operands[2]) == CONST_INT
6479 && INTVAL (operands[2]) < 0)
6481 operands[2] = GEN_INT (-INTVAL (operands[2]));
6482 return "sub{b}\t{%2, %0|%0, %2}";
6484 return "add{b}\t{%2, %0|%0, %2}";
6488 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6489 (const_string "incdec")
6490 (const_string "alu")))
6491 (set_attr "mode" "QI")])
6494 (define_insn "addqi_ext_1"
6495 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6500 (match_operand 1 "ext_register_operand" "0")
6503 (match_operand:QI 2 "general_operand" "Qmn")))
6504 (clobber (reg:CC FLAGS_REG))]
6507 switch (get_attr_type (insn))
6510 if (operands[2] == const1_rtx)
6511 return "inc{b}\t%h0";
6512 else if (operands[2] == constm1_rtx
6513 || (GET_CODE (operands[2]) == CONST_INT
6514 && INTVAL (operands[2]) == 255))
6515 return "dec{b}\t%h0";
6519 return "add{b}\t{%2, %h0|%h0, %2}";
6523 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6524 (const_string "incdec")
6525 (const_string "alu")))
6526 (set_attr "mode" "QI")])
6528 (define_insn "*addqi_ext_1_rex64"
6529 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6534 (match_operand 1 "ext_register_operand" "0")
6537 (match_operand:QI 2 "nonmemory_operand" "Qn")))
6538 (clobber (reg:CC FLAGS_REG))]
6541 switch (get_attr_type (insn))
6544 if (operands[2] == const1_rtx)
6545 return "inc{b}\t%h0";
6546 else if (operands[2] == constm1_rtx
6547 || (GET_CODE (operands[2]) == CONST_INT
6548 && INTVAL (operands[2]) == 255))
6549 return "dec{b}\t%h0";
6553 return "add{b}\t{%2, %h0|%h0, %2}";
6557 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6558 (const_string "incdec")
6559 (const_string "alu")))
6560 (set_attr "mode" "QI")])
6562 (define_insn "*addqi_ext_2"
6563 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6568 (match_operand 1 "ext_register_operand" "%0")
6572 (match_operand 2 "ext_register_operand" "Q")
6575 (clobber (reg:CC FLAGS_REG))]
6577 "add{b}\t{%h2, %h0|%h0, %h2}"
6578 [(set_attr "type" "alu")
6579 (set_attr "mode" "QI")])
6581 ;; The patterns that match these are at the end of this file.
6583 (define_expand "addxf3"
6584 [(set (match_operand:XF 0 "register_operand" "")
6585 (plus:XF (match_operand:XF 1 "register_operand" "")
6586 (match_operand:XF 2 "register_operand" "")))]
6590 (define_expand "adddf3"
6591 [(set (match_operand:DF 0 "register_operand" "")
6592 (plus:DF (match_operand:DF 1 "register_operand" "")
6593 (match_operand:DF 2 "nonimmediate_operand" "")))]
6594 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6597 (define_expand "addsf3"
6598 [(set (match_operand:SF 0 "register_operand" "")
6599 (plus:SF (match_operand:SF 1 "register_operand" "")
6600 (match_operand:SF 2 "nonimmediate_operand" "")))]
6601 "TARGET_80387 || TARGET_SSE_MATH"
6604 ;; Subtract instructions
6606 ;; %%% splits for subsidi3
6608 (define_expand "subdi3"
6609 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
6610 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6611 (match_operand:DI 2 "x86_64_general_operand" "")))
6612 (clobber (reg:CC FLAGS_REG))])]
6614 "ix86_expand_binary_operator (MINUS, DImode, operands); DONE;")
6616 (define_insn "*subdi3_1"
6617 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
6618 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6619 (match_operand:DI 2 "general_operand" "roiF,riF")))
6620 (clobber (reg:CC FLAGS_REG))]
6621 "!TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6625 [(set (match_operand:DI 0 "nonimmediate_operand" "")
6626 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6627 (match_operand:DI 2 "general_operand" "")))
6628 (clobber (reg:CC FLAGS_REG))]
6629 "!TARGET_64BIT && reload_completed"
6630 [(parallel [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2)))
6631 (set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))])
6632 (parallel [(set (match_dup 3)
6633 (minus:SI (match_dup 4)
6634 (plus:SI (ltu:SI (reg:CC FLAGS_REG) (const_int 0))
6636 (clobber (reg:CC FLAGS_REG))])]
6637 "split_di (operands+0, 1, operands+0, operands+3);
6638 split_di (operands+1, 1, operands+1, operands+4);
6639 split_di (operands+2, 1, operands+2, operands+5);")
6641 (define_insn "subdi3_carry_rex64"
6642 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6643 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6644 (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "")
6645 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))))
6646 (clobber (reg:CC FLAGS_REG))]
6647 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6648 "sbb{q}\t{%2, %0|%0, %2}"
6649 [(set_attr "type" "alu")
6650 (set_attr "pent_pair" "pu")
6651 (set_attr "mode" "DI")])
6653 (define_insn "*subdi_1_rex64"
6654 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6655 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6656 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6657 (clobber (reg:CC FLAGS_REG))]
6658 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6659 "sub{q}\t{%2, %0|%0, %2}"
6660 [(set_attr "type" "alu")
6661 (set_attr "mode" "DI")])
6663 (define_insn "*subdi_2_rex64"
6664 [(set (reg FLAGS_REG)
6666 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6667 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))
6669 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6670 (minus:DI (match_dup 1) (match_dup 2)))]
6671 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6672 && ix86_binary_operator_ok (MINUS, DImode, operands)"
6673 "sub{q}\t{%2, %0|%0, %2}"
6674 [(set_attr "type" "alu")
6675 (set_attr "mode" "DI")])
6677 (define_insn "*subdi_3_rex63"
6678 [(set (reg FLAGS_REG)
6679 (compare (match_operand:DI 1 "nonimmediate_operand" "0,0")
6680 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6681 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6682 (minus:DI (match_dup 1) (match_dup 2)))]
6683 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6684 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6685 "sub{q}\t{%2, %0|%0, %2}"
6686 [(set_attr "type" "alu")
6687 (set_attr "mode" "DI")])
6689 (define_insn "subqi3_carry"
6690 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
6691 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6692 (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "")
6693 (match_operand:QI 2 "general_operand" "qi,qm"))))
6694 (clobber (reg:CC FLAGS_REG))]
6695 "ix86_binary_operator_ok (MINUS, QImode, operands)"
6696 "sbb{b}\t{%2, %0|%0, %2}"
6697 [(set_attr "type" "alu")
6698 (set_attr "pent_pair" "pu")
6699 (set_attr "mode" "QI")])
6701 (define_insn "subhi3_carry"
6702 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6703 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6704 (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "")
6705 (match_operand:HI 2 "general_operand" "ri,rm"))))
6706 (clobber (reg:CC FLAGS_REG))]
6707 "ix86_binary_operator_ok (MINUS, HImode, operands)"
6708 "sbb{w}\t{%2, %0|%0, %2}"
6709 [(set_attr "type" "alu")
6710 (set_attr "pent_pair" "pu")
6711 (set_attr "mode" "HI")])
6713 (define_insn "subsi3_carry"
6714 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6715 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6716 (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
6717 (match_operand:SI 2 "general_operand" "ri,rm"))))
6718 (clobber (reg:CC FLAGS_REG))]
6719 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6720 "sbb{l}\t{%2, %0|%0, %2}"
6721 [(set_attr "type" "alu")
6722 (set_attr "pent_pair" "pu")
6723 (set_attr "mode" "SI")])
6725 (define_insn "subsi3_carry_zext"
6726 [(set (match_operand:DI 0 "register_operand" "=rm,r")
6728 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
6729 (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
6730 (match_operand:SI 2 "general_operand" "ri,rm")))))
6731 (clobber (reg:CC FLAGS_REG))]
6732 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6733 "sbb{l}\t{%2, %k0|%k0, %2}"
6734 [(set_attr "type" "alu")
6735 (set_attr "pent_pair" "pu")
6736 (set_attr "mode" "SI")])
6738 (define_expand "subsi3"
6739 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
6740 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "")
6741 (match_operand:SI 2 "general_operand" "")))
6742 (clobber (reg:CC FLAGS_REG))])]
6744 "ix86_expand_binary_operator (MINUS, SImode, operands); DONE;")
6746 (define_insn "*subsi_1"
6747 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6748 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6749 (match_operand:SI 2 "general_operand" "ri,rm")))
6750 (clobber (reg:CC FLAGS_REG))]
6751 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6752 "sub{l}\t{%2, %0|%0, %2}"
6753 [(set_attr "type" "alu")
6754 (set_attr "mode" "SI")])
6756 (define_insn "*subsi_1_zext"
6757 [(set (match_operand:DI 0 "register_operand" "=r")
6759 (minus:SI (match_operand:SI 1 "register_operand" "0")
6760 (match_operand:SI 2 "general_operand" "rim"))))
6761 (clobber (reg:CC FLAGS_REG))]
6762 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6763 "sub{l}\t{%2, %k0|%k0, %2}"
6764 [(set_attr "type" "alu")
6765 (set_attr "mode" "SI")])
6767 (define_insn "*subsi_2"
6768 [(set (reg FLAGS_REG)
6770 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6771 (match_operand:SI 2 "general_operand" "ri,rm"))
6773 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6774 (minus:SI (match_dup 1) (match_dup 2)))]
6775 "ix86_match_ccmode (insn, CCGOCmode)
6776 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6777 "sub{l}\t{%2, %0|%0, %2}"
6778 [(set_attr "type" "alu")
6779 (set_attr "mode" "SI")])
6781 (define_insn "*subsi_2_zext"
6782 [(set (reg FLAGS_REG)
6784 (minus:SI (match_operand:SI 1 "register_operand" "0")
6785 (match_operand:SI 2 "general_operand" "rim"))
6787 (set (match_operand:DI 0 "register_operand" "=r")
6789 (minus:SI (match_dup 1)
6791 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6792 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6793 "sub{l}\t{%2, %k0|%k0, %2}"
6794 [(set_attr "type" "alu")
6795 (set_attr "mode" "SI")])
6797 (define_insn "*subsi_3"
6798 [(set (reg FLAGS_REG)
6799 (compare (match_operand:SI 1 "nonimmediate_operand" "0,0")
6800 (match_operand:SI 2 "general_operand" "ri,rm")))
6801 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6802 (minus:SI (match_dup 1) (match_dup 2)))]
6803 "ix86_match_ccmode (insn, CCmode)
6804 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6805 "sub{l}\t{%2, %0|%0, %2}"
6806 [(set_attr "type" "alu")
6807 (set_attr "mode" "SI")])
6809 (define_insn "*subsi_3_zext"
6810 [(set (reg FLAGS_REG)
6811 (compare (match_operand:SI 1 "register_operand" "0")
6812 (match_operand:SI 2 "general_operand" "rim")))
6813 (set (match_operand:DI 0 "register_operand" "=r")
6815 (minus:SI (match_dup 1)
6817 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6818 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6819 "sub{q}\t{%2, %0|%0, %2}"
6820 [(set_attr "type" "alu")
6821 (set_attr "mode" "DI")])
6823 (define_expand "subhi3"
6824 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
6825 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "")
6826 (match_operand:HI 2 "general_operand" "")))
6827 (clobber (reg:CC FLAGS_REG))])]
6828 "TARGET_HIMODE_MATH"
6829 "ix86_expand_binary_operator (MINUS, HImode, operands); DONE;")
6831 (define_insn "*subhi_1"
6832 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6833 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6834 (match_operand:HI 2 "general_operand" "ri,rm")))
6835 (clobber (reg:CC FLAGS_REG))]
6836 "ix86_binary_operator_ok (MINUS, HImode, operands)"
6837 "sub{w}\t{%2, %0|%0, %2}"
6838 [(set_attr "type" "alu")
6839 (set_attr "mode" "HI")])
6841 (define_insn "*subhi_2"
6842 [(set (reg FLAGS_REG)
6844 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6845 (match_operand:HI 2 "general_operand" "ri,rm"))
6847 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6848 (minus:HI (match_dup 1) (match_dup 2)))]
6849 "ix86_match_ccmode (insn, CCGOCmode)
6850 && ix86_binary_operator_ok (MINUS, HImode, operands)"
6851 "sub{w}\t{%2, %0|%0, %2}"
6852 [(set_attr "type" "alu")
6853 (set_attr "mode" "HI")])
6855 (define_insn "*subhi_3"
6856 [(set (reg FLAGS_REG)
6857 (compare (match_operand:HI 1 "nonimmediate_operand" "0,0")
6858 (match_operand:HI 2 "general_operand" "ri,rm")))
6859 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6860 (minus:HI (match_dup 1) (match_dup 2)))]
6861 "ix86_match_ccmode (insn, CCmode)
6862 && ix86_binary_operator_ok (MINUS, HImode, operands)"
6863 "sub{w}\t{%2, %0|%0, %2}"
6864 [(set_attr "type" "alu")
6865 (set_attr "mode" "HI")])
6867 (define_expand "subqi3"
6868 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
6869 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "")
6870 (match_operand:QI 2 "general_operand" "")))
6871 (clobber (reg:CC FLAGS_REG))])]
6872 "TARGET_QIMODE_MATH"
6873 "ix86_expand_binary_operator (MINUS, QImode, operands); DONE;")
6875 (define_insn "*subqi_1"
6876 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
6877 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6878 (match_operand:QI 2 "general_operand" "qn,qmn")))
6879 (clobber (reg:CC FLAGS_REG))]
6880 "ix86_binary_operator_ok (MINUS, QImode, operands)"
6881 "sub{b}\t{%2, %0|%0, %2}"
6882 [(set_attr "type" "alu")
6883 (set_attr "mode" "QI")])
6885 (define_insn "*subqi_1_slp"
6886 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6887 (minus:QI (match_dup 0)
6888 (match_operand:QI 1 "general_operand" "qn,qmn")))
6889 (clobber (reg:CC FLAGS_REG))]
6890 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6891 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
6892 "sub{b}\t{%1, %0|%0, %1}"
6893 [(set_attr "type" "alu1")
6894 (set_attr "mode" "QI")])
6896 (define_insn "*subqi_2"
6897 [(set (reg FLAGS_REG)
6899 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6900 (match_operand:QI 2 "general_operand" "qi,qm"))
6902 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
6903 (minus:HI (match_dup 1) (match_dup 2)))]
6904 "ix86_match_ccmode (insn, CCGOCmode)
6905 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6906 "sub{b}\t{%2, %0|%0, %2}"
6907 [(set_attr "type" "alu")
6908 (set_attr "mode" "QI")])
6910 (define_insn "*subqi_3"
6911 [(set (reg FLAGS_REG)
6912 (compare (match_operand:QI 1 "nonimmediate_operand" "0,0")
6913 (match_operand:QI 2 "general_operand" "qi,qm")))
6914 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
6915 (minus:HI (match_dup 1) (match_dup 2)))]
6916 "ix86_match_ccmode (insn, CCmode)
6917 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6918 "sub{b}\t{%2, %0|%0, %2}"
6919 [(set_attr "type" "alu")
6920 (set_attr "mode" "QI")])
6922 ;; The patterns that match these are at the end of this file.
6924 (define_expand "subxf3"
6925 [(set (match_operand:XF 0 "register_operand" "")
6926 (minus:XF (match_operand:XF 1 "register_operand" "")
6927 (match_operand:XF 2 "register_operand" "")))]
6931 (define_expand "subdf3"
6932 [(set (match_operand:DF 0 "register_operand" "")
6933 (minus:DF (match_operand:DF 1 "register_operand" "")
6934 (match_operand:DF 2 "nonimmediate_operand" "")))]
6935 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6938 (define_expand "subsf3"
6939 [(set (match_operand:SF 0 "register_operand" "")
6940 (minus:SF (match_operand:SF 1 "register_operand" "")
6941 (match_operand:SF 2 "nonimmediate_operand" "")))]
6942 "TARGET_80387 || TARGET_SSE_MATH"
6945 ;; Multiply instructions
6947 (define_expand "muldi3"
6948 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6949 (mult:DI (match_operand:DI 1 "register_operand" "")
6950 (match_operand:DI 2 "x86_64_general_operand" "")))
6951 (clobber (reg:CC FLAGS_REG))])]
6955 (define_insn "*muldi3_1_rex64"
6956 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
6957 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%rm,rm,0")
6958 (match_operand:DI 2 "x86_64_general_operand" "K,e,mr")))
6959 (clobber (reg:CC FLAGS_REG))]
6961 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6963 imul{q}\t{%2, %1, %0|%0, %1, %2}
6964 imul{q}\t{%2, %1, %0|%0, %1, %2}
6965 imul{q}\t{%2, %0|%0, %2}"
6966 [(set_attr "type" "imul")
6967 (set_attr "prefix_0f" "0,0,1")
6968 (set (attr "athlon_decode")
6969 (cond [(eq_attr "cpu" "athlon")
6970 (const_string "vector")
6971 (eq_attr "alternative" "1")
6972 (const_string "vector")
6973 (and (eq_attr "alternative" "2")
6974 (match_operand 1 "memory_operand" ""))
6975 (const_string "vector")]
6976 (const_string "direct")))
6977 (set_attr "mode" "DI")])
6979 (define_expand "mulsi3"
6980 [(parallel [(set (match_operand:SI 0 "register_operand" "")
6981 (mult:SI (match_operand:SI 1 "register_operand" "")
6982 (match_operand:SI 2 "general_operand" "")))
6983 (clobber (reg:CC FLAGS_REG))])]
6987 (define_insn "*mulsi3_1"
6988 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
6989 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0")
6990 (match_operand:SI 2 "general_operand" "K,i,mr")))
6991 (clobber (reg:CC FLAGS_REG))]
6992 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
6994 imul{l}\t{%2, %1, %0|%0, %1, %2}
6995 imul{l}\t{%2, %1, %0|%0, %1, %2}
6996 imul{l}\t{%2, %0|%0, %2}"
6997 [(set_attr "type" "imul")
6998 (set_attr "prefix_0f" "0,0,1")
6999 (set (attr "athlon_decode")
7000 (cond [(eq_attr "cpu" "athlon")
7001 (const_string "vector")
7002 (eq_attr "alternative" "1")
7003 (const_string "vector")
7004 (and (eq_attr "alternative" "2")
7005 (match_operand 1 "memory_operand" ""))
7006 (const_string "vector")]
7007 (const_string "direct")))
7008 (set_attr "mode" "SI")])
7010 (define_insn "*mulsi3_1_zext"
7011 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
7013 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0")
7014 (match_operand:SI 2 "general_operand" "K,i,mr"))))
7015 (clobber (reg:CC FLAGS_REG))]
7017 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7019 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
7020 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
7021 imul{l}\t{%2, %k0|%k0, %2}"
7022 [(set_attr "type" "imul")
7023 (set_attr "prefix_0f" "0,0,1")
7024 (set (attr "athlon_decode")
7025 (cond [(eq_attr "cpu" "athlon")
7026 (const_string "vector")
7027 (eq_attr "alternative" "1")
7028 (const_string "vector")
7029 (and (eq_attr "alternative" "2")
7030 (match_operand 1 "memory_operand" ""))
7031 (const_string "vector")]
7032 (const_string "direct")))
7033 (set_attr "mode" "SI")])
7035 (define_expand "mulhi3"
7036 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7037 (mult:HI (match_operand:HI 1 "register_operand" "")
7038 (match_operand:HI 2 "general_operand" "")))
7039 (clobber (reg:CC FLAGS_REG))])]
7040 "TARGET_HIMODE_MATH"
7043 (define_insn "*mulhi3_1"
7044 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
7045 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,rm,0")
7046 (match_operand:HI 2 "general_operand" "K,i,mr")))
7047 (clobber (reg:CC FLAGS_REG))]
7048 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7050 imul{w}\t{%2, %1, %0|%0, %1, %2}
7051 imul{w}\t{%2, %1, %0|%0, %1, %2}
7052 imul{w}\t{%2, %0|%0, %2}"
7053 [(set_attr "type" "imul")
7054 (set_attr "prefix_0f" "0,0,1")
7055 (set (attr "athlon_decode")
7056 (cond [(eq_attr "cpu" "athlon")
7057 (const_string "vector")
7058 (eq_attr "alternative" "1,2")
7059 (const_string "vector")]
7060 (const_string "direct")))
7061 (set_attr "mode" "HI")])
7063 (define_expand "mulqi3"
7064 [(parallel [(set (match_operand:QI 0 "register_operand" "")
7065 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "")
7066 (match_operand:QI 2 "register_operand" "")))
7067 (clobber (reg:CC FLAGS_REG))])]
7068 "TARGET_QIMODE_MATH"
7071 (define_insn "*mulqi3_1"
7072 [(set (match_operand:QI 0 "register_operand" "=a")
7073 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
7074 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7075 (clobber (reg:CC FLAGS_REG))]
7077 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7079 [(set_attr "type" "imul")
7080 (set_attr "length_immediate" "0")
7081 (set (attr "athlon_decode")
7082 (if_then_else (eq_attr "cpu" "athlon")
7083 (const_string "vector")
7084 (const_string "direct")))
7085 (set_attr "mode" "QI")])
7087 (define_expand "umulqihi3"
7088 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7089 (mult:HI (zero_extend:HI
7090 (match_operand:QI 1 "nonimmediate_operand" ""))
7092 (match_operand:QI 2 "register_operand" ""))))
7093 (clobber (reg:CC FLAGS_REG))])]
7094 "TARGET_QIMODE_MATH"
7097 (define_insn "*umulqihi3_1"
7098 [(set (match_operand:HI 0 "register_operand" "=a")
7099 (mult:HI (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
7100 (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
7101 (clobber (reg:CC FLAGS_REG))]
7103 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7105 [(set_attr "type" "imul")
7106 (set_attr "length_immediate" "0")
7107 (set (attr "athlon_decode")
7108 (if_then_else (eq_attr "cpu" "athlon")
7109 (const_string "vector")
7110 (const_string "direct")))
7111 (set_attr "mode" "QI")])
7113 (define_expand "mulqihi3"
7114 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7115 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" ""))
7116 (sign_extend:HI (match_operand:QI 2 "register_operand" ""))))
7117 (clobber (reg:CC FLAGS_REG))])]
7118 "TARGET_QIMODE_MATH"
7121 (define_insn "*mulqihi3_insn"
7122 [(set (match_operand:HI 0 "register_operand" "=a")
7123 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
7124 (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
7125 (clobber (reg:CC FLAGS_REG))]
7127 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7129 [(set_attr "type" "imul")
7130 (set_attr "length_immediate" "0")
7131 (set (attr "athlon_decode")
7132 (if_then_else (eq_attr "cpu" "athlon")
7133 (const_string "vector")
7134 (const_string "direct")))
7135 (set_attr "mode" "QI")])
7137 (define_expand "umulditi3"
7138 [(parallel [(set (match_operand:TI 0 "register_operand" "")
7139 (mult:TI (zero_extend:TI
7140 (match_operand:DI 1 "nonimmediate_operand" ""))
7142 (match_operand:DI 2 "register_operand" ""))))
7143 (clobber (reg:CC FLAGS_REG))])]
7147 (define_insn "*umulditi3_insn"
7148 [(set (match_operand:TI 0 "register_operand" "=A")
7149 (mult:TI (zero_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
7150 (zero_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
7151 (clobber (reg:CC FLAGS_REG))]
7153 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7155 [(set_attr "type" "imul")
7156 (set_attr "length_immediate" "0")
7157 (set (attr "athlon_decode")
7158 (if_then_else (eq_attr "cpu" "athlon")
7159 (const_string "vector")
7160 (const_string "double")))
7161 (set_attr "mode" "DI")])
7163 ;; We can't use this pattern in 64bit mode, since it results in two separate 32bit registers
7164 (define_expand "umulsidi3"
7165 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7166 (mult:DI (zero_extend:DI
7167 (match_operand:SI 1 "nonimmediate_operand" ""))
7169 (match_operand:SI 2 "register_operand" ""))))
7170 (clobber (reg:CC FLAGS_REG))])]
7174 (define_insn "*umulsidi3_insn"
7175 [(set (match_operand:DI 0 "register_operand" "=A")
7176 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
7177 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
7178 (clobber (reg:CC FLAGS_REG))]
7180 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7182 [(set_attr "type" "imul")
7183 (set_attr "length_immediate" "0")
7184 (set (attr "athlon_decode")
7185 (if_then_else (eq_attr "cpu" "athlon")
7186 (const_string "vector")
7187 (const_string "double")))
7188 (set_attr "mode" "SI")])
7190 (define_expand "mulditi3"
7191 [(parallel [(set (match_operand:TI 0 "register_operand" "")
7192 (mult:TI (sign_extend:TI
7193 (match_operand:DI 1 "nonimmediate_operand" ""))
7195 (match_operand:DI 2 "register_operand" ""))))
7196 (clobber (reg:CC FLAGS_REG))])]
7200 (define_insn "*mulditi3_insn"
7201 [(set (match_operand:TI 0 "register_operand" "=A")
7202 (mult:TI (sign_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
7203 (sign_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
7204 (clobber (reg:CC FLAGS_REG))]
7206 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7208 [(set_attr "type" "imul")
7209 (set_attr "length_immediate" "0")
7210 (set (attr "athlon_decode")
7211 (if_then_else (eq_attr "cpu" "athlon")
7212 (const_string "vector")
7213 (const_string "double")))
7214 (set_attr "mode" "DI")])
7216 (define_expand "mulsidi3"
7217 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7218 (mult:DI (sign_extend:DI
7219 (match_operand:SI 1 "nonimmediate_operand" ""))
7221 (match_operand:SI 2 "register_operand" ""))))
7222 (clobber (reg:CC FLAGS_REG))])]
7226 (define_insn "*mulsidi3_insn"
7227 [(set (match_operand:DI 0 "register_operand" "=A")
7228 (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
7229 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
7230 (clobber (reg:CC FLAGS_REG))]
7232 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7234 [(set_attr "type" "imul")
7235 (set_attr "length_immediate" "0")
7236 (set (attr "athlon_decode")
7237 (if_then_else (eq_attr "cpu" "athlon")
7238 (const_string "vector")
7239 (const_string "double")))
7240 (set_attr "mode" "SI")])
7242 (define_expand "umuldi3_highpart"
7243 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7246 (mult:TI (zero_extend:TI
7247 (match_operand:DI 1 "nonimmediate_operand" ""))
7249 (match_operand:DI 2 "register_operand" "")))
7251 (clobber (match_scratch:DI 3 ""))
7252 (clobber (reg:CC FLAGS_REG))])]
7256 (define_insn "*umuldi3_highpart_rex64"
7257 [(set (match_operand:DI 0 "register_operand" "=d")
7260 (mult:TI (zero_extend:TI
7261 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7263 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7265 (clobber (match_scratch:DI 3 "=1"))
7266 (clobber (reg:CC FLAGS_REG))]
7268 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7270 [(set_attr "type" "imul")
7271 (set_attr "length_immediate" "0")
7272 (set (attr "athlon_decode")
7273 (if_then_else (eq_attr "cpu" "athlon")
7274 (const_string "vector")
7275 (const_string "double")))
7276 (set_attr "mode" "DI")])
7278 (define_expand "umulsi3_highpart"
7279 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7282 (mult:DI (zero_extend:DI
7283 (match_operand:SI 1 "nonimmediate_operand" ""))
7285 (match_operand:SI 2 "register_operand" "")))
7287 (clobber (match_scratch:SI 3 ""))
7288 (clobber (reg:CC FLAGS_REG))])]
7292 (define_insn "*umulsi3_highpart_insn"
7293 [(set (match_operand:SI 0 "register_operand" "=d")
7296 (mult:DI (zero_extend:DI
7297 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7299 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7301 (clobber (match_scratch:SI 3 "=1"))
7302 (clobber (reg:CC FLAGS_REG))]
7303 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7305 [(set_attr "type" "imul")
7306 (set_attr "length_immediate" "0")
7307 (set (attr "athlon_decode")
7308 (if_then_else (eq_attr "cpu" "athlon")
7309 (const_string "vector")
7310 (const_string "double")))
7311 (set_attr "mode" "SI")])
7313 (define_insn "*umulsi3_highpart_zext"
7314 [(set (match_operand:DI 0 "register_operand" "=d")
7315 (zero_extend:DI (truncate:SI
7317 (mult:DI (zero_extend:DI
7318 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7320 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7322 (clobber (match_scratch:SI 3 "=1"))
7323 (clobber (reg:CC FLAGS_REG))]
7325 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7327 [(set_attr "type" "imul")
7328 (set_attr "length_immediate" "0")
7329 (set (attr "athlon_decode")
7330 (if_then_else (eq_attr "cpu" "athlon")
7331 (const_string "vector")
7332 (const_string "double")))
7333 (set_attr "mode" "SI")])
7335 (define_expand "smuldi3_highpart"
7336 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
7339 (mult:TI (sign_extend:TI
7340 (match_operand:DI 1 "nonimmediate_operand" ""))
7342 (match_operand:DI 2 "register_operand" "")))
7344 (clobber (match_scratch:DI 3 ""))
7345 (clobber (reg:CC FLAGS_REG))])]
7349 (define_insn "*smuldi3_highpart_rex64"
7350 [(set (match_operand:DI 0 "register_operand" "=d")
7353 (mult:TI (sign_extend:TI
7354 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7356 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7358 (clobber (match_scratch:DI 3 "=1"))
7359 (clobber (reg:CC FLAGS_REG))]
7361 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7363 [(set_attr "type" "imul")
7364 (set (attr "athlon_decode")
7365 (if_then_else (eq_attr "cpu" "athlon")
7366 (const_string "vector")
7367 (const_string "double")))
7368 (set_attr "mode" "DI")])
7370 (define_expand "smulsi3_highpart"
7371 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7374 (mult:DI (sign_extend:DI
7375 (match_operand:SI 1 "nonimmediate_operand" ""))
7377 (match_operand:SI 2 "register_operand" "")))
7379 (clobber (match_scratch:SI 3 ""))
7380 (clobber (reg:CC FLAGS_REG))])]
7384 (define_insn "*smulsi3_highpart_insn"
7385 [(set (match_operand:SI 0 "register_operand" "=d")
7388 (mult:DI (sign_extend:DI
7389 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7391 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7393 (clobber (match_scratch:SI 3 "=1"))
7394 (clobber (reg:CC FLAGS_REG))]
7395 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7397 [(set_attr "type" "imul")
7398 (set (attr "athlon_decode")
7399 (if_then_else (eq_attr "cpu" "athlon")
7400 (const_string "vector")
7401 (const_string "double")))
7402 (set_attr "mode" "SI")])
7404 (define_insn "*smulsi3_highpart_zext"
7405 [(set (match_operand:DI 0 "register_operand" "=d")
7406 (zero_extend:DI (truncate:SI
7408 (mult:DI (sign_extend:DI
7409 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7411 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7413 (clobber (match_scratch:SI 3 "=1"))
7414 (clobber (reg:CC FLAGS_REG))]
7416 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7418 [(set_attr "type" "imul")
7419 (set (attr "athlon_decode")
7420 (if_then_else (eq_attr "cpu" "athlon")
7421 (const_string "vector")
7422 (const_string "double")))
7423 (set_attr "mode" "SI")])
7425 ;; The patterns that match these are at the end of this file.
7427 (define_expand "mulxf3"
7428 [(set (match_operand:XF 0 "register_operand" "")
7429 (mult:XF (match_operand:XF 1 "register_operand" "")
7430 (match_operand:XF 2 "register_operand" "")))]
7434 (define_expand "muldf3"
7435 [(set (match_operand:DF 0 "register_operand" "")
7436 (mult:DF (match_operand:DF 1 "register_operand" "")
7437 (match_operand:DF 2 "nonimmediate_operand" "")))]
7438 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7441 (define_expand "mulsf3"
7442 [(set (match_operand:SF 0 "register_operand" "")
7443 (mult:SF (match_operand:SF 1 "register_operand" "")
7444 (match_operand:SF 2 "nonimmediate_operand" "")))]
7445 "TARGET_80387 || TARGET_SSE_MATH"
7448 ;; Divide instructions
7450 (define_insn "divqi3"
7451 [(set (match_operand:QI 0 "register_operand" "=a")
7452 (div:QI (match_operand:HI 1 "register_operand" "0")
7453 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7454 (clobber (reg:CC FLAGS_REG))]
7455 "TARGET_QIMODE_MATH"
7457 [(set_attr "type" "idiv")
7458 (set_attr "mode" "QI")])
7460 (define_insn "udivqi3"
7461 [(set (match_operand:QI 0 "register_operand" "=a")
7462 (udiv:QI (match_operand:HI 1 "register_operand" "0")
7463 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7464 (clobber (reg:CC FLAGS_REG))]
7465 "TARGET_QIMODE_MATH"
7467 [(set_attr "type" "idiv")
7468 (set_attr "mode" "QI")])
7470 ;; The patterns that match these are at the end of this file.
7472 (define_expand "divxf3"
7473 [(set (match_operand:XF 0 "register_operand" "")
7474 (div:XF (match_operand:XF 1 "register_operand" "")
7475 (match_operand:XF 2 "register_operand" "")))]
7479 (define_expand "divdf3"
7480 [(set (match_operand:DF 0 "register_operand" "")
7481 (div:DF (match_operand:DF 1 "register_operand" "")
7482 (match_operand:DF 2 "nonimmediate_operand" "")))]
7483 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7486 (define_expand "divsf3"
7487 [(set (match_operand:SF 0 "register_operand" "")
7488 (div:SF (match_operand:SF 1 "register_operand" "")
7489 (match_operand:SF 2 "nonimmediate_operand" "")))]
7490 "TARGET_80387 || TARGET_SSE_MATH"
7493 ;; Remainder instructions.
7495 (define_expand "divmoddi4"
7496 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7497 (div:DI (match_operand:DI 1 "register_operand" "")
7498 (match_operand:DI 2 "nonimmediate_operand" "")))
7499 (set (match_operand:DI 3 "register_operand" "")
7500 (mod:DI (match_dup 1) (match_dup 2)))
7501 (clobber (reg:CC FLAGS_REG))])]
7505 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7506 ;; Penalize eax case slightly because it results in worse scheduling
7508 (define_insn "*divmoddi4_nocltd_rex64"
7509 [(set (match_operand:DI 0 "register_operand" "=&a,?a")
7510 (div:DI (match_operand:DI 2 "register_operand" "1,0")
7511 (match_operand:DI 3 "nonimmediate_operand" "rm,rm")))
7512 (set (match_operand:DI 1 "register_operand" "=&d,&d")
7513 (mod:DI (match_dup 2) (match_dup 3)))
7514 (clobber (reg:CC FLAGS_REG))]
7515 "TARGET_64BIT && !optimize_size && !TARGET_USE_CLTD"
7517 [(set_attr "type" "multi")])
7519 (define_insn "*divmoddi4_cltd_rex64"
7520 [(set (match_operand:DI 0 "register_operand" "=a")
7521 (div:DI (match_operand:DI 2 "register_operand" "a")
7522 (match_operand:DI 3 "nonimmediate_operand" "rm")))
7523 (set (match_operand:DI 1 "register_operand" "=&d")
7524 (mod:DI (match_dup 2) (match_dup 3)))
7525 (clobber (reg:CC FLAGS_REG))]
7526 "TARGET_64BIT && (optimize_size || TARGET_USE_CLTD)"
7528 [(set_attr "type" "multi")])
7530 (define_insn "*divmoddi_noext_rex64"
7531 [(set (match_operand:DI 0 "register_operand" "=a")
7532 (div:DI (match_operand:DI 1 "register_operand" "0")
7533 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7534 (set (match_operand:DI 3 "register_operand" "=d")
7535 (mod:DI (match_dup 1) (match_dup 2)))
7536 (use (match_operand:DI 4 "register_operand" "3"))
7537 (clobber (reg:CC FLAGS_REG))]
7540 [(set_attr "type" "idiv")
7541 (set_attr "mode" "DI")])
7544 [(set (match_operand:DI 0 "register_operand" "")
7545 (div:DI (match_operand:DI 1 "register_operand" "")
7546 (match_operand:DI 2 "nonimmediate_operand" "")))
7547 (set (match_operand:DI 3 "register_operand" "")
7548 (mod:DI (match_dup 1) (match_dup 2)))
7549 (clobber (reg:CC FLAGS_REG))]
7550 "TARGET_64BIT && reload_completed"
7551 [(parallel [(set (match_dup 3)
7552 (ashiftrt:DI (match_dup 4) (const_int 63)))
7553 (clobber (reg:CC FLAGS_REG))])
7554 (parallel [(set (match_dup 0)
7555 (div:DI (reg:DI 0) (match_dup 2)))
7557 (mod:DI (reg:DI 0) (match_dup 2)))
7559 (clobber (reg:CC FLAGS_REG))])]
7561 /* Avoid use of cltd in favor of a mov+shift. */
7562 if (!TARGET_USE_CLTD && !optimize_size)
7564 if (true_regnum (operands[1]))
7565 emit_move_insn (operands[0], operands[1]);
7567 emit_move_insn (operands[3], operands[1]);
7568 operands[4] = operands[3];
7572 if (true_regnum (operands[1]))
7574 operands[4] = operands[1];
7579 (define_expand "divmodsi4"
7580 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7581 (div:SI (match_operand:SI 1 "register_operand" "")
7582 (match_operand:SI 2 "nonimmediate_operand" "")))
7583 (set (match_operand:SI 3 "register_operand" "")
7584 (mod:SI (match_dup 1) (match_dup 2)))
7585 (clobber (reg:CC FLAGS_REG))])]
7589 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7590 ;; Penalize eax case slightly because it results in worse scheduling
7592 (define_insn "*divmodsi4_nocltd"
7593 [(set (match_operand:SI 0 "register_operand" "=&a,?a")
7594 (div:SI (match_operand:SI 2 "register_operand" "1,0")
7595 (match_operand:SI 3 "nonimmediate_operand" "rm,rm")))
7596 (set (match_operand:SI 1 "register_operand" "=&d,&d")
7597 (mod:SI (match_dup 2) (match_dup 3)))
7598 (clobber (reg:CC FLAGS_REG))]
7599 "!optimize_size && !TARGET_USE_CLTD"
7601 [(set_attr "type" "multi")])
7603 (define_insn "*divmodsi4_cltd"
7604 [(set (match_operand:SI 0 "register_operand" "=a")
7605 (div:SI (match_operand:SI 2 "register_operand" "a")
7606 (match_operand:SI 3 "nonimmediate_operand" "rm")))
7607 (set (match_operand:SI 1 "register_operand" "=&d")
7608 (mod:SI (match_dup 2) (match_dup 3)))
7609 (clobber (reg:CC FLAGS_REG))]
7610 "optimize_size || TARGET_USE_CLTD"
7612 [(set_attr "type" "multi")])
7614 (define_insn "*divmodsi_noext"
7615 [(set (match_operand:SI 0 "register_operand" "=a")
7616 (div:SI (match_operand:SI 1 "register_operand" "0")
7617 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7618 (set (match_operand:SI 3 "register_operand" "=d")
7619 (mod:SI (match_dup 1) (match_dup 2)))
7620 (use (match_operand:SI 4 "register_operand" "3"))
7621 (clobber (reg:CC FLAGS_REG))]
7624 [(set_attr "type" "idiv")
7625 (set_attr "mode" "SI")])
7628 [(set (match_operand:SI 0 "register_operand" "")
7629 (div:SI (match_operand:SI 1 "register_operand" "")
7630 (match_operand:SI 2 "nonimmediate_operand" "")))
7631 (set (match_operand:SI 3 "register_operand" "")
7632 (mod:SI (match_dup 1) (match_dup 2)))
7633 (clobber (reg:CC FLAGS_REG))]
7635 [(parallel [(set (match_dup 3)
7636 (ashiftrt:SI (match_dup 4) (const_int 31)))
7637 (clobber (reg:CC FLAGS_REG))])
7638 (parallel [(set (match_dup 0)
7639 (div:SI (reg:SI 0) (match_dup 2)))
7641 (mod:SI (reg:SI 0) (match_dup 2)))
7643 (clobber (reg:CC FLAGS_REG))])]
7645 /* Avoid use of cltd in favor of a mov+shift. */
7646 if (!TARGET_USE_CLTD && !optimize_size)
7648 if (true_regnum (operands[1]))
7649 emit_move_insn (operands[0], operands[1]);
7651 emit_move_insn (operands[3], operands[1]);
7652 operands[4] = operands[3];
7656 if (true_regnum (operands[1]))
7658 operands[4] = operands[1];
7662 (define_insn "divmodhi4"
7663 [(set (match_operand:HI 0 "register_operand" "=a")
7664 (div:HI (match_operand:HI 1 "register_operand" "0")
7665 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7666 (set (match_operand:HI 3 "register_operand" "=&d")
7667 (mod:HI (match_dup 1) (match_dup 2)))
7668 (clobber (reg:CC FLAGS_REG))]
7669 "TARGET_HIMODE_MATH"
7671 [(set_attr "type" "multi")
7672 (set_attr "length_immediate" "0")
7673 (set_attr "mode" "SI")])
7675 (define_insn "udivmoddi4"
7676 [(set (match_operand:DI 0 "register_operand" "=a")
7677 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7678 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7679 (set (match_operand:DI 3 "register_operand" "=&d")
7680 (umod:DI (match_dup 1) (match_dup 2)))
7681 (clobber (reg:CC FLAGS_REG))]
7683 "xor{q}\t%3, %3\;div{q}\t%2"
7684 [(set_attr "type" "multi")
7685 (set_attr "length_immediate" "0")
7686 (set_attr "mode" "DI")])
7688 (define_insn "*udivmoddi4_noext"
7689 [(set (match_operand:DI 0 "register_operand" "=a")
7690 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7691 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7692 (set (match_operand:DI 3 "register_operand" "=d")
7693 (umod:DI (match_dup 1) (match_dup 2)))
7695 (clobber (reg:CC FLAGS_REG))]
7698 [(set_attr "type" "idiv")
7699 (set_attr "mode" "DI")])
7702 [(set (match_operand:DI 0 "register_operand" "")
7703 (udiv:DI (match_operand:DI 1 "register_operand" "")
7704 (match_operand:DI 2 "nonimmediate_operand" "")))
7705 (set (match_operand:DI 3 "register_operand" "")
7706 (umod:DI (match_dup 1) (match_dup 2)))
7707 (clobber (reg:CC FLAGS_REG))]
7708 "TARGET_64BIT && reload_completed"
7709 [(set (match_dup 3) (const_int 0))
7710 (parallel [(set (match_dup 0)
7711 (udiv:DI (match_dup 1) (match_dup 2)))
7713 (umod:DI (match_dup 1) (match_dup 2)))
7715 (clobber (reg:CC FLAGS_REG))])]
7718 (define_insn "udivmodsi4"
7719 [(set (match_operand:SI 0 "register_operand" "=a")
7720 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7721 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7722 (set (match_operand:SI 3 "register_operand" "=&d")
7723 (umod:SI (match_dup 1) (match_dup 2)))
7724 (clobber (reg:CC FLAGS_REG))]
7726 "xor{l}\t%3, %3\;div{l}\t%2"
7727 [(set_attr "type" "multi")
7728 (set_attr "length_immediate" "0")
7729 (set_attr "mode" "SI")])
7731 (define_insn "*udivmodsi4_noext"
7732 [(set (match_operand:SI 0 "register_operand" "=a")
7733 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7734 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7735 (set (match_operand:SI 3 "register_operand" "=d")
7736 (umod:SI (match_dup 1) (match_dup 2)))
7738 (clobber (reg:CC FLAGS_REG))]
7741 [(set_attr "type" "idiv")
7742 (set_attr "mode" "SI")])
7745 [(set (match_operand:SI 0 "register_operand" "")
7746 (udiv:SI (match_operand:SI 1 "register_operand" "")
7747 (match_operand:SI 2 "nonimmediate_operand" "")))
7748 (set (match_operand:SI 3 "register_operand" "")
7749 (umod:SI (match_dup 1) (match_dup 2)))
7750 (clobber (reg:CC FLAGS_REG))]
7752 [(set (match_dup 3) (const_int 0))
7753 (parallel [(set (match_dup 0)
7754 (udiv:SI (match_dup 1) (match_dup 2)))
7756 (umod:SI (match_dup 1) (match_dup 2)))
7758 (clobber (reg:CC FLAGS_REG))])]
7761 (define_expand "udivmodhi4"
7762 [(set (match_dup 4) (const_int 0))
7763 (parallel [(set (match_operand:HI 0 "register_operand" "")
7764 (udiv:HI (match_operand:HI 1 "register_operand" "")
7765 (match_operand:HI 2 "nonimmediate_operand" "")))
7766 (set (match_operand:HI 3 "register_operand" "")
7767 (umod:HI (match_dup 1) (match_dup 2)))
7769 (clobber (reg:CC FLAGS_REG))])]
7770 "TARGET_HIMODE_MATH"
7771 "operands[4] = gen_reg_rtx (HImode);")
7773 (define_insn "*udivmodhi_noext"
7774 [(set (match_operand:HI 0 "register_operand" "=a")
7775 (udiv:HI (match_operand:HI 1 "register_operand" "0")
7776 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7777 (set (match_operand:HI 3 "register_operand" "=d")
7778 (umod:HI (match_dup 1) (match_dup 2)))
7779 (use (match_operand:HI 4 "register_operand" "3"))
7780 (clobber (reg:CC FLAGS_REG))]
7783 [(set_attr "type" "idiv")
7784 (set_attr "mode" "HI")])
7786 ;; We cannot use div/idiv for double division, because it causes
7787 ;; "division by zero" on the overflow and that's not what we expect
7788 ;; from truncate. Because true (non truncating) double division is
7789 ;; never generated, we can't create this insn anyway.
7792 ; [(set (match_operand:SI 0 "register_operand" "=a")
7794 ; (udiv:DI (match_operand:DI 1 "register_operand" "A")
7796 ; (match_operand:SI 2 "nonimmediate_operand" "rm")))))
7797 ; (set (match_operand:SI 3 "register_operand" "=d")
7799 ; (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
7800 ; (clobber (reg:CC FLAGS_REG))]
7802 ; "div{l}\t{%2, %0|%0, %2}"
7803 ; [(set_attr "type" "idiv")])
7805 ;;- Logical AND instructions
7807 ;; On Pentium, "test imm, reg" is pairable only with eax, ax, and al.
7808 ;; Note that this excludes ah.
7810 (define_insn "*testdi_1_rex64"
7811 [(set (reg FLAGS_REG)
7813 (and:DI (match_operand:DI 0 "nonimmediate_operand" "%!*a,r,!*a,r,rm")
7814 (match_operand:DI 1 "x86_64_szext_general_operand" "Z,Z,e,e,re"))
7816 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
7817 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7819 test{l}\t{%k1, %k0|%k0, %k1}
7820 test{l}\t{%k1, %k0|%k0, %k1}
7821 test{q}\t{%1, %0|%0, %1}
7822 test{q}\t{%1, %0|%0, %1}
7823 test{q}\t{%1, %0|%0, %1}"
7824 [(set_attr "type" "test")
7825 (set_attr "modrm" "0,1,0,1,1")
7826 (set_attr "mode" "SI,SI,DI,DI,DI")
7827 (set_attr "pent_pair" "uv,np,uv,np,uv")])
7829 (define_insn "testsi_1"
7830 [(set (reg FLAGS_REG)
7832 (and:SI (match_operand:SI 0 "nonimmediate_operand" "%!*a,r,rm")
7833 (match_operand:SI 1 "general_operand" "in,in,rin"))
7835 "ix86_match_ccmode (insn, CCNOmode)
7836 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7837 "test{l}\t{%1, %0|%0, %1}"
7838 [(set_attr "type" "test")
7839 (set_attr "modrm" "0,1,1")
7840 (set_attr "mode" "SI")
7841 (set_attr "pent_pair" "uv,np,uv")])
7843 (define_expand "testsi_ccno_1"
7844 [(set (reg:CCNO FLAGS_REG)
7846 (and:SI (match_operand:SI 0 "nonimmediate_operand" "")
7847 (match_operand:SI 1 "nonmemory_operand" ""))
7852 (define_insn "*testhi_1"
7853 [(set (reg FLAGS_REG)
7854 (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%!*a,r,rm")
7855 (match_operand:HI 1 "general_operand" "n,n,rn"))
7857 "ix86_match_ccmode (insn, CCNOmode)
7858 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7859 "test{w}\t{%1, %0|%0, %1}"
7860 [(set_attr "type" "test")
7861 (set_attr "modrm" "0,1,1")
7862 (set_attr "mode" "HI")
7863 (set_attr "pent_pair" "uv,np,uv")])
7865 (define_expand "testqi_ccz_1"
7866 [(set (reg:CCZ FLAGS_REG)
7867 (compare:CCZ (and:QI (match_operand:QI 0 "nonimmediate_operand" "")
7868 (match_operand:QI 1 "nonmemory_operand" ""))
7873 (define_insn "*testqi_1_maybe_si"
7874 [(set (reg FLAGS_REG)
7877 (match_operand:QI 0 "nonimmediate_operand" "%!*a,q,qm,r")
7878 (match_operand:QI 1 "general_operand" "n,n,qn,n"))
7880 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
7881 && ix86_match_ccmode (insn,
7882 GET_CODE (operands[1]) == CONST_INT
7883 && INTVAL (operands[1]) >= 0 ? CCNOmode : CCZmode)"
7885 if (which_alternative == 3)
7887 if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) < 0)
7888 operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
7889 return "test{l}\t{%1, %k0|%k0, %1}";
7891 return "test{b}\t{%1, %0|%0, %1}";
7893 [(set_attr "type" "test")
7894 (set_attr "modrm" "0,1,1,1")
7895 (set_attr "mode" "QI,QI,QI,SI")
7896 (set_attr "pent_pair" "uv,np,uv,np")])
7898 (define_insn "*testqi_1"
7899 [(set (reg FLAGS_REG)
7902 (match_operand:QI 0 "nonimmediate_operand" "%!*a,q,qm")
7903 (match_operand:QI 1 "general_operand" "n,n,qn"))
7905 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
7906 && ix86_match_ccmode (insn, CCNOmode)"
7907 "test{b}\t{%1, %0|%0, %1}"
7908 [(set_attr "type" "test")
7909 (set_attr "modrm" "0,1,1")
7910 (set_attr "mode" "QI")
7911 (set_attr "pent_pair" "uv,np,uv")])
7913 (define_expand "testqi_ext_ccno_0"
7914 [(set (reg:CCNO FLAGS_REG)
7918 (match_operand 0 "ext_register_operand" "")
7921 (match_operand 1 "const_int_operand" ""))
7926 (define_insn "*testqi_ext_0"
7927 [(set (reg FLAGS_REG)
7931 (match_operand 0 "ext_register_operand" "Q")
7934 (match_operand 1 "const_int_operand" "n"))
7936 "ix86_match_ccmode (insn, CCNOmode)"
7937 "test{b}\t{%1, %h0|%h0, %1}"
7938 [(set_attr "type" "test")
7939 (set_attr "mode" "QI")
7940 (set_attr "length_immediate" "1")
7941 (set_attr "pent_pair" "np")])
7943 (define_insn "*testqi_ext_1"
7944 [(set (reg FLAGS_REG)
7948 (match_operand 0 "ext_register_operand" "Q")
7952 (match_operand:QI 1 "general_operand" "Qm")))
7954 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
7955 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7956 "test{b}\t{%1, %h0|%h0, %1}"
7957 [(set_attr "type" "test")
7958 (set_attr "mode" "QI")])
7960 (define_insn "*testqi_ext_1_rex64"
7961 [(set (reg FLAGS_REG)
7965 (match_operand 0 "ext_register_operand" "Q")
7969 (match_operand:QI 1 "register_operand" "Q")))
7971 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
7972 "test{b}\t{%1, %h0|%h0, %1}"
7973 [(set_attr "type" "test")
7974 (set_attr "mode" "QI")])
7976 (define_insn "*testqi_ext_2"
7977 [(set (reg FLAGS_REG)
7981 (match_operand 0 "ext_register_operand" "Q")
7985 (match_operand 1 "ext_register_operand" "Q")
7989 "ix86_match_ccmode (insn, CCNOmode)"
7990 "test{b}\t{%h1, %h0|%h0, %h1}"
7991 [(set_attr "type" "test")
7992 (set_attr "mode" "QI")])
7994 ;; Combine likes to form bit extractions for some tests. Humor it.
7995 (define_insn "*testqi_ext_3"
7996 [(set (reg FLAGS_REG)
7997 (compare (zero_extract:SI
7998 (match_operand 0 "nonimmediate_operand" "rm")
7999 (match_operand:SI 1 "const_int_operand" "")
8000 (match_operand:SI 2 "const_int_operand" ""))
8002 "ix86_match_ccmode (insn, CCNOmode)
8003 && (GET_MODE (operands[0]) == SImode
8004 || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)
8005 || GET_MODE (operands[0]) == HImode
8006 || GET_MODE (operands[0]) == QImode)"
8009 (define_insn "*testqi_ext_3_rex64"
8010 [(set (reg FLAGS_REG)
8011 (compare (zero_extract:DI
8012 (match_operand 0 "nonimmediate_operand" "rm")
8013 (match_operand:DI 1 "const_int_operand" "")
8014 (match_operand:DI 2 "const_int_operand" ""))
8017 && ix86_match_ccmode (insn, CCNOmode)
8018 /* The code below cannot deal with constants outside HOST_WIDE_INT. */
8019 && INTVAL (operands[1]) + INTVAL (operands[2]) < HOST_BITS_PER_WIDE_INT
8020 /* Ensure that resulting mask is zero or sign extended operand. */
8021 && (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
8022 || (INTVAL (operands[1]) + INTVAL (operands[2]) == 64
8023 && INTVAL (operands[1]) > 32))
8024 && (GET_MODE (operands[0]) == SImode
8025 || GET_MODE (operands[0]) == DImode
8026 || GET_MODE (operands[0]) == HImode
8027 || GET_MODE (operands[0]) == QImode)"
8031 [(set (match_operand 0 "flags_reg_operand" "")
8032 (match_operator 1 "compare_operator"
8034 (match_operand 2 "nonimmediate_operand" "")
8035 (match_operand 3 "const_int_operand" "")
8036 (match_operand 4 "const_int_operand" ""))
8038 "ix86_match_ccmode (insn, CCNOmode)"
8039 [(set (match_dup 0) (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
8041 rtx val = operands[2];
8042 HOST_WIDE_INT len = INTVAL (operands[3]);
8043 HOST_WIDE_INT pos = INTVAL (operands[4]);
8045 enum machine_mode mode, submode;
8047 mode = GET_MODE (val);
8048 if (GET_CODE (val) == MEM)
8050 /* ??? Combine likes to put non-volatile mem extractions in QImode
8051 no matter the size of the test. So find a mode that works. */
8052 if (! MEM_VOLATILE_P (val))
8054 mode = smallest_mode_for_size (pos + len, MODE_INT);
8055 val = adjust_address (val, mode, 0);
8058 else if (GET_CODE (val) == SUBREG
8059 && (submode = GET_MODE (SUBREG_REG (val)),
8060 GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode))
8061 && pos + len <= GET_MODE_BITSIZE (submode))
8063 /* Narrow a paradoxical subreg to prevent partial register stalls. */
8065 val = SUBREG_REG (val);
8067 else if (mode == HImode && pos + len <= 8)
8069 /* Small HImode tests can be converted to QImode. */
8071 val = gen_lowpart (QImode, val);
8074 mask = ((HOST_WIDE_INT)1 << (pos + len)) - 1;
8075 mask &= ~(((HOST_WIDE_INT)1 << pos) - 1);
8077 operands[2] = gen_rtx_AND (mode, val, gen_int_mode (mask, mode));
8080 ;; Convert HImode/SImode test instructions with immediate to QImode ones.
8081 ;; i386 does not allow to encode test with 8bit sign extended immediate, so
8082 ;; this is relatively important trick.
8083 ;; Do the conversion only post-reload to avoid limiting of the register class
8086 [(set (match_operand 0 "flags_reg_operand" "")
8087 (match_operator 1 "compare_operator"
8088 [(and (match_operand 2 "register_operand" "")
8089 (match_operand 3 "const_int_operand" ""))
8092 && QI_REG_P (operands[2])
8093 && GET_MODE (operands[2]) != QImode
8094 && ((ix86_match_ccmode (insn, CCZmode)
8095 && !(INTVAL (operands[3]) & ~(255 << 8)))
8096 || (ix86_match_ccmode (insn, CCNOmode)
8097 && !(INTVAL (operands[3]) & ~(127 << 8))))"
8100 [(and:SI (zero_extract:SI (match_dup 2) (const_int 8) (const_int 8))
8103 "operands[2] = gen_lowpart (SImode, operands[2]);
8104 operands[3] = gen_int_mode (INTVAL (operands[3]) >> 8, SImode);")
8107 [(set (match_operand 0 "flags_reg_operand" "")
8108 (match_operator 1 "compare_operator"
8109 [(and (match_operand 2 "nonimmediate_operand" "")
8110 (match_operand 3 "const_int_operand" ""))
8113 && GET_MODE (operands[2]) != QImode
8114 && (!REG_P (operands[2]) || ANY_QI_REG_P (operands[2]))
8115 && ((ix86_match_ccmode (insn, CCZmode)
8116 && !(INTVAL (operands[3]) & ~255))
8117 || (ix86_match_ccmode (insn, CCNOmode)
8118 && !(INTVAL (operands[3]) & ~127)))"
8120 (match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3))
8122 "operands[2] = gen_lowpart (QImode, operands[2]);
8123 operands[3] = gen_lowpart (QImode, operands[3]);")
8126 ;; %%% This used to optimize known byte-wide and operations to memory,
8127 ;; and sometimes to QImode registers. If this is considered useful,
8128 ;; it should be done with splitters.
8130 (define_expand "anddi3"
8131 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8132 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
8133 (match_operand:DI 2 "x86_64_szext_general_operand" "")))
8134 (clobber (reg:CC FLAGS_REG))]
8136 "ix86_expand_binary_operator (AND, DImode, operands); DONE;")
8138 (define_insn "*anddi_1_rex64"
8139 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r,r")
8140 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,qm")
8141 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,re,rm,L")))
8142 (clobber (reg:CC FLAGS_REG))]
8143 "TARGET_64BIT && ix86_binary_operator_ok (AND, DImode, operands)"
8145 switch (get_attr_type (insn))
8149 enum machine_mode mode;
8151 if (GET_CODE (operands[2]) != CONST_INT)
8153 if (INTVAL (operands[2]) == 0xff)
8155 else if (INTVAL (operands[2]) == 0xffff)
8160 operands[1] = gen_lowpart (mode, operands[1]);
8162 return "movz{bq|x}\t{%1,%0|%0, %1}";
8164 return "movz{wq|x}\t{%1,%0|%0, %1}";
8168 if (! rtx_equal_p (operands[0], operands[1]))
8170 if (get_attr_mode (insn) == MODE_SI)
8171 return "and{l}\t{%k2, %k0|%k0, %k2}";
8173 return "and{q}\t{%2, %0|%0, %2}";
8176 [(set_attr "type" "alu,alu,alu,imovx")
8177 (set_attr "length_immediate" "*,*,*,0")
8178 (set_attr "mode" "SI,DI,DI,DI")])
8180 (define_insn "*anddi_2"
8181 [(set (reg FLAGS_REG)
8182 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
8183 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,rem,re"))
8185 (set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm")
8186 (and:DI (match_dup 1) (match_dup 2)))]
8187 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8188 && ix86_binary_operator_ok (AND, DImode, operands)"
8190 and{l}\t{%k2, %k0|%k0, %k2}
8191 and{q}\t{%2, %0|%0, %2}
8192 and{q}\t{%2, %0|%0, %2}"
8193 [(set_attr "type" "alu")
8194 (set_attr "mode" "SI,DI,DI")])
8196 (define_expand "andsi3"
8197 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8198 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
8199 (match_operand:SI 2 "general_operand" "")))
8200 (clobber (reg:CC FLAGS_REG))]
8202 "ix86_expand_binary_operator (AND, SImode, operands); DONE;")
8204 (define_insn "*andsi_1"
8205 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r,r")
8206 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,qm")
8207 (match_operand:SI 2 "general_operand" "ri,rm,L")))
8208 (clobber (reg:CC FLAGS_REG))]
8209 "ix86_binary_operator_ok (AND, SImode, operands)"
8211 switch (get_attr_type (insn))
8215 enum machine_mode mode;
8217 if (GET_CODE (operands[2]) != CONST_INT)
8219 if (INTVAL (operands[2]) == 0xff)
8221 else if (INTVAL (operands[2]) == 0xffff)
8226 operands[1] = gen_lowpart (mode, operands[1]);
8228 return "movz{bl|x}\t{%1,%0|%0, %1}";
8230 return "movz{wl|x}\t{%1,%0|%0, %1}";
8234 if (! rtx_equal_p (operands[0], operands[1]))
8236 return "and{l}\t{%2, %0|%0, %2}";
8239 [(set_attr "type" "alu,alu,imovx")
8240 (set_attr "length_immediate" "*,*,0")
8241 (set_attr "mode" "SI")])
8244 [(set (match_operand 0 "register_operand" "")
8246 (const_int -65536)))
8247 (clobber (reg:CC FLAGS_REG))]
8248 "optimize_size || (TARGET_FAST_PREFIX && !TARGET_PARTIAL_REG_STALL)"
8249 [(set (strict_low_part (match_dup 1)) (const_int 0))]
8250 "operands[1] = gen_lowpart (HImode, operands[0]);")
8253 [(set (match_operand 0 "ext_register_operand" "")
8256 (clobber (reg:CC FLAGS_REG))]
8257 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
8258 [(set (strict_low_part (match_dup 1)) (const_int 0))]
8259 "operands[1] = gen_lowpart (QImode, operands[0]);")
8262 [(set (match_operand 0 "ext_register_operand" "")
8264 (const_int -65281)))
8265 (clobber (reg:CC FLAGS_REG))]
8266 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
8267 [(parallel [(set (zero_extract:SI (match_dup 0)
8271 (zero_extract:SI (match_dup 0)
8274 (zero_extract:SI (match_dup 0)
8277 (clobber (reg:CC FLAGS_REG))])]
8278 "operands[0] = gen_lowpart (SImode, operands[0]);")
8280 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8281 (define_insn "*andsi_1_zext"
8282 [(set (match_operand:DI 0 "register_operand" "=r")
8284 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8285 (match_operand:SI 2 "general_operand" "rim"))))
8286 (clobber (reg:CC FLAGS_REG))]
8287 "TARGET_64BIT && ix86_binary_operator_ok (AND, SImode, operands)"
8288 "and{l}\t{%2, %k0|%k0, %2}"
8289 [(set_attr "type" "alu")
8290 (set_attr "mode" "SI")])
8292 (define_insn "*andsi_2"
8293 [(set (reg FLAGS_REG)
8294 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8295 (match_operand:SI 2 "general_operand" "rim,ri"))
8297 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8298 (and:SI (match_dup 1) (match_dup 2)))]
8299 "ix86_match_ccmode (insn, CCNOmode)
8300 && ix86_binary_operator_ok (AND, SImode, operands)"
8301 "and{l}\t{%2, %0|%0, %2}"
8302 [(set_attr "type" "alu")
8303 (set_attr "mode" "SI")])
8305 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8306 (define_insn "*andsi_2_zext"
8307 [(set (reg FLAGS_REG)
8308 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8309 (match_operand:SI 2 "general_operand" "rim"))
8311 (set (match_operand:DI 0 "register_operand" "=r")
8312 (zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))]
8313 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8314 && ix86_binary_operator_ok (AND, SImode, operands)"
8315 "and{l}\t{%2, %k0|%k0, %2}"
8316 [(set_attr "type" "alu")
8317 (set_attr "mode" "SI")])
8319 (define_expand "andhi3"
8320 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8321 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
8322 (match_operand:HI 2 "general_operand" "")))
8323 (clobber (reg:CC FLAGS_REG))]
8324 "TARGET_HIMODE_MATH"
8325 "ix86_expand_binary_operator (AND, HImode, operands); DONE;")
8327 (define_insn "*andhi_1"
8328 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
8329 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm")
8330 (match_operand:HI 2 "general_operand" "ri,rm,L")))
8331 (clobber (reg:CC FLAGS_REG))]
8332 "ix86_binary_operator_ok (AND, HImode, operands)"
8334 switch (get_attr_type (insn))
8337 if (GET_CODE (operands[2]) != CONST_INT)
8339 if (INTVAL (operands[2]) == 0xff)
8340 return "movz{bl|x}\t{%b1, %k0|%k0, %b1}";
8344 if (! rtx_equal_p (operands[0], operands[1]))
8347 return "and{w}\t{%2, %0|%0, %2}";
8350 [(set_attr "type" "alu,alu,imovx")
8351 (set_attr "length_immediate" "*,*,0")
8352 (set_attr "mode" "HI,HI,SI")])
8354 (define_insn "*andhi_2"
8355 [(set (reg FLAGS_REG)
8356 (compare (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8357 (match_operand:HI 2 "general_operand" "rim,ri"))
8359 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8360 (and:HI (match_dup 1) (match_dup 2)))]
8361 "ix86_match_ccmode (insn, CCNOmode)
8362 && ix86_binary_operator_ok (AND, HImode, operands)"
8363 "and{w}\t{%2, %0|%0, %2}"
8364 [(set_attr "type" "alu")
8365 (set_attr "mode" "HI")])
8367 (define_expand "andqi3"
8368 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8369 (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
8370 (match_operand:QI 2 "general_operand" "")))
8371 (clobber (reg:CC FLAGS_REG))]
8372 "TARGET_QIMODE_MATH"
8373 "ix86_expand_binary_operator (AND, QImode, operands); DONE;")
8375 ;; %%% Potential partial reg stall on alternative 2. What to do?
8376 (define_insn "*andqi_1"
8377 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
8378 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8379 (match_operand:QI 2 "general_operand" "qi,qmi,ri")))
8380 (clobber (reg:CC FLAGS_REG))]
8381 "ix86_binary_operator_ok (AND, QImode, operands)"
8383 and{b}\t{%2, %0|%0, %2}
8384 and{b}\t{%2, %0|%0, %2}
8385 and{l}\t{%k2, %k0|%k0, %k2}"
8386 [(set_attr "type" "alu")
8387 (set_attr "mode" "QI,QI,SI")])
8389 (define_insn "*andqi_1_slp"
8390 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
8391 (and:QI (match_dup 0)
8392 (match_operand:QI 1 "general_operand" "qi,qmi")))
8393 (clobber (reg:CC FLAGS_REG))]
8394 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8395 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8396 "and{b}\t{%1, %0|%0, %1}"
8397 [(set_attr "type" "alu1")
8398 (set_attr "mode" "QI")])
8400 (define_insn "*andqi_2_maybe_si"
8401 [(set (reg FLAGS_REG)
8403 (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8404 (match_operand:QI 2 "general_operand" "qim,qi,i"))
8406 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm,*r")
8407 (and:QI (match_dup 1) (match_dup 2)))]
8408 "ix86_binary_operator_ok (AND, QImode, operands)
8409 && ix86_match_ccmode (insn,
8410 GET_CODE (operands[2]) == CONST_INT
8411 && INTVAL (operands[2]) >= 0 ? CCNOmode : CCZmode)"
8413 if (which_alternative == 2)
8415 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
8416 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff);
8417 return "and{l}\t{%2, %k0|%k0, %2}";
8419 return "and{b}\t{%2, %0|%0, %2}";
8421 [(set_attr "type" "alu")
8422 (set_attr "mode" "QI,QI,SI")])
8424 (define_insn "*andqi_2"
8425 [(set (reg FLAGS_REG)
8427 (match_operand:QI 1 "nonimmediate_operand" "%0,0")
8428 (match_operand:QI 2 "general_operand" "qim,qi"))
8430 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
8431 (and:QI (match_dup 1) (match_dup 2)))]
8432 "ix86_match_ccmode (insn, CCNOmode)
8433 && ix86_binary_operator_ok (AND, QImode, operands)"
8434 "and{b}\t{%2, %0|%0, %2}"
8435 [(set_attr "type" "alu")
8436 (set_attr "mode" "QI")])
8438 (define_insn "*andqi_2_slp"
8439 [(set (reg FLAGS_REG)
8441 (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8442 (match_operand:QI 1 "nonimmediate_operand" "qmi,qi"))
8444 (set (strict_low_part (match_dup 0))
8445 (and:QI (match_dup 0) (match_dup 1)))]
8446 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8447 && ix86_match_ccmode (insn, CCNOmode)
8448 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8449 "and{b}\t{%1, %0|%0, %1}"
8450 [(set_attr "type" "alu1")
8451 (set_attr "mode" "QI")])
8453 ;; ??? A bug in recog prevents it from recognizing a const_int as an
8454 ;; operand to zero_extend in andqi_ext_1. It was checking explicitly
8455 ;; for a QImode operand, which of course failed.
8457 (define_insn "andqi_ext_0"
8458 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8463 (match_operand 1 "ext_register_operand" "0")
8466 (match_operand 2 "const_int_operand" "n")))
8467 (clobber (reg:CC FLAGS_REG))]
8469 "and{b}\t{%2, %h0|%h0, %2}"
8470 [(set_attr "type" "alu")
8471 (set_attr "length_immediate" "1")
8472 (set_attr "mode" "QI")])
8474 ;; Generated by peephole translating test to and. This shows up
8475 ;; often in fp comparisons.
8477 (define_insn "*andqi_ext_0_cc"
8478 [(set (reg FLAGS_REG)
8482 (match_operand 1 "ext_register_operand" "0")
8485 (match_operand 2 "const_int_operand" "n"))
8487 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8496 "ix86_match_ccmode (insn, CCNOmode)"
8497 "and{b}\t{%2, %h0|%h0, %2}"
8498 [(set_attr "type" "alu")
8499 (set_attr "length_immediate" "1")
8500 (set_attr "mode" "QI")])
8502 (define_insn "*andqi_ext_1"
8503 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8508 (match_operand 1 "ext_register_operand" "0")
8512 (match_operand:QI 2 "general_operand" "Qm"))))
8513 (clobber (reg:CC FLAGS_REG))]
8515 "and{b}\t{%2, %h0|%h0, %2}"
8516 [(set_attr "type" "alu")
8517 (set_attr "length_immediate" "0")
8518 (set_attr "mode" "QI")])
8520 (define_insn "*andqi_ext_1_rex64"
8521 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8526 (match_operand 1 "ext_register_operand" "0")
8530 (match_operand 2 "ext_register_operand" "Q"))))
8531 (clobber (reg:CC FLAGS_REG))]
8533 "and{b}\t{%2, %h0|%h0, %2}"
8534 [(set_attr "type" "alu")
8535 (set_attr "length_immediate" "0")
8536 (set_attr "mode" "QI")])
8538 (define_insn "*andqi_ext_2"
8539 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8544 (match_operand 1 "ext_register_operand" "%0")
8548 (match_operand 2 "ext_register_operand" "Q")
8551 (clobber (reg:CC FLAGS_REG))]
8553 "and{b}\t{%h2, %h0|%h0, %h2}"
8554 [(set_attr "type" "alu")
8555 (set_attr "length_immediate" "0")
8556 (set_attr "mode" "QI")])
8558 ;; Convert wide AND instructions with immediate operand to shorter QImode
8559 ;; equivalents when possible.
8560 ;; Don't do the splitting with memory operands, since it introduces risk
8561 ;; of memory mismatch stalls. We may want to do the splitting for optimizing
8562 ;; for size, but that can (should?) be handled by generic code instead.
8564 [(set (match_operand 0 "register_operand" "")
8565 (and (match_operand 1 "register_operand" "")
8566 (match_operand 2 "const_int_operand" "")))
8567 (clobber (reg:CC FLAGS_REG))]
8569 && QI_REG_P (operands[0])
8570 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8571 && !(~INTVAL (operands[2]) & ~(255 << 8))
8572 && GET_MODE (operands[0]) != QImode"
8573 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8574 (and:SI (zero_extract:SI (match_dup 1)
8575 (const_int 8) (const_int 8))
8577 (clobber (reg:CC FLAGS_REG))])]
8578 "operands[0] = gen_lowpart (SImode, operands[0]);
8579 operands[1] = gen_lowpart (SImode, operands[1]);
8580 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8582 ;; Since AND can be encoded with sign extended immediate, this is only
8583 ;; profitable when 7th bit is not set.
8585 [(set (match_operand 0 "register_operand" "")
8586 (and (match_operand 1 "general_operand" "")
8587 (match_operand 2 "const_int_operand" "")))
8588 (clobber (reg:CC FLAGS_REG))]
8590 && ANY_QI_REG_P (operands[0])
8591 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8592 && !(~INTVAL (operands[2]) & ~255)
8593 && !(INTVAL (operands[2]) & 128)
8594 && GET_MODE (operands[0]) != QImode"
8595 [(parallel [(set (strict_low_part (match_dup 0))
8596 (and:QI (match_dup 1)
8598 (clobber (reg:CC FLAGS_REG))])]
8599 "operands[0] = gen_lowpart (QImode, operands[0]);
8600 operands[1] = gen_lowpart (QImode, operands[1]);
8601 operands[2] = gen_lowpart (QImode, operands[2]);")
8603 ;; Logical inclusive OR instructions
8605 ;; %%% This used to optimize known byte-wide and operations to memory.
8606 ;; If this is considered useful, it should be done with splitters.
8608 (define_expand "iordi3"
8609 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8610 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "")
8611 (match_operand:DI 2 "x86_64_general_operand" "")))
8612 (clobber (reg:CC FLAGS_REG))]
8614 "ix86_expand_binary_operator (IOR, DImode, operands); DONE;")
8616 (define_insn "*iordi_1_rex64"
8617 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8618 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8619 (match_operand:DI 2 "x86_64_general_operand" "re,rme")))
8620 (clobber (reg:CC FLAGS_REG))]
8622 && ix86_binary_operator_ok (IOR, DImode, operands)"
8623 "or{q}\t{%2, %0|%0, %2}"
8624 [(set_attr "type" "alu")
8625 (set_attr "mode" "DI")])
8627 (define_insn "*iordi_2_rex64"
8628 [(set (reg FLAGS_REG)
8629 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8630 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
8632 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
8633 (ior:DI (match_dup 1) (match_dup 2)))]
8635 && ix86_match_ccmode (insn, CCNOmode)
8636 && ix86_binary_operator_ok (IOR, DImode, operands)"
8637 "or{q}\t{%2, %0|%0, %2}"
8638 [(set_attr "type" "alu")
8639 (set_attr "mode" "DI")])
8641 (define_insn "*iordi_3_rex64"
8642 [(set (reg FLAGS_REG)
8643 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
8644 (match_operand:DI 2 "x86_64_general_operand" "rem"))
8646 (clobber (match_scratch:DI 0 "=r"))]
8648 && ix86_match_ccmode (insn, CCNOmode)
8649 && ix86_binary_operator_ok (IOR, DImode, operands)"
8650 "or{q}\t{%2, %0|%0, %2}"
8651 [(set_attr "type" "alu")
8652 (set_attr "mode" "DI")])
8655 (define_expand "iorsi3"
8656 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8657 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
8658 (match_operand:SI 2 "general_operand" "")))
8659 (clobber (reg:CC FLAGS_REG))]
8661 "ix86_expand_binary_operator (IOR, SImode, operands); DONE;")
8663 (define_insn "*iorsi_1"
8664 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
8665 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8666 (match_operand:SI 2 "general_operand" "ri,rmi")))
8667 (clobber (reg:CC FLAGS_REG))]
8668 "ix86_binary_operator_ok (IOR, SImode, operands)"
8669 "or{l}\t{%2, %0|%0, %2}"
8670 [(set_attr "type" "alu")
8671 (set_attr "mode" "SI")])
8673 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8674 (define_insn "*iorsi_1_zext"
8675 [(set (match_operand:DI 0 "register_operand" "=rm")
8677 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8678 (match_operand:SI 2 "general_operand" "rim"))))
8679 (clobber (reg:CC FLAGS_REG))]
8680 "TARGET_64BIT && ix86_binary_operator_ok (IOR, SImode, operands)"
8681 "or{l}\t{%2, %k0|%k0, %2}"
8682 [(set_attr "type" "alu")
8683 (set_attr "mode" "SI")])
8685 (define_insn "*iorsi_1_zext_imm"
8686 [(set (match_operand:DI 0 "register_operand" "=rm")
8687 (ior:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
8688 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
8689 (clobber (reg:CC FLAGS_REG))]
8691 "or{l}\t{%2, %k0|%k0, %2}"
8692 [(set_attr "type" "alu")
8693 (set_attr "mode" "SI")])
8695 (define_insn "*iorsi_2"
8696 [(set (reg FLAGS_REG)
8697 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8698 (match_operand:SI 2 "general_operand" "rim,ri"))
8700 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8701 (ior:SI (match_dup 1) (match_dup 2)))]
8702 "ix86_match_ccmode (insn, CCNOmode)
8703 && ix86_binary_operator_ok (IOR, SImode, operands)"
8704 "or{l}\t{%2, %0|%0, %2}"
8705 [(set_attr "type" "alu")
8706 (set_attr "mode" "SI")])
8708 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8709 ;; ??? Special case for immediate operand is missing - it is tricky.
8710 (define_insn "*iorsi_2_zext"
8711 [(set (reg FLAGS_REG)
8712 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8713 (match_operand:SI 2 "general_operand" "rim"))
8715 (set (match_operand:DI 0 "register_operand" "=r")
8716 (zero_extend:DI (ior:SI (match_dup 1) (match_dup 2))))]
8717 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8718 && ix86_binary_operator_ok (IOR, SImode, operands)"
8719 "or{l}\t{%2, %k0|%k0, %2}"
8720 [(set_attr "type" "alu")
8721 (set_attr "mode" "SI")])
8723 (define_insn "*iorsi_2_zext_imm"
8724 [(set (reg FLAGS_REG)
8725 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8726 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
8728 (set (match_operand:DI 0 "register_operand" "=r")
8729 (ior:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
8730 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8731 && ix86_binary_operator_ok (IOR, SImode, operands)"
8732 "or{l}\t{%2, %k0|%k0, %2}"
8733 [(set_attr "type" "alu")
8734 (set_attr "mode" "SI")])
8736 (define_insn "*iorsi_3"
8737 [(set (reg FLAGS_REG)
8738 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8739 (match_operand:SI 2 "general_operand" "rim"))
8741 (clobber (match_scratch:SI 0 "=r"))]
8742 "ix86_match_ccmode (insn, CCNOmode)
8743 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8744 "or{l}\t{%2, %0|%0, %2}"
8745 [(set_attr "type" "alu")
8746 (set_attr "mode" "SI")])
8748 (define_expand "iorhi3"
8749 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8750 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
8751 (match_operand:HI 2 "general_operand" "")))
8752 (clobber (reg:CC FLAGS_REG))]
8753 "TARGET_HIMODE_MATH"
8754 "ix86_expand_binary_operator (IOR, HImode, operands); DONE;")
8756 (define_insn "*iorhi_1"
8757 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
8758 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8759 (match_operand:HI 2 "general_operand" "rmi,ri")))
8760 (clobber (reg:CC FLAGS_REG))]
8761 "ix86_binary_operator_ok (IOR, HImode, operands)"
8762 "or{w}\t{%2, %0|%0, %2}"
8763 [(set_attr "type" "alu")
8764 (set_attr "mode" "HI")])
8766 (define_insn "*iorhi_2"
8767 [(set (reg FLAGS_REG)
8768 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8769 (match_operand:HI 2 "general_operand" "rim,ri"))
8771 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8772 (ior:HI (match_dup 1) (match_dup 2)))]
8773 "ix86_match_ccmode (insn, CCNOmode)
8774 && ix86_binary_operator_ok (IOR, HImode, operands)"
8775 "or{w}\t{%2, %0|%0, %2}"
8776 [(set_attr "type" "alu")
8777 (set_attr "mode" "HI")])
8779 (define_insn "*iorhi_3"
8780 [(set (reg FLAGS_REG)
8781 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
8782 (match_operand:HI 2 "general_operand" "rim"))
8784 (clobber (match_scratch:HI 0 "=r"))]
8785 "ix86_match_ccmode (insn, CCNOmode)
8786 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8787 "or{w}\t{%2, %0|%0, %2}"
8788 [(set_attr "type" "alu")
8789 (set_attr "mode" "HI")])
8791 (define_expand "iorqi3"
8792 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8793 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
8794 (match_operand:QI 2 "general_operand" "")))
8795 (clobber (reg:CC FLAGS_REG))]
8796 "TARGET_QIMODE_MATH"
8797 "ix86_expand_binary_operator (IOR, QImode, operands); DONE;")
8799 ;; %%% Potential partial reg stall on alternative 2. What to do?
8800 (define_insn "*iorqi_1"
8801 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
8802 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8803 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
8804 (clobber (reg:CC FLAGS_REG))]
8805 "ix86_binary_operator_ok (IOR, QImode, operands)"
8807 or{b}\t{%2, %0|%0, %2}
8808 or{b}\t{%2, %0|%0, %2}
8809 or{l}\t{%k2, %k0|%k0, %k2}"
8810 [(set_attr "type" "alu")
8811 (set_attr "mode" "QI,QI,SI")])
8813 (define_insn "*iorqi_1_slp"
8814 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m"))
8815 (ior:QI (match_dup 0)
8816 (match_operand:QI 1 "general_operand" "qmi,qi")))
8817 (clobber (reg:CC FLAGS_REG))]
8818 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8819 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8820 "or{b}\t{%1, %0|%0, %1}"
8821 [(set_attr "type" "alu1")
8822 (set_attr "mode" "QI")])
8824 (define_insn "*iorqi_2"
8825 [(set (reg FLAGS_REG)
8826 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
8827 (match_operand:QI 2 "general_operand" "qim,qi"))
8829 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
8830 (ior:QI (match_dup 1) (match_dup 2)))]
8831 "ix86_match_ccmode (insn, CCNOmode)
8832 && ix86_binary_operator_ok (IOR, QImode, operands)"
8833 "or{b}\t{%2, %0|%0, %2}"
8834 [(set_attr "type" "alu")
8835 (set_attr "mode" "QI")])
8837 (define_insn "*iorqi_2_slp"
8838 [(set (reg FLAGS_REG)
8839 (compare (ior:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8840 (match_operand:QI 1 "general_operand" "qim,qi"))
8842 (set (strict_low_part (match_dup 0))
8843 (ior:QI (match_dup 0) (match_dup 1)))]
8844 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8845 && ix86_match_ccmode (insn, CCNOmode)
8846 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8847 "or{b}\t{%1, %0|%0, %1}"
8848 [(set_attr "type" "alu1")
8849 (set_attr "mode" "QI")])
8851 (define_insn "*iorqi_3"
8852 [(set (reg FLAGS_REG)
8853 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
8854 (match_operand:QI 2 "general_operand" "qim"))
8856 (clobber (match_scratch:QI 0 "=q"))]
8857 "ix86_match_ccmode (insn, CCNOmode)
8858 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8859 "or{b}\t{%2, %0|%0, %2}"
8860 [(set_attr "type" "alu")
8861 (set_attr "mode" "QI")])
8863 (define_insn "iorqi_ext_0"
8864 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8869 (match_operand 1 "ext_register_operand" "0")
8872 (match_operand 2 "const_int_operand" "n")))
8873 (clobber (reg:CC FLAGS_REG))]
8874 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8875 "or{b}\t{%2, %h0|%h0, %2}"
8876 [(set_attr "type" "alu")
8877 (set_attr "length_immediate" "1")
8878 (set_attr "mode" "QI")])
8880 (define_insn "*iorqi_ext_1"
8881 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8886 (match_operand 1 "ext_register_operand" "0")
8890 (match_operand:QI 2 "general_operand" "Qm"))))
8891 (clobber (reg:CC FLAGS_REG))]
8893 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8894 "or{b}\t{%2, %h0|%h0, %2}"
8895 [(set_attr "type" "alu")
8896 (set_attr "length_immediate" "0")
8897 (set_attr "mode" "QI")])
8899 (define_insn "*iorqi_ext_1_rex64"
8900 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8905 (match_operand 1 "ext_register_operand" "0")
8909 (match_operand 2 "ext_register_operand" "Q"))))
8910 (clobber (reg:CC FLAGS_REG))]
8912 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8913 "or{b}\t{%2, %h0|%h0, %2}"
8914 [(set_attr "type" "alu")
8915 (set_attr "length_immediate" "0")
8916 (set_attr "mode" "QI")])
8918 (define_insn "*iorqi_ext_2"
8919 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8923 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
8926 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
8929 (clobber (reg:CC FLAGS_REG))]
8930 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8931 "ior{b}\t{%h2, %h0|%h0, %h2}"
8932 [(set_attr "type" "alu")
8933 (set_attr "length_immediate" "0")
8934 (set_attr "mode" "QI")])
8937 [(set (match_operand 0 "register_operand" "")
8938 (ior (match_operand 1 "register_operand" "")
8939 (match_operand 2 "const_int_operand" "")))
8940 (clobber (reg:CC FLAGS_REG))]
8942 && QI_REG_P (operands[0])
8943 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8944 && !(INTVAL (operands[2]) & ~(255 << 8))
8945 && GET_MODE (operands[0]) != QImode"
8946 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8947 (ior:SI (zero_extract:SI (match_dup 1)
8948 (const_int 8) (const_int 8))
8950 (clobber (reg:CC FLAGS_REG))])]
8951 "operands[0] = gen_lowpart (SImode, operands[0]);
8952 operands[1] = gen_lowpart (SImode, operands[1]);
8953 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8955 ;; Since OR can be encoded with sign extended immediate, this is only
8956 ;; profitable when 7th bit is set.
8958 [(set (match_operand 0 "register_operand" "")
8959 (ior (match_operand 1 "general_operand" "")
8960 (match_operand 2 "const_int_operand" "")))
8961 (clobber (reg:CC FLAGS_REG))]
8963 && ANY_QI_REG_P (operands[0])
8964 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8965 && !(INTVAL (operands[2]) & ~255)
8966 && (INTVAL (operands[2]) & 128)
8967 && GET_MODE (operands[0]) != QImode"
8968 [(parallel [(set (strict_low_part (match_dup 0))
8969 (ior:QI (match_dup 1)
8971 (clobber (reg:CC FLAGS_REG))])]
8972 "operands[0] = gen_lowpart (QImode, operands[0]);
8973 operands[1] = gen_lowpart (QImode, operands[1]);
8974 operands[2] = gen_lowpart (QImode, operands[2]);")
8976 ;; Logical XOR instructions
8978 ;; %%% This used to optimize known byte-wide and operations to memory.
8979 ;; If this is considered useful, it should be done with splitters.
8981 (define_expand "xordi3"
8982 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8983 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "")
8984 (match_operand:DI 2 "x86_64_general_operand" "")))
8985 (clobber (reg:CC FLAGS_REG))]
8987 "ix86_expand_binary_operator (XOR, DImode, operands); DONE;")
8989 (define_insn "*xordi_1_rex64"
8990 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8991 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8992 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
8993 (clobber (reg:CC FLAGS_REG))]
8995 && ix86_binary_operator_ok (XOR, DImode, operands)"
8997 xor{q}\t{%2, %0|%0, %2}
8998 xor{q}\t{%2, %0|%0, %2}"
8999 [(set_attr "type" "alu")
9000 (set_attr "mode" "DI,DI")])
9002 (define_insn "*xordi_2_rex64"
9003 [(set (reg FLAGS_REG)
9004 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
9005 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
9007 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
9008 (xor:DI (match_dup 1) (match_dup 2)))]
9010 && ix86_match_ccmode (insn, CCNOmode)
9011 && ix86_binary_operator_ok (XOR, DImode, operands)"
9013 xor{q}\t{%2, %0|%0, %2}
9014 xor{q}\t{%2, %0|%0, %2}"
9015 [(set_attr "type" "alu")
9016 (set_attr "mode" "DI,DI")])
9018 (define_insn "*xordi_3_rex64"
9019 [(set (reg FLAGS_REG)
9020 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
9021 (match_operand:DI 2 "x86_64_general_operand" "rem"))
9023 (clobber (match_scratch:DI 0 "=r"))]
9025 && ix86_match_ccmode (insn, CCNOmode)
9026 && ix86_binary_operator_ok (XOR, DImode, operands)"
9027 "xor{q}\t{%2, %0|%0, %2}"
9028 [(set_attr "type" "alu")
9029 (set_attr "mode" "DI")])
9031 (define_expand "xorsi3"
9032 [(set (match_operand:SI 0 "nonimmediate_operand" "")
9033 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "")
9034 (match_operand:SI 2 "general_operand" "")))
9035 (clobber (reg:CC FLAGS_REG))]
9037 "ix86_expand_binary_operator (XOR, SImode, operands); DONE;")
9039 (define_insn "*xorsi_1"
9040 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
9041 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
9042 (match_operand:SI 2 "general_operand" "ri,rm")))
9043 (clobber (reg:CC FLAGS_REG))]
9044 "ix86_binary_operator_ok (XOR, SImode, operands)"
9045 "xor{l}\t{%2, %0|%0, %2}"
9046 [(set_attr "type" "alu")
9047 (set_attr "mode" "SI")])
9049 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
9050 ;; Add speccase for immediates
9051 (define_insn "*xorsi_1_zext"
9052 [(set (match_operand:DI 0 "register_operand" "=r")
9054 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9055 (match_operand:SI 2 "general_operand" "rim"))))
9056 (clobber (reg:CC FLAGS_REG))]
9057 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
9058 "xor{l}\t{%2, %k0|%k0, %2}"
9059 [(set_attr "type" "alu")
9060 (set_attr "mode" "SI")])
9062 (define_insn "*xorsi_1_zext_imm"
9063 [(set (match_operand:DI 0 "register_operand" "=r")
9064 (xor:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
9065 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
9066 (clobber (reg:CC FLAGS_REG))]
9067 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
9068 "xor{l}\t{%2, %k0|%k0, %2}"
9069 [(set_attr "type" "alu")
9070 (set_attr "mode" "SI")])
9072 (define_insn "*xorsi_2"
9073 [(set (reg FLAGS_REG)
9074 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
9075 (match_operand:SI 2 "general_operand" "rim,ri"))
9077 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
9078 (xor:SI (match_dup 1) (match_dup 2)))]
9079 "ix86_match_ccmode (insn, CCNOmode)
9080 && ix86_binary_operator_ok (XOR, SImode, operands)"
9081 "xor{l}\t{%2, %0|%0, %2}"
9082 [(set_attr "type" "alu")
9083 (set_attr "mode" "SI")])
9085 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
9086 ;; ??? Special case for immediate operand is missing - it is tricky.
9087 (define_insn "*xorsi_2_zext"
9088 [(set (reg FLAGS_REG)
9089 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9090 (match_operand:SI 2 "general_operand" "rim"))
9092 (set (match_operand:DI 0 "register_operand" "=r")
9093 (zero_extend:DI (xor:SI (match_dup 1) (match_dup 2))))]
9094 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9095 && ix86_binary_operator_ok (XOR, SImode, operands)"
9096 "xor{l}\t{%2, %k0|%k0, %2}"
9097 [(set_attr "type" "alu")
9098 (set_attr "mode" "SI")])
9100 (define_insn "*xorsi_2_zext_imm"
9101 [(set (reg FLAGS_REG)
9102 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9103 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
9105 (set (match_operand:DI 0 "register_operand" "=r")
9106 (xor:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
9107 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9108 && ix86_binary_operator_ok (XOR, SImode, operands)"
9109 "xor{l}\t{%2, %k0|%k0, %2}"
9110 [(set_attr "type" "alu")
9111 (set_attr "mode" "SI")])
9113 (define_insn "*xorsi_3"
9114 [(set (reg FLAGS_REG)
9115 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9116 (match_operand:SI 2 "general_operand" "rim"))
9118 (clobber (match_scratch:SI 0 "=r"))]
9119 "ix86_match_ccmode (insn, CCNOmode)
9120 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9121 "xor{l}\t{%2, %0|%0, %2}"
9122 [(set_attr "type" "alu")
9123 (set_attr "mode" "SI")])
9125 (define_expand "xorhi3"
9126 [(set (match_operand:HI 0 "nonimmediate_operand" "")
9127 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
9128 (match_operand:HI 2 "general_operand" "")))
9129 (clobber (reg:CC FLAGS_REG))]
9130 "TARGET_HIMODE_MATH"
9131 "ix86_expand_binary_operator (XOR, HImode, operands); DONE;")
9133 (define_insn "*xorhi_1"
9134 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
9135 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
9136 (match_operand:HI 2 "general_operand" "rmi,ri")))
9137 (clobber (reg:CC FLAGS_REG))]
9138 "ix86_binary_operator_ok (XOR, HImode, operands)"
9139 "xor{w}\t{%2, %0|%0, %2}"
9140 [(set_attr "type" "alu")
9141 (set_attr "mode" "HI")])
9143 (define_insn "*xorhi_2"
9144 [(set (reg FLAGS_REG)
9145 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
9146 (match_operand:HI 2 "general_operand" "rim,ri"))
9148 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
9149 (xor:HI (match_dup 1) (match_dup 2)))]
9150 "ix86_match_ccmode (insn, CCNOmode)
9151 && ix86_binary_operator_ok (XOR, HImode, operands)"
9152 "xor{w}\t{%2, %0|%0, %2}"
9153 [(set_attr "type" "alu")
9154 (set_attr "mode" "HI")])
9156 (define_insn "*xorhi_3"
9157 [(set (reg FLAGS_REG)
9158 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
9159 (match_operand:HI 2 "general_operand" "rim"))
9161 (clobber (match_scratch:HI 0 "=r"))]
9162 "ix86_match_ccmode (insn, CCNOmode)
9163 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9164 "xor{w}\t{%2, %0|%0, %2}"
9165 [(set_attr "type" "alu")
9166 (set_attr "mode" "HI")])
9168 (define_expand "xorqi3"
9169 [(set (match_operand:QI 0 "nonimmediate_operand" "")
9170 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
9171 (match_operand:QI 2 "general_operand" "")))
9172 (clobber (reg:CC FLAGS_REG))]
9173 "TARGET_QIMODE_MATH"
9174 "ix86_expand_binary_operator (XOR, QImode, operands); DONE;")
9176 ;; %%% Potential partial reg stall on alternative 2. What to do?
9177 (define_insn "*xorqi_1"
9178 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
9179 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
9180 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
9181 (clobber (reg:CC FLAGS_REG))]
9182 "ix86_binary_operator_ok (XOR, QImode, operands)"
9184 xor{b}\t{%2, %0|%0, %2}
9185 xor{b}\t{%2, %0|%0, %2}
9186 xor{l}\t{%k2, %k0|%k0, %k2}"
9187 [(set_attr "type" "alu")
9188 (set_attr "mode" "QI,QI,SI")])
9190 (define_insn "*xorqi_1_slp"
9191 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
9192 (xor:QI (match_dup 0)
9193 (match_operand:QI 1 "general_operand" "qi,qmi")))
9194 (clobber (reg:CC FLAGS_REG))]
9195 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9196 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9197 "xor{b}\t{%1, %0|%0, %1}"
9198 [(set_attr "type" "alu1")
9199 (set_attr "mode" "QI")])
9201 (define_insn "xorqi_ext_0"
9202 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9207 (match_operand 1 "ext_register_operand" "0")
9210 (match_operand 2 "const_int_operand" "n")))
9211 (clobber (reg:CC FLAGS_REG))]
9212 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9213 "xor{b}\t{%2, %h0|%h0, %2}"
9214 [(set_attr "type" "alu")
9215 (set_attr "length_immediate" "1")
9216 (set_attr "mode" "QI")])
9218 (define_insn "*xorqi_ext_1"
9219 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9224 (match_operand 1 "ext_register_operand" "0")
9228 (match_operand:QI 2 "general_operand" "Qm"))))
9229 (clobber (reg:CC FLAGS_REG))]
9231 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9232 "xor{b}\t{%2, %h0|%h0, %2}"
9233 [(set_attr "type" "alu")
9234 (set_attr "length_immediate" "0")
9235 (set_attr "mode" "QI")])
9237 (define_insn "*xorqi_ext_1_rex64"
9238 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9243 (match_operand 1 "ext_register_operand" "0")
9247 (match_operand 2 "ext_register_operand" "Q"))))
9248 (clobber (reg:CC FLAGS_REG))]
9250 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9251 "xor{b}\t{%2, %h0|%h0, %2}"
9252 [(set_attr "type" "alu")
9253 (set_attr "length_immediate" "0")
9254 (set_attr "mode" "QI")])
9256 (define_insn "*xorqi_ext_2"
9257 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9261 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
9264 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
9267 (clobber (reg:CC FLAGS_REG))]
9268 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9269 "xor{b}\t{%h2, %h0|%h0, %h2}"
9270 [(set_attr "type" "alu")
9271 (set_attr "length_immediate" "0")
9272 (set_attr "mode" "QI")])
9274 (define_insn "*xorqi_cc_1"
9275 [(set (reg FLAGS_REG)
9277 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
9278 (match_operand:QI 2 "general_operand" "qim,qi"))
9280 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
9281 (xor:QI (match_dup 1) (match_dup 2)))]
9282 "ix86_match_ccmode (insn, CCNOmode)
9283 && ix86_binary_operator_ok (XOR, QImode, operands)"
9284 "xor{b}\t{%2, %0|%0, %2}"
9285 [(set_attr "type" "alu")
9286 (set_attr "mode" "QI")])
9288 (define_insn "*xorqi_2_slp"
9289 [(set (reg FLAGS_REG)
9290 (compare (xor:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
9291 (match_operand:QI 1 "general_operand" "qim,qi"))
9293 (set (strict_low_part (match_dup 0))
9294 (xor:QI (match_dup 0) (match_dup 1)))]
9295 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9296 && ix86_match_ccmode (insn, CCNOmode)
9297 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9298 "xor{b}\t{%1, %0|%0, %1}"
9299 [(set_attr "type" "alu1")
9300 (set_attr "mode" "QI")])
9302 (define_insn "*xorqi_cc_2"
9303 [(set (reg FLAGS_REG)
9305 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
9306 (match_operand:QI 2 "general_operand" "qim"))
9308 (clobber (match_scratch:QI 0 "=q"))]
9309 "ix86_match_ccmode (insn, CCNOmode)
9310 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9311 "xor{b}\t{%2, %0|%0, %2}"
9312 [(set_attr "type" "alu")
9313 (set_attr "mode" "QI")])
9315 (define_insn "*xorqi_cc_ext_1"
9316 [(set (reg FLAGS_REG)
9320 (match_operand 1 "ext_register_operand" "0")
9323 (match_operand:QI 2 "general_operand" "qmn"))
9325 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=q")
9329 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9331 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9332 "xor{b}\t{%2, %h0|%h0, %2}"
9333 [(set_attr "type" "alu")
9334 (set_attr "mode" "QI")])
9336 (define_insn "*xorqi_cc_ext_1_rex64"
9337 [(set (reg FLAGS_REG)
9341 (match_operand 1 "ext_register_operand" "0")
9344 (match_operand:QI 2 "nonmemory_operand" "Qn"))
9346 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9350 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9352 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9353 "xor{b}\t{%2, %h0|%h0, %2}"
9354 [(set_attr "type" "alu")
9355 (set_attr "mode" "QI")])
9357 (define_expand "xorqi_cc_ext_1"
9359 (set (reg:CCNO FLAGS_REG)
9363 (match_operand 1 "ext_register_operand" "")
9366 (match_operand:QI 2 "general_operand" ""))
9368 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "")
9372 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9378 [(set (match_operand 0 "register_operand" "")
9379 (xor (match_operand 1 "register_operand" "")
9380 (match_operand 2 "const_int_operand" "")))
9381 (clobber (reg:CC FLAGS_REG))]
9383 && QI_REG_P (operands[0])
9384 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9385 && !(INTVAL (operands[2]) & ~(255 << 8))
9386 && GET_MODE (operands[0]) != QImode"
9387 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
9388 (xor:SI (zero_extract:SI (match_dup 1)
9389 (const_int 8) (const_int 8))
9391 (clobber (reg:CC FLAGS_REG))])]
9392 "operands[0] = gen_lowpart (SImode, operands[0]);
9393 operands[1] = gen_lowpart (SImode, operands[1]);
9394 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
9396 ;; Since XOR can be encoded with sign extended immediate, this is only
9397 ;; profitable when 7th bit is set.
9399 [(set (match_operand 0 "register_operand" "")
9400 (xor (match_operand 1 "general_operand" "")
9401 (match_operand 2 "const_int_operand" "")))
9402 (clobber (reg:CC FLAGS_REG))]
9404 && ANY_QI_REG_P (operands[0])
9405 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9406 && !(INTVAL (operands[2]) & ~255)
9407 && (INTVAL (operands[2]) & 128)
9408 && GET_MODE (operands[0]) != QImode"
9409 [(parallel [(set (strict_low_part (match_dup 0))
9410 (xor:QI (match_dup 1)
9412 (clobber (reg:CC FLAGS_REG))])]
9413 "operands[0] = gen_lowpart (QImode, operands[0]);
9414 operands[1] = gen_lowpart (QImode, operands[1]);
9415 operands[2] = gen_lowpart (QImode, operands[2]);")
9417 ;; Negation instructions
9419 (define_expand "negdi2"
9420 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
9421 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "")))
9422 (clobber (reg:CC FLAGS_REG))])]
9424 "ix86_expand_unary_operator (NEG, DImode, operands); DONE;")
9426 (define_insn "*negdi2_1"
9427 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
9428 (neg:DI (match_operand:DI 1 "general_operand" "0")))
9429 (clobber (reg:CC FLAGS_REG))]
9431 && ix86_unary_operator_ok (NEG, DImode, operands)"
9435 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9436 (neg:DI (match_operand:DI 1 "general_operand" "")))
9437 (clobber (reg:CC FLAGS_REG))]
9438 "!TARGET_64BIT && reload_completed"
9440 [(set (reg:CCZ FLAGS_REG)
9441 (compare:CCZ (neg:SI (match_dup 2)) (const_int 0)))
9442 (set (match_dup 0) (neg:SI (match_dup 2)))])
9445 (plus:SI (plus:SI (ltu:SI (reg:CC FLAGS_REG) (const_int 0))
9448 (clobber (reg:CC FLAGS_REG))])
9451 (neg:SI (match_dup 1)))
9452 (clobber (reg:CC FLAGS_REG))])]
9453 "split_di (operands+1, 1, operands+2, operands+3);
9454 split_di (operands+0, 1, operands+0, operands+1);")
9456 (define_insn "*negdi2_1_rex64"
9457 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9458 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0")))
9459 (clobber (reg:CC FLAGS_REG))]
9460 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9462 [(set_attr "type" "negnot")
9463 (set_attr "mode" "DI")])
9465 ;; The problem with neg is that it does not perform (compare x 0),
9466 ;; it really performs (compare 0 x), which leaves us with the zero
9467 ;; flag being the only useful item.
9469 (define_insn "*negdi2_cmpz_rex64"
9470 [(set (reg:CCZ FLAGS_REG)
9471 (compare:CCZ (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
9473 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9474 (neg:DI (match_dup 1)))]
9475 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9477 [(set_attr "type" "negnot")
9478 (set_attr "mode" "DI")])
9481 (define_expand "negsi2"
9482 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
9483 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "")))
9484 (clobber (reg:CC FLAGS_REG))])]
9486 "ix86_expand_unary_operator (NEG, SImode, operands); DONE;")
9488 (define_insn "*negsi2_1"
9489 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9490 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))
9491 (clobber (reg:CC FLAGS_REG))]
9492 "ix86_unary_operator_ok (NEG, SImode, operands)"
9494 [(set_attr "type" "negnot")
9495 (set_attr "mode" "SI")])
9497 ;; Combine is quite creative about this pattern.
9498 (define_insn "*negsi2_1_zext"
9499 [(set (match_operand:DI 0 "register_operand" "=r")
9500 (lshiftrt:DI (neg:DI (ashift:DI (match_operand:DI 1 "register_operand" "0")
9503 (clobber (reg:CC FLAGS_REG))]
9504 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9506 [(set_attr "type" "negnot")
9507 (set_attr "mode" "SI")])
9509 ;; The problem with neg is that it does not perform (compare x 0),
9510 ;; it really performs (compare 0 x), which leaves us with the zero
9511 ;; flag being the only useful item.
9513 (define_insn "*negsi2_cmpz"
9514 [(set (reg:CCZ FLAGS_REG)
9515 (compare:CCZ (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
9517 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9518 (neg:SI (match_dup 1)))]
9519 "ix86_unary_operator_ok (NEG, SImode, operands)"
9521 [(set_attr "type" "negnot")
9522 (set_attr "mode" "SI")])
9524 (define_insn "*negsi2_cmpz_zext"
9525 [(set (reg:CCZ FLAGS_REG)
9526 (compare:CCZ (lshiftrt:DI
9528 (match_operand:DI 1 "register_operand" "0")
9532 (set (match_operand:DI 0 "register_operand" "=r")
9533 (lshiftrt:DI (neg:DI (ashift:DI (match_dup 1)
9536 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9538 [(set_attr "type" "negnot")
9539 (set_attr "mode" "SI")])
9541 (define_expand "neghi2"
9542 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
9543 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "")))
9544 (clobber (reg:CC FLAGS_REG))])]
9545 "TARGET_HIMODE_MATH"
9546 "ix86_expand_unary_operator (NEG, HImode, operands); DONE;")
9548 (define_insn "*neghi2_1"
9549 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9550 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))
9551 (clobber (reg:CC FLAGS_REG))]
9552 "ix86_unary_operator_ok (NEG, HImode, operands)"
9554 [(set_attr "type" "negnot")
9555 (set_attr "mode" "HI")])
9557 (define_insn "*neghi2_cmpz"
9558 [(set (reg:CCZ FLAGS_REG)
9559 (compare:CCZ (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
9561 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9562 (neg:HI (match_dup 1)))]
9563 "ix86_unary_operator_ok (NEG, HImode, operands)"
9565 [(set_attr "type" "negnot")
9566 (set_attr "mode" "HI")])
9568 (define_expand "negqi2"
9569 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
9570 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "")))
9571 (clobber (reg:CC FLAGS_REG))])]
9572 "TARGET_QIMODE_MATH"
9573 "ix86_expand_unary_operator (NEG, QImode, operands); DONE;")
9575 (define_insn "*negqi2_1"
9576 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9577 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))
9578 (clobber (reg:CC FLAGS_REG))]
9579 "ix86_unary_operator_ok (NEG, QImode, operands)"
9581 [(set_attr "type" "negnot")
9582 (set_attr "mode" "QI")])
9584 (define_insn "*negqi2_cmpz"
9585 [(set (reg:CCZ FLAGS_REG)
9586 (compare:CCZ (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
9588 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9589 (neg:QI (match_dup 1)))]
9590 "ix86_unary_operator_ok (NEG, QImode, operands)"
9592 [(set_attr "type" "negnot")
9593 (set_attr "mode" "QI")])
9595 ;; Changing of sign for FP values is doable using integer unit too.
9597 (define_expand "negsf2"
9598 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9599 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
9600 "TARGET_80387 || TARGET_SSE_MATH"
9601 "ix86_expand_fp_absneg_operator (NEG, SFmode, operands); DONE;")
9603 (define_expand "abssf2"
9604 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9605 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
9606 "TARGET_80387 || TARGET_SSE_MATH"
9607 "ix86_expand_fp_absneg_operator (ABS, SFmode, operands); DONE;")
9609 (define_insn "*absnegsf2_mixed"
9610 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
9611 (match_operator:SF 3 "absneg_operator"
9612 [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#fr,0 ,0")]))
9613 (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X ,X"))
9614 (clobber (reg:CC FLAGS_REG))]
9615 "TARGET_SSE_MATH && TARGET_MIX_SSE_I387
9616 && ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
9619 (define_insn "*absnegsf2_sse"
9620 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#r,x#r,rm#x")
9621 (match_operator:SF 3 "absneg_operator"
9622 [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#r,0")]))
9623 (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X"))
9624 (clobber (reg:CC FLAGS_REG))]
9626 && ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
9629 (define_insn "*absnegsf2_i387"
9630 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
9631 (match_operator:SF 3 "absneg_operator"
9632 [(match_operand:SF 1 "nonimmediate_operand" "0,0")]))
9633 (use (match_operand 2 "" ""))
9634 (clobber (reg:CC FLAGS_REG))]
9635 "TARGET_80387 && !TARGET_SSE_MATH
9636 && ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
9639 (define_expand "negdf2"
9640 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9641 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
9642 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
9643 "ix86_expand_fp_absneg_operator (NEG, DFmode, operands); DONE;")
9645 (define_expand "absdf2"
9646 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9647 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
9648 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
9649 "ix86_expand_fp_absneg_operator (ABS, DFmode, operands); DONE;")
9651 (define_insn "*absnegdf2_mixed"
9652 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf")
9653 (match_operator:DF 3 "absneg_operator"
9654 [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#fr,0 ,0")]))
9655 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X ,X"))
9656 (clobber (reg:CC FLAGS_REG))]
9657 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
9658 && ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
9661 (define_insn "*absnegdf2_sse"
9662 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#r,Y#r,rm#Y")
9663 (match_operator:DF 3 "absneg_operator"
9664 [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#r,0")]))
9665 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X"))
9666 (clobber (reg:CC FLAGS_REG))]
9667 "TARGET_SSE2 && TARGET_SSE_MATH
9668 && ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
9671 (define_insn "*absnegdf2_i387"
9672 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
9673 (match_operator:DF 3 "absneg_operator"
9674 [(match_operand:DF 1 "nonimmediate_operand" "0,0")]))
9675 (use (match_operand 2 "" ""))
9676 (clobber (reg:CC FLAGS_REG))]
9677 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)
9678 && ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
9681 (define_expand "negxf2"
9682 [(set (match_operand:XF 0 "nonimmediate_operand" "")
9683 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
9685 "ix86_expand_fp_absneg_operator (NEG, XFmode, operands); DONE;")
9687 (define_expand "absxf2"
9688 [(set (match_operand:XF 0 "nonimmediate_operand" "")
9689 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
9691 "ix86_expand_fp_absneg_operator (ABS, XFmode, operands); DONE;")
9693 (define_insn "*absnegxf2_i387"
9694 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
9695 (match_operator:XF 3 "absneg_operator"
9696 [(match_operand:XF 1 "nonimmediate_operand" "0,0")]))
9697 (use (match_operand 2 "" ""))
9698 (clobber (reg:CC FLAGS_REG))]
9700 && ix86_unary_operator_ok (GET_CODE (operands[3]), XFmode, operands)"
9703 ;; Splitters for fp abs and neg.
9706 [(set (match_operand 0 "fp_register_operand" "")
9707 (match_operator 1 "absneg_operator" [(match_dup 0)]))
9708 (use (match_operand 2 "" ""))
9709 (clobber (reg:CC FLAGS_REG))]
9711 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0)]))])
9714 [(set (match_operand 0 "register_operand" "")
9715 (match_operator 3 "absneg_operator"
9716 [(match_operand 1 "register_operand" "")]))
9717 (use (match_operand 2 "nonimmediate_operand" ""))
9718 (clobber (reg:CC FLAGS_REG))]
9719 "reload_completed && SSE_REG_P (operands[0])"
9720 [(set (match_dup 0) (match_dup 3))]
9722 enum machine_mode mode = GET_MODE (operands[0]);
9723 enum machine_mode vmode = GET_MODE (operands[2]);
9726 operands[0] = simplify_gen_subreg (vmode, operands[0], mode, 0);
9727 operands[1] = simplify_gen_subreg (vmode, operands[1], mode, 0);
9728 if (operands_match_p (operands[0], operands[2]))
9731 operands[1] = operands[2];
9734 if (GET_CODE (operands[3]) == ABS)
9735 tmp = gen_rtx_AND (vmode, operands[1], operands[2]);
9737 tmp = gen_rtx_XOR (vmode, operands[1], operands[2]);
9742 [(set (match_operand:SF 0 "register_operand" "")
9743 (match_operator:SF 1 "absneg_operator" [(match_dup 0)]))
9744 (use (match_operand:V4SF 2 "" ""))
9745 (clobber (reg:CC FLAGS_REG))]
9747 [(parallel [(set (match_dup 0) (match_dup 1))
9748 (clobber (reg:CC FLAGS_REG))])]
9751 operands[0] = gen_lowpart (SImode, operands[0]);
9752 if (GET_CODE (operands[1]) == ABS)
9754 tmp = gen_int_mode (0x7fffffff, SImode);
9755 tmp = gen_rtx_AND (SImode, operands[0], tmp);
9759 tmp = gen_int_mode (0x80000000, SImode);
9760 tmp = gen_rtx_XOR (SImode, operands[0], tmp);
9766 [(set (match_operand:DF 0 "register_operand" "")
9767 (match_operator:DF 1 "absneg_operator" [(match_dup 0)]))
9768 (use (match_operand 2 "" ""))
9769 (clobber (reg:CC FLAGS_REG))]
9771 [(parallel [(set (match_dup 0) (match_dup 1))
9772 (clobber (reg:CC FLAGS_REG))])]
9777 tmp = gen_lowpart (DImode, operands[0]);
9778 tmp = gen_rtx_ZERO_EXTRACT (DImode, tmp, const1_rtx, GEN_INT (63));
9781 if (GET_CODE (operands[1]) == ABS)
9784 tmp = gen_rtx_NOT (DImode, tmp);
9788 operands[0] = gen_highpart (SImode, operands[0]);
9789 if (GET_CODE (operands[1]) == ABS)
9791 tmp = gen_int_mode (0x7fffffff, SImode);
9792 tmp = gen_rtx_AND (SImode, operands[0], tmp);
9796 tmp = gen_int_mode (0x80000000, SImode);
9797 tmp = gen_rtx_XOR (SImode, operands[0], tmp);
9804 [(set (match_operand:XF 0 "register_operand" "")
9805 (match_operator:XF 1 "absneg_operator" [(match_dup 0)]))
9806 (use (match_operand 2 "" ""))
9807 (clobber (reg:CC FLAGS_REG))]
9809 [(parallel [(set (match_dup 0) (match_dup 1))
9810 (clobber (reg:CC FLAGS_REG))])]
9813 operands[0] = gen_rtx_REG (SImode,
9814 true_regnum (operands[0])
9815 + (TARGET_64BIT ? 1 : 2));
9816 if (GET_CODE (operands[1]) == ABS)
9818 tmp = GEN_INT (0x7fff);
9819 tmp = gen_rtx_AND (SImode, operands[0], tmp);
9823 tmp = GEN_INT (0x8000);
9824 tmp = gen_rtx_XOR (SImode, operands[0], tmp);
9830 [(set (match_operand 0 "memory_operand" "")
9831 (match_operator 1 "absneg_operator" [(match_dup 0)]))
9832 (use (match_operand 2 "" ""))
9833 (clobber (reg:CC FLAGS_REG))]
9835 [(parallel [(set (match_dup 0) (match_dup 1))
9836 (clobber (reg:CC FLAGS_REG))])]
9838 enum machine_mode mode = GET_MODE (operands[0]);
9839 int size = mode == XFmode ? 10 : GET_MODE_SIZE (mode);
9842 operands[0] = adjust_address (operands[0], QImode, size - 1);
9843 if (GET_CODE (operands[1]) == ABS)
9845 tmp = gen_int_mode (0x7f, QImode);
9846 tmp = gen_rtx_AND (QImode, operands[0], tmp);
9850 tmp = gen_int_mode (0x80, QImode);
9851 tmp = gen_rtx_XOR (QImode, operands[0], tmp);
9856 ;; Conditionalize these after reload. If they match before reload, we
9857 ;; lose the clobber and ability to use integer instructions.
9859 (define_insn "*negsf2_1"
9860 [(set (match_operand:SF 0 "register_operand" "=f")
9861 (neg:SF (match_operand:SF 1 "register_operand" "0")))]
9862 "TARGET_80387 && reload_completed"
9864 [(set_attr "type" "fsgn")
9865 (set_attr "mode" "SF")])
9867 (define_insn "*negdf2_1"
9868 [(set (match_operand:DF 0 "register_operand" "=f")
9869 (neg:DF (match_operand:DF 1 "register_operand" "0")))]
9870 "TARGET_80387 && reload_completed"
9872 [(set_attr "type" "fsgn")
9873 (set_attr "mode" "DF")])
9875 (define_insn "*negxf2_1"
9876 [(set (match_operand:XF 0 "register_operand" "=f")
9877 (neg:XF (match_operand:XF 1 "register_operand" "0")))]
9878 "TARGET_80387 && reload_completed"
9880 [(set_attr "type" "fsgn")
9881 (set_attr "mode" "XF")])
9883 (define_insn "*abssf2_1"
9884 [(set (match_operand:SF 0 "register_operand" "=f")
9885 (abs:SF (match_operand:SF 1 "register_operand" "0")))]
9886 "TARGET_80387 && reload_completed"
9888 [(set_attr "type" "fsgn")
9889 (set_attr "mode" "SF")])
9891 (define_insn "*absdf2_1"
9892 [(set (match_operand:DF 0 "register_operand" "=f")
9893 (abs:DF (match_operand:DF 1 "register_operand" "0")))]
9894 "TARGET_80387 && reload_completed"
9896 [(set_attr "type" "fsgn")
9897 (set_attr "mode" "DF")])
9899 (define_insn "*absxf2_1"
9900 [(set (match_operand:XF 0 "register_operand" "=f")
9901 (abs:XF (match_operand:XF 1 "register_operand" "0")))]
9902 "TARGET_80387 && reload_completed"
9904 [(set_attr "type" "fsgn")
9905 (set_attr "mode" "DF")])
9907 (define_insn "*negextendsfdf2"
9908 [(set (match_operand:DF 0 "register_operand" "=f")
9909 (neg:DF (float_extend:DF
9910 (match_operand:SF 1 "register_operand" "0"))))]
9911 "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)"
9913 [(set_attr "type" "fsgn")
9914 (set_attr "mode" "DF")])
9916 (define_insn "*negextenddfxf2"
9917 [(set (match_operand:XF 0 "register_operand" "=f")
9918 (neg:XF (float_extend:XF
9919 (match_operand:DF 1 "register_operand" "0"))))]
9922 [(set_attr "type" "fsgn")
9923 (set_attr "mode" "XF")])
9925 (define_insn "*negextendsfxf2"
9926 [(set (match_operand:XF 0 "register_operand" "=f")
9927 (neg:XF (float_extend:XF
9928 (match_operand:SF 1 "register_operand" "0"))))]
9931 [(set_attr "type" "fsgn")
9932 (set_attr "mode" "XF")])
9934 (define_insn "*absextendsfdf2"
9935 [(set (match_operand:DF 0 "register_operand" "=f")
9936 (abs:DF (float_extend:DF
9937 (match_operand:SF 1 "register_operand" "0"))))]
9938 "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)"
9940 [(set_attr "type" "fsgn")
9941 (set_attr "mode" "DF")])
9943 (define_insn "*absextenddfxf2"
9944 [(set (match_operand:XF 0 "register_operand" "=f")
9945 (abs:XF (float_extend:XF
9946 (match_operand:DF 1 "register_operand" "0"))))]
9949 [(set_attr "type" "fsgn")
9950 (set_attr "mode" "XF")])
9952 (define_insn "*absextendsfxf2"
9953 [(set (match_operand:XF 0 "register_operand" "=f")
9954 (abs:XF (float_extend:XF
9955 (match_operand:SF 1 "register_operand" "0"))))]
9958 [(set_attr "type" "fsgn")
9959 (set_attr "mode" "XF")])
9961 ;; One complement instructions
9963 (define_expand "one_cmpldi2"
9964 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9965 (not:DI (match_operand:DI 1 "nonimmediate_operand" "")))]
9967 "ix86_expand_unary_operator (NOT, DImode, operands); DONE;")
9969 (define_insn "*one_cmpldi2_1_rex64"
9970 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9971 (not:DI (match_operand:DI 1 "nonimmediate_operand" "0")))]
9972 "TARGET_64BIT && ix86_unary_operator_ok (NOT, DImode, operands)"
9974 [(set_attr "type" "negnot")
9975 (set_attr "mode" "DI")])
9977 (define_insn "*one_cmpldi2_2_rex64"
9978 [(set (reg FLAGS_REG)
9979 (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
9981 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9982 (not:DI (match_dup 1)))]
9983 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9984 && ix86_unary_operator_ok (NOT, DImode, operands)"
9986 [(set_attr "type" "alu1")
9987 (set_attr "mode" "DI")])
9990 [(set (match_operand 0 "flags_reg_operand" "")
9991 (match_operator 2 "compare_operator"
9992 [(not:DI (match_operand:DI 3 "nonimmediate_operand" ""))
9994 (set (match_operand:DI 1 "nonimmediate_operand" "")
9995 (not:DI (match_dup 3)))]
9996 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9997 [(parallel [(set (match_dup 0)
9999 [(xor:DI (match_dup 3) (const_int -1))
10002 (xor:DI (match_dup 3) (const_int -1)))])]
10005 (define_expand "one_cmplsi2"
10006 [(set (match_operand:SI 0 "nonimmediate_operand" "")
10007 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
10009 "ix86_expand_unary_operator (NOT, SImode, operands); DONE;")
10011 (define_insn "*one_cmplsi2_1"
10012 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10013 (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
10014 "ix86_unary_operator_ok (NOT, SImode, operands)"
10016 [(set_attr "type" "negnot")
10017 (set_attr "mode" "SI")])
10019 ;; ??? Currently never generated - xor is used instead.
10020 (define_insn "*one_cmplsi2_1_zext"
10021 [(set (match_operand:DI 0 "register_operand" "=r")
10022 (zero_extend:DI (not:SI (match_operand:SI 1 "register_operand" "0"))))]
10023 "TARGET_64BIT && ix86_unary_operator_ok (NOT, SImode, operands)"
10025 [(set_attr "type" "negnot")
10026 (set_attr "mode" "SI")])
10028 (define_insn "*one_cmplsi2_2"
10029 [(set (reg FLAGS_REG)
10030 (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
10032 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10033 (not:SI (match_dup 1)))]
10034 "ix86_match_ccmode (insn, CCNOmode)
10035 && ix86_unary_operator_ok (NOT, SImode, operands)"
10037 [(set_attr "type" "alu1")
10038 (set_attr "mode" "SI")])
10041 [(set (match_operand 0 "flags_reg_operand" "")
10042 (match_operator 2 "compare_operator"
10043 [(not:SI (match_operand:SI 3 "nonimmediate_operand" ""))
10045 (set (match_operand:SI 1 "nonimmediate_operand" "")
10046 (not:SI (match_dup 3)))]
10047 "ix86_match_ccmode (insn, CCNOmode)"
10048 [(parallel [(set (match_dup 0)
10049 (match_op_dup 2 [(xor:SI (match_dup 3) (const_int -1))
10052 (xor:SI (match_dup 3) (const_int -1)))])]
10055 ;; ??? Currently never generated - xor is used instead.
10056 (define_insn "*one_cmplsi2_2_zext"
10057 [(set (reg FLAGS_REG)
10058 (compare (not:SI (match_operand:SI 1 "register_operand" "0"))
10060 (set (match_operand:DI 0 "register_operand" "=r")
10061 (zero_extend:DI (not:SI (match_dup 1))))]
10062 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
10063 && ix86_unary_operator_ok (NOT, SImode, operands)"
10065 [(set_attr "type" "alu1")
10066 (set_attr "mode" "SI")])
10069 [(set (match_operand 0 "flags_reg_operand" "")
10070 (match_operator 2 "compare_operator"
10071 [(not:SI (match_operand:SI 3 "register_operand" ""))
10073 (set (match_operand:DI 1 "register_operand" "")
10074 (zero_extend:DI (not:SI (match_dup 3))))]
10075 "ix86_match_ccmode (insn, CCNOmode)"
10076 [(parallel [(set (match_dup 0)
10077 (match_op_dup 2 [(xor:SI (match_dup 3) (const_int -1))
10080 (zero_extend:DI (xor:SI (match_dup 3) (const_int -1))))])]
10083 (define_expand "one_cmplhi2"
10084 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10085 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
10086 "TARGET_HIMODE_MATH"
10087 "ix86_expand_unary_operator (NOT, HImode, operands); DONE;")
10089 (define_insn "*one_cmplhi2_1"
10090 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10091 (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
10092 "ix86_unary_operator_ok (NOT, HImode, operands)"
10094 [(set_attr "type" "negnot")
10095 (set_attr "mode" "HI")])
10097 (define_insn "*one_cmplhi2_2"
10098 [(set (reg FLAGS_REG)
10099 (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
10101 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10102 (not:HI (match_dup 1)))]
10103 "ix86_match_ccmode (insn, CCNOmode)
10104 && ix86_unary_operator_ok (NEG, HImode, operands)"
10106 [(set_attr "type" "alu1")
10107 (set_attr "mode" "HI")])
10110 [(set (match_operand 0 "flags_reg_operand" "")
10111 (match_operator 2 "compare_operator"
10112 [(not:HI (match_operand:HI 3 "nonimmediate_operand" ""))
10114 (set (match_operand:HI 1 "nonimmediate_operand" "")
10115 (not:HI (match_dup 3)))]
10116 "ix86_match_ccmode (insn, CCNOmode)"
10117 [(parallel [(set (match_dup 0)
10118 (match_op_dup 2 [(xor:HI (match_dup 3) (const_int -1))
10121 (xor:HI (match_dup 3) (const_int -1)))])]
10124 ;; %%% Potential partial reg stall on alternative 1. What to do?
10125 (define_expand "one_cmplqi2"
10126 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10127 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
10128 "TARGET_QIMODE_MATH"
10129 "ix86_expand_unary_operator (NOT, QImode, operands); DONE;")
10131 (define_insn "*one_cmplqi2_1"
10132 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10133 (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
10134 "ix86_unary_operator_ok (NOT, QImode, operands)"
10138 [(set_attr "type" "negnot")
10139 (set_attr "mode" "QI,SI")])
10141 (define_insn "*one_cmplqi2_2"
10142 [(set (reg FLAGS_REG)
10143 (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
10145 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
10146 (not:QI (match_dup 1)))]
10147 "ix86_match_ccmode (insn, CCNOmode)
10148 && ix86_unary_operator_ok (NOT, QImode, operands)"
10150 [(set_attr "type" "alu1")
10151 (set_attr "mode" "QI")])
10154 [(set (match_operand 0 "flags_reg_operand" "")
10155 (match_operator 2 "compare_operator"
10156 [(not:QI (match_operand:QI 3 "nonimmediate_operand" ""))
10158 (set (match_operand:QI 1 "nonimmediate_operand" "")
10159 (not:QI (match_dup 3)))]
10160 "ix86_match_ccmode (insn, CCNOmode)"
10161 [(parallel [(set (match_dup 0)
10162 (match_op_dup 2 [(xor:QI (match_dup 3) (const_int -1))
10165 (xor:QI (match_dup 3) (const_int -1)))])]
10168 ;; Arithmetic shift instructions
10170 ;; DImode shifts are implemented using the i386 "shift double" opcode,
10171 ;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count
10172 ;; is variable, then the count is in %cl and the "imm" operand is dropped
10173 ;; from the assembler input.
10175 ;; This instruction shifts the target reg/mem as usual, but instead of
10176 ;; shifting in zeros, bits are shifted in from reg operand. If the insn
10177 ;; is a left shift double, bits are taken from the high order bits of
10178 ;; reg, else if the insn is a shift right double, bits are taken from the
10179 ;; low order bits of reg. So if %eax is "1234" and %edx is "5678",
10180 ;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345".
10182 ;; Since sh[lr]d does not change the `reg' operand, that is done
10183 ;; separately, making all shifts emit pairs of shift double and normal
10184 ;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to
10185 ;; support a 63 bit shift, each shift where the count is in a reg expands
10186 ;; to a pair of shifts, a branch, a shift by 32 and a label.
10188 ;; If the shift count is a constant, we need never emit more than one
10189 ;; shift pair, instead using moves and sign extension for counts greater
10192 (define_expand "ashldi3"
10193 [(set (match_operand:DI 0 "shiftdi_operand" "")
10194 (ashift:DI (match_operand:DI 1 "ashldi_input_operand" "")
10195 (match_operand:QI 2 "nonmemory_operand" "")))]
10197 "ix86_expand_binary_operator (ASHIFT, DImode, operands); DONE;")
10199 (define_insn "*ashldi3_1_rex64"
10200 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
10201 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0,l")
10202 (match_operand:QI 2 "nonmemory_operand" "cJ,M")))
10203 (clobber (reg:CC FLAGS_REG))]
10204 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10206 switch (get_attr_type (insn))
10209 if (operands[2] != const1_rtx)
10211 if (!rtx_equal_p (operands[0], operands[1]))
10213 return "add{q}\t{%0, %0|%0, %0}";
10216 if (GET_CODE (operands[2]) != CONST_INT
10217 || (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 3)
10219 operands[1] = gen_rtx_MULT (DImode, operands[1],
10220 GEN_INT (1 << INTVAL (operands[2])));
10221 return "lea{q}\t{%a1, %0|%0, %a1}";
10224 if (REG_P (operands[2]))
10225 return "sal{q}\t{%b2, %0|%0, %b2}";
10226 else if (operands[2] == const1_rtx
10227 && (TARGET_SHIFT1 || optimize_size))
10228 return "sal{q}\t%0";
10230 return "sal{q}\t{%2, %0|%0, %2}";
10233 [(set (attr "type")
10234 (cond [(eq_attr "alternative" "1")
10235 (const_string "lea")
10236 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10238 (match_operand 0 "register_operand" ""))
10239 (match_operand 2 "const1_operand" ""))
10240 (const_string "alu")
10242 (const_string "ishift")))
10243 (set_attr "mode" "DI")])
10245 ;; Convert lea to the lea pattern to avoid flags dependency.
10247 [(set (match_operand:DI 0 "register_operand" "")
10248 (ashift:DI (match_operand:DI 1 "index_register_operand" "")
10249 (match_operand:QI 2 "immediate_operand" "")))
10250 (clobber (reg:CC FLAGS_REG))]
10251 "TARGET_64BIT && reload_completed
10252 && true_regnum (operands[0]) != true_regnum (operands[1])"
10253 [(set (match_dup 0)
10254 (mult:DI (match_dup 1)
10256 "operands[2] = gen_int_mode (1 << INTVAL (operands[2]), DImode);")
10258 ;; This pattern can't accept a variable shift count, since shifts by
10259 ;; zero don't affect the flags. We assume that shifts by constant
10260 ;; zero are optimized away.
10261 (define_insn "*ashldi3_cmp_rex64"
10262 [(set (reg FLAGS_REG)
10264 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10265 (match_operand:QI 2 "immediate_operand" "e"))
10267 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10268 (ashift:DI (match_dup 1) (match_dup 2)))]
10269 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10270 && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10272 switch (get_attr_type (insn))
10275 if (operands[2] != const1_rtx)
10277 return "add{q}\t{%0, %0|%0, %0}";
10280 if (REG_P (operands[2]))
10281 return "sal{q}\t{%b2, %0|%0, %b2}";
10282 else if (operands[2] == const1_rtx
10283 && (TARGET_SHIFT1 || optimize_size))
10284 return "sal{q}\t%0";
10286 return "sal{q}\t{%2, %0|%0, %2}";
10289 [(set (attr "type")
10290 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10292 (match_operand 0 "register_operand" ""))
10293 (match_operand 2 "const1_operand" ""))
10294 (const_string "alu")
10296 (const_string "ishift")))
10297 (set_attr "mode" "DI")])
10299 (define_insn "*ashldi3_1"
10300 [(set (match_operand:DI 0 "register_operand" "=&r,r")
10301 (ashift:DI (match_operand:DI 1 "reg_or_pm1_operand" "n,0")
10302 (match_operand:QI 2 "nonmemory_operand" "Jc,Jc")))
10303 (clobber (reg:CC FLAGS_REG))]
10306 [(set_attr "type" "multi")])
10308 ;; By default we don't ask for a scratch register, because when DImode
10309 ;; values are manipulated, registers are already at a premium. But if
10310 ;; we have one handy, we won't turn it away.
10312 [(match_scratch:SI 3 "r")
10313 (parallel [(set (match_operand:DI 0 "register_operand" "")
10314 (ashift:DI (match_operand:DI 1 "nonmemory_operand" "")
10315 (match_operand:QI 2 "nonmemory_operand" "")))
10316 (clobber (reg:CC FLAGS_REG))])
10318 "!TARGET_64BIT && TARGET_CMOVE"
10320 "ix86_split_ashldi (operands, operands[3]); DONE;")
10323 [(set (match_operand:DI 0 "register_operand" "")
10324 (ashift:DI (match_operand:DI 1 "nonmemory_operand" "")
10325 (match_operand:QI 2 "nonmemory_operand" "")))
10326 (clobber (reg:CC FLAGS_REG))]
10327 "!TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)"
10329 "ix86_split_ashldi (operands, NULL_RTX); DONE;")
10331 (define_insn "x86_shld_1"
10332 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
10333 (ior:SI (ashift:SI (match_dup 0)
10334 (match_operand:QI 2 "nonmemory_operand" "I,c"))
10335 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
10336 (minus:QI (const_int 32) (match_dup 2)))))
10337 (clobber (reg:CC FLAGS_REG))]
10340 shld{l}\t{%2, %1, %0|%0, %1, %2}
10341 shld{l}\t{%s2%1, %0|%0, %1, %2}"
10342 [(set_attr "type" "ishift")
10343 (set_attr "prefix_0f" "1")
10344 (set_attr "mode" "SI")
10345 (set_attr "pent_pair" "np")
10346 (set_attr "athlon_decode" "vector")])
10348 (define_expand "x86_shift_adj_1"
10349 [(set (reg:CCZ FLAGS_REG)
10350 (compare:CCZ (and:QI (match_operand:QI 2 "register_operand" "")
10353 (set (match_operand:SI 0 "register_operand" "")
10354 (if_then_else:SI (ne (reg:CCZ FLAGS_REG) (const_int 0))
10355 (match_operand:SI 1 "register_operand" "")
10358 (if_then_else:SI (ne (reg:CCZ FLAGS_REG) (const_int 0))
10359 (match_operand:SI 3 "register_operand" "r")
10364 (define_expand "x86_shift_adj_2"
10365 [(use (match_operand:SI 0 "register_operand" ""))
10366 (use (match_operand:SI 1 "register_operand" ""))
10367 (use (match_operand:QI 2 "register_operand" ""))]
10370 rtx label = gen_label_rtx ();
10373 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
10375 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
10376 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
10377 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
10378 gen_rtx_LABEL_REF (VOIDmode, label),
10380 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
10381 JUMP_LABEL (tmp) = label;
10383 emit_move_insn (operands[0], operands[1]);
10384 ix86_expand_clear (operands[1]);
10386 emit_label (label);
10387 LABEL_NUSES (label) = 1;
10392 (define_expand "ashlsi3"
10393 [(set (match_operand:SI 0 "nonimmediate_operand" "")
10394 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "")
10395 (match_operand:QI 2 "nonmemory_operand" "")))
10396 (clobber (reg:CC FLAGS_REG))]
10398 "ix86_expand_binary_operator (ASHIFT, SImode, operands); DONE;")
10400 (define_insn "*ashlsi3_1"
10401 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
10402 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,l")
10403 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
10404 (clobber (reg:CC FLAGS_REG))]
10405 "ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10407 switch (get_attr_type (insn))
10410 if (operands[2] != const1_rtx)
10412 if (!rtx_equal_p (operands[0], operands[1]))
10414 return "add{l}\t{%0, %0|%0, %0}";
10420 if (REG_P (operands[2]))
10421 return "sal{l}\t{%b2, %0|%0, %b2}";
10422 else if (operands[2] == const1_rtx
10423 && (TARGET_SHIFT1 || optimize_size))
10424 return "sal{l}\t%0";
10426 return "sal{l}\t{%2, %0|%0, %2}";
10429 [(set (attr "type")
10430 (cond [(eq_attr "alternative" "1")
10431 (const_string "lea")
10432 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10434 (match_operand 0 "register_operand" ""))
10435 (match_operand 2 "const1_operand" ""))
10436 (const_string "alu")
10438 (const_string "ishift")))
10439 (set_attr "mode" "SI")])
10441 ;; Convert lea to the lea pattern to avoid flags dependency.
10443 [(set (match_operand 0 "register_operand" "")
10444 (ashift (match_operand 1 "index_register_operand" "")
10445 (match_operand:QI 2 "const_int_operand" "")))
10446 (clobber (reg:CC FLAGS_REG))]
10448 && true_regnum (operands[0]) != true_regnum (operands[1])
10449 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 4"
10453 enum machine_mode mode = GET_MODE (operands[0]);
10455 if (GET_MODE_SIZE (mode) < 4)
10456 operands[0] = gen_lowpart (SImode, operands[0]);
10458 operands[1] = gen_lowpart (Pmode, operands[1]);
10459 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
10461 pat = gen_rtx_MULT (Pmode, operands[1], operands[2]);
10462 if (Pmode != SImode)
10463 pat = gen_rtx_SUBREG (SImode, pat, 0);
10464 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
10468 ;; Rare case of shifting RSP is handled by generating move and shift
10470 [(set (match_operand 0 "register_operand" "")
10471 (ashift (match_operand 1 "register_operand" "")
10472 (match_operand:QI 2 "const_int_operand" "")))
10473 (clobber (reg:CC FLAGS_REG))]
10475 && true_regnum (operands[0]) != true_regnum (operands[1])"
10479 emit_move_insn (operands[1], operands[0]);
10480 pat = gen_rtx_SET (VOIDmode, operands[0],
10481 gen_rtx_ASHIFT (GET_MODE (operands[0]),
10482 operands[0], operands[2]));
10483 clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
10484 emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, pat, clob)));
10488 (define_insn "*ashlsi3_1_zext"
10489 [(set (match_operand:DI 0 "register_operand" "=r,r")
10490 (zero_extend:DI (ashift:SI (match_operand:SI 1 "register_operand" "0,l")
10491 (match_operand:QI 2 "nonmemory_operand" "cI,M"))))
10492 (clobber (reg:CC FLAGS_REG))]
10493 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10495 switch (get_attr_type (insn))
10498 if (operands[2] != const1_rtx)
10500 return "add{l}\t{%k0, %k0|%k0, %k0}";
10506 if (REG_P (operands[2]))
10507 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10508 else if (operands[2] == const1_rtx
10509 && (TARGET_SHIFT1 || optimize_size))
10510 return "sal{l}\t%k0";
10512 return "sal{l}\t{%2, %k0|%k0, %2}";
10515 [(set (attr "type")
10516 (cond [(eq_attr "alternative" "1")
10517 (const_string "lea")
10518 (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10520 (match_operand 2 "const1_operand" ""))
10521 (const_string "alu")
10523 (const_string "ishift")))
10524 (set_attr "mode" "SI")])
10526 ;; Convert lea to the lea pattern to avoid flags dependency.
10528 [(set (match_operand:DI 0 "register_operand" "")
10529 (zero_extend:DI (ashift (match_operand 1 "register_operand" "")
10530 (match_operand:QI 2 "const_int_operand" ""))))
10531 (clobber (reg:CC FLAGS_REG))]
10532 "TARGET_64BIT && reload_completed
10533 && true_regnum (operands[0]) != true_regnum (operands[1])"
10534 [(set (match_dup 0) (zero_extend:DI
10535 (subreg:SI (mult:SI (match_dup 1)
10536 (match_dup 2)) 0)))]
10538 operands[1] = gen_lowpart (Pmode, operands[1]);
10539 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
10542 ;; This pattern can't accept a variable shift count, since shifts by
10543 ;; zero don't affect the flags. We assume that shifts by constant
10544 ;; zero are optimized away.
10545 (define_insn "*ashlsi3_cmp"
10546 [(set (reg FLAGS_REG)
10548 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
10549 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10551 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10552 (ashift:SI (match_dup 1) (match_dup 2)))]
10553 "ix86_match_ccmode (insn, CCGOCmode)
10554 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10556 switch (get_attr_type (insn))
10559 if (operands[2] != const1_rtx)
10561 return "add{l}\t{%0, %0|%0, %0}";
10564 if (REG_P (operands[2]))
10565 return "sal{l}\t{%b2, %0|%0, %b2}";
10566 else if (operands[2] == const1_rtx
10567 && (TARGET_SHIFT1 || optimize_size))
10568 return "sal{l}\t%0";
10570 return "sal{l}\t{%2, %0|%0, %2}";
10573 [(set (attr "type")
10574 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10576 (match_operand 0 "register_operand" ""))
10577 (match_operand 2 "const1_operand" ""))
10578 (const_string "alu")
10580 (const_string "ishift")))
10581 (set_attr "mode" "SI")])
10583 (define_insn "*ashlsi3_cmp_zext"
10584 [(set (reg FLAGS_REG)
10586 (ashift:SI (match_operand:SI 1 "register_operand" "0")
10587 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10589 (set (match_operand:DI 0 "register_operand" "=r")
10590 (zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))]
10591 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10592 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10594 switch (get_attr_type (insn))
10597 if (operands[2] != const1_rtx)
10599 return "add{l}\t{%k0, %k0|%k0, %k0}";
10602 if (REG_P (operands[2]))
10603 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10604 else if (operands[2] == const1_rtx
10605 && (TARGET_SHIFT1 || optimize_size))
10606 return "sal{l}\t%k0";
10608 return "sal{l}\t{%2, %k0|%k0, %2}";
10611 [(set (attr "type")
10612 (cond [(and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10614 (match_operand 2 "const1_operand" ""))
10615 (const_string "alu")
10617 (const_string "ishift")))
10618 (set_attr "mode" "SI")])
10620 (define_expand "ashlhi3"
10621 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10622 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "")
10623 (match_operand:QI 2 "nonmemory_operand" "")))
10624 (clobber (reg:CC FLAGS_REG))]
10625 "TARGET_HIMODE_MATH"
10626 "ix86_expand_binary_operator (ASHIFT, HImode, operands); DONE;")
10628 (define_insn "*ashlhi3_1_lea"
10629 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
10630 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,l")
10631 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
10632 (clobber (reg:CC FLAGS_REG))]
10633 "!TARGET_PARTIAL_REG_STALL
10634 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10636 switch (get_attr_type (insn))
10641 if (operands[2] != const1_rtx)
10643 return "add{w}\t{%0, %0|%0, %0}";
10646 if (REG_P (operands[2]))
10647 return "sal{w}\t{%b2, %0|%0, %b2}";
10648 else if (operands[2] == const1_rtx
10649 && (TARGET_SHIFT1 || optimize_size))
10650 return "sal{w}\t%0";
10652 return "sal{w}\t{%2, %0|%0, %2}";
10655 [(set (attr "type")
10656 (cond [(eq_attr "alternative" "1")
10657 (const_string "lea")
10658 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10660 (match_operand 0 "register_operand" ""))
10661 (match_operand 2 "const1_operand" ""))
10662 (const_string "alu")
10664 (const_string "ishift")))
10665 (set_attr "mode" "HI,SI")])
10667 (define_insn "*ashlhi3_1"
10668 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10669 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
10670 (match_operand:QI 2 "nonmemory_operand" "cI")))
10671 (clobber (reg:CC FLAGS_REG))]
10672 "TARGET_PARTIAL_REG_STALL
10673 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10675 switch (get_attr_type (insn))
10678 if (operands[2] != const1_rtx)
10680 return "add{w}\t{%0, %0|%0, %0}";
10683 if (REG_P (operands[2]))
10684 return "sal{w}\t{%b2, %0|%0, %b2}";
10685 else if (operands[2] == const1_rtx
10686 && (TARGET_SHIFT1 || optimize_size))
10687 return "sal{w}\t%0";
10689 return "sal{w}\t{%2, %0|%0, %2}";
10692 [(set (attr "type")
10693 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10695 (match_operand 0 "register_operand" ""))
10696 (match_operand 2 "const1_operand" ""))
10697 (const_string "alu")
10699 (const_string "ishift")))
10700 (set_attr "mode" "HI")])
10702 ;; This pattern can't accept a variable shift count, since shifts by
10703 ;; zero don't affect the flags. We assume that shifts by constant
10704 ;; zero are optimized away.
10705 (define_insn "*ashlhi3_cmp"
10706 [(set (reg FLAGS_REG)
10708 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
10709 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10711 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10712 (ashift:HI (match_dup 1) (match_dup 2)))]
10713 "ix86_match_ccmode (insn, CCGOCmode)
10714 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10716 switch (get_attr_type (insn))
10719 if (operands[2] != const1_rtx)
10721 return "add{w}\t{%0, %0|%0, %0}";
10724 if (REG_P (operands[2]))
10725 return "sal{w}\t{%b2, %0|%0, %b2}";
10726 else if (operands[2] == const1_rtx
10727 && (TARGET_SHIFT1 || optimize_size))
10728 return "sal{w}\t%0";
10730 return "sal{w}\t{%2, %0|%0, %2}";
10733 [(set (attr "type")
10734 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10736 (match_operand 0 "register_operand" ""))
10737 (match_operand 2 "const1_operand" ""))
10738 (const_string "alu")
10740 (const_string "ishift")))
10741 (set_attr "mode" "HI")])
10743 (define_expand "ashlqi3"
10744 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10745 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "")
10746 (match_operand:QI 2 "nonmemory_operand" "")))
10747 (clobber (reg:CC FLAGS_REG))]
10748 "TARGET_QIMODE_MATH"
10749 "ix86_expand_binary_operator (ASHIFT, QImode, operands); DONE;")
10751 ;; %%% Potential partial reg stall on alternative 2. What to do?
10753 (define_insn "*ashlqi3_1_lea"
10754 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,r")
10755 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,l")
10756 (match_operand:QI 2 "nonmemory_operand" "cI,cI,M")))
10757 (clobber (reg:CC FLAGS_REG))]
10758 "!TARGET_PARTIAL_REG_STALL
10759 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10761 switch (get_attr_type (insn))
10766 if (operands[2] != const1_rtx)
10768 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
10769 return "add{l}\t{%k0, %k0|%k0, %k0}";
10771 return "add{b}\t{%0, %0|%0, %0}";
10774 if (REG_P (operands[2]))
10776 if (get_attr_mode (insn) == MODE_SI)
10777 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10779 return "sal{b}\t{%b2, %0|%0, %b2}";
10781 else if (operands[2] == const1_rtx
10782 && (TARGET_SHIFT1 || optimize_size))
10784 if (get_attr_mode (insn) == MODE_SI)
10785 return "sal{l}\t%0";
10787 return "sal{b}\t%0";
10791 if (get_attr_mode (insn) == MODE_SI)
10792 return "sal{l}\t{%2, %k0|%k0, %2}";
10794 return "sal{b}\t{%2, %0|%0, %2}";
10798 [(set (attr "type")
10799 (cond [(eq_attr "alternative" "2")
10800 (const_string "lea")
10801 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10803 (match_operand 0 "register_operand" ""))
10804 (match_operand 2 "const1_operand" ""))
10805 (const_string "alu")
10807 (const_string "ishift")))
10808 (set_attr "mode" "QI,SI,SI")])
10810 (define_insn "*ashlqi3_1"
10811 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10812 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
10813 (match_operand:QI 2 "nonmemory_operand" "cI,cI")))
10814 (clobber (reg:CC FLAGS_REG))]
10815 "TARGET_PARTIAL_REG_STALL
10816 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10818 switch (get_attr_type (insn))
10821 if (operands[2] != const1_rtx)
10823 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
10824 return "add{l}\t{%k0, %k0|%k0, %k0}";
10826 return "add{b}\t{%0, %0|%0, %0}";
10829 if (REG_P (operands[2]))
10831 if (get_attr_mode (insn) == MODE_SI)
10832 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10834 return "sal{b}\t{%b2, %0|%0, %b2}";
10836 else if (operands[2] == const1_rtx
10837 && (TARGET_SHIFT1 || optimize_size))
10839 if (get_attr_mode (insn) == MODE_SI)
10840 return "sal{l}\t%0";
10842 return "sal{b}\t%0";
10846 if (get_attr_mode (insn) == MODE_SI)
10847 return "sal{l}\t{%2, %k0|%k0, %2}";
10849 return "sal{b}\t{%2, %0|%0, %2}";
10853 [(set (attr "type")
10854 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10856 (match_operand 0 "register_operand" ""))
10857 (match_operand 2 "const1_operand" ""))
10858 (const_string "alu")
10860 (const_string "ishift")))
10861 (set_attr "mode" "QI,SI")])
10863 ;; This pattern can't accept a variable shift count, since shifts by
10864 ;; zero don't affect the flags. We assume that shifts by constant
10865 ;; zero are optimized away.
10866 (define_insn "*ashlqi3_cmp"
10867 [(set (reg FLAGS_REG)
10869 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
10870 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10872 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
10873 (ashift:QI (match_dup 1) (match_dup 2)))]
10874 "ix86_match_ccmode (insn, CCGOCmode)
10875 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10877 switch (get_attr_type (insn))
10880 if (operands[2] != const1_rtx)
10882 return "add{b}\t{%0, %0|%0, %0}";
10885 if (REG_P (operands[2]))
10886 return "sal{b}\t{%b2, %0|%0, %b2}";
10887 else if (operands[2] == const1_rtx
10888 && (TARGET_SHIFT1 || optimize_size))
10889 return "sal{b}\t%0";
10891 return "sal{b}\t{%2, %0|%0, %2}";
10894 [(set (attr "type")
10895 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10897 (match_operand 0 "register_operand" ""))
10898 (match_operand 2 "const1_operand" ""))
10899 (const_string "alu")
10901 (const_string "ishift")))
10902 (set_attr "mode" "QI")])
10904 ;; See comment above `ashldi3' about how this works.
10906 (define_expand "ashrdi3"
10907 [(set (match_operand:DI 0 "shiftdi_operand" "")
10908 (ashiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
10909 (match_operand:QI 2 "nonmemory_operand" "")))]
10911 "ix86_expand_binary_operator (ASHIFTRT, DImode, operands); DONE;")
10913 (define_insn "*ashrdi3_63_rex64"
10914 [(set (match_operand:DI 0 "nonimmediate_operand" "=*d,rm")
10915 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "*a,0")
10916 (match_operand:DI 2 "const_int_operand" "i,i")))
10917 (clobber (reg:CC FLAGS_REG))]
10918 "TARGET_64BIT && INTVAL (operands[2]) == 63
10919 && (TARGET_USE_CLTD || optimize_size)
10920 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10923 sar{q}\t{%2, %0|%0, %2}"
10924 [(set_attr "type" "imovx,ishift")
10925 (set_attr "prefix_0f" "0,*")
10926 (set_attr "length_immediate" "0,*")
10927 (set_attr "modrm" "0,1")
10928 (set_attr "mode" "DI")])
10930 (define_insn "*ashrdi3_1_one_bit_rex64"
10931 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10932 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10933 (match_operand:QI 2 "const1_operand" "")))
10934 (clobber (reg:CC FLAGS_REG))]
10935 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)
10936 && (TARGET_SHIFT1 || optimize_size)"
10938 [(set_attr "type" "ishift")
10939 (set (attr "length")
10940 (if_then_else (match_operand:DI 0 "register_operand" "")
10942 (const_string "*")))])
10944 (define_insn "*ashrdi3_1_rex64"
10945 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
10946 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
10947 (match_operand:QI 2 "nonmemory_operand" "J,c")))
10948 (clobber (reg:CC FLAGS_REG))]
10949 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10951 sar{q}\t{%2, %0|%0, %2}
10952 sar{q}\t{%b2, %0|%0, %b2}"
10953 [(set_attr "type" "ishift")
10954 (set_attr "mode" "DI")])
10956 ;; This pattern can't accept a variable shift count, since shifts by
10957 ;; zero don't affect the flags. We assume that shifts by constant
10958 ;; zero are optimized away.
10959 (define_insn "*ashrdi3_one_bit_cmp_rex64"
10960 [(set (reg FLAGS_REG)
10962 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10963 (match_operand:QI 2 "const1_operand" ""))
10965 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10966 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
10967 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10968 && (TARGET_SHIFT1 || optimize_size)
10969 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10971 [(set_attr "type" "ishift")
10972 (set (attr "length")
10973 (if_then_else (match_operand:DI 0 "register_operand" "")
10975 (const_string "*")))])
10977 ;; This pattern can't accept a variable shift count, since shifts by
10978 ;; zero don't affect the flags. We assume that shifts by constant
10979 ;; zero are optimized away.
10980 (define_insn "*ashrdi3_cmp_rex64"
10981 [(set (reg FLAGS_REG)
10983 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10984 (match_operand:QI 2 "const_int_operand" "n"))
10986 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10987 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
10988 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10989 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10990 "sar{q}\t{%2, %0|%0, %2}"
10991 [(set_attr "type" "ishift")
10992 (set_attr "mode" "DI")])
10994 (define_insn "*ashrdi3_1"
10995 [(set (match_operand:DI 0 "register_operand" "=r")
10996 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
10997 (match_operand:QI 2 "nonmemory_operand" "Jc")))
10998 (clobber (reg:CC FLAGS_REG))]
11001 [(set_attr "type" "multi")])
11003 ;; By default we don't ask for a scratch register, because when DImode
11004 ;; values are manipulated, registers are already at a premium. But if
11005 ;; we have one handy, we won't turn it away.
11007 [(match_scratch:SI 3 "r")
11008 (parallel [(set (match_operand:DI 0 "register_operand" "")
11009 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
11010 (match_operand:QI 2 "nonmemory_operand" "")))
11011 (clobber (reg:CC FLAGS_REG))])
11013 "!TARGET_64BIT && TARGET_CMOVE"
11015 "ix86_split_ashrdi (operands, operands[3]); DONE;")
11018 [(set (match_operand:DI 0 "register_operand" "")
11019 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
11020 (match_operand:QI 2 "nonmemory_operand" "")))
11021 (clobber (reg:CC FLAGS_REG))]
11022 "!TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)"
11024 "ix86_split_ashrdi (operands, NULL_RTX); DONE;")
11026 (define_insn "x86_shrd_1"
11027 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
11028 (ior:SI (ashiftrt:SI (match_dup 0)
11029 (match_operand:QI 2 "nonmemory_operand" "I,c"))
11030 (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
11031 (minus:QI (const_int 32) (match_dup 2)))))
11032 (clobber (reg:CC FLAGS_REG))]
11035 shrd{l}\t{%2, %1, %0|%0, %1, %2}
11036 shrd{l}\t{%s2%1, %0|%0, %1, %2}"
11037 [(set_attr "type" "ishift")
11038 (set_attr "prefix_0f" "1")
11039 (set_attr "pent_pair" "np")
11040 (set_attr "mode" "SI")])
11042 (define_expand "x86_shift_adj_3"
11043 [(use (match_operand:SI 0 "register_operand" ""))
11044 (use (match_operand:SI 1 "register_operand" ""))
11045 (use (match_operand:QI 2 "register_operand" ""))]
11048 rtx label = gen_label_rtx ();
11051 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
11053 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
11054 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
11055 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
11056 gen_rtx_LABEL_REF (VOIDmode, label),
11058 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
11059 JUMP_LABEL (tmp) = label;
11061 emit_move_insn (operands[0], operands[1]);
11062 emit_insn (gen_ashrsi3_31 (operands[1], operands[1], GEN_INT (31)));
11064 emit_label (label);
11065 LABEL_NUSES (label) = 1;
11070 (define_insn "ashrsi3_31"
11071 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,rm")
11072 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "*a,0")
11073 (match_operand:SI 2 "const_int_operand" "i,i")))
11074 (clobber (reg:CC FLAGS_REG))]
11075 "INTVAL (operands[2]) == 31 && (TARGET_USE_CLTD || optimize_size)
11076 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11079 sar{l}\t{%2, %0|%0, %2}"
11080 [(set_attr "type" "imovx,ishift")
11081 (set_attr "prefix_0f" "0,*")
11082 (set_attr "length_immediate" "0,*")
11083 (set_attr "modrm" "0,1")
11084 (set_attr "mode" "SI")])
11086 (define_insn "*ashrsi3_31_zext"
11087 [(set (match_operand:DI 0 "register_operand" "=*d,r")
11088 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "*a,0")
11089 (match_operand:SI 2 "const_int_operand" "i,i"))))
11090 (clobber (reg:CC FLAGS_REG))]
11091 "TARGET_64BIT && (TARGET_USE_CLTD || optimize_size)
11092 && INTVAL (operands[2]) == 31
11093 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11096 sar{l}\t{%2, %k0|%k0, %2}"
11097 [(set_attr "type" "imovx,ishift")
11098 (set_attr "prefix_0f" "0,*")
11099 (set_attr "length_immediate" "0,*")
11100 (set_attr "modrm" "0,1")
11101 (set_attr "mode" "SI")])
11103 (define_expand "ashrsi3"
11104 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11105 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11106 (match_operand:QI 2 "nonmemory_operand" "")))
11107 (clobber (reg:CC FLAGS_REG))]
11109 "ix86_expand_binary_operator (ASHIFTRT, SImode, operands); DONE;")
11111 (define_insn "*ashrsi3_1_one_bit"
11112 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11113 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11114 (match_operand:QI 2 "const1_operand" "")))
11115 (clobber (reg:CC FLAGS_REG))]
11116 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11117 && (TARGET_SHIFT1 || optimize_size)"
11119 [(set_attr "type" "ishift")
11120 (set (attr "length")
11121 (if_then_else (match_operand:SI 0 "register_operand" "")
11123 (const_string "*")))])
11125 (define_insn "*ashrsi3_1_one_bit_zext"
11126 [(set (match_operand:DI 0 "register_operand" "=r")
11127 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11128 (match_operand:QI 2 "const1_operand" ""))))
11129 (clobber (reg:CC FLAGS_REG))]
11130 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11131 && (TARGET_SHIFT1 || optimize_size)"
11133 [(set_attr "type" "ishift")
11134 (set_attr "length" "2")])
11136 (define_insn "*ashrsi3_1"
11137 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11138 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11139 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11140 (clobber (reg:CC FLAGS_REG))]
11141 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11143 sar{l}\t{%2, %0|%0, %2}
11144 sar{l}\t{%b2, %0|%0, %b2}"
11145 [(set_attr "type" "ishift")
11146 (set_attr "mode" "SI")])
11148 (define_insn "*ashrsi3_1_zext"
11149 [(set (match_operand:DI 0 "register_operand" "=r,r")
11150 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
11151 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11152 (clobber (reg:CC FLAGS_REG))]
11153 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11155 sar{l}\t{%2, %k0|%k0, %2}
11156 sar{l}\t{%b2, %k0|%k0, %b2}"
11157 [(set_attr "type" "ishift")
11158 (set_attr "mode" "SI")])
11160 ;; This pattern can't accept a variable shift count, since shifts by
11161 ;; zero don't affect the flags. We assume that shifts by constant
11162 ;; zero are optimized away.
11163 (define_insn "*ashrsi3_one_bit_cmp"
11164 [(set (reg FLAGS_REG)
11166 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11167 (match_operand:QI 2 "const1_operand" ""))
11169 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11170 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11171 "ix86_match_ccmode (insn, CCGOCmode)
11172 && (TARGET_SHIFT1 || optimize_size)
11173 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11175 [(set_attr "type" "ishift")
11176 (set (attr "length")
11177 (if_then_else (match_operand:SI 0 "register_operand" "")
11179 (const_string "*")))])
11181 (define_insn "*ashrsi3_one_bit_cmp_zext"
11182 [(set (reg FLAGS_REG)
11184 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11185 (match_operand:QI 2 "const1_operand" ""))
11187 (set (match_operand:DI 0 "register_operand" "=r")
11188 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11189 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
11190 && (TARGET_SHIFT1 || optimize_size)
11191 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11193 [(set_attr "type" "ishift")
11194 (set_attr "length" "2")])
11196 ;; This pattern can't accept a variable shift count, since shifts by
11197 ;; zero don't affect the flags. We assume that shifts by constant
11198 ;; zero are optimized away.
11199 (define_insn "*ashrsi3_cmp"
11200 [(set (reg FLAGS_REG)
11202 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11203 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11205 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11206 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11207 "ix86_match_ccmode (insn, CCGOCmode)
11208 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11209 "sar{l}\t{%2, %0|%0, %2}"
11210 [(set_attr "type" "ishift")
11211 (set_attr "mode" "SI")])
11213 (define_insn "*ashrsi3_cmp_zext"
11214 [(set (reg FLAGS_REG)
11216 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11217 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11219 (set (match_operand:DI 0 "register_operand" "=r")
11220 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11221 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11222 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11223 "sar{l}\t{%2, %k0|%k0, %2}"
11224 [(set_attr "type" "ishift")
11225 (set_attr "mode" "SI")])
11227 (define_expand "ashrhi3"
11228 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11229 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
11230 (match_operand:QI 2 "nonmemory_operand" "")))
11231 (clobber (reg:CC FLAGS_REG))]
11232 "TARGET_HIMODE_MATH"
11233 "ix86_expand_binary_operator (ASHIFTRT, HImode, operands); DONE;")
11235 (define_insn "*ashrhi3_1_one_bit"
11236 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11237 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11238 (match_operand:QI 2 "const1_operand" "")))
11239 (clobber (reg:CC FLAGS_REG))]
11240 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)
11241 && (TARGET_SHIFT1 || optimize_size)"
11243 [(set_attr "type" "ishift")
11244 (set (attr "length")
11245 (if_then_else (match_operand 0 "register_operand" "")
11247 (const_string "*")))])
11249 (define_insn "*ashrhi3_1"
11250 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11251 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11252 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11253 (clobber (reg:CC FLAGS_REG))]
11254 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11256 sar{w}\t{%2, %0|%0, %2}
11257 sar{w}\t{%b2, %0|%0, %b2}"
11258 [(set_attr "type" "ishift")
11259 (set_attr "mode" "HI")])
11261 ;; This pattern can't accept a variable shift count, since shifts by
11262 ;; zero don't affect the flags. We assume that shifts by constant
11263 ;; zero are optimized away.
11264 (define_insn "*ashrhi3_one_bit_cmp"
11265 [(set (reg FLAGS_REG)
11267 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11268 (match_operand:QI 2 "const1_operand" ""))
11270 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11271 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
11272 "ix86_match_ccmode (insn, CCGOCmode)
11273 && (TARGET_SHIFT1 || optimize_size)
11274 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11276 [(set_attr "type" "ishift")
11277 (set (attr "length")
11278 (if_then_else (match_operand 0 "register_operand" "")
11280 (const_string "*")))])
11282 ;; This pattern can't accept a variable shift count, since shifts by
11283 ;; zero don't affect the flags. We assume that shifts by constant
11284 ;; zero are optimized away.
11285 (define_insn "*ashrhi3_cmp"
11286 [(set (reg FLAGS_REG)
11288 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11289 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11291 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11292 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
11293 "ix86_match_ccmode (insn, CCGOCmode)
11294 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11295 "sar{w}\t{%2, %0|%0, %2}"
11296 [(set_attr "type" "ishift")
11297 (set_attr "mode" "HI")])
11299 (define_expand "ashrqi3"
11300 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11301 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
11302 (match_operand:QI 2 "nonmemory_operand" "")))
11303 (clobber (reg:CC FLAGS_REG))]
11304 "TARGET_QIMODE_MATH"
11305 "ix86_expand_binary_operator (ASHIFTRT, QImode, operands); DONE;")
11307 (define_insn "*ashrqi3_1_one_bit"
11308 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11309 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11310 (match_operand:QI 2 "const1_operand" "")))
11311 (clobber (reg:CC FLAGS_REG))]
11312 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
11313 && (TARGET_SHIFT1 || optimize_size)"
11315 [(set_attr "type" "ishift")
11316 (set (attr "length")
11317 (if_then_else (match_operand 0 "register_operand" "")
11319 (const_string "*")))])
11321 (define_insn "*ashrqi3_1_one_bit_slp"
11322 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11323 (ashiftrt:QI (match_dup 0)
11324 (match_operand:QI 1 "const1_operand" "")))
11325 (clobber (reg:CC FLAGS_REG))]
11326 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
11327 && (! TARGET_PARTIAL_REG_STALL || optimize_size)
11328 && (TARGET_SHIFT1 || optimize_size)"
11330 [(set_attr "type" "ishift1")
11331 (set (attr "length")
11332 (if_then_else (match_operand 0 "register_operand" "")
11334 (const_string "*")))])
11336 (define_insn "*ashrqi3_1"
11337 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11338 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11339 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11340 (clobber (reg:CC FLAGS_REG))]
11341 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11343 sar{b}\t{%2, %0|%0, %2}
11344 sar{b}\t{%b2, %0|%0, %b2}"
11345 [(set_attr "type" "ishift")
11346 (set_attr "mode" "QI")])
11348 (define_insn "*ashrqi3_1_slp"
11349 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11350 (ashiftrt:QI (match_dup 0)
11351 (match_operand:QI 1 "nonmemory_operand" "I,c")))
11352 (clobber (reg:CC FLAGS_REG))]
11353 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11354 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
11356 sar{b}\t{%1, %0|%0, %1}
11357 sar{b}\t{%b1, %0|%0, %b1}"
11358 [(set_attr "type" "ishift1")
11359 (set_attr "mode" "QI")])
11361 ;; This pattern can't accept a variable shift count, since shifts by
11362 ;; zero don't affect the flags. We assume that shifts by constant
11363 ;; zero are optimized away.
11364 (define_insn "*ashrqi3_one_bit_cmp"
11365 [(set (reg FLAGS_REG)
11367 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11368 (match_operand:QI 2 "const1_operand" "I"))
11370 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11371 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
11372 "ix86_match_ccmode (insn, CCGOCmode)
11373 && (TARGET_SHIFT1 || optimize_size)
11374 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11376 [(set_attr "type" "ishift")
11377 (set (attr "length")
11378 (if_then_else (match_operand 0 "register_operand" "")
11380 (const_string "*")))])
11382 ;; This pattern can't accept a variable shift count, since shifts by
11383 ;; zero don't affect the flags. We assume that shifts by constant
11384 ;; zero are optimized away.
11385 (define_insn "*ashrqi3_cmp"
11386 [(set (reg FLAGS_REG)
11388 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11389 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11391 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11392 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
11393 "ix86_match_ccmode (insn, CCGOCmode)
11394 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11395 "sar{b}\t{%2, %0|%0, %2}"
11396 [(set_attr "type" "ishift")
11397 (set_attr "mode" "QI")])
11399 ;; Logical shift instructions
11401 ;; See comment above `ashldi3' about how this works.
11403 (define_expand "lshrdi3"
11404 [(set (match_operand:DI 0 "shiftdi_operand" "")
11405 (lshiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
11406 (match_operand:QI 2 "nonmemory_operand" "")))]
11408 "ix86_expand_binary_operator (LSHIFTRT, DImode, operands); DONE;")
11410 (define_insn "*lshrdi3_1_one_bit_rex64"
11411 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11412 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11413 (match_operand:QI 2 "const1_operand" "")))
11414 (clobber (reg:CC FLAGS_REG))]
11415 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11416 && (TARGET_SHIFT1 || optimize_size)"
11418 [(set_attr "type" "ishift")
11419 (set (attr "length")
11420 (if_then_else (match_operand:DI 0 "register_operand" "")
11422 (const_string "*")))])
11424 (define_insn "*lshrdi3_1_rex64"
11425 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11426 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11427 (match_operand:QI 2 "nonmemory_operand" "J,c")))
11428 (clobber (reg:CC FLAGS_REG))]
11429 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11431 shr{q}\t{%2, %0|%0, %2}
11432 shr{q}\t{%b2, %0|%0, %b2}"
11433 [(set_attr "type" "ishift")
11434 (set_attr "mode" "DI")])
11436 ;; This pattern can't accept a variable shift count, since shifts by
11437 ;; zero don't affect the flags. We assume that shifts by constant
11438 ;; zero are optimized away.
11439 (define_insn "*lshrdi3_cmp_one_bit_rex64"
11440 [(set (reg FLAGS_REG)
11442 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11443 (match_operand:QI 2 "const1_operand" ""))
11445 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11446 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
11447 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11448 && (TARGET_SHIFT1 || optimize_size)
11449 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11451 [(set_attr "type" "ishift")
11452 (set (attr "length")
11453 (if_then_else (match_operand:DI 0 "register_operand" "")
11455 (const_string "*")))])
11457 ;; This pattern can't accept a variable shift count, since shifts by
11458 ;; zero don't affect the flags. We assume that shifts by constant
11459 ;; zero are optimized away.
11460 (define_insn "*lshrdi3_cmp_rex64"
11461 [(set (reg FLAGS_REG)
11463 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11464 (match_operand:QI 2 "const_int_operand" "e"))
11466 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11467 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
11468 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11469 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11470 "shr{q}\t{%2, %0|%0, %2}"
11471 [(set_attr "type" "ishift")
11472 (set_attr "mode" "DI")])
11474 (define_insn "*lshrdi3_1"
11475 [(set (match_operand:DI 0 "register_operand" "=r")
11476 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
11477 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11478 (clobber (reg:CC FLAGS_REG))]
11481 [(set_attr "type" "multi")])
11483 ;; By default we don't ask for a scratch register, because when DImode
11484 ;; values are manipulated, registers are already at a premium. But if
11485 ;; we have one handy, we won't turn it away.
11487 [(match_scratch:SI 3 "r")
11488 (parallel [(set (match_operand:DI 0 "register_operand" "")
11489 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
11490 (match_operand:QI 2 "nonmemory_operand" "")))
11491 (clobber (reg:CC FLAGS_REG))])
11493 "!TARGET_64BIT && TARGET_CMOVE"
11495 "ix86_split_lshrdi (operands, operands[3]); DONE;")
11498 [(set (match_operand:DI 0 "register_operand" "")
11499 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
11500 (match_operand:QI 2 "nonmemory_operand" "")))
11501 (clobber (reg:CC FLAGS_REG))]
11502 "!TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)"
11504 "ix86_split_lshrdi (operands, NULL_RTX); DONE;")
11506 (define_expand "lshrsi3"
11507 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11508 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11509 (match_operand:QI 2 "nonmemory_operand" "")))
11510 (clobber (reg:CC FLAGS_REG))]
11512 "ix86_expand_binary_operator (LSHIFTRT, SImode, operands); DONE;")
11514 (define_insn "*lshrsi3_1_one_bit"
11515 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11516 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11517 (match_operand:QI 2 "const1_operand" "")))
11518 (clobber (reg:CC FLAGS_REG))]
11519 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11520 && (TARGET_SHIFT1 || optimize_size)"
11522 [(set_attr "type" "ishift")
11523 (set (attr "length")
11524 (if_then_else (match_operand:SI 0 "register_operand" "")
11526 (const_string "*")))])
11528 (define_insn "*lshrsi3_1_one_bit_zext"
11529 [(set (match_operand:DI 0 "register_operand" "=r")
11530 (lshiftrt:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
11531 (match_operand:QI 2 "const1_operand" "")))
11532 (clobber (reg:CC FLAGS_REG))]
11533 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11534 && (TARGET_SHIFT1 || optimize_size)"
11536 [(set_attr "type" "ishift")
11537 (set_attr "length" "2")])
11539 (define_insn "*lshrsi3_1"
11540 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11541 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11542 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11543 (clobber (reg:CC FLAGS_REG))]
11544 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11546 shr{l}\t{%2, %0|%0, %2}
11547 shr{l}\t{%b2, %0|%0, %b2}"
11548 [(set_attr "type" "ishift")
11549 (set_attr "mode" "SI")])
11551 (define_insn "*lshrsi3_1_zext"
11552 [(set (match_operand:DI 0 "register_operand" "=r,r")
11554 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11555 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11556 (clobber (reg:CC FLAGS_REG))]
11557 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11559 shr{l}\t{%2, %k0|%k0, %2}
11560 shr{l}\t{%b2, %k0|%k0, %b2}"
11561 [(set_attr "type" "ishift")
11562 (set_attr "mode" "SI")])
11564 ;; This pattern can't accept a variable shift count, since shifts by
11565 ;; zero don't affect the flags. We assume that shifts by constant
11566 ;; zero are optimized away.
11567 (define_insn "*lshrsi3_one_bit_cmp"
11568 [(set (reg FLAGS_REG)
11570 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11571 (match_operand:QI 2 "const1_operand" ""))
11573 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11574 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
11575 "ix86_match_ccmode (insn, CCGOCmode)
11576 && (TARGET_SHIFT1 || optimize_size)
11577 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11579 [(set_attr "type" "ishift")
11580 (set (attr "length")
11581 (if_then_else (match_operand:SI 0 "register_operand" "")
11583 (const_string "*")))])
11585 (define_insn "*lshrsi3_cmp_one_bit_zext"
11586 [(set (reg FLAGS_REG)
11588 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
11589 (match_operand:QI 2 "const1_operand" ""))
11591 (set (match_operand:DI 0 "register_operand" "=r")
11592 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
11593 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11594 && (TARGET_SHIFT1 || optimize_size)
11595 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11597 [(set_attr "type" "ishift")
11598 (set_attr "length" "2")])
11600 ;; This pattern can't accept a variable shift count, since shifts by
11601 ;; zero don't affect the flags. We assume that shifts by constant
11602 ;; zero are optimized away.
11603 (define_insn "*lshrsi3_cmp"
11604 [(set (reg FLAGS_REG)
11606 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11607 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11609 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11610 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
11611 "ix86_match_ccmode (insn, CCGOCmode)
11612 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11613 "shr{l}\t{%2, %0|%0, %2}"
11614 [(set_attr "type" "ishift")
11615 (set_attr "mode" "SI")])
11617 (define_insn "*lshrsi3_cmp_zext"
11618 [(set (reg FLAGS_REG)
11620 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
11621 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11623 (set (match_operand:DI 0 "register_operand" "=r")
11624 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
11625 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11626 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11627 "shr{l}\t{%2, %k0|%k0, %2}"
11628 [(set_attr "type" "ishift")
11629 (set_attr "mode" "SI")])
11631 (define_expand "lshrhi3"
11632 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11633 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
11634 (match_operand:QI 2 "nonmemory_operand" "")))
11635 (clobber (reg:CC FLAGS_REG))]
11636 "TARGET_HIMODE_MATH"
11637 "ix86_expand_binary_operator (LSHIFTRT, HImode, operands); DONE;")
11639 (define_insn "*lshrhi3_1_one_bit"
11640 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11641 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11642 (match_operand:QI 2 "const1_operand" "")))
11643 (clobber (reg:CC FLAGS_REG))]
11644 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11645 && (TARGET_SHIFT1 || optimize_size)"
11647 [(set_attr "type" "ishift")
11648 (set (attr "length")
11649 (if_then_else (match_operand 0 "register_operand" "")
11651 (const_string "*")))])
11653 (define_insn "*lshrhi3_1"
11654 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11655 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11656 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11657 (clobber (reg:CC FLAGS_REG))]
11658 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11660 shr{w}\t{%2, %0|%0, %2}
11661 shr{w}\t{%b2, %0|%0, %b2}"
11662 [(set_attr "type" "ishift")
11663 (set_attr "mode" "HI")])
11665 ;; This pattern can't accept a variable shift count, since shifts by
11666 ;; zero don't affect the flags. We assume that shifts by constant
11667 ;; zero are optimized away.
11668 (define_insn "*lshrhi3_one_bit_cmp"
11669 [(set (reg FLAGS_REG)
11671 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11672 (match_operand:QI 2 "const1_operand" ""))
11674 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11675 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
11676 "ix86_match_ccmode (insn, CCGOCmode)
11677 && (TARGET_SHIFT1 || optimize_size)
11678 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11680 [(set_attr "type" "ishift")
11681 (set (attr "length")
11682 (if_then_else (match_operand:SI 0 "register_operand" "")
11684 (const_string "*")))])
11686 ;; This pattern can't accept a variable shift count, since shifts by
11687 ;; zero don't affect the flags. We assume that shifts by constant
11688 ;; zero are optimized away.
11689 (define_insn "*lshrhi3_cmp"
11690 [(set (reg FLAGS_REG)
11692 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11693 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11695 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11696 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
11697 "ix86_match_ccmode (insn, CCGOCmode)
11698 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11699 "shr{w}\t{%2, %0|%0, %2}"
11700 [(set_attr "type" "ishift")
11701 (set_attr "mode" "HI")])
11703 (define_expand "lshrqi3"
11704 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11705 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
11706 (match_operand:QI 2 "nonmemory_operand" "")))
11707 (clobber (reg:CC FLAGS_REG))]
11708 "TARGET_QIMODE_MATH"
11709 "ix86_expand_binary_operator (LSHIFTRT, QImode, operands); DONE;")
11711 (define_insn "*lshrqi3_1_one_bit"
11712 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11713 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11714 (match_operand:QI 2 "const1_operand" "")))
11715 (clobber (reg:CC FLAGS_REG))]
11716 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)
11717 && (TARGET_SHIFT1 || optimize_size)"
11719 [(set_attr "type" "ishift")
11720 (set (attr "length")
11721 (if_then_else (match_operand 0 "register_operand" "")
11723 (const_string "*")))])
11725 (define_insn "*lshrqi3_1_one_bit_slp"
11726 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11727 (lshiftrt:QI (match_dup 0)
11728 (match_operand:QI 1 "const1_operand" "")))
11729 (clobber (reg:CC FLAGS_REG))]
11730 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11731 && (TARGET_SHIFT1 || optimize_size)"
11733 [(set_attr "type" "ishift1")
11734 (set (attr "length")
11735 (if_then_else (match_operand 0 "register_operand" "")
11737 (const_string "*")))])
11739 (define_insn "*lshrqi3_1"
11740 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11741 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11742 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11743 (clobber (reg:CC FLAGS_REG))]
11744 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11746 shr{b}\t{%2, %0|%0, %2}
11747 shr{b}\t{%b2, %0|%0, %b2}"
11748 [(set_attr "type" "ishift")
11749 (set_attr "mode" "QI")])
11751 (define_insn "*lshrqi3_1_slp"
11752 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11753 (lshiftrt:QI (match_dup 0)
11754 (match_operand:QI 1 "nonmemory_operand" "I,c")))
11755 (clobber (reg:CC FLAGS_REG))]
11756 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11757 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
11759 shr{b}\t{%1, %0|%0, %1}
11760 shr{b}\t{%b1, %0|%0, %b1}"
11761 [(set_attr "type" "ishift1")
11762 (set_attr "mode" "QI")])
11764 ;; This pattern can't accept a variable shift count, since shifts by
11765 ;; zero don't affect the flags. We assume that shifts by constant
11766 ;; zero are optimized away.
11767 (define_insn "*lshrqi2_one_bit_cmp"
11768 [(set (reg FLAGS_REG)
11770 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11771 (match_operand:QI 2 "const1_operand" ""))
11773 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11774 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
11775 "ix86_match_ccmode (insn, CCGOCmode)
11776 && (TARGET_SHIFT1 || optimize_size)
11777 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11779 [(set_attr "type" "ishift")
11780 (set (attr "length")
11781 (if_then_else (match_operand:SI 0 "register_operand" "")
11783 (const_string "*")))])
11785 ;; This pattern can't accept a variable shift count, since shifts by
11786 ;; zero don't affect the flags. We assume that shifts by constant
11787 ;; zero are optimized away.
11788 (define_insn "*lshrqi2_cmp"
11789 [(set (reg FLAGS_REG)
11791 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11792 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11794 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11795 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
11796 "ix86_match_ccmode (insn, CCGOCmode)
11797 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11798 "shr{b}\t{%2, %0|%0, %2}"
11799 [(set_attr "type" "ishift")
11800 (set_attr "mode" "QI")])
11802 ;; Rotate instructions
11804 (define_expand "rotldi3"
11805 [(set (match_operand:DI 0 "nonimmediate_operand" "")
11806 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "")
11807 (match_operand:QI 2 "nonmemory_operand" "")))
11808 (clobber (reg:CC FLAGS_REG))]
11810 "ix86_expand_binary_operator (ROTATE, DImode, operands); DONE;")
11812 (define_insn "*rotlsi3_1_one_bit_rex64"
11813 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11814 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11815 (match_operand:QI 2 "const1_operand" "")))
11816 (clobber (reg:CC FLAGS_REG))]
11817 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)
11818 && (TARGET_SHIFT1 || optimize_size)"
11820 [(set_attr "type" "rotate")
11821 (set (attr "length")
11822 (if_then_else (match_operand:DI 0 "register_operand" "")
11824 (const_string "*")))])
11826 (define_insn "*rotldi3_1_rex64"
11827 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11828 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11829 (match_operand:QI 2 "nonmemory_operand" "e,c")))
11830 (clobber (reg:CC FLAGS_REG))]
11831 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)"
11833 rol{q}\t{%2, %0|%0, %2}
11834 rol{q}\t{%b2, %0|%0, %b2}"
11835 [(set_attr "type" "rotate")
11836 (set_attr "mode" "DI")])
11838 (define_expand "rotlsi3"
11839 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11840 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "")
11841 (match_operand:QI 2 "nonmemory_operand" "")))
11842 (clobber (reg:CC FLAGS_REG))]
11844 "ix86_expand_binary_operator (ROTATE, SImode, operands); DONE;")
11846 (define_insn "*rotlsi3_1_one_bit"
11847 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11848 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11849 (match_operand:QI 2 "const1_operand" "")))
11850 (clobber (reg:CC FLAGS_REG))]
11851 "ix86_binary_operator_ok (ROTATE, SImode, operands)
11852 && (TARGET_SHIFT1 || optimize_size)"
11854 [(set_attr "type" "rotate")
11855 (set (attr "length")
11856 (if_then_else (match_operand:SI 0 "register_operand" "")
11858 (const_string "*")))])
11860 (define_insn "*rotlsi3_1_one_bit_zext"
11861 [(set (match_operand:DI 0 "register_operand" "=r")
11863 (rotate:SI (match_operand:SI 1 "register_operand" "0")
11864 (match_operand:QI 2 "const1_operand" ""))))
11865 (clobber (reg:CC FLAGS_REG))]
11866 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)
11867 && (TARGET_SHIFT1 || optimize_size)"
11869 [(set_attr "type" "rotate")
11870 (set_attr "length" "2")])
11872 (define_insn "*rotlsi3_1"
11873 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11874 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11875 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11876 (clobber (reg:CC FLAGS_REG))]
11877 "ix86_binary_operator_ok (ROTATE, SImode, operands)"
11879 rol{l}\t{%2, %0|%0, %2}
11880 rol{l}\t{%b2, %0|%0, %b2}"
11881 [(set_attr "type" "rotate")
11882 (set_attr "mode" "SI")])
11884 (define_insn "*rotlsi3_1_zext"
11885 [(set (match_operand:DI 0 "register_operand" "=r,r")
11887 (rotate:SI (match_operand:SI 1 "register_operand" "0,0")
11888 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11889 (clobber (reg:CC FLAGS_REG))]
11890 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)"
11892 rol{l}\t{%2, %k0|%k0, %2}
11893 rol{l}\t{%b2, %k0|%k0, %b2}"
11894 [(set_attr "type" "rotate")
11895 (set_attr "mode" "SI")])
11897 (define_expand "rotlhi3"
11898 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11899 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "")
11900 (match_operand:QI 2 "nonmemory_operand" "")))
11901 (clobber (reg:CC FLAGS_REG))]
11902 "TARGET_HIMODE_MATH"
11903 "ix86_expand_binary_operator (ROTATE, HImode, operands); DONE;")
11905 (define_insn "*rotlhi3_1_one_bit"
11906 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11907 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11908 (match_operand:QI 2 "const1_operand" "")))
11909 (clobber (reg:CC FLAGS_REG))]
11910 "ix86_binary_operator_ok (ROTATE, HImode, operands)
11911 && (TARGET_SHIFT1 || optimize_size)"
11913 [(set_attr "type" "rotate")
11914 (set (attr "length")
11915 (if_then_else (match_operand 0 "register_operand" "")
11917 (const_string "*")))])
11919 (define_insn "*rotlhi3_1"
11920 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11921 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11922 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11923 (clobber (reg:CC FLAGS_REG))]
11924 "ix86_binary_operator_ok (ROTATE, HImode, operands)"
11926 rol{w}\t{%2, %0|%0, %2}
11927 rol{w}\t{%b2, %0|%0, %b2}"
11928 [(set_attr "type" "rotate")
11929 (set_attr "mode" "HI")])
11931 (define_expand "rotlqi3"
11932 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11933 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "")
11934 (match_operand:QI 2 "nonmemory_operand" "")))
11935 (clobber (reg:CC FLAGS_REG))]
11936 "TARGET_QIMODE_MATH"
11937 "ix86_expand_binary_operator (ROTATE, QImode, operands); DONE;")
11939 (define_insn "*rotlqi3_1_one_bit_slp"
11940 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11941 (rotate:QI (match_dup 0)
11942 (match_operand:QI 1 "const1_operand" "")))
11943 (clobber (reg:CC FLAGS_REG))]
11944 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11945 && (TARGET_SHIFT1 || optimize_size)"
11947 [(set_attr "type" "rotate1")
11948 (set (attr "length")
11949 (if_then_else (match_operand 0 "register_operand" "")
11951 (const_string "*")))])
11953 (define_insn "*rotlqi3_1_one_bit"
11954 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11955 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11956 (match_operand:QI 2 "const1_operand" "")))
11957 (clobber (reg:CC FLAGS_REG))]
11958 "ix86_binary_operator_ok (ROTATE, QImode, operands)
11959 && (TARGET_SHIFT1 || optimize_size)"
11961 [(set_attr "type" "rotate")
11962 (set (attr "length")
11963 (if_then_else (match_operand 0 "register_operand" "")
11965 (const_string "*")))])
11967 (define_insn "*rotlqi3_1_slp"
11968 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11969 (rotate:QI (match_dup 0)
11970 (match_operand:QI 1 "nonmemory_operand" "I,c")))
11971 (clobber (reg:CC FLAGS_REG))]
11972 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11973 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
11975 rol{b}\t{%1, %0|%0, %1}
11976 rol{b}\t{%b1, %0|%0, %b1}"
11977 [(set_attr "type" "rotate1")
11978 (set_attr "mode" "QI")])
11980 (define_insn "*rotlqi3_1"
11981 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11982 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11983 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11984 (clobber (reg:CC FLAGS_REG))]
11985 "ix86_binary_operator_ok (ROTATE, QImode, operands)"
11987 rol{b}\t{%2, %0|%0, %2}
11988 rol{b}\t{%b2, %0|%0, %b2}"
11989 [(set_attr "type" "rotate")
11990 (set_attr "mode" "QI")])
11992 (define_expand "rotrdi3"
11993 [(set (match_operand:DI 0 "nonimmediate_operand" "")
11994 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "")
11995 (match_operand:QI 2 "nonmemory_operand" "")))
11996 (clobber (reg:CC FLAGS_REG))]
11998 "ix86_expand_binary_operator (ROTATERT, DImode, operands); DONE;")
12000 (define_insn "*rotrdi3_1_one_bit_rex64"
12001 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12002 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12003 (match_operand:QI 2 "const1_operand" "")))
12004 (clobber (reg:CC FLAGS_REG))]
12005 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)
12006 && (TARGET_SHIFT1 || optimize_size)"
12008 [(set_attr "type" "rotate")
12009 (set (attr "length")
12010 (if_then_else (match_operand:DI 0 "register_operand" "")
12012 (const_string "*")))])
12014 (define_insn "*rotrdi3_1_rex64"
12015 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
12016 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
12017 (match_operand:QI 2 "nonmemory_operand" "J,c")))
12018 (clobber (reg:CC FLAGS_REG))]
12019 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)"
12021 ror{q}\t{%2, %0|%0, %2}
12022 ror{q}\t{%b2, %0|%0, %b2}"
12023 [(set_attr "type" "rotate")
12024 (set_attr "mode" "DI")])
12026 (define_expand "rotrsi3"
12027 [(set (match_operand:SI 0 "nonimmediate_operand" "")
12028 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "")
12029 (match_operand:QI 2 "nonmemory_operand" "")))
12030 (clobber (reg:CC FLAGS_REG))]
12032 "ix86_expand_binary_operator (ROTATERT, SImode, operands); DONE;")
12034 (define_insn "*rotrsi3_1_one_bit"
12035 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12036 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12037 (match_operand:QI 2 "const1_operand" "")))
12038 (clobber (reg:CC FLAGS_REG))]
12039 "ix86_binary_operator_ok (ROTATERT, SImode, operands)
12040 && (TARGET_SHIFT1 || optimize_size)"
12042 [(set_attr "type" "rotate")
12043 (set (attr "length")
12044 (if_then_else (match_operand:SI 0 "register_operand" "")
12046 (const_string "*")))])
12048 (define_insn "*rotrsi3_1_one_bit_zext"
12049 [(set (match_operand:DI 0 "register_operand" "=r")
12051 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
12052 (match_operand:QI 2 "const1_operand" ""))))
12053 (clobber (reg:CC FLAGS_REG))]
12054 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)
12055 && (TARGET_SHIFT1 || optimize_size)"
12057 [(set_attr "type" "rotate")
12058 (set (attr "length")
12059 (if_then_else (match_operand:SI 0 "register_operand" "")
12061 (const_string "*")))])
12063 (define_insn "*rotrsi3_1"
12064 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12065 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12066 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12067 (clobber (reg:CC FLAGS_REG))]
12068 "ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12070 ror{l}\t{%2, %0|%0, %2}
12071 ror{l}\t{%b2, %0|%0, %b2}"
12072 [(set_attr "type" "rotate")
12073 (set_attr "mode" "SI")])
12075 (define_insn "*rotrsi3_1_zext"
12076 [(set (match_operand:DI 0 "register_operand" "=r,r")
12078 (rotatert:SI (match_operand:SI 1 "register_operand" "0,0")
12079 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12080 (clobber (reg:CC FLAGS_REG))]
12081 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12083 ror{l}\t{%2, %k0|%k0, %2}
12084 ror{l}\t{%b2, %k0|%k0, %b2}"
12085 [(set_attr "type" "rotate")
12086 (set_attr "mode" "SI")])
12088 (define_expand "rotrhi3"
12089 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12090 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "")
12091 (match_operand:QI 2 "nonmemory_operand" "")))
12092 (clobber (reg:CC FLAGS_REG))]
12093 "TARGET_HIMODE_MATH"
12094 "ix86_expand_binary_operator (ROTATERT, HImode, operands); DONE;")
12096 (define_insn "*rotrhi3_one_bit"
12097 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12098 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12099 (match_operand:QI 2 "const1_operand" "")))
12100 (clobber (reg:CC FLAGS_REG))]
12101 "ix86_binary_operator_ok (ROTATERT, HImode, operands)
12102 && (TARGET_SHIFT1 || optimize_size)"
12104 [(set_attr "type" "rotate")
12105 (set (attr "length")
12106 (if_then_else (match_operand 0 "register_operand" "")
12108 (const_string "*")))])
12110 (define_insn "*rotrhi3"
12111 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12112 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12113 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12114 (clobber (reg:CC FLAGS_REG))]
12115 "ix86_binary_operator_ok (ROTATERT, HImode, operands)"
12117 ror{w}\t{%2, %0|%0, %2}
12118 ror{w}\t{%b2, %0|%0, %b2}"
12119 [(set_attr "type" "rotate")
12120 (set_attr "mode" "HI")])
12122 (define_expand "rotrqi3"
12123 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12124 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "")
12125 (match_operand:QI 2 "nonmemory_operand" "")))
12126 (clobber (reg:CC FLAGS_REG))]
12127 "TARGET_QIMODE_MATH"
12128 "ix86_expand_binary_operator (ROTATERT, QImode, operands); DONE;")
12130 (define_insn "*rotrqi3_1_one_bit"
12131 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12132 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12133 (match_operand:QI 2 "const1_operand" "")))
12134 (clobber (reg:CC FLAGS_REG))]
12135 "ix86_binary_operator_ok (ROTATERT, QImode, operands)
12136 && (TARGET_SHIFT1 || optimize_size)"
12138 [(set_attr "type" "rotate")
12139 (set (attr "length")
12140 (if_then_else (match_operand 0 "register_operand" "")
12142 (const_string "*")))])
12144 (define_insn "*rotrqi3_1_one_bit_slp"
12145 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12146 (rotatert:QI (match_dup 0)
12147 (match_operand:QI 1 "const1_operand" "")))
12148 (clobber (reg:CC FLAGS_REG))]
12149 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12150 && (TARGET_SHIFT1 || optimize_size)"
12152 [(set_attr "type" "rotate1")
12153 (set (attr "length")
12154 (if_then_else (match_operand 0 "register_operand" "")
12156 (const_string "*")))])
12158 (define_insn "*rotrqi3_1"
12159 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12160 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12161 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12162 (clobber (reg:CC FLAGS_REG))]
12163 "ix86_binary_operator_ok (ROTATERT, QImode, operands)"
12165 ror{b}\t{%2, %0|%0, %2}
12166 ror{b}\t{%b2, %0|%0, %b2}"
12167 [(set_attr "type" "rotate")
12168 (set_attr "mode" "QI")])
12170 (define_insn "*rotrqi3_1_slp"
12171 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12172 (rotatert:QI (match_dup 0)
12173 (match_operand:QI 1 "nonmemory_operand" "I,c")))
12174 (clobber (reg:CC FLAGS_REG))]
12175 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12176 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
12178 ror{b}\t{%1, %0|%0, %1}
12179 ror{b}\t{%b1, %0|%0, %b1}"
12180 [(set_attr "type" "rotate1")
12181 (set_attr "mode" "QI")])
12183 ;; Bit set / bit test instructions
12185 (define_expand "extv"
12186 [(set (match_operand:SI 0 "register_operand" "")
12187 (sign_extract:SI (match_operand:SI 1 "register_operand" "")
12188 (match_operand:SI 2 "immediate_operand" "")
12189 (match_operand:SI 3 "immediate_operand" "")))]
12192 /* Handle extractions from %ah et al. */
12193 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
12196 /* From mips.md: extract_bit_field doesn't verify that our source
12197 matches the predicate, so check it again here. */
12198 if (! register_operand (operands[1], VOIDmode))
12202 (define_expand "extzv"
12203 [(set (match_operand:SI 0 "register_operand" "")
12204 (zero_extract:SI (match_operand 1 "ext_register_operand" "")
12205 (match_operand:SI 2 "immediate_operand" "")
12206 (match_operand:SI 3 "immediate_operand" "")))]
12209 /* Handle extractions from %ah et al. */
12210 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
12213 /* From mips.md: extract_bit_field doesn't verify that our source
12214 matches the predicate, so check it again here. */
12215 if (! register_operand (operands[1], VOIDmode))
12219 (define_expand "insv"
12220 [(set (zero_extract (match_operand 0 "ext_register_operand" "")
12221 (match_operand 1 "immediate_operand" "")
12222 (match_operand 2 "immediate_operand" ""))
12223 (match_operand 3 "register_operand" ""))]
12226 /* Handle extractions from %ah et al. */
12227 if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) != 8)
12230 /* From mips.md: insert_bit_field doesn't verify that our source
12231 matches the predicate, so check it again here. */
12232 if (! register_operand (operands[0], VOIDmode))
12236 emit_insn (gen_movdi_insv_1_rex64 (operands[0], operands[3]));
12238 emit_insn (gen_movsi_insv_1 (operands[0], operands[3]));
12243 ;; %%% bts, btr, btc, bt.
12244 ;; In general these instructions are *slow* when applied to memory,
12245 ;; since they enforce atomic operation. When applied to registers,
12246 ;; it depends on the cpu implementation. They're never faster than
12247 ;; the corresponding and/ior/xor operations, so with 32-bit there's
12248 ;; no point. But in 64-bit, we can't hold the relevant immediates
12249 ;; within the instruction itself, so operating on bits in the high
12250 ;; 32-bits of a register becomes easier.
12252 ;; These are slow on Nocona, but fast on Athlon64. We do require the use
12253 ;; of btrq and btcq for corner cases of post-reload expansion of absdf and
12254 ;; negdf respectively, so they can never be disabled entirely.
12256 (define_insn "*btsq"
12257 [(set (zero_extract:DI (match_operand 0 "register_operand" "+r")
12259 (match_operand 1 "const_0_to_63_operand" ""))
12261 (clobber (reg:CC FLAGS_REG))]
12262 "TARGET_64BIT && (TARGET_USE_BT || reload_completed)"
12264 [(set_attr "type" "alu1")])
12266 (define_insn "*btrq"
12267 [(set (zero_extract:DI (match_operand 0 "register_operand" "+r")
12269 (match_operand 1 "const_0_to_63_operand" ""))
12271 (clobber (reg:CC FLAGS_REG))]
12272 "TARGET_64BIT && (TARGET_USE_BT || reload_completed)"
12274 [(set_attr "type" "alu1")])
12276 (define_insn "*btcq"
12277 [(set (zero_extract:DI (match_operand 0 "register_operand" "+r")
12279 (match_operand 1 "const_0_to_63_operand" ""))
12280 (not:DI (zero_extract:DI (match_dup 0) (const_int 1) (match_dup 1))))
12281 (clobber (reg:CC FLAGS_REG))]
12282 "TARGET_64BIT && (TARGET_USE_BT || reload_completed)"
12284 [(set_attr "type" "alu1")])
12286 ;; Allow Nocona to avoid these instructions if a register is available.
12289 [(match_scratch:DI 2 "r")
12290 (parallel [(set (zero_extract:DI
12291 (match_operand 0 "register_operand" "")
12293 (match_operand 1 "const_0_to_63_operand" ""))
12295 (clobber (reg:CC FLAGS_REG))])]
12296 "TARGET_64BIT && !TARGET_USE_BT"
12299 HOST_WIDE_INT i = INTVAL (operands[1]), hi, lo;
12302 if (HOST_BITS_PER_WIDE_INT >= 64)
12303 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12304 else if (i < HOST_BITS_PER_WIDE_INT)
12305 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12307 lo = 0, hi = (HOST_WIDE_INT)1 << (i - HOST_BITS_PER_WIDE_INT);
12309 op1 = immed_double_const (lo, hi, DImode);
12312 emit_move_insn (operands[2], op1);
12316 emit_insn (gen_iordi3 (operands[0], operands[0], op1));
12321 [(match_scratch:DI 2 "r")
12322 (parallel [(set (zero_extract:DI
12323 (match_operand 0 "register_operand" "")
12325 (match_operand 1 "const_0_to_63_operand" ""))
12327 (clobber (reg:CC FLAGS_REG))])]
12328 "TARGET_64BIT && !TARGET_USE_BT"
12331 HOST_WIDE_INT i = INTVAL (operands[1]), hi, lo;
12334 if (HOST_BITS_PER_WIDE_INT >= 64)
12335 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12336 else if (i < HOST_BITS_PER_WIDE_INT)
12337 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12339 lo = 0, hi = (HOST_WIDE_INT)1 << (i - HOST_BITS_PER_WIDE_INT);
12341 op1 = immed_double_const (~lo, ~hi, DImode);
12344 emit_move_insn (operands[2], op1);
12348 emit_insn (gen_anddi3 (operands[0], operands[0], op1));
12353 [(match_scratch:DI 2 "r")
12354 (parallel [(set (zero_extract:DI
12355 (match_operand 0 "register_operand" "")
12357 (match_operand 1 "const_0_to_63_operand" ""))
12358 (not:DI (zero_extract:DI
12359 (match_dup 0) (const_int 1) (match_dup 1))))
12360 (clobber (reg:CC FLAGS_REG))])]
12361 "TARGET_64BIT && !TARGET_USE_BT"
12364 HOST_WIDE_INT i = INTVAL (operands[1]), hi, lo;
12367 if (HOST_BITS_PER_WIDE_INT >= 64)
12368 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12369 else if (i < HOST_BITS_PER_WIDE_INT)
12370 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12372 lo = 0, hi = (HOST_WIDE_INT)1 << (i - HOST_BITS_PER_WIDE_INT);
12374 op1 = immed_double_const (lo, hi, DImode);
12377 emit_move_insn (operands[2], op1);
12381 emit_insn (gen_xordi3 (operands[0], operands[0], op1));
12385 ;; Store-flag instructions.
12387 ;; For all sCOND expanders, also expand the compare or test insn that
12388 ;; generates cc0. Generate an equality comparison if `seq' or `sne'.
12390 ;; %%% Do the expansion to SImode. If PII, do things the xor+setcc way
12391 ;; to avoid partial register stalls. Otherwise do things the setcc+movzx
12392 ;; way, which can later delete the movzx if only QImode is needed.
12394 (define_expand "seq"
12395 [(set (match_operand:QI 0 "register_operand" "")
12396 (eq:QI (reg:CC FLAGS_REG) (const_int 0)))]
12398 "if (ix86_expand_setcc (EQ, operands[0])) DONE; else FAIL;")
12400 (define_expand "sne"
12401 [(set (match_operand:QI 0 "register_operand" "")
12402 (ne:QI (reg:CC FLAGS_REG) (const_int 0)))]
12404 "if (ix86_expand_setcc (NE, operands[0])) DONE; else FAIL;")
12406 (define_expand "sgt"
12407 [(set (match_operand:QI 0 "register_operand" "")
12408 (gt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12410 "if (ix86_expand_setcc (GT, operands[0])) DONE; else FAIL;")
12412 (define_expand "sgtu"
12413 [(set (match_operand:QI 0 "register_operand" "")
12414 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12416 "if (ix86_expand_setcc (GTU, operands[0])) DONE; else FAIL;")
12418 (define_expand "slt"
12419 [(set (match_operand:QI 0 "register_operand" "")
12420 (lt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12422 "if (ix86_expand_setcc (LT, operands[0])) DONE; else FAIL;")
12424 (define_expand "sltu"
12425 [(set (match_operand:QI 0 "register_operand" "")
12426 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12428 "if (ix86_expand_setcc (LTU, operands[0])) DONE; else FAIL;")
12430 (define_expand "sge"
12431 [(set (match_operand:QI 0 "register_operand" "")
12432 (ge:QI (reg:CC FLAGS_REG) (const_int 0)))]
12434 "if (ix86_expand_setcc (GE, operands[0])) DONE; else FAIL;")
12436 (define_expand "sgeu"
12437 [(set (match_operand:QI 0 "register_operand" "")
12438 (geu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12440 "if (ix86_expand_setcc (GEU, operands[0])) DONE; else FAIL;")
12442 (define_expand "sle"
12443 [(set (match_operand:QI 0 "register_operand" "")
12444 (le:QI (reg:CC FLAGS_REG) (const_int 0)))]
12446 "if (ix86_expand_setcc (LE, operands[0])) DONE; else FAIL;")
12448 (define_expand "sleu"
12449 [(set (match_operand:QI 0 "register_operand" "")
12450 (leu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12452 "if (ix86_expand_setcc (LEU, operands[0])) DONE; else FAIL;")
12454 (define_expand "sunordered"
12455 [(set (match_operand:QI 0 "register_operand" "")
12456 (unordered:QI (reg:CC FLAGS_REG) (const_int 0)))]
12457 "TARGET_80387 || TARGET_SSE"
12458 "if (ix86_expand_setcc (UNORDERED, operands[0])) DONE; else FAIL;")
12460 (define_expand "sordered"
12461 [(set (match_operand:QI 0 "register_operand" "")
12462 (ordered:QI (reg:CC FLAGS_REG) (const_int 0)))]
12464 "if (ix86_expand_setcc (ORDERED, operands[0])) DONE; else FAIL;")
12466 (define_expand "suneq"
12467 [(set (match_operand:QI 0 "register_operand" "")
12468 (uneq:QI (reg:CC FLAGS_REG) (const_int 0)))]
12469 "TARGET_80387 || TARGET_SSE"
12470 "if (ix86_expand_setcc (UNEQ, operands[0])) DONE; else FAIL;")
12472 (define_expand "sunge"
12473 [(set (match_operand:QI 0 "register_operand" "")
12474 (unge:QI (reg:CC FLAGS_REG) (const_int 0)))]
12475 "TARGET_80387 || TARGET_SSE"
12476 "if (ix86_expand_setcc (UNGE, operands[0])) DONE; else FAIL;")
12478 (define_expand "sungt"
12479 [(set (match_operand:QI 0 "register_operand" "")
12480 (ungt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12481 "TARGET_80387 || TARGET_SSE"
12482 "if (ix86_expand_setcc (UNGT, operands[0])) DONE; else FAIL;")
12484 (define_expand "sunle"
12485 [(set (match_operand:QI 0 "register_operand" "")
12486 (unle:QI (reg:CC FLAGS_REG) (const_int 0)))]
12487 "TARGET_80387 || TARGET_SSE"
12488 "if (ix86_expand_setcc (UNLE, operands[0])) DONE; else FAIL;")
12490 (define_expand "sunlt"
12491 [(set (match_operand:QI 0 "register_operand" "")
12492 (unlt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12493 "TARGET_80387 || TARGET_SSE"
12494 "if (ix86_expand_setcc (UNLT, operands[0])) DONE; else FAIL;")
12496 (define_expand "sltgt"
12497 [(set (match_operand:QI 0 "register_operand" "")
12498 (ltgt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12499 "TARGET_80387 || TARGET_SSE"
12500 "if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")
12502 (define_insn "*setcc_1"
12503 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12504 (match_operator:QI 1 "ix86_comparison_operator"
12505 [(reg FLAGS_REG) (const_int 0)]))]
12508 [(set_attr "type" "setcc")
12509 (set_attr "mode" "QI")])
12511 (define_insn "*setcc_2"
12512 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12513 (match_operator:QI 1 "ix86_comparison_operator"
12514 [(reg FLAGS_REG) (const_int 0)]))]
12517 [(set_attr "type" "setcc")
12518 (set_attr "mode" "QI")])
12520 ;; In general it is not safe to assume too much about CCmode registers,
12521 ;; so simplify-rtx stops when it sees a second one. Under certain
12522 ;; conditions this is safe on x86, so help combine not create
12529 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12530 (ne:QI (match_operator 1 "ix86_comparison_operator"
12531 [(reg FLAGS_REG) (const_int 0)])
12534 [(set (match_dup 0) (match_dup 1))]
12536 PUT_MODE (operands[1], QImode);
12540 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
12541 (ne:QI (match_operator 1 "ix86_comparison_operator"
12542 [(reg FLAGS_REG) (const_int 0)])
12545 [(set (match_dup 0) (match_dup 1))]
12547 PUT_MODE (operands[1], QImode);
12551 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12552 (eq:QI (match_operator 1 "ix86_comparison_operator"
12553 [(reg FLAGS_REG) (const_int 0)])
12556 [(set (match_dup 0) (match_dup 1))]
12558 rtx new_op1 = copy_rtx (operands[1]);
12559 operands[1] = new_op1;
12560 PUT_MODE (new_op1, QImode);
12561 PUT_CODE (new_op1, ix86_reverse_condition (GET_CODE (new_op1),
12562 GET_MODE (XEXP (new_op1, 0))));
12564 /* Make sure that (a) the CCmode we have for the flags is strong
12565 enough for the reversed compare or (b) we have a valid FP compare. */
12566 if (! ix86_comparison_operator (new_op1, VOIDmode))
12571 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
12572 (eq:QI (match_operator 1 "ix86_comparison_operator"
12573 [(reg FLAGS_REG) (const_int 0)])
12576 [(set (match_dup 0) (match_dup 1))]
12578 rtx new_op1 = copy_rtx (operands[1]);
12579 operands[1] = new_op1;
12580 PUT_MODE (new_op1, QImode);
12581 PUT_CODE (new_op1, ix86_reverse_condition (GET_CODE (new_op1),
12582 GET_MODE (XEXP (new_op1, 0))));
12584 /* Make sure that (a) the CCmode we have for the flags is strong
12585 enough for the reversed compare or (b) we have a valid FP compare. */
12586 if (! ix86_comparison_operator (new_op1, VOIDmode))
12590 ;; The SSE store flag instructions saves 0 or 0xffffffff to the result.
12591 ;; subsequent logical operations are used to imitate conditional moves.
12592 ;; 0xffffffff is NaN, but not in normalized form, so we can't represent
12593 ;; it directly. Further holding this value in pseudo register might bring
12594 ;; problem in implicit normalization in spill code.
12595 ;; So we don't define FLOAT_STORE_FLAG_VALUE and create these
12596 ;; instructions after reload by splitting the conditional move patterns.
12598 (define_insn "*sse_setccsf"
12599 [(set (match_operand:SF 0 "register_operand" "=x")
12600 (match_operator:SF 1 "sse_comparison_operator"
12601 [(match_operand:SF 2 "register_operand" "0")
12602 (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
12603 "TARGET_SSE && reload_completed"
12604 "cmp%D1ss\t{%3, %0|%0, %3}"
12605 [(set_attr "type" "ssecmp")
12606 (set_attr "mode" "SF")])
12608 (define_insn "*sse_setccdf"
12609 [(set (match_operand:DF 0 "register_operand" "=Y")
12610 (match_operator:DF 1 "sse_comparison_operator"
12611 [(match_operand:DF 2 "register_operand" "0")
12612 (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
12613 "TARGET_SSE2 && reload_completed"
12614 "cmp%D1sd\t{%3, %0|%0, %3}"
12615 [(set_attr "type" "ssecmp")
12616 (set_attr "mode" "DF")])
12618 ;; Basic conditional jump instructions.
12619 ;; We ignore the overflow flag for signed branch instructions.
12621 ;; For all bCOND expanders, also expand the compare or test insn that
12622 ;; generates reg FLAGS_REG. Generate an equality comparison if `beq' or `bne'.
12624 (define_expand "beq"
12626 (if_then_else (match_dup 1)
12627 (label_ref (match_operand 0 "" ""))
12630 "ix86_expand_branch (EQ, operands[0]); DONE;")
12632 (define_expand "bne"
12634 (if_then_else (match_dup 1)
12635 (label_ref (match_operand 0 "" ""))
12638 "ix86_expand_branch (NE, operands[0]); DONE;")
12640 (define_expand "bgt"
12642 (if_then_else (match_dup 1)
12643 (label_ref (match_operand 0 "" ""))
12646 "ix86_expand_branch (GT, operands[0]); DONE;")
12648 (define_expand "bgtu"
12650 (if_then_else (match_dup 1)
12651 (label_ref (match_operand 0 "" ""))
12654 "ix86_expand_branch (GTU, operands[0]); DONE;")
12656 (define_expand "blt"
12658 (if_then_else (match_dup 1)
12659 (label_ref (match_operand 0 "" ""))
12662 "ix86_expand_branch (LT, operands[0]); DONE;")
12664 (define_expand "bltu"
12666 (if_then_else (match_dup 1)
12667 (label_ref (match_operand 0 "" ""))
12670 "ix86_expand_branch (LTU, operands[0]); DONE;")
12672 (define_expand "bge"
12674 (if_then_else (match_dup 1)
12675 (label_ref (match_operand 0 "" ""))
12678 "ix86_expand_branch (GE, operands[0]); DONE;")
12680 (define_expand "bgeu"
12682 (if_then_else (match_dup 1)
12683 (label_ref (match_operand 0 "" ""))
12686 "ix86_expand_branch (GEU, operands[0]); DONE;")
12688 (define_expand "ble"
12690 (if_then_else (match_dup 1)
12691 (label_ref (match_operand 0 "" ""))
12694 "ix86_expand_branch (LE, operands[0]); DONE;")
12696 (define_expand "bleu"
12698 (if_then_else (match_dup 1)
12699 (label_ref (match_operand 0 "" ""))
12702 "ix86_expand_branch (LEU, operands[0]); DONE;")
12704 (define_expand "bunordered"
12706 (if_then_else (match_dup 1)
12707 (label_ref (match_operand 0 "" ""))
12709 "TARGET_80387 || TARGET_SSE"
12710 "ix86_expand_branch (UNORDERED, operands[0]); DONE;")
12712 (define_expand "bordered"
12714 (if_then_else (match_dup 1)
12715 (label_ref (match_operand 0 "" ""))
12717 "TARGET_80387 || TARGET_SSE"
12718 "ix86_expand_branch (ORDERED, operands[0]); DONE;")
12720 (define_expand "buneq"
12722 (if_then_else (match_dup 1)
12723 (label_ref (match_operand 0 "" ""))
12725 "TARGET_80387 || TARGET_SSE"
12726 "ix86_expand_branch (UNEQ, operands[0]); DONE;")
12728 (define_expand "bunge"
12730 (if_then_else (match_dup 1)
12731 (label_ref (match_operand 0 "" ""))
12733 "TARGET_80387 || TARGET_SSE"
12734 "ix86_expand_branch (UNGE, operands[0]); DONE;")
12736 (define_expand "bungt"
12738 (if_then_else (match_dup 1)
12739 (label_ref (match_operand 0 "" ""))
12741 "TARGET_80387 || TARGET_SSE"
12742 "ix86_expand_branch (UNGT, operands[0]); DONE;")
12744 (define_expand "bunle"
12746 (if_then_else (match_dup 1)
12747 (label_ref (match_operand 0 "" ""))
12749 "TARGET_80387 || TARGET_SSE"
12750 "ix86_expand_branch (UNLE, operands[0]); DONE;")
12752 (define_expand "bunlt"
12754 (if_then_else (match_dup 1)
12755 (label_ref (match_operand 0 "" ""))
12757 "TARGET_80387 || TARGET_SSE"
12758 "ix86_expand_branch (UNLT, operands[0]); DONE;")
12760 (define_expand "bltgt"
12762 (if_then_else (match_dup 1)
12763 (label_ref (match_operand 0 "" ""))
12765 "TARGET_80387 || TARGET_SSE"
12766 "ix86_expand_branch (LTGT, operands[0]); DONE;")
12768 (define_insn "*jcc_1"
12770 (if_then_else (match_operator 1 "ix86_comparison_operator"
12771 [(reg FLAGS_REG) (const_int 0)])
12772 (label_ref (match_operand 0 "" ""))
12776 [(set_attr "type" "ibr")
12777 (set_attr "modrm" "0")
12778 (set (attr "length")
12779 (if_then_else (and (ge (minus (match_dup 0) (pc))
12781 (lt (minus (match_dup 0) (pc))
12786 (define_insn "*jcc_2"
12788 (if_then_else (match_operator 1 "ix86_comparison_operator"
12789 [(reg FLAGS_REG) (const_int 0)])
12791 (label_ref (match_operand 0 "" ""))))]
12794 [(set_attr "type" "ibr")
12795 (set_attr "modrm" "0")
12796 (set (attr "length")
12797 (if_then_else (and (ge (minus (match_dup 0) (pc))
12799 (lt (minus (match_dup 0) (pc))
12804 ;; In general it is not safe to assume too much about CCmode registers,
12805 ;; so simplify-rtx stops when it sees a second one. Under certain
12806 ;; conditions this is safe on x86, so help combine not create
12814 (if_then_else (ne (match_operator 0 "ix86_comparison_operator"
12815 [(reg FLAGS_REG) (const_int 0)])
12817 (label_ref (match_operand 1 "" ""))
12821 (if_then_else (match_dup 0)
12822 (label_ref (match_dup 1))
12825 PUT_MODE (operands[0], VOIDmode);
12830 (if_then_else (eq (match_operator 0 "ix86_comparison_operator"
12831 [(reg FLAGS_REG) (const_int 0)])
12833 (label_ref (match_operand 1 "" ""))
12837 (if_then_else (match_dup 0)
12838 (label_ref (match_dup 1))
12841 rtx new_op0 = copy_rtx (operands[0]);
12842 operands[0] = new_op0;
12843 PUT_MODE (new_op0, VOIDmode);
12844 PUT_CODE (new_op0, ix86_reverse_condition (GET_CODE (new_op0),
12845 GET_MODE (XEXP (new_op0, 0))));
12847 /* Make sure that (a) the CCmode we have for the flags is strong
12848 enough for the reversed compare or (b) we have a valid FP compare. */
12849 if (! ix86_comparison_operator (new_op0, VOIDmode))
12853 ;; Define combination compare-and-branch fp compare instructions to use
12854 ;; during early optimization. Splitting the operation apart early makes
12855 ;; for bad code when we want to reverse the operation.
12857 (define_insn "*fp_jcc_1"
12859 (if_then_else (match_operator 0 "comparison_operator"
12860 [(match_operand 1 "register_operand" "f")
12861 (match_operand 2 "register_operand" "f")])
12862 (label_ref (match_operand 3 "" ""))
12864 (clobber (reg:CCFP FPSR_REG))
12865 (clobber (reg:CCFP FLAGS_REG))]
12866 "TARGET_CMOVE && TARGET_80387
12867 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12868 && FLOAT_MODE_P (GET_MODE (operands[1]))
12869 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12870 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12873 (define_insn "*fp_jcc_1_sse"
12875 (if_then_else (match_operator 0 "comparison_operator"
12876 [(match_operand 1 "register_operand" "f#x,x#f")
12877 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
12878 (label_ref (match_operand 3 "" ""))
12880 (clobber (reg:CCFP FPSR_REG))
12881 (clobber (reg:CCFP FLAGS_REG))]
12883 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12884 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12885 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12888 (define_insn "*fp_jcc_1_sse_only"
12890 (if_then_else (match_operator 0 "comparison_operator"
12891 [(match_operand 1 "register_operand" "x")
12892 (match_operand 2 "nonimmediate_operand" "xm")])
12893 (label_ref (match_operand 3 "" ""))
12895 (clobber (reg:CCFP FPSR_REG))
12896 (clobber (reg:CCFP FLAGS_REG))]
12897 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12898 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12899 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12902 (define_insn "*fp_jcc_2"
12904 (if_then_else (match_operator 0 "comparison_operator"
12905 [(match_operand 1 "register_operand" "f")
12906 (match_operand 2 "register_operand" "f")])
12908 (label_ref (match_operand 3 "" ""))))
12909 (clobber (reg:CCFP FPSR_REG))
12910 (clobber (reg:CCFP FLAGS_REG))]
12911 "TARGET_CMOVE && TARGET_80387
12912 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12913 && FLOAT_MODE_P (GET_MODE (operands[1]))
12914 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12915 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12918 (define_insn "*fp_jcc_2_sse"
12920 (if_then_else (match_operator 0 "comparison_operator"
12921 [(match_operand 1 "register_operand" "f#x,x#f")
12922 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
12924 (label_ref (match_operand 3 "" ""))))
12925 (clobber (reg:CCFP FPSR_REG))
12926 (clobber (reg:CCFP FLAGS_REG))]
12928 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12929 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12930 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12933 (define_insn "*fp_jcc_2_sse_only"
12935 (if_then_else (match_operator 0 "comparison_operator"
12936 [(match_operand 1 "register_operand" "x")
12937 (match_operand 2 "nonimmediate_operand" "xm")])
12939 (label_ref (match_operand 3 "" ""))))
12940 (clobber (reg:CCFP FPSR_REG))
12941 (clobber (reg:CCFP FLAGS_REG))]
12942 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12943 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12944 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12947 (define_insn "*fp_jcc_3"
12949 (if_then_else (match_operator 0 "comparison_operator"
12950 [(match_operand 1 "register_operand" "f")
12951 (match_operand 2 "nonimmediate_operand" "fm")])
12952 (label_ref (match_operand 3 "" ""))
12954 (clobber (reg:CCFP FPSR_REG))
12955 (clobber (reg:CCFP FLAGS_REG))
12956 (clobber (match_scratch:HI 4 "=a"))]
12958 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
12959 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12960 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
12961 && SELECT_CC_MODE (GET_CODE (operands[0]),
12962 operands[1], operands[2]) == CCFPmode
12963 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12966 (define_insn "*fp_jcc_4"
12968 (if_then_else (match_operator 0 "comparison_operator"
12969 [(match_operand 1 "register_operand" "f")
12970 (match_operand 2 "nonimmediate_operand" "fm")])
12972 (label_ref (match_operand 3 "" ""))))
12973 (clobber (reg:CCFP FPSR_REG))
12974 (clobber (reg:CCFP FLAGS_REG))
12975 (clobber (match_scratch:HI 4 "=a"))]
12977 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
12978 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12979 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
12980 && SELECT_CC_MODE (GET_CODE (operands[0]),
12981 operands[1], operands[2]) == CCFPmode
12982 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12985 (define_insn "*fp_jcc_5"
12987 (if_then_else (match_operator 0 "comparison_operator"
12988 [(match_operand 1 "register_operand" "f")
12989 (match_operand 2 "register_operand" "f")])
12990 (label_ref (match_operand 3 "" ""))
12992 (clobber (reg:CCFP FPSR_REG))
12993 (clobber (reg:CCFP FLAGS_REG))
12994 (clobber (match_scratch:HI 4 "=a"))]
12996 && FLOAT_MODE_P (GET_MODE (operands[1]))
12997 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12998 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13001 (define_insn "*fp_jcc_6"
13003 (if_then_else (match_operator 0 "comparison_operator"
13004 [(match_operand 1 "register_operand" "f")
13005 (match_operand 2 "register_operand" "f")])
13007 (label_ref (match_operand 3 "" ""))))
13008 (clobber (reg:CCFP FPSR_REG))
13009 (clobber (reg:CCFP FLAGS_REG))
13010 (clobber (match_scratch:HI 4 "=a"))]
13012 && FLOAT_MODE_P (GET_MODE (operands[1]))
13013 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13014 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13017 (define_insn "*fp_jcc_7"
13019 (if_then_else (match_operator 0 "comparison_operator"
13020 [(match_operand 1 "register_operand" "f")
13021 (match_operand 2 "const_double_operand" "C")])
13022 (label_ref (match_operand 3 "" ""))
13024 (clobber (reg:CCFP FPSR_REG))
13025 (clobber (reg:CCFP FLAGS_REG))
13026 (clobber (match_scratch:HI 4 "=a"))]
13028 && FLOAT_MODE_P (GET_MODE (operands[1]))
13029 && operands[2] == CONST0_RTX (GET_MODE (operands[1]))
13030 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
13031 && SELECT_CC_MODE (GET_CODE (operands[0]),
13032 operands[1], operands[2]) == CCFPmode
13033 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13036 ;; The order of operands in *fp_jcc_8 is forced by combine in
13037 ;; simplify_comparison () function. Float operator is treated as RTX_OBJ
13038 ;; with a precedence over other operators and is always put in the first
13039 ;; place. Swap condition and operands to match ficom instruction.
13041 (define_insn "*fp_jcc_8"
13043 (if_then_else (match_operator 0 "comparison_operator"
13044 [(match_operator 1 "float_operator"
13045 [(match_operand:SI 2 "nonimmediate_operand" "m,?r")])
13046 (match_operand 3 "register_operand" "f,f")])
13047 (label_ref (match_operand 4 "" ""))
13049 (clobber (reg:CCFP FPSR_REG))
13050 (clobber (reg:CCFP FLAGS_REG))
13051 (clobber (match_scratch:HI 5 "=a,a"))]
13052 "TARGET_80387 && TARGET_USE_FIOP
13053 && FLOAT_MODE_P (GET_MODE (operands[3]))
13054 && GET_MODE (operands[1]) == GET_MODE (operands[3])
13055 && !ix86_use_fcomi_compare (swap_condition (GET_CODE (operands[0])))
13056 && ix86_fp_compare_mode (swap_condition (GET_CODE (operands[0]))) == CCFPmode
13057 && ix86_fp_jump_nontrivial_p (swap_condition (GET_CODE (operands[0])))"
13062 (if_then_else (match_operator 0 "comparison_operator"
13063 [(match_operand 1 "register_operand" "")
13064 (match_operand 2 "nonimmediate_operand" "")])
13065 (match_operand 3 "" "")
13066 (match_operand 4 "" "")))
13067 (clobber (reg:CCFP FPSR_REG))
13068 (clobber (reg:CCFP FLAGS_REG))]
13072 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13073 operands[3], operands[4], NULL_RTX, NULL_RTX);
13079 (if_then_else (match_operator 0 "comparison_operator"
13080 [(match_operand 1 "register_operand" "")
13081 (match_operand 2 "general_operand" "")])
13082 (match_operand 3 "" "")
13083 (match_operand 4 "" "")))
13084 (clobber (reg:CCFP FPSR_REG))
13085 (clobber (reg:CCFP FLAGS_REG))
13086 (clobber (match_scratch:HI 5 "=a"))]
13090 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13091 operands[3], operands[4], operands[5], NULL_RTX);
13097 (if_then_else (match_operator 0 "comparison_operator"
13098 [(match_operator 1 "float_operator"
13099 [(match_operand:SI 2 "memory_operand" "")])
13100 (match_operand 3 "register_operand" "")])
13101 (match_operand 4 "" "")
13102 (match_operand 5 "" "")))
13103 (clobber (reg:CCFP FPSR_REG))
13104 (clobber (reg:CCFP FLAGS_REG))
13105 (clobber (match_scratch:HI 6 "=a"))]
13109 operands[7] = gen_rtx_FLOAT (GET_MODE (operands[1]), operands[2]);
13110 ix86_split_fp_branch (swap_condition (GET_CODE (operands[0])),
13111 operands[3], operands[7],
13112 operands[4], operands[5], operands[6], NULL_RTX);
13116 ;; %%% Kill this when reload knows how to do it.
13119 (if_then_else (match_operator 0 "comparison_operator"
13120 [(match_operator 1 "float_operator"
13121 [(match_operand:SI 2 "register_operand" "")])
13122 (match_operand 3 "register_operand" "")])
13123 (match_operand 4 "" "")
13124 (match_operand 5 "" "")))
13125 (clobber (reg:CCFP FPSR_REG))
13126 (clobber (reg:CCFP FLAGS_REG))
13127 (clobber (match_scratch:HI 6 "=a"))]
13131 operands[7] = ix86_force_to_memory (GET_MODE (operands[2]), operands[2]);
13132 operands[7] = gen_rtx_FLOAT (GET_MODE (operands[1]), operands[7]);
13133 ix86_split_fp_branch (swap_condition (GET_CODE (operands[0])),
13134 operands[3], operands[7],
13135 operands[4], operands[5], operands[6], operands[2]);
13139 ;; Unconditional and other jump instructions
13141 (define_insn "jump"
13143 (label_ref (match_operand 0 "" "")))]
13146 [(set_attr "type" "ibr")
13147 (set (attr "length")
13148 (if_then_else (and (ge (minus (match_dup 0) (pc))
13150 (lt (minus (match_dup 0) (pc))
13154 (set_attr "modrm" "0")])
13156 (define_expand "indirect_jump"
13157 [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))]
13161 (define_insn "*indirect_jump"
13162 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
13165 [(set_attr "type" "ibr")
13166 (set_attr "length_immediate" "0")])
13168 (define_insn "*indirect_jump_rtx64"
13169 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))]
13172 [(set_attr "type" "ibr")
13173 (set_attr "length_immediate" "0")])
13175 (define_expand "tablejump"
13176 [(parallel [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))
13177 (use (label_ref (match_operand 1 "" "")))])]
13180 /* In PIC mode, the table entries are stored GOT (32-bit) or PC (64-bit)
13181 relative. Convert the relative address to an absolute address. */
13185 enum rtx_code code;
13191 op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
13193 else if (TARGET_MACHO || HAVE_AS_GOTOFF_IN_DATA)
13197 op1 = pic_offset_table_rtx;
13202 op0 = pic_offset_table_rtx;
13206 operands[0] = expand_simple_binop (Pmode, code, op0, op1, NULL_RTX, 0,
13211 (define_insn "*tablejump_1"
13212 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))
13213 (use (label_ref (match_operand 1 "" "")))]
13216 [(set_attr "type" "ibr")
13217 (set_attr "length_immediate" "0")])
13219 (define_insn "*tablejump_1_rtx64"
13220 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))
13221 (use (label_ref (match_operand 1 "" "")))]
13224 [(set_attr "type" "ibr")
13225 (set_attr "length_immediate" "0")])
13227 ;; Loop instruction
13229 ;; This is all complicated by the fact that since this is a jump insn
13230 ;; we must handle our own reloads.
13232 (define_expand "doloop_end"
13233 [(use (match_operand 0 "" "")) ; loop pseudo
13234 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13235 (use (match_operand 2 "" "")) ; max iterations
13236 (use (match_operand 3 "" "")) ; loop level
13237 (use (match_operand 4 "" ""))] ; label
13238 "!TARGET_64BIT && TARGET_USE_LOOP"
13241 /* Only use cloop on innermost loops. */
13242 if (INTVAL (operands[3]) > 1)
13244 if (GET_MODE (operands[0]) != SImode)
13246 emit_jump_insn (gen_doloop_end_internal (operands[4], operands[0],
13251 (define_insn "doloop_end_internal"
13253 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,?*r,?*r")
13255 (label_ref (match_operand 0 "" ""))
13257 (set (match_operand:SI 2 "nonimmediate_operand" "=1,1,*m*r")
13258 (plus:SI (match_dup 1)
13260 (clobber (match_scratch:SI 3 "=X,X,r"))
13261 (clobber (reg:CC FLAGS_REG))]
13262 "!TARGET_64BIT && TARGET_USE_LOOP
13263 && (reload_in_progress || reload_completed
13264 || register_operand (operands[2], VOIDmode))"
13266 if (which_alternative != 0)
13268 if (get_attr_length (insn) == 2)
13269 return "%+loop\t%l0";
13271 return "dec{l}\t%1\;%+jne\t%l0";
13273 [(set (attr "length")
13274 (if_then_else (and (eq_attr "alternative" "0")
13275 (and (ge (minus (match_dup 0) (pc))
13277 (lt (minus (match_dup 0) (pc))
13281 ;; We don't know the type before shorten branches. Optimistically expect
13282 ;; the loop instruction to match.
13283 (set (attr "type") (const_string "ibr"))])
13287 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13289 (match_operand 0 "" "")
13292 (plus:SI (match_dup 1)
13294 (clobber (match_scratch:SI 2 ""))
13295 (clobber (reg:CC FLAGS_REG))]
13296 "!TARGET_64BIT && TARGET_USE_LOOP
13297 && reload_completed
13298 && REGNO (operands[1]) != 2"
13299 [(parallel [(set (reg:CCZ FLAGS_REG)
13300 (compare:CCZ (plus:SI (match_dup 1) (const_int -1))
13302 (set (match_dup 1) (plus:SI (match_dup 1) (const_int -1)))])
13303 (set (pc) (if_then_else (ne (reg:CCZ FLAGS_REG) (const_int 0))
13310 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13312 (match_operand 0 "" "")
13314 (set (match_operand:SI 2 "nonimmediate_operand" "")
13315 (plus:SI (match_dup 1)
13317 (clobber (match_scratch:SI 3 ""))
13318 (clobber (reg:CC FLAGS_REG))]
13319 "!TARGET_64BIT && TARGET_USE_LOOP
13320 && reload_completed
13321 && (! REG_P (operands[2])
13322 || ! rtx_equal_p (operands[1], operands[2]))"
13323 [(set (match_dup 3) (match_dup 1))
13324 (parallel [(set (reg:CCZ FLAGS_REG)
13325 (compare:CCZ (plus:SI (match_dup 3) (const_int -1))
13327 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
13328 (set (match_dup 2) (match_dup 3))
13329 (set (pc) (if_then_else (ne (reg:CCZ FLAGS_REG) (const_int 0))
13334 ;; Convert setcc + movzbl to xor + setcc if operands don't overlap.
13337 [(set (reg FLAGS_REG) (match_operand 0 "" ""))
13338 (set (match_operand:QI 1 "register_operand" "")
13339 (match_operator:QI 2 "ix86_comparison_operator"
13340 [(reg FLAGS_REG) (const_int 0)]))
13341 (set (match_operand 3 "q_regs_operand" "")
13342 (zero_extend (match_dup 1)))]
13343 "(peep2_reg_dead_p (3, operands[1])
13344 || operands_match_p (operands[1], operands[3]))
13345 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13346 [(set (match_dup 4) (match_dup 0))
13347 (set (strict_low_part (match_dup 5))
13350 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13351 operands[5] = gen_lowpart (QImode, operands[3]);
13352 ix86_expand_clear (operands[3]);
13355 ;; Similar, but match zero_extendhisi2_and, which adds a clobber.
13358 [(set (reg FLAGS_REG) (match_operand 0 "" ""))
13359 (set (match_operand:QI 1 "register_operand" "")
13360 (match_operator:QI 2 "ix86_comparison_operator"
13361 [(reg FLAGS_REG) (const_int 0)]))
13362 (parallel [(set (match_operand 3 "q_regs_operand" "")
13363 (zero_extend (match_dup 1)))
13364 (clobber (reg:CC FLAGS_REG))])]
13365 "(peep2_reg_dead_p (3, operands[1])
13366 || operands_match_p (operands[1], operands[3]))
13367 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13368 [(set (match_dup 4) (match_dup 0))
13369 (set (strict_low_part (match_dup 5))
13372 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13373 operands[5] = gen_lowpart (QImode, operands[3]);
13374 ix86_expand_clear (operands[3]);
13377 ;; Call instructions.
13379 ;; The predicates normally associated with named expanders are not properly
13380 ;; checked for calls. This is a bug in the generic code, but it isn't that
13381 ;; easy to fix. Ignore it for now and be prepared to fix things up.
13383 ;; Call subroutine returning no value.
13385 (define_expand "call_pop"
13386 [(parallel [(call (match_operand:QI 0 "" "")
13387 (match_operand:SI 1 "" ""))
13388 (set (reg:SI SP_REG)
13389 (plus:SI (reg:SI SP_REG)
13390 (match_operand:SI 3 "" "")))])]
13393 ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3], 0);
13397 (define_insn "*call_pop_0"
13398 [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" ""))
13399 (match_operand:SI 1 "" ""))
13400 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
13401 (match_operand:SI 2 "immediate_operand" "")))]
13404 if (SIBLING_CALL_P (insn))
13407 return "call\t%P0";
13409 [(set_attr "type" "call")])
13411 (define_insn "*call_pop_1"
13412 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
13413 (match_operand:SI 1 "" ""))
13414 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
13415 (match_operand:SI 2 "immediate_operand" "i")))]
13418 if (constant_call_address_operand (operands[0], Pmode))
13420 if (SIBLING_CALL_P (insn))
13423 return "call\t%P0";
13425 if (SIBLING_CALL_P (insn))
13428 return "call\t%A0";
13430 [(set_attr "type" "call")])
13432 (define_expand "call"
13433 [(call (match_operand:QI 0 "" "")
13434 (match_operand 1 "" ""))
13435 (use (match_operand 2 "" ""))]
13438 ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 0);
13442 (define_expand "sibcall"
13443 [(call (match_operand:QI 0 "" "")
13444 (match_operand 1 "" ""))
13445 (use (match_operand 2 "" ""))]
13448 ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 1);
13452 (define_insn "*call_0"
13453 [(call (mem:QI (match_operand 0 "constant_call_address_operand" ""))
13454 (match_operand 1 "" ""))]
13457 if (SIBLING_CALL_P (insn))
13460 return "call\t%P0";
13462 [(set_attr "type" "call")])
13464 (define_insn "*call_1"
13465 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
13466 (match_operand 1 "" ""))]
13467 "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
13469 if (constant_call_address_operand (operands[0], Pmode))
13470 return "call\t%P0";
13471 return "call\t%A0";
13473 [(set_attr "type" "call")])
13475 (define_insn "*sibcall_1"
13476 [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,c,d,a"))
13477 (match_operand 1 "" ""))]
13478 "SIBLING_CALL_P (insn) && !TARGET_64BIT"
13480 if (constant_call_address_operand (operands[0], Pmode))
13484 [(set_attr "type" "call")])
13486 (define_insn "*call_1_rex64"
13487 [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm"))
13488 (match_operand 1 "" ""))]
13489 "!SIBLING_CALL_P (insn) && TARGET_64BIT"
13491 if (constant_call_address_operand (operands[0], Pmode))
13492 return "call\t%P0";
13493 return "call\t%A0";
13495 [(set_attr "type" "call")])
13497 (define_insn "*sibcall_1_rex64"
13498 [(call (mem:QI (match_operand:DI 0 "constant_call_address_operand" ""))
13499 (match_operand 1 "" ""))]
13500 "SIBLING_CALL_P (insn) && TARGET_64BIT"
13502 [(set_attr "type" "call")])
13504 (define_insn "*sibcall_1_rex64_v"
13505 [(call (mem:QI (reg:DI 40))
13506 (match_operand 0 "" ""))]
13507 "SIBLING_CALL_P (insn) && TARGET_64BIT"
13509 [(set_attr "type" "call")])
13512 ;; Call subroutine, returning value in operand 0
13514 (define_expand "call_value_pop"
13515 [(parallel [(set (match_operand 0 "" "")
13516 (call (match_operand:QI 1 "" "")
13517 (match_operand:SI 2 "" "")))
13518 (set (reg:SI SP_REG)
13519 (plus:SI (reg:SI SP_REG)
13520 (match_operand:SI 4 "" "")))])]
13523 ix86_expand_call (operands[0], operands[1], operands[2],
13524 operands[3], operands[4], 0);
13528 (define_expand "call_value"
13529 [(set (match_operand 0 "" "")
13530 (call (match_operand:QI 1 "" "")
13531 (match_operand:SI 2 "" "")))
13532 (use (match_operand:SI 3 "" ""))]
13533 ;; Operand 2 not used on the i386.
13536 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 0);
13540 (define_expand "sibcall_value"
13541 [(set (match_operand 0 "" "")
13542 (call (match_operand:QI 1 "" "")
13543 (match_operand:SI 2 "" "")))
13544 (use (match_operand:SI 3 "" ""))]
13545 ;; Operand 2 not used on the i386.
13548 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 1);
13552 ;; Call subroutine returning any type.
13554 (define_expand "untyped_call"
13555 [(parallel [(call (match_operand 0 "" "")
13557 (match_operand 1 "" "")
13558 (match_operand 2 "" "")])]
13563 /* In order to give reg-stack an easier job in validating two
13564 coprocessor registers as containing a possible return value,
13565 simply pretend the untyped call returns a complex long double
13568 ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
13569 ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
13570 operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1),
13573 for (i = 0; i < XVECLEN (operands[2], 0); i++)
13575 rtx set = XVECEXP (operands[2], 0, i);
13576 emit_move_insn (SET_DEST (set), SET_SRC (set));
13579 /* The optimizer does not know that the call sets the function value
13580 registers we stored in the result block. We avoid problems by
13581 claiming that all hard registers are used and clobbered at this
13583 emit_insn (gen_blockage (const0_rtx));
13588 ;; Prologue and epilogue instructions
13590 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13591 ;; all of memory. This blocks insns from being moved across this point.
13593 (define_insn "blockage"
13594 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_BLOCKAGE)]
13597 [(set_attr "length" "0")])
13599 ;; Insn emitted into the body of a function to return from a function.
13600 ;; This is only done if the function's epilogue is known to be simple.
13601 ;; See comments for ix86_can_use_return_insn_p in i386.c.
13603 (define_expand "return"
13605 "ix86_can_use_return_insn_p ()"
13607 if (current_function_pops_args)
13609 rtx popc = GEN_INT (current_function_pops_args);
13610 emit_jump_insn (gen_return_pop_internal (popc));
13615 (define_insn "return_internal"
13619 [(set_attr "length" "1")
13620 (set_attr "length_immediate" "0")
13621 (set_attr "modrm" "0")])
13623 ;; Used by x86_machine_dependent_reorg to avoid penalty on single byte RET
13624 ;; instruction Athlon and K8 have.
13626 (define_insn "return_internal_long"
13628 (unspec [(const_int 0)] UNSPEC_REP)]
13631 [(set_attr "length" "1")
13632 (set_attr "length_immediate" "0")
13633 (set_attr "prefix_rep" "1")
13634 (set_attr "modrm" "0")])
13636 (define_insn "return_pop_internal"
13638 (use (match_operand:SI 0 "const_int_operand" ""))]
13641 [(set_attr "length" "3")
13642 (set_attr "length_immediate" "2")
13643 (set_attr "modrm" "0")])
13645 (define_insn "return_indirect_internal"
13647 (use (match_operand:SI 0 "register_operand" "r"))]
13650 [(set_attr "type" "ibr")
13651 (set_attr "length_immediate" "0")])
13657 [(set_attr "length" "1")
13658 (set_attr "length_immediate" "0")
13659 (set_attr "modrm" "0")])
13661 ;; Align to 16-byte boundary, max skip in op0. Used to avoid
13662 ;; branch prediction penalty for the third jump in a 16-byte
13665 (define_insn "align"
13666 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_ALIGN)]
13669 #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
13670 ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, (int)INTVAL (operands[0]));
13672 /* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that.
13673 The align insn is used to avoid 3 jump instructions in the row to improve
13674 branch prediction and the benefits hardly outweight the cost of extra 8
13675 nops on the average inserted by full alignment pseudo operation. */
13679 [(set_attr "length" "16")])
13681 (define_expand "prologue"
13684 "ix86_expand_prologue (); DONE;")
13686 (define_insn "set_got"
13687 [(set (match_operand:SI 0 "register_operand" "=r")
13688 (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
13689 (clobber (reg:CC FLAGS_REG))]
13691 { return output_set_got (operands[0]); }
13692 [(set_attr "type" "multi")
13693 (set_attr "length" "12")])
13695 (define_expand "epilogue"
13698 "ix86_expand_epilogue (1); DONE;")
13700 (define_expand "sibcall_epilogue"
13703 "ix86_expand_epilogue (0); DONE;")
13705 (define_expand "eh_return"
13706 [(use (match_operand 0 "register_operand" ""))]
13709 rtx tmp, sa = EH_RETURN_STACKADJ_RTX, ra = operands[0];
13711 /* Tricky bit: we write the address of the handler to which we will
13712 be returning into someone else's stack frame, one word below the
13713 stack address we wish to restore. */
13714 tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
13715 tmp = plus_constant (tmp, -UNITS_PER_WORD);
13716 tmp = gen_rtx_MEM (Pmode, tmp);
13717 emit_move_insn (tmp, ra);
13719 if (Pmode == SImode)
13720 emit_jump_insn (gen_eh_return_si (sa));
13722 emit_jump_insn (gen_eh_return_di (sa));
13727 (define_insn_and_split "eh_return_si"
13729 (unspec [(match_operand:SI 0 "register_operand" "c")]
13730 UNSPEC_EH_RETURN))]
13735 "ix86_expand_epilogue (2); DONE;")
13737 (define_insn_and_split "eh_return_di"
13739 (unspec [(match_operand:DI 0 "register_operand" "c")]
13740 UNSPEC_EH_RETURN))]
13745 "ix86_expand_epilogue (2); DONE;")
13747 (define_insn "leave"
13748 [(set (reg:SI SP_REG) (plus:SI (reg:SI BP_REG) (const_int 4)))
13749 (set (reg:SI BP_REG) (mem:SI (reg:SI BP_REG)))
13750 (clobber (mem:BLK (scratch)))]
13753 [(set_attr "type" "leave")])
13755 (define_insn "leave_rex64"
13756 [(set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
13757 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
13758 (clobber (mem:BLK (scratch)))]
13761 [(set_attr "type" "leave")])
13763 (define_expand "ffssi2"
13765 [(set (match_operand:SI 0 "register_operand" "")
13766 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "")))
13767 (clobber (match_scratch:SI 2 ""))
13768 (clobber (reg:CC FLAGS_REG))])]
13772 (define_insn_and_split "*ffs_cmove"
13773 [(set (match_operand:SI 0 "register_operand" "=r")
13774 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
13775 (clobber (match_scratch:SI 2 "=&r"))
13776 (clobber (reg:CC FLAGS_REG))]
13779 "&& reload_completed"
13780 [(set (match_dup 2) (const_int -1))
13781 (parallel [(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 1) (const_int 0)))
13782 (set (match_dup 0) (ctz:SI (match_dup 1)))])
13783 (set (match_dup 0) (if_then_else:SI
13784 (eq (reg:CCZ FLAGS_REG) (const_int 0))
13787 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
13788 (clobber (reg:CC FLAGS_REG))])]
13791 (define_insn_and_split "*ffs_no_cmove"
13792 [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
13793 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
13794 (clobber (match_scratch:SI 2 "=&q"))
13795 (clobber (reg:CC FLAGS_REG))]
13799 [(parallel [(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 1) (const_int 0)))
13800 (set (match_dup 0) (ctz:SI (match_dup 1)))])
13801 (set (strict_low_part (match_dup 3))
13802 (eq:QI (reg:CCZ FLAGS_REG) (const_int 0)))
13803 (parallel [(set (match_dup 2) (neg:SI (match_dup 2)))
13804 (clobber (reg:CC FLAGS_REG))])
13805 (parallel [(set (match_dup 0) (ior:SI (match_dup 0) (match_dup 2)))
13806 (clobber (reg:CC FLAGS_REG))])
13807 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
13808 (clobber (reg:CC FLAGS_REG))])]
13810 operands[3] = gen_lowpart (QImode, operands[2]);
13811 ix86_expand_clear (operands[2]);
13814 (define_insn "*ffssi_1"
13815 [(set (reg:CCZ FLAGS_REG)
13816 (compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm")
13818 (set (match_operand:SI 0 "register_operand" "=r")
13819 (ctz:SI (match_dup 1)))]
13821 "bsf{l}\t{%1, %0|%0, %1}"
13822 [(set_attr "prefix_0f" "1")])
13824 (define_expand "ffsdi2"
13826 [(set (match_operand:DI 0 "register_operand" "")
13827 (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "")))
13828 (clobber (match_scratch:DI 2 ""))
13829 (clobber (reg:CC FLAGS_REG))])]
13830 "TARGET_64BIT && TARGET_CMOVE"
13833 (define_insn_and_split "*ffs_rex64"
13834 [(set (match_operand:DI 0 "register_operand" "=r")
13835 (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
13836 (clobber (match_scratch:DI 2 "=&r"))
13837 (clobber (reg:CC FLAGS_REG))]
13838 "TARGET_64BIT && TARGET_CMOVE"
13840 "&& reload_completed"
13841 [(set (match_dup 2) (const_int -1))
13842 (parallel [(set (reg:CCZ FLAGS_REG)
13843 (compare:CCZ (match_dup 1) (const_int 0)))
13844 (set (match_dup 0) (ctz:DI (match_dup 1)))])
13845 (set (match_dup 0) (if_then_else:DI
13846 (eq (reg:CCZ FLAGS_REG) (const_int 0))
13849 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
13850 (clobber (reg:CC FLAGS_REG))])]
13853 (define_insn "*ffsdi_1"
13854 [(set (reg:CCZ FLAGS_REG)
13855 (compare:CCZ (match_operand:DI 1 "nonimmediate_operand" "rm")
13857 (set (match_operand:DI 0 "register_operand" "=r")
13858 (ctz:DI (match_dup 1)))]
13860 "bsf{q}\t{%1, %0|%0, %1}"
13861 [(set_attr "prefix_0f" "1")])
13863 (define_insn "ctzsi2"
13864 [(set (match_operand:SI 0 "register_operand" "=r")
13865 (ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
13866 (clobber (reg:CC FLAGS_REG))]
13868 "bsf{l}\t{%1, %0|%0, %1}"
13869 [(set_attr "prefix_0f" "1")])
13871 (define_insn "ctzdi2"
13872 [(set (match_operand:DI 0 "register_operand" "=r")
13873 (ctz:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
13874 (clobber (reg:CC FLAGS_REG))]
13876 "bsf{q}\t{%1, %0|%0, %1}"
13877 [(set_attr "prefix_0f" "1")])
13879 (define_expand "clzsi2"
13881 [(set (match_operand:SI 0 "register_operand" "")
13882 (minus:SI (const_int 31)
13883 (clz:SI (match_operand:SI 1 "nonimmediate_operand" ""))))
13884 (clobber (reg:CC FLAGS_REG))])
13886 [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 31)))
13887 (clobber (reg:CC FLAGS_REG))])]
13891 (define_insn "*bsr"
13892 [(set (match_operand:SI 0 "register_operand" "=r")
13893 (minus:SI (const_int 31)
13894 (clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))))
13895 (clobber (reg:CC FLAGS_REG))]
13897 "bsr{l}\t{%1, %0|%0, %1}"
13898 [(set_attr "prefix_0f" "1")])
13900 (define_expand "clzdi2"
13902 [(set (match_operand:DI 0 "register_operand" "")
13903 (minus:DI (const_int 63)
13904 (clz:DI (match_operand:DI 1 "nonimmediate_operand" ""))))
13905 (clobber (reg:CC FLAGS_REG))])
13907 [(set (match_dup 0) (xor:DI (match_dup 0) (const_int 63)))
13908 (clobber (reg:CC FLAGS_REG))])]
13912 (define_insn "*bsr_rex64"
13913 [(set (match_operand:DI 0 "register_operand" "=r")
13914 (minus:DI (const_int 63)
13915 (clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))))
13916 (clobber (reg:CC FLAGS_REG))]
13918 "bsr{q}\t{%1, %0|%0, %1}"
13919 [(set_attr "prefix_0f" "1")])
13921 ;; Thread-local storage patterns for ELF.
13923 ;; Note that these code sequences must appear exactly as shown
13924 ;; in order to allow linker relaxation.
13926 (define_insn "*tls_global_dynamic_32_gnu"
13927 [(set (match_operand:SI 0 "register_operand" "=a")
13928 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13929 (match_operand:SI 2 "tls_symbolic_operand" "")
13930 (match_operand:SI 3 "call_insn_operand" "")]
13932 (clobber (match_scratch:SI 4 "=d"))
13933 (clobber (match_scratch:SI 5 "=c"))
13934 (clobber (reg:CC FLAGS_REG))]
13935 "!TARGET_64BIT && TARGET_GNU_TLS"
13936 "lea{l}\t{%a2@TLSGD(,%1,1), %0|%0, %a2@TLSGD[%1*1]}\;call\t%P3"
13937 [(set_attr "type" "multi")
13938 (set_attr "length" "12")])
13940 (define_insn "*tls_global_dynamic_32_sun"
13941 [(set (match_operand:SI 0 "register_operand" "=a")
13942 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13943 (match_operand:SI 2 "tls_symbolic_operand" "")
13944 (match_operand:SI 3 "call_insn_operand" "")]
13946 (clobber (match_scratch:SI 4 "=d"))
13947 (clobber (match_scratch:SI 5 "=c"))
13948 (clobber (reg:CC FLAGS_REG))]
13949 "!TARGET_64BIT && TARGET_SUN_TLS"
13950 "lea{l}\t{%a2@DTLNDX(%1), %4|%4, %a2@DTLNDX[%1]}
13951 push{l}\t%4\;call\t%a2@TLSPLT\;pop{l}\t%4\;nop"
13952 [(set_attr "type" "multi")
13953 (set_attr "length" "14")])
13955 (define_expand "tls_global_dynamic_32"
13956 [(parallel [(set (match_operand:SI 0 "register_operand" "")
13959 (match_operand:SI 1 "tls_symbolic_operand" "")
13962 (clobber (match_scratch:SI 4 ""))
13963 (clobber (match_scratch:SI 5 ""))
13964 (clobber (reg:CC FLAGS_REG))])]
13968 operands[2] = pic_offset_table_rtx;
13971 operands[2] = gen_reg_rtx (Pmode);
13972 emit_insn (gen_set_got (operands[2]));
13974 operands[3] = ix86_tls_get_addr ();
13977 (define_insn "*tls_global_dynamic_64"
13978 [(set (match_operand:DI 0 "register_operand" "=a")
13979 (call (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
13980 (match_operand:DI 3 "" "")))
13981 (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
13984 ".byte\t0x66\;lea{q}\t{%a1@TLSGD(%%rip), %%rdi|%%rdi, %a1@TLSGD[%%rip]}\;.word\t0x6666\;rex64\;call\t%P2"
13985 [(set_attr "type" "multi")
13986 (set_attr "length" "16")])
13988 (define_expand "tls_global_dynamic_64"
13989 [(parallel [(set (match_operand:DI 0 "register_operand" "")
13990 (call (mem:QI (match_dup 2)) (const_int 0)))
13991 (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
13995 operands[2] = ix86_tls_get_addr ();
13998 (define_insn "*tls_local_dynamic_base_32_gnu"
13999 [(set (match_operand:SI 0 "register_operand" "=a")
14000 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14001 (match_operand:SI 2 "call_insn_operand" "")]
14002 UNSPEC_TLS_LD_BASE))
14003 (clobber (match_scratch:SI 3 "=d"))
14004 (clobber (match_scratch:SI 4 "=c"))
14005 (clobber (reg:CC FLAGS_REG))]
14006 "!TARGET_64BIT && TARGET_GNU_TLS"
14007 "lea{l}\t{%&@TLSLDM(%1), %0|%0, %&@TLSLDM[%1]}\;call\t%P2"
14008 [(set_attr "type" "multi")
14009 (set_attr "length" "11")])
14011 (define_insn "*tls_local_dynamic_base_32_sun"
14012 [(set (match_operand:SI 0 "register_operand" "=a")
14013 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14014 (match_operand:SI 2 "call_insn_operand" "")]
14015 UNSPEC_TLS_LD_BASE))
14016 (clobber (match_scratch:SI 3 "=d"))
14017 (clobber (match_scratch:SI 4 "=c"))
14018 (clobber (reg:CC FLAGS_REG))]
14019 "!TARGET_64BIT && TARGET_SUN_TLS"
14020 "lea{l}\t{%&@TMDNX(%1), %3|%3, %&@TMDNX[%1]}
14021 push{l}\t%3\;call\t%&@TLSPLT\;pop{l}\t%3"
14022 [(set_attr "type" "multi")
14023 (set_attr "length" "13")])
14025 (define_expand "tls_local_dynamic_base_32"
14026 [(parallel [(set (match_operand:SI 0 "register_operand" "")
14027 (unspec:SI [(match_dup 1) (match_dup 2)]
14028 UNSPEC_TLS_LD_BASE))
14029 (clobber (match_scratch:SI 3 ""))
14030 (clobber (match_scratch:SI 4 ""))
14031 (clobber (reg:CC FLAGS_REG))])]
14035 operands[1] = pic_offset_table_rtx;
14038 operands[1] = gen_reg_rtx (Pmode);
14039 emit_insn (gen_set_got (operands[1]));
14041 operands[2] = ix86_tls_get_addr ();
14044 (define_insn "*tls_local_dynamic_base_64"
14045 [(set (match_operand:DI 0 "register_operand" "=a")
14046 (call (mem:QI (match_operand:DI 1 "call_insn_operand" ""))
14047 (match_operand:DI 2 "" "")))
14048 (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)]
14050 "lea{q}\t{%&@TLSLD(%%rip), %%rdi|%%rdi, %&@TLSLD[%%rip]}\;call\t%P1"
14051 [(set_attr "type" "multi")
14052 (set_attr "length" "12")])
14054 (define_expand "tls_local_dynamic_base_64"
14055 [(parallel [(set (match_operand:DI 0 "register_operand" "")
14056 (call (mem:QI (match_dup 1)) (const_int 0)))
14057 (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)])]
14060 operands[1] = ix86_tls_get_addr ();
14063 ;; Local dynamic of a single variable is a lose. Show combine how
14064 ;; to convert that back to global dynamic.
14066 (define_insn_and_split "*tls_local_dynamic_32_once"
14067 [(set (match_operand:SI 0 "register_operand" "=a")
14068 (plus:SI (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14069 (match_operand:SI 2 "call_insn_operand" "")]
14070 UNSPEC_TLS_LD_BASE)
14071 (const:SI (unspec:SI
14072 [(match_operand:SI 3 "tls_symbolic_operand" "")]
14074 (clobber (match_scratch:SI 4 "=d"))
14075 (clobber (match_scratch:SI 5 "=c"))
14076 (clobber (reg:CC FLAGS_REG))]
14080 [(parallel [(set (match_dup 0)
14081 (unspec:SI [(match_dup 1) (match_dup 3) (match_dup 2)]
14083 (clobber (match_dup 4))
14084 (clobber (match_dup 5))
14085 (clobber (reg:CC FLAGS_REG))])]
14088 ;; Load and add the thread base pointer from %gs:0.
14090 (define_insn "*load_tp_si"
14091 [(set (match_operand:SI 0 "register_operand" "=r")
14092 (unspec:SI [(const_int 0)] UNSPEC_TP))]
14094 "mov{l}\t{%%gs:0, %0|%0, DWORD PTR %%gs:0}"
14095 [(set_attr "type" "imov")
14096 (set_attr "modrm" "0")
14097 (set_attr "length" "7")
14098 (set_attr "memory" "load")
14099 (set_attr "imm_disp" "false")])
14101 (define_insn "*add_tp_si"
14102 [(set (match_operand:SI 0 "register_operand" "=r")
14103 (plus:SI (unspec:SI [(const_int 0)] UNSPEC_TP)
14104 (match_operand:SI 1 "register_operand" "0")))
14105 (clobber (reg:CC FLAGS_REG))]
14107 "add{l}\t{%%gs:0, %0|%0, DWORD PTR %%gs:0}"
14108 [(set_attr "type" "alu")
14109 (set_attr "modrm" "0")
14110 (set_attr "length" "7")
14111 (set_attr "memory" "load")
14112 (set_attr "imm_disp" "false")])
14114 (define_insn "*load_tp_di"
14115 [(set (match_operand:DI 0 "register_operand" "=r")
14116 (unspec:DI [(const_int 0)] UNSPEC_TP))]
14118 "mov{q}\t{%%fs:0, %0|%0, QWORD PTR %%fs:0}"
14119 [(set_attr "type" "imov")
14120 (set_attr "modrm" "0")
14121 (set_attr "length" "7")
14122 (set_attr "memory" "load")
14123 (set_attr "imm_disp" "false")])
14125 (define_insn "*add_tp_di"
14126 [(set (match_operand:DI 0 "register_operand" "=r")
14127 (plus:DI (unspec:DI [(const_int 0)] UNSPEC_TP)
14128 (match_operand:DI 1 "register_operand" "0")))
14129 (clobber (reg:CC FLAGS_REG))]
14131 "add{q}\t{%%fs:0, %0|%0, QWORD PTR %%fs:0}"
14132 [(set_attr "type" "alu")
14133 (set_attr "modrm" "0")
14134 (set_attr "length" "7")
14135 (set_attr "memory" "load")
14136 (set_attr "imm_disp" "false")])
14138 ;; These patterns match the binary 387 instructions for addM3, subM3,
14139 ;; mulM3 and divM3. There are three patterns for each of DFmode and
14140 ;; SFmode. The first is the normal insn, the second the same insn but
14141 ;; with one operand a conversion, and the third the same insn but with
14142 ;; the other operand a conversion. The conversion may be SFmode or
14143 ;; SImode if the target mode DFmode, but only SImode if the target mode
14146 ;; Gcc is slightly more smart about handling normal two address instructions
14147 ;; so use special patterns for add and mull.
14149 (define_insn "*fop_sf_comm_mixed"
14150 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
14151 (match_operator:SF 3 "binary_fp_operator"
14152 [(match_operand:SF 1 "nonimmediate_operand" "%0,0")
14153 (match_operand:SF 2 "nonimmediate_operand" "fm#x,xm#f")]))]
14154 "TARGET_MIX_SSE_I387
14155 && COMMUTATIVE_ARITH_P (operands[3])
14156 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14157 "* return output_387_binary_op (insn, operands);"
14158 [(set (attr "type")
14159 (if_then_else (eq_attr "alternative" "1")
14160 (if_then_else (match_operand:SF 3 "mult_operator" "")
14161 (const_string "ssemul")
14162 (const_string "sseadd"))
14163 (if_then_else (match_operand:SF 3 "mult_operator" "")
14164 (const_string "fmul")
14165 (const_string "fop"))))
14166 (set_attr "mode" "SF")])
14168 (define_insn "*fop_sf_comm_sse"
14169 [(set (match_operand:SF 0 "register_operand" "=x")
14170 (match_operator:SF 3 "binary_fp_operator"
14171 [(match_operand:SF 1 "nonimmediate_operand" "%0")
14172 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14174 && COMMUTATIVE_ARITH_P (operands[3])
14175 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14176 "* return output_387_binary_op (insn, operands);"
14177 [(set (attr "type")
14178 (if_then_else (match_operand:SF 3 "mult_operator" "")
14179 (const_string "ssemul")
14180 (const_string "sseadd")))
14181 (set_attr "mode" "SF")])
14183 (define_insn "*fop_sf_comm_i387"
14184 [(set (match_operand:SF 0 "register_operand" "=f")
14185 (match_operator:SF 3 "binary_fp_operator"
14186 [(match_operand:SF 1 "nonimmediate_operand" "%0")
14187 (match_operand:SF 2 "nonimmediate_operand" "fm")]))]
14189 && COMMUTATIVE_ARITH_P (operands[3])
14190 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14191 "* return output_387_binary_op (insn, operands);"
14192 [(set (attr "type")
14193 (if_then_else (match_operand:SF 3 "mult_operator" "")
14194 (const_string "fmul")
14195 (const_string "fop")))
14196 (set_attr "mode" "SF")])
14198 (define_insn "*fop_sf_1_mixed"
14199 [(set (match_operand:SF 0 "register_operand" "=f,f,x")
14200 (match_operator:SF 3 "binary_fp_operator"
14201 [(match_operand:SF 1 "nonimmediate_operand" "0,fm,0")
14202 (match_operand:SF 2 "nonimmediate_operand" "fm,0,xm#f")]))]
14203 "TARGET_MIX_SSE_I387
14204 && !COMMUTATIVE_ARITH_P (operands[3])
14205 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14206 "* return output_387_binary_op (insn, operands);"
14207 [(set (attr "type")
14208 (cond [(and (eq_attr "alternative" "2")
14209 (match_operand:SF 3 "mult_operator" ""))
14210 (const_string "ssemul")
14211 (and (eq_attr "alternative" "2")
14212 (match_operand:SF 3 "div_operator" ""))
14213 (const_string "ssediv")
14214 (eq_attr "alternative" "2")
14215 (const_string "sseadd")
14216 (match_operand:SF 3 "mult_operator" "")
14217 (const_string "fmul")
14218 (match_operand:SF 3 "div_operator" "")
14219 (const_string "fdiv")
14221 (const_string "fop")))
14222 (set_attr "mode" "SF")])
14224 (define_insn "*fop_sf_1_sse"
14225 [(set (match_operand:SF 0 "register_operand" "=x")
14226 (match_operator:SF 3 "binary_fp_operator"
14227 [(match_operand:SF 1 "register_operand" "0")
14228 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14230 && !COMMUTATIVE_ARITH_P (operands[3])"
14231 "* return output_387_binary_op (insn, operands);"
14232 [(set (attr "type")
14233 (cond [(match_operand:SF 3 "mult_operator" "")
14234 (const_string "ssemul")
14235 (match_operand:SF 3 "div_operator" "")
14236 (const_string "ssediv")
14238 (const_string "sseadd")))
14239 (set_attr "mode" "SF")])
14241 (define_insn "*fop_sf_1_i387"
14242 [(set (match_operand:SF 0 "register_operand" "=f,f")
14243 (match_operator:SF 3 "binary_fp_operator"
14244 [(match_operand:SF 1 "nonimmediate_operand" "0,fm")
14245 (match_operand:SF 2 "nonimmediate_operand" "fm,0")]))]
14247 && !COMMUTATIVE_ARITH_P (operands[3])
14248 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14249 "* return output_387_binary_op (insn, operands);"
14250 [(set (attr "type")
14251 (cond [(match_operand:SF 3 "mult_operator" "")
14252 (const_string "fmul")
14253 (match_operand:SF 3 "div_operator" "")
14254 (const_string "fdiv")
14256 (const_string "fop")))
14257 (set_attr "mode" "SF")])
14260 ;; ??? Add SSE splitters for these!
14261 (define_insn "*fop_sf_2_i387"
14262 [(set (match_operand:SF 0 "register_operand" "=f,f")
14263 (match_operator:SF 3 "binary_fp_operator"
14264 [(float:SF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14265 (match_operand:SF 2 "register_operand" "0,0")]))]
14266 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14267 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14268 [(set (attr "type")
14269 (cond [(match_operand:SF 3 "mult_operator" "")
14270 (const_string "fmul")
14271 (match_operand:SF 3 "div_operator" "")
14272 (const_string "fdiv")
14274 (const_string "fop")))
14275 (set_attr "fp_int_src" "true")
14276 (set_attr "mode" "SI")])
14278 (define_insn "*fop_sf_3_i387"
14279 [(set (match_operand:SF 0 "register_operand" "=f,f")
14280 (match_operator:SF 3 "binary_fp_operator"
14281 [(match_operand:SF 1 "register_operand" "0,0")
14282 (float:SF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14283 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14284 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14285 [(set (attr "type")
14286 (cond [(match_operand:SF 3 "mult_operator" "")
14287 (const_string "fmul")
14288 (match_operand:SF 3 "div_operator" "")
14289 (const_string "fdiv")
14291 (const_string "fop")))
14292 (set_attr "fp_int_src" "true")
14293 (set_attr "mode" "SI")])
14295 (define_insn "*fop_df_comm_mixed"
14296 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
14297 (match_operator:DF 3 "binary_fp_operator"
14298 [(match_operand:DF 1 "nonimmediate_operand" "%0,0")
14299 (match_operand:DF 2 "nonimmediate_operand" "fm#Y,Ym#f")]))]
14300 "TARGET_SSE2 && TARGET_MIX_SSE_I387
14301 && COMMUTATIVE_ARITH_P (operands[3])
14302 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14303 "* return output_387_binary_op (insn, operands);"
14304 [(set (attr "type")
14305 (if_then_else (eq_attr "alternative" "1")
14306 (if_then_else (match_operand:SF 3 "mult_operator" "")
14307 (const_string "ssemul")
14308 (const_string "sseadd"))
14309 (if_then_else (match_operand:SF 3 "mult_operator" "")
14310 (const_string "fmul")
14311 (const_string "fop"))))
14312 (set_attr "mode" "DF")])
14314 (define_insn "*fop_df_comm_sse"
14315 [(set (match_operand:DF 0 "register_operand" "=Y")
14316 (match_operator:DF 3 "binary_fp_operator"
14317 [(match_operand:DF 1 "nonimmediate_operand" "%0")
14318 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14319 "TARGET_SSE2 && TARGET_SSE_MATH
14320 && COMMUTATIVE_ARITH_P (operands[3])
14321 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14322 "* return output_387_binary_op (insn, operands);"
14323 [(set (attr "type")
14324 (if_then_else (match_operand:SF 3 "mult_operator" "")
14325 (const_string "ssemul")
14326 (const_string "sseadd")))
14327 (set_attr "mode" "DF")])
14329 (define_insn "*fop_df_comm_i387"
14330 [(set (match_operand:DF 0 "register_operand" "=f")
14331 (match_operator:DF 3 "binary_fp_operator"
14332 [(match_operand:DF 1 "nonimmediate_operand" "%0")
14333 (match_operand:DF 2 "nonimmediate_operand" "fm")]))]
14335 && COMMUTATIVE_ARITH_P (operands[3])
14336 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14337 "* return output_387_binary_op (insn, operands);"
14338 [(set (attr "type")
14339 (if_then_else (match_operand:SF 3 "mult_operator" "")
14340 (const_string "fmul")
14341 (const_string "fop")))
14342 (set_attr "mode" "DF")])
14344 (define_insn "*fop_df_1_mixed"
14345 [(set (match_operand:DF 0 "register_operand" "=f#Y,f#Y,Y#f")
14346 (match_operator:DF 3 "binary_fp_operator"
14347 [(match_operand:DF 1 "nonimmediate_operand" "0,fm,0")
14348 (match_operand:DF 2 "nonimmediate_operand" "fm,0,Ym#f")]))]
14349 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14350 && !COMMUTATIVE_ARITH_P (operands[3])
14351 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14352 "* return output_387_binary_op (insn, operands);"
14353 [(set (attr "type")
14354 (cond [(and (eq_attr "alternative" "2")
14355 (match_operand:SF 3 "mult_operator" ""))
14356 (const_string "ssemul")
14357 (and (eq_attr "alternative" "2")
14358 (match_operand:SF 3 "div_operator" ""))
14359 (const_string "ssediv")
14360 (eq_attr "alternative" "2")
14361 (const_string "sseadd")
14362 (match_operand:DF 3 "mult_operator" "")
14363 (const_string "fmul")
14364 (match_operand:DF 3 "div_operator" "")
14365 (const_string "fdiv")
14367 (const_string "fop")))
14368 (set_attr "mode" "DF")])
14370 (define_insn "*fop_df_1_sse"
14371 [(set (match_operand:DF 0 "register_operand" "=Y")
14372 (match_operator:DF 3 "binary_fp_operator"
14373 [(match_operand:DF 1 "register_operand" "0")
14374 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14375 "TARGET_SSE2 && TARGET_SSE_MATH
14376 && !COMMUTATIVE_ARITH_P (operands[3])"
14377 "* return output_387_binary_op (insn, operands);"
14378 [(set_attr "mode" "DF")
14380 (cond [(match_operand:SF 3 "mult_operator" "")
14381 (const_string "ssemul")
14382 (match_operand:SF 3 "div_operator" "")
14383 (const_string "ssediv")
14385 (const_string "sseadd")))])
14387 (define_insn "*fop_df_1_i387"
14388 [(set (match_operand:DF 0 "register_operand" "=f,f")
14389 (match_operator:DF 3 "binary_fp_operator"
14390 [(match_operand:DF 1 "nonimmediate_operand" "0,fm")
14391 (match_operand:DF 2 "nonimmediate_operand" "fm,0")]))]
14393 && !COMMUTATIVE_ARITH_P (operands[3])
14394 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14395 "* return output_387_binary_op (insn, operands);"
14396 [(set (attr "type")
14397 (cond [(match_operand:DF 3 "mult_operator" "")
14398 (const_string "fmul")
14399 (match_operand:DF 3 "div_operator" "")
14400 (const_string "fdiv")
14402 (const_string "fop")))
14403 (set_attr "mode" "DF")])
14405 ;; ??? Add SSE splitters for these!
14406 (define_insn "*fop_df_2_i387"
14407 [(set (match_operand:DF 0 "register_operand" "=f,f")
14408 (match_operator:DF 3 "binary_fp_operator"
14409 [(float:DF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14410 (match_operand:DF 2 "register_operand" "0,0")]))]
14411 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14412 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14413 [(set (attr "type")
14414 (cond [(match_operand:DF 3 "mult_operator" "")
14415 (const_string "fmul")
14416 (match_operand:DF 3 "div_operator" "")
14417 (const_string "fdiv")
14419 (const_string "fop")))
14420 (set_attr "fp_int_src" "true")
14421 (set_attr "mode" "SI")])
14423 (define_insn "*fop_df_3_i387"
14424 [(set (match_operand:DF 0 "register_operand" "=f,f")
14425 (match_operator:DF 3 "binary_fp_operator"
14426 [(match_operand:DF 1 "register_operand" "0,0")
14427 (float:DF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14428 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14429 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14430 [(set (attr "type")
14431 (cond [(match_operand:DF 3 "mult_operator" "")
14432 (const_string "fmul")
14433 (match_operand:DF 3 "div_operator" "")
14434 (const_string "fdiv")
14436 (const_string "fop")))
14437 (set_attr "fp_int_src" "true")
14438 (set_attr "mode" "SI")])
14440 (define_insn "*fop_df_4_i387"
14441 [(set (match_operand:DF 0 "register_operand" "=f,f")
14442 (match_operator:DF 3 "binary_fp_operator"
14443 [(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
14444 (match_operand:DF 2 "register_operand" "0,f")]))]
14445 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)
14446 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14447 "* return output_387_binary_op (insn, operands);"
14448 [(set (attr "type")
14449 (cond [(match_operand:DF 3 "mult_operator" "")
14450 (const_string "fmul")
14451 (match_operand:DF 3 "div_operator" "")
14452 (const_string "fdiv")
14454 (const_string "fop")))
14455 (set_attr "mode" "SF")])
14457 (define_insn "*fop_df_5_i387"
14458 [(set (match_operand:DF 0 "register_operand" "=f,f")
14459 (match_operator:DF 3 "binary_fp_operator"
14460 [(match_operand:DF 1 "register_operand" "0,f")
14462 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14463 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14464 "* return output_387_binary_op (insn, operands);"
14465 [(set (attr "type")
14466 (cond [(match_operand:DF 3 "mult_operator" "")
14467 (const_string "fmul")
14468 (match_operand:DF 3 "div_operator" "")
14469 (const_string "fdiv")
14471 (const_string "fop")))
14472 (set_attr "mode" "SF")])
14474 (define_insn "*fop_df_6_i387"
14475 [(set (match_operand:DF 0 "register_operand" "=f,f")
14476 (match_operator:DF 3 "binary_fp_operator"
14478 (match_operand:SF 1 "register_operand" "0,f"))
14480 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14481 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14482 "* return output_387_binary_op (insn, operands);"
14483 [(set (attr "type")
14484 (cond [(match_operand:DF 3 "mult_operator" "")
14485 (const_string "fmul")
14486 (match_operand:DF 3 "div_operator" "")
14487 (const_string "fdiv")
14489 (const_string "fop")))
14490 (set_attr "mode" "SF")])
14492 (define_insn "*fop_xf_comm_i387"
14493 [(set (match_operand:XF 0 "register_operand" "=f")
14494 (match_operator:XF 3 "binary_fp_operator"
14495 [(match_operand:XF 1 "register_operand" "%0")
14496 (match_operand:XF 2 "register_operand" "f")]))]
14498 && COMMUTATIVE_ARITH_P (operands[3])"
14499 "* return output_387_binary_op (insn, operands);"
14500 [(set (attr "type")
14501 (if_then_else (match_operand:XF 3 "mult_operator" "")
14502 (const_string "fmul")
14503 (const_string "fop")))
14504 (set_attr "mode" "XF")])
14506 (define_insn "*fop_xf_1_i387"
14507 [(set (match_operand:XF 0 "register_operand" "=f,f")
14508 (match_operator:XF 3 "binary_fp_operator"
14509 [(match_operand:XF 1 "register_operand" "0,f")
14510 (match_operand:XF 2 "register_operand" "f,0")]))]
14512 && !COMMUTATIVE_ARITH_P (operands[3])"
14513 "* return output_387_binary_op (insn, operands);"
14514 [(set (attr "type")
14515 (cond [(match_operand:XF 3 "mult_operator" "")
14516 (const_string "fmul")
14517 (match_operand:XF 3 "div_operator" "")
14518 (const_string "fdiv")
14520 (const_string "fop")))
14521 (set_attr "mode" "XF")])
14523 (define_insn "*fop_xf_2_i387"
14524 [(set (match_operand:XF 0 "register_operand" "=f,f")
14525 (match_operator:XF 3 "binary_fp_operator"
14526 [(float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14527 (match_operand:XF 2 "register_operand" "0,0")]))]
14528 "TARGET_80387 && TARGET_USE_FIOP"
14529 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14530 [(set (attr "type")
14531 (cond [(match_operand:XF 3 "mult_operator" "")
14532 (const_string "fmul")
14533 (match_operand:XF 3 "div_operator" "")
14534 (const_string "fdiv")
14536 (const_string "fop")))
14537 (set_attr "fp_int_src" "true")
14538 (set_attr "mode" "SI")])
14540 (define_insn "*fop_xf_3_i387"
14541 [(set (match_operand:XF 0 "register_operand" "=f,f")
14542 (match_operator:XF 3 "binary_fp_operator"
14543 [(match_operand:XF 1 "register_operand" "0,0")
14544 (float:XF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14545 "TARGET_80387 && TARGET_USE_FIOP"
14546 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14547 [(set (attr "type")
14548 (cond [(match_operand:XF 3 "mult_operator" "")
14549 (const_string "fmul")
14550 (match_operand:XF 3 "div_operator" "")
14551 (const_string "fdiv")
14553 (const_string "fop")))
14554 (set_attr "fp_int_src" "true")
14555 (set_attr "mode" "SI")])
14557 (define_insn "*fop_xf_4_i387"
14558 [(set (match_operand:XF 0 "register_operand" "=f,f")
14559 (match_operator:XF 3 "binary_fp_operator"
14560 [(float_extend:XF (match_operand 1 "nonimmediate_operand" "fm,0"))
14561 (match_operand:XF 2 "register_operand" "0,f")]))]
14563 "* return output_387_binary_op (insn, operands);"
14564 [(set (attr "type")
14565 (cond [(match_operand:XF 3 "mult_operator" "")
14566 (const_string "fmul")
14567 (match_operand:XF 3 "div_operator" "")
14568 (const_string "fdiv")
14570 (const_string "fop")))
14571 (set_attr "mode" "SF")])
14573 (define_insn "*fop_xf_5_i387"
14574 [(set (match_operand:XF 0 "register_operand" "=f,f")
14575 (match_operator:XF 3 "binary_fp_operator"
14576 [(match_operand:XF 1 "register_operand" "0,f")
14578 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
14580 "* return output_387_binary_op (insn, operands);"
14581 [(set (attr "type")
14582 (cond [(match_operand:XF 3 "mult_operator" "")
14583 (const_string "fmul")
14584 (match_operand:XF 3 "div_operator" "")
14585 (const_string "fdiv")
14587 (const_string "fop")))
14588 (set_attr "mode" "SF")])
14590 (define_insn "*fop_xf_6_i387"
14591 [(set (match_operand:XF 0 "register_operand" "=f,f")
14592 (match_operator:XF 3 "binary_fp_operator"
14594 (match_operand 1 "register_operand" "0,f"))
14596 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
14598 "* return output_387_binary_op (insn, operands);"
14599 [(set (attr "type")
14600 (cond [(match_operand:XF 3 "mult_operator" "")
14601 (const_string "fmul")
14602 (match_operand:XF 3 "div_operator" "")
14603 (const_string "fdiv")
14605 (const_string "fop")))
14606 (set_attr "mode" "SF")])
14609 [(set (match_operand 0 "register_operand" "")
14610 (match_operator 3 "binary_fp_operator"
14611 [(float (match_operand:SI 1 "register_operand" ""))
14612 (match_operand 2 "register_operand" "")]))]
14613 "TARGET_80387 && reload_completed
14614 && FLOAT_MODE_P (GET_MODE (operands[0]))"
14617 operands[4] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
14618 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
14619 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
14620 gen_rtx_fmt_ee (GET_CODE (operands[3]),
14621 GET_MODE (operands[3]),
14624 ix86_free_from_memory (GET_MODE (operands[1]));
14629 [(set (match_operand 0 "register_operand" "")
14630 (match_operator 3 "binary_fp_operator"
14631 [(match_operand 1 "register_operand" "")
14632 (float (match_operand:SI 2 "register_operand" ""))]))]
14633 "TARGET_80387 && reload_completed
14634 && FLOAT_MODE_P (GET_MODE (operands[0]))"
14637 operands[4] = ix86_force_to_memory (GET_MODE (operands[2]), operands[2]);
14638 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
14639 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
14640 gen_rtx_fmt_ee (GET_CODE (operands[3]),
14641 GET_MODE (operands[3]),
14644 ix86_free_from_memory (GET_MODE (operands[2]));
14648 ;; FPU special functions.
14650 (define_expand "sqrtsf2"
14651 [(set (match_operand:SF 0 "register_operand" "")
14652 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
14653 "TARGET_USE_FANCY_MATH_387 || TARGET_SSE_MATH"
14655 if (!TARGET_SSE_MATH)
14656 operands[1] = force_reg (SFmode, operands[1]);
14659 (define_insn "*sqrtsf2_mixed"
14660 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
14661 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "0#x,xm#f")))]
14662 "TARGET_USE_FANCY_MATH_387 && TARGET_MIX_SSE_I387"
14665 sqrtss\t{%1, %0|%0, %1}"
14666 [(set_attr "type" "fpspc,sse")
14667 (set_attr "mode" "SF,SF")
14668 (set_attr "athlon_decode" "direct,*")])
14670 (define_insn "*sqrtsf2_sse"
14671 [(set (match_operand:SF 0 "register_operand" "=x")
14672 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "xm")))]
14674 "sqrtss\t{%1, %0|%0, %1}"
14675 [(set_attr "type" "sse")
14676 (set_attr "mode" "SF")
14677 (set_attr "athlon_decode" "*")])
14679 (define_insn "*sqrtsf2_i387"
14680 [(set (match_operand:SF 0 "register_operand" "=f")
14681 (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
14682 "TARGET_USE_FANCY_MATH_387"
14684 [(set_attr "type" "fpspc")
14685 (set_attr "mode" "SF")
14686 (set_attr "athlon_decode" "direct")])
14688 (define_expand "sqrtdf2"
14689 [(set (match_operand:DF 0 "register_operand" "")
14690 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
14691 "TARGET_USE_FANCY_MATH_387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
14693 if (!(TARGET_SSE2 && TARGET_SSE_MATH))
14694 operands[1] = force_reg (DFmode, operands[1]);
14697 (define_insn "*sqrtdf2_mixed"
14698 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
14699 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "0#Y,Ym#f")))]
14700 "TARGET_USE_FANCY_MATH_387 && TARGET_SSE2 && TARGET_MIX_SSE_I387"
14703 sqrtsd\t{%1, %0|%0, %1}"
14704 [(set_attr "type" "fpspc,sse")
14705 (set_attr "mode" "DF,DF")
14706 (set_attr "athlon_decode" "direct,*")])
14708 (define_insn "*sqrtdf2_sse"
14709 [(set (match_operand:DF 0 "register_operand" "=Y")
14710 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
14711 "TARGET_SSE2 && TARGET_SSE_MATH"
14712 "sqrtsd\t{%1, %0|%0, %1}"
14713 [(set_attr "type" "sse")
14714 (set_attr "mode" "DF")
14715 (set_attr "athlon_decode" "*")])
14717 (define_insn "*sqrtdf2_i387"
14718 [(set (match_operand:DF 0 "register_operand" "=f")
14719 (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
14720 "TARGET_USE_FANCY_MATH_387"
14722 [(set_attr "type" "fpspc")
14723 (set_attr "mode" "DF")
14724 (set_attr "athlon_decode" "direct")])
14726 (define_insn "*sqrtextendsfdf2_i387"
14727 [(set (match_operand:DF 0 "register_operand" "=f")
14728 (sqrt:DF (float_extend:DF
14729 (match_operand:SF 1 "register_operand" "0"))))]
14730 "TARGET_USE_FANCY_MATH_387
14731 && (!(TARGET_SSE2 && TARGET_SSE_MATH) || TARGET_MIX_SSE_I387)"
14733 [(set_attr "type" "fpspc")
14734 (set_attr "mode" "DF")
14735 (set_attr "athlon_decode" "direct")])
14737 (define_insn "sqrtxf2"
14738 [(set (match_operand:XF 0 "register_operand" "=f")
14739 (sqrt:XF (match_operand:XF 1 "register_operand" "0")))]
14740 "TARGET_USE_FANCY_MATH_387
14741 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
14743 [(set_attr "type" "fpspc")
14744 (set_attr "mode" "XF")
14745 (set_attr "athlon_decode" "direct")])
14747 (define_insn "*sqrtextendsfxf2_i387"
14748 [(set (match_operand:XF 0 "register_operand" "=f")
14749 (sqrt:XF (float_extend:XF
14750 (match_operand:SF 1 "register_operand" "0"))))]
14751 "TARGET_USE_FANCY_MATH_387"
14753 [(set_attr "type" "fpspc")
14754 (set_attr "mode" "XF")
14755 (set_attr "athlon_decode" "direct")])
14757 (define_insn "*sqrtextenddfxf2_i387"
14758 [(set (match_operand:XF 0 "register_operand" "=f")
14759 (sqrt:XF (float_extend:XF
14760 (match_operand:DF 1 "register_operand" "0"))))]
14761 "TARGET_USE_FANCY_MATH_387"
14763 [(set_attr "type" "fpspc")
14764 (set_attr "mode" "XF")
14765 (set_attr "athlon_decode" "direct")])
14767 (define_insn "fpremxf4"
14768 [(set (match_operand:XF 0 "register_operand" "=f")
14769 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
14770 (match_operand:XF 3 "register_operand" "1")]
14772 (set (match_operand:XF 1 "register_operand" "=u")
14773 (unspec:XF [(match_dup 2) (match_dup 3)]
14775 (set (reg:CCFP FPSR_REG)
14776 (unspec:CCFP [(const_int 0)] UNSPEC_NOP))]
14777 "TARGET_USE_FANCY_MATH_387
14778 && flag_unsafe_math_optimizations"
14780 [(set_attr "type" "fpspc")
14781 (set_attr "mode" "XF")])
14783 (define_expand "fmodsf3"
14784 [(use (match_operand:SF 0 "register_operand" ""))
14785 (use (match_operand:SF 1 "register_operand" ""))
14786 (use (match_operand:SF 2 "register_operand" ""))]
14787 "TARGET_USE_FANCY_MATH_387
14788 && flag_unsafe_math_optimizations"
14790 rtx label = gen_label_rtx ();
14792 rtx op1 = gen_reg_rtx (XFmode);
14793 rtx op2 = gen_reg_rtx (XFmode);
14795 emit_insn(gen_extendsfxf2 (op1, operands[1]));
14796 emit_insn(gen_extendsfxf2 (op2, operands[2]));
14798 emit_label (label);
14800 emit_insn (gen_fpremxf4 (op1, op2, op1, op2));
14801 ix86_emit_fp_unordered_jump (label);
14803 emit_insn (gen_truncxfsf2_noop (operands[0], op1));
14807 (define_expand "fmoddf3"
14808 [(use (match_operand:DF 0 "register_operand" ""))
14809 (use (match_operand:DF 1 "register_operand" ""))
14810 (use (match_operand:DF 2 "register_operand" ""))]
14811 "TARGET_USE_FANCY_MATH_387
14812 && flag_unsafe_math_optimizations"
14814 rtx label = gen_label_rtx ();
14816 rtx op1 = gen_reg_rtx (XFmode);
14817 rtx op2 = gen_reg_rtx (XFmode);
14819 emit_insn (gen_extenddfxf2 (op1, operands[1]));
14820 emit_insn (gen_extenddfxf2 (op2, operands[2]));
14822 emit_label (label);
14824 emit_insn (gen_fpremxf4 (op1, op2, op1, op2));
14825 ix86_emit_fp_unordered_jump (label);
14827 emit_insn (gen_truncxfdf2_noop (operands[0], op1));
14831 (define_expand "fmodxf3"
14832 [(use (match_operand:XF 0 "register_operand" ""))
14833 (use (match_operand:XF 1 "register_operand" ""))
14834 (use (match_operand:XF 2 "register_operand" ""))]
14835 "TARGET_USE_FANCY_MATH_387
14836 && flag_unsafe_math_optimizations"
14838 rtx label = gen_label_rtx ();
14840 emit_label (label);
14842 emit_insn (gen_fpremxf4 (operands[1], operands[2],
14843 operands[1], operands[2]));
14844 ix86_emit_fp_unordered_jump (label);
14846 emit_move_insn (operands[0], operands[1]);
14850 (define_insn "fprem1xf4"
14851 [(set (match_operand:XF 0 "register_operand" "=f")
14852 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
14853 (match_operand:XF 3 "register_operand" "1")]
14855 (set (match_operand:XF 1 "register_operand" "=u")
14856 (unspec:XF [(match_dup 2) (match_dup 3)]
14858 (set (reg:CCFP FPSR_REG)
14859 (unspec:CCFP [(const_int 0)] UNSPEC_NOP))]
14860 "TARGET_USE_FANCY_MATH_387
14861 && flag_unsafe_math_optimizations"
14863 [(set_attr "type" "fpspc")
14864 (set_attr "mode" "XF")])
14866 (define_expand "dremsf3"
14867 [(use (match_operand:SF 0 "register_operand" ""))
14868 (use (match_operand:SF 1 "register_operand" ""))
14869 (use (match_operand:SF 2 "register_operand" ""))]
14870 "TARGET_USE_FANCY_MATH_387
14871 && flag_unsafe_math_optimizations"
14873 rtx label = gen_label_rtx ();
14875 rtx op1 = gen_reg_rtx (XFmode);
14876 rtx op2 = gen_reg_rtx (XFmode);
14878 emit_insn(gen_extendsfxf2 (op1, operands[1]));
14879 emit_insn(gen_extendsfxf2 (op2, operands[2]));
14881 emit_label (label);
14883 emit_insn (gen_fprem1xf4 (op1, op2, op1, op2));
14884 ix86_emit_fp_unordered_jump (label);
14886 emit_insn (gen_truncxfsf2_noop (operands[0], op1));
14890 (define_expand "dremdf3"
14891 [(use (match_operand:DF 0 "register_operand" ""))
14892 (use (match_operand:DF 1 "register_operand" ""))
14893 (use (match_operand:DF 2 "register_operand" ""))]
14894 "TARGET_USE_FANCY_MATH_387
14895 && flag_unsafe_math_optimizations"
14897 rtx label = gen_label_rtx ();
14899 rtx op1 = gen_reg_rtx (XFmode);
14900 rtx op2 = gen_reg_rtx (XFmode);
14902 emit_insn (gen_extenddfxf2 (op1, operands[1]));
14903 emit_insn (gen_extenddfxf2 (op2, operands[2]));
14905 emit_label (label);
14907 emit_insn (gen_fprem1xf4 (op1, op2, op1, op2));
14908 ix86_emit_fp_unordered_jump (label);
14910 emit_insn (gen_truncxfdf2_noop (operands[0], op1));
14914 (define_expand "dremxf3"
14915 [(use (match_operand:XF 0 "register_operand" ""))
14916 (use (match_operand:XF 1 "register_operand" ""))
14917 (use (match_operand:XF 2 "register_operand" ""))]
14918 "TARGET_USE_FANCY_MATH_387
14919 && flag_unsafe_math_optimizations"
14921 rtx label = gen_label_rtx ();
14923 emit_label (label);
14925 emit_insn (gen_fprem1xf4 (operands[1], operands[2],
14926 operands[1], operands[2]));
14927 ix86_emit_fp_unordered_jump (label);
14929 emit_move_insn (operands[0], operands[1]);
14933 (define_insn "*sindf2"
14934 [(set (match_operand:DF 0 "register_operand" "=f")
14935 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_SIN))]
14936 "TARGET_USE_FANCY_MATH_387
14937 && flag_unsafe_math_optimizations"
14939 [(set_attr "type" "fpspc")
14940 (set_attr "mode" "DF")])
14942 (define_insn "*sinsf2"
14943 [(set (match_operand:SF 0 "register_operand" "=f")
14944 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_SIN))]
14945 "TARGET_USE_FANCY_MATH_387
14946 && flag_unsafe_math_optimizations"
14948 [(set_attr "type" "fpspc")
14949 (set_attr "mode" "SF")])
14951 (define_insn "*sinextendsfdf2"
14952 [(set (match_operand:DF 0 "register_operand" "=f")
14953 (unspec:DF [(float_extend:DF
14954 (match_operand:SF 1 "register_operand" "0"))]
14956 "TARGET_USE_FANCY_MATH_387
14957 && flag_unsafe_math_optimizations"
14959 [(set_attr "type" "fpspc")
14960 (set_attr "mode" "DF")])
14962 (define_insn "*sinxf2"
14963 [(set (match_operand:XF 0 "register_operand" "=f")
14964 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_SIN))]
14965 "TARGET_USE_FANCY_MATH_387
14966 && flag_unsafe_math_optimizations"
14968 [(set_attr "type" "fpspc")
14969 (set_attr "mode" "XF")])
14971 (define_insn "*cosdf2"
14972 [(set (match_operand:DF 0 "register_operand" "=f")
14973 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_COS))]
14974 "TARGET_USE_FANCY_MATH_387
14975 && flag_unsafe_math_optimizations"
14977 [(set_attr "type" "fpspc")
14978 (set_attr "mode" "DF")])
14980 (define_insn "*cossf2"
14981 [(set (match_operand:SF 0 "register_operand" "=f")
14982 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_COS))]
14983 "TARGET_USE_FANCY_MATH_387
14984 && flag_unsafe_math_optimizations"
14986 [(set_attr "type" "fpspc")
14987 (set_attr "mode" "SF")])
14989 (define_insn "*cosextendsfdf2"
14990 [(set (match_operand:DF 0 "register_operand" "=f")
14991 (unspec:DF [(float_extend:DF
14992 (match_operand:SF 1 "register_operand" "0"))]
14994 "TARGET_USE_FANCY_MATH_387
14995 && flag_unsafe_math_optimizations"
14997 [(set_attr "type" "fpspc")
14998 (set_attr "mode" "DF")])
15000 (define_insn "*cosxf2"
15001 [(set (match_operand:XF 0 "register_operand" "=f")
15002 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_COS))]
15003 "TARGET_USE_FANCY_MATH_387
15004 && flag_unsafe_math_optimizations"
15006 [(set_attr "type" "fpspc")
15007 (set_attr "mode" "XF")])
15009 ;; With sincos pattern defined, sin and cos builtin function will be
15010 ;; expanded to sincos pattern with one of its outputs left unused.
15011 ;; Cse pass will detected, if two sincos patterns can be combined,
15012 ;; otherwise sincos pattern will be split back to sin or cos pattern,
15013 ;; depending on the unused output.
15015 (define_insn "sincosdf3"
15016 [(set (match_operand:DF 0 "register_operand" "=f")
15017 (unspec:DF [(match_operand:DF 2 "register_operand" "0")]
15018 UNSPEC_SINCOS_COS))
15019 (set (match_operand:DF 1 "register_operand" "=u")
15020 (unspec:DF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15021 "TARGET_USE_FANCY_MATH_387
15022 && flag_unsafe_math_optimizations"
15024 [(set_attr "type" "fpspc")
15025 (set_attr "mode" "DF")])
15028 [(set (match_operand:DF 0 "register_operand" "")
15029 (unspec:DF [(match_operand:DF 2 "register_operand" "")]
15030 UNSPEC_SINCOS_COS))
15031 (set (match_operand:DF 1 "register_operand" "")
15032 (unspec:DF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15033 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15034 && !reload_completed && !reload_in_progress"
15035 [(set (match_dup 1) (unspec:DF [(match_dup 2)] UNSPEC_SIN))]
15039 [(set (match_operand:DF 0 "register_operand" "")
15040 (unspec:DF [(match_operand:DF 2 "register_operand" "")]
15041 UNSPEC_SINCOS_COS))
15042 (set (match_operand:DF 1 "register_operand" "")
15043 (unspec:DF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15044 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15045 && !reload_completed && !reload_in_progress"
15046 [(set (match_dup 0) (unspec:DF [(match_dup 2)] UNSPEC_COS))]
15049 (define_insn "sincossf3"
15050 [(set (match_operand:SF 0 "register_operand" "=f")
15051 (unspec:SF [(match_operand:SF 2 "register_operand" "0")]
15052 UNSPEC_SINCOS_COS))
15053 (set (match_operand:SF 1 "register_operand" "=u")
15054 (unspec:SF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15055 "TARGET_USE_FANCY_MATH_387
15056 && flag_unsafe_math_optimizations"
15058 [(set_attr "type" "fpspc")
15059 (set_attr "mode" "SF")])
15062 [(set (match_operand:SF 0 "register_operand" "")
15063 (unspec:SF [(match_operand:SF 2 "register_operand" "")]
15064 UNSPEC_SINCOS_COS))
15065 (set (match_operand:SF 1 "register_operand" "")
15066 (unspec:SF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15067 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15068 && !reload_completed && !reload_in_progress"
15069 [(set (match_dup 1) (unspec:SF [(match_dup 2)] UNSPEC_SIN))]
15073 [(set (match_operand:SF 0 "register_operand" "")
15074 (unspec:SF [(match_operand:SF 2 "register_operand" "")]
15075 UNSPEC_SINCOS_COS))
15076 (set (match_operand:SF 1 "register_operand" "")
15077 (unspec:SF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15078 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15079 && !reload_completed && !reload_in_progress"
15080 [(set (match_dup 0) (unspec:SF [(match_dup 2)] UNSPEC_COS))]
15083 (define_insn "*sincosextendsfdf3"
15084 [(set (match_operand:DF 0 "register_operand" "=f")
15085 (unspec:DF [(float_extend:DF
15086 (match_operand:SF 2 "register_operand" "0"))]
15087 UNSPEC_SINCOS_COS))
15088 (set (match_operand:DF 1 "register_operand" "=u")
15089 (unspec:DF [(float_extend:DF
15090 (match_dup 2))] UNSPEC_SINCOS_SIN))]
15091 "TARGET_USE_FANCY_MATH_387
15092 && flag_unsafe_math_optimizations"
15094 [(set_attr "type" "fpspc")
15095 (set_attr "mode" "DF")])
15098 [(set (match_operand:DF 0 "register_operand" "")
15099 (unspec:DF [(float_extend:DF
15100 (match_operand:SF 2 "register_operand" ""))]
15101 UNSPEC_SINCOS_COS))
15102 (set (match_operand:DF 1 "register_operand" "")
15103 (unspec:DF [(float_extend:DF
15104 (match_dup 2))] UNSPEC_SINCOS_SIN))]
15105 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15106 && !reload_completed && !reload_in_progress"
15107 [(set (match_dup 1) (unspec:DF [(float_extend:DF
15108 (match_dup 2))] UNSPEC_SIN))]
15112 [(set (match_operand:DF 0 "register_operand" "")
15113 (unspec:DF [(float_extend:DF
15114 (match_operand:SF 2 "register_operand" ""))]
15115 UNSPEC_SINCOS_COS))
15116 (set (match_operand:DF 1 "register_operand" "")
15117 (unspec:DF [(float_extend:DF
15118 (match_dup 2))] UNSPEC_SINCOS_SIN))]
15119 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15120 && !reload_completed && !reload_in_progress"
15121 [(set (match_dup 0) (unspec:DF [(float_extend:DF
15122 (match_dup 2))] UNSPEC_COS))]
15125 (define_insn "sincosxf3"
15126 [(set (match_operand:XF 0 "register_operand" "=f")
15127 (unspec:XF [(match_operand:XF 2 "register_operand" "0")]
15128 UNSPEC_SINCOS_COS))
15129 (set (match_operand:XF 1 "register_operand" "=u")
15130 (unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15131 "TARGET_USE_FANCY_MATH_387
15132 && flag_unsafe_math_optimizations"
15134 [(set_attr "type" "fpspc")
15135 (set_attr "mode" "XF")])
15138 [(set (match_operand:XF 0 "register_operand" "")
15139 (unspec:XF [(match_operand:XF 2 "register_operand" "")]
15140 UNSPEC_SINCOS_COS))
15141 (set (match_operand:XF 1 "register_operand" "")
15142 (unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15143 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15144 && !reload_completed && !reload_in_progress"
15145 [(set (match_dup 1) (unspec:XF [(match_dup 2)] UNSPEC_SIN))]
15149 [(set (match_operand:XF 0 "register_operand" "")
15150 (unspec:XF [(match_operand:XF 2 "register_operand" "")]
15151 UNSPEC_SINCOS_COS))
15152 (set (match_operand:XF 1 "register_operand" "")
15153 (unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15154 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15155 && !reload_completed && !reload_in_progress"
15156 [(set (match_dup 0) (unspec:XF [(match_dup 2)] UNSPEC_COS))]
15159 (define_insn "*tandf3_1"
15160 [(set (match_operand:DF 0 "register_operand" "=f")
15161 (unspec:DF [(match_operand:DF 2 "register_operand" "0")]
15163 (set (match_operand:DF 1 "register_operand" "=u")
15164 (unspec:DF [(match_dup 2)] UNSPEC_TAN_TAN))]
15165 "TARGET_USE_FANCY_MATH_387
15166 && flag_unsafe_math_optimizations"
15168 [(set_attr "type" "fpspc")
15169 (set_attr "mode" "DF")])
15171 ;; optimize sequence: fptan
15174 ;; into fptan insn.
15177 [(parallel[(set (match_operand:DF 0 "register_operand" "")
15178 (unspec:DF [(match_operand:DF 2 "register_operand" "")]
15180 (set (match_operand:DF 1 "register_operand" "")
15181 (unspec:DF [(match_dup 2)] UNSPEC_TAN_TAN))])
15183 (match_operand:DF 3 "immediate_operand" ""))]
15184 "standard_80387_constant_p (operands[3]) == 2"
15185 [(parallel[(set (match_dup 0) (unspec:DF [(match_dup 2)] UNSPEC_TAN_ONE))
15186 (set (match_dup 1) (unspec:DF [(match_dup 2)] UNSPEC_TAN_TAN))])]
15189 (define_expand "tandf2"
15190 [(parallel [(set (match_dup 2)
15191 (unspec:DF [(match_operand:DF 1 "register_operand" "")]
15193 (set (match_operand:DF 0 "register_operand" "")
15194 (unspec:DF [(match_dup 1)] UNSPEC_TAN_TAN))])]
15195 "TARGET_USE_FANCY_MATH_387
15196 && flag_unsafe_math_optimizations"
15198 operands[2] = gen_reg_rtx (DFmode);
15201 (define_insn "*tansf3_1"
15202 [(set (match_operand:SF 0 "register_operand" "=f")
15203 (unspec:SF [(match_operand:SF 2 "register_operand" "0")]
15205 (set (match_operand:SF 1 "register_operand" "=u")
15206 (unspec:SF [(match_dup 2)] UNSPEC_TAN_TAN))]
15207 "TARGET_USE_FANCY_MATH_387
15208 && flag_unsafe_math_optimizations"
15210 [(set_attr "type" "fpspc")
15211 (set_attr "mode" "SF")])
15213 ;; optimize sequence: fptan
15216 ;; into fptan insn.
15219 [(parallel[(set (match_operand:SF 0 "register_operand" "")
15220 (unspec:SF [(match_operand:SF 2 "register_operand" "")]
15222 (set (match_operand:SF 1 "register_operand" "")
15223 (unspec:SF [(match_dup 2)] UNSPEC_TAN_TAN))])
15225 (match_operand:SF 3 "immediate_operand" ""))]
15226 "standard_80387_constant_p (operands[3]) == 2"
15227 [(parallel[(set (match_dup 0) (unspec:SF [(match_dup 2)] UNSPEC_TAN_ONE))
15228 (set (match_dup 1) (unspec:SF [(match_dup 2)] UNSPEC_TAN_TAN))])]
15231 (define_expand "tansf2"
15232 [(parallel [(set (match_dup 2)
15233 (unspec:SF [(match_operand:SF 1 "register_operand" "")]
15235 (set (match_operand:SF 0 "register_operand" "")
15236 (unspec:SF [(match_dup 1)] UNSPEC_TAN_TAN))])]
15237 "TARGET_USE_FANCY_MATH_387
15238 && flag_unsafe_math_optimizations"
15240 operands[2] = gen_reg_rtx (SFmode);
15243 (define_insn "*tanxf3_1"
15244 [(set (match_operand:XF 0 "register_operand" "=f")
15245 (unspec:XF [(match_operand:XF 2 "register_operand" "0")]
15247 (set (match_operand:XF 1 "register_operand" "=u")
15248 (unspec:XF [(match_dup 2)] UNSPEC_TAN_TAN))]
15249 "TARGET_USE_FANCY_MATH_387
15250 && flag_unsafe_math_optimizations"
15252 [(set_attr "type" "fpspc")
15253 (set_attr "mode" "XF")])
15255 ;; optimize sequence: fptan
15258 ;; into fptan insn.
15261 [(parallel[(set (match_operand:XF 0 "register_operand" "")
15262 (unspec:XF [(match_operand:XF 2 "register_operand" "")]
15264 (set (match_operand:XF 1 "register_operand" "")
15265 (unspec:XF [(match_dup 2)] UNSPEC_TAN_TAN))])
15267 (match_operand:XF 3 "immediate_operand" ""))]
15268 "standard_80387_constant_p (operands[3]) == 2"
15269 [(parallel[(set (match_dup 0) (unspec:XF [(match_dup 2)] UNSPEC_TAN_ONE))
15270 (set (match_dup 1) (unspec:XF [(match_dup 2)] UNSPEC_TAN_TAN))])]
15273 (define_expand "tanxf2"
15274 [(parallel [(set (match_dup 2)
15275 (unspec:XF [(match_operand:XF 1 "register_operand" "")]
15277 (set (match_operand:XF 0 "register_operand" "")
15278 (unspec:XF [(match_dup 1)] UNSPEC_TAN_TAN))])]
15279 "TARGET_USE_FANCY_MATH_387
15280 && flag_unsafe_math_optimizations"
15282 operands[2] = gen_reg_rtx (XFmode);
15285 (define_insn "atan2df3_1"
15286 [(set (match_operand:DF 0 "register_operand" "=f")
15287 (unspec:DF [(match_operand:DF 2 "register_operand" "0")
15288 (match_operand:DF 1 "register_operand" "u")]
15290 (clobber (match_scratch:DF 3 "=1"))]
15291 "TARGET_USE_FANCY_MATH_387
15292 && flag_unsafe_math_optimizations"
15294 [(set_attr "type" "fpspc")
15295 (set_attr "mode" "DF")])
15297 (define_expand "atan2df3"
15298 [(use (match_operand:DF 0 "register_operand" "=f"))
15299 (use (match_operand:DF 2 "register_operand" "0"))
15300 (use (match_operand:DF 1 "register_operand" "u"))]
15301 "TARGET_USE_FANCY_MATH_387
15302 && flag_unsafe_math_optimizations"
15304 rtx copy = gen_reg_rtx (DFmode);
15305 emit_move_insn (copy, operands[1]);
15306 emit_insn (gen_atan2df3_1 (operands[0], copy, operands[2]));
15310 (define_expand "atandf2"
15311 [(parallel [(set (match_operand:DF 0 "register_operand" "")
15312 (unspec:DF [(match_dup 2)
15313 (match_operand:DF 1 "register_operand" "")]
15315 (clobber (match_scratch:DF 3 ""))])]
15316 "TARGET_USE_FANCY_MATH_387
15317 && flag_unsafe_math_optimizations"
15319 operands[2] = gen_reg_rtx (DFmode);
15320 emit_move_insn (operands[2], CONST1_RTX (DFmode)); /* fld1 */
15323 (define_insn "atan2sf3_1"
15324 [(set (match_operand:SF 0 "register_operand" "=f")
15325 (unspec:SF [(match_operand:SF 2 "register_operand" "0")
15326 (match_operand:SF 1 "register_operand" "u")]
15328 (clobber (match_scratch:SF 3 "=1"))]
15329 "TARGET_USE_FANCY_MATH_387
15330 && flag_unsafe_math_optimizations"
15332 [(set_attr "type" "fpspc")
15333 (set_attr "mode" "SF")])
15335 (define_expand "atan2sf3"
15336 [(use (match_operand:SF 0 "register_operand" "=f"))
15337 (use (match_operand:SF 2 "register_operand" "0"))
15338 (use (match_operand:SF 1 "register_operand" "u"))]
15339 "TARGET_USE_FANCY_MATH_387
15340 && flag_unsafe_math_optimizations"
15342 rtx copy = gen_reg_rtx (SFmode);
15343 emit_move_insn (copy, operands[1]);
15344 emit_insn (gen_atan2sf3_1 (operands[0], copy, operands[2]));
15348 (define_expand "atansf2"
15349 [(parallel [(set (match_operand:SF 0 "register_operand" "")
15350 (unspec:SF [(match_dup 2)
15351 (match_operand:SF 1 "register_operand" "")]
15353 (clobber (match_scratch:SF 3 ""))])]
15354 "TARGET_USE_FANCY_MATH_387
15355 && flag_unsafe_math_optimizations"
15357 operands[2] = gen_reg_rtx (SFmode);
15358 emit_move_insn (operands[2], CONST1_RTX (SFmode)); /* fld1 */
15361 (define_insn "atan2xf3_1"
15362 [(set (match_operand:XF 0 "register_operand" "=f")
15363 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15364 (match_operand:XF 1 "register_operand" "u")]
15366 (clobber (match_scratch:XF 3 "=1"))]
15367 "TARGET_USE_FANCY_MATH_387
15368 && flag_unsafe_math_optimizations"
15370 [(set_attr "type" "fpspc")
15371 (set_attr "mode" "XF")])
15373 (define_expand "atan2xf3"
15374 [(use (match_operand:XF 0 "register_operand" "=f"))
15375 (use (match_operand:XF 2 "register_operand" "0"))
15376 (use (match_operand:XF 1 "register_operand" "u"))]
15377 "TARGET_USE_FANCY_MATH_387
15378 && flag_unsafe_math_optimizations"
15380 rtx copy = gen_reg_rtx (XFmode);
15381 emit_move_insn (copy, operands[1]);
15382 emit_insn (gen_atan2xf3_1 (operands[0], copy, operands[2]));
15386 (define_expand "atanxf2"
15387 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15388 (unspec:XF [(match_dup 2)
15389 (match_operand:XF 1 "register_operand" "")]
15391 (clobber (match_scratch:XF 3 ""))])]
15392 "TARGET_USE_FANCY_MATH_387
15393 && flag_unsafe_math_optimizations"
15395 operands[2] = gen_reg_rtx (XFmode);
15396 emit_move_insn (operands[2], CONST1_RTX (XFmode)); /* fld1 */
15399 (define_expand "asindf2"
15400 [(set (match_dup 2)
15401 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15402 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15403 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15404 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15405 (parallel [(set (match_dup 7)
15406 (unspec:XF [(match_dup 6) (match_dup 2)]
15408 (clobber (match_scratch:XF 8 ""))])
15409 (set (match_operand:DF 0 "register_operand" "")
15410 (float_truncate:DF (match_dup 7)))]
15411 "TARGET_USE_FANCY_MATH_387
15412 && flag_unsafe_math_optimizations"
15416 for (i=2; i<8; i++)
15417 operands[i] = gen_reg_rtx (XFmode);
15419 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15422 (define_expand "asinsf2"
15423 [(set (match_dup 2)
15424 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15425 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15426 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15427 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15428 (parallel [(set (match_dup 7)
15429 (unspec:XF [(match_dup 6) (match_dup 2)]
15431 (clobber (match_scratch:XF 8 ""))])
15432 (set (match_operand:SF 0 "register_operand" "")
15433 (float_truncate:SF (match_dup 7)))]
15434 "TARGET_USE_FANCY_MATH_387
15435 && flag_unsafe_math_optimizations"
15439 for (i=2; i<8; i++)
15440 operands[i] = gen_reg_rtx (XFmode);
15442 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15445 (define_expand "asinxf2"
15446 [(set (match_dup 2)
15447 (mult:XF (match_operand:XF 1 "register_operand" "")
15449 (set (match_dup 4) (minus:XF (match_dup 3) (match_dup 2)))
15450 (set (match_dup 5) (sqrt:XF (match_dup 4)))
15451 (parallel [(set (match_operand:XF 0 "register_operand" "")
15452 (unspec:XF [(match_dup 5) (match_dup 1)]
15454 (clobber (match_scratch:XF 6 ""))])]
15455 "TARGET_USE_FANCY_MATH_387
15456 && flag_unsafe_math_optimizations"
15460 for (i=2; i<6; i++)
15461 operands[i] = gen_reg_rtx (XFmode);
15463 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15466 (define_expand "acosdf2"
15467 [(set (match_dup 2)
15468 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15469 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15470 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15471 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15472 (parallel [(set (match_dup 7)
15473 (unspec:XF [(match_dup 2) (match_dup 6)]
15475 (clobber (match_scratch:XF 8 ""))])
15476 (set (match_operand:DF 0 "register_operand" "")
15477 (float_truncate:DF (match_dup 7)))]
15478 "TARGET_USE_FANCY_MATH_387
15479 && flag_unsafe_math_optimizations"
15483 for (i=2; i<8; i++)
15484 operands[i] = gen_reg_rtx (XFmode);
15486 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15489 (define_expand "acossf2"
15490 [(set (match_dup 2)
15491 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15492 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15493 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15494 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15495 (parallel [(set (match_dup 7)
15496 (unspec:XF [(match_dup 2) (match_dup 6)]
15498 (clobber (match_scratch:XF 8 ""))])
15499 (set (match_operand:SF 0 "register_operand" "")
15500 (float_truncate:SF (match_dup 7)))]
15501 "TARGET_USE_FANCY_MATH_387
15502 && flag_unsafe_math_optimizations"
15506 for (i=2; i<8; i++)
15507 operands[i] = gen_reg_rtx (XFmode);
15509 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15512 (define_expand "acosxf2"
15513 [(set (match_dup 2)
15514 (mult:XF (match_operand:XF 1 "register_operand" "")
15516 (set (match_dup 4) (minus:XF (match_dup 3) (match_dup 2)))
15517 (set (match_dup 5) (sqrt:XF (match_dup 4)))
15518 (parallel [(set (match_operand:XF 0 "register_operand" "")
15519 (unspec:XF [(match_dup 1) (match_dup 5)]
15521 (clobber (match_scratch:XF 6 ""))])]
15522 "TARGET_USE_FANCY_MATH_387
15523 && flag_unsafe_math_optimizations"
15527 for (i=2; i<6; i++)
15528 operands[i] = gen_reg_rtx (XFmode);
15530 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15533 (define_insn "fyl2x_xf3"
15534 [(set (match_operand:XF 0 "register_operand" "=f")
15535 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15536 (match_operand:XF 1 "register_operand" "u")]
15538 (clobber (match_scratch:XF 3 "=1"))]
15539 "TARGET_USE_FANCY_MATH_387
15540 && flag_unsafe_math_optimizations"
15542 [(set_attr "type" "fpspc")
15543 (set_attr "mode" "XF")])
15545 (define_expand "logsf2"
15546 [(set (match_dup 2)
15547 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15548 (parallel [(set (match_dup 4)
15549 (unspec:XF [(match_dup 2)
15550 (match_dup 3)] UNSPEC_FYL2X))
15551 (clobber (match_scratch:XF 5 ""))])
15552 (set (match_operand:SF 0 "register_operand" "")
15553 (float_truncate:SF (match_dup 4)))]
15554 "TARGET_USE_FANCY_MATH_387
15555 && flag_unsafe_math_optimizations"
15559 operands[2] = gen_reg_rtx (XFmode);
15560 operands[3] = gen_reg_rtx (XFmode);
15561 operands[4] = gen_reg_rtx (XFmode);
15563 temp = standard_80387_constant_rtx (4); /* fldln2 */
15564 emit_move_insn (operands[3], temp);
15567 (define_expand "logdf2"
15568 [(set (match_dup 2)
15569 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15570 (parallel [(set (match_dup 4)
15571 (unspec:XF [(match_dup 2)
15572 (match_dup 3)] UNSPEC_FYL2X))
15573 (clobber (match_scratch:XF 5 ""))])
15574 (set (match_operand:DF 0 "register_operand" "")
15575 (float_truncate:DF (match_dup 4)))]
15576 "TARGET_USE_FANCY_MATH_387
15577 && flag_unsafe_math_optimizations"
15581 operands[2] = gen_reg_rtx (XFmode);
15582 operands[3] = gen_reg_rtx (XFmode);
15583 operands[4] = gen_reg_rtx (XFmode);
15585 temp = standard_80387_constant_rtx (4); /* fldln2 */
15586 emit_move_insn (operands[3], temp);
15589 (define_expand "logxf2"
15590 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15591 (unspec:XF [(match_operand:XF 1 "register_operand" "")
15592 (match_dup 2)] UNSPEC_FYL2X))
15593 (clobber (match_scratch:XF 3 ""))])]
15594 "TARGET_USE_FANCY_MATH_387
15595 && flag_unsafe_math_optimizations"
15599 operands[2] = gen_reg_rtx (XFmode);
15600 temp = standard_80387_constant_rtx (4); /* fldln2 */
15601 emit_move_insn (operands[2], temp);
15604 (define_expand "log10sf2"
15605 [(set (match_dup 2)
15606 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15607 (parallel [(set (match_dup 4)
15608 (unspec:XF [(match_dup 2)
15609 (match_dup 3)] UNSPEC_FYL2X))
15610 (clobber (match_scratch:XF 5 ""))])
15611 (set (match_operand:SF 0 "register_operand" "")
15612 (float_truncate:SF (match_dup 4)))]
15613 "TARGET_USE_FANCY_MATH_387
15614 && flag_unsafe_math_optimizations"
15618 operands[2] = gen_reg_rtx (XFmode);
15619 operands[3] = gen_reg_rtx (XFmode);
15620 operands[4] = gen_reg_rtx (XFmode);
15622 temp = standard_80387_constant_rtx (3); /* fldlg2 */
15623 emit_move_insn (operands[3], temp);
15626 (define_expand "log10df2"
15627 [(set (match_dup 2)
15628 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15629 (parallel [(set (match_dup 4)
15630 (unspec:XF [(match_dup 2)
15631 (match_dup 3)] UNSPEC_FYL2X))
15632 (clobber (match_scratch:XF 5 ""))])
15633 (set (match_operand:DF 0 "register_operand" "")
15634 (float_truncate:DF (match_dup 4)))]
15635 "TARGET_USE_FANCY_MATH_387
15636 && flag_unsafe_math_optimizations"
15640 operands[2] = gen_reg_rtx (XFmode);
15641 operands[3] = gen_reg_rtx (XFmode);
15642 operands[4] = gen_reg_rtx (XFmode);
15644 temp = standard_80387_constant_rtx (3); /* fldlg2 */
15645 emit_move_insn (operands[3], temp);
15648 (define_expand "log10xf2"
15649 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15650 (unspec:XF [(match_operand:XF 1 "register_operand" "")
15651 (match_dup 2)] UNSPEC_FYL2X))
15652 (clobber (match_scratch:XF 3 ""))])]
15653 "TARGET_USE_FANCY_MATH_387
15654 && flag_unsafe_math_optimizations"
15658 operands[2] = gen_reg_rtx (XFmode);
15659 temp = standard_80387_constant_rtx (3); /* fldlg2 */
15660 emit_move_insn (operands[2], temp);
15663 (define_expand "log2sf2"
15664 [(set (match_dup 2)
15665 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15666 (parallel [(set (match_dup 4)
15667 (unspec:XF [(match_dup 2)
15668 (match_dup 3)] UNSPEC_FYL2X))
15669 (clobber (match_scratch:XF 5 ""))])
15670 (set (match_operand:SF 0 "register_operand" "")
15671 (float_truncate:SF (match_dup 4)))]
15672 "TARGET_USE_FANCY_MATH_387
15673 && flag_unsafe_math_optimizations"
15675 operands[2] = gen_reg_rtx (XFmode);
15676 operands[3] = gen_reg_rtx (XFmode);
15677 operands[4] = gen_reg_rtx (XFmode);
15679 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15682 (define_expand "log2df2"
15683 [(set (match_dup 2)
15684 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15685 (parallel [(set (match_dup 4)
15686 (unspec:XF [(match_dup 2)
15687 (match_dup 3)] UNSPEC_FYL2X))
15688 (clobber (match_scratch:XF 5 ""))])
15689 (set (match_operand:DF 0 "register_operand" "")
15690 (float_truncate:DF (match_dup 4)))]
15691 "TARGET_USE_FANCY_MATH_387
15692 && flag_unsafe_math_optimizations"
15694 operands[2] = gen_reg_rtx (XFmode);
15695 operands[3] = gen_reg_rtx (XFmode);
15696 operands[4] = gen_reg_rtx (XFmode);
15698 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15701 (define_expand "log2xf2"
15702 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15703 (unspec:XF [(match_operand:XF 1 "register_operand" "")
15704 (match_dup 2)] UNSPEC_FYL2X))
15705 (clobber (match_scratch:XF 3 ""))])]
15706 "TARGET_USE_FANCY_MATH_387
15707 && flag_unsafe_math_optimizations"
15709 operands[2] = gen_reg_rtx (XFmode);
15710 emit_move_insn (operands[2], CONST1_RTX (XFmode)); /* fld1 */
15713 (define_insn "fyl2xp1_xf3"
15714 [(set (match_operand:XF 0 "register_operand" "=f")
15715 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15716 (match_operand:XF 1 "register_operand" "u")]
15718 (clobber (match_scratch:XF 3 "=1"))]
15719 "TARGET_USE_FANCY_MATH_387
15720 && flag_unsafe_math_optimizations"
15722 [(set_attr "type" "fpspc")
15723 (set_attr "mode" "XF")])
15725 (define_expand "log1psf2"
15726 [(use (match_operand:XF 0 "register_operand" ""))
15727 (use (match_operand:XF 1 "register_operand" ""))]
15728 "TARGET_USE_FANCY_MATH_387
15729 && flag_unsafe_math_optimizations"
15731 rtx op0 = gen_reg_rtx (XFmode);
15732 rtx op1 = gen_reg_rtx (XFmode);
15734 emit_insn (gen_extendsfxf2 (op1, operands[1]));
15735 ix86_emit_i387_log1p (op0, op1);
15736 emit_insn (gen_truncxfsf2_noop (operands[0], op0));
15740 (define_expand "log1pdf2"
15741 [(use (match_operand:XF 0 "register_operand" ""))
15742 (use (match_operand:XF 1 "register_operand" ""))]
15743 "TARGET_USE_FANCY_MATH_387
15744 && flag_unsafe_math_optimizations"
15746 rtx op0 = gen_reg_rtx (XFmode);
15747 rtx op1 = gen_reg_rtx (XFmode);
15749 emit_insn (gen_extenddfxf2 (op1, operands[1]));
15750 ix86_emit_i387_log1p (op0, op1);
15751 emit_insn (gen_truncxfdf2_noop (operands[0], op0));
15755 (define_expand "log1pxf2"
15756 [(use (match_operand:XF 0 "register_operand" ""))
15757 (use (match_operand:XF 1 "register_operand" ""))]
15758 "TARGET_USE_FANCY_MATH_387
15759 && flag_unsafe_math_optimizations"
15761 ix86_emit_i387_log1p (operands[0], operands[1]);
15765 (define_insn "*fxtractxf3"
15766 [(set (match_operand:XF 0 "register_operand" "=f")
15767 (unspec:XF [(match_operand:XF 2 "register_operand" "0")]
15768 UNSPEC_XTRACT_FRACT))
15769 (set (match_operand:XF 1 "register_operand" "=u")
15770 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))]
15771 "TARGET_USE_FANCY_MATH_387
15772 && flag_unsafe_math_optimizations"
15774 [(set_attr "type" "fpspc")
15775 (set_attr "mode" "XF")])
15777 (define_expand "logbsf2"
15778 [(set (match_dup 2)
15779 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15780 (parallel [(set (match_dup 3)
15781 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_FRACT))
15783 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))])
15784 (set (match_operand:SF 0 "register_operand" "")
15785 (float_truncate:SF (match_dup 4)))]
15786 "TARGET_USE_FANCY_MATH_387
15787 && flag_unsafe_math_optimizations"
15789 operands[2] = gen_reg_rtx (XFmode);
15790 operands[3] = gen_reg_rtx (XFmode);
15791 operands[4] = gen_reg_rtx (XFmode);
15794 (define_expand "logbdf2"
15795 [(set (match_dup 2)
15796 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15797 (parallel [(set (match_dup 3)
15798 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_FRACT))
15800 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))])
15801 (set (match_operand:DF 0 "register_operand" "")
15802 (float_truncate:DF (match_dup 4)))]
15803 "TARGET_USE_FANCY_MATH_387
15804 && flag_unsafe_math_optimizations"
15806 operands[2] = gen_reg_rtx (XFmode);
15807 operands[3] = gen_reg_rtx (XFmode);
15808 operands[4] = gen_reg_rtx (XFmode);
15811 (define_expand "logbxf2"
15812 [(parallel [(set (match_dup 2)
15813 (unspec:XF [(match_operand:XF 1 "register_operand" "")]
15814 UNSPEC_XTRACT_FRACT))
15815 (set (match_operand:XF 0 "register_operand" "")
15816 (unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])]
15817 "TARGET_USE_FANCY_MATH_387
15818 && flag_unsafe_math_optimizations"
15820 operands[2] = gen_reg_rtx (XFmode);
15823 (define_expand "ilogbsi2"
15824 [(parallel [(set (match_dup 2)
15825 (unspec:XF [(match_operand:XF 1 "register_operand" "")]
15826 UNSPEC_XTRACT_FRACT))
15827 (set (match_operand:XF 3 "register_operand" "")
15828 (unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])
15829 (parallel [(set (match_operand:SI 0 "register_operand" "")
15830 (fix:SI (match_dup 3)))
15831 (clobber (reg:CC FLAGS_REG))])]
15832 "TARGET_USE_FANCY_MATH_387
15833 && flag_unsafe_math_optimizations"
15835 operands[2] = gen_reg_rtx (XFmode);
15836 operands[3] = gen_reg_rtx (XFmode);
15839 (define_insn "*f2xm1xf2"
15840 [(set (match_operand:XF 0 "register_operand" "=f")
15841 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
15843 "TARGET_USE_FANCY_MATH_387
15844 && flag_unsafe_math_optimizations"
15846 [(set_attr "type" "fpspc")
15847 (set_attr "mode" "XF")])
15849 (define_insn "*fscalexf4"
15850 [(set (match_operand:XF 0 "register_operand" "=f")
15851 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15852 (match_operand:XF 3 "register_operand" "1")]
15853 UNSPEC_FSCALE_FRACT))
15854 (set (match_operand:XF 1 "register_operand" "=u")
15855 (unspec:XF [(match_dup 2) (match_dup 3)]
15856 UNSPEC_FSCALE_EXP))]
15857 "TARGET_USE_FANCY_MATH_387
15858 && flag_unsafe_math_optimizations"
15860 [(set_attr "type" "fpspc")
15861 (set_attr "mode" "XF")])
15863 (define_expand "expsf2"
15864 [(set (match_dup 2)
15865 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15866 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15867 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15868 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15869 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15870 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15871 (parallel [(set (match_dup 10)
15872 (unspec:XF [(match_dup 9) (match_dup 5)]
15873 UNSPEC_FSCALE_FRACT))
15874 (set (match_dup 11)
15875 (unspec:XF [(match_dup 9) (match_dup 5)]
15876 UNSPEC_FSCALE_EXP))])
15877 (set (match_operand:SF 0 "register_operand" "")
15878 (float_truncate:SF (match_dup 10)))]
15879 "TARGET_USE_FANCY_MATH_387
15880 && flag_unsafe_math_optimizations"
15885 for (i=2; i<12; i++)
15886 operands[i] = gen_reg_rtx (XFmode);
15887 temp = standard_80387_constant_rtx (5); /* fldl2e */
15888 emit_move_insn (operands[3], temp);
15889 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15892 (define_expand "expdf2"
15893 [(set (match_dup 2)
15894 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15895 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15896 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15897 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15898 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15899 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15900 (parallel [(set (match_dup 10)
15901 (unspec:XF [(match_dup 9) (match_dup 5)]
15902 UNSPEC_FSCALE_FRACT))
15903 (set (match_dup 11)
15904 (unspec:XF [(match_dup 9) (match_dup 5)]
15905 UNSPEC_FSCALE_EXP))])
15906 (set (match_operand:DF 0 "register_operand" "")
15907 (float_truncate:DF (match_dup 10)))]
15908 "TARGET_USE_FANCY_MATH_387
15909 && flag_unsafe_math_optimizations"
15914 for (i=2; i<12; i++)
15915 operands[i] = gen_reg_rtx (XFmode);
15916 temp = standard_80387_constant_rtx (5); /* fldl2e */
15917 emit_move_insn (operands[3], temp);
15918 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15921 (define_expand "expxf2"
15922 [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "")
15924 (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT))
15925 (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4)))
15926 (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1))
15927 (set (match_dup 8) (plus:XF (match_dup 6) (match_dup 7)))
15928 (parallel [(set (match_operand:XF 0 "register_operand" "")
15929 (unspec:XF [(match_dup 8) (match_dup 4)]
15930 UNSPEC_FSCALE_FRACT))
15932 (unspec:XF [(match_dup 8) (match_dup 4)]
15933 UNSPEC_FSCALE_EXP))])]
15934 "TARGET_USE_FANCY_MATH_387
15935 && flag_unsafe_math_optimizations"
15940 for (i=2; i<10; i++)
15941 operands[i] = gen_reg_rtx (XFmode);
15942 temp = standard_80387_constant_rtx (5); /* fldl2e */
15943 emit_move_insn (operands[2], temp);
15944 emit_move_insn (operands[7], CONST1_RTX (XFmode)); /* fld1 */
15947 (define_expand "exp10sf2"
15948 [(set (match_dup 2)
15949 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15950 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15951 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15952 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15953 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15954 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15955 (parallel [(set (match_dup 10)
15956 (unspec:XF [(match_dup 9) (match_dup 5)]
15957 UNSPEC_FSCALE_FRACT))
15958 (set (match_dup 11)
15959 (unspec:XF [(match_dup 9) (match_dup 5)]
15960 UNSPEC_FSCALE_EXP))])
15961 (set (match_operand:SF 0 "register_operand" "")
15962 (float_truncate:SF (match_dup 10)))]
15963 "TARGET_USE_FANCY_MATH_387
15964 && flag_unsafe_math_optimizations"
15969 for (i=2; i<12; i++)
15970 operands[i] = gen_reg_rtx (XFmode);
15971 temp = standard_80387_constant_rtx (6); /* fldl2t */
15972 emit_move_insn (operands[3], temp);
15973 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15976 (define_expand "exp10df2"
15977 [(set (match_dup 2)
15978 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15979 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15980 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15981 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15982 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15983 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15984 (parallel [(set (match_dup 10)
15985 (unspec:XF [(match_dup 9) (match_dup 5)]
15986 UNSPEC_FSCALE_FRACT))
15987 (set (match_dup 11)
15988 (unspec:XF [(match_dup 9) (match_dup 5)]
15989 UNSPEC_FSCALE_EXP))])
15990 (set (match_operand:DF 0 "register_operand" "")
15991 (float_truncate:DF (match_dup 10)))]
15992 "TARGET_USE_FANCY_MATH_387
15993 && flag_unsafe_math_optimizations"
15998 for (i=2; i<12; i++)
15999 operands[i] = gen_reg_rtx (XFmode);
16000 temp = standard_80387_constant_rtx (6); /* fldl2t */
16001 emit_move_insn (operands[3], temp);
16002 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
16005 (define_expand "exp10xf2"
16006 [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "")
16008 (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT))
16009 (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4)))
16010 (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1))
16011 (set (match_dup 8) (plus:XF (match_dup 6) (match_dup 7)))
16012 (parallel [(set (match_operand:XF 0 "register_operand" "")
16013 (unspec:XF [(match_dup 8) (match_dup 4)]
16014 UNSPEC_FSCALE_FRACT))
16016 (unspec:XF [(match_dup 8) (match_dup 4)]
16017 UNSPEC_FSCALE_EXP))])]
16018 "TARGET_USE_FANCY_MATH_387
16019 && flag_unsafe_math_optimizations"
16024 for (i=2; i<10; i++)
16025 operands[i] = gen_reg_rtx (XFmode);
16026 temp = standard_80387_constant_rtx (6); /* fldl2t */
16027 emit_move_insn (operands[2], temp);
16028 emit_move_insn (operands[7], CONST1_RTX (XFmode)); /* fld1 */
16031 (define_expand "exp2sf2"
16032 [(set (match_dup 2)
16033 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
16034 (set (match_dup 3) (unspec:XF [(match_dup 2)] UNSPEC_FRNDINT))
16035 (set (match_dup 4) (minus:XF (match_dup 2) (match_dup 3)))
16036 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_F2XM1))
16037 (set (match_dup 7) (plus:XF (match_dup 5) (match_dup 6)))
16038 (parallel [(set (match_dup 8)
16039 (unspec:XF [(match_dup 7) (match_dup 3)]
16040 UNSPEC_FSCALE_FRACT))
16042 (unspec:XF [(match_dup 7) (match_dup 3)]
16043 UNSPEC_FSCALE_EXP))])
16044 (set (match_operand:SF 0 "register_operand" "")
16045 (float_truncate:SF (match_dup 8)))]
16046 "TARGET_USE_FANCY_MATH_387
16047 && flag_unsafe_math_optimizations"
16051 for (i=2; i<10; i++)
16052 operands[i] = gen_reg_rtx (XFmode);
16053 emit_move_insn (operands[6], CONST1_RTX (XFmode)); /* fld1 */
16056 (define_expand "exp2df2"
16057 [(set (match_dup 2)
16058 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
16059 (set (match_dup 3) (unspec:XF [(match_dup 2)] UNSPEC_FRNDINT))
16060 (set (match_dup 4) (minus:XF (match_dup 2) (match_dup 3)))
16061 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_F2XM1))
16062 (set (match_dup 7) (plus:XF (match_dup 5) (match_dup 6)))
16063 (parallel [(set (match_dup 8)
16064 (unspec:XF [(match_dup 7) (match_dup 3)]
16065 UNSPEC_FSCALE_FRACT))
16067 (unspec:XF [(match_dup 7) (match_dup 3)]
16068 UNSPEC_FSCALE_EXP))])
16069 (set (match_operand:DF 0 "register_operand" "")
16070 (float_truncate:DF (match_dup 8)))]
16071 "TARGET_USE_FANCY_MATH_387
16072 && flag_unsafe_math_optimizations"
16076 for (i=2; i<10; i++)
16077 operands[i] = gen_reg_rtx (XFmode);
16078 emit_move_insn (operands[6], CONST1_RTX (XFmode)); /* fld1 */
16081 (define_expand "exp2xf2"
16082 [(set (match_dup 2) (match_operand:XF 1 "register_operand" ""))
16083 (set (match_dup 3) (unspec:XF [(match_dup 2)] UNSPEC_FRNDINT))
16084 (set (match_dup 4) (minus:XF (match_dup 2) (match_dup 3)))
16085 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_F2XM1))
16086 (set (match_dup 7) (plus:XF (match_dup 5) (match_dup 6)))
16087 (parallel [(set (match_operand:XF 0 "register_operand" "")
16088 (unspec:XF [(match_dup 7) (match_dup 3)]
16089 UNSPEC_FSCALE_FRACT))
16091 (unspec:XF [(match_dup 7) (match_dup 3)]
16092 UNSPEC_FSCALE_EXP))])]
16093 "TARGET_USE_FANCY_MATH_387
16094 && flag_unsafe_math_optimizations"
16098 for (i=2; i<9; i++)
16099 operands[i] = gen_reg_rtx (XFmode);
16100 emit_move_insn (operands[6], CONST1_RTX (XFmode)); /* fld1 */
16103 (define_expand "expm1df2"
16104 [(set (match_dup 2)
16105 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
16106 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
16107 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
16108 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
16109 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
16110 (parallel [(set (match_dup 8)
16111 (unspec:XF [(match_dup 7) (match_dup 5)]
16112 UNSPEC_FSCALE_FRACT))
16114 (unspec:XF [(match_dup 7) (match_dup 5)]
16115 UNSPEC_FSCALE_EXP))])
16116 (parallel [(set (match_dup 11)
16117 (unspec:XF [(match_dup 10) (match_dup 9)]
16118 UNSPEC_FSCALE_FRACT))
16119 (set (match_dup 12)
16120 (unspec:XF [(match_dup 10) (match_dup 9)]
16121 UNSPEC_FSCALE_EXP))])
16122 (set (match_dup 13) (minus:XF (match_dup 11) (match_dup 10)))
16123 (set (match_dup 14) (plus:XF (match_dup 13) (match_dup 8)))
16124 (set (match_operand:DF 0 "register_operand" "")
16125 (float_truncate:DF (match_dup 14)))]
16126 "TARGET_USE_FANCY_MATH_387
16127 && flag_unsafe_math_optimizations"
16132 for (i=2; i<15; i++)
16133 operands[i] = gen_reg_rtx (XFmode);
16134 temp = standard_80387_constant_rtx (5); /* fldl2e */
16135 emit_move_insn (operands[3], temp);
16136 emit_move_insn (operands[10], CONST1_RTX (XFmode)); /* fld1 */
16139 (define_expand "expm1sf2"
16140 [(set (match_dup 2)
16141 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
16142 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
16143 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
16144 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
16145 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
16146 (parallel [(set (match_dup 8)
16147 (unspec:XF [(match_dup 7) (match_dup 5)]
16148 UNSPEC_FSCALE_FRACT))
16150 (unspec:XF [(match_dup 7) (match_dup 5)]
16151 UNSPEC_FSCALE_EXP))])
16152 (parallel [(set (match_dup 11)
16153 (unspec:XF [(match_dup 10) (match_dup 9)]
16154 UNSPEC_FSCALE_FRACT))
16155 (set (match_dup 12)
16156 (unspec:XF [(match_dup 10) (match_dup 9)]
16157 UNSPEC_FSCALE_EXP))])
16158 (set (match_dup 13) (minus:XF (match_dup 11) (match_dup 10)))
16159 (set (match_dup 14) (plus:XF (match_dup 13) (match_dup 8)))
16160 (set (match_operand:SF 0 "register_operand" "")
16161 (float_truncate:SF (match_dup 14)))]
16162 "TARGET_USE_FANCY_MATH_387
16163 && flag_unsafe_math_optimizations"
16168 for (i=2; i<15; i++)
16169 operands[i] = gen_reg_rtx (XFmode);
16170 temp = standard_80387_constant_rtx (5); /* fldl2e */
16171 emit_move_insn (operands[3], temp);
16172 emit_move_insn (operands[10], CONST1_RTX (XFmode)); /* fld1 */
16175 (define_expand "expm1xf2"
16176 [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "")
16178 (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT))
16179 (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4)))
16180 (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1))
16181 (parallel [(set (match_dup 7)
16182 (unspec:XF [(match_dup 6) (match_dup 4)]
16183 UNSPEC_FSCALE_FRACT))
16185 (unspec:XF [(match_dup 6) (match_dup 4)]
16186 UNSPEC_FSCALE_EXP))])
16187 (parallel [(set (match_dup 10)
16188 (unspec:XF [(match_dup 9) (match_dup 8)]
16189 UNSPEC_FSCALE_FRACT))
16190 (set (match_dup 11)
16191 (unspec:XF [(match_dup 9) (match_dup 8)]
16192 UNSPEC_FSCALE_EXP))])
16193 (set (match_dup 12) (minus:XF (match_dup 10) (match_dup 9)))
16194 (set (match_operand:XF 0 "register_operand" "")
16195 (plus:XF (match_dup 12) (match_dup 7)))]
16196 "TARGET_USE_FANCY_MATH_387
16197 && flag_unsafe_math_optimizations"
16202 for (i=2; i<13; i++)
16203 operands[i] = gen_reg_rtx (XFmode);
16204 temp = standard_80387_constant_rtx (5); /* fldl2e */
16205 emit_move_insn (operands[2], temp);
16206 emit_move_insn (operands[9], CONST1_RTX (XFmode)); /* fld1 */
16210 (define_insn "frndintxf2"
16211 [(set (match_operand:XF 0 "register_operand" "=f")
16212 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16214 "TARGET_USE_FANCY_MATH_387
16215 && flag_unsafe_math_optimizations"
16217 [(set_attr "type" "fpspc")
16218 (set_attr "mode" "XF")])
16220 (define_expand "rintdf2"
16221 [(use (match_operand:DF 0 "register_operand" ""))
16222 (use (match_operand:DF 1 "register_operand" ""))]
16223 "TARGET_USE_FANCY_MATH_387
16224 && flag_unsafe_math_optimizations"
16226 rtx op0 = gen_reg_rtx (XFmode);
16227 rtx op1 = gen_reg_rtx (XFmode);
16229 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16230 emit_insn (gen_frndintxf2 (op0, op1));
16232 emit_insn (gen_truncxfdf2_noop (operands[0], op0));
16236 (define_expand "rintsf2"
16237 [(use (match_operand:SF 0 "register_operand" ""))
16238 (use (match_operand:SF 1 "register_operand" ""))]
16239 "TARGET_USE_FANCY_MATH_387
16240 && flag_unsafe_math_optimizations"
16242 rtx op0 = gen_reg_rtx (XFmode);
16243 rtx op1 = gen_reg_rtx (XFmode);
16245 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16246 emit_insn (gen_frndintxf2 (op0, op1));
16248 emit_insn (gen_truncxfsf2_noop (operands[0], op0));
16252 (define_expand "rintxf2"
16253 [(use (match_operand:XF 0 "register_operand" ""))
16254 (use (match_operand:XF 1 "register_operand" ""))]
16255 "TARGET_USE_FANCY_MATH_387
16256 && flag_unsafe_math_optimizations"
16258 emit_insn (gen_frndintxf2 (operands[0], operands[1]));
16262 (define_insn "frndintxf2_floor"
16263 [(set (match_operand:XF 0 "register_operand" "=f")
16264 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16265 UNSPEC_FRNDINT_FLOOR))
16266 (use (match_operand:HI 2 "memory_operand" "m"))
16267 (use (match_operand:HI 3 "memory_operand" "m"))]
16268 "TARGET_USE_FANCY_MATH_387
16269 && flag_unsafe_math_optimizations"
16270 "fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
16271 [(set_attr "type" "frndint")
16272 (set_attr "i387_cw" "floor")
16273 (set_attr "mode" "XF")])
16275 (define_expand "floordf2"
16276 [(use (match_operand:DF 0 "register_operand" ""))
16277 (use (match_operand:DF 1 "register_operand" ""))]
16278 "TARGET_USE_FANCY_MATH_387
16279 && flag_unsafe_math_optimizations"
16281 rtx op0 = gen_reg_rtx (XFmode);
16282 rtx op1 = gen_reg_rtx (XFmode);
16283 rtx op2 = assign_386_stack_local (HImode, 1);
16284 rtx op3 = assign_386_stack_local (HImode, 2);
16286 ix86_optimize_mode_switching = 1;
16288 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16289 emit_insn (gen_frndintxf2_floor (op0, op1, op2, op3));
16291 emit_insn (gen_truncxfdf2_noop (operands[0], op0));
16295 (define_expand "floorsf2"
16296 [(use (match_operand:SF 0 "register_operand" ""))
16297 (use (match_operand:SF 1 "register_operand" ""))]
16298 "TARGET_USE_FANCY_MATH_387
16299 && flag_unsafe_math_optimizations"
16301 rtx op0 = gen_reg_rtx (XFmode);
16302 rtx op1 = gen_reg_rtx (XFmode);
16303 rtx op2 = assign_386_stack_local (HImode, 1);
16304 rtx op3 = assign_386_stack_local (HImode, 2);
16306 ix86_optimize_mode_switching = 1;
16308 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16309 emit_insn (gen_frndintxf2_floor (op0, op1, op2, op3));
16311 emit_insn (gen_truncxfsf2_noop (operands[0], op0));
16315 (define_expand "floorxf2"
16316 [(use (match_operand:XF 0 "register_operand" ""))
16317 (use (match_operand:XF 1 "register_operand" ""))]
16318 "TARGET_USE_FANCY_MATH_387
16319 && flag_unsafe_math_optimizations"
16321 rtx op2 = assign_386_stack_local (HImode, 1);
16322 rtx op3 = assign_386_stack_local (HImode, 2);
16324 ix86_optimize_mode_switching = 1;
16326 emit_insn (gen_frndintxf2_floor (operands[0], operands[1], op2, op3));
16330 (define_insn "frndintxf2_ceil"
16331 [(set (match_operand:XF 0 "register_operand" "=f")
16332 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16333 UNSPEC_FRNDINT_CEIL))
16334 (use (match_operand:HI 2 "memory_operand" "m"))
16335 (use (match_operand:HI 3 "memory_operand" "m"))]
16336 "TARGET_USE_FANCY_MATH_387
16337 && flag_unsafe_math_optimizations"
16338 "fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
16339 [(set_attr "type" "frndint")
16340 (set_attr "i387_cw" "ceil")
16341 (set_attr "mode" "XF")])
16343 (define_expand "ceildf2"
16344 [(use (match_operand:DF 0 "register_operand" ""))
16345 (use (match_operand:DF 1 "register_operand" ""))]
16346 "TARGET_USE_FANCY_MATH_387
16347 && flag_unsafe_math_optimizations"
16349 rtx op0 = gen_reg_rtx (XFmode);
16350 rtx op1 = gen_reg_rtx (XFmode);
16351 rtx op2 = assign_386_stack_local (HImode, 1);
16352 rtx op3 = assign_386_stack_local (HImode, 2);
16354 ix86_optimize_mode_switching = 1;
16356 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16357 emit_insn (gen_frndintxf2_ceil (op0, op1, op2, op3));
16359 emit_insn (gen_truncxfdf2_noop (operands[0], op0));
16363 (define_expand "ceilsf2"
16364 [(use (match_operand:SF 0 "register_operand" ""))
16365 (use (match_operand:SF 1 "register_operand" ""))]
16366 "TARGET_USE_FANCY_MATH_387
16367 && flag_unsafe_math_optimizations"
16369 rtx op0 = gen_reg_rtx (XFmode);
16370 rtx op1 = gen_reg_rtx (XFmode);
16371 rtx op2 = assign_386_stack_local (HImode, 1);
16372 rtx op3 = assign_386_stack_local (HImode, 2);
16374 ix86_optimize_mode_switching = 1;
16376 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16377 emit_insn (gen_frndintxf2_ceil (op0, op1, op2, op3));
16379 emit_insn (gen_truncxfsf2_noop (operands[0], op0));
16383 (define_expand "ceilxf2"
16384 [(use (match_operand:XF 0 "register_operand" ""))
16385 (use (match_operand:XF 1 "register_operand" ""))]
16386 "TARGET_USE_FANCY_MATH_387
16387 && flag_unsafe_math_optimizations"
16389 rtx op2 = assign_386_stack_local (HImode, 1);
16390 rtx op3 = assign_386_stack_local (HImode, 2);
16392 ix86_optimize_mode_switching = 1;
16394 emit_insn (gen_frndintxf2_ceil (operands[0], operands[1], op2, op3));
16398 (define_insn "frndintxf2_trunc"
16399 [(set (match_operand:XF 0 "register_operand" "=f")
16400 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16401 UNSPEC_FRNDINT_TRUNC))
16402 (use (match_operand:HI 2 "memory_operand" "m"))
16403 (use (match_operand:HI 3 "memory_operand" "m"))]
16404 "TARGET_USE_FANCY_MATH_387
16405 && flag_unsafe_math_optimizations"
16406 "fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
16407 [(set_attr "type" "frndint")
16408 (set_attr "i387_cw" "trunc")
16409 (set_attr "mode" "XF")])
16411 (define_expand "btruncdf2"
16412 [(use (match_operand:DF 0 "register_operand" ""))
16413 (use (match_operand:DF 1 "register_operand" ""))]
16414 "TARGET_USE_FANCY_MATH_387
16415 && flag_unsafe_math_optimizations"
16417 rtx op0 = gen_reg_rtx (XFmode);
16418 rtx op1 = gen_reg_rtx (XFmode);
16419 rtx op2 = assign_386_stack_local (HImode, 1);
16420 rtx op3 = assign_386_stack_local (HImode, 2);
16422 ix86_optimize_mode_switching = 1;
16424 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16425 emit_insn (gen_frndintxf2_trunc (op0, op1, op2, op3));
16427 emit_insn (gen_truncxfdf2_noop (operands[0], op0));
16431 (define_expand "btruncsf2"
16432 [(use (match_operand:SF 0 "register_operand" ""))
16433 (use (match_operand:SF 1 "register_operand" ""))]
16434 "TARGET_USE_FANCY_MATH_387
16435 && flag_unsafe_math_optimizations"
16437 rtx op0 = gen_reg_rtx (XFmode);
16438 rtx op1 = gen_reg_rtx (XFmode);
16439 rtx op2 = assign_386_stack_local (HImode, 1);
16440 rtx op3 = assign_386_stack_local (HImode, 2);
16442 ix86_optimize_mode_switching = 1;
16444 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16445 emit_insn (gen_frndintxf2_trunc (op0, op1, op2, op3));
16447 emit_insn (gen_truncxfsf2_noop (operands[0], op0));
16451 (define_expand "btruncxf2"
16452 [(use (match_operand:XF 0 "register_operand" ""))
16453 (use (match_operand:XF 1 "register_operand" ""))]
16454 "TARGET_USE_FANCY_MATH_387
16455 && flag_unsafe_math_optimizations"
16457 rtx op2 = assign_386_stack_local (HImode, 1);
16458 rtx op3 = assign_386_stack_local (HImode, 2);
16460 ix86_optimize_mode_switching = 1;
16462 emit_insn (gen_frndintxf2_trunc (operands[0], operands[1], op2, op3));
16466 (define_insn "frndintxf2_mask_pm"
16467 [(set (match_operand:XF 0 "register_operand" "=f")
16468 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16469 UNSPEC_FRNDINT_MASK_PM))
16470 (use (match_operand:HI 2 "memory_operand" "m"))
16471 (use (match_operand:HI 3 "memory_operand" "m"))]
16472 "TARGET_USE_FANCY_MATH_387
16473 && flag_unsafe_math_optimizations"
16474 "fldcw\t%3\n\tfrndint\n\tfclex\n\tfldcw\t%2"
16475 [(set_attr "type" "frndint")
16476 (set_attr "i387_cw" "mask_pm")
16477 (set_attr "mode" "XF")])
16479 (define_expand "nearbyintdf2"
16480 [(use (match_operand:DF 0 "register_operand" ""))
16481 (use (match_operand:DF 1 "register_operand" ""))]
16482 "TARGET_USE_FANCY_MATH_387
16483 && flag_unsafe_math_optimizations"
16485 rtx op0 = gen_reg_rtx (XFmode);
16486 rtx op1 = gen_reg_rtx (XFmode);
16487 rtx op2 = assign_386_stack_local (HImode, 1);
16488 rtx op3 = assign_386_stack_local (HImode, 2);
16490 ix86_optimize_mode_switching = 1;
16492 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16493 emit_insn (gen_frndintxf2_mask_pm (op0, op1, op2, op3));
16495 emit_insn (gen_truncxfdf2_noop (operands[0], op0));
16499 (define_expand "nearbyintsf2"
16500 [(use (match_operand:SF 0 "register_operand" ""))
16501 (use (match_operand:SF 1 "register_operand" ""))]
16502 "TARGET_USE_FANCY_MATH_387
16503 && flag_unsafe_math_optimizations"
16505 rtx op0 = gen_reg_rtx (XFmode);
16506 rtx op1 = gen_reg_rtx (XFmode);
16507 rtx op2 = assign_386_stack_local (HImode, 1);
16508 rtx op3 = assign_386_stack_local (HImode, 2);
16510 ix86_optimize_mode_switching = 1;
16512 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16513 emit_insn (gen_frndintxf2_mask_pm (op0, op1, op2, op3));
16515 emit_insn (gen_truncxfsf2_noop (operands[0], op0));
16519 (define_expand "nearbyintxf2"
16520 [(use (match_operand:XF 0 "register_operand" ""))
16521 (use (match_operand:XF 1 "register_operand" ""))]
16522 "TARGET_USE_FANCY_MATH_387
16523 && flag_unsafe_math_optimizations"
16525 rtx op2 = assign_386_stack_local (HImode, 1);
16526 rtx op3 = assign_386_stack_local (HImode, 2);
16528 ix86_optimize_mode_switching = 1;
16530 emit_insn (gen_frndintxf2_mask_pm (operands[0], operands[1],
16536 ;; Block operation instructions
16539 [(set (reg:SI DIRFLAG_REG) (const_int 0))]
16542 [(set_attr "type" "cld")])
16544 (define_expand "movmemsi"
16545 [(use (match_operand:BLK 0 "memory_operand" ""))
16546 (use (match_operand:BLK 1 "memory_operand" ""))
16547 (use (match_operand:SI 2 "nonmemory_operand" ""))
16548 (use (match_operand:SI 3 "const_int_operand" ""))]
16551 if (ix86_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
16557 (define_expand "movmemdi"
16558 [(use (match_operand:BLK 0 "memory_operand" ""))
16559 (use (match_operand:BLK 1 "memory_operand" ""))
16560 (use (match_operand:DI 2 "nonmemory_operand" ""))
16561 (use (match_operand:DI 3 "const_int_operand" ""))]
16564 if (ix86_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
16570 ;; Most CPUs don't like single string operations
16571 ;; Handle this case here to simplify previous expander.
16573 (define_expand "strmov"
16574 [(set (match_dup 4) (match_operand 3 "memory_operand" ""))
16575 (set (match_operand 1 "memory_operand" "") (match_dup 4))
16576 (parallel [(set (match_operand 0 "register_operand" "") (match_dup 5))
16577 (clobber (reg:CC FLAGS_REG))])
16578 (parallel [(set (match_operand 2 "register_operand" "") (match_dup 6))
16579 (clobber (reg:CC FLAGS_REG))])]
16582 rtx adjust = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[1])));
16584 /* If .md ever supports :P for Pmode, these can be directly
16585 in the pattern above. */
16586 operands[5] = gen_rtx_PLUS (Pmode, operands[0], adjust);
16587 operands[6] = gen_rtx_PLUS (Pmode, operands[2], adjust);
16589 if (TARGET_SINGLE_STRINGOP || optimize_size)
16591 emit_insn (gen_strmov_singleop (operands[0], operands[1],
16592 operands[2], operands[3],
16593 operands[5], operands[6]));
16597 operands[4] = gen_reg_rtx (GET_MODE (operands[1]));
16600 (define_expand "strmov_singleop"
16601 [(parallel [(set (match_operand 1 "memory_operand" "")
16602 (match_operand 3 "memory_operand" ""))
16603 (set (match_operand 0 "register_operand" "")
16604 (match_operand 4 "" ""))
16605 (set (match_operand 2 "register_operand" "")
16606 (match_operand 5 "" ""))
16607 (use (reg:SI DIRFLAG_REG))])]
16608 "TARGET_SINGLE_STRINGOP || optimize_size"
16611 (define_insn "*strmovdi_rex_1"
16612 [(set (mem:DI (match_operand:DI 2 "register_operand" "0"))
16613 (mem:DI (match_operand:DI 3 "register_operand" "1")))
16614 (set (match_operand:DI 0 "register_operand" "=D")
16615 (plus:DI (match_dup 2)
16617 (set (match_operand:DI 1 "register_operand" "=S")
16618 (plus:DI (match_dup 3)
16620 (use (reg:SI DIRFLAG_REG))]
16621 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16623 [(set_attr "type" "str")
16624 (set_attr "mode" "DI")
16625 (set_attr "memory" "both")])
16627 (define_insn "*strmovsi_1"
16628 [(set (mem:SI (match_operand:SI 2 "register_operand" "0"))
16629 (mem:SI (match_operand:SI 3 "register_operand" "1")))
16630 (set (match_operand:SI 0 "register_operand" "=D")
16631 (plus:SI (match_dup 2)
16633 (set (match_operand:SI 1 "register_operand" "=S")
16634 (plus:SI (match_dup 3)
16636 (use (reg:SI DIRFLAG_REG))]
16637 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16639 [(set_attr "type" "str")
16640 (set_attr "mode" "SI")
16641 (set_attr "memory" "both")])
16643 (define_insn "*strmovsi_rex_1"
16644 [(set (mem:SI (match_operand:DI 2 "register_operand" "0"))
16645 (mem:SI (match_operand:DI 3 "register_operand" "1")))
16646 (set (match_operand:DI 0 "register_operand" "=D")
16647 (plus:DI (match_dup 2)
16649 (set (match_operand:DI 1 "register_operand" "=S")
16650 (plus:DI (match_dup 3)
16652 (use (reg:SI DIRFLAG_REG))]
16653 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16655 [(set_attr "type" "str")
16656 (set_attr "mode" "SI")
16657 (set_attr "memory" "both")])
16659 (define_insn "*strmovhi_1"
16660 [(set (mem:HI (match_operand:SI 2 "register_operand" "0"))
16661 (mem:HI (match_operand:SI 3 "register_operand" "1")))
16662 (set (match_operand:SI 0 "register_operand" "=D")
16663 (plus:SI (match_dup 2)
16665 (set (match_operand:SI 1 "register_operand" "=S")
16666 (plus:SI (match_dup 3)
16668 (use (reg:SI DIRFLAG_REG))]
16669 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16671 [(set_attr "type" "str")
16672 (set_attr "memory" "both")
16673 (set_attr "mode" "HI")])
16675 (define_insn "*strmovhi_rex_1"
16676 [(set (mem:HI (match_operand:DI 2 "register_operand" "0"))
16677 (mem:HI (match_operand:DI 3 "register_operand" "1")))
16678 (set (match_operand:DI 0 "register_operand" "=D")
16679 (plus:DI (match_dup 2)
16681 (set (match_operand:DI 1 "register_operand" "=S")
16682 (plus:DI (match_dup 3)
16684 (use (reg:SI DIRFLAG_REG))]
16685 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16687 [(set_attr "type" "str")
16688 (set_attr "memory" "both")
16689 (set_attr "mode" "HI")])
16691 (define_insn "*strmovqi_1"
16692 [(set (mem:QI (match_operand:SI 2 "register_operand" "0"))
16693 (mem:QI (match_operand:SI 3 "register_operand" "1")))
16694 (set (match_operand:SI 0 "register_operand" "=D")
16695 (plus:SI (match_dup 2)
16697 (set (match_operand:SI 1 "register_operand" "=S")
16698 (plus:SI (match_dup 3)
16700 (use (reg:SI DIRFLAG_REG))]
16701 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16703 [(set_attr "type" "str")
16704 (set_attr "memory" "both")
16705 (set_attr "mode" "QI")])
16707 (define_insn "*strmovqi_rex_1"
16708 [(set (mem:QI (match_operand:DI 2 "register_operand" "0"))
16709 (mem:QI (match_operand:DI 3 "register_operand" "1")))
16710 (set (match_operand:DI 0 "register_operand" "=D")
16711 (plus:DI (match_dup 2)
16713 (set (match_operand:DI 1 "register_operand" "=S")
16714 (plus:DI (match_dup 3)
16716 (use (reg:SI DIRFLAG_REG))]
16717 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16719 [(set_attr "type" "str")
16720 (set_attr "memory" "both")
16721 (set_attr "mode" "QI")])
16723 (define_expand "rep_mov"
16724 [(parallel [(set (match_operand 4 "register_operand" "") (const_int 0))
16725 (set (match_operand 0 "register_operand" "")
16726 (match_operand 5 "" ""))
16727 (set (match_operand 2 "register_operand" "")
16728 (match_operand 6 "" ""))
16729 (set (match_operand 1 "memory_operand" "")
16730 (match_operand 3 "memory_operand" ""))
16731 (use (match_dup 4))
16732 (use (reg:SI DIRFLAG_REG))])]
16736 (define_insn "*rep_movdi_rex64"
16737 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
16738 (set (match_operand:DI 0 "register_operand" "=D")
16739 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
16741 (match_operand:DI 3 "register_operand" "0")))
16742 (set (match_operand:DI 1 "register_operand" "=S")
16743 (plus:DI (ashift:DI (match_dup 5) (const_int 3))
16744 (match_operand:DI 4 "register_operand" "1")))
16745 (set (mem:BLK (match_dup 3))
16746 (mem:BLK (match_dup 4)))
16747 (use (match_dup 5))
16748 (use (reg:SI DIRFLAG_REG))]
16750 "{rep\;movsq|rep movsq}"
16751 [(set_attr "type" "str")
16752 (set_attr "prefix_rep" "1")
16753 (set_attr "memory" "both")
16754 (set_attr "mode" "DI")])
16756 (define_insn "*rep_movsi"
16757 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
16758 (set (match_operand:SI 0 "register_operand" "=D")
16759 (plus:SI (ashift:SI (match_operand:SI 5 "register_operand" "2")
16761 (match_operand:SI 3 "register_operand" "0")))
16762 (set (match_operand:SI 1 "register_operand" "=S")
16763 (plus:SI (ashift:SI (match_dup 5) (const_int 2))
16764 (match_operand:SI 4 "register_operand" "1")))
16765 (set (mem:BLK (match_dup 3))
16766 (mem:BLK (match_dup 4)))
16767 (use (match_dup 5))
16768 (use (reg:SI DIRFLAG_REG))]
16770 "{rep\;movsl|rep movsd}"
16771 [(set_attr "type" "str")
16772 (set_attr "prefix_rep" "1")
16773 (set_attr "memory" "both")
16774 (set_attr "mode" "SI")])
16776 (define_insn "*rep_movsi_rex64"
16777 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
16778 (set (match_operand:DI 0 "register_operand" "=D")
16779 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
16781 (match_operand:DI 3 "register_operand" "0")))
16782 (set (match_operand:DI 1 "register_operand" "=S")
16783 (plus:DI (ashift:DI (match_dup 5) (const_int 2))
16784 (match_operand:DI 4 "register_operand" "1")))
16785 (set (mem:BLK (match_dup 3))
16786 (mem:BLK (match_dup 4)))
16787 (use (match_dup 5))
16788 (use (reg:SI DIRFLAG_REG))]
16790 "{rep\;movsl|rep movsd}"
16791 [(set_attr "type" "str")
16792 (set_attr "prefix_rep" "1")
16793 (set_attr "memory" "both")
16794 (set_attr "mode" "SI")])
16796 (define_insn "*rep_movqi"
16797 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
16798 (set (match_operand:SI 0 "register_operand" "=D")
16799 (plus:SI (match_operand:SI 3 "register_operand" "0")
16800 (match_operand:SI 5 "register_operand" "2")))
16801 (set (match_operand:SI 1 "register_operand" "=S")
16802 (plus:SI (match_operand:SI 4 "register_operand" "1") (match_dup 5)))
16803 (set (mem:BLK (match_dup 3))
16804 (mem:BLK (match_dup 4)))
16805 (use (match_dup 5))
16806 (use (reg:SI DIRFLAG_REG))]
16808 "{rep\;movsb|rep movsb}"
16809 [(set_attr "type" "str")
16810 (set_attr "prefix_rep" "1")
16811 (set_attr "memory" "both")
16812 (set_attr "mode" "SI")])
16814 (define_insn "*rep_movqi_rex64"
16815 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
16816 (set (match_operand:DI 0 "register_operand" "=D")
16817 (plus:DI (match_operand:DI 3 "register_operand" "0")
16818 (match_operand:DI 5 "register_operand" "2")))
16819 (set (match_operand:DI 1 "register_operand" "=S")
16820 (plus:DI (match_operand:DI 4 "register_operand" "1") (match_dup 5)))
16821 (set (mem:BLK (match_dup 3))
16822 (mem:BLK (match_dup 4)))
16823 (use (match_dup 5))
16824 (use (reg:SI DIRFLAG_REG))]
16826 "{rep\;movsb|rep movsb}"
16827 [(set_attr "type" "str")
16828 (set_attr "prefix_rep" "1")
16829 (set_attr "memory" "both")
16830 (set_attr "mode" "SI")])
16832 (define_expand "clrmemsi"
16833 [(use (match_operand:BLK 0 "memory_operand" ""))
16834 (use (match_operand:SI 1 "nonmemory_operand" ""))
16835 (use (match_operand 2 "const_int_operand" ""))]
16838 if (ix86_expand_clrmem (operands[0], operands[1], operands[2]))
16844 (define_expand "clrmemdi"
16845 [(use (match_operand:BLK 0 "memory_operand" ""))
16846 (use (match_operand:DI 1 "nonmemory_operand" ""))
16847 (use (match_operand 2 "const_int_operand" ""))]
16850 if (ix86_expand_clrmem (operands[0], operands[1], operands[2]))
16856 ;; Most CPUs don't like single string operations
16857 ;; Handle this case here to simplify previous expander.
16859 (define_expand "strset"
16860 [(set (match_operand 1 "memory_operand" "")
16861 (match_operand 2 "register_operand" ""))
16862 (parallel [(set (match_operand 0 "register_operand" "")
16864 (clobber (reg:CC FLAGS_REG))])]
16867 if (GET_MODE (operands[1]) != GET_MODE (operands[2]))
16868 operands[1] = adjust_address_nv (operands[1], GET_MODE (operands[2]), 0);
16870 /* If .md ever supports :P for Pmode, this can be directly
16871 in the pattern above. */
16872 operands[3] = gen_rtx_PLUS (Pmode, operands[0],
16873 GEN_INT (GET_MODE_SIZE (GET_MODE
16875 if (TARGET_SINGLE_STRINGOP || optimize_size)
16877 emit_insn (gen_strset_singleop (operands[0], operands[1], operands[2],
16883 (define_expand "strset_singleop"
16884 [(parallel [(set (match_operand 1 "memory_operand" "")
16885 (match_operand 2 "register_operand" ""))
16886 (set (match_operand 0 "register_operand" "")
16887 (match_operand 3 "" ""))
16888 (use (reg:SI DIRFLAG_REG))])]
16889 "TARGET_SINGLE_STRINGOP || optimize_size"
16892 (define_insn "*strsetdi_rex_1"
16893 [(set (mem:DI (match_operand:DI 1 "register_operand" "0"))
16894 (match_operand:DI 2 "register_operand" "a"))
16895 (set (match_operand:DI 0 "register_operand" "=D")
16896 (plus:DI (match_dup 1)
16898 (use (reg:SI DIRFLAG_REG))]
16899 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16901 [(set_attr "type" "str")
16902 (set_attr "memory" "store")
16903 (set_attr "mode" "DI")])
16905 (define_insn "*strsetsi_1"
16906 [(set (mem:SI (match_operand:SI 1 "register_operand" "0"))
16907 (match_operand:SI 2 "register_operand" "a"))
16908 (set (match_operand:SI 0 "register_operand" "=D")
16909 (plus:SI (match_dup 1)
16911 (use (reg:SI DIRFLAG_REG))]
16912 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16914 [(set_attr "type" "str")
16915 (set_attr "memory" "store")
16916 (set_attr "mode" "SI")])
16918 (define_insn "*strsetsi_rex_1"
16919 [(set (mem:SI (match_operand:DI 1 "register_operand" "0"))
16920 (match_operand:SI 2 "register_operand" "a"))
16921 (set (match_operand:DI 0 "register_operand" "=D")
16922 (plus:DI (match_dup 1)
16924 (use (reg:SI DIRFLAG_REG))]
16925 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16927 [(set_attr "type" "str")
16928 (set_attr "memory" "store")
16929 (set_attr "mode" "SI")])
16931 (define_insn "*strsethi_1"
16932 [(set (mem:HI (match_operand:SI 1 "register_operand" "0"))
16933 (match_operand:HI 2 "register_operand" "a"))
16934 (set (match_operand:SI 0 "register_operand" "=D")
16935 (plus:SI (match_dup 1)
16937 (use (reg:SI DIRFLAG_REG))]
16938 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16940 [(set_attr "type" "str")
16941 (set_attr "memory" "store")
16942 (set_attr "mode" "HI")])
16944 (define_insn "*strsethi_rex_1"
16945 [(set (mem:HI (match_operand:DI 1 "register_operand" "0"))
16946 (match_operand:HI 2 "register_operand" "a"))
16947 (set (match_operand:DI 0 "register_operand" "=D")
16948 (plus:DI (match_dup 1)
16950 (use (reg:SI DIRFLAG_REG))]
16951 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16953 [(set_attr "type" "str")
16954 (set_attr "memory" "store")
16955 (set_attr "mode" "HI")])
16957 (define_insn "*strsetqi_1"
16958 [(set (mem:QI (match_operand:SI 1 "register_operand" "0"))
16959 (match_operand:QI 2 "register_operand" "a"))
16960 (set (match_operand:SI 0 "register_operand" "=D")
16961 (plus:SI (match_dup 1)
16963 (use (reg:SI DIRFLAG_REG))]
16964 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16966 [(set_attr "type" "str")
16967 (set_attr "memory" "store")
16968 (set_attr "mode" "QI")])
16970 (define_insn "*strsetqi_rex_1"
16971 [(set (mem:QI (match_operand:DI 1 "register_operand" "0"))
16972 (match_operand:QI 2 "register_operand" "a"))
16973 (set (match_operand:DI 0 "register_operand" "=D")
16974 (plus:DI (match_dup 1)
16976 (use (reg:SI DIRFLAG_REG))]
16977 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16979 [(set_attr "type" "str")
16980 (set_attr "memory" "store")
16981 (set_attr "mode" "QI")])
16983 (define_expand "rep_stos"
16984 [(parallel [(set (match_operand 1 "register_operand" "") (const_int 0))
16985 (set (match_operand 0 "register_operand" "")
16986 (match_operand 4 "" ""))
16987 (set (match_operand 2 "memory_operand" "") (const_int 0))
16988 (use (match_operand 3 "register_operand" ""))
16989 (use (match_dup 1))
16990 (use (reg:SI DIRFLAG_REG))])]
16994 (define_insn "*rep_stosdi_rex64"
16995 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
16996 (set (match_operand:DI 0 "register_operand" "=D")
16997 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
16999 (match_operand:DI 3 "register_operand" "0")))
17000 (set (mem:BLK (match_dup 3))
17002 (use (match_operand:DI 2 "register_operand" "a"))
17003 (use (match_dup 4))
17004 (use (reg:SI DIRFLAG_REG))]
17006 "{rep\;stosq|rep stosq}"
17007 [(set_attr "type" "str")
17008 (set_attr "prefix_rep" "1")
17009 (set_attr "memory" "store")
17010 (set_attr "mode" "DI")])
17012 (define_insn "*rep_stossi"
17013 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
17014 (set (match_operand:SI 0 "register_operand" "=D")
17015 (plus:SI (ashift:SI (match_operand:SI 4 "register_operand" "1")
17017 (match_operand:SI 3 "register_operand" "0")))
17018 (set (mem:BLK (match_dup 3))
17020 (use (match_operand:SI 2 "register_operand" "a"))
17021 (use (match_dup 4))
17022 (use (reg:SI DIRFLAG_REG))]
17024 "{rep\;stosl|rep stosd}"
17025 [(set_attr "type" "str")
17026 (set_attr "prefix_rep" "1")
17027 (set_attr "memory" "store")
17028 (set_attr "mode" "SI")])
17030 (define_insn "*rep_stossi_rex64"
17031 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
17032 (set (match_operand:DI 0 "register_operand" "=D")
17033 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
17035 (match_operand:DI 3 "register_operand" "0")))
17036 (set (mem:BLK (match_dup 3))
17038 (use (match_operand:SI 2 "register_operand" "a"))
17039 (use (match_dup 4))
17040 (use (reg:SI DIRFLAG_REG))]
17042 "{rep\;stosl|rep stosd}"
17043 [(set_attr "type" "str")
17044 (set_attr "prefix_rep" "1")
17045 (set_attr "memory" "store")
17046 (set_attr "mode" "SI")])
17048 (define_insn "*rep_stosqi"
17049 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
17050 (set (match_operand:SI 0 "register_operand" "=D")
17051 (plus:SI (match_operand:SI 3 "register_operand" "0")
17052 (match_operand:SI 4 "register_operand" "1")))
17053 (set (mem:BLK (match_dup 3))
17055 (use (match_operand:QI 2 "register_operand" "a"))
17056 (use (match_dup 4))
17057 (use (reg:SI DIRFLAG_REG))]
17059 "{rep\;stosb|rep stosb}"
17060 [(set_attr "type" "str")
17061 (set_attr "prefix_rep" "1")
17062 (set_attr "memory" "store")
17063 (set_attr "mode" "QI")])
17065 (define_insn "*rep_stosqi_rex64"
17066 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
17067 (set (match_operand:DI 0 "register_operand" "=D")
17068 (plus:DI (match_operand:DI 3 "register_operand" "0")
17069 (match_operand:DI 4 "register_operand" "1")))
17070 (set (mem:BLK (match_dup 3))
17072 (use (match_operand:QI 2 "register_operand" "a"))
17073 (use (match_dup 4))
17074 (use (reg:SI DIRFLAG_REG))]
17076 "{rep\;stosb|rep stosb}"
17077 [(set_attr "type" "str")
17078 (set_attr "prefix_rep" "1")
17079 (set_attr "memory" "store")
17080 (set_attr "mode" "QI")])
17082 (define_expand "cmpstrsi"
17083 [(set (match_operand:SI 0 "register_operand" "")
17084 (compare:SI (match_operand:BLK 1 "general_operand" "")
17085 (match_operand:BLK 2 "general_operand" "")))
17086 (use (match_operand 3 "general_operand" ""))
17087 (use (match_operand 4 "immediate_operand" ""))]
17088 "! optimize_size || TARGET_INLINE_ALL_STRINGOPS"
17090 rtx addr1, addr2, out, outlow, count, countreg, align;
17092 /* Can't use this if the user has appropriated esi or edi. */
17093 if (global_regs[4] || global_regs[5])
17097 if (GET_CODE (out) != REG)
17098 out = gen_reg_rtx (SImode);
17100 addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
17101 addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0));
17102 if (addr1 != XEXP (operands[1], 0))
17103 operands[1] = replace_equiv_address_nv (operands[1], addr1);
17104 if (addr2 != XEXP (operands[2], 0))
17105 operands[2] = replace_equiv_address_nv (operands[2], addr2);
17107 count = operands[3];
17108 countreg = ix86_zero_extend_to_Pmode (count);
17110 /* %%% Iff we are testing strict equality, we can use known alignment
17111 to good advantage. This may be possible with combine, particularly
17112 once cc0 is dead. */
17113 align = operands[4];
17115 emit_insn (gen_cld ());
17116 if (GET_CODE (count) == CONST_INT)
17118 if (INTVAL (count) == 0)
17120 emit_move_insn (operands[0], const0_rtx);
17123 emit_insn (gen_cmpstrqi_nz_1 (addr1, addr2, countreg, align,
17124 operands[1], operands[2]));
17129 emit_insn (gen_cmpdi_1_rex64 (countreg, countreg));
17131 emit_insn (gen_cmpsi_1 (countreg, countreg));
17132 emit_insn (gen_cmpstrqi_1 (addr1, addr2, countreg, align,
17133 operands[1], operands[2]));
17136 outlow = gen_lowpart (QImode, out);
17137 emit_insn (gen_cmpintqi (outlow));
17138 emit_move_insn (out, gen_rtx_SIGN_EXTEND (SImode, outlow));
17140 if (operands[0] != out)
17141 emit_move_insn (operands[0], out);
17146 ;; Produce a tri-state integer (-1, 0, 1) from condition codes.
17148 (define_expand "cmpintqi"
17149 [(set (match_dup 1)
17150 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
17152 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
17153 (parallel [(set (match_operand:QI 0 "register_operand" "")
17154 (minus:QI (match_dup 1)
17156 (clobber (reg:CC FLAGS_REG))])]
17158 "operands[1] = gen_reg_rtx (QImode);
17159 operands[2] = gen_reg_rtx (QImode);")
17161 ;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is
17162 ;; zero. Emit extra code to make sure that a zero-length compare is EQ.
17164 (define_expand "cmpstrqi_nz_1"
17165 [(parallel [(set (reg:CC FLAGS_REG)
17166 (compare:CC (match_operand 4 "memory_operand" "")
17167 (match_operand 5 "memory_operand" "")))
17168 (use (match_operand 2 "register_operand" ""))
17169 (use (match_operand:SI 3 "immediate_operand" ""))
17170 (use (reg:SI DIRFLAG_REG))
17171 (clobber (match_operand 0 "register_operand" ""))
17172 (clobber (match_operand 1 "register_operand" ""))
17173 (clobber (match_dup 2))])]
17177 (define_insn "*cmpstrqi_nz_1"
17178 [(set (reg:CC FLAGS_REG)
17179 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
17180 (mem:BLK (match_operand:SI 5 "register_operand" "1"))))
17181 (use (match_operand:SI 6 "register_operand" "2"))
17182 (use (match_operand:SI 3 "immediate_operand" "i"))
17183 (use (reg:SI DIRFLAG_REG))
17184 (clobber (match_operand:SI 0 "register_operand" "=S"))
17185 (clobber (match_operand:SI 1 "register_operand" "=D"))
17186 (clobber (match_operand:SI 2 "register_operand" "=c"))]
17189 [(set_attr "type" "str")
17190 (set_attr "mode" "QI")
17191 (set_attr "prefix_rep" "1")])
17193 (define_insn "*cmpstrqi_nz_rex_1"
17194 [(set (reg:CC FLAGS_REG)
17195 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
17196 (mem:BLK (match_operand:DI 5 "register_operand" "1"))))
17197 (use (match_operand:DI 6 "register_operand" "2"))
17198 (use (match_operand:SI 3 "immediate_operand" "i"))
17199 (use (reg:SI DIRFLAG_REG))
17200 (clobber (match_operand:DI 0 "register_operand" "=S"))
17201 (clobber (match_operand:DI 1 "register_operand" "=D"))
17202 (clobber (match_operand:DI 2 "register_operand" "=c"))]
17205 [(set_attr "type" "str")
17206 (set_attr "mode" "QI")
17207 (set_attr "prefix_rep" "1")])
17209 ;; The same, but the count is not known to not be zero.
17211 (define_expand "cmpstrqi_1"
17212 [(parallel [(set (reg:CC FLAGS_REG)
17213 (if_then_else:CC (ne (match_operand 2 "register_operand" "")
17215 (compare:CC (match_operand 4 "memory_operand" "")
17216 (match_operand 5 "memory_operand" ""))
17218 (use (match_operand:SI 3 "immediate_operand" ""))
17219 (use (reg:CC FLAGS_REG))
17220 (use (reg:SI DIRFLAG_REG))
17221 (clobber (match_operand 0 "register_operand" ""))
17222 (clobber (match_operand 1 "register_operand" ""))
17223 (clobber (match_dup 2))])]
17227 (define_insn "*cmpstrqi_1"
17228 [(set (reg:CC FLAGS_REG)
17229 (if_then_else:CC (ne (match_operand:SI 6 "register_operand" "2")
17231 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
17232 (mem:BLK (match_operand:SI 5 "register_operand" "1")))
17234 (use (match_operand:SI 3 "immediate_operand" "i"))
17235 (use (reg:CC FLAGS_REG))
17236 (use (reg:SI DIRFLAG_REG))
17237 (clobber (match_operand:SI 0 "register_operand" "=S"))
17238 (clobber (match_operand:SI 1 "register_operand" "=D"))
17239 (clobber (match_operand:SI 2 "register_operand" "=c"))]
17242 [(set_attr "type" "str")
17243 (set_attr "mode" "QI")
17244 (set_attr "prefix_rep" "1")])
17246 (define_insn "*cmpstrqi_rex_1"
17247 [(set (reg:CC FLAGS_REG)
17248 (if_then_else:CC (ne (match_operand:DI 6 "register_operand" "2")
17250 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
17251 (mem:BLK (match_operand:DI 5 "register_operand" "1")))
17253 (use (match_operand:SI 3 "immediate_operand" "i"))
17254 (use (reg:CC FLAGS_REG))
17255 (use (reg:SI DIRFLAG_REG))
17256 (clobber (match_operand:DI 0 "register_operand" "=S"))
17257 (clobber (match_operand:DI 1 "register_operand" "=D"))
17258 (clobber (match_operand:DI 2 "register_operand" "=c"))]
17261 [(set_attr "type" "str")
17262 (set_attr "mode" "QI")
17263 (set_attr "prefix_rep" "1")])
17265 (define_expand "strlensi"
17266 [(set (match_operand:SI 0 "register_operand" "")
17267 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
17268 (match_operand:QI 2 "immediate_operand" "")
17269 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
17272 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
17278 (define_expand "strlendi"
17279 [(set (match_operand:DI 0 "register_operand" "")
17280 (unspec:DI [(match_operand:BLK 1 "general_operand" "")
17281 (match_operand:QI 2 "immediate_operand" "")
17282 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
17285 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
17291 (define_expand "strlenqi_1"
17292 [(parallel [(set (match_operand 0 "register_operand" "") (match_operand 2 "" ""))
17293 (use (reg:SI DIRFLAG_REG))
17294 (clobber (match_operand 1 "register_operand" ""))
17295 (clobber (reg:CC FLAGS_REG))])]
17299 (define_insn "*strlenqi_1"
17300 [(set (match_operand:SI 0 "register_operand" "=&c")
17301 (unspec:SI [(mem:BLK (match_operand:SI 5 "register_operand" "1"))
17302 (match_operand:QI 2 "register_operand" "a")
17303 (match_operand:SI 3 "immediate_operand" "i")
17304 (match_operand:SI 4 "register_operand" "0")] UNSPEC_SCAS))
17305 (use (reg:SI DIRFLAG_REG))
17306 (clobber (match_operand:SI 1 "register_operand" "=D"))
17307 (clobber (reg:CC FLAGS_REG))]
17310 [(set_attr "type" "str")
17311 (set_attr "mode" "QI")
17312 (set_attr "prefix_rep" "1")])
17314 (define_insn "*strlenqi_rex_1"
17315 [(set (match_operand:DI 0 "register_operand" "=&c")
17316 (unspec:DI [(mem:BLK (match_operand:DI 5 "register_operand" "1"))
17317 (match_operand:QI 2 "register_operand" "a")
17318 (match_operand:DI 3 "immediate_operand" "i")
17319 (match_operand:DI 4 "register_operand" "0")] UNSPEC_SCAS))
17320 (use (reg:SI DIRFLAG_REG))
17321 (clobber (match_operand:DI 1 "register_operand" "=D"))
17322 (clobber (reg:CC FLAGS_REG))]
17325 [(set_attr "type" "str")
17326 (set_attr "mode" "QI")
17327 (set_attr "prefix_rep" "1")])
17329 ;; Peephole optimizations to clean up after cmpstr*. This should be
17330 ;; handled in combine, but it is not currently up to the task.
17331 ;; When used for their truth value, the cmpstr* expanders generate
17340 ;; The intermediate three instructions are unnecessary.
17342 ;; This one handles cmpstr*_nz_1...
17345 (set (reg:CC FLAGS_REG)
17346 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
17347 (mem:BLK (match_operand 5 "register_operand" ""))))
17348 (use (match_operand 6 "register_operand" ""))
17349 (use (match_operand:SI 3 "immediate_operand" ""))
17350 (use (reg:SI DIRFLAG_REG))
17351 (clobber (match_operand 0 "register_operand" ""))
17352 (clobber (match_operand 1 "register_operand" ""))
17353 (clobber (match_operand 2 "register_operand" ""))])
17354 (set (match_operand:QI 7 "register_operand" "")
17355 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
17356 (set (match_operand:QI 8 "register_operand" "")
17357 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
17358 (set (reg FLAGS_REG)
17359 (compare (match_dup 7) (match_dup 8)))
17361 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
17363 (set (reg:CC FLAGS_REG)
17364 (compare:CC (mem:BLK (match_dup 4))
17365 (mem:BLK (match_dup 5))))
17366 (use (match_dup 6))
17367 (use (match_dup 3))
17368 (use (reg:SI DIRFLAG_REG))
17369 (clobber (match_dup 0))
17370 (clobber (match_dup 1))
17371 (clobber (match_dup 2))])]
17374 ;; ...and this one handles cmpstr*_1.
17377 (set (reg:CC FLAGS_REG)
17378 (if_then_else:CC (ne (match_operand 6 "register_operand" "")
17380 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
17381 (mem:BLK (match_operand 5 "register_operand" "")))
17383 (use (match_operand:SI 3 "immediate_operand" ""))
17384 (use (reg:CC FLAGS_REG))
17385 (use (reg:SI DIRFLAG_REG))
17386 (clobber (match_operand 0 "register_operand" ""))
17387 (clobber (match_operand 1 "register_operand" ""))
17388 (clobber (match_operand 2 "register_operand" ""))])
17389 (set (match_operand:QI 7 "register_operand" "")
17390 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
17391 (set (match_operand:QI 8 "register_operand" "")
17392 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
17393 (set (reg FLAGS_REG)
17394 (compare (match_dup 7) (match_dup 8)))
17396 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
17398 (set (reg:CC FLAGS_REG)
17399 (if_then_else:CC (ne (match_dup 6)
17401 (compare:CC (mem:BLK (match_dup 4))
17402 (mem:BLK (match_dup 5)))
17404 (use (match_dup 3))
17405 (use (reg:CC FLAGS_REG))
17406 (use (reg:SI DIRFLAG_REG))
17407 (clobber (match_dup 0))
17408 (clobber (match_dup 1))
17409 (clobber (match_dup 2))])]
17414 ;; Conditional move instructions.
17416 (define_expand "movdicc"
17417 [(set (match_operand:DI 0 "register_operand" "")
17418 (if_then_else:DI (match_operand 1 "comparison_operator" "")
17419 (match_operand:DI 2 "general_operand" "")
17420 (match_operand:DI 3 "general_operand" "")))]
17422 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17424 (define_insn "x86_movdicc_0_m1_rex64"
17425 [(set (match_operand:DI 0 "register_operand" "=r")
17426 (if_then_else:DI (match_operand 1 "ix86_carry_flag_operator" "")
17429 (clobber (reg:CC FLAGS_REG))]
17432 ; Since we don't have the proper number of operands for an alu insn,
17433 ; fill in all the blanks.
17434 [(set_attr "type" "alu")
17435 (set_attr "pent_pair" "pu")
17436 (set_attr "memory" "none")
17437 (set_attr "imm_disp" "false")
17438 (set_attr "mode" "DI")
17439 (set_attr "length_immediate" "0")])
17441 (define_insn "movdicc_c_rex64"
17442 [(set (match_operand:DI 0 "register_operand" "=r,r")
17443 (if_then_else:DI (match_operator 1 "ix86_comparison_operator"
17444 [(reg FLAGS_REG) (const_int 0)])
17445 (match_operand:DI 2 "nonimmediate_operand" "rm,0")
17446 (match_operand:DI 3 "nonimmediate_operand" "0,rm")))]
17447 "TARGET_64BIT && TARGET_CMOVE
17448 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17450 cmov%O2%C1\t{%2, %0|%0, %2}
17451 cmov%O2%c1\t{%3, %0|%0, %3}"
17452 [(set_attr "type" "icmov")
17453 (set_attr "mode" "DI")])
17455 (define_expand "movsicc"
17456 [(set (match_operand:SI 0 "register_operand" "")
17457 (if_then_else:SI (match_operand 1 "comparison_operator" "")
17458 (match_operand:SI 2 "general_operand" "")
17459 (match_operand:SI 3 "general_operand" "")))]
17461 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17463 ;; Data flow gets confused by our desire for `sbbl reg,reg', and clearing
17464 ;; the register first winds up with `sbbl $0,reg', which is also weird.
17465 ;; So just document what we're doing explicitly.
17467 (define_insn "x86_movsicc_0_m1"
17468 [(set (match_operand:SI 0 "register_operand" "=r")
17469 (if_then_else:SI (match_operand 1 "ix86_carry_flag_operator" "")
17472 (clobber (reg:CC FLAGS_REG))]
17475 ; Since we don't have the proper number of operands for an alu insn,
17476 ; fill in all the blanks.
17477 [(set_attr "type" "alu")
17478 (set_attr "pent_pair" "pu")
17479 (set_attr "memory" "none")
17480 (set_attr "imm_disp" "false")
17481 (set_attr "mode" "SI")
17482 (set_attr "length_immediate" "0")])
17484 (define_insn "*movsicc_noc"
17485 [(set (match_operand:SI 0 "register_operand" "=r,r")
17486 (if_then_else:SI (match_operator 1 "ix86_comparison_operator"
17487 [(reg FLAGS_REG) (const_int 0)])
17488 (match_operand:SI 2 "nonimmediate_operand" "rm,0")
17489 (match_operand:SI 3 "nonimmediate_operand" "0,rm")))]
17491 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17493 cmov%O2%C1\t{%2, %0|%0, %2}
17494 cmov%O2%c1\t{%3, %0|%0, %3}"
17495 [(set_attr "type" "icmov")
17496 (set_attr "mode" "SI")])
17498 (define_expand "movhicc"
17499 [(set (match_operand:HI 0 "register_operand" "")
17500 (if_then_else:HI (match_operand 1 "comparison_operator" "")
17501 (match_operand:HI 2 "general_operand" "")
17502 (match_operand:HI 3 "general_operand" "")))]
17503 "TARGET_HIMODE_MATH"
17504 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17506 (define_insn "*movhicc_noc"
17507 [(set (match_operand:HI 0 "register_operand" "=r,r")
17508 (if_then_else:HI (match_operator 1 "ix86_comparison_operator"
17509 [(reg FLAGS_REG) (const_int 0)])
17510 (match_operand:HI 2 "nonimmediate_operand" "rm,0")
17511 (match_operand:HI 3 "nonimmediate_operand" "0,rm")))]
17513 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17515 cmov%O2%C1\t{%2, %0|%0, %2}
17516 cmov%O2%c1\t{%3, %0|%0, %3}"
17517 [(set_attr "type" "icmov")
17518 (set_attr "mode" "HI")])
17520 (define_expand "movqicc"
17521 [(set (match_operand:QI 0 "register_operand" "")
17522 (if_then_else:QI (match_operand 1 "comparison_operator" "")
17523 (match_operand:QI 2 "general_operand" "")
17524 (match_operand:QI 3 "general_operand" "")))]
17525 "TARGET_QIMODE_MATH"
17526 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17528 (define_insn_and_split "*movqicc_noc"
17529 [(set (match_operand:QI 0 "register_operand" "=r,r")
17530 (if_then_else:QI (match_operator 1 "ix86_comparison_operator"
17531 [(match_operand 4 "flags_reg_operand" "") (const_int 0)])
17532 (match_operand:QI 2 "register_operand" "r,0")
17533 (match_operand:QI 3 "register_operand" "0,r")))]
17534 "TARGET_CMOVE && !TARGET_PARTIAL_REG_STALL"
17536 "&& reload_completed"
17537 [(set (match_dup 0)
17538 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
17541 "operands[0] = gen_lowpart (SImode, operands[0]);
17542 operands[2] = gen_lowpart (SImode, operands[2]);
17543 operands[3] = gen_lowpart (SImode, operands[3]);"
17544 [(set_attr "type" "icmov")
17545 (set_attr "mode" "SI")])
17547 (define_expand "movsfcc"
17548 [(set (match_operand:SF 0 "register_operand" "")
17549 (if_then_else:SF (match_operand 1 "comparison_operator" "")
17550 (match_operand:SF 2 "register_operand" "")
17551 (match_operand:SF 3 "register_operand" "")))]
17553 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
17555 (define_insn "*movsfcc_1"
17556 [(set (match_operand:SF 0 "register_operand" "=f#r,f#r,r#f,r#f")
17557 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
17558 [(reg FLAGS_REG) (const_int 0)])
17559 (match_operand:SF 2 "nonimmediate_operand" "f#r,0,rm#f,0")
17560 (match_operand:SF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))]
17562 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17564 fcmov%F1\t{%2, %0|%0, %2}
17565 fcmov%f1\t{%3, %0|%0, %3}
17566 cmov%O2%C1\t{%2, %0|%0, %2}
17567 cmov%O2%c1\t{%3, %0|%0, %3}"
17568 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
17569 (set_attr "mode" "SF,SF,SI,SI")])
17571 (define_expand "movdfcc"
17572 [(set (match_operand:DF 0 "register_operand" "")
17573 (if_then_else:DF (match_operand 1 "comparison_operator" "")
17574 (match_operand:DF 2 "register_operand" "")
17575 (match_operand:DF 3 "register_operand" "")))]
17577 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
17579 (define_insn "*movdfcc_1"
17580 [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,&r#f,&r#f")
17581 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17582 [(reg FLAGS_REG) (const_int 0)])
17583 (match_operand:DF 2 "nonimmediate_operand" "f#r,0,rm#f,0")
17584 (match_operand:DF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))]
17585 "!TARGET_64BIT && TARGET_CMOVE
17586 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17588 fcmov%F1\t{%2, %0|%0, %2}
17589 fcmov%f1\t{%3, %0|%0, %3}
17592 [(set_attr "type" "fcmov,fcmov,multi,multi")
17593 (set_attr "mode" "DF")])
17595 (define_insn "*movdfcc_1_rex64"
17596 [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,r#f,r#f")
17597 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17598 [(reg FLAGS_REG) (const_int 0)])
17599 (match_operand:DF 2 "nonimmediate_operand" "f#r,0#r,rm#f,0#f")
17600 (match_operand:DF 3 "nonimmediate_operand" "0#r,f#r,0#f,rm#f")))]
17601 "TARGET_64BIT && TARGET_CMOVE
17602 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17604 fcmov%F1\t{%2, %0|%0, %2}
17605 fcmov%f1\t{%3, %0|%0, %3}
17606 cmov%O2%C1\t{%2, %0|%0, %2}
17607 cmov%O2%c1\t{%3, %0|%0, %3}"
17608 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
17609 (set_attr "mode" "DF")])
17612 [(set (match_operand:DF 0 "register_and_not_any_fp_reg_operand" "")
17613 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17614 [(match_operand 4 "flags_reg_operand" "") (const_int 0)])
17615 (match_operand:DF 2 "nonimmediate_operand" "")
17616 (match_operand:DF 3 "nonimmediate_operand" "")))]
17617 "!TARGET_64BIT && reload_completed"
17618 [(set (match_dup 2)
17619 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
17623 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
17626 "split_di (operands+2, 1, operands+5, operands+6);
17627 split_di (operands+3, 1, operands+7, operands+8);
17628 split_di (operands, 1, operands+2, operands+3);")
17630 (define_expand "movxfcc"
17631 [(set (match_operand:XF 0 "register_operand" "")
17632 (if_then_else:XF (match_operand 1 "comparison_operator" "")
17633 (match_operand:XF 2 "register_operand" "")
17634 (match_operand:XF 3 "register_operand" "")))]
17636 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
17638 (define_insn "*movxfcc_1"
17639 [(set (match_operand:XF 0 "register_operand" "=f,f")
17640 (if_then_else:XF (match_operator 1 "fcmov_comparison_operator"
17641 [(reg FLAGS_REG) (const_int 0)])
17642 (match_operand:XF 2 "register_operand" "f,0")
17643 (match_operand:XF 3 "register_operand" "0,f")))]
17646 fcmov%F1\t{%2, %0|%0, %2}
17647 fcmov%f1\t{%3, %0|%0, %3}"
17648 [(set_attr "type" "fcmov")
17649 (set_attr "mode" "XF")])
17651 (define_expand "minsf3"
17653 (set (match_operand:SF 0 "register_operand" "")
17654 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
17655 (match_operand:SF 2 "nonimmediate_operand" ""))
17658 (clobber (reg:CC FLAGS_REG))])]
17662 (define_insn "*minsf"
17663 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
17664 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0,0,f#x")
17665 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
17668 (clobber (reg:CC FLAGS_REG))]
17669 "TARGET_SSE && TARGET_IEEE_FP"
17672 (define_insn "*minsf_nonieee"
17673 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
17674 (if_then_else:SF (lt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
17675 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
17678 (clobber (reg:CC FLAGS_REG))]
17679 "TARGET_SSE && !TARGET_IEEE_FP
17680 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17684 [(set (match_operand:SF 0 "register_operand" "")
17685 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
17686 (match_operand:SF 2 "nonimmediate_operand" ""))
17687 (match_operand:SF 3 "register_operand" "")
17688 (match_operand:SF 4 "nonimmediate_operand" "")))
17689 (clobber (reg:CC FLAGS_REG))]
17690 "SSE_REG_P (operands[0]) && reload_completed
17691 && ((operands_match_p (operands[1], operands[3])
17692 && operands_match_p (operands[2], operands[4]))
17693 || (operands_match_p (operands[1], operands[4])
17694 && operands_match_p (operands[2], operands[3])))"
17695 [(set (match_dup 0)
17696 (if_then_else:SF (lt (match_dup 1)
17701 ;; Conditional addition patterns
17702 (define_expand "addqicc"
17703 [(match_operand:QI 0 "register_operand" "")
17704 (match_operand 1 "comparison_operator" "")
17705 (match_operand:QI 2 "register_operand" "")
17706 (match_operand:QI 3 "const_int_operand" "")]
17708 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17710 (define_expand "addhicc"
17711 [(match_operand:HI 0 "register_operand" "")
17712 (match_operand 1 "comparison_operator" "")
17713 (match_operand:HI 2 "register_operand" "")
17714 (match_operand:HI 3 "const_int_operand" "")]
17716 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17718 (define_expand "addsicc"
17719 [(match_operand:SI 0 "register_operand" "")
17720 (match_operand 1 "comparison_operator" "")
17721 (match_operand:SI 2 "register_operand" "")
17722 (match_operand:SI 3 "const_int_operand" "")]
17724 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17726 (define_expand "adddicc"
17727 [(match_operand:DI 0 "register_operand" "")
17728 (match_operand 1 "comparison_operator" "")
17729 (match_operand:DI 2 "register_operand" "")
17730 (match_operand:DI 3 "const_int_operand" "")]
17732 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17734 ;; We can't represent the LT test directly. Do this by swapping the operands.
17737 [(set (match_operand:SF 0 "fp_register_operand" "")
17738 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
17739 (match_operand:SF 2 "register_operand" ""))
17740 (match_operand:SF 3 "register_operand" "")
17741 (match_operand:SF 4 "register_operand" "")))
17742 (clobber (reg:CC FLAGS_REG))]
17744 && ((operands_match_p (operands[1], operands[3])
17745 && operands_match_p (operands[2], operands[4]))
17746 || (operands_match_p (operands[1], operands[4])
17747 && operands_match_p (operands[2], operands[3])))"
17748 [(set (reg:CCFP FLAGS_REG)
17749 (compare:CCFP (match_dup 2)
17752 (if_then_else:SF (ge (reg:CCFP FLAGS_REG) (const_int 0))
17756 (define_insn "*minsf_sse"
17757 [(set (match_operand:SF 0 "register_operand" "=x")
17758 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0")
17759 (match_operand:SF 2 "nonimmediate_operand" "xm"))
17762 "TARGET_SSE && reload_completed"
17763 "minss\t{%2, %0|%0, %2}"
17764 [(set_attr "type" "sse")
17765 (set_attr "mode" "SF")])
17767 (define_expand "mindf3"
17769 (set (match_operand:DF 0 "register_operand" "")
17770 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
17771 (match_operand:DF 2 "nonimmediate_operand" ""))
17774 (clobber (reg:CC FLAGS_REG))])]
17775 "TARGET_SSE2 && TARGET_SSE_MATH"
17778 (define_insn "*mindf"
17779 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
17780 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0,0,f#Y")
17781 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
17784 (clobber (reg:CC FLAGS_REG))]
17785 "TARGET_SSE2 && TARGET_IEEE_FP && TARGET_SSE_MATH"
17788 (define_insn "*mindf_nonieee"
17789 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
17790 (if_then_else:DF (lt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
17791 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
17794 (clobber (reg:CC FLAGS_REG))]
17795 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
17796 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17800 [(set (match_operand:DF 0 "register_operand" "")
17801 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
17802 (match_operand:DF 2 "nonimmediate_operand" ""))
17803 (match_operand:DF 3 "register_operand" "")
17804 (match_operand:DF 4 "nonimmediate_operand" "")))
17805 (clobber (reg:CC FLAGS_REG))]
17806 "SSE_REG_P (operands[0]) && reload_completed
17807 && ((operands_match_p (operands[1], operands[3])
17808 && operands_match_p (operands[2], operands[4]))
17809 || (operands_match_p (operands[1], operands[4])
17810 && operands_match_p (operands[2], operands[3])))"
17811 [(set (match_dup 0)
17812 (if_then_else:DF (lt (match_dup 1)
17817 ;; We can't represent the LT test directly. Do this by swapping the operands.
17819 [(set (match_operand:DF 0 "fp_register_operand" "")
17820 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
17821 (match_operand:DF 2 "register_operand" ""))
17822 (match_operand:DF 3 "register_operand" "")
17823 (match_operand:DF 4 "register_operand" "")))
17824 (clobber (reg:CC FLAGS_REG))]
17826 && ((operands_match_p (operands[1], operands[3])
17827 && operands_match_p (operands[2], operands[4]))
17828 || (operands_match_p (operands[1], operands[4])
17829 && operands_match_p (operands[2], operands[3])))"
17830 [(set (reg:CCFP FLAGS_REG)
17831 (compare:CCFP (match_dup 2)
17834 (if_then_else:DF (ge (reg:CCFP FLAGS_REG) (const_int 0))
17838 (define_insn "*mindf_sse"
17839 [(set (match_operand:DF 0 "register_operand" "=Y")
17840 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0")
17841 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
17844 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
17845 "minsd\t{%2, %0|%0, %2}"
17846 [(set_attr "type" "sse")
17847 (set_attr "mode" "DF")])
17849 (define_expand "maxsf3"
17851 (set (match_operand:SF 0 "register_operand" "")
17852 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
17853 (match_operand:SF 2 "nonimmediate_operand" ""))
17856 (clobber (reg:CC FLAGS_REG))])]
17860 (define_insn "*maxsf"
17861 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
17862 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0,0,f#x")
17863 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
17866 (clobber (reg:CC FLAGS_REG))]
17867 "TARGET_SSE && TARGET_IEEE_FP"
17870 (define_insn "*maxsf_nonieee"
17871 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
17872 (if_then_else:SF (gt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
17873 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
17876 (clobber (reg:CC FLAGS_REG))]
17877 "TARGET_SSE && !TARGET_IEEE_FP
17878 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17882 [(set (match_operand:SF 0 "register_operand" "")
17883 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
17884 (match_operand:SF 2 "nonimmediate_operand" ""))
17885 (match_operand:SF 3 "register_operand" "")
17886 (match_operand:SF 4 "nonimmediate_operand" "")))
17887 (clobber (reg:CC FLAGS_REG))]
17888 "SSE_REG_P (operands[0]) && reload_completed
17889 && ((operands_match_p (operands[1], operands[3])
17890 && operands_match_p (operands[2], operands[4]))
17891 || (operands_match_p (operands[1], operands[4])
17892 && operands_match_p (operands[2], operands[3])))"
17893 [(set (match_dup 0)
17894 (if_then_else:SF (gt (match_dup 1)
17900 [(set (match_operand:SF 0 "fp_register_operand" "")
17901 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
17902 (match_operand:SF 2 "register_operand" ""))
17903 (match_operand:SF 3 "register_operand" "")
17904 (match_operand:SF 4 "register_operand" "")))
17905 (clobber (reg:CC FLAGS_REG))]
17907 && ((operands_match_p (operands[1], operands[3])
17908 && operands_match_p (operands[2], operands[4]))
17909 || (operands_match_p (operands[1], operands[4])
17910 && operands_match_p (operands[2], operands[3])))"
17911 [(set (reg:CCFP FLAGS_REG)
17912 (compare:CCFP (match_dup 1)
17915 (if_then_else:SF (gt (reg:CCFP FLAGS_REG) (const_int 0))
17919 (define_insn "*maxsf_sse"
17920 [(set (match_operand:SF 0 "register_operand" "=x")
17921 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0")
17922 (match_operand:SF 2 "nonimmediate_operand" "xm"))
17925 "TARGET_SSE && reload_completed"
17926 "maxss\t{%2, %0|%0, %2}"
17927 [(set_attr "type" "sse")
17928 (set_attr "mode" "SF")])
17930 (define_expand "maxdf3"
17932 (set (match_operand:DF 0 "register_operand" "")
17933 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17934 (match_operand:DF 2 "nonimmediate_operand" ""))
17937 (clobber (reg:CC FLAGS_REG))])]
17938 "TARGET_SSE2 && TARGET_SSE_MATH"
17941 (define_insn "*maxdf"
17942 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
17943 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0,0,f#Y")
17944 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
17947 (clobber (reg:CC FLAGS_REG))]
17948 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_IEEE_FP"
17951 (define_insn "*maxdf_nonieee"
17952 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
17953 (if_then_else:DF (gt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
17954 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
17957 (clobber (reg:CC FLAGS_REG))]
17958 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
17959 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17963 [(set (match_operand:DF 0 "register_operand" "")
17964 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17965 (match_operand:DF 2 "nonimmediate_operand" ""))
17966 (match_operand:DF 3 "register_operand" "")
17967 (match_operand:DF 4 "nonimmediate_operand" "")))
17968 (clobber (reg:CC FLAGS_REG))]
17969 "SSE_REG_P (operands[0]) && reload_completed
17970 && ((operands_match_p (operands[1], operands[3])
17971 && operands_match_p (operands[2], operands[4]))
17972 || (operands_match_p (operands[1], operands[4])
17973 && operands_match_p (operands[2], operands[3])))"
17974 [(set (match_dup 0)
17975 (if_then_else:DF (gt (match_dup 1)
17981 [(set (match_operand:DF 0 "fp_register_operand" "")
17982 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17983 (match_operand:DF 2 "register_operand" ""))
17984 (match_operand:DF 3 "register_operand" "")
17985 (match_operand:DF 4 "register_operand" "")))
17986 (clobber (reg:CC FLAGS_REG))]
17988 && ((operands_match_p (operands[1], operands[3])
17989 && operands_match_p (operands[2], operands[4]))
17990 || (operands_match_p (operands[1], operands[4])
17991 && operands_match_p (operands[2], operands[3])))"
17992 [(set (reg:CCFP FLAGS_REG)
17993 (compare:CCFP (match_dup 1)
17996 (if_then_else:DF (gt (reg:CCFP FLAGS_REG) (const_int 0))
18000 (define_insn "*maxdf_sse"
18001 [(set (match_operand:DF 0 "register_operand" "=Y")
18002 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0")
18003 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
18006 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
18007 "maxsd\t{%2, %0|%0, %2}"
18008 [(set_attr "type" "sse")
18009 (set_attr "mode" "DF")])
18011 ;; Misc patterns (?)
18013 ;; This pattern exists to put a dependency on all ebp-based memory accesses.
18014 ;; Otherwise there will be nothing to keep
18016 ;; [(set (reg ebp) (reg esp))]
18017 ;; [(set (reg esp) (plus (reg esp) (const_int -160000)))
18018 ;; (clobber (eflags)]
18019 ;; [(set (mem (plus (reg ebp) (const_int -160000))) (const_int 0))]
18021 ;; in proper program order.
18022 (define_insn "pro_epilogue_adjust_stack_1"
18023 [(set (match_operand:SI 0 "register_operand" "=r,r")
18024 (plus:SI (match_operand:SI 1 "register_operand" "0,r")
18025 (match_operand:SI 2 "immediate_operand" "i,i")))
18026 (clobber (reg:CC FLAGS_REG))
18027 (clobber (mem:BLK (scratch)))]
18030 switch (get_attr_type (insn))
18033 return "mov{l}\t{%1, %0|%0, %1}";
18036 if (GET_CODE (operands[2]) == CONST_INT
18037 && (INTVAL (operands[2]) == 128
18038 || (INTVAL (operands[2]) < 0
18039 && INTVAL (operands[2]) != -128)))
18041 operands[2] = GEN_INT (-INTVAL (operands[2]));
18042 return "sub{l}\t{%2, %0|%0, %2}";
18044 return "add{l}\t{%2, %0|%0, %2}";
18047 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
18048 return "lea{l}\t{%a2, %0|%0, %a2}";
18054 [(set (attr "type")
18055 (cond [(eq_attr "alternative" "0")
18056 (const_string "alu")
18057 (match_operand:SI 2 "const0_operand" "")
18058 (const_string "imov")
18060 (const_string "lea")))
18061 (set_attr "mode" "SI")])
18063 (define_insn "pro_epilogue_adjust_stack_rex64"
18064 [(set (match_operand:DI 0 "register_operand" "=r,r")
18065 (plus:DI (match_operand:DI 1 "register_operand" "0,r")
18066 (match_operand:DI 2 "x86_64_immediate_operand" "e,e")))
18067 (clobber (reg:CC FLAGS_REG))
18068 (clobber (mem:BLK (scratch)))]
18071 switch (get_attr_type (insn))
18074 return "mov{q}\t{%1, %0|%0, %1}";
18077 if (GET_CODE (operands[2]) == CONST_INT
18078 /* Avoid overflows. */
18079 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
18080 && (INTVAL (operands[2]) == 128
18081 || (INTVAL (operands[2]) < 0
18082 && INTVAL (operands[2]) != -128)))
18084 operands[2] = GEN_INT (-INTVAL (operands[2]));
18085 return "sub{q}\t{%2, %0|%0, %2}";
18087 return "add{q}\t{%2, %0|%0, %2}";
18090 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
18091 return "lea{q}\t{%a2, %0|%0, %a2}";
18097 [(set (attr "type")
18098 (cond [(eq_attr "alternative" "0")
18099 (const_string "alu")
18100 (match_operand:DI 2 "const0_operand" "")
18101 (const_string "imov")
18103 (const_string "lea")))
18104 (set_attr "mode" "DI")])
18106 (define_insn "pro_epilogue_adjust_stack_rex64_2"
18107 [(set (match_operand:DI 0 "register_operand" "=r,r")
18108 (plus:DI (match_operand:DI 1 "register_operand" "0,r")
18109 (match_operand:DI 3 "immediate_operand" "i,i")))
18110 (use (match_operand:DI 2 "register_operand" "r,r"))
18111 (clobber (reg:CC FLAGS_REG))
18112 (clobber (mem:BLK (scratch)))]
18115 switch (get_attr_type (insn))
18118 return "add{q}\t{%2, %0|%0, %2}";
18121 operands[2] = gen_rtx_PLUS (DImode, operands[1], operands[2]);
18122 return "lea{q}\t{%a2, %0|%0, %a2}";
18128 [(set_attr "type" "alu,lea")
18129 (set_attr "mode" "DI")])
18131 ;; Placeholder for the conditional moves. This one is split either to SSE
18132 ;; based moves emulation or to usual cmove sequence. Little bit unfortunate
18133 ;; fact is that compares supported by the cmp??ss instructions are exactly
18134 ;; swapped of those supported by cmove sequence.
18135 ;; The EQ/NE comparisons also needs bit care, since they are not directly
18136 ;; supported by i387 comparisons and we do need to emit two conditional moves
18139 (define_insn "sse_movsfcc"
18140 [(set (match_operand:SF 0 "register_operand" "=&x#rf,x#rf,?f#xr,?f#xr,?f#xr,?f#xr,?r#xf,?r#xf,?r#xf,?r#xf")
18141 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
18142 [(match_operand:SF 4 "nonimmediate_operand" "0#fx,x#fx,f#x,f#x,xm#f,xm#f,f#x,f#x,xm#f,xm#f")
18143 (match_operand:SF 5 "nonimmediate_operand" "xm#f,xm#f,f#x,f#x,x#f,x#f,f#x,f#x,x#f,x#f")])
18144 (match_operand:SF 2 "nonimmediate_operand" "x#fr,0#fr,f#fx,0#fx,f#fx,0#fx,rm#rx,0#rx,rm#rx,0#rx")
18145 (match_operand:SF 3 "nonimmediate_operand" "x#fr,x#fr,0#fx,f#fx,0#fx,f#fx,0#fx,rm#rx,0#rx,rm#rx")))
18146 (clobber (match_scratch:SF 6 "=2,&4,X,X,X,X,X,X,X,X"))
18147 (clobber (reg:CC FLAGS_REG))]
18149 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
18150 /* Avoid combine from being smart and converting min/max
18151 instruction patterns into conditional moves. */
18152 && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT
18153 && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE)
18154 || !rtx_equal_p (operands[4], operands[2])
18155 || !rtx_equal_p (operands[5], operands[3]))
18156 && (!TARGET_IEEE_FP
18157 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
18160 (define_insn "sse_movsfcc_eq"
18161 [(set (match_operand:SF 0 "register_operand" "=&x#rf,x#rf,?f#xr,?f#xr,?r#xf,?r#xf")
18162 (if_then_else:SF (eq (match_operand:SF 3 "nonimmediate_operand" "%0#fx,x#fx,f#x,xm#f,f#x,xm#f")
18163 (match_operand:SF 4 "nonimmediate_operand" "xm#f,xm#f,f#x,x#f,f#x,x#f"))
18164 (match_operand:SF 1 "nonimmediate_operand" "x#fr,0#fr,0#fx,0#fx,0#rx,0#rx")
18165 (match_operand:SF 2 "nonimmediate_operand" "x#fr,x#fr,f#fx,f#fx,rm#rx,rm#rx")))
18166 (clobber (match_scratch:SF 5 "=1,&3,X,X,X,X"))
18167 (clobber (reg:CC FLAGS_REG))]
18169 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
18172 (define_insn "sse_movdfcc"
18173 [(set (match_operand:DF 0 "register_operand" "=&Y#rf,Y#rf,?f#Yr,?f#Yr,?f#Yr,?f#Yr,?r#Yf,?r#Yf,?r#Yf,?r#Yf")
18174 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
18175 [(match_operand:DF 4 "nonimmediate_operand" "0#fY,Y#fY,f#Y,f#Y,Ym#f,Ym#f,f#Y,f#Y,Ym#f,Ym#f")
18176 (match_operand:DF 5 "nonimmediate_operand" "Ym#f,Ym#f,f#Y,f#Y,Y#f,Y#f,f#Y,f#Y,Y#f,Y#f")])
18177 (match_operand:DF 2 "nonimmediate_operand" "Y#fr,0#fr,f#fY,0#fY,f#fY,0#fY,rm#rY,0#rY,rm#rY,0#rY")
18178 (match_operand:DF 3 "nonimmediate_operand" "Y#fr,Y#fr,0#fY,f#fY,0#fY,f#fY,0#fY,rm#rY,0#rY,rm#rY")))
18179 (clobber (match_scratch:DF 6 "=2,&4,X,X,X,X,X,X,X,X"))
18180 (clobber (reg:CC FLAGS_REG))]
18182 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
18183 /* Avoid combine from being smart and converting min/max
18184 instruction patterns into conditional moves. */
18185 && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT
18186 && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE)
18187 || !rtx_equal_p (operands[4], operands[2])
18188 || !rtx_equal_p (operands[5], operands[3]))
18189 && (!TARGET_IEEE_FP
18190 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
18193 (define_insn "sse_movdfcc_eq"
18194 [(set (match_operand:DF 0 "register_operand" "=&Y#rf,Y#rf,?f#Yr,?f#Yr,?r#Yf,?r#Yf")
18195 (if_then_else:DF (eq (match_operand:DF 3 "nonimmediate_operand" "%0#fY,Y#fY,f#Y,Ym#f,f#Y,Ym#f")
18196 (match_operand:DF 4 "nonimmediate_operand" "Ym#f,Ym#f,f#Y,Y#f,f#Y,Y#f"))
18197 (match_operand:DF 1 "nonimmediate_operand" "Y#fr,0#fr,0#fY,0#fY,0#rY,0#rY")
18198 (match_operand:DF 2 "nonimmediate_operand" "Y#fr,Y#fr,f#fY,f#fY,rm#rY,rm#rY")))
18199 (clobber (match_scratch:DF 5 "=1,&3,X,X,X,X"))
18200 (clobber (reg:CC FLAGS_REG))]
18202 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
18205 ;; For non-sse moves just expand the usual cmove sequence.
18207 [(set (match_operand 0 "register_operand" "")
18208 (if_then_else (match_operator 1 "comparison_operator"
18209 [(match_operand 4 "nonimmediate_operand" "")
18210 (match_operand 5 "register_operand" "")])
18211 (match_operand 2 "nonimmediate_operand" "")
18212 (match_operand 3 "nonimmediate_operand" "")))
18213 (clobber (match_operand 6 "" ""))
18214 (clobber (reg:CC FLAGS_REG))]
18215 "!SSE_REG_P (operands[0]) && reload_completed
18216 && (GET_MODE (operands[0]) == SFmode
18217 || (TARGET_SSE2 && GET_MODE (operands[0]) == DFmode))"
18220 ix86_compare_op0 = operands[5];
18221 ix86_compare_op1 = operands[4];
18222 operands[1] = gen_rtx_fmt_ee (swap_condition (GET_CODE (operands[1])),
18223 VOIDmode, operands[5], operands[4]);
18224 ix86_expand_fp_movcc (operands);
18228 ;; Split SSE based conditional move into sequence:
18229 ;; cmpCC op0, op4 - set op0 to 0 or ffffffff depending on the comparison
18230 ;; and op2, op0 - zero op2 if comparison was false
18231 ;; nand op0, op3 - load op3 to op0 if comparison was false
18232 ;; or op2, op0 - get the nonzero one into the result.
18234 [(set (match_operand:SF 0 "register_operand" "")
18235 (if_then_else:SF (match_operator:SF 1 "sse_comparison_operator"
18236 [(match_operand:SF 4 "register_operand" "")
18237 (match_operand:SF 5 "nonimmediate_operand" "")])
18238 (match_operand:SF 2 "register_operand" "")
18239 (match_operand:SF 3 "register_operand" "")))
18240 (clobber (match_operand 6 "" ""))
18241 (clobber (reg:CC FLAGS_REG))]
18242 "SSE_REG_P (operands[0]) && reload_completed"
18243 [(set (match_dup 4) (match_op_dup 1 [(match_dup 4) (match_dup 5)]))
18244 (set (match_dup 2) (and:V4SF (match_dup 2)
18246 (set (match_dup 8) (and:V4SF (not:V4SF (match_dup 8))
18248 (set (match_dup 0) (ior:V4SF (match_dup 6)
18251 /* If op2 == op3, op3 would be clobbered before it is used. */
18252 if (operands_match_p (operands[2], operands[3]))
18254 emit_move_insn (operands[0], operands[2]);
18258 PUT_MODE (operands[1], GET_MODE (operands[0]));
18259 if (operands_match_p (operands[0], operands[4]))
18260 operands[6] = operands[4], operands[7] = operands[2];
18262 operands[6] = operands[2], operands[7] = operands[4];
18263 operands[0] = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
18264 operands[2] = simplify_gen_subreg (V4SFmode, operands[2], SFmode, 0);
18265 operands[3] = simplify_gen_subreg (V4SFmode, operands[3], SFmode, 0);
18266 operands[8] = simplify_gen_subreg (V4SFmode, operands[4], SFmode, 0);
18267 operands[6] = simplify_gen_subreg (V4SFmode, operands[6], SFmode, 0);
18268 operands[7] = simplify_gen_subreg (V4SFmode, operands[7], SFmode, 0);
18272 [(set (match_operand:DF 0 "register_operand" "")
18273 (if_then_else:DF (match_operator:DF 1 "sse_comparison_operator"
18274 [(match_operand:DF 4 "register_operand" "")
18275 (match_operand:DF 5 "nonimmediate_operand" "")])
18276 (match_operand:DF 2 "register_operand" "")
18277 (match_operand:DF 3 "register_operand" "")))
18278 (clobber (match_operand 6 "" ""))
18279 (clobber (reg:CC FLAGS_REG))]
18280 "SSE_REG_P (operands[0]) && reload_completed"
18281 [(set (match_dup 4) (match_op_dup 1 [(match_dup 4) (match_dup 5)]))
18282 (set (match_dup 2) (and:V2DF (match_dup 2)
18284 (set (match_dup 8) (and:V2DF (not:V2DF (match_dup 8))
18286 (set (match_dup 0) (ior:V2DF (match_dup 6)
18289 if (GET_MODE (operands[2]) == DFmode
18290 && TARGET_SSE_PARTIAL_REGS && !optimize_size)
18292 rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
18293 emit_insn (gen_sse2_unpcklpd (op, op, op));
18294 op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
18295 emit_insn (gen_sse2_unpcklpd (op, op, op));
18298 /* If op2 == op3, op3 would be clobbered before it is used. */
18299 if (operands_match_p (operands[2], operands[3]))
18301 emit_move_insn (operands[0], operands[2]);
18305 PUT_MODE (operands[1], GET_MODE (operands[0]));
18306 if (operands_match_p (operands[0], operands[4]))
18307 operands[6] = operands[4], operands[7] = operands[2];
18309 operands[6] = operands[2], operands[7] = operands[4];
18310 operands[0] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
18311 operands[2] = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
18312 operands[3] = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
18313 operands[8] = simplify_gen_subreg (V2DFmode, operands[4], DFmode, 0);
18314 operands[6] = simplify_gen_subreg (V2DFmode, operands[6], DFmode, 0);
18315 operands[7] = simplify_gen_subreg (V2DFmode, operands[7], DFmode, 0);
18318 ;; Special case of conditional move we can handle effectively.
18319 ;; Do not brother with the integer/floating point case, since these are
18320 ;; bot considerably slower, unlike in the generic case.
18321 (define_insn "*sse_movsfcc_const0_1"
18322 [(set (match_operand:SF 0 "register_operand" "=&x")
18323 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
18324 [(match_operand:SF 4 "register_operand" "0")
18325 (match_operand:SF 5 "nonimmediate_operand" "xm")])
18326 (match_operand:SF 2 "register_operand" "x")
18327 (match_operand:SF 3 "const0_operand" "X")))]
18331 (define_insn "*sse_movsfcc_const0_2"
18332 [(set (match_operand:SF 0 "register_operand" "=&x")
18333 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
18334 [(match_operand:SF 4 "register_operand" "0")
18335 (match_operand:SF 5 "nonimmediate_operand" "xm")])
18336 (match_operand:SF 2 "const0_operand" "X")
18337 (match_operand:SF 3 "register_operand" "x")))]
18341 (define_insn "*sse_movsfcc_const0_3"
18342 [(set (match_operand:SF 0 "register_operand" "=&x")
18343 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
18344 [(match_operand:SF 4 "nonimmediate_operand" "xm")
18345 (match_operand:SF 5 "register_operand" "0")])
18346 (match_operand:SF 2 "register_operand" "x")
18347 (match_operand:SF 3 "const0_operand" "X")))]
18351 (define_insn "*sse_movsfcc_const0_4"
18352 [(set (match_operand:SF 0 "register_operand" "=&x")
18353 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
18354 [(match_operand:SF 4 "nonimmediate_operand" "xm")
18355 (match_operand:SF 5 "register_operand" "0")])
18356 (match_operand:SF 2 "const0_operand" "X")
18357 (match_operand:SF 3 "register_operand" "x")))]
18361 (define_insn "*sse_movdfcc_const0_1"
18362 [(set (match_operand:DF 0 "register_operand" "=&Y")
18363 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
18364 [(match_operand:DF 4 "register_operand" "0")
18365 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
18366 (match_operand:DF 2 "register_operand" "Y")
18367 (match_operand:DF 3 "const0_operand" "X")))]
18371 (define_insn "*sse_movdfcc_const0_2"
18372 [(set (match_operand:DF 0 "register_operand" "=&Y")
18373 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
18374 [(match_operand:DF 4 "register_operand" "0")
18375 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
18376 (match_operand:DF 2 "const0_operand" "X")
18377 (match_operand:DF 3 "register_operand" "Y")))]
18381 (define_insn "*sse_movdfcc_const0_3"
18382 [(set (match_operand:DF 0 "register_operand" "=&Y")
18383 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
18384 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
18385 (match_operand:DF 5 "register_operand" "0")])
18386 (match_operand:DF 2 "register_operand" "Y")
18387 (match_operand:DF 3 "const0_operand" "X")))]
18391 (define_insn "*sse_movdfcc_const0_4"
18392 [(set (match_operand:DF 0 "register_operand" "=&Y")
18393 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
18394 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
18395 (match_operand:DF 5 "register_operand" "0")])
18396 (match_operand:DF 2 "const0_operand" "X")
18397 (match_operand:DF 3 "register_operand" "Y")))]
18402 [(set (match_operand:SF 0 "register_operand" "")
18403 (if_then_else:SF (match_operator 1 "comparison_operator"
18404 [(match_operand:SF 4 "nonimmediate_operand" "")
18405 (match_operand:SF 5 "nonimmediate_operand" "")])
18406 (match_operand:SF 2 "nonmemory_operand" "")
18407 (match_operand:SF 3 "nonmemory_operand" "")))]
18408 "SSE_REG_P (operands[0]) && reload_completed
18409 && (const0_operand (operands[2], GET_MODE (operands[0]))
18410 || const0_operand (operands[3], GET_MODE (operands[0])))"
18411 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)]))
18412 (set (match_dup 8) (and:V4SF (match_dup 6) (match_dup 7)))]
18414 PUT_MODE (operands[1], GET_MODE (operands[0]));
18415 if (!sse_comparison_operator (operands[1], VOIDmode)
18416 || !rtx_equal_p (operands[0], operands[4]))
18418 rtx tmp = operands[5];
18419 operands[5] = operands[4];
18421 PUT_CODE (operands[1], swap_condition (GET_CODE (operands[1])));
18423 if (!rtx_equal_p (operands[0], operands[4]))
18425 operands[8] = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
18426 if (const0_operand (operands[2], GET_MODE (operands[2])))
18428 operands[7] = operands[3];
18429 operands[6] = gen_rtx_NOT (V4SFmode, operands[8]);
18433 operands[7] = operands[2];
18434 operands[6] = operands[8];
18436 operands[7] = simplify_gen_subreg (V4SFmode, operands[7], SFmode, 0);
18440 [(set (match_operand:DF 0 "register_operand" "")
18441 (if_then_else:DF (match_operator 1 "comparison_operator"
18442 [(match_operand:DF 4 "nonimmediate_operand" "")
18443 (match_operand:DF 5 "nonimmediate_operand" "")])
18444 (match_operand:DF 2 "nonmemory_operand" "")
18445 (match_operand:DF 3 "nonmemory_operand" "")))]
18446 "SSE_REG_P (operands[0]) && reload_completed
18447 && (const0_operand (operands[2], GET_MODE (operands[0]))
18448 || const0_operand (operands[3], GET_MODE (operands[0])))"
18449 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)]))
18450 (set (match_dup 8) (and:V2DF (match_dup 6) (match_dup 7)))]
18452 if (TARGET_SSE_PARTIAL_REGS && !optimize_size
18453 && GET_MODE (operands[2]) == DFmode)
18455 if (REG_P (operands[2]))
18457 rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
18458 emit_insn (gen_sse2_unpcklpd (op, op, op));
18460 if (REG_P (operands[3]))
18462 rtx op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
18463 emit_insn (gen_sse2_unpcklpd (op, op, op));
18466 PUT_MODE (operands[1], GET_MODE (operands[0]));
18467 if (!sse_comparison_operator (operands[1], VOIDmode)
18468 || !rtx_equal_p (operands[0], operands[4]))
18470 rtx tmp = operands[5];
18471 operands[5] = operands[4];
18473 PUT_CODE (operands[1], swap_condition (GET_CODE (operands[1])));
18475 if (!rtx_equal_p (operands[0], operands[4]))
18477 operands[8] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
18478 if (const0_operand (operands[2], GET_MODE (operands[2])))
18480 operands[7] = operands[3];
18481 operands[6] = gen_rtx_NOT (V2DFmode, operands[8]);
18485 operands[7] = operands[2];
18486 operands[6] = operands[8];
18488 operands[7] = simplify_gen_subreg (V2DFmode, operands[7], DFmode, 0);
18491 (define_expand "allocate_stack_worker"
18492 [(match_operand:SI 0 "register_operand" "")]
18493 "TARGET_STACK_PROBE"
18495 if (reload_completed)
18498 emit_insn (gen_allocate_stack_worker_rex64_postreload (operands[0]));
18500 emit_insn (gen_allocate_stack_worker_postreload (operands[0]));
18505 emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
18507 emit_insn (gen_allocate_stack_worker_1 (operands[0]));
18512 (define_insn "allocate_stack_worker_1"
18513 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "a")]
18514 UNSPECV_STACK_PROBE)
18515 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 0)))
18516 (clobber (match_scratch:SI 1 "=0"))
18517 (clobber (reg:CC FLAGS_REG))]
18518 "!TARGET_64BIT && TARGET_STACK_PROBE"
18520 [(set_attr "type" "multi")
18521 (set_attr "length" "5")])
18523 (define_expand "allocate_stack_worker_postreload"
18524 [(parallel [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "a")]
18525 UNSPECV_STACK_PROBE)
18526 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 0)))
18527 (clobber (match_dup 0))
18528 (clobber (reg:CC FLAGS_REG))])]
18532 (define_insn "allocate_stack_worker_rex64"
18533 [(unspec_volatile:DI [(match_operand:DI 0 "register_operand" "a")]
18534 UNSPECV_STACK_PROBE)
18535 (set (reg:DI SP_REG) (minus:DI (reg:DI SP_REG) (match_dup 0)))
18536 (clobber (match_scratch:DI 1 "=0"))
18537 (clobber (reg:CC FLAGS_REG))]
18538 "TARGET_64BIT && TARGET_STACK_PROBE"
18540 [(set_attr "type" "multi")
18541 (set_attr "length" "5")])
18543 (define_expand "allocate_stack_worker_rex64_postreload"
18544 [(parallel [(unspec_volatile:DI [(match_operand:DI 0 "register_operand" "a")]
18545 UNSPECV_STACK_PROBE)
18546 (set (reg:DI SP_REG) (minus:DI (reg:DI SP_REG) (match_dup 0)))
18547 (clobber (match_dup 0))
18548 (clobber (reg:CC FLAGS_REG))])]
18552 (define_expand "allocate_stack"
18553 [(parallel [(set (match_operand:SI 0 "register_operand" "=r")
18554 (minus:SI (reg:SI SP_REG)
18555 (match_operand:SI 1 "general_operand" "")))
18556 (clobber (reg:CC FLAGS_REG))])
18557 (parallel [(set (reg:SI SP_REG)
18558 (minus:SI (reg:SI SP_REG) (match_dup 1)))
18559 (clobber (reg:CC FLAGS_REG))])]
18560 "TARGET_STACK_PROBE"
18562 #ifdef CHECK_STACK_LIMIT
18563 if (GET_CODE (operands[1]) == CONST_INT
18564 && INTVAL (operands[1]) < CHECK_STACK_LIMIT)
18565 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
18569 emit_insn (gen_allocate_stack_worker (copy_to_mode_reg (SImode,
18572 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
18576 (define_expand "builtin_setjmp_receiver"
18577 [(label_ref (match_operand 0 "" ""))]
18578 "!TARGET_64BIT && flag_pic"
18580 emit_insn (gen_set_got (pic_offset_table_rtx));
18584 ;; Avoid redundant prefixes by splitting HImode arithmetic to SImode.
18587 [(set (match_operand 0 "register_operand" "")
18588 (match_operator 3 "promotable_binary_operator"
18589 [(match_operand 1 "register_operand" "")
18590 (match_operand 2 "aligned_operand" "")]))
18591 (clobber (reg:CC FLAGS_REG))]
18592 "! TARGET_PARTIAL_REG_STALL && reload_completed
18593 && ((GET_MODE (operands[0]) == HImode
18594 && ((!optimize_size && !TARGET_FAST_PREFIX)
18595 || GET_CODE (operands[2]) != CONST_INT
18596 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')))
18597 || (GET_MODE (operands[0]) == QImode
18598 && (TARGET_PROMOTE_QImode || optimize_size)))"
18599 [(parallel [(set (match_dup 0)
18600 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
18601 (clobber (reg:CC FLAGS_REG))])]
18602 "operands[0] = gen_lowpart (SImode, operands[0]);
18603 operands[1] = gen_lowpart (SImode, operands[1]);
18604 if (GET_CODE (operands[3]) != ASHIFT)
18605 operands[2] = gen_lowpart (SImode, operands[2]);
18606 PUT_MODE (operands[3], SImode);")
18608 ; Promote the QImode tests, as i386 has encoding of the AND
18609 ; instruction with 32-bit sign-extended immediate and thus the
18610 ; instruction size is unchanged, except in the %eax case for
18611 ; which it is increased by one byte, hence the ! optimize_size.
18613 [(set (match_operand 0 "flags_reg_operand" "")
18614 (match_operator 2 "compare_operator"
18615 [(and (match_operand 3 "aligned_operand" "")
18616 (match_operand 4 "const_int_operand" ""))
18618 (set (match_operand 1 "register_operand" "")
18619 (and (match_dup 3) (match_dup 4)))]
18620 "! TARGET_PARTIAL_REG_STALL && reload_completed
18621 /* Ensure that the operand will remain sign-extended immediate. */
18622 && ix86_match_ccmode (insn, INTVAL (operands[4]) >= 0 ? CCNOmode : CCZmode)
18624 && ((GET_MODE (operands[1]) == HImode && ! TARGET_FAST_PREFIX)
18625 || (GET_MODE (operands[1]) == QImode && TARGET_PROMOTE_QImode))"
18626 [(parallel [(set (match_dup 0)
18627 (match_op_dup 2 [(and:SI (match_dup 3) (match_dup 4))
18630 (and:SI (match_dup 3) (match_dup 4)))])]
18633 = gen_int_mode (INTVAL (operands[4])
18634 & GET_MODE_MASK (GET_MODE (operands[1])), SImode);
18635 operands[1] = gen_lowpart (SImode, operands[1]);
18636 operands[3] = gen_lowpart (SImode, operands[3]);
18639 ; Don't promote the QImode tests, as i386 doesn't have encoding of
18640 ; the TEST instruction with 32-bit sign-extended immediate and thus
18641 ; the instruction size would at least double, which is not what we
18642 ; want even with ! optimize_size.
18644 [(set (match_operand 0 "flags_reg_operand" "")
18645 (match_operator 1 "compare_operator"
18646 [(and (match_operand:HI 2 "aligned_operand" "")
18647 (match_operand:HI 3 "const_int_operand" ""))
18649 "! TARGET_PARTIAL_REG_STALL && reload_completed
18650 /* Ensure that the operand will remain sign-extended immediate. */
18651 && ix86_match_ccmode (insn, INTVAL (operands[3]) >= 0 ? CCNOmode : CCZmode)
18652 && ! TARGET_FAST_PREFIX
18653 && ! optimize_size"
18654 [(set (match_dup 0)
18655 (match_op_dup 1 [(and:SI (match_dup 2) (match_dup 3))
18659 = gen_int_mode (INTVAL (operands[3])
18660 & GET_MODE_MASK (GET_MODE (operands[2])), SImode);
18661 operands[2] = gen_lowpart (SImode, operands[2]);
18665 [(set (match_operand 0 "register_operand" "")
18666 (neg (match_operand 1 "register_operand" "")))
18667 (clobber (reg:CC FLAGS_REG))]
18668 "! TARGET_PARTIAL_REG_STALL && reload_completed
18669 && (GET_MODE (operands[0]) == HImode
18670 || (GET_MODE (operands[0]) == QImode
18671 && (TARGET_PROMOTE_QImode || optimize_size)))"
18672 [(parallel [(set (match_dup 0)
18673 (neg:SI (match_dup 1)))
18674 (clobber (reg:CC FLAGS_REG))])]
18675 "operands[0] = gen_lowpart (SImode, operands[0]);
18676 operands[1] = gen_lowpart (SImode, operands[1]);")
18679 [(set (match_operand 0 "register_operand" "")
18680 (not (match_operand 1 "register_operand" "")))]
18681 "! TARGET_PARTIAL_REG_STALL && reload_completed
18682 && (GET_MODE (operands[0]) == HImode
18683 || (GET_MODE (operands[0]) == QImode
18684 && (TARGET_PROMOTE_QImode || optimize_size)))"
18685 [(set (match_dup 0)
18686 (not:SI (match_dup 1)))]
18687 "operands[0] = gen_lowpart (SImode, operands[0]);
18688 operands[1] = gen_lowpart (SImode, operands[1]);")
18691 [(set (match_operand 0 "register_operand" "")
18692 (if_then_else (match_operator 1 "comparison_operator"
18693 [(reg FLAGS_REG) (const_int 0)])
18694 (match_operand 2 "register_operand" "")
18695 (match_operand 3 "register_operand" "")))]
18696 "! TARGET_PARTIAL_REG_STALL && TARGET_CMOVE
18697 && (GET_MODE (operands[0]) == HImode
18698 || (GET_MODE (operands[0]) == QImode
18699 && (TARGET_PROMOTE_QImode || optimize_size)))"
18700 [(set (match_dup 0)
18701 (if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
18702 "operands[0] = gen_lowpart (SImode, operands[0]);
18703 operands[2] = gen_lowpart (SImode, operands[2]);
18704 operands[3] = gen_lowpart (SImode, operands[3]);")
18707 ;; RTL Peephole optimizations, run before sched2. These primarily look to
18708 ;; transform a complex memory operation into two memory to register operations.
18710 ;; Don't push memory operands
18712 [(set (match_operand:SI 0 "push_operand" "")
18713 (match_operand:SI 1 "memory_operand" ""))
18714 (match_scratch:SI 2 "r")]
18715 "! optimize_size && ! TARGET_PUSH_MEMORY"
18716 [(set (match_dup 2) (match_dup 1))
18717 (set (match_dup 0) (match_dup 2))]
18721 [(set (match_operand:DI 0 "push_operand" "")
18722 (match_operand:DI 1 "memory_operand" ""))
18723 (match_scratch:DI 2 "r")]
18724 "! optimize_size && ! TARGET_PUSH_MEMORY"
18725 [(set (match_dup 2) (match_dup 1))
18726 (set (match_dup 0) (match_dup 2))]
18729 ;; We need to handle SFmode only, because DFmode and XFmode is split to
18732 [(set (match_operand:SF 0 "push_operand" "")
18733 (match_operand:SF 1 "memory_operand" ""))
18734 (match_scratch:SF 2 "r")]
18735 "! optimize_size && ! TARGET_PUSH_MEMORY"
18736 [(set (match_dup 2) (match_dup 1))
18737 (set (match_dup 0) (match_dup 2))]
18741 [(set (match_operand:HI 0 "push_operand" "")
18742 (match_operand:HI 1 "memory_operand" ""))
18743 (match_scratch:HI 2 "r")]
18744 "! optimize_size && ! TARGET_PUSH_MEMORY"
18745 [(set (match_dup 2) (match_dup 1))
18746 (set (match_dup 0) (match_dup 2))]
18750 [(set (match_operand:QI 0 "push_operand" "")
18751 (match_operand:QI 1 "memory_operand" ""))
18752 (match_scratch:QI 2 "q")]
18753 "! optimize_size && ! TARGET_PUSH_MEMORY"
18754 [(set (match_dup 2) (match_dup 1))
18755 (set (match_dup 0) (match_dup 2))]
18758 ;; Don't move an immediate directly to memory when the instruction
18761 [(match_scratch:SI 1 "r")
18762 (set (match_operand:SI 0 "memory_operand" "")
18765 && ! TARGET_USE_MOV0
18766 && TARGET_SPLIT_LONG_MOVES
18767 && get_attr_length (insn) >= ix86_cost->large_insn
18768 && peep2_regno_dead_p (0, FLAGS_REG)"
18769 [(parallel [(set (match_dup 1) (const_int 0))
18770 (clobber (reg:CC FLAGS_REG))])
18771 (set (match_dup 0) (match_dup 1))]
18775 [(match_scratch:HI 1 "r")
18776 (set (match_operand:HI 0 "memory_operand" "")
18779 && ! TARGET_USE_MOV0
18780 && TARGET_SPLIT_LONG_MOVES
18781 && get_attr_length (insn) >= ix86_cost->large_insn
18782 && peep2_regno_dead_p (0, FLAGS_REG)"
18783 [(parallel [(set (match_dup 2) (const_int 0))
18784 (clobber (reg:CC FLAGS_REG))])
18785 (set (match_dup 0) (match_dup 1))]
18786 "operands[2] = gen_lowpart (SImode, operands[1]);")
18789 [(match_scratch:QI 1 "q")
18790 (set (match_operand:QI 0 "memory_operand" "")
18793 && ! TARGET_USE_MOV0
18794 && TARGET_SPLIT_LONG_MOVES
18795 && get_attr_length (insn) >= ix86_cost->large_insn
18796 && peep2_regno_dead_p (0, FLAGS_REG)"
18797 [(parallel [(set (match_dup 2) (const_int 0))
18798 (clobber (reg:CC FLAGS_REG))])
18799 (set (match_dup 0) (match_dup 1))]
18800 "operands[2] = gen_lowpart (SImode, operands[1]);")
18803 [(match_scratch:SI 2 "r")
18804 (set (match_operand:SI 0 "memory_operand" "")
18805 (match_operand:SI 1 "immediate_operand" ""))]
18807 && get_attr_length (insn) >= ix86_cost->large_insn
18808 && TARGET_SPLIT_LONG_MOVES"
18809 [(set (match_dup 2) (match_dup 1))
18810 (set (match_dup 0) (match_dup 2))]
18814 [(match_scratch:HI 2 "r")
18815 (set (match_operand:HI 0 "memory_operand" "")
18816 (match_operand:HI 1 "immediate_operand" ""))]
18817 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
18818 && TARGET_SPLIT_LONG_MOVES"
18819 [(set (match_dup 2) (match_dup 1))
18820 (set (match_dup 0) (match_dup 2))]
18824 [(match_scratch:QI 2 "q")
18825 (set (match_operand:QI 0 "memory_operand" "")
18826 (match_operand:QI 1 "immediate_operand" ""))]
18827 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
18828 && TARGET_SPLIT_LONG_MOVES"
18829 [(set (match_dup 2) (match_dup 1))
18830 (set (match_dup 0) (match_dup 2))]
18833 ;; Don't compare memory with zero, load and use a test instead.
18835 [(set (match_operand 0 "flags_reg_operand" "")
18836 (match_operator 1 "compare_operator"
18837 [(match_operand:SI 2 "memory_operand" "")
18839 (match_scratch:SI 3 "r")]
18840 "ix86_match_ccmode (insn, CCNOmode) && ! optimize_size"
18841 [(set (match_dup 3) (match_dup 2))
18842 (set (match_dup 0) (match_op_dup 1 [(match_dup 3) (const_int 0)]))]
18845 ;; NOT is not pairable on Pentium, while XOR is, but one byte longer.
18846 ;; Don't split NOTs with a displacement operand, because resulting XOR
18847 ;; will not be pairable anyway.
18849 ;; On AMD K6, NOT is vector decoded with memory operand that cannot be
18850 ;; represented using a modRM byte. The XOR replacement is long decoded,
18851 ;; so this split helps here as well.
18853 ;; Note: Can't do this as a regular split because we can't get proper
18854 ;; lifetime information then.
18857 [(set (match_operand:SI 0 "nonimmediate_operand" "")
18858 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
18860 && peep2_regno_dead_p (0, FLAGS_REG)
18861 && ((TARGET_PENTIUM
18862 && (GET_CODE (operands[0]) != MEM
18863 || !memory_displacement_operand (operands[0], SImode)))
18864 || (TARGET_K6 && long_memory_operand (operands[0], SImode)))"
18865 [(parallel [(set (match_dup 0)
18866 (xor:SI (match_dup 1) (const_int -1)))
18867 (clobber (reg:CC FLAGS_REG))])]
18871 [(set (match_operand:HI 0 "nonimmediate_operand" "")
18872 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
18874 && peep2_regno_dead_p (0, FLAGS_REG)
18875 && ((TARGET_PENTIUM
18876 && (GET_CODE (operands[0]) != MEM
18877 || !memory_displacement_operand (operands[0], HImode)))
18878 || (TARGET_K6 && long_memory_operand (operands[0], HImode)))"
18879 [(parallel [(set (match_dup 0)
18880 (xor:HI (match_dup 1) (const_int -1)))
18881 (clobber (reg:CC FLAGS_REG))])]
18885 [(set (match_operand:QI 0 "nonimmediate_operand" "")
18886 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
18888 && peep2_regno_dead_p (0, FLAGS_REG)
18889 && ((TARGET_PENTIUM
18890 && (GET_CODE (operands[0]) != MEM
18891 || !memory_displacement_operand (operands[0], QImode)))
18892 || (TARGET_K6 && long_memory_operand (operands[0], QImode)))"
18893 [(parallel [(set (match_dup 0)
18894 (xor:QI (match_dup 1) (const_int -1)))
18895 (clobber (reg:CC FLAGS_REG))])]
18898 ;; Non pairable "test imm, reg" instructions can be translated to
18899 ;; "and imm, reg" if reg dies. The "and" form is also shorter (one
18900 ;; byte opcode instead of two, have a short form for byte operands),
18901 ;; so do it for other CPUs as well. Given that the value was dead,
18902 ;; this should not create any new dependencies. Pass on the sub-word
18903 ;; versions if we're concerned about partial register stalls.
18906 [(set (match_operand 0 "flags_reg_operand" "")
18907 (match_operator 1 "compare_operator"
18908 [(and:SI (match_operand:SI 2 "register_operand" "")
18909 (match_operand:SI 3 "immediate_operand" ""))
18911 "ix86_match_ccmode (insn, CCNOmode)
18912 && (true_regnum (operands[2]) != 0
18913 || (GET_CODE (operands[3]) == CONST_INT
18914 && CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'K')))
18915 && peep2_reg_dead_p (1, operands[2])"
18917 [(set (match_dup 0)
18918 (match_op_dup 1 [(and:SI (match_dup 2) (match_dup 3))
18921 (and:SI (match_dup 2) (match_dup 3)))])]
18924 ;; We don't need to handle HImode case, because it will be promoted to SImode
18925 ;; on ! TARGET_PARTIAL_REG_STALL
18928 [(set (match_operand 0 "flags_reg_operand" "")
18929 (match_operator 1 "compare_operator"
18930 [(and:QI (match_operand:QI 2 "register_operand" "")
18931 (match_operand:QI 3 "immediate_operand" ""))
18933 "! TARGET_PARTIAL_REG_STALL
18934 && ix86_match_ccmode (insn, CCNOmode)
18935 && true_regnum (operands[2]) != 0
18936 && peep2_reg_dead_p (1, operands[2])"
18938 [(set (match_dup 0)
18939 (match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3))
18942 (and:QI (match_dup 2) (match_dup 3)))])]
18946 [(set (match_operand 0 "flags_reg_operand" "")
18947 (match_operator 1 "compare_operator"
18950 (match_operand 2 "ext_register_operand" "")
18953 (match_operand 3 "const_int_operand" ""))
18955 "! TARGET_PARTIAL_REG_STALL
18956 && ix86_match_ccmode (insn, CCNOmode)
18957 && true_regnum (operands[2]) != 0
18958 && peep2_reg_dead_p (1, operands[2])"
18959 [(parallel [(set (match_dup 0)
18968 (set (zero_extract:SI (match_dup 2)
18979 ;; Don't do logical operations with memory inputs.
18981 [(match_scratch:SI 2 "r")
18982 (parallel [(set (match_operand:SI 0 "register_operand" "")
18983 (match_operator:SI 3 "arith_or_logical_operator"
18985 (match_operand:SI 1 "memory_operand" "")]))
18986 (clobber (reg:CC FLAGS_REG))])]
18987 "! optimize_size && ! TARGET_READ_MODIFY"
18988 [(set (match_dup 2) (match_dup 1))
18989 (parallel [(set (match_dup 0)
18990 (match_op_dup 3 [(match_dup 0) (match_dup 2)]))
18991 (clobber (reg:CC FLAGS_REG))])]
18995 [(match_scratch:SI 2 "r")
18996 (parallel [(set (match_operand:SI 0 "register_operand" "")
18997 (match_operator:SI 3 "arith_or_logical_operator"
18998 [(match_operand:SI 1 "memory_operand" "")
19000 (clobber (reg:CC FLAGS_REG))])]
19001 "! optimize_size && ! TARGET_READ_MODIFY"
19002 [(set (match_dup 2) (match_dup 1))
19003 (parallel [(set (match_dup 0)
19004 (match_op_dup 3 [(match_dup 2) (match_dup 0)]))
19005 (clobber (reg:CC FLAGS_REG))])]
19008 ; Don't do logical operations with memory outputs
19010 ; These two don't make sense for PPro/PII -- we're expanding a 4-uop
19011 ; instruction into two 1-uop insns plus a 2-uop insn. That last has
19012 ; the same decoder scheduling characteristics as the original.
19015 [(match_scratch:SI 2 "r")
19016 (parallel [(set (match_operand:SI 0 "memory_operand" "")
19017 (match_operator:SI 3 "arith_or_logical_operator"
19019 (match_operand:SI 1 "nonmemory_operand" "")]))
19020 (clobber (reg:CC FLAGS_REG))])]
19021 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
19022 [(set (match_dup 2) (match_dup 0))
19023 (parallel [(set (match_dup 2)
19024 (match_op_dup 3 [(match_dup 2) (match_dup 1)]))
19025 (clobber (reg:CC FLAGS_REG))])
19026 (set (match_dup 0) (match_dup 2))]
19030 [(match_scratch:SI 2 "r")
19031 (parallel [(set (match_operand:SI 0 "memory_operand" "")
19032 (match_operator:SI 3 "arith_or_logical_operator"
19033 [(match_operand:SI 1 "nonmemory_operand" "")
19035 (clobber (reg:CC FLAGS_REG))])]
19036 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
19037 [(set (match_dup 2) (match_dup 0))
19038 (parallel [(set (match_dup 2)
19039 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
19040 (clobber (reg:CC FLAGS_REG))])
19041 (set (match_dup 0) (match_dup 2))]
19044 ;; Attempt to always use XOR for zeroing registers.
19046 [(set (match_operand 0 "register_operand" "")
19048 "(GET_MODE (operands[0]) == QImode
19049 || GET_MODE (operands[0]) == HImode
19050 || GET_MODE (operands[0]) == SImode
19051 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
19052 && (! TARGET_USE_MOV0 || optimize_size)
19053 && peep2_regno_dead_p (0, FLAGS_REG)"
19054 [(parallel [(set (match_dup 0) (const_int 0))
19055 (clobber (reg:CC FLAGS_REG))])]
19056 "operands[0] = gen_lowpart (GET_MODE (operands[0]) == DImode ? DImode : SImode,
19060 [(set (strict_low_part (match_operand 0 "register_operand" ""))
19062 "(GET_MODE (operands[0]) == QImode
19063 || GET_MODE (operands[0]) == HImode)
19064 && (! TARGET_USE_MOV0 || optimize_size)
19065 && peep2_regno_dead_p (0, FLAGS_REG)"
19066 [(parallel [(set (strict_low_part (match_dup 0)) (const_int 0))
19067 (clobber (reg:CC FLAGS_REG))])])
19069 ;; For HI and SI modes, or $-1,reg is smaller than mov $-1,reg.
19071 [(set (match_operand 0 "register_operand" "")
19073 "(GET_MODE (operands[0]) == HImode
19074 || GET_MODE (operands[0]) == SImode
19075 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
19076 && (optimize_size || TARGET_PENTIUM)
19077 && peep2_regno_dead_p (0, FLAGS_REG)"
19078 [(parallel [(set (match_dup 0) (const_int -1))
19079 (clobber (reg:CC FLAGS_REG))])]
19080 "operands[0] = gen_lowpart (GET_MODE (operands[0]) == DImode ? DImode : SImode,
19083 ;; Attempt to convert simple leas to adds. These can be created by
19086 [(set (match_operand:SI 0 "register_operand" "")
19087 (plus:SI (match_dup 0)
19088 (match_operand:SI 1 "nonmemory_operand" "")))]
19089 "peep2_regno_dead_p (0, FLAGS_REG)"
19090 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
19091 (clobber (reg:CC FLAGS_REG))])]
19095 [(set (match_operand:SI 0 "register_operand" "")
19096 (subreg:SI (plus:DI (match_operand:DI 1 "register_operand" "")
19097 (match_operand:DI 2 "nonmemory_operand" "")) 0))]
19098 "peep2_regno_dead_p (0, FLAGS_REG) && REGNO (operands[0]) == REGNO (operands[1])"
19099 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
19100 (clobber (reg:CC FLAGS_REG))])]
19101 "operands[2] = gen_lowpart (SImode, operands[2]);")
19104 [(set (match_operand:DI 0 "register_operand" "")
19105 (plus:DI (match_dup 0)
19106 (match_operand:DI 1 "x86_64_general_operand" "")))]
19107 "peep2_regno_dead_p (0, FLAGS_REG)"
19108 [(parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))
19109 (clobber (reg:CC FLAGS_REG))])]
19113 [(set (match_operand:SI 0 "register_operand" "")
19114 (mult:SI (match_dup 0)
19115 (match_operand:SI 1 "const_int_operand" "")))]
19116 "exact_log2 (INTVAL (operands[1])) >= 0
19117 && peep2_regno_dead_p (0, FLAGS_REG)"
19118 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
19119 (clobber (reg:CC FLAGS_REG))])]
19120 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
19123 [(set (match_operand:DI 0 "register_operand" "")
19124 (mult:DI (match_dup 0)
19125 (match_operand:DI 1 "const_int_operand" "")))]
19126 "exact_log2 (INTVAL (operands[1])) >= 0
19127 && peep2_regno_dead_p (0, FLAGS_REG)"
19128 [(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
19129 (clobber (reg:CC FLAGS_REG))])]
19130 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
19133 [(set (match_operand:SI 0 "register_operand" "")
19134 (subreg:SI (mult:DI (match_operand:DI 1 "register_operand" "")
19135 (match_operand:DI 2 "const_int_operand" "")) 0))]
19136 "exact_log2 (INTVAL (operands[2])) >= 0
19137 && REGNO (operands[0]) == REGNO (operands[1])
19138 && peep2_regno_dead_p (0, FLAGS_REG)"
19139 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
19140 (clobber (reg:CC FLAGS_REG))])]
19141 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[2])));")
19143 ;; The ESP adjustments can be done by the push and pop instructions. Resulting
19144 ;; code is shorter, since push is only 1 byte, while add imm, %esp 3 bytes. On
19145 ;; many CPUs it is also faster, since special hardware to avoid esp
19146 ;; dependencies is present.
19148 ;; While some of these conversions may be done using splitters, we use peepholes
19149 ;; in order to allow combine_stack_adjustments pass to see nonobfuscated RTL.
19151 ;; Convert prologue esp subtractions to push.
19152 ;; We need register to push. In order to keep verify_flow_info happy we have
19154 ;; - use scratch and clobber it in order to avoid dependencies
19155 ;; - use already live register
19156 ;; We can't use the second way right now, since there is no reliable way how to
19157 ;; verify that given register is live. First choice will also most likely in
19158 ;; fewer dependencies. On the place of esp adjustments it is very likely that
19159 ;; call clobbered registers are dead. We may want to use base pointer as an
19160 ;; alternative when no register is available later.
19163 [(match_scratch:SI 0 "r")
19164 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
19165 (clobber (reg:CC FLAGS_REG))
19166 (clobber (mem:BLK (scratch)))])]
19167 "optimize_size || !TARGET_SUB_ESP_4"
19168 [(clobber (match_dup 0))
19169 (parallel [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19170 (clobber (mem:BLK (scratch)))])])
19173 [(match_scratch:SI 0 "r")
19174 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
19175 (clobber (reg:CC FLAGS_REG))
19176 (clobber (mem:BLK (scratch)))])]
19177 "optimize_size || !TARGET_SUB_ESP_8"
19178 [(clobber (match_dup 0))
19179 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19180 (parallel [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19181 (clobber (mem:BLK (scratch)))])])
19183 ;; Convert esp subtractions to push.
19185 [(match_scratch:SI 0 "r")
19186 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
19187 (clobber (reg:CC FLAGS_REG))])]
19188 "optimize_size || !TARGET_SUB_ESP_4"
19189 [(clobber (match_dup 0))
19190 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))])
19193 [(match_scratch:SI 0 "r")
19194 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
19195 (clobber (reg:CC FLAGS_REG))])]
19196 "optimize_size || !TARGET_SUB_ESP_8"
19197 [(clobber (match_dup 0))
19198 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19199 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))])
19201 ;; Convert epilogue deallocator to pop.
19203 [(match_scratch:SI 0 "r")
19204 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19205 (clobber (reg:CC FLAGS_REG))
19206 (clobber (mem:BLK (scratch)))])]
19207 "optimize_size || !TARGET_ADD_ESP_4"
19208 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19209 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19210 (clobber (mem:BLK (scratch)))])]
19213 ;; Two pops case is tricky, since pop causes dependency on destination register.
19214 ;; We use two registers if available.
19216 [(match_scratch:SI 0 "r")
19217 (match_scratch:SI 1 "r")
19218 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19219 (clobber (reg:CC FLAGS_REG))
19220 (clobber (mem:BLK (scratch)))])]
19221 "optimize_size || !TARGET_ADD_ESP_8"
19222 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19223 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19224 (clobber (mem:BLK (scratch)))])
19225 (parallel [(set (match_dup 1) (mem:SI (reg:SI SP_REG)))
19226 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19230 [(match_scratch:SI 0 "r")
19231 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19232 (clobber (reg:CC FLAGS_REG))
19233 (clobber (mem:BLK (scratch)))])]
19235 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19236 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19237 (clobber (mem:BLK (scratch)))])
19238 (parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19239 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19242 ;; Convert esp additions to pop.
19244 [(match_scratch:SI 0 "r")
19245 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19246 (clobber (reg:CC FLAGS_REG))])]
19248 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19249 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19252 ;; Two pops case is tricky, since pop causes dependency on destination register.
19253 ;; We use two registers if available.
19255 [(match_scratch:SI 0 "r")
19256 (match_scratch:SI 1 "r")
19257 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19258 (clobber (reg:CC FLAGS_REG))])]
19260 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19261 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])
19262 (parallel [(set (match_dup 1) (mem:SI (reg:SI SP_REG)))
19263 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19267 [(match_scratch:SI 0 "r")
19268 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19269 (clobber (reg:CC FLAGS_REG))])]
19271 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19272 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])
19273 (parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19274 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19277 ;; Convert compares with 1 to shorter inc/dec operations when CF is not
19278 ;; required and register dies. Similarly for 128 to plus -128.
19280 [(set (match_operand 0 "flags_reg_operand" "")
19281 (match_operator 1 "compare_operator"
19282 [(match_operand 2 "register_operand" "")
19283 (match_operand 3 "const_int_operand" "")]))]
19284 "(INTVAL (operands[3]) == -1
19285 || INTVAL (operands[3]) == 1
19286 || INTVAL (operands[3]) == 128)
19287 && ix86_match_ccmode (insn, CCGCmode)
19288 && peep2_reg_dead_p (1, operands[2])"
19289 [(parallel [(set (match_dup 0)
19290 (match_op_dup 1 [(match_dup 2) (match_dup 3)]))
19291 (clobber (match_dup 2))])]
19295 [(match_scratch:DI 0 "r")
19296 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
19297 (clobber (reg:CC FLAGS_REG))
19298 (clobber (mem:BLK (scratch)))])]
19299 "optimize_size || !TARGET_SUB_ESP_4"
19300 [(clobber (match_dup 0))
19301 (parallel [(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19302 (clobber (mem:BLK (scratch)))])])
19305 [(match_scratch:DI 0 "r")
19306 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -16)))
19307 (clobber (reg:CC FLAGS_REG))
19308 (clobber (mem:BLK (scratch)))])]
19309 "optimize_size || !TARGET_SUB_ESP_8"
19310 [(clobber (match_dup 0))
19311 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19312 (parallel [(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19313 (clobber (mem:BLK (scratch)))])])
19315 ;; Convert esp subtractions to push.
19317 [(match_scratch:DI 0 "r")
19318 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
19319 (clobber (reg:CC FLAGS_REG))])]
19320 "optimize_size || !TARGET_SUB_ESP_4"
19321 [(clobber (match_dup 0))
19322 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))])
19325 [(match_scratch:DI 0 "r")
19326 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -16)))
19327 (clobber (reg:CC FLAGS_REG))])]
19328 "optimize_size || !TARGET_SUB_ESP_8"
19329 [(clobber (match_dup 0))
19330 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19331 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))])
19333 ;; Convert epilogue deallocator to pop.
19335 [(match_scratch:DI 0 "r")
19336 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19337 (clobber (reg:CC FLAGS_REG))
19338 (clobber (mem:BLK (scratch)))])]
19339 "optimize_size || !TARGET_ADD_ESP_4"
19340 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19341 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19342 (clobber (mem:BLK (scratch)))])]
19345 ;; Two pops case is tricky, since pop causes dependency on destination register.
19346 ;; We use two registers if available.
19348 [(match_scratch:DI 0 "r")
19349 (match_scratch:DI 1 "r")
19350 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19351 (clobber (reg:CC FLAGS_REG))
19352 (clobber (mem:BLK (scratch)))])]
19353 "optimize_size || !TARGET_ADD_ESP_8"
19354 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19355 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19356 (clobber (mem:BLK (scratch)))])
19357 (parallel [(set (match_dup 1) (mem:DI (reg:DI SP_REG)))
19358 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19362 [(match_scratch:DI 0 "r")
19363 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19364 (clobber (reg:CC FLAGS_REG))
19365 (clobber (mem:BLK (scratch)))])]
19367 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19368 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19369 (clobber (mem:BLK (scratch)))])
19370 (parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19371 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19374 ;; Convert esp additions to pop.
19376 [(match_scratch:DI 0 "r")
19377 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19378 (clobber (reg:CC FLAGS_REG))])]
19380 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19381 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19384 ;; Two pops case is tricky, since pop causes dependency on destination register.
19385 ;; We use two registers if available.
19387 [(match_scratch:DI 0 "r")
19388 (match_scratch:DI 1 "r")
19389 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19390 (clobber (reg:CC FLAGS_REG))])]
19392 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19393 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])
19394 (parallel [(set (match_dup 1) (mem:DI (reg:DI SP_REG)))
19395 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19399 [(match_scratch:DI 0 "r")
19400 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19401 (clobber (reg:CC FLAGS_REG))])]
19403 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19404 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])
19405 (parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19406 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19409 ;; Convert imul by three, five and nine into lea
19412 [(set (match_operand:SI 0 "register_operand" "")
19413 (mult:SI (match_operand:SI 1 "register_operand" "")
19414 (match_operand:SI 2 "const_int_operand" "")))
19415 (clobber (reg:CC FLAGS_REG))])]
19416 "INTVAL (operands[2]) == 3
19417 || INTVAL (operands[2]) == 5
19418 || INTVAL (operands[2]) == 9"
19419 [(set (match_dup 0)
19420 (plus:SI (mult:SI (match_dup 1) (match_dup 2))
19422 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19426 [(set (match_operand:SI 0 "register_operand" "")
19427 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "")
19428 (match_operand:SI 2 "const_int_operand" "")))
19429 (clobber (reg:CC FLAGS_REG))])]
19431 && (INTVAL (operands[2]) == 3
19432 || INTVAL (operands[2]) == 5
19433 || INTVAL (operands[2]) == 9)"
19434 [(set (match_dup 0) (match_dup 1))
19436 (plus:SI (mult:SI (match_dup 0) (match_dup 2))
19438 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19442 [(set (match_operand:DI 0 "register_operand" "")
19443 (mult:DI (match_operand:DI 1 "register_operand" "")
19444 (match_operand:DI 2 "const_int_operand" "")))
19445 (clobber (reg:CC FLAGS_REG))])]
19447 && (INTVAL (operands[2]) == 3
19448 || INTVAL (operands[2]) == 5
19449 || INTVAL (operands[2]) == 9)"
19450 [(set (match_dup 0)
19451 (plus:DI (mult:DI (match_dup 1) (match_dup 2))
19453 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19457 [(set (match_operand:DI 0 "register_operand" "")
19458 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "")
19459 (match_operand:DI 2 "const_int_operand" "")))
19460 (clobber (reg:CC FLAGS_REG))])]
19463 && (INTVAL (operands[2]) == 3
19464 || INTVAL (operands[2]) == 5
19465 || INTVAL (operands[2]) == 9)"
19466 [(set (match_dup 0) (match_dup 1))
19468 (plus:DI (mult:DI (match_dup 0) (match_dup 2))
19470 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19472 ;; Imul $32bit_imm, mem, reg is vector decoded, while
19473 ;; imul $32bit_imm, reg, reg is direct decoded.
19475 [(match_scratch:DI 3 "r")
19476 (parallel [(set (match_operand:DI 0 "register_operand" "")
19477 (mult:DI (match_operand:DI 1 "memory_operand" "")
19478 (match_operand:DI 2 "immediate_operand" "")))
19479 (clobber (reg:CC FLAGS_REG))])]
19480 "TARGET_K8 && !optimize_size
19481 && (GET_CODE (operands[2]) != CONST_INT
19482 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
19483 [(set (match_dup 3) (match_dup 1))
19484 (parallel [(set (match_dup 0) (mult:DI (match_dup 3) (match_dup 2)))
19485 (clobber (reg:CC FLAGS_REG))])]
19489 [(match_scratch:SI 3 "r")
19490 (parallel [(set (match_operand:SI 0 "register_operand" "")
19491 (mult:SI (match_operand:SI 1 "memory_operand" "")
19492 (match_operand:SI 2 "immediate_operand" "")))
19493 (clobber (reg:CC FLAGS_REG))])]
19494 "TARGET_K8 && !optimize_size
19495 && (GET_CODE (operands[2]) != CONST_INT
19496 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
19497 [(set (match_dup 3) (match_dup 1))
19498 (parallel [(set (match_dup 0) (mult:SI (match_dup 3) (match_dup 2)))
19499 (clobber (reg:CC FLAGS_REG))])]
19503 [(match_scratch:SI 3 "r")
19504 (parallel [(set (match_operand:DI 0 "register_operand" "")
19506 (mult:SI (match_operand:SI 1 "memory_operand" "")
19507 (match_operand:SI 2 "immediate_operand" ""))))
19508 (clobber (reg:CC FLAGS_REG))])]
19509 "TARGET_K8 && !optimize_size
19510 && (GET_CODE (operands[2]) != CONST_INT
19511 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
19512 [(set (match_dup 3) (match_dup 1))
19513 (parallel [(set (match_dup 0) (zero_extend:DI (mult:SI (match_dup 3) (match_dup 2))))
19514 (clobber (reg:CC FLAGS_REG))])]
19517 ;; imul $8/16bit_imm, regmem, reg is vector decoded.
19518 ;; Convert it into imul reg, reg
19519 ;; It would be better to force assembler to encode instruction using long
19520 ;; immediate, but there is apparently no way to do so.
19522 [(parallel [(set (match_operand:DI 0 "register_operand" "")
19523 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "")
19524 (match_operand:DI 2 "const_int_operand" "")))
19525 (clobber (reg:CC FLAGS_REG))])
19526 (match_scratch:DI 3 "r")]
19527 "TARGET_K8 && !optimize_size
19528 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
19529 [(set (match_dup 3) (match_dup 2))
19530 (parallel [(set (match_dup 0) (mult:DI (match_dup 0) (match_dup 3)))
19531 (clobber (reg:CC FLAGS_REG))])]
19533 if (!rtx_equal_p (operands[0], operands[1]))
19534 emit_move_insn (operands[0], operands[1]);
19538 [(parallel [(set (match_operand:SI 0 "register_operand" "")
19539 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "")
19540 (match_operand:SI 2 "const_int_operand" "")))
19541 (clobber (reg:CC FLAGS_REG))])
19542 (match_scratch:SI 3 "r")]
19543 "TARGET_K8 && !optimize_size
19544 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
19545 [(set (match_dup 3) (match_dup 2))
19546 (parallel [(set (match_dup 0) (mult:SI (match_dup 0) (match_dup 3)))
19547 (clobber (reg:CC FLAGS_REG))])]
19549 if (!rtx_equal_p (operands[0], operands[1]))
19550 emit_move_insn (operands[0], operands[1]);
19554 [(parallel [(set (match_operand:HI 0 "register_operand" "")
19555 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "")
19556 (match_operand:HI 2 "immediate_operand" "")))
19557 (clobber (reg:CC FLAGS_REG))])
19558 (match_scratch:HI 3 "r")]
19559 "TARGET_K8 && !optimize_size"
19560 [(set (match_dup 3) (match_dup 2))
19561 (parallel [(set (match_dup 0) (mult:HI (match_dup 0) (match_dup 3)))
19562 (clobber (reg:CC FLAGS_REG))])]
19564 if (!rtx_equal_p (operands[0], operands[1]))
19565 emit_move_insn (operands[0], operands[1]);
19568 ;; Call-value patterns last so that the wildcard operand does not
19569 ;; disrupt insn-recog's switch tables.
19571 (define_insn "*call_value_pop_0"
19572 [(set (match_operand 0 "" "")
19573 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
19574 (match_operand:SI 2 "" "")))
19575 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
19576 (match_operand:SI 3 "immediate_operand" "")))]
19579 if (SIBLING_CALL_P (insn))
19582 return "call\t%P1";
19584 [(set_attr "type" "callv")])
19586 (define_insn "*call_value_pop_1"
19587 [(set (match_operand 0 "" "")
19588 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
19589 (match_operand:SI 2 "" "")))
19590 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
19591 (match_operand:SI 3 "immediate_operand" "i")))]
19594 if (constant_call_address_operand (operands[1], Pmode))
19596 if (SIBLING_CALL_P (insn))
19599 return "call\t%P1";
19601 if (SIBLING_CALL_P (insn))
19604 return "call\t%A1";
19606 [(set_attr "type" "callv")])
19608 (define_insn "*call_value_0"
19609 [(set (match_operand 0 "" "")
19610 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
19611 (match_operand:SI 2 "" "")))]
19614 if (SIBLING_CALL_P (insn))
19617 return "call\t%P1";
19619 [(set_attr "type" "callv")])
19621 (define_insn "*call_value_0_rex64"
19622 [(set (match_operand 0 "" "")
19623 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
19624 (match_operand:DI 2 "const_int_operand" "")))]
19627 if (SIBLING_CALL_P (insn))
19630 return "call\t%P1";
19632 [(set_attr "type" "callv")])
19634 (define_insn "*call_value_1"
19635 [(set (match_operand 0 "" "")
19636 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
19637 (match_operand:SI 2 "" "")))]
19638 "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
19640 if (constant_call_address_operand (operands[1], Pmode))
19641 return "call\t%P1";
19642 return "call\t%A1";
19644 [(set_attr "type" "callv")])
19646 (define_insn "*sibcall_value_1"
19647 [(set (match_operand 0 "" "")
19648 (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,c,d,a"))
19649 (match_operand:SI 2 "" "")))]
19650 "SIBLING_CALL_P (insn) && !TARGET_64BIT"
19652 if (constant_call_address_operand (operands[1], Pmode))
19656 [(set_attr "type" "callv")])
19658 (define_insn "*call_value_1_rex64"
19659 [(set (match_operand 0 "" "")
19660 (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm"))
19661 (match_operand:DI 2 "" "")))]
19662 "!SIBLING_CALL_P (insn) && TARGET_64BIT"
19664 if (constant_call_address_operand (operands[1], Pmode))
19665 return "call\t%P1";
19666 return "call\t%A1";
19668 [(set_attr "type" "callv")])
19670 (define_insn "*sibcall_value_1_rex64"
19671 [(set (match_operand 0 "" "")
19672 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
19673 (match_operand:DI 2 "" "")))]
19674 "SIBLING_CALL_P (insn) && TARGET_64BIT"
19676 [(set_attr "type" "callv")])
19678 (define_insn "*sibcall_value_1_rex64_v"
19679 [(set (match_operand 0 "" "")
19680 (call (mem:QI (reg:DI 40))
19681 (match_operand:DI 1 "" "")))]
19682 "SIBLING_CALL_P (insn) && TARGET_64BIT"
19684 [(set_attr "type" "callv")])
19686 (define_insn "trap"
19687 [(trap_if (const_int 1) (const_int 5))]
19691 ;;; ix86 doesn't have conditional trap instructions, but we fake them
19692 ;;; for the sake of bounds checking. By emitting bounds checks as
19693 ;;; conditional traps rather than as conditional jumps around
19694 ;;; unconditional traps we avoid introducing spurious basic-block
19695 ;;; boundaries and facilitate elimination of redundant checks. In
19696 ;;; honor of the too-inflexible-for-BPs `bound' instruction, we use
19699 ;;; FIXME: Static branch prediction rules for ix86 are such that
19700 ;;; forward conditional branches predict as untaken. As implemented
19701 ;;; below, pseudo conditional traps violate that rule. We should use
19702 ;;; .pushsection/.popsection to place all of the `int 5's in a special
19703 ;;; section loaded at the end of the text segment and branch forward
19704 ;;; there on bounds-failure, and then jump back immediately (in case
19705 ;;; the system chooses to ignore bounds violations, or to report
19706 ;;; violations and continue execution).
19708 (define_expand "conditional_trap"
19709 [(trap_if (match_operator 0 "comparison_operator"
19710 [(match_dup 2) (const_int 0)])
19711 (match_operand 1 "const_int_operand" ""))]
19714 emit_insn (gen_rtx_TRAP_IF (VOIDmode,
19715 ix86_expand_compare (GET_CODE (operands[0]),
19721 (define_insn "*conditional_trap_1"
19722 [(trap_if (match_operator 0 "comparison_operator"
19723 [(reg FLAGS_REG) (const_int 0)])
19724 (match_operand 1 "const_int_operand" ""))]
19727 operands[2] = gen_label_rtx ();
19728 output_asm_insn ("j%c0\t%l2\; int\t%1", operands);
19729 (*targetm.asm_out.internal_label) (asm_out_file, "L",
19730 CODE_LABEL_NUMBER (operands[2]));
19734 ;; Pentium III SIMD instructions.
19736 ;; Moves for SSE/MMX regs.
19738 (define_insn "movv4sf_internal"
19739 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,m")
19740 (match_operand:V4SF 1 "vector_move_operand" "C,xm,x"))]
19744 movaps\t{%1, %0|%0, %1}
19745 movaps\t{%1, %0|%0, %1}"
19746 [(set_attr "type" "ssemov")
19747 (set_attr "mode" "V4SF")])
19750 [(set (match_operand:V4SF 0 "register_operand" "")
19751 (match_operand:V4SF 1 "zero_extended_scalar_load_operand" ""))]
19752 "TARGET_SSE && reload_completed"
19753 [(set (match_dup 0)
19755 (vec_duplicate:V4SF (match_dup 1))
19759 operands[1] = simplify_gen_subreg (SFmode, operands[1], V4SFmode, 0);
19760 operands[2] = CONST0_RTX (V4SFmode);
19763 (define_insn "movv4si_internal"
19764 [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,x,m")
19765 (match_operand:V4SI 1 "vector_move_operand" "C,xm,x"))]
19768 switch (which_alternative)
19771 if (get_attr_mode (insn) == MODE_V4SF)
19772 return "xorps\t%0, %0";
19774 return "pxor\t%0, %0";
19777 if (get_attr_mode (insn) == MODE_V4SF)
19778 return "movaps\t{%1, %0|%0, %1}";
19780 return "movdqa\t{%1, %0|%0, %1}";
19785 [(set_attr "type" "ssemov")
19787 (cond [(eq_attr "alternative" "0,1")
19789 (ne (symbol_ref "optimize_size")
19791 (const_string "V4SF")
19792 (const_string "TI"))
19793 (eq_attr "alternative" "2")
19795 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
19797 (ne (symbol_ref "optimize_size")
19799 (const_string "V4SF")
19800 (const_string "TI"))]
19801 (const_string "TI")))])
19803 (define_insn "movv2di_internal"
19804 [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x,x,m")
19805 (match_operand:V2DI 1 "vector_move_operand" "C,xm,x"))]
19808 switch (which_alternative)
19811 if (get_attr_mode (insn) == MODE_V4SF)
19812 return "xorps\t%0, %0";
19814 return "pxor\t%0, %0";
19817 if (get_attr_mode (insn) == MODE_V4SF)
19818 return "movaps\t{%1, %0|%0, %1}";
19820 return "movdqa\t{%1, %0|%0, %1}";
19825 [(set_attr "type" "ssemov")
19827 (cond [(eq_attr "alternative" "0,1")
19829 (ne (symbol_ref "optimize_size")
19831 (const_string "V4SF")
19832 (const_string "TI"))
19833 (eq_attr "alternative" "2")
19835 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
19837 (ne (symbol_ref "optimize_size")
19839 (const_string "V4SF")
19840 (const_string "TI"))]
19841 (const_string "TI")))])
19844 [(set (match_operand:V2DF 0 "register_operand" "")
19845 (match_operand:V2DF 1 "zero_extended_scalar_load_operand" ""))]
19846 "TARGET_SSE2 && reload_completed"
19847 [(set (match_dup 0)
19849 (vec_duplicate:V2DF (match_dup 1))
19853 operands[1] = simplify_gen_subreg (DFmode, operands[1], V2DFmode, 0);
19854 operands[2] = CONST0_RTX (V2DFmode);
19857 (define_insn "movv8qi_internal"
19858 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,y,m,!y,!*Y,?*Y,?m")
19859 (match_operand:V8QI 1 "vector_move_operand" "C,ym,y,*Y,y,*Ym,*Y"))]
19861 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19864 movq\t{%1, %0|%0, %1}
19865 movq\t{%1, %0|%0, %1}
19866 movdq2q\t{%1, %0|%0, %1}
19867 movq2dq\t{%1, %0|%0, %1}
19868 movq\t{%1, %0|%0, %1}
19869 movq\t{%1, %0|%0, %1}"
19870 [(set_attr "type" "mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov")
19871 (set_attr "mode" "DI")])
19873 (define_insn "movv4hi_internal"
19874 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,y,m,!y,!*Y,?*Y,?m")
19875 (match_operand:V4HI 1 "vector_move_operand" "C,ym,y,*Y,y,*Ym,*Y"))]
19877 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19880 movq\t{%1, %0|%0, %1}
19881 movq\t{%1, %0|%0, %1}
19882 movdq2q\t{%1, %0|%0, %1}
19883 movq2dq\t{%1, %0|%0, %1}
19884 movq\t{%1, %0|%0, %1}
19885 movq\t{%1, %0|%0, %1}"
19886 [(set_attr "type" "mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov")
19887 (set_attr "mode" "DI")])
19889 (define_insn "*movv2si_internal"
19890 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,y,m,!y,!*Y,?*Y,?m")
19891 (match_operand:V2SI 1 "vector_move_operand" "C,ym,y,*Y,y,*Ym,*Y"))]
19893 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19896 movq\t{%1, %0|%0, %1}
19897 movq\t{%1, %0|%0, %1}
19898 movdq2q\t{%1, %0|%0, %1}
19899 movq2dq\t{%1, %0|%0, %1}
19900 movq\t{%1, %0|%0, %1}
19901 movq\t{%1, %0|%0, %1}"
19902 [(set_attr "type" "mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov")
19903 (set_attr "mode" "DI")])
19905 (define_insn "movv2sf_internal"
19906 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,y,m,!y,!*Y,?*x,?m")
19907 (match_operand:V2SF 1 "vector_move_operand" "C,ym,y,*Y,y,*xm,*x"))]
19909 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19912 movq\t{%1, %0|%0, %1}
19913 movq\t{%1, %0|%0, %1}
19914 movdq2q\t{%1, %0|%0, %1}
19915 movq2dq\t{%1, %0|%0, %1}
19916 movlps\t{%1, %0|%0, %1}
19917 movlps\t{%1, %0|%0, %1}"
19918 [(set_attr "type" "mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov")
19919 (set_attr "mode" "DI,DI,DI,DI,DI,V2SF,V2SF")])
19921 (define_expand "movti"
19922 [(set (match_operand:TI 0 "nonimmediate_operand" "")
19923 (match_operand:TI 1 "nonimmediate_operand" ""))]
19924 "TARGET_SSE || TARGET_64BIT"
19927 ix86_expand_move (TImode, operands);
19929 ix86_expand_vector_move (TImode, operands);
19933 (define_expand "movtf"
19934 [(set (match_operand:TF 0 "nonimmediate_operand" "")
19935 (match_operand:TF 1 "nonimmediate_operand" ""))]
19939 ix86_expand_move (TFmode, operands);
19941 ix86_expand_vector_move (TFmode, operands);
19945 (define_insn "movv2df_internal"
19946 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,m")
19947 (match_operand:V2DF 1 "vector_move_operand" "C,xm,x"))]
19949 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19951 switch (which_alternative)
19954 if (get_attr_mode (insn) == MODE_V4SF)
19955 return "xorps\t%0, %0";
19957 return "xorpd\t%0, %0";
19960 if (get_attr_mode (insn) == MODE_V4SF)
19961 return "movaps\t{%1, %0|%0, %1}";
19963 return "movapd\t{%1, %0|%0, %1}";
19968 [(set_attr "type" "ssemov")
19970 (cond [(eq_attr "alternative" "0,1")
19972 (ne (symbol_ref "optimize_size")
19974 (const_string "V4SF")
19975 (const_string "V2DF"))
19976 (eq_attr "alternative" "2")
19978 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
19980 (ne (symbol_ref "optimize_size")
19982 (const_string "V4SF")
19983 (const_string "V2DF"))]
19984 (const_string "V2DF")))])
19986 (define_insn "movv8hi_internal"
19987 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,x,m")
19988 (match_operand:V8HI 1 "vector_move_operand" "C,xm,x"))]
19990 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19992 switch (which_alternative)
19995 if (get_attr_mode (insn) == MODE_V4SF)
19996 return "xorps\t%0, %0";
19998 return "pxor\t%0, %0";
20001 if (get_attr_mode (insn) == MODE_V4SF)
20002 return "movaps\t{%1, %0|%0, %1}";
20004 return "movdqa\t{%1, %0|%0, %1}";
20009 [(set_attr "type" "ssemov")
20011 (cond [(eq_attr "alternative" "0,1")
20013 (ne (symbol_ref "optimize_size")
20015 (const_string "V4SF")
20016 (const_string "TI"))
20017 (eq_attr "alternative" "2")
20019 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
20021 (ne (symbol_ref "optimize_size")
20023 (const_string "V4SF")
20024 (const_string "TI"))]
20025 (const_string "TI")))])
20027 (define_insn "movv16qi_internal"
20028 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,x,m")
20029 (match_operand:V16QI 1 "vector_move_operand" "C,xm,x"))]
20031 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20033 switch (which_alternative)
20036 if (get_attr_mode (insn) == MODE_V4SF)
20037 return "xorps\t%0, %0";
20039 return "pxor\t%0, %0";
20042 if (get_attr_mode (insn) == MODE_V4SF)
20043 return "movaps\t{%1, %0|%0, %1}";
20045 return "movdqa\t{%1, %0|%0, %1}";
20050 [(set_attr "type" "ssemov")
20052 (cond [(eq_attr "alternative" "0,1")
20054 (ne (symbol_ref "optimize_size")
20056 (const_string "V4SF")
20057 (const_string "TI"))
20058 (eq_attr "alternative" "2")
20060 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
20062 (ne (symbol_ref "optimize_size")
20064 (const_string "V4SF")
20065 (const_string "TI"))]
20066 (const_string "TI")))])
20068 (define_expand "movv2df"
20069 [(set (match_operand:V2DF 0 "nonimmediate_operand" "")
20070 (match_operand:V2DF 1 "nonimmediate_operand" ""))]
20073 ix86_expand_vector_move (V2DFmode, operands);
20077 (define_expand "movv8hi"
20078 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
20079 (match_operand:V8HI 1 "nonimmediate_operand" ""))]
20082 ix86_expand_vector_move (V8HImode, operands);
20086 (define_expand "movv16qi"
20087 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
20088 (match_operand:V16QI 1 "nonimmediate_operand" ""))]
20091 ix86_expand_vector_move (V16QImode, operands);
20095 (define_expand "movv4sf"
20096 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
20097 (match_operand:V4SF 1 "nonimmediate_operand" ""))]
20100 ix86_expand_vector_move (V4SFmode, operands);
20104 (define_expand "movv4si"
20105 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
20106 (match_operand:V4SI 1 "nonimmediate_operand" ""))]
20109 ix86_expand_vector_move (V4SImode, operands);
20113 (define_expand "movv2di"
20114 [(set (match_operand:V2DI 0 "nonimmediate_operand" "")
20115 (match_operand:V2DI 1 "nonimmediate_operand" ""))]
20118 ix86_expand_vector_move (V2DImode, operands);
20122 (define_expand "movv2si"
20123 [(set (match_operand:V2SI 0 "nonimmediate_operand" "")
20124 (match_operand:V2SI 1 "nonimmediate_operand" ""))]
20127 ix86_expand_vector_move (V2SImode, operands);
20131 (define_expand "movv4hi"
20132 [(set (match_operand:V4HI 0 "nonimmediate_operand" "")
20133 (match_operand:V4HI 1 "nonimmediate_operand" ""))]
20136 ix86_expand_vector_move (V4HImode, operands);
20140 (define_expand "movv8qi"
20141 [(set (match_operand:V8QI 0 "nonimmediate_operand" "")
20142 (match_operand:V8QI 1 "nonimmediate_operand" ""))]
20145 ix86_expand_vector_move (V8QImode, operands);
20149 (define_expand "movv2sf"
20150 [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
20151 (match_operand:V2SF 1 "nonimmediate_operand" ""))]
20154 ix86_expand_vector_move (V2SFmode, operands);
20158 (define_insn "*pushti"
20159 [(set (match_operand:TI 0 "push_operand" "=<")
20160 (match_operand:TI 1 "register_operand" "x"))]
20164 (define_insn "*pushv2df"
20165 [(set (match_operand:V2DF 0 "push_operand" "=<")
20166 (match_operand:V2DF 1 "register_operand" "x"))]
20170 (define_insn "*pushv2di"
20171 [(set (match_operand:V2DI 0 "push_operand" "=<")
20172 (match_operand:V2DI 1 "register_operand" "x"))]
20176 (define_insn "*pushv8hi"
20177 [(set (match_operand:V8HI 0 "push_operand" "=<")
20178 (match_operand:V8HI 1 "register_operand" "x"))]
20182 (define_insn "*pushv16qi"
20183 [(set (match_operand:V16QI 0 "push_operand" "=<")
20184 (match_operand:V16QI 1 "register_operand" "x"))]
20188 (define_insn "*pushv4sf"
20189 [(set (match_operand:V4SF 0 "push_operand" "=<")
20190 (match_operand:V4SF 1 "register_operand" "x"))]
20194 (define_insn "*pushv4si"
20195 [(set (match_operand:V4SI 0 "push_operand" "=<")
20196 (match_operand:V4SI 1 "register_operand" "x"))]
20200 (define_insn "*pushv2si"
20201 [(set (match_operand:V2SI 0 "push_operand" "=<")
20202 (match_operand:V2SI 1 "register_operand" "y"))]
20206 (define_insn "*pushv4hi"
20207 [(set (match_operand:V4HI 0 "push_operand" "=<")
20208 (match_operand:V4HI 1 "register_operand" "y"))]
20212 (define_insn "*pushv8qi"
20213 [(set (match_operand:V8QI 0 "push_operand" "=<")
20214 (match_operand:V8QI 1 "register_operand" "y"))]
20218 (define_insn "*pushv2sf"
20219 [(set (match_operand:V2SF 0 "push_operand" "=<")
20220 (match_operand:V2SF 1 "register_operand" "y"))]
20225 [(set (match_operand 0 "push_operand" "")
20226 (match_operand 1 "register_operand" ""))]
20227 "!TARGET_64BIT && reload_completed
20228 && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
20229 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 3)))
20230 (set (match_dup 2) (match_dup 1))]
20231 "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
20232 stack_pointer_rtx);
20233 operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));")
20236 [(set (match_operand 0 "push_operand" "")
20237 (match_operand 1 "register_operand" ""))]
20238 "TARGET_64BIT && reload_completed
20239 && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
20240 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 3)))
20241 (set (match_dup 2) (match_dup 1))]
20242 "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
20243 stack_pointer_rtx);
20244 operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));")
20247 (define_insn "movti_internal"
20248 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
20249 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
20250 "TARGET_SSE && !TARGET_64BIT
20251 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20253 switch (which_alternative)
20256 if (get_attr_mode (insn) == MODE_V4SF)
20257 return "xorps\t%0, %0";
20259 return "pxor\t%0, %0";
20262 if (get_attr_mode (insn) == MODE_V4SF)
20263 return "movaps\t{%1, %0|%0, %1}";
20265 return "movdqa\t{%1, %0|%0, %1}";
20270 [(set_attr "type" "ssemov,ssemov,ssemov")
20272 (cond [(eq_attr "alternative" "0,1")
20274 (ne (symbol_ref "optimize_size")
20276 (const_string "V4SF")
20277 (const_string "TI"))
20278 (eq_attr "alternative" "2")
20280 (ne (symbol_ref "optimize_size")
20282 (const_string "V4SF")
20283 (const_string "TI"))]
20284 (const_string "TI")))])
20286 (define_insn "*movti_rex64"
20287 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,x,xm")
20288 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
20290 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20292 switch (which_alternative)
20298 if (get_attr_mode (insn) == MODE_V4SF)
20299 return "xorps\t%0, %0";
20301 return "pxor\t%0, %0";
20304 if (get_attr_mode (insn) == MODE_V4SF)
20305 return "movaps\t{%1, %0|%0, %1}";
20307 return "movdqa\t{%1, %0|%0, %1}";
20312 [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
20314 (cond [(eq_attr "alternative" "2,3")
20316 (ne (symbol_ref "optimize_size")
20318 (const_string "V4SF")
20319 (const_string "TI"))
20320 (eq_attr "alternative" "4")
20322 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
20324 (ne (symbol_ref "optimize_size")
20326 (const_string "V4SF")
20327 (const_string "TI"))]
20328 (const_string "DI")))])
20330 (define_insn "*movtf_rex64"
20331 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o,x,x,xm")
20332 (match_operand:TF 1 "general_operand" "riFo,riF,C,xm,x"))]
20334 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20336 switch (which_alternative)
20342 if (get_attr_mode (insn) == MODE_V4SF)
20343 return "xorps\t%0, %0";
20345 return "pxor\t%0, %0";
20348 if (get_attr_mode (insn) == MODE_V4SF)
20349 return "movaps\t{%1, %0|%0, %1}";
20351 return "movdqa\t{%1, %0|%0, %1}";
20356 [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
20358 (cond [(eq_attr "alternative" "2,3")
20360 (ne (symbol_ref "optimize_size")
20362 (const_string "V4SF")
20363 (const_string "TI"))
20364 (eq_attr "alternative" "4")
20366 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
20368 (ne (symbol_ref "optimize_size")
20370 (const_string "V4SF")
20371 (const_string "TI"))]
20372 (const_string "DI")))])
20375 [(set (match_operand:TI 0 "nonimmediate_operand" "")
20376 (match_operand:TI 1 "general_operand" ""))]
20377 "reload_completed && !SSE_REG_P (operands[0])
20378 && !SSE_REG_P (operands[1])"
20380 "ix86_split_long_move (operands); DONE;")
20383 [(set (match_operand:TF 0 "nonimmediate_operand" "")
20384 (match_operand:TF 1 "general_operand" ""))]
20385 "reload_completed && !SSE_REG_P (operands[0])
20386 && !SSE_REG_P (operands[1])"
20388 "ix86_split_long_move (operands); DONE;")
20390 ;; These two patterns are useful for specifying exactly whether to use
20391 ;; movaps or movups
20392 (define_expand "sse_movaps"
20393 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
20394 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "")]
20398 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
20400 rtx tmp = gen_reg_rtx (V4SFmode);
20401 emit_insn (gen_sse_movaps (tmp, operands[1]));
20402 emit_move_insn (operands[0], tmp);
20407 (define_insn "*sse_movaps_1"
20408 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
20409 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
20412 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20413 "movaps\t{%1, %0|%0, %1}"
20414 [(set_attr "type" "ssemov,ssemov")
20415 (set_attr "mode" "V4SF")])
20417 (define_expand "sse_movups"
20418 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
20419 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "")]
20423 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
20425 rtx tmp = gen_reg_rtx (V4SFmode);
20426 emit_insn (gen_sse_movups (tmp, operands[1]));
20427 emit_move_insn (operands[0], tmp);
20432 (define_insn "*sse_movups_1"
20433 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
20434 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
20437 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20438 "movups\t{%1, %0|%0, %1}"
20439 [(set_attr "type" "ssecvt,ssecvt")
20440 (set_attr "mode" "V4SF")])
20442 ;; SSE Strange Moves.
20444 (define_insn "sse_movmskps"
20445 [(set (match_operand:SI 0 "register_operand" "=r")
20446 (unspec:SI [(match_operand:V4SF 1 "register_operand" "x")]
20449 "movmskps\t{%1, %0|%0, %1}"
20450 [(set_attr "type" "ssecvt")
20451 (set_attr "mode" "V4SF")])
20453 (define_insn "mmx_pmovmskb"
20454 [(set (match_operand:SI 0 "register_operand" "=r")
20455 (unspec:SI [(match_operand:V8QI 1 "register_operand" "y")]
20457 "TARGET_SSE || TARGET_3DNOW_A"
20458 "pmovmskb\t{%1, %0|%0, %1}"
20459 [(set_attr "type" "ssecvt")
20460 (set_attr "mode" "V4SF")])
20463 (define_insn "mmx_maskmovq"
20464 [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
20465 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
20466 (match_operand:V8QI 2 "register_operand" "y")]
20468 "(TARGET_SSE || TARGET_3DNOW_A) && !TARGET_64BIT"
20469 ;; @@@ check ordering of operands in intel/nonintel syntax
20470 "maskmovq\t{%2, %1|%1, %2}"
20471 [(set_attr "type" "mmxcvt")
20472 (set_attr "mode" "DI")])
20474 (define_insn "mmx_maskmovq_rex"
20475 [(set (mem:V8QI (match_operand:DI 0 "register_operand" "D"))
20476 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
20477 (match_operand:V8QI 2 "register_operand" "y")]
20479 "(TARGET_SSE || TARGET_3DNOW_A) && TARGET_64BIT"
20480 ;; @@@ check ordering of operands in intel/nonintel syntax
20481 "maskmovq\t{%2, %1|%1, %2}"
20482 [(set_attr "type" "mmxcvt")
20483 (set_attr "mode" "DI")])
20485 (define_insn "sse_movntv4sf"
20486 [(set (match_operand:V4SF 0 "memory_operand" "=m")
20487 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")]
20490 "movntps\t{%1, %0|%0, %1}"
20491 [(set_attr "type" "ssemov")
20492 (set_attr "mode" "V4SF")])
20494 (define_insn "sse_movntdi"
20495 [(set (match_operand:DI 0 "memory_operand" "=m")
20496 (unspec:DI [(match_operand:DI 1 "register_operand" "y")]
20498 "TARGET_SSE || TARGET_3DNOW_A"
20499 "movntq\t{%1, %0|%0, %1}"
20500 [(set_attr "type" "mmxmov")
20501 (set_attr "mode" "DI")])
20503 (define_insn "sse_movhlps"
20504 [(set (match_operand:V4SF 0 "register_operand" "=x")
20506 (match_operand:V4SF 1 "register_operand" "0")
20507 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
20508 (parallel [(const_int 2)
20514 "movhlps\t{%2, %0|%0, %2}"
20515 [(set_attr "type" "ssecvt")
20516 (set_attr "mode" "V4SF")])
20518 (define_insn "sse_movlhps"
20519 [(set (match_operand:V4SF 0 "register_operand" "=x")
20521 (match_operand:V4SF 1 "register_operand" "0")
20522 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
20523 (parallel [(const_int 2)
20529 "movlhps\t{%2, %0|%0, %2}"
20530 [(set_attr "type" "ssecvt")
20531 (set_attr "mode" "V4SF")])
20533 (define_insn "sse_movhps"
20534 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
20536 (match_operand:V4SF 1 "nonimmediate_operand" "0,0")
20537 (match_operand:V4SF 2 "nonimmediate_operand" "m,x")
20540 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
20541 "movhps\t{%2, %0|%0, %2}"
20542 [(set_attr "type" "ssecvt")
20543 (set_attr "mode" "V4SF")])
20545 (define_insn "sse_movlps"
20546 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
20548 (match_operand:V4SF 1 "nonimmediate_operand" "0,0")
20549 (match_operand:V4SF 2 "nonimmediate_operand" "m,x")
20552 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
20553 "movlps\t{%2, %0|%0, %2}"
20554 [(set_attr "type" "ssecvt")
20555 (set_attr "mode" "V4SF")])
20557 (define_expand "sse_loadss"
20558 [(match_operand:V4SF 0 "register_operand" "")
20559 (match_operand:SF 1 "memory_operand" "")]
20562 emit_insn (gen_sse_loadss_1 (operands[0], operands[1],
20563 CONST0_RTX (V4SFmode)));
20567 (define_insn "sse_loadss_1"
20568 [(set (match_operand:V4SF 0 "register_operand" "=x")
20570 (vec_duplicate:V4SF (match_operand:SF 1 "memory_operand" "m"))
20571 (match_operand:V4SF 2 "const0_operand" "X")
20574 "movss\t{%1, %0|%0, %1}"
20575 [(set_attr "type" "ssemov")
20576 (set_attr "mode" "SF")])
20578 (define_insn "sse_movss"
20579 [(set (match_operand:V4SF 0 "register_operand" "=x")
20581 (match_operand:V4SF 1 "register_operand" "0")
20582 (match_operand:V4SF 2 "register_operand" "x")
20585 "movss\t{%2, %0|%0, %2}"
20586 [(set_attr "type" "ssemov")
20587 (set_attr "mode" "SF")])
20589 (define_insn "sse_storess"
20590 [(set (match_operand:SF 0 "memory_operand" "=m")
20592 (match_operand:V4SF 1 "register_operand" "x")
20593 (parallel [(const_int 0)])))]
20595 "movss\t{%1, %0|%0, %1}"
20596 [(set_attr "type" "ssemov")
20597 (set_attr "mode" "SF")])
20599 (define_insn "sse_shufps"
20600 [(set (match_operand:V4SF 0 "register_operand" "=x")
20601 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
20602 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
20603 (match_operand:SI 3 "immediate_operand" "i")]
20606 ;; @@@ check operand order for intel/nonintel syntax
20607 "shufps\t{%3, %2, %0|%0, %2, %3}"
20608 [(set_attr "type" "ssecvt")
20609 (set_attr "mode" "V4SF")])
20614 (define_insn "addv4sf3"
20615 [(set (match_operand:V4SF 0 "register_operand" "=x")
20616 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20617 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20619 "addps\t{%2, %0|%0, %2}"
20620 [(set_attr "type" "sseadd")
20621 (set_attr "mode" "V4SF")])
20623 (define_insn "vmaddv4sf3"
20624 [(set (match_operand:V4SF 0 "register_operand" "=x")
20626 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20627 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20631 "addss\t{%2, %0|%0, %2}"
20632 [(set_attr "type" "sseadd")
20633 (set_attr "mode" "SF")])
20635 (define_insn "subv4sf3"
20636 [(set (match_operand:V4SF 0 "register_operand" "=x")
20637 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20638 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20640 "subps\t{%2, %0|%0, %2}"
20641 [(set_attr "type" "sseadd")
20642 (set_attr "mode" "V4SF")])
20644 (define_insn "vmsubv4sf3"
20645 [(set (match_operand:V4SF 0 "register_operand" "=x")
20647 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20648 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20652 "subss\t{%2, %0|%0, %2}"
20653 [(set_attr "type" "sseadd")
20654 (set_attr "mode" "SF")])
20656 ;; ??? Should probably be done by generic code instead.
20657 (define_expand "negv4sf2"
20658 [(set (match_operand:V4SF 0 "register_operand" "")
20659 (xor:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "")
20663 rtx m0 = gen_lowpart (SFmode, gen_int_mode (0x80000000, SImode));
20664 rtx vm0 = gen_rtx_CONST_VECTOR (V4SFmode, gen_rtvec (4, m0, m0, m0, m0));
20665 operands[2] = force_reg (V4SFmode, vm0);
20668 (define_insn "mulv4sf3"
20669 [(set (match_operand:V4SF 0 "register_operand" "=x")
20670 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
20671 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20673 "mulps\t{%2, %0|%0, %2}"
20674 [(set_attr "type" "ssemul")
20675 (set_attr "mode" "V4SF")])
20677 (define_insn "vmmulv4sf3"
20678 [(set (match_operand:V4SF 0 "register_operand" "=x")
20680 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
20681 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20685 "mulss\t{%2, %0|%0, %2}"
20686 [(set_attr "type" "ssemul")
20687 (set_attr "mode" "SF")])
20689 (define_insn "divv4sf3"
20690 [(set (match_operand:V4SF 0 "register_operand" "=x")
20691 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
20692 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20694 "divps\t{%2, %0|%0, %2}"
20695 [(set_attr "type" "ssediv")
20696 (set_attr "mode" "V4SF")])
20698 (define_insn "vmdivv4sf3"
20699 [(set (match_operand:V4SF 0 "register_operand" "=x")
20701 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
20702 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20706 "divss\t{%2, %0|%0, %2}"
20707 [(set_attr "type" "ssediv")
20708 (set_attr "mode" "SF")])
20711 ;; SSE square root/reciprocal
20713 (define_insn "rcpv4sf2"
20714 [(set (match_operand:V4SF 0 "register_operand" "=x")
20716 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RCP))]
20718 "rcpps\t{%1, %0|%0, %1}"
20719 [(set_attr "type" "sse")
20720 (set_attr "mode" "V4SF")])
20722 (define_insn "vmrcpv4sf2"
20723 [(set (match_operand:V4SF 0 "register_operand" "=x")
20725 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
20727 (match_operand:V4SF 2 "register_operand" "0")
20730 "rcpss\t{%1, %0|%0, %1}"
20731 [(set_attr "type" "sse")
20732 (set_attr "mode" "SF")])
20734 (define_insn "rsqrtv4sf2"
20735 [(set (match_operand:V4SF 0 "register_operand" "=x")
20737 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RSQRT))]
20739 "rsqrtps\t{%1, %0|%0, %1}"
20740 [(set_attr "type" "sse")
20741 (set_attr "mode" "V4SF")])
20743 (define_insn "vmrsqrtv4sf2"
20744 [(set (match_operand:V4SF 0 "register_operand" "=x")
20746 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
20748 (match_operand:V4SF 2 "register_operand" "0")
20751 "rsqrtss\t{%1, %0|%0, %1}"
20752 [(set_attr "type" "sse")
20753 (set_attr "mode" "SF")])
20755 (define_insn "sqrtv4sf2"
20756 [(set (match_operand:V4SF 0 "register_operand" "=x")
20757 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
20759 "sqrtps\t{%1, %0|%0, %1}"
20760 [(set_attr "type" "sse")
20761 (set_attr "mode" "V4SF")])
20763 (define_insn "vmsqrtv4sf2"
20764 [(set (match_operand:V4SF 0 "register_operand" "=x")
20766 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
20767 (match_operand:V4SF 2 "register_operand" "0")
20770 "sqrtss\t{%1, %0|%0, %1}"
20771 [(set_attr "type" "sse")
20772 (set_attr "mode" "SF")])
20774 ;; SSE logical operations.
20776 ;; SSE defines logical operations on floating point values. This brings
20777 ;; interesting challenge to RTL representation where logicals are only valid
20778 ;; on integral types. We deal with this by representing the floating point
20779 ;; logical as logical on arguments casted to TImode as this is what hardware
20780 ;; really does. Unfortunately hardware requires the type information to be
20781 ;; present and thus we must avoid subregs from being simplified and eliminated
20782 ;; in later compilation phases.
20784 ;; We have following variants from each instruction:
20785 ;; sse_andsf3 - the operation taking V4SF vector operands
20786 ;; and doing TImode cast on them
20787 ;; *sse_andsf3_memory - the operation taking one memory operand casted to
20788 ;; TImode, since backend insist on eliminating casts
20789 ;; on memory operands
20790 ;; sse_andti3_sf_1 - the operation taking SF scalar operands.
20791 ;; We cannot accept memory operand here as instruction reads
20792 ;; whole scalar. This is generated only post reload by GCC
20793 ;; scalar float operations that expands to logicals (fabs)
20794 ;; sse_andti3_sf_2 - the operation taking SF scalar input and TImode
20795 ;; memory operand. Eventually combine can be able
20796 ;; to synthesize these using splitter.
20797 ;; sse2_anddf3, *sse2_anddf3_memory
20800 ;; These are not called andti3 etc. because we really really don't want
20801 ;; the compiler to widen DImode ands to TImode ands and then try to move
20802 ;; into DImode subregs of SSE registers, and them together, and move out
20803 ;; of DImode subregs again!
20804 ;; SSE1 single precision floating point logical operation
20805 (define_expand "sse_andv4sf3"
20806 [(set (match_operand:V4SF 0 "register_operand" "")
20807 (and:V4SF (match_operand:V4SF 1 "register_operand" "")
20808 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20812 (define_insn "*sse_andv4sf3"
20813 [(set (match_operand:V4SF 0 "register_operand" "=x")
20814 (and:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0")
20815 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20817 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20818 "andps\t{%2, %0|%0, %2}"
20819 [(set_attr "type" "sselog")
20820 (set_attr "mode" "V4SF")])
20822 (define_expand "sse_nandv4sf3"
20823 [(set (match_operand:V4SF 0 "register_operand" "")
20824 (and:V4SF (not:V4SF (match_operand:V4SF 1 "register_operand" ""))
20825 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20829 (define_insn "*sse_nandv4sf3"
20830 [(set (match_operand:V4SF 0 "register_operand" "=x")
20831 (and:V4SF (not:V4SF (match_operand:V4SF 1 "register_operand" "0"))
20832 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20834 "andnps\t{%2, %0|%0, %2}"
20835 [(set_attr "type" "sselog")
20836 (set_attr "mode" "V4SF")])
20838 (define_expand "sse_iorv4sf3"
20839 [(set (match_operand:V4SF 0 "register_operand" "")
20840 (ior:V4SF (match_operand:V4SF 1 "register_operand" "")
20841 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20845 (define_insn "*sse_iorv4sf3"
20846 [(set (match_operand:V4SF 0 "register_operand" "=x")
20847 (ior:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0")
20848 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20850 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20851 "orps\t{%2, %0|%0, %2}"
20852 [(set_attr "type" "sselog")
20853 (set_attr "mode" "V4SF")])
20855 (define_expand "sse_xorv4sf3"
20856 [(set (match_operand:V4SF 0 "register_operand" "")
20857 (xor:V4SF (match_operand:V4SF 1 "register_operand" "")
20858 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20862 (define_insn "*sse_xorv4sf3"
20863 [(set (match_operand:V4SF 0 "register_operand" "=x")
20864 (xor:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0")
20865 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20867 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20868 "xorps\t{%2, %0|%0, %2}"
20869 [(set_attr "type" "sselog")
20870 (set_attr "mode" "V4SF")])
20872 ;; SSE2 double precision floating point logical operation
20874 (define_expand "sse2_andv2df3"
20875 [(set (match_operand:V2DF 0 "register_operand" "")
20876 (and:V2DF (match_operand:V2DF 1 "register_operand" "")
20877 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20881 (define_insn "*sse2_andv2df3"
20882 [(set (match_operand:V2DF 0 "register_operand" "=x")
20883 (and:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "%0")
20884 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20886 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20887 "andpd\t{%2, %0|%0, %2}"
20888 [(set_attr "type" "sselog")
20889 (set_attr "mode" "V2DF")])
20891 (define_expand "sse2_nandv2df3"
20892 [(set (match_operand:V2DF 0 "register_operand" "")
20893 (and:V2DF (not:V2DF (match_operand:V2DF 1 "register_operand" ""))
20894 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20898 (define_insn "*sse2_nandv2df3"
20899 [(set (match_operand:V2DF 0 "register_operand" "=x")
20900 (and:V2DF (not:V2DF (match_operand:V2DF 1 "register_operand" "0"))
20901 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20903 "andnpd\t{%2, %0|%0, %2}"
20904 [(set_attr "type" "sselog")
20905 (set_attr "mode" "V2DF")])
20907 (define_expand "sse2_iorv2df3"
20908 [(set (match_operand:V2DF 0 "register_operand" "")
20909 (ior:V2DF (match_operand:V2DF 1 "register_operand" "")
20910 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20914 (define_insn "*sse2_iorv2df3"
20915 [(set (match_operand:V2DF 0 "register_operand" "=x")
20916 (ior:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "%0")
20917 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20919 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20920 "orpd\t{%2, %0|%0, %2}"
20921 [(set_attr "type" "sselog")
20922 (set_attr "mode" "V2DF")])
20924 (define_expand "sse2_xorv2df3"
20925 [(set (match_operand:V2DF 0 "register_operand" "")
20926 (xor:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "")
20927 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20931 (define_insn "*sse2_xorv2df3"
20932 [(set (match_operand:V2DF 0 "register_operand" "=x")
20933 (xor:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "%0")
20934 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20936 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20937 "xorpd\t{%2, %0|%0, %2}"
20938 [(set_attr "type" "sselog")
20939 (set_attr "mode" "V2DF")])
20941 ;; SSE2 integral logicals. These patterns must always come after floating
20942 ;; point ones since we don't want compiler to use integer opcodes on floating
20943 ;; point SSE values to avoid matching of subregs in the match_operand.
20944 (define_insn "*sse2_andti3"
20945 [(set (match_operand:TI 0 "register_operand" "=x")
20946 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
20947 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20949 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20950 "pand\t{%2, %0|%0, %2}"
20951 [(set_attr "type" "sselog")
20952 (set_attr "mode" "TI")])
20954 (define_insn "sse2_andv2di3"
20955 [(set (match_operand:V2DI 0 "register_operand" "=x")
20956 (and:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
20957 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20959 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20960 "pand\t{%2, %0|%0, %2}"
20961 [(set_attr "type" "sselog")
20962 (set_attr "mode" "TI")])
20964 (define_insn "*sse2_nandti3"
20965 [(set (match_operand:TI 0 "register_operand" "=x")
20966 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
20967 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20969 "pandn\t{%2, %0|%0, %2}"
20970 [(set_attr "type" "sselog")
20971 (set_attr "mode" "TI")])
20973 (define_insn "sse2_nandv2di3"
20974 [(set (match_operand:V2DI 0 "register_operand" "=x")
20975 (and:V2DI (not:V2DI (match_operand:V2DI 1 "register_operand" "0"))
20976 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20978 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20979 "pandn\t{%2, %0|%0, %2}"
20980 [(set_attr "type" "sselog")
20981 (set_attr "mode" "TI")])
20983 (define_insn "*sse2_iorti3"
20984 [(set (match_operand:TI 0 "register_operand" "=x")
20985 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
20986 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20988 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20989 "por\t{%2, %0|%0, %2}"
20990 [(set_attr "type" "sselog")
20991 (set_attr "mode" "TI")])
20993 (define_insn "sse2_iorv2di3"
20994 [(set (match_operand:V2DI 0 "register_operand" "=x")
20995 (ior:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
20996 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20998 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20999 "por\t{%2, %0|%0, %2}"
21000 [(set_attr "type" "sselog")
21001 (set_attr "mode" "TI")])
21003 (define_insn "*sse2_xorti3"
21004 [(set (match_operand:TI 0 "register_operand" "=x")
21005 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
21006 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
21008 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
21009 "pxor\t{%2, %0|%0, %2}"
21010 [(set_attr "type" "sselog")
21011 (set_attr "mode" "TI")])
21013 (define_insn "sse2_xorv2di3"
21014 [(set (match_operand:V2DI 0 "register_operand" "=x")
21015 (xor:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
21016 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
21018 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
21019 "pxor\t{%2, %0|%0, %2}"
21020 [(set_attr "type" "sselog")
21021 (set_attr "mode" "TI")])
21023 ;; Use xor, but don't show input operands so they aren't live before
21025 (define_insn "sse_clrv4sf"
21026 [(set (match_operand:V4SF 0 "register_operand" "=x")
21027 (match_operand:V4SF 1 "const0_operand" "X"))]
21030 if (get_attr_mode (insn) == MODE_TI)
21031 return "pxor\t{%0, %0|%0, %0}";
21033 return "xorps\t{%0, %0|%0, %0}";
21035 [(set_attr "type" "sselog")
21036 (set_attr "memory" "none")
21039 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
21041 (ne (symbol_ref "TARGET_SSE2")
21043 (eq (symbol_ref "optimize_size")
21045 (const_string "TI")
21046 (const_string "V4SF")))])
21048 ;; Use xor, but don't show input operands so they aren't live before
21050 (define_insn "sse_clrv2df"
21051 [(set (match_operand:V2DF 0 "register_operand" "=x")
21052 (unspec:V2DF [(const_int 0)] UNSPEC_NOP))]
21054 "xorpd\t{%0, %0|%0, %0}"
21055 [(set_attr "type" "sselog")
21056 (set_attr "memory" "none")
21057 (set_attr "mode" "V4SF")])
21059 ;; SSE mask-generating compares
21061 (define_insn "maskcmpv4sf3"
21062 [(set (match_operand:V4SI 0 "register_operand" "=x")
21063 (match_operator:V4SI 3 "sse_comparison_operator"
21064 [(match_operand:V4SF 1 "register_operand" "0")
21065 (match_operand:V4SF 2 "register_operand" "x")]))]
21067 "cmp%D3ps\t{%2, %0|%0, %2}"
21068 [(set_attr "type" "ssecmp")
21069 (set_attr "mode" "V4SF")])
21071 (define_insn "maskncmpv4sf3"
21072 [(set (match_operand:V4SI 0 "register_operand" "=x")
21074 (match_operator:V4SI 3 "sse_comparison_operator"
21075 [(match_operand:V4SF 1 "register_operand" "0")
21076 (match_operand:V4SF 2 "register_operand" "x")])))]
21079 if (GET_CODE (operands[3]) == UNORDERED)
21080 return "cmpordps\t{%2, %0|%0, %2}";
21082 return "cmpn%D3ps\t{%2, %0|%0, %2}";
21084 [(set_attr "type" "ssecmp")
21085 (set_attr "mode" "V4SF")])
21087 (define_insn "vmmaskcmpv4sf3"
21088 [(set (match_operand:V4SI 0 "register_operand" "=x")
21090 (match_operator:V4SI 3 "sse_comparison_operator"
21091 [(match_operand:V4SF 1 "register_operand" "0")
21092 (match_operand:V4SF 2 "register_operand" "x")])
21093 (subreg:V4SI (match_dup 1) 0)
21096 "cmp%D3ss\t{%2, %0|%0, %2}"
21097 [(set_attr "type" "ssecmp")
21098 (set_attr "mode" "SF")])
21100 (define_insn "vmmaskncmpv4sf3"
21101 [(set (match_operand:V4SI 0 "register_operand" "=x")
21104 (match_operator:V4SI 3 "sse_comparison_operator"
21105 [(match_operand:V4SF 1 "register_operand" "0")
21106 (match_operand:V4SF 2 "register_operand" "x")]))
21107 (subreg:V4SI (match_dup 1) 0)
21111 if (GET_CODE (operands[3]) == UNORDERED)
21112 return "cmpordss\t{%2, %0|%0, %2}";
21114 return "cmpn%D3ss\t{%2, %0|%0, %2}";
21116 [(set_attr "type" "ssecmp")
21117 (set_attr "mode" "SF")])
21119 (define_insn "sse_comi"
21120 [(set (reg:CCFP FLAGS_REG)
21121 (compare:CCFP (vec_select:SF
21122 (match_operand:V4SF 0 "register_operand" "x")
21123 (parallel [(const_int 0)]))
21125 (match_operand:V4SF 1 "register_operand" "x")
21126 (parallel [(const_int 0)]))))]
21128 "comiss\t{%1, %0|%0, %1}"
21129 [(set_attr "type" "ssecomi")
21130 (set_attr "mode" "SF")])
21132 (define_insn "sse_ucomi"
21133 [(set (reg:CCFPU FLAGS_REG)
21134 (compare:CCFPU (vec_select:SF
21135 (match_operand:V4SF 0 "register_operand" "x")
21136 (parallel [(const_int 0)]))
21138 (match_operand:V4SF 1 "register_operand" "x")
21139 (parallel [(const_int 0)]))))]
21141 "ucomiss\t{%1, %0|%0, %1}"
21142 [(set_attr "type" "ssecomi")
21143 (set_attr "mode" "SF")])
21148 (define_insn "sse_unpckhps"
21149 [(set (match_operand:V4SF 0 "register_operand" "=x")
21151 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
21152 (parallel [(const_int 2)
21156 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
21157 (parallel [(const_int 0)
21163 "unpckhps\t{%2, %0|%0, %2}"
21164 [(set_attr "type" "ssecvt")
21165 (set_attr "mode" "V4SF")])
21167 (define_insn "sse_unpcklps"
21168 [(set (match_operand:V4SF 0 "register_operand" "=x")
21170 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
21171 (parallel [(const_int 0)
21175 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
21176 (parallel [(const_int 2)
21182 "unpcklps\t{%2, %0|%0, %2}"
21183 [(set_attr "type" "ssecvt")
21184 (set_attr "mode" "V4SF")])
21189 (define_insn "smaxv4sf3"
21190 [(set (match_operand:V4SF 0 "register_operand" "=x")
21191 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
21192 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
21194 "maxps\t{%2, %0|%0, %2}"
21195 [(set_attr "type" "sse")
21196 (set_attr "mode" "V4SF")])
21198 (define_insn "vmsmaxv4sf3"
21199 [(set (match_operand:V4SF 0 "register_operand" "=x")
21201 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
21202 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
21206 "maxss\t{%2, %0|%0, %2}"
21207 [(set_attr "type" "sse")
21208 (set_attr "mode" "SF")])
21210 (define_insn "sminv4sf3"
21211 [(set (match_operand:V4SF 0 "register_operand" "=x")
21212 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
21213 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
21215 "minps\t{%2, %0|%0, %2}"
21216 [(set_attr "type" "sse")
21217 (set_attr "mode" "V4SF")])
21219 (define_insn "vmsminv4sf3"
21220 [(set (match_operand:V4SF 0 "register_operand" "=x")
21222 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
21223 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
21227 "minss\t{%2, %0|%0, %2}"
21228 [(set_attr "type" "sse")
21229 (set_attr "mode" "SF")])
21231 ;; SSE <-> integer/MMX conversions
21233 (define_insn "cvtpi2ps"
21234 [(set (match_operand:V4SF 0 "register_operand" "=x")
21236 (match_operand:V4SF 1 "register_operand" "0")
21237 (vec_duplicate:V4SF
21238 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
21241 "cvtpi2ps\t{%2, %0|%0, %2}"
21242 [(set_attr "type" "ssecvt")
21243 (set_attr "mode" "V4SF")])
21245 (define_insn "cvtps2pi"
21246 [(set (match_operand:V2SI 0 "register_operand" "=y")
21248 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
21249 (parallel [(const_int 0) (const_int 1)])))]
21251 "cvtps2pi\t{%1, %0|%0, %1}"
21252 [(set_attr "type" "ssecvt")
21253 (set_attr "mode" "V4SF")])
21255 (define_insn "cvttps2pi"
21256 [(set (match_operand:V2SI 0 "register_operand" "=y")
21258 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
21260 (parallel [(const_int 0) (const_int 1)])))]
21262 "cvttps2pi\t{%1, %0|%0, %1}"
21263 [(set_attr "type" "ssecvt")
21264 (set_attr "mode" "SF")])
21266 (define_insn "cvtsi2ss"
21267 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
21269 (match_operand:V4SF 1 "register_operand" "0,0")
21270 (vec_duplicate:V4SF
21271 (float:SF (match_operand:SI 2 "nonimmediate_operand" "r,rm")))
21274 "cvtsi2ss\t{%2, %0|%0, %2}"
21275 [(set_attr "type" "sseicvt")
21276 (set_attr "athlon_decode" "vector,double")
21277 (set_attr "mode" "SF")])
21279 (define_insn "cvtsi2ssq"
21280 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
21282 (match_operand:V4SF 1 "register_operand" "0,0")
21283 (vec_duplicate:V4SF
21284 (float:SF (match_operand:DI 2 "nonimmediate_operand" "r,rm")))
21286 "TARGET_SSE && TARGET_64BIT"
21287 "cvtsi2ssq\t{%2, %0|%0, %2}"
21288 [(set_attr "type" "sseicvt")
21289 (set_attr "athlon_decode" "vector,double")
21290 (set_attr "mode" "SF")])
21292 (define_insn "cvtss2si"
21293 [(set (match_operand:SI 0 "register_operand" "=r,r")
21295 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "x,m"))
21296 (parallel [(const_int 0)])))]
21298 "cvtss2si\t{%1, %0|%0, %1}"
21299 [(set_attr "type" "sseicvt")
21300 (set_attr "athlon_decode" "double,vector")
21301 (set_attr "mode" "SI")])
21303 (define_insn "cvtss2siq"
21304 [(set (match_operand:DI 0 "register_operand" "=r,r")
21306 (fix:V4DI (match_operand:V4SF 1 "nonimmediate_operand" "x,m"))
21307 (parallel [(const_int 0)])))]
21309 "cvtss2siq\t{%1, %0|%0, %1}"
21310 [(set_attr "type" "sseicvt")
21311 (set_attr "athlon_decode" "double,vector")
21312 (set_attr "mode" "DI")])
21314 (define_insn "cvttss2si"
21315 [(set (match_operand:SI 0 "register_operand" "=r,r")
21317 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "x,xm")]
21319 (parallel [(const_int 0)])))]
21321 "cvttss2si\t{%1, %0|%0, %1}"
21322 [(set_attr "type" "sseicvt")
21323 (set_attr "mode" "SF")
21324 (set_attr "athlon_decode" "double,vector")])
21326 (define_insn "cvttss2siq"
21327 [(set (match_operand:DI 0 "register_operand" "=r,r")
21329 (unspec:V4DI [(match_operand:V4SF 1 "nonimmediate_operand" "x,xm")]
21331 (parallel [(const_int 0)])))]
21332 "TARGET_SSE && TARGET_64BIT"
21333 "cvttss2siq\t{%1, %0|%0, %1}"
21334 [(set_attr "type" "sseicvt")
21335 (set_attr "mode" "SF")
21336 (set_attr "athlon_decode" "double,vector")])
21343 (define_insn "addv8qi3"
21344 [(set (match_operand:V8QI 0 "register_operand" "=y")
21345 (plus:V8QI (match_operand:V8QI 1 "register_operand" "%0")
21346 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21348 "paddb\t{%2, %0|%0, %2}"
21349 [(set_attr "type" "mmxadd")
21350 (set_attr "mode" "DI")])
21352 (define_insn "addv4hi3"
21353 [(set (match_operand:V4HI 0 "register_operand" "=y")
21354 (plus:V4HI (match_operand:V4HI 1 "register_operand" "%0")
21355 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21357 "paddw\t{%2, %0|%0, %2}"
21358 [(set_attr "type" "mmxadd")
21359 (set_attr "mode" "DI")])
21361 (define_insn "addv2si3"
21362 [(set (match_operand:V2SI 0 "register_operand" "=y")
21363 (plus:V2SI (match_operand:V2SI 1 "register_operand" "%0")
21364 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21366 "paddd\t{%2, %0|%0, %2}"
21367 [(set_attr "type" "mmxadd")
21368 (set_attr "mode" "DI")])
21370 (define_insn "mmx_adddi3"
21371 [(set (match_operand:DI 0 "register_operand" "=y")
21373 [(plus:DI (match_operand:DI 1 "register_operand" "%0")
21374 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21377 "paddq\t{%2, %0|%0, %2}"
21378 [(set_attr "type" "mmxadd")
21379 (set_attr "mode" "DI")])
21381 (define_insn "ssaddv8qi3"
21382 [(set (match_operand:V8QI 0 "register_operand" "=y")
21383 (ss_plus:V8QI (match_operand:V8QI 1 "register_operand" "%0")
21384 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21386 "paddsb\t{%2, %0|%0, %2}"
21387 [(set_attr "type" "mmxadd")
21388 (set_attr "mode" "DI")])
21390 (define_insn "ssaddv4hi3"
21391 [(set (match_operand:V4HI 0 "register_operand" "=y")
21392 (ss_plus:V4HI (match_operand:V4HI 1 "register_operand" "%0")
21393 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21395 "paddsw\t{%2, %0|%0, %2}"
21396 [(set_attr "type" "mmxadd")
21397 (set_attr "mode" "DI")])
21399 (define_insn "usaddv8qi3"
21400 [(set (match_operand:V8QI 0 "register_operand" "=y")
21401 (us_plus:V8QI (match_operand:V8QI 1 "register_operand" "%0")
21402 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21404 "paddusb\t{%2, %0|%0, %2}"
21405 [(set_attr "type" "mmxadd")
21406 (set_attr "mode" "DI")])
21408 (define_insn "usaddv4hi3"
21409 [(set (match_operand:V4HI 0 "register_operand" "=y")
21410 (us_plus:V4HI (match_operand:V4HI 1 "register_operand" "%0")
21411 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21413 "paddusw\t{%2, %0|%0, %2}"
21414 [(set_attr "type" "mmxadd")
21415 (set_attr "mode" "DI")])
21417 (define_insn "subv8qi3"
21418 [(set (match_operand:V8QI 0 "register_operand" "=y")
21419 (minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
21420 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21422 "psubb\t{%2, %0|%0, %2}"
21423 [(set_attr "type" "mmxadd")
21424 (set_attr "mode" "DI")])
21426 (define_insn "subv4hi3"
21427 [(set (match_operand:V4HI 0 "register_operand" "=y")
21428 (minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
21429 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21431 "psubw\t{%2, %0|%0, %2}"
21432 [(set_attr "type" "mmxadd")
21433 (set_attr "mode" "DI")])
21435 (define_insn "subv2si3"
21436 [(set (match_operand:V2SI 0 "register_operand" "=y")
21437 (minus:V2SI (match_operand:V2SI 1 "register_operand" "0")
21438 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21440 "psubd\t{%2, %0|%0, %2}"
21441 [(set_attr "type" "mmxadd")
21442 (set_attr "mode" "DI")])
21444 (define_insn "mmx_subdi3"
21445 [(set (match_operand:DI 0 "register_operand" "=y")
21447 [(minus:DI (match_operand:DI 1 "register_operand" "0")
21448 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21451 "psubq\t{%2, %0|%0, %2}"
21452 [(set_attr "type" "mmxadd")
21453 (set_attr "mode" "DI")])
21455 (define_insn "sssubv8qi3"
21456 [(set (match_operand:V8QI 0 "register_operand" "=y")
21457 (ss_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
21458 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21460 "psubsb\t{%2, %0|%0, %2}"
21461 [(set_attr "type" "mmxadd")
21462 (set_attr "mode" "DI")])
21464 (define_insn "sssubv4hi3"
21465 [(set (match_operand:V4HI 0 "register_operand" "=y")
21466 (ss_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
21467 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21469 "psubsw\t{%2, %0|%0, %2}"
21470 [(set_attr "type" "mmxadd")
21471 (set_attr "mode" "DI")])
21473 (define_insn "ussubv8qi3"
21474 [(set (match_operand:V8QI 0 "register_operand" "=y")
21475 (us_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
21476 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21478 "psubusb\t{%2, %0|%0, %2}"
21479 [(set_attr "type" "mmxadd")
21480 (set_attr "mode" "DI")])
21482 (define_insn "ussubv4hi3"
21483 [(set (match_operand:V4HI 0 "register_operand" "=y")
21484 (us_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
21485 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21487 "psubusw\t{%2, %0|%0, %2}"
21488 [(set_attr "type" "mmxadd")
21489 (set_attr "mode" "DI")])
21491 (define_insn "mulv4hi3"
21492 [(set (match_operand:V4HI 0 "register_operand" "=y")
21493 (mult:V4HI (match_operand:V4HI 1 "register_operand" "0")
21494 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21496 "pmullw\t{%2, %0|%0, %2}"
21497 [(set_attr "type" "mmxmul")
21498 (set_attr "mode" "DI")])
21500 (define_insn "smulv4hi3_highpart"
21501 [(set (match_operand:V4HI 0 "register_operand" "=y")
21504 (mult:V4SI (sign_extend:V4SI
21505 (match_operand:V4HI 1 "register_operand" "0"))
21507 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
21510 "pmulhw\t{%2, %0|%0, %2}"
21511 [(set_attr "type" "mmxmul")
21512 (set_attr "mode" "DI")])
21514 (define_insn "umulv4hi3_highpart"
21515 [(set (match_operand:V4HI 0 "register_operand" "=y")
21518 (mult:V4SI (zero_extend:V4SI
21519 (match_operand:V4HI 1 "register_operand" "0"))
21521 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
21523 "TARGET_SSE || TARGET_3DNOW_A"
21524 "pmulhuw\t{%2, %0|%0, %2}"
21525 [(set_attr "type" "mmxmul")
21526 (set_attr "mode" "DI")])
21528 (define_insn "mmx_pmaddwd"
21529 [(set (match_operand:V2SI 0 "register_operand" "=y")
21533 (vec_select:V2HI (match_operand:V4HI 1 "register_operand" "0")
21534 (parallel [(const_int 0) (const_int 2)])))
21536 (vec_select:V2HI (match_operand:V4HI 2 "nonimmediate_operand" "ym")
21537 (parallel [(const_int 0) (const_int 2)]))))
21539 (sign_extend:V2SI (vec_select:V2HI (match_dup 1)
21540 (parallel [(const_int 1)
21542 (sign_extend:V2SI (vec_select:V2HI (match_dup 2)
21543 (parallel [(const_int 1)
21544 (const_int 3)]))))))]
21546 "pmaddwd\t{%2, %0|%0, %2}"
21547 [(set_attr "type" "mmxmul")
21548 (set_attr "mode" "DI")])
21551 ;; MMX logical operations
21552 ;; Note we don't want to declare these as regular iordi3 insns to prevent
21553 ;; normal code that also wants to use the FPU from getting broken.
21554 ;; The UNSPECs are there to prevent the combiner from getting overly clever.
21555 (define_insn "mmx_iordi3"
21556 [(set (match_operand:DI 0 "register_operand" "=y")
21558 [(ior:DI (match_operand:DI 1 "register_operand" "%0")
21559 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21562 "por\t{%2, %0|%0, %2}"
21563 [(set_attr "type" "mmxadd")
21564 (set_attr "mode" "DI")])
21566 (define_insn "mmx_xordi3"
21567 [(set (match_operand:DI 0 "register_operand" "=y")
21569 [(xor:DI (match_operand:DI 1 "register_operand" "%0")
21570 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21573 "pxor\t{%2, %0|%0, %2}"
21574 [(set_attr "type" "mmxadd")
21575 (set_attr "mode" "DI")
21576 (set_attr "memory" "none")])
21578 ;; Same as pxor, but don't show input operands so that we don't think
21580 (define_insn "mmx_clrdi"
21581 [(set (match_operand:DI 0 "register_operand" "=y")
21582 (unspec:DI [(const_int 0)] UNSPEC_NOP))]
21584 "pxor\t{%0, %0|%0, %0}"
21585 [(set_attr "type" "mmxadd")
21586 (set_attr "mode" "DI")
21587 (set_attr "memory" "none")])
21589 (define_insn "mmx_anddi3"
21590 [(set (match_operand:DI 0 "register_operand" "=y")
21592 [(and:DI (match_operand:DI 1 "register_operand" "%0")
21593 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21596 "pand\t{%2, %0|%0, %2}"
21597 [(set_attr "type" "mmxadd")
21598 (set_attr "mode" "DI")])
21600 (define_insn "mmx_nanddi3"
21601 [(set (match_operand:DI 0 "register_operand" "=y")
21603 [(and:DI (not:DI (match_operand:DI 1 "register_operand" "0"))
21604 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21607 "pandn\t{%2, %0|%0, %2}"
21608 [(set_attr "type" "mmxadd")
21609 (set_attr "mode" "DI")])
21612 ;; MMX unsigned averages/sum of absolute differences
21614 (define_insn "mmx_uavgv8qi3"
21615 [(set (match_operand:V8QI 0 "register_operand" "=y")
21617 (plus:V8QI (plus:V8QI
21618 (match_operand:V8QI 1 "register_operand" "0")
21619 (match_operand:V8QI 2 "nonimmediate_operand" "ym"))
21620 (const_vector:V8QI [(const_int 1)
21629 "TARGET_SSE || TARGET_3DNOW_A"
21630 "pavgb\t{%2, %0|%0, %2}"
21631 [(set_attr "type" "mmxshft")
21632 (set_attr "mode" "DI")])
21634 (define_insn "mmx_uavgv4hi3"
21635 [(set (match_operand:V4HI 0 "register_operand" "=y")
21637 (plus:V4HI (plus:V4HI
21638 (match_operand:V4HI 1 "register_operand" "0")
21639 (match_operand:V4HI 2 "nonimmediate_operand" "ym"))
21640 (const_vector:V4HI [(const_int 1)
21645 "TARGET_SSE || TARGET_3DNOW_A"
21646 "pavgw\t{%2, %0|%0, %2}"
21647 [(set_attr "type" "mmxshft")
21648 (set_attr "mode" "DI")])
21650 (define_insn "mmx_psadbw"
21651 [(set (match_operand:DI 0 "register_operand" "=y")
21652 (unspec:DI [(match_operand:V8QI 1 "register_operand" "0")
21653 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
21655 "TARGET_SSE || TARGET_3DNOW_A"
21656 "psadbw\t{%2, %0|%0, %2}"
21657 [(set_attr "type" "mmxshft")
21658 (set_attr "mode" "DI")])
21661 ;; MMX insert/extract/shuffle
21663 (define_insn "mmx_pinsrw"
21664 [(set (match_operand:V4HI 0 "register_operand" "=y")
21665 (vec_merge:V4HI (match_operand:V4HI 1 "register_operand" "0")
21666 (vec_duplicate:V4HI
21667 (truncate:HI (match_operand:SI 2 "nonimmediate_operand" "rm")))
21668 (match_operand:SI 3 "const_0_to_15_operand" "N")))]
21669 "TARGET_SSE || TARGET_3DNOW_A"
21670 "pinsrw\t{%3, %2, %0|%0, %2, %3}"
21671 [(set_attr "type" "mmxcvt")
21672 (set_attr "mode" "DI")])
21674 (define_insn "mmx_pextrw"
21675 [(set (match_operand:SI 0 "register_operand" "=r")
21676 (zero_extend:SI (vec_select:HI (match_operand:V4HI 1 "register_operand" "y")
21678 [(match_operand:SI 2 "const_0_to_3_operand" "N")]))))]
21679 "TARGET_SSE || TARGET_3DNOW_A"
21680 "pextrw\t{%2, %1, %0|%0, %1, %2}"
21681 [(set_attr "type" "mmxcvt")
21682 (set_attr "mode" "DI")])
21684 (define_insn "mmx_pshufw"
21685 [(set (match_operand:V4HI 0 "register_operand" "=y")
21686 (unspec:V4HI [(match_operand:V4HI 1 "nonimmediate_operand" "ym")
21687 (match_operand:SI 2 "immediate_operand" "i")]
21689 "TARGET_SSE || TARGET_3DNOW_A"
21690 "pshufw\t{%2, %1, %0|%0, %1, %2}"
21691 [(set_attr "type" "mmxcvt")
21692 (set_attr "mode" "DI")])
21695 ;; MMX mask-generating comparisons
21697 (define_insn "eqv8qi3"
21698 [(set (match_operand:V8QI 0 "register_operand" "=y")
21699 (eq:V8QI (match_operand:V8QI 1 "register_operand" "0")
21700 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21702 "pcmpeqb\t{%2, %0|%0, %2}"
21703 [(set_attr "type" "mmxcmp")
21704 (set_attr "mode" "DI")])
21706 (define_insn "eqv4hi3"
21707 [(set (match_operand:V4HI 0 "register_operand" "=y")
21708 (eq:V4HI (match_operand:V4HI 1 "register_operand" "0")
21709 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21711 "pcmpeqw\t{%2, %0|%0, %2}"
21712 [(set_attr "type" "mmxcmp")
21713 (set_attr "mode" "DI")])
21715 (define_insn "eqv2si3"
21716 [(set (match_operand:V2SI 0 "register_operand" "=y")
21717 (eq:V2SI (match_operand:V2SI 1 "register_operand" "0")
21718 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21720 "pcmpeqd\t{%2, %0|%0, %2}"
21721 [(set_attr "type" "mmxcmp")
21722 (set_attr "mode" "DI")])
21724 (define_insn "gtv8qi3"
21725 [(set (match_operand:V8QI 0 "register_operand" "=y")
21726 (gt:V8QI (match_operand:V8QI 1 "register_operand" "0")
21727 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21729 "pcmpgtb\t{%2, %0|%0, %2}"
21730 [(set_attr "type" "mmxcmp")
21731 (set_attr "mode" "DI")])
21733 (define_insn "gtv4hi3"
21734 [(set (match_operand:V4HI 0 "register_operand" "=y")
21735 (gt:V4HI (match_operand:V4HI 1 "register_operand" "0")
21736 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21738 "pcmpgtw\t{%2, %0|%0, %2}"
21739 [(set_attr "type" "mmxcmp")
21740 (set_attr "mode" "DI")])
21742 (define_insn "gtv2si3"
21743 [(set (match_operand:V2SI 0 "register_operand" "=y")
21744 (gt:V2SI (match_operand:V2SI 1 "register_operand" "0")
21745 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21747 "pcmpgtd\t{%2, %0|%0, %2}"
21748 [(set_attr "type" "mmxcmp")
21749 (set_attr "mode" "DI")])
21752 ;; MMX max/min insns
21754 (define_insn "umaxv8qi3"
21755 [(set (match_operand:V8QI 0 "register_operand" "=y")
21756 (umax:V8QI (match_operand:V8QI 1 "register_operand" "0")
21757 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21758 "TARGET_SSE || TARGET_3DNOW_A"
21759 "pmaxub\t{%2, %0|%0, %2}"
21760 [(set_attr "type" "mmxadd")
21761 (set_attr "mode" "DI")])
21763 (define_insn "smaxv4hi3"
21764 [(set (match_operand:V4HI 0 "register_operand" "=y")
21765 (smax:V4HI (match_operand:V4HI 1 "register_operand" "0")
21766 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21767 "TARGET_SSE || TARGET_3DNOW_A"
21768 "pmaxsw\t{%2, %0|%0, %2}"
21769 [(set_attr "type" "mmxadd")
21770 (set_attr "mode" "DI")])
21772 (define_insn "uminv8qi3"
21773 [(set (match_operand:V8QI 0 "register_operand" "=y")
21774 (umin:V8QI (match_operand:V8QI 1 "register_operand" "0")
21775 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21776 "TARGET_SSE || TARGET_3DNOW_A"
21777 "pminub\t{%2, %0|%0, %2}"
21778 [(set_attr "type" "mmxadd")
21779 (set_attr "mode" "DI")])
21781 (define_insn "sminv4hi3"
21782 [(set (match_operand:V4HI 0 "register_operand" "=y")
21783 (smin:V4HI (match_operand:V4HI 1 "register_operand" "0")
21784 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21785 "TARGET_SSE || TARGET_3DNOW_A"
21786 "pminsw\t{%2, %0|%0, %2}"
21787 [(set_attr "type" "mmxadd")
21788 (set_attr "mode" "DI")])
21793 (define_insn "ashrv4hi3"
21794 [(set (match_operand:V4HI 0 "register_operand" "=y")
21795 (ashiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
21796 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21798 "psraw\t{%2, %0|%0, %2}"
21799 [(set_attr "type" "mmxshft")
21800 (set_attr "mode" "DI")])
21802 (define_insn "ashrv2si3"
21803 [(set (match_operand:V2SI 0 "register_operand" "=y")
21804 (ashiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
21805 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21807 "psrad\t{%2, %0|%0, %2}"
21808 [(set_attr "type" "mmxshft")
21809 (set_attr "mode" "DI")])
21811 (define_insn "lshrv4hi3"
21812 [(set (match_operand:V4HI 0 "register_operand" "=y")
21813 (lshiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
21814 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21816 "psrlw\t{%2, %0|%0, %2}"
21817 [(set_attr "type" "mmxshft")
21818 (set_attr "mode" "DI")])
21820 (define_insn "lshrv2si3"
21821 [(set (match_operand:V2SI 0 "register_operand" "=y")
21822 (lshiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
21823 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21825 "psrld\t{%2, %0|%0, %2}"
21826 [(set_attr "type" "mmxshft")
21827 (set_attr "mode" "DI")])
21829 ;; See logical MMX insns.
21830 (define_insn "mmx_lshrdi3"
21831 [(set (match_operand:DI 0 "register_operand" "=y")
21833 [(lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
21834 (match_operand:DI 2 "nonmemory_operand" "yi"))]
21837 "psrlq\t{%2, %0|%0, %2}"
21838 [(set_attr "type" "mmxshft")
21839 (set_attr "mode" "DI")])
21841 (define_insn "ashlv4hi3"
21842 [(set (match_operand:V4HI 0 "register_operand" "=y")
21843 (ashift:V4HI (match_operand:V4HI 1 "register_operand" "0")
21844 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21846 "psllw\t{%2, %0|%0, %2}"
21847 [(set_attr "type" "mmxshft")
21848 (set_attr "mode" "DI")])
21850 (define_insn "ashlv2si3"
21851 [(set (match_operand:V2SI 0 "register_operand" "=y")
21852 (ashift:V2SI (match_operand:V2SI 1 "register_operand" "0")
21853 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21855 "pslld\t{%2, %0|%0, %2}"
21856 [(set_attr "type" "mmxshft")
21857 (set_attr "mode" "DI")])
21859 ;; See logical MMX insns.
21860 (define_insn "mmx_ashldi3"
21861 [(set (match_operand:DI 0 "register_operand" "=y")
21863 [(ashift:DI (match_operand:DI 1 "register_operand" "0")
21864 (match_operand:DI 2 "nonmemory_operand" "yi"))]
21867 "psllq\t{%2, %0|%0, %2}"
21868 [(set_attr "type" "mmxshft")
21869 (set_attr "mode" "DI")])
21872 ;; MMX pack/unpack insns.
21874 (define_insn "mmx_packsswb"
21875 [(set (match_operand:V8QI 0 "register_operand" "=y")
21877 (ss_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
21878 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
21880 "packsswb\t{%2, %0|%0, %2}"
21881 [(set_attr "type" "mmxshft")
21882 (set_attr "mode" "DI")])
21884 (define_insn "mmx_packssdw"
21885 [(set (match_operand:V4HI 0 "register_operand" "=y")
21887 (ss_truncate:V2HI (match_operand:V2SI 1 "register_operand" "0"))
21888 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
21890 "packssdw\t{%2, %0|%0, %2}"
21891 [(set_attr "type" "mmxshft")
21892 (set_attr "mode" "DI")])
21894 (define_insn "mmx_packuswb"
21895 [(set (match_operand:V8QI 0 "register_operand" "=y")
21897 (us_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
21898 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
21900 "packuswb\t{%2, %0|%0, %2}"
21901 [(set_attr "type" "mmxshft")
21902 (set_attr "mode" "DI")])
21904 (define_insn "mmx_punpckhbw"
21905 [(set (match_operand:V8QI 0 "register_operand" "=y")
21907 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
21908 (parallel [(const_int 4)
21916 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
21917 (parallel [(const_int 0)
21927 "punpckhbw\t{%2, %0|%0, %2}"
21928 [(set_attr "type" "mmxcvt")
21929 (set_attr "mode" "DI")])
21931 (define_insn "mmx_punpckhwd"
21932 [(set (match_operand:V4HI 0 "register_operand" "=y")
21934 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
21935 (parallel [(const_int 0)
21939 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
21940 (parallel [(const_int 2)
21946 "punpckhwd\t{%2, %0|%0, %2}"
21947 [(set_attr "type" "mmxcvt")
21948 (set_attr "mode" "DI")])
21950 (define_insn "mmx_punpckhdq"
21951 [(set (match_operand:V2SI 0 "register_operand" "=y")
21953 (match_operand:V2SI 1 "register_operand" "0")
21954 (vec_select:V2SI (match_operand:V2SI 2 "register_operand" "y")
21955 (parallel [(const_int 1)
21959 "punpckhdq\t{%2, %0|%0, %2}"
21960 [(set_attr "type" "mmxcvt")
21961 (set_attr "mode" "DI")])
21963 (define_insn "mmx_punpcklbw"
21964 [(set (match_operand:V8QI 0 "register_operand" "=y")
21966 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
21967 (parallel [(const_int 0)
21975 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
21976 (parallel [(const_int 4)
21986 "punpcklbw\t{%2, %0|%0, %2}"
21987 [(set_attr "type" "mmxcvt")
21988 (set_attr "mode" "DI")])
21990 (define_insn "mmx_punpcklwd"
21991 [(set (match_operand:V4HI 0 "register_operand" "=y")
21993 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
21994 (parallel [(const_int 2)
21998 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
21999 (parallel [(const_int 0)
22005 "punpcklwd\t{%2, %0|%0, %2}"
22006 [(set_attr "type" "mmxcvt")
22007 (set_attr "mode" "DI")])
22009 (define_insn "mmx_punpckldq"
22010 [(set (match_operand:V2SI 0 "register_operand" "=y")
22012 (vec_select:V2SI (match_operand:V2SI 1 "register_operand" "0")
22013 (parallel [(const_int 1)
22015 (match_operand:V2SI 2 "register_operand" "y")
22018 "punpckldq\t{%2, %0|%0, %2}"
22019 [(set_attr "type" "mmxcvt")
22020 (set_attr "mode" "DI")])
22023 ;; Miscellaneous stuff
22025 (define_insn "emms"
22026 [(unspec_volatile [(const_int 0)] UNSPECV_EMMS)
22027 (clobber (reg:XF 8))
22028 (clobber (reg:XF 9))
22029 (clobber (reg:XF 10))
22030 (clobber (reg:XF 11))
22031 (clobber (reg:XF 12))
22032 (clobber (reg:XF 13))
22033 (clobber (reg:XF 14))
22034 (clobber (reg:XF 15))
22035 (clobber (reg:DI 29))
22036 (clobber (reg:DI 30))
22037 (clobber (reg:DI 31))
22038 (clobber (reg:DI 32))
22039 (clobber (reg:DI 33))
22040 (clobber (reg:DI 34))
22041 (clobber (reg:DI 35))
22042 (clobber (reg:DI 36))]
22045 [(set_attr "type" "mmx")
22046 (set_attr "memory" "unknown")])
22048 (define_insn "ldmxcsr"
22049 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
22053 [(set_attr "type" "sse")
22054 (set_attr "memory" "load")])
22056 (define_insn "stmxcsr"
22057 [(set (match_operand:SI 0 "memory_operand" "=m")
22058 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
22061 [(set_attr "type" "sse")
22062 (set_attr "memory" "store")])
22064 (define_expand "sfence"
22065 [(set (match_dup 0)
22066 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
22067 "TARGET_SSE || TARGET_3DNOW_A"
22069 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
22070 MEM_VOLATILE_P (operands[0]) = 1;
22073 (define_insn "*sfence_insn"
22074 [(set (match_operand:BLK 0 "" "")
22075 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
22076 "TARGET_SSE || TARGET_3DNOW_A"
22078 [(set_attr "type" "sse")
22079 (set_attr "memory" "unknown")])
22081 (define_expand "sse_prologue_save"
22082 [(parallel [(set (match_operand:BLK 0 "" "")
22083 (unspec:BLK [(reg:DI 21)
22090 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
22091 (use (match_operand:DI 1 "register_operand" ""))
22092 (use (match_operand:DI 2 "immediate_operand" ""))
22093 (use (label_ref:DI (match_operand 3 "" "")))])]
22097 (define_insn "*sse_prologue_save_insn"
22098 [(set (mem:BLK (plus:DI (match_operand:DI 0 "register_operand" "R")
22099 (match_operand:DI 4 "const_int_operand" "n")))
22100 (unspec:BLK [(reg:DI 21)
22107 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
22108 (use (match_operand:DI 1 "register_operand" "r"))
22109 (use (match_operand:DI 2 "const_int_operand" "i"))
22110 (use (label_ref:DI (match_operand 3 "" "X")))]
22112 && INTVAL (operands[4]) + SSE_REGPARM_MAX * 16 - 16 < 128
22113 && INTVAL (operands[4]) + INTVAL (operands[2]) * 16 >= -128"
22117 operands[0] = gen_rtx_MEM (Pmode,
22118 gen_rtx_PLUS (Pmode, operands[0], operands[4]));
22119 output_asm_insn (\"jmp\\t%A1\", operands);
22120 for (i = SSE_REGPARM_MAX - 1; i >= INTVAL (operands[2]); i--)
22122 operands[4] = adjust_address (operands[0], DImode, i*16);
22123 operands[5] = gen_rtx_REG (TImode, SSE_REGNO (i));
22124 PUT_MODE (operands[4], TImode);
22125 if (GET_CODE (XEXP (operands[0], 0)) != PLUS)
22126 output_asm_insn (\"rex\", operands);
22127 output_asm_insn (\"movaps\\t{%5, %4|%4, %5}\", operands);
22129 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
22130 CODE_LABEL_NUMBER (operands[3]));
22134 [(set_attr "type" "other")
22135 (set_attr "length_immediate" "0")
22136 (set_attr "length_address" "0")
22137 (set_attr "length" "135")
22138 (set_attr "memory" "store")
22139 (set_attr "modrm" "0")
22140 (set_attr "mode" "DI")])
22142 ;; 3Dnow! instructions
22144 (define_insn "addv2sf3"
22145 [(set (match_operand:V2SF 0 "register_operand" "=y")
22146 (plus:V2SF (match_operand:V2SF 1 "register_operand" "0")
22147 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22149 "pfadd\\t{%2, %0|%0, %2}"
22150 [(set_attr "type" "mmxadd")
22151 (set_attr "mode" "V2SF")])
22153 (define_insn "subv2sf3"
22154 [(set (match_operand:V2SF 0 "register_operand" "=y")
22155 (minus:V2SF (match_operand:V2SF 1 "register_operand" "0")
22156 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22158 "pfsub\\t{%2, %0|%0, %2}"
22159 [(set_attr "type" "mmxadd")
22160 (set_attr "mode" "V2SF")])
22162 (define_insn "subrv2sf3"
22163 [(set (match_operand:V2SF 0 "register_operand" "=y")
22164 (minus:V2SF (match_operand:V2SF 2 "nonimmediate_operand" "ym")
22165 (match_operand:V2SF 1 "register_operand" "0")))]
22167 "pfsubr\\t{%2, %0|%0, %2}"
22168 [(set_attr "type" "mmxadd")
22169 (set_attr "mode" "V2SF")])
22171 (define_insn "gtv2sf3"
22172 [(set (match_operand:V2SI 0 "register_operand" "=y")
22173 (gt:V2SI (match_operand:V2SF 1 "register_operand" "0")
22174 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22176 "pfcmpgt\\t{%2, %0|%0, %2}"
22177 [(set_attr "type" "mmxcmp")
22178 (set_attr "mode" "V2SF")])
22180 (define_insn "gev2sf3"
22181 [(set (match_operand:V2SI 0 "register_operand" "=y")
22182 (ge:V2SI (match_operand:V2SF 1 "register_operand" "0")
22183 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22185 "pfcmpge\\t{%2, %0|%0, %2}"
22186 [(set_attr "type" "mmxcmp")
22187 (set_attr "mode" "V2SF")])
22189 (define_insn "eqv2sf3"
22190 [(set (match_operand:V2SI 0 "register_operand" "=y")
22191 (eq:V2SI (match_operand:V2SF 1 "register_operand" "0")
22192 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22194 "pfcmpeq\\t{%2, %0|%0, %2}"
22195 [(set_attr "type" "mmxcmp")
22196 (set_attr "mode" "V2SF")])
22198 (define_insn "pfmaxv2sf3"
22199 [(set (match_operand:V2SF 0 "register_operand" "=y")
22200 (smax:V2SF (match_operand:V2SF 1 "register_operand" "0")
22201 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22203 "pfmax\\t{%2, %0|%0, %2}"
22204 [(set_attr "type" "mmxadd")
22205 (set_attr "mode" "V2SF")])
22207 (define_insn "pfminv2sf3"
22208 [(set (match_operand:V2SF 0 "register_operand" "=y")
22209 (smin:V2SF (match_operand:V2SF 1 "register_operand" "0")
22210 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22212 "pfmin\\t{%2, %0|%0, %2}"
22213 [(set_attr "type" "mmxadd")
22214 (set_attr "mode" "V2SF")])
22216 (define_insn "mulv2sf3"
22217 [(set (match_operand:V2SF 0 "register_operand" "=y")
22218 (mult:V2SF (match_operand:V2SF 1 "register_operand" "0")
22219 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22221 "pfmul\\t{%2, %0|%0, %2}"
22222 [(set_attr "type" "mmxmul")
22223 (set_attr "mode" "V2SF")])
22225 (define_insn "femms"
22226 [(unspec_volatile [(const_int 0)] UNSPECV_FEMMS)
22227 (clobber (reg:XF 8))
22228 (clobber (reg:XF 9))
22229 (clobber (reg:XF 10))
22230 (clobber (reg:XF 11))
22231 (clobber (reg:XF 12))
22232 (clobber (reg:XF 13))
22233 (clobber (reg:XF 14))
22234 (clobber (reg:XF 15))
22235 (clobber (reg:DI 29))
22236 (clobber (reg:DI 30))
22237 (clobber (reg:DI 31))
22238 (clobber (reg:DI 32))
22239 (clobber (reg:DI 33))
22240 (clobber (reg:DI 34))
22241 (clobber (reg:DI 35))
22242 (clobber (reg:DI 36))]
22245 [(set_attr "type" "mmx")
22246 (set_attr "memory" "none")])
22248 (define_insn "pf2id"
22249 [(set (match_operand:V2SI 0 "register_operand" "=y")
22250 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
22252 "pf2id\\t{%1, %0|%0, %1}"
22253 [(set_attr "type" "mmxcvt")
22254 (set_attr "mode" "V2SF")])
22256 (define_insn "pf2iw"
22257 [(set (match_operand:V2SI 0 "register_operand" "=y")
22260 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
22262 "pf2iw\\t{%1, %0|%0, %1}"
22263 [(set_attr "type" "mmxcvt")
22264 (set_attr "mode" "V2SF")])
22266 (define_insn "pfacc"
22267 [(set (match_operand:V2SF 0 "register_operand" "=y")
22270 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
22271 (parallel [(const_int 0)]))
22272 (vec_select:SF (match_dup 1)
22273 (parallel [(const_int 1)])))
22275 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
22276 (parallel [(const_int 0)]))
22277 (vec_select:SF (match_dup 2)
22278 (parallel [(const_int 1)])))))]
22280 "pfacc\\t{%2, %0|%0, %2}"
22281 [(set_attr "type" "mmxadd")
22282 (set_attr "mode" "V2SF")])
22284 (define_insn "pfnacc"
22285 [(set (match_operand:V2SF 0 "register_operand" "=y")
22288 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
22289 (parallel [(const_int 0)]))
22290 (vec_select:SF (match_dup 1)
22291 (parallel [(const_int 1)])))
22293 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
22294 (parallel [(const_int 0)]))
22295 (vec_select:SF (match_dup 2)
22296 (parallel [(const_int 1)])))))]
22298 "pfnacc\\t{%2, %0|%0, %2}"
22299 [(set_attr "type" "mmxadd")
22300 (set_attr "mode" "V2SF")])
22302 (define_insn "pfpnacc"
22303 [(set (match_operand:V2SF 0 "register_operand" "=y")
22306 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
22307 (parallel [(const_int 0)]))
22308 (vec_select:SF (match_dup 1)
22309 (parallel [(const_int 1)])))
22311 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
22312 (parallel [(const_int 0)]))
22313 (vec_select:SF (match_dup 2)
22314 (parallel [(const_int 1)])))))]
22316 "pfpnacc\\t{%2, %0|%0, %2}"
22317 [(set_attr "type" "mmxadd")
22318 (set_attr "mode" "V2SF")])
22320 (define_insn "pi2fw"
22321 [(set (match_operand:V2SF 0 "register_operand" "=y")
22326 (vec_select:SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
22327 (parallel [(const_int 0)]))))
22330 (vec_select:SI (match_dup 1)
22331 (parallel [(const_int 1)])))))))]
22333 "pi2fw\\t{%1, %0|%0, %1}"
22334 [(set_attr "type" "mmxcvt")
22335 (set_attr "mode" "V2SF")])
22337 (define_insn "floatv2si2"
22338 [(set (match_operand:V2SF 0 "register_operand" "=y")
22339 (float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
22341 "pi2fd\\t{%1, %0|%0, %1}"
22342 [(set_attr "type" "mmxcvt")
22343 (set_attr "mode" "V2SF")])
22345 ;; This insn is identical to pavgb in operation, but the opcode is
22346 ;; different. To avoid accidentally matching pavgb, use an unspec.
22348 (define_insn "pavgusb"
22349 [(set (match_operand:V8QI 0 "register_operand" "=y")
22351 [(match_operand:V8QI 1 "register_operand" "0")
22352 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
22355 "pavgusb\\t{%2, %0|%0, %2}"
22356 [(set_attr "type" "mmxshft")
22357 (set_attr "mode" "TI")])
22359 ;; 3DNow reciprocal and sqrt
22361 (define_insn "pfrcpv2sf2"
22362 [(set (match_operand:V2SF 0 "register_operand" "=y")
22363 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
22366 "pfrcp\\t{%1, %0|%0, %1}"
22367 [(set_attr "type" "mmx")
22368 (set_attr "mode" "TI")])
22370 (define_insn "pfrcpit1v2sf3"
22371 [(set (match_operand:V2SF 0 "register_operand" "=y")
22372 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
22373 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
22376 "pfrcpit1\\t{%2, %0|%0, %2}"
22377 [(set_attr "type" "mmx")
22378 (set_attr "mode" "TI")])
22380 (define_insn "pfrcpit2v2sf3"
22381 [(set (match_operand:V2SF 0 "register_operand" "=y")
22382 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
22383 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
22386 "pfrcpit2\\t{%2, %0|%0, %2}"
22387 [(set_attr "type" "mmx")
22388 (set_attr "mode" "TI")])
22390 (define_insn "pfrsqrtv2sf2"
22391 [(set (match_operand:V2SF 0 "register_operand" "=y")
22392 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
22395 "pfrsqrt\\t{%1, %0|%0, %1}"
22396 [(set_attr "type" "mmx")
22397 (set_attr "mode" "TI")])
22399 (define_insn "pfrsqit1v2sf3"
22400 [(set (match_operand:V2SF 0 "register_operand" "=y")
22401 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
22402 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
22405 "pfrsqit1\\t{%2, %0|%0, %2}"
22406 [(set_attr "type" "mmx")
22407 (set_attr "mode" "TI")])
22409 (define_insn "pmulhrwv4hi3"
22410 [(set (match_operand:V4HI 0 "register_operand" "=y")
22416 (match_operand:V4HI 1 "register_operand" "0"))
22418 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
22419 (const_vector:V4SI [(const_int 32768)
22422 (const_int 32768)]))
22425 "pmulhrw\\t{%2, %0|%0, %2}"
22426 [(set_attr "type" "mmxmul")
22427 (set_attr "mode" "TI")])
22429 (define_insn "pswapdv2si2"
22430 [(set (match_operand:V2SI 0 "register_operand" "=y")
22431 (vec_select:V2SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
22432 (parallel [(const_int 1) (const_int 0)])))]
22434 "pswapd\\t{%1, %0|%0, %1}"
22435 [(set_attr "type" "mmxcvt")
22436 (set_attr "mode" "TI")])
22438 (define_insn "pswapdv2sf2"
22439 [(set (match_operand:V2SF 0 "register_operand" "=y")
22440 (vec_select:V2SF (match_operand:V2SF 1 "nonimmediate_operand" "ym")
22441 (parallel [(const_int 1) (const_int 0)])))]
22443 "pswapd\\t{%1, %0|%0, %1}"
22444 [(set_attr "type" "mmxcvt")
22445 (set_attr "mode" "TI")])
22447 (define_expand "prefetch"
22448 [(prefetch (match_operand 0 "address_operand" "")
22449 (match_operand:SI 1 "const_int_operand" "")
22450 (match_operand:SI 2 "const_int_operand" ""))]
22451 "TARGET_PREFETCH_SSE || TARGET_3DNOW"
22453 int rw = INTVAL (operands[1]);
22454 int locality = INTVAL (operands[2]);
22456 if (rw != 0 && rw != 1)
22458 if (locality < 0 || locality > 3)
22460 if (GET_MODE (operands[0]) != Pmode && GET_MODE (operands[0]) != VOIDmode)
22463 /* Use 3dNOW prefetch in case we are asking for write prefetch not
22464 suported by SSE counterpart or the SSE prefetch is not available
22465 (K6 machines). Otherwise use SSE prefetch as it allows specifying
22467 if (TARGET_3DNOW && (!TARGET_PREFETCH_SSE || rw))
22468 operands[2] = GEN_INT (3);
22470 operands[1] = const0_rtx;
22473 (define_insn "*prefetch_sse"
22474 [(prefetch (match_operand:SI 0 "address_operand" "p")
22476 (match_operand:SI 1 "const_int_operand" ""))]
22477 "TARGET_PREFETCH_SSE && !TARGET_64BIT"
22479 static const char * const patterns[4] = {
22480 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
22483 int locality = INTVAL (operands[1]);
22484 if (locality < 0 || locality > 3)
22487 return patterns[locality];
22489 [(set_attr "type" "sse")
22490 (set_attr "memory" "none")])
22492 (define_insn "*prefetch_sse_rex"
22493 [(prefetch (match_operand:DI 0 "address_operand" "p")
22495 (match_operand:SI 1 "const_int_operand" ""))]
22496 "TARGET_PREFETCH_SSE && TARGET_64BIT"
22498 static const char * const patterns[4] = {
22499 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
22502 int locality = INTVAL (operands[1]);
22503 if (locality < 0 || locality > 3)
22506 return patterns[locality];
22508 [(set_attr "type" "sse")
22509 (set_attr "memory" "none")])
22511 (define_insn "*prefetch_3dnow"
22512 [(prefetch (match_operand:SI 0 "address_operand" "p")
22513 (match_operand:SI 1 "const_int_operand" "n")
22515 "TARGET_3DNOW && !TARGET_64BIT"
22517 if (INTVAL (operands[1]) == 0)
22518 return "prefetch\t%a0";
22520 return "prefetchw\t%a0";
22522 [(set_attr "type" "mmx")
22523 (set_attr "memory" "none")])
22525 (define_insn "*prefetch_3dnow_rex"
22526 [(prefetch (match_operand:DI 0 "address_operand" "p")
22527 (match_operand:SI 1 "const_int_operand" "n")
22529 "TARGET_3DNOW && TARGET_64BIT"
22531 if (INTVAL (operands[1]) == 0)
22532 return "prefetch\t%a0";
22534 return "prefetchw\t%a0";
22536 [(set_attr "type" "mmx")
22537 (set_attr "memory" "none")])
22541 (define_insn "addv2df3"
22542 [(set (match_operand:V2DF 0 "register_operand" "=x")
22543 (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22544 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22546 "addpd\t{%2, %0|%0, %2}"
22547 [(set_attr "type" "sseadd")
22548 (set_attr "mode" "V2DF")])
22550 (define_insn "vmaddv2df3"
22551 [(set (match_operand:V2DF 0 "register_operand" "=x")
22552 (vec_merge:V2DF (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22553 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22557 "addsd\t{%2, %0|%0, %2}"
22558 [(set_attr "type" "sseadd")
22559 (set_attr "mode" "DF")])
22561 (define_insn "subv2df3"
22562 [(set (match_operand:V2DF 0 "register_operand" "=x")
22563 (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22564 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22566 "subpd\t{%2, %0|%0, %2}"
22567 [(set_attr "type" "sseadd")
22568 (set_attr "mode" "V2DF")])
22570 (define_insn "vmsubv2df3"
22571 [(set (match_operand:V2DF 0 "register_operand" "=x")
22572 (vec_merge:V2DF (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22573 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22577 "subsd\t{%2, %0|%0, %2}"
22578 [(set_attr "type" "sseadd")
22579 (set_attr "mode" "DF")])
22581 (define_insn "mulv2df3"
22582 [(set (match_operand:V2DF 0 "register_operand" "=x")
22583 (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
22584 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22586 "mulpd\t{%2, %0|%0, %2}"
22587 [(set_attr "type" "ssemul")
22588 (set_attr "mode" "V2DF")])
22590 (define_insn "vmmulv2df3"
22591 [(set (match_operand:V2DF 0 "register_operand" "=x")
22592 (vec_merge:V2DF (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
22593 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22597 "mulsd\t{%2, %0|%0, %2}"
22598 [(set_attr "type" "ssemul")
22599 (set_attr "mode" "DF")])
22601 (define_insn "divv2df3"
22602 [(set (match_operand:V2DF 0 "register_operand" "=x")
22603 (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
22604 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22606 "divpd\t{%2, %0|%0, %2}"
22607 [(set_attr "type" "ssediv")
22608 (set_attr "mode" "V2DF")])
22610 (define_insn "vmdivv2df3"
22611 [(set (match_operand:V2DF 0 "register_operand" "=x")
22612 (vec_merge:V2DF (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
22613 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22617 "divsd\t{%2, %0|%0, %2}"
22618 [(set_attr "type" "ssediv")
22619 (set_attr "mode" "DF")])
22623 (define_insn "smaxv2df3"
22624 [(set (match_operand:V2DF 0 "register_operand" "=x")
22625 (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
22626 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22628 "maxpd\t{%2, %0|%0, %2}"
22629 [(set_attr "type" "sseadd")
22630 (set_attr "mode" "V2DF")])
22632 (define_insn "vmsmaxv2df3"
22633 [(set (match_operand:V2DF 0 "register_operand" "=x")
22634 (vec_merge:V2DF (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
22635 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22639 "maxsd\t{%2, %0|%0, %2}"
22640 [(set_attr "type" "sseadd")
22641 (set_attr "mode" "DF")])
22643 (define_insn "sminv2df3"
22644 [(set (match_operand:V2DF 0 "register_operand" "=x")
22645 (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
22646 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22648 "minpd\t{%2, %0|%0, %2}"
22649 [(set_attr "type" "sseadd")
22650 (set_attr "mode" "V2DF")])
22652 (define_insn "vmsminv2df3"
22653 [(set (match_operand:V2DF 0 "register_operand" "=x")
22654 (vec_merge:V2DF (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
22655 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22659 "minsd\t{%2, %0|%0, %2}"
22660 [(set_attr "type" "sseadd")
22661 (set_attr "mode" "DF")])
22662 ;; SSE2 square root. There doesn't appear to be an extension for the
22663 ;; reciprocal/rsqrt instructions if the Intel manual is to be believed.
22665 (define_insn "sqrtv2df2"
22666 [(set (match_operand:V2DF 0 "register_operand" "=x")
22667 (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm")))]
22669 "sqrtpd\t{%1, %0|%0, %1}"
22670 [(set_attr "type" "sse")
22671 (set_attr "mode" "V2DF")])
22673 (define_insn "vmsqrtv2df2"
22674 [(set (match_operand:V2DF 0 "register_operand" "=x")
22675 (vec_merge:V2DF (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm"))
22676 (match_operand:V2DF 2 "register_operand" "0")
22679 "sqrtsd\t{%1, %0|%0, %1}"
22680 [(set_attr "type" "sse")
22681 (set_attr "mode" "SF")])
22683 ;; SSE mask-generating compares
22685 (define_insn "maskcmpv2df3"
22686 [(set (match_operand:V2DI 0 "register_operand" "=x")
22687 (match_operator:V2DI 3 "sse_comparison_operator"
22688 [(match_operand:V2DF 1 "register_operand" "0")
22689 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))]
22691 "cmp%D3pd\t{%2, %0|%0, %2}"
22692 [(set_attr "type" "ssecmp")
22693 (set_attr "mode" "V2DF")])
22695 (define_insn "maskncmpv2df3"
22696 [(set (match_operand:V2DI 0 "register_operand" "=x")
22698 (match_operator:V2DI 3 "sse_comparison_operator"
22699 [(match_operand:V2DF 1 "register_operand" "0")
22700 (match_operand:V2DF 2 "nonimmediate_operand" "x")])))]
22703 if (GET_CODE (operands[3]) == UNORDERED)
22704 return "cmpordps\t{%2, %0|%0, %2}";
22706 return "cmpn%D3pd\t{%2, %0|%0, %2}";
22708 [(set_attr "type" "ssecmp")
22709 (set_attr "mode" "V2DF")])
22711 (define_insn "vmmaskcmpv2df3"
22712 [(set (match_operand:V2DI 0 "register_operand" "=x")
22714 (match_operator:V2DI 3 "sse_comparison_operator"
22715 [(match_operand:V2DF 1 "register_operand" "0")
22716 (match_operand:V2DF 2 "nonimmediate_operand" "x")])
22717 (subreg:V2DI (match_dup 1) 0)
22720 "cmp%D3sd\t{%2, %0|%0, %2}"
22721 [(set_attr "type" "ssecmp")
22722 (set_attr "mode" "DF")])
22724 (define_insn "vmmaskncmpv2df3"
22725 [(set (match_operand:V2DI 0 "register_operand" "=x")
22728 (match_operator:V2DI 3 "sse_comparison_operator"
22729 [(match_operand:V2DF 1 "register_operand" "0")
22730 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))
22731 (subreg:V2DI (match_dup 1) 0)
22735 if (GET_CODE (operands[3]) == UNORDERED)
22736 return "cmpordsd\t{%2, %0|%0, %2}";
22738 return "cmpn%D3sd\t{%2, %0|%0, %2}";
22740 [(set_attr "type" "ssecmp")
22741 (set_attr "mode" "DF")])
22743 (define_insn "sse2_comi"
22744 [(set (reg:CCFP FLAGS_REG)
22745 (compare:CCFP (vec_select:DF
22746 (match_operand:V2DF 0 "register_operand" "x")
22747 (parallel [(const_int 0)]))
22749 (match_operand:V2DF 1 "register_operand" "x")
22750 (parallel [(const_int 0)]))))]
22752 "comisd\t{%1, %0|%0, %1}"
22753 [(set_attr "type" "ssecomi")
22754 (set_attr "mode" "DF")])
22756 (define_insn "sse2_ucomi"
22757 [(set (reg:CCFPU FLAGS_REG)
22758 (compare:CCFPU (vec_select:DF
22759 (match_operand:V2DF 0 "register_operand" "x")
22760 (parallel [(const_int 0)]))
22762 (match_operand:V2DF 1 "register_operand" "x")
22763 (parallel [(const_int 0)]))))]
22765 "ucomisd\t{%1, %0|%0, %1}"
22766 [(set_attr "type" "ssecomi")
22767 (set_attr "mode" "DF")])
22769 ;; SSE Strange Moves.
22771 (define_insn "sse2_movmskpd"
22772 [(set (match_operand:SI 0 "register_operand" "=r")
22773 (unspec:SI [(match_operand:V2DF 1 "register_operand" "x")]
22776 "movmskpd\t{%1, %0|%0, %1}"
22777 [(set_attr "type" "ssecvt")
22778 (set_attr "mode" "V2DF")])
22780 (define_insn "sse2_pmovmskb"
22781 [(set (match_operand:SI 0 "register_operand" "=r")
22782 (unspec:SI [(match_operand:V16QI 1 "register_operand" "x")]
22785 "pmovmskb\t{%1, %0|%0, %1}"
22786 [(set_attr "type" "ssecvt")
22787 (set_attr "mode" "V2DF")])
22789 (define_insn "sse2_maskmovdqu"
22790 [(set (mem:V16QI (match_operand:SI 0 "register_operand" "D"))
22791 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
22792 (match_operand:V16QI 2 "register_operand" "x")]
22795 ;; @@@ check ordering of operands in intel/nonintel syntax
22796 "maskmovdqu\t{%2, %1|%1, %2}"
22797 [(set_attr "type" "ssecvt")
22798 (set_attr "mode" "TI")])
22800 (define_insn "sse2_maskmovdqu_rex64"
22801 [(set (mem:V16QI (match_operand:DI 0 "register_operand" "D"))
22802 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
22803 (match_operand:V16QI 2 "register_operand" "x")]
22806 ;; @@@ check ordering of operands in intel/nonintel syntax
22807 "maskmovdqu\t{%2, %1|%1, %2}"
22808 [(set_attr "type" "ssecvt")
22809 (set_attr "mode" "TI")])
22811 (define_insn "sse2_movntv2df"
22812 [(set (match_operand:V2DF 0 "memory_operand" "=m")
22813 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")]
22816 "movntpd\t{%1, %0|%0, %1}"
22817 [(set_attr "type" "ssecvt")
22818 (set_attr "mode" "V2DF")])
22820 (define_insn "sse2_movntv2di"
22821 [(set (match_operand:V2DI 0 "memory_operand" "=m")
22822 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "x")]
22825 "movntdq\t{%1, %0|%0, %1}"
22826 [(set_attr "type" "ssecvt")
22827 (set_attr "mode" "TI")])
22829 (define_insn "sse2_movntsi"
22830 [(set (match_operand:SI 0 "memory_operand" "=m")
22831 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
22834 "movnti\t{%1, %0|%0, %1}"
22835 [(set_attr "type" "ssecvt")
22836 (set_attr "mode" "V2DF")])
22838 ;; SSE <-> integer/MMX conversions
22840 ;; Conversions between SI and SF
22842 (define_insn "cvtdq2ps"
22843 [(set (match_operand:V4SF 0 "register_operand" "=x")
22844 (float:V4SF (match_operand:V4SI 1 "nonimmediate_operand" "xm")))]
22846 "cvtdq2ps\t{%1, %0|%0, %1}"
22847 [(set_attr "type" "ssecvt")
22848 (set_attr "mode" "V2DF")])
22850 (define_insn "cvtps2dq"
22851 [(set (match_operand:V4SI 0 "register_operand" "=x")
22852 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
22854 "cvtps2dq\t{%1, %0|%0, %1}"
22855 [(set_attr "type" "ssecvt")
22856 (set_attr "mode" "TI")])
22858 (define_insn "cvttps2dq"
22859 [(set (match_operand:V4SI 0 "register_operand" "=x")
22860 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
22863 "cvttps2dq\t{%1, %0|%0, %1}"
22864 [(set_attr "type" "ssecvt")
22865 (set_attr "mode" "TI")])
22867 ;; Conversions between SI and DF
22869 (define_insn "cvtdq2pd"
22870 [(set (match_operand:V2DF 0 "register_operand" "=x")
22871 (float:V2DF (vec_select:V2SI
22872 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
22875 (const_int 1)]))))]
22877 "cvtdq2pd\t{%1, %0|%0, %1}"
22878 [(set_attr "type" "ssecvt")
22879 (set_attr "mode" "V2DF")])
22881 (define_insn "cvtpd2dq"
22882 [(set (match_operand:V4SI 0 "register_operand" "=x")
22884 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm"))
22885 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
22887 "cvtpd2dq\t{%1, %0|%0, %1}"
22888 [(set_attr "type" "ssecvt")
22889 (set_attr "mode" "TI")])
22891 (define_insn "cvttpd2dq"
22892 [(set (match_operand:V4SI 0 "register_operand" "=x")
22894 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
22896 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
22898 "cvttpd2dq\t{%1, %0|%0, %1}"
22899 [(set_attr "type" "ssecvt")
22900 (set_attr "mode" "TI")])
22902 (define_insn "cvtpd2pi"
22903 [(set (match_operand:V2SI 0 "register_operand" "=y")
22904 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
22906 "cvtpd2pi\t{%1, %0|%0, %1}"
22907 [(set_attr "type" "ssecvt")
22908 (set_attr "mode" "TI")])
22910 (define_insn "cvttpd2pi"
22911 [(set (match_operand:V2SI 0 "register_operand" "=y")
22912 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
22915 "cvttpd2pi\t{%1, %0|%0, %1}"
22916 [(set_attr "type" "ssecvt")
22917 (set_attr "mode" "TI")])
22919 (define_insn "cvtpi2pd"
22920 [(set (match_operand:V2DF 0 "register_operand" "=x")
22921 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
22923 "cvtpi2pd\t{%1, %0|%0, %1}"
22924 [(set_attr "type" "ssecvt")
22925 (set_attr "mode" "TI")])
22927 ;; Conversions between SI and DF
22929 (define_insn "cvtsd2si"
22930 [(set (match_operand:SI 0 "register_operand" "=r,r")
22931 (fix:SI (vec_select:DF (match_operand:V2DF 1 "register_operand" "x,m")
22932 (parallel [(const_int 0)]))))]
22934 "cvtsd2si\t{%1, %0|%0, %1}"
22935 [(set_attr "type" "sseicvt")
22936 (set_attr "athlon_decode" "double,vector")
22937 (set_attr "mode" "SI")])
22939 (define_insn "cvtsd2siq"
22940 [(set (match_operand:DI 0 "register_operand" "=r,r")
22941 (fix:DI (vec_select:DF (match_operand:V2DF 1 "register_operand" "x,m")
22942 (parallel [(const_int 0)]))))]
22943 "TARGET_SSE2 && TARGET_64BIT"
22944 "cvtsd2siq\t{%1, %0|%0, %1}"
22945 [(set_attr "type" "sseicvt")
22946 (set_attr "athlon_decode" "double,vector")
22947 (set_attr "mode" "DI")])
22949 (define_insn "cvttsd2si"
22950 [(set (match_operand:SI 0 "register_operand" "=r,r")
22951 (unspec:SI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "x,xm")
22952 (parallel [(const_int 0)]))] UNSPEC_FIX))]
22954 "cvttsd2si\t{%1, %0|%0, %1}"
22955 [(set_attr "type" "sseicvt")
22956 (set_attr "mode" "SI")
22957 (set_attr "athlon_decode" "double,vector")])
22959 (define_insn "cvttsd2siq"
22960 [(set (match_operand:DI 0 "register_operand" "=r,r")
22961 (unspec:DI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "x,xm")
22962 (parallel [(const_int 0)]))] UNSPEC_FIX))]
22963 "TARGET_SSE2 && TARGET_64BIT"
22964 "cvttsd2siq\t{%1, %0|%0, %1}"
22965 [(set_attr "type" "sseicvt")
22966 (set_attr "mode" "DI")
22967 (set_attr "athlon_decode" "double,vector")])
22969 (define_insn "cvtsi2sd"
22970 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
22971 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0,0")
22972 (vec_duplicate:V2DF
22974 (match_operand:SI 2 "nonimmediate_operand" "r,rm")))
22977 "cvtsi2sd\t{%2, %0|%0, %2}"
22978 [(set_attr "type" "sseicvt")
22979 (set_attr "mode" "DF")
22980 (set_attr "athlon_decode" "double,direct")])
22982 (define_insn "cvtsi2sdq"
22983 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
22984 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0,0")
22985 (vec_duplicate:V2DF
22987 (match_operand:DI 2 "nonimmediate_operand" "r,rm")))
22989 "TARGET_SSE2 && TARGET_64BIT"
22990 "cvtsi2sdq\t{%2, %0|%0, %2}"
22991 [(set_attr "type" "sseicvt")
22992 (set_attr "mode" "DF")
22993 (set_attr "athlon_decode" "double,direct")])
22995 ;; Conversions between SF and DF
22997 (define_insn "cvtsd2ss"
22998 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
22999 (vec_merge:V4SF (match_operand:V4SF 1 "register_operand" "0,0")
23000 (vec_duplicate:V4SF
23001 (float_truncate:V2SF
23002 (match_operand:V2DF 2 "nonimmediate_operand" "x,xm")))
23005 "cvtsd2ss\t{%2, %0|%0, %2}"
23006 [(set_attr "type" "ssecvt")
23007 (set_attr "athlon_decode" "vector,double")
23008 (set_attr "mode" "SF")])
23010 (define_insn "cvtss2sd"
23011 [(set (match_operand:V2DF 0 "register_operand" "=x")
23012 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0")
23015 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
23016 (parallel [(const_int 0)
23020 "cvtss2sd\t{%2, %0|%0, %2}"
23021 [(set_attr "type" "ssecvt")
23022 (set_attr "mode" "DF")])
23024 (define_insn "cvtpd2ps"
23025 [(set (match_operand:V4SF 0 "register_operand" "=x")
23028 (subreg:V2SI (float_truncate:V2SF
23029 (match_operand:V2DF 1 "nonimmediate_operand" "xm")) 0)
23030 (const_vector:V2SI [(const_int 0) (const_int 0)])) 0))]
23032 "cvtpd2ps\t{%1, %0|%0, %1}"
23033 [(set_attr "type" "ssecvt")
23034 (set_attr "mode" "V4SF")])
23036 (define_insn "cvtps2pd"
23037 [(set (match_operand:V2DF 0 "register_operand" "=x")
23039 (vec_select:V2SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")
23040 (parallel [(const_int 0)
23041 (const_int 1)]))))]
23043 "cvtps2pd\t{%1, %0|%0, %1}"
23044 [(set_attr "type" "ssecvt")
23045 (set_attr "mode" "V2DF")])
23047 ;; SSE2 variants of MMX insns
23051 (define_insn "addv16qi3"
23052 [(set (match_operand:V16QI 0 "register_operand" "=x")
23053 (plus:V16QI (match_operand:V16QI 1 "register_operand" "%0")
23054 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23056 "paddb\t{%2, %0|%0, %2}"
23057 [(set_attr "type" "sseiadd")
23058 (set_attr "mode" "TI")])
23060 (define_insn "addv8hi3"
23061 [(set (match_operand:V8HI 0 "register_operand" "=x")
23062 (plus:V8HI (match_operand:V8HI 1 "register_operand" "%0")
23063 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23065 "paddw\t{%2, %0|%0, %2}"
23066 [(set_attr "type" "sseiadd")
23067 (set_attr "mode" "TI")])
23069 (define_insn "addv4si3"
23070 [(set (match_operand:V4SI 0 "register_operand" "=x")
23071 (plus:V4SI (match_operand:V4SI 1 "register_operand" "%0")
23072 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23074 "paddd\t{%2, %0|%0, %2}"
23075 [(set_attr "type" "sseiadd")
23076 (set_attr "mode" "TI")])
23078 (define_insn "addv2di3"
23079 [(set (match_operand:V2DI 0 "register_operand" "=x")
23080 (plus:V2DI (match_operand:V2DI 1 "register_operand" "%0")
23081 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
23083 "paddq\t{%2, %0|%0, %2}"
23084 [(set_attr "type" "sseiadd")
23085 (set_attr "mode" "TI")])
23087 (define_insn "ssaddv16qi3"
23088 [(set (match_operand:V16QI 0 "register_operand" "=x")
23089 (ss_plus:V16QI (match_operand:V16QI 1 "register_operand" "%0")
23090 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23092 "paddsb\t{%2, %0|%0, %2}"
23093 [(set_attr "type" "sseiadd")
23094 (set_attr "mode" "TI")])
23096 (define_insn "ssaddv8hi3"
23097 [(set (match_operand:V8HI 0 "register_operand" "=x")
23098 (ss_plus:V8HI (match_operand:V8HI 1 "register_operand" "%0")
23099 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23101 "paddsw\t{%2, %0|%0, %2}"
23102 [(set_attr "type" "sseiadd")
23103 (set_attr "mode" "TI")])
23105 (define_insn "usaddv16qi3"
23106 [(set (match_operand:V16QI 0 "register_operand" "=x")
23107 (us_plus:V16QI (match_operand:V16QI 1 "register_operand" "%0")
23108 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23110 "paddusb\t{%2, %0|%0, %2}"
23111 [(set_attr "type" "sseiadd")
23112 (set_attr "mode" "TI")])
23114 (define_insn "usaddv8hi3"
23115 [(set (match_operand:V8HI 0 "register_operand" "=x")
23116 (us_plus:V8HI (match_operand:V8HI 1 "register_operand" "%0")
23117 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23119 "paddusw\t{%2, %0|%0, %2}"
23120 [(set_attr "type" "sseiadd")
23121 (set_attr "mode" "TI")])
23123 (define_insn "subv16qi3"
23124 [(set (match_operand:V16QI 0 "register_operand" "=x")
23125 (minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
23126 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23128 "psubb\t{%2, %0|%0, %2}"
23129 [(set_attr "type" "sseiadd")
23130 (set_attr "mode" "TI")])
23132 (define_insn "subv8hi3"
23133 [(set (match_operand:V8HI 0 "register_operand" "=x")
23134 (minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
23135 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23137 "psubw\t{%2, %0|%0, %2}"
23138 [(set_attr "type" "sseiadd")
23139 (set_attr "mode" "TI")])
23141 (define_insn "subv4si3"
23142 [(set (match_operand:V4SI 0 "register_operand" "=x")
23143 (minus:V4SI (match_operand:V4SI 1 "register_operand" "0")
23144 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23146 "psubd\t{%2, %0|%0, %2}"
23147 [(set_attr "type" "sseiadd")
23148 (set_attr "mode" "TI")])
23150 (define_insn "subv2di3"
23151 [(set (match_operand:V2DI 0 "register_operand" "=x")
23152 (minus:V2DI (match_operand:V2DI 1 "register_operand" "0")
23153 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
23155 "psubq\t{%2, %0|%0, %2}"
23156 [(set_attr "type" "sseiadd")
23157 (set_attr "mode" "TI")])
23159 (define_insn "sssubv16qi3"
23160 [(set (match_operand:V16QI 0 "register_operand" "=x")
23161 (ss_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
23162 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23164 "psubsb\t{%2, %0|%0, %2}"
23165 [(set_attr "type" "sseiadd")
23166 (set_attr "mode" "TI")])
23168 (define_insn "sssubv8hi3"
23169 [(set (match_operand:V8HI 0 "register_operand" "=x")
23170 (ss_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
23171 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23173 "psubsw\t{%2, %0|%0, %2}"
23174 [(set_attr "type" "sseiadd")
23175 (set_attr "mode" "TI")])
23177 (define_insn "ussubv16qi3"
23178 [(set (match_operand:V16QI 0 "register_operand" "=x")
23179 (us_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
23180 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23182 "psubusb\t{%2, %0|%0, %2}"
23183 [(set_attr "type" "sseiadd")
23184 (set_attr "mode" "TI")])
23186 (define_insn "ussubv8hi3"
23187 [(set (match_operand:V8HI 0 "register_operand" "=x")
23188 (us_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
23189 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23191 "psubusw\t{%2, %0|%0, %2}"
23192 [(set_attr "type" "sseiadd")
23193 (set_attr "mode" "TI")])
23195 (define_insn "mulv8hi3"
23196 [(set (match_operand:V8HI 0 "register_operand" "=x")
23197 (mult:V8HI (match_operand:V8HI 1 "register_operand" "0")
23198 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23200 "pmullw\t{%2, %0|%0, %2}"
23201 [(set_attr "type" "sseimul")
23202 (set_attr "mode" "TI")])
23204 (define_insn "smulv8hi3_highpart"
23205 [(set (match_operand:V8HI 0 "register_operand" "=x")
23208 (mult:V8SI (sign_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
23209 (sign_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
23212 "pmulhw\t{%2, %0|%0, %2}"
23213 [(set_attr "type" "sseimul")
23214 (set_attr "mode" "TI")])
23216 (define_insn "umulv8hi3_highpart"
23217 [(set (match_operand:V8HI 0 "register_operand" "=x")
23220 (mult:V8SI (zero_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
23221 (zero_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
23224 "pmulhuw\t{%2, %0|%0, %2}"
23225 [(set_attr "type" "sseimul")
23226 (set_attr "mode" "TI")])
23228 (define_insn "sse2_umulsidi3"
23229 [(set (match_operand:DI 0 "register_operand" "=y")
23230 (mult:DI (zero_extend:DI (vec_select:SI
23231 (match_operand:V2SI 1 "register_operand" "0")
23232 (parallel [(const_int 0)])))
23233 (zero_extend:DI (vec_select:SI
23234 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
23235 (parallel [(const_int 0)])))))]
23237 "pmuludq\t{%2, %0|%0, %2}"
23238 [(set_attr "type" "mmxmul")
23239 (set_attr "mode" "DI")])
23241 (define_insn "sse2_umulv2siv2di3"
23242 [(set (match_operand:V2DI 0 "register_operand" "=x")
23243 (mult:V2DI (zero_extend:V2DI
23245 (match_operand:V4SI 1 "register_operand" "0")
23246 (parallel [(const_int 0) (const_int 2)])))
23249 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
23250 (parallel [(const_int 0) (const_int 2)])))))]
23252 "pmuludq\t{%2, %0|%0, %2}"
23253 [(set_attr "type" "sseimul")
23254 (set_attr "mode" "TI")])
23256 (define_insn "sse2_pmaddwd"
23257 [(set (match_operand:V4SI 0 "register_operand" "=x")
23260 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 1 "register_operand" "0")
23261 (parallel [(const_int 0)
23265 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 2 "nonimmediate_operand" "xm")
23266 (parallel [(const_int 0)
23271 (sign_extend:V4SI (vec_select:V4HI (match_dup 1)
23272 (parallel [(const_int 1)
23276 (sign_extend:V4SI (vec_select:V4HI (match_dup 2)
23277 (parallel [(const_int 1)
23280 (const_int 7)]))))))]
23282 "pmaddwd\t{%2, %0|%0, %2}"
23283 [(set_attr "type" "sseiadd")
23284 (set_attr "mode" "TI")])
23286 ;; Same as pxor, but don't show input operands so that we don't think
23288 (define_insn "sse2_clrti"
23289 [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))]
23292 if (get_attr_mode (insn) == MODE_TI)
23293 return "pxor\t%0, %0";
23295 return "xorps\t%0, %0";
23297 [(set_attr "type" "ssemov")
23298 (set_attr "memory" "none")
23301 (ne (symbol_ref "optimize_size")
23303 (const_string "V4SF")
23304 (const_string "TI")))])
23306 ;; MMX unsigned averages/sum of absolute differences
23308 (define_insn "sse2_uavgv16qi3"
23309 [(set (match_operand:V16QI 0 "register_operand" "=x")
23311 (plus:V16QI (plus:V16QI
23312 (match_operand:V16QI 1 "register_operand" "0")
23313 (match_operand:V16QI 2 "nonimmediate_operand" "xm"))
23314 (const_vector:V16QI [(const_int 1) (const_int 1)
23315 (const_int 1) (const_int 1)
23316 (const_int 1) (const_int 1)
23317 (const_int 1) (const_int 1)
23318 (const_int 1) (const_int 1)
23319 (const_int 1) (const_int 1)
23320 (const_int 1) (const_int 1)
23321 (const_int 1) (const_int 1)]))
23324 "pavgb\t{%2, %0|%0, %2}"
23325 [(set_attr "type" "sseiadd")
23326 (set_attr "mode" "TI")])
23328 (define_insn "sse2_uavgv8hi3"
23329 [(set (match_operand:V8HI 0 "register_operand" "=x")
23331 (plus:V8HI (plus:V8HI
23332 (match_operand:V8HI 1 "register_operand" "0")
23333 (match_operand:V8HI 2 "nonimmediate_operand" "xm"))
23334 (const_vector:V8HI [(const_int 1) (const_int 1)
23335 (const_int 1) (const_int 1)
23336 (const_int 1) (const_int 1)
23337 (const_int 1) (const_int 1)]))
23340 "pavgw\t{%2, %0|%0, %2}"
23341 [(set_attr "type" "sseiadd")
23342 (set_attr "mode" "TI")])
23344 ;; @@@ this isn't the right representation.
23345 (define_insn "sse2_psadbw"
23346 [(set (match_operand:V2DI 0 "register_operand" "=x")
23347 (unspec:V2DI [(match_operand:V16QI 1 "register_operand" "0")
23348 (match_operand:V16QI 2 "nonimmediate_operand" "xm")]
23351 "psadbw\t{%2, %0|%0, %2}"
23352 [(set_attr "type" "sseiadd")
23353 (set_attr "mode" "TI")])
23356 ;; MMX insert/extract/shuffle
23358 (define_insn "sse2_pinsrw"
23359 [(set (match_operand:V8HI 0 "register_operand" "=x")
23360 (vec_merge:V8HI (match_operand:V8HI 1 "register_operand" "0")
23361 (vec_duplicate:V8HI
23363 (match_operand:SI 2 "nonimmediate_operand" "rm")))
23364 (match_operand:SI 3 "const_0_to_255_operand" "N")))]
23366 "pinsrw\t{%3, %2, %0|%0, %2, %3}"
23367 [(set_attr "type" "ssecvt")
23368 (set_attr "mode" "TI")])
23370 (define_insn "sse2_pextrw"
23371 [(set (match_operand:SI 0 "register_operand" "=r")
23373 (vec_select:HI (match_operand:V8HI 1 "register_operand" "x")
23375 [(match_operand:SI 2 "const_0_to_7_operand" "N")]))))]
23377 "pextrw\t{%2, %1, %0|%0, %1, %2}"
23378 [(set_attr "type" "ssecvt")
23379 (set_attr "mode" "TI")])
23381 (define_insn "sse2_pshufd"
23382 [(set (match_operand:V4SI 0 "register_operand" "=x")
23383 (unspec:V4SI [(match_operand:V4SI 1 "nonimmediate_operand" "xm")
23384 (match_operand:SI 2 "immediate_operand" "i")]
23387 "pshufd\t{%2, %1, %0|%0, %1, %2}"
23388 [(set_attr "type" "ssecvt")
23389 (set_attr "mode" "TI")])
23391 (define_insn "sse2_pshuflw"
23392 [(set (match_operand:V8HI 0 "register_operand" "=x")
23393 (unspec:V8HI [(match_operand:V8HI 1 "nonimmediate_operand" "xm")
23394 (match_operand:SI 2 "immediate_operand" "i")]
23397 "pshuflw\t{%2, %1, %0|%0, %1, %2}"
23398 [(set_attr "type" "ssecvt")
23399 (set_attr "mode" "TI")])
23401 (define_insn "sse2_pshufhw"
23402 [(set (match_operand:V8HI 0 "register_operand" "=x")
23403 (unspec:V8HI [(match_operand:V8HI 1 "nonimmediate_operand" "xm")
23404 (match_operand:SI 2 "immediate_operand" "i")]
23407 "pshufhw\t{%2, %1, %0|%0, %1, %2}"
23408 [(set_attr "type" "ssecvt")
23409 (set_attr "mode" "TI")])
23411 ;; MMX mask-generating comparisons
23413 (define_insn "eqv16qi3"
23414 [(set (match_operand:V16QI 0 "register_operand" "=x")
23415 (eq:V16QI (match_operand:V16QI 1 "register_operand" "0")
23416 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23418 "pcmpeqb\t{%2, %0|%0, %2}"
23419 [(set_attr "type" "ssecmp")
23420 (set_attr "mode" "TI")])
23422 (define_insn "eqv8hi3"
23423 [(set (match_operand:V8HI 0 "register_operand" "=x")
23424 (eq:V8HI (match_operand:V8HI 1 "register_operand" "0")
23425 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23427 "pcmpeqw\t{%2, %0|%0, %2}"
23428 [(set_attr "type" "ssecmp")
23429 (set_attr "mode" "TI")])
23431 (define_insn "eqv4si3"
23432 [(set (match_operand:V4SI 0 "register_operand" "=x")
23433 (eq:V4SI (match_operand:V4SI 1 "register_operand" "0")
23434 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23436 "pcmpeqd\t{%2, %0|%0, %2}"
23437 [(set_attr "type" "ssecmp")
23438 (set_attr "mode" "TI")])
23440 (define_insn "gtv16qi3"
23441 [(set (match_operand:V16QI 0 "register_operand" "=x")
23442 (gt:V16QI (match_operand:V16QI 1 "register_operand" "0")
23443 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23445 "pcmpgtb\t{%2, %0|%0, %2}"
23446 [(set_attr "type" "ssecmp")
23447 (set_attr "mode" "TI")])
23449 (define_insn "gtv8hi3"
23450 [(set (match_operand:V8HI 0 "register_operand" "=x")
23451 (gt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23452 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23454 "pcmpgtw\t{%2, %0|%0, %2}"
23455 [(set_attr "type" "ssecmp")
23456 (set_attr "mode" "TI")])
23458 (define_insn "gtv4si3"
23459 [(set (match_operand:V4SI 0 "register_operand" "=x")
23460 (gt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23461 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23463 "pcmpgtd\t{%2, %0|%0, %2}"
23464 [(set_attr "type" "ssecmp")
23465 (set_attr "mode" "TI")])
23468 ;; MMX max/min insns
23470 (define_insn "umaxv16qi3"
23471 [(set (match_operand:V16QI 0 "register_operand" "=x")
23472 (umax:V16QI (match_operand:V16QI 1 "register_operand" "0")
23473 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23475 "pmaxub\t{%2, %0|%0, %2}"
23476 [(set_attr "type" "sseiadd")
23477 (set_attr "mode" "TI")])
23479 (define_insn "smaxv8hi3"
23480 [(set (match_operand:V8HI 0 "register_operand" "=x")
23481 (smax:V8HI (match_operand:V8HI 1 "register_operand" "0")
23482 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23484 "pmaxsw\t{%2, %0|%0, %2}"
23485 [(set_attr "type" "sseiadd")
23486 (set_attr "mode" "TI")])
23488 (define_insn "uminv16qi3"
23489 [(set (match_operand:V16QI 0 "register_operand" "=x")
23490 (umin:V16QI (match_operand:V16QI 1 "register_operand" "0")
23491 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23493 "pminub\t{%2, %0|%0, %2}"
23494 [(set_attr "type" "sseiadd")
23495 (set_attr "mode" "TI")])
23497 (define_insn "sminv8hi3"
23498 [(set (match_operand:V8HI 0 "register_operand" "=x")
23499 (smin:V8HI (match_operand:V8HI 1 "register_operand" "0")
23500 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23502 "pminsw\t{%2, %0|%0, %2}"
23503 [(set_attr "type" "sseiadd")
23504 (set_attr "mode" "TI")])
23509 (define_insn "ashrv8hi3"
23510 [(set (match_operand:V8HI 0 "register_operand" "=x")
23511 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23512 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23514 "psraw\t{%2, %0|%0, %2}"
23515 [(set_attr "type" "sseishft")
23516 (set_attr "mode" "TI")])
23518 (define_insn "ashrv4si3"
23519 [(set (match_operand:V4SI 0 "register_operand" "=x")
23520 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23521 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23523 "psrad\t{%2, %0|%0, %2}"
23524 [(set_attr "type" "sseishft")
23525 (set_attr "mode" "TI")])
23527 (define_insn "lshrv8hi3"
23528 [(set (match_operand:V8HI 0 "register_operand" "=x")
23529 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23530 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23532 "psrlw\t{%2, %0|%0, %2}"
23533 [(set_attr "type" "sseishft")
23534 (set_attr "mode" "TI")])
23536 (define_insn "lshrv4si3"
23537 [(set (match_operand:V4SI 0 "register_operand" "=x")
23538 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23539 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23541 "psrld\t{%2, %0|%0, %2}"
23542 [(set_attr "type" "sseishft")
23543 (set_attr "mode" "TI")])
23545 (define_insn "lshrv2di3"
23546 [(set (match_operand:V2DI 0 "register_operand" "=x")
23547 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
23548 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23550 "psrlq\t{%2, %0|%0, %2}"
23551 [(set_attr "type" "sseishft")
23552 (set_attr "mode" "TI")])
23554 (define_insn "ashlv8hi3"
23555 [(set (match_operand:V8HI 0 "register_operand" "=x")
23556 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
23557 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23559 "psllw\t{%2, %0|%0, %2}"
23560 [(set_attr "type" "sseishft")
23561 (set_attr "mode" "TI")])
23563 (define_insn "ashlv4si3"
23564 [(set (match_operand:V4SI 0 "register_operand" "=x")
23565 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
23566 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23568 "pslld\t{%2, %0|%0, %2}"
23569 [(set_attr "type" "sseishft")
23570 (set_attr "mode" "TI")])
23572 (define_insn "ashlv2di3"
23573 [(set (match_operand:V2DI 0 "register_operand" "=x")
23574 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
23575 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23577 "psllq\t{%2, %0|%0, %2}"
23578 [(set_attr "type" "sseishft")
23579 (set_attr "mode" "TI")])
23581 (define_insn "ashrv8hi3_ti"
23582 [(set (match_operand:V8HI 0 "register_operand" "=x")
23583 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23584 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23586 "psraw\t{%2, %0|%0, %2}"
23587 [(set_attr "type" "sseishft")
23588 (set_attr "mode" "TI")])
23590 (define_insn "ashrv4si3_ti"
23591 [(set (match_operand:V4SI 0 "register_operand" "=x")
23592 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23593 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23595 "psrad\t{%2, %0|%0, %2}"
23596 [(set_attr "type" "sseishft")
23597 (set_attr "mode" "TI")])
23599 (define_insn "lshrv8hi3_ti"
23600 [(set (match_operand:V8HI 0 "register_operand" "=x")
23601 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23602 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23604 "psrlw\t{%2, %0|%0, %2}"
23605 [(set_attr "type" "sseishft")
23606 (set_attr "mode" "TI")])
23608 (define_insn "lshrv4si3_ti"
23609 [(set (match_operand:V4SI 0 "register_operand" "=x")
23610 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23611 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23613 "psrld\t{%2, %0|%0, %2}"
23614 [(set_attr "type" "sseishft")
23615 (set_attr "mode" "TI")])
23617 (define_insn "lshrv2di3_ti"
23618 [(set (match_operand:V2DI 0 "register_operand" "=x")
23619 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
23620 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23622 "psrlq\t{%2, %0|%0, %2}"
23623 [(set_attr "type" "sseishft")
23624 (set_attr "mode" "TI")])
23626 (define_insn "ashlv8hi3_ti"
23627 [(set (match_operand:V8HI 0 "register_operand" "=x")
23628 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
23629 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23631 "psllw\t{%2, %0|%0, %2}"
23632 [(set_attr "type" "sseishft")
23633 (set_attr "mode" "TI")])
23635 (define_insn "ashlv4si3_ti"
23636 [(set (match_operand:V4SI 0 "register_operand" "=x")
23637 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
23638 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23640 "pslld\t{%2, %0|%0, %2}"
23641 [(set_attr "type" "sseishft")
23642 (set_attr "mode" "TI")])
23644 (define_insn "ashlv2di3_ti"
23645 [(set (match_operand:V2DI 0 "register_operand" "=x")
23646 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
23647 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23649 "psllq\t{%2, %0|%0, %2}"
23650 [(set_attr "type" "sseishft")
23651 (set_attr "mode" "TI")])
23653 ;; See logical MMX insns for the reason for the unspec. Strictly speaking
23654 ;; we wouldn't need here it since we never generate TImode arithmetic.
23656 ;; There has to be some kind of prize for the weirdest new instruction...
23657 (define_insn "sse2_ashlti3"
23658 [(set (match_operand:TI 0 "register_operand" "=x")
23660 [(ashift:TI (match_operand:TI 1 "register_operand" "0")
23661 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
23662 (const_int 8)))] UNSPEC_NOP))]
23664 "pslldq\t{%2, %0|%0, %2}"
23665 [(set_attr "type" "sseishft")
23666 (set_attr "mode" "TI")])
23668 (define_insn "sse2_lshrti3"
23669 [(set (match_operand:TI 0 "register_operand" "=x")
23671 [(lshiftrt:TI (match_operand:TI 1 "register_operand" "0")
23672 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
23673 (const_int 8)))] UNSPEC_NOP))]
23675 "psrldq\t{%2, %0|%0, %2}"
23676 [(set_attr "type" "sseishft")
23677 (set_attr "mode" "TI")])
23681 (define_insn "sse2_unpckhpd"
23682 [(set (match_operand:V2DF 0 "register_operand" "=x")
23684 (vec_select:DF (match_operand:V2DF 1 "register_operand" "0")
23685 (parallel [(const_int 1)]))
23686 (vec_select:DF (match_operand:V2DF 2 "register_operand" "x")
23687 (parallel [(const_int 1)]))))]
23689 "unpckhpd\t{%2, %0|%0, %2}"
23690 [(set_attr "type" "ssecvt")
23691 (set_attr "mode" "V2DF")])
23693 (define_insn "sse2_unpcklpd"
23694 [(set (match_operand:V2DF 0 "register_operand" "=x")
23696 (vec_select:DF (match_operand:V2DF 1 "register_operand" "0")
23697 (parallel [(const_int 0)]))
23698 (vec_select:DF (match_operand:V2DF 2 "register_operand" "x")
23699 (parallel [(const_int 0)]))))]
23701 "unpcklpd\t{%2, %0|%0, %2}"
23702 [(set_attr "type" "ssecvt")
23703 (set_attr "mode" "V2DF")])
23705 ;; MMX pack/unpack insns.
23707 (define_insn "sse2_packsswb"
23708 [(set (match_operand:V16QI 0 "register_operand" "=x")
23710 (ss_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
23711 (ss_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
23713 "packsswb\t{%2, %0|%0, %2}"
23714 [(set_attr "type" "ssecvt")
23715 (set_attr "mode" "TI")])
23717 (define_insn "sse2_packssdw"
23718 [(set (match_operand:V8HI 0 "register_operand" "=x")
23720 (ss_truncate:V4HI (match_operand:V4SI 1 "register_operand" "0"))
23721 (ss_truncate:V4HI (match_operand:V4SI 2 "register_operand" "x"))))]
23723 "packssdw\t{%2, %0|%0, %2}"
23724 [(set_attr "type" "ssecvt")
23725 (set_attr "mode" "TI")])
23727 (define_insn "sse2_packuswb"
23728 [(set (match_operand:V16QI 0 "register_operand" "=x")
23730 (us_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
23731 (us_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
23733 "packuswb\t{%2, %0|%0, %2}"
23734 [(set_attr "type" "ssecvt")
23735 (set_attr "mode" "TI")])
23737 (define_insn "sse2_punpckhbw"
23738 [(set (match_operand:V16QI 0 "register_operand" "=x")
23740 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
23741 (parallel [(const_int 8) (const_int 0)
23742 (const_int 9) (const_int 1)
23743 (const_int 10) (const_int 2)
23744 (const_int 11) (const_int 3)
23745 (const_int 12) (const_int 4)
23746 (const_int 13) (const_int 5)
23747 (const_int 14) (const_int 6)
23748 (const_int 15) (const_int 7)]))
23749 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
23750 (parallel [(const_int 0) (const_int 8)
23751 (const_int 1) (const_int 9)
23752 (const_int 2) (const_int 10)
23753 (const_int 3) (const_int 11)
23754 (const_int 4) (const_int 12)
23755 (const_int 5) (const_int 13)
23756 (const_int 6) (const_int 14)
23757 (const_int 7) (const_int 15)]))
23758 (const_int 21845)))]
23760 "punpckhbw\t{%2, %0|%0, %2}"
23761 [(set_attr "type" "ssecvt")
23762 (set_attr "mode" "TI")])
23764 (define_insn "sse2_punpckhwd"
23765 [(set (match_operand:V8HI 0 "register_operand" "=x")
23767 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
23768 (parallel [(const_int 4) (const_int 0)
23769 (const_int 5) (const_int 1)
23770 (const_int 6) (const_int 2)
23771 (const_int 7) (const_int 3)]))
23772 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
23773 (parallel [(const_int 0) (const_int 4)
23774 (const_int 1) (const_int 5)
23775 (const_int 2) (const_int 6)
23776 (const_int 3) (const_int 7)]))
23779 "punpckhwd\t{%2, %0|%0, %2}"
23780 [(set_attr "type" "ssecvt")
23781 (set_attr "mode" "TI")])
23783 (define_insn "sse2_punpckhdq"
23784 [(set (match_operand:V4SI 0 "register_operand" "=x")
23786 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
23787 (parallel [(const_int 2) (const_int 0)
23788 (const_int 3) (const_int 1)]))
23789 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
23790 (parallel [(const_int 0) (const_int 2)
23791 (const_int 1) (const_int 3)]))
23794 "punpckhdq\t{%2, %0|%0, %2}"
23795 [(set_attr "type" "ssecvt")
23796 (set_attr "mode" "TI")])
23798 (define_insn "sse2_punpcklbw"
23799 [(set (match_operand:V16QI 0 "register_operand" "=x")
23801 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
23802 (parallel [(const_int 0) (const_int 8)
23803 (const_int 1) (const_int 9)
23804 (const_int 2) (const_int 10)
23805 (const_int 3) (const_int 11)
23806 (const_int 4) (const_int 12)
23807 (const_int 5) (const_int 13)
23808 (const_int 6) (const_int 14)
23809 (const_int 7) (const_int 15)]))
23810 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
23811 (parallel [(const_int 8) (const_int 0)
23812 (const_int 9) (const_int 1)
23813 (const_int 10) (const_int 2)
23814 (const_int 11) (const_int 3)
23815 (const_int 12) (const_int 4)
23816 (const_int 13) (const_int 5)
23817 (const_int 14) (const_int 6)
23818 (const_int 15) (const_int 7)]))
23819 (const_int 21845)))]
23821 "punpcklbw\t{%2, %0|%0, %2}"
23822 [(set_attr "type" "ssecvt")
23823 (set_attr "mode" "TI")])
23825 (define_insn "sse2_punpcklwd"
23826 [(set (match_operand:V8HI 0 "register_operand" "=x")
23828 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
23829 (parallel [(const_int 0) (const_int 4)
23830 (const_int 1) (const_int 5)
23831 (const_int 2) (const_int 6)
23832 (const_int 3) (const_int 7)]))
23833 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
23834 (parallel [(const_int 4) (const_int 0)
23835 (const_int 5) (const_int 1)
23836 (const_int 6) (const_int 2)
23837 (const_int 7) (const_int 3)]))
23840 "punpcklwd\t{%2, %0|%0, %2}"
23841 [(set_attr "type" "ssecvt")
23842 (set_attr "mode" "TI")])
23844 (define_insn "sse2_punpckldq"
23845 [(set (match_operand:V4SI 0 "register_operand" "=x")
23847 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
23848 (parallel [(const_int 0) (const_int 2)
23849 (const_int 1) (const_int 3)]))
23850 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
23851 (parallel [(const_int 2) (const_int 0)
23852 (const_int 3) (const_int 1)]))
23855 "punpckldq\t{%2, %0|%0, %2}"
23856 [(set_attr "type" "ssecvt")
23857 (set_attr "mode" "TI")])
23859 (define_insn "sse2_punpcklqdq"
23860 [(set (match_operand:V2DI 0 "register_operand" "=x")
23862 (vec_select:V2DI (match_operand:V2DI 2 "register_operand" "x")
23863 (parallel [(const_int 1)
23865 (match_operand:V2DI 1 "register_operand" "0")
23868 "punpcklqdq\t{%2, %0|%0, %2}"
23869 [(set_attr "type" "ssecvt")
23870 (set_attr "mode" "TI")])
23872 (define_insn "sse2_punpckhqdq"
23873 [(set (match_operand:V2DI 0 "register_operand" "=x")
23875 (match_operand:V2DI 1 "register_operand" "0")
23876 (vec_select:V2DI (match_operand:V2DI 2 "register_operand" "x")
23877 (parallel [(const_int 1)
23881 "punpckhqdq\t{%2, %0|%0, %2}"
23882 [(set_attr "type" "ssecvt")
23883 (set_attr "mode" "TI")])
23887 (define_insn "sse2_movapd"
23888 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
23889 (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
23892 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23893 "movapd\t{%1, %0|%0, %1}"
23894 [(set_attr "type" "ssemov")
23895 (set_attr "mode" "V2DF")])
23897 (define_insn "sse2_movupd"
23898 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
23899 (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
23902 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23903 "movupd\t{%1, %0|%0, %1}"
23904 [(set_attr "type" "ssecvt")
23905 (set_attr "mode" "V2DF")])
23907 (define_insn "sse2_movdqa"
23908 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
23909 (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
23912 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23913 "movdqa\t{%1, %0|%0, %1}"
23914 [(set_attr "type" "ssemov")
23915 (set_attr "mode" "TI")])
23917 (define_insn "sse2_movdqu"
23918 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
23919 (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
23922 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23923 "movdqu\t{%1, %0|%0, %1}"
23924 [(set_attr "type" "ssecvt")
23925 (set_attr "mode" "TI")])
23927 (define_insn "sse2_movdq2q"
23928 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,y")
23929 (vec_select:DI (match_operand:V2DI 1 "register_operand" "x,x")
23930 (parallel [(const_int 0)])))]
23931 "TARGET_SSE2 && !TARGET_64BIT"
23933 movq\t{%1, %0|%0, %1}
23934 movdq2q\t{%1, %0|%0, %1}"
23935 [(set_attr "type" "ssecvt")
23936 (set_attr "mode" "TI")])
23938 (define_insn "sse2_movdq2q_rex64"
23939 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,y,r")
23940 (vec_select:DI (match_operand:V2DI 1 "register_operand" "x,x,x")
23941 (parallel [(const_int 0)])))]
23942 "TARGET_SSE2 && TARGET_64BIT"
23944 movq\t{%1, %0|%0, %1}
23945 movdq2q\t{%1, %0|%0, %1}
23946 movd\t{%1, %0|%0, %1}"
23947 [(set_attr "type" "ssecvt")
23948 (set_attr "mode" "TI")])
23950 (define_insn "sse2_movq2dq"
23951 [(set (match_operand:V2DI 0 "register_operand" "=x,?x")
23952 (vec_concat:V2DI (match_operand:DI 1 "nonimmediate_operand" "m,y")
23954 "TARGET_SSE2 && !TARGET_64BIT"
23956 movq\t{%1, %0|%0, %1}
23957 movq2dq\t{%1, %0|%0, %1}"
23958 [(set_attr "type" "ssecvt,ssemov")
23959 (set_attr "mode" "TI")])
23961 (define_insn "sse2_movq2dq_rex64"
23962 [(set (match_operand:V2DI 0 "register_operand" "=x,?x,?x")
23963 (vec_concat:V2DI (match_operand:DI 1 "nonimmediate_operand" "m,y,r")
23965 "TARGET_SSE2 && TARGET_64BIT"
23967 movq\t{%1, %0|%0, %1}
23968 movq2dq\t{%1, %0|%0, %1}
23969 movd\t{%1, %0|%0, %1}"
23970 [(set_attr "type" "ssecvt,ssemov,ssecvt")
23971 (set_attr "mode" "TI")])
23973 (define_insn "sse2_movq"
23974 [(set (match_operand:V2DI 0 "register_operand" "=x")
23975 (vec_concat:V2DI (vec_select:DI
23976 (match_operand:V2DI 1 "nonimmediate_operand" "xm")
23977 (parallel [(const_int 0)]))
23980 "movq\t{%1, %0|%0, %1}"
23981 [(set_attr "type" "ssemov")
23982 (set_attr "mode" "TI")])
23984 (define_insn "sse2_loadd"
23985 [(set (match_operand:V4SI 0 "register_operand" "=x")
23987 (vec_duplicate:V4SI (match_operand:SI 1 "nonimmediate_operand" "mr"))
23988 (const_vector:V4SI [(const_int 0)
23994 "movd\t{%1, %0|%0, %1}"
23995 [(set_attr "type" "ssemov")
23996 (set_attr "mode" "TI")])
23998 (define_insn "sse2_stored"
23999 [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
24001 (match_operand:V4SI 1 "register_operand" "x")
24002 (parallel [(const_int 0)])))]
24004 "movd\t{%1, %0|%0, %1}"
24005 [(set_attr "type" "ssemov")
24006 (set_attr "mode" "TI")])
24008 (define_insn "sse2_movhpd"
24009 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
24011 (match_operand:V2DF 1 "nonimmediate_operand" "0,0")
24012 (match_operand:V2DF 2 "nonimmediate_operand" "m,x")
24014 "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
24015 "movhpd\t{%2, %0|%0, %2}"
24016 [(set_attr "type" "ssecvt")
24017 (set_attr "mode" "V2DF")])
24019 (define_expand "sse2_loadsd"
24020 [(match_operand:V2DF 0 "register_operand" "")
24021 (match_operand:DF 1 "memory_operand" "")]
24024 emit_insn (gen_sse2_loadsd_1 (operands[0], operands[1],
24025 CONST0_RTX (V2DFmode)));
24029 (define_insn "sse2_loadsd_1"
24030 [(set (match_operand:V2DF 0 "register_operand" "=x")
24032 (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m"))
24033 (match_operand:V2DF 2 "const0_operand" "X")
24036 "movsd\t{%1, %0|%0, %1}"
24037 [(set_attr "type" "ssecvt")
24038 (set_attr "mode" "DF")])
24040 (define_insn "sse2_movsd"
24041 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,m")
24043 (match_operand:V2DF 1 "nonimmediate_operand" "0,0,0")
24044 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,x")
24046 "TARGET_SSE2 && ix86_binary_operator_ok (UNKNOWN, V2DFmode, operands)"
24047 "@movsd\t{%2, %0|%0, %2}
24048 movlpd\t{%2, %0|%0, %2}
24049 movlpd\t{%2, %0|%0, %2}"
24050 [(set_attr "type" "ssecvt")
24051 (set_attr "mode" "DF,V2DF,V2DF")])
24053 (define_insn "sse2_storesd"
24054 [(set (match_operand:DF 0 "memory_operand" "=m")
24056 (match_operand:V2DF 1 "register_operand" "x")
24057 (parallel [(const_int 0)])))]
24059 "movsd\t{%1, %0|%0, %1}"
24060 [(set_attr "type" "ssecvt")
24061 (set_attr "mode" "DF")])
24063 (define_insn "sse2_shufpd"
24064 [(set (match_operand:V2DF 0 "register_operand" "=x")
24065 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24066 (match_operand:V2DF 2 "nonimmediate_operand" "xm")
24067 (match_operand:SI 3 "immediate_operand" "i")]
24070 ;; @@@ check operand order for intel/nonintel syntax
24071 "shufpd\t{%3, %2, %0|%0, %2, %3}"
24072 [(set_attr "type" "ssecvt")
24073 (set_attr "mode" "V2DF")])
24075 (define_insn "sse2_clflush"
24076 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
24080 [(set_attr "type" "sse")
24081 (set_attr "memory" "unknown")])
24083 (define_expand "sse2_mfence"
24084 [(set (match_dup 0)
24085 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
24088 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
24089 MEM_VOLATILE_P (operands[0]) = 1;
24092 (define_insn "*mfence_insn"
24093 [(set (match_operand:BLK 0 "" "")
24094 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
24097 [(set_attr "type" "sse")
24098 (set_attr "memory" "unknown")])
24100 (define_expand "sse2_lfence"
24101 [(set (match_dup 0)
24102 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
24105 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
24106 MEM_VOLATILE_P (operands[0]) = 1;
24109 (define_insn "*lfence_insn"
24110 [(set (match_operand:BLK 0 "" "")
24111 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
24114 [(set_attr "type" "sse")
24115 (set_attr "memory" "unknown")])
24119 (define_insn "mwait"
24120 [(unspec_volatile [(match_operand:SI 0 "register_operand" "a")
24121 (match_operand:SI 1 "register_operand" "c")]
24125 [(set_attr "length" "3")])
24127 (define_insn "monitor"
24128 [(unspec_volatile [(match_operand:SI 0 "register_operand" "a")
24129 (match_operand:SI 1 "register_operand" "c")
24130 (match_operand:SI 2 "register_operand" "d")]
24133 "monitor\t%0, %1, %2"
24134 [(set_attr "length" "3")])
24138 (define_insn "addsubv4sf3"
24139 [(set (match_operand:V4SF 0 "register_operand" "=x")
24140 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
24141 (match_operand:V4SF 2 "nonimmediate_operand" "xm")]
24144 "addsubps\t{%2, %0|%0, %2}"
24145 [(set_attr "type" "sseadd")
24146 (set_attr "mode" "V4SF")])
24148 (define_insn "addsubv2df3"
24149 [(set (match_operand:V2DF 0 "register_operand" "=x")
24150 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24151 (match_operand:V2DF 2 "nonimmediate_operand" "xm")]
24154 "addsubpd\t{%2, %0|%0, %2}"
24155 [(set_attr "type" "sseadd")
24156 (set_attr "mode" "V2DF")])
24158 (define_insn "haddv4sf3"
24159 [(set (match_operand:V4SF 0 "register_operand" "=x")
24160 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
24161 (match_operand:V4SF 2 "nonimmediate_operand" "xm")]
24164 "haddps\t{%2, %0|%0, %2}"
24165 [(set_attr "type" "sseadd")
24166 (set_attr "mode" "V4SF")])
24168 (define_insn "haddv2df3"
24169 [(set (match_operand:V2DF 0 "register_operand" "=x")
24170 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24171 (match_operand:V2DF 2 "nonimmediate_operand" "xm")]
24174 "haddpd\t{%2, %0|%0, %2}"
24175 [(set_attr "type" "sseadd")
24176 (set_attr "mode" "V2DF")])
24178 (define_insn "hsubv4sf3"
24179 [(set (match_operand:V4SF 0 "register_operand" "=x")
24180 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
24181 (match_operand:V4SF 2 "nonimmediate_operand" "xm")]
24184 "hsubps\t{%2, %0|%0, %2}"
24185 [(set_attr "type" "sseadd")
24186 (set_attr "mode" "V4SF")])
24188 (define_insn "hsubv2df3"
24189 [(set (match_operand:V2DF 0 "register_operand" "=x")
24190 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24191 (match_operand:V2DF 2 "nonimmediate_operand" "xm")]
24194 "hsubpd\t{%2, %0|%0, %2}"
24195 [(set_attr "type" "sseadd")
24196 (set_attr "mode" "V2DF")])
24198 (define_insn "movshdup"
24199 [(set (match_operand:V4SF 0 "register_operand" "=x")
24201 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSHDUP))]
24203 "movshdup\t{%1, %0|%0, %1}"
24204 [(set_attr "type" "sse")
24205 (set_attr "mode" "V4SF")])
24207 (define_insn "movsldup"
24208 [(set (match_operand:V4SF 0 "register_operand" "=x")
24210 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSLDUP))]
24212 "movsldup\t{%1, %0|%0, %1}"
24213 [(set_attr "type" "sse")
24214 (set_attr "mode" "V4SF")])
24216 (define_insn "lddqu"
24217 [(set (match_operand:V16QI 0 "register_operand" "=x")
24218 (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "m")]
24221 "lddqu\t{%1, %0|%0, %1}"
24222 [(set_attr "type" "ssecvt")
24223 (set_attr "mode" "TI")])
24225 (define_insn "loadddup"
24226 [(set (match_operand:V2DF 0 "register_operand" "=x")
24227 (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m")))]
24229 "movddup\t{%1, %0|%0, %1}"
24230 [(set_attr "type" "ssecvt")
24231 (set_attr "mode" "DF")])
24233 (define_insn "movddup"
24234 [(set (match_operand:V2DF 0 "register_operand" "=x")
24235 (vec_duplicate:V2DF
24236 (vec_select:DF (match_operand:V2DF 1 "register_operand" "x")
24237 (parallel [(const_int 0)]))))]
24239 "movddup\t{%1, %0|%0, %1}"
24240 [(set_attr "type" "ssecvt")
24241 (set_attr "mode" "DF")])