1 ;; GCC machine description for IA-32 and x86-64.
2 ;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 ;; 2001, 2002, 2003, 2004, 2005
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,V1DF"
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"
1126 "=r ,m ,!*y,!rm,!*y,!*x,!rm,!*x")
1127 (match_operand:SI 1 "general_operand"
1128 "rinm,rin,*y ,*y ,rm ,*x ,*x ,rm"))]
1129 "(TARGET_INTER_UNIT_MOVES || optimize_size)
1130 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1132 switch (get_attr_type (insn))
1135 if (get_attr_mode (insn) == MODE_TI)
1136 return "movdqa\t{%1, %0|%0, %1}";
1137 return "movd\t{%1, %0|%0, %1}";
1140 if (get_attr_mode (insn) == MODE_DI)
1141 return "movq\t{%1, %0|%0, %1}";
1142 return "movd\t{%1, %0|%0, %1}";
1145 return "lea{l}\t{%1, %0|%0, %1}";
1148 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1150 return "mov{l}\t{%1, %0|%0, %1}";
1154 (cond [(eq_attr "alternative" "2,3,4")
1155 (const_string "mmxmov")
1156 (eq_attr "alternative" "5,6,7")
1157 (const_string "ssemov")
1158 (and (ne (symbol_ref "flag_pic") (const_int 0))
1159 (match_operand:SI 1 "symbolic_operand" ""))
1160 (const_string "lea")
1162 (const_string "imov")))
1163 (set_attr "mode" "SI,SI,DI,SI,SI,TI,SI,SI")])
1165 (define_insn "*movsi_1_nointernunit"
1166 [(set (match_operand:SI 0 "nonimmediate_operand"
1167 "=r ,m ,!*y,!m,!*y,!*x,!m,!*x")
1168 (match_operand:SI 1 "general_operand"
1169 "rinm,rin,*y ,*y,m ,*x ,*x,m"))]
1170 "(!TARGET_INTER_UNIT_MOVES && !optimize_size)
1171 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1173 switch (get_attr_type (insn))
1176 if (get_attr_mode (insn) == MODE_TI)
1177 return "movdqa\t{%1, %0|%0, %1}";
1178 return "movd\t{%1, %0|%0, %1}";
1181 if (get_attr_mode (insn) == MODE_DI)
1182 return "movq\t{%1, %0|%0, %1}";
1183 return "movd\t{%1, %0|%0, %1}";
1186 return "lea{l}\t{%1, %0|%0, %1}";
1189 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1191 return "mov{l}\t{%1, %0|%0, %1}";
1195 (cond [(eq_attr "alternative" "2,3,4")
1196 (const_string "mmxmov")
1197 (eq_attr "alternative" "5,6,7")
1198 (const_string "ssemov")
1199 (and (ne (symbol_ref "flag_pic") (const_int 0))
1200 (match_operand:SI 1 "symbolic_operand" ""))
1201 (const_string "lea")
1203 (const_string "imov")))
1204 (set_attr "mode" "SI,SI,DI,SI,SI,TI,SI,SI")])
1206 ;; Stores and loads of ax to arbitrary constant address.
1207 ;; We fake an second form of instruction to force reload to load address
1208 ;; into register when rax is not available
1209 (define_insn "*movabssi_1_rex64"
1210 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1211 (match_operand:SI 1 "nonmemory_operand" "a,er"))]
1212 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1214 movabs{l}\t{%1, %P0|%P0, %1}
1215 mov{l}\t{%1, %a0|%a0, %1}"
1216 [(set_attr "type" "imov")
1217 (set_attr "modrm" "0,*")
1218 (set_attr "length_address" "8,0")
1219 (set_attr "length_immediate" "0,*")
1220 (set_attr "memory" "store")
1221 (set_attr "mode" "SI")])
1223 (define_insn "*movabssi_2_rex64"
1224 [(set (match_operand:SI 0 "register_operand" "=a,r")
1225 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1226 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1228 movabs{l}\t{%P1, %0|%0, %P1}
1229 mov{l}\t{%a1, %0|%0, %a1}"
1230 [(set_attr "type" "imov")
1231 (set_attr "modrm" "0,*")
1232 (set_attr "length_address" "8,0")
1233 (set_attr "length_immediate" "0")
1234 (set_attr "memory" "load")
1235 (set_attr "mode" "SI")])
1237 (define_insn "*swapsi"
1238 [(set (match_operand:SI 0 "register_operand" "+r")
1239 (match_operand:SI 1 "register_operand" "+r"))
1244 [(set_attr "type" "imov")
1245 (set_attr "mode" "SI")
1246 (set_attr "pent_pair" "np")
1247 (set_attr "athlon_decode" "vector")])
1249 (define_expand "movhi"
1250 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1251 (match_operand:HI 1 "general_operand" ""))]
1253 "ix86_expand_move (HImode, operands); DONE;")
1255 (define_insn "*pushhi2"
1256 [(set (match_operand:HI 0 "push_operand" "=<,<")
1257 (match_operand:HI 1 "general_no_elim_operand" "n,r*m"))]
1260 push{w}\t{|WORD PTR }%1
1262 [(set_attr "type" "push")
1263 (set_attr "mode" "HI")])
1265 ;; For 64BIT abi we always round up to 8 bytes.
1266 (define_insn "*pushhi2_rex64"
1267 [(set (match_operand:HI 0 "push_operand" "=X")
1268 (match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))]
1271 [(set_attr "type" "push")
1272 (set_attr "mode" "QI")])
1274 (define_insn "*movhi_1"
1275 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
1276 (match_operand:HI 1 "general_operand" "r,rn,rm,rn"))]
1277 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1279 switch (get_attr_type (insn))
1282 /* movzwl is faster than movw on p2 due to partial word stalls,
1283 though not as fast as an aligned movl. */
1284 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1286 if (get_attr_mode (insn) == MODE_SI)
1287 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1289 return "mov{w}\t{%1, %0|%0, %1}";
1293 (cond [(ne (symbol_ref "optimize_size") (const_int 0))
1294 (const_string "imov")
1295 (and (eq_attr "alternative" "0")
1296 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1298 (eq (symbol_ref "TARGET_HIMODE_MATH")
1300 (const_string "imov")
1301 (and (eq_attr "alternative" "1,2")
1302 (match_operand:HI 1 "aligned_operand" ""))
1303 (const_string "imov")
1304 (and (ne (symbol_ref "TARGET_MOVX")
1306 (eq_attr "alternative" "0,2"))
1307 (const_string "imovx")
1309 (const_string "imov")))
1311 (cond [(eq_attr "type" "imovx")
1313 (and (eq_attr "alternative" "1,2")
1314 (match_operand:HI 1 "aligned_operand" ""))
1316 (and (eq_attr "alternative" "0")
1317 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1319 (eq (symbol_ref "TARGET_HIMODE_MATH")
1323 (const_string "HI")))])
1325 ;; Stores and loads of ax to arbitrary constant address.
1326 ;; We fake an second form of instruction to force reload to load address
1327 ;; into register when rax is not available
1328 (define_insn "*movabshi_1_rex64"
1329 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1330 (match_operand:HI 1 "nonmemory_operand" "a,er"))]
1331 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1333 movabs{w}\t{%1, %P0|%P0, %1}
1334 mov{w}\t{%1, %a0|%a0, %1}"
1335 [(set_attr "type" "imov")
1336 (set_attr "modrm" "0,*")
1337 (set_attr "length_address" "8,0")
1338 (set_attr "length_immediate" "0,*")
1339 (set_attr "memory" "store")
1340 (set_attr "mode" "HI")])
1342 (define_insn "*movabshi_2_rex64"
1343 [(set (match_operand:HI 0 "register_operand" "=a,r")
1344 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1345 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1347 movabs{w}\t{%P1, %0|%0, %P1}
1348 mov{w}\t{%a1, %0|%0, %a1}"
1349 [(set_attr "type" "imov")
1350 (set_attr "modrm" "0,*")
1351 (set_attr "length_address" "8,0")
1352 (set_attr "length_immediate" "0")
1353 (set_attr "memory" "load")
1354 (set_attr "mode" "HI")])
1356 (define_insn "*swaphi_1"
1357 [(set (match_operand:HI 0 "register_operand" "+r")
1358 (match_operand:HI 1 "register_operand" "+r"))
1361 "!TARGET_PARTIAL_REG_STALL || optimize_size"
1363 [(set_attr "type" "imov")
1364 (set_attr "mode" "SI")
1365 (set_attr "pent_pair" "np")
1366 (set_attr "athlon_decode" "vector")])
1368 (define_insn "*swaphi_2"
1369 [(set (match_operand:HI 0 "register_operand" "+r")
1370 (match_operand:HI 1 "register_operand" "+r"))
1373 "TARGET_PARTIAL_REG_STALL"
1375 [(set_attr "type" "imov")
1376 (set_attr "mode" "HI")
1377 (set_attr "pent_pair" "np")
1378 (set_attr "athlon_decode" "vector")])
1380 (define_expand "movstricthi"
1381 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1382 (match_operand:HI 1 "general_operand" ""))]
1383 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1385 /* Don't generate memory->memory moves, go through a register */
1386 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1387 operands[1] = force_reg (HImode, operands[1]);
1390 (define_insn "*movstricthi_1"
1391 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1392 (match_operand:HI 1 "general_operand" "rn,m"))]
1393 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1394 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1395 "mov{w}\t{%1, %0|%0, %1}"
1396 [(set_attr "type" "imov")
1397 (set_attr "mode" "HI")])
1399 (define_insn "*movstricthi_xor"
1400 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1401 (match_operand:HI 1 "const0_operand" "i"))
1402 (clobber (reg:CC FLAGS_REG))]
1404 && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"
1405 "xor{w}\t{%0, %0|%0, %0}"
1406 [(set_attr "type" "alu1")
1407 (set_attr "mode" "HI")
1408 (set_attr "length_immediate" "0")])
1410 (define_expand "movqi"
1411 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1412 (match_operand:QI 1 "general_operand" ""))]
1414 "ix86_expand_move (QImode, operands); DONE;")
1416 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1417 ;; "push a byte". But actually we use pushw, which has the effect
1418 ;; of rounding the amount pushed up to a halfword.
1420 (define_insn "*pushqi2"
1421 [(set (match_operand:QI 0 "push_operand" "=X,X")
1422 (match_operand:QI 1 "nonmemory_no_elim_operand" "n,r"))]
1425 push{w}\t{|word ptr }%1
1427 [(set_attr "type" "push")
1428 (set_attr "mode" "HI")])
1430 ;; For 64BIT abi we always round up to 8 bytes.
1431 (define_insn "*pushqi2_rex64"
1432 [(set (match_operand:QI 0 "push_operand" "=X")
1433 (match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))]
1436 [(set_attr "type" "push")
1437 (set_attr "mode" "QI")])
1439 ;; Situation is quite tricky about when to choose full sized (SImode) move
1440 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1441 ;; partial register dependency machines (such as AMD Athlon), where QImode
1442 ;; moves issue extra dependency and for partial register stalls machines
1443 ;; that don't use QImode patterns (and QImode move cause stall on the next
1446 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1447 ;; register stall machines with, where we use QImode instructions, since
1448 ;; partial register stall can be caused there. Then we use movzx.
1449 (define_insn "*movqi_1"
1450 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1451 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1452 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1454 switch (get_attr_type (insn))
1457 if (!ANY_QI_REG_P (operands[1]) && GET_CODE (operands[1]) != MEM)
1459 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1461 if (get_attr_mode (insn) == MODE_SI)
1462 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1464 return "mov{b}\t{%1, %0|%0, %1}";
1468 (cond [(ne (symbol_ref "optimize_size") (const_int 0))
1469 (const_string "imov")
1470 (and (eq_attr "alternative" "3")
1471 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1473 (eq (symbol_ref "TARGET_QIMODE_MATH")
1475 (const_string "imov")
1476 (eq_attr "alternative" "3,5")
1477 (const_string "imovx")
1478 (and (ne (symbol_ref "TARGET_MOVX")
1480 (eq_attr "alternative" "2"))
1481 (const_string "imovx")
1483 (const_string "imov")))
1485 (cond [(eq_attr "alternative" "3,4,5")
1487 (eq_attr "alternative" "6")
1489 (eq_attr "type" "imovx")
1491 (and (eq_attr "type" "imov")
1492 (and (eq_attr "alternative" "0,1")
1493 (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
1496 ;; Avoid partial register stalls when not using QImode arithmetic
1497 (and (eq_attr "type" "imov")
1498 (and (eq_attr "alternative" "0,1")
1499 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
1501 (eq (symbol_ref "TARGET_QIMODE_MATH")
1505 (const_string "QI")))])
1507 (define_expand "reload_outqi"
1508 [(parallel [(match_operand:QI 0 "" "=m")
1509 (match_operand:QI 1 "register_operand" "r")
1510 (match_operand:QI 2 "register_operand" "=&q")])]
1514 op0 = operands[0]; op1 = operands[1]; op2 = operands[2];
1516 if (reg_overlap_mentioned_p (op2, op0))
1518 if (! q_regs_operand (op1, QImode))
1520 emit_insn (gen_movqi (op2, op1));
1523 emit_insn (gen_movqi (op0, op1));
1527 (define_insn "*swapqi_1"
1528 [(set (match_operand:QI 0 "register_operand" "+r")
1529 (match_operand:QI 1 "register_operand" "+r"))
1532 "!TARGET_PARTIAL_REG_STALL || optimize_size"
1534 [(set_attr "type" "imov")
1535 (set_attr "mode" "SI")
1536 (set_attr "pent_pair" "np")
1537 (set_attr "athlon_decode" "vector")])
1539 (define_insn "*swapqi_2"
1540 [(set (match_operand:QI 0 "register_operand" "+q")
1541 (match_operand:QI 1 "register_operand" "+q"))
1544 "TARGET_PARTIAL_REG_STALL"
1546 [(set_attr "type" "imov")
1547 (set_attr "mode" "QI")
1548 (set_attr "pent_pair" "np")
1549 (set_attr "athlon_decode" "vector")])
1551 (define_expand "movstrictqi"
1552 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1553 (match_operand:QI 1 "general_operand" ""))]
1554 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1556 /* Don't generate memory->memory moves, go through a register. */
1557 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1558 operands[1] = force_reg (QImode, operands[1]);
1561 (define_insn "*movstrictqi_1"
1562 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
1563 (match_operand:QI 1 "general_operand" "*qn,m"))]
1564 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1565 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1566 "mov{b}\t{%1, %0|%0, %1}"
1567 [(set_attr "type" "imov")
1568 (set_attr "mode" "QI")])
1570 (define_insn "*movstrictqi_xor"
1571 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
1572 (match_operand:QI 1 "const0_operand" "i"))
1573 (clobber (reg:CC FLAGS_REG))]
1574 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1575 "xor{b}\t{%0, %0|%0, %0}"
1576 [(set_attr "type" "alu1")
1577 (set_attr "mode" "QI")
1578 (set_attr "length_immediate" "0")])
1580 (define_insn "*movsi_extv_1"
1581 [(set (match_operand:SI 0 "register_operand" "=R")
1582 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
1586 "movs{bl|x}\t{%h1, %0|%0, %h1}"
1587 [(set_attr "type" "imovx")
1588 (set_attr "mode" "SI")])
1590 (define_insn "*movhi_extv_1"
1591 [(set (match_operand:HI 0 "register_operand" "=R")
1592 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
1596 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
1597 [(set_attr "type" "imovx")
1598 (set_attr "mode" "SI")])
1600 (define_insn "*movqi_extv_1"
1601 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
1602 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1607 switch (get_attr_type (insn))
1610 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1612 return "mov{b}\t{%h1, %0|%0, %h1}";
1616 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1617 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1618 (ne (symbol_ref "TARGET_MOVX")
1620 (const_string "imovx")
1621 (const_string "imov")))
1623 (if_then_else (eq_attr "type" "imovx")
1625 (const_string "QI")))])
1627 (define_insn "*movqi_extv_1_rex64"
1628 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1629 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1634 switch (get_attr_type (insn))
1637 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1639 return "mov{b}\t{%h1, %0|%0, %h1}";
1643 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1644 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1645 (ne (symbol_ref "TARGET_MOVX")
1647 (const_string "imovx")
1648 (const_string "imov")))
1650 (if_then_else (eq_attr "type" "imovx")
1652 (const_string "QI")))])
1654 ;; Stores and loads of ax to arbitrary constant address.
1655 ;; We fake an second form of instruction to force reload to load address
1656 ;; into register when rax is not available
1657 (define_insn "*movabsqi_1_rex64"
1658 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
1659 (match_operand:QI 1 "nonmemory_operand" "a,er"))]
1660 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
1662 movabs{b}\t{%1, %P0|%P0, %1}
1663 mov{b}\t{%1, %a0|%a0, %1}"
1664 [(set_attr "type" "imov")
1665 (set_attr "modrm" "0,*")
1666 (set_attr "length_address" "8,0")
1667 (set_attr "length_immediate" "0,*")
1668 (set_attr "memory" "store")
1669 (set_attr "mode" "QI")])
1671 (define_insn "*movabsqi_2_rex64"
1672 [(set (match_operand:QI 0 "register_operand" "=a,r")
1673 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1674 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
1676 movabs{b}\t{%P1, %0|%0, %P1}
1677 mov{b}\t{%a1, %0|%0, %a1}"
1678 [(set_attr "type" "imov")
1679 (set_attr "modrm" "0,*")
1680 (set_attr "length_address" "8,0")
1681 (set_attr "length_immediate" "0")
1682 (set_attr "memory" "load")
1683 (set_attr "mode" "QI")])
1685 (define_insn "*movsi_extzv_1"
1686 [(set (match_operand:SI 0 "register_operand" "=R")
1687 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
1691 "movz{bl|x}\t{%h1, %0|%0, %h1}"
1692 [(set_attr "type" "imovx")
1693 (set_attr "mode" "SI")])
1695 (define_insn "*movqi_extzv_2"
1696 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
1697 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1702 switch (get_attr_type (insn))
1705 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1707 return "mov{b}\t{%h1, %0|%0, %h1}";
1711 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1712 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1713 (ne (symbol_ref "TARGET_MOVX")
1715 (const_string "imovx")
1716 (const_string "imov")))
1718 (if_then_else (eq_attr "type" "imovx")
1720 (const_string "QI")))])
1722 (define_insn "*movqi_extzv_2_rex64"
1723 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1724 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1729 switch (get_attr_type (insn))
1732 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1734 return "mov{b}\t{%h1, %0|%0, %h1}";
1738 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1739 (ne (symbol_ref "TARGET_MOVX")
1741 (const_string "imovx")
1742 (const_string "imov")))
1744 (if_then_else (eq_attr "type" "imovx")
1746 (const_string "QI")))])
1748 (define_insn "movsi_insv_1"
1749 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1752 (match_operand:SI 1 "general_operand" "Qmn"))]
1754 "mov{b}\t{%b1, %h0|%h0, %b1}"
1755 [(set_attr "type" "imov")
1756 (set_attr "mode" "QI")])
1758 (define_insn "movdi_insv_1_rex64"
1759 [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q")
1762 (match_operand:DI 1 "nonmemory_operand" "Qn"))]
1764 "mov{b}\t{%b1, %h0|%h0, %b1}"
1765 [(set_attr "type" "imov")
1766 (set_attr "mode" "QI")])
1768 (define_insn "*movqi_insv_2"
1769 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1772 (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
1775 "mov{b}\t{%h1, %h0|%h0, %h1}"
1776 [(set_attr "type" "imov")
1777 (set_attr "mode" "QI")])
1779 (define_expand "movdi"
1780 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1781 (match_operand:DI 1 "general_operand" ""))]
1783 "ix86_expand_move (DImode, operands); DONE;")
1785 (define_insn "*pushdi"
1786 [(set (match_operand:DI 0 "push_operand" "=<")
1787 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
1791 (define_insn "*pushdi2_rex64"
1792 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1793 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1798 [(set_attr "type" "push,multi")
1799 (set_attr "mode" "DI")])
1801 ;; Convert impossible pushes of immediate to existing instructions.
1802 ;; First try to get scratch register and go through it. In case this
1803 ;; fails, push sign extended lower part first and then overwrite
1804 ;; upper part by 32bit move.
1806 [(match_scratch:DI 2 "r")
1807 (set (match_operand:DI 0 "push_operand" "")
1808 (match_operand:DI 1 "immediate_operand" ""))]
1809 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1810 && !x86_64_immediate_operand (operands[1], DImode)"
1811 [(set (match_dup 2) (match_dup 1))
1812 (set (match_dup 0) (match_dup 2))]
1815 ;; We need to define this as both peepholer and splitter for case
1816 ;; peephole2 pass is not run.
1817 ;; "&& 1" is needed to keep it from matching the previous pattern.
1819 [(set (match_operand:DI 0 "push_operand" "")
1820 (match_operand:DI 1 "immediate_operand" ""))]
1821 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1822 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1823 [(set (match_dup 0) (match_dup 1))
1824 (set (match_dup 2) (match_dup 3))]
1825 "split_di (operands + 1, 1, operands + 2, operands + 3);
1826 operands[1] = gen_lowpart (DImode, operands[2]);
1827 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1832 [(set (match_operand:DI 0 "push_operand" "")
1833 (match_operand:DI 1 "immediate_operand" ""))]
1834 "TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)
1835 && !symbolic_operand (operands[1], DImode)
1836 && !x86_64_immediate_operand (operands[1], DImode)"
1837 [(set (match_dup 0) (match_dup 1))
1838 (set (match_dup 2) (match_dup 3))]
1839 "split_di (operands + 1, 1, operands + 2, operands + 3);
1840 operands[1] = gen_lowpart (DImode, operands[2]);
1841 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1845 (define_insn "*pushdi2_prologue_rex64"
1846 [(set (match_operand:DI 0 "push_operand" "=<")
1847 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
1848 (clobber (mem:BLK (scratch)))]
1851 [(set_attr "type" "push")
1852 (set_attr "mode" "DI")])
1854 (define_insn "*popdi1_epilogue_rex64"
1855 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1856 (mem:DI (reg:DI SP_REG)))
1857 (set (reg:DI SP_REG)
1858 (plus:DI (reg:DI SP_REG) (const_int 8)))
1859 (clobber (mem:BLK (scratch)))]
1862 [(set_attr "type" "pop")
1863 (set_attr "mode" "DI")])
1865 (define_insn "popdi1"
1866 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1867 (mem:DI (reg:DI SP_REG)))
1868 (set (reg:DI SP_REG)
1869 (plus:DI (reg:DI SP_REG) (const_int 8)))]
1872 [(set_attr "type" "pop")
1873 (set_attr "mode" "DI")])
1875 (define_insn "*movdi_xor_rex64"
1876 [(set (match_operand:DI 0 "register_operand" "=r")
1877 (match_operand:DI 1 "const0_operand" "i"))
1878 (clobber (reg:CC FLAGS_REG))]
1879 "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size)
1880 && reload_completed"
1881 "xor{l}\t{%k0, %k0|%k0, %k0}"
1882 [(set_attr "type" "alu1")
1883 (set_attr "mode" "SI")
1884 (set_attr "length_immediate" "0")])
1886 (define_insn "*movdi_or_rex64"
1887 [(set (match_operand:DI 0 "register_operand" "=r")
1888 (match_operand:DI 1 "const_int_operand" "i"))
1889 (clobber (reg:CC FLAGS_REG))]
1890 "TARGET_64BIT && (TARGET_PENTIUM || optimize_size)
1892 && operands[1] == constm1_rtx"
1894 operands[1] = constm1_rtx;
1895 return "or{q}\t{%1, %0|%0, %1}";
1897 [(set_attr "type" "alu1")
1898 (set_attr "mode" "DI")
1899 (set_attr "length_immediate" "1")])
1901 (define_insn "*movdi_2"
1902 [(set (match_operand:DI 0 "nonimmediate_operand"
1903 "=r ,o ,m*y,*y,m ,*Y,*Y,m ,*x,*x")
1904 (match_operand:DI 1 "general_operand"
1905 "riFo,riF,*y ,m ,*Y,*Y,m ,*x,*x,m "))]
1907 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1911 movq\t{%1, %0|%0, %1}
1912 movq\t{%1, %0|%0, %1}
1913 movq\t{%1, %0|%0, %1}
1914 movdqa\t{%1, %0|%0, %1}
1915 movq\t{%1, %0|%0, %1}
1916 movlps\t{%1, %0|%0, %1}
1917 movaps\t{%1, %0|%0, %1}
1918 movlps\t{%1, %0|%0, %1}"
1919 [(set_attr "type" "*,*,mmx,mmx,ssemov,ssemov,ssemov,ssemov,ssemov,ssemov")
1920 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,V2SF,V4SF,V2SF")])
1923 [(set (match_operand:DI 0 "push_operand" "")
1924 (match_operand:DI 1 "general_operand" ""))]
1925 "!TARGET_64BIT && reload_completed
1926 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1928 "ix86_split_long_move (operands); DONE;")
1930 ;; %%% This multiword shite has got to go.
1932 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1933 (match_operand:DI 1 "general_operand" ""))]
1934 "!TARGET_64BIT && reload_completed
1935 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
1936 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1938 "ix86_split_long_move (operands); DONE;")
1940 (define_insn "*movdi_1_rex64"
1941 [(set (match_operand:DI 0 "nonimmediate_operand"
1942 "=r,r ,r,mr,!mr,!*y,!rm,!*y,!*x,!rm,!*x,!*x,!*y")
1943 (match_operand:DI 1 "general_operand"
1944 "Z ,rem,i,re,n ,*y ,*y ,rm ,*x ,*x ,rm ,*y ,*x"))]
1946 && (TARGET_INTER_UNIT_MOVES || optimize_size)
1947 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1949 switch (get_attr_type (insn))
1952 if (which_alternative == 11)
1953 return "movq2dq\t{%1, %0|%0, %1}";
1955 return "movdq2q\t{%1, %0|%0, %1}";
1957 if (get_attr_mode (insn) == MODE_TI)
1958 return "movdqa\t{%1, %0|%0, %1}";
1961 /* Moves from and into integer register is done using movd opcode with
1963 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
1964 return "movd\t{%1, %0|%0, %1}";
1965 return "movq\t{%1, %0|%0, %1}";
1969 return "lea{q}\t{%a1, %0|%0, %a1}";
1971 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1973 if (get_attr_mode (insn) == MODE_SI)
1974 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1975 else if (which_alternative == 2)
1976 return "movabs{q}\t{%1, %0|%0, %1}";
1978 return "mov{q}\t{%1, %0|%0, %1}";
1982 (cond [(eq_attr "alternative" "5,6,7")
1983 (const_string "mmxmov")
1984 (eq_attr "alternative" "8,9,10")
1985 (const_string "ssemov")
1986 (eq_attr "alternative" "11,12")
1987 (const_string "ssecvt")
1988 (eq_attr "alternative" "4")
1989 (const_string "multi")
1990 (and (ne (symbol_ref "flag_pic") (const_int 0))
1991 (match_operand:DI 1 "symbolic_operand" ""))
1992 (const_string "lea")
1994 (const_string "imov")))
1995 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*,*,*")
1996 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*,*,*")
1997 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI,DI,DI")])
1999 (define_insn "*movdi_1_rex64_nointerunit"
2000 [(set (match_operand:DI 0 "nonimmediate_operand"
2001 "=r,r ,r,mr,!mr,!*y,!m,!*y,!*Y,!m,!*Y")
2002 (match_operand:DI 1 "general_operand"
2003 "Z,rem,i,re,n ,*y ,*y,m ,*Y ,*Y,m"))]
2005 && (!TARGET_INTER_UNIT_MOVES && !optimize_size)
2006 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
2008 switch (get_attr_type (insn))
2011 if (get_attr_mode (insn) == MODE_TI)
2012 return "movdqa\t{%1, %0|%0, %1}";
2015 return "movq\t{%1, %0|%0, %1}";
2019 return "lea{q}\t{%a1, %0|%0, %a1}";
2021 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
2023 if (get_attr_mode (insn) == MODE_SI)
2024 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2025 else if (which_alternative == 2)
2026 return "movabs{q}\t{%1, %0|%0, %1}";
2028 return "mov{q}\t{%1, %0|%0, %1}";
2032 (cond [(eq_attr "alternative" "5,6,7")
2033 (const_string "mmxmov")
2034 (eq_attr "alternative" "8,9,10")
2035 (const_string "ssemov")
2036 (eq_attr "alternative" "4")
2037 (const_string "multi")
2038 (and (ne (symbol_ref "flag_pic") (const_int 0))
2039 (match_operand:DI 1 "symbolic_operand" ""))
2040 (const_string "lea")
2042 (const_string "imov")))
2043 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*")
2044 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*")
2045 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI")])
2047 ;; Stores and loads of ax to arbitrary constant address.
2048 ;; We fake an second form of instruction to force reload to load address
2049 ;; into register when rax is not available
2050 (define_insn "*movabsdi_1_rex64"
2051 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
2052 (match_operand:DI 1 "nonmemory_operand" "a,er"))]
2053 "TARGET_64BIT && ix86_check_movabs (insn, 0)"
2055 movabs{q}\t{%1, %P0|%P0, %1}
2056 mov{q}\t{%1, %a0|%a0, %1}"
2057 [(set_attr "type" "imov")
2058 (set_attr "modrm" "0,*")
2059 (set_attr "length_address" "8,0")
2060 (set_attr "length_immediate" "0,*")
2061 (set_attr "memory" "store")
2062 (set_attr "mode" "DI")])
2064 (define_insn "*movabsdi_2_rex64"
2065 [(set (match_operand:DI 0 "register_operand" "=a,r")
2066 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2067 "TARGET_64BIT && ix86_check_movabs (insn, 1)"
2069 movabs{q}\t{%P1, %0|%0, %P1}
2070 mov{q}\t{%a1, %0|%0, %a1}"
2071 [(set_attr "type" "imov")
2072 (set_attr "modrm" "0,*")
2073 (set_attr "length_address" "8,0")
2074 (set_attr "length_immediate" "0")
2075 (set_attr "memory" "load")
2076 (set_attr "mode" "DI")])
2078 ;; Convert impossible stores of immediate to existing instructions.
2079 ;; First try to get scratch register and go through it. In case this
2080 ;; fails, move by 32bit parts.
2082 [(match_scratch:DI 2 "r")
2083 (set (match_operand:DI 0 "memory_operand" "")
2084 (match_operand:DI 1 "immediate_operand" ""))]
2085 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2086 && !x86_64_immediate_operand (operands[1], DImode)"
2087 [(set (match_dup 2) (match_dup 1))
2088 (set (match_dup 0) (match_dup 2))]
2091 ;; We need to define this as both peepholer and splitter for case
2092 ;; peephole2 pass is not run.
2093 ;; "&& 1" is needed to keep it from matching the previous pattern.
2095 [(set (match_operand:DI 0 "memory_operand" "")
2096 (match_operand:DI 1 "immediate_operand" ""))]
2097 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2098 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2099 [(set (match_dup 2) (match_dup 3))
2100 (set (match_dup 4) (match_dup 5))]
2101 "split_di (operands, 2, operands + 2, operands + 4);")
2104 [(set (match_operand:DI 0 "memory_operand" "")
2105 (match_operand:DI 1 "immediate_operand" ""))]
2106 "TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)
2107 && !symbolic_operand (operands[1], DImode)
2108 && !x86_64_immediate_operand (operands[1], DImode)"
2109 [(set (match_dup 2) (match_dup 3))
2110 (set (match_dup 4) (match_dup 5))]
2111 "split_di (operands, 2, operands + 2, operands + 4);")
2113 (define_insn "*swapdi_rex64"
2114 [(set (match_operand:DI 0 "register_operand" "+r")
2115 (match_operand:DI 1 "register_operand" "+r"))
2120 [(set_attr "type" "imov")
2121 (set_attr "mode" "DI")
2122 (set_attr "pent_pair" "np")
2123 (set_attr "athlon_decode" "vector")])
2125 (define_expand "movsf"
2126 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2127 (match_operand:SF 1 "general_operand" ""))]
2129 "ix86_expand_move (SFmode, operands); DONE;")
2131 (define_insn "*pushsf"
2132 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2133 (match_operand:SF 1 "general_no_elim_operand" "f#rx,rFm#fx,x#rf"))]
2136 switch (which_alternative)
2139 return "push{l}\t%1";
2142 /* This insn should be already split before reg-stack. */
2146 [(set_attr "type" "multi,push,multi")
2147 (set_attr "mode" "SF,SI,SF")])
2149 (define_insn "*pushsf_rex64"
2150 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2151 (match_operand:SF 1 "nonmemory_no_elim_operand" "f#rx,rF#fx,x#rf"))]
2154 switch (which_alternative)
2157 return "push{q}\t%q1";
2160 /* This insn should be already split before reg-stack. */
2164 [(set_attr "type" "multi,push,multi")
2165 (set_attr "mode" "SF,DI,SF")])
2168 [(set (match_operand:SF 0 "push_operand" "")
2169 (match_operand:SF 1 "memory_operand" ""))]
2171 && GET_CODE (operands[1]) == MEM
2172 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2173 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
2176 "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
2179 ;; %%% Kill this when call knows how to work this out.
2181 [(set (match_operand:SF 0 "push_operand" "")
2182 (match_operand:SF 1 "any_fp_register_operand" ""))]
2184 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
2185 (set (mem:SF (reg:SI SP_REG)) (match_dup 1))])
2188 [(set (match_operand:SF 0 "push_operand" "")
2189 (match_operand:SF 1 "any_fp_register_operand" ""))]
2191 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2192 (set (mem:SF (reg:DI SP_REG)) (match_dup 1))])
2194 (define_insn "*movsf_1"
2195 [(set (match_operand:SF 0 "nonimmediate_operand"
2196 "=f#xr,m ,f#xr,r#xf ,m ,x#rf,x#rf,x#rf ,m ,!*y,!rm,!*y")
2197 (match_operand:SF 1 "general_operand"
2198 "fm#rx,f#rx,G ,rmF#fx,Fr#fx,C ,x ,xm#rf,x#rf,rm ,*y ,*y"))]
2199 "(TARGET_INTER_UNIT_MOVES || optimize_size)
2200 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2201 && (reload_in_progress || reload_completed
2202 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2203 || GET_CODE (operands[1]) != CONST_DOUBLE
2204 || memory_operand (operands[0], SFmode))"
2206 switch (which_alternative)
2209 return output_387_reg_move (insn, operands);
2212 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2213 return "fstp%z0\t%y0";
2215 return "fst%z0\t%y0";
2218 return standard_80387_constant_opcode (operands[1]);
2222 return "mov{l}\t{%1, %0|%0, %1}";
2224 if (get_attr_mode (insn) == MODE_TI)
2225 return "pxor\t%0, %0";
2227 return "xorps\t%0, %0";
2229 if (get_attr_mode (insn) == MODE_V4SF)
2230 return "movaps\t{%1, %0|%0, %1}";
2232 return "movss\t{%1, %0|%0, %1}";
2235 return "movss\t{%1, %0|%0, %1}";
2239 return "movd\t{%1, %0|%0, %1}";
2242 return "movq\t{%1, %0|%0, %1}";
2248 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2250 (cond [(eq_attr "alternative" "3,4,9,10")
2252 (eq_attr "alternative" "5")
2254 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2256 (ne (symbol_ref "TARGET_SSE2")
2258 (eq (symbol_ref "optimize_size")
2261 (const_string "V4SF"))
2262 /* For architectures resolving dependencies on
2263 whole SSE registers use APS move to break dependency
2264 chains, otherwise use short move to avoid extra work.
2266 Do the same for architectures resolving dependencies on
2267 the parts. While in DF mode it is better to always handle
2268 just register parts, the SF mode is different due to lack
2269 of instructions to load just part of the register. It is
2270 better to maintain the whole registers in single format
2271 to avoid problems on using packed logical operations. */
2272 (eq_attr "alternative" "6")
2274 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2276 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2278 (const_string "V4SF")
2279 (const_string "SF"))
2280 (eq_attr "alternative" "11")
2281 (const_string "DI")]
2282 (const_string "SF")))])
2284 (define_insn "*movsf_1_nointerunit"
2285 [(set (match_operand:SF 0 "nonimmediate_operand"
2286 "=f#xr,m ,f#xr,r#xf ,m ,x#rf,x#rf,x#rf ,m ,!*y,!m,!*y")
2287 (match_operand:SF 1 "general_operand"
2288 "fm#rx,f#rx,G ,rmF#fx,Fr#fx,C ,x ,xm#rf,x#rf,m ,*y,*y"))]
2289 "(!TARGET_INTER_UNIT_MOVES && !optimize_size)
2290 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2291 && (reload_in_progress || reload_completed
2292 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2293 || GET_CODE (operands[1]) != CONST_DOUBLE
2294 || memory_operand (operands[0], SFmode))"
2296 switch (which_alternative)
2299 return output_387_reg_move (insn, operands);
2302 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2303 return "fstp%z0\t%y0";
2305 return "fst%z0\t%y0";
2308 return standard_80387_constant_opcode (operands[1]);
2312 return "mov{l}\t{%1, %0|%0, %1}";
2314 if (get_attr_mode (insn) == MODE_TI)
2315 return "pxor\t%0, %0";
2317 return "xorps\t%0, %0";
2319 if (get_attr_mode (insn) == MODE_V4SF)
2320 return "movaps\t{%1, %0|%0, %1}";
2322 return "movss\t{%1, %0|%0, %1}";
2325 return "movss\t{%1, %0|%0, %1}";
2329 return "movd\t{%1, %0|%0, %1}";
2332 return "movq\t{%1, %0|%0, %1}";
2338 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2340 (cond [(eq_attr "alternative" "3,4,9,10")
2342 (eq_attr "alternative" "5")
2344 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2346 (ne (symbol_ref "TARGET_SSE2")
2348 (eq (symbol_ref "optimize_size")
2351 (const_string "V4SF"))
2352 /* For architectures resolving dependencies on
2353 whole SSE registers use APS move to break dependency
2354 chains, otherwise use short move to avoid extra work.
2356 Do the same for architectures resolving dependencies on
2357 the parts. While in DF mode it is better to always handle
2358 just register parts, the SF mode is different due to lack
2359 of instructions to load just part of the register. It is
2360 better to maintain the whole registers in single format
2361 to avoid problems on using packed logical operations. */
2362 (eq_attr "alternative" "6")
2364 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2366 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2368 (const_string "V4SF")
2369 (const_string "SF"))
2370 (eq_attr "alternative" "11")
2371 (const_string "DI")]
2372 (const_string "SF")))])
2374 (define_insn "*swapsf"
2375 [(set (match_operand:SF 0 "fp_register_operand" "+f")
2376 (match_operand:SF 1 "fp_register_operand" "+f"))
2379 "reload_completed || TARGET_80387"
2381 if (STACK_TOP_P (operands[0]))
2386 [(set_attr "type" "fxch")
2387 (set_attr "mode" "SF")])
2389 (define_expand "movdf"
2390 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2391 (match_operand:DF 1 "general_operand" ""))]
2393 "ix86_expand_move (DFmode, operands); DONE;")
2395 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2396 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2397 ;; On the average, pushdf using integers can be still shorter. Allow this
2398 ;; pattern for optimize_size too.
2400 (define_insn "*pushdf_nointeger"
2401 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2402 (match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))]
2403 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
2405 /* This insn should be already split before reg-stack. */
2408 [(set_attr "type" "multi")
2409 (set_attr "mode" "DF,SI,SI,DF")])
2411 (define_insn "*pushdf_integer"
2412 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2413 (match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))]
2414 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2416 /* This insn should be already split before reg-stack. */
2419 [(set_attr "type" "multi")
2420 (set_attr "mode" "DF,SI,DF")])
2422 ;; %%% Kill this when call knows how to work this out.
2424 [(set (match_operand:DF 0 "push_operand" "")
2425 (match_operand:DF 1 "any_fp_register_operand" ""))]
2426 "!TARGET_64BIT && reload_completed"
2427 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
2428 (set (mem:DF (reg:SI SP_REG)) (match_dup 1))]
2432 [(set (match_operand:DF 0 "push_operand" "")
2433 (match_operand:DF 1 "any_fp_register_operand" ""))]
2434 "TARGET_64BIT && reload_completed"
2435 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
2436 (set (mem:DF (reg:DI SP_REG)) (match_dup 1))]
2440 [(set (match_operand:DF 0 "push_operand" "")
2441 (match_operand:DF 1 "general_operand" ""))]
2444 "ix86_split_long_move (operands); DONE;")
2446 ;; Moving is usually shorter when only FP registers are used. This separate
2447 ;; movdf pattern avoids the use of integer registers for FP operations
2448 ;; when optimizing for size.
2450 (define_insn "*movdf_nointeger"
2451 [(set (match_operand:DF 0 "nonimmediate_operand"
2452 "=f#Y,m ,f#Y,*r ,o ,Y#f*x,Y#f*x,Y#f*x ,m ")
2453 (match_operand:DF 1 "general_operand"
2454 "fm#Y,f#Y,G ,*roF,F*r,C ,Y#f*x,HmY#f*x,Y#f*x"))]
2455 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2456 && ((optimize_size || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
2457 && (reload_in_progress || reload_completed
2458 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2459 || GET_CODE (operands[1]) != CONST_DOUBLE
2460 || memory_operand (operands[0], DFmode))"
2462 switch (which_alternative)
2465 return output_387_reg_move (insn, operands);
2468 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2469 return "fstp%z0\t%y0";
2471 return "fst%z0\t%y0";
2474 return standard_80387_constant_opcode (operands[1]);
2480 switch (get_attr_mode (insn))
2483 return "xorps\t%0, %0";
2485 return "xorpd\t%0, %0";
2487 return "pxor\t%0, %0";
2494 switch (get_attr_mode (insn))
2497 return "movaps\t{%1, %0|%0, %1}";
2499 return "movapd\t{%1, %0|%0, %1}";
2501 return "movdqa\t{%1, %0|%0, %1}";
2503 return "movq\t{%1, %0|%0, %1}";
2505 return "movsd\t{%1, %0|%0, %1}";
2507 return "movlpd\t{%1, %0|%0, %1}";
2509 return "movlps\t{%1, %0|%0, %1}";
2518 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2520 (cond [(eq_attr "alternative" "0,1,2")
2522 (eq_attr "alternative" "3,4")
2525 /* For SSE1, we have many fewer alternatives. */
2526 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2527 (cond [(eq_attr "alternative" "5,6")
2528 (const_string "V4SF")
2530 (const_string "V2SF"))
2532 /* xorps is one byte shorter. */
2533 (eq_attr "alternative" "5")
2534 (cond [(ne (symbol_ref "optimize_size")
2536 (const_string "V4SF")
2537 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2541 (const_string "V2DF"))
2543 /* For architectures resolving dependencies on
2544 whole SSE registers use APD move to break dependency
2545 chains, otherwise use short move to avoid extra work.
2547 movaps encodes one byte shorter. */
2548 (eq_attr "alternative" "6")
2550 [(ne (symbol_ref "optimize_size")
2552 (const_string "V4SF")
2553 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2555 (const_string "V2DF")
2557 (const_string "DF"))
2558 /* For architectures resolving dependencies on register
2559 parts we may avoid extra work to zero out upper part
2561 (eq_attr "alternative" "7")
2563 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2565 (const_string "V1DF")
2566 (const_string "DF"))
2568 (const_string "DF")))])
2570 (define_insn "*movdf_integer"
2571 [(set (match_operand:DF 0 "nonimmediate_operand"
2572 "=f#Yr,m ,f#Yr,r#Yf ,o ,Y#rf*x,Y#rf*x,Y#rf*x,m")
2573 (match_operand:DF 1 "general_operand"
2574 "fm#Yr,f#Yr,G ,roF#Yf,Fr#Yf,C ,Y#rf*x,m ,Y#rf*x"))]
2575 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2576 && ((!optimize_size && TARGET_INTEGER_DFMODE_MOVES) || TARGET_64BIT)
2577 && (reload_in_progress || reload_completed
2578 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2579 || GET_CODE (operands[1]) != CONST_DOUBLE
2580 || memory_operand (operands[0], DFmode))"
2582 switch (which_alternative)
2585 return output_387_reg_move (insn, operands);
2588 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2589 return "fstp%z0\t%y0";
2591 return "fst%z0\t%y0";
2594 return standard_80387_constant_opcode (operands[1]);
2601 switch (get_attr_mode (insn))
2604 return "xorps\t%0, %0";
2606 return "xorpd\t%0, %0";
2608 return "pxor\t%0, %0";
2615 switch (get_attr_mode (insn))
2618 return "movaps\t{%1, %0|%0, %1}";
2620 return "movapd\t{%1, %0|%0, %1}";
2622 return "movdqa\t{%1, %0|%0, %1}";
2624 return "movq\t{%1, %0|%0, %1}";
2626 return "movsd\t{%1, %0|%0, %1}";
2628 return "movlpd\t{%1, %0|%0, %1}";
2630 return "movlps\t{%1, %0|%0, %1}";
2639 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2641 (cond [(eq_attr "alternative" "0,1,2")
2643 (eq_attr "alternative" "3,4")
2646 /* For SSE1, we have many fewer alternatives. */
2647 (eq (symbol_ref "TARGET_SSE2") (const_int 0))
2648 (cond [(eq_attr "alternative" "5,6")
2649 (const_string "V4SF")
2651 (const_string "V2SF"))
2653 /* xorps is one byte shorter. */
2654 (eq_attr "alternative" "5")
2655 (cond [(ne (symbol_ref "optimize_size")
2657 (const_string "V4SF")
2658 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2662 (const_string "V2DF"))
2664 /* For architectures resolving dependencies on
2665 whole SSE registers use APD move to break dependency
2666 chains, otherwise use short move to avoid extra work.
2668 movaps encodes one byte shorter. */
2669 (eq_attr "alternative" "6")
2671 [(ne (symbol_ref "optimize_size")
2673 (const_string "V4SF")
2674 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2676 (const_string "V2DF")
2678 (const_string "DF"))
2679 /* For architectures resolving dependencies on register
2680 parts we may avoid extra work to zero out upper part
2682 (eq_attr "alternative" "7")
2684 (ne (symbol_ref "TARGET_SSE_SPLIT_REGS")
2686 (const_string "V1DF")
2687 (const_string "DF"))
2689 (const_string "DF")))])
2692 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2693 (match_operand:DF 1 "general_operand" ""))]
2695 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2696 && ! (ANY_FP_REG_P (operands[0]) ||
2697 (GET_CODE (operands[0]) == SUBREG
2698 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2699 && ! (ANY_FP_REG_P (operands[1]) ||
2700 (GET_CODE (operands[1]) == SUBREG
2701 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2703 "ix86_split_long_move (operands); DONE;")
2705 (define_insn "*swapdf"
2706 [(set (match_operand:DF 0 "fp_register_operand" "+f")
2707 (match_operand:DF 1 "fp_register_operand" "+f"))
2710 "reload_completed || TARGET_80387"
2712 if (STACK_TOP_P (operands[0]))
2717 [(set_attr "type" "fxch")
2718 (set_attr "mode" "DF")])
2720 (define_expand "movxf"
2721 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2722 (match_operand:XF 1 "general_operand" ""))]
2724 "ix86_expand_move (XFmode, operands); DONE;")
2726 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2727 ;; Size of pushdf using integer instructions is 3+3*memory operand size
2728 ;; Pushing using integer instructions is longer except for constants
2729 ;; and direct memory references.
2730 ;; (assuming that any given constant is pushed only once, but this ought to be
2731 ;; handled elsewhere).
2733 (define_insn "*pushxf_nointeger"
2734 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2735 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2738 /* This insn should be already split before reg-stack. */
2741 [(set_attr "type" "multi")
2742 (set_attr "mode" "XF,SI,SI")])
2744 (define_insn "*pushxf_integer"
2745 [(set (match_operand:XF 0 "push_operand" "=<,<")
2746 (match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))]
2749 /* This insn should be already split before reg-stack. */
2752 [(set_attr "type" "multi")
2753 (set_attr "mode" "XF,SI")])
2756 [(set (match_operand 0 "push_operand" "")
2757 (match_operand 1 "general_operand" ""))]
2759 && (GET_MODE (operands[0]) == XFmode
2760 || GET_MODE (operands[0]) == DFmode)
2761 && !ANY_FP_REG_P (operands[1])"
2763 "ix86_split_long_move (operands); DONE;")
2766 [(set (match_operand:XF 0 "push_operand" "")
2767 (match_operand:XF 1 "any_fp_register_operand" ""))]
2769 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
2770 (set (mem:XF (reg:SI SP_REG)) (match_dup 1))]
2771 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
2774 [(set (match_operand:XF 0 "push_operand" "")
2775 (match_operand:XF 1 "any_fp_register_operand" ""))]
2777 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
2778 (set (mem:XF (reg:DI SP_REG)) (match_dup 1))]
2779 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
2781 ;; Do not use integer registers when optimizing for size
2782 (define_insn "*movxf_nointeger"
2783 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2784 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2786 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2787 && (reload_in_progress || reload_completed
2788 || GET_CODE (operands[1]) != CONST_DOUBLE
2789 || memory_operand (operands[0], XFmode))"
2791 switch (which_alternative)
2794 return output_387_reg_move (insn, operands);
2797 /* There is no non-popping store to memory for XFmode. So if
2798 we need one, follow the store with a load. */
2799 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2800 return "fstp%z0\t%y0\;fld%z0\t%y0";
2802 return "fstp%z0\t%y0";
2805 return standard_80387_constant_opcode (operands[1]);
2812 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2813 (set_attr "mode" "XF,XF,XF,SI,SI")])
2815 (define_insn "*movxf_integer"
2816 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
2817 (match_operand:XF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
2819 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2820 && (reload_in_progress || reload_completed
2821 || GET_CODE (operands[1]) != CONST_DOUBLE
2822 || memory_operand (operands[0], XFmode))"
2824 switch (which_alternative)
2827 return output_387_reg_move (insn, operands);
2830 /* There is no non-popping store to memory for XFmode. So if
2831 we need one, follow the store with a load. */
2832 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2833 return "fstp%z0\t%y0\;fld%z0\t%y0";
2835 return "fstp%z0\t%y0";
2838 return standard_80387_constant_opcode (operands[1]);
2845 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2846 (set_attr "mode" "XF,XF,XF,SI,SI")])
2849 [(set (match_operand 0 "nonimmediate_operand" "")
2850 (match_operand 1 "general_operand" ""))]
2852 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2853 && GET_MODE (operands[0]) == XFmode
2854 && ! (ANY_FP_REG_P (operands[0]) ||
2855 (GET_CODE (operands[0]) == SUBREG
2856 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2857 && ! (ANY_FP_REG_P (operands[1]) ||
2858 (GET_CODE (operands[1]) == SUBREG
2859 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2861 "ix86_split_long_move (operands); DONE;")
2864 [(set (match_operand 0 "register_operand" "")
2865 (match_operand 1 "memory_operand" ""))]
2867 && GET_CODE (operands[1]) == MEM
2868 && (GET_MODE (operands[0]) == XFmode
2869 || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
2870 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2871 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
2872 [(set (match_dup 0) (match_dup 1))]
2874 rtx c = get_pool_constant (XEXP (operands[1], 0));
2875 rtx r = operands[0];
2877 if (GET_CODE (r) == SUBREG)
2882 if (!standard_sse_constant_p (c))
2885 else if (FP_REG_P (r))
2887 if (!standard_80387_constant_p (c))
2890 else if (MMX_REG_P (r))
2896 (define_insn "swapxf"
2897 [(set (match_operand:XF 0 "register_operand" "+f")
2898 (match_operand:XF 1 "register_operand" "+f"))
2903 if (STACK_TOP_P (operands[0]))
2908 [(set_attr "type" "fxch")
2909 (set_attr "mode" "XF")])
2911 ;; Zero extension instructions
2913 (define_expand "zero_extendhisi2"
2914 [(set (match_operand:SI 0 "register_operand" "")
2915 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
2918 if (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
2920 operands[1] = force_reg (HImode, operands[1]);
2921 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
2926 (define_insn "zero_extendhisi2_and"
2927 [(set (match_operand:SI 0 "register_operand" "=r")
2928 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
2929 (clobber (reg:CC FLAGS_REG))]
2930 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2932 [(set_attr "type" "alu1")
2933 (set_attr "mode" "SI")])
2936 [(set (match_operand:SI 0 "register_operand" "")
2937 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
2938 (clobber (reg:CC FLAGS_REG))]
2939 "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2940 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
2941 (clobber (reg:CC FLAGS_REG))])]
2944 (define_insn "*zero_extendhisi2_movzwl"
2945 [(set (match_operand:SI 0 "register_operand" "=r")
2946 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
2947 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2948 "movz{wl|x}\t{%1, %0|%0, %1}"
2949 [(set_attr "type" "imovx")
2950 (set_attr "mode" "SI")])
2952 (define_expand "zero_extendqihi2"
2954 [(set (match_operand:HI 0 "register_operand" "")
2955 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2956 (clobber (reg:CC FLAGS_REG))])]
2960 (define_insn "*zero_extendqihi2_and"
2961 [(set (match_operand:HI 0 "register_operand" "=r,?&q")
2962 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
2963 (clobber (reg:CC FLAGS_REG))]
2964 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2966 [(set_attr "type" "alu1")
2967 (set_attr "mode" "HI")])
2969 (define_insn "*zero_extendqihi2_movzbw_and"
2970 [(set (match_operand:HI 0 "register_operand" "=r,r")
2971 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
2972 (clobber (reg:CC FLAGS_REG))]
2973 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2975 [(set_attr "type" "imovx,alu1")
2976 (set_attr "mode" "HI")])
2978 (define_insn "*zero_extendqihi2_movzbw"
2979 [(set (match_operand:HI 0 "register_operand" "=r")
2980 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
2981 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
2982 "movz{bw|x}\t{%1, %0|%0, %1}"
2983 [(set_attr "type" "imovx")
2984 (set_attr "mode" "HI")])
2986 ;; For the movzbw case strip only the clobber
2988 [(set (match_operand:HI 0 "register_operand" "")
2989 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2990 (clobber (reg:CC FLAGS_REG))]
2992 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
2993 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
2994 [(set (match_operand:HI 0 "register_operand" "")
2995 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))])
2997 ;; When source and destination does not overlap, clear destination
2998 ;; first and then do the movb
3000 [(set (match_operand:HI 0 "register_operand" "")
3001 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3002 (clobber (reg:CC FLAGS_REG))]
3004 && ANY_QI_REG_P (operands[0])
3005 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3006 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3007 [(set (match_dup 0) (const_int 0))
3008 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3009 "operands[2] = gen_lowpart (QImode, operands[0]);")
3011 ;; Rest is handled by single and.
3013 [(set (match_operand:HI 0 "register_operand" "")
3014 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))
3015 (clobber (reg:CC FLAGS_REG))]
3017 && true_regnum (operands[0]) == true_regnum (operands[1])"
3018 [(parallel [(set (match_dup 0) (and:HI (match_dup 0) (const_int 255)))
3019 (clobber (reg:CC FLAGS_REG))])]
3022 (define_expand "zero_extendqisi2"
3024 [(set (match_operand:SI 0 "register_operand" "")
3025 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3026 (clobber (reg:CC FLAGS_REG))])]
3030 (define_insn "*zero_extendqisi2_and"
3031 [(set (match_operand:SI 0 "register_operand" "=r,?&q")
3032 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3033 (clobber (reg:CC FLAGS_REG))]
3034 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
3036 [(set_attr "type" "alu1")
3037 (set_attr "mode" "SI")])
3039 (define_insn "*zero_extendqisi2_movzbw_and"
3040 [(set (match_operand:SI 0 "register_operand" "=r,r")
3041 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3042 (clobber (reg:CC FLAGS_REG))]
3043 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
3045 [(set_attr "type" "imovx,alu1")
3046 (set_attr "mode" "SI")])
3048 (define_insn "*zero_extendqisi2_movzbw"
3049 [(set (match_operand:SI 0 "register_operand" "=r")
3050 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3051 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
3052 "movz{bl|x}\t{%1, %0|%0, %1}"
3053 [(set_attr "type" "imovx")
3054 (set_attr "mode" "SI")])
3056 ;; For the movzbl case strip only the clobber
3058 [(set (match_operand:SI 0 "register_operand" "")
3059 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3060 (clobber (reg:CC FLAGS_REG))]
3062 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
3063 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3065 (zero_extend:SI (match_dup 1)))])
3067 ;; When source and destination does not overlap, clear destination
3068 ;; first and then do the movb
3070 [(set (match_operand:SI 0 "register_operand" "")
3071 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3072 (clobber (reg:CC FLAGS_REG))]
3074 && ANY_QI_REG_P (operands[0])
3075 && (ANY_QI_REG_P (operands[1]) || GET_CODE (operands[1]) == MEM)
3076 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3077 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3078 [(set (match_dup 0) (const_int 0))
3079 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3080 "operands[2] = gen_lowpart (QImode, operands[0]);")
3082 ;; Rest is handled by single and.
3084 [(set (match_operand:SI 0 "register_operand" "")
3085 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
3086 (clobber (reg:CC FLAGS_REG))]
3088 && true_regnum (operands[0]) == true_regnum (operands[1])"
3089 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 255)))
3090 (clobber (reg:CC FLAGS_REG))])]
3093 ;; %%% Kill me once multi-word ops are sane.
3094 (define_expand "zero_extendsidi2"
3095 [(set (match_operand:DI 0 "register_operand" "=r")
3096 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
3100 emit_insn (gen_zero_extendsidi2_32 (operands[0], operands[1]));
3105 (define_insn "zero_extendsidi2_32"
3106 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o,!?y,!?Y")
3107 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r,m,m")))
3108 (clobber (reg:CC FLAGS_REG))]
3109 "!TARGET_64BIT && !TARGET_INTER_UNIT_MOVES"
3114 movd\t{%1, %0|%0, %1}
3115 movd\t{%1, %0|%0, %1}"
3116 [(set_attr "mode" "SI,SI,SI,DI,TI")
3117 (set_attr "type" "multi,multi,multi,mmxmov,ssemov")])
3119 (define_insn "*zero_extendsidi2_32_1"
3120 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o,!?y,!?Y")
3121 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r,rm,rm")))
3122 (clobber (reg:CC FLAGS_REG))]
3123 "!TARGET_64BIT && TARGET_INTER_UNIT_MOVES"
3128 movd\t{%1, %0|%0, %1}
3129 movd\t{%1, %0|%0, %1}"
3130 [(set_attr "mode" "SI,SI,SI,DI,TI")
3131 (set_attr "type" "multi,multi,multi,mmxmov,ssemov")])
3133 (define_insn "zero_extendsidi2_rex64"
3134 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!?y,!?Y")
3135 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0,m,m")))]
3136 "TARGET_64BIT && !TARGET_INTER_UNIT_MOVES"
3138 mov\t{%k1, %k0|%k0, %k1}
3140 movd\t{%1, %0|%0, %1}
3141 movd\t{%1, %0|%0, %1}"
3142 [(set_attr "type" "imovx,imov,mmxmov,ssemov")
3143 (set_attr "mode" "SI,DI,DI,TI")])
3145 (define_insn "*zero_extendsidi2_rex64_1"
3146 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!?y,!*?")
3147 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0,rm,rm")))]
3148 "TARGET_64BIT && TARGET_INTER_UNIT_MOVES"
3150 mov\t{%k1, %k0|%k0, %k1}
3152 movd\t{%1, %0|%0, %1}
3153 movd\t{%1, %0|%0, %1}"
3154 [(set_attr "type" "imovx,imov,mmxmov,ssemov")
3155 (set_attr "mode" "SI,DI,SI,SI")])
3158 [(set (match_operand:DI 0 "memory_operand" "")
3159 (zero_extend:DI (match_dup 0)))]
3161 [(set (match_dup 4) (const_int 0))]
3162 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3165 [(set (match_operand:DI 0 "register_operand" "")
3166 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3167 (clobber (reg:CC FLAGS_REG))]
3168 "!TARGET_64BIT && reload_completed
3169 && true_regnum (operands[0]) == true_regnum (operands[1])"
3170 [(set (match_dup 4) (const_int 0))]
3171 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3174 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3175 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3176 (clobber (reg:CC FLAGS_REG))]
3177 "!TARGET_64BIT && reload_completed
3178 && !SSE_REG_P (operands[0]) && !MMX_REG_P (operands[0])"
3179 [(set (match_dup 3) (match_dup 1))
3180 (set (match_dup 4) (const_int 0))]
3181 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3183 (define_insn "zero_extendhidi2"
3184 [(set (match_operand:DI 0 "register_operand" "=r,r")
3185 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
3188 movz{wl|x}\t{%1, %k0|%k0, %1}
3189 movz{wq|x}\t{%1, %0|%0, %1}"
3190 [(set_attr "type" "imovx")
3191 (set_attr "mode" "SI,DI")])
3193 (define_insn "zero_extendqidi2"
3194 [(set (match_operand:DI 0 "register_operand" "=r,r")
3195 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "Q,m")))]
3198 movz{bl|x}\t{%1, %k0|%k0, %1}
3199 movz{bq|x}\t{%1, %0|%0, %1}"
3200 [(set_attr "type" "imovx")
3201 (set_attr "mode" "SI,DI")])
3203 ;; Sign extension instructions
3205 (define_expand "extendsidi2"
3206 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3207 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3208 (clobber (reg:CC FLAGS_REG))
3209 (clobber (match_scratch:SI 2 ""))])]
3214 emit_insn (gen_extendsidi2_rex64 (operands[0], operands[1]));
3219 (define_insn "*extendsidi2_1"
3220 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3221 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3222 (clobber (reg:CC FLAGS_REG))
3223 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3227 (define_insn "extendsidi2_rex64"
3228 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3229 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3233 movs{lq|x}\t{%1,%0|%0, %1}"
3234 [(set_attr "type" "imovx")
3235 (set_attr "mode" "DI")
3236 (set_attr "prefix_0f" "0")
3237 (set_attr "modrm" "0,1")])
3239 (define_insn "extendhidi2"
3240 [(set (match_operand:DI 0 "register_operand" "=r")
3241 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3243 "movs{wq|x}\t{%1,%0|%0, %1}"
3244 [(set_attr "type" "imovx")
3245 (set_attr "mode" "DI")])
3247 (define_insn "extendqidi2"
3248 [(set (match_operand:DI 0 "register_operand" "=r")
3249 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3251 "movs{bq|x}\t{%1,%0|%0, %1}"
3252 [(set_attr "type" "imovx")
3253 (set_attr "mode" "DI")])
3255 ;; Extend to memory case when source register does die.
3257 [(set (match_operand:DI 0 "memory_operand" "")
3258 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3259 (clobber (reg:CC FLAGS_REG))
3260 (clobber (match_operand:SI 2 "register_operand" ""))]
3262 && dead_or_set_p (insn, operands[1])
3263 && !reg_mentioned_p (operands[1], operands[0]))"
3264 [(set (match_dup 3) (match_dup 1))
3265 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3266 (clobber (reg:CC FLAGS_REG))])
3267 (set (match_dup 4) (match_dup 1))]
3268 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3270 ;; Extend to memory case when source register does not die.
3272 [(set (match_operand:DI 0 "memory_operand" "")
3273 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3274 (clobber (reg:CC FLAGS_REG))
3275 (clobber (match_operand:SI 2 "register_operand" ""))]
3279 split_di (&operands[0], 1, &operands[3], &operands[4]);
3281 emit_move_insn (operands[3], operands[1]);
3283 /* Generate a cltd if possible and doing so it profitable. */
3284 if (true_regnum (operands[1]) == 0
3285 && true_regnum (operands[2]) == 1
3286 && (optimize_size || TARGET_USE_CLTD))
3288 emit_insn (gen_ashrsi3_31 (operands[2], operands[1], GEN_INT (31)));
3292 emit_move_insn (operands[2], operands[1]);
3293 emit_insn (gen_ashrsi3_31 (operands[2], operands[2], GEN_INT (31)));
3295 emit_move_insn (operands[4], operands[2]);
3299 ;; Extend to register case. Optimize case where source and destination
3300 ;; registers match and cases where we can use cltd.
3302 [(set (match_operand:DI 0 "register_operand" "")
3303 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3304 (clobber (reg:CC FLAGS_REG))
3305 (clobber (match_scratch:SI 2 ""))]
3309 split_di (&operands[0], 1, &operands[3], &operands[4]);
3311 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3312 emit_move_insn (operands[3], operands[1]);
3314 /* Generate a cltd if possible and doing so it profitable. */
3315 if (true_regnum (operands[3]) == 0
3316 && (optimize_size || TARGET_USE_CLTD))
3318 emit_insn (gen_ashrsi3_31 (operands[4], operands[3], GEN_INT (31)));
3322 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3323 emit_move_insn (operands[4], operands[1]);
3325 emit_insn (gen_ashrsi3_31 (operands[4], operands[4], GEN_INT (31)));
3329 (define_insn "extendhisi2"
3330 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3331 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3334 switch (get_attr_prefix_0f (insn))
3337 return "{cwtl|cwde}";
3339 return "movs{wl|x}\t{%1,%0|%0, %1}";
3342 [(set_attr "type" "imovx")
3343 (set_attr "mode" "SI")
3344 (set (attr "prefix_0f")
3345 ;; movsx is short decodable while cwtl is vector decoded.
3346 (if_then_else (and (eq_attr "cpu" "!k6")
3347 (eq_attr "alternative" "0"))
3349 (const_string "1")))
3351 (if_then_else (eq_attr "prefix_0f" "0")
3353 (const_string "1")))])
3355 (define_insn "*extendhisi2_zext"
3356 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3358 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm"))))]
3361 switch (get_attr_prefix_0f (insn))
3364 return "{cwtl|cwde}";
3366 return "movs{wl|x}\t{%1,%k0|%k0, %1}";
3369 [(set_attr "type" "imovx")
3370 (set_attr "mode" "SI")
3371 (set (attr "prefix_0f")
3372 ;; movsx is short decodable while cwtl is vector decoded.
3373 (if_then_else (and (eq_attr "cpu" "!k6")
3374 (eq_attr "alternative" "0"))
3376 (const_string "1")))
3378 (if_then_else (eq_attr "prefix_0f" "0")
3380 (const_string "1")))])
3382 (define_insn "extendqihi2"
3383 [(set (match_operand:HI 0 "register_operand" "=*a,r")
3384 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "*0,qm")))]
3387 switch (get_attr_prefix_0f (insn))
3390 return "{cbtw|cbw}";
3392 return "movs{bw|x}\t{%1,%0|%0, %1}";
3395 [(set_attr "type" "imovx")
3396 (set_attr "mode" "HI")
3397 (set (attr "prefix_0f")
3398 ;; movsx is short decodable while cwtl is vector decoded.
3399 (if_then_else (and (eq_attr "cpu" "!k6")
3400 (eq_attr "alternative" "0"))
3402 (const_string "1")))
3404 (if_then_else (eq_attr "prefix_0f" "0")
3406 (const_string "1")))])
3408 (define_insn "extendqisi2"
3409 [(set (match_operand:SI 0 "register_operand" "=r")
3410 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3412 "movs{bl|x}\t{%1,%0|%0, %1}"
3413 [(set_attr "type" "imovx")
3414 (set_attr "mode" "SI")])
3416 (define_insn "*extendqisi2_zext"
3417 [(set (match_operand:DI 0 "register_operand" "=r")
3419 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm"))))]
3421 "movs{bl|x}\t{%1,%k0|%k0, %1}"
3422 [(set_attr "type" "imovx")
3423 (set_attr "mode" "SI")])
3425 ;; Conversions between float and double.
3427 ;; These are all no-ops in the model used for the 80387. So just
3430 ;; %%% Kill these when call knows how to work out a DFmode push earlier.
3431 (define_insn "*dummy_extendsfdf2"
3432 [(set (match_operand:DF 0 "push_operand" "=<")
3433 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fY")))]
3438 [(set (match_operand:DF 0 "push_operand" "")
3439 (float_extend:DF (match_operand:SF 1 "fp_register_operand" "")))]
3441 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
3442 (set (mem:DF (reg:SI SP_REG)) (float_extend:DF (match_dup 1)))])
3445 [(set (match_operand:DF 0 "push_operand" "")
3446 (float_extend:DF (match_operand:SF 1 "fp_register_operand" "")))]
3448 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
3449 (set (mem:DF (reg:DI SP_REG)) (float_extend:DF (match_dup 1)))])
3451 (define_insn "*dummy_extendsfxf2"
3452 [(set (match_operand:XF 0 "push_operand" "=<")
3453 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "f")))]
3458 [(set (match_operand:XF 0 "push_operand" "")
3459 (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
3461 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
3462 (set (mem:XF (reg:SI SP_REG)) (float_extend:XF (match_dup 1)))]
3463 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3466 [(set (match_operand:XF 0 "push_operand" "")
3467 (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
3469 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
3470 (set (mem:DF (reg:DI SP_REG)) (float_extend:XF (match_dup 1)))]
3471 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3474 [(set (match_operand:XF 0 "push_operand" "")
3475 (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))]
3477 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
3478 (set (mem:DF (reg:SI SP_REG)) (float_extend:XF (match_dup 1)))]
3479 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3482 [(set (match_operand:XF 0 "push_operand" "")
3483 (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))]
3485 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
3486 (set (mem:XF (reg:DI SP_REG)) (float_extend:XF (match_dup 1)))]
3487 "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
3489 (define_expand "extendsfdf2"
3490 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3491 (float_extend:DF (match_operand:SF 1 "general_operand" "")))]
3492 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
3494 /* ??? Needed for compress_float_constant since all fp constants
3495 are LEGITIMATE_CONSTANT_P. */
3496 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3497 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3498 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3499 operands[1] = force_reg (SFmode, operands[1]);
3502 (define_insn "*extendsfdf2_mixed"
3503 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,m#fY,Y#f")
3504 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm#Y,f#Y,mY#f")))]
3505 "TARGET_SSE2 && TARGET_MIX_SSE_I387
3506 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3508 switch (which_alternative)
3511 return output_387_reg_move (insn, operands);
3514 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3515 return "fstp%z0\t%y0";
3517 return "fst%z0\t%y0";
3520 return "cvtss2sd\t{%1, %0|%0, %1}";
3526 [(set_attr "type" "fmov,fmov,ssecvt")
3527 (set_attr "mode" "SF,XF,DF")])
3529 (define_insn "*extendsfdf2_sse"
3530 [(set (match_operand:DF 0 "register_operand" "=Y")
3531 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "mY")))]
3532 "TARGET_SSE2 && TARGET_SSE_MATH
3533 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3534 "cvtss2sd\t{%1, %0|%0, %1}"
3535 [(set_attr "type" "ssecvt")
3536 (set_attr "mode" "DF")])
3538 (define_insn "*extendsfdf2_i387"
3539 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m")
3540 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3542 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3544 switch (which_alternative)
3547 return output_387_reg_move (insn, operands);
3550 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3551 return "fstp%z0\t%y0";
3553 return "fst%z0\t%y0";
3559 [(set_attr "type" "fmov")
3560 (set_attr "mode" "SF,XF")])
3562 (define_expand "extendsfxf2"
3563 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3564 (float_extend:XF (match_operand:SF 1 "general_operand" "")))]
3567 /* ??? Needed for compress_float_constant since all fp constants
3568 are LEGITIMATE_CONSTANT_P. */
3569 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3570 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3571 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3572 operands[1] = force_reg (SFmode, operands[1]);
3575 (define_insn "*extendsfxf2_i387"
3576 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3577 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3579 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3581 switch (which_alternative)
3584 return output_387_reg_move (insn, operands);
3587 /* There is no non-popping store to memory for XFmode. So if
3588 we need one, follow the store with a load. */
3589 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3590 return "fstp%z0\t%y0";
3592 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3598 [(set_attr "type" "fmov")
3599 (set_attr "mode" "SF,XF")])
3601 (define_expand "extenddfxf2"
3602 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3603 (float_extend:XF (match_operand:DF 1 "general_operand" "")))]
3606 /* ??? Needed for compress_float_constant since all fp constants
3607 are LEGITIMATE_CONSTANT_P. */
3608 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3609 operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
3610 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3611 operands[1] = force_reg (DFmode, operands[1]);
3614 (define_insn "*extenddfxf2_i387"
3615 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3616 (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
3618 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3620 switch (which_alternative)
3623 return output_387_reg_move (insn, operands);
3626 /* There is no non-popping store to memory for XFmode. So if
3627 we need one, follow the store with a load. */
3628 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3629 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3631 return "fstp%z0\t%y0";
3637 [(set_attr "type" "fmov")
3638 (set_attr "mode" "DF,XF")])
3640 ;; %%% This seems bad bad news.
3641 ;; This cannot output into an f-reg because there is no way to be sure
3642 ;; of truncating in that case. Otherwise this is just like a simple move
3643 ;; insn. So we pretend we can output to a reg in order to get better
3644 ;; register preferencing, but we really use a stack slot.
3646 ;; Conversion from DFmode to SFmode.
3648 (define_expand "truncdfsf2"
3649 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3651 (match_operand:DF 1 "nonimmediate_operand" "")))]
3652 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
3654 if (MEM_P (operands[0]) && MEM_P (operands[1]))
3655 operands[1] = force_reg (DFmode, operands[1]);
3657 if (TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_MIX_SSE_I387)
3659 else if (flag_unsafe_math_optimizations)
3663 rtx temp = assign_386_stack_local (SFmode, 0);
3664 emit_insn (gen_truncdfsf2_with_temp (operands[0], operands[1], temp));
3669 (define_expand "truncdfsf2_with_temp"
3670 [(parallel [(set (match_operand:SF 0 "" "")
3671 (float_truncate:SF (match_operand:DF 1 "" "")))
3672 (clobber (match_operand:SF 2 "" ""))])]
3675 (define_insn "*truncdfsf_fast_mixed"
3676 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,f,Y")
3678 (match_operand:DF 1 "nonimmediate_operand" "f ,f,Ym")))]
3679 "TARGET_SSE2 && TARGET_MIX_SSE_I387 && flag_unsafe_math_optimizations"
3681 switch (which_alternative)
3684 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3685 return "fstp%z0\t%y0";
3687 return "fst%z0\t%y0";
3689 return output_387_reg_move (insn, operands);
3691 return "cvtsd2ss\t{%1, %0|%0, %1}";
3696 [(set_attr "type" "fmov,fmov,ssecvt")
3697 (set_attr "mode" "SF")])
3699 ;; Yes, this one doesn't depend on flag_unsafe_math_optimizations,
3700 ;; because nothing we do here is unsafe.
3701 (define_insn "*truncdfsf_fast_sse"
3702 [(set (match_operand:SF 0 "nonimmediate_operand" "=Y")
3704 (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
3705 "TARGET_SSE2 && TARGET_SSE_MATH"
3706 "cvtsd2ss\t{%1, %0|%0, %1}"
3707 [(set_attr "type" "ssecvt")
3708 (set_attr "mode" "SF")])
3710 (define_insn "*truncdfsf_fast_i387"
3711 [(set (match_operand:SF 0 "nonimmediate_operand" "=fm")
3713 (match_operand:DF 1 "nonimmediate_operand" "f")))]
3714 "TARGET_80387 && flag_unsafe_math_optimizations"
3715 "* return output_387_reg_move (insn, operands);"
3716 [(set_attr "type" "fmov")
3717 (set_attr "mode" "SF")])
3719 (define_insn "*truncdfsf_mixed"
3720 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?fx*r,Y")
3722 (match_operand:DF 1 "nonimmediate_operand" "f ,f ,Ym")))
3723 (clobber (match_operand:SF 2 "memory_operand" "=X,m ,X"))]
3724 "TARGET_MIX_SSE_I387"
3726 switch (which_alternative)
3729 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3730 return "fstp%z0\t%y0";
3732 return "fst%z0\t%y0";
3736 return "cvtsd2ss\t{%1, %0|%0, %1}";
3741 [(set_attr "type" "fmov,multi,ssecvt")
3742 (set_attr "mode" "SF")])
3744 (define_insn "*truncdfsf_i387"
3745 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?fx*r")
3747 (match_operand:DF 1 "nonimmediate_operand" "f,f")))
3748 (clobber (match_operand:SF 2 "memory_operand" "=X,m"))]
3751 switch (which_alternative)
3754 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3755 return "fstp%z0\t%y0";
3757 return "fst%z0\t%y0";
3764 [(set_attr "type" "fmov,multi")
3765 (set_attr "mode" "SF")])
3768 [(set (match_operand:SF 0 "register_operand" "")
3770 (match_operand:DF 1 "fp_register_operand" "")))
3771 (clobber (match_operand 2 "" ""))]
3773 [(set (match_dup 2) (match_dup 1))
3774 (set (match_dup 0) (match_dup 2))]
3776 operands[1] = gen_rtx_REG (SFmode, true_regnum (operands[1]));
3779 ;; Conversion from XFmode to SFmode.
3781 (define_expand "truncxfsf2"
3782 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3784 (match_operand:XF 1 "register_operand" "")))
3785 (clobber (match_dup 2))])]
3788 if (flag_unsafe_math_optimizations)
3790 rtx reg = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SFmode);
3791 emit_insn (gen_truncxfsf2_i387_noop (reg, operands[1]));
3792 if (reg != operands[0])
3793 emit_move_insn (operands[0], reg);
3797 operands[2] = assign_386_stack_local (SFmode, 0);
3800 (define_insn "*truncxfsf2_mixed"
3801 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3803 (match_operand:XF 1 "register_operand" "f,f,f,f")))
3804 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3805 "TARGET_MIX_SSE_I387"
3807 switch (which_alternative)
3810 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3811 return "fstp%z0\t%y0";
3813 return "fst%z0\t%y0";
3818 [(set_attr "type" "fmov,multi,multi,multi")
3819 (set_attr "mode" "SF")])
3821 (define_insn "truncxfsf2_i387_noop"
3822 [(set (match_operand:SF 0 "register_operand" "=f")
3823 (float_truncate:SF (match_operand:XF 1 "register_operand" "f")))]
3824 "TARGET_80387 && flag_unsafe_math_optimizations"
3826 return output_387_reg_move (insn, operands);
3828 [(set_attr "type" "fmov")
3829 (set_attr "mode" "SF")])
3831 (define_insn "*truncxfsf2_i387"
3832 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#r,?r#f")
3834 (match_operand:XF 1 "register_operand" "f,f,f")))
3835 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m"))]
3838 switch (which_alternative)
3841 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3842 return "fstp%z0\t%y0";
3844 return "fst%z0\t%y0";
3849 [(set_attr "type" "fmov,multi,multi")
3850 (set_attr "mode" "SF")])
3852 (define_insn "*truncxfsf2_i387_1"
3853 [(set (match_operand:SF 0 "memory_operand" "=m")
3855 (match_operand:XF 1 "register_operand" "f")))]
3858 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3859 return "fstp%z0\t%y0";
3861 return "fst%z0\t%y0";
3863 [(set_attr "type" "fmov")
3864 (set_attr "mode" "SF")])
3867 [(set (match_operand:SF 0 "register_operand" "")
3869 (match_operand:XF 1 "register_operand" "")))
3870 (clobber (match_operand:SF 2 "memory_operand" ""))]
3871 "TARGET_80387 && reload_completed"
3872 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
3873 (set (match_dup 0) (match_dup 2))]
3877 [(set (match_operand:SF 0 "memory_operand" "")
3879 (match_operand:XF 1 "register_operand" "")))
3880 (clobber (match_operand:SF 2 "memory_operand" ""))]
3882 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3885 ;; Conversion from XFmode to DFmode.
3887 (define_expand "truncxfdf2"
3888 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
3890 (match_operand:XF 1 "register_operand" "")))
3891 (clobber (match_dup 2))])]
3894 if (flag_unsafe_math_optimizations)
3896 rtx reg = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DFmode);
3897 emit_insn (gen_truncxfdf2_i387_noop (reg, operands[1]));
3898 if (reg != operands[0])
3899 emit_move_insn (operands[0], reg);
3903 operands[2] = assign_386_stack_local (DFmode, 0);
3906 (define_insn "*truncxfdf2_mixed"
3907 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")
3909 (match_operand:XF 1 "register_operand" "f,f,f,f")))
3910 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))]
3911 "TARGET_SSE2 && TARGET_MIX_SSE_I387"
3913 switch (which_alternative)
3916 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3917 return "fstp%z0\t%y0";
3919 return "fst%z0\t%y0";
3925 [(set_attr "type" "fmov,multi,multi,multi")
3926 (set_attr "mode" "DF")])
3928 (define_insn "truncxfdf2_i387_noop"
3929 [(set (match_operand:DF 0 "register_operand" "=f")
3930 (float_truncate:DF (match_operand:XF 1 "register_operand" "f")))]
3931 "TARGET_80387 && flag_unsafe_math_optimizations"
3933 return output_387_reg_move (insn, operands);
3935 [(set_attr "type" "fmov")
3936 (set_attr "mode" "DF")])
3938 (define_insn "*truncxfdf2_i387"
3939 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#r,?r#f")
3941 (match_operand:XF 1 "register_operand" "f,f,f")))
3942 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m"))]
3945 switch (which_alternative)
3948 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3949 return "fstp%z0\t%y0";
3951 return "fst%z0\t%y0";
3956 [(set_attr "type" "fmov,multi,multi")
3957 (set_attr "mode" "DF")])
3959 (define_insn "*truncxfdf2_i387_1"
3960 [(set (match_operand:DF 0 "memory_operand" "=m")
3962 (match_operand:XF 1 "register_operand" "f")))]
3965 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3966 return "fstp%z0\t%y0";
3968 return "fst%z0\t%y0";
3970 [(set_attr "type" "fmov")
3971 (set_attr "mode" "DF")])
3974 [(set (match_operand:DF 0 "register_operand" "")
3976 (match_operand:XF 1 "register_operand" "")))
3977 (clobber (match_operand:DF 2 "memory_operand" ""))]
3978 "TARGET_80387 && reload_completed"
3979 [(set (match_dup 2) (float_truncate:DF (match_dup 1)))
3980 (set (match_dup 0) (match_dup 2))]
3984 [(set (match_operand:DF 0 "memory_operand" "")
3986 (match_operand:XF 1 "register_operand" "")))
3987 (clobber (match_operand:DF 2 "memory_operand" ""))]
3989 [(set (match_dup 0) (float_truncate:DF (match_dup 1)))]
3992 ;; %%% Break up all these bad boys.
3994 ;; Signed conversion to DImode.
3996 (define_expand "fix_truncxfdi2"
3997 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
3998 (fix:DI (match_operand:XF 1 "register_operand" "")))
3999 (clobber (reg:CC FLAGS_REG))])]
4003 (define_expand "fix_truncdfdi2"
4004 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
4005 (fix:DI (match_operand:DF 1 "register_operand" "")))
4006 (clobber (reg:CC FLAGS_REG))])]
4007 "TARGET_80387 || (TARGET_64BIT && TARGET_SSE2)"
4009 if (TARGET_64BIT && TARGET_SSE2)
4011 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4012 emit_insn (gen_fix_truncdfdi_sse (out, operands[1]));
4013 if (out != operands[0])
4014 emit_move_insn (operands[0], out);
4019 (define_expand "fix_truncsfdi2"
4020 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
4021 (fix:DI (match_operand:SF 1 "register_operand" "")))
4022 (clobber (reg:CC FLAGS_REG))])]
4023 "TARGET_80387 || (TARGET_64BIT && TARGET_SSE)"
4025 if (TARGET_64BIT && TARGET_SSE)
4027 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4028 emit_insn (gen_fix_truncsfdi_sse (out, operands[1]));
4029 if (out != operands[0])
4030 emit_move_insn (operands[0], out);
4035 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4036 ;; of the machinery.
4037 (define_insn_and_split "*fix_truncdi_i387"
4038 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4039 (fix:DI (match_operand 1 "register_operand" "f,f")))
4040 (clobber (reg:CC FLAGS_REG))]
4041 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4042 && !reload_completed && !reload_in_progress
4043 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4048 ix86_optimize_mode_switching = 1;
4049 operands[2] = assign_386_stack_local (HImode, 1);
4050 operands[3] = assign_386_stack_local (HImode, 2);
4051 if (memory_operand (operands[0], VOIDmode))
4052 emit_insn (gen_fix_truncdi_memory (operands[0], operands[1],
4053 operands[2], operands[3]));
4056 operands[4] = assign_386_stack_local (DImode, 0);
4057 emit_insn (gen_fix_truncdi_nomemory (operands[0], operands[1],
4058 operands[2], operands[3],
4063 [(set_attr "type" "fistp")
4064 (set_attr "i387_cw" "trunc")
4065 (set_attr "mode" "DI")])
4067 (define_insn "fix_truncdi_nomemory"
4068 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4069 (fix:DI (match_operand 1 "register_operand" "f,f")))
4070 (use (match_operand:HI 2 "memory_operand" "m,m"))
4071 (use (match_operand:HI 3 "memory_operand" "m,m"))
4072 (clobber (match_operand:DI 4 "memory_operand" "=m,m"))
4073 (clobber (match_scratch:DF 5 "=&1f,&1f"))]
4074 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4075 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4077 [(set_attr "type" "fistp")
4078 (set_attr "i387_cw" "trunc")
4079 (set_attr "mode" "DI")])
4081 (define_insn "fix_truncdi_memory"
4082 [(set (match_operand:DI 0 "memory_operand" "=m")
4083 (fix:DI (match_operand 1 "register_operand" "f")))
4084 (use (match_operand:HI 2 "memory_operand" "m"))
4085 (use (match_operand:HI 3 "memory_operand" "m"))
4086 (clobber (match_scratch:DF 4 "=&1f"))]
4087 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4088 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4089 "* return output_fix_trunc (insn, operands);"
4090 [(set_attr "type" "fistp")
4091 (set_attr "i387_cw" "trunc")
4092 (set_attr "mode" "DI")])
4095 [(set (match_operand:DI 0 "register_operand" "")
4096 (fix:DI (match_operand 1 "register_operand" "")))
4097 (use (match_operand:HI 2 "memory_operand" ""))
4098 (use (match_operand:HI 3 "memory_operand" ""))
4099 (clobber (match_operand:DI 4 "memory_operand" ""))
4100 (clobber (match_scratch 5 ""))]
4102 [(parallel [(set (match_dup 4) (fix:DI (match_dup 1)))
4105 (clobber (match_dup 5))])
4106 (set (match_dup 0) (match_dup 4))]
4110 [(set (match_operand:DI 0 "memory_operand" "")
4111 (fix:DI (match_operand 1 "register_operand" "")))
4112 (use (match_operand:HI 2 "memory_operand" ""))
4113 (use (match_operand:HI 3 "memory_operand" ""))
4114 (clobber (match_operand:DI 4 "memory_operand" ""))
4115 (clobber (match_scratch 5 ""))]
4117 [(parallel [(set (match_dup 0) (fix:DI (match_dup 1)))
4120 (clobber (match_dup 5))])]
4123 ;; When SSE available, it is always faster to use it!
4124 (define_insn "fix_truncsfdi_sse"
4125 [(set (match_operand:DI 0 "register_operand" "=r,r")
4126 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))]
4127 "TARGET_64BIT && TARGET_SSE"
4128 "cvttss2si{q}\t{%1, %0|%0, %1}"
4129 [(set_attr "type" "sseicvt")
4130 (set_attr "mode" "SF")
4131 (set_attr "athlon_decode" "double,vector")])
4133 ;; Avoid vector decoded form of the instruction.
4135 [(match_scratch:SF 2 "x")
4136 (set (match_operand:DI 0 "register_operand" "")
4137 (fix:DI (match_operand:SF 1 "memory_operand" "")))]
4138 "TARGET_K8 && !optimize_size"
4139 [(set (match_dup 2) (match_dup 1))
4140 (set (match_dup 0) (fix:DI (match_dup 2)))]
4143 (define_insn "fix_truncdfdi_sse"
4144 [(set (match_operand:DI 0 "register_operand" "=r,r")
4145 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))]
4146 "TARGET_64BIT && TARGET_SSE2"
4147 "cvttsd2si{q}\t{%1, %0|%0, %1}"
4148 [(set_attr "type" "sseicvt,sseicvt")
4149 (set_attr "mode" "DF")
4150 (set_attr "athlon_decode" "double,vector")])
4152 ;; Avoid vector decoded form of the instruction.
4154 [(match_scratch:DF 2 "Y")
4155 (set (match_operand:DI 0 "register_operand" "")
4156 (fix:DI (match_operand:DF 1 "memory_operand" "")))]
4157 "TARGET_K8 && !optimize_size"
4158 [(set (match_dup 2) (match_dup 1))
4159 (set (match_dup 0) (fix:DI (match_dup 2)))]
4162 ;; Signed conversion to SImode.
4164 (define_expand "fix_truncxfsi2"
4165 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4166 (fix:SI (match_operand:XF 1 "register_operand" "")))
4167 (clobber (reg:CC FLAGS_REG))])]
4171 (define_expand "fix_truncdfsi2"
4172 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4173 (fix:SI (match_operand:DF 1 "register_operand" "")))
4174 (clobber (reg:CC FLAGS_REG))])]
4175 "TARGET_80387 || TARGET_SSE2"
4179 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4180 emit_insn (gen_fix_truncdfsi_sse (out, operands[1]));
4181 if (out != operands[0])
4182 emit_move_insn (operands[0], out);
4187 (define_expand "fix_truncsfsi2"
4188 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4189 (fix:SI (match_operand:SF 1 "register_operand" "")))
4190 (clobber (reg:CC FLAGS_REG))])]
4191 "TARGET_80387 || TARGET_SSE"
4195 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4196 emit_insn (gen_fix_truncsfsi_sse (out, operands[1]));
4197 if (out != operands[0])
4198 emit_move_insn (operands[0], out);
4203 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4204 ;; of the machinery.
4205 (define_insn_and_split "*fix_truncsi_i387"
4206 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4207 (fix:SI (match_operand 1 "register_operand" "f,f")))
4208 (clobber (reg:CC FLAGS_REG))]
4209 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4210 && !reload_completed && !reload_in_progress
4211 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4216 ix86_optimize_mode_switching = 1;
4217 operands[2] = assign_386_stack_local (HImode, 1);
4218 operands[3] = assign_386_stack_local (HImode, 2);
4219 if (memory_operand (operands[0], VOIDmode))
4220 emit_insn (gen_fix_truncsi_memory (operands[0], operands[1],
4221 operands[2], operands[3]));
4224 operands[4] = assign_386_stack_local (SImode, 0);
4225 emit_insn (gen_fix_truncsi_nomemory (operands[0], operands[1],
4226 operands[2], operands[3],
4231 [(set_attr "type" "fistp")
4232 (set_attr "i387_cw" "trunc")
4233 (set_attr "mode" "SI")])
4235 (define_insn "fix_truncsi_nomemory"
4236 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4237 (fix:SI (match_operand 1 "register_operand" "f,f")))
4238 (use (match_operand:HI 2 "memory_operand" "m,m"))
4239 (use (match_operand:HI 3 "memory_operand" "m,m"))
4240 (clobber (match_operand:SI 4 "memory_operand" "=m,m"))]
4241 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4242 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4244 [(set_attr "type" "fistp")
4245 (set_attr "i387_cw" "trunc")
4246 (set_attr "mode" "SI")])
4248 (define_insn "fix_truncsi_memory"
4249 [(set (match_operand:SI 0 "memory_operand" "=m")
4250 (fix:SI (match_operand 1 "register_operand" "f")))
4251 (use (match_operand:HI 2 "memory_operand" "m"))
4252 (use (match_operand:HI 3 "memory_operand" "m"))]
4253 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4254 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4255 "* return output_fix_trunc (insn, operands);"
4256 [(set_attr "type" "fistp")
4257 (set_attr "i387_cw" "trunc")
4258 (set_attr "mode" "SI")])
4260 ;; When SSE available, it is always faster to use it!
4261 (define_insn "fix_truncsfsi_sse"
4262 [(set (match_operand:SI 0 "register_operand" "=r,r")
4263 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))]
4265 "cvttss2si\t{%1, %0|%0, %1}"
4266 [(set_attr "type" "sseicvt")
4267 (set_attr "mode" "DF")
4268 (set_attr "athlon_decode" "double,vector")])
4270 ;; Avoid vector decoded form of the instruction.
4272 [(match_scratch:SF 2 "x")
4273 (set (match_operand:SI 0 "register_operand" "")
4274 (fix:SI (match_operand:SF 1 "memory_operand" "")))]
4275 "TARGET_K8 && !optimize_size"
4276 [(set (match_dup 2) (match_dup 1))
4277 (set (match_dup 0) (fix:SI (match_dup 2)))]
4280 (define_insn "fix_truncdfsi_sse"
4281 [(set (match_operand:SI 0 "register_operand" "=r,r")
4282 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))]
4284 "cvttsd2si\t{%1, %0|%0, %1}"
4285 [(set_attr "type" "sseicvt")
4286 (set_attr "mode" "DF")
4287 (set_attr "athlon_decode" "double,vector")])
4289 ;; Avoid vector decoded form of the instruction.
4291 [(match_scratch:DF 2 "Y")
4292 (set (match_operand:SI 0 "register_operand" "")
4293 (fix:SI (match_operand:DF 1 "memory_operand" "")))]
4294 "TARGET_K8 && !optimize_size"
4295 [(set (match_dup 2) (match_dup 1))
4296 (set (match_dup 0) (fix:SI (match_dup 2)))]
4300 [(set (match_operand:SI 0 "register_operand" "")
4301 (fix:SI (match_operand 1 "register_operand" "")))
4302 (use (match_operand:HI 2 "memory_operand" ""))
4303 (use (match_operand:HI 3 "memory_operand" ""))
4304 (clobber (match_operand:SI 4 "memory_operand" ""))]
4306 [(parallel [(set (match_dup 4) (fix:SI (match_dup 1)))
4308 (use (match_dup 3))])
4309 (set (match_dup 0) (match_dup 4))]
4313 [(set (match_operand:SI 0 "memory_operand" "")
4314 (fix:SI (match_operand 1 "register_operand" "")))
4315 (use (match_operand:HI 2 "memory_operand" ""))
4316 (use (match_operand:HI 3 "memory_operand" ""))
4317 (clobber (match_operand:SI 4 "memory_operand" ""))]
4319 [(parallel [(set (match_dup 0) (fix:SI (match_dup 1)))
4321 (use (match_dup 3))])]
4324 ;; Signed conversion to HImode.
4326 (define_expand "fix_truncxfhi2"
4327 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
4328 (fix:HI (match_operand:XF 1 "register_operand" "")))
4329 (clobber (reg:CC FLAGS_REG))])]
4333 (define_expand "fix_truncdfhi2"
4334 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
4335 (fix:HI (match_operand:DF 1 "register_operand" "")))
4336 (clobber (reg:CC FLAGS_REG))])]
4337 "TARGET_80387 && !TARGET_SSE2"
4340 (define_expand "fix_truncsfhi2"
4341 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
4342 (fix:HI (match_operand:SF 1 "register_operand" "")))
4343 (clobber (reg:CC FLAGS_REG))])]
4344 "TARGET_80387 && !TARGET_SSE"
4347 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4348 ;; of the machinery.
4349 (define_insn_and_split "*fix_trunchi_i387"
4350 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4351 (fix:HI (match_operand 1 "register_operand" "f,f")))
4352 (clobber (reg:CC FLAGS_REG))]
4353 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4354 && !reload_completed && !reload_in_progress
4355 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4360 ix86_optimize_mode_switching = 1;
4361 operands[2] = assign_386_stack_local (HImode, 1);
4362 operands[3] = assign_386_stack_local (HImode, 2);
4363 if (memory_operand (operands[0], VOIDmode))
4364 emit_insn (gen_fix_trunchi_memory (operands[0], operands[1],
4365 operands[2], operands[3]));
4368 operands[4] = assign_386_stack_local (HImode, 0);
4369 emit_insn (gen_fix_trunchi_nomemory (operands[0], operands[1],
4370 operands[2], operands[3],
4375 [(set_attr "type" "fistp")
4376 (set_attr "i387_cw" "trunc")
4377 (set_attr "mode" "HI")])
4379 (define_insn "fix_trunchi_nomemory"
4380 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4381 (fix:HI (match_operand 1 "register_operand" "f,f")))
4382 (use (match_operand:HI 2 "memory_operand" "m,m"))
4383 (use (match_operand:HI 3 "memory_operand" "m,m"))
4384 (clobber (match_operand:HI 4 "memory_operand" "=m,m"))]
4385 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4386 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4388 [(set_attr "type" "fistp")
4389 (set_attr "i387_cw" "trunc")
4390 (set_attr "mode" "HI")])
4392 (define_insn "fix_trunchi_memory"
4393 [(set (match_operand:HI 0 "memory_operand" "=m")
4394 (fix:HI (match_operand 1 "register_operand" "f")))
4395 (use (match_operand:HI 2 "memory_operand" "m"))
4396 (use (match_operand:HI 3 "memory_operand" "m"))]
4397 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4398 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4399 "* return output_fix_trunc (insn, operands);"
4400 [(set_attr "type" "fistp")
4401 (set_attr "i387_cw" "trunc")
4402 (set_attr "mode" "HI")])
4405 [(set (match_operand:HI 0 "memory_operand" "")
4406 (fix:HI (match_operand 1 "register_operand" "")))
4407 (use (match_operand:HI 2 "memory_operand" ""))
4408 (use (match_operand:HI 3 "memory_operand" ""))
4409 (clobber (match_operand:HI 4 "memory_operand" ""))]
4411 [(parallel [(set (match_dup 0) (fix:HI (match_dup 1)))
4413 (use (match_dup 3))])]
4417 [(set (match_operand:HI 0 "register_operand" "")
4418 (fix:HI (match_operand 1 "register_operand" "")))
4419 (use (match_operand:HI 2 "memory_operand" ""))
4420 (use (match_operand:HI 3 "memory_operand" ""))
4421 (clobber (match_operand:HI 4 "memory_operand" ""))]
4423 [(parallel [(set (match_dup 4) (fix:HI (match_dup 1)))
4426 (clobber (match_dup 4))])
4427 (set (match_dup 0) (match_dup 4))]
4430 (define_insn "x86_fnstcw_1"
4431 [(set (match_operand:HI 0 "memory_operand" "=m")
4432 (unspec:HI [(reg:HI FPSR_REG)] UNSPEC_FSTCW))]
4435 [(set_attr "length" "2")
4436 (set_attr "mode" "HI")
4437 (set_attr "unit" "i387")])
4439 (define_insn "x86_fldcw_1"
4440 [(set (reg:HI FPSR_REG)
4441 (unspec:HI [(match_operand:HI 0 "memory_operand" "m")] UNSPEC_FLDCW))]
4444 [(set_attr "length" "2")
4445 (set_attr "mode" "HI")
4446 (set_attr "unit" "i387")
4447 (set_attr "athlon_decode" "vector")])
4449 ;; Conversion between fixed point and floating point.
4451 ;; Even though we only accept memory inputs, the backend _really_
4452 ;; wants to be able to do this between registers.
4454 (define_expand "floathisf2"
4455 [(set (match_operand:SF 0 "register_operand" "")
4456 (float:SF (match_operand:HI 1 "nonimmediate_operand" "")))]
4457 "TARGET_80387 || TARGET_SSE_MATH"
4459 if (TARGET_SSE_MATH)
4461 emit_insn (gen_floatsisf2 (operands[0],
4462 convert_to_mode (SImode, operands[1], 0)));
4467 (define_insn "*floathisf2_i387"
4468 [(set (match_operand:SF 0 "register_operand" "=f,f")
4469 (float:SF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))]
4470 "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)"
4474 [(set_attr "type" "fmov,multi")
4475 (set_attr "mode" "SF")
4476 (set_attr "fp_int_src" "true")])
4478 (define_expand "floatsisf2"
4479 [(set (match_operand:SF 0 "register_operand" "")
4480 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
4481 "TARGET_80387 || TARGET_SSE_MATH"
4484 (define_insn "*floatsisf2_mixed"
4485 [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f")
4486 (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))]
4487 "TARGET_MIX_SSE_I387"
4491 cvtsi2ss\t{%1, %0|%0, %1}
4492 cvtsi2ss\t{%1, %0|%0, %1}"
4493 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4494 (set_attr "mode" "SF")
4495 (set_attr "athlon_decode" "*,*,vector,double")
4496 (set_attr "fp_int_src" "true")])
4498 (define_insn "*floatsisf2_sse"
4499 [(set (match_operand:SF 0 "register_operand" "=x,x")
4500 (float:SF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))]
4502 "cvtsi2ss\t{%1, %0|%0, %1}"
4503 [(set_attr "type" "sseicvt")
4504 (set_attr "mode" "SF")
4505 (set_attr "athlon_decode" "vector,double")
4506 (set_attr "fp_int_src" "true")])
4508 (define_insn "*floatsisf2_i387"
4509 [(set (match_operand:SF 0 "register_operand" "=f,f")
4510 (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,?r")))]
4515 [(set_attr "type" "fmov,multi")
4516 (set_attr "mode" "SF")
4517 (set_attr "fp_int_src" "true")])
4519 (define_expand "floatdisf2"
4520 [(set (match_operand:SF 0 "register_operand" "")
4521 (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
4522 "TARGET_80387 || (TARGET_64BIT && TARGET_SSE_MATH)"
4525 (define_insn "*floatdisf2_mixed"
4526 [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f")
4527 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))]
4528 "TARGET_64BIT && TARGET_MIX_SSE_I387"
4532 cvtsi2ss{q}\t{%1, %0|%0, %1}
4533 cvtsi2ss{q}\t{%1, %0|%0, %1}"
4534 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4535 (set_attr "mode" "SF")
4536 (set_attr "athlon_decode" "*,*,vector,double")
4537 (set_attr "fp_int_src" "true")])
4539 (define_insn "*floatdisf2_sse"
4540 [(set (match_operand:SF 0 "register_operand" "=x,x")
4541 (float:SF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))]
4542 "TARGET_64BIT && TARGET_SSE_MATH"
4543 "cvtsi2ss{q}\t{%1, %0|%0, %1}"
4544 [(set_attr "type" "sseicvt")
4545 (set_attr "mode" "SF")
4546 (set_attr "athlon_decode" "vector,double")
4547 (set_attr "fp_int_src" "true")])
4549 (define_insn "*floatdisf2_i387"
4550 [(set (match_operand:SF 0 "register_operand" "=f,f")
4551 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,?r")))]
4556 [(set_attr "type" "fmov,multi")
4557 (set_attr "mode" "SF")
4558 (set_attr "fp_int_src" "true")])
4560 (define_expand "floathidf2"
4561 [(set (match_operand:DF 0 "register_operand" "")
4562 (float:DF (match_operand:HI 1 "nonimmediate_operand" "")))]
4563 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
4565 if (TARGET_SSE2 && TARGET_SSE_MATH)
4567 emit_insn (gen_floatsidf2 (operands[0],
4568 convert_to_mode (SImode, operands[1], 0)));
4573 (define_insn "*floathidf2_i387"
4574 [(set (match_operand:DF 0 "register_operand" "=f,f")
4575 (float:DF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))]
4576 "TARGET_80387 && (!(TARGET_SSE2 && TARGET_SSE_MATH) || TARGET_MIX_SSE_I387)"
4580 [(set_attr "type" "fmov,multi")
4581 (set_attr "mode" "DF")
4582 (set_attr "fp_int_src" "true")])
4584 (define_expand "floatsidf2"
4585 [(set (match_operand:DF 0 "register_operand" "")
4586 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))]
4587 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
4590 (define_insn "*floatsidf2_mixed"
4591 [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f")
4592 (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))]
4593 "TARGET_SSE2 && TARGET_MIX_SSE_I387"
4597 cvtsi2sd\t{%1, %0|%0, %1}
4598 cvtsi2sd\t{%1, %0|%0, %1}"
4599 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4600 (set_attr "mode" "DF")
4601 (set_attr "athlon_decode" "*,*,double,direct")
4602 (set_attr "fp_int_src" "true")])
4604 (define_insn "*floatsidf2_sse"
4605 [(set (match_operand:DF 0 "register_operand" "=Y,Y")
4606 (float:DF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))]
4607 "TARGET_SSE2 && TARGET_SSE_MATH"
4608 "cvtsi2sd\t{%1, %0|%0, %1}"
4609 [(set_attr "type" "sseicvt")
4610 (set_attr "mode" "DF")
4611 (set_attr "athlon_decode" "double,direct")
4612 (set_attr "fp_int_src" "true")])
4614 (define_insn "*floatsidf2_i387"
4615 [(set (match_operand:DF 0 "register_operand" "=f,f")
4616 (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,?r")))]
4621 [(set_attr "type" "fmov,multi")
4622 (set_attr "mode" "DF")
4623 (set_attr "fp_int_src" "true")])
4625 (define_expand "floatdidf2"
4626 [(set (match_operand:DF 0 "register_operand" "")
4627 (float:DF (match_operand:DI 1 "nonimmediate_operand" "")))]
4628 "TARGET_80387 || (TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH)"
4631 (define_insn "*floatdidf2_mixed"
4632 [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f")
4633 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))]
4634 "TARGET_64BIT && TARGET_SSE2 && TARGET_MIX_SSE_I387"
4638 cvtsi2sd{q}\t{%1, %0|%0, %1}
4639 cvtsi2sd{q}\t{%1, %0|%0, %1}"
4640 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4641 (set_attr "mode" "DF")
4642 (set_attr "athlon_decode" "*,*,double,direct")
4643 (set_attr "fp_int_src" "true")])
4645 (define_insn "*floatdidf2_sse"
4646 [(set (match_operand:DF 0 "register_operand" "=Y,Y")
4647 (float:DF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))]
4648 "TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH"
4649 "cvtsi2sd{q}\t{%1, %0|%0, %1}"
4650 [(set_attr "type" "sseicvt")
4651 (set_attr "mode" "DF")
4652 (set_attr "athlon_decode" "double,direct")
4653 (set_attr "fp_int_src" "true")])
4655 (define_insn "*floatdidf2_i387"
4656 [(set (match_operand:DF 0 "register_operand" "=f,f")
4657 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,?r")))]
4662 [(set_attr "type" "fmov,multi")
4663 (set_attr "mode" "DF")
4664 (set_attr "fp_int_src" "true")])
4666 (define_insn "floathixf2"
4667 [(set (match_operand:XF 0 "register_operand" "=f,f")
4668 (float:XF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))]
4673 [(set_attr "type" "fmov,multi")
4674 (set_attr "mode" "XF")
4675 (set_attr "fp_int_src" "true")])
4677 (define_insn "floatsixf2"
4678 [(set (match_operand:XF 0 "register_operand" "=f,f")
4679 (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r")))]
4684 [(set_attr "type" "fmov,multi")
4685 (set_attr "mode" "XF")
4686 (set_attr "fp_int_src" "true")])
4688 (define_insn "floatdixf2"
4689 [(set (match_operand:XF 0 "register_operand" "=f,f")
4690 (float:XF (match_operand:DI 1 "nonimmediate_operand" "m,?r")))]
4695 [(set_attr "type" "fmov,multi")
4696 (set_attr "mode" "XF")
4697 (set_attr "fp_int_src" "true")])
4699 ;; %%% Kill these when reload knows how to do it.
4701 [(set (match_operand 0 "fp_register_operand" "")
4702 (float (match_operand 1 "register_operand" "")))]
4705 && FLOAT_MODE_P (GET_MODE (operands[0]))"
4708 operands[2] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
4709 operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);
4710 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[2]));
4711 ix86_free_from_memory (GET_MODE (operands[1]));
4715 (define_expand "floatunssisf2"
4716 [(use (match_operand:SF 0 "register_operand" ""))
4717 (use (match_operand:SI 1 "register_operand" ""))]
4718 "!TARGET_64BIT && TARGET_SSE_MATH"
4719 "x86_emit_floatuns (operands); DONE;")
4721 (define_expand "floatunsdisf2"
4722 [(use (match_operand:SF 0 "register_operand" ""))
4723 (use (match_operand:DI 1 "register_operand" ""))]
4724 "TARGET_64BIT && TARGET_SSE_MATH"
4725 "x86_emit_floatuns (operands); DONE;")
4727 (define_expand "floatunsdidf2"
4728 [(use (match_operand:DF 0 "register_operand" ""))
4729 (use (match_operand:DI 1 "register_operand" ""))]
4730 "TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH"
4731 "x86_emit_floatuns (operands); DONE;")
4733 ;; SSE extract/set expanders
4735 (define_expand "vec_setv2df"
4736 [(match_operand:V2DF 0 "register_operand" "")
4737 (match_operand:DF 1 "register_operand" "")
4738 (match_operand 2 "const_int_operand" "")]
4741 switch (INTVAL (operands[2]))
4744 emit_insn (gen_sse2_loadlpd (operands[0], operands[0], operands[1]));
4747 emit_insn (gen_sse2_loadhpd (operands[0], operands[0], operands[1]));
4755 (define_expand "vec_extractv2df"
4756 [(match_operand:DF 0 "register_operand" "")
4757 (match_operand:V2DF 1 "register_operand" "")
4758 (match_operand 2 "const_int_operand" "")]
4761 switch (INTVAL (operands[2]))
4764 emit_insn (gen_sse2_storelpd (operands[0], operands[1]));
4767 emit_insn (gen_sse2_storehpd (operands[0], operands[1]));
4775 (define_expand "vec_initv2df"
4776 [(match_operand:V2DF 0 "register_operand" "")
4777 (match_operand 1 "" "")]
4780 ix86_expand_vector_init (operands[0], operands[1]);
4784 (define_expand "vec_setv4sf"
4785 [(match_operand:V4SF 0 "register_operand" "")
4786 (match_operand:SF 1 "register_operand" "")
4787 (match_operand 2 "const_int_operand" "")]
4790 switch (INTVAL (operands[2]))
4793 emit_insn (gen_sse_movss (operands[0], operands[0],
4794 simplify_gen_subreg (V4SFmode, operands[1],
4799 rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4800 rtx tmp = gen_reg_rtx (V4SFmode);
4802 emit_move_insn (tmp, operands[0]);
4803 emit_insn (gen_sse_unpcklps (operands[0], operands[0], operands[0]));
4804 emit_insn (gen_sse_movss (operands[0], operands[0], op1));
4805 emit_insn (gen_sse_shufps (operands[0], operands[0], tmp,
4806 GEN_INT (1 + (0<<2) + (2<<4) + (3<<6))));
4811 rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4812 rtx tmp = gen_reg_rtx (V4SFmode);
4814 emit_move_insn (tmp, operands[0]);
4815 emit_insn (gen_sse_movss (tmp, tmp, op1));
4816 emit_insn (gen_sse_shufps (operands[0], operands[0], tmp,
4817 GEN_INT (0 + (1<<2) + (0<<4) + (3<<6))));
4822 rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4823 rtx tmp = gen_reg_rtx (V4SFmode);
4825 emit_move_insn (tmp, operands[0]);
4826 emit_insn (gen_sse_movss (tmp, tmp, op1));
4827 emit_insn (gen_sse_shufps (operands[0], operands[0], tmp,
4828 GEN_INT (0 + (1<<2) + (2<<4) + (0<<6))));
4837 (define_expand "vec_extractv4sf"
4838 [(match_operand:SF 0 "register_operand" "")
4839 (match_operand:V4SF 1 "register_operand" "")
4840 (match_operand 2 "const_int_operand" "")]
4843 switch (INTVAL (operands[2]))
4846 emit_move_insn (operands[0], gen_lowpart (SFmode, operands[1]));
4850 rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4851 rtx tmp = gen_reg_rtx (V4SFmode);
4853 emit_move_insn (tmp, operands[1]);
4854 emit_insn (gen_sse_shufps (op0, tmp, tmp,
4860 rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4861 rtx tmp = gen_reg_rtx (V4SFmode);
4863 emit_move_insn (tmp, operands[1]);
4864 emit_insn (gen_sse_unpckhps (op0, tmp, tmp));
4869 rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0);
4870 rtx tmp = gen_reg_rtx (V4SFmode);
4872 emit_move_insn (tmp, operands[1]);
4873 emit_insn (gen_sse_shufps (op0, tmp, tmp,
4883 (define_expand "vec_initv4sf"
4884 [(match_operand:V4SF 0 "register_operand" "")
4885 (match_operand 1 "" "")]
4888 ix86_expand_vector_init (operands[0], operands[1]);
4894 ;; %%% splits for addsidi3
4895 ; [(set (match_operand:DI 0 "nonimmediate_operand" "")
4896 ; (plus:DI (match_operand:DI 1 "general_operand" "")
4897 ; (zero_extend:DI (match_operand:SI 2 "general_operand" ""))))]
4899 (define_expand "adddi3"
4900 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4901 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4902 (match_operand:DI 2 "x86_64_general_operand" "")))
4903 (clobber (reg:CC FLAGS_REG))]
4905 "ix86_expand_binary_operator (PLUS, DImode, operands); DONE;")
4907 (define_insn "*adddi3_1"
4908 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
4909 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4910 (match_operand:DI 2 "general_operand" "roiF,riF")))
4911 (clobber (reg:CC FLAGS_REG))]
4912 "!TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4916 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4917 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4918 (match_operand:DI 2 "general_operand" "")))
4919 (clobber (reg:CC FLAGS_REG))]
4920 "!TARGET_64BIT && reload_completed"
4921 [(parallel [(set (reg:CC FLAGS_REG) (unspec:CC [(match_dup 1) (match_dup 2)]
4923 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
4924 (parallel [(set (match_dup 3)
4925 (plus:SI (plus:SI (ltu:SI (reg:CC FLAGS_REG) (const_int 0))
4928 (clobber (reg:CC FLAGS_REG))])]
4929 "split_di (operands+0, 1, operands+0, operands+3);
4930 split_di (operands+1, 1, operands+1, operands+4);
4931 split_di (operands+2, 1, operands+2, operands+5);")
4933 (define_insn "adddi3_carry_rex64"
4934 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
4935 (plus:DI (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "")
4936 (match_operand:DI 1 "nonimmediate_operand" "%0,0"))
4937 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
4938 (clobber (reg:CC FLAGS_REG))]
4939 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4940 "adc{q}\t{%2, %0|%0, %2}"
4941 [(set_attr "type" "alu")
4942 (set_attr "pent_pair" "pu")
4943 (set_attr "mode" "DI")])
4945 (define_insn "*adddi3_cc_rex64"
4946 [(set (reg:CC FLAGS_REG)
4947 (unspec:CC [(match_operand:DI 1 "nonimmediate_operand" "%0,0")
4948 (match_operand:DI 2 "x86_64_general_operand" "re,rm")]
4950 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
4951 (plus:DI (match_dup 1) (match_dup 2)))]
4952 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4953 "add{q}\t{%2, %0|%0, %2}"
4954 [(set_attr "type" "alu")
4955 (set_attr "mode" "DI")])
4957 (define_insn "addqi3_carry"
4958 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
4959 (plus:QI (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "")
4960 (match_operand:QI 1 "nonimmediate_operand" "%0,0"))
4961 (match_operand:QI 2 "general_operand" "qi,qm")))
4962 (clobber (reg:CC FLAGS_REG))]
4963 "ix86_binary_operator_ok (PLUS, QImode, operands)"
4964 "adc{b}\t{%2, %0|%0, %2}"
4965 [(set_attr "type" "alu")
4966 (set_attr "pent_pair" "pu")
4967 (set_attr "mode" "QI")])
4969 (define_insn "addhi3_carry"
4970 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
4971 (plus:HI (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "")
4972 (match_operand:HI 1 "nonimmediate_operand" "%0,0"))
4973 (match_operand:HI 2 "general_operand" "ri,rm")))
4974 (clobber (reg:CC FLAGS_REG))]
4975 "ix86_binary_operator_ok (PLUS, HImode, operands)"
4976 "adc{w}\t{%2, %0|%0, %2}"
4977 [(set_attr "type" "alu")
4978 (set_attr "pent_pair" "pu")
4979 (set_attr "mode" "HI")])
4981 (define_insn "addsi3_carry"
4982 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
4983 (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
4984 (match_operand:SI 1 "nonimmediate_operand" "%0,0"))
4985 (match_operand:SI 2 "general_operand" "ri,rm")))
4986 (clobber (reg:CC FLAGS_REG))]
4987 "ix86_binary_operator_ok (PLUS, SImode, operands)"
4988 "adc{l}\t{%2, %0|%0, %2}"
4989 [(set_attr "type" "alu")
4990 (set_attr "pent_pair" "pu")
4991 (set_attr "mode" "SI")])
4993 (define_insn "*addsi3_carry_zext"
4994 [(set (match_operand:DI 0 "register_operand" "=r")
4996 (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
4997 (match_operand:SI 1 "nonimmediate_operand" "%0"))
4998 (match_operand:SI 2 "general_operand" "rim"))))
4999 (clobber (reg:CC FLAGS_REG))]
5000 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5001 "adc{l}\t{%2, %k0|%k0, %2}"
5002 [(set_attr "type" "alu")
5003 (set_attr "pent_pair" "pu")
5004 (set_attr "mode" "SI")])
5006 (define_insn "*addsi3_cc"
5007 [(set (reg:CC FLAGS_REG)
5008 (unspec:CC [(match_operand:SI 1 "nonimmediate_operand" "%0,0")
5009 (match_operand:SI 2 "general_operand" "ri,rm")]
5011 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
5012 (plus:SI (match_dup 1) (match_dup 2)))]
5013 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5014 "add{l}\t{%2, %0|%0, %2}"
5015 [(set_attr "type" "alu")
5016 (set_attr "mode" "SI")])
5018 (define_insn "addqi3_cc"
5019 [(set (reg:CC FLAGS_REG)
5020 (unspec:CC [(match_operand:QI 1 "nonimmediate_operand" "%0,0")
5021 (match_operand:QI 2 "general_operand" "qi,qm")]
5023 (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
5024 (plus:QI (match_dup 1) (match_dup 2)))]
5025 "ix86_binary_operator_ok (PLUS, QImode, operands)"
5026 "add{b}\t{%2, %0|%0, %2}"
5027 [(set_attr "type" "alu")
5028 (set_attr "mode" "QI")])
5030 (define_expand "addsi3"
5031 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
5032 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5033 (match_operand:SI 2 "general_operand" "")))
5034 (clobber (reg:CC FLAGS_REG))])]
5036 "ix86_expand_binary_operator (PLUS, SImode, operands); DONE;")
5038 (define_insn "*lea_1"
5039 [(set (match_operand:SI 0 "register_operand" "=r")
5040 (match_operand:SI 1 "no_seg_address_operand" "p"))]
5042 "lea{l}\t{%a1, %0|%0, %a1}"
5043 [(set_attr "type" "lea")
5044 (set_attr "mode" "SI")])
5046 (define_insn "*lea_1_rex64"
5047 [(set (match_operand:SI 0 "register_operand" "=r")
5048 (subreg:SI (match_operand:DI 1 "no_seg_address_operand" "p") 0))]
5050 "lea{l}\t{%a1, %0|%0, %a1}"
5051 [(set_attr "type" "lea")
5052 (set_attr "mode" "SI")])
5054 (define_insn "*lea_1_zext"
5055 [(set (match_operand:DI 0 "register_operand" "=r")
5057 (subreg:SI (match_operand:DI 1 "no_seg_address_operand" "p") 0)))]
5059 "lea{l}\t{%a1, %k0|%k0, %a1}"
5060 [(set_attr "type" "lea")
5061 (set_attr "mode" "SI")])
5063 (define_insn "*lea_2_rex64"
5064 [(set (match_operand:DI 0 "register_operand" "=r")
5065 (match_operand:DI 1 "no_seg_address_operand" "p"))]
5067 "lea{q}\t{%a1, %0|%0, %a1}"
5068 [(set_attr "type" "lea")
5069 (set_attr "mode" "DI")])
5071 ;; The lea patterns for non-Pmodes needs to be matched by several
5072 ;; insns converted to real lea by splitters.
5074 (define_insn_and_split "*lea_general_1"
5075 [(set (match_operand 0 "register_operand" "=r")
5076 (plus (plus (match_operand 1 "index_register_operand" "l")
5077 (match_operand 2 "register_operand" "r"))
5078 (match_operand 3 "immediate_operand" "i")))]
5079 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5080 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5081 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5082 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5083 && GET_MODE (operands[0]) == GET_MODE (operands[2])
5084 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
5085 || GET_MODE (operands[3]) == VOIDmode)"
5087 "&& reload_completed"
5091 operands[0] = gen_lowpart (SImode, operands[0]);
5092 operands[1] = gen_lowpart (Pmode, operands[1]);
5093 operands[2] = gen_lowpart (Pmode, operands[2]);
5094 operands[3] = gen_lowpart (Pmode, operands[3]);
5095 pat = gen_rtx_PLUS (Pmode, gen_rtx_PLUS (Pmode, operands[1], operands[2]),
5097 if (Pmode != SImode)
5098 pat = gen_rtx_SUBREG (SImode, pat, 0);
5099 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5102 [(set_attr "type" "lea")
5103 (set_attr "mode" "SI")])
5105 (define_insn_and_split "*lea_general_1_zext"
5106 [(set (match_operand:DI 0 "register_operand" "=r")
5108 (plus:SI (plus:SI (match_operand:SI 1 "index_register_operand" "l")
5109 (match_operand:SI 2 "register_operand" "r"))
5110 (match_operand:SI 3 "immediate_operand" "i"))))]
5113 "&& reload_completed"
5115 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (match_dup 1)
5117 (match_dup 3)) 0)))]
5119 operands[1] = gen_lowpart (Pmode, operands[1]);
5120 operands[2] = gen_lowpart (Pmode, operands[2]);
5121 operands[3] = gen_lowpart (Pmode, operands[3]);
5123 [(set_attr "type" "lea")
5124 (set_attr "mode" "SI")])
5126 (define_insn_and_split "*lea_general_2"
5127 [(set (match_operand 0 "register_operand" "=r")
5128 (plus (mult (match_operand 1 "index_register_operand" "l")
5129 (match_operand 2 "const248_operand" "i"))
5130 (match_operand 3 "nonmemory_operand" "ri")))]
5131 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5132 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5133 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5134 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5135 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
5136 || GET_MODE (operands[3]) == VOIDmode)"
5138 "&& reload_completed"
5142 operands[0] = gen_lowpart (SImode, operands[0]);
5143 operands[1] = gen_lowpart (Pmode, operands[1]);
5144 operands[3] = gen_lowpart (Pmode, operands[3]);
5145 pat = gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1], operands[2]),
5147 if (Pmode != SImode)
5148 pat = gen_rtx_SUBREG (SImode, pat, 0);
5149 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5152 [(set_attr "type" "lea")
5153 (set_attr "mode" "SI")])
5155 (define_insn_and_split "*lea_general_2_zext"
5156 [(set (match_operand:DI 0 "register_operand" "=r")
5158 (plus:SI (mult:SI (match_operand:SI 1 "index_register_operand" "l")
5159 (match_operand:SI 2 "const248_operand" "n"))
5160 (match_operand:SI 3 "nonmemory_operand" "ri"))))]
5163 "&& reload_completed"
5165 (zero_extend:DI (subreg:SI (plus:DI (mult:DI (match_dup 1)
5167 (match_dup 3)) 0)))]
5169 operands[1] = gen_lowpart (Pmode, operands[1]);
5170 operands[3] = gen_lowpart (Pmode, operands[3]);
5172 [(set_attr "type" "lea")
5173 (set_attr "mode" "SI")])
5175 (define_insn_and_split "*lea_general_3"
5176 [(set (match_operand 0 "register_operand" "=r")
5177 (plus (plus (mult (match_operand 1 "index_register_operand" "l")
5178 (match_operand 2 "const248_operand" "i"))
5179 (match_operand 3 "register_operand" "r"))
5180 (match_operand 4 "immediate_operand" "i")))]
5181 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5182 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5183 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5184 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5185 && GET_MODE (operands[0]) == GET_MODE (operands[3])"
5187 "&& reload_completed"
5191 operands[0] = gen_lowpart (SImode, operands[0]);
5192 operands[1] = gen_lowpart (Pmode, operands[1]);
5193 operands[3] = gen_lowpart (Pmode, operands[3]);
5194 operands[4] = gen_lowpart (Pmode, operands[4]);
5195 pat = gen_rtx_PLUS (Pmode,
5196 gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1],
5200 if (Pmode != SImode)
5201 pat = gen_rtx_SUBREG (SImode, pat, 0);
5202 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5205 [(set_attr "type" "lea")
5206 (set_attr "mode" "SI")])
5208 (define_insn_and_split "*lea_general_3_zext"
5209 [(set (match_operand:DI 0 "register_operand" "=r")
5211 (plus:SI (plus:SI (mult:SI
5212 (match_operand:SI 1 "index_register_operand" "l")
5213 (match_operand:SI 2 "const248_operand" "n"))
5214 (match_operand:SI 3 "register_operand" "r"))
5215 (match_operand:SI 4 "immediate_operand" "i"))))]
5218 "&& reload_completed"
5220 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (mult:DI (match_dup 1)
5223 (match_dup 4)) 0)))]
5225 operands[1] = gen_lowpart (Pmode, operands[1]);
5226 operands[3] = gen_lowpart (Pmode, operands[3]);
5227 operands[4] = gen_lowpart (Pmode, operands[4]);
5229 [(set_attr "type" "lea")
5230 (set_attr "mode" "SI")])
5232 (define_insn "*adddi_1_rex64"
5233 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r")
5234 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,r")
5235 (match_operand:DI 2 "x86_64_general_operand" "rme,re,le")))
5236 (clobber (reg:CC FLAGS_REG))]
5237 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5239 switch (get_attr_type (insn))
5242 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5243 return "lea{q}\t{%a2, %0|%0, %a2}";
5246 if (! rtx_equal_p (operands[0], operands[1]))
5248 if (operands[2] == const1_rtx)
5249 return "inc{q}\t%0";
5250 else if (operands[2] == constm1_rtx)
5251 return "dec{q}\t%0";
5256 if (! rtx_equal_p (operands[0], operands[1]))
5259 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5260 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5261 if (GET_CODE (operands[2]) == CONST_INT
5262 /* Avoid overflows. */
5263 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5264 && (INTVAL (operands[2]) == 128
5265 || (INTVAL (operands[2]) < 0
5266 && INTVAL (operands[2]) != -128)))
5268 operands[2] = GEN_INT (-INTVAL (operands[2]));
5269 return "sub{q}\t{%2, %0|%0, %2}";
5271 return "add{q}\t{%2, %0|%0, %2}";
5275 (cond [(eq_attr "alternative" "2")
5276 (const_string "lea")
5277 ; Current assemblers are broken and do not allow @GOTOFF in
5278 ; ought but a memory context.
5279 (match_operand:DI 2 "pic_symbolic_operand" "")
5280 (const_string "lea")
5281 (match_operand:DI 2 "incdec_operand" "")
5282 (const_string "incdec")
5284 (const_string "alu")))
5285 (set_attr "mode" "DI")])
5287 ;; Convert lea to the lea pattern to avoid flags dependency.
5289 [(set (match_operand:DI 0 "register_operand" "")
5290 (plus:DI (match_operand:DI 1 "register_operand" "")
5291 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
5292 (clobber (reg:CC FLAGS_REG))]
5293 "TARGET_64BIT && reload_completed
5294 && true_regnum (operands[0]) != true_regnum (operands[1])"
5296 (plus:DI (match_dup 1)
5300 (define_insn "*adddi_2_rex64"
5301 [(set (reg FLAGS_REG)
5303 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5304 (match_operand:DI 2 "x86_64_general_operand" "rme,re"))
5306 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
5307 (plus:DI (match_dup 1) (match_dup 2)))]
5308 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5309 && ix86_binary_operator_ok (PLUS, DImode, operands)
5310 /* Current assemblers are broken and do not allow @GOTOFF in
5311 ought but a memory context. */
5312 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5314 switch (get_attr_type (insn))
5317 if (! rtx_equal_p (operands[0], operands[1]))
5319 if (operands[2] == const1_rtx)
5320 return "inc{q}\t%0";
5321 else if (operands[2] == constm1_rtx)
5322 return "dec{q}\t%0";
5327 if (! rtx_equal_p (operands[0], operands[1]))
5329 /* ???? We ought to handle there the 32bit case too
5330 - do we need new constraint? */
5331 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5332 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5333 if (GET_CODE (operands[2]) == CONST_INT
5334 /* Avoid overflows. */
5335 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5336 && (INTVAL (operands[2]) == 128
5337 || (INTVAL (operands[2]) < 0
5338 && INTVAL (operands[2]) != -128)))
5340 operands[2] = GEN_INT (-INTVAL (operands[2]));
5341 return "sub{q}\t{%2, %0|%0, %2}";
5343 return "add{q}\t{%2, %0|%0, %2}";
5347 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5348 (const_string "incdec")
5349 (const_string "alu")))
5350 (set_attr "mode" "DI")])
5352 (define_insn "*adddi_3_rex64"
5353 [(set (reg FLAGS_REG)
5354 (compare (neg:DI (match_operand:DI 2 "x86_64_general_operand" "rme"))
5355 (match_operand:DI 1 "x86_64_general_operand" "%0")))
5356 (clobber (match_scratch:DI 0 "=r"))]
5358 && ix86_match_ccmode (insn, CCZmode)
5359 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5360 /* Current assemblers are broken and do not allow @GOTOFF in
5361 ought but a memory context. */
5362 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5364 switch (get_attr_type (insn))
5367 if (! rtx_equal_p (operands[0], operands[1]))
5369 if (operands[2] == const1_rtx)
5370 return "inc{q}\t%0";
5371 else if (operands[2] == constm1_rtx)
5372 return "dec{q}\t%0";
5377 if (! rtx_equal_p (operands[0], operands[1]))
5379 /* ???? We ought to handle there the 32bit case too
5380 - do we need new constraint? */
5381 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5382 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5383 if (GET_CODE (operands[2]) == CONST_INT
5384 /* Avoid overflows. */
5385 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5386 && (INTVAL (operands[2]) == 128
5387 || (INTVAL (operands[2]) < 0
5388 && INTVAL (operands[2]) != -128)))
5390 operands[2] = GEN_INT (-INTVAL (operands[2]));
5391 return "sub{q}\t{%2, %0|%0, %2}";
5393 return "add{q}\t{%2, %0|%0, %2}";
5397 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5398 (const_string "incdec")
5399 (const_string "alu")))
5400 (set_attr "mode" "DI")])
5402 ; For comparisons against 1, -1 and 128, we may generate better code
5403 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5404 ; is matched then. We can't accept general immediate, because for
5405 ; case of overflows, the result is messed up.
5406 ; This pattern also don't hold of 0x8000000000000000, since the value overflows
5408 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5409 ; only for comparisons not depending on it.
5410 (define_insn "*adddi_4_rex64"
5411 [(set (reg FLAGS_REG)
5412 (compare (match_operand:DI 1 "nonimmediate_operand" "0")
5413 (match_operand:DI 2 "x86_64_immediate_operand" "e")))
5414 (clobber (match_scratch:DI 0 "=rm"))]
5416 && ix86_match_ccmode (insn, CCGCmode)"
5418 switch (get_attr_type (insn))
5421 if (operands[2] == constm1_rtx)
5422 return "inc{q}\t%0";
5423 else if (operands[2] == const1_rtx)
5424 return "dec{q}\t%0";
5429 if (! rtx_equal_p (operands[0], operands[1]))
5431 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5432 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5433 if ((INTVAL (operands[2]) == -128
5434 || (INTVAL (operands[2]) > 0
5435 && INTVAL (operands[2]) != 128))
5436 /* Avoid overflows. */
5437 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))))
5438 return "sub{q}\t{%2, %0|%0, %2}";
5439 operands[2] = GEN_INT (-INTVAL (operands[2]));
5440 return "add{q}\t{%2, %0|%0, %2}";
5444 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5445 (const_string "incdec")
5446 (const_string "alu")))
5447 (set_attr "mode" "DI")])
5449 (define_insn "*adddi_5_rex64"
5450 [(set (reg FLAGS_REG)
5452 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5453 (match_operand:DI 2 "x86_64_general_operand" "rme"))
5455 (clobber (match_scratch:DI 0 "=r"))]
5457 && ix86_match_ccmode (insn, CCGOCmode)
5458 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5459 /* Current assemblers are broken and do not allow @GOTOFF in
5460 ought but a memory context. */
5461 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5463 switch (get_attr_type (insn))
5466 if (! rtx_equal_p (operands[0], operands[1]))
5468 if (operands[2] == const1_rtx)
5469 return "inc{q}\t%0";
5470 else if (operands[2] == constm1_rtx)
5471 return "dec{q}\t%0";
5476 if (! rtx_equal_p (operands[0], operands[1]))
5478 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5479 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5480 if (GET_CODE (operands[2]) == CONST_INT
5481 /* Avoid overflows. */
5482 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5483 && (INTVAL (operands[2]) == 128
5484 || (INTVAL (operands[2]) < 0
5485 && INTVAL (operands[2]) != -128)))
5487 operands[2] = GEN_INT (-INTVAL (operands[2]));
5488 return "sub{q}\t{%2, %0|%0, %2}";
5490 return "add{q}\t{%2, %0|%0, %2}";
5494 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5495 (const_string "incdec")
5496 (const_string "alu")))
5497 (set_attr "mode" "DI")])
5500 (define_insn "*addsi_1"
5501 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r")
5502 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r")
5503 (match_operand:SI 2 "general_operand" "rmni,rni,lni")))
5504 (clobber (reg:CC FLAGS_REG))]
5505 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5507 switch (get_attr_type (insn))
5510 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5511 return "lea{l}\t{%a2, %0|%0, %a2}";
5514 if (! rtx_equal_p (operands[0], operands[1]))
5516 if (operands[2] == const1_rtx)
5517 return "inc{l}\t%0";
5518 else if (operands[2] == constm1_rtx)
5519 return "dec{l}\t%0";
5524 if (! rtx_equal_p (operands[0], operands[1]))
5527 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5528 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5529 if (GET_CODE (operands[2]) == CONST_INT
5530 && (INTVAL (operands[2]) == 128
5531 || (INTVAL (operands[2]) < 0
5532 && INTVAL (operands[2]) != -128)))
5534 operands[2] = GEN_INT (-INTVAL (operands[2]));
5535 return "sub{l}\t{%2, %0|%0, %2}";
5537 return "add{l}\t{%2, %0|%0, %2}";
5541 (cond [(eq_attr "alternative" "2")
5542 (const_string "lea")
5543 ; Current assemblers are broken and do not allow @GOTOFF in
5544 ; ought but a memory context.
5545 (match_operand:SI 2 "pic_symbolic_operand" "")
5546 (const_string "lea")
5547 (match_operand:SI 2 "incdec_operand" "")
5548 (const_string "incdec")
5550 (const_string "alu")))
5551 (set_attr "mode" "SI")])
5553 ;; Convert lea to the lea pattern to avoid flags dependency.
5555 [(set (match_operand 0 "register_operand" "")
5556 (plus (match_operand 1 "register_operand" "")
5557 (match_operand 2 "nonmemory_operand" "")))
5558 (clobber (reg:CC FLAGS_REG))]
5560 && true_regnum (operands[0]) != true_regnum (operands[1])"
5564 /* In -fPIC mode the constructs like (const (unspec [symbol_ref]))
5565 may confuse gen_lowpart. */
5566 if (GET_MODE (operands[0]) != Pmode)
5568 operands[1] = gen_lowpart (Pmode, operands[1]);
5569 operands[2] = gen_lowpart (Pmode, operands[2]);
5571 operands[0] = gen_lowpart (SImode, operands[0]);
5572 pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
5573 if (Pmode != SImode)
5574 pat = gen_rtx_SUBREG (SImode, pat, 0);
5575 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5579 ;; It may seem that nonimmediate operand is proper one for operand 1.
5580 ;; The addsi_1 pattern allows nonimmediate operand at that place and
5581 ;; we take care in ix86_binary_operator_ok to not allow two memory
5582 ;; operands so proper swapping will be done in reload. This allow
5583 ;; patterns constructed from addsi_1 to match.
5584 (define_insn "addsi_1_zext"
5585 [(set (match_operand:DI 0 "register_operand" "=r,r")
5587 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r")
5588 (match_operand:SI 2 "general_operand" "rmni,lni"))))
5589 (clobber (reg:CC FLAGS_REG))]
5590 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5592 switch (get_attr_type (insn))
5595 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5596 return "lea{l}\t{%a2, %k0|%k0, %a2}";
5599 if (operands[2] == const1_rtx)
5600 return "inc{l}\t%k0";
5601 else if (operands[2] == constm1_rtx)
5602 return "dec{l}\t%k0";
5607 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5608 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5609 if (GET_CODE (operands[2]) == CONST_INT
5610 && (INTVAL (operands[2]) == 128
5611 || (INTVAL (operands[2]) < 0
5612 && INTVAL (operands[2]) != -128)))
5614 operands[2] = GEN_INT (-INTVAL (operands[2]));
5615 return "sub{l}\t{%2, %k0|%k0, %2}";
5617 return "add{l}\t{%2, %k0|%k0, %2}";
5621 (cond [(eq_attr "alternative" "1")
5622 (const_string "lea")
5623 ; Current assemblers are broken and do not allow @GOTOFF in
5624 ; ought but a memory context.
5625 (match_operand:SI 2 "pic_symbolic_operand" "")
5626 (const_string "lea")
5627 (match_operand:SI 2 "incdec_operand" "")
5628 (const_string "incdec")
5630 (const_string "alu")))
5631 (set_attr "mode" "SI")])
5633 ;; Convert lea to the lea pattern to avoid flags dependency.
5635 [(set (match_operand:DI 0 "register_operand" "")
5637 (plus:SI (match_operand:SI 1 "register_operand" "")
5638 (match_operand:SI 2 "nonmemory_operand" ""))))
5639 (clobber (reg:CC FLAGS_REG))]
5640 "TARGET_64BIT && reload_completed
5641 && true_regnum (operands[0]) != true_regnum (operands[1])"
5643 (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))]
5645 operands[1] = gen_lowpart (Pmode, operands[1]);
5646 operands[2] = gen_lowpart (Pmode, operands[2]);
5649 (define_insn "*addsi_2"
5650 [(set (reg FLAGS_REG)
5652 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5653 (match_operand:SI 2 "general_operand" "rmni,rni"))
5655 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
5656 (plus:SI (match_dup 1) (match_dup 2)))]
5657 "ix86_match_ccmode (insn, CCGOCmode)
5658 && ix86_binary_operator_ok (PLUS, SImode, operands)
5659 /* Current assemblers are broken and do not allow @GOTOFF in
5660 ought but a memory context. */
5661 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5663 switch (get_attr_type (insn))
5666 if (! rtx_equal_p (operands[0], operands[1]))
5668 if (operands[2] == const1_rtx)
5669 return "inc{l}\t%0";
5670 else if (operands[2] == constm1_rtx)
5671 return "dec{l}\t%0";
5676 if (! rtx_equal_p (operands[0], operands[1]))
5678 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5679 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5680 if (GET_CODE (operands[2]) == CONST_INT
5681 && (INTVAL (operands[2]) == 128
5682 || (INTVAL (operands[2]) < 0
5683 && INTVAL (operands[2]) != -128)))
5685 operands[2] = GEN_INT (-INTVAL (operands[2]));
5686 return "sub{l}\t{%2, %0|%0, %2}";
5688 return "add{l}\t{%2, %0|%0, %2}";
5692 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5693 (const_string "incdec")
5694 (const_string "alu")))
5695 (set_attr "mode" "SI")])
5697 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5698 (define_insn "*addsi_2_zext"
5699 [(set (reg FLAGS_REG)
5701 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5702 (match_operand:SI 2 "general_operand" "rmni"))
5704 (set (match_operand:DI 0 "register_operand" "=r")
5705 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5706 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5707 && ix86_binary_operator_ok (PLUS, SImode, operands)
5708 /* Current assemblers are broken and do not allow @GOTOFF in
5709 ought but a memory context. */
5710 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5712 switch (get_attr_type (insn))
5715 if (operands[2] == const1_rtx)
5716 return "inc{l}\t%k0";
5717 else if (operands[2] == constm1_rtx)
5718 return "dec{l}\t%k0";
5723 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5724 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5725 if (GET_CODE (operands[2]) == CONST_INT
5726 && (INTVAL (operands[2]) == 128
5727 || (INTVAL (operands[2]) < 0
5728 && INTVAL (operands[2]) != -128)))
5730 operands[2] = GEN_INT (-INTVAL (operands[2]));
5731 return "sub{l}\t{%2, %k0|%k0, %2}";
5733 return "add{l}\t{%2, %k0|%k0, %2}";
5737 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5738 (const_string "incdec")
5739 (const_string "alu")))
5740 (set_attr "mode" "SI")])
5742 (define_insn "*addsi_3"
5743 [(set (reg FLAGS_REG)
5744 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5745 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5746 (clobber (match_scratch:SI 0 "=r"))]
5747 "ix86_match_ccmode (insn, CCZmode)
5748 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5749 /* Current assemblers are broken and do not allow @GOTOFF in
5750 ought but a memory context. */
5751 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5753 switch (get_attr_type (insn))
5756 if (! rtx_equal_p (operands[0], operands[1]))
5758 if (operands[2] == const1_rtx)
5759 return "inc{l}\t%0";
5760 else if (operands[2] == constm1_rtx)
5761 return "dec{l}\t%0";
5766 if (! rtx_equal_p (operands[0], operands[1]))
5768 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5769 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5770 if (GET_CODE (operands[2]) == CONST_INT
5771 && (INTVAL (operands[2]) == 128
5772 || (INTVAL (operands[2]) < 0
5773 && INTVAL (operands[2]) != -128)))
5775 operands[2] = GEN_INT (-INTVAL (operands[2]));
5776 return "sub{l}\t{%2, %0|%0, %2}";
5778 return "add{l}\t{%2, %0|%0, %2}";
5782 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5783 (const_string "incdec")
5784 (const_string "alu")))
5785 (set_attr "mode" "SI")])
5787 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5788 (define_insn "*addsi_3_zext"
5789 [(set (reg FLAGS_REG)
5790 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5791 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5792 (set (match_operand:DI 0 "register_operand" "=r")
5793 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5794 "TARGET_64BIT && ix86_match_ccmode (insn, CCZmode)
5795 && ix86_binary_operator_ok (PLUS, SImode, operands)
5796 /* Current assemblers are broken and do not allow @GOTOFF in
5797 ought but a memory context. */
5798 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5800 switch (get_attr_type (insn))
5803 if (operands[2] == const1_rtx)
5804 return "inc{l}\t%k0";
5805 else if (operands[2] == constm1_rtx)
5806 return "dec{l}\t%k0";
5811 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5812 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5813 if (GET_CODE (operands[2]) == CONST_INT
5814 && (INTVAL (operands[2]) == 128
5815 || (INTVAL (operands[2]) < 0
5816 && INTVAL (operands[2]) != -128)))
5818 operands[2] = GEN_INT (-INTVAL (operands[2]));
5819 return "sub{l}\t{%2, %k0|%k0, %2}";
5821 return "add{l}\t{%2, %k0|%k0, %2}";
5825 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5826 (const_string "incdec")
5827 (const_string "alu")))
5828 (set_attr "mode" "SI")])
5830 ; For comparisons against 1, -1 and 128, we may generate better code
5831 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5832 ; is matched then. We can't accept general immediate, because for
5833 ; case of overflows, the result is messed up.
5834 ; This pattern also don't hold of 0x80000000, since the value overflows
5836 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5837 ; only for comparisons not depending on it.
5838 (define_insn "*addsi_4"
5839 [(set (reg FLAGS_REG)
5840 (compare (match_operand:SI 1 "nonimmediate_operand" "0")
5841 (match_operand:SI 2 "const_int_operand" "n")))
5842 (clobber (match_scratch:SI 0 "=rm"))]
5843 "ix86_match_ccmode (insn, CCGCmode)
5844 && (INTVAL (operands[2]) & 0xffffffff) != 0x80000000"
5846 switch (get_attr_type (insn))
5849 if (operands[2] == constm1_rtx)
5850 return "inc{l}\t%0";
5851 else if (operands[2] == const1_rtx)
5852 return "dec{l}\t%0";
5857 if (! rtx_equal_p (operands[0], operands[1]))
5859 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5860 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5861 if ((INTVAL (operands[2]) == -128
5862 || (INTVAL (operands[2]) > 0
5863 && INTVAL (operands[2]) != 128)))
5864 return "sub{l}\t{%2, %0|%0, %2}";
5865 operands[2] = GEN_INT (-INTVAL (operands[2]));
5866 return "add{l}\t{%2, %0|%0, %2}";
5870 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5871 (const_string "incdec")
5872 (const_string "alu")))
5873 (set_attr "mode" "SI")])
5875 (define_insn "*addsi_5"
5876 [(set (reg FLAGS_REG)
5878 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5879 (match_operand:SI 2 "general_operand" "rmni"))
5881 (clobber (match_scratch:SI 0 "=r"))]
5882 "ix86_match_ccmode (insn, CCGOCmode)
5883 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5884 /* Current assemblers are broken and do not allow @GOTOFF in
5885 ought but a memory context. */
5886 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5888 switch (get_attr_type (insn))
5891 if (! rtx_equal_p (operands[0], operands[1]))
5893 if (operands[2] == const1_rtx)
5894 return "inc{l}\t%0";
5895 else if (operands[2] == constm1_rtx)
5896 return "dec{l}\t%0";
5901 if (! rtx_equal_p (operands[0], operands[1]))
5903 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5904 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5905 if (GET_CODE (operands[2]) == CONST_INT
5906 && (INTVAL (operands[2]) == 128
5907 || (INTVAL (operands[2]) < 0
5908 && INTVAL (operands[2]) != -128)))
5910 operands[2] = GEN_INT (-INTVAL (operands[2]));
5911 return "sub{l}\t{%2, %0|%0, %2}";
5913 return "add{l}\t{%2, %0|%0, %2}";
5917 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5918 (const_string "incdec")
5919 (const_string "alu")))
5920 (set_attr "mode" "SI")])
5922 (define_expand "addhi3"
5923 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
5924 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "")
5925 (match_operand:HI 2 "general_operand" "")))
5926 (clobber (reg:CC FLAGS_REG))])]
5927 "TARGET_HIMODE_MATH"
5928 "ix86_expand_binary_operator (PLUS, HImode, operands); DONE;")
5930 ;; %%% After Dave's SUBREG_BYTE stuff goes in, re-enable incb %ah
5931 ;; type optimizations enabled by define-splits. This is not important
5932 ;; for PII, and in fact harmful because of partial register stalls.
5934 (define_insn "*addhi_1_lea"
5935 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
5936 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r")
5937 (match_operand:HI 2 "general_operand" "ri,rm,lni")))
5938 (clobber (reg:CC FLAGS_REG))]
5939 "!TARGET_PARTIAL_REG_STALL
5940 && ix86_binary_operator_ok (PLUS, HImode, operands)"
5942 switch (get_attr_type (insn))
5947 if (operands[2] == const1_rtx)
5948 return "inc{w}\t%0";
5949 else if (operands[2] == constm1_rtx)
5950 return "dec{w}\t%0";
5954 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5955 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5956 if (GET_CODE (operands[2]) == CONST_INT
5957 && (INTVAL (operands[2]) == 128
5958 || (INTVAL (operands[2]) < 0
5959 && INTVAL (operands[2]) != -128)))
5961 operands[2] = GEN_INT (-INTVAL (operands[2]));
5962 return "sub{w}\t{%2, %0|%0, %2}";
5964 return "add{w}\t{%2, %0|%0, %2}";
5968 (if_then_else (eq_attr "alternative" "2")
5969 (const_string "lea")
5970 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5971 (const_string "incdec")
5972 (const_string "alu"))))
5973 (set_attr "mode" "HI,HI,SI")])
5975 (define_insn "*addhi_1"
5976 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
5977 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
5978 (match_operand:HI 2 "general_operand" "ri,rm")))
5979 (clobber (reg:CC FLAGS_REG))]
5980 "TARGET_PARTIAL_REG_STALL
5981 && ix86_binary_operator_ok (PLUS, HImode, operands)"
5983 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 (match_operand:HI 2 "incdec_operand" "")
6008 (const_string "incdec")
6009 (const_string "alu")))
6010 (set_attr "mode" "HI")])
6012 (define_insn "*addhi_2"
6013 [(set (reg FLAGS_REG)
6015 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
6016 (match_operand:HI 2 "general_operand" "rmni,rni"))
6018 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
6019 (plus:HI (match_dup 1) (match_dup 2)))]
6020 "ix86_match_ccmode (insn, CCGOCmode)
6021 && ix86_binary_operator_ok (PLUS, HImode, operands)"
6023 switch (get_attr_type (insn))
6026 if (operands[2] == const1_rtx)
6027 return "inc{w}\t%0";
6028 else if (operands[2] == constm1_rtx)
6029 return "dec{w}\t%0";
6033 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6034 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6035 if (GET_CODE (operands[2]) == CONST_INT
6036 && (INTVAL (operands[2]) == 128
6037 || (INTVAL (operands[2]) < 0
6038 && INTVAL (operands[2]) != -128)))
6040 operands[2] = GEN_INT (-INTVAL (operands[2]));
6041 return "sub{w}\t{%2, %0|%0, %2}";
6043 return "add{w}\t{%2, %0|%0, %2}";
6047 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6048 (const_string "incdec")
6049 (const_string "alu")))
6050 (set_attr "mode" "HI")])
6052 (define_insn "*addhi_3"
6053 [(set (reg FLAGS_REG)
6054 (compare (neg:HI (match_operand:HI 2 "general_operand" "rmni"))
6055 (match_operand:HI 1 "nonimmediate_operand" "%0")))
6056 (clobber (match_scratch:HI 0 "=r"))]
6057 "ix86_match_ccmode (insn, CCZmode)
6058 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6060 switch (get_attr_type (insn))
6063 if (operands[2] == const1_rtx)
6064 return "inc{w}\t%0";
6065 else if (operands[2] == constm1_rtx)
6066 return "dec{w}\t%0";
6070 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6071 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6072 if (GET_CODE (operands[2]) == CONST_INT
6073 && (INTVAL (operands[2]) == 128
6074 || (INTVAL (operands[2]) < 0
6075 && INTVAL (operands[2]) != -128)))
6077 operands[2] = GEN_INT (-INTVAL (operands[2]));
6078 return "sub{w}\t{%2, %0|%0, %2}";
6080 return "add{w}\t{%2, %0|%0, %2}";
6084 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6085 (const_string "incdec")
6086 (const_string "alu")))
6087 (set_attr "mode" "HI")])
6089 ; See comments above addsi_3_imm for details.
6090 (define_insn "*addhi_4"
6091 [(set (reg FLAGS_REG)
6092 (compare (match_operand:HI 1 "nonimmediate_operand" "0")
6093 (match_operand:HI 2 "const_int_operand" "n")))
6094 (clobber (match_scratch:HI 0 "=rm"))]
6095 "ix86_match_ccmode (insn, CCGCmode)
6096 && (INTVAL (operands[2]) & 0xffff) != 0x8000"
6098 switch (get_attr_type (insn))
6101 if (operands[2] == constm1_rtx)
6102 return "inc{w}\t%0";
6103 else if (operands[2] == const1_rtx)
6104 return "dec{w}\t%0";
6109 if (! rtx_equal_p (operands[0], operands[1]))
6111 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6112 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6113 if ((INTVAL (operands[2]) == -128
6114 || (INTVAL (operands[2]) > 0
6115 && INTVAL (operands[2]) != 128)))
6116 return "sub{w}\t{%2, %0|%0, %2}";
6117 operands[2] = GEN_INT (-INTVAL (operands[2]));
6118 return "add{w}\t{%2, %0|%0, %2}";
6122 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6123 (const_string "incdec")
6124 (const_string "alu")))
6125 (set_attr "mode" "SI")])
6128 (define_insn "*addhi_5"
6129 [(set (reg FLAGS_REG)
6131 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
6132 (match_operand:HI 2 "general_operand" "rmni"))
6134 (clobber (match_scratch:HI 0 "=r"))]
6135 "ix86_match_ccmode (insn, CCGOCmode)
6136 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6138 switch (get_attr_type (insn))
6141 if (operands[2] == const1_rtx)
6142 return "inc{w}\t%0";
6143 else if (operands[2] == constm1_rtx)
6144 return "dec{w}\t%0";
6148 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6149 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6150 if (GET_CODE (operands[2]) == CONST_INT
6151 && (INTVAL (operands[2]) == 128
6152 || (INTVAL (operands[2]) < 0
6153 && INTVAL (operands[2]) != -128)))
6155 operands[2] = GEN_INT (-INTVAL (operands[2]));
6156 return "sub{w}\t{%2, %0|%0, %2}";
6158 return "add{w}\t{%2, %0|%0, %2}";
6162 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6163 (const_string "incdec")
6164 (const_string "alu")))
6165 (set_attr "mode" "HI")])
6167 (define_expand "addqi3"
6168 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
6169 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "")
6170 (match_operand:QI 2 "general_operand" "")))
6171 (clobber (reg:CC FLAGS_REG))])]
6172 "TARGET_QIMODE_MATH"
6173 "ix86_expand_binary_operator (PLUS, QImode, operands); DONE;")
6175 ;; %%% Potential partial reg stall on alternative 2. What to do?
6176 (define_insn "*addqi_1_lea"
6177 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r")
6178 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,r")
6179 (match_operand:QI 2 "general_operand" "qn,qmn,rn,ln")))
6180 (clobber (reg:CC FLAGS_REG))]
6181 "!TARGET_PARTIAL_REG_STALL
6182 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6184 int widen = (which_alternative == 2);
6185 switch (get_attr_type (insn))
6190 if (operands[2] == const1_rtx)
6191 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6192 else if (operands[2] == constm1_rtx)
6193 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6197 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6198 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6199 if (GET_CODE (operands[2]) == CONST_INT
6200 && (INTVAL (operands[2]) == 128
6201 || (INTVAL (operands[2]) < 0
6202 && INTVAL (operands[2]) != -128)))
6204 operands[2] = GEN_INT (-INTVAL (operands[2]));
6206 return "sub{l}\t{%2, %k0|%k0, %2}";
6208 return "sub{b}\t{%2, %0|%0, %2}";
6211 return "add{l}\t{%k2, %k0|%k0, %k2}";
6213 return "add{b}\t{%2, %0|%0, %2}";
6217 (if_then_else (eq_attr "alternative" "3")
6218 (const_string "lea")
6219 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6220 (const_string "incdec")
6221 (const_string "alu"))))
6222 (set_attr "mode" "QI,QI,SI,SI")])
6224 (define_insn "*addqi_1"
6225 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
6226 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
6227 (match_operand:QI 2 "general_operand" "qn,qmn,rn")))
6228 (clobber (reg:CC FLAGS_REG))]
6229 "TARGET_PARTIAL_REG_STALL
6230 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6232 int widen = (which_alternative == 2);
6233 switch (get_attr_type (insn))
6236 if (operands[2] == const1_rtx)
6237 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6238 else if (operands[2] == constm1_rtx)
6239 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6243 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6244 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6245 if (GET_CODE (operands[2]) == CONST_INT
6246 && (INTVAL (operands[2]) == 128
6247 || (INTVAL (operands[2]) < 0
6248 && INTVAL (operands[2]) != -128)))
6250 operands[2] = GEN_INT (-INTVAL (operands[2]));
6252 return "sub{l}\t{%2, %k0|%k0, %2}";
6254 return "sub{b}\t{%2, %0|%0, %2}";
6257 return "add{l}\t{%k2, %k0|%k0, %k2}";
6259 return "add{b}\t{%2, %0|%0, %2}";
6263 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6264 (const_string "incdec")
6265 (const_string "alu")))
6266 (set_attr "mode" "QI,QI,SI")])
6268 (define_insn "*addqi_1_slp"
6269 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6270 (plus:QI (match_dup 0)
6271 (match_operand:QI 1 "general_operand" "qn,qnm")))
6272 (clobber (reg:CC FLAGS_REG))]
6273 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6274 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
6276 switch (get_attr_type (insn))
6279 if (operands[1] == const1_rtx)
6280 return "inc{b}\t%0";
6281 else if (operands[1] == constm1_rtx)
6282 return "dec{b}\t%0";
6286 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'. */
6287 if (GET_CODE (operands[1]) == CONST_INT
6288 && INTVAL (operands[1]) < 0)
6290 operands[1] = GEN_INT (-INTVAL (operands[1]));
6291 return "sub{b}\t{%1, %0|%0, %1}";
6293 return "add{b}\t{%1, %0|%0, %1}";
6297 (if_then_else (match_operand:QI 1 "incdec_operand" "")
6298 (const_string "incdec")
6299 (const_string "alu1")))
6300 (set (attr "memory")
6301 (if_then_else (match_operand 1 "memory_operand" "")
6302 (const_string "load")
6303 (const_string "none")))
6304 (set_attr "mode" "QI")])
6306 (define_insn "*addqi_2"
6307 [(set (reg FLAGS_REG)
6309 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
6310 (match_operand:QI 2 "general_operand" "qmni,qni"))
6312 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
6313 (plus:QI (match_dup 1) (match_dup 2)))]
6314 "ix86_match_ccmode (insn, CCGOCmode)
6315 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6317 switch (get_attr_type (insn))
6320 if (operands[2] == const1_rtx)
6321 return "inc{b}\t%0";
6322 else if (operands[2] == constm1_rtx
6323 || (GET_CODE (operands[2]) == CONST_INT
6324 && INTVAL (operands[2]) == 255))
6325 return "dec{b}\t%0";
6329 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6330 if (GET_CODE (operands[2]) == CONST_INT
6331 && INTVAL (operands[2]) < 0)
6333 operands[2] = GEN_INT (-INTVAL (operands[2]));
6334 return "sub{b}\t{%2, %0|%0, %2}";
6336 return "add{b}\t{%2, %0|%0, %2}";
6340 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6341 (const_string "incdec")
6342 (const_string "alu")))
6343 (set_attr "mode" "QI")])
6345 (define_insn "*addqi_3"
6346 [(set (reg FLAGS_REG)
6347 (compare (neg:QI (match_operand:QI 2 "general_operand" "qmni"))
6348 (match_operand:QI 1 "nonimmediate_operand" "%0")))
6349 (clobber (match_scratch:QI 0 "=q"))]
6350 "ix86_match_ccmode (insn, CCZmode)
6351 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6353 switch (get_attr_type (insn))
6356 if (operands[2] == const1_rtx)
6357 return "inc{b}\t%0";
6358 else if (operands[2] == constm1_rtx
6359 || (GET_CODE (operands[2]) == CONST_INT
6360 && INTVAL (operands[2]) == 255))
6361 return "dec{b}\t%0";
6365 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6366 if (GET_CODE (operands[2]) == CONST_INT
6367 && INTVAL (operands[2]) < 0)
6369 operands[2] = GEN_INT (-INTVAL (operands[2]));
6370 return "sub{b}\t{%2, %0|%0, %2}";
6372 return "add{b}\t{%2, %0|%0, %2}";
6376 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6377 (const_string "incdec")
6378 (const_string "alu")))
6379 (set_attr "mode" "QI")])
6381 ; See comments above addsi_3_imm for details.
6382 (define_insn "*addqi_4"
6383 [(set (reg FLAGS_REG)
6384 (compare (match_operand:QI 1 "nonimmediate_operand" "0")
6385 (match_operand:QI 2 "const_int_operand" "n")))
6386 (clobber (match_scratch:QI 0 "=qm"))]
6387 "ix86_match_ccmode (insn, CCGCmode)
6388 && (INTVAL (operands[2]) & 0xff) != 0x80"
6390 switch (get_attr_type (insn))
6393 if (operands[2] == constm1_rtx
6394 || (GET_CODE (operands[2]) == CONST_INT
6395 && INTVAL (operands[2]) == 255))
6396 return "inc{b}\t%0";
6397 else if (operands[2] == const1_rtx)
6398 return "dec{b}\t%0";
6403 if (! rtx_equal_p (operands[0], operands[1]))
6405 if (INTVAL (operands[2]) < 0)
6407 operands[2] = GEN_INT (-INTVAL (operands[2]));
6408 return "add{b}\t{%2, %0|%0, %2}";
6410 return "sub{b}\t{%2, %0|%0, %2}";
6414 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6415 (const_string "incdec")
6416 (const_string "alu")))
6417 (set_attr "mode" "QI")])
6420 (define_insn "*addqi_5"
6421 [(set (reg FLAGS_REG)
6423 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
6424 (match_operand:QI 2 "general_operand" "qmni"))
6426 (clobber (match_scratch:QI 0 "=q"))]
6427 "ix86_match_ccmode (insn, CCGOCmode)
6428 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6430 switch (get_attr_type (insn))
6433 if (operands[2] == const1_rtx)
6434 return "inc{b}\t%0";
6435 else if (operands[2] == constm1_rtx
6436 || (GET_CODE (operands[2]) == CONST_INT
6437 && INTVAL (operands[2]) == 255))
6438 return "dec{b}\t%0";
6442 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6443 if (GET_CODE (operands[2]) == CONST_INT
6444 && INTVAL (operands[2]) < 0)
6446 operands[2] = GEN_INT (-INTVAL (operands[2]));
6447 return "sub{b}\t{%2, %0|%0, %2}";
6449 return "add{b}\t{%2, %0|%0, %2}";
6453 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6454 (const_string "incdec")
6455 (const_string "alu")))
6456 (set_attr "mode" "QI")])
6459 (define_insn "addqi_ext_1"
6460 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6465 (match_operand 1 "ext_register_operand" "0")
6468 (match_operand:QI 2 "general_operand" "Qmn")))
6469 (clobber (reg:CC FLAGS_REG))]
6472 switch (get_attr_type (insn))
6475 if (operands[2] == const1_rtx)
6476 return "inc{b}\t%h0";
6477 else if (operands[2] == constm1_rtx
6478 || (GET_CODE (operands[2]) == CONST_INT
6479 && INTVAL (operands[2]) == 255))
6480 return "dec{b}\t%h0";
6484 return "add{b}\t{%2, %h0|%h0, %2}";
6488 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6489 (const_string "incdec")
6490 (const_string "alu")))
6491 (set_attr "mode" "QI")])
6493 (define_insn "*addqi_ext_1_rex64"
6494 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6499 (match_operand 1 "ext_register_operand" "0")
6502 (match_operand:QI 2 "nonmemory_operand" "Qn")))
6503 (clobber (reg:CC FLAGS_REG))]
6506 switch (get_attr_type (insn))
6509 if (operands[2] == const1_rtx)
6510 return "inc{b}\t%h0";
6511 else if (operands[2] == constm1_rtx
6512 || (GET_CODE (operands[2]) == CONST_INT
6513 && INTVAL (operands[2]) == 255))
6514 return "dec{b}\t%h0";
6518 return "add{b}\t{%2, %h0|%h0, %2}";
6522 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6523 (const_string "incdec")
6524 (const_string "alu")))
6525 (set_attr "mode" "QI")])
6527 (define_insn "*addqi_ext_2"
6528 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6533 (match_operand 1 "ext_register_operand" "%0")
6537 (match_operand 2 "ext_register_operand" "Q")
6540 (clobber (reg:CC FLAGS_REG))]
6542 "add{b}\t{%h2, %h0|%h0, %h2}"
6543 [(set_attr "type" "alu")
6544 (set_attr "mode" "QI")])
6546 ;; The patterns that match these are at the end of this file.
6548 (define_expand "addxf3"
6549 [(set (match_operand:XF 0 "register_operand" "")
6550 (plus:XF (match_operand:XF 1 "register_operand" "")
6551 (match_operand:XF 2 "register_operand" "")))]
6555 (define_expand "adddf3"
6556 [(set (match_operand:DF 0 "register_operand" "")
6557 (plus:DF (match_operand:DF 1 "register_operand" "")
6558 (match_operand:DF 2 "nonimmediate_operand" "")))]
6559 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6562 (define_expand "addsf3"
6563 [(set (match_operand:SF 0 "register_operand" "")
6564 (plus:SF (match_operand:SF 1 "register_operand" "")
6565 (match_operand:SF 2 "nonimmediate_operand" "")))]
6566 "TARGET_80387 || TARGET_SSE_MATH"
6569 ;; Subtract instructions
6571 ;; %%% splits for subsidi3
6573 (define_expand "subdi3"
6574 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
6575 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6576 (match_operand:DI 2 "x86_64_general_operand" "")))
6577 (clobber (reg:CC FLAGS_REG))])]
6579 "ix86_expand_binary_operator (MINUS, DImode, operands); DONE;")
6581 (define_insn "*subdi3_1"
6582 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
6583 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6584 (match_operand:DI 2 "general_operand" "roiF,riF")))
6585 (clobber (reg:CC FLAGS_REG))]
6586 "!TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6590 [(set (match_operand:DI 0 "nonimmediate_operand" "")
6591 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6592 (match_operand:DI 2 "general_operand" "")))
6593 (clobber (reg:CC FLAGS_REG))]
6594 "!TARGET_64BIT && reload_completed"
6595 [(parallel [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2)))
6596 (set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))])
6597 (parallel [(set (match_dup 3)
6598 (minus:SI (match_dup 4)
6599 (plus:SI (ltu:SI (reg:CC FLAGS_REG) (const_int 0))
6601 (clobber (reg:CC FLAGS_REG))])]
6602 "split_di (operands+0, 1, operands+0, operands+3);
6603 split_di (operands+1, 1, operands+1, operands+4);
6604 split_di (operands+2, 1, operands+2, operands+5);")
6606 (define_insn "subdi3_carry_rex64"
6607 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6608 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6609 (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "")
6610 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))))
6611 (clobber (reg:CC FLAGS_REG))]
6612 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6613 "sbb{q}\t{%2, %0|%0, %2}"
6614 [(set_attr "type" "alu")
6615 (set_attr "pent_pair" "pu")
6616 (set_attr "mode" "DI")])
6618 (define_insn "*subdi_1_rex64"
6619 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6620 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6621 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6622 (clobber (reg:CC FLAGS_REG))]
6623 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6624 "sub{q}\t{%2, %0|%0, %2}"
6625 [(set_attr "type" "alu")
6626 (set_attr "mode" "DI")])
6628 (define_insn "*subdi_2_rex64"
6629 [(set (reg FLAGS_REG)
6631 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6632 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))
6634 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6635 (minus:DI (match_dup 1) (match_dup 2)))]
6636 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6637 && ix86_binary_operator_ok (MINUS, DImode, operands)"
6638 "sub{q}\t{%2, %0|%0, %2}"
6639 [(set_attr "type" "alu")
6640 (set_attr "mode" "DI")])
6642 (define_insn "*subdi_3_rex63"
6643 [(set (reg FLAGS_REG)
6644 (compare (match_operand:DI 1 "nonimmediate_operand" "0,0")
6645 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6646 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6647 (minus:DI (match_dup 1) (match_dup 2)))]
6648 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6649 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6650 "sub{q}\t{%2, %0|%0, %2}"
6651 [(set_attr "type" "alu")
6652 (set_attr "mode" "DI")])
6654 (define_insn "subqi3_carry"
6655 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
6656 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6657 (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "")
6658 (match_operand:QI 2 "general_operand" "qi,qm"))))
6659 (clobber (reg:CC FLAGS_REG))]
6660 "ix86_binary_operator_ok (MINUS, QImode, operands)"
6661 "sbb{b}\t{%2, %0|%0, %2}"
6662 [(set_attr "type" "alu")
6663 (set_attr "pent_pair" "pu")
6664 (set_attr "mode" "QI")])
6666 (define_insn "subhi3_carry"
6667 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6668 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6669 (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "")
6670 (match_operand:HI 2 "general_operand" "ri,rm"))))
6671 (clobber (reg:CC FLAGS_REG))]
6672 "ix86_binary_operator_ok (MINUS, HImode, operands)"
6673 "sbb{w}\t{%2, %0|%0, %2}"
6674 [(set_attr "type" "alu")
6675 (set_attr "pent_pair" "pu")
6676 (set_attr "mode" "HI")])
6678 (define_insn "subsi3_carry"
6679 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6680 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6681 (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
6682 (match_operand:SI 2 "general_operand" "ri,rm"))))
6683 (clobber (reg:CC FLAGS_REG))]
6684 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6685 "sbb{l}\t{%2, %0|%0, %2}"
6686 [(set_attr "type" "alu")
6687 (set_attr "pent_pair" "pu")
6688 (set_attr "mode" "SI")])
6690 (define_insn "subsi3_carry_zext"
6691 [(set (match_operand:DI 0 "register_operand" "=rm,r")
6693 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
6694 (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
6695 (match_operand:SI 2 "general_operand" "ri,rm")))))
6696 (clobber (reg:CC FLAGS_REG))]
6697 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6698 "sbb{l}\t{%2, %k0|%k0, %2}"
6699 [(set_attr "type" "alu")
6700 (set_attr "pent_pair" "pu")
6701 (set_attr "mode" "SI")])
6703 (define_expand "subsi3"
6704 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
6705 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "")
6706 (match_operand:SI 2 "general_operand" "")))
6707 (clobber (reg:CC FLAGS_REG))])]
6709 "ix86_expand_binary_operator (MINUS, SImode, operands); DONE;")
6711 (define_insn "*subsi_1"
6712 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6713 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6714 (match_operand:SI 2 "general_operand" "ri,rm")))
6715 (clobber (reg:CC FLAGS_REG))]
6716 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6717 "sub{l}\t{%2, %0|%0, %2}"
6718 [(set_attr "type" "alu")
6719 (set_attr "mode" "SI")])
6721 (define_insn "*subsi_1_zext"
6722 [(set (match_operand:DI 0 "register_operand" "=r")
6724 (minus:SI (match_operand:SI 1 "register_operand" "0")
6725 (match_operand:SI 2 "general_operand" "rim"))))
6726 (clobber (reg:CC FLAGS_REG))]
6727 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6728 "sub{l}\t{%2, %k0|%k0, %2}"
6729 [(set_attr "type" "alu")
6730 (set_attr "mode" "SI")])
6732 (define_insn "*subsi_2"
6733 [(set (reg FLAGS_REG)
6735 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6736 (match_operand:SI 2 "general_operand" "ri,rm"))
6738 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6739 (minus:SI (match_dup 1) (match_dup 2)))]
6740 "ix86_match_ccmode (insn, CCGOCmode)
6741 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6742 "sub{l}\t{%2, %0|%0, %2}"
6743 [(set_attr "type" "alu")
6744 (set_attr "mode" "SI")])
6746 (define_insn "*subsi_2_zext"
6747 [(set (reg FLAGS_REG)
6749 (minus:SI (match_operand:SI 1 "register_operand" "0")
6750 (match_operand:SI 2 "general_operand" "rim"))
6752 (set (match_operand:DI 0 "register_operand" "=r")
6754 (minus:SI (match_dup 1)
6756 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6757 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6758 "sub{l}\t{%2, %k0|%k0, %2}"
6759 [(set_attr "type" "alu")
6760 (set_attr "mode" "SI")])
6762 (define_insn "*subsi_3"
6763 [(set (reg FLAGS_REG)
6764 (compare (match_operand:SI 1 "nonimmediate_operand" "0,0")
6765 (match_operand:SI 2 "general_operand" "ri,rm")))
6766 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6767 (minus:SI (match_dup 1) (match_dup 2)))]
6768 "ix86_match_ccmode (insn, CCmode)
6769 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6770 "sub{l}\t{%2, %0|%0, %2}"
6771 [(set_attr "type" "alu")
6772 (set_attr "mode" "SI")])
6774 (define_insn "*subsi_3_zext"
6775 [(set (reg FLAGS_REG)
6776 (compare (match_operand:SI 1 "register_operand" "0")
6777 (match_operand:SI 2 "general_operand" "rim")))
6778 (set (match_operand:DI 0 "register_operand" "=r")
6780 (minus:SI (match_dup 1)
6782 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6783 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6784 "sub{q}\t{%2, %0|%0, %2}"
6785 [(set_attr "type" "alu")
6786 (set_attr "mode" "DI")])
6788 (define_expand "subhi3"
6789 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
6790 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "")
6791 (match_operand:HI 2 "general_operand" "")))
6792 (clobber (reg:CC FLAGS_REG))])]
6793 "TARGET_HIMODE_MATH"
6794 "ix86_expand_binary_operator (MINUS, HImode, operands); DONE;")
6796 (define_insn "*subhi_1"
6797 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6798 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6799 (match_operand:HI 2 "general_operand" "ri,rm")))
6800 (clobber (reg:CC FLAGS_REG))]
6801 "ix86_binary_operator_ok (MINUS, HImode, operands)"
6802 "sub{w}\t{%2, %0|%0, %2}"
6803 [(set_attr "type" "alu")
6804 (set_attr "mode" "HI")])
6806 (define_insn "*subhi_2"
6807 [(set (reg FLAGS_REG)
6809 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6810 (match_operand:HI 2 "general_operand" "ri,rm"))
6812 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6813 (minus:HI (match_dup 1) (match_dup 2)))]
6814 "ix86_match_ccmode (insn, CCGOCmode)
6815 && ix86_binary_operator_ok (MINUS, HImode, operands)"
6816 "sub{w}\t{%2, %0|%0, %2}"
6817 [(set_attr "type" "alu")
6818 (set_attr "mode" "HI")])
6820 (define_insn "*subhi_3"
6821 [(set (reg FLAGS_REG)
6822 (compare (match_operand:HI 1 "nonimmediate_operand" "0,0")
6823 (match_operand:HI 2 "general_operand" "ri,rm")))
6824 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6825 (minus:HI (match_dup 1) (match_dup 2)))]
6826 "ix86_match_ccmode (insn, CCmode)
6827 && ix86_binary_operator_ok (MINUS, HImode, operands)"
6828 "sub{w}\t{%2, %0|%0, %2}"
6829 [(set_attr "type" "alu")
6830 (set_attr "mode" "HI")])
6832 (define_expand "subqi3"
6833 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
6834 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "")
6835 (match_operand:QI 2 "general_operand" "")))
6836 (clobber (reg:CC FLAGS_REG))])]
6837 "TARGET_QIMODE_MATH"
6838 "ix86_expand_binary_operator (MINUS, QImode, operands); DONE;")
6840 (define_insn "*subqi_1"
6841 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
6842 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6843 (match_operand:QI 2 "general_operand" "qn,qmn")))
6844 (clobber (reg:CC FLAGS_REG))]
6845 "ix86_binary_operator_ok (MINUS, QImode, operands)"
6846 "sub{b}\t{%2, %0|%0, %2}"
6847 [(set_attr "type" "alu")
6848 (set_attr "mode" "QI")])
6850 (define_insn "*subqi_1_slp"
6851 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6852 (minus:QI (match_dup 0)
6853 (match_operand:QI 1 "general_operand" "qn,qmn")))
6854 (clobber (reg:CC FLAGS_REG))]
6855 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6856 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
6857 "sub{b}\t{%1, %0|%0, %1}"
6858 [(set_attr "type" "alu1")
6859 (set_attr "mode" "QI")])
6861 (define_insn "*subqi_2"
6862 [(set (reg FLAGS_REG)
6864 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6865 (match_operand:QI 2 "general_operand" "qi,qm"))
6867 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
6868 (minus:HI (match_dup 1) (match_dup 2)))]
6869 "ix86_match_ccmode (insn, CCGOCmode)
6870 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6871 "sub{b}\t{%2, %0|%0, %2}"
6872 [(set_attr "type" "alu")
6873 (set_attr "mode" "QI")])
6875 (define_insn "*subqi_3"
6876 [(set (reg FLAGS_REG)
6877 (compare (match_operand:QI 1 "nonimmediate_operand" "0,0")
6878 (match_operand:QI 2 "general_operand" "qi,qm")))
6879 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
6880 (minus:HI (match_dup 1) (match_dup 2)))]
6881 "ix86_match_ccmode (insn, CCmode)
6882 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6883 "sub{b}\t{%2, %0|%0, %2}"
6884 [(set_attr "type" "alu")
6885 (set_attr "mode" "QI")])
6887 ;; The patterns that match these are at the end of this file.
6889 (define_expand "subxf3"
6890 [(set (match_operand:XF 0 "register_operand" "")
6891 (minus:XF (match_operand:XF 1 "register_operand" "")
6892 (match_operand:XF 2 "register_operand" "")))]
6896 (define_expand "subdf3"
6897 [(set (match_operand:DF 0 "register_operand" "")
6898 (minus:DF (match_operand:DF 1 "register_operand" "")
6899 (match_operand:DF 2 "nonimmediate_operand" "")))]
6900 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6903 (define_expand "subsf3"
6904 [(set (match_operand:SF 0 "register_operand" "")
6905 (minus:SF (match_operand:SF 1 "register_operand" "")
6906 (match_operand:SF 2 "nonimmediate_operand" "")))]
6907 "TARGET_80387 || TARGET_SSE_MATH"
6910 ;; Multiply instructions
6912 (define_expand "muldi3"
6913 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6914 (mult:DI (match_operand:DI 1 "register_operand" "")
6915 (match_operand:DI 2 "x86_64_general_operand" "")))
6916 (clobber (reg:CC FLAGS_REG))])]
6920 (define_insn "*muldi3_1_rex64"
6921 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
6922 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%rm,rm,0")
6923 (match_operand:DI 2 "x86_64_general_operand" "K,e,mr")))
6924 (clobber (reg:CC FLAGS_REG))]
6926 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6928 imul{q}\t{%2, %1, %0|%0, %1, %2}
6929 imul{q}\t{%2, %1, %0|%0, %1, %2}
6930 imul{q}\t{%2, %0|%0, %2}"
6931 [(set_attr "type" "imul")
6932 (set_attr "prefix_0f" "0,0,1")
6933 (set (attr "athlon_decode")
6934 (cond [(eq_attr "cpu" "athlon")
6935 (const_string "vector")
6936 (eq_attr "alternative" "1")
6937 (const_string "vector")
6938 (and (eq_attr "alternative" "2")
6939 (match_operand 1 "memory_operand" ""))
6940 (const_string "vector")]
6941 (const_string "direct")))
6942 (set_attr "mode" "DI")])
6944 (define_expand "mulsi3"
6945 [(parallel [(set (match_operand:SI 0 "register_operand" "")
6946 (mult:SI (match_operand:SI 1 "register_operand" "")
6947 (match_operand:SI 2 "general_operand" "")))
6948 (clobber (reg:CC FLAGS_REG))])]
6952 (define_insn "*mulsi3_1"
6953 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
6954 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0")
6955 (match_operand:SI 2 "general_operand" "K,i,mr")))
6956 (clobber (reg:CC FLAGS_REG))]
6957 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
6959 imul{l}\t{%2, %1, %0|%0, %1, %2}
6960 imul{l}\t{%2, %1, %0|%0, %1, %2}
6961 imul{l}\t{%2, %0|%0, %2}"
6962 [(set_attr "type" "imul")
6963 (set_attr "prefix_0f" "0,0,1")
6964 (set (attr "athlon_decode")
6965 (cond [(eq_attr "cpu" "athlon")
6966 (const_string "vector")
6967 (eq_attr "alternative" "1")
6968 (const_string "vector")
6969 (and (eq_attr "alternative" "2")
6970 (match_operand 1 "memory_operand" ""))
6971 (const_string "vector")]
6972 (const_string "direct")))
6973 (set_attr "mode" "SI")])
6975 (define_insn "*mulsi3_1_zext"
6976 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
6978 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0")
6979 (match_operand:SI 2 "general_operand" "K,i,mr"))))
6980 (clobber (reg:CC FLAGS_REG))]
6982 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6984 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
6985 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
6986 imul{l}\t{%2, %k0|%k0, %2}"
6987 [(set_attr "type" "imul")
6988 (set_attr "prefix_0f" "0,0,1")
6989 (set (attr "athlon_decode")
6990 (cond [(eq_attr "cpu" "athlon")
6991 (const_string "vector")
6992 (eq_attr "alternative" "1")
6993 (const_string "vector")
6994 (and (eq_attr "alternative" "2")
6995 (match_operand 1 "memory_operand" ""))
6996 (const_string "vector")]
6997 (const_string "direct")))
6998 (set_attr "mode" "SI")])
7000 (define_expand "mulhi3"
7001 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7002 (mult:HI (match_operand:HI 1 "register_operand" "")
7003 (match_operand:HI 2 "general_operand" "")))
7004 (clobber (reg:CC FLAGS_REG))])]
7005 "TARGET_HIMODE_MATH"
7008 (define_insn "*mulhi3_1"
7009 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
7010 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,rm,0")
7011 (match_operand:HI 2 "general_operand" "K,i,mr")))
7012 (clobber (reg:CC FLAGS_REG))]
7013 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7015 imul{w}\t{%2, %1, %0|%0, %1, %2}
7016 imul{w}\t{%2, %1, %0|%0, %1, %2}
7017 imul{w}\t{%2, %0|%0, %2}"
7018 [(set_attr "type" "imul")
7019 (set_attr "prefix_0f" "0,0,1")
7020 (set (attr "athlon_decode")
7021 (cond [(eq_attr "cpu" "athlon")
7022 (const_string "vector")
7023 (eq_attr "alternative" "1,2")
7024 (const_string "vector")]
7025 (const_string "direct")))
7026 (set_attr "mode" "HI")])
7028 (define_expand "mulqi3"
7029 [(parallel [(set (match_operand:QI 0 "register_operand" "")
7030 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "")
7031 (match_operand:QI 2 "register_operand" "")))
7032 (clobber (reg:CC FLAGS_REG))])]
7033 "TARGET_QIMODE_MATH"
7036 (define_insn "*mulqi3_1"
7037 [(set (match_operand:QI 0 "register_operand" "=a")
7038 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
7039 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7040 (clobber (reg:CC FLAGS_REG))]
7042 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7044 [(set_attr "type" "imul")
7045 (set_attr "length_immediate" "0")
7046 (set (attr "athlon_decode")
7047 (if_then_else (eq_attr "cpu" "athlon")
7048 (const_string "vector")
7049 (const_string "direct")))
7050 (set_attr "mode" "QI")])
7052 (define_expand "umulqihi3"
7053 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7054 (mult:HI (zero_extend:HI
7055 (match_operand:QI 1 "nonimmediate_operand" ""))
7057 (match_operand:QI 2 "register_operand" ""))))
7058 (clobber (reg:CC FLAGS_REG))])]
7059 "TARGET_QIMODE_MATH"
7062 (define_insn "*umulqihi3_1"
7063 [(set (match_operand:HI 0 "register_operand" "=a")
7064 (mult:HI (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
7065 (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
7066 (clobber (reg:CC FLAGS_REG))]
7068 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7070 [(set_attr "type" "imul")
7071 (set_attr "length_immediate" "0")
7072 (set (attr "athlon_decode")
7073 (if_then_else (eq_attr "cpu" "athlon")
7074 (const_string "vector")
7075 (const_string "direct")))
7076 (set_attr "mode" "QI")])
7078 (define_expand "mulqihi3"
7079 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7080 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" ""))
7081 (sign_extend:HI (match_operand:QI 2 "register_operand" ""))))
7082 (clobber (reg:CC FLAGS_REG))])]
7083 "TARGET_QIMODE_MATH"
7086 (define_insn "*mulqihi3_insn"
7087 [(set (match_operand:HI 0 "register_operand" "=a")
7088 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
7089 (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
7090 (clobber (reg:CC FLAGS_REG))]
7092 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7094 [(set_attr "type" "imul")
7095 (set_attr "length_immediate" "0")
7096 (set (attr "athlon_decode")
7097 (if_then_else (eq_attr "cpu" "athlon")
7098 (const_string "vector")
7099 (const_string "direct")))
7100 (set_attr "mode" "QI")])
7102 (define_expand "umulditi3"
7103 [(parallel [(set (match_operand:TI 0 "register_operand" "")
7104 (mult:TI (zero_extend:TI
7105 (match_operand:DI 1 "nonimmediate_operand" ""))
7107 (match_operand:DI 2 "register_operand" ""))))
7108 (clobber (reg:CC FLAGS_REG))])]
7112 (define_insn "*umulditi3_insn"
7113 [(set (match_operand:TI 0 "register_operand" "=A")
7114 (mult:TI (zero_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
7115 (zero_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
7116 (clobber (reg:CC FLAGS_REG))]
7118 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7120 [(set_attr "type" "imul")
7121 (set_attr "length_immediate" "0")
7122 (set (attr "athlon_decode")
7123 (if_then_else (eq_attr "cpu" "athlon")
7124 (const_string "vector")
7125 (const_string "double")))
7126 (set_attr "mode" "DI")])
7128 ;; We can't use this pattern in 64bit mode, since it results in two separate 32bit registers
7129 (define_expand "umulsidi3"
7130 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7131 (mult:DI (zero_extend:DI
7132 (match_operand:SI 1 "nonimmediate_operand" ""))
7134 (match_operand:SI 2 "register_operand" ""))))
7135 (clobber (reg:CC FLAGS_REG))])]
7139 (define_insn "*umulsidi3_insn"
7140 [(set (match_operand:DI 0 "register_operand" "=A")
7141 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
7142 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
7143 (clobber (reg:CC FLAGS_REG))]
7145 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7147 [(set_attr "type" "imul")
7148 (set_attr "length_immediate" "0")
7149 (set (attr "athlon_decode")
7150 (if_then_else (eq_attr "cpu" "athlon")
7151 (const_string "vector")
7152 (const_string "double")))
7153 (set_attr "mode" "SI")])
7155 (define_expand "mulditi3"
7156 [(parallel [(set (match_operand:TI 0 "register_operand" "")
7157 (mult:TI (sign_extend:TI
7158 (match_operand:DI 1 "nonimmediate_operand" ""))
7160 (match_operand:DI 2 "register_operand" ""))))
7161 (clobber (reg:CC FLAGS_REG))])]
7165 (define_insn "*mulditi3_insn"
7166 [(set (match_operand:TI 0 "register_operand" "=A")
7167 (mult:TI (sign_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
7168 (sign_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
7169 (clobber (reg:CC FLAGS_REG))]
7171 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7173 [(set_attr "type" "imul")
7174 (set_attr "length_immediate" "0")
7175 (set (attr "athlon_decode")
7176 (if_then_else (eq_attr "cpu" "athlon")
7177 (const_string "vector")
7178 (const_string "double")))
7179 (set_attr "mode" "DI")])
7181 (define_expand "mulsidi3"
7182 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7183 (mult:DI (sign_extend:DI
7184 (match_operand:SI 1 "nonimmediate_operand" ""))
7186 (match_operand:SI 2 "register_operand" ""))))
7187 (clobber (reg:CC FLAGS_REG))])]
7191 (define_insn "*mulsidi3_insn"
7192 [(set (match_operand:DI 0 "register_operand" "=A")
7193 (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
7194 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
7195 (clobber (reg:CC FLAGS_REG))]
7197 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7199 [(set_attr "type" "imul")
7200 (set_attr "length_immediate" "0")
7201 (set (attr "athlon_decode")
7202 (if_then_else (eq_attr "cpu" "athlon")
7203 (const_string "vector")
7204 (const_string "double")))
7205 (set_attr "mode" "SI")])
7207 (define_expand "umuldi3_highpart"
7208 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7211 (mult:TI (zero_extend:TI
7212 (match_operand:DI 1 "nonimmediate_operand" ""))
7214 (match_operand:DI 2 "register_operand" "")))
7216 (clobber (match_scratch:DI 3 ""))
7217 (clobber (reg:CC FLAGS_REG))])]
7221 (define_insn "*umuldi3_highpart_rex64"
7222 [(set (match_operand:DI 0 "register_operand" "=d")
7225 (mult:TI (zero_extend:TI
7226 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7228 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7230 (clobber (match_scratch:DI 3 "=1"))
7231 (clobber (reg:CC FLAGS_REG))]
7233 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7235 [(set_attr "type" "imul")
7236 (set_attr "length_immediate" "0")
7237 (set (attr "athlon_decode")
7238 (if_then_else (eq_attr "cpu" "athlon")
7239 (const_string "vector")
7240 (const_string "double")))
7241 (set_attr "mode" "DI")])
7243 (define_expand "umulsi3_highpart"
7244 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7247 (mult:DI (zero_extend:DI
7248 (match_operand:SI 1 "nonimmediate_operand" ""))
7250 (match_operand:SI 2 "register_operand" "")))
7252 (clobber (match_scratch:SI 3 ""))
7253 (clobber (reg:CC FLAGS_REG))])]
7257 (define_insn "*umulsi3_highpart_insn"
7258 [(set (match_operand:SI 0 "register_operand" "=d")
7261 (mult:DI (zero_extend:DI
7262 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7264 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7266 (clobber (match_scratch:SI 3 "=1"))
7267 (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" "SI")])
7278 (define_insn "*umulsi3_highpart_zext"
7279 [(set (match_operand:DI 0 "register_operand" "=d")
7280 (zero_extend:DI (truncate:SI
7282 (mult:DI (zero_extend:DI
7283 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7285 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7287 (clobber (match_scratch:SI 3 "=1"))
7288 (clobber (reg:CC FLAGS_REG))]
7290 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7292 [(set_attr "type" "imul")
7293 (set_attr "length_immediate" "0")
7294 (set (attr "athlon_decode")
7295 (if_then_else (eq_attr "cpu" "athlon")
7296 (const_string "vector")
7297 (const_string "double")))
7298 (set_attr "mode" "SI")])
7300 (define_expand "smuldi3_highpart"
7301 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
7304 (mult:TI (sign_extend:TI
7305 (match_operand:DI 1 "nonimmediate_operand" ""))
7307 (match_operand:DI 2 "register_operand" "")))
7309 (clobber (match_scratch:DI 3 ""))
7310 (clobber (reg:CC FLAGS_REG))])]
7314 (define_insn "*smuldi3_highpart_rex64"
7315 [(set (match_operand:DI 0 "register_operand" "=d")
7318 (mult:TI (sign_extend:TI
7319 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7321 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7323 (clobber (match_scratch:DI 3 "=1"))
7324 (clobber (reg:CC FLAGS_REG))]
7326 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7328 [(set_attr "type" "imul")
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" "DI")])
7335 (define_expand "smulsi3_highpart"
7336 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7339 (mult:DI (sign_extend:DI
7340 (match_operand:SI 1 "nonimmediate_operand" ""))
7342 (match_operand:SI 2 "register_operand" "")))
7344 (clobber (match_scratch:SI 3 ""))
7345 (clobber (reg:CC FLAGS_REG))])]
7349 (define_insn "*smulsi3_highpart_insn"
7350 [(set (match_operand:SI 0 "register_operand" "=d")
7353 (mult:DI (sign_extend:DI
7354 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7356 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7358 (clobber (match_scratch:SI 3 "=1"))
7359 (clobber (reg:CC FLAGS_REG))]
7360 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7362 [(set_attr "type" "imul")
7363 (set (attr "athlon_decode")
7364 (if_then_else (eq_attr "cpu" "athlon")
7365 (const_string "vector")
7366 (const_string "double")))
7367 (set_attr "mode" "SI")])
7369 (define_insn "*smulsi3_highpart_zext"
7370 [(set (match_operand:DI 0 "register_operand" "=d")
7371 (zero_extend:DI (truncate:SI
7373 (mult:DI (sign_extend:DI
7374 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7376 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7378 (clobber (match_scratch:SI 3 "=1"))
7379 (clobber (reg:CC FLAGS_REG))]
7381 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7383 [(set_attr "type" "imul")
7384 (set (attr "athlon_decode")
7385 (if_then_else (eq_attr "cpu" "athlon")
7386 (const_string "vector")
7387 (const_string "double")))
7388 (set_attr "mode" "SI")])
7390 ;; The patterns that match these are at the end of this file.
7392 (define_expand "mulxf3"
7393 [(set (match_operand:XF 0 "register_operand" "")
7394 (mult:XF (match_operand:XF 1 "register_operand" "")
7395 (match_operand:XF 2 "register_operand" "")))]
7399 (define_expand "muldf3"
7400 [(set (match_operand:DF 0 "register_operand" "")
7401 (mult:DF (match_operand:DF 1 "register_operand" "")
7402 (match_operand:DF 2 "nonimmediate_operand" "")))]
7403 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7406 (define_expand "mulsf3"
7407 [(set (match_operand:SF 0 "register_operand" "")
7408 (mult:SF (match_operand:SF 1 "register_operand" "")
7409 (match_operand:SF 2 "nonimmediate_operand" "")))]
7410 "TARGET_80387 || TARGET_SSE_MATH"
7413 ;; Divide instructions
7415 (define_insn "divqi3"
7416 [(set (match_operand:QI 0 "register_operand" "=a")
7417 (div:QI (match_operand:HI 1 "register_operand" "0")
7418 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7419 (clobber (reg:CC FLAGS_REG))]
7420 "TARGET_QIMODE_MATH"
7422 [(set_attr "type" "idiv")
7423 (set_attr "mode" "QI")])
7425 (define_insn "udivqi3"
7426 [(set (match_operand:QI 0 "register_operand" "=a")
7427 (udiv:QI (match_operand:HI 1 "register_operand" "0")
7428 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7429 (clobber (reg:CC FLAGS_REG))]
7430 "TARGET_QIMODE_MATH"
7432 [(set_attr "type" "idiv")
7433 (set_attr "mode" "QI")])
7435 ;; The patterns that match these are at the end of this file.
7437 (define_expand "divxf3"
7438 [(set (match_operand:XF 0 "register_operand" "")
7439 (div:XF (match_operand:XF 1 "register_operand" "")
7440 (match_operand:XF 2 "register_operand" "")))]
7444 (define_expand "divdf3"
7445 [(set (match_operand:DF 0 "register_operand" "")
7446 (div:DF (match_operand:DF 1 "register_operand" "")
7447 (match_operand:DF 2 "nonimmediate_operand" "")))]
7448 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7451 (define_expand "divsf3"
7452 [(set (match_operand:SF 0 "register_operand" "")
7453 (div:SF (match_operand:SF 1 "register_operand" "")
7454 (match_operand:SF 2 "nonimmediate_operand" "")))]
7455 "TARGET_80387 || TARGET_SSE_MATH"
7458 ;; Remainder instructions.
7460 (define_expand "divmoddi4"
7461 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7462 (div:DI (match_operand:DI 1 "register_operand" "")
7463 (match_operand:DI 2 "nonimmediate_operand" "")))
7464 (set (match_operand:DI 3 "register_operand" "")
7465 (mod:DI (match_dup 1) (match_dup 2)))
7466 (clobber (reg:CC FLAGS_REG))])]
7470 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7471 ;; Penalize eax case slightly because it results in worse scheduling
7473 (define_insn "*divmoddi4_nocltd_rex64"
7474 [(set (match_operand:DI 0 "register_operand" "=&a,?a")
7475 (div:DI (match_operand:DI 2 "register_operand" "1,0")
7476 (match_operand:DI 3 "nonimmediate_operand" "rm,rm")))
7477 (set (match_operand:DI 1 "register_operand" "=&d,&d")
7478 (mod:DI (match_dup 2) (match_dup 3)))
7479 (clobber (reg:CC FLAGS_REG))]
7480 "TARGET_64BIT && !optimize_size && !TARGET_USE_CLTD"
7482 [(set_attr "type" "multi")])
7484 (define_insn "*divmoddi4_cltd_rex64"
7485 [(set (match_operand:DI 0 "register_operand" "=a")
7486 (div:DI (match_operand:DI 2 "register_operand" "a")
7487 (match_operand:DI 3 "nonimmediate_operand" "rm")))
7488 (set (match_operand:DI 1 "register_operand" "=&d")
7489 (mod:DI (match_dup 2) (match_dup 3)))
7490 (clobber (reg:CC FLAGS_REG))]
7491 "TARGET_64BIT && (optimize_size || TARGET_USE_CLTD)"
7493 [(set_attr "type" "multi")])
7495 (define_insn "*divmoddi_noext_rex64"
7496 [(set (match_operand:DI 0 "register_operand" "=a")
7497 (div:DI (match_operand:DI 1 "register_operand" "0")
7498 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7499 (set (match_operand:DI 3 "register_operand" "=d")
7500 (mod:DI (match_dup 1) (match_dup 2)))
7501 (use (match_operand:DI 4 "register_operand" "3"))
7502 (clobber (reg:CC FLAGS_REG))]
7505 [(set_attr "type" "idiv")
7506 (set_attr "mode" "DI")])
7509 [(set (match_operand:DI 0 "register_operand" "")
7510 (div:DI (match_operand:DI 1 "register_operand" "")
7511 (match_operand:DI 2 "nonimmediate_operand" "")))
7512 (set (match_operand:DI 3 "register_operand" "")
7513 (mod:DI (match_dup 1) (match_dup 2)))
7514 (clobber (reg:CC FLAGS_REG))]
7515 "TARGET_64BIT && reload_completed"
7516 [(parallel [(set (match_dup 3)
7517 (ashiftrt:DI (match_dup 4) (const_int 63)))
7518 (clobber (reg:CC FLAGS_REG))])
7519 (parallel [(set (match_dup 0)
7520 (div:DI (reg:DI 0) (match_dup 2)))
7522 (mod:DI (reg:DI 0) (match_dup 2)))
7524 (clobber (reg:CC FLAGS_REG))])]
7526 /* Avoid use of cltd in favor of a mov+shift. */
7527 if (!TARGET_USE_CLTD && !optimize_size)
7529 if (true_regnum (operands[1]))
7530 emit_move_insn (operands[0], operands[1]);
7532 emit_move_insn (operands[3], operands[1]);
7533 operands[4] = operands[3];
7537 if (true_regnum (operands[1]))
7539 operands[4] = operands[1];
7544 (define_expand "divmodsi4"
7545 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7546 (div:SI (match_operand:SI 1 "register_operand" "")
7547 (match_operand:SI 2 "nonimmediate_operand" "")))
7548 (set (match_operand:SI 3 "register_operand" "")
7549 (mod:SI (match_dup 1) (match_dup 2)))
7550 (clobber (reg:CC FLAGS_REG))])]
7554 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7555 ;; Penalize eax case slightly because it results in worse scheduling
7557 (define_insn "*divmodsi4_nocltd"
7558 [(set (match_operand:SI 0 "register_operand" "=&a,?a")
7559 (div:SI (match_operand:SI 2 "register_operand" "1,0")
7560 (match_operand:SI 3 "nonimmediate_operand" "rm,rm")))
7561 (set (match_operand:SI 1 "register_operand" "=&d,&d")
7562 (mod:SI (match_dup 2) (match_dup 3)))
7563 (clobber (reg:CC FLAGS_REG))]
7564 "!optimize_size && !TARGET_USE_CLTD"
7566 [(set_attr "type" "multi")])
7568 (define_insn "*divmodsi4_cltd"
7569 [(set (match_operand:SI 0 "register_operand" "=a")
7570 (div:SI (match_operand:SI 2 "register_operand" "a")
7571 (match_operand:SI 3 "nonimmediate_operand" "rm")))
7572 (set (match_operand:SI 1 "register_operand" "=&d")
7573 (mod:SI (match_dup 2) (match_dup 3)))
7574 (clobber (reg:CC FLAGS_REG))]
7575 "optimize_size || TARGET_USE_CLTD"
7577 [(set_attr "type" "multi")])
7579 (define_insn "*divmodsi_noext"
7580 [(set (match_operand:SI 0 "register_operand" "=a")
7581 (div:SI (match_operand:SI 1 "register_operand" "0")
7582 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7583 (set (match_operand:SI 3 "register_operand" "=d")
7584 (mod:SI (match_dup 1) (match_dup 2)))
7585 (use (match_operand:SI 4 "register_operand" "3"))
7586 (clobber (reg:CC FLAGS_REG))]
7589 [(set_attr "type" "idiv")
7590 (set_attr "mode" "SI")])
7593 [(set (match_operand:SI 0 "register_operand" "")
7594 (div:SI (match_operand:SI 1 "register_operand" "")
7595 (match_operand:SI 2 "nonimmediate_operand" "")))
7596 (set (match_operand:SI 3 "register_operand" "")
7597 (mod:SI (match_dup 1) (match_dup 2)))
7598 (clobber (reg:CC FLAGS_REG))]
7600 [(parallel [(set (match_dup 3)
7601 (ashiftrt:SI (match_dup 4) (const_int 31)))
7602 (clobber (reg:CC FLAGS_REG))])
7603 (parallel [(set (match_dup 0)
7604 (div:SI (reg:SI 0) (match_dup 2)))
7606 (mod:SI (reg:SI 0) (match_dup 2)))
7608 (clobber (reg:CC FLAGS_REG))])]
7610 /* Avoid use of cltd in favor of a mov+shift. */
7611 if (!TARGET_USE_CLTD && !optimize_size)
7613 if (true_regnum (operands[1]))
7614 emit_move_insn (operands[0], operands[1]);
7616 emit_move_insn (operands[3], operands[1]);
7617 operands[4] = operands[3];
7621 if (true_regnum (operands[1]))
7623 operands[4] = operands[1];
7627 (define_insn "divmodhi4"
7628 [(set (match_operand:HI 0 "register_operand" "=a")
7629 (div:HI (match_operand:HI 1 "register_operand" "0")
7630 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7631 (set (match_operand:HI 3 "register_operand" "=&d")
7632 (mod:HI (match_dup 1) (match_dup 2)))
7633 (clobber (reg:CC FLAGS_REG))]
7634 "TARGET_HIMODE_MATH"
7636 [(set_attr "type" "multi")
7637 (set_attr "length_immediate" "0")
7638 (set_attr "mode" "SI")])
7640 (define_insn "udivmoddi4"
7641 [(set (match_operand:DI 0 "register_operand" "=a")
7642 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7643 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7644 (set (match_operand:DI 3 "register_operand" "=&d")
7645 (umod:DI (match_dup 1) (match_dup 2)))
7646 (clobber (reg:CC FLAGS_REG))]
7648 "xor{q}\t%3, %3\;div{q}\t%2"
7649 [(set_attr "type" "multi")
7650 (set_attr "length_immediate" "0")
7651 (set_attr "mode" "DI")])
7653 (define_insn "*udivmoddi4_noext"
7654 [(set (match_operand:DI 0 "register_operand" "=a")
7655 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7656 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7657 (set (match_operand:DI 3 "register_operand" "=d")
7658 (umod:DI (match_dup 1) (match_dup 2)))
7660 (clobber (reg:CC FLAGS_REG))]
7663 [(set_attr "type" "idiv")
7664 (set_attr "mode" "DI")])
7667 [(set (match_operand:DI 0 "register_operand" "")
7668 (udiv:DI (match_operand:DI 1 "register_operand" "")
7669 (match_operand:DI 2 "nonimmediate_operand" "")))
7670 (set (match_operand:DI 3 "register_operand" "")
7671 (umod:DI (match_dup 1) (match_dup 2)))
7672 (clobber (reg:CC FLAGS_REG))]
7673 "TARGET_64BIT && reload_completed"
7674 [(set (match_dup 3) (const_int 0))
7675 (parallel [(set (match_dup 0)
7676 (udiv:DI (match_dup 1) (match_dup 2)))
7678 (umod:DI (match_dup 1) (match_dup 2)))
7680 (clobber (reg:CC FLAGS_REG))])]
7683 (define_insn "udivmodsi4"
7684 [(set (match_operand:SI 0 "register_operand" "=a")
7685 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7686 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7687 (set (match_operand:SI 3 "register_operand" "=&d")
7688 (umod:SI (match_dup 1) (match_dup 2)))
7689 (clobber (reg:CC FLAGS_REG))]
7691 "xor{l}\t%3, %3\;div{l}\t%2"
7692 [(set_attr "type" "multi")
7693 (set_attr "length_immediate" "0")
7694 (set_attr "mode" "SI")])
7696 (define_insn "*udivmodsi4_noext"
7697 [(set (match_operand:SI 0 "register_operand" "=a")
7698 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7699 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7700 (set (match_operand:SI 3 "register_operand" "=d")
7701 (umod:SI (match_dup 1) (match_dup 2)))
7703 (clobber (reg:CC FLAGS_REG))]
7706 [(set_attr "type" "idiv")
7707 (set_attr "mode" "SI")])
7710 [(set (match_operand:SI 0 "register_operand" "")
7711 (udiv:SI (match_operand:SI 1 "register_operand" "")
7712 (match_operand:SI 2 "nonimmediate_operand" "")))
7713 (set (match_operand:SI 3 "register_operand" "")
7714 (umod:SI (match_dup 1) (match_dup 2)))
7715 (clobber (reg:CC FLAGS_REG))]
7717 [(set (match_dup 3) (const_int 0))
7718 (parallel [(set (match_dup 0)
7719 (udiv:SI (match_dup 1) (match_dup 2)))
7721 (umod:SI (match_dup 1) (match_dup 2)))
7723 (clobber (reg:CC FLAGS_REG))])]
7726 (define_expand "udivmodhi4"
7727 [(set (match_dup 4) (const_int 0))
7728 (parallel [(set (match_operand:HI 0 "register_operand" "")
7729 (udiv:HI (match_operand:HI 1 "register_operand" "")
7730 (match_operand:HI 2 "nonimmediate_operand" "")))
7731 (set (match_operand:HI 3 "register_operand" "")
7732 (umod:HI (match_dup 1) (match_dup 2)))
7734 (clobber (reg:CC FLAGS_REG))])]
7735 "TARGET_HIMODE_MATH"
7736 "operands[4] = gen_reg_rtx (HImode);")
7738 (define_insn "*udivmodhi_noext"
7739 [(set (match_operand:HI 0 "register_operand" "=a")
7740 (udiv:HI (match_operand:HI 1 "register_operand" "0")
7741 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7742 (set (match_operand:HI 3 "register_operand" "=d")
7743 (umod:HI (match_dup 1) (match_dup 2)))
7744 (use (match_operand:HI 4 "register_operand" "3"))
7745 (clobber (reg:CC FLAGS_REG))]
7748 [(set_attr "type" "idiv")
7749 (set_attr "mode" "HI")])
7751 ;; We cannot use div/idiv for double division, because it causes
7752 ;; "division by zero" on the overflow and that's not what we expect
7753 ;; from truncate. Because true (non truncating) double division is
7754 ;; never generated, we can't create this insn anyway.
7757 ; [(set (match_operand:SI 0 "register_operand" "=a")
7759 ; (udiv:DI (match_operand:DI 1 "register_operand" "A")
7761 ; (match_operand:SI 2 "nonimmediate_operand" "rm")))))
7762 ; (set (match_operand:SI 3 "register_operand" "=d")
7764 ; (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
7765 ; (clobber (reg:CC FLAGS_REG))]
7767 ; "div{l}\t{%2, %0|%0, %2}"
7768 ; [(set_attr "type" "idiv")])
7770 ;;- Logical AND instructions
7772 ;; On Pentium, "test imm, reg" is pairable only with eax, ax, and al.
7773 ;; Note that this excludes ah.
7775 (define_insn "*testdi_1_rex64"
7776 [(set (reg FLAGS_REG)
7778 (and:DI (match_operand:DI 0 "nonimmediate_operand" "%!*a,r,!*a,r,rm")
7779 (match_operand:DI 1 "x86_64_szext_general_operand" "Z,Z,e,e,re"))
7781 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
7782 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7784 test{l}\t{%k1, %k0|%k0, %k1}
7785 test{l}\t{%k1, %k0|%k0, %k1}
7786 test{q}\t{%1, %0|%0, %1}
7787 test{q}\t{%1, %0|%0, %1}
7788 test{q}\t{%1, %0|%0, %1}"
7789 [(set_attr "type" "test")
7790 (set_attr "modrm" "0,1,0,1,1")
7791 (set_attr "mode" "SI,SI,DI,DI,DI")
7792 (set_attr "pent_pair" "uv,np,uv,np,uv")])
7794 (define_insn "testsi_1"
7795 [(set (reg FLAGS_REG)
7797 (and:SI (match_operand:SI 0 "nonimmediate_operand" "%!*a,r,rm")
7798 (match_operand:SI 1 "general_operand" "in,in,rin"))
7800 "ix86_match_ccmode (insn, CCNOmode)
7801 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7802 "test{l}\t{%1, %0|%0, %1}"
7803 [(set_attr "type" "test")
7804 (set_attr "modrm" "0,1,1")
7805 (set_attr "mode" "SI")
7806 (set_attr "pent_pair" "uv,np,uv")])
7808 (define_expand "testsi_ccno_1"
7809 [(set (reg:CCNO FLAGS_REG)
7811 (and:SI (match_operand:SI 0 "nonimmediate_operand" "")
7812 (match_operand:SI 1 "nonmemory_operand" ""))
7817 (define_insn "*testhi_1"
7818 [(set (reg FLAGS_REG)
7819 (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%!*a,r,rm")
7820 (match_operand:HI 1 "general_operand" "n,n,rn"))
7822 "ix86_match_ccmode (insn, CCNOmode)
7823 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7824 "test{w}\t{%1, %0|%0, %1}"
7825 [(set_attr "type" "test")
7826 (set_attr "modrm" "0,1,1")
7827 (set_attr "mode" "HI")
7828 (set_attr "pent_pair" "uv,np,uv")])
7830 (define_expand "testqi_ccz_1"
7831 [(set (reg:CCZ FLAGS_REG)
7832 (compare:CCZ (and:QI (match_operand:QI 0 "nonimmediate_operand" "")
7833 (match_operand:QI 1 "nonmemory_operand" ""))
7838 (define_insn "*testqi_1_maybe_si"
7839 [(set (reg FLAGS_REG)
7842 (match_operand:QI 0 "nonimmediate_operand" "%!*a,q,qm,r")
7843 (match_operand:QI 1 "general_operand" "n,n,qn,n"))
7845 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
7846 && ix86_match_ccmode (insn,
7847 GET_CODE (operands[1]) == CONST_INT
7848 && INTVAL (operands[1]) >= 0 ? CCNOmode : CCZmode)"
7850 if (which_alternative == 3)
7852 if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) < 0)
7853 operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
7854 return "test{l}\t{%1, %k0|%k0, %1}";
7856 return "test{b}\t{%1, %0|%0, %1}";
7858 [(set_attr "type" "test")
7859 (set_attr "modrm" "0,1,1,1")
7860 (set_attr "mode" "QI,QI,QI,SI")
7861 (set_attr "pent_pair" "uv,np,uv,np")])
7863 (define_insn "*testqi_1"
7864 [(set (reg FLAGS_REG)
7867 (match_operand:QI 0 "nonimmediate_operand" "%!*a,q,qm")
7868 (match_operand:QI 1 "general_operand" "n,n,qn"))
7870 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
7871 && ix86_match_ccmode (insn, CCNOmode)"
7872 "test{b}\t{%1, %0|%0, %1}"
7873 [(set_attr "type" "test")
7874 (set_attr "modrm" "0,1,1")
7875 (set_attr "mode" "QI")
7876 (set_attr "pent_pair" "uv,np,uv")])
7878 (define_expand "testqi_ext_ccno_0"
7879 [(set (reg:CCNO FLAGS_REG)
7883 (match_operand 0 "ext_register_operand" "")
7886 (match_operand 1 "const_int_operand" ""))
7891 (define_insn "*testqi_ext_0"
7892 [(set (reg FLAGS_REG)
7896 (match_operand 0 "ext_register_operand" "Q")
7899 (match_operand 1 "const_int_operand" "n"))
7901 "ix86_match_ccmode (insn, CCNOmode)"
7902 "test{b}\t{%1, %h0|%h0, %1}"
7903 [(set_attr "type" "test")
7904 (set_attr "mode" "QI")
7905 (set_attr "length_immediate" "1")
7906 (set_attr "pent_pair" "np")])
7908 (define_insn "*testqi_ext_1"
7909 [(set (reg FLAGS_REG)
7913 (match_operand 0 "ext_register_operand" "Q")
7917 (match_operand:QI 1 "general_operand" "Qm")))
7919 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
7920 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7921 "test{b}\t{%1, %h0|%h0, %1}"
7922 [(set_attr "type" "test")
7923 (set_attr "mode" "QI")])
7925 (define_insn "*testqi_ext_1_rex64"
7926 [(set (reg FLAGS_REG)
7930 (match_operand 0 "ext_register_operand" "Q")
7934 (match_operand:QI 1 "register_operand" "Q")))
7936 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
7937 "test{b}\t{%1, %h0|%h0, %1}"
7938 [(set_attr "type" "test")
7939 (set_attr "mode" "QI")])
7941 (define_insn "*testqi_ext_2"
7942 [(set (reg FLAGS_REG)
7946 (match_operand 0 "ext_register_operand" "Q")
7950 (match_operand 1 "ext_register_operand" "Q")
7954 "ix86_match_ccmode (insn, CCNOmode)"
7955 "test{b}\t{%h1, %h0|%h0, %h1}"
7956 [(set_attr "type" "test")
7957 (set_attr "mode" "QI")])
7959 ;; Combine likes to form bit extractions for some tests. Humor it.
7960 (define_insn "*testqi_ext_3"
7961 [(set (reg FLAGS_REG)
7962 (compare (zero_extract:SI
7963 (match_operand 0 "nonimmediate_operand" "rm")
7964 (match_operand:SI 1 "const_int_operand" "")
7965 (match_operand:SI 2 "const_int_operand" ""))
7967 "ix86_match_ccmode (insn, CCNOmode)
7968 && (GET_MODE (operands[0]) == SImode
7969 || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)
7970 || GET_MODE (operands[0]) == HImode
7971 || GET_MODE (operands[0]) == QImode)"
7974 (define_insn "*testqi_ext_3_rex64"
7975 [(set (reg FLAGS_REG)
7976 (compare (zero_extract:DI
7977 (match_operand 0 "nonimmediate_operand" "rm")
7978 (match_operand:DI 1 "const_int_operand" "")
7979 (match_operand:DI 2 "const_int_operand" ""))
7982 && ix86_match_ccmode (insn, CCNOmode)
7983 /* The code below cannot deal with constants outside HOST_WIDE_INT. */
7984 && INTVAL (operands[1]) + INTVAL (operands[2]) < HOST_BITS_PER_WIDE_INT
7985 /* Ensure that resulting mask is zero or sign extended operand. */
7986 && (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
7987 || (INTVAL (operands[1]) + INTVAL (operands[2]) == 64
7988 && INTVAL (operands[1]) > 32))
7989 && (GET_MODE (operands[0]) == SImode
7990 || GET_MODE (operands[0]) == DImode
7991 || GET_MODE (operands[0]) == HImode
7992 || GET_MODE (operands[0]) == QImode)"
7996 [(set (match_operand 0 "flags_reg_operand" "")
7997 (match_operator 1 "compare_operator"
7999 (match_operand 2 "nonimmediate_operand" "")
8000 (match_operand 3 "const_int_operand" "")
8001 (match_operand 4 "const_int_operand" ""))
8003 "ix86_match_ccmode (insn, CCNOmode)"
8004 [(set (match_dup 0) (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
8006 rtx val = operands[2];
8007 HOST_WIDE_INT len = INTVAL (operands[3]);
8008 HOST_WIDE_INT pos = INTVAL (operands[4]);
8010 enum machine_mode mode, submode;
8012 mode = GET_MODE (val);
8013 if (GET_CODE (val) == MEM)
8015 /* ??? Combine likes to put non-volatile mem extractions in QImode
8016 no matter the size of the test. So find a mode that works. */
8017 if (! MEM_VOLATILE_P (val))
8019 mode = smallest_mode_for_size (pos + len, MODE_INT);
8020 val = adjust_address (val, mode, 0);
8023 else if (GET_CODE (val) == SUBREG
8024 && (submode = GET_MODE (SUBREG_REG (val)),
8025 GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode))
8026 && pos + len <= GET_MODE_BITSIZE (submode))
8028 /* Narrow a paradoxical subreg to prevent partial register stalls. */
8030 val = SUBREG_REG (val);
8032 else if (mode == HImode && pos + len <= 8)
8034 /* Small HImode tests can be converted to QImode. */
8036 val = gen_lowpart (QImode, val);
8039 mask = ((HOST_WIDE_INT)1 << (pos + len)) - 1;
8040 mask &= ~(((HOST_WIDE_INT)1 << pos) - 1);
8042 operands[2] = gen_rtx_AND (mode, val, gen_int_mode (mask, mode));
8045 ;; Convert HImode/SImode test instructions with immediate to QImode ones.
8046 ;; i386 does not allow to encode test with 8bit sign extended immediate, so
8047 ;; this is relatively important trick.
8048 ;; Do the conversion only post-reload to avoid limiting of the register class
8051 [(set (match_operand 0 "flags_reg_operand" "")
8052 (match_operator 1 "compare_operator"
8053 [(and (match_operand 2 "register_operand" "")
8054 (match_operand 3 "const_int_operand" ""))
8057 && QI_REG_P (operands[2])
8058 && GET_MODE (operands[2]) != QImode
8059 && ((ix86_match_ccmode (insn, CCZmode)
8060 && !(INTVAL (operands[3]) & ~(255 << 8)))
8061 || (ix86_match_ccmode (insn, CCNOmode)
8062 && !(INTVAL (operands[3]) & ~(127 << 8))))"
8065 [(and:SI (zero_extract:SI (match_dup 2) (const_int 8) (const_int 8))
8068 "operands[2] = gen_lowpart (SImode, operands[2]);
8069 operands[3] = gen_int_mode (INTVAL (operands[3]) >> 8, SImode);")
8072 [(set (match_operand 0 "flags_reg_operand" "")
8073 (match_operator 1 "compare_operator"
8074 [(and (match_operand 2 "nonimmediate_operand" "")
8075 (match_operand 3 "const_int_operand" ""))
8078 && GET_MODE (operands[2]) != QImode
8079 && (!REG_P (operands[2]) || ANY_QI_REG_P (operands[2]))
8080 && ((ix86_match_ccmode (insn, CCZmode)
8081 && !(INTVAL (operands[3]) & ~255))
8082 || (ix86_match_ccmode (insn, CCNOmode)
8083 && !(INTVAL (operands[3]) & ~127)))"
8085 (match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3))
8087 "operands[2] = gen_lowpart (QImode, operands[2]);
8088 operands[3] = gen_lowpart (QImode, operands[3]);")
8091 ;; %%% This used to optimize known byte-wide and operations to memory,
8092 ;; and sometimes to QImode registers. If this is considered useful,
8093 ;; it should be done with splitters.
8095 (define_expand "anddi3"
8096 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8097 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
8098 (match_operand:DI 2 "x86_64_szext_general_operand" "")))
8099 (clobber (reg:CC FLAGS_REG))]
8101 "ix86_expand_binary_operator (AND, DImode, operands); DONE;")
8103 (define_insn "*anddi_1_rex64"
8104 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r,r")
8105 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,qm")
8106 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,re,rm,L")))
8107 (clobber (reg:CC FLAGS_REG))]
8108 "TARGET_64BIT && ix86_binary_operator_ok (AND, DImode, operands)"
8110 switch (get_attr_type (insn))
8114 enum machine_mode mode;
8116 if (GET_CODE (operands[2]) != CONST_INT)
8118 if (INTVAL (operands[2]) == 0xff)
8120 else if (INTVAL (operands[2]) == 0xffff)
8125 operands[1] = gen_lowpart (mode, operands[1]);
8127 return "movz{bq|x}\t{%1,%0|%0, %1}";
8129 return "movz{wq|x}\t{%1,%0|%0, %1}";
8133 if (! rtx_equal_p (operands[0], operands[1]))
8135 if (get_attr_mode (insn) == MODE_SI)
8136 return "and{l}\t{%k2, %k0|%k0, %k2}";
8138 return "and{q}\t{%2, %0|%0, %2}";
8141 [(set_attr "type" "alu,alu,alu,imovx")
8142 (set_attr "length_immediate" "*,*,*,0")
8143 (set_attr "mode" "SI,DI,DI,DI")])
8145 (define_insn "*anddi_2"
8146 [(set (reg FLAGS_REG)
8147 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
8148 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,rem,re"))
8150 (set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm")
8151 (and:DI (match_dup 1) (match_dup 2)))]
8152 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8153 && ix86_binary_operator_ok (AND, DImode, operands)"
8155 and{l}\t{%k2, %k0|%k0, %k2}
8156 and{q}\t{%2, %0|%0, %2}
8157 and{q}\t{%2, %0|%0, %2}"
8158 [(set_attr "type" "alu")
8159 (set_attr "mode" "SI,DI,DI")])
8161 (define_expand "andsi3"
8162 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8163 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
8164 (match_operand:SI 2 "general_operand" "")))
8165 (clobber (reg:CC FLAGS_REG))]
8167 "ix86_expand_binary_operator (AND, SImode, operands); DONE;")
8169 (define_insn "*andsi_1"
8170 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r,r")
8171 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,qm")
8172 (match_operand:SI 2 "general_operand" "ri,rm,L")))
8173 (clobber (reg:CC FLAGS_REG))]
8174 "ix86_binary_operator_ok (AND, SImode, operands)"
8176 switch (get_attr_type (insn))
8180 enum machine_mode mode;
8182 if (GET_CODE (operands[2]) != CONST_INT)
8184 if (INTVAL (operands[2]) == 0xff)
8186 else if (INTVAL (operands[2]) == 0xffff)
8191 operands[1] = gen_lowpart (mode, operands[1]);
8193 return "movz{bl|x}\t{%1,%0|%0, %1}";
8195 return "movz{wl|x}\t{%1,%0|%0, %1}";
8199 if (! rtx_equal_p (operands[0], operands[1]))
8201 return "and{l}\t{%2, %0|%0, %2}";
8204 [(set_attr "type" "alu,alu,imovx")
8205 (set_attr "length_immediate" "*,*,0")
8206 (set_attr "mode" "SI")])
8209 [(set (match_operand 0 "register_operand" "")
8211 (const_int -65536)))
8212 (clobber (reg:CC FLAGS_REG))]
8213 "optimize_size || (TARGET_FAST_PREFIX && !TARGET_PARTIAL_REG_STALL)"
8214 [(set (strict_low_part (match_dup 1)) (const_int 0))]
8215 "operands[1] = gen_lowpart (HImode, operands[0]);")
8218 [(set (match_operand 0 "ext_register_operand" "")
8221 (clobber (reg:CC FLAGS_REG))]
8222 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
8223 [(set (strict_low_part (match_dup 1)) (const_int 0))]
8224 "operands[1] = gen_lowpart (QImode, operands[0]);")
8227 [(set (match_operand 0 "ext_register_operand" "")
8229 (const_int -65281)))
8230 (clobber (reg:CC FLAGS_REG))]
8231 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
8232 [(parallel [(set (zero_extract:SI (match_dup 0)
8236 (zero_extract:SI (match_dup 0)
8239 (zero_extract:SI (match_dup 0)
8242 (clobber (reg:CC FLAGS_REG))])]
8243 "operands[0] = gen_lowpart (SImode, operands[0]);")
8245 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8246 (define_insn "*andsi_1_zext"
8247 [(set (match_operand:DI 0 "register_operand" "=r")
8249 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8250 (match_operand:SI 2 "general_operand" "rim"))))
8251 (clobber (reg:CC FLAGS_REG))]
8252 "TARGET_64BIT && ix86_binary_operator_ok (AND, SImode, operands)"
8253 "and{l}\t{%2, %k0|%k0, %2}"
8254 [(set_attr "type" "alu")
8255 (set_attr "mode" "SI")])
8257 (define_insn "*andsi_2"
8258 [(set (reg FLAGS_REG)
8259 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8260 (match_operand:SI 2 "general_operand" "rim,ri"))
8262 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8263 (and:SI (match_dup 1) (match_dup 2)))]
8264 "ix86_match_ccmode (insn, CCNOmode)
8265 && ix86_binary_operator_ok (AND, SImode, operands)"
8266 "and{l}\t{%2, %0|%0, %2}"
8267 [(set_attr "type" "alu")
8268 (set_attr "mode" "SI")])
8270 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8271 (define_insn "*andsi_2_zext"
8272 [(set (reg FLAGS_REG)
8273 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8274 (match_operand:SI 2 "general_operand" "rim"))
8276 (set (match_operand:DI 0 "register_operand" "=r")
8277 (zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))]
8278 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8279 && ix86_binary_operator_ok (AND, SImode, operands)"
8280 "and{l}\t{%2, %k0|%k0, %2}"
8281 [(set_attr "type" "alu")
8282 (set_attr "mode" "SI")])
8284 (define_expand "andhi3"
8285 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8286 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
8287 (match_operand:HI 2 "general_operand" "")))
8288 (clobber (reg:CC FLAGS_REG))]
8289 "TARGET_HIMODE_MATH"
8290 "ix86_expand_binary_operator (AND, HImode, operands); DONE;")
8292 (define_insn "*andhi_1"
8293 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
8294 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm")
8295 (match_operand:HI 2 "general_operand" "ri,rm,L")))
8296 (clobber (reg:CC FLAGS_REG))]
8297 "ix86_binary_operator_ok (AND, HImode, operands)"
8299 switch (get_attr_type (insn))
8302 if (GET_CODE (operands[2]) != CONST_INT)
8304 if (INTVAL (operands[2]) == 0xff)
8305 return "movz{bl|x}\t{%b1, %k0|%k0, %b1}";
8309 if (! rtx_equal_p (operands[0], operands[1]))
8312 return "and{w}\t{%2, %0|%0, %2}";
8315 [(set_attr "type" "alu,alu,imovx")
8316 (set_attr "length_immediate" "*,*,0")
8317 (set_attr "mode" "HI,HI,SI")])
8319 (define_insn "*andhi_2"
8320 [(set (reg FLAGS_REG)
8321 (compare (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8322 (match_operand:HI 2 "general_operand" "rim,ri"))
8324 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8325 (and:HI (match_dup 1) (match_dup 2)))]
8326 "ix86_match_ccmode (insn, CCNOmode)
8327 && ix86_binary_operator_ok (AND, HImode, operands)"
8328 "and{w}\t{%2, %0|%0, %2}"
8329 [(set_attr "type" "alu")
8330 (set_attr "mode" "HI")])
8332 (define_expand "andqi3"
8333 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8334 (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
8335 (match_operand:QI 2 "general_operand" "")))
8336 (clobber (reg:CC FLAGS_REG))]
8337 "TARGET_QIMODE_MATH"
8338 "ix86_expand_binary_operator (AND, QImode, operands); DONE;")
8340 ;; %%% Potential partial reg stall on alternative 2. What to do?
8341 (define_insn "*andqi_1"
8342 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
8343 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8344 (match_operand:QI 2 "general_operand" "qi,qmi,ri")))
8345 (clobber (reg:CC FLAGS_REG))]
8346 "ix86_binary_operator_ok (AND, QImode, operands)"
8348 and{b}\t{%2, %0|%0, %2}
8349 and{b}\t{%2, %0|%0, %2}
8350 and{l}\t{%k2, %k0|%k0, %k2}"
8351 [(set_attr "type" "alu")
8352 (set_attr "mode" "QI,QI,SI")])
8354 (define_insn "*andqi_1_slp"
8355 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
8356 (and:QI (match_dup 0)
8357 (match_operand:QI 1 "general_operand" "qi,qmi")))
8358 (clobber (reg:CC FLAGS_REG))]
8359 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8360 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8361 "and{b}\t{%1, %0|%0, %1}"
8362 [(set_attr "type" "alu1")
8363 (set_attr "mode" "QI")])
8365 (define_insn "*andqi_2_maybe_si"
8366 [(set (reg FLAGS_REG)
8368 (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8369 (match_operand:QI 2 "general_operand" "qim,qi,i"))
8371 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm,*r")
8372 (and:QI (match_dup 1) (match_dup 2)))]
8373 "ix86_binary_operator_ok (AND, QImode, operands)
8374 && ix86_match_ccmode (insn,
8375 GET_CODE (operands[2]) == CONST_INT
8376 && INTVAL (operands[2]) >= 0 ? CCNOmode : CCZmode)"
8378 if (which_alternative == 2)
8380 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
8381 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff);
8382 return "and{l}\t{%2, %k0|%k0, %2}";
8384 return "and{b}\t{%2, %0|%0, %2}";
8386 [(set_attr "type" "alu")
8387 (set_attr "mode" "QI,QI,SI")])
8389 (define_insn "*andqi_2"
8390 [(set (reg FLAGS_REG)
8392 (match_operand:QI 1 "nonimmediate_operand" "%0,0")
8393 (match_operand:QI 2 "general_operand" "qim,qi"))
8395 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
8396 (and:QI (match_dup 1) (match_dup 2)))]
8397 "ix86_match_ccmode (insn, CCNOmode)
8398 && ix86_binary_operator_ok (AND, QImode, operands)"
8399 "and{b}\t{%2, %0|%0, %2}"
8400 [(set_attr "type" "alu")
8401 (set_attr "mode" "QI")])
8403 (define_insn "*andqi_2_slp"
8404 [(set (reg FLAGS_REG)
8406 (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8407 (match_operand:QI 1 "nonimmediate_operand" "qmi,qi"))
8409 (set (strict_low_part (match_dup 0))
8410 (and:QI (match_dup 0) (match_dup 1)))]
8411 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8412 && ix86_match_ccmode (insn, CCNOmode)
8413 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8414 "and{b}\t{%1, %0|%0, %1}"
8415 [(set_attr "type" "alu1")
8416 (set_attr "mode" "QI")])
8418 ;; ??? A bug in recog prevents it from recognizing a const_int as an
8419 ;; operand to zero_extend in andqi_ext_1. It was checking explicitly
8420 ;; for a QImode operand, which of course failed.
8422 (define_insn "andqi_ext_0"
8423 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8428 (match_operand 1 "ext_register_operand" "0")
8431 (match_operand 2 "const_int_operand" "n")))
8432 (clobber (reg:CC FLAGS_REG))]
8434 "and{b}\t{%2, %h0|%h0, %2}"
8435 [(set_attr "type" "alu")
8436 (set_attr "length_immediate" "1")
8437 (set_attr "mode" "QI")])
8439 ;; Generated by peephole translating test to and. This shows up
8440 ;; often in fp comparisons.
8442 (define_insn "*andqi_ext_0_cc"
8443 [(set (reg FLAGS_REG)
8447 (match_operand 1 "ext_register_operand" "0")
8450 (match_operand 2 "const_int_operand" "n"))
8452 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8461 "ix86_match_ccmode (insn, CCNOmode)"
8462 "and{b}\t{%2, %h0|%h0, %2}"
8463 [(set_attr "type" "alu")
8464 (set_attr "length_immediate" "1")
8465 (set_attr "mode" "QI")])
8467 (define_insn "*andqi_ext_1"
8468 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8473 (match_operand 1 "ext_register_operand" "0")
8477 (match_operand:QI 2 "general_operand" "Qm"))))
8478 (clobber (reg:CC FLAGS_REG))]
8480 "and{b}\t{%2, %h0|%h0, %2}"
8481 [(set_attr "type" "alu")
8482 (set_attr "length_immediate" "0")
8483 (set_attr "mode" "QI")])
8485 (define_insn "*andqi_ext_1_rex64"
8486 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8491 (match_operand 1 "ext_register_operand" "0")
8495 (match_operand 2 "ext_register_operand" "Q"))))
8496 (clobber (reg:CC FLAGS_REG))]
8498 "and{b}\t{%2, %h0|%h0, %2}"
8499 [(set_attr "type" "alu")
8500 (set_attr "length_immediate" "0")
8501 (set_attr "mode" "QI")])
8503 (define_insn "*andqi_ext_2"
8504 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8509 (match_operand 1 "ext_register_operand" "%0")
8513 (match_operand 2 "ext_register_operand" "Q")
8516 (clobber (reg:CC FLAGS_REG))]
8518 "and{b}\t{%h2, %h0|%h0, %h2}"
8519 [(set_attr "type" "alu")
8520 (set_attr "length_immediate" "0")
8521 (set_attr "mode" "QI")])
8523 ;; Convert wide AND instructions with immediate operand to shorter QImode
8524 ;; equivalents when possible.
8525 ;; Don't do the splitting with memory operands, since it introduces risk
8526 ;; of memory mismatch stalls. We may want to do the splitting for optimizing
8527 ;; for size, but that can (should?) be handled by generic code instead.
8529 [(set (match_operand 0 "register_operand" "")
8530 (and (match_operand 1 "register_operand" "")
8531 (match_operand 2 "const_int_operand" "")))
8532 (clobber (reg:CC FLAGS_REG))]
8534 && QI_REG_P (operands[0])
8535 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8536 && !(~INTVAL (operands[2]) & ~(255 << 8))
8537 && GET_MODE (operands[0]) != QImode"
8538 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8539 (and:SI (zero_extract:SI (match_dup 1)
8540 (const_int 8) (const_int 8))
8542 (clobber (reg:CC FLAGS_REG))])]
8543 "operands[0] = gen_lowpart (SImode, operands[0]);
8544 operands[1] = gen_lowpart (SImode, operands[1]);
8545 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8547 ;; Since AND can be encoded with sign extended immediate, this is only
8548 ;; profitable when 7th bit is not set.
8550 [(set (match_operand 0 "register_operand" "")
8551 (and (match_operand 1 "general_operand" "")
8552 (match_operand 2 "const_int_operand" "")))
8553 (clobber (reg:CC FLAGS_REG))]
8555 && ANY_QI_REG_P (operands[0])
8556 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8557 && !(~INTVAL (operands[2]) & ~255)
8558 && !(INTVAL (operands[2]) & 128)
8559 && GET_MODE (operands[0]) != QImode"
8560 [(parallel [(set (strict_low_part (match_dup 0))
8561 (and:QI (match_dup 1)
8563 (clobber (reg:CC FLAGS_REG))])]
8564 "operands[0] = gen_lowpart (QImode, operands[0]);
8565 operands[1] = gen_lowpart (QImode, operands[1]);
8566 operands[2] = gen_lowpart (QImode, operands[2]);")
8568 ;; Logical inclusive OR instructions
8570 ;; %%% This used to optimize known byte-wide and operations to memory.
8571 ;; If this is considered useful, it should be done with splitters.
8573 (define_expand "iordi3"
8574 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8575 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "")
8576 (match_operand:DI 2 "x86_64_general_operand" "")))
8577 (clobber (reg:CC FLAGS_REG))]
8579 "ix86_expand_binary_operator (IOR, DImode, operands); DONE;")
8581 (define_insn "*iordi_1_rex64"
8582 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8583 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8584 (match_operand:DI 2 "x86_64_general_operand" "re,rme")))
8585 (clobber (reg:CC FLAGS_REG))]
8587 && ix86_binary_operator_ok (IOR, DImode, operands)"
8588 "or{q}\t{%2, %0|%0, %2}"
8589 [(set_attr "type" "alu")
8590 (set_attr "mode" "DI")])
8592 (define_insn "*iordi_2_rex64"
8593 [(set (reg FLAGS_REG)
8594 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8595 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
8597 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
8598 (ior:DI (match_dup 1) (match_dup 2)))]
8600 && ix86_match_ccmode (insn, CCNOmode)
8601 && ix86_binary_operator_ok (IOR, DImode, operands)"
8602 "or{q}\t{%2, %0|%0, %2}"
8603 [(set_attr "type" "alu")
8604 (set_attr "mode" "DI")])
8606 (define_insn "*iordi_3_rex64"
8607 [(set (reg FLAGS_REG)
8608 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
8609 (match_operand:DI 2 "x86_64_general_operand" "rem"))
8611 (clobber (match_scratch:DI 0 "=r"))]
8613 && ix86_match_ccmode (insn, CCNOmode)
8614 && ix86_binary_operator_ok (IOR, DImode, operands)"
8615 "or{q}\t{%2, %0|%0, %2}"
8616 [(set_attr "type" "alu")
8617 (set_attr "mode" "DI")])
8620 (define_expand "iorsi3"
8621 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8622 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
8623 (match_operand:SI 2 "general_operand" "")))
8624 (clobber (reg:CC FLAGS_REG))]
8626 "ix86_expand_binary_operator (IOR, SImode, operands); DONE;")
8628 (define_insn "*iorsi_1"
8629 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
8630 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8631 (match_operand:SI 2 "general_operand" "ri,rmi")))
8632 (clobber (reg:CC FLAGS_REG))]
8633 "ix86_binary_operator_ok (IOR, SImode, operands)"
8634 "or{l}\t{%2, %0|%0, %2}"
8635 [(set_attr "type" "alu")
8636 (set_attr "mode" "SI")])
8638 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8639 (define_insn "*iorsi_1_zext"
8640 [(set (match_operand:DI 0 "register_operand" "=rm")
8642 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8643 (match_operand:SI 2 "general_operand" "rim"))))
8644 (clobber (reg:CC FLAGS_REG))]
8645 "TARGET_64BIT && ix86_binary_operator_ok (IOR, SImode, operands)"
8646 "or{l}\t{%2, %k0|%k0, %2}"
8647 [(set_attr "type" "alu")
8648 (set_attr "mode" "SI")])
8650 (define_insn "*iorsi_1_zext_imm"
8651 [(set (match_operand:DI 0 "register_operand" "=rm")
8652 (ior:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
8653 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
8654 (clobber (reg:CC FLAGS_REG))]
8656 "or{l}\t{%2, %k0|%k0, %2}"
8657 [(set_attr "type" "alu")
8658 (set_attr "mode" "SI")])
8660 (define_insn "*iorsi_2"
8661 [(set (reg FLAGS_REG)
8662 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8663 (match_operand:SI 2 "general_operand" "rim,ri"))
8665 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8666 (ior:SI (match_dup 1) (match_dup 2)))]
8667 "ix86_match_ccmode (insn, CCNOmode)
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 ;; ??? Special case for immediate operand is missing - it is tricky.
8675 (define_insn "*iorsi_2_zext"
8676 [(set (reg FLAGS_REG)
8677 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8678 (match_operand:SI 2 "general_operand" "rim"))
8680 (set (match_operand:DI 0 "register_operand" "=r")
8681 (zero_extend:DI (ior:SI (match_dup 1) (match_dup 2))))]
8682 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8683 && ix86_binary_operator_ok (IOR, SImode, operands)"
8684 "or{l}\t{%2, %k0|%k0, %2}"
8685 [(set_attr "type" "alu")
8686 (set_attr "mode" "SI")])
8688 (define_insn "*iorsi_2_zext_imm"
8689 [(set (reg FLAGS_REG)
8690 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8691 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
8693 (set (match_operand:DI 0 "register_operand" "=r")
8694 (ior:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
8695 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8696 && ix86_binary_operator_ok (IOR, SImode, operands)"
8697 "or{l}\t{%2, %k0|%k0, %2}"
8698 [(set_attr "type" "alu")
8699 (set_attr "mode" "SI")])
8701 (define_insn "*iorsi_3"
8702 [(set (reg FLAGS_REG)
8703 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8704 (match_operand:SI 2 "general_operand" "rim"))
8706 (clobber (match_scratch:SI 0 "=r"))]
8707 "ix86_match_ccmode (insn, CCNOmode)
8708 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8709 "or{l}\t{%2, %0|%0, %2}"
8710 [(set_attr "type" "alu")
8711 (set_attr "mode" "SI")])
8713 (define_expand "iorhi3"
8714 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8715 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
8716 (match_operand:HI 2 "general_operand" "")))
8717 (clobber (reg:CC FLAGS_REG))]
8718 "TARGET_HIMODE_MATH"
8719 "ix86_expand_binary_operator (IOR, HImode, operands); DONE;")
8721 (define_insn "*iorhi_1"
8722 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
8723 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8724 (match_operand:HI 2 "general_operand" "rmi,ri")))
8725 (clobber (reg:CC FLAGS_REG))]
8726 "ix86_binary_operator_ok (IOR, HImode, operands)"
8727 "or{w}\t{%2, %0|%0, %2}"
8728 [(set_attr "type" "alu")
8729 (set_attr "mode" "HI")])
8731 (define_insn "*iorhi_2"
8732 [(set (reg FLAGS_REG)
8733 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8734 (match_operand:HI 2 "general_operand" "rim,ri"))
8736 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8737 (ior:HI (match_dup 1) (match_dup 2)))]
8738 "ix86_match_ccmode (insn, CCNOmode)
8739 && ix86_binary_operator_ok (IOR, HImode, operands)"
8740 "or{w}\t{%2, %0|%0, %2}"
8741 [(set_attr "type" "alu")
8742 (set_attr "mode" "HI")])
8744 (define_insn "*iorhi_3"
8745 [(set (reg FLAGS_REG)
8746 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
8747 (match_operand:HI 2 "general_operand" "rim"))
8749 (clobber (match_scratch:HI 0 "=r"))]
8750 "ix86_match_ccmode (insn, CCNOmode)
8751 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8752 "or{w}\t{%2, %0|%0, %2}"
8753 [(set_attr "type" "alu")
8754 (set_attr "mode" "HI")])
8756 (define_expand "iorqi3"
8757 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8758 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
8759 (match_operand:QI 2 "general_operand" "")))
8760 (clobber (reg:CC FLAGS_REG))]
8761 "TARGET_QIMODE_MATH"
8762 "ix86_expand_binary_operator (IOR, QImode, operands); DONE;")
8764 ;; %%% Potential partial reg stall on alternative 2. What to do?
8765 (define_insn "*iorqi_1"
8766 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
8767 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8768 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
8769 (clobber (reg:CC FLAGS_REG))]
8770 "ix86_binary_operator_ok (IOR, QImode, operands)"
8772 or{b}\t{%2, %0|%0, %2}
8773 or{b}\t{%2, %0|%0, %2}
8774 or{l}\t{%k2, %k0|%k0, %k2}"
8775 [(set_attr "type" "alu")
8776 (set_attr "mode" "QI,QI,SI")])
8778 (define_insn "*iorqi_1_slp"
8779 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m"))
8780 (ior:QI (match_dup 0)
8781 (match_operand:QI 1 "general_operand" "qmi,qi")))
8782 (clobber (reg:CC FLAGS_REG))]
8783 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8784 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8785 "or{b}\t{%1, %0|%0, %1}"
8786 [(set_attr "type" "alu1")
8787 (set_attr "mode" "QI")])
8789 (define_insn "*iorqi_2"
8790 [(set (reg FLAGS_REG)
8791 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
8792 (match_operand:QI 2 "general_operand" "qim,qi"))
8794 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
8795 (ior:QI (match_dup 1) (match_dup 2)))]
8796 "ix86_match_ccmode (insn, CCNOmode)
8797 && ix86_binary_operator_ok (IOR, QImode, operands)"
8798 "or{b}\t{%2, %0|%0, %2}"
8799 [(set_attr "type" "alu")
8800 (set_attr "mode" "QI")])
8802 (define_insn "*iorqi_2_slp"
8803 [(set (reg FLAGS_REG)
8804 (compare (ior:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8805 (match_operand:QI 1 "general_operand" "qim,qi"))
8807 (set (strict_low_part (match_dup 0))
8808 (ior:QI (match_dup 0) (match_dup 1)))]
8809 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8810 && ix86_match_ccmode (insn, CCNOmode)
8811 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8812 "or{b}\t{%1, %0|%0, %1}"
8813 [(set_attr "type" "alu1")
8814 (set_attr "mode" "QI")])
8816 (define_insn "*iorqi_3"
8817 [(set (reg FLAGS_REG)
8818 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
8819 (match_operand:QI 2 "general_operand" "qim"))
8821 (clobber (match_scratch:QI 0 "=q"))]
8822 "ix86_match_ccmode (insn, CCNOmode)
8823 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8824 "or{b}\t{%2, %0|%0, %2}"
8825 [(set_attr "type" "alu")
8826 (set_attr "mode" "QI")])
8828 (define_insn "iorqi_ext_0"
8829 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8834 (match_operand 1 "ext_register_operand" "0")
8837 (match_operand 2 "const_int_operand" "n")))
8838 (clobber (reg:CC FLAGS_REG))]
8839 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8840 "or{b}\t{%2, %h0|%h0, %2}"
8841 [(set_attr "type" "alu")
8842 (set_attr "length_immediate" "1")
8843 (set_attr "mode" "QI")])
8845 (define_insn "*iorqi_ext_1"
8846 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8851 (match_operand 1 "ext_register_operand" "0")
8855 (match_operand:QI 2 "general_operand" "Qm"))))
8856 (clobber (reg:CC FLAGS_REG))]
8858 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8859 "or{b}\t{%2, %h0|%h0, %2}"
8860 [(set_attr "type" "alu")
8861 (set_attr "length_immediate" "0")
8862 (set_attr "mode" "QI")])
8864 (define_insn "*iorqi_ext_1_rex64"
8865 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8870 (match_operand 1 "ext_register_operand" "0")
8874 (match_operand 2 "ext_register_operand" "Q"))))
8875 (clobber (reg:CC FLAGS_REG))]
8877 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8878 "or{b}\t{%2, %h0|%h0, %2}"
8879 [(set_attr "type" "alu")
8880 (set_attr "length_immediate" "0")
8881 (set_attr "mode" "QI")])
8883 (define_insn "*iorqi_ext_2"
8884 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8888 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
8891 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
8894 (clobber (reg:CC FLAGS_REG))]
8895 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8896 "ior{b}\t{%h2, %h0|%h0, %h2}"
8897 [(set_attr "type" "alu")
8898 (set_attr "length_immediate" "0")
8899 (set_attr "mode" "QI")])
8902 [(set (match_operand 0 "register_operand" "")
8903 (ior (match_operand 1 "register_operand" "")
8904 (match_operand 2 "const_int_operand" "")))
8905 (clobber (reg:CC FLAGS_REG))]
8907 && QI_REG_P (operands[0])
8908 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8909 && !(INTVAL (operands[2]) & ~(255 << 8))
8910 && GET_MODE (operands[0]) != QImode"
8911 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8912 (ior:SI (zero_extract:SI (match_dup 1)
8913 (const_int 8) (const_int 8))
8915 (clobber (reg:CC FLAGS_REG))])]
8916 "operands[0] = gen_lowpart (SImode, operands[0]);
8917 operands[1] = gen_lowpart (SImode, operands[1]);
8918 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8920 ;; Since OR can be encoded with sign extended immediate, this is only
8921 ;; profitable when 7th bit is set.
8923 [(set (match_operand 0 "register_operand" "")
8924 (ior (match_operand 1 "general_operand" "")
8925 (match_operand 2 "const_int_operand" "")))
8926 (clobber (reg:CC FLAGS_REG))]
8928 && ANY_QI_REG_P (operands[0])
8929 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8930 && !(INTVAL (operands[2]) & ~255)
8931 && (INTVAL (operands[2]) & 128)
8932 && GET_MODE (operands[0]) != QImode"
8933 [(parallel [(set (strict_low_part (match_dup 0))
8934 (ior:QI (match_dup 1)
8936 (clobber (reg:CC FLAGS_REG))])]
8937 "operands[0] = gen_lowpart (QImode, operands[0]);
8938 operands[1] = gen_lowpart (QImode, operands[1]);
8939 operands[2] = gen_lowpart (QImode, operands[2]);")
8941 ;; Logical XOR instructions
8943 ;; %%% This used to optimize known byte-wide and operations to memory.
8944 ;; If this is considered useful, it should be done with splitters.
8946 (define_expand "xordi3"
8947 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8948 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "")
8949 (match_operand:DI 2 "x86_64_general_operand" "")))
8950 (clobber (reg:CC FLAGS_REG))]
8952 "ix86_expand_binary_operator (XOR, DImode, operands); DONE;")
8954 (define_insn "*xordi_1_rex64"
8955 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8956 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8957 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
8958 (clobber (reg:CC FLAGS_REG))]
8960 && ix86_binary_operator_ok (XOR, DImode, operands)"
8962 xor{q}\t{%2, %0|%0, %2}
8963 xor{q}\t{%2, %0|%0, %2}"
8964 [(set_attr "type" "alu")
8965 (set_attr "mode" "DI,DI")])
8967 (define_insn "*xordi_2_rex64"
8968 [(set (reg FLAGS_REG)
8969 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8970 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
8972 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
8973 (xor:DI (match_dup 1) (match_dup 2)))]
8975 && ix86_match_ccmode (insn, CCNOmode)
8976 && ix86_binary_operator_ok (XOR, DImode, operands)"
8978 xor{q}\t{%2, %0|%0, %2}
8979 xor{q}\t{%2, %0|%0, %2}"
8980 [(set_attr "type" "alu")
8981 (set_attr "mode" "DI,DI")])
8983 (define_insn "*xordi_3_rex64"
8984 [(set (reg FLAGS_REG)
8985 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
8986 (match_operand:DI 2 "x86_64_general_operand" "rem"))
8988 (clobber (match_scratch:DI 0 "=r"))]
8990 && ix86_match_ccmode (insn, CCNOmode)
8991 && ix86_binary_operator_ok (XOR, DImode, operands)"
8992 "xor{q}\t{%2, %0|%0, %2}"
8993 [(set_attr "type" "alu")
8994 (set_attr "mode" "DI")])
8996 (define_expand "xorsi3"
8997 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8998 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "")
8999 (match_operand:SI 2 "general_operand" "")))
9000 (clobber (reg:CC FLAGS_REG))]
9002 "ix86_expand_binary_operator (XOR, SImode, operands); DONE;")
9004 (define_insn "*xorsi_1"
9005 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
9006 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
9007 (match_operand:SI 2 "general_operand" "ri,rm")))
9008 (clobber (reg:CC FLAGS_REG))]
9009 "ix86_binary_operator_ok (XOR, SImode, operands)"
9010 "xor{l}\t{%2, %0|%0, %2}"
9011 [(set_attr "type" "alu")
9012 (set_attr "mode" "SI")])
9014 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
9015 ;; Add speccase for immediates
9016 (define_insn "*xorsi_1_zext"
9017 [(set (match_operand:DI 0 "register_operand" "=r")
9019 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9020 (match_operand:SI 2 "general_operand" "rim"))))
9021 (clobber (reg:CC FLAGS_REG))]
9022 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
9023 "xor{l}\t{%2, %k0|%k0, %2}"
9024 [(set_attr "type" "alu")
9025 (set_attr "mode" "SI")])
9027 (define_insn "*xorsi_1_zext_imm"
9028 [(set (match_operand:DI 0 "register_operand" "=r")
9029 (xor:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
9030 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
9031 (clobber (reg:CC FLAGS_REG))]
9032 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
9033 "xor{l}\t{%2, %k0|%k0, %2}"
9034 [(set_attr "type" "alu")
9035 (set_attr "mode" "SI")])
9037 (define_insn "*xorsi_2"
9038 [(set (reg FLAGS_REG)
9039 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
9040 (match_operand:SI 2 "general_operand" "rim,ri"))
9042 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
9043 (xor:SI (match_dup 1) (match_dup 2)))]
9044 "ix86_match_ccmode (insn, CCNOmode)
9045 && ix86_binary_operator_ok (XOR, SImode, operands)"
9046 "xor{l}\t{%2, %0|%0, %2}"
9047 [(set_attr "type" "alu")
9048 (set_attr "mode" "SI")])
9050 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
9051 ;; ??? Special case for immediate operand is missing - it is tricky.
9052 (define_insn "*xorsi_2_zext"
9053 [(set (reg FLAGS_REG)
9054 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9055 (match_operand:SI 2 "general_operand" "rim"))
9057 (set (match_operand:DI 0 "register_operand" "=r")
9058 (zero_extend:DI (xor:SI (match_dup 1) (match_dup 2))))]
9059 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9060 && ix86_binary_operator_ok (XOR, SImode, operands)"
9061 "xor{l}\t{%2, %k0|%k0, %2}"
9062 [(set_attr "type" "alu")
9063 (set_attr "mode" "SI")])
9065 (define_insn "*xorsi_2_zext_imm"
9066 [(set (reg FLAGS_REG)
9067 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9068 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
9070 (set (match_operand:DI 0 "register_operand" "=r")
9071 (xor:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
9072 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9073 && ix86_binary_operator_ok (XOR, SImode, operands)"
9074 "xor{l}\t{%2, %k0|%k0, %2}"
9075 [(set_attr "type" "alu")
9076 (set_attr "mode" "SI")])
9078 (define_insn "*xorsi_3"
9079 [(set (reg FLAGS_REG)
9080 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9081 (match_operand:SI 2 "general_operand" "rim"))
9083 (clobber (match_scratch:SI 0 "=r"))]
9084 "ix86_match_ccmode (insn, CCNOmode)
9085 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9086 "xor{l}\t{%2, %0|%0, %2}"
9087 [(set_attr "type" "alu")
9088 (set_attr "mode" "SI")])
9090 (define_expand "xorhi3"
9091 [(set (match_operand:HI 0 "nonimmediate_operand" "")
9092 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
9093 (match_operand:HI 2 "general_operand" "")))
9094 (clobber (reg:CC FLAGS_REG))]
9095 "TARGET_HIMODE_MATH"
9096 "ix86_expand_binary_operator (XOR, HImode, operands); DONE;")
9098 (define_insn "*xorhi_1"
9099 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
9100 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
9101 (match_operand:HI 2 "general_operand" "rmi,ri")))
9102 (clobber (reg:CC FLAGS_REG))]
9103 "ix86_binary_operator_ok (XOR, HImode, operands)"
9104 "xor{w}\t{%2, %0|%0, %2}"
9105 [(set_attr "type" "alu")
9106 (set_attr "mode" "HI")])
9108 (define_insn "*xorhi_2"
9109 [(set (reg FLAGS_REG)
9110 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
9111 (match_operand:HI 2 "general_operand" "rim,ri"))
9113 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
9114 (xor:HI (match_dup 1) (match_dup 2)))]
9115 "ix86_match_ccmode (insn, CCNOmode)
9116 && ix86_binary_operator_ok (XOR, HImode, operands)"
9117 "xor{w}\t{%2, %0|%0, %2}"
9118 [(set_attr "type" "alu")
9119 (set_attr "mode" "HI")])
9121 (define_insn "*xorhi_3"
9122 [(set (reg FLAGS_REG)
9123 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
9124 (match_operand:HI 2 "general_operand" "rim"))
9126 (clobber (match_scratch:HI 0 "=r"))]
9127 "ix86_match_ccmode (insn, CCNOmode)
9128 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9129 "xor{w}\t{%2, %0|%0, %2}"
9130 [(set_attr "type" "alu")
9131 (set_attr "mode" "HI")])
9133 (define_expand "xorqi3"
9134 [(set (match_operand:QI 0 "nonimmediate_operand" "")
9135 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
9136 (match_operand:QI 2 "general_operand" "")))
9137 (clobber (reg:CC FLAGS_REG))]
9138 "TARGET_QIMODE_MATH"
9139 "ix86_expand_binary_operator (XOR, QImode, operands); DONE;")
9141 ;; %%% Potential partial reg stall on alternative 2. What to do?
9142 (define_insn "*xorqi_1"
9143 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
9144 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
9145 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
9146 (clobber (reg:CC FLAGS_REG))]
9147 "ix86_binary_operator_ok (XOR, QImode, operands)"
9149 xor{b}\t{%2, %0|%0, %2}
9150 xor{b}\t{%2, %0|%0, %2}
9151 xor{l}\t{%k2, %k0|%k0, %k2}"
9152 [(set_attr "type" "alu")
9153 (set_attr "mode" "QI,QI,SI")])
9155 (define_insn "*xorqi_1_slp"
9156 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
9157 (xor:QI (match_dup 0)
9158 (match_operand:QI 1 "general_operand" "qi,qmi")))
9159 (clobber (reg:CC FLAGS_REG))]
9160 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9161 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9162 "xor{b}\t{%1, %0|%0, %1}"
9163 [(set_attr "type" "alu1")
9164 (set_attr "mode" "QI")])
9166 (define_insn "xorqi_ext_0"
9167 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9172 (match_operand 1 "ext_register_operand" "0")
9175 (match_operand 2 "const_int_operand" "n")))
9176 (clobber (reg:CC FLAGS_REG))]
9177 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9178 "xor{b}\t{%2, %h0|%h0, %2}"
9179 [(set_attr "type" "alu")
9180 (set_attr "length_immediate" "1")
9181 (set_attr "mode" "QI")])
9183 (define_insn "*xorqi_ext_1"
9184 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9189 (match_operand 1 "ext_register_operand" "0")
9193 (match_operand:QI 2 "general_operand" "Qm"))))
9194 (clobber (reg:CC FLAGS_REG))]
9196 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9197 "xor{b}\t{%2, %h0|%h0, %2}"
9198 [(set_attr "type" "alu")
9199 (set_attr "length_immediate" "0")
9200 (set_attr "mode" "QI")])
9202 (define_insn "*xorqi_ext_1_rex64"
9203 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9208 (match_operand 1 "ext_register_operand" "0")
9212 (match_operand 2 "ext_register_operand" "Q"))))
9213 (clobber (reg:CC FLAGS_REG))]
9215 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9216 "xor{b}\t{%2, %h0|%h0, %2}"
9217 [(set_attr "type" "alu")
9218 (set_attr "length_immediate" "0")
9219 (set_attr "mode" "QI")])
9221 (define_insn "*xorqi_ext_2"
9222 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9226 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
9229 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
9232 (clobber (reg:CC FLAGS_REG))]
9233 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9234 "xor{b}\t{%h2, %h0|%h0, %h2}"
9235 [(set_attr "type" "alu")
9236 (set_attr "length_immediate" "0")
9237 (set_attr "mode" "QI")])
9239 (define_insn "*xorqi_cc_1"
9240 [(set (reg FLAGS_REG)
9242 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
9243 (match_operand:QI 2 "general_operand" "qim,qi"))
9245 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
9246 (xor:QI (match_dup 1) (match_dup 2)))]
9247 "ix86_match_ccmode (insn, CCNOmode)
9248 && ix86_binary_operator_ok (XOR, QImode, operands)"
9249 "xor{b}\t{%2, %0|%0, %2}"
9250 [(set_attr "type" "alu")
9251 (set_attr "mode" "QI")])
9253 (define_insn "*xorqi_2_slp"
9254 [(set (reg FLAGS_REG)
9255 (compare (xor:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
9256 (match_operand:QI 1 "general_operand" "qim,qi"))
9258 (set (strict_low_part (match_dup 0))
9259 (xor:QI (match_dup 0) (match_dup 1)))]
9260 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9261 && ix86_match_ccmode (insn, CCNOmode)
9262 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9263 "xor{b}\t{%1, %0|%0, %1}"
9264 [(set_attr "type" "alu1")
9265 (set_attr "mode" "QI")])
9267 (define_insn "*xorqi_cc_2"
9268 [(set (reg FLAGS_REG)
9270 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
9271 (match_operand:QI 2 "general_operand" "qim"))
9273 (clobber (match_scratch:QI 0 "=q"))]
9274 "ix86_match_ccmode (insn, CCNOmode)
9275 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9276 "xor{b}\t{%2, %0|%0, %2}"
9277 [(set_attr "type" "alu")
9278 (set_attr "mode" "QI")])
9280 (define_insn "*xorqi_cc_ext_1"
9281 [(set (reg FLAGS_REG)
9285 (match_operand 1 "ext_register_operand" "0")
9288 (match_operand:QI 2 "general_operand" "qmn"))
9290 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=q")
9294 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9296 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9297 "xor{b}\t{%2, %h0|%h0, %2}"
9298 [(set_attr "type" "alu")
9299 (set_attr "mode" "QI")])
9301 (define_insn "*xorqi_cc_ext_1_rex64"
9302 [(set (reg FLAGS_REG)
9306 (match_operand 1 "ext_register_operand" "0")
9309 (match_operand:QI 2 "nonmemory_operand" "Qn"))
9311 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9315 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9317 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9318 "xor{b}\t{%2, %h0|%h0, %2}"
9319 [(set_attr "type" "alu")
9320 (set_attr "mode" "QI")])
9322 (define_expand "xorqi_cc_ext_1"
9324 (set (reg:CCNO FLAGS_REG)
9328 (match_operand 1 "ext_register_operand" "")
9331 (match_operand:QI 2 "general_operand" ""))
9333 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "")
9337 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9343 [(set (match_operand 0 "register_operand" "")
9344 (xor (match_operand 1 "register_operand" "")
9345 (match_operand 2 "const_int_operand" "")))
9346 (clobber (reg:CC FLAGS_REG))]
9348 && QI_REG_P (operands[0])
9349 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9350 && !(INTVAL (operands[2]) & ~(255 << 8))
9351 && GET_MODE (operands[0]) != QImode"
9352 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
9353 (xor:SI (zero_extract:SI (match_dup 1)
9354 (const_int 8) (const_int 8))
9356 (clobber (reg:CC FLAGS_REG))])]
9357 "operands[0] = gen_lowpart (SImode, operands[0]);
9358 operands[1] = gen_lowpart (SImode, operands[1]);
9359 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
9361 ;; Since XOR can be encoded with sign extended immediate, this is only
9362 ;; profitable when 7th bit is set.
9364 [(set (match_operand 0 "register_operand" "")
9365 (xor (match_operand 1 "general_operand" "")
9366 (match_operand 2 "const_int_operand" "")))
9367 (clobber (reg:CC FLAGS_REG))]
9369 && ANY_QI_REG_P (operands[0])
9370 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9371 && !(INTVAL (operands[2]) & ~255)
9372 && (INTVAL (operands[2]) & 128)
9373 && GET_MODE (operands[0]) != QImode"
9374 [(parallel [(set (strict_low_part (match_dup 0))
9375 (xor:QI (match_dup 1)
9377 (clobber (reg:CC FLAGS_REG))])]
9378 "operands[0] = gen_lowpart (QImode, operands[0]);
9379 operands[1] = gen_lowpart (QImode, operands[1]);
9380 operands[2] = gen_lowpart (QImode, operands[2]);")
9382 ;; Negation instructions
9384 (define_expand "negdi2"
9385 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
9386 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "")))
9387 (clobber (reg:CC FLAGS_REG))])]
9389 "ix86_expand_unary_operator (NEG, DImode, operands); DONE;")
9391 (define_insn "*negdi2_1"
9392 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
9393 (neg:DI (match_operand:DI 1 "general_operand" "0")))
9394 (clobber (reg:CC FLAGS_REG))]
9396 && ix86_unary_operator_ok (NEG, DImode, operands)"
9400 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9401 (neg:DI (match_operand:DI 1 "general_operand" "")))
9402 (clobber (reg:CC FLAGS_REG))]
9403 "!TARGET_64BIT && reload_completed"
9405 [(set (reg:CCZ FLAGS_REG)
9406 (compare:CCZ (neg:SI (match_dup 2)) (const_int 0)))
9407 (set (match_dup 0) (neg:SI (match_dup 2)))])
9410 (plus:SI (plus:SI (ltu:SI (reg:CC FLAGS_REG) (const_int 0))
9413 (clobber (reg:CC FLAGS_REG))])
9416 (neg:SI (match_dup 1)))
9417 (clobber (reg:CC FLAGS_REG))])]
9418 "split_di (operands+1, 1, operands+2, operands+3);
9419 split_di (operands+0, 1, operands+0, operands+1);")
9421 (define_insn "*negdi2_1_rex64"
9422 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9423 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0")))
9424 (clobber (reg:CC FLAGS_REG))]
9425 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9427 [(set_attr "type" "negnot")
9428 (set_attr "mode" "DI")])
9430 ;; The problem with neg is that it does not perform (compare x 0),
9431 ;; it really performs (compare 0 x), which leaves us with the zero
9432 ;; flag being the only useful item.
9434 (define_insn "*negdi2_cmpz_rex64"
9435 [(set (reg:CCZ FLAGS_REG)
9436 (compare:CCZ (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
9438 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9439 (neg:DI (match_dup 1)))]
9440 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9442 [(set_attr "type" "negnot")
9443 (set_attr "mode" "DI")])
9446 (define_expand "negsi2"
9447 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
9448 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "")))
9449 (clobber (reg:CC FLAGS_REG))])]
9451 "ix86_expand_unary_operator (NEG, SImode, operands); DONE;")
9453 (define_insn "*negsi2_1"
9454 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9455 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))
9456 (clobber (reg:CC FLAGS_REG))]
9457 "ix86_unary_operator_ok (NEG, SImode, operands)"
9459 [(set_attr "type" "negnot")
9460 (set_attr "mode" "SI")])
9462 ;; Combine is quite creative about this pattern.
9463 (define_insn "*negsi2_1_zext"
9464 [(set (match_operand:DI 0 "register_operand" "=r")
9465 (lshiftrt:DI (neg:DI (ashift:DI (match_operand:DI 1 "register_operand" "0")
9468 (clobber (reg:CC FLAGS_REG))]
9469 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9471 [(set_attr "type" "negnot")
9472 (set_attr "mode" "SI")])
9474 ;; The problem with neg is that it does not perform (compare x 0),
9475 ;; it really performs (compare 0 x), which leaves us with the zero
9476 ;; flag being the only useful item.
9478 (define_insn "*negsi2_cmpz"
9479 [(set (reg:CCZ FLAGS_REG)
9480 (compare:CCZ (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
9482 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9483 (neg:SI (match_dup 1)))]
9484 "ix86_unary_operator_ok (NEG, SImode, operands)"
9486 [(set_attr "type" "negnot")
9487 (set_attr "mode" "SI")])
9489 (define_insn "*negsi2_cmpz_zext"
9490 [(set (reg:CCZ FLAGS_REG)
9491 (compare:CCZ (lshiftrt:DI
9493 (match_operand:DI 1 "register_operand" "0")
9497 (set (match_operand:DI 0 "register_operand" "=r")
9498 (lshiftrt:DI (neg:DI (ashift:DI (match_dup 1)
9501 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9503 [(set_attr "type" "negnot")
9504 (set_attr "mode" "SI")])
9506 (define_expand "neghi2"
9507 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
9508 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "")))
9509 (clobber (reg:CC FLAGS_REG))])]
9510 "TARGET_HIMODE_MATH"
9511 "ix86_expand_unary_operator (NEG, HImode, operands); DONE;")
9513 (define_insn "*neghi2_1"
9514 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9515 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))
9516 (clobber (reg:CC FLAGS_REG))]
9517 "ix86_unary_operator_ok (NEG, HImode, operands)"
9519 [(set_attr "type" "negnot")
9520 (set_attr "mode" "HI")])
9522 (define_insn "*neghi2_cmpz"
9523 [(set (reg:CCZ FLAGS_REG)
9524 (compare:CCZ (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
9526 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9527 (neg:HI (match_dup 1)))]
9528 "ix86_unary_operator_ok (NEG, HImode, operands)"
9530 [(set_attr "type" "negnot")
9531 (set_attr "mode" "HI")])
9533 (define_expand "negqi2"
9534 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
9535 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "")))
9536 (clobber (reg:CC FLAGS_REG))])]
9537 "TARGET_QIMODE_MATH"
9538 "ix86_expand_unary_operator (NEG, QImode, operands); DONE;")
9540 (define_insn "*negqi2_1"
9541 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9542 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))
9543 (clobber (reg:CC FLAGS_REG))]
9544 "ix86_unary_operator_ok (NEG, QImode, operands)"
9546 [(set_attr "type" "negnot")
9547 (set_attr "mode" "QI")])
9549 (define_insn "*negqi2_cmpz"
9550 [(set (reg:CCZ FLAGS_REG)
9551 (compare:CCZ (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
9553 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9554 (neg:QI (match_dup 1)))]
9555 "ix86_unary_operator_ok (NEG, QImode, operands)"
9557 [(set_attr "type" "negnot")
9558 (set_attr "mode" "QI")])
9560 ;; Changing of sign for FP values is doable using integer unit too.
9562 (define_expand "negsf2"
9563 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9564 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
9565 "TARGET_80387 || TARGET_SSE_MATH"
9566 "ix86_expand_fp_absneg_operator (NEG, SFmode, operands); DONE;")
9568 (define_expand "abssf2"
9569 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9570 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
9571 "TARGET_80387 || TARGET_SSE_MATH"
9572 "ix86_expand_fp_absneg_operator (ABS, SFmode, operands); DONE;")
9574 (define_insn "*absnegsf2_mixed"
9575 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
9576 (match_operator:SF 3 "absneg_operator"
9577 [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#fr,0 ,0")]))
9578 (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X ,X"))
9579 (clobber (reg:CC FLAGS_REG))]
9580 "TARGET_SSE_MATH && TARGET_MIX_SSE_I387
9581 && ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
9584 (define_insn "*absnegsf2_sse"
9585 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#r,x#r,rm#x")
9586 (match_operator:SF 3 "absneg_operator"
9587 [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#r,0")]))
9588 (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X"))
9589 (clobber (reg:CC FLAGS_REG))]
9591 && ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
9594 (define_insn "*absnegsf2_i387"
9595 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
9596 (match_operator:SF 3 "absneg_operator"
9597 [(match_operand:SF 1 "nonimmediate_operand" "0,0")]))
9598 (use (match_operand 2 "" ""))
9599 (clobber (reg:CC FLAGS_REG))]
9600 "TARGET_80387 && !TARGET_SSE_MATH
9601 && ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
9604 (define_expand "negdf2"
9605 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9606 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
9607 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
9608 "ix86_expand_fp_absneg_operator (NEG, DFmode, operands); DONE;")
9610 (define_expand "absdf2"
9611 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9612 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
9613 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
9614 "ix86_expand_fp_absneg_operator (ABS, DFmode, operands); DONE;")
9616 (define_insn "*absnegdf2_mixed"
9617 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf")
9618 (match_operator:DF 3 "absneg_operator"
9619 [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#fr,0 ,0")]))
9620 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X ,X"))
9621 (clobber (reg:CC FLAGS_REG))]
9622 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
9623 && ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
9626 (define_insn "*absnegdf2_sse"
9627 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#r,Y#r,rm#Y")
9628 (match_operator:DF 3 "absneg_operator"
9629 [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#r,0")]))
9630 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X"))
9631 (clobber (reg:CC FLAGS_REG))]
9632 "TARGET_SSE2 && TARGET_SSE_MATH
9633 && ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
9636 (define_insn "*absnegdf2_i387"
9637 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
9638 (match_operator:DF 3 "absneg_operator"
9639 [(match_operand:DF 1 "nonimmediate_operand" "0,0")]))
9640 (use (match_operand 2 "" ""))
9641 (clobber (reg:CC FLAGS_REG))]
9642 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)
9643 && ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
9646 (define_expand "negxf2"
9647 [(set (match_operand:XF 0 "nonimmediate_operand" "")
9648 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
9650 "ix86_expand_fp_absneg_operator (NEG, XFmode, operands); DONE;")
9652 (define_expand "absxf2"
9653 [(set (match_operand:XF 0 "nonimmediate_operand" "")
9654 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
9656 "ix86_expand_fp_absneg_operator (ABS, XFmode, operands); DONE;")
9658 (define_insn "*absnegxf2_i387"
9659 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
9660 (match_operator:XF 3 "absneg_operator"
9661 [(match_operand:XF 1 "nonimmediate_operand" "0,0")]))
9662 (use (match_operand 2 "" ""))
9663 (clobber (reg:CC FLAGS_REG))]
9665 && ix86_unary_operator_ok (GET_CODE (operands[3]), XFmode, operands)"
9668 ;; Splitters for fp abs and neg.
9671 [(set (match_operand 0 "fp_register_operand" "")
9672 (match_operator 1 "absneg_operator" [(match_dup 0)]))
9673 (use (match_operand 2 "" ""))
9674 (clobber (reg:CC FLAGS_REG))]
9676 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0)]))])
9679 [(set (match_operand 0 "register_operand" "")
9680 (match_operator 3 "absneg_operator"
9681 [(match_operand 1 "register_operand" "")]))
9682 (use (match_operand 2 "nonimmediate_operand" ""))
9683 (clobber (reg:CC FLAGS_REG))]
9684 "reload_completed && SSE_REG_P (operands[0])"
9685 [(set (match_dup 0) (match_dup 3))]
9687 enum machine_mode mode = GET_MODE (operands[0]);
9688 enum machine_mode vmode = GET_MODE (operands[2]);
9691 operands[0] = simplify_gen_subreg (vmode, operands[0], mode, 0);
9692 operands[1] = simplify_gen_subreg (vmode, operands[1], mode, 0);
9693 if (operands_match_p (operands[0], operands[2]))
9696 operands[1] = operands[2];
9699 if (GET_CODE (operands[3]) == ABS)
9700 tmp = gen_rtx_AND (vmode, operands[1], operands[2]);
9702 tmp = gen_rtx_XOR (vmode, operands[1], operands[2]);
9707 [(set (match_operand:SF 0 "register_operand" "")
9708 (match_operator:SF 1 "absneg_operator" [(match_dup 0)]))
9709 (use (match_operand:V4SF 2 "" ""))
9710 (clobber (reg:CC FLAGS_REG))]
9712 [(parallel [(set (match_dup 0) (match_dup 1))
9713 (clobber (reg:CC FLAGS_REG))])]
9716 operands[0] = gen_lowpart (SImode, operands[0]);
9717 if (GET_CODE (operands[1]) == ABS)
9719 tmp = gen_int_mode (0x7fffffff, SImode);
9720 tmp = gen_rtx_AND (SImode, operands[0], tmp);
9724 tmp = gen_int_mode (0x80000000, SImode);
9725 tmp = gen_rtx_XOR (SImode, operands[0], tmp);
9731 [(set (match_operand:DF 0 "register_operand" "")
9732 (match_operator:DF 1 "absneg_operator" [(match_dup 0)]))
9733 (use (match_operand 2 "" ""))
9734 (clobber (reg:CC FLAGS_REG))]
9736 [(parallel [(set (match_dup 0) (match_dup 1))
9737 (clobber (reg:CC FLAGS_REG))])]
9742 tmp = gen_lowpart (DImode, operands[0]);
9743 tmp = gen_rtx_ZERO_EXTRACT (DImode, tmp, const1_rtx, GEN_INT (63));
9746 if (GET_CODE (operands[1]) == ABS)
9749 tmp = gen_rtx_NOT (DImode, tmp);
9753 operands[0] = gen_highpart (SImode, operands[0]);
9754 if (GET_CODE (operands[1]) == ABS)
9756 tmp = gen_int_mode (0x7fffffff, SImode);
9757 tmp = gen_rtx_AND (SImode, operands[0], tmp);
9761 tmp = gen_int_mode (0x80000000, SImode);
9762 tmp = gen_rtx_XOR (SImode, operands[0], tmp);
9769 [(set (match_operand:XF 0 "register_operand" "")
9770 (match_operator:XF 1 "absneg_operator" [(match_dup 0)]))
9771 (use (match_operand 2 "" ""))
9772 (clobber (reg:CC FLAGS_REG))]
9774 [(parallel [(set (match_dup 0) (match_dup 1))
9775 (clobber (reg:CC FLAGS_REG))])]
9778 operands[0] = gen_rtx_REG (SImode,
9779 true_regnum (operands[0])
9780 + (TARGET_64BIT ? 1 : 2));
9781 if (GET_CODE (operands[1]) == ABS)
9783 tmp = GEN_INT (0x7fff);
9784 tmp = gen_rtx_AND (SImode, operands[0], tmp);
9788 tmp = GEN_INT (0x8000);
9789 tmp = gen_rtx_XOR (SImode, operands[0], tmp);
9795 [(set (match_operand 0 "memory_operand" "")
9796 (match_operator 1 "absneg_operator" [(match_dup 0)]))
9797 (use (match_operand 2 "" ""))
9798 (clobber (reg:CC FLAGS_REG))]
9800 [(parallel [(set (match_dup 0) (match_dup 1))
9801 (clobber (reg:CC FLAGS_REG))])]
9803 enum machine_mode mode = GET_MODE (operands[0]);
9804 int size = mode == XFmode ? 10 : GET_MODE_SIZE (mode);
9807 operands[0] = adjust_address (operands[0], QImode, size - 1);
9808 if (GET_CODE (operands[1]) == ABS)
9810 tmp = gen_int_mode (0x7f, QImode);
9811 tmp = gen_rtx_AND (QImode, operands[0], tmp);
9815 tmp = gen_int_mode (0x80, QImode);
9816 tmp = gen_rtx_XOR (QImode, operands[0], tmp);
9821 ;; Conditionalize these after reload. If they match before reload, we
9822 ;; lose the clobber and ability to use integer instructions.
9824 (define_insn "*negsf2_1"
9825 [(set (match_operand:SF 0 "register_operand" "=f")
9826 (neg:SF (match_operand:SF 1 "register_operand" "0")))]
9827 "TARGET_80387 && reload_completed"
9829 [(set_attr "type" "fsgn")
9830 (set_attr "mode" "SF")])
9832 (define_insn "*negdf2_1"
9833 [(set (match_operand:DF 0 "register_operand" "=f")
9834 (neg:DF (match_operand:DF 1 "register_operand" "0")))]
9835 "TARGET_80387 && reload_completed"
9837 [(set_attr "type" "fsgn")
9838 (set_attr "mode" "DF")])
9840 (define_insn "*negxf2_1"
9841 [(set (match_operand:XF 0 "register_operand" "=f")
9842 (neg:XF (match_operand:XF 1 "register_operand" "0")))]
9843 "TARGET_80387 && reload_completed"
9845 [(set_attr "type" "fsgn")
9846 (set_attr "mode" "XF")])
9848 (define_insn "*abssf2_1"
9849 [(set (match_operand:SF 0 "register_operand" "=f")
9850 (abs:SF (match_operand:SF 1 "register_operand" "0")))]
9851 "TARGET_80387 && reload_completed"
9853 [(set_attr "type" "fsgn")
9854 (set_attr "mode" "SF")])
9856 (define_insn "*absdf2_1"
9857 [(set (match_operand:DF 0 "register_operand" "=f")
9858 (abs:DF (match_operand:DF 1 "register_operand" "0")))]
9859 "TARGET_80387 && reload_completed"
9861 [(set_attr "type" "fsgn")
9862 (set_attr "mode" "DF")])
9864 (define_insn "*absxf2_1"
9865 [(set (match_operand:XF 0 "register_operand" "=f")
9866 (abs:XF (match_operand:XF 1 "register_operand" "0")))]
9867 "TARGET_80387 && reload_completed"
9869 [(set_attr "type" "fsgn")
9870 (set_attr "mode" "DF")])
9872 (define_insn "*negextendsfdf2"
9873 [(set (match_operand:DF 0 "register_operand" "=f")
9874 (neg:DF (float_extend:DF
9875 (match_operand:SF 1 "register_operand" "0"))))]
9876 "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)"
9878 [(set_attr "type" "fsgn")
9879 (set_attr "mode" "DF")])
9881 (define_insn "*negextenddfxf2"
9882 [(set (match_operand:XF 0 "register_operand" "=f")
9883 (neg:XF (float_extend:XF
9884 (match_operand:DF 1 "register_operand" "0"))))]
9887 [(set_attr "type" "fsgn")
9888 (set_attr "mode" "XF")])
9890 (define_insn "*negextendsfxf2"
9891 [(set (match_operand:XF 0 "register_operand" "=f")
9892 (neg:XF (float_extend:XF
9893 (match_operand:SF 1 "register_operand" "0"))))]
9896 [(set_attr "type" "fsgn")
9897 (set_attr "mode" "XF")])
9899 (define_insn "*absextendsfdf2"
9900 [(set (match_operand:DF 0 "register_operand" "=f")
9901 (abs:DF (float_extend:DF
9902 (match_operand:SF 1 "register_operand" "0"))))]
9903 "TARGET_80387 && (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)"
9905 [(set_attr "type" "fsgn")
9906 (set_attr "mode" "DF")])
9908 (define_insn "*absextenddfxf2"
9909 [(set (match_operand:XF 0 "register_operand" "=f")
9910 (abs:XF (float_extend:XF
9911 (match_operand:DF 1 "register_operand" "0"))))]
9914 [(set_attr "type" "fsgn")
9915 (set_attr "mode" "XF")])
9917 (define_insn "*absextendsfxf2"
9918 [(set (match_operand:XF 0 "register_operand" "=f")
9919 (abs:XF (float_extend:XF
9920 (match_operand:SF 1 "register_operand" "0"))))]
9923 [(set_attr "type" "fsgn")
9924 (set_attr "mode" "XF")])
9926 ;; One complement instructions
9928 (define_expand "one_cmpldi2"
9929 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9930 (not:DI (match_operand:DI 1 "nonimmediate_operand" "")))]
9932 "ix86_expand_unary_operator (NOT, DImode, operands); DONE;")
9934 (define_insn "*one_cmpldi2_1_rex64"
9935 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9936 (not:DI (match_operand:DI 1 "nonimmediate_operand" "0")))]
9937 "TARGET_64BIT && ix86_unary_operator_ok (NOT, DImode, operands)"
9939 [(set_attr "type" "negnot")
9940 (set_attr "mode" "DI")])
9942 (define_insn "*one_cmpldi2_2_rex64"
9943 [(set (reg FLAGS_REG)
9944 (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
9946 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9947 (not:DI (match_dup 1)))]
9948 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9949 && ix86_unary_operator_ok (NOT, DImode, operands)"
9951 [(set_attr "type" "alu1")
9952 (set_attr "mode" "DI")])
9955 [(set (match_operand 0 "flags_reg_operand" "")
9956 (match_operator 2 "compare_operator"
9957 [(not:DI (match_operand:DI 3 "nonimmediate_operand" ""))
9959 (set (match_operand:DI 1 "nonimmediate_operand" "")
9960 (not:DI (match_dup 3)))]
9961 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9962 [(parallel [(set (match_dup 0)
9964 [(xor:DI (match_dup 3) (const_int -1))
9967 (xor:DI (match_dup 3) (const_int -1)))])]
9970 (define_expand "one_cmplsi2"
9971 [(set (match_operand:SI 0 "nonimmediate_operand" "")
9972 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
9974 "ix86_expand_unary_operator (NOT, SImode, operands); DONE;")
9976 (define_insn "*one_cmplsi2_1"
9977 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9978 (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
9979 "ix86_unary_operator_ok (NOT, SImode, operands)"
9981 [(set_attr "type" "negnot")
9982 (set_attr "mode" "SI")])
9984 ;; ??? Currently never generated - xor is used instead.
9985 (define_insn "*one_cmplsi2_1_zext"
9986 [(set (match_operand:DI 0 "register_operand" "=r")
9987 (zero_extend:DI (not:SI (match_operand:SI 1 "register_operand" "0"))))]
9988 "TARGET_64BIT && ix86_unary_operator_ok (NOT, SImode, operands)"
9990 [(set_attr "type" "negnot")
9991 (set_attr "mode" "SI")])
9993 (define_insn "*one_cmplsi2_2"
9994 [(set (reg FLAGS_REG)
9995 (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
9997 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9998 (not:SI (match_dup 1)))]
9999 "ix86_match_ccmode (insn, CCNOmode)
10000 && ix86_unary_operator_ok (NOT, SImode, operands)"
10002 [(set_attr "type" "alu1")
10003 (set_attr "mode" "SI")])
10006 [(set (match_operand 0 "flags_reg_operand" "")
10007 (match_operator 2 "compare_operator"
10008 [(not:SI (match_operand:SI 3 "nonimmediate_operand" ""))
10010 (set (match_operand:SI 1 "nonimmediate_operand" "")
10011 (not:SI (match_dup 3)))]
10012 "ix86_match_ccmode (insn, CCNOmode)"
10013 [(parallel [(set (match_dup 0)
10014 (match_op_dup 2 [(xor:SI (match_dup 3) (const_int -1))
10017 (xor:SI (match_dup 3) (const_int -1)))])]
10020 ;; ??? Currently never generated - xor is used instead.
10021 (define_insn "*one_cmplsi2_2_zext"
10022 [(set (reg FLAGS_REG)
10023 (compare (not:SI (match_operand:SI 1 "register_operand" "0"))
10025 (set (match_operand:DI 0 "register_operand" "=r")
10026 (zero_extend:DI (not:SI (match_dup 1))))]
10027 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
10028 && ix86_unary_operator_ok (NOT, SImode, operands)"
10030 [(set_attr "type" "alu1")
10031 (set_attr "mode" "SI")])
10034 [(set (match_operand 0 "flags_reg_operand" "")
10035 (match_operator 2 "compare_operator"
10036 [(not:SI (match_operand:SI 3 "register_operand" ""))
10038 (set (match_operand:DI 1 "register_operand" "")
10039 (zero_extend:DI (not:SI (match_dup 3))))]
10040 "ix86_match_ccmode (insn, CCNOmode)"
10041 [(parallel [(set (match_dup 0)
10042 (match_op_dup 2 [(xor:SI (match_dup 3) (const_int -1))
10045 (zero_extend:DI (xor:SI (match_dup 3) (const_int -1))))])]
10048 (define_expand "one_cmplhi2"
10049 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10050 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
10051 "TARGET_HIMODE_MATH"
10052 "ix86_expand_unary_operator (NOT, HImode, operands); DONE;")
10054 (define_insn "*one_cmplhi2_1"
10055 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10056 (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
10057 "ix86_unary_operator_ok (NOT, HImode, operands)"
10059 [(set_attr "type" "negnot")
10060 (set_attr "mode" "HI")])
10062 (define_insn "*one_cmplhi2_2"
10063 [(set (reg FLAGS_REG)
10064 (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
10066 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10067 (not:HI (match_dup 1)))]
10068 "ix86_match_ccmode (insn, CCNOmode)
10069 && ix86_unary_operator_ok (NEG, HImode, operands)"
10071 [(set_attr "type" "alu1")
10072 (set_attr "mode" "HI")])
10075 [(set (match_operand 0 "flags_reg_operand" "")
10076 (match_operator 2 "compare_operator"
10077 [(not:HI (match_operand:HI 3 "nonimmediate_operand" ""))
10079 (set (match_operand:HI 1 "nonimmediate_operand" "")
10080 (not:HI (match_dup 3)))]
10081 "ix86_match_ccmode (insn, CCNOmode)"
10082 [(parallel [(set (match_dup 0)
10083 (match_op_dup 2 [(xor:HI (match_dup 3) (const_int -1))
10086 (xor:HI (match_dup 3) (const_int -1)))])]
10089 ;; %%% Potential partial reg stall on alternative 1. What to do?
10090 (define_expand "one_cmplqi2"
10091 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10092 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
10093 "TARGET_QIMODE_MATH"
10094 "ix86_expand_unary_operator (NOT, QImode, operands); DONE;")
10096 (define_insn "*one_cmplqi2_1"
10097 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10098 (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
10099 "ix86_unary_operator_ok (NOT, QImode, operands)"
10103 [(set_attr "type" "negnot")
10104 (set_attr "mode" "QI,SI")])
10106 (define_insn "*one_cmplqi2_2"
10107 [(set (reg FLAGS_REG)
10108 (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
10110 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
10111 (not:QI (match_dup 1)))]
10112 "ix86_match_ccmode (insn, CCNOmode)
10113 && ix86_unary_operator_ok (NOT, QImode, operands)"
10115 [(set_attr "type" "alu1")
10116 (set_attr "mode" "QI")])
10119 [(set (match_operand 0 "flags_reg_operand" "")
10120 (match_operator 2 "compare_operator"
10121 [(not:QI (match_operand:QI 3 "nonimmediate_operand" ""))
10123 (set (match_operand:QI 1 "nonimmediate_operand" "")
10124 (not:QI (match_dup 3)))]
10125 "ix86_match_ccmode (insn, CCNOmode)"
10126 [(parallel [(set (match_dup 0)
10127 (match_op_dup 2 [(xor:QI (match_dup 3) (const_int -1))
10130 (xor:QI (match_dup 3) (const_int -1)))])]
10133 ;; Arithmetic shift instructions
10135 ;; DImode shifts are implemented using the i386 "shift double" opcode,
10136 ;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count
10137 ;; is variable, then the count is in %cl and the "imm" operand is dropped
10138 ;; from the assembler input.
10140 ;; This instruction shifts the target reg/mem as usual, but instead of
10141 ;; shifting in zeros, bits are shifted in from reg operand. If the insn
10142 ;; is a left shift double, bits are taken from the high order bits of
10143 ;; reg, else if the insn is a shift right double, bits are taken from the
10144 ;; low order bits of reg. So if %eax is "1234" and %edx is "5678",
10145 ;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345".
10147 ;; Since sh[lr]d does not change the `reg' operand, that is done
10148 ;; separately, making all shifts emit pairs of shift double and normal
10149 ;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to
10150 ;; support a 63 bit shift, each shift where the count is in a reg expands
10151 ;; to a pair of shifts, a branch, a shift by 32 and a label.
10153 ;; If the shift count is a constant, we need never emit more than one
10154 ;; shift pair, instead using moves and sign extension for counts greater
10157 (define_expand "ashldi3"
10158 [(set (match_operand:DI 0 "shiftdi_operand" "")
10159 (ashift:DI (match_operand:DI 1 "ashldi_input_operand" "")
10160 (match_operand:QI 2 "nonmemory_operand" "")))]
10162 "ix86_expand_binary_operator (ASHIFT, DImode, operands); DONE;")
10164 (define_insn "*ashldi3_1_rex64"
10165 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
10166 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0,l")
10167 (match_operand:QI 2 "nonmemory_operand" "cJ,M")))
10168 (clobber (reg:CC FLAGS_REG))]
10169 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10171 switch (get_attr_type (insn))
10174 if (operands[2] != const1_rtx)
10176 if (!rtx_equal_p (operands[0], operands[1]))
10178 return "add{q}\t{%0, %0|%0, %0}";
10181 if (GET_CODE (operands[2]) != CONST_INT
10182 || (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 3)
10184 operands[1] = gen_rtx_MULT (DImode, operands[1],
10185 GEN_INT (1 << INTVAL (operands[2])));
10186 return "lea{q}\t{%a1, %0|%0, %a1}";
10189 if (REG_P (operands[2]))
10190 return "sal{q}\t{%b2, %0|%0, %b2}";
10191 else if (operands[2] == const1_rtx
10192 && (TARGET_SHIFT1 || optimize_size))
10193 return "sal{q}\t%0";
10195 return "sal{q}\t{%2, %0|%0, %2}";
10198 [(set (attr "type")
10199 (cond [(eq_attr "alternative" "1")
10200 (const_string "lea")
10201 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10203 (match_operand 0 "register_operand" ""))
10204 (match_operand 2 "const1_operand" ""))
10205 (const_string "alu")
10207 (const_string "ishift")))
10208 (set_attr "mode" "DI")])
10210 ;; Convert lea to the lea pattern to avoid flags dependency.
10212 [(set (match_operand:DI 0 "register_operand" "")
10213 (ashift:DI (match_operand:DI 1 "index_register_operand" "")
10214 (match_operand:QI 2 "immediate_operand" "")))
10215 (clobber (reg:CC FLAGS_REG))]
10216 "TARGET_64BIT && reload_completed
10217 && true_regnum (operands[0]) != true_regnum (operands[1])"
10218 [(set (match_dup 0)
10219 (mult:DI (match_dup 1)
10221 "operands[2] = gen_int_mode (1 << INTVAL (operands[2]), DImode);")
10223 ;; This pattern can't accept a variable shift count, since shifts by
10224 ;; zero don't affect the flags. We assume that shifts by constant
10225 ;; zero are optimized away.
10226 (define_insn "*ashldi3_cmp_rex64"
10227 [(set (reg FLAGS_REG)
10229 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10230 (match_operand:QI 2 "immediate_operand" "e"))
10232 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10233 (ashift:DI (match_dup 1) (match_dup 2)))]
10234 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10235 && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10237 switch (get_attr_type (insn))
10240 if (operands[2] != const1_rtx)
10242 return "add{q}\t{%0, %0|%0, %0}";
10245 if (REG_P (operands[2]))
10246 return "sal{q}\t{%b2, %0|%0, %b2}";
10247 else if (operands[2] == const1_rtx
10248 && (TARGET_SHIFT1 || optimize_size))
10249 return "sal{q}\t%0";
10251 return "sal{q}\t{%2, %0|%0, %2}";
10254 [(set (attr "type")
10255 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10257 (match_operand 0 "register_operand" ""))
10258 (match_operand 2 "const1_operand" ""))
10259 (const_string "alu")
10261 (const_string "ishift")))
10262 (set_attr "mode" "DI")])
10264 (define_insn "*ashldi3_1"
10265 [(set (match_operand:DI 0 "register_operand" "=&r,r")
10266 (ashift:DI (match_operand:DI 1 "reg_or_pm1_operand" "n,0")
10267 (match_operand:QI 2 "nonmemory_operand" "Jc,Jc")))
10268 (clobber (reg:CC FLAGS_REG))]
10271 [(set_attr "type" "multi")])
10273 ;; By default we don't ask for a scratch register, because when DImode
10274 ;; values are manipulated, registers are already at a premium. But if
10275 ;; we have one handy, we won't turn it away.
10277 [(match_scratch:SI 3 "r")
10278 (parallel [(set (match_operand:DI 0 "register_operand" "")
10279 (ashift:DI (match_operand:DI 1 "nonmemory_operand" "")
10280 (match_operand:QI 2 "nonmemory_operand" "")))
10281 (clobber (reg:CC FLAGS_REG))])
10283 "!TARGET_64BIT && TARGET_CMOVE"
10285 "ix86_split_ashldi (operands, operands[3]); DONE;")
10288 [(set (match_operand:DI 0 "register_operand" "")
10289 (ashift:DI (match_operand:DI 1 "nonmemory_operand" "")
10290 (match_operand:QI 2 "nonmemory_operand" "")))
10291 (clobber (reg:CC FLAGS_REG))]
10292 "!TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)"
10294 "ix86_split_ashldi (operands, NULL_RTX); DONE;")
10296 (define_insn "x86_shld_1"
10297 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
10298 (ior:SI (ashift:SI (match_dup 0)
10299 (match_operand:QI 2 "nonmemory_operand" "I,c"))
10300 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
10301 (minus:QI (const_int 32) (match_dup 2)))))
10302 (clobber (reg:CC FLAGS_REG))]
10305 shld{l}\t{%2, %1, %0|%0, %1, %2}
10306 shld{l}\t{%s2%1, %0|%0, %1, %2}"
10307 [(set_attr "type" "ishift")
10308 (set_attr "prefix_0f" "1")
10309 (set_attr "mode" "SI")
10310 (set_attr "pent_pair" "np")
10311 (set_attr "athlon_decode" "vector")])
10313 (define_expand "x86_shift_adj_1"
10314 [(set (reg:CCZ FLAGS_REG)
10315 (compare:CCZ (and:QI (match_operand:QI 2 "register_operand" "")
10318 (set (match_operand:SI 0 "register_operand" "")
10319 (if_then_else:SI (ne (reg:CCZ FLAGS_REG) (const_int 0))
10320 (match_operand:SI 1 "register_operand" "")
10323 (if_then_else:SI (ne (reg:CCZ FLAGS_REG) (const_int 0))
10324 (match_operand:SI 3 "register_operand" "r")
10329 (define_expand "x86_shift_adj_2"
10330 [(use (match_operand:SI 0 "register_operand" ""))
10331 (use (match_operand:SI 1 "register_operand" ""))
10332 (use (match_operand:QI 2 "register_operand" ""))]
10335 rtx label = gen_label_rtx ();
10338 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
10340 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
10341 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
10342 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
10343 gen_rtx_LABEL_REF (VOIDmode, label),
10345 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
10346 JUMP_LABEL (tmp) = label;
10348 emit_move_insn (operands[0], operands[1]);
10349 ix86_expand_clear (operands[1]);
10351 emit_label (label);
10352 LABEL_NUSES (label) = 1;
10357 (define_expand "ashlsi3"
10358 [(set (match_operand:SI 0 "nonimmediate_operand" "")
10359 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "")
10360 (match_operand:QI 2 "nonmemory_operand" "")))
10361 (clobber (reg:CC FLAGS_REG))]
10363 "ix86_expand_binary_operator (ASHIFT, SImode, operands); DONE;")
10365 (define_insn "*ashlsi3_1"
10366 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
10367 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,l")
10368 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
10369 (clobber (reg:CC FLAGS_REG))]
10370 "ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10372 switch (get_attr_type (insn))
10375 if (operands[2] != const1_rtx)
10377 if (!rtx_equal_p (operands[0], operands[1]))
10379 return "add{l}\t{%0, %0|%0, %0}";
10385 if (REG_P (operands[2]))
10386 return "sal{l}\t{%b2, %0|%0, %b2}";
10387 else if (operands[2] == const1_rtx
10388 && (TARGET_SHIFT1 || optimize_size))
10389 return "sal{l}\t%0";
10391 return "sal{l}\t{%2, %0|%0, %2}";
10394 [(set (attr "type")
10395 (cond [(eq_attr "alternative" "1")
10396 (const_string "lea")
10397 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10399 (match_operand 0 "register_operand" ""))
10400 (match_operand 2 "const1_operand" ""))
10401 (const_string "alu")
10403 (const_string "ishift")))
10404 (set_attr "mode" "SI")])
10406 ;; Convert lea to the lea pattern to avoid flags dependency.
10408 [(set (match_operand 0 "register_operand" "")
10409 (ashift (match_operand 1 "index_register_operand" "")
10410 (match_operand:QI 2 "const_int_operand" "")))
10411 (clobber (reg:CC FLAGS_REG))]
10413 && true_regnum (operands[0]) != true_regnum (operands[1])
10414 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 4"
10418 enum machine_mode mode = GET_MODE (operands[0]);
10420 if (GET_MODE_SIZE (mode) < 4)
10421 operands[0] = gen_lowpart (SImode, operands[0]);
10423 operands[1] = gen_lowpart (Pmode, operands[1]);
10424 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
10426 pat = gen_rtx_MULT (Pmode, operands[1], operands[2]);
10427 if (Pmode != SImode)
10428 pat = gen_rtx_SUBREG (SImode, pat, 0);
10429 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
10433 ;; Rare case of shifting RSP is handled by generating move and shift
10435 [(set (match_operand 0 "register_operand" "")
10436 (ashift (match_operand 1 "register_operand" "")
10437 (match_operand:QI 2 "const_int_operand" "")))
10438 (clobber (reg:CC FLAGS_REG))]
10440 && true_regnum (operands[0]) != true_regnum (operands[1])"
10444 emit_move_insn (operands[1], operands[0]);
10445 pat = gen_rtx_SET (VOIDmode, operands[0],
10446 gen_rtx_ASHIFT (GET_MODE (operands[0]),
10447 operands[0], operands[2]));
10448 clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
10449 emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, pat, clob)));
10453 (define_insn "*ashlsi3_1_zext"
10454 [(set (match_operand:DI 0 "register_operand" "=r,r")
10455 (zero_extend:DI (ashift:SI (match_operand:SI 1 "register_operand" "0,l")
10456 (match_operand:QI 2 "nonmemory_operand" "cI,M"))))
10457 (clobber (reg:CC FLAGS_REG))]
10458 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10460 switch (get_attr_type (insn))
10463 if (operands[2] != const1_rtx)
10465 return "add{l}\t{%k0, %k0|%k0, %k0}";
10471 if (REG_P (operands[2]))
10472 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10473 else if (operands[2] == const1_rtx
10474 && (TARGET_SHIFT1 || optimize_size))
10475 return "sal{l}\t%k0";
10477 return "sal{l}\t{%2, %k0|%k0, %2}";
10480 [(set (attr "type")
10481 (cond [(eq_attr "alternative" "1")
10482 (const_string "lea")
10483 (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10485 (match_operand 2 "const1_operand" ""))
10486 (const_string "alu")
10488 (const_string "ishift")))
10489 (set_attr "mode" "SI")])
10491 ;; Convert lea to the lea pattern to avoid flags dependency.
10493 [(set (match_operand:DI 0 "register_operand" "")
10494 (zero_extend:DI (ashift (match_operand 1 "register_operand" "")
10495 (match_operand:QI 2 "const_int_operand" ""))))
10496 (clobber (reg:CC FLAGS_REG))]
10497 "TARGET_64BIT && reload_completed
10498 && true_regnum (operands[0]) != true_regnum (operands[1])"
10499 [(set (match_dup 0) (zero_extend:DI
10500 (subreg:SI (mult:SI (match_dup 1)
10501 (match_dup 2)) 0)))]
10503 operands[1] = gen_lowpart (Pmode, operands[1]);
10504 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
10507 ;; This pattern can't accept a variable shift count, since shifts by
10508 ;; zero don't affect the flags. We assume that shifts by constant
10509 ;; zero are optimized away.
10510 (define_insn "*ashlsi3_cmp"
10511 [(set (reg FLAGS_REG)
10513 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
10514 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10516 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10517 (ashift:SI (match_dup 1) (match_dup 2)))]
10518 "ix86_match_ccmode (insn, CCGOCmode)
10519 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10521 switch (get_attr_type (insn))
10524 if (operands[2] != const1_rtx)
10526 return "add{l}\t{%0, %0|%0, %0}";
10529 if (REG_P (operands[2]))
10530 return "sal{l}\t{%b2, %0|%0, %b2}";
10531 else if (operands[2] == const1_rtx
10532 && (TARGET_SHIFT1 || optimize_size))
10533 return "sal{l}\t%0";
10535 return "sal{l}\t{%2, %0|%0, %2}";
10538 [(set (attr "type")
10539 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10541 (match_operand 0 "register_operand" ""))
10542 (match_operand 2 "const1_operand" ""))
10543 (const_string "alu")
10545 (const_string "ishift")))
10546 (set_attr "mode" "SI")])
10548 (define_insn "*ashlsi3_cmp_zext"
10549 [(set (reg FLAGS_REG)
10551 (ashift:SI (match_operand:SI 1 "register_operand" "0")
10552 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10554 (set (match_operand:DI 0 "register_operand" "=r")
10555 (zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))]
10556 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10557 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10559 switch (get_attr_type (insn))
10562 if (operands[2] != const1_rtx)
10564 return "add{l}\t{%k0, %k0|%k0, %k0}";
10567 if (REG_P (operands[2]))
10568 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10569 else if (operands[2] == const1_rtx
10570 && (TARGET_SHIFT1 || optimize_size))
10571 return "sal{l}\t%k0";
10573 return "sal{l}\t{%2, %k0|%k0, %2}";
10576 [(set (attr "type")
10577 (cond [(and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10579 (match_operand 2 "const1_operand" ""))
10580 (const_string "alu")
10582 (const_string "ishift")))
10583 (set_attr "mode" "SI")])
10585 (define_expand "ashlhi3"
10586 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10587 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "")
10588 (match_operand:QI 2 "nonmemory_operand" "")))
10589 (clobber (reg:CC FLAGS_REG))]
10590 "TARGET_HIMODE_MATH"
10591 "ix86_expand_binary_operator (ASHIFT, HImode, operands); DONE;")
10593 (define_insn "*ashlhi3_1_lea"
10594 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
10595 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,l")
10596 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
10597 (clobber (reg:CC FLAGS_REG))]
10598 "!TARGET_PARTIAL_REG_STALL
10599 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10601 switch (get_attr_type (insn))
10606 if (operands[2] != const1_rtx)
10608 return "add{w}\t{%0, %0|%0, %0}";
10611 if (REG_P (operands[2]))
10612 return "sal{w}\t{%b2, %0|%0, %b2}";
10613 else if (operands[2] == const1_rtx
10614 && (TARGET_SHIFT1 || optimize_size))
10615 return "sal{w}\t%0";
10617 return "sal{w}\t{%2, %0|%0, %2}";
10620 [(set (attr "type")
10621 (cond [(eq_attr "alternative" "1")
10622 (const_string "lea")
10623 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10625 (match_operand 0 "register_operand" ""))
10626 (match_operand 2 "const1_operand" ""))
10627 (const_string "alu")
10629 (const_string "ishift")))
10630 (set_attr "mode" "HI,SI")])
10632 (define_insn "*ashlhi3_1"
10633 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10634 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
10635 (match_operand:QI 2 "nonmemory_operand" "cI")))
10636 (clobber (reg:CC FLAGS_REG))]
10637 "TARGET_PARTIAL_REG_STALL
10638 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10640 switch (get_attr_type (insn))
10643 if (operands[2] != const1_rtx)
10645 return "add{w}\t{%0, %0|%0, %0}";
10648 if (REG_P (operands[2]))
10649 return "sal{w}\t{%b2, %0|%0, %b2}";
10650 else if (operands[2] == const1_rtx
10651 && (TARGET_SHIFT1 || optimize_size))
10652 return "sal{w}\t%0";
10654 return "sal{w}\t{%2, %0|%0, %2}";
10657 [(set (attr "type")
10658 (cond [(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")])
10667 ;; This pattern can't accept a variable shift count, since shifts by
10668 ;; zero don't affect the flags. We assume that shifts by constant
10669 ;; zero are optimized away.
10670 (define_insn "*ashlhi3_cmp"
10671 [(set (reg FLAGS_REG)
10673 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
10674 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10676 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10677 (ashift:HI (match_dup 1) (match_dup 2)))]
10678 "ix86_match_ccmode (insn, CCGOCmode)
10679 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10681 switch (get_attr_type (insn))
10684 if (operands[2] != const1_rtx)
10686 return "add{w}\t{%0, %0|%0, %0}";
10689 if (REG_P (operands[2]))
10690 return "sal{w}\t{%b2, %0|%0, %b2}";
10691 else if (operands[2] == const1_rtx
10692 && (TARGET_SHIFT1 || optimize_size))
10693 return "sal{w}\t%0";
10695 return "sal{w}\t{%2, %0|%0, %2}";
10698 [(set (attr "type")
10699 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10701 (match_operand 0 "register_operand" ""))
10702 (match_operand 2 "const1_operand" ""))
10703 (const_string "alu")
10705 (const_string "ishift")))
10706 (set_attr "mode" "HI")])
10708 (define_expand "ashlqi3"
10709 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10710 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "")
10711 (match_operand:QI 2 "nonmemory_operand" "")))
10712 (clobber (reg:CC FLAGS_REG))]
10713 "TARGET_QIMODE_MATH"
10714 "ix86_expand_binary_operator (ASHIFT, QImode, operands); DONE;")
10716 ;; %%% Potential partial reg stall on alternative 2. What to do?
10718 (define_insn "*ashlqi3_1_lea"
10719 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,r")
10720 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,l")
10721 (match_operand:QI 2 "nonmemory_operand" "cI,cI,M")))
10722 (clobber (reg:CC FLAGS_REG))]
10723 "!TARGET_PARTIAL_REG_STALL
10724 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10726 switch (get_attr_type (insn))
10731 if (operands[2] != const1_rtx)
10733 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
10734 return "add{l}\t{%k0, %k0|%k0, %k0}";
10736 return "add{b}\t{%0, %0|%0, %0}";
10739 if (REG_P (operands[2]))
10741 if (get_attr_mode (insn) == MODE_SI)
10742 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10744 return "sal{b}\t{%b2, %0|%0, %b2}";
10746 else if (operands[2] == const1_rtx
10747 && (TARGET_SHIFT1 || optimize_size))
10749 if (get_attr_mode (insn) == MODE_SI)
10750 return "sal{l}\t%0";
10752 return "sal{b}\t%0";
10756 if (get_attr_mode (insn) == MODE_SI)
10757 return "sal{l}\t{%2, %k0|%k0, %2}";
10759 return "sal{b}\t{%2, %0|%0, %2}";
10763 [(set (attr "type")
10764 (cond [(eq_attr "alternative" "2")
10765 (const_string "lea")
10766 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10768 (match_operand 0 "register_operand" ""))
10769 (match_operand 2 "const1_operand" ""))
10770 (const_string "alu")
10772 (const_string "ishift")))
10773 (set_attr "mode" "QI,SI,SI")])
10775 (define_insn "*ashlqi3_1"
10776 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10777 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
10778 (match_operand:QI 2 "nonmemory_operand" "cI,cI")))
10779 (clobber (reg:CC FLAGS_REG))]
10780 "TARGET_PARTIAL_REG_STALL
10781 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10783 switch (get_attr_type (insn))
10786 if (operands[2] != const1_rtx)
10788 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
10789 return "add{l}\t{%k0, %k0|%k0, %k0}";
10791 return "add{b}\t{%0, %0|%0, %0}";
10794 if (REG_P (operands[2]))
10796 if (get_attr_mode (insn) == MODE_SI)
10797 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10799 return "sal{b}\t{%b2, %0|%0, %b2}";
10801 else if (operands[2] == const1_rtx
10802 && (TARGET_SHIFT1 || optimize_size))
10804 if (get_attr_mode (insn) == MODE_SI)
10805 return "sal{l}\t%0";
10807 return "sal{b}\t%0";
10811 if (get_attr_mode (insn) == MODE_SI)
10812 return "sal{l}\t{%2, %k0|%k0, %2}";
10814 return "sal{b}\t{%2, %0|%0, %2}";
10818 [(set (attr "type")
10819 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10821 (match_operand 0 "register_operand" ""))
10822 (match_operand 2 "const1_operand" ""))
10823 (const_string "alu")
10825 (const_string "ishift")))
10826 (set_attr "mode" "QI,SI")])
10828 ;; This pattern can't accept a variable shift count, since shifts by
10829 ;; zero don't affect the flags. We assume that shifts by constant
10830 ;; zero are optimized away.
10831 (define_insn "*ashlqi3_cmp"
10832 [(set (reg FLAGS_REG)
10834 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
10835 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10837 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
10838 (ashift:QI (match_dup 1) (match_dup 2)))]
10839 "ix86_match_ccmode (insn, CCGOCmode)
10840 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10842 switch (get_attr_type (insn))
10845 if (operands[2] != const1_rtx)
10847 return "add{b}\t{%0, %0|%0, %0}";
10850 if (REG_P (operands[2]))
10851 return "sal{b}\t{%b2, %0|%0, %b2}";
10852 else if (operands[2] == const1_rtx
10853 && (TARGET_SHIFT1 || optimize_size))
10854 return "sal{b}\t%0";
10856 return "sal{b}\t{%2, %0|%0, %2}";
10859 [(set (attr "type")
10860 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10862 (match_operand 0 "register_operand" ""))
10863 (match_operand 2 "const1_operand" ""))
10864 (const_string "alu")
10866 (const_string "ishift")))
10867 (set_attr "mode" "QI")])
10869 ;; See comment above `ashldi3' about how this works.
10871 (define_expand "ashrdi3"
10872 [(set (match_operand:DI 0 "shiftdi_operand" "")
10873 (ashiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
10874 (match_operand:QI 2 "nonmemory_operand" "")))]
10876 "ix86_expand_binary_operator (ASHIFTRT, DImode, operands); DONE;")
10878 (define_insn "*ashrdi3_63_rex64"
10879 [(set (match_operand:DI 0 "nonimmediate_operand" "=*d,rm")
10880 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "*a,0")
10881 (match_operand:DI 2 "const_int_operand" "i,i")))
10882 (clobber (reg:CC FLAGS_REG))]
10883 "TARGET_64BIT && INTVAL (operands[2]) == 63
10884 && (TARGET_USE_CLTD || optimize_size)
10885 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10888 sar{q}\t{%2, %0|%0, %2}"
10889 [(set_attr "type" "imovx,ishift")
10890 (set_attr "prefix_0f" "0,*")
10891 (set_attr "length_immediate" "0,*")
10892 (set_attr "modrm" "0,1")
10893 (set_attr "mode" "DI")])
10895 (define_insn "*ashrdi3_1_one_bit_rex64"
10896 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10897 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10898 (match_operand:QI 2 "const1_operand" "")))
10899 (clobber (reg:CC FLAGS_REG))]
10900 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)
10901 && (TARGET_SHIFT1 || optimize_size)"
10903 [(set_attr "type" "ishift")
10904 (set (attr "length")
10905 (if_then_else (match_operand:DI 0 "register_operand" "")
10907 (const_string "*")))])
10909 (define_insn "*ashrdi3_1_rex64"
10910 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
10911 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
10912 (match_operand:QI 2 "nonmemory_operand" "J,c")))
10913 (clobber (reg:CC FLAGS_REG))]
10914 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10916 sar{q}\t{%2, %0|%0, %2}
10917 sar{q}\t{%b2, %0|%0, %b2}"
10918 [(set_attr "type" "ishift")
10919 (set_attr "mode" "DI")])
10921 ;; This pattern can't accept a variable shift count, since shifts by
10922 ;; zero don't affect the flags. We assume that shifts by constant
10923 ;; zero are optimized away.
10924 (define_insn "*ashrdi3_one_bit_cmp_rex64"
10925 [(set (reg FLAGS_REG)
10927 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10928 (match_operand:QI 2 "const1_operand" ""))
10930 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10931 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
10932 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10933 && (TARGET_SHIFT1 || optimize_size)
10934 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10936 [(set_attr "type" "ishift")
10937 (set (attr "length")
10938 (if_then_else (match_operand:DI 0 "register_operand" "")
10940 (const_string "*")))])
10942 ;; This pattern can't accept a variable shift count, since shifts by
10943 ;; zero don't affect the flags. We assume that shifts by constant
10944 ;; zero are optimized away.
10945 (define_insn "*ashrdi3_cmp_rex64"
10946 [(set (reg FLAGS_REG)
10948 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10949 (match_operand:QI 2 "const_int_operand" "n"))
10951 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10952 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
10953 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10954 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
10955 "sar{q}\t{%2, %0|%0, %2}"
10956 [(set_attr "type" "ishift")
10957 (set_attr "mode" "DI")])
10959 (define_insn "*ashrdi3_1"
10960 [(set (match_operand:DI 0 "register_operand" "=r")
10961 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
10962 (match_operand:QI 2 "nonmemory_operand" "Jc")))
10963 (clobber (reg:CC FLAGS_REG))]
10966 [(set_attr "type" "multi")])
10968 ;; By default we don't ask for a scratch register, because when DImode
10969 ;; values are manipulated, registers are already at a premium. But if
10970 ;; we have one handy, we won't turn it away.
10972 [(match_scratch:SI 3 "r")
10973 (parallel [(set (match_operand:DI 0 "register_operand" "")
10974 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
10975 (match_operand:QI 2 "nonmemory_operand" "")))
10976 (clobber (reg:CC FLAGS_REG))])
10978 "!TARGET_64BIT && TARGET_CMOVE"
10980 "ix86_split_ashrdi (operands, operands[3]); DONE;")
10983 [(set (match_operand:DI 0 "register_operand" "")
10984 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
10985 (match_operand:QI 2 "nonmemory_operand" "")))
10986 (clobber (reg:CC FLAGS_REG))]
10987 "!TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)"
10989 "ix86_split_ashrdi (operands, NULL_RTX); DONE;")
10991 (define_insn "x86_shrd_1"
10992 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
10993 (ior:SI (ashiftrt:SI (match_dup 0)
10994 (match_operand:QI 2 "nonmemory_operand" "I,c"))
10995 (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
10996 (minus:QI (const_int 32) (match_dup 2)))))
10997 (clobber (reg:CC FLAGS_REG))]
11000 shrd{l}\t{%2, %1, %0|%0, %1, %2}
11001 shrd{l}\t{%s2%1, %0|%0, %1, %2}"
11002 [(set_attr "type" "ishift")
11003 (set_attr "prefix_0f" "1")
11004 (set_attr "pent_pair" "np")
11005 (set_attr "mode" "SI")])
11007 (define_expand "x86_shift_adj_3"
11008 [(use (match_operand:SI 0 "register_operand" ""))
11009 (use (match_operand:SI 1 "register_operand" ""))
11010 (use (match_operand:QI 2 "register_operand" ""))]
11013 rtx label = gen_label_rtx ();
11016 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
11018 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
11019 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
11020 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
11021 gen_rtx_LABEL_REF (VOIDmode, label),
11023 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
11024 JUMP_LABEL (tmp) = label;
11026 emit_move_insn (operands[0], operands[1]);
11027 emit_insn (gen_ashrsi3_31 (operands[1], operands[1], GEN_INT (31)));
11029 emit_label (label);
11030 LABEL_NUSES (label) = 1;
11035 (define_insn "ashrsi3_31"
11036 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,rm")
11037 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "*a,0")
11038 (match_operand:SI 2 "const_int_operand" "i,i")))
11039 (clobber (reg:CC FLAGS_REG))]
11040 "INTVAL (operands[2]) == 31 && (TARGET_USE_CLTD || optimize_size)
11041 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11044 sar{l}\t{%2, %0|%0, %2}"
11045 [(set_attr "type" "imovx,ishift")
11046 (set_attr "prefix_0f" "0,*")
11047 (set_attr "length_immediate" "0,*")
11048 (set_attr "modrm" "0,1")
11049 (set_attr "mode" "SI")])
11051 (define_insn "*ashrsi3_31_zext"
11052 [(set (match_operand:DI 0 "register_operand" "=*d,r")
11053 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "*a,0")
11054 (match_operand:SI 2 "const_int_operand" "i,i"))))
11055 (clobber (reg:CC FLAGS_REG))]
11056 "TARGET_64BIT && (TARGET_USE_CLTD || optimize_size)
11057 && INTVAL (operands[2]) == 31
11058 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11061 sar{l}\t{%2, %k0|%k0, %2}"
11062 [(set_attr "type" "imovx,ishift")
11063 (set_attr "prefix_0f" "0,*")
11064 (set_attr "length_immediate" "0,*")
11065 (set_attr "modrm" "0,1")
11066 (set_attr "mode" "SI")])
11068 (define_expand "ashrsi3"
11069 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11070 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11071 (match_operand:QI 2 "nonmemory_operand" "")))
11072 (clobber (reg:CC FLAGS_REG))]
11074 "ix86_expand_binary_operator (ASHIFTRT, SImode, operands); DONE;")
11076 (define_insn "*ashrsi3_1_one_bit"
11077 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11078 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11079 (match_operand:QI 2 "const1_operand" "")))
11080 (clobber (reg:CC FLAGS_REG))]
11081 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11082 && (TARGET_SHIFT1 || optimize_size)"
11084 [(set_attr "type" "ishift")
11085 (set (attr "length")
11086 (if_then_else (match_operand:SI 0 "register_operand" "")
11088 (const_string "*")))])
11090 (define_insn "*ashrsi3_1_one_bit_zext"
11091 [(set (match_operand:DI 0 "register_operand" "=r")
11092 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11093 (match_operand:QI 2 "const1_operand" ""))))
11094 (clobber (reg:CC FLAGS_REG))]
11095 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11096 && (TARGET_SHIFT1 || optimize_size)"
11098 [(set_attr "type" "ishift")
11099 (set_attr "length" "2")])
11101 (define_insn "*ashrsi3_1"
11102 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11103 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11104 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11105 (clobber (reg:CC FLAGS_REG))]
11106 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11108 sar{l}\t{%2, %0|%0, %2}
11109 sar{l}\t{%b2, %0|%0, %b2}"
11110 [(set_attr "type" "ishift")
11111 (set_attr "mode" "SI")])
11113 (define_insn "*ashrsi3_1_zext"
11114 [(set (match_operand:DI 0 "register_operand" "=r,r")
11115 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
11116 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11117 (clobber (reg:CC FLAGS_REG))]
11118 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11120 sar{l}\t{%2, %k0|%k0, %2}
11121 sar{l}\t{%b2, %k0|%k0, %b2}"
11122 [(set_attr "type" "ishift")
11123 (set_attr "mode" "SI")])
11125 ;; This pattern can't accept a variable shift count, since shifts by
11126 ;; zero don't affect the flags. We assume that shifts by constant
11127 ;; zero are optimized away.
11128 (define_insn "*ashrsi3_one_bit_cmp"
11129 [(set (reg FLAGS_REG)
11131 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11132 (match_operand:QI 2 "const1_operand" ""))
11134 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11135 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11136 "ix86_match_ccmode (insn, CCGOCmode)
11137 && (TARGET_SHIFT1 || optimize_size)
11138 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11140 [(set_attr "type" "ishift")
11141 (set (attr "length")
11142 (if_then_else (match_operand:SI 0 "register_operand" "")
11144 (const_string "*")))])
11146 (define_insn "*ashrsi3_one_bit_cmp_zext"
11147 [(set (reg FLAGS_REG)
11149 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11150 (match_operand:QI 2 "const1_operand" ""))
11152 (set (match_operand:DI 0 "register_operand" "=r")
11153 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11154 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
11155 && (TARGET_SHIFT1 || optimize_size)
11156 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11158 [(set_attr "type" "ishift")
11159 (set_attr "length" "2")])
11161 ;; This pattern can't accept a variable shift count, since shifts by
11162 ;; zero don't affect the flags. We assume that shifts by constant
11163 ;; zero are optimized away.
11164 (define_insn "*ashrsi3_cmp"
11165 [(set (reg FLAGS_REG)
11167 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11168 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11170 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11171 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11172 "ix86_match_ccmode (insn, CCGOCmode)
11173 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11174 "sar{l}\t{%2, %0|%0, %2}"
11175 [(set_attr "type" "ishift")
11176 (set_attr "mode" "SI")])
11178 (define_insn "*ashrsi3_cmp_zext"
11179 [(set (reg FLAGS_REG)
11181 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11182 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11184 (set (match_operand:DI 0 "register_operand" "=r")
11185 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11186 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11187 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11188 "sar{l}\t{%2, %k0|%k0, %2}"
11189 [(set_attr "type" "ishift")
11190 (set_attr "mode" "SI")])
11192 (define_expand "ashrhi3"
11193 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11194 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
11195 (match_operand:QI 2 "nonmemory_operand" "")))
11196 (clobber (reg:CC FLAGS_REG))]
11197 "TARGET_HIMODE_MATH"
11198 "ix86_expand_binary_operator (ASHIFTRT, HImode, operands); DONE;")
11200 (define_insn "*ashrhi3_1_one_bit"
11201 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11202 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11203 (match_operand:QI 2 "const1_operand" "")))
11204 (clobber (reg:CC FLAGS_REG))]
11205 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)
11206 && (TARGET_SHIFT1 || optimize_size)"
11208 [(set_attr "type" "ishift")
11209 (set (attr "length")
11210 (if_then_else (match_operand 0 "register_operand" "")
11212 (const_string "*")))])
11214 (define_insn "*ashrhi3_1"
11215 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11216 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11217 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11218 (clobber (reg:CC FLAGS_REG))]
11219 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11221 sar{w}\t{%2, %0|%0, %2}
11222 sar{w}\t{%b2, %0|%0, %b2}"
11223 [(set_attr "type" "ishift")
11224 (set_attr "mode" "HI")])
11226 ;; This pattern can't accept a variable shift count, since shifts by
11227 ;; zero don't affect the flags. We assume that shifts by constant
11228 ;; zero are optimized away.
11229 (define_insn "*ashrhi3_one_bit_cmp"
11230 [(set (reg FLAGS_REG)
11232 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11233 (match_operand:QI 2 "const1_operand" ""))
11235 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11236 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
11237 "ix86_match_ccmode (insn, CCGOCmode)
11238 && (TARGET_SHIFT1 || optimize_size)
11239 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11241 [(set_attr "type" "ishift")
11242 (set (attr "length")
11243 (if_then_else (match_operand 0 "register_operand" "")
11245 (const_string "*")))])
11247 ;; This pattern can't accept a variable shift count, since shifts by
11248 ;; zero don't affect the flags. We assume that shifts by constant
11249 ;; zero are optimized away.
11250 (define_insn "*ashrhi3_cmp"
11251 [(set (reg FLAGS_REG)
11253 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11254 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11256 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11257 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
11258 "ix86_match_ccmode (insn, CCGOCmode)
11259 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11260 "sar{w}\t{%2, %0|%0, %2}"
11261 [(set_attr "type" "ishift")
11262 (set_attr "mode" "HI")])
11264 (define_expand "ashrqi3"
11265 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11266 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
11267 (match_operand:QI 2 "nonmemory_operand" "")))
11268 (clobber (reg:CC FLAGS_REG))]
11269 "TARGET_QIMODE_MATH"
11270 "ix86_expand_binary_operator (ASHIFTRT, QImode, operands); DONE;")
11272 (define_insn "*ashrqi3_1_one_bit"
11273 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11274 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11275 (match_operand:QI 2 "const1_operand" "")))
11276 (clobber (reg:CC FLAGS_REG))]
11277 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
11278 && (TARGET_SHIFT1 || optimize_size)"
11280 [(set_attr "type" "ishift")
11281 (set (attr "length")
11282 (if_then_else (match_operand 0 "register_operand" "")
11284 (const_string "*")))])
11286 (define_insn "*ashrqi3_1_one_bit_slp"
11287 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11288 (ashiftrt:QI (match_dup 0)
11289 (match_operand:QI 1 "const1_operand" "")))
11290 (clobber (reg:CC FLAGS_REG))]
11291 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
11292 && (! TARGET_PARTIAL_REG_STALL || optimize_size)
11293 && (TARGET_SHIFT1 || optimize_size)"
11295 [(set_attr "type" "ishift1")
11296 (set (attr "length")
11297 (if_then_else (match_operand 0 "register_operand" "")
11299 (const_string "*")))])
11301 (define_insn "*ashrqi3_1"
11302 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11303 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11304 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11305 (clobber (reg:CC FLAGS_REG))]
11306 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11308 sar{b}\t{%2, %0|%0, %2}
11309 sar{b}\t{%b2, %0|%0, %b2}"
11310 [(set_attr "type" "ishift")
11311 (set_attr "mode" "QI")])
11313 (define_insn "*ashrqi3_1_slp"
11314 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11315 (ashiftrt:QI (match_dup 0)
11316 (match_operand:QI 1 "nonmemory_operand" "I,c")))
11317 (clobber (reg:CC FLAGS_REG))]
11318 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11319 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
11321 sar{b}\t{%1, %0|%0, %1}
11322 sar{b}\t{%b1, %0|%0, %b1}"
11323 [(set_attr "type" "ishift1")
11324 (set_attr "mode" "QI")])
11326 ;; This pattern can't accept a variable shift count, since shifts by
11327 ;; zero don't affect the flags. We assume that shifts by constant
11328 ;; zero are optimized away.
11329 (define_insn "*ashrqi3_one_bit_cmp"
11330 [(set (reg FLAGS_REG)
11332 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11333 (match_operand:QI 2 "const1_operand" "I"))
11335 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11336 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
11337 "ix86_match_ccmode (insn, CCGOCmode)
11338 && (TARGET_SHIFT1 || optimize_size)
11339 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11341 [(set_attr "type" "ishift")
11342 (set (attr "length")
11343 (if_then_else (match_operand 0 "register_operand" "")
11345 (const_string "*")))])
11347 ;; This pattern can't accept a variable shift count, since shifts by
11348 ;; zero don't affect the flags. We assume that shifts by constant
11349 ;; zero are optimized away.
11350 (define_insn "*ashrqi3_cmp"
11351 [(set (reg FLAGS_REG)
11353 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11354 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11356 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11357 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
11358 "ix86_match_ccmode (insn, CCGOCmode)
11359 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11360 "sar{b}\t{%2, %0|%0, %2}"
11361 [(set_attr "type" "ishift")
11362 (set_attr "mode" "QI")])
11364 ;; Logical shift instructions
11366 ;; See comment above `ashldi3' about how this works.
11368 (define_expand "lshrdi3"
11369 [(set (match_operand:DI 0 "shiftdi_operand" "")
11370 (lshiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
11371 (match_operand:QI 2 "nonmemory_operand" "")))]
11373 "ix86_expand_binary_operator (LSHIFTRT, DImode, operands); DONE;")
11375 (define_insn "*lshrdi3_1_one_bit_rex64"
11376 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11377 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11378 (match_operand:QI 2 "const1_operand" "")))
11379 (clobber (reg:CC FLAGS_REG))]
11380 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11381 && (TARGET_SHIFT1 || optimize_size)"
11383 [(set_attr "type" "ishift")
11384 (set (attr "length")
11385 (if_then_else (match_operand:DI 0 "register_operand" "")
11387 (const_string "*")))])
11389 (define_insn "*lshrdi3_1_rex64"
11390 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11391 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11392 (match_operand:QI 2 "nonmemory_operand" "J,c")))
11393 (clobber (reg:CC FLAGS_REG))]
11394 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11396 shr{q}\t{%2, %0|%0, %2}
11397 shr{q}\t{%b2, %0|%0, %b2}"
11398 [(set_attr "type" "ishift")
11399 (set_attr "mode" "DI")])
11401 ;; This pattern can't accept a variable shift count, since shifts by
11402 ;; zero don't affect the flags. We assume that shifts by constant
11403 ;; zero are optimized away.
11404 (define_insn "*lshrdi3_cmp_one_bit_rex64"
11405 [(set (reg FLAGS_REG)
11407 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11408 (match_operand:QI 2 "const1_operand" ""))
11410 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11411 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
11412 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11413 && (TARGET_SHIFT1 || optimize_size)
11414 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11416 [(set_attr "type" "ishift")
11417 (set (attr "length")
11418 (if_then_else (match_operand:DI 0 "register_operand" "")
11420 (const_string "*")))])
11422 ;; This pattern can't accept a variable shift count, since shifts by
11423 ;; zero don't affect the flags. We assume that shifts by constant
11424 ;; zero are optimized away.
11425 (define_insn "*lshrdi3_cmp_rex64"
11426 [(set (reg FLAGS_REG)
11428 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11429 (match_operand:QI 2 "const_int_operand" "e"))
11431 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11432 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
11433 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11434 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11435 "shr{q}\t{%2, %0|%0, %2}"
11436 [(set_attr "type" "ishift")
11437 (set_attr "mode" "DI")])
11439 (define_insn "*lshrdi3_1"
11440 [(set (match_operand:DI 0 "register_operand" "=r")
11441 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
11442 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11443 (clobber (reg:CC FLAGS_REG))]
11446 [(set_attr "type" "multi")])
11448 ;; By default we don't ask for a scratch register, because when DImode
11449 ;; values are manipulated, registers are already at a premium. But if
11450 ;; we have one handy, we won't turn it away.
11452 [(match_scratch:SI 3 "r")
11453 (parallel [(set (match_operand:DI 0 "register_operand" "")
11454 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
11455 (match_operand:QI 2 "nonmemory_operand" "")))
11456 (clobber (reg:CC FLAGS_REG))])
11458 "!TARGET_64BIT && TARGET_CMOVE"
11460 "ix86_split_lshrdi (operands, operands[3]); DONE;")
11463 [(set (match_operand:DI 0 "register_operand" "")
11464 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
11465 (match_operand:QI 2 "nonmemory_operand" "")))
11466 (clobber (reg:CC FLAGS_REG))]
11467 "!TARGET_64BIT && (flag_peephole2 ? flow2_completed : reload_completed)"
11469 "ix86_split_lshrdi (operands, NULL_RTX); DONE;")
11471 (define_expand "lshrsi3"
11472 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11473 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11474 (match_operand:QI 2 "nonmemory_operand" "")))
11475 (clobber (reg:CC FLAGS_REG))]
11477 "ix86_expand_binary_operator (LSHIFTRT, SImode, operands); DONE;")
11479 (define_insn "*lshrsi3_1_one_bit"
11480 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11481 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11482 (match_operand:QI 2 "const1_operand" "")))
11483 (clobber (reg:CC FLAGS_REG))]
11484 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11485 && (TARGET_SHIFT1 || optimize_size)"
11487 [(set_attr "type" "ishift")
11488 (set (attr "length")
11489 (if_then_else (match_operand:SI 0 "register_operand" "")
11491 (const_string "*")))])
11493 (define_insn "*lshrsi3_1_one_bit_zext"
11494 [(set (match_operand:DI 0 "register_operand" "=r")
11495 (lshiftrt:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
11496 (match_operand:QI 2 "const1_operand" "")))
11497 (clobber (reg:CC FLAGS_REG))]
11498 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11499 && (TARGET_SHIFT1 || optimize_size)"
11501 [(set_attr "type" "ishift")
11502 (set_attr "length" "2")])
11504 (define_insn "*lshrsi3_1"
11505 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11506 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11507 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11508 (clobber (reg:CC FLAGS_REG))]
11509 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11511 shr{l}\t{%2, %0|%0, %2}
11512 shr{l}\t{%b2, %0|%0, %b2}"
11513 [(set_attr "type" "ishift")
11514 (set_attr "mode" "SI")])
11516 (define_insn "*lshrsi3_1_zext"
11517 [(set (match_operand:DI 0 "register_operand" "=r,r")
11519 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11520 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11521 (clobber (reg:CC FLAGS_REG))]
11522 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11524 shr{l}\t{%2, %k0|%k0, %2}
11525 shr{l}\t{%b2, %k0|%k0, %b2}"
11526 [(set_attr "type" "ishift")
11527 (set_attr "mode" "SI")])
11529 ;; This pattern can't accept a variable shift count, since shifts by
11530 ;; zero don't affect the flags. We assume that shifts by constant
11531 ;; zero are optimized away.
11532 (define_insn "*lshrsi3_one_bit_cmp"
11533 [(set (reg FLAGS_REG)
11535 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11536 (match_operand:QI 2 "const1_operand" ""))
11538 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11539 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
11540 "ix86_match_ccmode (insn, CCGOCmode)
11541 && (TARGET_SHIFT1 || optimize_size)
11542 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11544 [(set_attr "type" "ishift")
11545 (set (attr "length")
11546 (if_then_else (match_operand:SI 0 "register_operand" "")
11548 (const_string "*")))])
11550 (define_insn "*lshrsi3_cmp_one_bit_zext"
11551 [(set (reg FLAGS_REG)
11553 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
11554 (match_operand:QI 2 "const1_operand" ""))
11556 (set (match_operand:DI 0 "register_operand" "=r")
11557 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
11558 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11559 && (TARGET_SHIFT1 || optimize_size)
11560 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11562 [(set_attr "type" "ishift")
11563 (set_attr "length" "2")])
11565 ;; This pattern can't accept a variable shift count, since shifts by
11566 ;; zero don't affect the flags. We assume that shifts by constant
11567 ;; zero are optimized away.
11568 (define_insn "*lshrsi3_cmp"
11569 [(set (reg FLAGS_REG)
11571 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11572 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11574 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11575 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
11576 "ix86_match_ccmode (insn, CCGOCmode)
11577 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11578 "shr{l}\t{%2, %0|%0, %2}"
11579 [(set_attr "type" "ishift")
11580 (set_attr "mode" "SI")])
11582 (define_insn "*lshrsi3_cmp_zext"
11583 [(set (reg FLAGS_REG)
11585 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
11586 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11588 (set (match_operand:DI 0 "register_operand" "=r")
11589 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
11590 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11591 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11592 "shr{l}\t{%2, %k0|%k0, %2}"
11593 [(set_attr "type" "ishift")
11594 (set_attr "mode" "SI")])
11596 (define_expand "lshrhi3"
11597 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11598 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
11599 (match_operand:QI 2 "nonmemory_operand" "")))
11600 (clobber (reg:CC FLAGS_REG))]
11601 "TARGET_HIMODE_MATH"
11602 "ix86_expand_binary_operator (LSHIFTRT, HImode, operands); DONE;")
11604 (define_insn "*lshrhi3_1_one_bit"
11605 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11606 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11607 (match_operand:QI 2 "const1_operand" "")))
11608 (clobber (reg:CC FLAGS_REG))]
11609 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11610 && (TARGET_SHIFT1 || optimize_size)"
11612 [(set_attr "type" "ishift")
11613 (set (attr "length")
11614 (if_then_else (match_operand 0 "register_operand" "")
11616 (const_string "*")))])
11618 (define_insn "*lshrhi3_1"
11619 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11620 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11621 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11622 (clobber (reg:CC FLAGS_REG))]
11623 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11625 shr{w}\t{%2, %0|%0, %2}
11626 shr{w}\t{%b2, %0|%0, %b2}"
11627 [(set_attr "type" "ishift")
11628 (set_attr "mode" "HI")])
11630 ;; This pattern can't accept a variable shift count, since shifts by
11631 ;; zero don't affect the flags. We assume that shifts by constant
11632 ;; zero are optimized away.
11633 (define_insn "*lshrhi3_one_bit_cmp"
11634 [(set (reg FLAGS_REG)
11636 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11637 (match_operand:QI 2 "const1_operand" ""))
11639 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11640 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
11641 "ix86_match_ccmode (insn, CCGOCmode)
11642 && (TARGET_SHIFT1 || optimize_size)
11643 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11645 [(set_attr "type" "ishift")
11646 (set (attr "length")
11647 (if_then_else (match_operand:SI 0 "register_operand" "")
11649 (const_string "*")))])
11651 ;; This pattern can't accept a variable shift count, since shifts by
11652 ;; zero don't affect the flags. We assume that shifts by constant
11653 ;; zero are optimized away.
11654 (define_insn "*lshrhi3_cmp"
11655 [(set (reg FLAGS_REG)
11657 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11658 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11660 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11661 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
11662 "ix86_match_ccmode (insn, CCGOCmode)
11663 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11664 "shr{w}\t{%2, %0|%0, %2}"
11665 [(set_attr "type" "ishift")
11666 (set_attr "mode" "HI")])
11668 (define_expand "lshrqi3"
11669 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11670 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
11671 (match_operand:QI 2 "nonmemory_operand" "")))
11672 (clobber (reg:CC FLAGS_REG))]
11673 "TARGET_QIMODE_MATH"
11674 "ix86_expand_binary_operator (LSHIFTRT, QImode, operands); DONE;")
11676 (define_insn "*lshrqi3_1_one_bit"
11677 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11678 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11679 (match_operand:QI 2 "const1_operand" "")))
11680 (clobber (reg:CC FLAGS_REG))]
11681 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)
11682 && (TARGET_SHIFT1 || optimize_size)"
11684 [(set_attr "type" "ishift")
11685 (set (attr "length")
11686 (if_then_else (match_operand 0 "register_operand" "")
11688 (const_string "*")))])
11690 (define_insn "*lshrqi3_1_one_bit_slp"
11691 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11692 (lshiftrt:QI (match_dup 0)
11693 (match_operand:QI 1 "const1_operand" "")))
11694 (clobber (reg:CC FLAGS_REG))]
11695 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11696 && (TARGET_SHIFT1 || optimize_size)"
11698 [(set_attr "type" "ishift1")
11699 (set (attr "length")
11700 (if_then_else (match_operand 0 "register_operand" "")
11702 (const_string "*")))])
11704 (define_insn "*lshrqi3_1"
11705 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11706 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11707 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11708 (clobber (reg:CC FLAGS_REG))]
11709 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11711 shr{b}\t{%2, %0|%0, %2}
11712 shr{b}\t{%b2, %0|%0, %b2}"
11713 [(set_attr "type" "ishift")
11714 (set_attr "mode" "QI")])
11716 (define_insn "*lshrqi3_1_slp"
11717 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11718 (lshiftrt:QI (match_dup 0)
11719 (match_operand:QI 1 "nonmemory_operand" "I,c")))
11720 (clobber (reg:CC FLAGS_REG))]
11721 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11722 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
11724 shr{b}\t{%1, %0|%0, %1}
11725 shr{b}\t{%b1, %0|%0, %b1}"
11726 [(set_attr "type" "ishift1")
11727 (set_attr "mode" "QI")])
11729 ;; This pattern can't accept a variable shift count, since shifts by
11730 ;; zero don't affect the flags. We assume that shifts by constant
11731 ;; zero are optimized away.
11732 (define_insn "*lshrqi2_one_bit_cmp"
11733 [(set (reg FLAGS_REG)
11735 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11736 (match_operand:QI 2 "const1_operand" ""))
11738 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11739 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
11740 "ix86_match_ccmode (insn, CCGOCmode)
11741 && (TARGET_SHIFT1 || optimize_size)
11742 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11744 [(set_attr "type" "ishift")
11745 (set (attr "length")
11746 (if_then_else (match_operand:SI 0 "register_operand" "")
11748 (const_string "*")))])
11750 ;; This pattern can't accept a variable shift count, since shifts by
11751 ;; zero don't affect the flags. We assume that shifts by constant
11752 ;; zero are optimized away.
11753 (define_insn "*lshrqi2_cmp"
11754 [(set (reg FLAGS_REG)
11756 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11757 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11759 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11760 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
11761 "ix86_match_ccmode (insn, CCGOCmode)
11762 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11763 "shr{b}\t{%2, %0|%0, %2}"
11764 [(set_attr "type" "ishift")
11765 (set_attr "mode" "QI")])
11767 ;; Rotate instructions
11769 (define_expand "rotldi3"
11770 [(set (match_operand:DI 0 "nonimmediate_operand" "")
11771 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "")
11772 (match_operand:QI 2 "nonmemory_operand" "")))
11773 (clobber (reg:CC FLAGS_REG))]
11775 "ix86_expand_binary_operator (ROTATE, DImode, operands); DONE;")
11777 (define_insn "*rotlsi3_1_one_bit_rex64"
11778 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11779 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11780 (match_operand:QI 2 "const1_operand" "")))
11781 (clobber (reg:CC FLAGS_REG))]
11782 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)
11783 && (TARGET_SHIFT1 || optimize_size)"
11785 [(set_attr "type" "rotate")
11786 (set (attr "length")
11787 (if_then_else (match_operand:DI 0 "register_operand" "")
11789 (const_string "*")))])
11791 (define_insn "*rotldi3_1_rex64"
11792 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11793 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11794 (match_operand:QI 2 "nonmemory_operand" "e,c")))
11795 (clobber (reg:CC FLAGS_REG))]
11796 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)"
11798 rol{q}\t{%2, %0|%0, %2}
11799 rol{q}\t{%b2, %0|%0, %b2}"
11800 [(set_attr "type" "rotate")
11801 (set_attr "mode" "DI")])
11803 (define_expand "rotlsi3"
11804 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11805 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "")
11806 (match_operand:QI 2 "nonmemory_operand" "")))
11807 (clobber (reg:CC FLAGS_REG))]
11809 "ix86_expand_binary_operator (ROTATE, SImode, operands); DONE;")
11811 (define_insn "*rotlsi3_1_one_bit"
11812 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11813 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11814 (match_operand:QI 2 "const1_operand" "")))
11815 (clobber (reg:CC FLAGS_REG))]
11816 "ix86_binary_operator_ok (ROTATE, SImode, operands)
11817 && (TARGET_SHIFT1 || optimize_size)"
11819 [(set_attr "type" "rotate")
11820 (set (attr "length")
11821 (if_then_else (match_operand:SI 0 "register_operand" "")
11823 (const_string "*")))])
11825 (define_insn "*rotlsi3_1_one_bit_zext"
11826 [(set (match_operand:DI 0 "register_operand" "=r")
11828 (rotate:SI (match_operand:SI 1 "register_operand" "0")
11829 (match_operand:QI 2 "const1_operand" ""))))
11830 (clobber (reg:CC FLAGS_REG))]
11831 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)
11832 && (TARGET_SHIFT1 || optimize_size)"
11834 [(set_attr "type" "rotate")
11835 (set_attr "length" "2")])
11837 (define_insn "*rotlsi3_1"
11838 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11839 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11840 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11841 (clobber (reg:CC FLAGS_REG))]
11842 "ix86_binary_operator_ok (ROTATE, SImode, operands)"
11844 rol{l}\t{%2, %0|%0, %2}
11845 rol{l}\t{%b2, %0|%0, %b2}"
11846 [(set_attr "type" "rotate")
11847 (set_attr "mode" "SI")])
11849 (define_insn "*rotlsi3_1_zext"
11850 [(set (match_operand:DI 0 "register_operand" "=r,r")
11852 (rotate:SI (match_operand:SI 1 "register_operand" "0,0")
11853 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11854 (clobber (reg:CC FLAGS_REG))]
11855 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)"
11857 rol{l}\t{%2, %k0|%k0, %2}
11858 rol{l}\t{%b2, %k0|%k0, %b2}"
11859 [(set_attr "type" "rotate")
11860 (set_attr "mode" "SI")])
11862 (define_expand "rotlhi3"
11863 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11864 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "")
11865 (match_operand:QI 2 "nonmemory_operand" "")))
11866 (clobber (reg:CC FLAGS_REG))]
11867 "TARGET_HIMODE_MATH"
11868 "ix86_expand_binary_operator (ROTATE, HImode, operands); DONE;")
11870 (define_insn "*rotlhi3_1_one_bit"
11871 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11872 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11873 (match_operand:QI 2 "const1_operand" "")))
11874 (clobber (reg:CC FLAGS_REG))]
11875 "ix86_binary_operator_ok (ROTATE, HImode, operands)
11876 && (TARGET_SHIFT1 || optimize_size)"
11878 [(set_attr "type" "rotate")
11879 (set (attr "length")
11880 (if_then_else (match_operand 0 "register_operand" "")
11882 (const_string "*")))])
11884 (define_insn "*rotlhi3_1"
11885 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11886 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11887 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11888 (clobber (reg:CC FLAGS_REG))]
11889 "ix86_binary_operator_ok (ROTATE, HImode, operands)"
11891 rol{w}\t{%2, %0|%0, %2}
11892 rol{w}\t{%b2, %0|%0, %b2}"
11893 [(set_attr "type" "rotate")
11894 (set_attr "mode" "HI")])
11896 (define_expand "rotlqi3"
11897 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11898 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "")
11899 (match_operand:QI 2 "nonmemory_operand" "")))
11900 (clobber (reg:CC FLAGS_REG))]
11901 "TARGET_QIMODE_MATH"
11902 "ix86_expand_binary_operator (ROTATE, QImode, operands); DONE;")
11904 (define_insn "*rotlqi3_1_one_bit_slp"
11905 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11906 (rotate:QI (match_dup 0)
11907 (match_operand:QI 1 "const1_operand" "")))
11908 (clobber (reg:CC FLAGS_REG))]
11909 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11910 && (TARGET_SHIFT1 || optimize_size)"
11912 [(set_attr "type" "rotate1")
11913 (set (attr "length")
11914 (if_then_else (match_operand 0 "register_operand" "")
11916 (const_string "*")))])
11918 (define_insn "*rotlqi3_1_one_bit"
11919 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11920 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11921 (match_operand:QI 2 "const1_operand" "")))
11922 (clobber (reg:CC FLAGS_REG))]
11923 "ix86_binary_operator_ok (ROTATE, QImode, operands)
11924 && (TARGET_SHIFT1 || optimize_size)"
11926 [(set_attr "type" "rotate")
11927 (set (attr "length")
11928 (if_then_else (match_operand 0 "register_operand" "")
11930 (const_string "*")))])
11932 (define_insn "*rotlqi3_1_slp"
11933 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11934 (rotate:QI (match_dup 0)
11935 (match_operand:QI 1 "nonmemory_operand" "I,c")))
11936 (clobber (reg:CC FLAGS_REG))]
11937 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11938 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
11940 rol{b}\t{%1, %0|%0, %1}
11941 rol{b}\t{%b1, %0|%0, %b1}"
11942 [(set_attr "type" "rotate1")
11943 (set_attr "mode" "QI")])
11945 (define_insn "*rotlqi3_1"
11946 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11947 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11948 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11949 (clobber (reg:CC FLAGS_REG))]
11950 "ix86_binary_operator_ok (ROTATE, QImode, operands)"
11952 rol{b}\t{%2, %0|%0, %2}
11953 rol{b}\t{%b2, %0|%0, %b2}"
11954 [(set_attr "type" "rotate")
11955 (set_attr "mode" "QI")])
11957 (define_expand "rotrdi3"
11958 [(set (match_operand:DI 0 "nonimmediate_operand" "")
11959 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "")
11960 (match_operand:QI 2 "nonmemory_operand" "")))
11961 (clobber (reg:CC FLAGS_REG))]
11963 "ix86_expand_binary_operator (ROTATERT, DImode, operands); DONE;")
11965 (define_insn "*rotrdi3_1_one_bit_rex64"
11966 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11967 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11968 (match_operand:QI 2 "const1_operand" "")))
11969 (clobber (reg:CC FLAGS_REG))]
11970 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)
11971 && (TARGET_SHIFT1 || optimize_size)"
11973 [(set_attr "type" "rotate")
11974 (set (attr "length")
11975 (if_then_else (match_operand:DI 0 "register_operand" "")
11977 (const_string "*")))])
11979 (define_insn "*rotrdi3_1_rex64"
11980 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11981 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11982 (match_operand:QI 2 "nonmemory_operand" "J,c")))
11983 (clobber (reg:CC FLAGS_REG))]
11984 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)"
11986 ror{q}\t{%2, %0|%0, %2}
11987 ror{q}\t{%b2, %0|%0, %b2}"
11988 [(set_attr "type" "rotate")
11989 (set_attr "mode" "DI")])
11991 (define_expand "rotrsi3"
11992 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11993 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "")
11994 (match_operand:QI 2 "nonmemory_operand" "")))
11995 (clobber (reg:CC FLAGS_REG))]
11997 "ix86_expand_binary_operator (ROTATERT, SImode, operands); DONE;")
11999 (define_insn "*rotrsi3_1_one_bit"
12000 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12001 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12002 (match_operand:QI 2 "const1_operand" "")))
12003 (clobber (reg:CC FLAGS_REG))]
12004 "ix86_binary_operator_ok (ROTATERT, SImode, operands)
12005 && (TARGET_SHIFT1 || optimize_size)"
12007 [(set_attr "type" "rotate")
12008 (set (attr "length")
12009 (if_then_else (match_operand:SI 0 "register_operand" "")
12011 (const_string "*")))])
12013 (define_insn "*rotrsi3_1_one_bit_zext"
12014 [(set (match_operand:DI 0 "register_operand" "=r")
12016 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
12017 (match_operand:QI 2 "const1_operand" ""))))
12018 (clobber (reg:CC FLAGS_REG))]
12019 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)
12020 && (TARGET_SHIFT1 || optimize_size)"
12022 [(set_attr "type" "rotate")
12023 (set (attr "length")
12024 (if_then_else (match_operand:SI 0 "register_operand" "")
12026 (const_string "*")))])
12028 (define_insn "*rotrsi3_1"
12029 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12030 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12031 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12032 (clobber (reg:CC FLAGS_REG))]
12033 "ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12035 ror{l}\t{%2, %0|%0, %2}
12036 ror{l}\t{%b2, %0|%0, %b2}"
12037 [(set_attr "type" "rotate")
12038 (set_attr "mode" "SI")])
12040 (define_insn "*rotrsi3_1_zext"
12041 [(set (match_operand:DI 0 "register_operand" "=r,r")
12043 (rotatert:SI (match_operand:SI 1 "register_operand" "0,0")
12044 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12045 (clobber (reg:CC FLAGS_REG))]
12046 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12048 ror{l}\t{%2, %k0|%k0, %2}
12049 ror{l}\t{%b2, %k0|%k0, %b2}"
12050 [(set_attr "type" "rotate")
12051 (set_attr "mode" "SI")])
12053 (define_expand "rotrhi3"
12054 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12055 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "")
12056 (match_operand:QI 2 "nonmemory_operand" "")))
12057 (clobber (reg:CC FLAGS_REG))]
12058 "TARGET_HIMODE_MATH"
12059 "ix86_expand_binary_operator (ROTATERT, HImode, operands); DONE;")
12061 (define_insn "*rotrhi3_one_bit"
12062 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12063 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12064 (match_operand:QI 2 "const1_operand" "")))
12065 (clobber (reg:CC FLAGS_REG))]
12066 "ix86_binary_operator_ok (ROTATERT, HImode, operands)
12067 && (TARGET_SHIFT1 || optimize_size)"
12069 [(set_attr "type" "rotate")
12070 (set (attr "length")
12071 (if_then_else (match_operand 0 "register_operand" "")
12073 (const_string "*")))])
12075 (define_insn "*rotrhi3"
12076 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12077 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12078 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12079 (clobber (reg:CC FLAGS_REG))]
12080 "ix86_binary_operator_ok (ROTATERT, HImode, operands)"
12082 ror{w}\t{%2, %0|%0, %2}
12083 ror{w}\t{%b2, %0|%0, %b2}"
12084 [(set_attr "type" "rotate")
12085 (set_attr "mode" "HI")])
12087 (define_expand "rotrqi3"
12088 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12089 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "")
12090 (match_operand:QI 2 "nonmemory_operand" "")))
12091 (clobber (reg:CC FLAGS_REG))]
12092 "TARGET_QIMODE_MATH"
12093 "ix86_expand_binary_operator (ROTATERT, QImode, operands); DONE;")
12095 (define_insn "*rotrqi3_1_one_bit"
12096 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12097 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12098 (match_operand:QI 2 "const1_operand" "")))
12099 (clobber (reg:CC FLAGS_REG))]
12100 "ix86_binary_operator_ok (ROTATERT, QImode, operands)
12101 && (TARGET_SHIFT1 || optimize_size)"
12103 [(set_attr "type" "rotate")
12104 (set (attr "length")
12105 (if_then_else (match_operand 0 "register_operand" "")
12107 (const_string "*")))])
12109 (define_insn "*rotrqi3_1_one_bit_slp"
12110 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12111 (rotatert:QI (match_dup 0)
12112 (match_operand:QI 1 "const1_operand" "")))
12113 (clobber (reg:CC FLAGS_REG))]
12114 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12115 && (TARGET_SHIFT1 || optimize_size)"
12117 [(set_attr "type" "rotate1")
12118 (set (attr "length")
12119 (if_then_else (match_operand 0 "register_operand" "")
12121 (const_string "*")))])
12123 (define_insn "*rotrqi3_1"
12124 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12125 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12126 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12127 (clobber (reg:CC FLAGS_REG))]
12128 "ix86_binary_operator_ok (ROTATERT, QImode, operands)"
12130 ror{b}\t{%2, %0|%0, %2}
12131 ror{b}\t{%b2, %0|%0, %b2}"
12132 [(set_attr "type" "rotate")
12133 (set_attr "mode" "QI")])
12135 (define_insn "*rotrqi3_1_slp"
12136 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12137 (rotatert:QI (match_dup 0)
12138 (match_operand:QI 1 "nonmemory_operand" "I,c")))
12139 (clobber (reg:CC FLAGS_REG))]
12140 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12141 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
12143 ror{b}\t{%1, %0|%0, %1}
12144 ror{b}\t{%b1, %0|%0, %b1}"
12145 [(set_attr "type" "rotate1")
12146 (set_attr "mode" "QI")])
12148 ;; Bit set / bit test instructions
12150 (define_expand "extv"
12151 [(set (match_operand:SI 0 "register_operand" "")
12152 (sign_extract:SI (match_operand:SI 1 "register_operand" "")
12153 (match_operand:SI 2 "immediate_operand" "")
12154 (match_operand:SI 3 "immediate_operand" "")))]
12157 /* Handle extractions from %ah et al. */
12158 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
12161 /* From mips.md: extract_bit_field doesn't verify that our source
12162 matches the predicate, so check it again here. */
12163 if (! ext_register_operand (operands[1], VOIDmode))
12167 (define_expand "extzv"
12168 [(set (match_operand:SI 0 "register_operand" "")
12169 (zero_extract:SI (match_operand 1 "ext_register_operand" "")
12170 (match_operand:SI 2 "immediate_operand" "")
12171 (match_operand:SI 3 "immediate_operand" "")))]
12174 /* Handle extractions from %ah et al. */
12175 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
12178 /* From mips.md: extract_bit_field doesn't verify that our source
12179 matches the predicate, so check it again here. */
12180 if (! ext_register_operand (operands[1], VOIDmode))
12184 (define_expand "insv"
12185 [(set (zero_extract (match_operand 0 "ext_register_operand" "")
12186 (match_operand 1 "immediate_operand" "")
12187 (match_operand 2 "immediate_operand" ""))
12188 (match_operand 3 "register_operand" ""))]
12191 /* Handle extractions from %ah et al. */
12192 if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) != 8)
12195 /* From mips.md: insert_bit_field doesn't verify that our source
12196 matches the predicate, so check it again here. */
12197 if (! ext_register_operand (operands[0], VOIDmode))
12201 emit_insn (gen_movdi_insv_1_rex64 (operands[0], operands[3]));
12203 emit_insn (gen_movsi_insv_1 (operands[0], operands[3]));
12208 ;; %%% bts, btr, btc, bt.
12209 ;; In general these instructions are *slow* when applied to memory,
12210 ;; since they enforce atomic operation. When applied to registers,
12211 ;; it depends on the cpu implementation. They're never faster than
12212 ;; the corresponding and/ior/xor operations, so with 32-bit there's
12213 ;; no point. But in 64-bit, we can't hold the relevant immediates
12214 ;; within the instruction itself, so operating on bits in the high
12215 ;; 32-bits of a register becomes easier.
12217 ;; These are slow on Nocona, but fast on Athlon64. We do require the use
12218 ;; of btrq and btcq for corner cases of post-reload expansion of absdf and
12219 ;; negdf respectively, so they can never be disabled entirely.
12221 (define_insn "*btsq"
12222 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
12224 (match_operand:DI 1 "const_0_to_63_operand" ""))
12226 (clobber (reg:CC FLAGS_REG))]
12227 "TARGET_64BIT && (TARGET_USE_BT || reload_completed)"
12229 [(set_attr "type" "alu1")])
12231 (define_insn "*btrq"
12232 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
12234 (match_operand:DI 1 "const_0_to_63_operand" ""))
12236 (clobber (reg:CC FLAGS_REG))]
12237 "TARGET_64BIT && (TARGET_USE_BT || reload_completed)"
12239 [(set_attr "type" "alu1")])
12241 (define_insn "*btcq"
12242 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
12244 (match_operand:DI 1 "const_0_to_63_operand" ""))
12245 (not:DI (zero_extract:DI (match_dup 0) (const_int 1) (match_dup 1))))
12246 (clobber (reg:CC FLAGS_REG))]
12247 "TARGET_64BIT && (TARGET_USE_BT || reload_completed)"
12249 [(set_attr "type" "alu1")])
12251 ;; Allow Nocona to avoid these instructions if a register is available.
12254 [(match_scratch:DI 2 "r")
12255 (parallel [(set (zero_extract:DI
12256 (match_operand:DI 0 "register_operand" "")
12258 (match_operand:DI 1 "const_0_to_63_operand" ""))
12260 (clobber (reg:CC FLAGS_REG))])]
12261 "TARGET_64BIT && !TARGET_USE_BT"
12264 HOST_WIDE_INT i = INTVAL (operands[1]), hi, lo;
12267 if (HOST_BITS_PER_WIDE_INT >= 64)
12268 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12269 else if (i < HOST_BITS_PER_WIDE_INT)
12270 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12272 lo = 0, hi = (HOST_WIDE_INT)1 << (i - HOST_BITS_PER_WIDE_INT);
12274 op1 = immed_double_const (lo, hi, DImode);
12277 emit_move_insn (operands[2], op1);
12281 emit_insn (gen_iordi3 (operands[0], operands[0], op1));
12286 [(match_scratch:DI 2 "r")
12287 (parallel [(set (zero_extract:DI
12288 (match_operand:DI 0 "register_operand" "")
12290 (match_operand:DI 1 "const_0_to_63_operand" ""))
12292 (clobber (reg:CC FLAGS_REG))])]
12293 "TARGET_64BIT && !TARGET_USE_BT"
12296 HOST_WIDE_INT i = INTVAL (operands[1]), hi, lo;
12299 if (HOST_BITS_PER_WIDE_INT >= 64)
12300 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12301 else if (i < HOST_BITS_PER_WIDE_INT)
12302 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12304 lo = 0, hi = (HOST_WIDE_INT)1 << (i - HOST_BITS_PER_WIDE_INT);
12306 op1 = immed_double_const (~lo, ~hi, DImode);
12309 emit_move_insn (operands[2], op1);
12313 emit_insn (gen_anddi3 (operands[0], operands[0], op1));
12318 [(match_scratch:DI 2 "r")
12319 (parallel [(set (zero_extract:DI
12320 (match_operand:DI 0 "register_operand" "")
12322 (match_operand:DI 1 "const_0_to_63_operand" ""))
12323 (not:DI (zero_extract:DI
12324 (match_dup 0) (const_int 1) (match_dup 1))))
12325 (clobber (reg:CC FLAGS_REG))])]
12326 "TARGET_64BIT && !TARGET_USE_BT"
12329 HOST_WIDE_INT i = INTVAL (operands[1]), hi, lo;
12332 if (HOST_BITS_PER_WIDE_INT >= 64)
12333 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12334 else if (i < HOST_BITS_PER_WIDE_INT)
12335 lo = (HOST_WIDE_INT)1 << i, hi = 0;
12337 lo = 0, hi = (HOST_WIDE_INT)1 << (i - HOST_BITS_PER_WIDE_INT);
12339 op1 = immed_double_const (lo, hi, DImode);
12342 emit_move_insn (operands[2], op1);
12346 emit_insn (gen_xordi3 (operands[0], operands[0], op1));
12350 ;; Store-flag instructions.
12352 ;; For all sCOND expanders, also expand the compare or test insn that
12353 ;; generates cc0. Generate an equality comparison if `seq' or `sne'.
12355 ;; %%% Do the expansion to SImode. If PII, do things the xor+setcc way
12356 ;; to avoid partial register stalls. Otherwise do things the setcc+movzx
12357 ;; way, which can later delete the movzx if only QImode is needed.
12359 (define_expand "seq"
12360 [(set (match_operand:QI 0 "register_operand" "")
12361 (eq:QI (reg:CC FLAGS_REG) (const_int 0)))]
12363 "if (ix86_expand_setcc (EQ, operands[0])) DONE; else FAIL;")
12365 (define_expand "sne"
12366 [(set (match_operand:QI 0 "register_operand" "")
12367 (ne:QI (reg:CC FLAGS_REG) (const_int 0)))]
12369 "if (ix86_expand_setcc (NE, operands[0])) DONE; else FAIL;")
12371 (define_expand "sgt"
12372 [(set (match_operand:QI 0 "register_operand" "")
12373 (gt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12375 "if (ix86_expand_setcc (GT, operands[0])) DONE; else FAIL;")
12377 (define_expand "sgtu"
12378 [(set (match_operand:QI 0 "register_operand" "")
12379 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12381 "if (ix86_expand_setcc (GTU, operands[0])) DONE; else FAIL;")
12383 (define_expand "slt"
12384 [(set (match_operand:QI 0 "register_operand" "")
12385 (lt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12387 "if (ix86_expand_setcc (LT, operands[0])) DONE; else FAIL;")
12389 (define_expand "sltu"
12390 [(set (match_operand:QI 0 "register_operand" "")
12391 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12393 "if (ix86_expand_setcc (LTU, operands[0])) DONE; else FAIL;")
12395 (define_expand "sge"
12396 [(set (match_operand:QI 0 "register_operand" "")
12397 (ge:QI (reg:CC FLAGS_REG) (const_int 0)))]
12399 "if (ix86_expand_setcc (GE, operands[0])) DONE; else FAIL;")
12401 (define_expand "sgeu"
12402 [(set (match_operand:QI 0 "register_operand" "")
12403 (geu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12405 "if (ix86_expand_setcc (GEU, operands[0])) DONE; else FAIL;")
12407 (define_expand "sle"
12408 [(set (match_operand:QI 0 "register_operand" "")
12409 (le:QI (reg:CC FLAGS_REG) (const_int 0)))]
12411 "if (ix86_expand_setcc (LE, operands[0])) DONE; else FAIL;")
12413 (define_expand "sleu"
12414 [(set (match_operand:QI 0 "register_operand" "")
12415 (leu:QI (reg:CC FLAGS_REG) (const_int 0)))]
12417 "if (ix86_expand_setcc (LEU, operands[0])) DONE; else FAIL;")
12419 (define_expand "sunordered"
12420 [(set (match_operand:QI 0 "register_operand" "")
12421 (unordered:QI (reg:CC FLAGS_REG) (const_int 0)))]
12422 "TARGET_80387 || TARGET_SSE"
12423 "if (ix86_expand_setcc (UNORDERED, operands[0])) DONE; else FAIL;")
12425 (define_expand "sordered"
12426 [(set (match_operand:QI 0 "register_operand" "")
12427 (ordered:QI (reg:CC FLAGS_REG) (const_int 0)))]
12429 "if (ix86_expand_setcc (ORDERED, operands[0])) DONE; else FAIL;")
12431 (define_expand "suneq"
12432 [(set (match_operand:QI 0 "register_operand" "")
12433 (uneq:QI (reg:CC FLAGS_REG) (const_int 0)))]
12434 "TARGET_80387 || TARGET_SSE"
12435 "if (ix86_expand_setcc (UNEQ, operands[0])) DONE; else FAIL;")
12437 (define_expand "sunge"
12438 [(set (match_operand:QI 0 "register_operand" "")
12439 (unge:QI (reg:CC FLAGS_REG) (const_int 0)))]
12440 "TARGET_80387 || TARGET_SSE"
12441 "if (ix86_expand_setcc (UNGE, operands[0])) DONE; else FAIL;")
12443 (define_expand "sungt"
12444 [(set (match_operand:QI 0 "register_operand" "")
12445 (ungt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12446 "TARGET_80387 || TARGET_SSE"
12447 "if (ix86_expand_setcc (UNGT, operands[0])) DONE; else FAIL;")
12449 (define_expand "sunle"
12450 [(set (match_operand:QI 0 "register_operand" "")
12451 (unle:QI (reg:CC FLAGS_REG) (const_int 0)))]
12452 "TARGET_80387 || TARGET_SSE"
12453 "if (ix86_expand_setcc (UNLE, operands[0])) DONE; else FAIL;")
12455 (define_expand "sunlt"
12456 [(set (match_operand:QI 0 "register_operand" "")
12457 (unlt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12458 "TARGET_80387 || TARGET_SSE"
12459 "if (ix86_expand_setcc (UNLT, operands[0])) DONE; else FAIL;")
12461 (define_expand "sltgt"
12462 [(set (match_operand:QI 0 "register_operand" "")
12463 (ltgt:QI (reg:CC FLAGS_REG) (const_int 0)))]
12464 "TARGET_80387 || TARGET_SSE"
12465 "if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")
12467 (define_insn "*setcc_1"
12468 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12469 (match_operator:QI 1 "ix86_comparison_operator"
12470 [(reg FLAGS_REG) (const_int 0)]))]
12473 [(set_attr "type" "setcc")
12474 (set_attr "mode" "QI")])
12476 (define_insn "*setcc_2"
12477 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12478 (match_operator:QI 1 "ix86_comparison_operator"
12479 [(reg FLAGS_REG) (const_int 0)]))]
12482 [(set_attr "type" "setcc")
12483 (set_attr "mode" "QI")])
12485 ;; In general it is not safe to assume too much about CCmode registers,
12486 ;; so simplify-rtx stops when it sees a second one. Under certain
12487 ;; conditions this is safe on x86, so help combine not create
12494 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12495 (ne:QI (match_operator 1 "ix86_comparison_operator"
12496 [(reg FLAGS_REG) (const_int 0)])
12499 [(set (match_dup 0) (match_dup 1))]
12501 PUT_MODE (operands[1], QImode);
12505 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
12506 (ne:QI (match_operator 1 "ix86_comparison_operator"
12507 [(reg FLAGS_REG) (const_int 0)])
12510 [(set (match_dup 0) (match_dup 1))]
12512 PUT_MODE (operands[1], QImode);
12516 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12517 (eq:QI (match_operator 1 "ix86_comparison_operator"
12518 [(reg FLAGS_REG) (const_int 0)])
12521 [(set (match_dup 0) (match_dup 1))]
12523 rtx new_op1 = copy_rtx (operands[1]);
12524 operands[1] = new_op1;
12525 PUT_MODE (new_op1, QImode);
12526 PUT_CODE (new_op1, ix86_reverse_condition (GET_CODE (new_op1),
12527 GET_MODE (XEXP (new_op1, 0))));
12529 /* Make sure that (a) the CCmode we have for the flags is strong
12530 enough for the reversed compare or (b) we have a valid FP compare. */
12531 if (! ix86_comparison_operator (new_op1, VOIDmode))
12536 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
12537 (eq:QI (match_operator 1 "ix86_comparison_operator"
12538 [(reg FLAGS_REG) (const_int 0)])
12541 [(set (match_dup 0) (match_dup 1))]
12543 rtx new_op1 = copy_rtx (operands[1]);
12544 operands[1] = new_op1;
12545 PUT_MODE (new_op1, QImode);
12546 PUT_CODE (new_op1, ix86_reverse_condition (GET_CODE (new_op1),
12547 GET_MODE (XEXP (new_op1, 0))));
12549 /* Make sure that (a) the CCmode we have for the flags is strong
12550 enough for the reversed compare or (b) we have a valid FP compare. */
12551 if (! ix86_comparison_operator (new_op1, VOIDmode))
12555 ;; The SSE store flag instructions saves 0 or 0xffffffff to the result.
12556 ;; subsequent logical operations are used to imitate conditional moves.
12557 ;; 0xffffffff is NaN, but not in normalized form, so we can't represent
12558 ;; it directly. Further holding this value in pseudo register might bring
12559 ;; problem in implicit normalization in spill code.
12560 ;; So we don't define FLOAT_STORE_FLAG_VALUE and create these
12561 ;; instructions after reload by splitting the conditional move patterns.
12563 (define_insn "*sse_setccsf"
12564 [(set (match_operand:SF 0 "register_operand" "=x")
12565 (match_operator:SF 1 "sse_comparison_operator"
12566 [(match_operand:SF 2 "register_operand" "0")
12567 (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
12568 "TARGET_SSE && reload_completed"
12569 "cmp%D1ss\t{%3, %0|%0, %3}"
12570 [(set_attr "type" "ssecmp")
12571 (set_attr "mode" "SF")])
12573 (define_insn "*sse_setccdf"
12574 [(set (match_operand:DF 0 "register_operand" "=Y")
12575 (match_operator:DF 1 "sse_comparison_operator"
12576 [(match_operand:DF 2 "register_operand" "0")
12577 (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
12578 "TARGET_SSE2 && reload_completed"
12579 "cmp%D1sd\t{%3, %0|%0, %3}"
12580 [(set_attr "type" "ssecmp")
12581 (set_attr "mode" "DF")])
12583 ;; Basic conditional jump instructions.
12584 ;; We ignore the overflow flag for signed branch instructions.
12586 ;; For all bCOND expanders, also expand the compare or test insn that
12587 ;; generates reg FLAGS_REG. Generate an equality comparison if `beq' or `bne'.
12589 (define_expand "beq"
12591 (if_then_else (match_dup 1)
12592 (label_ref (match_operand 0 "" ""))
12595 "ix86_expand_branch (EQ, operands[0]); DONE;")
12597 (define_expand "bne"
12599 (if_then_else (match_dup 1)
12600 (label_ref (match_operand 0 "" ""))
12603 "ix86_expand_branch (NE, operands[0]); DONE;")
12605 (define_expand "bgt"
12607 (if_then_else (match_dup 1)
12608 (label_ref (match_operand 0 "" ""))
12611 "ix86_expand_branch (GT, operands[0]); DONE;")
12613 (define_expand "bgtu"
12615 (if_then_else (match_dup 1)
12616 (label_ref (match_operand 0 "" ""))
12619 "ix86_expand_branch (GTU, operands[0]); DONE;")
12621 (define_expand "blt"
12623 (if_then_else (match_dup 1)
12624 (label_ref (match_operand 0 "" ""))
12627 "ix86_expand_branch (LT, operands[0]); DONE;")
12629 (define_expand "bltu"
12631 (if_then_else (match_dup 1)
12632 (label_ref (match_operand 0 "" ""))
12635 "ix86_expand_branch (LTU, operands[0]); DONE;")
12637 (define_expand "bge"
12639 (if_then_else (match_dup 1)
12640 (label_ref (match_operand 0 "" ""))
12643 "ix86_expand_branch (GE, operands[0]); DONE;")
12645 (define_expand "bgeu"
12647 (if_then_else (match_dup 1)
12648 (label_ref (match_operand 0 "" ""))
12651 "ix86_expand_branch (GEU, operands[0]); DONE;")
12653 (define_expand "ble"
12655 (if_then_else (match_dup 1)
12656 (label_ref (match_operand 0 "" ""))
12659 "ix86_expand_branch (LE, operands[0]); DONE;")
12661 (define_expand "bleu"
12663 (if_then_else (match_dup 1)
12664 (label_ref (match_operand 0 "" ""))
12667 "ix86_expand_branch (LEU, operands[0]); DONE;")
12669 (define_expand "bunordered"
12671 (if_then_else (match_dup 1)
12672 (label_ref (match_operand 0 "" ""))
12674 "TARGET_80387 || TARGET_SSE"
12675 "ix86_expand_branch (UNORDERED, operands[0]); DONE;")
12677 (define_expand "bordered"
12679 (if_then_else (match_dup 1)
12680 (label_ref (match_operand 0 "" ""))
12682 "TARGET_80387 || TARGET_SSE"
12683 "ix86_expand_branch (ORDERED, operands[0]); DONE;")
12685 (define_expand "buneq"
12687 (if_then_else (match_dup 1)
12688 (label_ref (match_operand 0 "" ""))
12690 "TARGET_80387 || TARGET_SSE"
12691 "ix86_expand_branch (UNEQ, operands[0]); DONE;")
12693 (define_expand "bunge"
12695 (if_then_else (match_dup 1)
12696 (label_ref (match_operand 0 "" ""))
12698 "TARGET_80387 || TARGET_SSE"
12699 "ix86_expand_branch (UNGE, operands[0]); DONE;")
12701 (define_expand "bungt"
12703 (if_then_else (match_dup 1)
12704 (label_ref (match_operand 0 "" ""))
12706 "TARGET_80387 || TARGET_SSE"
12707 "ix86_expand_branch (UNGT, operands[0]); DONE;")
12709 (define_expand "bunle"
12711 (if_then_else (match_dup 1)
12712 (label_ref (match_operand 0 "" ""))
12714 "TARGET_80387 || TARGET_SSE"
12715 "ix86_expand_branch (UNLE, operands[0]); DONE;")
12717 (define_expand "bunlt"
12719 (if_then_else (match_dup 1)
12720 (label_ref (match_operand 0 "" ""))
12722 "TARGET_80387 || TARGET_SSE"
12723 "ix86_expand_branch (UNLT, operands[0]); DONE;")
12725 (define_expand "bltgt"
12727 (if_then_else (match_dup 1)
12728 (label_ref (match_operand 0 "" ""))
12730 "TARGET_80387 || TARGET_SSE"
12731 "ix86_expand_branch (LTGT, operands[0]); DONE;")
12733 (define_insn "*jcc_1"
12735 (if_then_else (match_operator 1 "ix86_comparison_operator"
12736 [(reg FLAGS_REG) (const_int 0)])
12737 (label_ref (match_operand 0 "" ""))
12741 [(set_attr "type" "ibr")
12742 (set_attr "modrm" "0")
12743 (set (attr "length")
12744 (if_then_else (and (ge (minus (match_dup 0) (pc))
12746 (lt (minus (match_dup 0) (pc))
12751 (define_insn "*jcc_2"
12753 (if_then_else (match_operator 1 "ix86_comparison_operator"
12754 [(reg FLAGS_REG) (const_int 0)])
12756 (label_ref (match_operand 0 "" ""))))]
12759 [(set_attr "type" "ibr")
12760 (set_attr "modrm" "0")
12761 (set (attr "length")
12762 (if_then_else (and (ge (minus (match_dup 0) (pc))
12764 (lt (minus (match_dup 0) (pc))
12769 ;; In general it is not safe to assume too much about CCmode registers,
12770 ;; so simplify-rtx stops when it sees a second one. Under certain
12771 ;; conditions this is safe on x86, so help combine not create
12779 (if_then_else (ne (match_operator 0 "ix86_comparison_operator"
12780 [(reg FLAGS_REG) (const_int 0)])
12782 (label_ref (match_operand 1 "" ""))
12786 (if_then_else (match_dup 0)
12787 (label_ref (match_dup 1))
12790 PUT_MODE (operands[0], VOIDmode);
12795 (if_then_else (eq (match_operator 0 "ix86_comparison_operator"
12796 [(reg FLAGS_REG) (const_int 0)])
12798 (label_ref (match_operand 1 "" ""))
12802 (if_then_else (match_dup 0)
12803 (label_ref (match_dup 1))
12806 rtx new_op0 = copy_rtx (operands[0]);
12807 operands[0] = new_op0;
12808 PUT_MODE (new_op0, VOIDmode);
12809 PUT_CODE (new_op0, ix86_reverse_condition (GET_CODE (new_op0),
12810 GET_MODE (XEXP (new_op0, 0))));
12812 /* Make sure that (a) the CCmode we have for the flags is strong
12813 enough for the reversed compare or (b) we have a valid FP compare. */
12814 if (! ix86_comparison_operator (new_op0, VOIDmode))
12818 ;; Define combination compare-and-branch fp compare instructions to use
12819 ;; during early optimization. Splitting the operation apart early makes
12820 ;; for bad code when we want to reverse the operation.
12822 (define_insn "*fp_jcc_1"
12824 (if_then_else (match_operator 0 "comparison_operator"
12825 [(match_operand 1 "register_operand" "f")
12826 (match_operand 2 "register_operand" "f")])
12827 (label_ref (match_operand 3 "" ""))
12829 (clobber (reg:CCFP FPSR_REG))
12830 (clobber (reg:CCFP FLAGS_REG))]
12831 "TARGET_CMOVE && TARGET_80387
12832 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12833 && FLOAT_MODE_P (GET_MODE (operands[1]))
12834 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12835 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12838 (define_insn "*fp_jcc_1_sse"
12840 (if_then_else (match_operator 0 "comparison_operator"
12841 [(match_operand 1 "register_operand" "f#x,x#f")
12842 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
12843 (label_ref (match_operand 3 "" ""))
12845 (clobber (reg:CCFP FPSR_REG))
12846 (clobber (reg:CCFP FLAGS_REG))]
12848 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12849 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12850 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12853 (define_insn "*fp_jcc_1_sse_only"
12855 (if_then_else (match_operator 0 "comparison_operator"
12856 [(match_operand 1 "register_operand" "x")
12857 (match_operand 2 "nonimmediate_operand" "xm")])
12858 (label_ref (match_operand 3 "" ""))
12860 (clobber (reg:CCFP FPSR_REG))
12861 (clobber (reg:CCFP FLAGS_REG))]
12862 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12863 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12864 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12867 (define_insn "*fp_jcc_2"
12869 (if_then_else (match_operator 0 "comparison_operator"
12870 [(match_operand 1 "register_operand" "f")
12871 (match_operand 2 "register_operand" "f")])
12873 (label_ref (match_operand 3 "" ""))))
12874 (clobber (reg:CCFP FPSR_REG))
12875 (clobber (reg:CCFP FLAGS_REG))]
12876 "TARGET_CMOVE && TARGET_80387
12877 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12878 && FLOAT_MODE_P (GET_MODE (operands[1]))
12879 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12880 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12883 (define_insn "*fp_jcc_2_sse"
12885 (if_then_else (match_operator 0 "comparison_operator"
12886 [(match_operand 1 "register_operand" "f#x,x#f")
12887 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
12889 (label_ref (match_operand 3 "" ""))))
12890 (clobber (reg:CCFP FPSR_REG))
12891 (clobber (reg:CCFP FLAGS_REG))]
12893 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12894 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12895 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12898 (define_insn "*fp_jcc_2_sse_only"
12900 (if_then_else (match_operator 0 "comparison_operator"
12901 [(match_operand 1 "register_operand" "x")
12902 (match_operand 2 "nonimmediate_operand" "xm")])
12904 (label_ref (match_operand 3 "" ""))))
12905 (clobber (reg:CCFP FPSR_REG))
12906 (clobber (reg:CCFP FLAGS_REG))]
12907 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12908 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12909 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12912 (define_insn "*fp_jcc_3"
12914 (if_then_else (match_operator 0 "comparison_operator"
12915 [(match_operand 1 "register_operand" "f")
12916 (match_operand 2 "nonimmediate_operand" "fm")])
12917 (label_ref (match_operand 3 "" ""))
12919 (clobber (reg:CCFP FPSR_REG))
12920 (clobber (reg:CCFP FLAGS_REG))
12921 (clobber (match_scratch:HI 4 "=a"))]
12923 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
12924 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12925 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
12926 && SELECT_CC_MODE (GET_CODE (operands[0]),
12927 operands[1], operands[2]) == CCFPmode
12928 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12931 (define_insn "*fp_jcc_4"
12933 (if_then_else (match_operator 0 "comparison_operator"
12934 [(match_operand 1 "register_operand" "f")
12935 (match_operand 2 "nonimmediate_operand" "fm")])
12937 (label_ref (match_operand 3 "" ""))))
12938 (clobber (reg:CCFP FPSR_REG))
12939 (clobber (reg:CCFP FLAGS_REG))
12940 (clobber (match_scratch:HI 4 "=a"))]
12942 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
12943 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12944 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
12945 && SELECT_CC_MODE (GET_CODE (operands[0]),
12946 operands[1], operands[2]) == CCFPmode
12947 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12950 (define_insn "*fp_jcc_5"
12952 (if_then_else (match_operator 0 "comparison_operator"
12953 [(match_operand 1 "register_operand" "f")
12954 (match_operand 2 "register_operand" "f")])
12955 (label_ref (match_operand 3 "" ""))
12957 (clobber (reg:CCFP FPSR_REG))
12958 (clobber (reg:CCFP FLAGS_REG))
12959 (clobber (match_scratch:HI 4 "=a"))]
12961 && FLOAT_MODE_P (GET_MODE (operands[1]))
12962 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12963 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12966 (define_insn "*fp_jcc_6"
12968 (if_then_else (match_operator 0 "comparison_operator"
12969 [(match_operand 1 "register_operand" "f")
12970 (match_operand 2 "register_operand" "f")])
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 && FLOAT_MODE_P (GET_MODE (operands[1]))
12978 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12979 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12982 (define_insn "*fp_jcc_7"
12984 (if_then_else (match_operator 0 "comparison_operator"
12985 [(match_operand 1 "register_operand" "f")
12986 (match_operand 2 "const_double_operand" "C")])
12987 (label_ref (match_operand 3 "" ""))
12989 (clobber (reg:CCFP FPSR_REG))
12990 (clobber (reg:CCFP FLAGS_REG))
12991 (clobber (match_scratch:HI 4 "=a"))]
12993 && FLOAT_MODE_P (GET_MODE (operands[1]))
12994 && operands[2] == CONST0_RTX (GET_MODE (operands[1]))
12995 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
12996 && SELECT_CC_MODE (GET_CODE (operands[0]),
12997 operands[1], operands[2]) == CCFPmode
12998 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13001 ;; The order of operands in *fp_jcc_8 is forced by combine in
13002 ;; simplify_comparison () function. Float operator is treated as RTX_OBJ
13003 ;; with a precedence over other operators and is always put in the first
13004 ;; place. Swap condition and operands to match ficom instruction.
13006 (define_insn "*fp_jcc_8"
13008 (if_then_else (match_operator 0 "comparison_operator"
13009 [(match_operator 1 "float_operator"
13010 [(match_operand:SI 2 "nonimmediate_operand" "m,?r")])
13011 (match_operand 3 "register_operand" "f,f")])
13012 (label_ref (match_operand 4 "" ""))
13014 (clobber (reg:CCFP FPSR_REG))
13015 (clobber (reg:CCFP FLAGS_REG))
13016 (clobber (match_scratch:HI 5 "=a,a"))]
13017 "TARGET_80387 && TARGET_USE_FIOP
13018 && FLOAT_MODE_P (GET_MODE (operands[3]))
13019 && GET_MODE (operands[1]) == GET_MODE (operands[3])
13020 && !ix86_use_fcomi_compare (swap_condition (GET_CODE (operands[0])))
13021 && ix86_fp_compare_mode (swap_condition (GET_CODE (operands[0]))) == CCFPmode
13022 && ix86_fp_jump_nontrivial_p (swap_condition (GET_CODE (operands[0])))"
13027 (if_then_else (match_operator 0 "comparison_operator"
13028 [(match_operand 1 "register_operand" "")
13029 (match_operand 2 "nonimmediate_operand" "")])
13030 (match_operand 3 "" "")
13031 (match_operand 4 "" "")))
13032 (clobber (reg:CCFP FPSR_REG))
13033 (clobber (reg:CCFP FLAGS_REG))]
13037 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13038 operands[3], operands[4], NULL_RTX, NULL_RTX);
13044 (if_then_else (match_operator 0 "comparison_operator"
13045 [(match_operand 1 "register_operand" "")
13046 (match_operand 2 "general_operand" "")])
13047 (match_operand 3 "" "")
13048 (match_operand 4 "" "")))
13049 (clobber (reg:CCFP FPSR_REG))
13050 (clobber (reg:CCFP FLAGS_REG))
13051 (clobber (match_scratch:HI 5 "=a"))]
13055 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13056 operands[3], operands[4], operands[5], NULL_RTX);
13062 (if_then_else (match_operator 0 "comparison_operator"
13063 [(match_operator 1 "float_operator"
13064 [(match_operand:SI 2 "memory_operand" "")])
13065 (match_operand 3 "register_operand" "")])
13066 (match_operand 4 "" "")
13067 (match_operand 5 "" "")))
13068 (clobber (reg:CCFP FPSR_REG))
13069 (clobber (reg:CCFP FLAGS_REG))
13070 (clobber (match_scratch:HI 6 "=a"))]
13074 operands[7] = gen_rtx_FLOAT (GET_MODE (operands[1]), operands[2]);
13075 ix86_split_fp_branch (swap_condition (GET_CODE (operands[0])),
13076 operands[3], operands[7],
13077 operands[4], operands[5], operands[6], NULL_RTX);
13081 ;; %%% Kill this when reload knows how to do it.
13084 (if_then_else (match_operator 0 "comparison_operator"
13085 [(match_operator 1 "float_operator"
13086 [(match_operand:SI 2 "register_operand" "")])
13087 (match_operand 3 "register_operand" "")])
13088 (match_operand 4 "" "")
13089 (match_operand 5 "" "")))
13090 (clobber (reg:CCFP FPSR_REG))
13091 (clobber (reg:CCFP FLAGS_REG))
13092 (clobber (match_scratch:HI 6 "=a"))]
13096 operands[7] = ix86_force_to_memory (GET_MODE (operands[2]), operands[2]);
13097 operands[7] = gen_rtx_FLOAT (GET_MODE (operands[1]), operands[7]);
13098 ix86_split_fp_branch (swap_condition (GET_CODE (operands[0])),
13099 operands[3], operands[7],
13100 operands[4], operands[5], operands[6], operands[2]);
13104 ;; Unconditional and other jump instructions
13106 (define_insn "jump"
13108 (label_ref (match_operand 0 "" "")))]
13111 [(set_attr "type" "ibr")
13112 (set (attr "length")
13113 (if_then_else (and (ge (minus (match_dup 0) (pc))
13115 (lt (minus (match_dup 0) (pc))
13119 (set_attr "modrm" "0")])
13121 (define_expand "indirect_jump"
13122 [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))]
13126 (define_insn "*indirect_jump"
13127 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
13130 [(set_attr "type" "ibr")
13131 (set_attr "length_immediate" "0")])
13133 (define_insn "*indirect_jump_rtx64"
13134 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))]
13137 [(set_attr "type" "ibr")
13138 (set_attr "length_immediate" "0")])
13140 (define_expand "tablejump"
13141 [(parallel [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))
13142 (use (label_ref (match_operand 1 "" "")))])]
13145 /* In PIC mode, the table entries are stored GOT (32-bit) or PC (64-bit)
13146 relative. Convert the relative address to an absolute address. */
13150 enum rtx_code code;
13156 op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
13158 else if (TARGET_MACHO || HAVE_AS_GOTOFF_IN_DATA)
13162 op1 = pic_offset_table_rtx;
13167 op0 = pic_offset_table_rtx;
13171 operands[0] = expand_simple_binop (Pmode, code, op0, op1, NULL_RTX, 0,
13176 (define_insn "*tablejump_1"
13177 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))
13178 (use (label_ref (match_operand 1 "" "")))]
13181 [(set_attr "type" "ibr")
13182 (set_attr "length_immediate" "0")])
13184 (define_insn "*tablejump_1_rtx64"
13185 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))
13186 (use (label_ref (match_operand 1 "" "")))]
13189 [(set_attr "type" "ibr")
13190 (set_attr "length_immediate" "0")])
13192 ;; Loop instruction
13194 ;; This is all complicated by the fact that since this is a jump insn
13195 ;; we must handle our own reloads.
13197 (define_expand "doloop_end"
13198 [(use (match_operand 0 "" "")) ; loop pseudo
13199 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13200 (use (match_operand 2 "" "")) ; max iterations
13201 (use (match_operand 3 "" "")) ; loop level
13202 (use (match_operand 4 "" ""))] ; label
13203 "!TARGET_64BIT && TARGET_USE_LOOP"
13206 /* Only use cloop on innermost loops. */
13207 if (INTVAL (operands[3]) > 1)
13209 if (GET_MODE (operands[0]) != SImode)
13211 emit_jump_insn (gen_doloop_end_internal (operands[4], operands[0],
13216 (define_insn "doloop_end_internal"
13218 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,?*r,?*r")
13220 (label_ref (match_operand 0 "" ""))
13222 (set (match_operand:SI 2 "nonimmediate_operand" "=1,1,*m*r")
13223 (plus:SI (match_dup 1)
13225 (clobber (match_scratch:SI 3 "=X,X,r"))
13226 (clobber (reg:CC FLAGS_REG))]
13227 "!TARGET_64BIT && TARGET_USE_LOOP
13228 && (reload_in_progress || reload_completed
13229 || register_operand (operands[2], VOIDmode))"
13231 if (which_alternative != 0)
13233 if (get_attr_length (insn) == 2)
13234 return "%+loop\t%l0";
13236 return "dec{l}\t%1\;%+jne\t%l0";
13238 [(set (attr "length")
13239 (if_then_else (and (eq_attr "alternative" "0")
13240 (and (ge (minus (match_dup 0) (pc))
13242 (lt (minus (match_dup 0) (pc))
13246 ;; We don't know the type before shorten branches. Optimistically expect
13247 ;; the loop instruction to match.
13248 (set (attr "type") (const_string "ibr"))])
13252 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13254 (match_operand 0 "" "")
13257 (plus:SI (match_dup 1)
13259 (clobber (match_scratch:SI 2 ""))
13260 (clobber (reg:CC FLAGS_REG))]
13261 "!TARGET_64BIT && TARGET_USE_LOOP
13262 && reload_completed
13263 && REGNO (operands[1]) != 2"
13264 [(parallel [(set (reg:CCZ FLAGS_REG)
13265 (compare:CCZ (plus:SI (match_dup 1) (const_int -1))
13267 (set (match_dup 1) (plus:SI (match_dup 1) (const_int -1)))])
13268 (set (pc) (if_then_else (ne (reg:CCZ FLAGS_REG) (const_int 0))
13275 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13277 (match_operand 0 "" "")
13279 (set (match_operand:SI 2 "nonimmediate_operand" "")
13280 (plus:SI (match_dup 1)
13282 (clobber (match_scratch:SI 3 ""))
13283 (clobber (reg:CC FLAGS_REG))]
13284 "!TARGET_64BIT && TARGET_USE_LOOP
13285 && reload_completed
13286 && (! REG_P (operands[2])
13287 || ! rtx_equal_p (operands[1], operands[2]))"
13288 [(set (match_dup 3) (match_dup 1))
13289 (parallel [(set (reg:CCZ FLAGS_REG)
13290 (compare:CCZ (plus:SI (match_dup 3) (const_int -1))
13292 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
13293 (set (match_dup 2) (match_dup 3))
13294 (set (pc) (if_then_else (ne (reg:CCZ FLAGS_REG) (const_int 0))
13299 ;; Convert setcc + movzbl to xor + setcc if operands don't overlap.
13302 [(set (reg FLAGS_REG) (match_operand 0 "" ""))
13303 (set (match_operand:QI 1 "register_operand" "")
13304 (match_operator:QI 2 "ix86_comparison_operator"
13305 [(reg FLAGS_REG) (const_int 0)]))
13306 (set (match_operand 3 "q_regs_operand" "")
13307 (zero_extend (match_dup 1)))]
13308 "(peep2_reg_dead_p (3, operands[1])
13309 || operands_match_p (operands[1], operands[3]))
13310 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13311 [(set (match_dup 4) (match_dup 0))
13312 (set (strict_low_part (match_dup 5))
13315 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13316 operands[5] = gen_lowpart (QImode, operands[3]);
13317 ix86_expand_clear (operands[3]);
13320 ;; Similar, but match zero_extendhisi2_and, which adds a clobber.
13323 [(set (reg FLAGS_REG) (match_operand 0 "" ""))
13324 (set (match_operand:QI 1 "register_operand" "")
13325 (match_operator:QI 2 "ix86_comparison_operator"
13326 [(reg FLAGS_REG) (const_int 0)]))
13327 (parallel [(set (match_operand 3 "q_regs_operand" "")
13328 (zero_extend (match_dup 1)))
13329 (clobber (reg:CC FLAGS_REG))])]
13330 "(peep2_reg_dead_p (3, operands[1])
13331 || operands_match_p (operands[1], operands[3]))
13332 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13333 [(set (match_dup 4) (match_dup 0))
13334 (set (strict_low_part (match_dup 5))
13337 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13338 operands[5] = gen_lowpart (QImode, operands[3]);
13339 ix86_expand_clear (operands[3]);
13342 ;; Call instructions.
13344 ;; The predicates normally associated with named expanders are not properly
13345 ;; checked for calls. This is a bug in the generic code, but it isn't that
13346 ;; easy to fix. Ignore it for now and be prepared to fix things up.
13348 ;; Call subroutine returning no value.
13350 (define_expand "call_pop"
13351 [(parallel [(call (match_operand:QI 0 "" "")
13352 (match_operand:SI 1 "" ""))
13353 (set (reg:SI SP_REG)
13354 (plus:SI (reg:SI SP_REG)
13355 (match_operand:SI 3 "" "")))])]
13358 ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3], 0);
13362 (define_insn "*call_pop_0"
13363 [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" ""))
13364 (match_operand:SI 1 "" ""))
13365 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
13366 (match_operand:SI 2 "immediate_operand" "")))]
13369 if (SIBLING_CALL_P (insn))
13372 return "call\t%P0";
13374 [(set_attr "type" "call")])
13376 (define_insn "*call_pop_1"
13377 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
13378 (match_operand:SI 1 "" ""))
13379 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
13380 (match_operand:SI 2 "immediate_operand" "i")))]
13383 if (constant_call_address_operand (operands[0], Pmode))
13385 if (SIBLING_CALL_P (insn))
13388 return "call\t%P0";
13390 if (SIBLING_CALL_P (insn))
13393 return "call\t%A0";
13395 [(set_attr "type" "call")])
13397 (define_expand "call"
13398 [(call (match_operand:QI 0 "" "")
13399 (match_operand 1 "" ""))
13400 (use (match_operand 2 "" ""))]
13403 ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 0);
13407 (define_expand "sibcall"
13408 [(call (match_operand:QI 0 "" "")
13409 (match_operand 1 "" ""))
13410 (use (match_operand 2 "" ""))]
13413 ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 1);
13417 (define_insn "*call_0"
13418 [(call (mem:QI (match_operand 0 "constant_call_address_operand" ""))
13419 (match_operand 1 "" ""))]
13422 if (SIBLING_CALL_P (insn))
13425 return "call\t%P0";
13427 [(set_attr "type" "call")])
13429 (define_insn "*call_1"
13430 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
13431 (match_operand 1 "" ""))]
13432 "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
13434 if (constant_call_address_operand (operands[0], Pmode))
13435 return "call\t%P0";
13436 return "call\t%A0";
13438 [(set_attr "type" "call")])
13440 (define_insn "*sibcall_1"
13441 [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,c,d,a"))
13442 (match_operand 1 "" ""))]
13443 "SIBLING_CALL_P (insn) && !TARGET_64BIT"
13445 if (constant_call_address_operand (operands[0], Pmode))
13449 [(set_attr "type" "call")])
13451 (define_insn "*call_1_rex64"
13452 [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm"))
13453 (match_operand 1 "" ""))]
13454 "!SIBLING_CALL_P (insn) && TARGET_64BIT"
13456 if (constant_call_address_operand (operands[0], Pmode))
13457 return "call\t%P0";
13458 return "call\t%A0";
13460 [(set_attr "type" "call")])
13462 (define_insn "*sibcall_1_rex64"
13463 [(call (mem:QI (match_operand:DI 0 "constant_call_address_operand" ""))
13464 (match_operand 1 "" ""))]
13465 "SIBLING_CALL_P (insn) && TARGET_64BIT"
13467 [(set_attr "type" "call")])
13469 (define_insn "*sibcall_1_rex64_v"
13470 [(call (mem:QI (reg:DI 40))
13471 (match_operand 0 "" ""))]
13472 "SIBLING_CALL_P (insn) && TARGET_64BIT"
13474 [(set_attr "type" "call")])
13477 ;; Call subroutine, returning value in operand 0
13479 (define_expand "call_value_pop"
13480 [(parallel [(set (match_operand 0 "" "")
13481 (call (match_operand:QI 1 "" "")
13482 (match_operand:SI 2 "" "")))
13483 (set (reg:SI SP_REG)
13484 (plus:SI (reg:SI SP_REG)
13485 (match_operand:SI 4 "" "")))])]
13488 ix86_expand_call (operands[0], operands[1], operands[2],
13489 operands[3], operands[4], 0);
13493 (define_expand "call_value"
13494 [(set (match_operand 0 "" "")
13495 (call (match_operand:QI 1 "" "")
13496 (match_operand:SI 2 "" "")))
13497 (use (match_operand:SI 3 "" ""))]
13498 ;; Operand 2 not used on the i386.
13501 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 0);
13505 (define_expand "sibcall_value"
13506 [(set (match_operand 0 "" "")
13507 (call (match_operand:QI 1 "" "")
13508 (match_operand:SI 2 "" "")))
13509 (use (match_operand:SI 3 "" ""))]
13510 ;; Operand 2 not used on the i386.
13513 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 1);
13517 ;; Call subroutine returning any type.
13519 (define_expand "untyped_call"
13520 [(parallel [(call (match_operand 0 "" "")
13522 (match_operand 1 "" "")
13523 (match_operand 2 "" "")])]
13528 /* In order to give reg-stack an easier job in validating two
13529 coprocessor registers as containing a possible return value,
13530 simply pretend the untyped call returns a complex long double
13533 ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
13534 ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
13535 operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1),
13538 for (i = 0; i < XVECLEN (operands[2], 0); i++)
13540 rtx set = XVECEXP (operands[2], 0, i);
13541 emit_move_insn (SET_DEST (set), SET_SRC (set));
13544 /* The optimizer does not know that the call sets the function value
13545 registers we stored in the result block. We avoid problems by
13546 claiming that all hard registers are used and clobbered at this
13548 emit_insn (gen_blockage (const0_rtx));
13553 ;; Prologue and epilogue instructions
13555 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13556 ;; all of memory. This blocks insns from being moved across this point.
13558 (define_insn "blockage"
13559 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_BLOCKAGE)]
13562 [(set_attr "length" "0")])
13564 ;; Insn emitted into the body of a function to return from a function.
13565 ;; This is only done if the function's epilogue is known to be simple.
13566 ;; See comments for ix86_can_use_return_insn_p in i386.c.
13568 (define_expand "return"
13570 "ix86_can_use_return_insn_p ()"
13572 if (current_function_pops_args)
13574 rtx popc = GEN_INT (current_function_pops_args);
13575 emit_jump_insn (gen_return_pop_internal (popc));
13580 (define_insn "return_internal"
13584 [(set_attr "length" "1")
13585 (set_attr "length_immediate" "0")
13586 (set_attr "modrm" "0")])
13588 ;; Used by x86_machine_dependent_reorg to avoid penalty on single byte RET
13589 ;; instruction Athlon and K8 have.
13591 (define_insn "return_internal_long"
13593 (unspec [(const_int 0)] UNSPEC_REP)]
13596 [(set_attr "length" "1")
13597 (set_attr "length_immediate" "0")
13598 (set_attr "prefix_rep" "1")
13599 (set_attr "modrm" "0")])
13601 (define_insn "return_pop_internal"
13603 (use (match_operand:SI 0 "const_int_operand" ""))]
13606 [(set_attr "length" "3")
13607 (set_attr "length_immediate" "2")
13608 (set_attr "modrm" "0")])
13610 (define_insn "return_indirect_internal"
13612 (use (match_operand:SI 0 "register_operand" "r"))]
13615 [(set_attr "type" "ibr")
13616 (set_attr "length_immediate" "0")])
13622 [(set_attr "length" "1")
13623 (set_attr "length_immediate" "0")
13624 (set_attr "modrm" "0")])
13626 ;; Align to 16-byte boundary, max skip in op0. Used to avoid
13627 ;; branch prediction penalty for the third jump in a 16-byte
13630 (define_insn "align"
13631 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_ALIGN)]
13634 #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
13635 ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, (int)INTVAL (operands[0]));
13637 /* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that.
13638 The align insn is used to avoid 3 jump instructions in the row to improve
13639 branch prediction and the benefits hardly outweight the cost of extra 8
13640 nops on the average inserted by full alignment pseudo operation. */
13644 [(set_attr "length" "16")])
13646 (define_expand "prologue"
13649 "ix86_expand_prologue (); DONE;")
13651 (define_insn "set_got"
13652 [(set (match_operand:SI 0 "register_operand" "=r")
13653 (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
13654 (clobber (reg:CC FLAGS_REG))]
13656 { return output_set_got (operands[0]); }
13657 [(set_attr "type" "multi")
13658 (set_attr "length" "12")])
13660 (define_expand "epilogue"
13663 "ix86_expand_epilogue (1); DONE;")
13665 (define_expand "sibcall_epilogue"
13668 "ix86_expand_epilogue (0); DONE;")
13670 (define_expand "eh_return"
13671 [(use (match_operand 0 "register_operand" ""))]
13674 rtx tmp, sa = EH_RETURN_STACKADJ_RTX, ra = operands[0];
13676 /* Tricky bit: we write the address of the handler to which we will
13677 be returning into someone else's stack frame, one word below the
13678 stack address we wish to restore. */
13679 tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
13680 tmp = plus_constant (tmp, -UNITS_PER_WORD);
13681 tmp = gen_rtx_MEM (Pmode, tmp);
13682 emit_move_insn (tmp, ra);
13684 if (Pmode == SImode)
13685 emit_jump_insn (gen_eh_return_si (sa));
13687 emit_jump_insn (gen_eh_return_di (sa));
13692 (define_insn_and_split "eh_return_si"
13694 (unspec [(match_operand:SI 0 "register_operand" "c")]
13695 UNSPEC_EH_RETURN))]
13700 "ix86_expand_epilogue (2); DONE;")
13702 (define_insn_and_split "eh_return_di"
13704 (unspec [(match_operand:DI 0 "register_operand" "c")]
13705 UNSPEC_EH_RETURN))]
13710 "ix86_expand_epilogue (2); DONE;")
13712 (define_insn "leave"
13713 [(set (reg:SI SP_REG) (plus:SI (reg:SI BP_REG) (const_int 4)))
13714 (set (reg:SI BP_REG) (mem:SI (reg:SI BP_REG)))
13715 (clobber (mem:BLK (scratch)))]
13718 [(set_attr "type" "leave")])
13720 (define_insn "leave_rex64"
13721 [(set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
13722 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
13723 (clobber (mem:BLK (scratch)))]
13726 [(set_attr "type" "leave")])
13728 (define_expand "ffssi2"
13730 [(set (match_operand:SI 0 "register_operand" "")
13731 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "")))
13732 (clobber (match_scratch:SI 2 ""))
13733 (clobber (reg:CC FLAGS_REG))])]
13737 (define_insn_and_split "*ffs_cmove"
13738 [(set (match_operand:SI 0 "register_operand" "=r")
13739 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
13740 (clobber (match_scratch:SI 2 "=&r"))
13741 (clobber (reg:CC FLAGS_REG))]
13744 "&& reload_completed"
13745 [(set (match_dup 2) (const_int -1))
13746 (parallel [(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 1) (const_int 0)))
13747 (set (match_dup 0) (ctz:SI (match_dup 1)))])
13748 (set (match_dup 0) (if_then_else:SI
13749 (eq (reg:CCZ FLAGS_REG) (const_int 0))
13752 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
13753 (clobber (reg:CC FLAGS_REG))])]
13756 (define_insn_and_split "*ffs_no_cmove"
13757 [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
13758 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
13759 (clobber (match_scratch:SI 2 "=&q"))
13760 (clobber (reg:CC FLAGS_REG))]
13764 [(parallel [(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 1) (const_int 0)))
13765 (set (match_dup 0) (ctz:SI (match_dup 1)))])
13766 (set (strict_low_part (match_dup 3))
13767 (eq:QI (reg:CCZ FLAGS_REG) (const_int 0)))
13768 (parallel [(set (match_dup 2) (neg:SI (match_dup 2)))
13769 (clobber (reg:CC FLAGS_REG))])
13770 (parallel [(set (match_dup 0) (ior:SI (match_dup 0) (match_dup 2)))
13771 (clobber (reg:CC FLAGS_REG))])
13772 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
13773 (clobber (reg:CC FLAGS_REG))])]
13775 operands[3] = gen_lowpart (QImode, operands[2]);
13776 ix86_expand_clear (operands[2]);
13779 (define_insn "*ffssi_1"
13780 [(set (reg:CCZ FLAGS_REG)
13781 (compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm")
13783 (set (match_operand:SI 0 "register_operand" "=r")
13784 (ctz:SI (match_dup 1)))]
13786 "bsf{l}\t{%1, %0|%0, %1}"
13787 [(set_attr "prefix_0f" "1")])
13789 (define_expand "ffsdi2"
13791 [(set (match_operand:DI 0 "register_operand" "")
13792 (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "")))
13793 (clobber (match_scratch:DI 2 ""))
13794 (clobber (reg:CC FLAGS_REG))])]
13795 "TARGET_64BIT && TARGET_CMOVE"
13798 (define_insn_and_split "*ffs_rex64"
13799 [(set (match_operand:DI 0 "register_operand" "=r")
13800 (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
13801 (clobber (match_scratch:DI 2 "=&r"))
13802 (clobber (reg:CC FLAGS_REG))]
13803 "TARGET_64BIT && TARGET_CMOVE"
13805 "&& reload_completed"
13806 [(set (match_dup 2) (const_int -1))
13807 (parallel [(set (reg:CCZ FLAGS_REG)
13808 (compare:CCZ (match_dup 1) (const_int 0)))
13809 (set (match_dup 0) (ctz:DI (match_dup 1)))])
13810 (set (match_dup 0) (if_then_else:DI
13811 (eq (reg:CCZ FLAGS_REG) (const_int 0))
13814 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
13815 (clobber (reg:CC FLAGS_REG))])]
13818 (define_insn "*ffsdi_1"
13819 [(set (reg:CCZ FLAGS_REG)
13820 (compare:CCZ (match_operand:DI 1 "nonimmediate_operand" "rm")
13822 (set (match_operand:DI 0 "register_operand" "=r")
13823 (ctz:DI (match_dup 1)))]
13825 "bsf{q}\t{%1, %0|%0, %1}"
13826 [(set_attr "prefix_0f" "1")])
13828 (define_insn "ctzsi2"
13829 [(set (match_operand:SI 0 "register_operand" "=r")
13830 (ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
13831 (clobber (reg:CC FLAGS_REG))]
13833 "bsf{l}\t{%1, %0|%0, %1}"
13834 [(set_attr "prefix_0f" "1")])
13836 (define_insn "ctzdi2"
13837 [(set (match_operand:DI 0 "register_operand" "=r")
13838 (ctz:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
13839 (clobber (reg:CC FLAGS_REG))]
13841 "bsf{q}\t{%1, %0|%0, %1}"
13842 [(set_attr "prefix_0f" "1")])
13844 (define_expand "clzsi2"
13846 [(set (match_operand:SI 0 "register_operand" "")
13847 (minus:SI (const_int 31)
13848 (clz:SI (match_operand:SI 1 "nonimmediate_operand" ""))))
13849 (clobber (reg:CC FLAGS_REG))])
13851 [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 31)))
13852 (clobber (reg:CC FLAGS_REG))])]
13856 (define_insn "*bsr"
13857 [(set (match_operand:SI 0 "register_operand" "=r")
13858 (minus:SI (const_int 31)
13859 (clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))))
13860 (clobber (reg:CC FLAGS_REG))]
13862 "bsr{l}\t{%1, %0|%0, %1}"
13863 [(set_attr "prefix_0f" "1")])
13865 (define_expand "clzdi2"
13867 [(set (match_operand:DI 0 "register_operand" "")
13868 (minus:DI (const_int 63)
13869 (clz:DI (match_operand:DI 1 "nonimmediate_operand" ""))))
13870 (clobber (reg:CC FLAGS_REG))])
13872 [(set (match_dup 0) (xor:DI (match_dup 0) (const_int 63)))
13873 (clobber (reg:CC FLAGS_REG))])]
13877 (define_insn "*bsr_rex64"
13878 [(set (match_operand:DI 0 "register_operand" "=r")
13879 (minus:DI (const_int 63)
13880 (clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))))
13881 (clobber (reg:CC FLAGS_REG))]
13883 "bsr{q}\t{%1, %0|%0, %1}"
13884 [(set_attr "prefix_0f" "1")])
13886 ;; Thread-local storage patterns for ELF.
13888 ;; Note that these code sequences must appear exactly as shown
13889 ;; in order to allow linker relaxation.
13891 (define_insn "*tls_global_dynamic_32_gnu"
13892 [(set (match_operand:SI 0 "register_operand" "=a")
13893 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13894 (match_operand:SI 2 "tls_symbolic_operand" "")
13895 (match_operand:SI 3 "call_insn_operand" "")]
13897 (clobber (match_scratch:SI 4 "=d"))
13898 (clobber (match_scratch:SI 5 "=c"))
13899 (clobber (reg:CC FLAGS_REG))]
13900 "!TARGET_64BIT && TARGET_GNU_TLS"
13901 "lea{l}\t{%a2@TLSGD(,%1,1), %0|%0, %a2@TLSGD[%1*1]}\;call\t%P3"
13902 [(set_attr "type" "multi")
13903 (set_attr "length" "12")])
13905 (define_insn "*tls_global_dynamic_32_sun"
13906 [(set (match_operand:SI 0 "register_operand" "=a")
13907 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13908 (match_operand:SI 2 "tls_symbolic_operand" "")
13909 (match_operand:SI 3 "call_insn_operand" "")]
13911 (clobber (match_scratch:SI 4 "=d"))
13912 (clobber (match_scratch:SI 5 "=c"))
13913 (clobber (reg:CC FLAGS_REG))]
13914 "!TARGET_64BIT && TARGET_SUN_TLS"
13915 "lea{l}\t{%a2@DTLNDX(%1), %4|%4, %a2@DTLNDX[%1]}
13916 push{l}\t%4\;call\t%a2@TLSPLT\;pop{l}\t%4\;nop"
13917 [(set_attr "type" "multi")
13918 (set_attr "length" "14")])
13920 (define_expand "tls_global_dynamic_32"
13921 [(parallel [(set (match_operand:SI 0 "register_operand" "")
13924 (match_operand:SI 1 "tls_symbolic_operand" "")
13927 (clobber (match_scratch:SI 4 ""))
13928 (clobber (match_scratch:SI 5 ""))
13929 (clobber (reg:CC FLAGS_REG))])]
13933 operands[2] = pic_offset_table_rtx;
13936 operands[2] = gen_reg_rtx (Pmode);
13937 emit_insn (gen_set_got (operands[2]));
13939 operands[3] = ix86_tls_get_addr ();
13942 (define_insn "*tls_global_dynamic_64"
13943 [(set (match_operand:DI 0 "register_operand" "=a")
13944 (call (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
13945 (match_operand:DI 3 "" "")))
13946 (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
13949 ".byte\t0x66\;lea{q}\t{%a1@TLSGD(%%rip), %%rdi|%%rdi, %a1@TLSGD[%%rip]}\;.word\t0x6666\;rex64\;call\t%P2"
13950 [(set_attr "type" "multi")
13951 (set_attr "length" "16")])
13953 (define_expand "tls_global_dynamic_64"
13954 [(parallel [(set (match_operand:DI 0 "register_operand" "")
13955 (call (mem:QI (match_dup 2)) (const_int 0)))
13956 (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
13960 operands[2] = ix86_tls_get_addr ();
13963 (define_insn "*tls_local_dynamic_base_32_gnu"
13964 [(set (match_operand:SI 0 "register_operand" "=a")
13965 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13966 (match_operand:SI 2 "call_insn_operand" "")]
13967 UNSPEC_TLS_LD_BASE))
13968 (clobber (match_scratch:SI 3 "=d"))
13969 (clobber (match_scratch:SI 4 "=c"))
13970 (clobber (reg:CC FLAGS_REG))]
13971 "!TARGET_64BIT && TARGET_GNU_TLS"
13972 "lea{l}\t{%&@TLSLDM(%1), %0|%0, %&@TLSLDM[%1]}\;call\t%P2"
13973 [(set_attr "type" "multi")
13974 (set_attr "length" "11")])
13976 (define_insn "*tls_local_dynamic_base_32_sun"
13977 [(set (match_operand:SI 0 "register_operand" "=a")
13978 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13979 (match_operand:SI 2 "call_insn_operand" "")]
13980 UNSPEC_TLS_LD_BASE))
13981 (clobber (match_scratch:SI 3 "=d"))
13982 (clobber (match_scratch:SI 4 "=c"))
13983 (clobber (reg:CC FLAGS_REG))]
13984 "!TARGET_64BIT && TARGET_SUN_TLS"
13985 "lea{l}\t{%&@TMDNX(%1), %3|%3, %&@TMDNX[%1]}
13986 push{l}\t%3\;call\t%&@TLSPLT\;pop{l}\t%3"
13987 [(set_attr "type" "multi")
13988 (set_attr "length" "13")])
13990 (define_expand "tls_local_dynamic_base_32"
13991 [(parallel [(set (match_operand:SI 0 "register_operand" "")
13992 (unspec:SI [(match_dup 1) (match_dup 2)]
13993 UNSPEC_TLS_LD_BASE))
13994 (clobber (match_scratch:SI 3 ""))
13995 (clobber (match_scratch:SI 4 ""))
13996 (clobber (reg:CC FLAGS_REG))])]
14000 operands[1] = pic_offset_table_rtx;
14003 operands[1] = gen_reg_rtx (Pmode);
14004 emit_insn (gen_set_got (operands[1]));
14006 operands[2] = ix86_tls_get_addr ();
14009 (define_insn "*tls_local_dynamic_base_64"
14010 [(set (match_operand:DI 0 "register_operand" "=a")
14011 (call (mem:QI (match_operand:DI 1 "call_insn_operand" ""))
14012 (match_operand:DI 2 "" "")))
14013 (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)]
14015 "lea{q}\t{%&@TLSLD(%%rip), %%rdi|%%rdi, %&@TLSLD[%%rip]}\;call\t%P1"
14016 [(set_attr "type" "multi")
14017 (set_attr "length" "12")])
14019 (define_expand "tls_local_dynamic_base_64"
14020 [(parallel [(set (match_operand:DI 0 "register_operand" "")
14021 (call (mem:QI (match_dup 1)) (const_int 0)))
14022 (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)])]
14025 operands[1] = ix86_tls_get_addr ();
14028 ;; Local dynamic of a single variable is a lose. Show combine how
14029 ;; to convert that back to global dynamic.
14031 (define_insn_and_split "*tls_local_dynamic_32_once"
14032 [(set (match_operand:SI 0 "register_operand" "=a")
14033 (plus:SI (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14034 (match_operand:SI 2 "call_insn_operand" "")]
14035 UNSPEC_TLS_LD_BASE)
14036 (const:SI (unspec:SI
14037 [(match_operand:SI 3 "tls_symbolic_operand" "")]
14039 (clobber (match_scratch:SI 4 "=d"))
14040 (clobber (match_scratch:SI 5 "=c"))
14041 (clobber (reg:CC FLAGS_REG))]
14045 [(parallel [(set (match_dup 0)
14046 (unspec:SI [(match_dup 1) (match_dup 3) (match_dup 2)]
14048 (clobber (match_dup 4))
14049 (clobber (match_dup 5))
14050 (clobber (reg:CC FLAGS_REG))])]
14053 ;; Load and add the thread base pointer from %gs:0.
14055 (define_insn "*load_tp_si"
14056 [(set (match_operand:SI 0 "register_operand" "=r")
14057 (unspec:SI [(const_int 0)] UNSPEC_TP))]
14059 "mov{l}\t{%%gs:0, %0|%0, DWORD PTR %%gs:0}"
14060 [(set_attr "type" "imov")
14061 (set_attr "modrm" "0")
14062 (set_attr "length" "7")
14063 (set_attr "memory" "load")
14064 (set_attr "imm_disp" "false")])
14066 (define_insn "*add_tp_si"
14067 [(set (match_operand:SI 0 "register_operand" "=r")
14068 (plus:SI (unspec:SI [(const_int 0)] UNSPEC_TP)
14069 (match_operand:SI 1 "register_operand" "0")))
14070 (clobber (reg:CC FLAGS_REG))]
14072 "add{l}\t{%%gs:0, %0|%0, DWORD PTR %%gs:0}"
14073 [(set_attr "type" "alu")
14074 (set_attr "modrm" "0")
14075 (set_attr "length" "7")
14076 (set_attr "memory" "load")
14077 (set_attr "imm_disp" "false")])
14079 (define_insn "*load_tp_di"
14080 [(set (match_operand:DI 0 "register_operand" "=r")
14081 (unspec:DI [(const_int 0)] UNSPEC_TP))]
14083 "mov{q}\t{%%fs:0, %0|%0, QWORD PTR %%fs:0}"
14084 [(set_attr "type" "imov")
14085 (set_attr "modrm" "0")
14086 (set_attr "length" "7")
14087 (set_attr "memory" "load")
14088 (set_attr "imm_disp" "false")])
14090 (define_insn "*add_tp_di"
14091 [(set (match_operand:DI 0 "register_operand" "=r")
14092 (plus:DI (unspec:DI [(const_int 0)] UNSPEC_TP)
14093 (match_operand:DI 1 "register_operand" "0")))
14094 (clobber (reg:CC FLAGS_REG))]
14096 "add{q}\t{%%fs:0, %0|%0, QWORD PTR %%fs:0}"
14097 [(set_attr "type" "alu")
14098 (set_attr "modrm" "0")
14099 (set_attr "length" "7")
14100 (set_attr "memory" "load")
14101 (set_attr "imm_disp" "false")])
14103 ;; These patterns match the binary 387 instructions for addM3, subM3,
14104 ;; mulM3 and divM3. There are three patterns for each of DFmode and
14105 ;; SFmode. The first is the normal insn, the second the same insn but
14106 ;; with one operand a conversion, and the third the same insn but with
14107 ;; the other operand a conversion. The conversion may be SFmode or
14108 ;; SImode if the target mode DFmode, but only SImode if the target mode
14111 ;; Gcc is slightly more smart about handling normal two address instructions
14112 ;; so use special patterns for add and mull.
14114 (define_insn "*fop_sf_comm_mixed"
14115 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
14116 (match_operator:SF 3 "binary_fp_operator"
14117 [(match_operand:SF 1 "nonimmediate_operand" "%0,0")
14118 (match_operand:SF 2 "nonimmediate_operand" "fm#x,xm#f")]))]
14119 "TARGET_MIX_SSE_I387
14120 && COMMUTATIVE_ARITH_P (operands[3])
14121 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14122 "* return output_387_binary_op (insn, operands);"
14123 [(set (attr "type")
14124 (if_then_else (eq_attr "alternative" "1")
14125 (if_then_else (match_operand:SF 3 "mult_operator" "")
14126 (const_string "ssemul")
14127 (const_string "sseadd"))
14128 (if_then_else (match_operand:SF 3 "mult_operator" "")
14129 (const_string "fmul")
14130 (const_string "fop"))))
14131 (set_attr "mode" "SF")])
14133 (define_insn "*fop_sf_comm_sse"
14134 [(set (match_operand:SF 0 "register_operand" "=x")
14135 (match_operator:SF 3 "binary_fp_operator"
14136 [(match_operand:SF 1 "nonimmediate_operand" "%0")
14137 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14139 && COMMUTATIVE_ARITH_P (operands[3])
14140 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14141 "* return output_387_binary_op (insn, operands);"
14142 [(set (attr "type")
14143 (if_then_else (match_operand:SF 3 "mult_operator" "")
14144 (const_string "ssemul")
14145 (const_string "sseadd")))
14146 (set_attr "mode" "SF")])
14148 (define_insn "*fop_sf_comm_i387"
14149 [(set (match_operand:SF 0 "register_operand" "=f")
14150 (match_operator:SF 3 "binary_fp_operator"
14151 [(match_operand:SF 1 "nonimmediate_operand" "%0")
14152 (match_operand:SF 2 "nonimmediate_operand" "fm")]))]
14154 && COMMUTATIVE_ARITH_P (operands[3])
14155 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14156 "* return output_387_binary_op (insn, operands);"
14157 [(set (attr "type")
14158 (if_then_else (match_operand:SF 3 "mult_operator" "")
14159 (const_string "fmul")
14160 (const_string "fop")))
14161 (set_attr "mode" "SF")])
14163 (define_insn "*fop_sf_1_mixed"
14164 [(set (match_operand:SF 0 "register_operand" "=f,f,x")
14165 (match_operator:SF 3 "binary_fp_operator"
14166 [(match_operand:SF 1 "nonimmediate_operand" "0,fm,0")
14167 (match_operand:SF 2 "nonimmediate_operand" "fm,0,xm#f")]))]
14168 "TARGET_MIX_SSE_I387
14169 && !COMMUTATIVE_ARITH_P (operands[3])
14170 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14171 "* return output_387_binary_op (insn, operands);"
14172 [(set (attr "type")
14173 (cond [(and (eq_attr "alternative" "2")
14174 (match_operand:SF 3 "mult_operator" ""))
14175 (const_string "ssemul")
14176 (and (eq_attr "alternative" "2")
14177 (match_operand:SF 3 "div_operator" ""))
14178 (const_string "ssediv")
14179 (eq_attr "alternative" "2")
14180 (const_string "sseadd")
14181 (match_operand:SF 3 "mult_operator" "")
14182 (const_string "fmul")
14183 (match_operand:SF 3 "div_operator" "")
14184 (const_string "fdiv")
14186 (const_string "fop")))
14187 (set_attr "mode" "SF")])
14189 (define_insn "*fop_sf_1_sse"
14190 [(set (match_operand:SF 0 "register_operand" "=x")
14191 (match_operator:SF 3 "binary_fp_operator"
14192 [(match_operand:SF 1 "register_operand" "0")
14193 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14195 && !COMMUTATIVE_ARITH_P (operands[3])"
14196 "* return output_387_binary_op (insn, operands);"
14197 [(set (attr "type")
14198 (cond [(match_operand:SF 3 "mult_operator" "")
14199 (const_string "ssemul")
14200 (match_operand:SF 3 "div_operator" "")
14201 (const_string "ssediv")
14203 (const_string "sseadd")))
14204 (set_attr "mode" "SF")])
14206 ;; This pattern is not fully shadowed by the pattern above.
14207 (define_insn "*fop_sf_1_i387"
14208 [(set (match_operand:SF 0 "register_operand" "=f,f")
14209 (match_operator:SF 3 "binary_fp_operator"
14210 [(match_operand:SF 1 "nonimmediate_operand" "0,fm")
14211 (match_operand:SF 2 "nonimmediate_operand" "fm,0")]))]
14212 "TARGET_80387 && !TARGET_SSE_MATH
14213 && !COMMUTATIVE_ARITH_P (operands[3])
14214 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14215 "* return output_387_binary_op (insn, operands);"
14216 [(set (attr "type")
14217 (cond [(match_operand:SF 3 "mult_operator" "")
14218 (const_string "fmul")
14219 (match_operand:SF 3 "div_operator" "")
14220 (const_string "fdiv")
14222 (const_string "fop")))
14223 (set_attr "mode" "SF")])
14226 ;; ??? Add SSE splitters for these!
14227 (define_insn "*fop_sf_2_i387"
14228 [(set (match_operand:SF 0 "register_operand" "=f,f")
14229 (match_operator:SF 3 "binary_fp_operator"
14230 [(float:SF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14231 (match_operand:SF 2 "register_operand" "0,0")]))]
14232 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14233 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14234 [(set (attr "type")
14235 (cond [(match_operand:SF 3 "mult_operator" "")
14236 (const_string "fmul")
14237 (match_operand:SF 3 "div_operator" "")
14238 (const_string "fdiv")
14240 (const_string "fop")))
14241 (set_attr "fp_int_src" "true")
14242 (set_attr "mode" "SI")])
14244 (define_insn "*fop_sf_3_i387"
14245 [(set (match_operand:SF 0 "register_operand" "=f,f")
14246 (match_operator:SF 3 "binary_fp_operator"
14247 [(match_operand:SF 1 "register_operand" "0,0")
14248 (float:SF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14249 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14250 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14251 [(set (attr "type")
14252 (cond [(match_operand:SF 3 "mult_operator" "")
14253 (const_string "fmul")
14254 (match_operand:SF 3 "div_operator" "")
14255 (const_string "fdiv")
14257 (const_string "fop")))
14258 (set_attr "fp_int_src" "true")
14259 (set_attr "mode" "SI")])
14261 (define_insn "*fop_df_comm_mixed"
14262 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
14263 (match_operator:DF 3 "binary_fp_operator"
14264 [(match_operand:DF 1 "nonimmediate_operand" "%0,0")
14265 (match_operand:DF 2 "nonimmediate_operand" "fm#Y,Ym#f")]))]
14266 "TARGET_SSE2 && TARGET_MIX_SSE_I387
14267 && COMMUTATIVE_ARITH_P (operands[3])
14268 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14269 "* return output_387_binary_op (insn, operands);"
14270 [(set (attr "type")
14271 (if_then_else (eq_attr "alternative" "1")
14272 (if_then_else (match_operand:SF 3 "mult_operator" "")
14273 (const_string "ssemul")
14274 (const_string "sseadd"))
14275 (if_then_else (match_operand:SF 3 "mult_operator" "")
14276 (const_string "fmul")
14277 (const_string "fop"))))
14278 (set_attr "mode" "DF")])
14280 (define_insn "*fop_df_comm_sse"
14281 [(set (match_operand:DF 0 "register_operand" "=Y")
14282 (match_operator:DF 3 "binary_fp_operator"
14283 [(match_operand:DF 1 "nonimmediate_operand" "%0")
14284 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14285 "TARGET_SSE2 && TARGET_SSE_MATH
14286 && COMMUTATIVE_ARITH_P (operands[3])
14287 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14288 "* return output_387_binary_op (insn, operands);"
14289 [(set (attr "type")
14290 (if_then_else (match_operand:SF 3 "mult_operator" "")
14291 (const_string "ssemul")
14292 (const_string "sseadd")))
14293 (set_attr "mode" "DF")])
14295 (define_insn "*fop_df_comm_i387"
14296 [(set (match_operand:DF 0 "register_operand" "=f")
14297 (match_operator:DF 3 "binary_fp_operator"
14298 [(match_operand:DF 1 "nonimmediate_operand" "%0")
14299 (match_operand:DF 2 "nonimmediate_operand" "fm")]))]
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 (match_operand:SF 3 "mult_operator" "")
14306 (const_string "fmul")
14307 (const_string "fop")))
14308 (set_attr "mode" "DF")])
14310 (define_insn "*fop_df_1_mixed"
14311 [(set (match_operand:DF 0 "register_operand" "=f#Y,f#Y,Y#f")
14312 (match_operator:DF 3 "binary_fp_operator"
14313 [(match_operand:DF 1 "nonimmediate_operand" "0,fm,0")
14314 (match_operand:DF 2 "nonimmediate_operand" "fm,0,Ym#f")]))]
14315 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14316 && !COMMUTATIVE_ARITH_P (operands[3])
14317 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14318 "* return output_387_binary_op (insn, operands);"
14319 [(set (attr "type")
14320 (cond [(and (eq_attr "alternative" "2")
14321 (match_operand:SF 3 "mult_operator" ""))
14322 (const_string "ssemul")
14323 (and (eq_attr "alternative" "2")
14324 (match_operand:SF 3 "div_operator" ""))
14325 (const_string "ssediv")
14326 (eq_attr "alternative" "2")
14327 (const_string "sseadd")
14328 (match_operand:DF 3 "mult_operator" "")
14329 (const_string "fmul")
14330 (match_operand:DF 3 "div_operator" "")
14331 (const_string "fdiv")
14333 (const_string "fop")))
14334 (set_attr "mode" "DF")])
14336 (define_insn "*fop_df_1_sse"
14337 [(set (match_operand:DF 0 "register_operand" "=Y")
14338 (match_operator:DF 3 "binary_fp_operator"
14339 [(match_operand:DF 1 "register_operand" "0")
14340 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14341 "TARGET_SSE2 && TARGET_SSE_MATH
14342 && !COMMUTATIVE_ARITH_P (operands[3])"
14343 "* return output_387_binary_op (insn, operands);"
14344 [(set_attr "mode" "DF")
14346 (cond [(match_operand:SF 3 "mult_operator" "")
14347 (const_string "ssemul")
14348 (match_operand:SF 3 "div_operator" "")
14349 (const_string "ssediv")
14351 (const_string "sseadd")))])
14353 ;; This pattern is not fully shadowed by the pattern above.
14354 (define_insn "*fop_df_1_i387"
14355 [(set (match_operand:DF 0 "register_operand" "=f,f")
14356 (match_operator:DF 3 "binary_fp_operator"
14357 [(match_operand:DF 1 "nonimmediate_operand" "0,fm")
14358 (match_operand:DF 2 "nonimmediate_operand" "fm,0")]))]
14359 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)
14360 && !COMMUTATIVE_ARITH_P (operands[3])
14361 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14362 "* return output_387_binary_op (insn, operands);"
14363 [(set (attr "type")
14364 (cond [(match_operand:DF 3 "mult_operator" "")
14365 (const_string "fmul")
14366 (match_operand:DF 3 "div_operator" "")
14367 (const_string "fdiv")
14369 (const_string "fop")))
14370 (set_attr "mode" "DF")])
14372 ;; ??? Add SSE splitters for these!
14373 (define_insn "*fop_df_2_i387"
14374 [(set (match_operand:DF 0 "register_operand" "=f,f")
14375 (match_operator:DF 3 "binary_fp_operator"
14376 [(float:DF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14377 (match_operand:DF 2 "register_operand" "0,0")]))]
14378 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14379 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14380 [(set (attr "type")
14381 (cond [(match_operand:DF 3 "mult_operator" "")
14382 (const_string "fmul")
14383 (match_operand:DF 3 "div_operator" "")
14384 (const_string "fdiv")
14386 (const_string "fop")))
14387 (set_attr "fp_int_src" "true")
14388 (set_attr "mode" "SI")])
14390 (define_insn "*fop_df_3_i387"
14391 [(set (match_operand:DF 0 "register_operand" "=f,f")
14392 (match_operator:DF 3 "binary_fp_operator"
14393 [(match_operand:DF 1 "register_operand" "0,0")
14394 (float:DF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14395 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14396 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14397 [(set (attr "type")
14398 (cond [(match_operand:DF 3 "mult_operator" "")
14399 (const_string "fmul")
14400 (match_operand:DF 3 "div_operator" "")
14401 (const_string "fdiv")
14403 (const_string "fop")))
14404 (set_attr "fp_int_src" "true")
14405 (set_attr "mode" "SI")])
14407 (define_insn "*fop_df_4_i387"
14408 [(set (match_operand:DF 0 "register_operand" "=f,f")
14409 (match_operator:DF 3 "binary_fp_operator"
14410 [(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
14411 (match_operand:DF 2 "register_operand" "0,f")]))]
14412 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)
14413 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14414 "* return output_387_binary_op (insn, operands);"
14415 [(set (attr "type")
14416 (cond [(match_operand:DF 3 "mult_operator" "")
14417 (const_string "fmul")
14418 (match_operand:DF 3 "div_operator" "")
14419 (const_string "fdiv")
14421 (const_string "fop")))
14422 (set_attr "mode" "SF")])
14424 (define_insn "*fop_df_5_i387"
14425 [(set (match_operand:DF 0 "register_operand" "=f,f")
14426 (match_operator:DF 3 "binary_fp_operator"
14427 [(match_operand:DF 1 "register_operand" "0,f")
14429 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14430 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14431 "* return output_387_binary_op (insn, operands);"
14432 [(set (attr "type")
14433 (cond [(match_operand:DF 3 "mult_operator" "")
14434 (const_string "fmul")
14435 (match_operand:DF 3 "div_operator" "")
14436 (const_string "fdiv")
14438 (const_string "fop")))
14439 (set_attr "mode" "SF")])
14441 (define_insn "*fop_df_6_i387"
14442 [(set (match_operand:DF 0 "register_operand" "=f,f")
14443 (match_operator:DF 3 "binary_fp_operator"
14445 (match_operand:SF 1 "register_operand" "0,f"))
14447 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14448 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14449 "* return output_387_binary_op (insn, operands);"
14450 [(set (attr "type")
14451 (cond [(match_operand:DF 3 "mult_operator" "")
14452 (const_string "fmul")
14453 (match_operand:DF 3 "div_operator" "")
14454 (const_string "fdiv")
14456 (const_string "fop")))
14457 (set_attr "mode" "SF")])
14459 (define_insn "*fop_xf_comm_i387"
14460 [(set (match_operand:XF 0 "register_operand" "=f")
14461 (match_operator:XF 3 "binary_fp_operator"
14462 [(match_operand:XF 1 "register_operand" "%0")
14463 (match_operand:XF 2 "register_operand" "f")]))]
14465 && COMMUTATIVE_ARITH_P (operands[3])"
14466 "* return output_387_binary_op (insn, operands);"
14467 [(set (attr "type")
14468 (if_then_else (match_operand:XF 3 "mult_operator" "")
14469 (const_string "fmul")
14470 (const_string "fop")))
14471 (set_attr "mode" "XF")])
14473 (define_insn "*fop_xf_1_i387"
14474 [(set (match_operand:XF 0 "register_operand" "=f,f")
14475 (match_operator:XF 3 "binary_fp_operator"
14476 [(match_operand:XF 1 "register_operand" "0,f")
14477 (match_operand:XF 2 "register_operand" "f,0")]))]
14479 && !COMMUTATIVE_ARITH_P (operands[3])"
14480 "* return output_387_binary_op (insn, operands);"
14481 [(set (attr "type")
14482 (cond [(match_operand:XF 3 "mult_operator" "")
14483 (const_string "fmul")
14484 (match_operand:XF 3 "div_operator" "")
14485 (const_string "fdiv")
14487 (const_string "fop")))
14488 (set_attr "mode" "XF")])
14490 (define_insn "*fop_xf_2_i387"
14491 [(set (match_operand:XF 0 "register_operand" "=f,f")
14492 (match_operator:XF 3 "binary_fp_operator"
14493 [(float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14494 (match_operand:XF 2 "register_operand" "0,0")]))]
14495 "TARGET_80387 && TARGET_USE_FIOP"
14496 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14497 [(set (attr "type")
14498 (cond [(match_operand:XF 3 "mult_operator" "")
14499 (const_string "fmul")
14500 (match_operand:XF 3 "div_operator" "")
14501 (const_string "fdiv")
14503 (const_string "fop")))
14504 (set_attr "fp_int_src" "true")
14505 (set_attr "mode" "SI")])
14507 (define_insn "*fop_xf_3_i387"
14508 [(set (match_operand:XF 0 "register_operand" "=f,f")
14509 (match_operator:XF 3 "binary_fp_operator"
14510 [(match_operand:XF 1 "register_operand" "0,0")
14511 (float:XF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14512 "TARGET_80387 && TARGET_USE_FIOP"
14513 "* return which_alternative ? \"#\" : 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 "fp_int_src" "true")
14522 (set_attr "mode" "SI")])
14524 (define_insn "*fop_xf_4_i387"
14525 [(set (match_operand:XF 0 "register_operand" "=f,f")
14526 (match_operator:XF 3 "binary_fp_operator"
14527 [(float_extend:XF (match_operand 1 "nonimmediate_operand" "fm,0"))
14528 (match_operand:XF 2 "register_operand" "0,f")]))]
14530 "* return output_387_binary_op (insn, operands);"
14531 [(set (attr "type")
14532 (cond [(match_operand:XF 3 "mult_operator" "")
14533 (const_string "fmul")
14534 (match_operand:XF 3 "div_operator" "")
14535 (const_string "fdiv")
14537 (const_string "fop")))
14538 (set_attr "mode" "SF")])
14540 (define_insn "*fop_xf_5_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,f")
14545 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
14547 "* return output_387_binary_op (insn, operands);"
14548 [(set (attr "type")
14549 (cond [(match_operand:XF 3 "mult_operator" "")
14550 (const_string "fmul")
14551 (match_operand:XF 3 "div_operator" "")
14552 (const_string "fdiv")
14554 (const_string "fop")))
14555 (set_attr "mode" "SF")])
14557 (define_insn "*fop_xf_6_i387"
14558 [(set (match_operand:XF 0 "register_operand" "=f,f")
14559 (match_operator:XF 3 "binary_fp_operator"
14561 (match_operand 1 "register_operand" "0,f"))
14563 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
14565 "* return output_387_binary_op (insn, operands);"
14566 [(set (attr "type")
14567 (cond [(match_operand:XF 3 "mult_operator" "")
14568 (const_string "fmul")
14569 (match_operand:XF 3 "div_operator" "")
14570 (const_string "fdiv")
14572 (const_string "fop")))
14573 (set_attr "mode" "SF")])
14576 [(set (match_operand 0 "register_operand" "")
14577 (match_operator 3 "binary_fp_operator"
14578 [(float (match_operand:SI 1 "register_operand" ""))
14579 (match_operand 2 "register_operand" "")]))]
14580 "TARGET_80387 && reload_completed
14581 && FLOAT_MODE_P (GET_MODE (operands[0]))"
14584 operands[4] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
14585 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
14586 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
14587 gen_rtx_fmt_ee (GET_CODE (operands[3]),
14588 GET_MODE (operands[3]),
14591 ix86_free_from_memory (GET_MODE (operands[1]));
14596 [(set (match_operand 0 "register_operand" "")
14597 (match_operator 3 "binary_fp_operator"
14598 [(match_operand 1 "register_operand" "")
14599 (float (match_operand:SI 2 "register_operand" ""))]))]
14600 "TARGET_80387 && reload_completed
14601 && FLOAT_MODE_P (GET_MODE (operands[0]))"
14604 operands[4] = ix86_force_to_memory (GET_MODE (operands[2]), operands[2]);
14605 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
14606 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
14607 gen_rtx_fmt_ee (GET_CODE (operands[3]),
14608 GET_MODE (operands[3]),
14611 ix86_free_from_memory (GET_MODE (operands[2]));
14615 ;; FPU special functions.
14617 (define_expand "sqrtsf2"
14618 [(set (match_operand:SF 0 "register_operand" "")
14619 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
14620 "TARGET_USE_FANCY_MATH_387 || TARGET_SSE_MATH"
14622 if (!TARGET_SSE_MATH)
14623 operands[1] = force_reg (SFmode, operands[1]);
14626 (define_insn "*sqrtsf2_mixed"
14627 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
14628 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "0#x,xm#f")))]
14629 "TARGET_USE_FANCY_MATH_387 && TARGET_MIX_SSE_I387"
14632 sqrtss\t{%1, %0|%0, %1}"
14633 [(set_attr "type" "fpspc,sse")
14634 (set_attr "mode" "SF,SF")
14635 (set_attr "athlon_decode" "direct,*")])
14637 (define_insn "*sqrtsf2_sse"
14638 [(set (match_operand:SF 0 "register_operand" "=x")
14639 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "xm")))]
14641 "sqrtss\t{%1, %0|%0, %1}"
14642 [(set_attr "type" "sse")
14643 (set_attr "mode" "SF")
14644 (set_attr "athlon_decode" "*")])
14646 (define_insn "*sqrtsf2_i387"
14647 [(set (match_operand:SF 0 "register_operand" "=f")
14648 (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
14649 "TARGET_USE_FANCY_MATH_387"
14651 [(set_attr "type" "fpspc")
14652 (set_attr "mode" "SF")
14653 (set_attr "athlon_decode" "direct")])
14655 (define_expand "sqrtdf2"
14656 [(set (match_operand:DF 0 "register_operand" "")
14657 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
14658 "TARGET_USE_FANCY_MATH_387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
14660 if (!(TARGET_SSE2 && TARGET_SSE_MATH))
14661 operands[1] = force_reg (DFmode, operands[1]);
14664 (define_insn "*sqrtdf2_mixed"
14665 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
14666 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "0#Y,Ym#f")))]
14667 "TARGET_USE_FANCY_MATH_387 && TARGET_SSE2 && TARGET_MIX_SSE_I387"
14670 sqrtsd\t{%1, %0|%0, %1}"
14671 [(set_attr "type" "fpspc,sse")
14672 (set_attr "mode" "DF,DF")
14673 (set_attr "athlon_decode" "direct,*")])
14675 (define_insn "*sqrtdf2_sse"
14676 [(set (match_operand:DF 0 "register_operand" "=Y")
14677 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
14678 "TARGET_SSE2 && TARGET_SSE_MATH"
14679 "sqrtsd\t{%1, %0|%0, %1}"
14680 [(set_attr "type" "sse")
14681 (set_attr "mode" "DF")
14682 (set_attr "athlon_decode" "*")])
14684 (define_insn "*sqrtdf2_i387"
14685 [(set (match_operand:DF 0 "register_operand" "=f")
14686 (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
14687 "TARGET_USE_FANCY_MATH_387"
14689 [(set_attr "type" "fpspc")
14690 (set_attr "mode" "DF")
14691 (set_attr "athlon_decode" "direct")])
14693 (define_insn "*sqrtextendsfdf2_i387"
14694 [(set (match_operand:DF 0 "register_operand" "=f")
14695 (sqrt:DF (float_extend:DF
14696 (match_operand:SF 1 "register_operand" "0"))))]
14697 "TARGET_USE_FANCY_MATH_387
14698 && (!(TARGET_SSE2 && TARGET_SSE_MATH) || TARGET_MIX_SSE_I387)"
14700 [(set_attr "type" "fpspc")
14701 (set_attr "mode" "DF")
14702 (set_attr "athlon_decode" "direct")])
14704 (define_insn "sqrtxf2"
14705 [(set (match_operand:XF 0 "register_operand" "=f")
14706 (sqrt:XF (match_operand:XF 1 "register_operand" "0")))]
14707 "TARGET_USE_FANCY_MATH_387
14708 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
14710 [(set_attr "type" "fpspc")
14711 (set_attr "mode" "XF")
14712 (set_attr "athlon_decode" "direct")])
14714 (define_insn "*sqrtextendsfxf2_i387"
14715 [(set (match_operand:XF 0 "register_operand" "=f")
14716 (sqrt:XF (float_extend:XF
14717 (match_operand:SF 1 "register_operand" "0"))))]
14718 "TARGET_USE_FANCY_MATH_387"
14720 [(set_attr "type" "fpspc")
14721 (set_attr "mode" "XF")
14722 (set_attr "athlon_decode" "direct")])
14724 (define_insn "*sqrtextenddfxf2_i387"
14725 [(set (match_operand:XF 0 "register_operand" "=f")
14726 (sqrt:XF (float_extend:XF
14727 (match_operand:DF 1 "register_operand" "0"))))]
14728 "TARGET_USE_FANCY_MATH_387"
14730 [(set_attr "type" "fpspc")
14731 (set_attr "mode" "XF")
14732 (set_attr "athlon_decode" "direct")])
14734 (define_insn "fpremxf4"
14735 [(set (match_operand:XF 0 "register_operand" "=f")
14736 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
14737 (match_operand:XF 3 "register_operand" "1")]
14739 (set (match_operand:XF 1 "register_operand" "=u")
14740 (unspec:XF [(match_dup 2) (match_dup 3)]
14742 (set (reg:CCFP FPSR_REG)
14743 (unspec:CCFP [(const_int 0)] UNSPEC_NOP))]
14744 "TARGET_USE_FANCY_MATH_387
14745 && flag_unsafe_math_optimizations"
14747 [(set_attr "type" "fpspc")
14748 (set_attr "mode" "XF")])
14750 (define_expand "fmodsf3"
14751 [(use (match_operand:SF 0 "register_operand" ""))
14752 (use (match_operand:SF 1 "register_operand" ""))
14753 (use (match_operand:SF 2 "register_operand" ""))]
14754 "TARGET_USE_FANCY_MATH_387
14755 && flag_unsafe_math_optimizations"
14757 rtx label = gen_label_rtx ();
14759 rtx op1 = gen_reg_rtx (XFmode);
14760 rtx op2 = gen_reg_rtx (XFmode);
14762 emit_insn(gen_extendsfxf2 (op1, operands[1]));
14763 emit_insn(gen_extendsfxf2 (op2, operands[2]));
14765 emit_label (label);
14767 emit_insn (gen_fpremxf4 (op1, op2, op1, op2));
14768 ix86_emit_fp_unordered_jump (label);
14770 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op1));
14774 (define_expand "fmoddf3"
14775 [(use (match_operand:DF 0 "register_operand" ""))
14776 (use (match_operand:DF 1 "register_operand" ""))
14777 (use (match_operand:DF 2 "register_operand" ""))]
14778 "TARGET_USE_FANCY_MATH_387
14779 && flag_unsafe_math_optimizations"
14781 rtx label = gen_label_rtx ();
14783 rtx op1 = gen_reg_rtx (XFmode);
14784 rtx op2 = gen_reg_rtx (XFmode);
14786 emit_insn (gen_extenddfxf2 (op1, operands[1]));
14787 emit_insn (gen_extenddfxf2 (op2, operands[2]));
14789 emit_label (label);
14791 emit_insn (gen_fpremxf4 (op1, op2, op1, op2));
14792 ix86_emit_fp_unordered_jump (label);
14794 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op1));
14798 (define_expand "fmodxf3"
14799 [(use (match_operand:XF 0 "register_operand" ""))
14800 (use (match_operand:XF 1 "register_operand" ""))
14801 (use (match_operand:XF 2 "register_operand" ""))]
14802 "TARGET_USE_FANCY_MATH_387
14803 && flag_unsafe_math_optimizations"
14805 rtx label = gen_label_rtx ();
14807 emit_label (label);
14809 emit_insn (gen_fpremxf4 (operands[1], operands[2],
14810 operands[1], operands[2]));
14811 ix86_emit_fp_unordered_jump (label);
14813 emit_move_insn (operands[0], operands[1]);
14817 (define_insn "fprem1xf4"
14818 [(set (match_operand:XF 0 "register_operand" "=f")
14819 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
14820 (match_operand:XF 3 "register_operand" "1")]
14822 (set (match_operand:XF 1 "register_operand" "=u")
14823 (unspec:XF [(match_dup 2) (match_dup 3)]
14825 (set (reg:CCFP FPSR_REG)
14826 (unspec:CCFP [(const_int 0)] UNSPEC_NOP))]
14827 "TARGET_USE_FANCY_MATH_387
14828 && flag_unsafe_math_optimizations"
14830 [(set_attr "type" "fpspc")
14831 (set_attr "mode" "XF")])
14833 (define_expand "dremsf3"
14834 [(use (match_operand:SF 0 "register_operand" ""))
14835 (use (match_operand:SF 1 "register_operand" ""))
14836 (use (match_operand:SF 2 "register_operand" ""))]
14837 "TARGET_USE_FANCY_MATH_387
14838 && flag_unsafe_math_optimizations"
14840 rtx label = gen_label_rtx ();
14842 rtx op1 = gen_reg_rtx (XFmode);
14843 rtx op2 = gen_reg_rtx (XFmode);
14845 emit_insn(gen_extendsfxf2 (op1, operands[1]));
14846 emit_insn(gen_extendsfxf2 (op2, operands[2]));
14848 emit_label (label);
14850 emit_insn (gen_fprem1xf4 (op1, op2, op1, op2));
14851 ix86_emit_fp_unordered_jump (label);
14853 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op1));
14857 (define_expand "dremdf3"
14858 [(use (match_operand:DF 0 "register_operand" ""))
14859 (use (match_operand:DF 1 "register_operand" ""))
14860 (use (match_operand:DF 2 "register_operand" ""))]
14861 "TARGET_USE_FANCY_MATH_387
14862 && flag_unsafe_math_optimizations"
14864 rtx label = gen_label_rtx ();
14866 rtx op1 = gen_reg_rtx (XFmode);
14867 rtx op2 = gen_reg_rtx (XFmode);
14869 emit_insn (gen_extenddfxf2 (op1, operands[1]));
14870 emit_insn (gen_extenddfxf2 (op2, operands[2]));
14872 emit_label (label);
14874 emit_insn (gen_fprem1xf4 (op1, op2, op1, op2));
14875 ix86_emit_fp_unordered_jump (label);
14877 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op1));
14881 (define_expand "dremxf3"
14882 [(use (match_operand:XF 0 "register_operand" ""))
14883 (use (match_operand:XF 1 "register_operand" ""))
14884 (use (match_operand:XF 2 "register_operand" ""))]
14885 "TARGET_USE_FANCY_MATH_387
14886 && flag_unsafe_math_optimizations"
14888 rtx label = gen_label_rtx ();
14890 emit_label (label);
14892 emit_insn (gen_fprem1xf4 (operands[1], operands[2],
14893 operands[1], operands[2]));
14894 ix86_emit_fp_unordered_jump (label);
14896 emit_move_insn (operands[0], operands[1]);
14900 (define_insn "*sindf2"
14901 [(set (match_operand:DF 0 "register_operand" "=f")
14902 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_SIN))]
14903 "TARGET_USE_FANCY_MATH_387
14904 && flag_unsafe_math_optimizations"
14906 [(set_attr "type" "fpspc")
14907 (set_attr "mode" "DF")])
14909 (define_insn "*sinsf2"
14910 [(set (match_operand:SF 0 "register_operand" "=f")
14911 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_SIN))]
14912 "TARGET_USE_FANCY_MATH_387
14913 && flag_unsafe_math_optimizations"
14915 [(set_attr "type" "fpspc")
14916 (set_attr "mode" "SF")])
14918 (define_insn "*sinextendsfdf2"
14919 [(set (match_operand:DF 0 "register_operand" "=f")
14920 (unspec:DF [(float_extend:DF
14921 (match_operand:SF 1 "register_operand" "0"))]
14923 "TARGET_USE_FANCY_MATH_387
14924 && flag_unsafe_math_optimizations"
14926 [(set_attr "type" "fpspc")
14927 (set_attr "mode" "DF")])
14929 (define_insn "*sinxf2"
14930 [(set (match_operand:XF 0 "register_operand" "=f")
14931 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_SIN))]
14932 "TARGET_USE_FANCY_MATH_387
14933 && flag_unsafe_math_optimizations"
14935 [(set_attr "type" "fpspc")
14936 (set_attr "mode" "XF")])
14938 (define_insn "*cosdf2"
14939 [(set (match_operand:DF 0 "register_operand" "=f")
14940 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_COS))]
14941 "TARGET_USE_FANCY_MATH_387
14942 && flag_unsafe_math_optimizations"
14944 [(set_attr "type" "fpspc")
14945 (set_attr "mode" "DF")])
14947 (define_insn "*cossf2"
14948 [(set (match_operand:SF 0 "register_operand" "=f")
14949 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_COS))]
14950 "TARGET_USE_FANCY_MATH_387
14951 && flag_unsafe_math_optimizations"
14953 [(set_attr "type" "fpspc")
14954 (set_attr "mode" "SF")])
14956 (define_insn "*cosextendsfdf2"
14957 [(set (match_operand:DF 0 "register_operand" "=f")
14958 (unspec:DF [(float_extend:DF
14959 (match_operand:SF 1 "register_operand" "0"))]
14961 "TARGET_USE_FANCY_MATH_387
14962 && flag_unsafe_math_optimizations"
14964 [(set_attr "type" "fpspc")
14965 (set_attr "mode" "DF")])
14967 (define_insn "*cosxf2"
14968 [(set (match_operand:XF 0 "register_operand" "=f")
14969 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_COS))]
14970 "TARGET_USE_FANCY_MATH_387
14971 && flag_unsafe_math_optimizations"
14973 [(set_attr "type" "fpspc")
14974 (set_attr "mode" "XF")])
14976 ;; With sincos pattern defined, sin and cos builtin function will be
14977 ;; expanded to sincos pattern with one of its outputs left unused.
14978 ;; Cse pass will detected, if two sincos patterns can be combined,
14979 ;; otherwise sincos pattern will be split back to sin or cos pattern,
14980 ;; depending on the unused output.
14982 (define_insn "sincosdf3"
14983 [(set (match_operand:DF 0 "register_operand" "=f")
14984 (unspec:DF [(match_operand:DF 2 "register_operand" "0")]
14985 UNSPEC_SINCOS_COS))
14986 (set (match_operand:DF 1 "register_operand" "=u")
14987 (unspec:DF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
14988 "TARGET_USE_FANCY_MATH_387
14989 && flag_unsafe_math_optimizations"
14991 [(set_attr "type" "fpspc")
14992 (set_attr "mode" "DF")])
14995 [(set (match_operand:DF 0 "register_operand" "")
14996 (unspec:DF [(match_operand:DF 2 "register_operand" "")]
14997 UNSPEC_SINCOS_COS))
14998 (set (match_operand:DF 1 "register_operand" "")
14999 (unspec:DF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15000 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15001 && !reload_completed && !reload_in_progress"
15002 [(set (match_dup 1) (unspec:DF [(match_dup 2)] UNSPEC_SIN))]
15006 [(set (match_operand:DF 0 "register_operand" "")
15007 (unspec:DF [(match_operand:DF 2 "register_operand" "")]
15008 UNSPEC_SINCOS_COS))
15009 (set (match_operand:DF 1 "register_operand" "")
15010 (unspec:DF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15011 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15012 && !reload_completed && !reload_in_progress"
15013 [(set (match_dup 0) (unspec:DF [(match_dup 2)] UNSPEC_COS))]
15016 (define_insn "sincossf3"
15017 [(set (match_operand:SF 0 "register_operand" "=f")
15018 (unspec:SF [(match_operand:SF 2 "register_operand" "0")]
15019 UNSPEC_SINCOS_COS))
15020 (set (match_operand:SF 1 "register_operand" "=u")
15021 (unspec:SF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15022 "TARGET_USE_FANCY_MATH_387
15023 && flag_unsafe_math_optimizations"
15025 [(set_attr "type" "fpspc")
15026 (set_attr "mode" "SF")])
15029 [(set (match_operand:SF 0 "register_operand" "")
15030 (unspec:SF [(match_operand:SF 2 "register_operand" "")]
15031 UNSPEC_SINCOS_COS))
15032 (set (match_operand:SF 1 "register_operand" "")
15033 (unspec:SF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15034 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15035 && !reload_completed && !reload_in_progress"
15036 [(set (match_dup 1) (unspec:SF [(match_dup 2)] UNSPEC_SIN))]
15040 [(set (match_operand:SF 0 "register_operand" "")
15041 (unspec:SF [(match_operand:SF 2 "register_operand" "")]
15042 UNSPEC_SINCOS_COS))
15043 (set (match_operand:SF 1 "register_operand" "")
15044 (unspec:SF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15045 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15046 && !reload_completed && !reload_in_progress"
15047 [(set (match_dup 0) (unspec:SF [(match_dup 2)] UNSPEC_COS))]
15050 (define_insn "*sincosextendsfdf3"
15051 [(set (match_operand:DF 0 "register_operand" "=f")
15052 (unspec:DF [(float_extend:DF
15053 (match_operand:SF 2 "register_operand" "0"))]
15054 UNSPEC_SINCOS_COS))
15055 (set (match_operand:DF 1 "register_operand" "=u")
15056 (unspec:DF [(float_extend:DF
15057 (match_dup 2))] UNSPEC_SINCOS_SIN))]
15058 "TARGET_USE_FANCY_MATH_387
15059 && flag_unsafe_math_optimizations"
15061 [(set_attr "type" "fpspc")
15062 (set_attr "mode" "DF")])
15065 [(set (match_operand:DF 0 "register_operand" "")
15066 (unspec:DF [(float_extend:DF
15067 (match_operand:SF 2 "register_operand" ""))]
15068 UNSPEC_SINCOS_COS))
15069 (set (match_operand:DF 1 "register_operand" "")
15070 (unspec:DF [(float_extend:DF
15071 (match_dup 2))] UNSPEC_SINCOS_SIN))]
15072 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15073 && !reload_completed && !reload_in_progress"
15074 [(set (match_dup 1) (unspec:DF [(float_extend:DF
15075 (match_dup 2))] UNSPEC_SIN))]
15079 [(set (match_operand:DF 0 "register_operand" "")
15080 (unspec:DF [(float_extend:DF
15081 (match_operand:SF 2 "register_operand" ""))]
15082 UNSPEC_SINCOS_COS))
15083 (set (match_operand:DF 1 "register_operand" "")
15084 (unspec:DF [(float_extend:DF
15085 (match_dup 2))] UNSPEC_SINCOS_SIN))]
15086 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15087 && !reload_completed && !reload_in_progress"
15088 [(set (match_dup 0) (unspec:DF [(float_extend:DF
15089 (match_dup 2))] UNSPEC_COS))]
15092 (define_insn "sincosxf3"
15093 [(set (match_operand:XF 0 "register_operand" "=f")
15094 (unspec:XF [(match_operand:XF 2 "register_operand" "0")]
15095 UNSPEC_SINCOS_COS))
15096 (set (match_operand:XF 1 "register_operand" "=u")
15097 (unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15098 "TARGET_USE_FANCY_MATH_387
15099 && flag_unsafe_math_optimizations"
15101 [(set_attr "type" "fpspc")
15102 (set_attr "mode" "XF")])
15105 [(set (match_operand:XF 0 "register_operand" "")
15106 (unspec:XF [(match_operand:XF 2 "register_operand" "")]
15107 UNSPEC_SINCOS_COS))
15108 (set (match_operand:XF 1 "register_operand" "")
15109 (unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15110 "find_regno_note (insn, REG_UNUSED, REGNO (operands[0]))
15111 && !reload_completed && !reload_in_progress"
15112 [(set (match_dup 1) (unspec:XF [(match_dup 2)] UNSPEC_SIN))]
15116 [(set (match_operand:XF 0 "register_operand" "")
15117 (unspec:XF [(match_operand:XF 2 "register_operand" "")]
15118 UNSPEC_SINCOS_COS))
15119 (set (match_operand:XF 1 "register_operand" "")
15120 (unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))]
15121 "find_regno_note (insn, REG_UNUSED, REGNO (operands[1]))
15122 && !reload_completed && !reload_in_progress"
15123 [(set (match_dup 0) (unspec:XF [(match_dup 2)] UNSPEC_COS))]
15126 (define_insn "*tandf3_1"
15127 [(set (match_operand:DF 0 "register_operand" "=f")
15128 (unspec:DF [(match_operand:DF 2 "register_operand" "0")]
15130 (set (match_operand:DF 1 "register_operand" "=u")
15131 (unspec:DF [(match_dup 2)] UNSPEC_TAN_TAN))]
15132 "TARGET_USE_FANCY_MATH_387
15133 && flag_unsafe_math_optimizations"
15135 [(set_attr "type" "fpspc")
15136 (set_attr "mode" "DF")])
15138 ;; optimize sequence: fptan
15141 ;; into fptan insn.
15144 [(parallel[(set (match_operand:DF 0 "register_operand" "")
15145 (unspec:DF [(match_operand:DF 2 "register_operand" "")]
15147 (set (match_operand:DF 1 "register_operand" "")
15148 (unspec:DF [(match_dup 2)] UNSPEC_TAN_TAN))])
15150 (match_operand:DF 3 "immediate_operand" ""))]
15151 "standard_80387_constant_p (operands[3]) == 2"
15152 [(parallel[(set (match_dup 0) (unspec:DF [(match_dup 2)] UNSPEC_TAN_ONE))
15153 (set (match_dup 1) (unspec:DF [(match_dup 2)] UNSPEC_TAN_TAN))])]
15156 (define_expand "tandf2"
15157 [(parallel [(set (match_dup 2)
15158 (unspec:DF [(match_operand:DF 1 "register_operand" "")]
15160 (set (match_operand:DF 0 "register_operand" "")
15161 (unspec:DF [(match_dup 1)] UNSPEC_TAN_TAN))])]
15162 "TARGET_USE_FANCY_MATH_387
15163 && flag_unsafe_math_optimizations"
15165 operands[2] = gen_reg_rtx (DFmode);
15168 (define_insn "*tansf3_1"
15169 [(set (match_operand:SF 0 "register_operand" "=f")
15170 (unspec:SF [(match_operand:SF 2 "register_operand" "0")]
15172 (set (match_operand:SF 1 "register_operand" "=u")
15173 (unspec:SF [(match_dup 2)] UNSPEC_TAN_TAN))]
15174 "TARGET_USE_FANCY_MATH_387
15175 && flag_unsafe_math_optimizations"
15177 [(set_attr "type" "fpspc")
15178 (set_attr "mode" "SF")])
15180 ;; optimize sequence: fptan
15183 ;; into fptan insn.
15186 [(parallel[(set (match_operand:SF 0 "register_operand" "")
15187 (unspec:SF [(match_operand:SF 2 "register_operand" "")]
15189 (set (match_operand:SF 1 "register_operand" "")
15190 (unspec:SF [(match_dup 2)] UNSPEC_TAN_TAN))])
15192 (match_operand:SF 3 "immediate_operand" ""))]
15193 "standard_80387_constant_p (operands[3]) == 2"
15194 [(parallel[(set (match_dup 0) (unspec:SF [(match_dup 2)] UNSPEC_TAN_ONE))
15195 (set (match_dup 1) (unspec:SF [(match_dup 2)] UNSPEC_TAN_TAN))])]
15198 (define_expand "tansf2"
15199 [(parallel [(set (match_dup 2)
15200 (unspec:SF [(match_operand:SF 1 "register_operand" "")]
15202 (set (match_operand:SF 0 "register_operand" "")
15203 (unspec:SF [(match_dup 1)] UNSPEC_TAN_TAN))])]
15204 "TARGET_USE_FANCY_MATH_387
15205 && flag_unsafe_math_optimizations"
15207 operands[2] = gen_reg_rtx (SFmode);
15210 (define_insn "*tanxf3_1"
15211 [(set (match_operand:XF 0 "register_operand" "=f")
15212 (unspec:XF [(match_operand:XF 2 "register_operand" "0")]
15214 (set (match_operand:XF 1 "register_operand" "=u")
15215 (unspec:XF [(match_dup 2)] UNSPEC_TAN_TAN))]
15216 "TARGET_USE_FANCY_MATH_387
15217 && flag_unsafe_math_optimizations"
15219 [(set_attr "type" "fpspc")
15220 (set_attr "mode" "XF")])
15222 ;; optimize sequence: fptan
15225 ;; into fptan insn.
15228 [(parallel[(set (match_operand:XF 0 "register_operand" "")
15229 (unspec:XF [(match_operand:XF 2 "register_operand" "")]
15231 (set (match_operand:XF 1 "register_operand" "")
15232 (unspec:XF [(match_dup 2)] UNSPEC_TAN_TAN))])
15234 (match_operand:XF 3 "immediate_operand" ""))]
15235 "standard_80387_constant_p (operands[3]) == 2"
15236 [(parallel[(set (match_dup 0) (unspec:XF [(match_dup 2)] UNSPEC_TAN_ONE))
15237 (set (match_dup 1) (unspec:XF [(match_dup 2)] UNSPEC_TAN_TAN))])]
15240 (define_expand "tanxf2"
15241 [(parallel [(set (match_dup 2)
15242 (unspec:XF [(match_operand:XF 1 "register_operand" "")]
15244 (set (match_operand:XF 0 "register_operand" "")
15245 (unspec:XF [(match_dup 1)] UNSPEC_TAN_TAN))])]
15246 "TARGET_USE_FANCY_MATH_387
15247 && flag_unsafe_math_optimizations"
15249 operands[2] = gen_reg_rtx (XFmode);
15252 (define_insn "atan2df3_1"
15253 [(set (match_operand:DF 0 "register_operand" "=f")
15254 (unspec:DF [(match_operand:DF 2 "register_operand" "0")
15255 (match_operand:DF 1 "register_operand" "u")]
15257 (clobber (match_scratch:DF 3 "=1"))]
15258 "TARGET_USE_FANCY_MATH_387
15259 && flag_unsafe_math_optimizations"
15261 [(set_attr "type" "fpspc")
15262 (set_attr "mode" "DF")])
15264 (define_expand "atan2df3"
15265 [(use (match_operand:DF 0 "register_operand" "=f"))
15266 (use (match_operand:DF 2 "register_operand" "0"))
15267 (use (match_operand:DF 1 "register_operand" "u"))]
15268 "TARGET_USE_FANCY_MATH_387
15269 && flag_unsafe_math_optimizations"
15271 rtx copy = gen_reg_rtx (DFmode);
15272 emit_move_insn (copy, operands[1]);
15273 emit_insn (gen_atan2df3_1 (operands[0], copy, operands[2]));
15277 (define_expand "atandf2"
15278 [(parallel [(set (match_operand:DF 0 "register_operand" "")
15279 (unspec:DF [(match_dup 2)
15280 (match_operand:DF 1 "register_operand" "")]
15282 (clobber (match_scratch:DF 3 ""))])]
15283 "TARGET_USE_FANCY_MATH_387
15284 && flag_unsafe_math_optimizations"
15286 operands[2] = gen_reg_rtx (DFmode);
15287 emit_move_insn (operands[2], CONST1_RTX (DFmode)); /* fld1 */
15290 (define_insn "atan2sf3_1"
15291 [(set (match_operand:SF 0 "register_operand" "=f")
15292 (unspec:SF [(match_operand:SF 2 "register_operand" "0")
15293 (match_operand:SF 1 "register_operand" "u")]
15295 (clobber (match_scratch:SF 3 "=1"))]
15296 "TARGET_USE_FANCY_MATH_387
15297 && flag_unsafe_math_optimizations"
15299 [(set_attr "type" "fpspc")
15300 (set_attr "mode" "SF")])
15302 (define_expand "atan2sf3"
15303 [(use (match_operand:SF 0 "register_operand" "=f"))
15304 (use (match_operand:SF 2 "register_operand" "0"))
15305 (use (match_operand:SF 1 "register_operand" "u"))]
15306 "TARGET_USE_FANCY_MATH_387
15307 && flag_unsafe_math_optimizations"
15309 rtx copy = gen_reg_rtx (SFmode);
15310 emit_move_insn (copy, operands[1]);
15311 emit_insn (gen_atan2sf3_1 (operands[0], copy, operands[2]));
15315 (define_expand "atansf2"
15316 [(parallel [(set (match_operand:SF 0 "register_operand" "")
15317 (unspec:SF [(match_dup 2)
15318 (match_operand:SF 1 "register_operand" "")]
15320 (clobber (match_scratch:SF 3 ""))])]
15321 "TARGET_USE_FANCY_MATH_387
15322 && flag_unsafe_math_optimizations"
15324 operands[2] = gen_reg_rtx (SFmode);
15325 emit_move_insn (operands[2], CONST1_RTX (SFmode)); /* fld1 */
15328 (define_insn "atan2xf3_1"
15329 [(set (match_operand:XF 0 "register_operand" "=f")
15330 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15331 (match_operand:XF 1 "register_operand" "u")]
15333 (clobber (match_scratch:XF 3 "=1"))]
15334 "TARGET_USE_FANCY_MATH_387
15335 && flag_unsafe_math_optimizations"
15337 [(set_attr "type" "fpspc")
15338 (set_attr "mode" "XF")])
15340 (define_expand "atan2xf3"
15341 [(use (match_operand:XF 0 "register_operand" "=f"))
15342 (use (match_operand:XF 2 "register_operand" "0"))
15343 (use (match_operand:XF 1 "register_operand" "u"))]
15344 "TARGET_USE_FANCY_MATH_387
15345 && flag_unsafe_math_optimizations"
15347 rtx copy = gen_reg_rtx (XFmode);
15348 emit_move_insn (copy, operands[1]);
15349 emit_insn (gen_atan2xf3_1 (operands[0], copy, operands[2]));
15353 (define_expand "atanxf2"
15354 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15355 (unspec:XF [(match_dup 2)
15356 (match_operand:XF 1 "register_operand" "")]
15358 (clobber (match_scratch:XF 3 ""))])]
15359 "TARGET_USE_FANCY_MATH_387
15360 && flag_unsafe_math_optimizations"
15362 operands[2] = gen_reg_rtx (XFmode);
15363 emit_move_insn (operands[2], CONST1_RTX (XFmode)); /* fld1 */
15366 (define_expand "asindf2"
15367 [(set (match_dup 2)
15368 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15369 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15370 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15371 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15372 (parallel [(set (match_dup 7)
15373 (unspec:XF [(match_dup 6) (match_dup 2)]
15375 (clobber (match_scratch:XF 8 ""))])
15376 (set (match_operand:DF 0 "register_operand" "")
15377 (float_truncate:DF (match_dup 7)))]
15378 "TARGET_USE_FANCY_MATH_387
15379 && flag_unsafe_math_optimizations"
15383 for (i=2; i<8; i++)
15384 operands[i] = gen_reg_rtx (XFmode);
15386 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15389 (define_expand "asinsf2"
15390 [(set (match_dup 2)
15391 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15392 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15393 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15394 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15395 (parallel [(set (match_dup 7)
15396 (unspec:XF [(match_dup 6) (match_dup 2)]
15398 (clobber (match_scratch:XF 8 ""))])
15399 (set (match_operand:SF 0 "register_operand" "")
15400 (float_truncate:SF (match_dup 7)))]
15401 "TARGET_USE_FANCY_MATH_387
15402 && flag_unsafe_math_optimizations"
15406 for (i=2; i<8; i++)
15407 operands[i] = gen_reg_rtx (XFmode);
15409 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15412 (define_expand "asinxf2"
15413 [(set (match_dup 2)
15414 (mult:XF (match_operand:XF 1 "register_operand" "")
15416 (set (match_dup 4) (minus:XF (match_dup 3) (match_dup 2)))
15417 (set (match_dup 5) (sqrt:XF (match_dup 4)))
15418 (parallel [(set (match_operand:XF 0 "register_operand" "")
15419 (unspec:XF [(match_dup 5) (match_dup 1)]
15421 (clobber (match_scratch:XF 6 ""))])]
15422 "TARGET_USE_FANCY_MATH_387
15423 && flag_unsafe_math_optimizations"
15427 for (i=2; i<6; i++)
15428 operands[i] = gen_reg_rtx (XFmode);
15430 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15433 (define_expand "acosdf2"
15434 [(set (match_dup 2)
15435 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15436 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15437 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15438 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15439 (parallel [(set (match_dup 7)
15440 (unspec:XF [(match_dup 2) (match_dup 6)]
15442 (clobber (match_scratch:XF 8 ""))])
15443 (set (match_operand:DF 0 "register_operand" "")
15444 (float_truncate:DF (match_dup 7)))]
15445 "TARGET_USE_FANCY_MATH_387
15446 && flag_unsafe_math_optimizations"
15450 for (i=2; i<8; i++)
15451 operands[i] = gen_reg_rtx (XFmode);
15453 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15456 (define_expand "acossf2"
15457 [(set (match_dup 2)
15458 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15459 (set (match_dup 3) (mult:XF (match_dup 2) (match_dup 2)))
15460 (set (match_dup 5) (minus:XF (match_dup 4) (match_dup 3)))
15461 (set (match_dup 6) (sqrt:XF (match_dup 5)))
15462 (parallel [(set (match_dup 7)
15463 (unspec:XF [(match_dup 2) (match_dup 6)]
15465 (clobber (match_scratch:XF 8 ""))])
15466 (set (match_operand:SF 0 "register_operand" "")
15467 (float_truncate:SF (match_dup 7)))]
15468 "TARGET_USE_FANCY_MATH_387
15469 && flag_unsafe_math_optimizations"
15473 for (i=2; i<8; i++)
15474 operands[i] = gen_reg_rtx (XFmode);
15476 emit_move_insn (operands[4], CONST1_RTX (XFmode)); /* fld1 */
15479 (define_expand "acosxf2"
15480 [(set (match_dup 2)
15481 (mult:XF (match_operand:XF 1 "register_operand" "")
15483 (set (match_dup 4) (minus:XF (match_dup 3) (match_dup 2)))
15484 (set (match_dup 5) (sqrt:XF (match_dup 4)))
15485 (parallel [(set (match_operand:XF 0 "register_operand" "")
15486 (unspec:XF [(match_dup 1) (match_dup 5)]
15488 (clobber (match_scratch:XF 6 ""))])]
15489 "TARGET_USE_FANCY_MATH_387
15490 && flag_unsafe_math_optimizations"
15494 for (i=2; i<6; i++)
15495 operands[i] = gen_reg_rtx (XFmode);
15497 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15500 (define_insn "fyl2x_xf3"
15501 [(set (match_operand:XF 0 "register_operand" "=f")
15502 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15503 (match_operand:XF 1 "register_operand" "u")]
15505 (clobber (match_scratch:XF 3 "=1"))]
15506 "TARGET_USE_FANCY_MATH_387
15507 && flag_unsafe_math_optimizations"
15509 [(set_attr "type" "fpspc")
15510 (set_attr "mode" "XF")])
15512 (define_expand "logsf2"
15513 [(set (match_dup 2)
15514 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15515 (parallel [(set (match_dup 4)
15516 (unspec:XF [(match_dup 2)
15517 (match_dup 3)] UNSPEC_FYL2X))
15518 (clobber (match_scratch:XF 5 ""))])
15519 (set (match_operand:SF 0 "register_operand" "")
15520 (float_truncate:SF (match_dup 4)))]
15521 "TARGET_USE_FANCY_MATH_387
15522 && flag_unsafe_math_optimizations"
15526 operands[2] = gen_reg_rtx (XFmode);
15527 operands[3] = gen_reg_rtx (XFmode);
15528 operands[4] = gen_reg_rtx (XFmode);
15530 temp = standard_80387_constant_rtx (4); /* fldln2 */
15531 emit_move_insn (operands[3], temp);
15534 (define_expand "logdf2"
15535 [(set (match_dup 2)
15536 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15537 (parallel [(set (match_dup 4)
15538 (unspec:XF [(match_dup 2)
15539 (match_dup 3)] UNSPEC_FYL2X))
15540 (clobber (match_scratch:XF 5 ""))])
15541 (set (match_operand:DF 0 "register_operand" "")
15542 (float_truncate:DF (match_dup 4)))]
15543 "TARGET_USE_FANCY_MATH_387
15544 && flag_unsafe_math_optimizations"
15548 operands[2] = gen_reg_rtx (XFmode);
15549 operands[3] = gen_reg_rtx (XFmode);
15550 operands[4] = gen_reg_rtx (XFmode);
15552 temp = standard_80387_constant_rtx (4); /* fldln2 */
15553 emit_move_insn (operands[3], temp);
15556 (define_expand "logxf2"
15557 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15558 (unspec:XF [(match_operand:XF 1 "register_operand" "")
15559 (match_dup 2)] UNSPEC_FYL2X))
15560 (clobber (match_scratch:XF 3 ""))])]
15561 "TARGET_USE_FANCY_MATH_387
15562 && flag_unsafe_math_optimizations"
15566 operands[2] = gen_reg_rtx (XFmode);
15567 temp = standard_80387_constant_rtx (4); /* fldln2 */
15568 emit_move_insn (operands[2], temp);
15571 (define_expand "log10sf2"
15572 [(set (match_dup 2)
15573 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15574 (parallel [(set (match_dup 4)
15575 (unspec:XF [(match_dup 2)
15576 (match_dup 3)] UNSPEC_FYL2X))
15577 (clobber (match_scratch:XF 5 ""))])
15578 (set (match_operand:SF 0 "register_operand" "")
15579 (float_truncate:SF (match_dup 4)))]
15580 "TARGET_USE_FANCY_MATH_387
15581 && flag_unsafe_math_optimizations"
15585 operands[2] = gen_reg_rtx (XFmode);
15586 operands[3] = gen_reg_rtx (XFmode);
15587 operands[4] = gen_reg_rtx (XFmode);
15589 temp = standard_80387_constant_rtx (3); /* fldlg2 */
15590 emit_move_insn (operands[3], temp);
15593 (define_expand "log10df2"
15594 [(set (match_dup 2)
15595 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15596 (parallel [(set (match_dup 4)
15597 (unspec:XF [(match_dup 2)
15598 (match_dup 3)] UNSPEC_FYL2X))
15599 (clobber (match_scratch:XF 5 ""))])
15600 (set (match_operand:DF 0 "register_operand" "")
15601 (float_truncate:DF (match_dup 4)))]
15602 "TARGET_USE_FANCY_MATH_387
15603 && flag_unsafe_math_optimizations"
15607 operands[2] = gen_reg_rtx (XFmode);
15608 operands[3] = gen_reg_rtx (XFmode);
15609 operands[4] = gen_reg_rtx (XFmode);
15611 temp = standard_80387_constant_rtx (3); /* fldlg2 */
15612 emit_move_insn (operands[3], temp);
15615 (define_expand "log10xf2"
15616 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15617 (unspec:XF [(match_operand:XF 1 "register_operand" "")
15618 (match_dup 2)] UNSPEC_FYL2X))
15619 (clobber (match_scratch:XF 3 ""))])]
15620 "TARGET_USE_FANCY_MATH_387
15621 && flag_unsafe_math_optimizations"
15625 operands[2] = gen_reg_rtx (XFmode);
15626 temp = standard_80387_constant_rtx (3); /* fldlg2 */
15627 emit_move_insn (operands[2], temp);
15630 (define_expand "log2sf2"
15631 [(set (match_dup 2)
15632 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15633 (parallel [(set (match_dup 4)
15634 (unspec:XF [(match_dup 2)
15635 (match_dup 3)] UNSPEC_FYL2X))
15636 (clobber (match_scratch:XF 5 ""))])
15637 (set (match_operand:SF 0 "register_operand" "")
15638 (float_truncate:SF (match_dup 4)))]
15639 "TARGET_USE_FANCY_MATH_387
15640 && flag_unsafe_math_optimizations"
15642 operands[2] = gen_reg_rtx (XFmode);
15643 operands[3] = gen_reg_rtx (XFmode);
15644 operands[4] = gen_reg_rtx (XFmode);
15646 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15649 (define_expand "log2df2"
15650 [(set (match_dup 2)
15651 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15652 (parallel [(set (match_dup 4)
15653 (unspec:XF [(match_dup 2)
15654 (match_dup 3)] UNSPEC_FYL2X))
15655 (clobber (match_scratch:XF 5 ""))])
15656 (set (match_operand:DF 0 "register_operand" "")
15657 (float_truncate:DF (match_dup 4)))]
15658 "TARGET_USE_FANCY_MATH_387
15659 && flag_unsafe_math_optimizations"
15661 operands[2] = gen_reg_rtx (XFmode);
15662 operands[3] = gen_reg_rtx (XFmode);
15663 operands[4] = gen_reg_rtx (XFmode);
15665 emit_move_insn (operands[3], CONST1_RTX (XFmode)); /* fld1 */
15668 (define_expand "log2xf2"
15669 [(parallel [(set (match_operand:XF 0 "register_operand" "")
15670 (unspec:XF [(match_operand:XF 1 "register_operand" "")
15671 (match_dup 2)] UNSPEC_FYL2X))
15672 (clobber (match_scratch:XF 3 ""))])]
15673 "TARGET_USE_FANCY_MATH_387
15674 && flag_unsafe_math_optimizations"
15676 operands[2] = gen_reg_rtx (XFmode);
15677 emit_move_insn (operands[2], CONST1_RTX (XFmode)); /* fld1 */
15680 (define_insn "fyl2xp1_xf3"
15681 [(set (match_operand:XF 0 "register_operand" "=f")
15682 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15683 (match_operand:XF 1 "register_operand" "u")]
15685 (clobber (match_scratch:XF 3 "=1"))]
15686 "TARGET_USE_FANCY_MATH_387
15687 && flag_unsafe_math_optimizations"
15689 [(set_attr "type" "fpspc")
15690 (set_attr "mode" "XF")])
15692 (define_expand "log1psf2"
15693 [(use (match_operand:SF 0 "register_operand" ""))
15694 (use (match_operand:SF 1 "register_operand" ""))]
15695 "TARGET_USE_FANCY_MATH_387
15696 && flag_unsafe_math_optimizations"
15698 rtx op0 = gen_reg_rtx (XFmode);
15699 rtx op1 = gen_reg_rtx (XFmode);
15701 emit_insn (gen_extendsfxf2 (op1, operands[1]));
15702 ix86_emit_i387_log1p (op0, op1);
15703 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op0));
15707 (define_expand "log1pdf2"
15708 [(use (match_operand:DF 0 "register_operand" ""))
15709 (use (match_operand:DF 1 "register_operand" ""))]
15710 "TARGET_USE_FANCY_MATH_387
15711 && flag_unsafe_math_optimizations"
15713 rtx op0 = gen_reg_rtx (XFmode);
15714 rtx op1 = gen_reg_rtx (XFmode);
15716 emit_insn (gen_extenddfxf2 (op1, operands[1]));
15717 ix86_emit_i387_log1p (op0, op1);
15718 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op0));
15722 (define_expand "log1pxf2"
15723 [(use (match_operand:XF 0 "register_operand" ""))
15724 (use (match_operand:XF 1 "register_operand" ""))]
15725 "TARGET_USE_FANCY_MATH_387
15726 && flag_unsafe_math_optimizations"
15728 ix86_emit_i387_log1p (operands[0], operands[1]);
15732 (define_insn "*fxtractxf3"
15733 [(set (match_operand:XF 0 "register_operand" "=f")
15734 (unspec:XF [(match_operand:XF 2 "register_operand" "0")]
15735 UNSPEC_XTRACT_FRACT))
15736 (set (match_operand:XF 1 "register_operand" "=u")
15737 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))]
15738 "TARGET_USE_FANCY_MATH_387
15739 && flag_unsafe_math_optimizations"
15741 [(set_attr "type" "fpspc")
15742 (set_attr "mode" "XF")])
15744 (define_expand "logbsf2"
15745 [(set (match_dup 2)
15746 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15747 (parallel [(set (match_dup 3)
15748 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_FRACT))
15750 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))])
15751 (set (match_operand:SF 0 "register_operand" "")
15752 (float_truncate:SF (match_dup 4)))]
15753 "TARGET_USE_FANCY_MATH_387
15754 && flag_unsafe_math_optimizations"
15756 operands[2] = gen_reg_rtx (XFmode);
15757 operands[3] = gen_reg_rtx (XFmode);
15758 operands[4] = gen_reg_rtx (XFmode);
15761 (define_expand "logbdf2"
15762 [(set (match_dup 2)
15763 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15764 (parallel [(set (match_dup 3)
15765 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_FRACT))
15767 (unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))])
15768 (set (match_operand:DF 0 "register_operand" "")
15769 (float_truncate:DF (match_dup 4)))]
15770 "TARGET_USE_FANCY_MATH_387
15771 && flag_unsafe_math_optimizations"
15773 operands[2] = gen_reg_rtx (XFmode);
15774 operands[3] = gen_reg_rtx (XFmode);
15775 operands[4] = gen_reg_rtx (XFmode);
15778 (define_expand "logbxf2"
15779 [(parallel [(set (match_dup 2)
15780 (unspec:XF [(match_operand:XF 1 "register_operand" "")]
15781 UNSPEC_XTRACT_FRACT))
15782 (set (match_operand:XF 0 "register_operand" "")
15783 (unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])]
15784 "TARGET_USE_FANCY_MATH_387
15785 && flag_unsafe_math_optimizations"
15787 operands[2] = gen_reg_rtx (XFmode);
15790 (define_expand "ilogbsi2"
15791 [(parallel [(set (match_dup 2)
15792 (unspec:XF [(match_operand:XF 1 "register_operand" "")]
15793 UNSPEC_XTRACT_FRACT))
15794 (set (match_operand:XF 3 "register_operand" "")
15795 (unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])
15796 (parallel [(set (match_operand:SI 0 "register_operand" "")
15797 (fix:SI (match_dup 3)))
15798 (clobber (reg:CC FLAGS_REG))])]
15799 "TARGET_USE_FANCY_MATH_387
15800 && flag_unsafe_math_optimizations"
15802 operands[2] = gen_reg_rtx (XFmode);
15803 operands[3] = gen_reg_rtx (XFmode);
15806 (define_insn "*f2xm1xf2"
15807 [(set (match_operand:XF 0 "register_operand" "=f")
15808 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
15810 "TARGET_USE_FANCY_MATH_387
15811 && flag_unsafe_math_optimizations"
15813 [(set_attr "type" "fpspc")
15814 (set_attr "mode" "XF")])
15816 (define_insn "*fscalexf4"
15817 [(set (match_operand:XF 0 "register_operand" "=f")
15818 (unspec:XF [(match_operand:XF 2 "register_operand" "0")
15819 (match_operand:XF 3 "register_operand" "1")]
15820 UNSPEC_FSCALE_FRACT))
15821 (set (match_operand:XF 1 "register_operand" "=u")
15822 (unspec:XF [(match_dup 2) (match_dup 3)]
15823 UNSPEC_FSCALE_EXP))]
15824 "TARGET_USE_FANCY_MATH_387
15825 && flag_unsafe_math_optimizations"
15827 [(set_attr "type" "fpspc")
15828 (set_attr "mode" "XF")])
15830 (define_expand "expsf2"
15831 [(set (match_dup 2)
15832 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15833 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15834 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15835 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15836 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15837 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15838 (parallel [(set (match_dup 10)
15839 (unspec:XF [(match_dup 9) (match_dup 5)]
15840 UNSPEC_FSCALE_FRACT))
15841 (set (match_dup 11)
15842 (unspec:XF [(match_dup 9) (match_dup 5)]
15843 UNSPEC_FSCALE_EXP))])
15844 (set (match_operand:SF 0 "register_operand" "")
15845 (float_truncate:SF (match_dup 10)))]
15846 "TARGET_USE_FANCY_MATH_387
15847 && flag_unsafe_math_optimizations"
15852 for (i=2; i<12; i++)
15853 operands[i] = gen_reg_rtx (XFmode);
15854 temp = standard_80387_constant_rtx (5); /* fldl2e */
15855 emit_move_insn (operands[3], temp);
15856 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15859 (define_expand "expdf2"
15860 [(set (match_dup 2)
15861 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15862 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15863 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15864 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15865 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15866 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15867 (parallel [(set (match_dup 10)
15868 (unspec:XF [(match_dup 9) (match_dup 5)]
15869 UNSPEC_FSCALE_FRACT))
15870 (set (match_dup 11)
15871 (unspec:XF [(match_dup 9) (match_dup 5)]
15872 UNSPEC_FSCALE_EXP))])
15873 (set (match_operand:DF 0 "register_operand" "")
15874 (float_truncate:DF (match_dup 10)))]
15875 "TARGET_USE_FANCY_MATH_387
15876 && flag_unsafe_math_optimizations"
15881 for (i=2; i<12; i++)
15882 operands[i] = gen_reg_rtx (XFmode);
15883 temp = standard_80387_constant_rtx (5); /* fldl2e */
15884 emit_move_insn (operands[3], temp);
15885 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15888 (define_expand "expxf2"
15889 [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "")
15891 (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT))
15892 (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4)))
15893 (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1))
15894 (set (match_dup 8) (plus:XF (match_dup 6) (match_dup 7)))
15895 (parallel [(set (match_operand:XF 0 "register_operand" "")
15896 (unspec:XF [(match_dup 8) (match_dup 4)]
15897 UNSPEC_FSCALE_FRACT))
15899 (unspec:XF [(match_dup 8) (match_dup 4)]
15900 UNSPEC_FSCALE_EXP))])]
15901 "TARGET_USE_FANCY_MATH_387
15902 && flag_unsafe_math_optimizations"
15907 for (i=2; i<10; i++)
15908 operands[i] = gen_reg_rtx (XFmode);
15909 temp = standard_80387_constant_rtx (5); /* fldl2e */
15910 emit_move_insn (operands[2], temp);
15911 emit_move_insn (operands[7], CONST1_RTX (XFmode)); /* fld1 */
15914 (define_expand "exp10sf2"
15915 [(set (match_dup 2)
15916 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
15917 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15918 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15919 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15920 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15921 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15922 (parallel [(set (match_dup 10)
15923 (unspec:XF [(match_dup 9) (match_dup 5)]
15924 UNSPEC_FSCALE_FRACT))
15925 (set (match_dup 11)
15926 (unspec:XF [(match_dup 9) (match_dup 5)]
15927 UNSPEC_FSCALE_EXP))])
15928 (set (match_operand:SF 0 "register_operand" "")
15929 (float_truncate:SF (match_dup 10)))]
15930 "TARGET_USE_FANCY_MATH_387
15931 && flag_unsafe_math_optimizations"
15936 for (i=2; i<12; i++)
15937 operands[i] = gen_reg_rtx (XFmode);
15938 temp = standard_80387_constant_rtx (6); /* fldl2t */
15939 emit_move_insn (operands[3], temp);
15940 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15943 (define_expand "exp10df2"
15944 [(set (match_dup 2)
15945 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
15946 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
15947 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
15948 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
15949 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
15950 (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8)))
15951 (parallel [(set (match_dup 10)
15952 (unspec:XF [(match_dup 9) (match_dup 5)]
15953 UNSPEC_FSCALE_FRACT))
15954 (set (match_dup 11)
15955 (unspec:XF [(match_dup 9) (match_dup 5)]
15956 UNSPEC_FSCALE_EXP))])
15957 (set (match_operand:DF 0 "register_operand" "")
15958 (float_truncate:DF (match_dup 10)))]
15959 "TARGET_USE_FANCY_MATH_387
15960 && flag_unsafe_math_optimizations"
15965 for (i=2; i<12; i++)
15966 operands[i] = gen_reg_rtx (XFmode);
15967 temp = standard_80387_constant_rtx (6); /* fldl2t */
15968 emit_move_insn (operands[3], temp);
15969 emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */
15972 (define_expand "exp10xf2"
15973 [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "")
15975 (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT))
15976 (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4)))
15977 (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1))
15978 (set (match_dup 8) (plus:XF (match_dup 6) (match_dup 7)))
15979 (parallel [(set (match_operand:XF 0 "register_operand" "")
15980 (unspec:XF [(match_dup 8) (match_dup 4)]
15981 UNSPEC_FSCALE_FRACT))
15983 (unspec:XF [(match_dup 8) (match_dup 4)]
15984 UNSPEC_FSCALE_EXP))])]
15985 "TARGET_USE_FANCY_MATH_387
15986 && flag_unsafe_math_optimizations"
15991 for (i=2; i<10; i++)
15992 operands[i] = gen_reg_rtx (XFmode);
15993 temp = standard_80387_constant_rtx (6); /* fldl2t */
15994 emit_move_insn (operands[2], temp);
15995 emit_move_insn (operands[7], CONST1_RTX (XFmode)); /* fld1 */
15998 (define_expand "exp2sf2"
15999 [(set (match_dup 2)
16000 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
16001 (set (match_dup 3) (unspec:XF [(match_dup 2)] UNSPEC_FRNDINT))
16002 (set (match_dup 4) (minus:XF (match_dup 2) (match_dup 3)))
16003 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_F2XM1))
16004 (set (match_dup 7) (plus:XF (match_dup 5) (match_dup 6)))
16005 (parallel [(set (match_dup 8)
16006 (unspec:XF [(match_dup 7) (match_dup 3)]
16007 UNSPEC_FSCALE_FRACT))
16009 (unspec:XF [(match_dup 7) (match_dup 3)]
16010 UNSPEC_FSCALE_EXP))])
16011 (set (match_operand:SF 0 "register_operand" "")
16012 (float_truncate:SF (match_dup 8)))]
16013 "TARGET_USE_FANCY_MATH_387
16014 && flag_unsafe_math_optimizations"
16018 for (i=2; i<10; i++)
16019 operands[i] = gen_reg_rtx (XFmode);
16020 emit_move_insn (operands[6], CONST1_RTX (XFmode)); /* fld1 */
16023 (define_expand "exp2df2"
16024 [(set (match_dup 2)
16025 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
16026 (set (match_dup 3) (unspec:XF [(match_dup 2)] UNSPEC_FRNDINT))
16027 (set (match_dup 4) (minus:XF (match_dup 2) (match_dup 3)))
16028 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_F2XM1))
16029 (set (match_dup 7) (plus:XF (match_dup 5) (match_dup 6)))
16030 (parallel [(set (match_dup 8)
16031 (unspec:XF [(match_dup 7) (match_dup 3)]
16032 UNSPEC_FSCALE_FRACT))
16034 (unspec:XF [(match_dup 7) (match_dup 3)]
16035 UNSPEC_FSCALE_EXP))])
16036 (set (match_operand:DF 0 "register_operand" "")
16037 (float_truncate:DF (match_dup 8)))]
16038 "TARGET_USE_FANCY_MATH_387
16039 && flag_unsafe_math_optimizations"
16043 for (i=2; i<10; i++)
16044 operands[i] = gen_reg_rtx (XFmode);
16045 emit_move_insn (operands[6], CONST1_RTX (XFmode)); /* fld1 */
16048 (define_expand "exp2xf2"
16049 [(set (match_dup 2) (match_operand:XF 1 "register_operand" ""))
16050 (set (match_dup 3) (unspec:XF [(match_dup 2)] UNSPEC_FRNDINT))
16051 (set (match_dup 4) (minus:XF (match_dup 2) (match_dup 3)))
16052 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_F2XM1))
16053 (set (match_dup 7) (plus:XF (match_dup 5) (match_dup 6)))
16054 (parallel [(set (match_operand:XF 0 "register_operand" "")
16055 (unspec:XF [(match_dup 7) (match_dup 3)]
16056 UNSPEC_FSCALE_FRACT))
16058 (unspec:XF [(match_dup 7) (match_dup 3)]
16059 UNSPEC_FSCALE_EXP))])]
16060 "TARGET_USE_FANCY_MATH_387
16061 && flag_unsafe_math_optimizations"
16065 for (i=2; i<9; i++)
16066 operands[i] = gen_reg_rtx (XFmode);
16067 emit_move_insn (operands[6], CONST1_RTX (XFmode)); /* fld1 */
16070 (define_expand "expm1df2"
16071 [(set (match_dup 2)
16072 (float_extend:XF (match_operand:DF 1 "register_operand" "")))
16073 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
16074 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
16075 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
16076 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
16077 (parallel [(set (match_dup 8)
16078 (unspec:XF [(match_dup 7) (match_dup 5)]
16079 UNSPEC_FSCALE_FRACT))
16081 (unspec:XF [(match_dup 7) (match_dup 5)]
16082 UNSPEC_FSCALE_EXP))])
16083 (parallel [(set (match_dup 11)
16084 (unspec:XF [(match_dup 10) (match_dup 9)]
16085 UNSPEC_FSCALE_FRACT))
16086 (set (match_dup 12)
16087 (unspec:XF [(match_dup 10) (match_dup 9)]
16088 UNSPEC_FSCALE_EXP))])
16089 (set (match_dup 13) (minus:XF (match_dup 11) (match_dup 10)))
16090 (set (match_dup 14) (plus:XF (match_dup 13) (match_dup 8)))
16091 (set (match_operand:DF 0 "register_operand" "")
16092 (float_truncate:DF (match_dup 14)))]
16093 "TARGET_USE_FANCY_MATH_387
16094 && flag_unsafe_math_optimizations"
16099 for (i=2; i<15; i++)
16100 operands[i] = gen_reg_rtx (XFmode);
16101 temp = standard_80387_constant_rtx (5); /* fldl2e */
16102 emit_move_insn (operands[3], temp);
16103 emit_move_insn (operands[10], CONST1_RTX (XFmode)); /* fld1 */
16106 (define_expand "expm1sf2"
16107 [(set (match_dup 2)
16108 (float_extend:XF (match_operand:SF 1 "register_operand" "")))
16109 (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3)))
16110 (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT))
16111 (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5)))
16112 (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1))
16113 (parallel [(set (match_dup 8)
16114 (unspec:XF [(match_dup 7) (match_dup 5)]
16115 UNSPEC_FSCALE_FRACT))
16117 (unspec:XF [(match_dup 7) (match_dup 5)]
16118 UNSPEC_FSCALE_EXP))])
16119 (parallel [(set (match_dup 11)
16120 (unspec:XF [(match_dup 10) (match_dup 9)]
16121 UNSPEC_FSCALE_FRACT))
16122 (set (match_dup 12)
16123 (unspec:XF [(match_dup 10) (match_dup 9)]
16124 UNSPEC_FSCALE_EXP))])
16125 (set (match_dup 13) (minus:XF (match_dup 11) (match_dup 10)))
16126 (set (match_dup 14) (plus:XF (match_dup 13) (match_dup 8)))
16127 (set (match_operand:SF 0 "register_operand" "")
16128 (float_truncate:SF (match_dup 14)))]
16129 "TARGET_USE_FANCY_MATH_387
16130 && flag_unsafe_math_optimizations"
16135 for (i=2; i<15; i++)
16136 operands[i] = gen_reg_rtx (XFmode);
16137 temp = standard_80387_constant_rtx (5); /* fldl2e */
16138 emit_move_insn (operands[3], temp);
16139 emit_move_insn (operands[10], CONST1_RTX (XFmode)); /* fld1 */
16142 (define_expand "expm1xf2"
16143 [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "")
16145 (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT))
16146 (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4)))
16147 (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1))
16148 (parallel [(set (match_dup 7)
16149 (unspec:XF [(match_dup 6) (match_dup 4)]
16150 UNSPEC_FSCALE_FRACT))
16152 (unspec:XF [(match_dup 6) (match_dup 4)]
16153 UNSPEC_FSCALE_EXP))])
16154 (parallel [(set (match_dup 10)
16155 (unspec:XF [(match_dup 9) (match_dup 8)]
16156 UNSPEC_FSCALE_FRACT))
16157 (set (match_dup 11)
16158 (unspec:XF [(match_dup 9) (match_dup 8)]
16159 UNSPEC_FSCALE_EXP))])
16160 (set (match_dup 12) (minus:XF (match_dup 10) (match_dup 9)))
16161 (set (match_operand:XF 0 "register_operand" "")
16162 (plus:XF (match_dup 12) (match_dup 7)))]
16163 "TARGET_USE_FANCY_MATH_387
16164 && flag_unsafe_math_optimizations"
16169 for (i=2; i<13; i++)
16170 operands[i] = gen_reg_rtx (XFmode);
16171 temp = standard_80387_constant_rtx (5); /* fldl2e */
16172 emit_move_insn (operands[2], temp);
16173 emit_move_insn (operands[9], CONST1_RTX (XFmode)); /* fld1 */
16177 (define_insn "frndintxf2"
16178 [(set (match_operand:XF 0 "register_operand" "=f")
16179 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16181 "TARGET_USE_FANCY_MATH_387
16182 && flag_unsafe_math_optimizations"
16184 [(set_attr "type" "fpspc")
16185 (set_attr "mode" "XF")])
16187 (define_expand "rintdf2"
16188 [(use (match_operand:DF 0 "register_operand" ""))
16189 (use (match_operand:DF 1 "register_operand" ""))]
16190 "TARGET_USE_FANCY_MATH_387
16191 && flag_unsafe_math_optimizations"
16193 rtx op0 = gen_reg_rtx (XFmode);
16194 rtx op1 = gen_reg_rtx (XFmode);
16196 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16197 emit_insn (gen_frndintxf2 (op0, op1));
16199 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op0));
16203 (define_expand "rintsf2"
16204 [(use (match_operand:SF 0 "register_operand" ""))
16205 (use (match_operand:SF 1 "register_operand" ""))]
16206 "TARGET_USE_FANCY_MATH_387
16207 && flag_unsafe_math_optimizations"
16209 rtx op0 = gen_reg_rtx (XFmode);
16210 rtx op1 = gen_reg_rtx (XFmode);
16212 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16213 emit_insn (gen_frndintxf2 (op0, op1));
16215 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op0));
16219 (define_expand "rintxf2"
16220 [(use (match_operand:XF 0 "register_operand" ""))
16221 (use (match_operand:XF 1 "register_operand" ""))]
16222 "TARGET_USE_FANCY_MATH_387
16223 && flag_unsafe_math_optimizations"
16225 emit_insn (gen_frndintxf2 (operands[0], operands[1]));
16229 (define_insn "frndintxf2_floor"
16230 [(set (match_operand:XF 0 "register_operand" "=f")
16231 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16232 UNSPEC_FRNDINT_FLOOR))
16233 (use (match_operand:HI 2 "memory_operand" "m"))
16234 (use (match_operand:HI 3 "memory_operand" "m"))]
16235 "TARGET_USE_FANCY_MATH_387
16236 && flag_unsafe_math_optimizations"
16237 "fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
16238 [(set_attr "type" "frndint")
16239 (set_attr "i387_cw" "floor")
16240 (set_attr "mode" "XF")])
16242 (define_expand "floordf2"
16243 [(use (match_operand:DF 0 "register_operand" ""))
16244 (use (match_operand:DF 1 "register_operand" ""))]
16245 "TARGET_USE_FANCY_MATH_387
16246 && flag_unsafe_math_optimizations"
16248 rtx op0 = gen_reg_rtx (XFmode);
16249 rtx op1 = gen_reg_rtx (XFmode);
16250 rtx op2 = assign_386_stack_local (HImode, 1);
16251 rtx op3 = assign_386_stack_local (HImode, 2);
16253 ix86_optimize_mode_switching = 1;
16255 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16256 emit_insn (gen_frndintxf2_floor (op0, op1, op2, op3));
16258 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op0));
16262 (define_expand "floorsf2"
16263 [(use (match_operand:SF 0 "register_operand" ""))
16264 (use (match_operand:SF 1 "register_operand" ""))]
16265 "TARGET_USE_FANCY_MATH_387
16266 && flag_unsafe_math_optimizations"
16268 rtx op0 = gen_reg_rtx (XFmode);
16269 rtx op1 = gen_reg_rtx (XFmode);
16270 rtx op2 = assign_386_stack_local (HImode, 1);
16271 rtx op3 = assign_386_stack_local (HImode, 2);
16273 ix86_optimize_mode_switching = 1;
16275 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16276 emit_insn (gen_frndintxf2_floor (op0, op1, op2, op3));
16278 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op0));
16282 (define_expand "floorxf2"
16283 [(use (match_operand:XF 0 "register_operand" ""))
16284 (use (match_operand:XF 1 "register_operand" ""))]
16285 "TARGET_USE_FANCY_MATH_387
16286 && flag_unsafe_math_optimizations"
16288 rtx op2 = assign_386_stack_local (HImode, 1);
16289 rtx op3 = assign_386_stack_local (HImode, 2);
16291 ix86_optimize_mode_switching = 1;
16293 emit_insn (gen_frndintxf2_floor (operands[0], operands[1], op2, op3));
16297 (define_insn "frndintxf2_ceil"
16298 [(set (match_operand:XF 0 "register_operand" "=f")
16299 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16300 UNSPEC_FRNDINT_CEIL))
16301 (use (match_operand:HI 2 "memory_operand" "m"))
16302 (use (match_operand:HI 3 "memory_operand" "m"))]
16303 "TARGET_USE_FANCY_MATH_387
16304 && flag_unsafe_math_optimizations"
16305 "fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
16306 [(set_attr "type" "frndint")
16307 (set_attr "i387_cw" "ceil")
16308 (set_attr "mode" "XF")])
16310 (define_expand "ceildf2"
16311 [(use (match_operand:DF 0 "register_operand" ""))
16312 (use (match_operand:DF 1 "register_operand" ""))]
16313 "TARGET_USE_FANCY_MATH_387
16314 && flag_unsafe_math_optimizations"
16316 rtx op0 = gen_reg_rtx (XFmode);
16317 rtx op1 = gen_reg_rtx (XFmode);
16318 rtx op2 = assign_386_stack_local (HImode, 1);
16319 rtx op3 = assign_386_stack_local (HImode, 2);
16321 ix86_optimize_mode_switching = 1;
16323 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16324 emit_insn (gen_frndintxf2_ceil (op0, op1, op2, op3));
16326 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op0));
16330 (define_expand "ceilsf2"
16331 [(use (match_operand:SF 0 "register_operand" ""))
16332 (use (match_operand:SF 1 "register_operand" ""))]
16333 "TARGET_USE_FANCY_MATH_387
16334 && flag_unsafe_math_optimizations"
16336 rtx op0 = gen_reg_rtx (XFmode);
16337 rtx op1 = gen_reg_rtx (XFmode);
16338 rtx op2 = assign_386_stack_local (HImode, 1);
16339 rtx op3 = assign_386_stack_local (HImode, 2);
16341 ix86_optimize_mode_switching = 1;
16343 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16344 emit_insn (gen_frndintxf2_ceil (op0, op1, op2, op3));
16346 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op0));
16350 (define_expand "ceilxf2"
16351 [(use (match_operand:XF 0 "register_operand" ""))
16352 (use (match_operand:XF 1 "register_operand" ""))]
16353 "TARGET_USE_FANCY_MATH_387
16354 && flag_unsafe_math_optimizations"
16356 rtx op2 = assign_386_stack_local (HImode, 1);
16357 rtx op3 = assign_386_stack_local (HImode, 2);
16359 ix86_optimize_mode_switching = 1;
16361 emit_insn (gen_frndintxf2_ceil (operands[0], operands[1], op2, op3));
16365 (define_insn "frndintxf2_trunc"
16366 [(set (match_operand:XF 0 "register_operand" "=f")
16367 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16368 UNSPEC_FRNDINT_TRUNC))
16369 (use (match_operand:HI 2 "memory_operand" "m"))
16370 (use (match_operand:HI 3 "memory_operand" "m"))]
16371 "TARGET_USE_FANCY_MATH_387
16372 && flag_unsafe_math_optimizations"
16373 "fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
16374 [(set_attr "type" "frndint")
16375 (set_attr "i387_cw" "trunc")
16376 (set_attr "mode" "XF")])
16378 (define_expand "btruncdf2"
16379 [(use (match_operand:DF 0 "register_operand" ""))
16380 (use (match_operand:DF 1 "register_operand" ""))]
16381 "TARGET_USE_FANCY_MATH_387
16382 && flag_unsafe_math_optimizations"
16384 rtx op0 = gen_reg_rtx (XFmode);
16385 rtx op1 = gen_reg_rtx (XFmode);
16386 rtx op2 = assign_386_stack_local (HImode, 1);
16387 rtx op3 = assign_386_stack_local (HImode, 2);
16389 ix86_optimize_mode_switching = 1;
16391 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16392 emit_insn (gen_frndintxf2_trunc (op0, op1, op2, op3));
16394 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op0));
16398 (define_expand "btruncsf2"
16399 [(use (match_operand:SF 0 "register_operand" ""))
16400 (use (match_operand:SF 1 "register_operand" ""))]
16401 "TARGET_USE_FANCY_MATH_387
16402 && flag_unsafe_math_optimizations"
16404 rtx op0 = gen_reg_rtx (XFmode);
16405 rtx op1 = gen_reg_rtx (XFmode);
16406 rtx op2 = assign_386_stack_local (HImode, 1);
16407 rtx op3 = assign_386_stack_local (HImode, 2);
16409 ix86_optimize_mode_switching = 1;
16411 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16412 emit_insn (gen_frndintxf2_trunc (op0, op1, op2, op3));
16414 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op0));
16418 (define_expand "btruncxf2"
16419 [(use (match_operand:XF 0 "register_operand" ""))
16420 (use (match_operand:XF 1 "register_operand" ""))]
16421 "TARGET_USE_FANCY_MATH_387
16422 && flag_unsafe_math_optimizations"
16424 rtx op2 = assign_386_stack_local (HImode, 1);
16425 rtx op3 = assign_386_stack_local (HImode, 2);
16427 ix86_optimize_mode_switching = 1;
16429 emit_insn (gen_frndintxf2_trunc (operands[0], operands[1], op2, op3));
16433 (define_insn "frndintxf2_mask_pm"
16434 [(set (match_operand:XF 0 "register_operand" "=f")
16435 (unspec:XF [(match_operand:XF 1 "register_operand" "0")]
16436 UNSPEC_FRNDINT_MASK_PM))
16437 (use (match_operand:HI 2 "memory_operand" "m"))
16438 (use (match_operand:HI 3 "memory_operand" "m"))]
16439 "TARGET_USE_FANCY_MATH_387
16440 && flag_unsafe_math_optimizations"
16441 "fldcw\t%3\n\tfrndint\n\tfclex\n\tfldcw\t%2"
16442 [(set_attr "type" "frndint")
16443 (set_attr "i387_cw" "mask_pm")
16444 (set_attr "mode" "XF")])
16446 (define_expand "nearbyintdf2"
16447 [(use (match_operand:DF 0 "register_operand" ""))
16448 (use (match_operand:DF 1 "register_operand" ""))]
16449 "TARGET_USE_FANCY_MATH_387
16450 && flag_unsafe_math_optimizations"
16452 rtx op0 = gen_reg_rtx (XFmode);
16453 rtx op1 = gen_reg_rtx (XFmode);
16454 rtx op2 = assign_386_stack_local (HImode, 1);
16455 rtx op3 = assign_386_stack_local (HImode, 2);
16457 ix86_optimize_mode_switching = 1;
16459 emit_insn (gen_extenddfxf2 (op1, operands[1]));
16460 emit_insn (gen_frndintxf2_mask_pm (op0, op1, op2, op3));
16462 emit_insn (gen_truncxfdf2_i387_noop (operands[0], op0));
16466 (define_expand "nearbyintsf2"
16467 [(use (match_operand:SF 0 "register_operand" ""))
16468 (use (match_operand:SF 1 "register_operand" ""))]
16469 "TARGET_USE_FANCY_MATH_387
16470 && flag_unsafe_math_optimizations"
16472 rtx op0 = gen_reg_rtx (XFmode);
16473 rtx op1 = gen_reg_rtx (XFmode);
16474 rtx op2 = assign_386_stack_local (HImode, 1);
16475 rtx op3 = assign_386_stack_local (HImode, 2);
16477 ix86_optimize_mode_switching = 1;
16479 emit_insn (gen_extendsfxf2 (op1, operands[1]));
16480 emit_insn (gen_frndintxf2_mask_pm (op0, op1, op2, op3));
16482 emit_insn (gen_truncxfsf2_i387_noop (operands[0], op0));
16486 (define_expand "nearbyintxf2"
16487 [(use (match_operand:XF 0 "register_operand" ""))
16488 (use (match_operand:XF 1 "register_operand" ""))]
16489 "TARGET_USE_FANCY_MATH_387
16490 && flag_unsafe_math_optimizations"
16492 rtx op2 = assign_386_stack_local (HImode, 1);
16493 rtx op3 = assign_386_stack_local (HImode, 2);
16495 ix86_optimize_mode_switching = 1;
16497 emit_insn (gen_frndintxf2_mask_pm (operands[0], operands[1],
16503 ;; Block operation instructions
16506 [(set (reg:SI DIRFLAG_REG) (const_int 0))]
16509 [(set_attr "type" "cld")])
16511 (define_expand "movmemsi"
16512 [(use (match_operand:BLK 0 "memory_operand" ""))
16513 (use (match_operand:BLK 1 "memory_operand" ""))
16514 (use (match_operand:SI 2 "nonmemory_operand" ""))
16515 (use (match_operand:SI 3 "const_int_operand" ""))]
16518 if (ix86_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
16524 (define_expand "movmemdi"
16525 [(use (match_operand:BLK 0 "memory_operand" ""))
16526 (use (match_operand:BLK 1 "memory_operand" ""))
16527 (use (match_operand:DI 2 "nonmemory_operand" ""))
16528 (use (match_operand:DI 3 "const_int_operand" ""))]
16531 if (ix86_expand_movmem (operands[0], operands[1], operands[2], operands[3]))
16537 ;; Most CPUs don't like single string operations
16538 ;; Handle this case here to simplify previous expander.
16540 (define_expand "strmov"
16541 [(set (match_dup 4) (match_operand 3 "memory_operand" ""))
16542 (set (match_operand 1 "memory_operand" "") (match_dup 4))
16543 (parallel [(set (match_operand 0 "register_operand" "") (match_dup 5))
16544 (clobber (reg:CC FLAGS_REG))])
16545 (parallel [(set (match_operand 2 "register_operand" "") (match_dup 6))
16546 (clobber (reg:CC FLAGS_REG))])]
16549 rtx adjust = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[1])));
16551 /* If .md ever supports :P for Pmode, these can be directly
16552 in the pattern above. */
16553 operands[5] = gen_rtx_PLUS (Pmode, operands[0], adjust);
16554 operands[6] = gen_rtx_PLUS (Pmode, operands[2], adjust);
16556 if (TARGET_SINGLE_STRINGOP || optimize_size)
16558 emit_insn (gen_strmov_singleop (operands[0], operands[1],
16559 operands[2], operands[3],
16560 operands[5], operands[6]));
16564 operands[4] = gen_reg_rtx (GET_MODE (operands[1]));
16567 (define_expand "strmov_singleop"
16568 [(parallel [(set (match_operand 1 "memory_operand" "")
16569 (match_operand 3 "memory_operand" ""))
16570 (set (match_operand 0 "register_operand" "")
16571 (match_operand 4 "" ""))
16572 (set (match_operand 2 "register_operand" "")
16573 (match_operand 5 "" ""))
16574 (use (reg:SI DIRFLAG_REG))])]
16575 "TARGET_SINGLE_STRINGOP || optimize_size"
16578 (define_insn "*strmovdi_rex_1"
16579 [(set (mem:DI (match_operand:DI 2 "register_operand" "0"))
16580 (mem:DI (match_operand:DI 3 "register_operand" "1")))
16581 (set (match_operand:DI 0 "register_operand" "=D")
16582 (plus:DI (match_dup 2)
16584 (set (match_operand:DI 1 "register_operand" "=S")
16585 (plus:DI (match_dup 3)
16587 (use (reg:SI DIRFLAG_REG))]
16588 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16590 [(set_attr "type" "str")
16591 (set_attr "mode" "DI")
16592 (set_attr "memory" "both")])
16594 (define_insn "*strmovsi_1"
16595 [(set (mem:SI (match_operand:SI 2 "register_operand" "0"))
16596 (mem:SI (match_operand:SI 3 "register_operand" "1")))
16597 (set (match_operand:SI 0 "register_operand" "=D")
16598 (plus:SI (match_dup 2)
16600 (set (match_operand:SI 1 "register_operand" "=S")
16601 (plus:SI (match_dup 3)
16603 (use (reg:SI DIRFLAG_REG))]
16604 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16606 [(set_attr "type" "str")
16607 (set_attr "mode" "SI")
16608 (set_attr "memory" "both")])
16610 (define_insn "*strmovsi_rex_1"
16611 [(set (mem:SI (match_operand:DI 2 "register_operand" "0"))
16612 (mem:SI (match_operand:DI 3 "register_operand" "1")))
16613 (set (match_operand:DI 0 "register_operand" "=D")
16614 (plus:DI (match_dup 2)
16616 (set (match_operand:DI 1 "register_operand" "=S")
16617 (plus:DI (match_dup 3)
16619 (use (reg:SI DIRFLAG_REG))]
16620 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16622 [(set_attr "type" "str")
16623 (set_attr "mode" "SI")
16624 (set_attr "memory" "both")])
16626 (define_insn "*strmovhi_1"
16627 [(set (mem:HI (match_operand:SI 2 "register_operand" "0"))
16628 (mem:HI (match_operand:SI 3 "register_operand" "1")))
16629 (set (match_operand:SI 0 "register_operand" "=D")
16630 (plus:SI (match_dup 2)
16632 (set (match_operand:SI 1 "register_operand" "=S")
16633 (plus:SI (match_dup 3)
16635 (use (reg:SI DIRFLAG_REG))]
16636 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16638 [(set_attr "type" "str")
16639 (set_attr "memory" "both")
16640 (set_attr "mode" "HI")])
16642 (define_insn "*strmovhi_rex_1"
16643 [(set (mem:HI (match_operand:DI 2 "register_operand" "0"))
16644 (mem:HI (match_operand:DI 3 "register_operand" "1")))
16645 (set (match_operand:DI 0 "register_operand" "=D")
16646 (plus:DI (match_dup 2)
16648 (set (match_operand:DI 1 "register_operand" "=S")
16649 (plus:DI (match_dup 3)
16651 (use (reg:SI DIRFLAG_REG))]
16652 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16654 [(set_attr "type" "str")
16655 (set_attr "memory" "both")
16656 (set_attr "mode" "HI")])
16658 (define_insn "*strmovqi_1"
16659 [(set (mem:QI (match_operand:SI 2 "register_operand" "0"))
16660 (mem:QI (match_operand:SI 3 "register_operand" "1")))
16661 (set (match_operand:SI 0 "register_operand" "=D")
16662 (plus:SI (match_dup 2)
16664 (set (match_operand:SI 1 "register_operand" "=S")
16665 (plus:SI (match_dup 3)
16667 (use (reg:SI DIRFLAG_REG))]
16668 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16670 [(set_attr "type" "str")
16671 (set_attr "memory" "both")
16672 (set_attr "mode" "QI")])
16674 (define_insn "*strmovqi_rex_1"
16675 [(set (mem:QI (match_operand:DI 2 "register_operand" "0"))
16676 (mem:QI (match_operand:DI 3 "register_operand" "1")))
16677 (set (match_operand:DI 0 "register_operand" "=D")
16678 (plus:DI (match_dup 2)
16680 (set (match_operand:DI 1 "register_operand" "=S")
16681 (plus:DI (match_dup 3)
16683 (use (reg:SI DIRFLAG_REG))]
16684 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16686 [(set_attr "type" "str")
16687 (set_attr "memory" "both")
16688 (set_attr "mode" "QI")])
16690 (define_expand "rep_mov"
16691 [(parallel [(set (match_operand 4 "register_operand" "") (const_int 0))
16692 (set (match_operand 0 "register_operand" "")
16693 (match_operand 5 "" ""))
16694 (set (match_operand 2 "register_operand" "")
16695 (match_operand 6 "" ""))
16696 (set (match_operand 1 "memory_operand" "")
16697 (match_operand 3 "memory_operand" ""))
16698 (use (match_dup 4))
16699 (use (reg:SI DIRFLAG_REG))])]
16703 (define_insn "*rep_movdi_rex64"
16704 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
16705 (set (match_operand:DI 0 "register_operand" "=D")
16706 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
16708 (match_operand:DI 3 "register_operand" "0")))
16709 (set (match_operand:DI 1 "register_operand" "=S")
16710 (plus:DI (ashift:DI (match_dup 5) (const_int 3))
16711 (match_operand:DI 4 "register_operand" "1")))
16712 (set (mem:BLK (match_dup 3))
16713 (mem:BLK (match_dup 4)))
16714 (use (match_dup 5))
16715 (use (reg:SI DIRFLAG_REG))]
16717 "{rep\;movsq|rep movsq}"
16718 [(set_attr "type" "str")
16719 (set_attr "prefix_rep" "1")
16720 (set_attr "memory" "both")
16721 (set_attr "mode" "DI")])
16723 (define_insn "*rep_movsi"
16724 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
16725 (set (match_operand:SI 0 "register_operand" "=D")
16726 (plus:SI (ashift:SI (match_operand:SI 5 "register_operand" "2")
16728 (match_operand:SI 3 "register_operand" "0")))
16729 (set (match_operand:SI 1 "register_operand" "=S")
16730 (plus:SI (ashift:SI (match_dup 5) (const_int 2))
16731 (match_operand:SI 4 "register_operand" "1")))
16732 (set (mem:BLK (match_dup 3))
16733 (mem:BLK (match_dup 4)))
16734 (use (match_dup 5))
16735 (use (reg:SI DIRFLAG_REG))]
16737 "{rep\;movsl|rep movsd}"
16738 [(set_attr "type" "str")
16739 (set_attr "prefix_rep" "1")
16740 (set_attr "memory" "both")
16741 (set_attr "mode" "SI")])
16743 (define_insn "*rep_movsi_rex64"
16744 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
16745 (set (match_operand:DI 0 "register_operand" "=D")
16746 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
16748 (match_operand:DI 3 "register_operand" "0")))
16749 (set (match_operand:DI 1 "register_operand" "=S")
16750 (plus:DI (ashift:DI (match_dup 5) (const_int 2))
16751 (match_operand:DI 4 "register_operand" "1")))
16752 (set (mem:BLK (match_dup 3))
16753 (mem:BLK (match_dup 4)))
16754 (use (match_dup 5))
16755 (use (reg:SI DIRFLAG_REG))]
16757 "{rep\;movsl|rep movsd}"
16758 [(set_attr "type" "str")
16759 (set_attr "prefix_rep" "1")
16760 (set_attr "memory" "both")
16761 (set_attr "mode" "SI")])
16763 (define_insn "*rep_movqi"
16764 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
16765 (set (match_operand:SI 0 "register_operand" "=D")
16766 (plus:SI (match_operand:SI 3 "register_operand" "0")
16767 (match_operand:SI 5 "register_operand" "2")))
16768 (set (match_operand:SI 1 "register_operand" "=S")
16769 (plus:SI (match_operand:SI 4 "register_operand" "1") (match_dup 5)))
16770 (set (mem:BLK (match_dup 3))
16771 (mem:BLK (match_dup 4)))
16772 (use (match_dup 5))
16773 (use (reg:SI DIRFLAG_REG))]
16775 "{rep\;movsb|rep movsb}"
16776 [(set_attr "type" "str")
16777 (set_attr "prefix_rep" "1")
16778 (set_attr "memory" "both")
16779 (set_attr "mode" "SI")])
16781 (define_insn "*rep_movqi_rex64"
16782 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
16783 (set (match_operand:DI 0 "register_operand" "=D")
16784 (plus:DI (match_operand:DI 3 "register_operand" "0")
16785 (match_operand:DI 5 "register_operand" "2")))
16786 (set (match_operand:DI 1 "register_operand" "=S")
16787 (plus:DI (match_operand:DI 4 "register_operand" "1") (match_dup 5)))
16788 (set (mem:BLK (match_dup 3))
16789 (mem:BLK (match_dup 4)))
16790 (use (match_dup 5))
16791 (use (reg:SI DIRFLAG_REG))]
16793 "{rep\;movsb|rep movsb}"
16794 [(set_attr "type" "str")
16795 (set_attr "prefix_rep" "1")
16796 (set_attr "memory" "both")
16797 (set_attr "mode" "SI")])
16799 (define_expand "clrmemsi"
16800 [(use (match_operand:BLK 0 "memory_operand" ""))
16801 (use (match_operand:SI 1 "nonmemory_operand" ""))
16802 (use (match_operand 2 "const_int_operand" ""))]
16805 if (ix86_expand_clrmem (operands[0], operands[1], operands[2]))
16811 (define_expand "clrmemdi"
16812 [(use (match_operand:BLK 0 "memory_operand" ""))
16813 (use (match_operand:DI 1 "nonmemory_operand" ""))
16814 (use (match_operand 2 "const_int_operand" ""))]
16817 if (ix86_expand_clrmem (operands[0], operands[1], operands[2]))
16823 ;; Most CPUs don't like single string operations
16824 ;; Handle this case here to simplify previous expander.
16826 (define_expand "strset"
16827 [(set (match_operand 1 "memory_operand" "")
16828 (match_operand 2 "register_operand" ""))
16829 (parallel [(set (match_operand 0 "register_operand" "")
16831 (clobber (reg:CC FLAGS_REG))])]
16834 if (GET_MODE (operands[1]) != GET_MODE (operands[2]))
16835 operands[1] = adjust_address_nv (operands[1], GET_MODE (operands[2]), 0);
16837 /* If .md ever supports :P for Pmode, this can be directly
16838 in the pattern above. */
16839 operands[3] = gen_rtx_PLUS (Pmode, operands[0],
16840 GEN_INT (GET_MODE_SIZE (GET_MODE
16842 if (TARGET_SINGLE_STRINGOP || optimize_size)
16844 emit_insn (gen_strset_singleop (operands[0], operands[1], operands[2],
16850 (define_expand "strset_singleop"
16851 [(parallel [(set (match_operand 1 "memory_operand" "")
16852 (match_operand 2 "register_operand" ""))
16853 (set (match_operand 0 "register_operand" "")
16854 (match_operand 3 "" ""))
16855 (use (reg:SI DIRFLAG_REG))])]
16856 "TARGET_SINGLE_STRINGOP || optimize_size"
16859 (define_insn "*strsetdi_rex_1"
16860 [(set (mem:DI (match_operand:DI 1 "register_operand" "0"))
16861 (match_operand:DI 2 "register_operand" "a"))
16862 (set (match_operand:DI 0 "register_operand" "=D")
16863 (plus:DI (match_dup 1)
16865 (use (reg:SI DIRFLAG_REG))]
16866 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16868 [(set_attr "type" "str")
16869 (set_attr "memory" "store")
16870 (set_attr "mode" "DI")])
16872 (define_insn "*strsetsi_1"
16873 [(set (mem:SI (match_operand:SI 1 "register_operand" "0"))
16874 (match_operand:SI 2 "register_operand" "a"))
16875 (set (match_operand:SI 0 "register_operand" "=D")
16876 (plus:SI (match_dup 1)
16878 (use (reg:SI DIRFLAG_REG))]
16879 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16881 [(set_attr "type" "str")
16882 (set_attr "memory" "store")
16883 (set_attr "mode" "SI")])
16885 (define_insn "*strsetsi_rex_1"
16886 [(set (mem:SI (match_operand:DI 1 "register_operand" "0"))
16887 (match_operand:SI 2 "register_operand" "a"))
16888 (set (match_operand:DI 0 "register_operand" "=D")
16889 (plus:DI (match_dup 1)
16891 (use (reg:SI DIRFLAG_REG))]
16892 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16894 [(set_attr "type" "str")
16895 (set_attr "memory" "store")
16896 (set_attr "mode" "SI")])
16898 (define_insn "*strsethi_1"
16899 [(set (mem:HI (match_operand:SI 1 "register_operand" "0"))
16900 (match_operand:HI 2 "register_operand" "a"))
16901 (set (match_operand:SI 0 "register_operand" "=D")
16902 (plus:SI (match_dup 1)
16904 (use (reg:SI DIRFLAG_REG))]
16905 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16907 [(set_attr "type" "str")
16908 (set_attr "memory" "store")
16909 (set_attr "mode" "HI")])
16911 (define_insn "*strsethi_rex_1"
16912 [(set (mem:HI (match_operand:DI 1 "register_operand" "0"))
16913 (match_operand:HI 2 "register_operand" "a"))
16914 (set (match_operand:DI 0 "register_operand" "=D")
16915 (plus:DI (match_dup 1)
16917 (use (reg:SI DIRFLAG_REG))]
16918 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16920 [(set_attr "type" "str")
16921 (set_attr "memory" "store")
16922 (set_attr "mode" "HI")])
16924 (define_insn "*strsetqi_1"
16925 [(set (mem:QI (match_operand:SI 1 "register_operand" "0"))
16926 (match_operand:QI 2 "register_operand" "a"))
16927 (set (match_operand:SI 0 "register_operand" "=D")
16928 (plus:SI (match_dup 1)
16930 (use (reg:SI DIRFLAG_REG))]
16931 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16933 [(set_attr "type" "str")
16934 (set_attr "memory" "store")
16935 (set_attr "mode" "QI")])
16937 (define_insn "*strsetqi_rex_1"
16938 [(set (mem:QI (match_operand:DI 1 "register_operand" "0"))
16939 (match_operand:QI 2 "register_operand" "a"))
16940 (set (match_operand:DI 0 "register_operand" "=D")
16941 (plus:DI (match_dup 1)
16943 (use (reg:SI DIRFLAG_REG))]
16944 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16946 [(set_attr "type" "str")
16947 (set_attr "memory" "store")
16948 (set_attr "mode" "QI")])
16950 (define_expand "rep_stos"
16951 [(parallel [(set (match_operand 1 "register_operand" "") (const_int 0))
16952 (set (match_operand 0 "register_operand" "")
16953 (match_operand 4 "" ""))
16954 (set (match_operand 2 "memory_operand" "") (const_int 0))
16955 (use (match_operand 3 "register_operand" ""))
16956 (use (match_dup 1))
16957 (use (reg:SI DIRFLAG_REG))])]
16961 (define_insn "*rep_stosdi_rex64"
16962 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
16963 (set (match_operand:DI 0 "register_operand" "=D")
16964 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
16966 (match_operand:DI 3 "register_operand" "0")))
16967 (set (mem:BLK (match_dup 3))
16969 (use (match_operand:DI 2 "register_operand" "a"))
16970 (use (match_dup 4))
16971 (use (reg:SI DIRFLAG_REG))]
16973 "{rep\;stosq|rep stosq}"
16974 [(set_attr "type" "str")
16975 (set_attr "prefix_rep" "1")
16976 (set_attr "memory" "store")
16977 (set_attr "mode" "DI")])
16979 (define_insn "*rep_stossi"
16980 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
16981 (set (match_operand:SI 0 "register_operand" "=D")
16982 (plus:SI (ashift:SI (match_operand:SI 4 "register_operand" "1")
16984 (match_operand:SI 3 "register_operand" "0")))
16985 (set (mem:BLK (match_dup 3))
16987 (use (match_operand:SI 2 "register_operand" "a"))
16988 (use (match_dup 4))
16989 (use (reg:SI DIRFLAG_REG))]
16991 "{rep\;stosl|rep stosd}"
16992 [(set_attr "type" "str")
16993 (set_attr "prefix_rep" "1")
16994 (set_attr "memory" "store")
16995 (set_attr "mode" "SI")])
16997 (define_insn "*rep_stossi_rex64"
16998 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
16999 (set (match_operand:DI 0 "register_operand" "=D")
17000 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
17002 (match_operand:DI 3 "register_operand" "0")))
17003 (set (mem:BLK (match_dup 3))
17005 (use (match_operand:SI 2 "register_operand" "a"))
17006 (use (match_dup 4))
17007 (use (reg:SI DIRFLAG_REG))]
17009 "{rep\;stosl|rep stosd}"
17010 [(set_attr "type" "str")
17011 (set_attr "prefix_rep" "1")
17012 (set_attr "memory" "store")
17013 (set_attr "mode" "SI")])
17015 (define_insn "*rep_stosqi"
17016 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
17017 (set (match_operand:SI 0 "register_operand" "=D")
17018 (plus:SI (match_operand:SI 3 "register_operand" "0")
17019 (match_operand:SI 4 "register_operand" "1")))
17020 (set (mem:BLK (match_dup 3))
17022 (use (match_operand:QI 2 "register_operand" "a"))
17023 (use (match_dup 4))
17024 (use (reg:SI DIRFLAG_REG))]
17026 "{rep\;stosb|rep stosb}"
17027 [(set_attr "type" "str")
17028 (set_attr "prefix_rep" "1")
17029 (set_attr "memory" "store")
17030 (set_attr "mode" "QI")])
17032 (define_insn "*rep_stosqi_rex64"
17033 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
17034 (set (match_operand:DI 0 "register_operand" "=D")
17035 (plus:DI (match_operand:DI 3 "register_operand" "0")
17036 (match_operand:DI 4 "register_operand" "1")))
17037 (set (mem:BLK (match_dup 3))
17039 (use (match_operand:QI 2 "register_operand" "a"))
17040 (use (match_dup 4))
17041 (use (reg:SI DIRFLAG_REG))]
17043 "{rep\;stosb|rep stosb}"
17044 [(set_attr "type" "str")
17045 (set_attr "prefix_rep" "1")
17046 (set_attr "memory" "store")
17047 (set_attr "mode" "QI")])
17049 (define_expand "cmpstrsi"
17050 [(set (match_operand:SI 0 "register_operand" "")
17051 (compare:SI (match_operand:BLK 1 "general_operand" "")
17052 (match_operand:BLK 2 "general_operand" "")))
17053 (use (match_operand 3 "general_operand" ""))
17054 (use (match_operand 4 "immediate_operand" ""))]
17055 "! optimize_size || TARGET_INLINE_ALL_STRINGOPS"
17057 rtx addr1, addr2, out, outlow, count, countreg, align;
17059 /* Can't use this if the user has appropriated esi or edi. */
17060 if (global_regs[4] || global_regs[5])
17064 if (GET_CODE (out) != REG)
17065 out = gen_reg_rtx (SImode);
17067 addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
17068 addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0));
17069 if (addr1 != XEXP (operands[1], 0))
17070 operands[1] = replace_equiv_address_nv (operands[1], addr1);
17071 if (addr2 != XEXP (operands[2], 0))
17072 operands[2] = replace_equiv_address_nv (operands[2], addr2);
17074 count = operands[3];
17075 countreg = ix86_zero_extend_to_Pmode (count);
17077 /* %%% Iff we are testing strict equality, we can use known alignment
17078 to good advantage. This may be possible with combine, particularly
17079 once cc0 is dead. */
17080 align = operands[4];
17082 emit_insn (gen_cld ());
17083 if (GET_CODE (count) == CONST_INT)
17085 if (INTVAL (count) == 0)
17087 emit_move_insn (operands[0], const0_rtx);
17090 emit_insn (gen_cmpstrqi_nz_1 (addr1, addr2, countreg, align,
17091 operands[1], operands[2]));
17096 emit_insn (gen_cmpdi_1_rex64 (countreg, countreg));
17098 emit_insn (gen_cmpsi_1 (countreg, countreg));
17099 emit_insn (gen_cmpstrqi_1 (addr1, addr2, countreg, align,
17100 operands[1], operands[2]));
17103 outlow = gen_lowpart (QImode, out);
17104 emit_insn (gen_cmpintqi (outlow));
17105 emit_move_insn (out, gen_rtx_SIGN_EXTEND (SImode, outlow));
17107 if (operands[0] != out)
17108 emit_move_insn (operands[0], out);
17113 ;; Produce a tri-state integer (-1, 0, 1) from condition codes.
17115 (define_expand "cmpintqi"
17116 [(set (match_dup 1)
17117 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
17119 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
17120 (parallel [(set (match_operand:QI 0 "register_operand" "")
17121 (minus:QI (match_dup 1)
17123 (clobber (reg:CC FLAGS_REG))])]
17125 "operands[1] = gen_reg_rtx (QImode);
17126 operands[2] = gen_reg_rtx (QImode);")
17128 ;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is
17129 ;; zero. Emit extra code to make sure that a zero-length compare is EQ.
17131 (define_expand "cmpstrqi_nz_1"
17132 [(parallel [(set (reg:CC FLAGS_REG)
17133 (compare:CC (match_operand 4 "memory_operand" "")
17134 (match_operand 5 "memory_operand" "")))
17135 (use (match_operand 2 "register_operand" ""))
17136 (use (match_operand:SI 3 "immediate_operand" ""))
17137 (use (reg:SI DIRFLAG_REG))
17138 (clobber (match_operand 0 "register_operand" ""))
17139 (clobber (match_operand 1 "register_operand" ""))
17140 (clobber (match_dup 2))])]
17144 (define_insn "*cmpstrqi_nz_1"
17145 [(set (reg:CC FLAGS_REG)
17146 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
17147 (mem:BLK (match_operand:SI 5 "register_operand" "1"))))
17148 (use (match_operand:SI 6 "register_operand" "2"))
17149 (use (match_operand:SI 3 "immediate_operand" "i"))
17150 (use (reg:SI DIRFLAG_REG))
17151 (clobber (match_operand:SI 0 "register_operand" "=S"))
17152 (clobber (match_operand:SI 1 "register_operand" "=D"))
17153 (clobber (match_operand:SI 2 "register_operand" "=c"))]
17156 [(set_attr "type" "str")
17157 (set_attr "mode" "QI")
17158 (set_attr "prefix_rep" "1")])
17160 (define_insn "*cmpstrqi_nz_rex_1"
17161 [(set (reg:CC FLAGS_REG)
17162 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
17163 (mem:BLK (match_operand:DI 5 "register_operand" "1"))))
17164 (use (match_operand:DI 6 "register_operand" "2"))
17165 (use (match_operand:SI 3 "immediate_operand" "i"))
17166 (use (reg:SI DIRFLAG_REG))
17167 (clobber (match_operand:DI 0 "register_operand" "=S"))
17168 (clobber (match_operand:DI 1 "register_operand" "=D"))
17169 (clobber (match_operand:DI 2 "register_operand" "=c"))]
17172 [(set_attr "type" "str")
17173 (set_attr "mode" "QI")
17174 (set_attr "prefix_rep" "1")])
17176 ;; The same, but the count is not known to not be zero.
17178 (define_expand "cmpstrqi_1"
17179 [(parallel [(set (reg:CC FLAGS_REG)
17180 (if_then_else:CC (ne (match_operand 2 "register_operand" "")
17182 (compare:CC (match_operand 4 "memory_operand" "")
17183 (match_operand 5 "memory_operand" ""))
17185 (use (match_operand:SI 3 "immediate_operand" ""))
17186 (use (reg:CC FLAGS_REG))
17187 (use (reg:SI DIRFLAG_REG))
17188 (clobber (match_operand 0 "register_operand" ""))
17189 (clobber (match_operand 1 "register_operand" ""))
17190 (clobber (match_dup 2))])]
17194 (define_insn "*cmpstrqi_1"
17195 [(set (reg:CC FLAGS_REG)
17196 (if_then_else:CC (ne (match_operand:SI 6 "register_operand" "2")
17198 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
17199 (mem:BLK (match_operand:SI 5 "register_operand" "1")))
17201 (use (match_operand:SI 3 "immediate_operand" "i"))
17202 (use (reg:CC FLAGS_REG))
17203 (use (reg:SI DIRFLAG_REG))
17204 (clobber (match_operand:SI 0 "register_operand" "=S"))
17205 (clobber (match_operand:SI 1 "register_operand" "=D"))
17206 (clobber (match_operand:SI 2 "register_operand" "=c"))]
17209 [(set_attr "type" "str")
17210 (set_attr "mode" "QI")
17211 (set_attr "prefix_rep" "1")])
17213 (define_insn "*cmpstrqi_rex_1"
17214 [(set (reg:CC FLAGS_REG)
17215 (if_then_else:CC (ne (match_operand:DI 6 "register_operand" "2")
17217 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
17218 (mem:BLK (match_operand:DI 5 "register_operand" "1")))
17220 (use (match_operand:SI 3 "immediate_operand" "i"))
17221 (use (reg:CC FLAGS_REG))
17222 (use (reg:SI DIRFLAG_REG))
17223 (clobber (match_operand:DI 0 "register_operand" "=S"))
17224 (clobber (match_operand:DI 1 "register_operand" "=D"))
17225 (clobber (match_operand:DI 2 "register_operand" "=c"))]
17228 [(set_attr "type" "str")
17229 (set_attr "mode" "QI")
17230 (set_attr "prefix_rep" "1")])
17232 (define_expand "strlensi"
17233 [(set (match_operand:SI 0 "register_operand" "")
17234 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
17235 (match_operand:QI 2 "immediate_operand" "")
17236 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
17239 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
17245 (define_expand "strlendi"
17246 [(set (match_operand:DI 0 "register_operand" "")
17247 (unspec:DI [(match_operand:BLK 1 "general_operand" "")
17248 (match_operand:QI 2 "immediate_operand" "")
17249 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
17252 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
17258 (define_expand "strlenqi_1"
17259 [(parallel [(set (match_operand 0 "register_operand" "") (match_operand 2 "" ""))
17260 (use (reg:SI DIRFLAG_REG))
17261 (clobber (match_operand 1 "register_operand" ""))
17262 (clobber (reg:CC FLAGS_REG))])]
17266 (define_insn "*strlenqi_1"
17267 [(set (match_operand:SI 0 "register_operand" "=&c")
17268 (unspec:SI [(mem:BLK (match_operand:SI 5 "register_operand" "1"))
17269 (match_operand:QI 2 "register_operand" "a")
17270 (match_operand:SI 3 "immediate_operand" "i")
17271 (match_operand:SI 4 "register_operand" "0")] UNSPEC_SCAS))
17272 (use (reg:SI DIRFLAG_REG))
17273 (clobber (match_operand:SI 1 "register_operand" "=D"))
17274 (clobber (reg:CC FLAGS_REG))]
17277 [(set_attr "type" "str")
17278 (set_attr "mode" "QI")
17279 (set_attr "prefix_rep" "1")])
17281 (define_insn "*strlenqi_rex_1"
17282 [(set (match_operand:DI 0 "register_operand" "=&c")
17283 (unspec:DI [(mem:BLK (match_operand:DI 5 "register_operand" "1"))
17284 (match_operand:QI 2 "register_operand" "a")
17285 (match_operand:DI 3 "immediate_operand" "i")
17286 (match_operand:DI 4 "register_operand" "0")] UNSPEC_SCAS))
17287 (use (reg:SI DIRFLAG_REG))
17288 (clobber (match_operand:DI 1 "register_operand" "=D"))
17289 (clobber (reg:CC FLAGS_REG))]
17292 [(set_attr "type" "str")
17293 (set_attr "mode" "QI")
17294 (set_attr "prefix_rep" "1")])
17296 ;; Peephole optimizations to clean up after cmpstr*. This should be
17297 ;; handled in combine, but it is not currently up to the task.
17298 ;; When used for their truth value, the cmpstr* expanders generate
17307 ;; The intermediate three instructions are unnecessary.
17309 ;; This one handles cmpstr*_nz_1...
17312 (set (reg:CC FLAGS_REG)
17313 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
17314 (mem:BLK (match_operand 5 "register_operand" ""))))
17315 (use (match_operand 6 "register_operand" ""))
17316 (use (match_operand:SI 3 "immediate_operand" ""))
17317 (use (reg:SI DIRFLAG_REG))
17318 (clobber (match_operand 0 "register_operand" ""))
17319 (clobber (match_operand 1 "register_operand" ""))
17320 (clobber (match_operand 2 "register_operand" ""))])
17321 (set (match_operand:QI 7 "register_operand" "")
17322 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
17323 (set (match_operand:QI 8 "register_operand" "")
17324 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
17325 (set (reg FLAGS_REG)
17326 (compare (match_dup 7) (match_dup 8)))
17328 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
17330 (set (reg:CC FLAGS_REG)
17331 (compare:CC (mem:BLK (match_dup 4))
17332 (mem:BLK (match_dup 5))))
17333 (use (match_dup 6))
17334 (use (match_dup 3))
17335 (use (reg:SI DIRFLAG_REG))
17336 (clobber (match_dup 0))
17337 (clobber (match_dup 1))
17338 (clobber (match_dup 2))])]
17341 ;; ...and this one handles cmpstr*_1.
17344 (set (reg:CC FLAGS_REG)
17345 (if_then_else:CC (ne (match_operand 6 "register_operand" "")
17347 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
17348 (mem:BLK (match_operand 5 "register_operand" "")))
17350 (use (match_operand:SI 3 "immediate_operand" ""))
17351 (use (reg:CC FLAGS_REG))
17352 (use (reg:SI DIRFLAG_REG))
17353 (clobber (match_operand 0 "register_operand" ""))
17354 (clobber (match_operand 1 "register_operand" ""))
17355 (clobber (match_operand 2 "register_operand" ""))])
17356 (set (match_operand:QI 7 "register_operand" "")
17357 (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
17358 (set (match_operand:QI 8 "register_operand" "")
17359 (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
17360 (set (reg FLAGS_REG)
17361 (compare (match_dup 7) (match_dup 8)))
17363 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
17365 (set (reg:CC FLAGS_REG)
17366 (if_then_else:CC (ne (match_dup 6)
17368 (compare:CC (mem:BLK (match_dup 4))
17369 (mem:BLK (match_dup 5)))
17371 (use (match_dup 3))
17372 (use (reg:CC FLAGS_REG))
17373 (use (reg:SI DIRFLAG_REG))
17374 (clobber (match_dup 0))
17375 (clobber (match_dup 1))
17376 (clobber (match_dup 2))])]
17381 ;; Conditional move instructions.
17383 (define_expand "movdicc"
17384 [(set (match_operand:DI 0 "register_operand" "")
17385 (if_then_else:DI (match_operand 1 "comparison_operator" "")
17386 (match_operand:DI 2 "general_operand" "")
17387 (match_operand:DI 3 "general_operand" "")))]
17389 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17391 (define_insn "x86_movdicc_0_m1_rex64"
17392 [(set (match_operand:DI 0 "register_operand" "=r")
17393 (if_then_else:DI (match_operand 1 "ix86_carry_flag_operator" "")
17396 (clobber (reg:CC FLAGS_REG))]
17399 ; Since we don't have the proper number of operands for an alu insn,
17400 ; fill in all the blanks.
17401 [(set_attr "type" "alu")
17402 (set_attr "pent_pair" "pu")
17403 (set_attr "memory" "none")
17404 (set_attr "imm_disp" "false")
17405 (set_attr "mode" "DI")
17406 (set_attr "length_immediate" "0")])
17408 (define_insn "movdicc_c_rex64"
17409 [(set (match_operand:DI 0 "register_operand" "=r,r")
17410 (if_then_else:DI (match_operator 1 "ix86_comparison_operator"
17411 [(reg FLAGS_REG) (const_int 0)])
17412 (match_operand:DI 2 "nonimmediate_operand" "rm,0")
17413 (match_operand:DI 3 "nonimmediate_operand" "0,rm")))]
17414 "TARGET_64BIT && TARGET_CMOVE
17415 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17417 cmov%O2%C1\t{%2, %0|%0, %2}
17418 cmov%O2%c1\t{%3, %0|%0, %3}"
17419 [(set_attr "type" "icmov")
17420 (set_attr "mode" "DI")])
17422 (define_expand "movsicc"
17423 [(set (match_operand:SI 0 "register_operand" "")
17424 (if_then_else:SI (match_operand 1 "comparison_operator" "")
17425 (match_operand:SI 2 "general_operand" "")
17426 (match_operand:SI 3 "general_operand" "")))]
17428 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17430 ;; Data flow gets confused by our desire for `sbbl reg,reg', and clearing
17431 ;; the register first winds up with `sbbl $0,reg', which is also weird.
17432 ;; So just document what we're doing explicitly.
17434 (define_insn "x86_movsicc_0_m1"
17435 [(set (match_operand:SI 0 "register_operand" "=r")
17436 (if_then_else:SI (match_operand 1 "ix86_carry_flag_operator" "")
17439 (clobber (reg:CC FLAGS_REG))]
17442 ; Since we don't have the proper number of operands for an alu insn,
17443 ; fill in all the blanks.
17444 [(set_attr "type" "alu")
17445 (set_attr "pent_pair" "pu")
17446 (set_attr "memory" "none")
17447 (set_attr "imm_disp" "false")
17448 (set_attr "mode" "SI")
17449 (set_attr "length_immediate" "0")])
17451 (define_insn "*movsicc_noc"
17452 [(set (match_operand:SI 0 "register_operand" "=r,r")
17453 (if_then_else:SI (match_operator 1 "ix86_comparison_operator"
17454 [(reg FLAGS_REG) (const_int 0)])
17455 (match_operand:SI 2 "nonimmediate_operand" "rm,0")
17456 (match_operand:SI 3 "nonimmediate_operand" "0,rm")))]
17458 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17460 cmov%O2%C1\t{%2, %0|%0, %2}
17461 cmov%O2%c1\t{%3, %0|%0, %3}"
17462 [(set_attr "type" "icmov")
17463 (set_attr "mode" "SI")])
17465 (define_expand "movhicc"
17466 [(set (match_operand:HI 0 "register_operand" "")
17467 (if_then_else:HI (match_operand 1 "comparison_operator" "")
17468 (match_operand:HI 2 "general_operand" "")
17469 (match_operand:HI 3 "general_operand" "")))]
17470 "TARGET_HIMODE_MATH"
17471 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17473 (define_insn "*movhicc_noc"
17474 [(set (match_operand:HI 0 "register_operand" "=r,r")
17475 (if_then_else:HI (match_operator 1 "ix86_comparison_operator"
17476 [(reg FLAGS_REG) (const_int 0)])
17477 (match_operand:HI 2 "nonimmediate_operand" "rm,0")
17478 (match_operand:HI 3 "nonimmediate_operand" "0,rm")))]
17480 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17482 cmov%O2%C1\t{%2, %0|%0, %2}
17483 cmov%O2%c1\t{%3, %0|%0, %3}"
17484 [(set_attr "type" "icmov")
17485 (set_attr "mode" "HI")])
17487 (define_expand "movqicc"
17488 [(set (match_operand:QI 0 "register_operand" "")
17489 (if_then_else:QI (match_operand 1 "comparison_operator" "")
17490 (match_operand:QI 2 "general_operand" "")
17491 (match_operand:QI 3 "general_operand" "")))]
17492 "TARGET_QIMODE_MATH"
17493 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
17495 (define_insn_and_split "*movqicc_noc"
17496 [(set (match_operand:QI 0 "register_operand" "=r,r")
17497 (if_then_else:QI (match_operator 1 "ix86_comparison_operator"
17498 [(match_operand 4 "flags_reg_operand" "") (const_int 0)])
17499 (match_operand:QI 2 "register_operand" "r,0")
17500 (match_operand:QI 3 "register_operand" "0,r")))]
17501 "TARGET_CMOVE && !TARGET_PARTIAL_REG_STALL"
17503 "&& reload_completed"
17504 [(set (match_dup 0)
17505 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
17508 "operands[0] = gen_lowpart (SImode, operands[0]);
17509 operands[2] = gen_lowpart (SImode, operands[2]);
17510 operands[3] = gen_lowpart (SImode, operands[3]);"
17511 [(set_attr "type" "icmov")
17512 (set_attr "mode" "SI")])
17514 (define_expand "movsfcc"
17515 [(set (match_operand:SF 0 "register_operand" "")
17516 (if_then_else:SF (match_operand 1 "comparison_operator" "")
17517 (match_operand:SF 2 "register_operand" "")
17518 (match_operand:SF 3 "register_operand" "")))]
17520 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
17522 (define_insn "*movsfcc_1"
17523 [(set (match_operand:SF 0 "register_operand" "=f#r,f#r,r#f,r#f")
17524 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
17525 [(reg FLAGS_REG) (const_int 0)])
17526 (match_operand:SF 2 "nonimmediate_operand" "f#r,0,rm#f,0")
17527 (match_operand:SF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))]
17529 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17531 fcmov%F1\t{%2, %0|%0, %2}
17532 fcmov%f1\t{%3, %0|%0, %3}
17533 cmov%O2%C1\t{%2, %0|%0, %2}
17534 cmov%O2%c1\t{%3, %0|%0, %3}"
17535 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
17536 (set_attr "mode" "SF,SF,SI,SI")])
17538 (define_expand "movdfcc"
17539 [(set (match_operand:DF 0 "register_operand" "")
17540 (if_then_else:DF (match_operand 1 "comparison_operator" "")
17541 (match_operand:DF 2 "register_operand" "")
17542 (match_operand:DF 3 "register_operand" "")))]
17544 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
17546 (define_insn "*movdfcc_1"
17547 [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,&r#f,&r#f")
17548 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17549 [(reg FLAGS_REG) (const_int 0)])
17550 (match_operand:DF 2 "nonimmediate_operand" "f#r,0,rm#f,0")
17551 (match_operand:DF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))]
17552 "!TARGET_64BIT && TARGET_CMOVE
17553 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17555 fcmov%F1\t{%2, %0|%0, %2}
17556 fcmov%f1\t{%3, %0|%0, %3}
17559 [(set_attr "type" "fcmov,fcmov,multi,multi")
17560 (set_attr "mode" "DF")])
17562 (define_insn "*movdfcc_1_rex64"
17563 [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,r#f,r#f")
17564 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17565 [(reg FLAGS_REG) (const_int 0)])
17566 (match_operand:DF 2 "nonimmediate_operand" "f#r,0#r,rm#f,0#f")
17567 (match_operand:DF 3 "nonimmediate_operand" "0#r,f#r,0#f,rm#f")))]
17568 "TARGET_64BIT && TARGET_CMOVE
17569 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17571 fcmov%F1\t{%2, %0|%0, %2}
17572 fcmov%f1\t{%3, %0|%0, %3}
17573 cmov%O2%C1\t{%2, %0|%0, %2}
17574 cmov%O2%c1\t{%3, %0|%0, %3}"
17575 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
17576 (set_attr "mode" "DF")])
17579 [(set (match_operand:DF 0 "register_and_not_any_fp_reg_operand" "")
17580 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17581 [(match_operand 4 "flags_reg_operand" "") (const_int 0)])
17582 (match_operand:DF 2 "nonimmediate_operand" "")
17583 (match_operand:DF 3 "nonimmediate_operand" "")))]
17584 "!TARGET_64BIT && reload_completed"
17585 [(set (match_dup 2)
17586 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
17590 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
17593 "split_di (operands+2, 1, operands+5, operands+6);
17594 split_di (operands+3, 1, operands+7, operands+8);
17595 split_di (operands, 1, operands+2, operands+3);")
17597 (define_expand "movxfcc"
17598 [(set (match_operand:XF 0 "register_operand" "")
17599 (if_then_else:XF (match_operand 1 "comparison_operator" "")
17600 (match_operand:XF 2 "register_operand" "")
17601 (match_operand:XF 3 "register_operand" "")))]
17603 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
17605 (define_insn "*movxfcc_1"
17606 [(set (match_operand:XF 0 "register_operand" "=f,f")
17607 (if_then_else:XF (match_operator 1 "fcmov_comparison_operator"
17608 [(reg FLAGS_REG) (const_int 0)])
17609 (match_operand:XF 2 "register_operand" "f,0")
17610 (match_operand:XF 3 "register_operand" "0,f")))]
17613 fcmov%F1\t{%2, %0|%0, %2}
17614 fcmov%f1\t{%3, %0|%0, %3}"
17615 [(set_attr "type" "fcmov")
17616 (set_attr "mode" "XF")])
17618 (define_expand "minsf3"
17620 (set (match_operand:SF 0 "register_operand" "")
17621 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
17622 (match_operand:SF 2 "nonimmediate_operand" ""))
17625 (clobber (reg:CC FLAGS_REG))])]
17629 (define_insn "*minsf"
17630 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
17631 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0,0,f#x")
17632 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
17635 (clobber (reg:CC FLAGS_REG))]
17636 "TARGET_SSE && TARGET_IEEE_FP"
17639 (define_insn "*minsf_nonieee"
17640 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
17641 (if_then_else:SF (lt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
17642 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
17645 (clobber (reg:CC FLAGS_REG))]
17646 "TARGET_SSE && !TARGET_IEEE_FP
17647 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17651 [(set (match_operand:SF 0 "register_operand" "")
17652 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
17653 (match_operand:SF 2 "nonimmediate_operand" ""))
17654 (match_operand:SF 3 "register_operand" "")
17655 (match_operand:SF 4 "nonimmediate_operand" "")))
17656 (clobber (reg:CC FLAGS_REG))]
17657 "SSE_REG_P (operands[0]) && reload_completed
17658 && ((operands_match_p (operands[1], operands[3])
17659 && operands_match_p (operands[2], operands[4]))
17660 || (operands_match_p (operands[1], operands[4])
17661 && operands_match_p (operands[2], operands[3])))"
17662 [(set (match_dup 0)
17663 (if_then_else:SF (lt (match_dup 1)
17668 ;; Conditional addition patterns
17669 (define_expand "addqicc"
17670 [(match_operand:QI 0 "register_operand" "")
17671 (match_operand 1 "comparison_operator" "")
17672 (match_operand:QI 2 "register_operand" "")
17673 (match_operand:QI 3 "const_int_operand" "")]
17675 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17677 (define_expand "addhicc"
17678 [(match_operand:HI 0 "register_operand" "")
17679 (match_operand 1 "comparison_operator" "")
17680 (match_operand:HI 2 "register_operand" "")
17681 (match_operand:HI 3 "const_int_operand" "")]
17683 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17685 (define_expand "addsicc"
17686 [(match_operand:SI 0 "register_operand" "")
17687 (match_operand 1 "comparison_operator" "")
17688 (match_operand:SI 2 "register_operand" "")
17689 (match_operand:SI 3 "const_int_operand" "")]
17691 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17693 (define_expand "adddicc"
17694 [(match_operand:DI 0 "register_operand" "")
17695 (match_operand 1 "comparison_operator" "")
17696 (match_operand:DI 2 "register_operand" "")
17697 (match_operand:DI 3 "const_int_operand" "")]
17699 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
17701 ;; We can't represent the LT test directly. Do this by swapping the operands.
17704 [(set (match_operand:SF 0 "fp_register_operand" "")
17705 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
17706 (match_operand:SF 2 "register_operand" ""))
17707 (match_operand:SF 3 "register_operand" "")
17708 (match_operand:SF 4 "register_operand" "")))
17709 (clobber (reg:CC FLAGS_REG))]
17711 && ((operands_match_p (operands[1], operands[3])
17712 && operands_match_p (operands[2], operands[4]))
17713 || (operands_match_p (operands[1], operands[4])
17714 && operands_match_p (operands[2], operands[3])))"
17715 [(set (reg:CCFP FLAGS_REG)
17716 (compare:CCFP (match_dup 2)
17719 (if_then_else:SF (ge (reg:CCFP FLAGS_REG) (const_int 0))
17723 (define_insn "*minsf_sse"
17724 [(set (match_operand:SF 0 "register_operand" "=x")
17725 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0")
17726 (match_operand:SF 2 "nonimmediate_operand" "xm"))
17729 "TARGET_SSE && reload_completed"
17730 "minss\t{%2, %0|%0, %2}"
17731 [(set_attr "type" "sse")
17732 (set_attr "mode" "SF")])
17734 (define_expand "mindf3"
17736 (set (match_operand:DF 0 "register_operand" "")
17737 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
17738 (match_operand:DF 2 "nonimmediate_operand" ""))
17741 (clobber (reg:CC FLAGS_REG))])]
17742 "TARGET_SSE2 && TARGET_SSE_MATH"
17745 (define_insn "*mindf"
17746 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
17747 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0,0,f#Y")
17748 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
17751 (clobber (reg:CC FLAGS_REG))]
17752 "TARGET_SSE2 && TARGET_IEEE_FP && TARGET_SSE_MATH"
17755 (define_insn "*mindf_nonieee"
17756 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
17757 (if_then_else:DF (lt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
17758 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
17761 (clobber (reg:CC FLAGS_REG))]
17762 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
17763 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17767 [(set (match_operand:DF 0 "register_operand" "")
17768 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
17769 (match_operand:DF 2 "nonimmediate_operand" ""))
17770 (match_operand:DF 3 "register_operand" "")
17771 (match_operand:DF 4 "nonimmediate_operand" "")))
17772 (clobber (reg:CC FLAGS_REG))]
17773 "SSE_REG_P (operands[0]) && reload_completed
17774 && ((operands_match_p (operands[1], operands[3])
17775 && operands_match_p (operands[2], operands[4]))
17776 || (operands_match_p (operands[1], operands[4])
17777 && operands_match_p (operands[2], operands[3])))"
17778 [(set (match_dup 0)
17779 (if_then_else:DF (lt (match_dup 1)
17784 ;; We can't represent the LT test directly. Do this by swapping the operands.
17786 [(set (match_operand:DF 0 "fp_register_operand" "")
17787 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
17788 (match_operand:DF 2 "register_operand" ""))
17789 (match_operand:DF 3 "register_operand" "")
17790 (match_operand:DF 4 "register_operand" "")))
17791 (clobber (reg:CC FLAGS_REG))]
17793 && ((operands_match_p (operands[1], operands[3])
17794 && operands_match_p (operands[2], operands[4]))
17795 || (operands_match_p (operands[1], operands[4])
17796 && operands_match_p (operands[2], operands[3])))"
17797 [(set (reg:CCFP FLAGS_REG)
17798 (compare:CCFP (match_dup 2)
17801 (if_then_else:DF (ge (reg:CCFP FLAGS_REG) (const_int 0))
17805 (define_insn "*mindf_sse"
17806 [(set (match_operand:DF 0 "register_operand" "=Y")
17807 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0")
17808 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
17811 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
17812 "minsd\t{%2, %0|%0, %2}"
17813 [(set_attr "type" "sse")
17814 (set_attr "mode" "DF")])
17816 (define_expand "maxsf3"
17818 (set (match_operand:SF 0 "register_operand" "")
17819 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
17820 (match_operand:SF 2 "nonimmediate_operand" ""))
17823 (clobber (reg:CC FLAGS_REG))])]
17827 (define_insn "*maxsf"
17828 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
17829 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0,0,f#x")
17830 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
17833 (clobber (reg:CC FLAGS_REG))]
17834 "TARGET_SSE && TARGET_IEEE_FP"
17837 (define_insn "*maxsf_nonieee"
17838 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
17839 (if_then_else:SF (gt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
17840 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
17843 (clobber (reg:CC FLAGS_REG))]
17844 "TARGET_SSE && !TARGET_IEEE_FP
17845 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17849 [(set (match_operand:SF 0 "register_operand" "")
17850 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
17851 (match_operand:SF 2 "nonimmediate_operand" ""))
17852 (match_operand:SF 3 "register_operand" "")
17853 (match_operand:SF 4 "nonimmediate_operand" "")))
17854 (clobber (reg:CC FLAGS_REG))]
17855 "SSE_REG_P (operands[0]) && reload_completed
17856 && ((operands_match_p (operands[1], operands[3])
17857 && operands_match_p (operands[2], operands[4]))
17858 || (operands_match_p (operands[1], operands[4])
17859 && operands_match_p (operands[2], operands[3])))"
17860 [(set (match_dup 0)
17861 (if_then_else:SF (gt (match_dup 1)
17867 [(set (match_operand:SF 0 "fp_register_operand" "")
17868 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
17869 (match_operand:SF 2 "register_operand" ""))
17870 (match_operand:SF 3 "register_operand" "")
17871 (match_operand:SF 4 "register_operand" "")))
17872 (clobber (reg:CC FLAGS_REG))]
17874 && ((operands_match_p (operands[1], operands[3])
17875 && operands_match_p (operands[2], operands[4]))
17876 || (operands_match_p (operands[1], operands[4])
17877 && operands_match_p (operands[2], operands[3])))"
17878 [(set (reg:CCFP FLAGS_REG)
17879 (compare:CCFP (match_dup 1)
17882 (if_then_else:SF (gt (reg:CCFP FLAGS_REG) (const_int 0))
17886 (define_insn "*maxsf_sse"
17887 [(set (match_operand:SF 0 "register_operand" "=x")
17888 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0")
17889 (match_operand:SF 2 "nonimmediate_operand" "xm"))
17892 "TARGET_SSE && reload_completed"
17893 "maxss\t{%2, %0|%0, %2}"
17894 [(set_attr "type" "sse")
17895 (set_attr "mode" "SF")])
17897 (define_expand "maxdf3"
17899 (set (match_operand:DF 0 "register_operand" "")
17900 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17901 (match_operand:DF 2 "nonimmediate_operand" ""))
17904 (clobber (reg:CC FLAGS_REG))])]
17905 "TARGET_SSE2 && TARGET_SSE_MATH"
17908 (define_insn "*maxdf"
17909 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
17910 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0,0,f#Y")
17911 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
17914 (clobber (reg:CC FLAGS_REG))]
17915 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_IEEE_FP"
17918 (define_insn "*maxdf_nonieee"
17919 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
17920 (if_then_else:DF (gt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
17921 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
17924 (clobber (reg:CC FLAGS_REG))]
17925 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
17926 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17930 [(set (match_operand:DF 0 "register_operand" "")
17931 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17932 (match_operand:DF 2 "nonimmediate_operand" ""))
17933 (match_operand:DF 3 "register_operand" "")
17934 (match_operand:DF 4 "nonimmediate_operand" "")))
17935 (clobber (reg:CC FLAGS_REG))]
17936 "SSE_REG_P (operands[0]) && reload_completed
17937 && ((operands_match_p (operands[1], operands[3])
17938 && operands_match_p (operands[2], operands[4]))
17939 || (operands_match_p (operands[1], operands[4])
17940 && operands_match_p (operands[2], operands[3])))"
17941 [(set (match_dup 0)
17942 (if_then_else:DF (gt (match_dup 1)
17948 [(set (match_operand:DF 0 "fp_register_operand" "")
17949 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17950 (match_operand:DF 2 "register_operand" ""))
17951 (match_operand:DF 3 "register_operand" "")
17952 (match_operand:DF 4 "register_operand" "")))
17953 (clobber (reg:CC FLAGS_REG))]
17955 && ((operands_match_p (operands[1], operands[3])
17956 && operands_match_p (operands[2], operands[4]))
17957 || (operands_match_p (operands[1], operands[4])
17958 && operands_match_p (operands[2], operands[3])))"
17959 [(set (reg:CCFP FLAGS_REG)
17960 (compare:CCFP (match_dup 1)
17963 (if_then_else:DF (gt (reg:CCFP FLAGS_REG) (const_int 0))
17967 (define_insn "*maxdf_sse"
17968 [(set (match_operand:DF 0 "register_operand" "=Y")
17969 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0")
17970 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
17973 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
17974 "maxsd\t{%2, %0|%0, %2}"
17975 [(set_attr "type" "sse")
17976 (set_attr "mode" "DF")])
17978 ;; Misc patterns (?)
17980 ;; This pattern exists to put a dependency on all ebp-based memory accesses.
17981 ;; Otherwise there will be nothing to keep
17983 ;; [(set (reg ebp) (reg esp))]
17984 ;; [(set (reg esp) (plus (reg esp) (const_int -160000)))
17985 ;; (clobber (eflags)]
17986 ;; [(set (mem (plus (reg ebp) (const_int -160000))) (const_int 0))]
17988 ;; in proper program order.
17989 (define_insn "pro_epilogue_adjust_stack_1"
17990 [(set (match_operand:SI 0 "register_operand" "=r,r")
17991 (plus:SI (match_operand:SI 1 "register_operand" "0,r")
17992 (match_operand:SI 2 "immediate_operand" "i,i")))
17993 (clobber (reg:CC FLAGS_REG))
17994 (clobber (mem:BLK (scratch)))]
17997 switch (get_attr_type (insn))
18000 return "mov{l}\t{%1, %0|%0, %1}";
18003 if (GET_CODE (operands[2]) == CONST_INT
18004 && (INTVAL (operands[2]) == 128
18005 || (INTVAL (operands[2]) < 0
18006 && INTVAL (operands[2]) != -128)))
18008 operands[2] = GEN_INT (-INTVAL (operands[2]));
18009 return "sub{l}\t{%2, %0|%0, %2}";
18011 return "add{l}\t{%2, %0|%0, %2}";
18014 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
18015 return "lea{l}\t{%a2, %0|%0, %a2}";
18021 [(set (attr "type")
18022 (cond [(eq_attr "alternative" "0")
18023 (const_string "alu")
18024 (match_operand:SI 2 "const0_operand" "")
18025 (const_string "imov")
18027 (const_string "lea")))
18028 (set_attr "mode" "SI")])
18030 (define_insn "pro_epilogue_adjust_stack_rex64"
18031 [(set (match_operand:DI 0 "register_operand" "=r,r")
18032 (plus:DI (match_operand:DI 1 "register_operand" "0,r")
18033 (match_operand:DI 2 "x86_64_immediate_operand" "e,e")))
18034 (clobber (reg:CC FLAGS_REG))
18035 (clobber (mem:BLK (scratch)))]
18038 switch (get_attr_type (insn))
18041 return "mov{q}\t{%1, %0|%0, %1}";
18044 if (GET_CODE (operands[2]) == CONST_INT
18045 /* Avoid overflows. */
18046 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
18047 && (INTVAL (operands[2]) == 128
18048 || (INTVAL (operands[2]) < 0
18049 && INTVAL (operands[2]) != -128)))
18051 operands[2] = GEN_INT (-INTVAL (operands[2]));
18052 return "sub{q}\t{%2, %0|%0, %2}";
18054 return "add{q}\t{%2, %0|%0, %2}";
18057 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
18058 return "lea{q}\t{%a2, %0|%0, %a2}";
18064 [(set (attr "type")
18065 (cond [(eq_attr "alternative" "0")
18066 (const_string "alu")
18067 (match_operand:DI 2 "const0_operand" "")
18068 (const_string "imov")
18070 (const_string "lea")))
18071 (set_attr "mode" "DI")])
18073 (define_insn "pro_epilogue_adjust_stack_rex64_2"
18074 [(set (match_operand:DI 0 "register_operand" "=r,r")
18075 (plus:DI (match_operand:DI 1 "register_operand" "0,r")
18076 (match_operand:DI 3 "immediate_operand" "i,i")))
18077 (use (match_operand:DI 2 "register_operand" "r,r"))
18078 (clobber (reg:CC FLAGS_REG))
18079 (clobber (mem:BLK (scratch)))]
18082 switch (get_attr_type (insn))
18085 return "add{q}\t{%2, %0|%0, %2}";
18088 operands[2] = gen_rtx_PLUS (DImode, operands[1], operands[2]);
18089 return "lea{q}\t{%a2, %0|%0, %a2}";
18095 [(set_attr "type" "alu,lea")
18096 (set_attr "mode" "DI")])
18098 ;; Placeholder for the conditional moves. This one is split either to SSE
18099 ;; based moves emulation or to usual cmove sequence. Little bit unfortunate
18100 ;; fact is that compares supported by the cmp??ss instructions are exactly
18101 ;; swapped of those supported by cmove sequence.
18102 ;; The EQ/NE comparisons also needs bit care, since they are not directly
18103 ;; supported by i387 comparisons and we do need to emit two conditional moves
18106 (define_insn "sse_movsfcc"
18107 [(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")
18108 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
18109 [(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")
18110 (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")])
18111 (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")
18112 (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")))
18113 (clobber (match_scratch:SF 6 "=2,&4,X,X,X,X,X,X,X,X"))
18114 (clobber (reg:CC FLAGS_REG))]
18116 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
18117 /* Avoid combine from being smart and converting min/max
18118 instruction patterns into conditional moves. */
18119 && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT
18120 && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE)
18121 || !rtx_equal_p (operands[4], operands[2])
18122 || !rtx_equal_p (operands[5], operands[3]))
18123 && (!TARGET_IEEE_FP
18124 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
18127 (define_insn "sse_movsfcc_eq"
18128 [(set (match_operand:SF 0 "register_operand" "=&x#rf,x#rf,?f#xr,?f#xr,?r#xf,?r#xf")
18129 (if_then_else:SF (eq (match_operand:SF 3 "nonimmediate_operand" "%0#fx,x#fx,f#x,xm#f,f#x,xm#f")
18130 (match_operand:SF 4 "nonimmediate_operand" "xm#f,xm#f,f#x,x#f,f#x,x#f"))
18131 (match_operand:SF 1 "nonimmediate_operand" "x#fr,0#fr,0#fx,0#fx,0#rx,0#rx")
18132 (match_operand:SF 2 "nonimmediate_operand" "x#fr,x#fr,f#fx,f#fx,rm#rx,rm#rx")))
18133 (clobber (match_scratch:SF 5 "=1,&3,X,X,X,X"))
18134 (clobber (reg:CC FLAGS_REG))]
18136 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
18139 (define_insn "sse_movdfcc"
18140 [(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")
18141 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
18142 [(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")
18143 (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")])
18144 (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")
18145 (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")))
18146 (clobber (match_scratch:DF 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_movdfcc_eq"
18161 [(set (match_operand:DF 0 "register_operand" "=&Y#rf,Y#rf,?f#Yr,?f#Yr,?r#Yf,?r#Yf")
18162 (if_then_else:DF (eq (match_operand:DF 3 "nonimmediate_operand" "%0#fY,Y#fY,f#Y,Ym#f,f#Y,Ym#f")
18163 (match_operand:DF 4 "nonimmediate_operand" "Ym#f,Ym#f,f#Y,Y#f,f#Y,Y#f"))
18164 (match_operand:DF 1 "nonimmediate_operand" "Y#fr,0#fr,0#fY,0#fY,0#rY,0#rY")
18165 (match_operand:DF 2 "nonimmediate_operand" "Y#fr,Y#fr,f#fY,f#fY,rm#rY,rm#rY")))
18166 (clobber (match_scratch:DF 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 ;; For non-sse moves just expand the usual cmove sequence.
18174 [(set (match_operand 0 "register_operand" "")
18175 (if_then_else (match_operator 1 "comparison_operator"
18176 [(match_operand 4 "nonimmediate_operand" "")
18177 (match_operand 5 "register_operand" "")])
18178 (match_operand 2 "nonimmediate_operand" "")
18179 (match_operand 3 "nonimmediate_operand" "")))
18180 (clobber (match_operand 6 "" ""))
18181 (clobber (reg:CC FLAGS_REG))]
18182 "!SSE_REG_P (operands[0]) && reload_completed
18183 && (GET_MODE (operands[0]) == SFmode
18184 || (TARGET_SSE2 && GET_MODE (operands[0]) == DFmode))"
18187 ix86_compare_op0 = operands[5];
18188 ix86_compare_op1 = operands[4];
18189 operands[1] = gen_rtx_fmt_ee (swap_condition (GET_CODE (operands[1])),
18190 VOIDmode, operands[5], operands[4]);
18191 ix86_expand_fp_movcc (operands);
18195 ;; Split SSE based conditional move into sequence:
18196 ;; cmpCC op0, op4 - set op0 to 0 or ffffffff depending on the comparison
18197 ;; and op2, op0 - zero op2 if comparison was false
18198 ;; nand op0, op3 - load op3 to op0 if comparison was false
18199 ;; or op2, op0 - get the nonzero one into the result.
18201 [(set (match_operand:SF 0 "register_operand" "")
18202 (if_then_else:SF (match_operator:SF 1 "sse_comparison_operator"
18203 [(match_operand:SF 4 "register_operand" "")
18204 (match_operand:SF 5 "nonimmediate_operand" "")])
18205 (match_operand:SF 2 "register_operand" "")
18206 (match_operand:SF 3 "register_operand" "")))
18207 (clobber (match_operand 6 "" ""))
18208 (clobber (reg:CC FLAGS_REG))]
18209 "SSE_REG_P (operands[0]) && reload_completed"
18210 [(set (match_dup 4) (match_op_dup 1 [(match_dup 4) (match_dup 5)]))
18211 (set (match_dup 2) (and:V4SF (match_dup 2)
18213 (set (match_dup 8) (and:V4SF (not:V4SF (match_dup 8))
18215 (set (match_dup 0) (ior:V4SF (match_dup 6)
18218 /* If op2 == op3, op3 would be clobbered before it is used. */
18219 if (operands_match_p (operands[2], operands[3]))
18221 emit_move_insn (operands[0], operands[2]);
18225 PUT_MODE (operands[1], GET_MODE (operands[0]));
18226 if (operands_match_p (operands[0], operands[4]))
18227 operands[6] = operands[4], operands[7] = operands[2];
18229 operands[6] = operands[2], operands[7] = operands[4];
18230 operands[0] = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
18231 operands[2] = simplify_gen_subreg (V4SFmode, operands[2], SFmode, 0);
18232 operands[3] = simplify_gen_subreg (V4SFmode, operands[3], SFmode, 0);
18233 operands[8] = simplify_gen_subreg (V4SFmode, operands[4], SFmode, 0);
18234 operands[6] = simplify_gen_subreg (V4SFmode, operands[6], SFmode, 0);
18235 operands[7] = simplify_gen_subreg (V4SFmode, operands[7], SFmode, 0);
18239 [(set (match_operand:DF 0 "register_operand" "")
18240 (if_then_else:DF (match_operator:DF 1 "sse_comparison_operator"
18241 [(match_operand:DF 4 "register_operand" "")
18242 (match_operand:DF 5 "nonimmediate_operand" "")])
18243 (match_operand:DF 2 "register_operand" "")
18244 (match_operand:DF 3 "register_operand" "")))
18245 (clobber (match_operand 6 "" ""))
18246 (clobber (reg:CC FLAGS_REG))]
18247 "SSE_REG_P (operands[0]) && reload_completed"
18248 [(set (match_dup 4) (match_op_dup 1 [(match_dup 4) (match_dup 5)]))
18249 (set (match_dup 2) (and:V2DF (match_dup 2)
18251 (set (match_dup 8) (and:V2DF (not:V2DF (match_dup 8))
18253 (set (match_dup 0) (ior:V2DF (match_dup 6)
18256 if (TARGET_SSE_SPLIT_REGS && !optimize_size)
18258 rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
18259 emit_insn (gen_sse2_unpcklpd (op, op, op));
18260 op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
18261 emit_insn (gen_sse2_unpcklpd (op, op, op));
18264 /* If op2 == op3, op3 would be clobbered before it is used. */
18265 if (operands_match_p (operands[2], operands[3]))
18267 emit_move_insn (operands[0], operands[2]);
18271 PUT_MODE (operands[1], GET_MODE (operands[0]));
18272 if (operands_match_p (operands[0], operands[4]))
18273 operands[6] = operands[4], operands[7] = operands[2];
18275 operands[6] = operands[2], operands[7] = operands[4];
18276 operands[0] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
18277 operands[2] = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
18278 operands[3] = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
18279 operands[8] = simplify_gen_subreg (V2DFmode, operands[4], DFmode, 0);
18280 operands[6] = simplify_gen_subreg (V2DFmode, operands[6], DFmode, 0);
18281 operands[7] = simplify_gen_subreg (V2DFmode, operands[7], DFmode, 0);
18284 ;; Special case of conditional move we can handle effectively.
18285 ;; Do not brother with the integer/floating point case, since these are
18286 ;; bot considerably slower, unlike in the generic case.
18287 (define_insn "*sse_movsfcc_const0_1"
18288 [(set (match_operand:SF 0 "register_operand" "=&x")
18289 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
18290 [(match_operand:SF 4 "register_operand" "0")
18291 (match_operand:SF 5 "nonimmediate_operand" "xm")])
18292 (match_operand:SF 2 "register_operand" "x")
18293 (match_operand:SF 3 "const0_operand" "X")))]
18297 (define_insn "*sse_movsfcc_const0_2"
18298 [(set (match_operand:SF 0 "register_operand" "=&x")
18299 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
18300 [(match_operand:SF 4 "register_operand" "0")
18301 (match_operand:SF 5 "nonimmediate_operand" "xm")])
18302 (match_operand:SF 2 "const0_operand" "X")
18303 (match_operand:SF 3 "register_operand" "x")))]
18307 (define_insn "*sse_movsfcc_const0_3"
18308 [(set (match_operand:SF 0 "register_operand" "=&x")
18309 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
18310 [(match_operand:SF 4 "nonimmediate_operand" "xm")
18311 (match_operand:SF 5 "register_operand" "0")])
18312 (match_operand:SF 2 "register_operand" "x")
18313 (match_operand:SF 3 "const0_operand" "X")))]
18317 (define_insn "*sse_movsfcc_const0_4"
18318 [(set (match_operand:SF 0 "register_operand" "=&x")
18319 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
18320 [(match_operand:SF 4 "nonimmediate_operand" "xm")
18321 (match_operand:SF 5 "register_operand" "0")])
18322 (match_operand:SF 2 "const0_operand" "X")
18323 (match_operand:SF 3 "register_operand" "x")))]
18327 (define_insn "*sse_movdfcc_const0_1"
18328 [(set (match_operand:DF 0 "register_operand" "=&Y")
18329 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
18330 [(match_operand:DF 4 "register_operand" "0")
18331 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
18332 (match_operand:DF 2 "register_operand" "Y")
18333 (match_operand:DF 3 "const0_operand" "X")))]
18337 (define_insn "*sse_movdfcc_const0_2"
18338 [(set (match_operand:DF 0 "register_operand" "=&Y")
18339 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
18340 [(match_operand:DF 4 "register_operand" "0")
18341 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
18342 (match_operand:DF 2 "const0_operand" "X")
18343 (match_operand:DF 3 "register_operand" "Y")))]
18347 (define_insn "*sse_movdfcc_const0_3"
18348 [(set (match_operand:DF 0 "register_operand" "=&Y")
18349 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
18350 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
18351 (match_operand:DF 5 "register_operand" "0")])
18352 (match_operand:DF 2 "register_operand" "Y")
18353 (match_operand:DF 3 "const0_operand" "X")))]
18357 (define_insn "*sse_movdfcc_const0_4"
18358 [(set (match_operand:DF 0 "register_operand" "=&Y")
18359 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
18360 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
18361 (match_operand:DF 5 "register_operand" "0")])
18362 (match_operand:DF 2 "const0_operand" "X")
18363 (match_operand:DF 3 "register_operand" "Y")))]
18368 [(set (match_operand:SF 0 "register_operand" "")
18369 (if_then_else:SF (match_operator 1 "comparison_operator"
18370 [(match_operand:SF 4 "nonimmediate_operand" "")
18371 (match_operand:SF 5 "nonimmediate_operand" "")])
18372 (match_operand:SF 2 "nonmemory_operand" "")
18373 (match_operand:SF 3 "nonmemory_operand" "")))]
18374 "SSE_REG_P (operands[0]) && reload_completed
18375 && (const0_operand (operands[2], GET_MODE (operands[0]))
18376 || const0_operand (operands[3], GET_MODE (operands[0])))"
18377 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)]))
18378 (set (match_dup 8) (and:V4SF (match_dup 6) (match_dup 7)))]
18380 PUT_MODE (operands[1], GET_MODE (operands[0]));
18381 if (!sse_comparison_operator (operands[1], VOIDmode)
18382 || !rtx_equal_p (operands[0], operands[4]))
18384 rtx tmp = operands[5];
18385 operands[5] = operands[4];
18387 PUT_CODE (operands[1], swap_condition (GET_CODE (operands[1])));
18389 if (!rtx_equal_p (operands[0], operands[4]))
18391 operands[8] = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
18392 if (const0_operand (operands[2], GET_MODE (operands[2])))
18394 operands[7] = operands[3];
18395 operands[6] = gen_rtx_NOT (V4SFmode, operands[8]);
18399 operands[7] = operands[2];
18400 operands[6] = operands[8];
18402 operands[7] = simplify_gen_subreg (V4SFmode, operands[7], SFmode, 0);
18406 [(set (match_operand:DF 0 "register_operand" "")
18407 (if_then_else:DF (match_operator 1 "comparison_operator"
18408 [(match_operand:DF 4 "nonimmediate_operand" "")
18409 (match_operand:DF 5 "nonimmediate_operand" "")])
18410 (match_operand:DF 2 "nonmemory_operand" "")
18411 (match_operand:DF 3 "nonmemory_operand" "")))]
18412 "SSE_REG_P (operands[0]) && reload_completed
18413 && (const0_operand (operands[2], GET_MODE (operands[0]))
18414 || const0_operand (operands[3], GET_MODE (operands[0])))"
18415 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)]))
18416 (set (match_dup 8) (and:V2DF (match_dup 6) (match_dup 7)))]
18418 if (TARGET_SSE_SPLIT_REGS && !optimize_size)
18420 if (REG_P (operands[2]))
18422 rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
18423 emit_insn (gen_sse2_unpcklpd (op, op, op));
18425 if (REG_P (operands[3]))
18427 rtx op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
18428 emit_insn (gen_sse2_unpcklpd (op, op, op));
18431 PUT_MODE (operands[1], GET_MODE (operands[0]));
18432 if (!sse_comparison_operator (operands[1], VOIDmode)
18433 || !rtx_equal_p (operands[0], operands[4]))
18435 rtx tmp = operands[5];
18436 operands[5] = operands[4];
18438 PUT_CODE (operands[1], swap_condition (GET_CODE (operands[1])));
18440 if (!rtx_equal_p (operands[0], operands[4]))
18442 operands[8] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
18443 if (const0_operand (operands[2], GET_MODE (operands[2])))
18445 operands[7] = operands[3];
18446 operands[6] = gen_rtx_NOT (V2DFmode, operands[8]);
18450 operands[7] = operands[2];
18451 operands[6] = operands[8];
18453 operands[7] = simplify_gen_subreg (V2DFmode, operands[7], DFmode, 0);
18456 (define_expand "allocate_stack_worker"
18457 [(match_operand:SI 0 "register_operand" "")]
18458 "TARGET_STACK_PROBE"
18460 if (reload_completed)
18463 emit_insn (gen_allocate_stack_worker_rex64_postreload (operands[0]));
18465 emit_insn (gen_allocate_stack_worker_postreload (operands[0]));
18470 emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
18472 emit_insn (gen_allocate_stack_worker_1 (operands[0]));
18477 (define_insn "allocate_stack_worker_1"
18478 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "a")]
18479 UNSPECV_STACK_PROBE)
18480 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 0)))
18481 (clobber (match_scratch:SI 1 "=0"))
18482 (clobber (reg:CC FLAGS_REG))]
18483 "!TARGET_64BIT && TARGET_STACK_PROBE"
18485 [(set_attr "type" "multi")
18486 (set_attr "length" "5")])
18488 (define_expand "allocate_stack_worker_postreload"
18489 [(parallel [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "a")]
18490 UNSPECV_STACK_PROBE)
18491 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 0)))
18492 (clobber (match_dup 0))
18493 (clobber (reg:CC FLAGS_REG))])]
18497 (define_insn "allocate_stack_worker_rex64"
18498 [(unspec_volatile:DI [(match_operand:DI 0 "register_operand" "a")]
18499 UNSPECV_STACK_PROBE)
18500 (set (reg:DI SP_REG) (minus:DI (reg:DI SP_REG) (match_dup 0)))
18501 (clobber (match_scratch:DI 1 "=0"))
18502 (clobber (reg:CC FLAGS_REG))]
18503 "TARGET_64BIT && TARGET_STACK_PROBE"
18505 [(set_attr "type" "multi")
18506 (set_attr "length" "5")])
18508 (define_expand "allocate_stack_worker_rex64_postreload"
18509 [(parallel [(unspec_volatile:DI [(match_operand:DI 0 "register_operand" "a")]
18510 UNSPECV_STACK_PROBE)
18511 (set (reg:DI SP_REG) (minus:DI (reg:DI SP_REG) (match_dup 0)))
18512 (clobber (match_dup 0))
18513 (clobber (reg:CC FLAGS_REG))])]
18517 (define_expand "allocate_stack"
18518 [(parallel [(set (match_operand:SI 0 "register_operand" "=r")
18519 (minus:SI (reg:SI SP_REG)
18520 (match_operand:SI 1 "general_operand" "")))
18521 (clobber (reg:CC FLAGS_REG))])
18522 (parallel [(set (reg:SI SP_REG)
18523 (minus:SI (reg:SI SP_REG) (match_dup 1)))
18524 (clobber (reg:CC FLAGS_REG))])]
18525 "TARGET_STACK_PROBE"
18527 #ifdef CHECK_STACK_LIMIT
18528 if (GET_CODE (operands[1]) == CONST_INT
18529 && INTVAL (operands[1]) < CHECK_STACK_LIMIT)
18530 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
18534 emit_insn (gen_allocate_stack_worker (copy_to_mode_reg (SImode,
18537 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
18541 (define_expand "builtin_setjmp_receiver"
18542 [(label_ref (match_operand 0 "" ""))]
18543 "!TARGET_64BIT && flag_pic"
18545 emit_insn (gen_set_got (pic_offset_table_rtx));
18549 ;; Avoid redundant prefixes by splitting HImode arithmetic to SImode.
18552 [(set (match_operand 0 "register_operand" "")
18553 (match_operator 3 "promotable_binary_operator"
18554 [(match_operand 1 "register_operand" "")
18555 (match_operand 2 "aligned_operand" "")]))
18556 (clobber (reg:CC FLAGS_REG))]
18557 "! TARGET_PARTIAL_REG_STALL && reload_completed
18558 && ((GET_MODE (operands[0]) == HImode
18559 && ((!optimize_size && !TARGET_FAST_PREFIX)
18560 || GET_CODE (operands[2]) != CONST_INT
18561 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')))
18562 || (GET_MODE (operands[0]) == QImode
18563 && (TARGET_PROMOTE_QImode || optimize_size)))"
18564 [(parallel [(set (match_dup 0)
18565 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
18566 (clobber (reg:CC FLAGS_REG))])]
18567 "operands[0] = gen_lowpart (SImode, operands[0]);
18568 operands[1] = gen_lowpart (SImode, operands[1]);
18569 if (GET_CODE (operands[3]) != ASHIFT)
18570 operands[2] = gen_lowpart (SImode, operands[2]);
18571 PUT_MODE (operands[3], SImode);")
18573 ; Promote the QImode tests, as i386 has encoding of the AND
18574 ; instruction with 32-bit sign-extended immediate and thus the
18575 ; instruction size is unchanged, except in the %eax case for
18576 ; which it is increased by one byte, hence the ! optimize_size.
18578 [(set (match_operand 0 "flags_reg_operand" "")
18579 (match_operator 2 "compare_operator"
18580 [(and (match_operand 3 "aligned_operand" "")
18581 (match_operand 4 "const_int_operand" ""))
18583 (set (match_operand 1 "register_operand" "")
18584 (and (match_dup 3) (match_dup 4)))]
18585 "! TARGET_PARTIAL_REG_STALL && reload_completed
18586 /* Ensure that the operand will remain sign-extended immediate. */
18587 && ix86_match_ccmode (insn, INTVAL (operands[4]) >= 0 ? CCNOmode : CCZmode)
18589 && ((GET_MODE (operands[1]) == HImode && ! TARGET_FAST_PREFIX)
18590 || (GET_MODE (operands[1]) == QImode && TARGET_PROMOTE_QImode))"
18591 [(parallel [(set (match_dup 0)
18592 (match_op_dup 2 [(and:SI (match_dup 3) (match_dup 4))
18595 (and:SI (match_dup 3) (match_dup 4)))])]
18598 = gen_int_mode (INTVAL (operands[4])
18599 & GET_MODE_MASK (GET_MODE (operands[1])), SImode);
18600 operands[1] = gen_lowpart (SImode, operands[1]);
18601 operands[3] = gen_lowpart (SImode, operands[3]);
18604 ; Don't promote the QImode tests, as i386 doesn't have encoding of
18605 ; the TEST instruction with 32-bit sign-extended immediate and thus
18606 ; the instruction size would at least double, which is not what we
18607 ; want even with ! optimize_size.
18609 [(set (match_operand 0 "flags_reg_operand" "")
18610 (match_operator 1 "compare_operator"
18611 [(and (match_operand:HI 2 "aligned_operand" "")
18612 (match_operand:HI 3 "const_int_operand" ""))
18614 "! TARGET_PARTIAL_REG_STALL && reload_completed
18615 /* Ensure that the operand will remain sign-extended immediate. */
18616 && ix86_match_ccmode (insn, INTVAL (operands[3]) >= 0 ? CCNOmode : CCZmode)
18617 && ! TARGET_FAST_PREFIX
18618 && ! optimize_size"
18619 [(set (match_dup 0)
18620 (match_op_dup 1 [(and:SI (match_dup 2) (match_dup 3))
18624 = gen_int_mode (INTVAL (operands[3])
18625 & GET_MODE_MASK (GET_MODE (operands[2])), SImode);
18626 operands[2] = gen_lowpart (SImode, operands[2]);
18630 [(set (match_operand 0 "register_operand" "")
18631 (neg (match_operand 1 "register_operand" "")))
18632 (clobber (reg:CC FLAGS_REG))]
18633 "! TARGET_PARTIAL_REG_STALL && reload_completed
18634 && (GET_MODE (operands[0]) == HImode
18635 || (GET_MODE (operands[0]) == QImode
18636 && (TARGET_PROMOTE_QImode || optimize_size)))"
18637 [(parallel [(set (match_dup 0)
18638 (neg:SI (match_dup 1)))
18639 (clobber (reg:CC FLAGS_REG))])]
18640 "operands[0] = gen_lowpart (SImode, operands[0]);
18641 operands[1] = gen_lowpart (SImode, operands[1]);")
18644 [(set (match_operand 0 "register_operand" "")
18645 (not (match_operand 1 "register_operand" "")))]
18646 "! TARGET_PARTIAL_REG_STALL && reload_completed
18647 && (GET_MODE (operands[0]) == HImode
18648 || (GET_MODE (operands[0]) == QImode
18649 && (TARGET_PROMOTE_QImode || optimize_size)))"
18650 [(set (match_dup 0)
18651 (not:SI (match_dup 1)))]
18652 "operands[0] = gen_lowpart (SImode, operands[0]);
18653 operands[1] = gen_lowpart (SImode, operands[1]);")
18656 [(set (match_operand 0 "register_operand" "")
18657 (if_then_else (match_operator 1 "comparison_operator"
18658 [(reg FLAGS_REG) (const_int 0)])
18659 (match_operand 2 "register_operand" "")
18660 (match_operand 3 "register_operand" "")))]
18661 "! TARGET_PARTIAL_REG_STALL && TARGET_CMOVE
18662 && (GET_MODE (operands[0]) == HImode
18663 || (GET_MODE (operands[0]) == QImode
18664 && (TARGET_PROMOTE_QImode || optimize_size)))"
18665 [(set (match_dup 0)
18666 (if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
18667 "operands[0] = gen_lowpart (SImode, operands[0]);
18668 operands[2] = gen_lowpart (SImode, operands[2]);
18669 operands[3] = gen_lowpart (SImode, operands[3]);")
18672 ;; RTL Peephole optimizations, run before sched2. These primarily look to
18673 ;; transform a complex memory operation into two memory to register operations.
18675 ;; Don't push memory operands
18677 [(set (match_operand:SI 0 "push_operand" "")
18678 (match_operand:SI 1 "memory_operand" ""))
18679 (match_scratch:SI 2 "r")]
18680 "! optimize_size && ! TARGET_PUSH_MEMORY"
18681 [(set (match_dup 2) (match_dup 1))
18682 (set (match_dup 0) (match_dup 2))]
18686 [(set (match_operand:DI 0 "push_operand" "")
18687 (match_operand:DI 1 "memory_operand" ""))
18688 (match_scratch:DI 2 "r")]
18689 "! optimize_size && ! TARGET_PUSH_MEMORY"
18690 [(set (match_dup 2) (match_dup 1))
18691 (set (match_dup 0) (match_dup 2))]
18694 ;; We need to handle SFmode only, because DFmode and XFmode is split to
18697 [(set (match_operand:SF 0 "push_operand" "")
18698 (match_operand:SF 1 "memory_operand" ""))
18699 (match_scratch:SF 2 "r")]
18700 "! optimize_size && ! TARGET_PUSH_MEMORY"
18701 [(set (match_dup 2) (match_dup 1))
18702 (set (match_dup 0) (match_dup 2))]
18706 [(set (match_operand:HI 0 "push_operand" "")
18707 (match_operand:HI 1 "memory_operand" ""))
18708 (match_scratch:HI 2 "r")]
18709 "! optimize_size && ! TARGET_PUSH_MEMORY"
18710 [(set (match_dup 2) (match_dup 1))
18711 (set (match_dup 0) (match_dup 2))]
18715 [(set (match_operand:QI 0 "push_operand" "")
18716 (match_operand:QI 1 "memory_operand" ""))
18717 (match_scratch:QI 2 "q")]
18718 "! optimize_size && ! TARGET_PUSH_MEMORY"
18719 [(set (match_dup 2) (match_dup 1))
18720 (set (match_dup 0) (match_dup 2))]
18723 ;; Don't move an immediate directly to memory when the instruction
18726 [(match_scratch:SI 1 "r")
18727 (set (match_operand:SI 0 "memory_operand" "")
18730 && ! TARGET_USE_MOV0
18731 && TARGET_SPLIT_LONG_MOVES
18732 && get_attr_length (insn) >= ix86_cost->large_insn
18733 && peep2_regno_dead_p (0, FLAGS_REG)"
18734 [(parallel [(set (match_dup 1) (const_int 0))
18735 (clobber (reg:CC FLAGS_REG))])
18736 (set (match_dup 0) (match_dup 1))]
18740 [(match_scratch:HI 1 "r")
18741 (set (match_operand:HI 0 "memory_operand" "")
18744 && ! TARGET_USE_MOV0
18745 && TARGET_SPLIT_LONG_MOVES
18746 && get_attr_length (insn) >= ix86_cost->large_insn
18747 && peep2_regno_dead_p (0, FLAGS_REG)"
18748 [(parallel [(set (match_dup 2) (const_int 0))
18749 (clobber (reg:CC FLAGS_REG))])
18750 (set (match_dup 0) (match_dup 1))]
18751 "operands[2] = gen_lowpart (SImode, operands[1]);")
18754 [(match_scratch:QI 1 "q")
18755 (set (match_operand:QI 0 "memory_operand" "")
18758 && ! TARGET_USE_MOV0
18759 && TARGET_SPLIT_LONG_MOVES
18760 && get_attr_length (insn) >= ix86_cost->large_insn
18761 && peep2_regno_dead_p (0, FLAGS_REG)"
18762 [(parallel [(set (match_dup 2) (const_int 0))
18763 (clobber (reg:CC FLAGS_REG))])
18764 (set (match_dup 0) (match_dup 1))]
18765 "operands[2] = gen_lowpart (SImode, operands[1]);")
18768 [(match_scratch:SI 2 "r")
18769 (set (match_operand:SI 0 "memory_operand" "")
18770 (match_operand:SI 1 "immediate_operand" ""))]
18772 && get_attr_length (insn) >= ix86_cost->large_insn
18773 && TARGET_SPLIT_LONG_MOVES"
18774 [(set (match_dup 2) (match_dup 1))
18775 (set (match_dup 0) (match_dup 2))]
18779 [(match_scratch:HI 2 "r")
18780 (set (match_operand:HI 0 "memory_operand" "")
18781 (match_operand:HI 1 "immediate_operand" ""))]
18782 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
18783 && TARGET_SPLIT_LONG_MOVES"
18784 [(set (match_dup 2) (match_dup 1))
18785 (set (match_dup 0) (match_dup 2))]
18789 [(match_scratch:QI 2 "q")
18790 (set (match_operand:QI 0 "memory_operand" "")
18791 (match_operand:QI 1 "immediate_operand" ""))]
18792 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
18793 && TARGET_SPLIT_LONG_MOVES"
18794 [(set (match_dup 2) (match_dup 1))
18795 (set (match_dup 0) (match_dup 2))]
18798 ;; Don't compare memory with zero, load and use a test instead.
18800 [(set (match_operand 0 "flags_reg_operand" "")
18801 (match_operator 1 "compare_operator"
18802 [(match_operand:SI 2 "memory_operand" "")
18804 (match_scratch:SI 3 "r")]
18805 "ix86_match_ccmode (insn, CCNOmode) && ! optimize_size"
18806 [(set (match_dup 3) (match_dup 2))
18807 (set (match_dup 0) (match_op_dup 1 [(match_dup 3) (const_int 0)]))]
18810 ;; NOT is not pairable on Pentium, while XOR is, but one byte longer.
18811 ;; Don't split NOTs with a displacement operand, because resulting XOR
18812 ;; will not be pairable anyway.
18814 ;; On AMD K6, NOT is vector decoded with memory operand that cannot be
18815 ;; represented using a modRM byte. The XOR replacement is long decoded,
18816 ;; so this split helps here as well.
18818 ;; Note: Can't do this as a regular split because we can't get proper
18819 ;; lifetime information then.
18822 [(set (match_operand:SI 0 "nonimmediate_operand" "")
18823 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
18825 && peep2_regno_dead_p (0, FLAGS_REG)
18826 && ((TARGET_PENTIUM
18827 && (GET_CODE (operands[0]) != MEM
18828 || !memory_displacement_operand (operands[0], SImode)))
18829 || (TARGET_K6 && long_memory_operand (operands[0], SImode)))"
18830 [(parallel [(set (match_dup 0)
18831 (xor:SI (match_dup 1) (const_int -1)))
18832 (clobber (reg:CC FLAGS_REG))])]
18836 [(set (match_operand:HI 0 "nonimmediate_operand" "")
18837 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
18839 && peep2_regno_dead_p (0, FLAGS_REG)
18840 && ((TARGET_PENTIUM
18841 && (GET_CODE (operands[0]) != MEM
18842 || !memory_displacement_operand (operands[0], HImode)))
18843 || (TARGET_K6 && long_memory_operand (operands[0], HImode)))"
18844 [(parallel [(set (match_dup 0)
18845 (xor:HI (match_dup 1) (const_int -1)))
18846 (clobber (reg:CC FLAGS_REG))])]
18850 [(set (match_operand:QI 0 "nonimmediate_operand" "")
18851 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
18853 && peep2_regno_dead_p (0, FLAGS_REG)
18854 && ((TARGET_PENTIUM
18855 && (GET_CODE (operands[0]) != MEM
18856 || !memory_displacement_operand (operands[0], QImode)))
18857 || (TARGET_K6 && long_memory_operand (operands[0], QImode)))"
18858 [(parallel [(set (match_dup 0)
18859 (xor:QI (match_dup 1) (const_int -1)))
18860 (clobber (reg:CC FLAGS_REG))])]
18863 ;; Non pairable "test imm, reg" instructions can be translated to
18864 ;; "and imm, reg" if reg dies. The "and" form is also shorter (one
18865 ;; byte opcode instead of two, have a short form for byte operands),
18866 ;; so do it for other CPUs as well. Given that the value was dead,
18867 ;; this should not create any new dependencies. Pass on the sub-word
18868 ;; versions if we're concerned about partial register stalls.
18871 [(set (match_operand 0 "flags_reg_operand" "")
18872 (match_operator 1 "compare_operator"
18873 [(and:SI (match_operand:SI 2 "register_operand" "")
18874 (match_operand:SI 3 "immediate_operand" ""))
18876 "ix86_match_ccmode (insn, CCNOmode)
18877 && (true_regnum (operands[2]) != 0
18878 || (GET_CODE (operands[3]) == CONST_INT
18879 && CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'K')))
18880 && peep2_reg_dead_p (1, operands[2])"
18882 [(set (match_dup 0)
18883 (match_op_dup 1 [(and:SI (match_dup 2) (match_dup 3))
18886 (and:SI (match_dup 2) (match_dup 3)))])]
18889 ;; We don't need to handle HImode case, because it will be promoted to SImode
18890 ;; on ! TARGET_PARTIAL_REG_STALL
18893 [(set (match_operand 0 "flags_reg_operand" "")
18894 (match_operator 1 "compare_operator"
18895 [(and:QI (match_operand:QI 2 "register_operand" "")
18896 (match_operand:QI 3 "immediate_operand" ""))
18898 "! TARGET_PARTIAL_REG_STALL
18899 && ix86_match_ccmode (insn, CCNOmode)
18900 && true_regnum (operands[2]) != 0
18901 && peep2_reg_dead_p (1, operands[2])"
18903 [(set (match_dup 0)
18904 (match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3))
18907 (and:QI (match_dup 2) (match_dup 3)))])]
18911 [(set (match_operand 0 "flags_reg_operand" "")
18912 (match_operator 1 "compare_operator"
18915 (match_operand 2 "ext_register_operand" "")
18918 (match_operand 3 "const_int_operand" ""))
18920 "! TARGET_PARTIAL_REG_STALL
18921 && ix86_match_ccmode (insn, CCNOmode)
18922 && true_regnum (operands[2]) != 0
18923 && peep2_reg_dead_p (1, operands[2])"
18924 [(parallel [(set (match_dup 0)
18933 (set (zero_extract:SI (match_dup 2)
18944 ;; Don't do logical operations with memory inputs.
18946 [(match_scratch:SI 2 "r")
18947 (parallel [(set (match_operand:SI 0 "register_operand" "")
18948 (match_operator:SI 3 "arith_or_logical_operator"
18950 (match_operand:SI 1 "memory_operand" "")]))
18951 (clobber (reg:CC FLAGS_REG))])]
18952 "! optimize_size && ! TARGET_READ_MODIFY"
18953 [(set (match_dup 2) (match_dup 1))
18954 (parallel [(set (match_dup 0)
18955 (match_op_dup 3 [(match_dup 0) (match_dup 2)]))
18956 (clobber (reg:CC FLAGS_REG))])]
18960 [(match_scratch:SI 2 "r")
18961 (parallel [(set (match_operand:SI 0 "register_operand" "")
18962 (match_operator:SI 3 "arith_or_logical_operator"
18963 [(match_operand:SI 1 "memory_operand" "")
18965 (clobber (reg:CC FLAGS_REG))])]
18966 "! optimize_size && ! TARGET_READ_MODIFY"
18967 [(set (match_dup 2) (match_dup 1))
18968 (parallel [(set (match_dup 0)
18969 (match_op_dup 3 [(match_dup 2) (match_dup 0)]))
18970 (clobber (reg:CC FLAGS_REG))])]
18973 ; Don't do logical operations with memory outputs
18975 ; These two don't make sense for PPro/PII -- we're expanding a 4-uop
18976 ; instruction into two 1-uop insns plus a 2-uop insn. That last has
18977 ; the same decoder scheduling characteristics as the original.
18980 [(match_scratch:SI 2 "r")
18981 (parallel [(set (match_operand:SI 0 "memory_operand" "")
18982 (match_operator:SI 3 "arith_or_logical_operator"
18984 (match_operand:SI 1 "nonmemory_operand" "")]))
18985 (clobber (reg:CC FLAGS_REG))])]
18986 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
18987 [(set (match_dup 2) (match_dup 0))
18988 (parallel [(set (match_dup 2)
18989 (match_op_dup 3 [(match_dup 2) (match_dup 1)]))
18990 (clobber (reg:CC FLAGS_REG))])
18991 (set (match_dup 0) (match_dup 2))]
18995 [(match_scratch:SI 2 "r")
18996 (parallel [(set (match_operand:SI 0 "memory_operand" "")
18997 (match_operator:SI 3 "arith_or_logical_operator"
18998 [(match_operand:SI 1 "nonmemory_operand" "")
19000 (clobber (reg:CC FLAGS_REG))])]
19001 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
19002 [(set (match_dup 2) (match_dup 0))
19003 (parallel [(set (match_dup 2)
19004 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
19005 (clobber (reg:CC FLAGS_REG))])
19006 (set (match_dup 0) (match_dup 2))]
19009 ;; Attempt to always use XOR for zeroing registers.
19011 [(set (match_operand 0 "register_operand" "")
19013 "(GET_MODE (operands[0]) == QImode
19014 || GET_MODE (operands[0]) == HImode
19015 || GET_MODE (operands[0]) == SImode
19016 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
19017 && (! TARGET_USE_MOV0 || optimize_size)
19018 && peep2_regno_dead_p (0, FLAGS_REG)"
19019 [(parallel [(set (match_dup 0) (const_int 0))
19020 (clobber (reg:CC FLAGS_REG))])]
19021 "operands[0] = gen_lowpart (GET_MODE (operands[0]) == DImode ? DImode : SImode,
19025 [(set (strict_low_part (match_operand 0 "register_operand" ""))
19027 "(GET_MODE (operands[0]) == QImode
19028 || GET_MODE (operands[0]) == HImode)
19029 && (! TARGET_USE_MOV0 || optimize_size)
19030 && peep2_regno_dead_p (0, FLAGS_REG)"
19031 [(parallel [(set (strict_low_part (match_dup 0)) (const_int 0))
19032 (clobber (reg:CC FLAGS_REG))])])
19034 ;; For HI and SI modes, or $-1,reg is smaller than mov $-1,reg.
19036 [(set (match_operand 0 "register_operand" "")
19038 "(GET_MODE (operands[0]) == HImode
19039 || GET_MODE (operands[0]) == SImode
19040 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
19041 && (optimize_size || TARGET_PENTIUM)
19042 && peep2_regno_dead_p (0, FLAGS_REG)"
19043 [(parallel [(set (match_dup 0) (const_int -1))
19044 (clobber (reg:CC FLAGS_REG))])]
19045 "operands[0] = gen_lowpart (GET_MODE (operands[0]) == DImode ? DImode : SImode,
19048 ;; Attempt to convert simple leas to adds. These can be created by
19051 [(set (match_operand:SI 0 "register_operand" "")
19052 (plus:SI (match_dup 0)
19053 (match_operand:SI 1 "nonmemory_operand" "")))]
19054 "peep2_regno_dead_p (0, FLAGS_REG)"
19055 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
19056 (clobber (reg:CC FLAGS_REG))])]
19060 [(set (match_operand:SI 0 "register_operand" "")
19061 (subreg:SI (plus:DI (match_operand:DI 1 "register_operand" "")
19062 (match_operand:DI 2 "nonmemory_operand" "")) 0))]
19063 "peep2_regno_dead_p (0, FLAGS_REG) && REGNO (operands[0]) == REGNO (operands[1])"
19064 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
19065 (clobber (reg:CC FLAGS_REG))])]
19066 "operands[2] = gen_lowpart (SImode, operands[2]);")
19069 [(set (match_operand:DI 0 "register_operand" "")
19070 (plus:DI (match_dup 0)
19071 (match_operand:DI 1 "x86_64_general_operand" "")))]
19072 "peep2_regno_dead_p (0, FLAGS_REG)"
19073 [(parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))
19074 (clobber (reg:CC FLAGS_REG))])]
19078 [(set (match_operand:SI 0 "register_operand" "")
19079 (mult:SI (match_dup 0)
19080 (match_operand:SI 1 "const_int_operand" "")))]
19081 "exact_log2 (INTVAL (operands[1])) >= 0
19082 && peep2_regno_dead_p (0, FLAGS_REG)"
19083 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
19084 (clobber (reg:CC FLAGS_REG))])]
19085 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
19088 [(set (match_operand:DI 0 "register_operand" "")
19089 (mult:DI (match_dup 0)
19090 (match_operand:DI 1 "const_int_operand" "")))]
19091 "exact_log2 (INTVAL (operands[1])) >= 0
19092 && peep2_regno_dead_p (0, FLAGS_REG)"
19093 [(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
19094 (clobber (reg:CC FLAGS_REG))])]
19095 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
19098 [(set (match_operand:SI 0 "register_operand" "")
19099 (subreg:SI (mult:DI (match_operand:DI 1 "register_operand" "")
19100 (match_operand:DI 2 "const_int_operand" "")) 0))]
19101 "exact_log2 (INTVAL (operands[2])) >= 0
19102 && REGNO (operands[0]) == REGNO (operands[1])
19103 && peep2_regno_dead_p (0, FLAGS_REG)"
19104 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
19105 (clobber (reg:CC FLAGS_REG))])]
19106 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[2])));")
19108 ;; The ESP adjustments can be done by the push and pop instructions. Resulting
19109 ;; code is shorter, since push is only 1 byte, while add imm, %esp 3 bytes. On
19110 ;; many CPUs it is also faster, since special hardware to avoid esp
19111 ;; dependencies is present.
19113 ;; While some of these conversions may be done using splitters, we use peepholes
19114 ;; in order to allow combine_stack_adjustments pass to see nonobfuscated RTL.
19116 ;; Convert prologue esp subtractions to push.
19117 ;; We need register to push. In order to keep verify_flow_info happy we have
19119 ;; - use scratch and clobber it in order to avoid dependencies
19120 ;; - use already live register
19121 ;; We can't use the second way right now, since there is no reliable way how to
19122 ;; verify that given register is live. First choice will also most likely in
19123 ;; fewer dependencies. On the place of esp adjustments it is very likely that
19124 ;; call clobbered registers are dead. We may want to use base pointer as an
19125 ;; alternative when no register is available later.
19128 [(match_scratch:SI 0 "r")
19129 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
19130 (clobber (reg:CC FLAGS_REG))
19131 (clobber (mem:BLK (scratch)))])]
19132 "optimize_size || !TARGET_SUB_ESP_4"
19133 [(clobber (match_dup 0))
19134 (parallel [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19135 (clobber (mem:BLK (scratch)))])])
19138 [(match_scratch:SI 0 "r")
19139 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
19140 (clobber (reg:CC FLAGS_REG))
19141 (clobber (mem:BLK (scratch)))])]
19142 "optimize_size || !TARGET_SUB_ESP_8"
19143 [(clobber (match_dup 0))
19144 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19145 (parallel [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19146 (clobber (mem:BLK (scratch)))])])
19148 ;; Convert esp subtractions to push.
19150 [(match_scratch:SI 0 "r")
19151 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
19152 (clobber (reg:CC FLAGS_REG))])]
19153 "optimize_size || !TARGET_SUB_ESP_4"
19154 [(clobber (match_dup 0))
19155 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))])
19158 [(match_scratch:SI 0 "r")
19159 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -8)))
19160 (clobber (reg:CC FLAGS_REG))])]
19161 "optimize_size || !TARGET_SUB_ESP_8"
19162 [(clobber (match_dup 0))
19163 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))
19164 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 0))])
19166 ;; Convert epilogue deallocator to pop.
19168 [(match_scratch:SI 0 "r")
19169 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19170 (clobber (reg:CC FLAGS_REG))
19171 (clobber (mem:BLK (scratch)))])]
19172 "optimize_size || !TARGET_ADD_ESP_4"
19173 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19174 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19175 (clobber (mem:BLK (scratch)))])]
19178 ;; Two pops case is tricky, since pop causes dependency on destination register.
19179 ;; We use two registers if available.
19181 [(match_scratch:SI 0 "r")
19182 (match_scratch:SI 1 "r")
19183 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19184 (clobber (reg:CC FLAGS_REG))
19185 (clobber (mem:BLK (scratch)))])]
19186 "optimize_size || !TARGET_ADD_ESP_8"
19187 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19188 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19189 (clobber (mem:BLK (scratch)))])
19190 (parallel [(set (match_dup 1) (mem:SI (reg:SI SP_REG)))
19191 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19195 [(match_scratch:SI 0 "r")
19196 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19197 (clobber (reg:CC FLAGS_REG))
19198 (clobber (mem:BLK (scratch)))])]
19200 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19201 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19202 (clobber (mem:BLK (scratch)))])
19203 (parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19204 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19207 ;; Convert esp additions to pop.
19209 [(match_scratch:SI 0 "r")
19210 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
19211 (clobber (reg:CC FLAGS_REG))])]
19213 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19214 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19217 ;; Two pops case is tricky, since pop causes dependency on destination register.
19218 ;; We use two registers if available.
19220 [(match_scratch:SI 0 "r")
19221 (match_scratch:SI 1 "r")
19222 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19223 (clobber (reg:CC FLAGS_REG))])]
19225 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19226 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])
19227 (parallel [(set (match_dup 1) (mem:SI (reg:SI SP_REG)))
19228 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])]
19232 [(match_scratch:SI 0 "r")
19233 (parallel [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
19234 (clobber (reg:CC FLAGS_REG))])]
19236 [(parallel [(set (match_dup 0) (mem:SI (reg:SI SP_REG)))
19237 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))])
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 compares with 1 to shorter inc/dec operations when CF is not
19243 ;; required and register dies. Similarly for 128 to plus -128.
19245 [(set (match_operand 0 "flags_reg_operand" "")
19246 (match_operator 1 "compare_operator"
19247 [(match_operand 2 "register_operand" "")
19248 (match_operand 3 "const_int_operand" "")]))]
19249 "(INTVAL (operands[3]) == -1
19250 || INTVAL (operands[3]) == 1
19251 || INTVAL (operands[3]) == 128)
19252 && ix86_match_ccmode (insn, CCGCmode)
19253 && peep2_reg_dead_p (1, operands[2])"
19254 [(parallel [(set (match_dup 0)
19255 (match_op_dup 1 [(match_dup 2) (match_dup 3)]))
19256 (clobber (match_dup 2))])]
19260 [(match_scratch:DI 0 "r")
19261 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
19262 (clobber (reg:CC FLAGS_REG))
19263 (clobber (mem:BLK (scratch)))])]
19264 "optimize_size || !TARGET_SUB_ESP_4"
19265 [(clobber (match_dup 0))
19266 (parallel [(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19267 (clobber (mem:BLK (scratch)))])])
19270 [(match_scratch:DI 0 "r")
19271 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -16)))
19272 (clobber (reg:CC FLAGS_REG))
19273 (clobber (mem:BLK (scratch)))])]
19274 "optimize_size || !TARGET_SUB_ESP_8"
19275 [(clobber (match_dup 0))
19276 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19277 (parallel [(set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19278 (clobber (mem:BLK (scratch)))])])
19280 ;; Convert esp subtractions to push.
19282 [(match_scratch:DI 0 "r")
19283 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -8)))
19284 (clobber (reg:CC FLAGS_REG))])]
19285 "optimize_size || !TARGET_SUB_ESP_4"
19286 [(clobber (match_dup 0))
19287 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))])
19290 [(match_scratch:DI 0 "r")
19291 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int -16)))
19292 (clobber (reg:CC FLAGS_REG))])]
19293 "optimize_size || !TARGET_SUB_ESP_8"
19294 [(clobber (match_dup 0))
19295 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))
19296 (set (mem:DI (pre_dec:DI (reg:DI SP_REG))) (match_dup 0))])
19298 ;; Convert epilogue deallocator to pop.
19300 [(match_scratch:DI 0 "r")
19301 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19302 (clobber (reg:CC FLAGS_REG))
19303 (clobber (mem:BLK (scratch)))])]
19304 "optimize_size || !TARGET_ADD_ESP_4"
19305 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19306 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19307 (clobber (mem:BLK (scratch)))])]
19310 ;; Two pops case is tricky, since pop causes dependency on destination register.
19311 ;; We use two registers if available.
19313 [(match_scratch:DI 0 "r")
19314 (match_scratch:DI 1 "r")
19315 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19316 (clobber (reg:CC FLAGS_REG))
19317 (clobber (mem:BLK (scratch)))])]
19318 "optimize_size || !TARGET_ADD_ESP_8"
19319 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19320 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19321 (clobber (mem:BLK (scratch)))])
19322 (parallel [(set (match_dup 1) (mem:DI (reg:DI SP_REG)))
19323 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19327 [(match_scratch:DI 0 "r")
19328 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19329 (clobber (reg:CC FLAGS_REG))
19330 (clobber (mem:BLK (scratch)))])]
19332 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19333 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19334 (clobber (mem:BLK (scratch)))])
19335 (parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19336 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19339 ;; Convert esp additions to pop.
19341 [(match_scratch:DI 0 "r")
19342 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))
19343 (clobber (reg:CC FLAGS_REG))])]
19345 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19346 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19349 ;; Two pops case is tricky, since pop causes dependency on destination register.
19350 ;; We use two registers if available.
19352 [(match_scratch:DI 0 "r")
19353 (match_scratch:DI 1 "r")
19354 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19355 (clobber (reg:CC FLAGS_REG))])]
19357 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19358 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])
19359 (parallel [(set (match_dup 1) (mem:DI (reg:DI SP_REG)))
19360 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])]
19364 [(match_scratch:DI 0 "r")
19365 (parallel [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 16)))
19366 (clobber (reg:CC FLAGS_REG))])]
19368 [(parallel [(set (match_dup 0) (mem:DI (reg:DI SP_REG)))
19369 (set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (const_int 8)))])
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 imul by three, five and nine into lea
19377 [(set (match_operand:SI 0 "register_operand" "")
19378 (mult:SI (match_operand:SI 1 "register_operand" "")
19379 (match_operand:SI 2 "const_int_operand" "")))
19380 (clobber (reg:CC FLAGS_REG))])]
19381 "INTVAL (operands[2]) == 3
19382 || INTVAL (operands[2]) == 5
19383 || INTVAL (operands[2]) == 9"
19384 [(set (match_dup 0)
19385 (plus:SI (mult:SI (match_dup 1) (match_dup 2))
19387 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19391 [(set (match_operand:SI 0 "register_operand" "")
19392 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "")
19393 (match_operand:SI 2 "const_int_operand" "")))
19394 (clobber (reg:CC FLAGS_REG))])]
19396 && (INTVAL (operands[2]) == 3
19397 || INTVAL (operands[2]) == 5
19398 || INTVAL (operands[2]) == 9)"
19399 [(set (match_dup 0) (match_dup 1))
19401 (plus:SI (mult:SI (match_dup 0) (match_dup 2))
19403 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19407 [(set (match_operand:DI 0 "register_operand" "")
19408 (mult:DI (match_operand:DI 1 "register_operand" "")
19409 (match_operand:DI 2 "const_int_operand" "")))
19410 (clobber (reg:CC FLAGS_REG))])]
19412 && (INTVAL (operands[2]) == 3
19413 || INTVAL (operands[2]) == 5
19414 || INTVAL (operands[2]) == 9)"
19415 [(set (match_dup 0)
19416 (plus:DI (mult:DI (match_dup 1) (match_dup 2))
19418 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19422 [(set (match_operand:DI 0 "register_operand" "")
19423 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "")
19424 (match_operand:DI 2 "const_int_operand" "")))
19425 (clobber (reg:CC FLAGS_REG))])]
19428 && (INTVAL (operands[2]) == 3
19429 || INTVAL (operands[2]) == 5
19430 || INTVAL (operands[2]) == 9)"
19431 [(set (match_dup 0) (match_dup 1))
19433 (plus:DI (mult:DI (match_dup 0) (match_dup 2))
19435 { operands[2] = GEN_INT (INTVAL (operands[2]) - 1); })
19437 ;; Imul $32bit_imm, mem, reg is vector decoded, while
19438 ;; imul $32bit_imm, reg, reg is direct decoded.
19440 [(match_scratch:DI 3 "r")
19441 (parallel [(set (match_operand:DI 0 "register_operand" "")
19442 (mult:DI (match_operand:DI 1 "memory_operand" "")
19443 (match_operand:DI 2 "immediate_operand" "")))
19444 (clobber (reg:CC FLAGS_REG))])]
19445 "TARGET_K8 && !optimize_size
19446 && (GET_CODE (operands[2]) != CONST_INT
19447 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
19448 [(set (match_dup 3) (match_dup 1))
19449 (parallel [(set (match_dup 0) (mult:DI (match_dup 3) (match_dup 2)))
19450 (clobber (reg:CC FLAGS_REG))])]
19454 [(match_scratch:SI 3 "r")
19455 (parallel [(set (match_operand:SI 0 "register_operand" "")
19456 (mult:SI (match_operand:SI 1 "memory_operand" "")
19457 (match_operand:SI 2 "immediate_operand" "")))
19458 (clobber (reg:CC FLAGS_REG))])]
19459 "TARGET_K8 && !optimize_size
19460 && (GET_CODE (operands[2]) != CONST_INT
19461 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
19462 [(set (match_dup 3) (match_dup 1))
19463 (parallel [(set (match_dup 0) (mult:SI (match_dup 3) (match_dup 2)))
19464 (clobber (reg:CC FLAGS_REG))])]
19468 [(match_scratch:SI 3 "r")
19469 (parallel [(set (match_operand:DI 0 "register_operand" "")
19471 (mult:SI (match_operand:SI 1 "memory_operand" "")
19472 (match_operand:SI 2 "immediate_operand" ""))))
19473 (clobber (reg:CC FLAGS_REG))])]
19474 "TARGET_K8 && !optimize_size
19475 && (GET_CODE (operands[2]) != CONST_INT
19476 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
19477 [(set (match_dup 3) (match_dup 1))
19478 (parallel [(set (match_dup 0) (zero_extend:DI (mult:SI (match_dup 3) (match_dup 2))))
19479 (clobber (reg:CC FLAGS_REG))])]
19482 ;; imul $8/16bit_imm, regmem, reg is vector decoded.
19483 ;; Convert it into imul reg, reg
19484 ;; It would be better to force assembler to encode instruction using long
19485 ;; immediate, but there is apparently no way to do so.
19487 [(parallel [(set (match_operand:DI 0 "register_operand" "")
19488 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "")
19489 (match_operand:DI 2 "const_int_operand" "")))
19490 (clobber (reg:CC FLAGS_REG))])
19491 (match_scratch:DI 3 "r")]
19492 "TARGET_K8 && !optimize_size
19493 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
19494 [(set (match_dup 3) (match_dup 2))
19495 (parallel [(set (match_dup 0) (mult:DI (match_dup 0) (match_dup 3)))
19496 (clobber (reg:CC FLAGS_REG))])]
19498 if (!rtx_equal_p (operands[0], operands[1]))
19499 emit_move_insn (operands[0], operands[1]);
19503 [(parallel [(set (match_operand:SI 0 "register_operand" "")
19504 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "")
19505 (match_operand:SI 2 "const_int_operand" "")))
19506 (clobber (reg:CC FLAGS_REG))])
19507 (match_scratch:SI 3 "r")]
19508 "TARGET_K8 && !optimize_size
19509 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
19510 [(set (match_dup 3) (match_dup 2))
19511 (parallel [(set (match_dup 0) (mult:SI (match_dup 0) (match_dup 3)))
19512 (clobber (reg:CC FLAGS_REG))])]
19514 if (!rtx_equal_p (operands[0], operands[1]))
19515 emit_move_insn (operands[0], operands[1]);
19519 [(parallel [(set (match_operand:HI 0 "register_operand" "")
19520 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "")
19521 (match_operand:HI 2 "immediate_operand" "")))
19522 (clobber (reg:CC FLAGS_REG))])
19523 (match_scratch:HI 3 "r")]
19524 "TARGET_K8 && !optimize_size"
19525 [(set (match_dup 3) (match_dup 2))
19526 (parallel [(set (match_dup 0) (mult:HI (match_dup 0) (match_dup 3)))
19527 (clobber (reg:CC FLAGS_REG))])]
19529 if (!rtx_equal_p (operands[0], operands[1]))
19530 emit_move_insn (operands[0], operands[1]);
19533 ;; Call-value patterns last so that the wildcard operand does not
19534 ;; disrupt insn-recog's switch tables.
19536 (define_insn "*call_value_pop_0"
19537 [(set (match_operand 0 "" "")
19538 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
19539 (match_operand:SI 2 "" "")))
19540 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
19541 (match_operand:SI 3 "immediate_operand" "")))]
19544 if (SIBLING_CALL_P (insn))
19547 return "call\t%P1";
19549 [(set_attr "type" "callv")])
19551 (define_insn "*call_value_pop_1"
19552 [(set (match_operand 0 "" "")
19553 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
19554 (match_operand:SI 2 "" "")))
19555 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
19556 (match_operand:SI 3 "immediate_operand" "i")))]
19559 if (constant_call_address_operand (operands[1], Pmode))
19561 if (SIBLING_CALL_P (insn))
19564 return "call\t%P1";
19566 if (SIBLING_CALL_P (insn))
19569 return "call\t%A1";
19571 [(set_attr "type" "callv")])
19573 (define_insn "*call_value_0"
19574 [(set (match_operand 0 "" "")
19575 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
19576 (match_operand:SI 2 "" "")))]
19579 if (SIBLING_CALL_P (insn))
19582 return "call\t%P1";
19584 [(set_attr "type" "callv")])
19586 (define_insn "*call_value_0_rex64"
19587 [(set (match_operand 0 "" "")
19588 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
19589 (match_operand:DI 2 "const_int_operand" "")))]
19592 if (SIBLING_CALL_P (insn))
19595 return "call\t%P1";
19597 [(set_attr "type" "callv")])
19599 (define_insn "*call_value_1"
19600 [(set (match_operand 0 "" "")
19601 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
19602 (match_operand:SI 2 "" "")))]
19603 "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
19605 if (constant_call_address_operand (operands[1], Pmode))
19606 return "call\t%P1";
19607 return "call\t%A1";
19609 [(set_attr "type" "callv")])
19611 (define_insn "*sibcall_value_1"
19612 [(set (match_operand 0 "" "")
19613 (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,c,d,a"))
19614 (match_operand:SI 2 "" "")))]
19615 "SIBLING_CALL_P (insn) && !TARGET_64BIT"
19617 if (constant_call_address_operand (operands[1], Pmode))
19621 [(set_attr "type" "callv")])
19623 (define_insn "*call_value_1_rex64"
19624 [(set (match_operand 0 "" "")
19625 (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm"))
19626 (match_operand:DI 2 "" "")))]
19627 "!SIBLING_CALL_P (insn) && TARGET_64BIT"
19629 if (constant_call_address_operand (operands[1], Pmode))
19630 return "call\t%P1";
19631 return "call\t%A1";
19633 [(set_attr "type" "callv")])
19635 (define_insn "*sibcall_value_1_rex64"
19636 [(set (match_operand 0 "" "")
19637 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
19638 (match_operand:DI 2 "" "")))]
19639 "SIBLING_CALL_P (insn) && TARGET_64BIT"
19641 [(set_attr "type" "callv")])
19643 (define_insn "*sibcall_value_1_rex64_v"
19644 [(set (match_operand 0 "" "")
19645 (call (mem:QI (reg:DI 40))
19646 (match_operand:DI 1 "" "")))]
19647 "SIBLING_CALL_P (insn) && TARGET_64BIT"
19649 [(set_attr "type" "callv")])
19651 (define_insn "trap"
19652 [(trap_if (const_int 1) (const_int 5))]
19656 ;;; ix86 doesn't have conditional trap instructions, but we fake them
19657 ;;; for the sake of bounds checking. By emitting bounds checks as
19658 ;;; conditional traps rather than as conditional jumps around
19659 ;;; unconditional traps we avoid introducing spurious basic-block
19660 ;;; boundaries and facilitate elimination of redundant checks. In
19661 ;;; honor of the too-inflexible-for-BPs `bound' instruction, we use
19664 ;;; FIXME: Static branch prediction rules for ix86 are such that
19665 ;;; forward conditional branches predict as untaken. As implemented
19666 ;;; below, pseudo conditional traps violate that rule. We should use
19667 ;;; .pushsection/.popsection to place all of the `int 5's in a special
19668 ;;; section loaded at the end of the text segment and branch forward
19669 ;;; there on bounds-failure, and then jump back immediately (in case
19670 ;;; the system chooses to ignore bounds violations, or to report
19671 ;;; violations and continue execution).
19673 (define_expand "conditional_trap"
19674 [(trap_if (match_operator 0 "comparison_operator"
19675 [(match_dup 2) (const_int 0)])
19676 (match_operand 1 "const_int_operand" ""))]
19679 emit_insn (gen_rtx_TRAP_IF (VOIDmode,
19680 ix86_expand_compare (GET_CODE (operands[0]),
19686 (define_insn "*conditional_trap_1"
19687 [(trap_if (match_operator 0 "comparison_operator"
19688 [(reg FLAGS_REG) (const_int 0)])
19689 (match_operand 1 "const_int_operand" ""))]
19692 operands[2] = gen_label_rtx ();
19693 output_asm_insn ("j%c0\t%l2\; int\t%1", operands);
19694 (*targetm.asm_out.internal_label) (asm_out_file, "L",
19695 CODE_LABEL_NUMBER (operands[2]));
19699 ;; Pentium III SIMD instructions.
19701 ;; Moves for SSE/MMX regs.
19703 (define_expand "movv4sf"
19704 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
19705 (match_operand:V4SF 1 "nonimmediate_operand" ""))]
19708 ix86_expand_vector_move (V4SFmode, operands);
19712 (define_insn "*movv4sf_internal"
19713 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,m")
19714 (match_operand:V4SF 1 "vector_move_operand" "C,xm,x"))]
19718 movaps\t{%1, %0|%0, %1}
19719 movaps\t{%1, %0|%0, %1}"
19720 [(set_attr "type" "ssemov")
19721 (set_attr "mode" "V4SF")])
19724 [(set (match_operand:V4SF 0 "register_operand" "")
19725 (match_operand:V4SF 1 "zero_extended_scalar_load_operand" ""))]
19726 "TARGET_SSE && reload_completed"
19727 [(set (match_dup 0)
19729 (vec_duplicate:V4SF (match_dup 1))
19733 operands[1] = simplify_gen_subreg (SFmode, operands[1], V4SFmode, 0);
19734 operands[2] = CONST0_RTX (V4SFmode);
19737 (define_expand "movv2df"
19738 [(set (match_operand:V2DF 0 "nonimmediate_operand" "")
19739 (match_operand:V2DF 1 "nonimmediate_operand" ""))]
19742 ix86_expand_vector_move (V2DFmode, operands);
19746 (define_insn "*movv2df_internal"
19747 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,m")
19748 (match_operand:V2DF 1 "vector_move_operand" "C,xm,x"))]
19750 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19752 switch (which_alternative)
19755 if (get_attr_mode (insn) == MODE_V4SF)
19756 return "xorps\t%0, %0";
19758 return "xorpd\t%0, %0";
19761 if (get_attr_mode (insn) == MODE_V4SF)
19762 return "movaps\t{%1, %0|%0, %1}";
19764 return "movapd\t{%1, %0|%0, %1}";
19769 [(set_attr "type" "ssemov")
19771 (cond [(eq (symbol_ref "TARGET_SSE2") (const_int 0))
19772 (const_string "V4SF")
19773 (eq_attr "alternative" "0,1")
19775 (ne (symbol_ref "optimize_size")
19777 (const_string "V4SF")
19778 (const_string "V2DF"))
19779 (eq_attr "alternative" "2")
19781 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
19783 (ne (symbol_ref "optimize_size")
19785 (const_string "V4SF")
19786 (const_string "V2DF"))]
19787 (const_string "V2DF")))])
19790 [(set (match_operand:V2DF 0 "register_operand" "")
19791 (match_operand:V2DF 1 "zero_extended_scalar_load_operand" ""))]
19792 "TARGET_SSE2 && reload_completed"
19793 [(set (match_dup 0)
19795 (vec_duplicate:V2DF (match_dup 1))
19799 operands[1] = simplify_gen_subreg (DFmode, operands[1], V2DFmode, 0);
19800 operands[2] = CONST0_RTX (V2DFmode);
19803 ;; 16 byte integral modes handled by SSE, minus TImode, which gets
19804 ;; special-cased for TARGET_64BIT.
19805 (define_mode_macro SSEMODEI [V16QI V8HI V4SI V2DI])
19807 (define_expand "mov<mode>"
19808 [(set (match_operand:SSEMODEI 0 "nonimmediate_operand" "")
19809 (match_operand:SSEMODEI 1 "nonimmediate_operand" ""))]
19812 ix86_expand_vector_move (<MODE>mode, operands);
19816 (define_insn "*mov<mode>_internal"
19817 [(set (match_operand:SSEMODEI 0 "nonimmediate_operand" "=x,x ,m")
19818 (match_operand:SSEMODEI 1 "vector_move_operand" "C ,xm,x"))]
19820 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19822 switch (which_alternative)
19825 if (get_attr_mode (insn) == MODE_V4SF)
19826 return "xorps\t%0, %0";
19828 return "pxor\t%0, %0";
19831 if (get_attr_mode (insn) == MODE_V4SF)
19832 return "movaps\t{%1, %0|%0, %1}";
19834 return "movdqa\t{%1, %0|%0, %1}";
19839 [(set_attr "type" "ssemov")
19841 (cond [(eq (symbol_ref "TARGET_SSE2") (const_int 0))
19842 (const_string "V4SF")
19844 (eq_attr "alternative" "0,1")
19846 (ne (symbol_ref "optimize_size")
19848 (const_string "V4SF")
19849 (const_string "TI"))
19850 (eq_attr "alternative" "2")
19852 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
19854 (ne (symbol_ref "optimize_size")
19856 (const_string "V4SF")
19857 (const_string "TI"))]
19858 (const_string "TI")))])
19860 ;; 8 byte integral modes handled by MMX (and by extension, SSE)
19861 (define_mode_macro MMXMODEI [V8QI V4HI V2SI])
19863 (define_expand "mov<mode>"
19864 [(set (match_operand:MMXMODEI 0 "nonimmediate_operand" "")
19865 (match_operand:MMXMODEI 1 "nonimmediate_operand" ""))]
19868 ix86_expand_vector_move (<MODE>mode, operands);
19872 (define_insn "*mov<mode>_internal_rex64"
19873 [(set (match_operand:MMXMODEI 0 "nonimmediate_operand"
19874 "=rm,r,*y,*y ,m ,*y,Y ,x,x ,m,r,x")
19875 (match_operand:MMXMODEI 1 "vector_move_operand"
19876 "Cr ,m,C ,*ym,*y,Y ,*y,C,xm,x,x,r"))]
19877 "TARGET_64BIT && TARGET_MMX
19878 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19880 movq\t{%1, %0|%0, %1}
19881 movq\t{%1, %0|%0, %1}
19883 movq\t{%1, %0|%0, %1}
19884 movq\t{%1, %0|%0, %1}
19885 movdq2q\t{%1, %0|%0, %1}
19886 movq2dq\t{%1, %0|%0, %1}
19888 movq\t{%1, %0|%0, %1}
19889 movq\t{%1, %0|%0, %1}
19890 movd\t{%1, %0|%0, %1}
19891 movd\t{%1, %0|%0, %1}"
19892 [(set_attr "type" "imov,imov,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov,ssemov,ssemov,ssemov")
19893 (set_attr "mode" "DI")])
19895 (define_insn "*mov<mode>_internal"
19896 [(set (match_operand:MMXMODEI 0 "nonimmediate_operand"
19897 "=*y,*y ,m ,*y,*Y,*Y,*Y ,m ,*x,*x,*x,m")
19898 (match_operand:MMXMODEI 1 "vector_move_operand"
19899 "C ,*ym,*y,*Y,*y,C ,*Ym,*Y,C ,*x,m ,*x"))]
19901 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19904 movq\t{%1, %0|%0, %1}
19905 movq\t{%1, %0|%0, %1}
19906 movdq2q\t{%1, %0|%0, %1}
19907 movq2dq\t{%1, %0|%0, %1}
19909 movq\t{%1, %0|%0, %1}
19910 movq\t{%1, %0|%0, %1}
19912 movaps\t{%1, %0|%0, %1}
19913 movlps\t{%1, %0|%0, %1}
19914 movlps\t{%1, %0|%0, %1}"
19915 [(set_attr "type" "mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov,ssemov,ssemov,ssemov,ssemov,ssemov")
19916 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,DI,V4SF,V4SF,V2SF,V2SF")])
19918 (define_expand "movv2sf"
19919 [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
19920 (match_operand:V2SF 1 "nonimmediate_operand" ""))]
19923 ix86_expand_vector_move (V2SFmode, operands);
19927 (define_insn "*movv2sf_internal_rex64"
19928 [(set (match_operand:V2SF 0 "nonimmediate_operand"
19929 "=rm,r,*y ,*y ,m ,*y,Y ,x,x ,m,r,x")
19930 (match_operand:V2SF 1 "vector_move_operand"
19931 "Cr ,m ,C ,*ym,*y,Y ,*y,C,xm,x,x,r"))]
19932 "TARGET_64BIT && TARGET_MMX
19933 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19935 movq\t{%1, %0|%0, %1}
19936 movq\t{%1, %0|%0, %1}
19938 movq\t{%1, %0|%0, %1}
19939 movq\t{%1, %0|%0, %1}
19940 movdq2q\t{%1, %0|%0, %1}
19941 movq2dq\t{%1, %0|%0, %1}
19943 movlps\t{%1, %0|%0, %1}
19944 movlps\t{%1, %0|%0, %1}
19945 movd\t{%1, %0|%0, %1}
19946 movd\t{%1, %0|%0, %1}"
19947 [(set_attr "type" "imov,imov,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov,ssemov,ssemov,ssemov")
19948 (set_attr "mode" "DI,DI,DI,DI,DI,DI,DI,V4SF,V2SF,V2SF,DI,DI")])
19950 (define_insn "*movv2sf_internal"
19951 [(set (match_operand:V2SF 0 "nonimmediate_operand"
19952 "=*y,*y ,m,*y,*Y,*x,*x ,m")
19953 (match_operand:V2SF 1 "vector_move_operand"
19954 "C ,*ym,*y,*Y,*y,C ,*xm,*x"))]
19956 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19959 movq\t{%1, %0|%0, %1}
19960 movq\t{%1, %0|%0, %1}
19961 movdq2q\t{%1, %0|%0, %1}
19962 movq2dq\t{%1, %0|%0, %1}
19964 movlps\t{%1, %0|%0, %1}
19965 movlps\t{%1, %0|%0, %1}"
19966 [(set_attr "type" "mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,ssemov,ssemov")
19967 (set_attr "mode" "DI,DI,DI,DI,DI,V4SF,V2SF,V2SF")])
19969 (define_expand "movti"
19970 [(set (match_operand:TI 0 "nonimmediate_operand" "")
19971 (match_operand:TI 1 "nonimmediate_operand" ""))]
19972 "TARGET_SSE || TARGET_64BIT"
19975 ix86_expand_move (TImode, operands);
19977 ix86_expand_vector_move (TImode, operands);
19981 (define_insn "*movti_internal"
19982 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
19983 (match_operand:TI 1 "vector_move_operand" "C,xm,x"))]
19984 "TARGET_SSE && !TARGET_64BIT
19985 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19987 switch (which_alternative)
19990 if (get_attr_mode (insn) == MODE_V4SF)
19991 return "xorps\t%0, %0";
19993 return "pxor\t%0, %0";
19996 if (get_attr_mode (insn) == MODE_V4SF)
19997 return "movaps\t{%1, %0|%0, %1}";
19999 return "movdqa\t{%1, %0|%0, %1}";
20004 [(set_attr "type" "ssemov,ssemov,ssemov")
20006 (cond [(eq (symbol_ref "TARGET_SSE2") (const_int 0))
20007 (const_string "V4SF")
20009 (eq_attr "alternative" "0,1")
20011 (ne (symbol_ref "optimize_size")
20013 (const_string "V4SF")
20014 (const_string "TI"))
20015 (eq_attr "alternative" "2")
20017 (ne (symbol_ref "optimize_size")
20019 (const_string "V4SF")
20020 (const_string "TI"))]
20021 (const_string "TI")))])
20023 (define_insn "*movti_rex64"
20024 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,x,xm")
20025 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
20027 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20029 switch (which_alternative)
20035 if (get_attr_mode (insn) == MODE_V4SF)
20036 return "xorps\t%0, %0";
20038 return "pxor\t%0, %0";
20041 if (get_attr_mode (insn) == MODE_V4SF)
20042 return "movaps\t{%1, %0|%0, %1}";
20044 return "movdqa\t{%1, %0|%0, %1}";
20049 [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
20051 (cond [(eq_attr "alternative" "2,3")
20053 (ne (symbol_ref "optimize_size")
20055 (const_string "V4SF")
20056 (const_string "TI"))
20057 (eq_attr "alternative" "4")
20059 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
20061 (ne (symbol_ref "optimize_size")
20063 (const_string "V4SF")
20064 (const_string "TI"))]
20065 (const_string "DI")))])
20067 (define_expand "movtf"
20068 [(set (match_operand:TF 0 "nonimmediate_operand" "")
20069 (match_operand:TF 1 "nonimmediate_operand" ""))]
20072 ix86_expand_move (TFmode, operands);
20076 (define_insn "*movtf_internal"
20077 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o,x,x,xm")
20078 (match_operand:TF 1 "general_operand" "riFo,riF,C,xm,x"))]
20080 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20082 switch (which_alternative)
20088 if (get_attr_mode (insn) == MODE_V4SF)
20089 return "xorps\t%0, %0";
20091 return "pxor\t%0, %0";
20094 if (get_attr_mode (insn) == MODE_V4SF)
20095 return "movaps\t{%1, %0|%0, %1}";
20097 return "movdqa\t{%1, %0|%0, %1}";
20102 [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
20104 (cond [(eq_attr "alternative" "2,3")
20106 (ne (symbol_ref "optimize_size")
20108 (const_string "V4SF")
20109 (const_string "TI"))
20110 (eq_attr "alternative" "4")
20112 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
20114 (ne (symbol_ref "optimize_size")
20116 (const_string "V4SF")
20117 (const_string "TI"))]
20118 (const_string "DI")))])
20120 (define_mode_macro SSEPUSH [V16QI V8HI V4SI V2DI TI V4SF V2DF])
20122 (define_insn "*push<mode>"
20123 [(set (match_operand:SSEPUSH 0 "push_operand" "=<")
20124 (match_operand:SSEPUSH 1 "register_operand" "x"))]
20128 (define_mode_macro MMXPUSH [V8QI V4HI V2SI V2SF])
20130 (define_insn "*push<mode>"
20131 [(set (match_operand:MMXPUSH 0 "push_operand" "=<")
20132 (match_operand:MMXPUSH 1 "register_operand" "xy"))]
20137 [(set (match_operand 0 "push_operand" "")
20138 (match_operand 1 "register_operand" ""))]
20139 "!TARGET_64BIT && reload_completed
20140 && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
20141 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 3)))
20142 (set (match_dup 2) (match_dup 1))]
20143 "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
20144 stack_pointer_rtx);
20145 operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));")
20148 [(set (match_operand 0 "push_operand" "")
20149 (match_operand 1 "register_operand" ""))]
20150 "TARGET_64BIT && reload_completed
20151 && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
20152 [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 3)))
20153 (set (match_dup 2) (match_dup 1))]
20154 "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
20155 stack_pointer_rtx);
20156 operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));")
20160 [(set (match_operand:TI 0 "nonimmediate_operand" "")
20161 (match_operand:TI 1 "general_operand" ""))]
20162 "reload_completed && !SSE_REG_P (operands[0])
20163 && !SSE_REG_P (operands[1])"
20165 "ix86_split_long_move (operands); DONE;")
20168 [(set (match_operand:TF 0 "nonimmediate_operand" "")
20169 (match_operand:TF 1 "general_operand" ""))]
20170 "reload_completed && !SSE_REG_P (operands[0])
20171 && !SSE_REG_P (operands[1])"
20173 "ix86_split_long_move (operands); DONE;")
20175 ;; All 16-byte vector modes handled by SSE
20176 (define_mode_macro SSEMODE [V16QI V8HI V4SI V2DI V4SF V2DF])
20178 (define_expand "movmisalign<mode>"
20179 [(set (match_operand:SSEMODE 0 "nonimmediate_operand" "")
20180 (match_operand:SSEMODE 1 "nonimmediate_operand" ""))]
20183 ix86_expand_vector_move_misalign (<MODE>mode, operands);
20187 ;; All 8-byte vector modes handled by MMX
20188 (define_mode_macro MMXMODE [V8QI V4HI V2SI V2SF])
20190 (define_expand "movmisalign<mode>"
20191 [(set (match_operand:MMXMODE 0 "nonimmediate_operand" "")
20192 (match_operand:MMXMODE 1 "nonimmediate_operand" ""))]
20195 ix86_expand_vector_move (<MODE>mode, operands);
20199 ;; These two patterns are useful for specifying exactly whether to use
20200 ;; movaps or movups
20201 (define_expand "sse_movaps"
20202 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
20203 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "")]
20207 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
20209 rtx tmp = gen_reg_rtx (V4SFmode);
20210 emit_insn (gen_sse_movaps (tmp, operands[1]));
20211 emit_move_insn (operands[0], tmp);
20216 (define_insn "*sse_movaps_1"
20217 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
20218 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
20221 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20222 "movaps\t{%1, %0|%0, %1}"
20223 [(set_attr "type" "ssemov,ssemov")
20224 (set_attr "mode" "V4SF")])
20226 (define_expand "sse_movups"
20227 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
20228 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "")]
20232 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
20234 rtx tmp = gen_reg_rtx (V4SFmode);
20235 emit_insn (gen_sse_movups (tmp, operands[1]));
20236 emit_move_insn (operands[0], tmp);
20241 (define_insn "*sse_movups_1"
20242 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
20243 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
20246 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
20247 "movups\t{%1, %0|%0, %1}"
20248 [(set_attr "type" "ssecvt,ssecvt")
20249 (set_attr "mode" "V4SF")])
20251 ;; SSE Strange Moves.
20253 (define_insn "sse_movmskps"
20254 [(set (match_operand:SI 0 "register_operand" "=r")
20255 (unspec:SI [(match_operand:V4SF 1 "register_operand" "x")]
20258 "movmskps\t{%1, %0|%0, %1}"
20259 [(set_attr "type" "ssecvt")
20260 (set_attr "mode" "V4SF")])
20262 (define_insn "mmx_pmovmskb"
20263 [(set (match_operand:SI 0 "register_operand" "=r")
20264 (unspec:SI [(match_operand:V8QI 1 "register_operand" "y")]
20266 "TARGET_SSE || TARGET_3DNOW_A"
20267 "pmovmskb\t{%1, %0|%0, %1}"
20268 [(set_attr "type" "ssecvt")
20269 (set_attr "mode" "V4SF")])
20272 (define_insn "mmx_maskmovq"
20273 [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
20274 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
20275 (match_operand:V8QI 2 "register_operand" "y")]
20277 "(TARGET_SSE || TARGET_3DNOW_A) && !TARGET_64BIT"
20278 ;; @@@ check ordering of operands in intel/nonintel syntax
20279 "maskmovq\t{%2, %1|%1, %2}"
20280 [(set_attr "type" "mmxcvt")
20281 (set_attr "mode" "DI")])
20283 (define_insn "mmx_maskmovq_rex"
20284 [(set (mem:V8QI (match_operand:DI 0 "register_operand" "D"))
20285 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
20286 (match_operand:V8QI 2 "register_operand" "y")]
20288 "(TARGET_SSE || TARGET_3DNOW_A) && TARGET_64BIT"
20289 ;; @@@ check ordering of operands in intel/nonintel syntax
20290 "maskmovq\t{%2, %1|%1, %2}"
20291 [(set_attr "type" "mmxcvt")
20292 (set_attr "mode" "DI")])
20294 (define_insn "sse_movntv4sf"
20295 [(set (match_operand:V4SF 0 "memory_operand" "=m")
20296 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")]
20299 "movntps\t{%1, %0|%0, %1}"
20300 [(set_attr "type" "ssemov")
20301 (set_attr "mode" "V4SF")])
20303 (define_insn "sse_movntdi"
20304 [(set (match_operand:DI 0 "memory_operand" "=m")
20305 (unspec:DI [(match_operand:DI 1 "register_operand" "y")]
20307 "TARGET_SSE || TARGET_3DNOW_A"
20308 "movntq\t{%1, %0|%0, %1}"
20309 [(set_attr "type" "mmxmov")
20310 (set_attr "mode" "DI")])
20312 (define_insn "sse_movhlps"
20313 [(set (match_operand:V4SF 0 "register_operand" "=x")
20315 (match_operand:V4SF 1 "register_operand" "0")
20316 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
20317 (parallel [(const_int 2)
20323 "movhlps\t{%2, %0|%0, %2}"
20324 [(set_attr "type" "ssecvt")
20325 (set_attr "mode" "V4SF")])
20327 (define_insn "sse_movlhps"
20328 [(set (match_operand:V4SF 0 "register_operand" "=x")
20330 (match_operand:V4SF 1 "register_operand" "0")
20331 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
20332 (parallel [(const_int 2)
20338 "movlhps\t{%2, %0|%0, %2}"
20339 [(set_attr "type" "ssecvt")
20340 (set_attr "mode" "V4SF")])
20342 ;; Store the high V2SF of the source vector to the destination.
20343 (define_insn "sse_storehps"
20344 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,x,x")
20346 (match_operand:V4SF 1 "nonimmediate_operand" "x,x,o")
20347 (parallel [(const_int 2) (const_int 3)])))]
20350 movhps\t{%1, %0|%0, %1}
20351 movhlps\t{%1, %0|%0, %1}
20353 [(set_attr "type" "ssecvt")
20354 (set_attr "mode" "V2SF")])
20357 [(set (match_operand:V2SF 0 "register_operand" "")
20359 (match_operand:V4SF 1 "memory_operand" "")
20360 (parallel [(const_int 2) (const_int 3)])))]
20361 "TARGET_SSE && reload_completed"
20364 emit_move_insn (operands[0], adjust_address (operands[1], V2SFmode, 8));
20368 ;; Load the high V2SF of the target vector from the source vector.
20369 (define_insn "sse_loadhps"
20370 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,o")
20373 (match_operand:V4SF 1 "nonimmediate_operand" "0,0,0")
20374 (parallel [(const_int 0) (const_int 1)]))
20375 (match_operand:V2SF 2 "nonimmediate_operand" "m,x,x")))]
20378 movhps\t{%2, %0|%0, %2}
20379 movlhps\t{%2, %0|%0, %2}
20381 [(set_attr "type" "ssecvt")
20382 (set_attr "mode" "V2SF")])
20385 [(set (match_operand:V4SF 0 "memory_operand" "")
20389 (parallel [(const_int 0) (const_int 1)]))
20390 (match_operand:V2SF 1 "register_operand" "")))]
20391 "TARGET_SSE && reload_completed"
20394 emit_move_insn (adjust_address (operands[0], V2SFmode, 8), operands[1]);
20398 ;; Store the low V2SF of the source vector to the destination.
20399 (define_expand "sse_storelps"
20400 [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
20402 (match_operand:V4SF 1 "nonimmediate_operand" "")
20403 (parallel [(const_int 0) (const_int 1)])))]
20406 operands[1] = gen_lowpart (V2SFmode, operands[1]);
20407 emit_move_insn (operands[0], operands[1]);
20411 ;; Load the low V2SF of the target vector from the source vector.
20412 (define_insn "sse_loadlps"
20413 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,m")
20415 (match_operand:V2SF 2 "nonimmediate_operand" "m,0,x")
20417 (match_operand:V4SF 1 "nonimmediate_operand" "0,x,0")
20418 (parallel [(const_int 2) (const_int 3)]))))]
20421 static const char * const alt[] = {
20422 "movlps\t{%2, %0|%0, %2}",
20423 "shufps\t{%2, %1, %0|%0, %1, %2}",
20424 "movlps\t{%2, %0|%0, %2}"
20427 if (which_alternative == 1)
20428 operands[2] = GEN_INT (0xe4);
20430 return alt[which_alternative];
20432 [(set_attr "type" "ssecvt")
20433 (set_attr "mode" "V2SF")])
20435 (define_expand "sse_loadss"
20436 [(match_operand:V4SF 0 "register_operand" "")
20437 (match_operand:SF 1 "memory_operand" "")]
20440 emit_insn (gen_sse_loadss_1 (operands[0], operands[1],
20441 CONST0_RTX (V4SFmode)));
20445 (define_insn "sse_loadss_1"
20446 [(set (match_operand:V4SF 0 "register_operand" "=x")
20448 (vec_duplicate:V4SF (match_operand:SF 1 "memory_operand" "m"))
20449 (match_operand:V4SF 2 "const0_operand" "X")
20452 "movss\t{%1, %0|%0, %1}"
20453 [(set_attr "type" "ssemov")
20454 (set_attr "mode" "SF")])
20456 (define_insn "sse_movss"
20457 [(set (match_operand:V4SF 0 "register_operand" "=x")
20459 (match_operand:V4SF 1 "register_operand" "0")
20460 (match_operand:V4SF 2 "register_operand" "x")
20463 "movss\t{%2, %0|%0, %2}"
20464 [(set_attr "type" "ssemov")
20465 (set_attr "mode" "SF")])
20467 (define_insn "sse_storess"
20468 [(set (match_operand:SF 0 "memory_operand" "=m")
20470 (match_operand:V4SF 1 "register_operand" "x")
20471 (parallel [(const_int 0)])))]
20473 "movss\t{%1, %0|%0, %1}"
20474 [(set_attr "type" "ssemov")
20475 (set_attr "mode" "SF")])
20477 (define_insn "sse_shufps"
20478 [(set (match_operand:V4SF 0 "register_operand" "=x")
20479 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
20480 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
20481 (match_operand:SI 3 "const_int_operand" "n")]
20484 "shufps\t{%3, %2, %0|%0, %2, %3}"
20485 [(set_attr "type" "ssecvt")
20486 (set_attr "mode" "V4SF")])
20491 (define_insn "addv4sf3"
20492 [(set (match_operand:V4SF 0 "register_operand" "=x")
20493 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20494 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20496 "addps\t{%2, %0|%0, %2}"
20497 [(set_attr "type" "sseadd")
20498 (set_attr "mode" "V4SF")])
20500 (define_insn "vmaddv4sf3"
20501 [(set (match_operand:V4SF 0 "register_operand" "=x")
20503 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20504 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20508 "addss\t{%2, %0|%0, %2}"
20509 [(set_attr "type" "sseadd")
20510 (set_attr "mode" "SF")])
20512 (define_insn "subv4sf3"
20513 [(set (match_operand:V4SF 0 "register_operand" "=x")
20514 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20515 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20517 "subps\t{%2, %0|%0, %2}"
20518 [(set_attr "type" "sseadd")
20519 (set_attr "mode" "V4SF")])
20521 (define_insn "vmsubv4sf3"
20522 [(set (match_operand:V4SF 0 "register_operand" "=x")
20524 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
20525 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20529 "subss\t{%2, %0|%0, %2}"
20530 [(set_attr "type" "sseadd")
20531 (set_attr "mode" "SF")])
20533 ;; ??? Should probably be done by generic code instead.
20534 (define_expand "negv4sf2"
20535 [(set (match_operand:V4SF 0 "register_operand" "")
20536 (xor:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "")
20540 rtx m0 = gen_lowpart (SFmode, gen_int_mode (0x80000000, SImode));
20541 rtx vm0 = gen_rtx_CONST_VECTOR (V4SFmode, gen_rtvec (4, m0, m0, m0, m0));
20542 operands[2] = force_reg (V4SFmode, vm0);
20545 (define_insn "mulv4sf3"
20546 [(set (match_operand:V4SF 0 "register_operand" "=x")
20547 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
20548 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20550 "mulps\t{%2, %0|%0, %2}"
20551 [(set_attr "type" "ssemul")
20552 (set_attr "mode" "V4SF")])
20554 (define_insn "vmmulv4sf3"
20555 [(set (match_operand:V4SF 0 "register_operand" "=x")
20557 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
20558 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20562 "mulss\t{%2, %0|%0, %2}"
20563 [(set_attr "type" "ssemul")
20564 (set_attr "mode" "SF")])
20566 (define_insn "divv4sf3"
20567 [(set (match_operand:V4SF 0 "register_operand" "=x")
20568 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
20569 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20571 "divps\t{%2, %0|%0, %2}"
20572 [(set_attr "type" "ssediv")
20573 (set_attr "mode" "V4SF")])
20575 (define_insn "vmdivv4sf3"
20576 [(set (match_operand:V4SF 0 "register_operand" "=x")
20578 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
20579 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20583 "divss\t{%2, %0|%0, %2}"
20584 [(set_attr "type" "ssediv")
20585 (set_attr "mode" "SF")])
20588 ;; SSE square root/reciprocal
20590 (define_insn "rcpv4sf2"
20591 [(set (match_operand:V4SF 0 "register_operand" "=x")
20593 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RCP))]
20595 "rcpps\t{%1, %0|%0, %1}"
20596 [(set_attr "type" "sse")
20597 (set_attr "mode" "V4SF")])
20599 (define_insn "vmrcpv4sf2"
20600 [(set (match_operand:V4SF 0 "register_operand" "=x")
20602 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
20604 (match_operand:V4SF 2 "register_operand" "0")
20607 "rcpss\t{%1, %0|%0, %1}"
20608 [(set_attr "type" "sse")
20609 (set_attr "mode" "SF")])
20611 (define_insn "rsqrtv4sf2"
20612 [(set (match_operand:V4SF 0 "register_operand" "=x")
20614 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RSQRT))]
20616 "rsqrtps\t{%1, %0|%0, %1}"
20617 [(set_attr "type" "sse")
20618 (set_attr "mode" "V4SF")])
20620 (define_insn "vmrsqrtv4sf2"
20621 [(set (match_operand:V4SF 0 "register_operand" "=x")
20623 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
20625 (match_operand:V4SF 2 "register_operand" "0")
20628 "rsqrtss\t{%1, %0|%0, %1}"
20629 [(set_attr "type" "sse")
20630 (set_attr "mode" "SF")])
20632 (define_insn "sqrtv4sf2"
20633 [(set (match_operand:V4SF 0 "register_operand" "=x")
20634 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
20636 "sqrtps\t{%1, %0|%0, %1}"
20637 [(set_attr "type" "sse")
20638 (set_attr "mode" "V4SF")])
20640 (define_insn "vmsqrtv4sf2"
20641 [(set (match_operand:V4SF 0 "register_operand" "=x")
20643 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
20644 (match_operand:V4SF 2 "register_operand" "0")
20647 "sqrtss\t{%1, %0|%0, %1}"
20648 [(set_attr "type" "sse")
20649 (set_attr "mode" "SF")])
20651 ;; SSE logical operations.
20653 ;; SSE defines logical operations on floating point values. This brings
20654 ;; interesting challenge to RTL representation where logicals are only valid
20655 ;; on integral types. We deal with this by representing the floating point
20656 ;; logical as logical on arguments casted to TImode as this is what hardware
20657 ;; really does. Unfortunately hardware requires the type information to be
20658 ;; present and thus we must avoid subregs from being simplified and eliminated
20659 ;; in later compilation phases.
20661 ;; We have following variants from each instruction:
20662 ;; sse_andsf3 - the operation taking V4SF vector operands
20663 ;; and doing TImode cast on them
20664 ;; *sse_andsf3_memory - the operation taking one memory operand casted to
20665 ;; TImode, since backend insist on eliminating casts
20666 ;; on memory operands
20667 ;; sse_andti3_sf_1 - the operation taking SF scalar operands.
20668 ;; We cannot accept memory operand here as instruction reads
20669 ;; whole scalar. This is generated only post reload by GCC
20670 ;; scalar float operations that expands to logicals (fabs)
20671 ;; sse_andti3_sf_2 - the operation taking SF scalar input and TImode
20672 ;; memory operand. Eventually combine can be able
20673 ;; to synthesize these using splitter.
20674 ;; sse2_anddf3, *sse2_anddf3_memory
20677 ;; These are not called andti3 etc. because we really really don't want
20678 ;; the compiler to widen DImode ands to TImode ands and then try to move
20679 ;; into DImode subregs of SSE registers, and them together, and move out
20680 ;; of DImode subregs again!
20681 ;; SSE1 single precision floating point logical operation
20682 (define_expand "sse_andv4sf3"
20683 [(set (match_operand:V4SF 0 "register_operand" "")
20684 (and:V4SF (match_operand:V4SF 1 "register_operand" "")
20685 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20689 (define_insn "*sse_andv4sf3"
20690 [(set (match_operand:V4SF 0 "register_operand" "=x")
20691 (and:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0")
20692 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20694 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20695 "andps\t{%2, %0|%0, %2}"
20696 [(set_attr "type" "sselog")
20697 (set_attr "mode" "V4SF")])
20699 (define_expand "sse_nandv4sf3"
20700 [(set (match_operand:V4SF 0 "register_operand" "")
20701 (and:V4SF (not:V4SF (match_operand:V4SF 1 "register_operand" ""))
20702 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20706 (define_insn "*sse_nandv4sf3"
20707 [(set (match_operand:V4SF 0 "register_operand" "=x")
20708 (and:V4SF (not:V4SF (match_operand:V4SF 1 "register_operand" "0"))
20709 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20711 "andnps\t{%2, %0|%0, %2}"
20712 [(set_attr "type" "sselog")
20713 (set_attr "mode" "V4SF")])
20715 (define_expand "sse_iorv4sf3"
20716 [(set (match_operand:V4SF 0 "register_operand" "")
20717 (ior:V4SF (match_operand:V4SF 1 "register_operand" "")
20718 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20722 (define_insn "*sse_iorv4sf3"
20723 [(set (match_operand:V4SF 0 "register_operand" "=x")
20724 (ior:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0")
20725 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20727 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20728 "orps\t{%2, %0|%0, %2}"
20729 [(set_attr "type" "sselog")
20730 (set_attr "mode" "V4SF")])
20732 (define_expand "sse_xorv4sf3"
20733 [(set (match_operand:V4SF 0 "register_operand" "")
20734 (xor:V4SF (match_operand:V4SF 1 "register_operand" "")
20735 (match_operand:V4SF 2 "nonimmediate_operand" "")))]
20739 (define_insn "*sse_xorv4sf3"
20740 [(set (match_operand:V4SF 0 "register_operand" "=x")
20741 (xor:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "%0")
20742 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20744 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20745 "xorps\t{%2, %0|%0, %2}"
20746 [(set_attr "type" "sselog")
20747 (set_attr "mode" "V4SF")])
20749 ;; SSE2 double precision floating point logical operation
20751 (define_expand "sse2_andv2df3"
20752 [(set (match_operand:V2DF 0 "register_operand" "")
20753 (and:V2DF (match_operand:V2DF 1 "register_operand" "")
20754 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20758 (define_insn "*sse2_andv2df3"
20759 [(set (match_operand:V2DF 0 "register_operand" "=x")
20760 (and:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "%0")
20761 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20763 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20764 "andpd\t{%2, %0|%0, %2}"
20765 [(set_attr "type" "sselog")
20766 (set_attr "mode" "V2DF")])
20768 (define_expand "sse2_nandv2df3"
20769 [(set (match_operand:V2DF 0 "register_operand" "")
20770 (and:V2DF (not:V2DF (match_operand:V2DF 1 "register_operand" ""))
20771 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20775 (define_insn "*sse2_nandv2df3"
20776 [(set (match_operand:V2DF 0 "register_operand" "=x")
20777 (and:V2DF (not:V2DF (match_operand:V2DF 1 "register_operand" "0"))
20778 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20780 "andnpd\t{%2, %0|%0, %2}"
20781 [(set_attr "type" "sselog")
20782 (set_attr "mode" "V2DF")])
20784 (define_expand "sse2_iorv2df3"
20785 [(set (match_operand:V2DF 0 "register_operand" "")
20786 (ior:V2DF (match_operand:V2DF 1 "register_operand" "")
20787 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20791 (define_insn "*sse2_iorv2df3"
20792 [(set (match_operand:V2DF 0 "register_operand" "=x")
20793 (ior:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "%0")
20794 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20796 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20797 "orpd\t{%2, %0|%0, %2}"
20798 [(set_attr "type" "sselog")
20799 (set_attr "mode" "V2DF")])
20801 (define_expand "sse2_xorv2df3"
20802 [(set (match_operand:V2DF 0 "register_operand" "")
20803 (xor:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "")
20804 (match_operand:V2DF 2 "nonimmediate_operand" "")))]
20808 (define_insn "*sse2_xorv2df3"
20809 [(set (match_operand:V2DF 0 "register_operand" "=x")
20810 (xor:V2DF (match_operand:V2DF 1 "nonimmediate_operand" "%0")
20811 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20813 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20814 "xorpd\t{%2, %0|%0, %2}"
20815 [(set_attr "type" "sselog")
20816 (set_attr "mode" "V2DF")])
20818 ;; SSE2 integral logicals. These patterns must always come after floating
20819 ;; point ones since we don't want compiler to use integer opcodes on floating
20820 ;; point SSE values to avoid matching of subregs in the match_operand.
20821 (define_insn "*sse2_andti3"
20822 [(set (match_operand:TI 0 "register_operand" "=x")
20823 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
20824 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20826 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20827 "pand\t{%2, %0|%0, %2}"
20828 [(set_attr "type" "sselog")
20829 (set_attr "mode" "TI")])
20831 (define_insn "sse2_andv2di3"
20832 [(set (match_operand:V2DI 0 "register_operand" "=x")
20833 (and:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
20834 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20836 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20837 "pand\t{%2, %0|%0, %2}"
20838 [(set_attr "type" "sselog")
20839 (set_attr "mode" "TI")])
20841 (define_insn "*sse2_nandti3"
20842 [(set (match_operand:TI 0 "register_operand" "=x")
20843 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
20844 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20846 "pandn\t{%2, %0|%0, %2}"
20847 [(set_attr "type" "sselog")
20848 (set_attr "mode" "TI")])
20850 (define_insn "sse2_nandv2di3"
20851 [(set (match_operand:V2DI 0 "register_operand" "=x")
20852 (and:V2DI (not:V2DI (match_operand:V2DI 1 "register_operand" "0"))
20853 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20855 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20856 "pandn\t{%2, %0|%0, %2}"
20857 [(set_attr "type" "sselog")
20858 (set_attr "mode" "TI")])
20860 (define_insn "*sse2_iorti3"
20861 [(set (match_operand:TI 0 "register_operand" "=x")
20862 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
20863 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20865 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20866 "por\t{%2, %0|%0, %2}"
20867 [(set_attr "type" "sselog")
20868 (set_attr "mode" "TI")])
20870 (define_insn "sse2_iorv2di3"
20871 [(set (match_operand:V2DI 0 "register_operand" "=x")
20872 (ior:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
20873 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20875 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20876 "por\t{%2, %0|%0, %2}"
20877 [(set_attr "type" "sselog")
20878 (set_attr "mode" "TI")])
20880 (define_insn "*sse2_xorti3"
20881 [(set (match_operand:TI 0 "register_operand" "=x")
20882 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
20883 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
20885 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20886 "pxor\t{%2, %0|%0, %2}"
20887 [(set_attr "type" "sselog")
20888 (set_attr "mode" "TI")])
20890 (define_insn "sse2_xorv2di3"
20891 [(set (match_operand:V2DI 0 "register_operand" "=x")
20892 (xor:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
20893 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20895 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
20896 "pxor\t{%2, %0|%0, %2}"
20897 [(set_attr "type" "sselog")
20898 (set_attr "mode" "TI")])
20900 ;; Use xor, but don't show input operands so they aren't live before
20902 (define_insn "sse_clrv4sf"
20903 [(set (match_operand:V4SF 0 "register_operand" "=x")
20904 (match_operand:V4SF 1 "const0_operand" "X"))]
20907 if (get_attr_mode (insn) == MODE_TI)
20908 return "pxor\t{%0, %0|%0, %0}";
20910 return "xorps\t{%0, %0|%0, %0}";
20912 [(set_attr "type" "sselog")
20913 (set_attr "memory" "none")
20916 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
20918 (ne (symbol_ref "TARGET_SSE2")
20920 (eq (symbol_ref "optimize_size")
20922 (const_string "TI")
20923 (const_string "V4SF")))])
20925 ;; Use xor, but don't show input operands so they aren't live before
20927 (define_insn "sse_clrv2df"
20928 [(set (match_operand:V2DF 0 "register_operand" "=x")
20929 (unspec:V2DF [(const_int 0)] UNSPEC_NOP))]
20931 "xorpd\t{%0, %0|%0, %0}"
20932 [(set_attr "type" "sselog")
20933 (set_attr "memory" "none")
20934 (set_attr "mode" "V4SF")])
20936 ;; SSE mask-generating compares
20938 (define_insn "maskcmpv4sf3"
20939 [(set (match_operand:V4SI 0 "register_operand" "=x")
20940 (match_operator:V4SI 3 "sse_comparison_operator"
20941 [(match_operand:V4SF 1 "register_operand" "0")
20942 (match_operand:V4SF 2 "register_operand" "x")]))]
20944 "cmp%D3ps\t{%2, %0|%0, %2}"
20945 [(set_attr "type" "ssecmp")
20946 (set_attr "mode" "V4SF")])
20948 (define_insn "maskncmpv4sf3"
20949 [(set (match_operand:V4SI 0 "register_operand" "=x")
20951 (match_operator:V4SI 3 "sse_comparison_operator"
20952 [(match_operand:V4SF 1 "register_operand" "0")
20953 (match_operand:V4SF 2 "register_operand" "x")])))]
20956 if (GET_CODE (operands[3]) == UNORDERED)
20957 return "cmpordps\t{%2, %0|%0, %2}";
20959 return "cmpn%D3ps\t{%2, %0|%0, %2}";
20961 [(set_attr "type" "ssecmp")
20962 (set_attr "mode" "V4SF")])
20964 (define_insn "vmmaskcmpv4sf3"
20965 [(set (match_operand:V4SI 0 "register_operand" "=x")
20967 (match_operator:V4SI 3 "sse_comparison_operator"
20968 [(match_operand:V4SF 1 "register_operand" "0")
20969 (match_operand:V4SF 2 "register_operand" "x")])
20970 (subreg:V4SI (match_dup 1) 0)
20973 "cmp%D3ss\t{%2, %0|%0, %2}"
20974 [(set_attr "type" "ssecmp")
20975 (set_attr "mode" "SF")])
20977 (define_insn "vmmaskncmpv4sf3"
20978 [(set (match_operand:V4SI 0 "register_operand" "=x")
20981 (match_operator:V4SI 3 "sse_comparison_operator"
20982 [(match_operand:V4SF 1 "register_operand" "0")
20983 (match_operand:V4SF 2 "register_operand" "x")]))
20984 (subreg:V4SI (match_dup 1) 0)
20988 if (GET_CODE (operands[3]) == UNORDERED)
20989 return "cmpordss\t{%2, %0|%0, %2}";
20991 return "cmpn%D3ss\t{%2, %0|%0, %2}";
20993 [(set_attr "type" "ssecmp")
20994 (set_attr "mode" "SF")])
20996 (define_insn "sse_comi"
20997 [(set (reg:CCFP FLAGS_REG)
20998 (compare:CCFP (vec_select:SF
20999 (match_operand:V4SF 0 "register_operand" "x")
21000 (parallel [(const_int 0)]))
21002 (match_operand:V4SF 1 "register_operand" "x")
21003 (parallel [(const_int 0)]))))]
21005 "comiss\t{%1, %0|%0, %1}"
21006 [(set_attr "type" "ssecomi")
21007 (set_attr "mode" "SF")])
21009 (define_insn "sse_ucomi"
21010 [(set (reg:CCFPU FLAGS_REG)
21011 (compare:CCFPU (vec_select:SF
21012 (match_operand:V4SF 0 "register_operand" "x")
21013 (parallel [(const_int 0)]))
21015 (match_operand:V4SF 1 "register_operand" "x")
21016 (parallel [(const_int 0)]))))]
21018 "ucomiss\t{%1, %0|%0, %1}"
21019 [(set_attr "type" "ssecomi")
21020 (set_attr "mode" "SF")])
21025 (define_insn "sse_unpckhps"
21026 [(set (match_operand:V4SF 0 "register_operand" "=x")
21028 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
21029 (parallel [(const_int 2)
21033 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
21034 (parallel [(const_int 0)
21040 "unpckhps\t{%2, %0|%0, %2}"
21041 [(set_attr "type" "ssecvt")
21042 (set_attr "mode" "V4SF")])
21044 (define_insn "sse_unpcklps"
21045 [(set (match_operand:V4SF 0 "register_operand" "=x")
21047 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
21048 (parallel [(const_int 0)
21052 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
21053 (parallel [(const_int 2)
21059 "unpcklps\t{%2, %0|%0, %2}"
21060 [(set_attr "type" "ssecvt")
21061 (set_attr "mode" "V4SF")])
21066 (define_insn "smaxv4sf3"
21067 [(set (match_operand:V4SF 0 "register_operand" "=x")
21068 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
21069 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
21071 "maxps\t{%2, %0|%0, %2}"
21072 [(set_attr "type" "sse")
21073 (set_attr "mode" "V4SF")])
21075 (define_insn "vmsmaxv4sf3"
21076 [(set (match_operand:V4SF 0 "register_operand" "=x")
21078 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
21079 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
21083 "maxss\t{%2, %0|%0, %2}"
21084 [(set_attr "type" "sse")
21085 (set_attr "mode" "SF")])
21087 (define_insn "sminv4sf3"
21088 [(set (match_operand:V4SF 0 "register_operand" "=x")
21089 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
21090 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
21092 "minps\t{%2, %0|%0, %2}"
21093 [(set_attr "type" "sse")
21094 (set_attr "mode" "V4SF")])
21096 (define_insn "vmsminv4sf3"
21097 [(set (match_operand:V4SF 0 "register_operand" "=x")
21099 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
21100 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
21104 "minss\t{%2, %0|%0, %2}"
21105 [(set_attr "type" "sse")
21106 (set_attr "mode" "SF")])
21108 ;; SSE <-> integer/MMX conversions
21110 (define_insn "cvtpi2ps"
21111 [(set (match_operand:V4SF 0 "register_operand" "=x")
21113 (match_operand:V4SF 1 "register_operand" "0")
21114 (vec_duplicate:V4SF
21115 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
21118 "cvtpi2ps\t{%2, %0|%0, %2}"
21119 [(set_attr "type" "ssecvt")
21120 (set_attr "mode" "V4SF")])
21122 (define_insn "cvtps2pi"
21123 [(set (match_operand:V2SI 0 "register_operand" "=y")
21125 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
21126 (parallel [(const_int 0) (const_int 1)])))]
21128 "cvtps2pi\t{%1, %0|%0, %1}"
21129 [(set_attr "type" "ssecvt")
21130 (set_attr "mode" "V4SF")])
21132 (define_insn "cvttps2pi"
21133 [(set (match_operand:V2SI 0 "register_operand" "=y")
21135 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
21137 (parallel [(const_int 0) (const_int 1)])))]
21139 "cvttps2pi\t{%1, %0|%0, %1}"
21140 [(set_attr "type" "ssecvt")
21141 (set_attr "mode" "SF")])
21143 (define_insn "cvtsi2ss"
21144 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
21146 (match_operand:V4SF 1 "register_operand" "0,0")
21147 (vec_duplicate:V4SF
21148 (float:SF (match_operand:SI 2 "nonimmediate_operand" "r,rm")))
21151 "cvtsi2ss\t{%2, %0|%0, %2}"
21152 [(set_attr "type" "sseicvt")
21153 (set_attr "athlon_decode" "vector,double")
21154 (set_attr "mode" "SF")])
21156 (define_insn "cvtsi2ssq"
21157 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
21159 (match_operand:V4SF 1 "register_operand" "0,0")
21160 (vec_duplicate:V4SF
21161 (float:SF (match_operand:DI 2 "nonimmediate_operand" "r,rm")))
21163 "TARGET_SSE && TARGET_64BIT"
21164 "cvtsi2ssq\t{%2, %0|%0, %2}"
21165 [(set_attr "type" "sseicvt")
21166 (set_attr "athlon_decode" "vector,double")
21167 (set_attr "mode" "SF")])
21169 (define_insn "cvtss2si"
21170 [(set (match_operand:SI 0 "register_operand" "=r,r")
21172 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "x,m"))
21173 (parallel [(const_int 0)])))]
21175 "cvtss2si\t{%1, %0|%0, %1}"
21176 [(set_attr "type" "sseicvt")
21177 (set_attr "athlon_decode" "double,vector")
21178 (set_attr "mode" "SI")])
21180 (define_insn "cvtss2siq"
21181 [(set (match_operand:DI 0 "register_operand" "=r,r")
21183 (fix:V4DI (match_operand:V4SF 1 "nonimmediate_operand" "x,m"))
21184 (parallel [(const_int 0)])))]
21186 "cvtss2siq\t{%1, %0|%0, %1}"
21187 [(set_attr "type" "sseicvt")
21188 (set_attr "athlon_decode" "double,vector")
21189 (set_attr "mode" "DI")])
21191 (define_insn "cvttss2si"
21192 [(set (match_operand:SI 0 "register_operand" "=r,r")
21194 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "x,xm")]
21196 (parallel [(const_int 0)])))]
21198 "cvttss2si\t{%1, %0|%0, %1}"
21199 [(set_attr "type" "sseicvt")
21200 (set_attr "mode" "SF")
21201 (set_attr "athlon_decode" "double,vector")])
21203 (define_insn "cvttss2siq"
21204 [(set (match_operand:DI 0 "register_operand" "=r,r")
21206 (unspec:V4DI [(match_operand:V4SF 1 "nonimmediate_operand" "x,xm")]
21208 (parallel [(const_int 0)])))]
21209 "TARGET_SSE && TARGET_64BIT"
21210 "cvttss2siq\t{%1, %0|%0, %1}"
21211 [(set_attr "type" "sseicvt")
21212 (set_attr "mode" "SF")
21213 (set_attr "athlon_decode" "double,vector")])
21220 (define_insn "addv8qi3"
21221 [(set (match_operand:V8QI 0 "register_operand" "=y")
21222 (plus:V8QI (match_operand:V8QI 1 "register_operand" "%0")
21223 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21225 "paddb\t{%2, %0|%0, %2}"
21226 [(set_attr "type" "mmxadd")
21227 (set_attr "mode" "DI")])
21229 (define_insn "addv4hi3"
21230 [(set (match_operand:V4HI 0 "register_operand" "=y")
21231 (plus:V4HI (match_operand:V4HI 1 "register_operand" "%0")
21232 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21234 "paddw\t{%2, %0|%0, %2}"
21235 [(set_attr "type" "mmxadd")
21236 (set_attr "mode" "DI")])
21238 (define_insn "addv2si3"
21239 [(set (match_operand:V2SI 0 "register_operand" "=y")
21240 (plus:V2SI (match_operand:V2SI 1 "register_operand" "%0")
21241 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21243 "paddd\t{%2, %0|%0, %2}"
21244 [(set_attr "type" "mmxadd")
21245 (set_attr "mode" "DI")])
21247 (define_insn "mmx_adddi3"
21248 [(set (match_operand:DI 0 "register_operand" "=y")
21250 [(plus:DI (match_operand:DI 1 "register_operand" "%0")
21251 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21254 "paddq\t{%2, %0|%0, %2}"
21255 [(set_attr "type" "mmxadd")
21256 (set_attr "mode" "DI")])
21258 (define_insn "ssaddv8qi3"
21259 [(set (match_operand:V8QI 0 "register_operand" "=y")
21260 (ss_plus:V8QI (match_operand:V8QI 1 "register_operand" "%0")
21261 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21263 "paddsb\t{%2, %0|%0, %2}"
21264 [(set_attr "type" "mmxadd")
21265 (set_attr "mode" "DI")])
21267 (define_insn "ssaddv4hi3"
21268 [(set (match_operand:V4HI 0 "register_operand" "=y")
21269 (ss_plus:V4HI (match_operand:V4HI 1 "register_operand" "%0")
21270 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21272 "paddsw\t{%2, %0|%0, %2}"
21273 [(set_attr "type" "mmxadd")
21274 (set_attr "mode" "DI")])
21276 (define_insn "usaddv8qi3"
21277 [(set (match_operand:V8QI 0 "register_operand" "=y")
21278 (us_plus:V8QI (match_operand:V8QI 1 "register_operand" "%0")
21279 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21281 "paddusb\t{%2, %0|%0, %2}"
21282 [(set_attr "type" "mmxadd")
21283 (set_attr "mode" "DI")])
21285 (define_insn "usaddv4hi3"
21286 [(set (match_operand:V4HI 0 "register_operand" "=y")
21287 (us_plus:V4HI (match_operand:V4HI 1 "register_operand" "%0")
21288 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21290 "paddusw\t{%2, %0|%0, %2}"
21291 [(set_attr "type" "mmxadd")
21292 (set_attr "mode" "DI")])
21294 (define_insn "subv8qi3"
21295 [(set (match_operand:V8QI 0 "register_operand" "=y")
21296 (minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
21297 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21299 "psubb\t{%2, %0|%0, %2}"
21300 [(set_attr "type" "mmxadd")
21301 (set_attr "mode" "DI")])
21303 (define_insn "subv4hi3"
21304 [(set (match_operand:V4HI 0 "register_operand" "=y")
21305 (minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
21306 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21308 "psubw\t{%2, %0|%0, %2}"
21309 [(set_attr "type" "mmxadd")
21310 (set_attr "mode" "DI")])
21312 (define_insn "subv2si3"
21313 [(set (match_operand:V2SI 0 "register_operand" "=y")
21314 (minus:V2SI (match_operand:V2SI 1 "register_operand" "0")
21315 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21317 "psubd\t{%2, %0|%0, %2}"
21318 [(set_attr "type" "mmxadd")
21319 (set_attr "mode" "DI")])
21321 (define_insn "mmx_subdi3"
21322 [(set (match_operand:DI 0 "register_operand" "=y")
21324 [(minus:DI (match_operand:DI 1 "register_operand" "0")
21325 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21328 "psubq\t{%2, %0|%0, %2}"
21329 [(set_attr "type" "mmxadd")
21330 (set_attr "mode" "DI")])
21332 (define_insn "sssubv8qi3"
21333 [(set (match_operand:V8QI 0 "register_operand" "=y")
21334 (ss_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
21335 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21337 "psubsb\t{%2, %0|%0, %2}"
21338 [(set_attr "type" "mmxadd")
21339 (set_attr "mode" "DI")])
21341 (define_insn "sssubv4hi3"
21342 [(set (match_operand:V4HI 0 "register_operand" "=y")
21343 (ss_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
21344 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21346 "psubsw\t{%2, %0|%0, %2}"
21347 [(set_attr "type" "mmxadd")
21348 (set_attr "mode" "DI")])
21350 (define_insn "ussubv8qi3"
21351 [(set (match_operand:V8QI 0 "register_operand" "=y")
21352 (us_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
21353 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21355 "psubusb\t{%2, %0|%0, %2}"
21356 [(set_attr "type" "mmxadd")
21357 (set_attr "mode" "DI")])
21359 (define_insn "ussubv4hi3"
21360 [(set (match_operand:V4HI 0 "register_operand" "=y")
21361 (us_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
21362 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21364 "psubusw\t{%2, %0|%0, %2}"
21365 [(set_attr "type" "mmxadd")
21366 (set_attr "mode" "DI")])
21368 (define_insn "mulv4hi3"
21369 [(set (match_operand:V4HI 0 "register_operand" "=y")
21370 (mult:V4HI (match_operand:V4HI 1 "register_operand" "0")
21371 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21373 "pmullw\t{%2, %0|%0, %2}"
21374 [(set_attr "type" "mmxmul")
21375 (set_attr "mode" "DI")])
21377 (define_insn "smulv4hi3_highpart"
21378 [(set (match_operand:V4HI 0 "register_operand" "=y")
21381 (mult:V4SI (sign_extend:V4SI
21382 (match_operand:V4HI 1 "register_operand" "0"))
21384 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
21387 "pmulhw\t{%2, %0|%0, %2}"
21388 [(set_attr "type" "mmxmul")
21389 (set_attr "mode" "DI")])
21391 (define_insn "umulv4hi3_highpart"
21392 [(set (match_operand:V4HI 0 "register_operand" "=y")
21395 (mult:V4SI (zero_extend:V4SI
21396 (match_operand:V4HI 1 "register_operand" "0"))
21398 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
21400 "TARGET_SSE || TARGET_3DNOW_A"
21401 "pmulhuw\t{%2, %0|%0, %2}"
21402 [(set_attr "type" "mmxmul")
21403 (set_attr "mode" "DI")])
21405 (define_insn "mmx_pmaddwd"
21406 [(set (match_operand:V2SI 0 "register_operand" "=y")
21410 (vec_select:V2HI (match_operand:V4HI 1 "register_operand" "0")
21411 (parallel [(const_int 0) (const_int 2)])))
21413 (vec_select:V2HI (match_operand:V4HI 2 "nonimmediate_operand" "ym")
21414 (parallel [(const_int 0) (const_int 2)]))))
21416 (sign_extend:V2SI (vec_select:V2HI (match_dup 1)
21417 (parallel [(const_int 1)
21419 (sign_extend:V2SI (vec_select:V2HI (match_dup 2)
21420 (parallel [(const_int 1)
21421 (const_int 3)]))))))]
21423 "pmaddwd\t{%2, %0|%0, %2}"
21424 [(set_attr "type" "mmxmul")
21425 (set_attr "mode" "DI")])
21428 ;; MMX logical operations
21429 ;; Note we don't want to declare these as regular iordi3 insns to prevent
21430 ;; normal code that also wants to use the FPU from getting broken.
21431 ;; The UNSPECs are there to prevent the combiner from getting overly clever.
21432 (define_insn "mmx_iordi3"
21433 [(set (match_operand:DI 0 "register_operand" "=y")
21435 [(ior:DI (match_operand:DI 1 "register_operand" "%0")
21436 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21439 "por\t{%2, %0|%0, %2}"
21440 [(set_attr "type" "mmxadd")
21441 (set_attr "mode" "DI")])
21443 (define_insn "mmx_xordi3"
21444 [(set (match_operand:DI 0 "register_operand" "=y")
21446 [(xor:DI (match_operand:DI 1 "register_operand" "%0")
21447 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21450 "pxor\t{%2, %0|%0, %2}"
21451 [(set_attr "type" "mmxadd")
21452 (set_attr "mode" "DI")
21453 (set_attr "memory" "none")])
21455 ;; Same as pxor, but don't show input operands so that we don't think
21457 (define_insn "mmx_clrdi"
21458 [(set (match_operand:DI 0 "register_operand" "=y")
21459 (unspec:DI [(const_int 0)] UNSPEC_NOP))]
21461 "pxor\t{%0, %0|%0, %0}"
21462 [(set_attr "type" "mmxadd")
21463 (set_attr "mode" "DI")
21464 (set_attr "memory" "none")])
21466 (define_insn "mmx_anddi3"
21467 [(set (match_operand:DI 0 "register_operand" "=y")
21469 [(and:DI (match_operand:DI 1 "register_operand" "%0")
21470 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21473 "pand\t{%2, %0|%0, %2}"
21474 [(set_attr "type" "mmxadd")
21475 (set_attr "mode" "DI")])
21477 (define_insn "mmx_nanddi3"
21478 [(set (match_operand:DI 0 "register_operand" "=y")
21480 [(and:DI (not:DI (match_operand:DI 1 "register_operand" "0"))
21481 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
21484 "pandn\t{%2, %0|%0, %2}"
21485 [(set_attr "type" "mmxadd")
21486 (set_attr "mode" "DI")])
21489 ;; MMX unsigned averages/sum of absolute differences
21491 (define_insn "mmx_uavgv8qi3"
21492 [(set (match_operand:V8QI 0 "register_operand" "=y")
21494 (plus:V8QI (plus:V8QI
21495 (match_operand:V8QI 1 "register_operand" "0")
21496 (match_operand:V8QI 2 "nonimmediate_operand" "ym"))
21497 (const_vector:V8QI [(const_int 1)
21506 "TARGET_SSE || TARGET_3DNOW_A"
21507 "pavgb\t{%2, %0|%0, %2}"
21508 [(set_attr "type" "mmxshft")
21509 (set_attr "mode" "DI")])
21511 (define_insn "mmx_uavgv4hi3"
21512 [(set (match_operand:V4HI 0 "register_operand" "=y")
21514 (plus:V4HI (plus:V4HI
21515 (match_operand:V4HI 1 "register_operand" "0")
21516 (match_operand:V4HI 2 "nonimmediate_operand" "ym"))
21517 (const_vector:V4HI [(const_int 1)
21522 "TARGET_SSE || TARGET_3DNOW_A"
21523 "pavgw\t{%2, %0|%0, %2}"
21524 [(set_attr "type" "mmxshft")
21525 (set_attr "mode" "DI")])
21527 (define_insn "mmx_psadbw"
21528 [(set (match_operand:DI 0 "register_operand" "=y")
21529 (unspec:DI [(match_operand:V8QI 1 "register_operand" "0")
21530 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
21532 "TARGET_SSE || TARGET_3DNOW_A"
21533 "psadbw\t{%2, %0|%0, %2}"
21534 [(set_attr "type" "mmxshft")
21535 (set_attr "mode" "DI")])
21538 ;; MMX insert/extract/shuffle
21540 (define_expand "mmx_pinsrw"
21541 [(set (match_operand:V4HI 0 "register_operand" "")
21543 (match_operand:V4HI 1 "register_operand" "")
21544 (vec_duplicate:V4HI
21545 (match_operand:SI 2 "nonimmediate_operand" ""))
21546 (match_operand:SI 3 "const_0_to_3_operand" "")))]
21547 "TARGET_SSE || TARGET_3DNOW_A"
21549 operands[2] = gen_lowpart (HImode, operands[2]);
21550 operands[3] = GEN_INT (1 << INTVAL (operands[3]));
21553 (define_insn "*mmx_pinsrw"
21554 [(set (match_operand:V4HI 0 "register_operand" "=y")
21556 (match_operand:V4HI 1 "register_operand" "0")
21557 (vec_duplicate:V4HI
21558 (match_operand:HI 2 "nonimmediate_operand" "rm"))
21559 (match_operand:SI 3 "const_pow2_1_to_8_operand" "N")))]
21560 "TARGET_SSE || TARGET_3DNOW_A"
21562 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
21563 return "pinsrw\t{%3, %k2, %0|%0, %k2, %3}";
21565 [(set_attr "type" "mmxcvt")
21566 (set_attr "mode" "DI")])
21568 (define_insn "mmx_pextrw"
21569 [(set (match_operand:SI 0 "register_operand" "=r")
21570 (zero_extend:SI (vec_select:HI (match_operand:V4HI 1 "register_operand" "y")
21572 [(match_operand:SI 2 "const_0_to_3_operand" "N")]))))]
21573 "TARGET_SSE || TARGET_3DNOW_A"
21574 "pextrw\t{%2, %1, %0|%0, %1, %2}"
21575 [(set_attr "type" "mmxcvt")
21576 (set_attr "mode" "DI")])
21578 (define_insn "mmx_pshufw"
21579 [(set (match_operand:V4HI 0 "register_operand" "=y")
21580 (unspec:V4HI [(match_operand:V4HI 1 "nonimmediate_operand" "ym")
21581 (match_operand:SI 2 "immediate_operand" "i")]
21583 "TARGET_SSE || TARGET_3DNOW_A"
21584 "pshufw\t{%2, %1, %0|%0, %1, %2}"
21585 [(set_attr "type" "mmxcvt")
21586 (set_attr "mode" "DI")])
21589 ;; MMX mask-generating comparisons
21591 (define_insn "eqv8qi3"
21592 [(set (match_operand:V8QI 0 "register_operand" "=y")
21593 (eq:V8QI (match_operand:V8QI 1 "register_operand" "0")
21594 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21596 "pcmpeqb\t{%2, %0|%0, %2}"
21597 [(set_attr "type" "mmxcmp")
21598 (set_attr "mode" "DI")])
21600 (define_insn "eqv4hi3"
21601 [(set (match_operand:V4HI 0 "register_operand" "=y")
21602 (eq:V4HI (match_operand:V4HI 1 "register_operand" "0")
21603 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21605 "pcmpeqw\t{%2, %0|%0, %2}"
21606 [(set_attr "type" "mmxcmp")
21607 (set_attr "mode" "DI")])
21609 (define_insn "eqv2si3"
21610 [(set (match_operand:V2SI 0 "register_operand" "=y")
21611 (eq:V2SI (match_operand:V2SI 1 "register_operand" "0")
21612 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21614 "pcmpeqd\t{%2, %0|%0, %2}"
21615 [(set_attr "type" "mmxcmp")
21616 (set_attr "mode" "DI")])
21618 (define_insn "gtv8qi3"
21619 [(set (match_operand:V8QI 0 "register_operand" "=y")
21620 (gt:V8QI (match_operand:V8QI 1 "register_operand" "0")
21621 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21623 "pcmpgtb\t{%2, %0|%0, %2}"
21624 [(set_attr "type" "mmxcmp")
21625 (set_attr "mode" "DI")])
21627 (define_insn "gtv4hi3"
21628 [(set (match_operand:V4HI 0 "register_operand" "=y")
21629 (gt:V4HI (match_operand:V4HI 1 "register_operand" "0")
21630 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21632 "pcmpgtw\t{%2, %0|%0, %2}"
21633 [(set_attr "type" "mmxcmp")
21634 (set_attr "mode" "DI")])
21636 (define_insn "gtv2si3"
21637 [(set (match_operand:V2SI 0 "register_operand" "=y")
21638 (gt:V2SI (match_operand:V2SI 1 "register_operand" "0")
21639 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
21641 "pcmpgtd\t{%2, %0|%0, %2}"
21642 [(set_attr "type" "mmxcmp")
21643 (set_attr "mode" "DI")])
21646 ;; MMX max/min insns
21648 (define_insn "umaxv8qi3"
21649 [(set (match_operand:V8QI 0 "register_operand" "=y")
21650 (umax:V8QI (match_operand:V8QI 1 "register_operand" "0")
21651 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21652 "TARGET_SSE || TARGET_3DNOW_A"
21653 "pmaxub\t{%2, %0|%0, %2}"
21654 [(set_attr "type" "mmxadd")
21655 (set_attr "mode" "DI")])
21657 (define_insn "smaxv4hi3"
21658 [(set (match_operand:V4HI 0 "register_operand" "=y")
21659 (smax:V4HI (match_operand:V4HI 1 "register_operand" "0")
21660 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21661 "TARGET_SSE || TARGET_3DNOW_A"
21662 "pmaxsw\t{%2, %0|%0, %2}"
21663 [(set_attr "type" "mmxadd")
21664 (set_attr "mode" "DI")])
21666 (define_insn "uminv8qi3"
21667 [(set (match_operand:V8QI 0 "register_operand" "=y")
21668 (umin:V8QI (match_operand:V8QI 1 "register_operand" "0")
21669 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
21670 "TARGET_SSE || TARGET_3DNOW_A"
21671 "pminub\t{%2, %0|%0, %2}"
21672 [(set_attr "type" "mmxadd")
21673 (set_attr "mode" "DI")])
21675 (define_insn "sminv4hi3"
21676 [(set (match_operand:V4HI 0 "register_operand" "=y")
21677 (smin:V4HI (match_operand:V4HI 1 "register_operand" "0")
21678 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
21679 "TARGET_SSE || TARGET_3DNOW_A"
21680 "pminsw\t{%2, %0|%0, %2}"
21681 [(set_attr "type" "mmxadd")
21682 (set_attr "mode" "DI")])
21687 (define_insn "ashrv4hi3"
21688 [(set (match_operand:V4HI 0 "register_operand" "=y")
21689 (ashiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
21690 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21692 "psraw\t{%2, %0|%0, %2}"
21693 [(set_attr "type" "mmxshft")
21694 (set_attr "mode" "DI")])
21696 (define_insn "ashrv2si3"
21697 [(set (match_operand:V2SI 0 "register_operand" "=y")
21698 (ashiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
21699 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21701 "psrad\t{%2, %0|%0, %2}"
21702 [(set_attr "type" "mmxshft")
21703 (set_attr "mode" "DI")])
21705 (define_insn "lshrv4hi3"
21706 [(set (match_operand:V4HI 0 "register_operand" "=y")
21707 (lshiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
21708 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21710 "psrlw\t{%2, %0|%0, %2}"
21711 [(set_attr "type" "mmxshft")
21712 (set_attr "mode" "DI")])
21714 (define_insn "lshrv2si3"
21715 [(set (match_operand:V2SI 0 "register_operand" "=y")
21716 (lshiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
21717 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21719 "psrld\t{%2, %0|%0, %2}"
21720 [(set_attr "type" "mmxshft")
21721 (set_attr "mode" "DI")])
21723 ;; See logical MMX insns.
21724 (define_insn "mmx_lshrdi3"
21725 [(set (match_operand:DI 0 "register_operand" "=y")
21727 [(lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
21728 (match_operand:DI 2 "nonmemory_operand" "yi"))]
21731 "psrlq\t{%2, %0|%0, %2}"
21732 [(set_attr "type" "mmxshft")
21733 (set_attr "mode" "DI")])
21735 (define_insn "ashlv4hi3"
21736 [(set (match_operand:V4HI 0 "register_operand" "=y")
21737 (ashift:V4HI (match_operand:V4HI 1 "register_operand" "0")
21738 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21740 "psllw\t{%2, %0|%0, %2}"
21741 [(set_attr "type" "mmxshft")
21742 (set_attr "mode" "DI")])
21744 (define_insn "ashlv2si3"
21745 [(set (match_operand:V2SI 0 "register_operand" "=y")
21746 (ashift:V2SI (match_operand:V2SI 1 "register_operand" "0")
21747 (match_operand:DI 2 "nonmemory_operand" "yi")))]
21749 "pslld\t{%2, %0|%0, %2}"
21750 [(set_attr "type" "mmxshft")
21751 (set_attr "mode" "DI")])
21753 ;; See logical MMX insns.
21754 (define_insn "mmx_ashldi3"
21755 [(set (match_operand:DI 0 "register_operand" "=y")
21757 [(ashift:DI (match_operand:DI 1 "register_operand" "0")
21758 (match_operand:DI 2 "nonmemory_operand" "yi"))]
21761 "psllq\t{%2, %0|%0, %2}"
21762 [(set_attr "type" "mmxshft")
21763 (set_attr "mode" "DI")])
21766 ;; MMX pack/unpack insns.
21768 (define_insn "mmx_packsswb"
21769 [(set (match_operand:V8QI 0 "register_operand" "=y")
21771 (ss_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
21772 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
21774 "packsswb\t{%2, %0|%0, %2}"
21775 [(set_attr "type" "mmxshft")
21776 (set_attr "mode" "DI")])
21778 (define_insn "mmx_packssdw"
21779 [(set (match_operand:V4HI 0 "register_operand" "=y")
21781 (ss_truncate:V2HI (match_operand:V2SI 1 "register_operand" "0"))
21782 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
21784 "packssdw\t{%2, %0|%0, %2}"
21785 [(set_attr "type" "mmxshft")
21786 (set_attr "mode" "DI")])
21788 (define_insn "mmx_packuswb"
21789 [(set (match_operand:V8QI 0 "register_operand" "=y")
21791 (us_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
21792 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
21794 "packuswb\t{%2, %0|%0, %2}"
21795 [(set_attr "type" "mmxshft")
21796 (set_attr "mode" "DI")])
21798 (define_insn "mmx_punpckhbw"
21799 [(set (match_operand:V8QI 0 "register_operand" "=y")
21801 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
21802 (parallel [(const_int 4)
21810 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
21811 (parallel [(const_int 0)
21821 "punpckhbw\t{%2, %0|%0, %2}"
21822 [(set_attr "type" "mmxcvt")
21823 (set_attr "mode" "DI")])
21825 (define_insn "mmx_punpckhwd"
21826 [(set (match_operand:V4HI 0 "register_operand" "=y")
21828 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
21829 (parallel [(const_int 0)
21833 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
21834 (parallel [(const_int 2)
21840 "punpckhwd\t{%2, %0|%0, %2}"
21841 [(set_attr "type" "mmxcvt")
21842 (set_attr "mode" "DI")])
21844 (define_insn "mmx_punpckhdq"
21845 [(set (match_operand:V2SI 0 "register_operand" "=y")
21847 (match_operand:V2SI 1 "register_operand" "0")
21848 (vec_select:V2SI (match_operand:V2SI 2 "register_operand" "y")
21849 (parallel [(const_int 1)
21853 "punpckhdq\t{%2, %0|%0, %2}"
21854 [(set_attr "type" "mmxcvt")
21855 (set_attr "mode" "DI")])
21857 (define_insn "mmx_punpcklbw"
21858 [(set (match_operand:V8QI 0 "register_operand" "=y")
21860 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
21861 (parallel [(const_int 0)
21869 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
21870 (parallel [(const_int 4)
21880 "punpcklbw\t{%2, %0|%0, %2}"
21881 [(set_attr "type" "mmxcvt")
21882 (set_attr "mode" "DI")])
21884 (define_insn "mmx_punpcklwd"
21885 [(set (match_operand:V4HI 0 "register_operand" "=y")
21887 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
21888 (parallel [(const_int 2)
21892 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
21893 (parallel [(const_int 0)
21899 "punpcklwd\t{%2, %0|%0, %2}"
21900 [(set_attr "type" "mmxcvt")
21901 (set_attr "mode" "DI")])
21903 (define_insn "mmx_punpckldq"
21904 [(set (match_operand:V2SI 0 "register_operand" "=y")
21906 (vec_select:V2SI (match_operand:V2SI 1 "register_operand" "0")
21907 (parallel [(const_int 1)
21909 (match_operand:V2SI 2 "register_operand" "y")
21912 "punpckldq\t{%2, %0|%0, %2}"
21913 [(set_attr "type" "mmxcvt")
21914 (set_attr "mode" "DI")])
21917 ;; Miscellaneous stuff
21919 (define_insn "emms"
21920 [(unspec_volatile [(const_int 0)] UNSPECV_EMMS)
21921 (clobber (reg:XF 8))
21922 (clobber (reg:XF 9))
21923 (clobber (reg:XF 10))
21924 (clobber (reg:XF 11))
21925 (clobber (reg:XF 12))
21926 (clobber (reg:XF 13))
21927 (clobber (reg:XF 14))
21928 (clobber (reg:XF 15))
21929 (clobber (reg:DI 29))
21930 (clobber (reg:DI 30))
21931 (clobber (reg:DI 31))
21932 (clobber (reg:DI 32))
21933 (clobber (reg:DI 33))
21934 (clobber (reg:DI 34))
21935 (clobber (reg:DI 35))
21936 (clobber (reg:DI 36))]
21939 [(set_attr "type" "mmx")
21940 (set_attr "memory" "unknown")])
21942 (define_insn "ldmxcsr"
21943 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
21947 [(set_attr "type" "sse")
21948 (set_attr "memory" "load")])
21950 (define_insn "stmxcsr"
21951 [(set (match_operand:SI 0 "memory_operand" "=m")
21952 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
21955 [(set_attr "type" "sse")
21956 (set_attr "memory" "store")])
21958 (define_expand "sfence"
21959 [(set (match_dup 0)
21960 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
21961 "TARGET_SSE || TARGET_3DNOW_A"
21963 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
21964 MEM_VOLATILE_P (operands[0]) = 1;
21967 (define_insn "*sfence_insn"
21968 [(set (match_operand:BLK 0 "" "")
21969 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
21970 "TARGET_SSE || TARGET_3DNOW_A"
21972 [(set_attr "type" "sse")
21973 (set_attr "memory" "unknown")])
21975 (define_expand "sse_prologue_save"
21976 [(parallel [(set (match_operand:BLK 0 "" "")
21977 (unspec:BLK [(reg:DI 21)
21984 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
21985 (use (match_operand:DI 1 "register_operand" ""))
21986 (use (match_operand:DI 2 "immediate_operand" ""))
21987 (use (label_ref:DI (match_operand 3 "" "")))])]
21991 (define_insn "*sse_prologue_save_insn"
21992 [(set (mem:BLK (plus:DI (match_operand:DI 0 "register_operand" "R")
21993 (match_operand:DI 4 "const_int_operand" "n")))
21994 (unspec:BLK [(reg:DI 21)
22001 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
22002 (use (match_operand:DI 1 "register_operand" "r"))
22003 (use (match_operand:DI 2 "const_int_operand" "i"))
22004 (use (label_ref:DI (match_operand 3 "" "X")))]
22006 && INTVAL (operands[4]) + SSE_REGPARM_MAX * 16 - 16 < 128
22007 && INTVAL (operands[4]) + INTVAL (operands[2]) * 16 >= -128"
22011 operands[0] = gen_rtx_MEM (Pmode,
22012 gen_rtx_PLUS (Pmode, operands[0], operands[4]));
22013 output_asm_insn (\"jmp\\t%A1\", operands);
22014 for (i = SSE_REGPARM_MAX - 1; i >= INTVAL (operands[2]); i--)
22016 operands[4] = adjust_address (operands[0], DImode, i*16);
22017 operands[5] = gen_rtx_REG (TImode, SSE_REGNO (i));
22018 PUT_MODE (operands[4], TImode);
22019 if (GET_CODE (XEXP (operands[0], 0)) != PLUS)
22020 output_asm_insn (\"rex\", operands);
22021 output_asm_insn (\"movaps\\t{%5, %4|%4, %5}\", operands);
22023 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
22024 CODE_LABEL_NUMBER (operands[3]));
22028 [(set_attr "type" "other")
22029 (set_attr "length_immediate" "0")
22030 (set_attr "length_address" "0")
22031 (set_attr "length" "135")
22032 (set_attr "memory" "store")
22033 (set_attr "modrm" "0")
22034 (set_attr "mode" "DI")])
22036 ;; 3Dnow! instructions
22038 (define_insn "addv2sf3"
22039 [(set (match_operand:V2SF 0 "register_operand" "=y")
22040 (plus:V2SF (match_operand:V2SF 1 "register_operand" "0")
22041 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22043 "pfadd\\t{%2, %0|%0, %2}"
22044 [(set_attr "type" "mmxadd")
22045 (set_attr "mode" "V2SF")])
22047 (define_insn "subv2sf3"
22048 [(set (match_operand:V2SF 0 "register_operand" "=y")
22049 (minus:V2SF (match_operand:V2SF 1 "register_operand" "0")
22050 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22052 "pfsub\\t{%2, %0|%0, %2}"
22053 [(set_attr "type" "mmxadd")
22054 (set_attr "mode" "V2SF")])
22056 (define_insn "subrv2sf3"
22057 [(set (match_operand:V2SF 0 "register_operand" "=y")
22058 (minus:V2SF (match_operand:V2SF 2 "nonimmediate_operand" "ym")
22059 (match_operand:V2SF 1 "register_operand" "0")))]
22061 "pfsubr\\t{%2, %0|%0, %2}"
22062 [(set_attr "type" "mmxadd")
22063 (set_attr "mode" "V2SF")])
22065 (define_insn "gtv2sf3"
22066 [(set (match_operand:V2SI 0 "register_operand" "=y")
22067 (gt:V2SI (match_operand:V2SF 1 "register_operand" "0")
22068 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22070 "pfcmpgt\\t{%2, %0|%0, %2}"
22071 [(set_attr "type" "mmxcmp")
22072 (set_attr "mode" "V2SF")])
22074 (define_insn "gev2sf3"
22075 [(set (match_operand:V2SI 0 "register_operand" "=y")
22076 (ge:V2SI (match_operand:V2SF 1 "register_operand" "0")
22077 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22079 "pfcmpge\\t{%2, %0|%0, %2}"
22080 [(set_attr "type" "mmxcmp")
22081 (set_attr "mode" "V2SF")])
22083 (define_insn "eqv2sf3"
22084 [(set (match_operand:V2SI 0 "register_operand" "=y")
22085 (eq:V2SI (match_operand:V2SF 1 "register_operand" "0")
22086 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22088 "pfcmpeq\\t{%2, %0|%0, %2}"
22089 [(set_attr "type" "mmxcmp")
22090 (set_attr "mode" "V2SF")])
22092 (define_insn "pfmaxv2sf3"
22093 [(set (match_operand:V2SF 0 "register_operand" "=y")
22094 (smax:V2SF (match_operand:V2SF 1 "register_operand" "0")
22095 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22097 "pfmax\\t{%2, %0|%0, %2}"
22098 [(set_attr "type" "mmxadd")
22099 (set_attr "mode" "V2SF")])
22101 (define_insn "pfminv2sf3"
22102 [(set (match_operand:V2SF 0 "register_operand" "=y")
22103 (smin:V2SF (match_operand:V2SF 1 "register_operand" "0")
22104 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22106 "pfmin\\t{%2, %0|%0, %2}"
22107 [(set_attr "type" "mmxadd")
22108 (set_attr "mode" "V2SF")])
22110 (define_insn "mulv2sf3"
22111 [(set (match_operand:V2SF 0 "register_operand" "=y")
22112 (mult:V2SF (match_operand:V2SF 1 "register_operand" "0")
22113 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
22115 "pfmul\\t{%2, %0|%0, %2}"
22116 [(set_attr "type" "mmxmul")
22117 (set_attr "mode" "V2SF")])
22119 (define_insn "femms"
22120 [(unspec_volatile [(const_int 0)] UNSPECV_FEMMS)
22121 (clobber (reg:XF 8))
22122 (clobber (reg:XF 9))
22123 (clobber (reg:XF 10))
22124 (clobber (reg:XF 11))
22125 (clobber (reg:XF 12))
22126 (clobber (reg:XF 13))
22127 (clobber (reg:XF 14))
22128 (clobber (reg:XF 15))
22129 (clobber (reg:DI 29))
22130 (clobber (reg:DI 30))
22131 (clobber (reg:DI 31))
22132 (clobber (reg:DI 32))
22133 (clobber (reg:DI 33))
22134 (clobber (reg:DI 34))
22135 (clobber (reg:DI 35))
22136 (clobber (reg:DI 36))]
22139 [(set_attr "type" "mmx")
22140 (set_attr "memory" "none")])
22142 (define_insn "pf2id"
22143 [(set (match_operand:V2SI 0 "register_operand" "=y")
22144 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
22146 "pf2id\\t{%1, %0|%0, %1}"
22147 [(set_attr "type" "mmxcvt")
22148 (set_attr "mode" "V2SF")])
22150 (define_insn "pf2iw"
22151 [(set (match_operand:V2SI 0 "register_operand" "=y")
22154 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
22156 "pf2iw\\t{%1, %0|%0, %1}"
22157 [(set_attr "type" "mmxcvt")
22158 (set_attr "mode" "V2SF")])
22160 (define_insn "pfacc"
22161 [(set (match_operand:V2SF 0 "register_operand" "=y")
22164 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
22165 (parallel [(const_int 0)]))
22166 (vec_select:SF (match_dup 1)
22167 (parallel [(const_int 1)])))
22169 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
22170 (parallel [(const_int 0)]))
22171 (vec_select:SF (match_dup 2)
22172 (parallel [(const_int 1)])))))]
22174 "pfacc\\t{%2, %0|%0, %2}"
22175 [(set_attr "type" "mmxadd")
22176 (set_attr "mode" "V2SF")])
22178 (define_insn "pfnacc"
22179 [(set (match_operand:V2SF 0 "register_operand" "=y")
22182 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
22183 (parallel [(const_int 0)]))
22184 (vec_select:SF (match_dup 1)
22185 (parallel [(const_int 1)])))
22187 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
22188 (parallel [(const_int 0)]))
22189 (vec_select:SF (match_dup 2)
22190 (parallel [(const_int 1)])))))]
22192 "pfnacc\\t{%2, %0|%0, %2}"
22193 [(set_attr "type" "mmxadd")
22194 (set_attr "mode" "V2SF")])
22196 (define_insn "pfpnacc"
22197 [(set (match_operand:V2SF 0 "register_operand" "=y")
22200 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
22201 (parallel [(const_int 0)]))
22202 (vec_select:SF (match_dup 1)
22203 (parallel [(const_int 1)])))
22205 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
22206 (parallel [(const_int 0)]))
22207 (vec_select:SF (match_dup 2)
22208 (parallel [(const_int 1)])))))]
22210 "pfpnacc\\t{%2, %0|%0, %2}"
22211 [(set_attr "type" "mmxadd")
22212 (set_attr "mode" "V2SF")])
22214 (define_insn "pi2fw"
22215 [(set (match_operand:V2SF 0 "register_operand" "=y")
22220 (vec_select:SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
22221 (parallel [(const_int 0)]))))
22224 (vec_select:SI (match_dup 1)
22225 (parallel [(const_int 1)])))))))]
22227 "pi2fw\\t{%1, %0|%0, %1}"
22228 [(set_attr "type" "mmxcvt")
22229 (set_attr "mode" "V2SF")])
22231 (define_insn "floatv2si2"
22232 [(set (match_operand:V2SF 0 "register_operand" "=y")
22233 (float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
22235 "pi2fd\\t{%1, %0|%0, %1}"
22236 [(set_attr "type" "mmxcvt")
22237 (set_attr "mode" "V2SF")])
22239 ;; This insn is identical to pavgb in operation, but the opcode is
22240 ;; different. To avoid accidentally matching pavgb, use an unspec.
22242 (define_insn "pavgusb"
22243 [(set (match_operand:V8QI 0 "register_operand" "=y")
22245 [(match_operand:V8QI 1 "register_operand" "0")
22246 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
22249 "pavgusb\\t{%2, %0|%0, %2}"
22250 [(set_attr "type" "mmxshft")
22251 (set_attr "mode" "TI")])
22253 ;; 3DNow reciprocal and sqrt
22255 (define_insn "pfrcpv2sf2"
22256 [(set (match_operand:V2SF 0 "register_operand" "=y")
22257 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
22260 "pfrcp\\t{%1, %0|%0, %1}"
22261 [(set_attr "type" "mmx")
22262 (set_attr "mode" "TI")])
22264 (define_insn "pfrcpit1v2sf3"
22265 [(set (match_operand:V2SF 0 "register_operand" "=y")
22266 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
22267 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
22270 "pfrcpit1\\t{%2, %0|%0, %2}"
22271 [(set_attr "type" "mmx")
22272 (set_attr "mode" "TI")])
22274 (define_insn "pfrcpit2v2sf3"
22275 [(set (match_operand:V2SF 0 "register_operand" "=y")
22276 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
22277 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
22280 "pfrcpit2\\t{%2, %0|%0, %2}"
22281 [(set_attr "type" "mmx")
22282 (set_attr "mode" "TI")])
22284 (define_insn "pfrsqrtv2sf2"
22285 [(set (match_operand:V2SF 0 "register_operand" "=y")
22286 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
22289 "pfrsqrt\\t{%1, %0|%0, %1}"
22290 [(set_attr "type" "mmx")
22291 (set_attr "mode" "TI")])
22293 (define_insn "pfrsqit1v2sf3"
22294 [(set (match_operand:V2SF 0 "register_operand" "=y")
22295 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
22296 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
22299 "pfrsqit1\\t{%2, %0|%0, %2}"
22300 [(set_attr "type" "mmx")
22301 (set_attr "mode" "TI")])
22303 (define_insn "pmulhrwv4hi3"
22304 [(set (match_operand:V4HI 0 "register_operand" "=y")
22310 (match_operand:V4HI 1 "register_operand" "0"))
22312 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
22313 (const_vector:V4SI [(const_int 32768)
22316 (const_int 32768)]))
22319 "pmulhrw\\t{%2, %0|%0, %2}"
22320 [(set_attr "type" "mmxmul")
22321 (set_attr "mode" "TI")])
22323 (define_insn "pswapdv2si2"
22324 [(set (match_operand:V2SI 0 "register_operand" "=y")
22325 (vec_select:V2SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
22326 (parallel [(const_int 1) (const_int 0)])))]
22328 "pswapd\\t{%1, %0|%0, %1}"
22329 [(set_attr "type" "mmxcvt")
22330 (set_attr "mode" "TI")])
22332 (define_insn "pswapdv2sf2"
22333 [(set (match_operand:V2SF 0 "register_operand" "=y")
22334 (vec_select:V2SF (match_operand:V2SF 1 "nonimmediate_operand" "ym")
22335 (parallel [(const_int 1) (const_int 0)])))]
22337 "pswapd\\t{%1, %0|%0, %1}"
22338 [(set_attr "type" "mmxcvt")
22339 (set_attr "mode" "TI")])
22341 (define_expand "prefetch"
22342 [(prefetch (match_operand 0 "address_operand" "")
22343 (match_operand:SI 1 "const_int_operand" "")
22344 (match_operand:SI 2 "const_int_operand" ""))]
22345 "TARGET_PREFETCH_SSE || TARGET_3DNOW"
22347 int rw = INTVAL (operands[1]);
22348 int locality = INTVAL (operands[2]);
22350 if (rw != 0 && rw != 1)
22352 if (locality < 0 || locality > 3)
22354 if (GET_MODE (operands[0]) != Pmode && GET_MODE (operands[0]) != VOIDmode)
22357 /* Use 3dNOW prefetch in case we are asking for write prefetch not
22358 suported by SSE counterpart or the SSE prefetch is not available
22359 (K6 machines). Otherwise use SSE prefetch as it allows specifying
22361 if (TARGET_3DNOW && (!TARGET_PREFETCH_SSE || rw))
22362 operands[2] = GEN_INT (3);
22364 operands[1] = const0_rtx;
22367 (define_insn "*prefetch_sse"
22368 [(prefetch (match_operand:SI 0 "address_operand" "p")
22370 (match_operand:SI 1 "const_int_operand" ""))]
22371 "TARGET_PREFETCH_SSE && !TARGET_64BIT"
22373 static const char * const patterns[4] = {
22374 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
22377 int locality = INTVAL (operands[1]);
22378 if (locality < 0 || locality > 3)
22381 return patterns[locality];
22383 [(set_attr "type" "sse")
22384 (set_attr "memory" "none")])
22386 (define_insn "*prefetch_sse_rex"
22387 [(prefetch (match_operand:DI 0 "address_operand" "p")
22389 (match_operand:SI 1 "const_int_operand" ""))]
22390 "TARGET_PREFETCH_SSE && TARGET_64BIT"
22392 static const char * const patterns[4] = {
22393 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
22396 int locality = INTVAL (operands[1]);
22397 if (locality < 0 || locality > 3)
22400 return patterns[locality];
22402 [(set_attr "type" "sse")
22403 (set_attr "memory" "none")])
22405 (define_insn "*prefetch_3dnow"
22406 [(prefetch (match_operand:SI 0 "address_operand" "p")
22407 (match_operand:SI 1 "const_int_operand" "n")
22409 "TARGET_3DNOW && !TARGET_64BIT"
22411 if (INTVAL (operands[1]) == 0)
22412 return "prefetch\t%a0";
22414 return "prefetchw\t%a0";
22416 [(set_attr "type" "mmx")
22417 (set_attr "memory" "none")])
22419 (define_insn "*prefetch_3dnow_rex"
22420 [(prefetch (match_operand:DI 0 "address_operand" "p")
22421 (match_operand:SI 1 "const_int_operand" "n")
22423 "TARGET_3DNOW && TARGET_64BIT"
22425 if (INTVAL (operands[1]) == 0)
22426 return "prefetch\t%a0";
22428 return "prefetchw\t%a0";
22430 [(set_attr "type" "mmx")
22431 (set_attr "memory" "none")])
22435 (define_insn "addv2df3"
22436 [(set (match_operand:V2DF 0 "register_operand" "=x")
22437 (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22438 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22440 "addpd\t{%2, %0|%0, %2}"
22441 [(set_attr "type" "sseadd")
22442 (set_attr "mode" "V2DF")])
22444 (define_insn "vmaddv2df3"
22445 [(set (match_operand:V2DF 0 "register_operand" "=x")
22446 (vec_merge:V2DF (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22447 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22451 "addsd\t{%2, %0|%0, %2}"
22452 [(set_attr "type" "sseadd")
22453 (set_attr "mode" "DF")])
22455 (define_insn "subv2df3"
22456 [(set (match_operand:V2DF 0 "register_operand" "=x")
22457 (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22458 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22460 "subpd\t{%2, %0|%0, %2}"
22461 [(set_attr "type" "sseadd")
22462 (set_attr "mode" "V2DF")])
22464 (define_insn "vmsubv2df3"
22465 [(set (match_operand:V2DF 0 "register_operand" "=x")
22466 (vec_merge:V2DF (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
22467 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22471 "subsd\t{%2, %0|%0, %2}"
22472 [(set_attr "type" "sseadd")
22473 (set_attr "mode" "DF")])
22475 (define_insn "mulv2df3"
22476 [(set (match_operand:V2DF 0 "register_operand" "=x")
22477 (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
22478 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22480 "mulpd\t{%2, %0|%0, %2}"
22481 [(set_attr "type" "ssemul")
22482 (set_attr "mode" "V2DF")])
22484 (define_insn "vmmulv2df3"
22485 [(set (match_operand:V2DF 0 "register_operand" "=x")
22486 (vec_merge:V2DF (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
22487 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22491 "mulsd\t{%2, %0|%0, %2}"
22492 [(set_attr "type" "ssemul")
22493 (set_attr "mode" "DF")])
22495 (define_insn "divv2df3"
22496 [(set (match_operand:V2DF 0 "register_operand" "=x")
22497 (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
22498 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22500 "divpd\t{%2, %0|%0, %2}"
22501 [(set_attr "type" "ssediv")
22502 (set_attr "mode" "V2DF")])
22504 (define_insn "vmdivv2df3"
22505 [(set (match_operand:V2DF 0 "register_operand" "=x")
22506 (vec_merge:V2DF (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
22507 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22511 "divsd\t{%2, %0|%0, %2}"
22512 [(set_attr "type" "ssediv")
22513 (set_attr "mode" "DF")])
22517 (define_insn "smaxv2df3"
22518 [(set (match_operand:V2DF 0 "register_operand" "=x")
22519 (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
22520 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22522 "maxpd\t{%2, %0|%0, %2}"
22523 [(set_attr "type" "sseadd")
22524 (set_attr "mode" "V2DF")])
22526 (define_insn "vmsmaxv2df3"
22527 [(set (match_operand:V2DF 0 "register_operand" "=x")
22528 (vec_merge:V2DF (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
22529 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22533 "maxsd\t{%2, %0|%0, %2}"
22534 [(set_attr "type" "sseadd")
22535 (set_attr "mode" "DF")])
22537 (define_insn "sminv2df3"
22538 [(set (match_operand:V2DF 0 "register_operand" "=x")
22539 (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
22540 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
22542 "minpd\t{%2, %0|%0, %2}"
22543 [(set_attr "type" "sseadd")
22544 (set_attr "mode" "V2DF")])
22546 (define_insn "vmsminv2df3"
22547 [(set (match_operand:V2DF 0 "register_operand" "=x")
22548 (vec_merge:V2DF (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
22549 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
22553 "minsd\t{%2, %0|%0, %2}"
22554 [(set_attr "type" "sseadd")
22555 (set_attr "mode" "DF")])
22556 ;; SSE2 square root. There doesn't appear to be an extension for the
22557 ;; reciprocal/rsqrt instructions if the Intel manual is to be believed.
22559 (define_insn "sqrtv2df2"
22560 [(set (match_operand:V2DF 0 "register_operand" "=x")
22561 (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm")))]
22563 "sqrtpd\t{%1, %0|%0, %1}"
22564 [(set_attr "type" "sse")
22565 (set_attr "mode" "V2DF")])
22567 (define_insn "vmsqrtv2df2"
22568 [(set (match_operand:V2DF 0 "register_operand" "=x")
22569 (vec_merge:V2DF (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm"))
22570 (match_operand:V2DF 2 "register_operand" "0")
22573 "sqrtsd\t{%1, %0|%0, %1}"
22574 [(set_attr "type" "sse")
22575 (set_attr "mode" "SF")])
22577 ;; SSE mask-generating compares
22579 (define_insn "maskcmpv2df3"
22580 [(set (match_operand:V2DI 0 "register_operand" "=x")
22581 (match_operator:V2DI 3 "sse_comparison_operator"
22582 [(match_operand:V2DF 1 "register_operand" "0")
22583 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))]
22585 "cmp%D3pd\t{%2, %0|%0, %2}"
22586 [(set_attr "type" "ssecmp")
22587 (set_attr "mode" "V2DF")])
22589 (define_insn "maskncmpv2df3"
22590 [(set (match_operand:V2DI 0 "register_operand" "=x")
22592 (match_operator:V2DI 3 "sse_comparison_operator"
22593 [(match_operand:V2DF 1 "register_operand" "0")
22594 (match_operand:V2DF 2 "nonimmediate_operand" "x")])))]
22597 if (GET_CODE (operands[3]) == UNORDERED)
22598 return "cmpordps\t{%2, %0|%0, %2}";
22600 return "cmpn%D3pd\t{%2, %0|%0, %2}";
22602 [(set_attr "type" "ssecmp")
22603 (set_attr "mode" "V2DF")])
22605 (define_insn "vmmaskcmpv2df3"
22606 [(set (match_operand:V2DI 0 "register_operand" "=x")
22608 (match_operator:V2DI 3 "sse_comparison_operator"
22609 [(match_operand:V2DF 1 "register_operand" "0")
22610 (match_operand:V2DF 2 "nonimmediate_operand" "x")])
22611 (subreg:V2DI (match_dup 1) 0)
22614 "cmp%D3sd\t{%2, %0|%0, %2}"
22615 [(set_attr "type" "ssecmp")
22616 (set_attr "mode" "DF")])
22618 (define_insn "vmmaskncmpv2df3"
22619 [(set (match_operand:V2DI 0 "register_operand" "=x")
22622 (match_operator:V2DI 3 "sse_comparison_operator"
22623 [(match_operand:V2DF 1 "register_operand" "0")
22624 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))
22625 (subreg:V2DI (match_dup 1) 0)
22629 if (GET_CODE (operands[3]) == UNORDERED)
22630 return "cmpordsd\t{%2, %0|%0, %2}";
22632 return "cmpn%D3sd\t{%2, %0|%0, %2}";
22634 [(set_attr "type" "ssecmp")
22635 (set_attr "mode" "DF")])
22637 (define_insn "sse2_comi"
22638 [(set (reg:CCFP FLAGS_REG)
22639 (compare:CCFP (vec_select:DF
22640 (match_operand:V2DF 0 "register_operand" "x")
22641 (parallel [(const_int 0)]))
22643 (match_operand:V2DF 1 "register_operand" "x")
22644 (parallel [(const_int 0)]))))]
22646 "comisd\t{%1, %0|%0, %1}"
22647 [(set_attr "type" "ssecomi")
22648 (set_attr "mode" "DF")])
22650 (define_insn "sse2_ucomi"
22651 [(set (reg:CCFPU FLAGS_REG)
22652 (compare:CCFPU (vec_select:DF
22653 (match_operand:V2DF 0 "register_operand" "x")
22654 (parallel [(const_int 0)]))
22656 (match_operand:V2DF 1 "register_operand" "x")
22657 (parallel [(const_int 0)]))))]
22659 "ucomisd\t{%1, %0|%0, %1}"
22660 [(set_attr "type" "ssecomi")
22661 (set_attr "mode" "DF")])
22663 ;; SSE Strange Moves.
22665 (define_insn "sse2_movmskpd"
22666 [(set (match_operand:SI 0 "register_operand" "=r")
22667 (unspec:SI [(match_operand:V2DF 1 "register_operand" "x")]
22670 "movmskpd\t{%1, %0|%0, %1}"
22671 [(set_attr "type" "ssecvt")
22672 (set_attr "mode" "V2DF")])
22674 (define_insn "sse2_pmovmskb"
22675 [(set (match_operand:SI 0 "register_operand" "=r")
22676 (unspec:SI [(match_operand:V16QI 1 "register_operand" "x")]
22679 "pmovmskb\t{%1, %0|%0, %1}"
22680 [(set_attr "type" "ssecvt")
22681 (set_attr "mode" "V2DF")])
22683 (define_insn "sse2_maskmovdqu"
22684 [(set (mem:V16QI (match_operand:SI 0 "register_operand" "D"))
22685 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
22686 (match_operand:V16QI 2 "register_operand" "x")]
22689 ;; @@@ check ordering of operands in intel/nonintel syntax
22690 "maskmovdqu\t{%2, %1|%1, %2}"
22691 [(set_attr "type" "ssecvt")
22692 (set_attr "mode" "TI")])
22694 (define_insn "sse2_maskmovdqu_rex64"
22695 [(set (mem:V16QI (match_operand:DI 0 "register_operand" "D"))
22696 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
22697 (match_operand:V16QI 2 "register_operand" "x")]
22700 ;; @@@ check ordering of operands in intel/nonintel syntax
22701 "maskmovdqu\t{%2, %1|%1, %2}"
22702 [(set_attr "type" "ssecvt")
22703 (set_attr "mode" "TI")])
22705 (define_insn "sse2_movntv2df"
22706 [(set (match_operand:V2DF 0 "memory_operand" "=m")
22707 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")]
22710 "movntpd\t{%1, %0|%0, %1}"
22711 [(set_attr "type" "ssecvt")
22712 (set_attr "mode" "V2DF")])
22714 (define_insn "sse2_movntv2di"
22715 [(set (match_operand:V2DI 0 "memory_operand" "=m")
22716 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "x")]
22719 "movntdq\t{%1, %0|%0, %1}"
22720 [(set_attr "type" "ssecvt")
22721 (set_attr "mode" "TI")])
22723 (define_insn "sse2_movntsi"
22724 [(set (match_operand:SI 0 "memory_operand" "=m")
22725 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
22728 "movnti\t{%1, %0|%0, %1}"
22729 [(set_attr "type" "ssecvt")
22730 (set_attr "mode" "V2DF")])
22732 ;; SSE <-> integer/MMX conversions
22734 ;; Conversions between SI and SF
22736 (define_insn "cvtdq2ps"
22737 [(set (match_operand:V4SF 0 "register_operand" "=x")
22738 (float:V4SF (match_operand:V4SI 1 "nonimmediate_operand" "xm")))]
22740 "cvtdq2ps\t{%1, %0|%0, %1}"
22741 [(set_attr "type" "ssecvt")
22742 (set_attr "mode" "V2DF")])
22744 (define_insn "cvtps2dq"
22745 [(set (match_operand:V4SI 0 "register_operand" "=x")
22746 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
22748 "cvtps2dq\t{%1, %0|%0, %1}"
22749 [(set_attr "type" "ssecvt")
22750 (set_attr "mode" "TI")])
22752 (define_insn "cvttps2dq"
22753 [(set (match_operand:V4SI 0 "register_operand" "=x")
22754 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
22757 "cvttps2dq\t{%1, %0|%0, %1}"
22758 [(set_attr "type" "ssecvt")
22759 (set_attr "mode" "TI")])
22761 ;; Conversions between SI and DF
22763 (define_insn "cvtdq2pd"
22764 [(set (match_operand:V2DF 0 "register_operand" "=x")
22765 (float:V2DF (vec_select:V2SI
22766 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
22769 (const_int 1)]))))]
22771 "cvtdq2pd\t{%1, %0|%0, %1}"
22772 [(set_attr "type" "ssecvt")
22773 (set_attr "mode" "V2DF")])
22775 (define_insn "cvtpd2dq"
22776 [(set (match_operand:V4SI 0 "register_operand" "=x")
22778 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm"))
22779 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
22781 "cvtpd2dq\t{%1, %0|%0, %1}"
22782 [(set_attr "type" "ssecvt")
22783 (set_attr "mode" "TI")])
22785 (define_insn "cvttpd2dq"
22786 [(set (match_operand:V4SI 0 "register_operand" "=x")
22788 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
22790 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
22792 "cvttpd2dq\t{%1, %0|%0, %1}"
22793 [(set_attr "type" "ssecvt")
22794 (set_attr "mode" "TI")])
22796 (define_insn "cvtpd2pi"
22797 [(set (match_operand:V2SI 0 "register_operand" "=y")
22798 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
22800 "cvtpd2pi\t{%1, %0|%0, %1}"
22801 [(set_attr "type" "ssecvt")
22802 (set_attr "mode" "TI")])
22804 (define_insn "cvttpd2pi"
22805 [(set (match_operand:V2SI 0 "register_operand" "=y")
22806 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
22809 "cvttpd2pi\t{%1, %0|%0, %1}"
22810 [(set_attr "type" "ssecvt")
22811 (set_attr "mode" "TI")])
22813 (define_insn "cvtpi2pd"
22814 [(set (match_operand:V2DF 0 "register_operand" "=x")
22815 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
22817 "cvtpi2pd\t{%1, %0|%0, %1}"
22818 [(set_attr "type" "ssecvt")
22819 (set_attr "mode" "TI")])
22821 ;; Conversions between SI and DF
22823 (define_insn "cvtsd2si"
22824 [(set (match_operand:SI 0 "register_operand" "=r,r")
22825 (fix:SI (vec_select:DF (match_operand:V2DF 1 "register_operand" "x,m")
22826 (parallel [(const_int 0)]))))]
22828 "cvtsd2si\t{%1, %0|%0, %1}"
22829 [(set_attr "type" "sseicvt")
22830 (set_attr "athlon_decode" "double,vector")
22831 (set_attr "mode" "SI")])
22833 (define_insn "cvtsd2siq"
22834 [(set (match_operand:DI 0 "register_operand" "=r,r")
22835 (fix:DI (vec_select:DF (match_operand:V2DF 1 "register_operand" "x,m")
22836 (parallel [(const_int 0)]))))]
22837 "TARGET_SSE2 && TARGET_64BIT"
22838 "cvtsd2siq\t{%1, %0|%0, %1}"
22839 [(set_attr "type" "sseicvt")
22840 (set_attr "athlon_decode" "double,vector")
22841 (set_attr "mode" "DI")])
22843 (define_insn "cvttsd2si"
22844 [(set (match_operand:SI 0 "register_operand" "=r,r")
22845 (unspec:SI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "x,xm")
22846 (parallel [(const_int 0)]))] UNSPEC_FIX))]
22848 "cvttsd2si\t{%1, %0|%0, %1}"
22849 [(set_attr "type" "sseicvt")
22850 (set_attr "mode" "SI")
22851 (set_attr "athlon_decode" "double,vector")])
22853 (define_insn "cvttsd2siq"
22854 [(set (match_operand:DI 0 "register_operand" "=r,r")
22855 (unspec:DI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "x,xm")
22856 (parallel [(const_int 0)]))] UNSPEC_FIX))]
22857 "TARGET_SSE2 && TARGET_64BIT"
22858 "cvttsd2siq\t{%1, %0|%0, %1}"
22859 [(set_attr "type" "sseicvt")
22860 (set_attr "mode" "DI")
22861 (set_attr "athlon_decode" "double,vector")])
22863 (define_insn "cvtsi2sd"
22864 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
22865 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0,0")
22866 (vec_duplicate:V2DF
22868 (match_operand:SI 2 "nonimmediate_operand" "r,rm")))
22871 "cvtsi2sd\t{%2, %0|%0, %2}"
22872 [(set_attr "type" "sseicvt")
22873 (set_attr "mode" "DF")
22874 (set_attr "athlon_decode" "double,direct")])
22876 (define_insn "cvtsi2sdq"
22877 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
22878 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0,0")
22879 (vec_duplicate:V2DF
22881 (match_operand:DI 2 "nonimmediate_operand" "r,rm")))
22883 "TARGET_SSE2 && TARGET_64BIT"
22884 "cvtsi2sdq\t{%2, %0|%0, %2}"
22885 [(set_attr "type" "sseicvt")
22886 (set_attr "mode" "DF")
22887 (set_attr "athlon_decode" "double,direct")])
22889 ;; Conversions between SF and DF
22891 (define_insn "cvtsd2ss"
22892 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
22893 (vec_merge:V4SF (match_operand:V4SF 1 "register_operand" "0,0")
22894 (vec_duplicate:V4SF
22895 (float_truncate:V2SF
22896 (match_operand:V2DF 2 "nonimmediate_operand" "x,xm")))
22899 "cvtsd2ss\t{%2, %0|%0, %2}"
22900 [(set_attr "type" "ssecvt")
22901 (set_attr "athlon_decode" "vector,double")
22902 (set_attr "mode" "SF")])
22904 (define_insn "cvtss2sd"
22905 [(set (match_operand:V2DF 0 "register_operand" "=x")
22906 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0")
22909 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
22910 (parallel [(const_int 0)
22914 "cvtss2sd\t{%2, %0|%0, %2}"
22915 [(set_attr "type" "ssecvt")
22916 (set_attr "mode" "DF")])
22918 (define_insn "cvtpd2ps"
22919 [(set (match_operand:V4SF 0 "register_operand" "=x")
22922 (subreg:V2SI (float_truncate:V2SF
22923 (match_operand:V2DF 1 "nonimmediate_operand" "xm")) 0)
22924 (const_vector:V2SI [(const_int 0) (const_int 0)])) 0))]
22926 "cvtpd2ps\t{%1, %0|%0, %1}"
22927 [(set_attr "type" "ssecvt")
22928 (set_attr "mode" "V4SF")])
22930 (define_insn "cvtps2pd"
22931 [(set (match_operand:V2DF 0 "register_operand" "=x")
22933 (vec_select:V2SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")
22934 (parallel [(const_int 0)
22935 (const_int 1)]))))]
22937 "cvtps2pd\t{%1, %0|%0, %1}"
22938 [(set_attr "type" "ssecvt")
22939 (set_attr "mode" "V2DF")])
22941 ;; SSE2 variants of MMX insns
22945 (define_insn "addv16qi3"
22946 [(set (match_operand:V16QI 0 "register_operand" "=x")
22947 (plus:V16QI (match_operand:V16QI 1 "register_operand" "%0")
22948 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
22950 "paddb\t{%2, %0|%0, %2}"
22951 [(set_attr "type" "sseiadd")
22952 (set_attr "mode" "TI")])
22954 (define_insn "addv8hi3"
22955 [(set (match_operand:V8HI 0 "register_operand" "=x")
22956 (plus:V8HI (match_operand:V8HI 1 "register_operand" "%0")
22957 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
22959 "paddw\t{%2, %0|%0, %2}"
22960 [(set_attr "type" "sseiadd")
22961 (set_attr "mode" "TI")])
22963 (define_insn "addv4si3"
22964 [(set (match_operand:V4SI 0 "register_operand" "=x")
22965 (plus:V4SI (match_operand:V4SI 1 "register_operand" "%0")
22966 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
22968 "paddd\t{%2, %0|%0, %2}"
22969 [(set_attr "type" "sseiadd")
22970 (set_attr "mode" "TI")])
22972 (define_insn "addv2di3"
22973 [(set (match_operand:V2DI 0 "register_operand" "=x")
22974 (plus:V2DI (match_operand:V2DI 1 "register_operand" "%0")
22975 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
22977 "paddq\t{%2, %0|%0, %2}"
22978 [(set_attr "type" "sseiadd")
22979 (set_attr "mode" "TI")])
22981 (define_insn "ssaddv16qi3"
22982 [(set (match_operand:V16QI 0 "register_operand" "=x")
22983 (ss_plus:V16QI (match_operand:V16QI 1 "register_operand" "%0")
22984 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
22986 "paddsb\t{%2, %0|%0, %2}"
22987 [(set_attr "type" "sseiadd")
22988 (set_attr "mode" "TI")])
22990 (define_insn "ssaddv8hi3"
22991 [(set (match_operand:V8HI 0 "register_operand" "=x")
22992 (ss_plus:V8HI (match_operand:V8HI 1 "register_operand" "%0")
22993 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
22995 "paddsw\t{%2, %0|%0, %2}"
22996 [(set_attr "type" "sseiadd")
22997 (set_attr "mode" "TI")])
22999 (define_insn "usaddv16qi3"
23000 [(set (match_operand:V16QI 0 "register_operand" "=x")
23001 (us_plus:V16QI (match_operand:V16QI 1 "register_operand" "%0")
23002 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23004 "paddusb\t{%2, %0|%0, %2}"
23005 [(set_attr "type" "sseiadd")
23006 (set_attr "mode" "TI")])
23008 (define_insn "usaddv8hi3"
23009 [(set (match_operand:V8HI 0 "register_operand" "=x")
23010 (us_plus:V8HI (match_operand:V8HI 1 "register_operand" "%0")
23011 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23013 "paddusw\t{%2, %0|%0, %2}"
23014 [(set_attr "type" "sseiadd")
23015 (set_attr "mode" "TI")])
23017 (define_insn "subv16qi3"
23018 [(set (match_operand:V16QI 0 "register_operand" "=x")
23019 (minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
23020 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23022 "psubb\t{%2, %0|%0, %2}"
23023 [(set_attr "type" "sseiadd")
23024 (set_attr "mode" "TI")])
23026 (define_insn "subv8hi3"
23027 [(set (match_operand:V8HI 0 "register_operand" "=x")
23028 (minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
23029 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23031 "psubw\t{%2, %0|%0, %2}"
23032 [(set_attr "type" "sseiadd")
23033 (set_attr "mode" "TI")])
23035 (define_insn "subv4si3"
23036 [(set (match_operand:V4SI 0 "register_operand" "=x")
23037 (minus:V4SI (match_operand:V4SI 1 "register_operand" "0")
23038 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23040 "psubd\t{%2, %0|%0, %2}"
23041 [(set_attr "type" "sseiadd")
23042 (set_attr "mode" "TI")])
23044 (define_insn "subv2di3"
23045 [(set (match_operand:V2DI 0 "register_operand" "=x")
23046 (minus:V2DI (match_operand:V2DI 1 "register_operand" "0")
23047 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
23049 "psubq\t{%2, %0|%0, %2}"
23050 [(set_attr "type" "sseiadd")
23051 (set_attr "mode" "TI")])
23053 (define_insn "sssubv16qi3"
23054 [(set (match_operand:V16QI 0 "register_operand" "=x")
23055 (ss_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
23056 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23058 "psubsb\t{%2, %0|%0, %2}"
23059 [(set_attr "type" "sseiadd")
23060 (set_attr "mode" "TI")])
23062 (define_insn "sssubv8hi3"
23063 [(set (match_operand:V8HI 0 "register_operand" "=x")
23064 (ss_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
23065 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23067 "psubsw\t{%2, %0|%0, %2}"
23068 [(set_attr "type" "sseiadd")
23069 (set_attr "mode" "TI")])
23071 (define_insn "ussubv16qi3"
23072 [(set (match_operand:V16QI 0 "register_operand" "=x")
23073 (us_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
23074 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23076 "psubusb\t{%2, %0|%0, %2}"
23077 [(set_attr "type" "sseiadd")
23078 (set_attr "mode" "TI")])
23080 (define_insn "ussubv8hi3"
23081 [(set (match_operand:V8HI 0 "register_operand" "=x")
23082 (us_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
23083 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23085 "psubusw\t{%2, %0|%0, %2}"
23086 [(set_attr "type" "sseiadd")
23087 (set_attr "mode" "TI")])
23089 (define_insn "mulv8hi3"
23090 [(set (match_operand:V8HI 0 "register_operand" "=x")
23091 (mult:V8HI (match_operand:V8HI 1 "register_operand" "0")
23092 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23094 "pmullw\t{%2, %0|%0, %2}"
23095 [(set_attr "type" "sseimul")
23096 (set_attr "mode" "TI")])
23098 (define_insn "smulv8hi3_highpart"
23099 [(set (match_operand:V8HI 0 "register_operand" "=x")
23102 (mult:V8SI (sign_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
23103 (sign_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
23106 "pmulhw\t{%2, %0|%0, %2}"
23107 [(set_attr "type" "sseimul")
23108 (set_attr "mode" "TI")])
23110 (define_insn "umulv8hi3_highpart"
23111 [(set (match_operand:V8HI 0 "register_operand" "=x")
23114 (mult:V8SI (zero_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
23115 (zero_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
23118 "pmulhuw\t{%2, %0|%0, %2}"
23119 [(set_attr "type" "sseimul")
23120 (set_attr "mode" "TI")])
23122 (define_insn "sse2_umulsidi3"
23123 [(set (match_operand:DI 0 "register_operand" "=y")
23124 (mult:DI (zero_extend:DI (vec_select:SI
23125 (match_operand:V2SI 1 "register_operand" "0")
23126 (parallel [(const_int 0)])))
23127 (zero_extend:DI (vec_select:SI
23128 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
23129 (parallel [(const_int 0)])))))]
23131 "pmuludq\t{%2, %0|%0, %2}"
23132 [(set_attr "type" "mmxmul")
23133 (set_attr "mode" "DI")])
23135 (define_insn "sse2_umulv2siv2di3"
23136 [(set (match_operand:V2DI 0 "register_operand" "=x")
23137 (mult:V2DI (zero_extend:V2DI
23139 (match_operand:V4SI 1 "register_operand" "0")
23140 (parallel [(const_int 0) (const_int 2)])))
23143 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
23144 (parallel [(const_int 0) (const_int 2)])))))]
23146 "pmuludq\t{%2, %0|%0, %2}"
23147 [(set_attr "type" "sseimul")
23148 (set_attr "mode" "TI")])
23150 (define_insn "sse2_pmaddwd"
23151 [(set (match_operand:V4SI 0 "register_operand" "=x")
23154 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 1 "register_operand" "0")
23155 (parallel [(const_int 0)
23159 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 2 "nonimmediate_operand" "xm")
23160 (parallel [(const_int 0)
23165 (sign_extend:V4SI (vec_select:V4HI (match_dup 1)
23166 (parallel [(const_int 1)
23170 (sign_extend:V4SI (vec_select:V4HI (match_dup 2)
23171 (parallel [(const_int 1)
23174 (const_int 7)]))))))]
23176 "pmaddwd\t{%2, %0|%0, %2}"
23177 [(set_attr "type" "sseiadd")
23178 (set_attr "mode" "TI")])
23180 ;; Same as pxor, but don't show input operands so that we don't think
23182 (define_insn "sse2_clrti"
23183 [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))]
23186 if (get_attr_mode (insn) == MODE_TI)
23187 return "pxor\t%0, %0";
23189 return "xorps\t%0, %0";
23191 [(set_attr "type" "ssemov")
23192 (set_attr "memory" "none")
23195 (ne (symbol_ref "optimize_size")
23197 (const_string "V4SF")
23198 (const_string "TI")))])
23200 ;; MMX unsigned averages/sum of absolute differences
23202 (define_insn "sse2_uavgv16qi3"
23203 [(set (match_operand:V16QI 0 "register_operand" "=x")
23205 (plus:V16QI (plus:V16QI
23206 (match_operand:V16QI 1 "register_operand" "0")
23207 (match_operand:V16QI 2 "nonimmediate_operand" "xm"))
23208 (const_vector:V16QI [(const_int 1) (const_int 1)
23209 (const_int 1) (const_int 1)
23210 (const_int 1) (const_int 1)
23211 (const_int 1) (const_int 1)
23212 (const_int 1) (const_int 1)
23213 (const_int 1) (const_int 1)
23214 (const_int 1) (const_int 1)
23215 (const_int 1) (const_int 1)]))
23218 "pavgb\t{%2, %0|%0, %2}"
23219 [(set_attr "type" "sseiadd")
23220 (set_attr "mode" "TI")])
23222 (define_insn "sse2_uavgv8hi3"
23223 [(set (match_operand:V8HI 0 "register_operand" "=x")
23225 (plus:V8HI (plus:V8HI
23226 (match_operand:V8HI 1 "register_operand" "0")
23227 (match_operand:V8HI 2 "nonimmediate_operand" "xm"))
23228 (const_vector:V8HI [(const_int 1) (const_int 1)
23229 (const_int 1) (const_int 1)
23230 (const_int 1) (const_int 1)
23231 (const_int 1) (const_int 1)]))
23234 "pavgw\t{%2, %0|%0, %2}"
23235 [(set_attr "type" "sseiadd")
23236 (set_attr "mode" "TI")])
23238 ;; @@@ this isn't the right representation.
23239 (define_insn "sse2_psadbw"
23240 [(set (match_operand:V2DI 0 "register_operand" "=x")
23241 (unspec:V2DI [(match_operand:V16QI 1 "register_operand" "0")
23242 (match_operand:V16QI 2 "nonimmediate_operand" "xm")]
23245 "psadbw\t{%2, %0|%0, %2}"
23246 [(set_attr "type" "sseiadd")
23247 (set_attr "mode" "TI")])
23250 ;; MMX insert/extract/shuffle
23252 (define_expand "sse2_pinsrw"
23253 [(set (match_operand:V8HI 0 "register_operand" "")
23255 (match_operand:V8HI 1 "register_operand" "")
23256 (vec_duplicate:V8HI
23257 (match_operand:SI 2 "nonimmediate_operand" ""))
23258 (match_operand:SI 3 "const_0_to_7_operand" "")))]
23261 operands[2] = gen_lowpart (HImode, operands[2]);
23262 operands[3] = GEN_INT (1 << INTVAL (operands[3]));
23265 (define_insn "*sse2_pinsrw"
23266 [(set (match_operand:V8HI 0 "register_operand" "=x")
23268 (match_operand:V8HI 1 "register_operand" "0")
23269 (vec_duplicate:V8HI
23270 (match_operand:HI 2 "nonimmediate_operand" "rm"))
23271 (match_operand:SI 3 "const_pow2_1_to_128_operand" "N")))]
23274 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
23275 return "pinsrw\t{%3, %k2, %0|%0, %k2, %3}";
23277 [(set_attr "type" "ssecvt")
23278 (set_attr "mode" "TI")])
23280 (define_insn "sse2_pextrw"
23281 [(set (match_operand:SI 0 "register_operand" "=r")
23283 (vec_select:HI (match_operand:V8HI 1 "register_operand" "x")
23285 [(match_operand:SI 2 "const_0_to_7_operand" "N")]))))]
23287 "pextrw\t{%2, %1, %0|%0, %1, %2}"
23288 [(set_attr "type" "ssecvt")
23289 (set_attr "mode" "TI")])
23291 (define_insn "sse2_pshufd"
23292 [(set (match_operand:V4SI 0 "register_operand" "=x")
23293 (unspec:V4SI [(match_operand:V4SI 1 "nonimmediate_operand" "xm")
23294 (match_operand:SI 2 "immediate_operand" "i")]
23297 "pshufd\t{%2, %1, %0|%0, %1, %2}"
23298 [(set_attr "type" "ssecvt")
23299 (set_attr "mode" "TI")])
23301 (define_insn "sse2_pshuflw"
23302 [(set (match_operand:V8HI 0 "register_operand" "=x")
23303 (unspec:V8HI [(match_operand:V8HI 1 "nonimmediate_operand" "xm")
23304 (match_operand:SI 2 "immediate_operand" "i")]
23307 "pshuflw\t{%2, %1, %0|%0, %1, %2}"
23308 [(set_attr "type" "ssecvt")
23309 (set_attr "mode" "TI")])
23311 (define_insn "sse2_pshufhw"
23312 [(set (match_operand:V8HI 0 "register_operand" "=x")
23313 (unspec:V8HI [(match_operand:V8HI 1 "nonimmediate_operand" "xm")
23314 (match_operand:SI 2 "immediate_operand" "i")]
23317 "pshufhw\t{%2, %1, %0|%0, %1, %2}"
23318 [(set_attr "type" "ssecvt")
23319 (set_attr "mode" "TI")])
23321 ;; MMX mask-generating comparisons
23323 (define_insn "eqv16qi3"
23324 [(set (match_operand:V16QI 0 "register_operand" "=x")
23325 (eq:V16QI (match_operand:V16QI 1 "register_operand" "0")
23326 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23328 "pcmpeqb\t{%2, %0|%0, %2}"
23329 [(set_attr "type" "ssecmp")
23330 (set_attr "mode" "TI")])
23332 (define_insn "eqv8hi3"
23333 [(set (match_operand:V8HI 0 "register_operand" "=x")
23334 (eq:V8HI (match_operand:V8HI 1 "register_operand" "0")
23335 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23337 "pcmpeqw\t{%2, %0|%0, %2}"
23338 [(set_attr "type" "ssecmp")
23339 (set_attr "mode" "TI")])
23341 (define_insn "eqv4si3"
23342 [(set (match_operand:V4SI 0 "register_operand" "=x")
23343 (eq:V4SI (match_operand:V4SI 1 "register_operand" "0")
23344 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23346 "pcmpeqd\t{%2, %0|%0, %2}"
23347 [(set_attr "type" "ssecmp")
23348 (set_attr "mode" "TI")])
23350 (define_insn "gtv16qi3"
23351 [(set (match_operand:V16QI 0 "register_operand" "=x")
23352 (gt:V16QI (match_operand:V16QI 1 "register_operand" "0")
23353 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23355 "pcmpgtb\t{%2, %0|%0, %2}"
23356 [(set_attr "type" "ssecmp")
23357 (set_attr "mode" "TI")])
23359 (define_insn "gtv8hi3"
23360 [(set (match_operand:V8HI 0 "register_operand" "=x")
23361 (gt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23362 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23364 "pcmpgtw\t{%2, %0|%0, %2}"
23365 [(set_attr "type" "ssecmp")
23366 (set_attr "mode" "TI")])
23368 (define_insn "gtv4si3"
23369 [(set (match_operand:V4SI 0 "register_operand" "=x")
23370 (gt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23371 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
23373 "pcmpgtd\t{%2, %0|%0, %2}"
23374 [(set_attr "type" "ssecmp")
23375 (set_attr "mode" "TI")])
23378 ;; MMX max/min insns
23380 (define_insn "umaxv16qi3"
23381 [(set (match_operand:V16QI 0 "register_operand" "=x")
23382 (umax:V16QI (match_operand:V16QI 1 "register_operand" "0")
23383 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23385 "pmaxub\t{%2, %0|%0, %2}"
23386 [(set_attr "type" "sseiadd")
23387 (set_attr "mode" "TI")])
23389 (define_insn "smaxv8hi3"
23390 [(set (match_operand:V8HI 0 "register_operand" "=x")
23391 (smax:V8HI (match_operand:V8HI 1 "register_operand" "0")
23392 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23394 "pmaxsw\t{%2, %0|%0, %2}"
23395 [(set_attr "type" "sseiadd")
23396 (set_attr "mode" "TI")])
23398 (define_insn "uminv16qi3"
23399 [(set (match_operand:V16QI 0 "register_operand" "=x")
23400 (umin:V16QI (match_operand:V16QI 1 "register_operand" "0")
23401 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
23403 "pminub\t{%2, %0|%0, %2}"
23404 [(set_attr "type" "sseiadd")
23405 (set_attr "mode" "TI")])
23407 (define_insn "sminv8hi3"
23408 [(set (match_operand:V8HI 0 "register_operand" "=x")
23409 (smin:V8HI (match_operand:V8HI 1 "register_operand" "0")
23410 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
23412 "pminsw\t{%2, %0|%0, %2}"
23413 [(set_attr "type" "sseiadd")
23414 (set_attr "mode" "TI")])
23419 (define_insn "ashrv8hi3"
23420 [(set (match_operand:V8HI 0 "register_operand" "=x")
23421 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23422 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23424 "psraw\t{%2, %0|%0, %2}"
23425 [(set_attr "type" "sseishft")
23426 (set_attr "mode" "TI")])
23428 (define_insn "ashrv4si3"
23429 [(set (match_operand:V4SI 0 "register_operand" "=x")
23430 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23431 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23433 "psrad\t{%2, %0|%0, %2}"
23434 [(set_attr "type" "sseishft")
23435 (set_attr "mode" "TI")])
23437 (define_insn "lshrv8hi3"
23438 [(set (match_operand:V8HI 0 "register_operand" "=x")
23439 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23440 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23442 "psrlw\t{%2, %0|%0, %2}"
23443 [(set_attr "type" "sseishft")
23444 (set_attr "mode" "TI")])
23446 (define_insn "lshrv4si3"
23447 [(set (match_operand:V4SI 0 "register_operand" "=x")
23448 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23449 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23451 "psrld\t{%2, %0|%0, %2}"
23452 [(set_attr "type" "sseishft")
23453 (set_attr "mode" "TI")])
23455 (define_insn "lshrv2di3"
23456 [(set (match_operand:V2DI 0 "register_operand" "=x")
23457 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
23458 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23460 "psrlq\t{%2, %0|%0, %2}"
23461 [(set_attr "type" "sseishft")
23462 (set_attr "mode" "TI")])
23464 (define_insn "ashlv8hi3"
23465 [(set (match_operand:V8HI 0 "register_operand" "=x")
23466 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
23467 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23469 "psllw\t{%2, %0|%0, %2}"
23470 [(set_attr "type" "sseishft")
23471 (set_attr "mode" "TI")])
23473 (define_insn "ashlv4si3"
23474 [(set (match_operand:V4SI 0 "register_operand" "=x")
23475 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
23476 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23478 "pslld\t{%2, %0|%0, %2}"
23479 [(set_attr "type" "sseishft")
23480 (set_attr "mode" "TI")])
23482 (define_insn "ashlv2di3"
23483 [(set (match_operand:V2DI 0 "register_operand" "=x")
23484 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
23485 (match_operand:SI 2 "nonmemory_operand" "xi")))]
23487 "psllq\t{%2, %0|%0, %2}"
23488 [(set_attr "type" "sseishft")
23489 (set_attr "mode" "TI")])
23491 (define_insn "ashrv8hi3_ti"
23492 [(set (match_operand:V8HI 0 "register_operand" "=x")
23493 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23494 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23496 "psraw\t{%2, %0|%0, %2}"
23497 [(set_attr "type" "sseishft")
23498 (set_attr "mode" "TI")])
23500 (define_insn "ashrv4si3_ti"
23501 [(set (match_operand:V4SI 0 "register_operand" "=x")
23502 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23503 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23505 "psrad\t{%2, %0|%0, %2}"
23506 [(set_attr "type" "sseishft")
23507 (set_attr "mode" "TI")])
23509 (define_insn "lshrv8hi3_ti"
23510 [(set (match_operand:V8HI 0 "register_operand" "=x")
23511 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
23512 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23514 "psrlw\t{%2, %0|%0, %2}"
23515 [(set_attr "type" "sseishft")
23516 (set_attr "mode" "TI")])
23518 (define_insn "lshrv4si3_ti"
23519 [(set (match_operand:V4SI 0 "register_operand" "=x")
23520 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
23521 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23523 "psrld\t{%2, %0|%0, %2}"
23524 [(set_attr "type" "sseishft")
23525 (set_attr "mode" "TI")])
23527 (define_insn "lshrv2di3_ti"
23528 [(set (match_operand:V2DI 0 "register_operand" "=x")
23529 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
23530 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23532 "psrlq\t{%2, %0|%0, %2}"
23533 [(set_attr "type" "sseishft")
23534 (set_attr "mode" "TI")])
23536 (define_insn "ashlv8hi3_ti"
23537 [(set (match_operand:V8HI 0 "register_operand" "=x")
23538 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
23539 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23541 "psllw\t{%2, %0|%0, %2}"
23542 [(set_attr "type" "sseishft")
23543 (set_attr "mode" "TI")])
23545 (define_insn "ashlv4si3_ti"
23546 [(set (match_operand:V4SI 0 "register_operand" "=x")
23547 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
23548 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23550 "pslld\t{%2, %0|%0, %2}"
23551 [(set_attr "type" "sseishft")
23552 (set_attr "mode" "TI")])
23554 (define_insn "ashlv2di3_ti"
23555 [(set (match_operand:V2DI 0 "register_operand" "=x")
23556 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
23557 (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
23559 "psllq\t{%2, %0|%0, %2}"
23560 [(set_attr "type" "sseishft")
23561 (set_attr "mode" "TI")])
23563 ;; See logical MMX insns for the reason for the unspec. Strictly speaking
23564 ;; we wouldn't need here it since we never generate TImode arithmetic.
23566 ;; There has to be some kind of prize for the weirdest new instruction...
23567 (define_insn "sse2_ashlti3"
23568 [(set (match_operand:TI 0 "register_operand" "=x")
23570 [(ashift:TI (match_operand:TI 1 "register_operand" "0")
23571 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
23572 (const_int 8)))] UNSPEC_NOP))]
23574 "pslldq\t{%2, %0|%0, %2}"
23575 [(set_attr "type" "sseishft")
23576 (set_attr "mode" "TI")])
23578 (define_insn "sse2_lshrti3"
23579 [(set (match_operand:TI 0 "register_operand" "=x")
23581 [(lshiftrt:TI (match_operand:TI 1 "register_operand" "0")
23582 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
23583 (const_int 8)))] UNSPEC_NOP))]
23585 "psrldq\t{%2, %0|%0, %2}"
23586 [(set_attr "type" "sseishft")
23587 (set_attr "mode" "TI")])
23591 (define_insn "sse2_unpckhpd"
23592 [(set (match_operand:V2DF 0 "register_operand" "=x")
23594 (vec_select:DF (match_operand:V2DF 1 "register_operand" "0")
23595 (parallel [(const_int 1)]))
23596 (vec_select:DF (match_operand:V2DF 2 "register_operand" "x")
23597 (parallel [(const_int 1)]))))]
23599 "unpckhpd\t{%2, %0|%0, %2}"
23600 [(set_attr "type" "ssecvt")
23601 (set_attr "mode" "V2DF")])
23603 (define_insn "sse2_unpcklpd"
23604 [(set (match_operand:V2DF 0 "register_operand" "=x")
23606 (vec_select:DF (match_operand:V2DF 1 "register_operand" "0")
23607 (parallel [(const_int 0)]))
23608 (vec_select:DF (match_operand:V2DF 2 "register_operand" "x")
23609 (parallel [(const_int 0)]))))]
23611 "unpcklpd\t{%2, %0|%0, %2}"
23612 [(set_attr "type" "ssecvt")
23613 (set_attr "mode" "V2DF")])
23615 ;; MMX pack/unpack insns.
23617 (define_insn "sse2_packsswb"
23618 [(set (match_operand:V16QI 0 "register_operand" "=x")
23620 (ss_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
23621 (ss_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
23623 "packsswb\t{%2, %0|%0, %2}"
23624 [(set_attr "type" "ssecvt")
23625 (set_attr "mode" "TI")])
23627 (define_insn "sse2_packssdw"
23628 [(set (match_operand:V8HI 0 "register_operand" "=x")
23630 (ss_truncate:V4HI (match_operand:V4SI 1 "register_operand" "0"))
23631 (ss_truncate:V4HI (match_operand:V4SI 2 "register_operand" "x"))))]
23633 "packssdw\t{%2, %0|%0, %2}"
23634 [(set_attr "type" "ssecvt")
23635 (set_attr "mode" "TI")])
23637 (define_insn "sse2_packuswb"
23638 [(set (match_operand:V16QI 0 "register_operand" "=x")
23640 (us_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
23641 (us_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
23643 "packuswb\t{%2, %0|%0, %2}"
23644 [(set_attr "type" "ssecvt")
23645 (set_attr "mode" "TI")])
23647 (define_insn "sse2_punpckhbw"
23648 [(set (match_operand:V16QI 0 "register_operand" "=x")
23650 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
23651 (parallel [(const_int 8) (const_int 0)
23652 (const_int 9) (const_int 1)
23653 (const_int 10) (const_int 2)
23654 (const_int 11) (const_int 3)
23655 (const_int 12) (const_int 4)
23656 (const_int 13) (const_int 5)
23657 (const_int 14) (const_int 6)
23658 (const_int 15) (const_int 7)]))
23659 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
23660 (parallel [(const_int 0) (const_int 8)
23661 (const_int 1) (const_int 9)
23662 (const_int 2) (const_int 10)
23663 (const_int 3) (const_int 11)
23664 (const_int 4) (const_int 12)
23665 (const_int 5) (const_int 13)
23666 (const_int 6) (const_int 14)
23667 (const_int 7) (const_int 15)]))
23668 (const_int 21845)))]
23670 "punpckhbw\t{%2, %0|%0, %2}"
23671 [(set_attr "type" "ssecvt")
23672 (set_attr "mode" "TI")])
23674 (define_insn "sse2_punpckhwd"
23675 [(set (match_operand:V8HI 0 "register_operand" "=x")
23677 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
23678 (parallel [(const_int 4) (const_int 0)
23679 (const_int 5) (const_int 1)
23680 (const_int 6) (const_int 2)
23681 (const_int 7) (const_int 3)]))
23682 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
23683 (parallel [(const_int 0) (const_int 4)
23684 (const_int 1) (const_int 5)
23685 (const_int 2) (const_int 6)
23686 (const_int 3) (const_int 7)]))
23689 "punpckhwd\t{%2, %0|%0, %2}"
23690 [(set_attr "type" "ssecvt")
23691 (set_attr "mode" "TI")])
23693 (define_insn "sse2_punpckhdq"
23694 [(set (match_operand:V4SI 0 "register_operand" "=x")
23696 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
23697 (parallel [(const_int 2) (const_int 0)
23698 (const_int 3) (const_int 1)]))
23699 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
23700 (parallel [(const_int 0) (const_int 2)
23701 (const_int 1) (const_int 3)]))
23704 "punpckhdq\t{%2, %0|%0, %2}"
23705 [(set_attr "type" "ssecvt")
23706 (set_attr "mode" "TI")])
23708 (define_insn "sse2_punpcklbw"
23709 [(set (match_operand:V16QI 0 "register_operand" "=x")
23711 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
23712 (parallel [(const_int 0) (const_int 8)
23713 (const_int 1) (const_int 9)
23714 (const_int 2) (const_int 10)
23715 (const_int 3) (const_int 11)
23716 (const_int 4) (const_int 12)
23717 (const_int 5) (const_int 13)
23718 (const_int 6) (const_int 14)
23719 (const_int 7) (const_int 15)]))
23720 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
23721 (parallel [(const_int 8) (const_int 0)
23722 (const_int 9) (const_int 1)
23723 (const_int 10) (const_int 2)
23724 (const_int 11) (const_int 3)
23725 (const_int 12) (const_int 4)
23726 (const_int 13) (const_int 5)
23727 (const_int 14) (const_int 6)
23728 (const_int 15) (const_int 7)]))
23729 (const_int 21845)))]
23731 "punpcklbw\t{%2, %0|%0, %2}"
23732 [(set_attr "type" "ssecvt")
23733 (set_attr "mode" "TI")])
23735 (define_insn "sse2_punpcklwd"
23736 [(set (match_operand:V8HI 0 "register_operand" "=x")
23738 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
23739 (parallel [(const_int 0) (const_int 4)
23740 (const_int 1) (const_int 5)
23741 (const_int 2) (const_int 6)
23742 (const_int 3) (const_int 7)]))
23743 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
23744 (parallel [(const_int 4) (const_int 0)
23745 (const_int 5) (const_int 1)
23746 (const_int 6) (const_int 2)
23747 (const_int 7) (const_int 3)]))
23750 "punpcklwd\t{%2, %0|%0, %2}"
23751 [(set_attr "type" "ssecvt")
23752 (set_attr "mode" "TI")])
23754 (define_insn "sse2_punpckldq"
23755 [(set (match_operand:V4SI 0 "register_operand" "=x")
23757 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
23758 (parallel [(const_int 0) (const_int 2)
23759 (const_int 1) (const_int 3)]))
23760 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
23761 (parallel [(const_int 2) (const_int 0)
23762 (const_int 3) (const_int 1)]))
23765 "punpckldq\t{%2, %0|%0, %2}"
23766 [(set_attr "type" "ssecvt")
23767 (set_attr "mode" "TI")])
23769 (define_insn "sse2_punpcklqdq"
23770 [(set (match_operand:V2DI 0 "register_operand" "=x")
23772 (vec_select:V2DI (match_operand:V2DI 2 "register_operand" "x")
23773 (parallel [(const_int 1)
23775 (match_operand:V2DI 1 "register_operand" "0")
23778 "punpcklqdq\t{%2, %0|%0, %2}"
23779 [(set_attr "type" "ssecvt")
23780 (set_attr "mode" "TI")])
23782 (define_insn "sse2_punpckhqdq"
23783 [(set (match_operand:V2DI 0 "register_operand" "=x")
23785 (match_operand:V2DI 1 "register_operand" "0")
23786 (vec_select:V2DI (match_operand:V2DI 2 "register_operand" "x")
23787 (parallel [(const_int 1)
23791 "punpckhqdq\t{%2, %0|%0, %2}"
23792 [(set_attr "type" "ssecvt")
23793 (set_attr "mode" "TI")])
23797 (define_insn "sse2_movapd"
23798 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
23799 (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
23802 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23803 "movapd\t{%1, %0|%0, %1}"
23804 [(set_attr "type" "ssemov")
23805 (set_attr "mode" "V2DF")])
23807 (define_insn "sse2_movupd"
23808 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
23809 (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
23812 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23813 "movupd\t{%1, %0|%0, %1}"
23814 [(set_attr "type" "ssecvt")
23815 (set_attr "mode" "V2DF")])
23817 (define_insn "sse2_movdqa"
23818 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
23819 (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
23822 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23823 "movdqa\t{%1, %0|%0, %1}"
23824 [(set_attr "type" "ssemov")
23825 (set_attr "mode" "TI")])
23827 (define_insn "sse2_movdqu"
23828 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
23829 (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
23832 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
23833 "movdqu\t{%1, %0|%0, %1}"
23834 [(set_attr "type" "ssecvt")
23835 (set_attr "mode" "TI")])
23837 (define_insn "sse2_movdq2q"
23838 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,y")
23839 (vec_select:DI (match_operand:V2DI 1 "register_operand" "x,x")
23840 (parallel [(const_int 0)])))]
23841 "TARGET_SSE2 && !TARGET_64BIT"
23843 movq\t{%1, %0|%0, %1}
23844 movdq2q\t{%1, %0|%0, %1}"
23845 [(set_attr "type" "ssecvt")
23846 (set_attr "mode" "TI")])
23848 (define_insn "sse2_movdq2q_rex64"
23849 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,y,r")
23850 (vec_select:DI (match_operand:V2DI 1 "register_operand" "x,x,x")
23851 (parallel [(const_int 0)])))]
23852 "TARGET_SSE2 && TARGET_64BIT"
23854 movq\t{%1, %0|%0, %1}
23855 movdq2q\t{%1, %0|%0, %1}
23856 movd\t{%1, %0|%0, %1}"
23857 [(set_attr "type" "ssecvt")
23858 (set_attr "mode" "TI")])
23860 (define_insn "sse2_movq2dq"
23861 [(set (match_operand:V2DI 0 "register_operand" "=x,?x")
23862 (vec_concat:V2DI (match_operand:DI 1 "nonimmediate_operand" "m,y")
23864 "TARGET_SSE2 && !TARGET_64BIT"
23866 movq\t{%1, %0|%0, %1}
23867 movq2dq\t{%1, %0|%0, %1}"
23868 [(set_attr "type" "ssecvt,ssemov")
23869 (set_attr "mode" "TI")])
23871 (define_insn "sse2_movq2dq_rex64"
23872 [(set (match_operand:V2DI 0 "register_operand" "=x,?x,?x")
23873 (vec_concat:V2DI (match_operand:DI 1 "nonimmediate_operand" "m,y,r")
23875 "TARGET_SSE2 && TARGET_64BIT"
23877 movq\t{%1, %0|%0, %1}
23878 movq2dq\t{%1, %0|%0, %1}
23879 movd\t{%1, %0|%0, %1}"
23880 [(set_attr "type" "ssecvt,ssemov,ssecvt")
23881 (set_attr "mode" "TI")])
23883 (define_insn "sse2_movq"
23884 [(set (match_operand:V2DI 0 "register_operand" "=x")
23885 (vec_concat:V2DI (vec_select:DI
23886 (match_operand:V2DI 1 "nonimmediate_operand" "xm")
23887 (parallel [(const_int 0)]))
23890 "movq\t{%1, %0|%0, %1}"
23891 [(set_attr "type" "ssemov")
23892 (set_attr "mode" "TI")])
23894 (define_insn "sse2_loadd"
23895 [(set (match_operand:V4SI 0 "register_operand" "=x")
23897 (vec_duplicate:V4SI (match_operand:SI 1 "nonimmediate_operand" "mr"))
23898 (const_vector:V4SI [(const_int 0)
23904 "movd\t{%1, %0|%0, %1}"
23905 [(set_attr "type" "ssemov")
23906 (set_attr "mode" "TI")])
23908 (define_insn "sse2_stored"
23909 [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
23911 (match_operand:V4SI 1 "register_operand" "x")
23912 (parallel [(const_int 0)])))]
23914 "movd\t{%1, %0|%0, %1}"
23915 [(set_attr "type" "ssemov")
23916 (set_attr "mode" "TI")])
23918 ;; Store the high double of the source vector into the double destination.
23919 (define_insn "sse2_storehpd"
23920 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,Y,Y")
23922 (match_operand:V2DF 1 "nonimmediate_operand" " Y,0,o")
23923 (parallel [(const_int 1)])))]
23926 movhpd\t{%1, %0|%0, %1}
23929 [(set_attr "type" "ssecvt")
23930 (set_attr "mode" "V2DF")])
23933 [(set (match_operand:DF 0 "register_operand" "")
23935 (match_operand:V2DF 1 "memory_operand" "")
23936 (parallel [(const_int 1)])))]
23937 "TARGET_SSE2 && reload_completed"
23940 emit_move_insn (operands[0], adjust_address (operands[1], DFmode, 8));
23944 ;; Load the high double of the target vector from the source scalar.
23945 (define_insn "sse2_loadhpd"
23946 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=Y,Y,o")
23949 (match_operand:V2DF 1 "nonimmediate_operand" " 0,0,0")
23950 (parallel [(const_int 0)]))
23951 (match_operand:DF 2 "nonimmediate_operand" " m,Y,Y")))]
23954 movhpd\t{%2, %0|%0, %2}
23955 unpcklpd\t{%2, %0|%0, %2}
23957 [(set_attr "type" "ssecvt")
23958 (set_attr "mode" "V2DF")])
23961 [(set (match_operand:V2DF 0 "memory_operand" "")
23963 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
23964 (match_operand:DF 1 "register_operand" "")))]
23965 "TARGET_SSE2 && reload_completed"
23968 emit_move_insn (adjust_address (operands[0], DFmode, 8), operands[1]);
23972 ;; Store the low double of the source vector into the double destination.
23973 (define_expand "sse2_storelpd"
23974 [(set (match_operand:DF 0 "nonimmediate_operand" "")
23976 (match_operand:V2DF 1 "nonimmediate_operand" "")
23977 (parallel [(const_int 0)])))]
23980 operands[1] = gen_lowpart (DFmode, operands[1]);
23981 emit_move_insn (operands[0], operands[1]);
23985 ;; Load the low double of the target vector from the source scalar.
23986 (define_insn "sse2_loadlpd"
23987 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=Y,Y,m")
23989 (match_operand:DF 2 "nonimmediate_operand" " m,Y,Y")
23991 (match_operand:V2DF 1 "nonimmediate_operand" " 0,0,0")
23992 (parallel [(const_int 1)]))))]
23995 movlpd\t{%2, %0|%0, %2}
23996 movsd\t{%2, %0|%0, %2}
23997 movlpd\t{%2, %0|%0, %2}"
23998 [(set_attr "type" "ssecvt")
23999 (set_attr "mode" "V2DF")])
24001 ;; Merge the low part of the source vector into the low part of the target.
24002 (define_insn "sse2_movsd"
24003 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=Y,Y,m")
24005 (match_operand:V2DF 1 "nonimmediate_operand" "0,0,0")
24006 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,Y")
24009 "@movsd\t{%2, %0|%0, %2}
24010 movlpd\t{%2, %0|%0, %2}
24011 movlpd\t{%2, %0|%0, %2}"
24012 [(set_attr "type" "ssecvt")
24013 (set_attr "mode" "DF,V2DF,V2DF")])
24015 (define_expand "sse2_loadsd"
24016 [(match_operand:V2DF 0 "register_operand" "")
24017 (match_operand:DF 1 "memory_operand" "")]
24020 emit_insn (gen_sse2_loadsd_1 (operands[0], operands[1],
24021 CONST0_RTX (V2DFmode)));
24025 (define_insn "sse2_loadsd_1"
24026 [(set (match_operand:V2DF 0 "register_operand" "=x")
24028 (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m"))
24029 (match_operand:V2DF 2 "const0_operand" "X")
24032 "movsd\t{%1, %0|%0, %1}"
24033 [(set_attr "type" "ssecvt")
24034 (set_attr "mode" "DF")])
24036 (define_insn "sse2_storesd"
24037 [(set (match_operand:DF 0 "memory_operand" "=m")
24039 (match_operand:V2DF 1 "register_operand" "x")
24040 (parallel [(const_int 0)])))]
24042 "movsd\t{%1, %0|%0, %1}"
24043 [(set_attr "type" "ssecvt")
24044 (set_attr "mode" "DF")])
24046 (define_insn "sse2_shufpd"
24047 [(set (match_operand:V2DF 0 "register_operand" "=x")
24048 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24049 (match_operand:V2DF 2 "nonimmediate_operand" "xm")
24050 (match_operand:SI 3 "immediate_operand" "i")]
24053 ;; @@@ check operand order for intel/nonintel syntax
24054 "shufpd\t{%3, %2, %0|%0, %2, %3}"
24055 [(set_attr "type" "ssecvt")
24056 (set_attr "mode" "V2DF")])
24058 (define_insn "sse2_clflush"
24059 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
24063 [(set_attr "type" "sse")
24064 (set_attr "memory" "unknown")])
24066 (define_expand "sse2_mfence"
24067 [(set (match_dup 0)
24068 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
24071 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
24072 MEM_VOLATILE_P (operands[0]) = 1;
24075 (define_insn "*mfence_insn"
24076 [(set (match_operand:BLK 0 "" "")
24077 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
24080 [(set_attr "type" "sse")
24081 (set_attr "memory" "unknown")])
24083 (define_expand "sse2_lfence"
24084 [(set (match_dup 0)
24085 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
24088 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
24089 MEM_VOLATILE_P (operands[0]) = 1;
24092 (define_insn "*lfence_insn"
24093 [(set (match_operand:BLK 0 "" "")
24094 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
24097 [(set_attr "type" "sse")
24098 (set_attr "memory" "unknown")])
24102 (define_insn "mwait"
24103 [(unspec_volatile [(match_operand:SI 0 "register_operand" "a")
24104 (match_operand:SI 1 "register_operand" "c")]
24108 [(set_attr "length" "3")])
24110 (define_insn "monitor"
24111 [(unspec_volatile [(match_operand:SI 0 "register_operand" "a")
24112 (match_operand:SI 1 "register_operand" "c")
24113 (match_operand:SI 2 "register_operand" "d")]
24116 "monitor\t%0, %1, %2"
24117 [(set_attr "length" "3")])
24121 (define_insn "addsubv4sf3"
24122 [(set (match_operand:V4SF 0 "register_operand" "=x")
24123 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
24124 (match_operand:V4SF 2 "nonimmediate_operand" "xm")]
24127 "addsubps\t{%2, %0|%0, %2}"
24128 [(set_attr "type" "sseadd")
24129 (set_attr "mode" "V4SF")])
24131 (define_insn "addsubv2df3"
24132 [(set (match_operand:V2DF 0 "register_operand" "=x")
24133 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24134 (match_operand:V2DF 2 "nonimmediate_operand" "xm")]
24137 "addsubpd\t{%2, %0|%0, %2}"
24138 [(set_attr "type" "sseadd")
24139 (set_attr "mode" "V2DF")])
24141 (define_insn "haddv4sf3"
24142 [(set (match_operand:V4SF 0 "register_operand" "=x")
24143 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
24144 (match_operand:V4SF 2 "nonimmediate_operand" "xm")]
24147 "haddps\t{%2, %0|%0, %2}"
24148 [(set_attr "type" "sseadd")
24149 (set_attr "mode" "V4SF")])
24151 (define_insn "haddv2df3"
24152 [(set (match_operand:V2DF 0 "register_operand" "=x")
24153 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24154 (match_operand:V2DF 2 "nonimmediate_operand" "xm")]
24157 "haddpd\t{%2, %0|%0, %2}"
24158 [(set_attr "type" "sseadd")
24159 (set_attr "mode" "V2DF")])
24161 (define_insn "hsubv4sf3"
24162 [(set (match_operand:V4SF 0 "register_operand" "=x")
24163 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
24164 (match_operand:V4SF 2 "nonimmediate_operand" "xm")]
24167 "hsubps\t{%2, %0|%0, %2}"
24168 [(set_attr "type" "sseadd")
24169 (set_attr "mode" "V4SF")])
24171 (define_insn "hsubv2df3"
24172 [(set (match_operand:V2DF 0 "register_operand" "=x")
24173 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
24174 (match_operand:V2DF 2 "nonimmediate_operand" "xm")]
24177 "hsubpd\t{%2, %0|%0, %2}"
24178 [(set_attr "type" "sseadd")
24179 (set_attr "mode" "V2DF")])
24181 (define_insn "movshdup"
24182 [(set (match_operand:V4SF 0 "register_operand" "=x")
24184 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSHDUP))]
24186 "movshdup\t{%1, %0|%0, %1}"
24187 [(set_attr "type" "sse")
24188 (set_attr "mode" "V4SF")])
24190 (define_insn "movsldup"
24191 [(set (match_operand:V4SF 0 "register_operand" "=x")
24193 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSLDUP))]
24195 "movsldup\t{%1, %0|%0, %1}"
24196 [(set_attr "type" "sse")
24197 (set_attr "mode" "V4SF")])
24199 (define_insn "lddqu"
24200 [(set (match_operand:V16QI 0 "register_operand" "=x")
24201 (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "m")]
24204 "lddqu\t{%1, %0|%0, %1}"
24205 [(set_attr "type" "ssecvt")
24206 (set_attr "mode" "TI")])
24208 (define_insn "loadddup"
24209 [(set (match_operand:V2DF 0 "register_operand" "=x")
24210 (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m")))]
24212 "movddup\t{%1, %0|%0, %1}"
24213 [(set_attr "type" "ssecvt")
24214 (set_attr "mode" "DF")])
24216 (define_insn "movddup"
24217 [(set (match_operand:V2DF 0 "register_operand" "=x")
24218 (vec_duplicate:V2DF
24219 (vec_select:DF (match_operand:V2DF 1 "register_operand" "x")
24220 (parallel [(const_int 0)]))))]
24222 "movddup\t{%1, %0|%0, %1}"
24223 [(set_attr "type" "ssecvt")
24224 (set_attr "mode" "DF")])