1 ;; GCC machine description for IA-32 and x86-64.
2 ;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 ;; Free Software Foundation, Inc.
4 ;; Mostly by William Schelter.
5 ;; x86_64 support added by Jan Hubicka
7 ;; This file is part of GNU CC.
9 ;; GNU CC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU CC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU CC; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA. */
24 ;; The original PO technology requires these to be ordered by speed,
25 ;; so that assigner will pick the fastest.
27 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 ;; Macro #define NOTICE_UPDATE_CC in file i386.h handles condition code
30 ;; updates for most instructions.
32 ;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register
33 ;; constraint letters.
35 ;; The special asm out single letter directives following a '%' are:
36 ;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of
38 ;; 'L' Print the opcode suffix for a 32-bit integer opcode.
39 ;; 'W' Print the opcode suffix for a 16-bit integer opcode.
40 ;; 'B' Print the opcode suffix for an 8-bit integer opcode.
41 ;; 'Q' Print the opcode suffix for a 64-bit float opcode.
42 ;; 'S' Print the opcode suffix for a 32-bit float opcode.
43 ;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode.
44 ;; 'J' Print the appropriate jump operand.
46 ;; 'b' Print the QImode name of the register for the indicated operand.
47 ;; %b0 would print %al if operands[0] is reg 0.
48 ;; 'w' Likewise, print the HImode name of the register.
49 ;; 'k' Likewise, print the SImode name of the register.
50 ;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.
51 ;; 'y' Print "st(0)" instead of "st" as a register.
56 [; Relocation specifiers
66 (UNSPEC_STACK_PROBE 10)
67 (UNSPEC_STACK_ALLOC 11)
69 (UNSPEC_SSE_PROLOGUE_SAVE 13)
74 (UNSPEC_TLS_LD_BASE 17)
76 ; Other random patterns
87 ; For SSE/MMX support:
98 (UNSPEC_NOP 45) ; prevents combiner cleverness
113 [(UNSPECV_BLOCKAGE 0)
114 (UNSPECV_EH_RETURN 13)
122 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
125 ;; In C guard expressions, put expressions which may be compile-time
126 ;; constants first. This allows for better optimization. For
127 ;; example, write "TARGET_64BIT && reload_completed", not
128 ;; "reload_completed && TARGET_64BIT".
131 ;; Processor type. This attribute must exactly match the processor_type
132 ;; enumeration in i386.h.
133 (define_attr "cpu" "i386,i486,pentium,pentiumpro,k6,athlon,pentium4"
134 (const (symbol_ref "ix86_cpu")))
136 ;; A basic instruction type. Refinements due to arguments to be
137 ;; provided in other attributes.
140 alu,alu1,negnot,imov,imovx,lea,
141 incdec,ishift,rotate,imul,idiv,
142 icmp,test,ibr,setcc,icmov,
145 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,
146 sselog,sseiadd,sseishft,sseimul,
147 sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv,
148 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
149 (const_string "other"))
151 ;; Main data type used by the insn
153 "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF"
154 (const_string "unknown"))
156 ;; The CPU unit operations uses.
157 (define_attr "unit" "integer,i387,sse,mmx,unknown"
158 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
159 (const_string "i387")
160 (eq_attr "type" "sselog,sseiadd,sseishft,sseimul,
161 sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv")
163 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
164 (const_string "mmx")]
165 (const_string "integer")))
167 ;; The (bounding maximum) length of an instruction immediate.
168 (define_attr "length_immediate" ""
169 (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv")
171 (eq_attr "unit" "i387,sse,mmx")
173 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,imul,
175 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
176 (eq_attr "type" "imov,test")
177 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
178 (eq_attr "type" "call")
179 (if_then_else (match_operand 0 "constant_call_address_operand" "")
182 (eq_attr "type" "callv")
183 (if_then_else (match_operand 1 "constant_call_address_operand" "")
186 (eq_attr "type" "ibr")
187 (if_then_else (and (ge (minus (match_dup 0) (pc))
189 (lt (minus (match_dup 0) (pc))
194 (symbol_ref "/* Update immediate_length and other attributes! */
197 ;; The (bounding maximum) length of an instruction address.
198 (define_attr "length_address" ""
199 (cond [(eq_attr "type" "str,cld,other,multi,fxch")
201 (and (eq_attr "type" "call")
202 (match_operand 0 "constant_call_address_operand" ""))
204 (and (eq_attr "type" "callv")
205 (match_operand 1 "constant_call_address_operand" ""))
208 (symbol_ref "ix86_attr_length_address_default (insn)")))
210 ;; Set when length prefix is used.
211 (define_attr "prefix_data16" ""
212 (if_then_else (ior (eq_attr "mode" "HI")
213 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))
217 ;; Set when string REP prefix is used.
218 (define_attr "prefix_rep" ""
219 (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
223 ;; Set when 0f opcode prefix is used.
224 (define_attr "prefix_0f" ""
228 sselog,sseiadd,sseishft,sseimul,
229 sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv,
230 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
234 ;; Set when modrm byte is used.
235 (define_attr "modrm" ""
236 (cond [(eq_attr "type" "str,cld")
238 (eq_attr "unit" "i387")
240 (and (eq_attr "type" "incdec")
241 (ior (match_operand:SI 1 "register_operand" "")
242 (match_operand:HI 1 "register_operand" "")))
244 (and (eq_attr "type" "push")
245 (not (match_operand 1 "memory_operand" "")))
247 (and (eq_attr "type" "pop")
248 (not (match_operand 0 "memory_operand" "")))
250 (and (eq_attr "type" "imov")
251 (and (match_operand 0 "register_operand" "")
252 (match_operand 1 "immediate_operand" "")))
254 (and (eq_attr "type" "call")
255 (match_operand 0 "constant_call_address_operand" ""))
257 (and (eq_attr "type" "callv")
258 (match_operand 1 "constant_call_address_operand" ""))
263 ;; The (bounding maximum) length of an instruction in bytes.
264 ;; ??? fistp is in fact fldcw/fistp/fldcw sequence. Later we may want
265 ;; to split it and compute proper length as for other insns.
266 (define_attr "length" ""
267 (cond [(eq_attr "type" "other,multi,fistp")
269 (eq_attr "unit" "i387")
271 (plus (attr "prefix_data16")
272 (attr "length_address")))]
273 (plus (plus (attr "modrm")
274 (plus (attr "prefix_0f")
276 (plus (attr "prefix_rep")
277 (plus (attr "prefix_data16")
278 (plus (attr "length_immediate")
279 (attr "length_address")))))))
281 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
282 ;; `store' if there is a simple memory reference therein, or `unknown'
283 ;; if the instruction is complex.
285 (define_attr "memory" "none,load,store,both,unknown"
286 (cond [(eq_attr "type" "other,multi,str")
287 (const_string "unknown")
288 (eq_attr "type" "lea,fcmov,fpspc,cld")
289 (const_string "none")
290 (eq_attr "type" "fistp")
291 (const_string "both")
292 (eq_attr "type" "push")
293 (if_then_else (match_operand 1 "memory_operand" "")
294 (const_string "both")
295 (const_string "store"))
296 (eq_attr "type" "pop,setcc")
297 (if_then_else (match_operand 0 "memory_operand" "")
298 (const_string "both")
299 (const_string "load"))
300 (eq_attr "type" "icmp,test,ssecmp,mmxcmp,fcmp")
301 (if_then_else (ior (match_operand 0 "memory_operand" "")
302 (match_operand 1 "memory_operand" ""))
303 (const_string "load")
304 (const_string "none"))
305 (eq_attr "type" "ibr")
306 (if_then_else (match_operand 0 "memory_operand" "")
307 (const_string "load")
308 (const_string "none"))
309 (eq_attr "type" "call")
310 (if_then_else (match_operand 0 "constant_call_address_operand" "")
311 (const_string "none")
312 (const_string "load"))
313 (eq_attr "type" "callv")
314 (if_then_else (match_operand 1 "constant_call_address_operand" "")
315 (const_string "none")
316 (const_string "load"))
317 (and (eq_attr "type" "alu1,negnot")
318 (match_operand 1 "memory_operand" ""))
319 (const_string "both")
320 (and (match_operand 0 "memory_operand" "")
321 (match_operand 1 "memory_operand" ""))
322 (const_string "both")
323 (match_operand 0 "memory_operand" "")
324 (const_string "store")
325 (match_operand 1 "memory_operand" "")
326 (const_string "load")
329 imov,imovx,icmp,test,
331 sse,ssemov,ssecmp,ssecvt,
332 mmx,mmxmov,mmxcmp,mmxcvt")
333 (match_operand 2 "memory_operand" ""))
334 (const_string "load")
335 (and (eq_attr "type" "icmov")
336 (match_operand 3 "memory_operand" ""))
337 (const_string "load")
339 (const_string "none")))
341 ;; Indicates if an instruction has both an immediate and a displacement.
343 (define_attr "imm_disp" "false,true,unknown"
344 (cond [(eq_attr "type" "other,multi")
345 (const_string "unknown")
346 (and (eq_attr "type" "icmp,test,imov")
347 (and (match_operand 0 "memory_displacement_operand" "")
348 (match_operand 1 "immediate_operand" "")))
349 (const_string "true")
350 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
351 (and (match_operand 0 "memory_displacement_operand" "")
352 (match_operand 2 "immediate_operand" "")))
353 (const_string "true")
355 (const_string "false")))
357 ;; Indicates if an FP operation has an integer source.
359 (define_attr "fp_int_src" "false,true"
360 (const_string "false"))
362 ;; Describe a user's asm statement.
363 (define_asm_attributes
364 [(set_attr "length" "128")
365 (set_attr "type" "multi")])
367 (include "pentium.md")
370 (include "athlon.md")
372 ;; Compare instructions.
374 ;; All compare insns have expanders that save the operands away without
375 ;; actually generating RTL. The bCOND or sCOND (emitted immediately
376 ;; after the cmp) will actually emit the cmpM.
378 (define_expand "cmpdi"
380 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
381 (match_operand:DI 1 "x86_64_general_operand" "")))]
384 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
385 operands[0] = force_reg (DImode, operands[0]);
386 ix86_compare_op0 = operands[0];
387 ix86_compare_op1 = operands[1];
391 (define_expand "cmpsi"
393 (compare:CC (match_operand:SI 0 "cmpsi_operand" "")
394 (match_operand:SI 1 "general_operand" "")))]
397 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
398 operands[0] = force_reg (SImode, operands[0]);
399 ix86_compare_op0 = operands[0];
400 ix86_compare_op1 = operands[1];
404 (define_expand "cmphi"
406 (compare:CC (match_operand:HI 0 "nonimmediate_operand" "")
407 (match_operand:HI 1 "general_operand" "")))]
410 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
411 operands[0] = force_reg (HImode, operands[0]);
412 ix86_compare_op0 = operands[0];
413 ix86_compare_op1 = operands[1];
417 (define_expand "cmpqi"
419 (compare:CC (match_operand:QI 0 "nonimmediate_operand" "")
420 (match_operand:QI 1 "general_operand" "")))]
423 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
424 operands[0] = force_reg (QImode, operands[0]);
425 ix86_compare_op0 = operands[0];
426 ix86_compare_op1 = operands[1];
430 (define_insn "cmpdi_ccno_1_rex64"
432 (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr")
433 (match_operand:DI 1 "const0_operand" "n,n")))]
434 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
436 test{q}\t{%0, %0|%0, %0}
437 cmp{q}\t{%1, %0|%0, %1}"
438 [(set_attr "type" "test,icmp")
439 (set_attr "length_immediate" "0,1")
440 (set_attr "mode" "DI")])
442 (define_insn "*cmpdi_minus_1_rex64"
444 (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r")
445 (match_operand:DI 1 "x86_64_general_operand" "re,mr"))
447 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)"
448 "cmp{q}\t{%1, %0|%0, %1}"
449 [(set_attr "type" "icmp")
450 (set_attr "mode" "DI")])
452 (define_expand "cmpdi_1_rex64"
454 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
455 (match_operand:DI 1 "general_operand" "")))]
459 (define_insn "cmpdi_1_insn_rex64"
461 (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r")
462 (match_operand:DI 1 "x86_64_general_operand" "re,mr")))]
463 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
464 "cmp{q}\t{%1, %0|%0, %1}"
465 [(set_attr "type" "icmp")
466 (set_attr "mode" "DI")])
469 (define_insn "*cmpsi_ccno_1"
471 (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr")
472 (match_operand:SI 1 "const0_operand" "n,n")))]
473 "ix86_match_ccmode (insn, CCNOmode)"
475 test{l}\t{%0, %0|%0, %0}
476 cmp{l}\t{%1, %0|%0, %1}"
477 [(set_attr "type" "test,icmp")
478 (set_attr "length_immediate" "0,1")
479 (set_attr "mode" "SI")])
481 (define_insn "*cmpsi_minus_1"
483 (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r")
484 (match_operand:SI 1 "general_operand" "ri,mr"))
486 "ix86_match_ccmode (insn, CCGOCmode)"
487 "cmp{l}\t{%1, %0|%0, %1}"
488 [(set_attr "type" "icmp")
489 (set_attr "mode" "SI")])
491 (define_expand "cmpsi_1"
493 (compare:CC (match_operand:SI 0 "nonimmediate_operand" "rm,r")
494 (match_operand:SI 1 "general_operand" "ri,mr")))]
498 (define_insn "*cmpsi_1_insn"
500 (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r")
501 (match_operand:SI 1 "general_operand" "ri,mr")))]
502 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
503 && ix86_match_ccmode (insn, CCmode)"
504 "cmp{l}\t{%1, %0|%0, %1}"
505 [(set_attr "type" "icmp")
506 (set_attr "mode" "SI")])
508 (define_insn "*cmphi_ccno_1"
510 (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr")
511 (match_operand:HI 1 "const0_operand" "n,n")))]
512 "ix86_match_ccmode (insn, CCNOmode)"
514 test{w}\t{%0, %0|%0, %0}
515 cmp{w}\t{%1, %0|%0, %1}"
516 [(set_attr "type" "test,icmp")
517 (set_attr "length_immediate" "0,1")
518 (set_attr "mode" "HI")])
520 (define_insn "*cmphi_minus_1"
522 (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r")
523 (match_operand:HI 1 "general_operand" "ri,mr"))
525 "ix86_match_ccmode (insn, CCGOCmode)"
526 "cmp{w}\t{%1, %0|%0, %1}"
527 [(set_attr "type" "icmp")
528 (set_attr "mode" "HI")])
530 (define_insn "*cmphi_1"
532 (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r")
533 (match_operand:HI 1 "general_operand" "ri,mr")))]
534 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
535 && ix86_match_ccmode (insn, CCmode)"
536 "cmp{w}\t{%1, %0|%0, %1}"
537 [(set_attr "type" "icmp")
538 (set_attr "mode" "HI")])
540 (define_insn "*cmpqi_ccno_1"
542 (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq")
543 (match_operand:QI 1 "const0_operand" "n,n")))]
544 "ix86_match_ccmode (insn, CCNOmode)"
546 test{b}\t{%0, %0|%0, %0}
547 cmp{b}\t{$0, %0|%0, 0}"
548 [(set_attr "type" "test,icmp")
549 (set_attr "length_immediate" "0,1")
550 (set_attr "mode" "QI")])
552 (define_insn "*cmpqi_1"
554 (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q")
555 (match_operand:QI 1 "general_operand" "qi,mq")))]
556 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
557 && ix86_match_ccmode (insn, CCmode)"
558 "cmp{b}\t{%1, %0|%0, %1}"
559 [(set_attr "type" "icmp")
560 (set_attr "mode" "QI")])
562 (define_insn "*cmpqi_minus_1"
564 (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q")
565 (match_operand:QI 1 "general_operand" "qi,mq"))
567 "ix86_match_ccmode (insn, CCGOCmode)"
568 "cmp{b}\t{%1, %0|%0, %1}"
569 [(set_attr "type" "icmp")
570 (set_attr "mode" "QI")])
572 (define_insn "*cmpqi_ext_1"
575 (match_operand:QI 0 "general_operand" "Qm")
578 (match_operand 1 "ext_register_operand" "Q")
581 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
582 "cmp{b}\t{%h1, %0|%0, %h1}"
583 [(set_attr "type" "icmp")
584 (set_attr "mode" "QI")])
586 (define_insn "*cmpqi_ext_1_rex64"
589 (match_operand:QI 0 "register_operand" "Q")
592 (match_operand 1 "ext_register_operand" "Q")
595 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
596 "cmp{b}\t{%h1, %0|%0, %h1}"
597 [(set_attr "type" "icmp")
598 (set_attr "mode" "QI")])
600 (define_insn "*cmpqi_ext_2"
605 (match_operand 0 "ext_register_operand" "Q")
608 (match_operand:QI 1 "const0_operand" "n")))]
609 "ix86_match_ccmode (insn, CCNOmode)"
611 [(set_attr "type" "test")
612 (set_attr "length_immediate" "0")
613 (set_attr "mode" "QI")])
615 (define_expand "cmpqi_ext_3"
620 (match_operand 0 "ext_register_operand" "")
623 (match_operand:QI 1 "general_operand" "")))]
627 (define_insn "cmpqi_ext_3_insn"
632 (match_operand 0 "ext_register_operand" "Q")
635 (match_operand:QI 1 "general_operand" "Qmn")))]
636 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
637 "cmp{b}\t{%1, %h0|%h0, %1}"
638 [(set_attr "type" "icmp")
639 (set_attr "mode" "QI")])
641 (define_insn "cmpqi_ext_3_insn_rex64"
646 (match_operand 0 "ext_register_operand" "Q")
649 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
650 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
651 "cmp{b}\t{%1, %h0|%h0, %1}"
652 [(set_attr "type" "icmp")
653 (set_attr "mode" "QI")])
655 (define_insn "*cmpqi_ext_4"
660 (match_operand 0 "ext_register_operand" "Q")
665 (match_operand 1 "ext_register_operand" "Q")
668 "ix86_match_ccmode (insn, CCmode)"
669 "cmp{b}\t{%h1, %h0|%h0, %h1}"
670 [(set_attr "type" "icmp")
671 (set_attr "mode" "QI")])
673 ;; These implement float point compares.
674 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
675 ;; which would allow mix and match FP modes on the compares. Which is what
676 ;; the old patterns did, but with many more of them.
678 (define_expand "cmpxf"
680 (compare:CC (match_operand:XF 0 "cmp_fp_expander_operand" "")
681 (match_operand:XF 1 "cmp_fp_expander_operand" "")))]
682 "!TARGET_64BIT && TARGET_80387"
684 ix86_compare_op0 = operands[0];
685 ix86_compare_op1 = operands[1];
689 (define_expand "cmptf"
691 (compare:CC (match_operand:TF 0 "cmp_fp_expander_operand" "")
692 (match_operand:TF 1 "cmp_fp_expander_operand" "")))]
695 ix86_compare_op0 = operands[0];
696 ix86_compare_op1 = operands[1];
700 (define_expand "cmpdf"
702 (compare:CC (match_operand:DF 0 "cmp_fp_expander_operand" "")
703 (match_operand:DF 1 "cmp_fp_expander_operand" "")))]
704 "TARGET_80387 || TARGET_SSE2"
706 ix86_compare_op0 = operands[0];
707 ix86_compare_op1 = operands[1];
711 (define_expand "cmpsf"
713 (compare:CC (match_operand:SF 0 "cmp_fp_expander_operand" "")
714 (match_operand:SF 1 "cmp_fp_expander_operand" "")))]
715 "TARGET_80387 || TARGET_SSE"
717 ix86_compare_op0 = operands[0];
718 ix86_compare_op1 = operands[1];
722 ;; FP compares, step 1:
723 ;; Set the FP condition codes.
725 ;; CCFPmode compare with exceptions
726 ;; CCFPUmode compare with no exceptions
728 ;; %%% It is an unfortunate fact that ftst has no non-popping variant,
729 ;; and that fp moves clobber the condition codes, and that there is
730 ;; currently no way to describe this fact to reg-stack. So there are
731 ;; no splitters yet for this.
733 ;; %%% YIKES! This scheme does not retain a strong connection between
734 ;; the real compare and the ultimate cc0 user, so CC_REVERSE does not
735 ;; work! Only allow tos/mem with tos in op 0.
737 ;; Hmm, of course, this is what the actual _hardware_ does. Perhaps
738 ;; things aren't as bad as they sound...
740 (define_insn "*cmpfp_0"
741 [(set (match_operand:HI 0 "register_operand" "=a")
743 [(compare:CCFP (match_operand 1 "register_operand" "f")
744 (match_operand 2 "const0_operand" "X"))]
747 && FLOAT_MODE_P (GET_MODE (operands[1]))
748 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
750 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
751 return "ftst\;fnstsw\t%0\;fstp\t%y0";
753 return "ftst\;fnstsw\t%0";
755 [(set_attr "type" "multi")
756 (set_attr "mode" "unknownfp")])
758 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
759 ;; used to manage the reg stack popping would not be preserved.
761 (define_insn "*cmpfp_2_sf"
764 (match_operand:SF 0 "register_operand" "f")
765 (match_operand:SF 1 "nonimmediate_operand" "fm")))]
767 "* return output_fp_compare (insn, operands, 0, 0);"
768 [(set_attr "type" "fcmp")
769 (set_attr "mode" "SF")])
771 (define_insn "*cmpfp_2_sf_1"
772 [(set (match_operand:HI 0 "register_operand" "=a")
775 (match_operand:SF 1 "register_operand" "f")
776 (match_operand:SF 2 "nonimmediate_operand" "fm"))]
779 "* return output_fp_compare (insn, operands, 2, 0);"
780 [(set_attr "type" "fcmp")
781 (set_attr "mode" "SF")])
783 (define_insn "*cmpfp_2_df"
786 (match_operand:DF 0 "register_operand" "f")
787 (match_operand:DF 1 "nonimmediate_operand" "fm")))]
789 "* return output_fp_compare (insn, operands, 0, 0);"
790 [(set_attr "type" "fcmp")
791 (set_attr "mode" "DF")])
793 (define_insn "*cmpfp_2_df_1"
794 [(set (match_operand:HI 0 "register_operand" "=a")
797 (match_operand:DF 1 "register_operand" "f")
798 (match_operand:DF 2 "nonimmediate_operand" "fm"))]
801 "* return output_fp_compare (insn, operands, 2, 0);"
802 [(set_attr "type" "multi")
803 (set_attr "mode" "DF")])
805 (define_insn "*cmpfp_2_xf"
808 (match_operand:XF 0 "register_operand" "f")
809 (match_operand:XF 1 "register_operand" "f")))]
810 "!TARGET_64BIT && TARGET_80387"
811 "* return output_fp_compare (insn, operands, 0, 0);"
812 [(set_attr "type" "fcmp")
813 (set_attr "mode" "XF")])
815 (define_insn "*cmpfp_2_tf"
818 (match_operand:TF 0 "register_operand" "f")
819 (match_operand:TF 1 "register_operand" "f")))]
821 "* return output_fp_compare (insn, operands, 0, 0);"
822 [(set_attr "type" "fcmp")
823 (set_attr "mode" "XF")])
825 (define_insn "*cmpfp_2_xf_1"
826 [(set (match_operand:HI 0 "register_operand" "=a")
829 (match_operand:XF 1 "register_operand" "f")
830 (match_operand:XF 2 "register_operand" "f"))]
832 "!TARGET_64BIT && TARGET_80387"
833 "* return output_fp_compare (insn, operands, 2, 0);"
834 [(set_attr "type" "multi")
835 (set_attr "mode" "XF")])
837 (define_insn "*cmpfp_2_tf_1"
838 [(set (match_operand:HI 0 "register_operand" "=a")
841 (match_operand:TF 1 "register_operand" "f")
842 (match_operand:TF 2 "register_operand" "f"))]
845 "* return output_fp_compare (insn, operands, 2, 0);"
846 [(set_attr "type" "multi")
847 (set_attr "mode" "XF")])
849 (define_insn "*cmpfp_2u"
852 (match_operand 0 "register_operand" "f")
853 (match_operand 1 "register_operand" "f")))]
855 && FLOAT_MODE_P (GET_MODE (operands[0]))
856 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
857 "* return output_fp_compare (insn, operands, 0, 1);"
858 [(set_attr "type" "fcmp")
859 (set_attr "mode" "unknownfp")])
861 (define_insn "*cmpfp_2u_1"
862 [(set (match_operand:HI 0 "register_operand" "=a")
865 (match_operand 1 "register_operand" "f")
866 (match_operand 2 "register_operand" "f"))]
869 && FLOAT_MODE_P (GET_MODE (operands[1]))
870 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
871 "* return output_fp_compare (insn, operands, 2, 1);"
872 [(set_attr "type" "multi")
873 (set_attr "mode" "unknownfp")])
875 ;; Patterns to match the SImode-in-memory ficom instructions.
877 ;; %%% Play games with accepting gp registers, as otherwise we have to
878 ;; force them to memory during rtl generation, which is no good. We
879 ;; can get rid of this once we teach reload to do memory input reloads
882 (define_insn "*ficom_1"
885 (match_operand 0 "register_operand" "f,f")
886 (float (match_operand:SI 1 "nonimmediate_operand" "m,?r"))))]
887 "0 && TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[0]))
888 && GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 1)) == GET_MODE (operands[0])"
891 ;; Split the not-really-implemented gp register case into a
892 ;; push-op-pop sequence.
894 ;; %%% This is most efficient, but am I gonna get in trouble
895 ;; for separating cc0_setter and cc0_user?
900 (match_operand:SF 0 "register_operand" "")
901 (float (match_operand:SI 1 "register_operand" ""))))]
902 "0 && TARGET_80387 && reload_completed"
903 [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 1))
904 (set (reg:CCFP 18) (compare:CCFP (match_dup 0) (match_dup 2)))
905 (parallel [(set (match_dup 1) (mem:SI (reg:SI 7)))
906 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
907 "operands[2] = gen_rtx_MEM (Pmode, stack_pointer_rtx);
908 operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);")
910 ;; FP compares, step 2
911 ;; Move the fpsw to ax.
913 (define_insn "x86_fnstsw_1"
914 [(set (match_operand:HI 0 "register_operand" "=a")
915 (unspec:HI [(reg 18)] UNSPEC_FNSTSW))]
918 [(set_attr "length" "2")
919 (set_attr "mode" "SI")
920 (set_attr "unit" "i387")
921 (set_attr "ppro_uops" "few")])
923 ;; FP compares, step 3
924 ;; Get ax into flags, general case.
926 (define_insn "x86_sahf_1"
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")
934 (set_attr "ppro_uops" "one")])
936 ;; Pentium Pro can do steps 1 through 3 in one go.
938 (define_insn "*cmpfp_i"
940 (compare:CCFP (match_operand 0 "register_operand" "f")
941 (match_operand 1 "register_operand" "f")))]
942 "TARGET_80387 && TARGET_CMOVE
943 && !SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
944 && FLOAT_MODE_P (GET_MODE (operands[0]))
945 && GET_MODE (operands[0]) == GET_MODE (operands[0])"
946 "* return output_fp_compare (insn, operands, 1, 0);"
947 [(set_attr "type" "fcmp")
948 (set_attr "mode" "unknownfp")
949 (set_attr "athlon_decode" "vector")])
951 (define_insn "*cmpfp_i_sse"
953 (compare:CCFP (match_operand 0 "register_operand" "f#x,x#f")
954 (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))]
956 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
957 && GET_MODE (operands[0]) == GET_MODE (operands[0])"
958 "* return output_fp_compare (insn, operands, 1, 0);"
959 [(set_attr "type" "fcmp,ssecmp")
960 (set_attr "mode" "unknownfp")
961 (set_attr "athlon_decode" "vector")])
963 (define_insn "*cmpfp_i_sse_only"
965 (compare:CCFP (match_operand 0 "register_operand" "x")
966 (match_operand 1 "nonimmediate_operand" "xm")))]
967 "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
968 && GET_MODE (operands[0]) == GET_MODE (operands[0])"
969 "* return output_fp_compare (insn, operands, 1, 0);"
970 [(set_attr "type" "ssecmp")
971 (set_attr "mode" "unknownfp")
972 (set_attr "athlon_decode" "vector")])
974 (define_insn "*cmpfp_iu"
976 (compare:CCFPU (match_operand 0 "register_operand" "f")
977 (match_operand 1 "register_operand" "f")))]
978 "TARGET_80387 && TARGET_CMOVE
979 && !SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
980 && FLOAT_MODE_P (GET_MODE (operands[0]))
981 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
982 "* return output_fp_compare (insn, operands, 1, 1);"
983 [(set_attr "type" "fcmp")
984 (set_attr "mode" "unknownfp")
985 (set_attr "athlon_decode" "vector")])
987 (define_insn "*cmpfp_iu_sse"
989 (compare:CCFPU (match_operand 0 "register_operand" "f#x,x#f")
990 (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))]
992 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
993 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
994 "* return output_fp_compare (insn, operands, 1, 1);"
995 [(set_attr "type" "fcmp,ssecmp")
996 (set_attr "mode" "unknownfp")
997 (set_attr "athlon_decode" "vector")])
999 (define_insn "*cmpfp_iu_sse_only"
1000 [(set (reg:CCFPU 17)
1001 (compare:CCFPU (match_operand 0 "register_operand" "x")
1002 (match_operand 1 "nonimmediate_operand" "xm")))]
1003 "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1004 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1005 "* return output_fp_compare (insn, operands, 1, 1);"
1006 [(set_attr "type" "ssecmp")
1007 (set_attr "mode" "unknownfp")
1008 (set_attr "athlon_decode" "vector")])
1010 ;; Move instructions.
1012 ;; General case of fullword move.
1014 (define_expand "movsi"
1015 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1016 (match_operand:SI 1 "general_operand" ""))]
1018 "ix86_expand_move (SImode, operands); DONE;")
1020 ;; Push/pop instructions. They are separate since autoinc/dec is not a
1023 ;; %%% We don't use a post-inc memory reference because x86 is not a
1024 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1025 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1026 ;; targets without our curiosities, and it is just as easy to represent
1027 ;; this differently.
1029 (define_insn "*pushsi2"
1030 [(set (match_operand:SI 0 "push_operand" "=<")
1031 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1034 [(set_attr "type" "push")
1035 (set_attr "mode" "SI")])
1037 ;; For 64BIT abi we always round up to 8 bytes.
1038 (define_insn "*pushsi2_rex64"
1039 [(set (match_operand:SI 0 "push_operand" "=X")
1040 (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1043 [(set_attr "type" "push")
1044 (set_attr "mode" "SI")])
1046 (define_insn "*pushsi2_prologue"
1047 [(set (match_operand:SI 0 "push_operand" "=<")
1048 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1049 (clobber (mem:BLK (scratch)))]
1052 [(set_attr "type" "push")
1053 (set_attr "mode" "SI")])
1055 (define_insn "*popsi1_epilogue"
1056 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1057 (mem:SI (reg:SI 7)))
1059 (plus:SI (reg:SI 7) (const_int 4)))
1060 (clobber (mem:BLK (scratch)))]
1063 [(set_attr "type" "pop")
1064 (set_attr "mode" "SI")])
1066 (define_insn "popsi1"
1067 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1068 (mem:SI (reg:SI 7)))
1070 (plus:SI (reg:SI 7) (const_int 4)))]
1073 [(set_attr "type" "pop")
1074 (set_attr "mode" "SI")])
1076 (define_insn "*movsi_xor"
1077 [(set (match_operand:SI 0 "register_operand" "=r")
1078 (match_operand:SI 1 "const0_operand" "i"))
1079 (clobber (reg:CC 17))]
1080 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1081 "xor{l}\t{%0, %0|%0, %0}"
1082 [(set_attr "type" "alu1")
1083 (set_attr "mode" "SI")
1084 (set_attr "length_immediate" "0")])
1086 (define_insn "*movsi_or"
1087 [(set (match_operand:SI 0 "register_operand" "=r")
1088 (match_operand:SI 1 "immediate_operand" "i"))
1089 (clobber (reg:CC 17))]
1090 "reload_completed && GET_CODE (operands[1]) == CONST_INT
1091 && INTVAL (operands[1]) == -1
1092 && (TARGET_PENTIUM || optimize_size)"
1094 operands[1] = constm1_rtx;
1095 return "or{l}\t{%1, %0|%0, %1}";
1097 [(set_attr "type" "alu1")
1098 (set_attr "mode" "SI")
1099 (set_attr "length_immediate" "1")])
1101 ; The first alternative is used only to compute proper length of instruction.
1102 ; Reload's algorithm does not take into account the cost of spill instructions
1103 ; needed to free register in given class, so avoid it from choosing the first
1104 ; alternative when eax is not available.
1106 (define_insn "*movsi_1"
1107 [(set (match_operand:SI 0 "nonimmediate_operand" "=*?a,r,*?a,m,!*y,!rm,!*y,!*Y,!rm,!*Y")
1108 (match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,rm,*y,*y,rm,*Y,*Y"))]
1109 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1111 switch (get_attr_type (insn))
1114 if (get_attr_mode (insn) == TImode)
1115 return "movdqa\t{%1, %0|%0, %1}";
1116 return "movd\t{%1, %0|%0, %1}";
1119 if (get_attr_mode (insn) == DImode)
1120 return "movq\t{%1, %0|%0, %1}";
1121 return "movd\t{%1, %0|%0, %1}";
1124 return "lea{l}\t{%1, %0|%0, %1}";
1127 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1129 return "mov{l}\t{%1, %0|%0, %1}";
1133 (cond [(eq_attr "alternative" "4,5,6")
1134 (const_string "mmxmov")
1135 (eq_attr "alternative" "7,8,9")
1136 (const_string "ssemov")
1137 (and (ne (symbol_ref "flag_pic") (const_int 0))
1138 (match_operand:SI 1 "symbolic_operand" ""))
1139 (const_string "lea")
1141 (const_string "imov")))
1142 (set_attr "modrm" "0,*,0,*,*,*,*,*,*,*")
1143 (set_attr "mode" "SI,SI,SI,SI,SI,SI,DI,TI,SI,SI")])
1145 ;; Stores and loads of ax to arbitary constant address.
1146 ;; We fake an second form of instruction to force reload to load address
1147 ;; into register when rax is not available
1148 (define_insn "*movabssi_1_rex64"
1149 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1150 (match_operand:SI 1 "nonmemory_operand" "a,er,i"))]
1153 movabs{l}\t{%1, %P0|%P0, %1}
1154 mov{l}\t{%1, %a0|%a0, %1}
1155 movabs{l}\t{%1, %a0|%a0, %1}"
1156 [(set_attr "type" "imov")
1157 (set_attr "modrm" "0,*,*")
1158 (set_attr "length_address" "8,0,0")
1159 (set_attr "length_immediate" "0,*,*")
1160 (set_attr "memory" "store")
1161 (set_attr "mode" "SI")])
1163 (define_insn "*movabssi_2_rex64"
1164 [(set (match_operand:SI 0 "register_operand" "=a,r")
1165 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1168 movabs{l}\t{%P1, %0|%0, %P1}
1169 mov{l}\t{%a1, %0|%0, %a1}"
1170 [(set_attr "type" "imov")
1171 (set_attr "modrm" "0,*")
1172 (set_attr "length_address" "8,0")
1173 (set_attr "length_immediate" "0")
1174 (set_attr "memory" "load")
1175 (set_attr "mode" "SI")])
1177 (define_insn "*swapsi"
1178 [(set (match_operand:SI 0 "register_operand" "+r")
1179 (match_operand:SI 1 "register_operand" "+r"))
1184 [(set_attr "type" "imov")
1185 (set_attr "pent_pair" "np")
1186 (set_attr "athlon_decode" "vector")
1187 (set_attr "mode" "SI")
1188 (set_attr "modrm" "0")
1189 (set_attr "ppro_uops" "few")])
1191 (define_expand "movhi"
1192 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1193 (match_operand:HI 1 "general_operand" ""))]
1195 "ix86_expand_move (HImode, operands); DONE;")
1197 (define_insn "*pushhi2"
1198 [(set (match_operand:HI 0 "push_operand" "=<,<")
1199 (match_operand:HI 1 "general_no_elim_operand" "n,r*m"))]
1202 push{w}\t{|WORD PTR }%1
1204 [(set_attr "type" "push")
1205 (set_attr "mode" "HI")])
1207 ;; For 64BIT abi we always round up to 8 bytes.
1208 (define_insn "*pushhi2_rex64"
1209 [(set (match_operand:HI 0 "push_operand" "=X")
1210 (match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))]
1213 [(set_attr "type" "push")
1214 (set_attr "mode" "QI")])
1216 ; The first alternative is used only to compute proper length of instruction.
1217 ; Reload's algorithm does not take into account the cost of spill instructions
1218 ; needed to free register in given class, so avoid it from choosing the first
1219 ; alternative when eax is not available.
1221 (define_insn "*movhi_1"
1222 [(set (match_operand:HI 0 "nonimmediate_operand" "=*?a,r,r,*?a,r,m")
1223 (match_operand:HI 1 "general_operand" "i,r,rn,rm,rm,rn"))]
1224 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1226 switch (get_attr_type (insn))
1229 /* movzwl is faster than movw on p2 due to partial word stalls,
1230 though not as fast as an aligned movl. */
1231 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1233 if (get_attr_mode (insn) == MODE_SI)
1234 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1236 return "mov{w}\t{%1, %0|%0, %1}";
1240 (cond [(and (eq_attr "alternative" "0,1")
1241 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1243 (eq (symbol_ref "TARGET_HIMODE_MATH")
1245 (const_string "imov")
1246 (and (eq_attr "alternative" "2,3,4")
1247 (match_operand:HI 1 "aligned_operand" ""))
1248 (const_string "imov")
1249 (and (ne (symbol_ref "TARGET_MOVX")
1251 (eq_attr "alternative" "0,1,3,4"))
1252 (const_string "imovx")
1254 (const_string "imov")))
1256 (cond [(eq_attr "type" "imovx")
1258 (and (eq_attr "alternative" "2,3,4")
1259 (match_operand:HI 1 "aligned_operand" ""))
1261 (and (eq_attr "alternative" "0,1")
1262 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1264 (eq (symbol_ref "TARGET_HIMODE_MATH")
1268 (const_string "HI")))
1269 (set_attr "modrm" "0,*,*,0,*,*")])
1271 ;; Stores and loads of ax to arbitary constant address.
1272 ;; We fake an second form of instruction to force reload to load address
1273 ;; into register when rax is not available
1274 (define_insn "*movabshi_1_rex64"
1275 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1276 (match_operand:HI 1 "nonmemory_operand" "a,er,i"))]
1279 movabs{w}\t{%1, %P0|%P0, %1}
1280 mov{w}\t{%1, %a0|%a0, %1}
1281 movabs{w}\t{%1, %a0|%a0, %1}"
1282 [(set_attr "type" "imov")
1283 (set_attr "modrm" "0,*,*")
1284 (set_attr "length_address" "8,0,0")
1285 (set_attr "length_immediate" "0,*,*")
1286 (set_attr "memory" "store")
1287 (set_attr "mode" "HI")])
1289 (define_insn "*movabshi_2_rex64"
1290 [(set (match_operand:HI 0 "register_operand" "=a,r")
1291 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1294 movabs{w}\t{%P1, %0|%0, %P1}
1295 mov{w}\t{%a1, %0|%0, %a1}"
1296 [(set_attr "type" "imov")
1297 (set_attr "modrm" "0,*")
1298 (set_attr "length_address" "8,0")
1299 (set_attr "length_immediate" "0")
1300 (set_attr "memory" "load")
1301 (set_attr "mode" "HI")])
1303 (define_insn "*swaphi_1"
1304 [(set (match_operand:HI 0 "register_operand" "+r")
1305 (match_operand:HI 1 "register_operand" "+r"))
1308 "TARGET_PARTIAL_REG_STALL"
1310 [(set_attr "type" "imov")
1311 (set_attr "pent_pair" "np")
1312 (set_attr "mode" "HI")
1313 (set_attr "modrm" "0")
1314 (set_attr "ppro_uops" "few")])
1316 (define_insn "*swaphi_2"
1317 [(set (match_operand:HI 0 "register_operand" "+r")
1318 (match_operand:HI 1 "register_operand" "+r"))
1321 "! TARGET_PARTIAL_REG_STALL"
1323 [(set_attr "type" "imov")
1324 (set_attr "pent_pair" "np")
1325 (set_attr "mode" "SI")
1326 (set_attr "modrm" "0")
1327 (set_attr "ppro_uops" "few")])
1329 (define_expand "movstricthi"
1330 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1331 (match_operand:HI 1 "general_operand" ""))]
1332 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1334 /* Don't generate memory->memory moves, go through a register */
1335 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1336 operands[1] = force_reg (HImode, operands[1]);
1339 (define_insn "*movstricthi_1"
1340 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1341 (match_operand:HI 1 "general_operand" "rn,m"))]
1342 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1343 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1344 "mov{w}\t{%1, %0|%0, %1}"
1345 [(set_attr "type" "imov")
1346 (set_attr "mode" "HI")])
1348 (define_insn "*movstricthi_xor"
1349 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1350 (match_operand:HI 1 "const0_operand" "i"))
1351 (clobber (reg:CC 17))]
1353 && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"
1354 "xor{w}\t{%0, %0|%0, %0}"
1355 [(set_attr "type" "alu1")
1356 (set_attr "mode" "HI")
1357 (set_attr "length_immediate" "0")])
1359 (define_expand "movqi"
1360 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1361 (match_operand:QI 1 "general_operand" ""))]
1363 "ix86_expand_move (QImode, operands); DONE;")
1365 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1366 ;; "push a byte". But actually we use pushw, which has the effect
1367 ;; of rounding the amount pushed up to a halfword.
1369 (define_insn "*pushqi2"
1370 [(set (match_operand:QI 0 "push_operand" "=X,X")
1371 (match_operand:QI 1 "nonmemory_no_elim_operand" "n,r"))]
1374 push{w}\t{|word ptr }%1
1376 [(set_attr "type" "push")
1377 (set_attr "mode" "HI")])
1379 ;; For 64BIT abi we always round up to 8 bytes.
1380 (define_insn "*pushqi2_rex64"
1381 [(set (match_operand:QI 0 "push_operand" "=X")
1382 (match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))]
1385 [(set_attr "type" "push")
1386 (set_attr "mode" "QI")])
1388 ;; Situation is quite tricky about when to choose full sized (SImode) move
1389 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1390 ;; partial register dependency machines (such as AMD Athlon), where QImode
1391 ;; moves issue extra dependency and for partial register stalls machines
1392 ;; that don't use QImode patterns (and QImode move cause stall on the next
1395 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1396 ;; register stall machines with, where we use QImode instructions, since
1397 ;; partial register stall can be caused there. Then we use movzx.
1398 (define_insn "*movqi_1"
1399 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1400 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1401 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1403 switch (get_attr_type (insn))
1406 if (!ANY_QI_REG_P (operands[1]) && GET_CODE (operands[1]) != MEM)
1408 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1410 if (get_attr_mode (insn) == MODE_SI)
1411 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1413 return "mov{b}\t{%1, %0|%0, %1}";
1417 (cond [(and (eq_attr "alternative" "3")
1418 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1420 (eq (symbol_ref "TARGET_QIMODE_MATH")
1422 (const_string "imov")
1423 (eq_attr "alternative" "3,5")
1424 (const_string "imovx")
1425 (and (ne (symbol_ref "TARGET_MOVX")
1427 (eq_attr "alternative" "2"))
1428 (const_string "imovx")
1430 (const_string "imov")))
1432 (cond [(eq_attr "alternative" "3,4,5")
1434 (eq_attr "alternative" "6")
1436 (eq_attr "type" "imovx")
1438 (and (eq_attr "type" "imov")
1439 (and (eq_attr "alternative" "0,1,2")
1440 (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
1443 ;; Avoid partial register stalls when not using QImode arithmetic
1444 (and (eq_attr "type" "imov")
1445 (and (eq_attr "alternative" "0,1,2")
1446 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
1448 (eq (symbol_ref "TARGET_QIMODE_MATH")
1452 (const_string "QI")))])
1454 (define_expand "reload_outqi"
1455 [(parallel [(match_operand:QI 0 "" "=m")
1456 (match_operand:QI 1 "register_operand" "r")
1457 (match_operand:QI 2 "register_operand" "=&q")])]
1461 op0 = operands[0]; op1 = operands[1]; op2 = operands[2];
1463 if (reg_overlap_mentioned_p (op2, op0))
1465 if (! q_regs_operand (op1, QImode))
1467 emit_insn (gen_movqi (op2, op1));
1470 emit_insn (gen_movqi (op0, op1));
1474 (define_insn "*swapqi"
1475 [(set (match_operand:QI 0 "register_operand" "+r")
1476 (match_operand:QI 1 "register_operand" "+r"))
1481 [(set_attr "type" "imov")
1482 (set_attr "pent_pair" "np")
1483 (set_attr "mode" "QI")
1484 (set_attr "modrm" "0")
1485 (set_attr "ppro_uops" "few")])
1487 (define_expand "movstrictqi"
1488 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1489 (match_operand:QI 1 "general_operand" ""))]
1490 "! TARGET_PARTIAL_REG_STALL"
1492 /* Don't generate memory->memory moves, go through a register. */
1493 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1494 operands[1] = force_reg (QImode, operands[1]);
1497 (define_insn "*movstrictqi_1"
1498 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
1499 (match_operand:QI 1 "general_operand" "*qn,m"))]
1500 "! TARGET_PARTIAL_REG_STALL
1501 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1502 "mov{b}\t{%1, %0|%0, %1}"
1503 [(set_attr "type" "imov")
1504 (set_attr "mode" "QI")])
1506 (define_insn "*movstrictqi_xor"
1507 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
1508 (match_operand:QI 1 "const0_operand" "i"))
1509 (clobber (reg:CC 17))]
1510 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1511 "xor{b}\t{%0, %0|%0, %0}"
1512 [(set_attr "type" "alu1")
1513 (set_attr "mode" "QI")
1514 (set_attr "length_immediate" "0")])
1516 (define_insn "*movsi_extv_1"
1517 [(set (match_operand:SI 0 "register_operand" "=R")
1518 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
1522 "movs{bl|x}\t{%h1, %0|%0, %h1}"
1523 [(set_attr "type" "imovx")
1524 (set_attr "mode" "SI")])
1526 (define_insn "*movhi_extv_1"
1527 [(set (match_operand:HI 0 "register_operand" "=R")
1528 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
1532 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
1533 [(set_attr "type" "imovx")
1534 (set_attr "mode" "SI")])
1536 (define_insn "*movqi_extv_1"
1537 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
1538 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1543 switch (get_attr_type (insn))
1546 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1548 return "mov{b}\t{%h1, %0|%0, %h1}";
1552 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1553 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1554 (ne (symbol_ref "TARGET_MOVX")
1556 (const_string "imovx")
1557 (const_string "imov")))
1559 (if_then_else (eq_attr "type" "imovx")
1561 (const_string "QI")))])
1563 (define_insn "*movqi_extv_1_rex64"
1564 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1565 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1570 switch (get_attr_type (insn))
1573 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1575 return "mov{b}\t{%h1, %0|%0, %h1}";
1579 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1580 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1581 (ne (symbol_ref "TARGET_MOVX")
1583 (const_string "imovx")
1584 (const_string "imov")))
1586 (if_then_else (eq_attr "type" "imovx")
1588 (const_string "QI")))])
1590 ;; Stores and loads of ax to arbitary constant address.
1591 ;; We fake an second form of instruction to force reload to load address
1592 ;; into register when rax is not available
1593 (define_insn "*movabsqi_1_rex64"
1594 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1595 (match_operand:QI 1 "nonmemory_operand" "a,er,i"))]
1598 movabs{b}\t{%1, %P0|%P0, %1}
1599 mov{b}\t{%1, %a0|%a0, %1}
1600 movabs{b}\t{%1, %a0|%a0, %1}"
1601 [(set_attr "type" "imov")
1602 (set_attr "modrm" "0,*,*")
1603 (set_attr "length_address" "8,0,0")
1604 (set_attr "length_immediate" "0,*,*")
1605 (set_attr "memory" "store")
1606 (set_attr "mode" "QI")])
1608 (define_insn "*movabsqi_2_rex64"
1609 [(set (match_operand:QI 0 "register_operand" "=a,r")
1610 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1613 movabs{b}\t{%P1, %0|%0, %P1}
1614 mov{b}\t{%a1, %0|%0, %a1}"
1615 [(set_attr "type" "imov")
1616 (set_attr "modrm" "0,*")
1617 (set_attr "length_address" "8,0")
1618 (set_attr "length_immediate" "0")
1619 (set_attr "memory" "load")
1620 (set_attr "mode" "QI")])
1622 (define_insn "*movsi_extzv_1"
1623 [(set (match_operand:SI 0 "register_operand" "=R")
1624 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
1628 "movz{bl|x}\t{%h1, %0|%0, %h1}"
1629 [(set_attr "type" "imovx")
1630 (set_attr "mode" "SI")])
1632 (define_insn "*movqi_extzv_2"
1633 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
1634 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1639 switch (get_attr_type (insn))
1642 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1644 return "mov{b}\t{%h1, %0|%0, %h1}";
1648 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1649 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1650 (ne (symbol_ref "TARGET_MOVX")
1652 (const_string "imovx")
1653 (const_string "imov")))
1655 (if_then_else (eq_attr "type" "imovx")
1657 (const_string "QI")))])
1659 (define_insn "*movqi_extzv_2_rex64"
1660 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1661 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1666 switch (get_attr_type (insn))
1669 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1671 return "mov{b}\t{%h1, %0|%0, %h1}";
1675 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1676 (ne (symbol_ref "TARGET_MOVX")
1678 (const_string "imovx")
1679 (const_string "imov")))
1681 (if_then_else (eq_attr "type" "imovx")
1683 (const_string "QI")))])
1685 (define_insn "movsi_insv_1"
1686 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1689 (match_operand:SI 1 "general_operand" "Qmn"))]
1691 "mov{b}\t{%b1, %h0|%h0, %b1}"
1692 [(set_attr "type" "imov")
1693 (set_attr "mode" "QI")])
1695 (define_insn "*movsi_insv_1_rex64"
1696 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1699 (match_operand:SI 1 "nonmemory_operand" "Qn"))]
1701 "mov{b}\t{%b1, %h0|%h0, %b1}"
1702 [(set_attr "type" "imov")
1703 (set_attr "mode" "QI")])
1705 (define_insn "*movqi_insv_2"
1706 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1709 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
1713 "mov{b}\t{%h1, %h0|%h0, %h1}"
1714 [(set_attr "type" "imov")
1715 (set_attr "mode" "QI")])
1717 (define_expand "movdi"
1718 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1719 (match_operand:DI 1 "general_operand" ""))]
1721 "ix86_expand_move (DImode, operands); DONE;")
1723 (define_insn "*pushdi"
1724 [(set (match_operand:DI 0 "push_operand" "=<")
1725 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
1729 (define_insn "pushdi2_rex64"
1730 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1731 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1736 [(set_attr "type" "push,multi")
1737 (set_attr "mode" "DI")])
1739 ;; Convert impossible pushes of immediate to existing instructions.
1740 ;; First try to get scratch register and go through it. In case this
1741 ;; fails, push sign extended lower part first and then overwrite
1742 ;; upper part by 32bit move.
1744 [(match_scratch:DI 2 "r")
1745 (set (match_operand:DI 0 "push_operand" "")
1746 (match_operand:DI 1 "immediate_operand" ""))]
1747 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1748 && !x86_64_immediate_operand (operands[1], DImode)"
1749 [(set (match_dup 2) (match_dup 1))
1750 (set (match_dup 0) (match_dup 2))]
1753 ;; We need to define this as both peepholer and splitter for case
1754 ;; peephole2 pass is not run.
1756 [(set (match_operand:DI 0 "push_operand" "")
1757 (match_operand:DI 1 "immediate_operand" ""))]
1758 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1759 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1760 [(set (match_dup 0) (match_dup 1))
1761 (set (match_dup 2) (match_dup 3))]
1762 "split_di (operands + 1, 1, operands + 2, operands + 3);
1763 operands[1] = gen_lowpart (DImode, operands[2]);
1764 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1769 [(set (match_operand:DI 0 "push_operand" "")
1770 (match_operand:DI 1 "immediate_operand" ""))]
1771 "TARGET_64BIT && (flow2_completed || (reload_completed && !flag_peephole2))
1772 && !symbolic_operand (operands[1], DImode)
1773 && !x86_64_immediate_operand (operands[1], DImode)"
1774 [(set (match_dup 0) (match_dup 1))
1775 (set (match_dup 2) (match_dup 3))]
1776 "split_di (operands + 1, 1, operands + 2, operands + 3);
1777 operands[1] = gen_lowpart (DImode, operands[2]);
1778 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1782 (define_insn "*pushdi2_prologue_rex64"
1783 [(set (match_operand:DI 0 "push_operand" "=<")
1784 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
1785 (clobber (mem:BLK (scratch)))]
1788 [(set_attr "type" "push")
1789 (set_attr "mode" "DI")])
1791 (define_insn "*popdi1_epilogue_rex64"
1792 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1793 (mem:DI (reg:DI 7)))
1795 (plus:DI (reg:DI 7) (const_int 8)))
1796 (clobber (mem:BLK (scratch)))]
1799 [(set_attr "type" "pop")
1800 (set_attr "mode" "DI")])
1802 (define_insn "popdi1"
1803 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1804 (mem:DI (reg:DI 7)))
1806 (plus:DI (reg:DI 7) (const_int 8)))]
1809 [(set_attr "type" "pop")
1810 (set_attr "mode" "DI")])
1812 (define_insn "*movdi_xor_rex64"
1813 [(set (match_operand:DI 0 "register_operand" "=r")
1814 (match_operand:DI 1 "const0_operand" "i"))
1815 (clobber (reg:CC 17))]
1816 "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size)
1817 && reload_completed"
1818 "xor{l}\t{%k0, %k0|%k0, %k0}"
1819 [(set_attr "type" "alu1")
1820 (set_attr "mode" "SI")
1821 (set_attr "length_immediate" "0")])
1823 (define_insn "*movdi_or_rex64"
1824 [(set (match_operand:DI 0 "register_operand" "=r")
1825 (match_operand:DI 1 "const_int_operand" "i"))
1826 (clobber (reg:CC 17))]
1827 "TARGET_64BIT && (TARGET_PENTIUM || optimize_size)
1829 && GET_CODE (operands[1]) == CONST_INT
1830 && INTVAL (operands[1]) == -1"
1832 operands[1] = constm1_rtx;
1833 return "or{q}\t{%1, %0|%0, %1}";
1835 [(set_attr "type" "alu1")
1836 (set_attr "mode" "DI")
1837 (set_attr "length_immediate" "1")])
1839 (define_insn "*movdi_2"
1840 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!m*y,!*y,!m,!*Y,!*Y")
1841 (match_operand:DI 1 "general_operand" "riFo,riF,*y,m,*Y,*Y,m"))]
1843 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1847 movq\t{%1, %0|%0, %1}
1848 movq\t{%1, %0|%0, %1}
1849 movq\t{%1, %0|%0, %1}
1850 movdqa\t{%1, %0|%0, %1}
1851 movq\t{%1, %0|%0, %1}"
1852 [(set_attr "type" "*,*,mmx,mmx,ssemov,ssemov,ssemov")
1853 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
1856 [(set (match_operand:DI 0 "push_operand" "")
1857 (match_operand:DI 1 "general_operand" ""))]
1858 "!TARGET_64BIT && reload_completed
1859 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1861 "ix86_split_long_move (operands); DONE;")
1863 ;; %%% This multiword shite has got to go.
1865 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1866 (match_operand:DI 1 "general_operand" ""))]
1867 "!TARGET_64BIT && reload_completed
1868 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
1869 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1871 "ix86_split_long_move (operands); DONE;")
1873 (define_insn "*movdi_1_rex64"
1874 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!m*y,!*y,!*Y,!m,!*Y")
1875 (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,m,*Y,*Y,*m"))]
1877 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1879 switch (get_attr_type (insn))
1882 if (register_operand (operands[0], DImode)
1883 && register_operand (operands[1], DImode))
1884 return "movdqa\t{%1, %0|%0, %1}";
1887 return "movq\t{%1, %0|%0, %1}";
1891 return "lea{q}\t{%a1, %0|%0, %a1}";
1893 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1895 if (get_attr_mode (insn) == MODE_SI)
1896 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1897 else if (which_alternative == 2)
1898 return "movabs{q}\t{%1, %0|%0, %1}";
1900 return "mov{q}\t{%1, %0|%0, %1}";
1904 (cond [(eq_attr "alternative" "5,6")
1905 (const_string "mmxmov")
1906 (eq_attr "alternative" "7,8")
1907 (const_string "ssemov")
1908 (eq_attr "alternative" "4")
1909 (const_string "multi")
1910 (and (ne (symbol_ref "flag_pic") (const_int 0))
1911 (match_operand:DI 1 "symbolic_operand" ""))
1912 (const_string "lea")
1914 (const_string "imov")))
1915 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*")
1916 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*")
1917 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI")])
1919 ;; Stores and loads of ax to arbitary constant address.
1920 ;; We fake an second form of instruction to force reload to load address
1921 ;; into register when rax is not available
1922 (define_insn "*movabsdi_1_rex64"
1923 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1924 (match_operand:DI 1 "nonmemory_operand" "a,er,i"))]
1927 movabs{q}\t{%1, %P0|%P0, %1}
1928 mov{q}\t{%1, %a0|%a0, %1}
1929 movabs{q}\t{%1, %a0|%a0, %1}"
1930 [(set_attr "type" "imov")
1931 (set_attr "modrm" "0,*,*")
1932 (set_attr "length_address" "8,0,0")
1933 (set_attr "length_immediate" "0,*,*")
1934 (set_attr "memory" "store")
1935 (set_attr "mode" "DI")])
1937 (define_insn "*movabsdi_2_rex64"
1938 [(set (match_operand:DI 0 "register_operand" "=a,r")
1939 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1942 movabs{q}\t{%P1, %0|%0, %P1}
1943 mov{q}\t{%a1, %0|%0, %a1}"
1944 [(set_attr "type" "imov")
1945 (set_attr "modrm" "0,*")
1946 (set_attr "length_address" "8,0")
1947 (set_attr "length_immediate" "0")
1948 (set_attr "memory" "load")
1949 (set_attr "mode" "DI")])
1951 ;; Convert impossible stores of immediate to existing instructions.
1952 ;; First try to get scratch register and go through it. In case this
1953 ;; fails, move by 32bit parts.
1955 [(match_scratch:DI 2 "r")
1956 (set (match_operand:DI 0 "memory_operand" "")
1957 (match_operand:DI 1 "immediate_operand" ""))]
1958 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1959 && !x86_64_immediate_operand (operands[1], DImode)"
1960 [(set (match_dup 2) (match_dup 1))
1961 (set (match_dup 0) (match_dup 2))]
1964 ;; We need to define this as both peepholer and splitter for case
1965 ;; peephole2 pass is not run.
1967 [(set (match_operand:DI 0 "memory_operand" "")
1968 (match_operand:DI 1 "immediate_operand" ""))]
1969 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1970 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1971 [(set (match_dup 2) (match_dup 3))
1972 (set (match_dup 4) (match_dup 5))]
1973 "split_di (operands, 2, operands + 2, operands + 4);")
1976 [(set (match_operand:DI 0 "memory_operand" "")
1977 (match_operand:DI 1 "immediate_operand" ""))]
1978 "TARGET_64BIT && (flow2_completed || (reload_completed && !flag_peephole2))
1979 && !symbolic_operand (operands[1], DImode)
1980 && !x86_64_immediate_operand (operands[1], DImode)"
1981 [(set (match_dup 2) (match_dup 3))
1982 (set (match_dup 4) (match_dup 5))]
1983 "split_di (operands, 2, operands + 2, operands + 4);")
1985 (define_insn "*swapdi_rex64"
1986 [(set (match_operand:DI 0 "register_operand" "+r")
1987 (match_operand:DI 1 "register_operand" "+r"))
1992 [(set_attr "type" "imov")
1993 (set_attr "pent_pair" "np")
1994 (set_attr "athlon_decode" "vector")
1995 (set_attr "mode" "DI")
1996 (set_attr "modrm" "0")
1997 (set_attr "ppro_uops" "few")])
2000 (define_expand "movsf"
2001 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2002 (match_operand:SF 1 "general_operand" ""))]
2004 "ix86_expand_move (SFmode, operands); DONE;")
2006 (define_insn "*pushsf"
2007 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2008 (match_operand:SF 1 "general_no_elim_operand" "f#rx,rFm#fx,x#rf"))]
2011 switch (which_alternative)
2014 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2015 operands[0] = gen_rtx_MEM (SFmode, stack_pointer_rtx);
2016 operands[2] = stack_pointer_rtx;
2017 operands[3] = GEN_INT (4);
2018 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2019 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2021 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2024 return "push{l}\t%1";
2032 [(set_attr "type" "multi,push,multi")
2033 (set_attr "mode" "SF,SI,SF")])
2035 (define_insn "*pushsf_rex64"
2036 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2037 (match_operand:SF 1 "nonmemory_no_elim_operand" "f#rx,rF#fx,x#rf"))]
2040 switch (which_alternative)
2043 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2044 operands[0] = gen_rtx_MEM (SFmode, stack_pointer_rtx);
2045 operands[2] = stack_pointer_rtx;
2046 operands[3] = GEN_INT (8);
2047 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2048 return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2050 return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2053 return "push{q}\t%q1";
2062 [(set_attr "type" "multi,push,multi")
2063 (set_attr "mode" "SF,DI,SF")])
2066 [(set (match_operand:SF 0 "push_operand" "")
2067 (match_operand:SF 1 "memory_operand" ""))]
2069 && GET_CODE (operands[1]) == MEM
2070 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2071 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
2074 "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
2077 ;; %%% Kill this when call knows how to work this out.
2079 [(set (match_operand:SF 0 "push_operand" "")
2080 (match_operand:SF 1 "register_operand" ""))]
2081 "!TARGET_64BIT && ANY_FP_REGNO_P (REGNO (operands[1]))"
2082 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -4)))
2083 (set (mem:SF (reg:SI 7)) (match_dup 1))])
2086 [(set (match_operand:SF 0 "push_operand" "")
2087 (match_operand:SF 1 "register_operand" ""))]
2088 "TARGET_64BIT && ANY_FP_REGNO_P (REGNO (operands[1]))"
2089 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
2090 (set (mem:SF (reg:DI 7)) (match_dup 1))])
2092 (define_insn "*movsf_1"
2093 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#xr,m,f#xr,r#xf,m,x#rf,x#rf,x#rf,m,!*y,!rm,!*y")
2094 (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,H,x,xm#rf,x#rf,rm,*y,*y"))]
2095 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2096 && (reload_in_progress || reload_completed
2097 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2098 || GET_CODE (operands[1]) != CONST_DOUBLE
2099 || memory_operand (operands[0], SFmode))"
2101 switch (which_alternative)
2104 if (REG_P (operands[1])
2105 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2107 else if (STACK_TOP_P (operands[0]))
2108 return "fld%z1\t%y1";
2113 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2114 return "fstp%z0\t%y0";
2116 return "fst%z0\t%y0";
2119 switch (standard_80387_constant_p (operands[1]))
2130 return "mov{l}\t{%1, %0|%0, %1}";
2132 if (TARGET_SSE2 && !TARGET_ATHLON)
2133 return "pxor\t%0, %0";
2135 return "xorps\t%0, %0";
2137 if (TARGET_PARTIAL_REG_DEPENDENCY)
2138 return "movaps\t{%1, %0|%0, %1}";
2140 return "movss\t{%1, %0|%0, %1}";
2143 return "movss\t{%1, %0|%0, %1}";
2147 return "movd\t{%1, %0|%0, %1}";
2150 return "movq\t{%1, %0|%0, %1}";
2156 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2157 (set_attr "mode" "SF,SF,SF,SI,SI,TI,SF,SF,SF,SI,SI,DI")])
2159 (define_insn "*swapsf"
2160 [(set (match_operand:SF 0 "register_operand" "+f")
2161 (match_operand:SF 1 "register_operand" "+f"))
2164 "reload_completed || !TARGET_SSE"
2166 if (STACK_TOP_P (operands[0]))
2171 [(set_attr "type" "fxch")
2172 (set_attr "mode" "SF")])
2174 (define_expand "movdf"
2175 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2176 (match_operand:DF 1 "general_operand" ""))]
2178 "ix86_expand_move (DFmode, operands); DONE;")
2180 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2181 ;; Size of pushdf using integer insturctions is 2+2*memory operand size
2182 ;; On the average, pushdf using integers can be still shorter. Allow this
2183 ;; pattern for optimize_size too.
2185 (define_insn "*pushdf_nointeger"
2186 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2187 (match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))]
2188 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
2190 switch (which_alternative)
2193 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2194 operands[0] = gen_rtx_MEM (DFmode, stack_pointer_rtx);
2195 operands[2] = stack_pointer_rtx;
2196 operands[3] = GEN_INT (8);
2197 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2198 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2200 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2211 [(set_attr "type" "multi")
2212 (set_attr "mode" "DF,SI,SI,DF")])
2214 (define_insn "*pushdf_integer"
2215 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2216 (match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))]
2217 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2219 switch (which_alternative)
2222 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2223 operands[0] = gen_rtx_MEM (DFmode, stack_pointer_rtx);
2224 operands[2] = stack_pointer_rtx;
2225 operands[3] = GEN_INT (8);
2227 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2228 return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2230 return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2232 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2233 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2235 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2246 [(set_attr "type" "multi")
2247 (set_attr "mode" "DF,SI,DF")])
2249 ;; %%% Kill this when call knows how to work this out.
2251 [(set (match_operand:DF 0 "push_operand" "")
2252 (match_operand:DF 1 "register_operand" ""))]
2253 "!TARGET_64BIT && reload_completed && ANY_FP_REGNO_P (REGNO (operands[1]))"
2254 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
2255 (set (mem:DF (reg:SI 7)) (match_dup 1))]
2259 [(set (match_operand:DF 0 "push_operand" "")
2260 (match_operand:DF 1 "register_operand" ""))]
2261 "TARGET_64BIT && reload_completed && ANY_FP_REGNO_P (REGNO (operands[1]))"
2262 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
2263 (set (mem:DF (reg:DI 7)) (match_dup 1))]
2267 [(set (match_operand:DF 0 "push_operand" "")
2268 (match_operand:DF 1 "general_operand" ""))]
2271 "ix86_split_long_move (operands); DONE;")
2273 ;; Moving is usually shorter when only FP registers are used. This separate
2274 ;; movdf pattern avoids the use of integer registers for FP operations
2275 ;; when optimizing for size.
2277 (define_insn "*movdf_nointeger"
2278 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,m,f#Y,*r,o,Y#f,Y#f,Y#f,m")
2279 (match_operand:DF 1 "general_operand" "fm#Y,f#Y,G,*roF,F*r,H,Y#f,YHm#f,Y#f"))]
2280 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2281 && (optimize_size || !TARGET_INTEGER_DFMODE_MOVES)
2282 && (reload_in_progress || reload_completed
2283 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2284 || GET_CODE (operands[1]) != CONST_DOUBLE
2285 || memory_operand (operands[0], DFmode))"
2287 switch (which_alternative)
2290 if (REG_P (operands[1])
2291 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2293 else if (STACK_TOP_P (operands[0]))
2294 return "fld%z1\t%y1";
2299 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2300 return "fstp%z0\t%y0";
2302 return "fst%z0\t%y0";
2305 switch (standard_80387_constant_p (operands[1]))
2319 return "xorpd\t%0, %0";
2321 return "pxor\t%0, %0";
2323 if (TARGET_PARTIAL_REG_DEPENDENCY)
2324 return "movapd\t{%1, %0|%0, %1}";
2326 return "movsd\t{%1, %0|%0, %1}";
2329 return "movsd\t{%1, %0|%0, %1}";
2335 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2336 (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
2338 (define_insn "*movdf_integer"
2339 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Yr,m,f#Yr,r#Yf,o,Y#rf,Y#rf,Y#rf,m")
2340 (match_operand:DF 1 "general_operand" "fm#Yr,f#Yr,G,roF#Yf,Fr#Yf,H,Y#rf,Ym#rf,Y#rf"))]
2341 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2342 && !optimize_size && TARGET_INTEGER_DFMODE_MOVES
2343 && (reload_in_progress || reload_completed
2344 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2345 || GET_CODE (operands[1]) != CONST_DOUBLE
2346 || memory_operand (operands[0], DFmode))"
2348 switch (which_alternative)
2351 if (REG_P (operands[1])
2352 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2354 else if (STACK_TOP_P (operands[0]))
2355 return "fld%z1\t%y1";
2360 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2361 return "fstp%z0\t%y0";
2363 return "fst%z0\t%y0";
2366 switch (standard_80387_constant_p (operands[1]))
2381 return "xorpd\t%0, %0";
2383 return "pxor\t%0, %0";
2385 if (TARGET_PARTIAL_REG_DEPENDENCY)
2386 return "movapd\t{%1, %0|%0, %1}";
2388 return "movsd\t{%1, %0|%0, %1}";
2391 return "movsd\t{%1, %0|%0, %1}";
2397 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2398 (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
2401 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2402 (match_operand:DF 1 "general_operand" ""))]
2404 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2405 && ! (ANY_FP_REG_P (operands[0]) ||
2406 (GET_CODE (operands[0]) == SUBREG
2407 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2408 && ! (ANY_FP_REG_P (operands[1]) ||
2409 (GET_CODE (operands[1]) == SUBREG
2410 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2412 "ix86_split_long_move (operands); DONE;")
2414 (define_insn "*swapdf"
2415 [(set (match_operand:DF 0 "register_operand" "+f")
2416 (match_operand:DF 1 "register_operand" "+f"))
2419 "reload_completed || !TARGET_SSE2"
2421 if (STACK_TOP_P (operands[0]))
2426 [(set_attr "type" "fxch")
2427 (set_attr "mode" "DF")])
2429 (define_expand "movxf"
2430 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2431 (match_operand:XF 1 "general_operand" ""))]
2433 "ix86_expand_move (XFmode, operands); DONE;")
2435 (define_expand "movtf"
2436 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2437 (match_operand:TF 1 "general_operand" ""))]
2439 "ix86_expand_move (TFmode, operands); DONE;")
2441 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2442 ;; Size of pushdf using integer insturctions is 3+3*memory operand size
2443 ;; Pushing using integer instructions is longer except for constants
2444 ;; and direct memory references.
2445 ;; (assuming that any given constant is pushed only once, but this ought to be
2446 ;; handled elsewhere).
2448 (define_insn "*pushxf_nointeger"
2449 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2450 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2451 "!TARGET_64BIT && optimize_size"
2453 switch (which_alternative)
2456 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2457 operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
2458 operands[2] = stack_pointer_rtx;
2459 operands[3] = GEN_INT (12);
2460 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2461 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2463 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2473 [(set_attr "type" "multi")
2474 (set_attr "mode" "XF,SI,SI")])
2476 (define_insn "*pushtf_nointeger"
2477 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
2478 (match_operand:TF 1 "general_no_elim_operand" "f,Fo,*r"))]
2481 switch (which_alternative)
2484 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2485 operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
2486 operands[2] = stack_pointer_rtx;
2487 operands[3] = GEN_INT (16);
2488 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2489 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2491 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2501 [(set_attr "type" "multi")
2502 (set_attr "mode" "XF,SI,SI")])
2504 (define_insn "*pushxf_integer"
2505 [(set (match_operand:XF 0 "push_operand" "=<,<")
2506 (match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))]
2507 "!TARGET_64BIT && !optimize_size"
2509 switch (which_alternative)
2512 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2513 operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
2514 operands[2] = stack_pointer_rtx;
2515 operands[3] = GEN_INT (12);
2516 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2517 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2519 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2528 [(set_attr "type" "multi")
2529 (set_attr "mode" "XF,SI")])
2531 (define_insn "*pushtf_integer"
2532 [(set (match_operand:TF 0 "push_operand" "=<,<")
2533 (match_operand:TF 1 "general_no_elim_operand" "f#r,rFo#f"))]
2536 switch (which_alternative)
2539 /* %%% We loose REG_DEAD notes for controling pops if we split late. */
2540 operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
2541 operands[2] = stack_pointer_rtx;
2542 operands[3] = GEN_INT (16);
2544 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2545 return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2547 return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2549 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2550 return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
2552 return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
2561 [(set_attr "type" "multi")
2562 (set_attr "mode" "XF,SI")])
2565 [(set (match_operand 0 "push_operand" "")
2566 (match_operand 1 "general_operand" ""))]
2568 && (GET_MODE (operands[0]) == XFmode
2569 || GET_MODE (operands[0]) == TFmode
2570 || GET_MODE (operands[0]) == DFmode)
2571 && (!REG_P (operands[1]) || !ANY_FP_REGNO_P (REGNO (operands[1])))"
2573 "ix86_split_long_move (operands); DONE;")
2576 [(set (match_operand:XF 0 "push_operand" "")
2577 (match_operand:XF 1 "register_operand" ""))]
2578 "!TARGET_64BIT && ANY_FP_REGNO_P (REGNO (operands[1]))"
2579 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12)))
2580 (set (mem:XF (reg:SI 7)) (match_dup 1))])
2583 [(set (match_operand:TF 0 "push_operand" "")
2584 (match_operand:TF 1 "register_operand" ""))]
2585 "!TARGET_64BIT && ANY_FP_REGNO_P (REGNO (operands[1]))"
2586 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
2587 (set (mem:TF (reg:SI 7)) (match_dup 1))])
2590 [(set (match_operand:TF 0 "push_operand" "")
2591 (match_operand:TF 1 "register_operand" ""))]
2592 "TARGET_64BIT && ANY_FP_REGNO_P (REGNO (operands[1]))"
2593 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
2594 (set (mem:TF (reg:DI 7)) (match_dup 1))])
2596 ;; Do not use integer registers when optimizing for size
2597 (define_insn "*movxf_nointeger"
2598 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2599 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2602 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2603 && (reload_in_progress || reload_completed
2604 || GET_CODE (operands[1]) != CONST_DOUBLE
2605 || memory_operand (operands[0], XFmode))"
2607 switch (which_alternative)
2610 if (REG_P (operands[1])
2611 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2613 else if (STACK_TOP_P (operands[0]))
2614 return "fld%z1\t%y1";
2619 /* There is no non-popping store to memory for XFmode. So if
2620 we need one, follow the store with a load. */
2621 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2622 return "fstp%z0\t%y0\;fld%z0\t%y0";
2624 return "fstp%z0\t%y0";
2627 switch (standard_80387_constant_p (operands[1]))
2641 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2642 (set_attr "mode" "XF,XF,XF,SI,SI")])
2644 (define_insn "*movtf_nointeger"
2645 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2646 (match_operand:TF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2647 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2649 && (reload_in_progress || reload_completed
2650 || GET_CODE (operands[1]) != CONST_DOUBLE
2651 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2652 || memory_operand (operands[0], TFmode))"
2654 switch (which_alternative)
2657 if (REG_P (operands[1])
2658 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2660 else if (STACK_TOP_P (operands[0]))
2661 return "fld%z1\t%y1";
2666 /* There is no non-popping store to memory for XFmode. So if
2667 we need one, follow the store with a load. */
2668 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2669 return "fstp%z0\t%y0\;fld%z0\t%y0";
2671 return "fstp%z0\t%y0";
2674 switch (standard_80387_constant_p (operands[1]))
2688 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2689 (set_attr "mode" "XF,XF,XF,SI,SI")])
2691 (define_insn "*movxf_integer"
2692 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
2693 (match_operand:XF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
2696 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2697 && (reload_in_progress || reload_completed
2698 || GET_CODE (operands[1]) != CONST_DOUBLE
2699 || memory_operand (operands[0], XFmode))"
2701 switch (which_alternative)
2704 if (REG_P (operands[1])
2705 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2707 else if (STACK_TOP_P (operands[0]))
2708 return "fld%z1\t%y1";
2713 /* There is no non-popping store to memory for XFmode. So if
2714 we need one, follow the store with a load. */
2715 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2716 return "fstp%z0\t%y0\;fld%z0\t%y0";
2718 return "fstp%z0\t%y0";
2721 switch (standard_80387_constant_p (operands[1]))
2735 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2736 (set_attr "mode" "XF,XF,XF,SI,SI")])
2738 (define_insn "*movtf_integer"
2739 [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
2740 (match_operand:TF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
2741 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2743 && (reload_in_progress || reload_completed
2744 || GET_CODE (operands[1]) != CONST_DOUBLE
2745 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2746 || memory_operand (operands[0], TFmode))"
2748 switch (which_alternative)
2751 if (REG_P (operands[1])
2752 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2754 else if (STACK_TOP_P (operands[0]))
2755 return "fld%z1\t%y1";
2760 /* There is no non-popping store to memory for XFmode. So if
2761 we need one, follow the store with a load. */
2762 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2763 return "fstp%z0\t%y0\;fld%z0\t%y0";
2765 return "fstp%z0\t%y0";
2768 switch (standard_80387_constant_p (operands[1]))
2782 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2783 (set_attr "mode" "XF,XF,XF,SI,SI")])
2786 [(set (match_operand 0 "nonimmediate_operand" "")
2787 (match_operand 1 "general_operand" ""))]
2789 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2790 && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == TFmode)
2791 && ! (ANY_FP_REG_P (operands[0]) ||
2792 (GET_CODE (operands[0]) == SUBREG
2793 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2794 && ! (ANY_FP_REG_P (operands[1]) ||
2795 (GET_CODE (operands[1]) == SUBREG
2796 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2798 "ix86_split_long_move (operands); DONE;")
2801 [(set (match_operand 0 "register_operand" "")
2802 (match_operand 1 "memory_operand" ""))]
2804 && GET_CODE (operands[1]) == MEM
2805 && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == TFmode
2806 || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
2807 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2808 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))
2809 && (!(SSE_REG_P (operands[0]) ||
2810 (GET_CODE (operands[0]) == SUBREG
2811 && SSE_REG_P (SUBREG_REG (operands[0]))))
2812 || standard_sse_constant_p (get_pool_constant (XEXP (operands[1], 0))))
2813 && (!(FP_REG_P (operands[0]) ||
2814 (GET_CODE (operands[0]) == SUBREG
2815 && FP_REG_P (SUBREG_REG (operands[0]))))
2816 || standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0))))"
2819 "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
2821 (define_insn "swapxf"
2822 [(set (match_operand:XF 0 "register_operand" "+f")
2823 (match_operand:XF 1 "register_operand" "+f"))
2828 if (STACK_TOP_P (operands[0]))
2833 [(set_attr "type" "fxch")
2834 (set_attr "mode" "XF")])
2836 (define_insn "swaptf"
2837 [(set (match_operand:TF 0 "register_operand" "+f")
2838 (match_operand:TF 1 "register_operand" "+f"))
2843 if (STACK_TOP_P (operands[0]))
2848 [(set_attr "type" "fxch")
2849 (set_attr "mode" "XF")])
2851 ;; Zero extension instructions
2853 (define_expand "zero_extendhisi2"
2854 [(set (match_operand:SI 0 "register_operand" "")
2855 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
2858 if (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
2860 operands[1] = force_reg (HImode, operands[1]);
2861 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
2866 (define_insn "zero_extendhisi2_and"
2867 [(set (match_operand:SI 0 "register_operand" "=r")
2868 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
2869 (clobber (reg:CC 17))]
2870 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2872 [(set_attr "type" "alu1")
2873 (set_attr "mode" "SI")])
2876 [(set (match_operand:SI 0 "register_operand" "")
2877 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
2878 (clobber (reg:CC 17))]
2879 "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2880 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
2881 (clobber (reg:CC 17))])]
2884 (define_insn "*zero_extendhisi2_movzwl"
2885 [(set (match_operand:SI 0 "register_operand" "=r")
2886 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
2887 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2888 "movz{wl|x}\t{%1, %0|%0, %1}"
2889 [(set_attr "type" "imovx")
2890 (set_attr "mode" "SI")])
2892 (define_expand "zero_extendqihi2"
2894 [(set (match_operand:HI 0 "register_operand" "")
2895 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2896 (clobber (reg:CC 17))])]
2900 (define_insn "*zero_extendqihi2_and"
2901 [(set (match_operand:HI 0 "register_operand" "=r,?&q")
2902 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
2903 (clobber (reg:CC 17))]
2904 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2906 [(set_attr "type" "alu1")
2907 (set_attr "mode" "HI")])
2909 (define_insn "*zero_extendqihi2_movzbw_and"
2910 [(set (match_operand:HI 0 "register_operand" "=r,r")
2911 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
2912 (clobber (reg:CC 17))]
2913 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2915 [(set_attr "type" "imovx,alu1")
2916 (set_attr "mode" "HI")])
2918 (define_insn "*zero_extendqihi2_movzbw"
2919 [(set (match_operand:HI 0 "register_operand" "=r")
2920 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
2921 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
2922 "movz{bw|x}\t{%1, %0|%0, %1}"
2923 [(set_attr "type" "imovx")
2924 (set_attr "mode" "HI")])
2926 ;; For the movzbw case strip only the clobber
2928 [(set (match_operand:HI 0 "register_operand" "")
2929 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2930 (clobber (reg:CC 17))]
2932 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
2933 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
2934 [(set (match_operand:HI 0 "register_operand" "")
2935 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))])
2937 ;; When source and destination does not overlap, clear destination
2938 ;; first and then do the movb
2940 [(set (match_operand:HI 0 "register_operand" "")
2941 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
2942 (clobber (reg:CC 17))]
2944 && ANY_QI_REG_P (operands[0])
2945 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
2946 && !reg_overlap_mentioned_p (operands[0], operands[1])"
2947 [(set (match_dup 0) (const_int 0))
2948 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2949 "operands[2] = gen_lowpart (QImode, operands[0]);")
2951 ;; Rest is handled by single and.
2953 [(set (match_operand:HI 0 "register_operand" "")
2954 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))
2955 (clobber (reg:CC 17))]
2957 && true_regnum (operands[0]) == true_regnum (operands[1])"
2958 [(parallel [(set (match_dup 0) (and:HI (match_dup 0) (const_int 255)))
2959 (clobber (reg:CC 17))])]
2962 (define_expand "zero_extendqisi2"
2964 [(set (match_operand:SI 0 "register_operand" "")
2965 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
2966 (clobber (reg:CC 17))])]
2970 (define_insn "*zero_extendqisi2_and"
2971 [(set (match_operand:SI 0 "register_operand" "=r,?&q")
2972 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
2973 (clobber (reg:CC 17))]
2974 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
2976 [(set_attr "type" "alu1")
2977 (set_attr "mode" "SI")])
2979 (define_insn "*zero_extendqisi2_movzbw_and"
2980 [(set (match_operand:SI 0 "register_operand" "=r,r")
2981 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
2982 (clobber (reg:CC 17))]
2983 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
2985 [(set_attr "type" "imovx,alu1")
2986 (set_attr "mode" "SI")])
2988 (define_insn "*zero_extendqisi2_movzbw"
2989 [(set (match_operand:SI 0 "register_operand" "=r")
2990 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
2991 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
2992 "movz{bl|x}\t{%1, %0|%0, %1}"
2993 [(set_attr "type" "imovx")
2994 (set_attr "mode" "SI")])
2996 ;; For the movzbl case strip only the clobber
2998 [(set (match_operand:SI 0 "register_operand" "")
2999 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3000 (clobber (reg:CC 17))]
3002 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
3003 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3005 (zero_extend:SI (match_dup 1)))])
3007 ;; When source and destination does not overlap, clear destination
3008 ;; first and then do the movb
3010 [(set (match_operand:SI 0 "register_operand" "")
3011 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3012 (clobber (reg:CC 17))]
3014 && ANY_QI_REG_P (operands[0])
3015 && (ANY_QI_REG_P (operands[1]) || GET_CODE (operands[1]) == MEM)
3016 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3017 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3018 [(set (match_dup 0) (const_int 0))
3019 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3020 "operands[2] = gen_lowpart (QImode, operands[0]);")
3022 ;; Rest is handled by single and.
3024 [(set (match_operand:SI 0 "register_operand" "")
3025 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
3026 (clobber (reg:CC 17))]
3028 && true_regnum (operands[0]) == true_regnum (operands[1])"
3029 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 255)))
3030 (clobber (reg:CC 17))])]
3033 ;; %%% Kill me once multi-word ops are sane.
3034 (define_expand "zero_extendsidi2"
3035 [(set (match_operand:DI 0 "register_operand" "=r")
3036 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
3040 emit_insn (gen_zero_extendsidi2_32 (operands[0], operands[1]));
3045 (define_insn "zero_extendsidi2_32"
3046 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o")
3047 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r")))
3048 (clobber (reg:CC 17))]
3051 [(set_attr "mode" "SI")])
3053 (define_insn "zero_extendsidi2_rex64"
3054 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
3055 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0")))]
3058 mov\t{%k1, %k0|%k0, %k1}
3060 [(set_attr "type" "imovx,imov")
3061 (set_attr "mode" "SI,DI")])
3064 [(set (match_operand:DI 0 "memory_operand" "")
3065 (zero_extend:DI (match_dup 0)))]
3067 [(set (match_dup 4) (const_int 0))]
3068 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3071 [(set (match_operand:DI 0 "register_operand" "")
3072 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3073 (clobber (reg:CC 17))]
3074 "!TARGET_64BIT && reload_completed
3075 && true_regnum (operands[0]) == true_regnum (operands[1])"
3076 [(set (match_dup 4) (const_int 0))]
3077 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3080 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3081 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3082 (clobber (reg:CC 17))]
3083 "!TARGET_64BIT && reload_completed"
3084 [(set (match_dup 3) (match_dup 1))
3085 (set (match_dup 4) (const_int 0))]
3086 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3088 (define_insn "zero_extendhidi2"
3089 [(set (match_operand:DI 0 "register_operand" "=r,r")
3090 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
3093 movz{wl|x}\t{%1, %k0|%k0, %1}
3094 movz{wq|x}\t{%1, %0|%0, %1}"
3095 [(set_attr "type" "imovx")
3096 (set_attr "mode" "SI,DI")])
3098 (define_insn "zero_extendqidi2"
3099 [(set (match_operand:DI 0 "register_operand" "=r,r")
3100 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "Q,m")))]
3103 movz{bl|x}\t{%1, %k0|%k0, %1}
3104 movz{bq|x}\t{%1, %0|%0, %1}"
3105 [(set_attr "type" "imovx")
3106 (set_attr "mode" "SI,DI")])
3108 ;; Sign extension instructions
3110 (define_expand "extendsidi2"
3111 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3112 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3113 (clobber (reg:CC 17))
3114 (clobber (match_scratch:SI 2 ""))])]
3119 emit_insn (gen_extendsidi2_rex64 (operands[0], operands[1]));
3124 (define_insn "*extendsidi2_1"
3125 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3126 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3127 (clobber (reg:CC 17))
3128 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3132 (define_insn "extendsidi2_rex64"
3133 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3134 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3138 movs{lq|x}\t{%1,%0|%0, %1}"
3139 [(set_attr "type" "imovx")
3140 (set_attr "mode" "DI")
3141 (set_attr "prefix_0f" "0")
3142 (set_attr "modrm" "0,1")])
3144 (define_insn "extendhidi2"
3145 [(set (match_operand:DI 0 "register_operand" "=r")
3146 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3148 "movs{wq|x}\t{%1,%0|%0, %1}"
3149 [(set_attr "type" "imovx")
3150 (set_attr "mode" "DI")])
3152 (define_insn "extendqidi2"
3153 [(set (match_operand:DI 0 "register_operand" "=r")
3154 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3156 "movs{bq|x}\t{%1,%0|%0, %1}"
3157 [(set_attr "type" "imovx")
3158 (set_attr "mode" "DI")])
3160 ;; Extend to memory case when source register does die.
3162 [(set (match_operand:DI 0 "memory_operand" "")
3163 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3164 (clobber (reg:CC 17))
3165 (clobber (match_operand:SI 2 "register_operand" ""))]
3167 && dead_or_set_p (insn, operands[1])
3168 && !reg_mentioned_p (operands[1], operands[0]))"
3169 [(set (match_dup 3) (match_dup 1))
3170 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3171 (clobber (reg:CC 17))])
3172 (set (match_dup 4) (match_dup 1))]
3173 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3175 ;; Extend to memory case when source register does not die.
3177 [(set (match_operand:DI 0 "memory_operand" "")
3178 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3179 (clobber (reg:CC 17))
3180 (clobber (match_operand:SI 2 "register_operand" ""))]
3184 split_di (&operands[0], 1, &operands[3], &operands[4]);
3186 emit_move_insn (operands[3], operands[1]);
3188 /* Generate a cltd if possible and doing so it profitable. */
3189 if (true_regnum (operands[1]) == 0
3190 && true_regnum (operands[2]) == 1
3191 && (optimize_size || TARGET_USE_CLTD))
3193 emit_insn (gen_ashrsi3_31 (operands[2], operands[1], GEN_INT (31)));
3197 emit_move_insn (operands[2], operands[1]);
3198 emit_insn (gen_ashrsi3_31 (operands[2], operands[2], GEN_INT (31)));
3200 emit_move_insn (operands[4], operands[2]);
3204 ;; Extend to register case. Optimize case where source and destination
3205 ;; registers match and cases where we can use cltd.
3207 [(set (match_operand:DI 0 "register_operand" "")
3208 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3209 (clobber (reg:CC 17))
3210 (clobber (match_scratch:SI 2 ""))]
3214 split_di (&operands[0], 1, &operands[3], &operands[4]);
3216 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3217 emit_move_insn (operands[3], operands[1]);
3219 /* Generate a cltd if possible and doing so it profitable. */
3220 if (true_regnum (operands[3]) == 0
3221 && (optimize_size || TARGET_USE_CLTD))
3223 emit_insn (gen_ashrsi3_31 (operands[4], operands[3], GEN_INT (31)));
3227 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3228 emit_move_insn (operands[4], operands[1]);
3230 emit_insn (gen_ashrsi3_31 (operands[4], operands[4], GEN_INT (31)));
3234 (define_insn "extendhisi2"
3235 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3236 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3239 switch (get_attr_prefix_0f (insn))
3242 return "{cwtl|cwde}";
3244 return "movs{wl|x}\t{%1,%0|%0, %1}";
3247 [(set_attr "type" "imovx")
3248 (set_attr "mode" "SI")
3249 (set (attr "prefix_0f")
3250 ;; movsx is short decodable while cwtl is vector decoded.
3251 (if_then_else (and (eq_attr "cpu" "!k6")
3252 (eq_attr "alternative" "0"))
3254 (const_string "1")))
3256 (if_then_else (eq_attr "prefix_0f" "0")
3258 (const_string "1")))])
3260 (define_insn "*extendhisi2_zext"
3261 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3263 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm"))))]
3266 switch (get_attr_prefix_0f (insn))
3269 return "{cwtl|cwde}";
3271 return "movs{wl|x}\t{%1,%k0|%k0, %1}";
3274 [(set_attr "type" "imovx")
3275 (set_attr "mode" "SI")
3276 (set (attr "prefix_0f")
3277 ;; movsx is short decodable while cwtl is vector decoded.
3278 (if_then_else (and (eq_attr "cpu" "!k6")
3279 (eq_attr "alternative" "0"))
3281 (const_string "1")))
3283 (if_then_else (eq_attr "prefix_0f" "0")
3285 (const_string "1")))])
3287 (define_insn "extendqihi2"
3288 [(set (match_operand:HI 0 "register_operand" "=*a,r")
3289 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "*0,qm")))]
3292 switch (get_attr_prefix_0f (insn))
3295 return "{cbtw|cbw}";
3297 return "movs{bw|x}\t{%1,%0|%0, %1}";
3300 [(set_attr "type" "imovx")
3301 (set_attr "mode" "HI")
3302 (set (attr "prefix_0f")
3303 ;; movsx is short decodable while cwtl is vector decoded.
3304 (if_then_else (and (eq_attr "cpu" "!k6")
3305 (eq_attr "alternative" "0"))
3307 (const_string "1")))
3309 (if_then_else (eq_attr "prefix_0f" "0")
3311 (const_string "1")))])
3313 (define_insn "extendqisi2"
3314 [(set (match_operand:SI 0 "register_operand" "=r")
3315 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3317 "movs{bl|x}\t{%1,%0|%0, %1}"
3318 [(set_attr "type" "imovx")
3319 (set_attr "mode" "SI")])
3321 (define_insn "*extendqisi2_zext"
3322 [(set (match_operand:DI 0 "register_operand" "=r")
3324 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm"))))]
3326 "movs{bl|x}\t{%1,%k0|%k0, %1}"
3327 [(set_attr "type" "imovx")
3328 (set_attr "mode" "SI")])
3330 ;; Conversions between float and double.
3332 ;; These are all no-ops in the model used for the 80387. So just
3335 ;; %%% Kill these when call knows how to work out a DFmode push earlier.
3336 (define_insn "*dummy_extendsfdf2"
3337 [(set (match_operand:DF 0 "push_operand" "=<")
3338 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fY")))]
3343 [(set (match_operand:DF 0 "push_operand" "")
3344 (float_extend:DF (match_operand:SF 1 "register_operand" "")))]
3345 "!TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3346 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
3347 (set (mem:DF (reg:SI 7)) (float_extend:DF (match_dup 1)))])
3350 [(set (match_operand:DF 0 "push_operand" "")
3351 (float_extend:DF (match_operand:SF 1 "register_operand" "")))]
3352 "TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3353 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
3354 (set (mem:DF (reg:DI 7)) (float_extend:DF (match_dup 1)))])
3356 (define_insn "*dummy_extendsfxf2"
3357 [(set (match_operand:XF 0 "push_operand" "=<")
3358 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "f")))]
3363 [(set (match_operand:XF 0 "push_operand" "")
3364 (float_extend:XF (match_operand:SF 1 "register_operand" "")))]
3365 "!TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3366 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12)))
3367 (set (mem:XF (reg:SI 7)) (float_extend:XF (match_dup 1)))])
3369 (define_insn "*dummy_extendsftf2"
3370 [(set (match_operand:TF 0 "push_operand" "=<")
3371 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f")))]
3376 [(set (match_operand:TF 0 "push_operand" "")
3377 (float_extend:TF (match_operand:SF 1 "register_operand" "")))]
3378 "!TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3379 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
3380 (set (mem:TF (reg:SI 7)) (float_extend:TF (match_dup 1)))])
3383 [(set (match_operand:TF 0 "push_operand" "")
3384 (float_extend:TF (match_operand:SF 1 "register_operand" "")))]
3385 "TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3386 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
3387 (set (mem:DF (reg:DI 7)) (float_extend:TF (match_dup 1)))])
3389 (define_insn "*dummy_extenddfxf2"
3390 [(set (match_operand:XF 0 "push_operand" "=<")
3391 (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "f")))]
3396 [(set (match_operand:XF 0 "push_operand" "")
3397 (float_extend:XF (match_operand:DF 1 "register_operand" "")))]
3398 "!TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3399 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12)))
3400 (set (mem:DF (reg:SI 7)) (float_extend:XF (match_dup 1)))])
3402 (define_insn "*dummy_extenddftf2"
3403 [(set (match_operand:TF 0 "push_operand" "=<")
3404 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f")))]
3409 [(set (match_operand:TF 0 "push_operand" "")
3410 (float_extend:TF (match_operand:DF 1 "register_operand" "")))]
3411 "!TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3412 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
3413 (set (mem:TF (reg:SI 7)) (float_extend:XF (match_dup 1)))])
3416 [(set (match_operand:TF 0 "push_operand" "")
3417 (float_extend:TF (match_operand:DF 1 "register_operand" "")))]
3418 "TARGET_64BIT && FP_REGNO_P (REGNO (operands[1]))"
3419 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
3420 (set (mem:TF (reg:DI 7)) (float_extend:TF (match_dup 1)))])
3422 (define_expand "extendsfdf2"
3423 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3424 (float_extend:DF (match_operand:SF 1 "general_operand" "")))]
3425 "TARGET_80387 || TARGET_SSE2"
3427 /* ??? Needed for compress_float_constant since all fp constants
3428 are LEGITIMATE_CONSTANT_P. */
3429 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3430 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3431 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3432 operands[1] = force_reg (SFmode, operands[1]);
3435 (define_insn "*extendsfdf2_1"
3436 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,mf#Y,Y#f")
3437 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm#Y,f#Y,mY#f")))]
3438 "(TARGET_80387 || TARGET_SSE2)
3439 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3441 switch (which_alternative)
3444 if (REG_P (operands[1])
3445 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3447 else if (STACK_TOP_P (operands[0]))
3448 return "fld%z1\t%y1";
3453 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3454 return "fstp%z0\t%y0";
3457 return "fst%z0\t%y0";
3459 return "cvtss2sd\t{%1, %0|%0, %1}";
3465 [(set_attr "type" "fmov,fmov,ssecvt")
3466 (set_attr "mode" "SF,XF,DF")])
3468 (define_insn "*extendsfdf2_1_sse_only"
3469 [(set (match_operand:DF 0 "register_operand" "=Y")
3470 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "mY")))]
3471 "!TARGET_80387 && TARGET_SSE2
3472 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3473 "cvtss2sd\t{%1, %0|%0, %1}"
3474 [(set_attr "type" "ssecvt")
3475 (set_attr "mode" "DF")])
3477 (define_expand "extendsfxf2"
3478 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3479 (float_extend:XF (match_operand:SF 1 "general_operand" "")))]
3480 "!TARGET_64BIT && TARGET_80387"
3482 /* ??? Needed for compress_float_constant since all fp constants
3483 are LEGITIMATE_CONSTANT_P. */
3484 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3485 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3486 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3487 operands[1] = force_reg (SFmode, operands[1]);
3490 (define_insn "*extendsfxf2_1"
3491 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3492 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3493 "!TARGET_64BIT && TARGET_80387
3494 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3496 switch (which_alternative)
3499 if (REG_P (operands[1])
3500 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3502 else if (STACK_TOP_P (operands[0]))
3503 return "fld%z1\t%y1";
3508 /* There is no non-popping store to memory for XFmode. So if
3509 we need one, follow the store with a load. */
3510 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3511 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3513 return "fstp%z0\t%y0";
3519 [(set_attr "type" "fmov")
3520 (set_attr "mode" "SF,XF")])
3522 (define_expand "extendsftf2"
3523 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3524 (float_extend:TF (match_operand:SF 1 "general_operand" "")))]
3527 /* ??? Needed for compress_float_constant since all fp constants
3528 are LEGITIMATE_CONSTANT_P. */
3529 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3530 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3531 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3532 operands[1] = force_reg (SFmode, operands[1]);
3535 (define_insn "*extendsftf2_1"
3536 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m")
3537 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3539 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3541 switch (which_alternative)
3544 if (REG_P (operands[1])
3545 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3547 else if (STACK_TOP_P (operands[0]))
3548 return "fld%z1\t%y1";
3553 /* There is no non-popping store to memory for XFmode. So if
3554 we need one, follow the store with a load. */
3555 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3556 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3558 return "fstp%z0\t%y0";
3564 [(set_attr "type" "fmov")
3565 (set_attr "mode" "SF,XF")])
3567 (define_expand "extenddfxf2"
3568 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3569 (float_extend:XF (match_operand:DF 1 "general_operand" "")))]
3570 "!TARGET_64BIT && TARGET_80387"
3572 /* ??? Needed for compress_float_constant since all fp constants
3573 are LEGITIMATE_CONSTANT_P. */
3574 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3575 operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
3576 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3577 operands[1] = force_reg (DFmode, operands[1]);
3580 (define_insn "*extenddfxf2_1"
3581 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3582 (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
3583 "!TARGET_64BIT && TARGET_80387
3584 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3586 switch (which_alternative)
3589 if (REG_P (operands[1])
3590 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3592 else if (STACK_TOP_P (operands[0]))
3593 return "fld%z1\t%y1";
3598 /* There is no non-popping store to memory for XFmode. So if
3599 we need one, follow the store with a load. */
3600 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3601 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3603 return "fstp%z0\t%y0";
3609 [(set_attr "type" "fmov")
3610 (set_attr "mode" "DF,XF")])
3612 (define_expand "extenddftf2"
3613 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3614 (float_extend:TF (match_operand:DF 1 "general_operand" "")))]
3617 /* ??? Needed for compress_float_constant since all fp constants
3618 are LEGITIMATE_CONSTANT_P. */
3619 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3620 operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
3621 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3622 operands[1] = force_reg (DFmode, operands[1]);
3625 (define_insn "*extenddftf2_1"
3626 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m")
3627 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
3629 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3631 switch (which_alternative)
3634 if (REG_P (operands[1])
3635 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3637 else if (STACK_TOP_P (operands[0]))
3638 return "fld%z1\t%y1";
3643 /* There is no non-popping store to memory for XFmode. So if
3644 we need one, follow the store with a load. */
3645 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3646 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3648 return "fstp%z0\t%y0";
3654 [(set_attr "type" "fmov")
3655 (set_attr "mode" "DF,XF")])
3657 ;; %%% This seems bad bad news.
3658 ;; This cannot output into an f-reg because there is no way to be sure
3659 ;; of truncating in that case. Otherwise this is just like a simple move
3660 ;; insn. So we pretend we can output to a reg in order to get better
3661 ;; register preferencing, but we really use a stack slot.
3663 (define_expand "truncdfsf2"
3664 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3666 (match_operand:DF 1 "register_operand" "")))
3667 (clobber (match_dup 2))])]
3668 "TARGET_80387 || TARGET_SSE2"
3671 operands[2] = assign_386_stack_local (SFmode, 0);
3674 emit_insn (gen_truncdfsf2_sse_only (operands[0], operands[1]));
3679 (define_insn "*truncdfsf2_1"
3680 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3682 (match_operand:DF 1 "register_operand" "f,f,f,f")))
3683 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3684 "TARGET_80387 && !TARGET_SSE2"
3686 switch (which_alternative)
3689 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3690 return "fstp%z0\t%y0";
3692 return "fst%z0\t%y0";
3697 [(set_attr "type" "fmov,multi,multi,multi")
3698 (set_attr "mode" "SF,SF,SF,SF")])
3700 (define_insn "*truncdfsf2_1_sse"
3701 [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m,?f#rx,?r#fx,?x#rf,Y")
3703 (match_operand:DF 1 "nonimmediate_operand" "f,f,f,f,mY")))
3704 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))]
3705 "TARGET_80387 && TARGET_SSE2"
3707 switch (which_alternative)
3710 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3711 return "fstp%z0\t%y0";
3713 return "fst%z0\t%y0";
3715 return "cvtsd2ss\t{%1, %0|%0, %1}";
3720 [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
3721 (set_attr "mode" "SF,SF,SF,SF,DF")])
3723 (define_insn "*truncdfsf2_2"
3724 [(set (match_operand:SF 0 "nonimmediate_operand" "=Y,!m")
3726 (match_operand:DF 1 "nonimmediate_operand" "mY,f")))]
3727 "TARGET_80387 && TARGET_SSE2
3728 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3730 switch (which_alternative)
3733 return "cvtsd2ss\t{%1, %0|%0, %1}";
3735 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3736 return "fstp%z0\t%y0";
3738 return "fst%z0\t%y0";
3743 [(set_attr "type" "ssecvt,fmov")
3744 (set_attr "mode" "DF,SF")])
3746 (define_insn "truncdfsf2_3"
3747 [(set (match_operand:SF 0 "memory_operand" "=m")
3749 (match_operand:DF 1 "register_operand" "f")))]
3752 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3753 return "fstp%z0\t%y0";
3755 return "fst%z0\t%y0";
3757 [(set_attr "type" "fmov")
3758 (set_attr "mode" "SF")])
3760 (define_insn "truncdfsf2_sse_only"
3761 [(set (match_operand:SF 0 "register_operand" "=Y")
3763 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
3764 "!TARGET_80387 && TARGET_SSE2"
3765 "cvtsd2ss\t{%1, %0|%0, %1}"
3766 [(set_attr "type" "ssecvt")
3767 (set_attr "mode" "DF")])
3770 [(set (match_operand:SF 0 "memory_operand" "")
3772 (match_operand:DF 1 "register_operand" "")))
3773 (clobber (match_operand:SF 2 "memory_operand" ""))]
3775 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3779 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3781 (match_operand:DF 1 "nonimmediate_operand" "")))
3782 (clobber (match_operand 2 "" ""))]
3783 "TARGET_80387 && reload_completed
3784 && !FP_REG_P (operands[0]) && !FP_REG_P (operands[1])"
3785 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3789 [(set (match_operand:SF 0 "register_operand" "")
3791 (match_operand:DF 1 "register_operand" "")))
3792 (clobber (match_operand:SF 2 "memory_operand" ""))]
3793 "TARGET_80387 && reload_completed
3794 && FP_REG_P (operands[1])"
3795 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
3796 (set (match_dup 0) (match_dup 2))]
3799 (define_expand "truncxfsf2"
3800 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3802 (match_operand:XF 1 "register_operand" "")))
3803 (clobber (match_dup 2))])]
3804 "!TARGET_64BIT && TARGET_80387"
3805 "operands[2] = assign_386_stack_local (SFmode, 0);")
3807 (define_insn "*truncxfsf2_1"
3808 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3810 (match_operand:XF 1 "register_operand" "f,f,f,f")))
3811 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3812 "!TARGET_64BIT && TARGET_80387"
3814 switch (which_alternative)
3817 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3818 return "fstp%z0\t%y0";
3820 return "fst%z0\t%y0";
3825 [(set_attr "type" "fmov,multi,multi,multi")
3826 (set_attr "mode" "SF")])
3828 (define_insn "*truncxfsf2_2"
3829 [(set (match_operand:SF 0 "memory_operand" "=m")
3831 (match_operand:XF 1 "register_operand" "f")))]
3832 "!TARGET_64BIT && TARGET_80387"
3834 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3835 return "fstp%z0\t%y0";
3837 return "fst%z0\t%y0";
3839 [(set_attr "type" "fmov")
3840 (set_attr "mode" "SF")])
3843 [(set (match_operand:SF 0 "memory_operand" "")
3845 (match_operand:XF 1 "register_operand" "")))
3846 (clobber (match_operand:SF 2 "memory_operand" ""))]
3848 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3852 [(set (match_operand:SF 0 "register_operand" "")
3854 (match_operand:XF 1 "register_operand" "")))
3855 (clobber (match_operand:SF 2 "memory_operand" ""))]
3856 "TARGET_80387 && reload_completed"
3857 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
3858 (set (match_dup 0) (match_dup 2))]
3861 (define_expand "trunctfsf2"
3862 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3864 (match_operand:TF 1 "register_operand" "")))
3865 (clobber (match_dup 2))])]
3867 "operands[2] = assign_386_stack_local (SFmode, 0);")
3869 (define_insn "*trunctfsf2_1"
3870 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3872 (match_operand:TF 1 "register_operand" "f,f,f,f")))
3873 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3876 switch (which_alternative)
3879 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3880 return "fstp%z0\t%y0";
3882 return "fst%z0\t%y0";
3887 [(set_attr "type" "fmov,multi,multi,multi")
3888 (set_attr "mode" "SF")])
3890 (define_insn "*trunctfsf2_2"
3891 [(set (match_operand:SF 0 "memory_operand" "=m")
3893 (match_operand:TF 1 "register_operand" "f")))]
3896 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3897 return "fstp%z0\t%y0";
3899 return "fst%z0\t%y0";
3901 [(set_attr "type" "fmov")
3902 (set_attr "mode" "SF")])
3905 [(set (match_operand:SF 0 "memory_operand" "")
3907 (match_operand:TF 1 "register_operand" "")))
3908 (clobber (match_operand:SF 2 "memory_operand" ""))]
3910 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
3914 [(set (match_operand:SF 0 "register_operand" "")
3916 (match_operand:TF 1 "register_operand" "")))
3917 (clobber (match_operand:SF 2 "memory_operand" ""))]
3918 "TARGET_80387 && reload_completed"
3919 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
3920 (set (match_dup 0) (match_dup 2))]
3924 (define_expand "truncxfdf2"
3925 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
3927 (match_operand:XF 1 "register_operand" "")))
3928 (clobber (match_dup 2))])]
3929 "!TARGET_64BIT && TARGET_80387"
3930 "operands[2] = assign_386_stack_local (DFmode, 0);")
3932 (define_insn "*truncxfdf2_1"
3933 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")
3935 (match_operand:XF 1 "register_operand" "f,f,f,f")))
3936 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))]
3937 "!TARGET_64BIT && TARGET_80387"
3939 switch (which_alternative)
3942 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3943 return "fstp%z0\t%y0";
3945 return "fst%z0\t%y0";
3951 [(set_attr "type" "fmov,multi,multi,multi")
3952 (set_attr "mode" "DF")])
3954 (define_insn "*truncxfdf2_2"
3955 [(set (match_operand:DF 0 "memory_operand" "=m")
3957 (match_operand:XF 1 "register_operand" "f")))]
3958 "!TARGET_64BIT && TARGET_80387"
3960 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3961 return "fstp%z0\t%y0";
3963 return "fst%z0\t%y0";
3965 [(set_attr "type" "fmov")
3966 (set_attr "mode" "DF")])
3969 [(set (match_operand:DF 0 "memory_operand" "")
3971 (match_operand:XF 1 "register_operand" "")))
3972 (clobber (match_operand:DF 2 "memory_operand" ""))]
3974 [(set (match_dup 0) (float_truncate:DF (match_dup 1)))]
3978 [(set (match_operand:DF 0 "register_operand" "")
3980 (match_operand:XF 1 "register_operand" "")))
3981 (clobber (match_operand:DF 2 "memory_operand" ""))]
3982 "TARGET_80387 && reload_completed"
3983 [(set (match_dup 2) (float_truncate:DF (match_dup 1)))
3984 (set (match_dup 0) (match_dup 2))]
3987 (define_expand "trunctfdf2"
3988 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
3990 (match_operand:TF 1 "register_operand" "")))
3991 (clobber (match_dup 2))])]
3993 "operands[2] = assign_386_stack_local (DFmode, 0);")
3995 (define_insn "*trunctfdf2_1"
3996 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")
3998 (match_operand:TF 1 "register_operand" "f,f,f,f")))
3999 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))]
4002 switch (which_alternative)
4005 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4006 return "fstp%z0\t%y0";
4008 return "fst%z0\t%y0";
4014 [(set_attr "type" "fmov,multi,multi,multi")
4015 (set_attr "mode" "DF")])
4017 (define_insn "*trunctfdf2_2"
4018 [(set (match_operand:DF 0 "memory_operand" "=m")
4020 (match_operand:TF 1 "register_operand" "f")))]
4023 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4024 return "fstp%z0\t%y0";
4026 return "fst%z0\t%y0";
4028 [(set_attr "type" "fmov")
4029 (set_attr "mode" "DF")])
4032 [(set (match_operand:DF 0 "memory_operand" "")
4034 (match_operand:TF 1 "register_operand" "")))
4035 (clobber (match_operand:DF 2 "memory_operand" ""))]
4037 [(set (match_dup 0) (float_truncate:DF (match_dup 1)))]
4041 [(set (match_operand:DF 0 "register_operand" "")
4043 (match_operand:TF 1 "register_operand" "")))
4044 (clobber (match_operand:DF 2 "memory_operand" ""))]
4045 "TARGET_80387 && reload_completed"
4046 [(set (match_dup 2) (float_truncate:DF (match_dup 1)))
4047 (set (match_dup 0) (match_dup 2))]
4051 ;; %%% Break up all these bad boys.
4053 ;; Signed conversion to DImode.
4055 (define_expand "fix_truncxfdi2"
4056 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4057 (fix:DI (match_operand:XF 1 "register_operand" "")))]
4058 "!TARGET_64BIT && TARGET_80387"
4061 (define_expand "fix_trunctfdi2"
4062 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4063 (fix:DI (match_operand:TF 1 "register_operand" "")))]
4067 (define_expand "fix_truncdfdi2"
4068 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4069 (fix:DI (match_operand:DF 1 "register_operand" "")))]
4070 "TARGET_80387 || (TARGET_SSE2 && TARGET_64BIT)"
4072 if (TARGET_64BIT && TARGET_SSE2)
4074 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4075 emit_insn (gen_fix_truncdfdi_sse (out, operands[1]));
4076 if (out != operands[0])
4077 emit_move_insn (operands[0], out);
4082 (define_expand "fix_truncsfdi2"
4083 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4084 (fix:DI (match_operand:SF 1 "register_operand" "")))]
4085 "TARGET_80387 || (TARGET_SSE && TARGET_64BIT)"
4087 if (TARGET_SSE && TARGET_64BIT)
4089 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4090 emit_insn (gen_fix_truncsfdi_sse (out, operands[1]));
4091 if (out != operands[0])
4092 emit_move_insn (operands[0], out);
4097 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4098 ;; of the machinery.
4099 (define_insn_and_split "*fix_truncdi_1"
4100 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4101 (fix:DI (match_operand 1 "register_operand" "f,f")))]
4102 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4103 && !reload_completed && !reload_in_progress
4104 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4109 operands[2] = assign_386_stack_local (HImode, 1);
4110 operands[3] = assign_386_stack_local (HImode, 2);
4111 if (memory_operand (operands[0], VOIDmode))
4112 emit_insn (gen_fix_truncdi_memory (operands[0], operands[1],
4113 operands[2], operands[3]));
4116 operands[4] = assign_386_stack_local (DImode, 0);
4117 emit_insn (gen_fix_truncdi_nomemory (operands[0], operands[1],
4118 operands[2], operands[3],
4123 [(set_attr "type" "fistp")])
4125 (define_insn "fix_truncdi_nomemory"
4126 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4127 (fix:DI (match_operand 1 "register_operand" "f,f")))
4128 (use (match_operand:HI 2 "memory_operand" "m,m"))
4129 (use (match_operand:HI 3 "memory_operand" "m,m"))
4130 (clobber (match_operand:DI 4 "memory_operand" "=m,m"))
4131 (clobber (match_scratch:DF 5 "=&1f,&1f"))]
4132 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4133 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4135 [(set_attr "type" "fistp")])
4137 (define_insn "fix_truncdi_memory"
4138 [(set (match_operand:DI 0 "memory_operand" "=m")
4139 (fix:DI (match_operand 1 "register_operand" "f")))
4140 (use (match_operand:HI 2 "memory_operand" "m"))
4141 (use (match_operand:HI 3 "memory_operand" "m"))
4142 (clobber (match_scratch:DF 4 "=&1f"))]
4143 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4144 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4145 "* operands[5] = operands[4]; return output_fix_trunc (insn, operands);"
4146 [(set_attr "type" "fistp")])
4149 [(set (match_operand:DI 0 "register_operand" "")
4150 (fix:DI (match_operand 1 "register_operand" "")))
4151 (use (match_operand:HI 2 "memory_operand" ""))
4152 (use (match_operand:HI 3 "memory_operand" ""))
4153 (clobber (match_operand:DI 4 "memory_operand" ""))
4154 (clobber (match_scratch 5 ""))]
4156 [(parallel [(set (match_dup 4) (fix:DI (match_dup 1)))
4159 (clobber (match_dup 5))])
4160 (set (match_dup 0) (match_dup 4))]
4164 [(set (match_operand:DI 0 "memory_operand" "")
4165 (fix:DI (match_operand 1 "register_operand" "")))
4166 (use (match_operand:HI 2 "memory_operand" ""))
4167 (use (match_operand:HI 3 "memory_operand" ""))
4168 (clobber (match_operand:DI 4 "memory_operand" ""))
4169 (clobber (match_scratch 5 ""))]
4171 [(parallel [(set (match_dup 0) (fix:DI (match_dup 1)))
4174 (clobber (match_dup 5))])]
4177 ;; When SSE available, it is always faster to use it!
4178 (define_insn "fix_truncsfdi_sse"
4179 [(set (match_operand:DI 0 "register_operand" "=r")
4180 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
4181 "TARGET_64BIT && TARGET_SSE"
4182 "cvttss2si{q}\t{%1, %0|%0, %1}"
4183 [(set_attr "type" "ssecvt")])
4185 (define_insn "fix_truncdfdi_sse"
4186 [(set (match_operand:DI 0 "register_operand" "=r")
4187 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
4188 "TARGET_64BIT && TARGET_SSE2"
4189 "cvttsd2si{q}\t{%1, %0|%0, %1}"
4190 [(set_attr "type" "ssecvt")])
4192 ;; Signed conversion to SImode.
4194 (define_expand "fix_truncxfsi2"
4195 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4196 (fix:SI (match_operand:XF 1 "register_operand" "")))]
4197 "!TARGET_64BIT && TARGET_80387"
4200 (define_expand "fix_trunctfsi2"
4201 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4202 (fix:SI (match_operand:TF 1 "register_operand" "")))]
4206 (define_expand "fix_truncdfsi2"
4207 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4208 (fix:SI (match_operand:DF 1 "register_operand" "")))]
4209 "TARGET_80387 || TARGET_SSE2"
4213 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4214 emit_insn (gen_fix_truncdfsi_sse (out, operands[1]));
4215 if (out != operands[0])
4216 emit_move_insn (operands[0], out);
4221 (define_expand "fix_truncsfsi2"
4222 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4223 (fix:SI (match_operand:SF 1 "register_operand" "")))]
4224 "TARGET_80387 || TARGET_SSE"
4228 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4229 emit_insn (gen_fix_truncsfsi_sse (out, operands[1]));
4230 if (out != operands[0])
4231 emit_move_insn (operands[0], out);
4236 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4237 ;; of the machinery.
4238 (define_insn_and_split "*fix_truncsi_1"
4239 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4240 (fix:SI (match_operand 1 "register_operand" "f,f")))]
4241 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4242 && !reload_completed && !reload_in_progress
4243 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4248 operands[2] = assign_386_stack_local (HImode, 1);
4249 operands[3] = assign_386_stack_local (HImode, 2);
4250 if (memory_operand (operands[0], VOIDmode))
4251 emit_insn (gen_fix_truncsi_memory (operands[0], operands[1],
4252 operands[2], operands[3]));
4255 operands[4] = assign_386_stack_local (SImode, 0);
4256 emit_insn (gen_fix_truncsi_nomemory (operands[0], operands[1],
4257 operands[2], operands[3],
4262 [(set_attr "type" "fistp")])
4264 (define_insn "fix_truncsi_nomemory"
4265 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4266 (fix:SI (match_operand 1 "register_operand" "f,f")))
4267 (use (match_operand:HI 2 "memory_operand" "m,m"))
4268 (use (match_operand:HI 3 "memory_operand" "m,m"))
4269 (clobber (match_operand:SI 4 "memory_operand" "=m,m"))]
4270 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4271 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4273 [(set_attr "type" "fistp")])
4275 (define_insn "fix_truncsi_memory"
4276 [(set (match_operand:SI 0 "memory_operand" "=m")
4277 (fix:SI (match_operand 1 "register_operand" "f")))
4278 (use (match_operand:HI 2 "memory_operand" "m"))
4279 (use (match_operand:HI 3 "memory_operand" "m"))]
4280 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4281 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4282 "* return output_fix_trunc (insn, operands);"
4283 [(set_attr "type" "fistp")])
4285 ;; When SSE available, it is always faster to use it!
4286 (define_insn "fix_truncsfsi_sse"
4287 [(set (match_operand:SI 0 "register_operand" "=r")
4288 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
4290 "cvttss2si\t{%1, %0|%0, %1}"
4291 [(set_attr "type" "ssecvt")])
4293 (define_insn "fix_truncdfsi_sse"
4294 [(set (match_operand:SI 0 "register_operand" "=r")
4295 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
4297 "cvttsd2si\t{%1, %0|%0, %1}"
4298 [(set_attr "type" "ssecvt")])
4301 [(set (match_operand:SI 0 "register_operand" "")
4302 (fix:SI (match_operand 1 "register_operand" "")))
4303 (use (match_operand:HI 2 "memory_operand" ""))
4304 (use (match_operand:HI 3 "memory_operand" ""))
4305 (clobber (match_operand:SI 4 "memory_operand" ""))]
4307 [(parallel [(set (match_dup 4) (fix:SI (match_dup 1)))
4309 (use (match_dup 3))])
4310 (set (match_dup 0) (match_dup 4))]
4314 [(set (match_operand:SI 0 "memory_operand" "")
4315 (fix:SI (match_operand 1 "register_operand" "")))
4316 (use (match_operand:HI 2 "memory_operand" ""))
4317 (use (match_operand:HI 3 "memory_operand" ""))
4318 (clobber (match_operand:SI 4 "memory_operand" ""))]
4320 [(parallel [(set (match_dup 0) (fix:SI (match_dup 1)))
4322 (use (match_dup 3))])]
4325 ;; Signed conversion to HImode.
4327 (define_expand "fix_truncxfhi2"
4328 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4329 (fix:HI (match_operand:XF 1 "register_operand" "")))]
4330 "!TARGET_64BIT && TARGET_80387"
4333 (define_expand "fix_trunctfhi2"
4334 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4335 (fix:HI (match_operand:TF 1 "register_operand" "")))]
4339 (define_expand "fix_truncdfhi2"
4340 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4341 (fix:HI (match_operand:DF 1 "register_operand" "")))]
4342 "TARGET_80387 && !TARGET_SSE2"
4345 (define_expand "fix_truncsfhi2"
4346 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4347 (fix:HI (match_operand:SF 1 "register_operand" "")))]
4348 "TARGET_80387 && !TARGET_SSE"
4351 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4352 ;; of the machinery.
4353 (define_insn_and_split "*fix_trunchi_1"
4354 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4355 (fix:HI (match_operand 1 "register_operand" "f,f")))]
4356 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4357 && !reload_completed && !reload_in_progress
4358 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4363 operands[2] = assign_386_stack_local (HImode, 1);
4364 operands[3] = assign_386_stack_local (HImode, 2);
4365 if (memory_operand (operands[0], VOIDmode))
4366 emit_insn (gen_fix_trunchi_memory (operands[0], operands[1],
4367 operands[2], operands[3]));
4370 operands[4] = assign_386_stack_local (HImode, 0);
4371 emit_insn (gen_fix_trunchi_nomemory (operands[0], operands[1],
4372 operands[2], operands[3],
4377 [(set_attr "type" "fistp")])
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")])
4390 (define_insn "fix_trunchi_memory"
4391 [(set (match_operand:HI 0 "memory_operand" "=m")
4392 (fix:HI (match_operand 1 "register_operand" "f")))
4393 (use (match_operand:HI 2 "memory_operand" "m"))
4394 (use (match_operand:HI 3 "memory_operand" "m"))]
4395 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4396 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4397 "* return output_fix_trunc (insn, operands);"
4398 [(set_attr "type" "fistp")])
4401 [(set (match_operand:HI 0 "memory_operand" "")
4402 (fix:HI (match_operand 1 "register_operand" "")))
4403 (use (match_operand:HI 2 "memory_operand" ""))
4404 (use (match_operand:HI 3 "memory_operand" ""))
4405 (clobber (match_operand:HI 4 "memory_operand" ""))]
4407 [(parallel [(set (match_dup 0) (fix:HI (match_dup 1)))
4409 (use (match_dup 3))])]
4413 [(set (match_operand:HI 0 "register_operand" "")
4414 (fix:HI (match_operand 1 "register_operand" "")))
4415 (use (match_operand:HI 2 "memory_operand" ""))
4416 (use (match_operand:HI 3 "memory_operand" ""))
4417 (clobber (match_operand:HI 4 "memory_operand" ""))]
4419 [(parallel [(set (match_dup 4) (fix:HI (match_dup 1)))
4422 (clobber (match_dup 4))])
4423 (set (match_dup 0) (match_dup 4))]
4427 (define_insn "x86_fnstcw_1"
4428 [(set (match_operand:HI 0 "memory_operand" "=m")
4429 (unspec:HI [(reg:HI 18)] UNSPEC_FSTCW))]
4432 [(set_attr "length" "2")
4433 (set_attr "mode" "HI")
4434 (set_attr "unit" "i387")
4435 (set_attr "ppro_uops" "few")])
4437 (define_insn "x86_fldcw_1"
4439 (unspec:HI [(match_operand:HI 0 "memory_operand" "m")] UNSPEC_FLDCW))]
4442 [(set_attr "length" "2")
4443 (set_attr "mode" "HI")
4444 (set_attr "unit" "i387")
4445 (set_attr "athlon_decode" "vector")
4446 (set_attr "ppro_uops" "few")])
4448 ;; Conversion between fixed point and floating point.
4450 ;; Even though we only accept memory inputs, the backend _really_
4451 ;; wants to be able to do this between registers.
4453 (define_insn "floathisf2"
4454 [(set (match_operand:SF 0 "register_operand" "=f,f")
4455 (float:SF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
4456 "TARGET_80387 && !TARGET_SSE"
4460 [(set_attr "type" "fmov,multi")
4461 (set_attr "mode" "SF")
4462 (set_attr "fp_int_src" "true")])
4464 (define_expand "floatsisf2"
4465 [(set (match_operand:SF 0 "register_operand" "")
4466 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
4467 "TARGET_SSE || TARGET_80387"
4470 (define_insn "*floatsisf2_i387"
4471 [(set (match_operand:SF 0 "register_operand" "=f,?f,x")
4472 (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,r,mr")))]
4473 "TARGET_80387 && (!TARGET_SSE || TARGET_MIX_SSE_I387)"
4477 cvtsi2ss\t{%1, %0|%0, %1}"
4478 [(set_attr "type" "fmov,multi,ssecvt")
4479 (set_attr "mode" "SF")
4480 (set_attr "fp_int_src" "true")])
4482 (define_insn "*floatsisf2_sse"
4483 [(set (match_operand:SF 0 "register_operand" "=x")
4484 (float:SF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
4486 "cvtsi2ss\t{%1, %0|%0, %1}"
4487 [(set_attr "type" "ssecvt")
4488 (set_attr "mode" "SF")
4489 (set_attr "fp_int_src" "true")])
4491 (define_expand "floatdisf2"
4492 [(set (match_operand:SF 0 "register_operand" "")
4493 (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
4494 "(TARGET_64BIT && TARGET_SSE) || TARGET_80387"
4497 (define_insn "*floatdisf2_i387_only"
4498 [(set (match_operand:SF 0 "register_operand" "=f,?f")
4499 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
4500 "TARGET_80387 && (!TARGET_SSE || !TARGET_64BIT || TARGET_MIX_SSE_I387)"
4504 [(set_attr "type" "fmov,multi")
4505 (set_attr "mode" "SF")
4506 (set_attr "fp_int_src" "true")])
4508 (define_insn "*floatdisf2_i387"
4509 [(set (match_operand:SF 0 "register_operand" "=f,?f,x")
4510 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r,mr")))]
4511 "TARGET_64BIT && TARGET_80387 && (!TARGET_SSE || TARGET_MIX_SSE_I387)"
4515 cvtsi2ss{q}\t{%1, %0|%0, %1}"
4516 [(set_attr "type" "fmov,multi,ssecvt")
4517 (set_attr "mode" "SF")
4518 (set_attr "fp_int_src" "true")])
4520 (define_insn "*floatdisf2_sse"
4521 [(set (match_operand:SF 0 "register_operand" "=x")
4522 (float:SF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
4523 "TARGET_64BIT && TARGET_SSE"
4524 "cvtsi2ss{q}\t{%1, %0|%0, %1}"
4525 [(set_attr "type" "ssecvt")
4526 (set_attr "mode" "SF")
4527 (set_attr "fp_int_src" "true")])
4529 (define_insn "floathidf2"
4530 [(set (match_operand:DF 0 "register_operand" "=f,f")
4531 (float:DF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
4532 "TARGET_80387 && !TARGET_SSE2"
4536 [(set_attr "type" "fmov,multi")
4537 (set_attr "mode" "DF")
4538 (set_attr "fp_int_src" "true")])
4540 (define_expand "floatsidf2"
4541 [(set (match_operand:DF 0 "register_operand" "")
4542 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))]
4543 "TARGET_80387 || TARGET_SSE2"
4546 (define_insn "*floatsidf2_i387"
4547 [(set (match_operand:DF 0 "register_operand" "=f,?f,Y")
4548 (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,r,mr")))]
4549 "TARGET_80387 && (!TARGET_SSE2 || TARGET_MIX_SSE_I387)"
4553 cvtsi2sd\t{%1, %0|%0, %1}"
4554 [(set_attr "type" "fmov,multi,ssecvt")
4555 (set_attr "mode" "DF")
4556 (set_attr "fp_int_src" "true")])
4558 (define_insn "*floatsidf2_sse"
4559 [(set (match_operand:DF 0 "register_operand" "=Y")
4560 (float:DF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
4562 "cvtsi2sd\t{%1, %0|%0, %1}"
4563 [(set_attr "type" "ssecvt")
4564 (set_attr "mode" "DF")
4565 (set_attr "fp_int_src" "true")])
4567 (define_expand "floatdidf2"
4568 [(set (match_operand:DF 0 "register_operand" "")
4569 (float:DF (match_operand:DI 1 "nonimmediate_operand" "")))]
4570 "(TARGET_64BIT && TARGET_SSE2) || TARGET_80387"
4573 (define_insn "*floatdidf2_i387_only"
4574 [(set (match_operand:DF 0 "register_operand" "=f,?f")
4575 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
4576 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_64BIT)"
4580 [(set_attr "type" "fmov,multi")
4581 (set_attr "mode" "DF")
4582 (set_attr "fp_int_src" "true")])
4584 (define_insn "*floatdidf2_i387"
4585 [(set (match_operand:DF 0 "register_operand" "=f,?f,Y")
4586 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r,mr")))]
4587 "TARGET_64BIT && TARGET_80387 && (!TARGET_SSE2 || TARGET_MIX_SSE_I387)"
4591 cvtsi2sd{q}\t{%1, %0|%0, %1}"
4592 [(set_attr "type" "fmov,multi,ssecvt")
4593 (set_attr "mode" "DF")
4594 (set_attr "fp_int_src" "true")])
4596 (define_insn "*floatdidf2_sse"
4597 [(set (match_operand:DF 0 "register_operand" "=Y")
4598 (float:DF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
4600 "cvtsi2sd{q}\t{%1, %0|%0, %1}"
4601 [(set_attr "type" "ssecvt")
4602 (set_attr "mode" "DF")
4603 (set_attr "fp_int_src" "true")])
4605 (define_insn "floathixf2"
4606 [(set (match_operand:XF 0 "register_operand" "=f,f")
4607 (float:XF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
4608 "!TARGET_64BIT && TARGET_80387"
4612 [(set_attr "type" "fmov,multi")
4613 (set_attr "mode" "XF")
4614 (set_attr "fp_int_src" "true")])
4616 (define_insn "floathitf2"
4617 [(set (match_operand:TF 0 "register_operand" "=f,f")
4618 (float:TF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
4623 [(set_attr "type" "fmov,multi")
4624 (set_attr "mode" "XF")
4625 (set_attr "fp_int_src" "true")])
4627 (define_insn "floatsixf2"
4628 [(set (match_operand:XF 0 "register_operand" "=f,f")
4629 (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,r")))]
4630 "!TARGET_64BIT && TARGET_80387"
4634 [(set_attr "type" "fmov,multi")
4635 (set_attr "mode" "XF")
4636 (set_attr "fp_int_src" "true")])
4638 (define_insn "floatsitf2"
4639 [(set (match_operand:TF 0 "register_operand" "=f,f")
4640 (float:TF (match_operand:SI 1 "nonimmediate_operand" "m,r")))]
4645 [(set_attr "type" "fmov,multi")
4646 (set_attr "mode" "XF")
4647 (set_attr "fp_int_src" "true")])
4649 (define_insn "floatdixf2"
4650 [(set (match_operand:XF 0 "register_operand" "=f,f")
4651 (float:XF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
4652 "!TARGET_64BIT && TARGET_80387"
4656 [(set_attr "type" "fmov,multi")
4657 (set_attr "mode" "XF")
4658 (set_attr "fp_int_src" "true")])
4660 (define_insn "floatditf2"
4661 [(set (match_operand:TF 0 "register_operand" "=f,f")
4662 (float:TF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
4667 [(set_attr "type" "fmov,multi")
4668 (set_attr "mode" "XF")
4669 (set_attr "fp_int_src" "true")])
4671 ;; %%% Kill these when reload knows how to do it.
4673 [(set (match_operand 0 "register_operand" "")
4674 (float (match_operand 1 "register_operand" "")))]
4675 "reload_completed && FLOAT_MODE_P (GET_MODE (operands[0]))
4676 && FP_REG_P (operands[0])"
4679 operands[2] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
4680 operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);
4681 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[2]));
4682 ix86_free_from_memory (GET_MODE (operands[1]));
4688 ;; %%% splits for addsidi3
4689 ; [(set (match_operand:DI 0 "nonimmediate_operand" "")
4690 ; (plus:DI (match_operand:DI 1 "general_operand" "")
4691 ; (zero_extend:DI (match_operand:SI 2 "general_operand" ""))))]
4693 (define_expand "adddi3"
4694 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4695 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4696 (match_operand:DI 2 "x86_64_general_operand" "")))
4697 (clobber (reg:CC 17))]
4699 "ix86_expand_binary_operator (PLUS, DImode, operands); DONE;")
4701 (define_insn "*adddi3_1"
4702 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
4703 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4704 (match_operand:DI 2 "general_operand" "roiF,riF")))
4705 (clobber (reg:CC 17))]
4710 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4711 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4712 (match_operand:DI 2 "general_operand" "")))
4713 (clobber (reg:CC 17))]
4714 "!TARGET_64BIT && reload_completed"
4715 [(parallel [(set (reg:CC 17) (unspec:CC [(match_dup 1) (match_dup 2)]
4717 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
4718 (parallel [(set (match_dup 3)
4719 (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
4722 (clobber (reg:CC 17))])]
4723 "split_di (operands+0, 1, operands+0, operands+3);
4724 split_di (operands+1, 1, operands+1, operands+4);
4725 split_di (operands+2, 1, operands+2, operands+5);")
4727 (define_insn "*adddi3_carry_rex64"
4728 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
4729 (plus:DI (plus:DI (ltu:DI (reg:CC 17) (const_int 0))
4730 (match_operand:DI 1 "nonimmediate_operand" "%0,0"))
4731 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
4732 (clobber (reg:CC 17))]
4733 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4734 "adc{q}\t{%2, %0|%0, %2}"
4735 [(set_attr "type" "alu")
4736 (set_attr "pent_pair" "pu")
4737 (set_attr "mode" "DI")
4738 (set_attr "ppro_uops" "few")])
4740 (define_insn "*adddi3_cc_rex64"
4742 (unspec:CC [(match_operand:DI 1 "nonimmediate_operand" "%0,0")
4743 (match_operand:DI 2 "x86_64_general_operand" "re,rm")]
4745 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
4746 (plus:DI (match_dup 1) (match_dup 2)))]
4747 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
4748 "add{q}\t{%2, %0|%0, %2}"
4749 [(set_attr "type" "alu")
4750 (set_attr "mode" "DI")])
4752 (define_insn "*addsi3_carry"
4753 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
4754 (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
4755 (match_operand:SI 1 "nonimmediate_operand" "%0,0"))
4756 (match_operand:SI 2 "general_operand" "ri,rm")))
4757 (clobber (reg:CC 17))]
4758 "ix86_binary_operator_ok (PLUS, SImode, operands)"
4759 "adc{l}\t{%2, %0|%0, %2}"
4760 [(set_attr "type" "alu")
4761 (set_attr "pent_pair" "pu")
4762 (set_attr "mode" "SI")
4763 (set_attr "ppro_uops" "few")])
4765 (define_insn "*addsi3_carry_zext"
4766 [(set (match_operand:DI 0 "register_operand" "=r")
4768 (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
4769 (match_operand:SI 1 "nonimmediate_operand" "%0"))
4770 (match_operand:SI 2 "general_operand" "rim"))))
4771 (clobber (reg:CC 17))]
4772 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
4773 "adc{l}\t{%2, %k0|%k0, %2}"
4774 [(set_attr "type" "alu")
4775 (set_attr "pent_pair" "pu")
4776 (set_attr "mode" "SI")
4777 (set_attr "ppro_uops" "few")])
4779 (define_insn "*addsi3_cc"
4781 (unspec:CC [(match_operand:SI 1 "nonimmediate_operand" "%0,0")
4782 (match_operand:SI 2 "general_operand" "ri,rm")]
4784 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
4785 (plus:SI (match_dup 1) (match_dup 2)))]
4786 "ix86_binary_operator_ok (PLUS, SImode, operands)"
4787 "add{l}\t{%2, %0|%0, %2}"
4788 [(set_attr "type" "alu")
4789 (set_attr "mode" "SI")])
4791 (define_insn "addqi3_cc"
4793 (unspec:CC [(match_operand:QI 1 "nonimmediate_operand" "%0,0")
4794 (match_operand:QI 2 "general_operand" "qi,qm")]
4796 (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
4797 (plus:QI (match_dup 1) (match_dup 2)))]
4798 "ix86_binary_operator_ok (PLUS, QImode, operands)"
4799 "add{b}\t{%2, %0|%0, %2}"
4800 [(set_attr "type" "alu")
4801 (set_attr "mode" "QI")])
4803 (define_expand "addsi3"
4804 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
4805 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
4806 (match_operand:SI 2 "general_operand" "")))
4807 (clobber (reg:CC 17))])]
4809 "ix86_expand_binary_operator (PLUS, SImode, operands); DONE;")
4811 (define_insn "*lea_1"
4812 [(set (match_operand:SI 0 "register_operand" "=r")
4813 (match_operand:SI 1 "address_operand" "p"))]
4815 "lea{l}\t{%a1, %0|%0, %a1}"
4816 [(set_attr "type" "lea")
4817 (set_attr "mode" "SI")])
4819 (define_insn "*lea_1_rex64"
4820 [(set (match_operand:SI 0 "register_operand" "=r")
4821 (subreg:SI (match_operand:DI 1 "address_operand" "p") 0))]
4823 "lea{l}\t{%a1, %0|%0, %a1}"
4824 [(set_attr "type" "lea")
4825 (set_attr "mode" "SI")])
4827 (define_insn "*lea_1_zext"
4828 [(set (match_operand:DI 0 "register_operand" "=r")
4829 (zero_extend:DI (subreg:SI (match_operand:DI 1 "address_operand" "p") 0)))]
4831 "lea{l}\t{%a1, %k0|%k0, %a1}"
4832 [(set_attr "type" "lea")
4833 (set_attr "mode" "SI")])
4835 (define_insn "*lea_2_rex64"
4836 [(set (match_operand:DI 0 "register_operand" "=r")
4837 (match_operand:DI 1 "address_operand" "p"))]
4839 "lea{q}\t{%a1, %0|%0, %a1}"
4840 [(set_attr "type" "lea")
4841 (set_attr "mode" "DI")])
4843 ;; The lea patterns for non-Pmodes needs to be matched by several
4844 ;; insns converted to real lea by splitters.
4846 (define_insn_and_split "*lea_general_1"
4847 [(set (match_operand 0 "register_operand" "=r")
4848 (plus (plus (match_operand 1 "index_register_operand" "r")
4849 (match_operand 2 "register_operand" "r"))
4850 (match_operand 3 "immediate_operand" "i")))]
4851 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
4852 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
4853 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
4854 && GET_MODE (operands[0]) == GET_MODE (operands[1])
4855 && GET_MODE (operands[0]) == GET_MODE (operands[2])
4856 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
4857 || GET_MODE (operands[3]) == VOIDmode)"
4859 "&& reload_completed"
4863 operands[0] = gen_lowpart (SImode, operands[0]);
4864 operands[1] = gen_lowpart (Pmode, operands[1]);
4865 operands[2] = gen_lowpart (Pmode, operands[2]);
4866 operands[3] = gen_lowpart (Pmode, operands[3]);
4867 pat = gen_rtx_PLUS (Pmode, gen_rtx_PLUS (Pmode, operands[1], operands[2]),
4869 if (Pmode != SImode)
4870 pat = gen_rtx_SUBREG (SImode, pat, 0);
4871 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
4874 [(set_attr "type" "lea")
4875 (set_attr "mode" "SI")])
4877 (define_insn_and_split "*lea_general_1_zext"
4878 [(set (match_operand:DI 0 "register_operand" "=r")
4880 (plus:SI (plus:SI (match_operand:SI 1 "index_register_operand" "r")
4881 (match_operand:SI 2 "register_operand" "r"))
4882 (match_operand:SI 3 "immediate_operand" "i"))))]
4885 "&& reload_completed"
4887 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (match_dup 1)
4889 (match_dup 3)) 0)))]
4891 operands[1] = gen_lowpart (Pmode, operands[1]);
4892 operands[2] = gen_lowpart (Pmode, operands[2]);
4893 operands[3] = gen_lowpart (Pmode, operands[3]);
4895 [(set_attr "type" "lea")
4896 (set_attr "mode" "SI")])
4898 (define_insn_and_split "*lea_general_2"
4899 [(set (match_operand 0 "register_operand" "=r")
4900 (plus (mult (match_operand 1 "index_register_operand" "r")
4901 (match_operand 2 "const248_operand" "i"))
4902 (match_operand 3 "nonmemory_operand" "ri")))]
4903 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
4904 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
4905 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
4906 && GET_MODE (operands[0]) == GET_MODE (operands[1])
4907 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
4908 || GET_MODE (operands[3]) == VOIDmode)"
4910 "&& reload_completed"
4914 operands[0] = gen_lowpart (SImode, operands[0]);
4915 operands[1] = gen_lowpart (Pmode, operands[1]);
4916 operands[3] = gen_lowpart (Pmode, operands[3]);
4917 pat = gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1], operands[2]),
4919 if (Pmode != SImode)
4920 pat = gen_rtx_SUBREG (SImode, pat, 0);
4921 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
4924 [(set_attr "type" "lea")
4925 (set_attr "mode" "SI")])
4927 (define_insn_and_split "*lea_general_2_zext"
4928 [(set (match_operand:DI 0 "register_operand" "=r")
4930 (plus:SI (mult:SI (match_operand:SI 1 "index_register_operand" "r")
4931 (match_operand:SI 2 "const248_operand" "n"))
4932 (match_operand:SI 3 "nonmemory_operand" "ri"))))]
4935 "&& reload_completed"
4937 (zero_extend:DI (subreg:SI (plus:DI (mult:DI (match_dup 1)
4939 (match_dup 3)) 0)))]
4941 operands[1] = gen_lowpart (Pmode, operands[1]);
4942 operands[3] = gen_lowpart (Pmode, operands[3]);
4944 [(set_attr "type" "lea")
4945 (set_attr "mode" "SI")])
4947 (define_insn_and_split "*lea_general_3"
4948 [(set (match_operand 0 "register_operand" "=r")
4949 (plus (plus (mult (match_operand 1 "index_register_operand" "r")
4950 (match_operand 2 "const248_operand" "i"))
4951 (match_operand 3 "register_operand" "r"))
4952 (match_operand 4 "immediate_operand" "i")))]
4953 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
4954 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
4955 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
4956 && GET_MODE (operands[0]) == GET_MODE (operands[1])
4957 && GET_MODE (operands[0]) == GET_MODE (operands[3])"
4959 "&& reload_completed"
4963 operands[0] = gen_lowpart (SImode, operands[0]);
4964 operands[1] = gen_lowpart (Pmode, operands[1]);
4965 operands[3] = gen_lowpart (Pmode, operands[3]);
4966 operands[4] = gen_lowpart (Pmode, operands[4]);
4967 pat = gen_rtx_PLUS (Pmode,
4968 gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1],
4972 if (Pmode != SImode)
4973 pat = gen_rtx_SUBREG (SImode, pat, 0);
4974 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
4977 [(set_attr "type" "lea")
4978 (set_attr "mode" "SI")])
4980 (define_insn_and_split "*lea_general_3_zext"
4981 [(set (match_operand:DI 0 "register_operand" "=r")
4983 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "index_register_operand" "r")
4984 (match_operand:SI 2 "const248_operand" "n"))
4985 (match_operand:SI 3 "register_operand" "r"))
4986 (match_operand:SI 4 "immediate_operand" "i"))))]
4989 "&& reload_completed"
4991 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (mult:DI (match_dup 1)
4994 (match_dup 4)) 0)))]
4996 operands[1] = gen_lowpart (Pmode, operands[1]);
4997 operands[3] = gen_lowpart (Pmode, operands[3]);
4998 operands[4] = gen_lowpart (Pmode, operands[4]);
5000 [(set_attr "type" "lea")
5001 (set_attr "mode" "SI")])
5003 (define_insn "*adddi_1_rex64"
5004 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r")
5005 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,r")
5006 (match_operand:DI 2 "x86_64_general_operand" "rme,re,re")))
5007 (clobber (reg:CC 17))]
5008 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5010 switch (get_attr_type (insn))
5013 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5014 return "lea{q}\t{%a2, %0|%0, %a2}";
5017 if (! rtx_equal_p (operands[0], operands[1]))
5019 if (operands[2] == const1_rtx)
5020 return "inc{q}\t%0";
5021 else if (operands[2] == constm1_rtx)
5022 return "dec{q}\t%0";
5027 if (! rtx_equal_p (operands[0], operands[1]))
5030 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5031 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5032 if (GET_CODE (operands[2]) == CONST_INT
5033 /* Avoid overflows. */
5034 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5035 && (INTVAL (operands[2]) == 128
5036 || (INTVAL (operands[2]) < 0
5037 && INTVAL (operands[2]) != -128)))
5039 operands[2] = GEN_INT (-INTVAL (operands[2]));
5040 return "sub{q}\t{%2, %0|%0, %2}";
5042 return "add{q}\t{%2, %0|%0, %2}";
5046 (cond [(eq_attr "alternative" "2")
5047 (const_string "lea")
5048 ; Current assemblers are broken and do not allow @GOTOFF in
5049 ; ought but a memory context.
5050 (match_operand:DI 2 "pic_symbolic_operand" "")
5051 (const_string "lea")
5052 (match_operand:DI 2 "incdec_operand" "")
5053 (const_string "incdec")
5055 (const_string "alu")))
5056 (set_attr "mode" "DI")])
5058 ;; Convert lea to the lea pattern to avoid flags dependency.
5060 [(set (match_operand:DI 0 "register_operand" "")
5061 (plus:DI (match_operand:DI 1 "register_operand" "")
5062 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
5063 (clobber (reg:CC 17))]
5064 "TARGET_64BIT && reload_completed
5065 && true_regnum (operands[0]) != true_regnum (operands[1])"
5067 (plus:DI (match_dup 1)
5071 (define_insn "*adddi_2_rex64"
5074 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5075 (match_operand:DI 2 "x86_64_general_operand" "rme,re"))
5077 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
5078 (plus:DI (match_dup 1) (match_dup 2)))]
5079 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5080 && ix86_binary_operator_ok (PLUS, DImode, operands)
5081 /* Current assemblers are broken and do not allow @GOTOFF in
5082 ought but a memory context. */
5083 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5085 switch (get_attr_type (insn))
5088 if (! rtx_equal_p (operands[0], operands[1]))
5090 if (operands[2] == const1_rtx)
5091 return "inc{q}\t%0";
5092 else if (operands[2] == constm1_rtx)
5093 return "dec{q}\t%0";
5098 if (! rtx_equal_p (operands[0], operands[1]))
5100 /* ???? We ought to handle there the 32bit case too
5101 - do we need new constrant? */
5102 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5103 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5104 if (GET_CODE (operands[2]) == CONST_INT
5105 /* Avoid overflows. */
5106 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5107 && (INTVAL (operands[2]) == 128
5108 || (INTVAL (operands[2]) < 0
5109 && INTVAL (operands[2]) != -128)))
5111 operands[2] = GEN_INT (-INTVAL (operands[2]));
5112 return "sub{q}\t{%2, %0|%0, %2}";
5114 return "add{q}\t{%2, %0|%0, %2}";
5118 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5119 (const_string "incdec")
5120 (const_string "alu")))
5121 (set_attr "mode" "DI")])
5123 (define_insn "*adddi_3_rex64"
5125 (compare (neg:DI (match_operand:DI 2 "x86_64_general_operand" "rme"))
5126 (match_operand:DI 1 "x86_64_general_operand" "%0")))
5127 (clobber (match_scratch:DI 0 "=r"))]
5129 && ix86_match_ccmode (insn, CCZmode)
5130 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5131 /* Current assemblers are broken and do not allow @GOTOFF in
5132 ought but a memory context. */
5133 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5135 switch (get_attr_type (insn))
5138 if (! rtx_equal_p (operands[0], operands[1]))
5140 if (operands[2] == const1_rtx)
5141 return "inc{q}\t%0";
5142 else if (operands[2] == constm1_rtx)
5143 return "dec{q}\t%0";
5148 if (! rtx_equal_p (operands[0], operands[1]))
5150 /* ???? We ought to handle there the 32bit case too
5151 - do we need new constrant? */
5152 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5153 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5154 if (GET_CODE (operands[2]) == CONST_INT
5155 /* Avoid overflows. */
5156 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5157 && (INTVAL (operands[2]) == 128
5158 || (INTVAL (operands[2]) < 0
5159 && INTVAL (operands[2]) != -128)))
5161 operands[2] = GEN_INT (-INTVAL (operands[2]));
5162 return "sub{q}\t{%2, %0|%0, %2}";
5164 return "add{q}\t{%2, %0|%0, %2}";
5168 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5169 (const_string "incdec")
5170 (const_string "alu")))
5171 (set_attr "mode" "DI")])
5173 ; For comparisons against 1, -1 and 128, we may generate better code
5174 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5175 ; is matched then. We can't accept general immediate, because for
5176 ; case of overflows, the result is messed up.
5177 ; This pattern also don't hold of 0x8000000000000000, since the value overflows
5179 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5180 ; only for comparisons not depending on it.
5181 (define_insn "*adddi_4_rex64"
5183 (compare (match_operand:DI 1 "nonimmediate_operand" "0")
5184 (match_operand:DI 2 "x86_64_immediate_operand" "e")))
5185 (clobber (match_scratch:DI 0 "=rm"))]
5187 && ix86_match_ccmode (insn, CCGCmode)"
5189 switch (get_attr_type (insn))
5192 if (operands[2] == constm1_rtx)
5193 return "inc{q}\t%0";
5194 else if (operands[2] == const1_rtx)
5195 return "dec{q}\t%0";
5200 if (! rtx_equal_p (operands[0], operands[1]))
5202 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5203 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5204 if ((INTVAL (operands[2]) == -128
5205 || (INTVAL (operands[2]) > 0
5206 && INTVAL (operands[2]) != 128))
5207 /* Avoid overflows. */
5208 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))))
5209 return "sub{q}\t{%2, %0|%0, %2}";
5210 operands[2] = GEN_INT (-INTVAL (operands[2]));
5211 return "add{q}\t{%2, %0|%0, %2}";
5215 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5216 (const_string "incdec")
5217 (const_string "alu")))
5218 (set_attr "mode" "DI")])
5220 (define_insn "*adddi_5_rex64"
5223 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5224 (match_operand:DI 2 "x86_64_general_operand" "rme"))
5226 (clobber (match_scratch:DI 0 "=r"))]
5228 && ix86_match_ccmode (insn, CCGOCmode)
5229 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5230 /* Current assemblers are broken and do not allow @GOTOFF in
5231 ought but a memory context. */
5232 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5234 switch (get_attr_type (insn))
5237 if (! rtx_equal_p (operands[0], operands[1]))
5239 if (operands[2] == const1_rtx)
5240 return "inc{q}\t%0";
5241 else if (operands[2] == constm1_rtx)
5242 return "dec{q}\t%0";
5247 if (! rtx_equal_p (operands[0], operands[1]))
5249 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5250 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5251 if (GET_CODE (operands[2]) == CONST_INT
5252 /* Avoid overflows. */
5253 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5254 && (INTVAL (operands[2]) == 128
5255 || (INTVAL (operands[2]) < 0
5256 && INTVAL (operands[2]) != -128)))
5258 operands[2] = GEN_INT (-INTVAL (operands[2]));
5259 return "sub{q}\t{%2, %0|%0, %2}";
5261 return "add{q}\t{%2, %0|%0, %2}";
5265 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5266 (const_string "incdec")
5267 (const_string "alu")))
5268 (set_attr "mode" "DI")])
5271 (define_insn "*addsi_1"
5272 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r")
5273 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r")
5274 (match_operand:SI 2 "general_operand" "rmni,rni,rni")))
5275 (clobber (reg:CC 17))]
5276 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5278 switch (get_attr_type (insn))
5281 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5282 return "lea{l}\t{%a2, %0|%0, %a2}";
5285 if (! rtx_equal_p (operands[0], operands[1]))
5287 if (operands[2] == const1_rtx)
5288 return "inc{l}\t%0";
5289 else if (operands[2] == constm1_rtx)
5290 return "dec{l}\t%0";
5295 if (! rtx_equal_p (operands[0], operands[1]))
5298 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5299 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5300 if (GET_CODE (operands[2]) == CONST_INT
5301 && (INTVAL (operands[2]) == 128
5302 || (INTVAL (operands[2]) < 0
5303 && INTVAL (operands[2]) != -128)))
5305 operands[2] = GEN_INT (-INTVAL (operands[2]));
5306 return "sub{l}\t{%2, %0|%0, %2}";
5308 return "add{l}\t{%2, %0|%0, %2}";
5312 (cond [(eq_attr "alternative" "2")
5313 (const_string "lea")
5314 ; Current assemblers are broken and do not allow @GOTOFF in
5315 ; ought but a memory context.
5316 (match_operand:SI 2 "pic_symbolic_operand" "")
5317 (const_string "lea")
5318 (match_operand:SI 2 "incdec_operand" "")
5319 (const_string "incdec")
5321 (const_string "alu")))
5322 (set_attr "mode" "SI")])
5324 ;; Convert lea to the lea pattern to avoid flags dependency.
5326 [(set (match_operand 0 "register_operand" "")
5327 (plus (match_operand 1 "register_operand" "")
5328 (match_operand 2 "nonmemory_operand" "")))
5329 (clobber (reg:CC 17))]
5331 && true_regnum (operands[0]) != true_regnum (operands[1])"
5335 /* In -fPIC mode the constructs like (const (unspec [symbol_ref]))
5336 may confuse gen_lowpart. */
5337 if (GET_MODE (operands[0]) != Pmode)
5339 operands[1] = gen_lowpart (Pmode, operands[1]);
5340 operands[2] = gen_lowpart (Pmode, operands[2]);
5342 operands[0] = gen_lowpart (SImode, operands[0]);
5343 pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
5344 if (Pmode != SImode)
5345 pat = gen_rtx_SUBREG (SImode, pat, 0);
5346 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5350 ;; It may seem that nonimmediate operand is proper one for operand 1.
5351 ;; The addsi_1 pattern allows nonimmediate operand at that place and
5352 ;; we take care in ix86_binary_operator_ok to not allow two memory
5353 ;; operands so proper swapping will be done in reload. This allow
5354 ;; patterns constructed from addsi_1 to match.
5355 (define_insn "addsi_1_zext"
5356 [(set (match_operand:DI 0 "register_operand" "=r,r")
5358 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r")
5359 (match_operand:SI 2 "general_operand" "rmni,rni"))))
5360 (clobber (reg:CC 17))]
5361 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5363 switch (get_attr_type (insn))
5366 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5367 return "lea{l}\t{%a2, %k0|%k0, %a2}";
5370 if (operands[2] == const1_rtx)
5371 return "inc{l}\t%k0";
5372 else if (operands[2] == constm1_rtx)
5373 return "dec{l}\t%k0";
5378 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5379 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5380 if (GET_CODE (operands[2]) == CONST_INT
5381 && (INTVAL (operands[2]) == 128
5382 || (INTVAL (operands[2]) < 0
5383 && INTVAL (operands[2]) != -128)))
5385 operands[2] = GEN_INT (-INTVAL (operands[2]));
5386 return "sub{l}\t{%2, %k0|%k0, %2}";
5388 return "add{l}\t{%2, %k0|%k0, %2}";
5392 (cond [(eq_attr "alternative" "1")
5393 (const_string "lea")
5394 ; Current assemblers are broken and do not allow @GOTOFF in
5395 ; ought but a memory context.
5396 (match_operand:SI 2 "pic_symbolic_operand" "")
5397 (const_string "lea")
5398 (match_operand:SI 2 "incdec_operand" "")
5399 (const_string "incdec")
5401 (const_string "alu")))
5402 (set_attr "mode" "SI")])
5404 ;; Convert lea to the lea pattern to avoid flags dependency.
5406 [(set (match_operand:DI 0 "register_operand" "")
5408 (plus:SI (match_operand:SI 1 "register_operand" "")
5409 (match_operand:SI 2 "nonmemory_operand" ""))))
5410 (clobber (reg:CC 17))]
5412 && true_regnum (operands[0]) != true_regnum (operands[1])"
5414 (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))]
5416 operands[1] = gen_lowpart (Pmode, operands[1]);
5417 operands[2] = gen_lowpart (Pmode, operands[2]);
5420 (define_insn "*addsi_2"
5423 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5424 (match_operand:SI 2 "general_operand" "rmni,rni"))
5426 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
5427 (plus:SI (match_dup 1) (match_dup 2)))]
5428 "ix86_match_ccmode (insn, CCGOCmode)
5429 && ix86_binary_operator_ok (PLUS, SImode, operands)
5430 /* Current assemblers are broken and do not allow @GOTOFF in
5431 ought but a memory context. */
5432 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5434 switch (get_attr_type (insn))
5437 if (! rtx_equal_p (operands[0], operands[1]))
5439 if (operands[2] == const1_rtx)
5440 return "inc{l}\t%0";
5441 else if (operands[2] == constm1_rtx)
5442 return "dec{l}\t%0";
5447 if (! rtx_equal_p (operands[0], operands[1]))
5449 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5450 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5451 if (GET_CODE (operands[2]) == CONST_INT
5452 && (INTVAL (operands[2]) == 128
5453 || (INTVAL (operands[2]) < 0
5454 && INTVAL (operands[2]) != -128)))
5456 operands[2] = GEN_INT (-INTVAL (operands[2]));
5457 return "sub{l}\t{%2, %0|%0, %2}";
5459 return "add{l}\t{%2, %0|%0, %2}";
5463 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5464 (const_string "incdec")
5465 (const_string "alu")))
5466 (set_attr "mode" "SI")])
5468 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5469 (define_insn "*addsi_2_zext"
5472 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5473 (match_operand:SI 2 "general_operand" "rmni"))
5475 (set (match_operand:DI 0 "register_operand" "=r")
5476 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5477 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5478 && ix86_binary_operator_ok (PLUS, SImode, operands)
5479 /* Current assemblers are broken and do not allow @GOTOFF in
5480 ought but a memory context. */
5481 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5483 switch (get_attr_type (insn))
5486 if (operands[2] == const1_rtx)
5487 return "inc{l}\t%k0";
5488 else if (operands[2] == constm1_rtx)
5489 return "dec{l}\t%k0";
5494 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5495 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5496 if (GET_CODE (operands[2]) == CONST_INT
5497 && (INTVAL (operands[2]) == 128
5498 || (INTVAL (operands[2]) < 0
5499 && INTVAL (operands[2]) != -128)))
5501 operands[2] = GEN_INT (-INTVAL (operands[2]));
5502 return "sub{l}\t{%2, %k0|%k0, %2}";
5504 return "add{l}\t{%2, %k0|%k0, %2}";
5508 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5509 (const_string "incdec")
5510 (const_string "alu")))
5511 (set_attr "mode" "SI")])
5513 (define_insn "*addsi_3"
5515 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5516 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5517 (clobber (match_scratch:SI 0 "=r"))]
5518 "ix86_match_ccmode (insn, CCZmode)
5519 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5520 /* Current assemblers are broken and do not allow @GOTOFF in
5521 ought but a memory context. */
5522 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5524 switch (get_attr_type (insn))
5527 if (! rtx_equal_p (operands[0], operands[1]))
5529 if (operands[2] == const1_rtx)
5530 return "inc{l}\t%0";
5531 else if (operands[2] == constm1_rtx)
5532 return "dec{l}\t%0";
5537 if (! rtx_equal_p (operands[0], operands[1]))
5539 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5540 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5541 if (GET_CODE (operands[2]) == CONST_INT
5542 && (INTVAL (operands[2]) == 128
5543 || (INTVAL (operands[2]) < 0
5544 && INTVAL (operands[2]) != -128)))
5546 operands[2] = GEN_INT (-INTVAL (operands[2]));
5547 return "sub{l}\t{%2, %0|%0, %2}";
5549 return "add{l}\t{%2, %0|%0, %2}";
5553 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5554 (const_string "incdec")
5555 (const_string "alu")))
5556 (set_attr "mode" "SI")])
5558 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5559 (define_insn "*addsi_3_zext"
5561 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5562 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5563 (set (match_operand:DI 0 "register_operand" "=r")
5564 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5565 "TARGET_64BIT && ix86_match_ccmode (insn, CCZmode)
5566 && ix86_binary_operator_ok (PLUS, SImode, operands)
5567 /* Current assemblers are broken and do not allow @GOTOFF in
5568 ought but a memory context. */
5569 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5571 switch (get_attr_type (insn))
5574 if (operands[2] == const1_rtx)
5575 return "inc{l}\t%k0";
5576 else if (operands[2] == constm1_rtx)
5577 return "dec{l}\t%k0";
5582 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5583 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5584 if (GET_CODE (operands[2]) == CONST_INT
5585 && (INTVAL (operands[2]) == 128
5586 || (INTVAL (operands[2]) < 0
5587 && INTVAL (operands[2]) != -128)))
5589 operands[2] = GEN_INT (-INTVAL (operands[2]));
5590 return "sub{l}\t{%2, %k0|%k0, %2}";
5592 return "add{l}\t{%2, %k0|%k0, %2}";
5596 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5597 (const_string "incdec")
5598 (const_string "alu")))
5599 (set_attr "mode" "SI")])
5601 ; For comparisons agains 1, -1 and 128, we may generate better code
5602 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5603 ; is matched then. We can't accept general immediate, because for
5604 ; case of overflows, the result is messed up.
5605 ; This pattern also don't hold of 0x80000000, since the value overflows
5607 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5608 ; only for comparisons not depending on it.
5609 (define_insn "*addsi_4"
5611 (compare (match_operand:SI 1 "nonimmediate_operand" "0")
5612 (match_operand:SI 2 "const_int_operand" "n")))
5613 (clobber (match_scratch:SI 0 "=rm"))]
5614 "ix86_match_ccmode (insn, CCGCmode)
5615 && (INTVAL (operands[2]) & 0xffffffff) != 0x80000000"
5617 switch (get_attr_type (insn))
5620 if (operands[2] == constm1_rtx)
5621 return "inc{l}\t%0";
5622 else if (operands[2] == const1_rtx)
5623 return "dec{l}\t%0";
5628 if (! rtx_equal_p (operands[0], operands[1]))
5630 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5631 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5632 if ((INTVAL (operands[2]) == -128
5633 || (INTVAL (operands[2]) > 0
5634 && INTVAL (operands[2]) != 128)))
5635 return "sub{l}\t{%2, %0|%0, %2}";
5636 operands[2] = GEN_INT (-INTVAL (operands[2]));
5637 return "add{l}\t{%2, %0|%0, %2}";
5641 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5642 (const_string "incdec")
5643 (const_string "alu")))
5644 (set_attr "mode" "SI")])
5646 (define_insn "*addsi_5"
5649 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5650 (match_operand:SI 2 "general_operand" "rmni"))
5652 (clobber (match_scratch:SI 0 "=r"))]
5653 "ix86_match_ccmode (insn, CCGOCmode)
5654 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5655 /* Current assemblers are broken and do not allow @GOTOFF in
5656 ought but a memory context. */
5657 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5659 switch (get_attr_type (insn))
5662 if (! rtx_equal_p (operands[0], operands[1]))
5664 if (operands[2] == const1_rtx)
5665 return "inc{l}\t%0";
5666 else if (operands[2] == constm1_rtx)
5667 return "dec{l}\t%0";
5672 if (! rtx_equal_p (operands[0], operands[1]))
5674 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5675 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5676 if (GET_CODE (operands[2]) == CONST_INT
5677 && (INTVAL (operands[2]) == 128
5678 || (INTVAL (operands[2]) < 0
5679 && INTVAL (operands[2]) != -128)))
5681 operands[2] = GEN_INT (-INTVAL (operands[2]));
5682 return "sub{l}\t{%2, %0|%0, %2}";
5684 return "add{l}\t{%2, %0|%0, %2}";
5688 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5689 (const_string "incdec")
5690 (const_string "alu")))
5691 (set_attr "mode" "SI")])
5693 (define_expand "addhi3"
5694 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
5695 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "")
5696 (match_operand:HI 2 "general_operand" "")))
5697 (clobber (reg:CC 17))])]
5698 "TARGET_HIMODE_MATH"
5699 "ix86_expand_binary_operator (PLUS, HImode, operands); DONE;")
5701 ;; %%% After Dave's SUBREG_BYTE stuff goes in, re-enable incb %ah
5702 ;; type optimizations enabled by define-splits. This is not important
5703 ;; for PII, and in fact harmful because of partial register stalls.
5705 (define_insn "*addhi_1_lea"
5706 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
5707 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r")
5708 (match_operand:HI 2 "general_operand" "ri,rm,rni")))
5709 (clobber (reg:CC 17))]
5710 "!TARGET_PARTIAL_REG_STALL
5711 && ix86_binary_operator_ok (PLUS, HImode, operands)"
5713 switch (get_attr_type (insn))
5718 if (operands[2] == const1_rtx)
5719 return "inc{w}\t%0";
5720 else if (operands[2] == constm1_rtx)
5721 return "dec{w}\t%0";
5725 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5726 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5727 if (GET_CODE (operands[2]) == CONST_INT
5728 && (INTVAL (operands[2]) == 128
5729 || (INTVAL (operands[2]) < 0
5730 && INTVAL (operands[2]) != -128)))
5732 operands[2] = GEN_INT (-INTVAL (operands[2]));
5733 return "sub{w}\t{%2, %0|%0, %2}";
5735 return "add{w}\t{%2, %0|%0, %2}";
5739 (if_then_else (eq_attr "alternative" "2")
5740 (const_string "lea")
5741 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5742 (const_string "incdec")
5743 (const_string "alu"))))
5744 (set_attr "mode" "HI,HI,SI")])
5746 (define_insn "*addhi_1"
5747 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
5748 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
5749 (match_operand:HI 2 "general_operand" "ri,rm")))
5750 (clobber (reg:CC 17))]
5751 "TARGET_PARTIAL_REG_STALL
5752 && ix86_binary_operator_ok (PLUS, HImode, operands)"
5754 switch (get_attr_type (insn))
5757 if (operands[2] == const1_rtx)
5758 return "inc{w}\t%0";
5759 else if (operands[2] == constm1_rtx)
5760 return "dec{w}\t%0";
5764 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5765 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5766 if (GET_CODE (operands[2]) == CONST_INT
5767 && (INTVAL (operands[2]) == 128
5768 || (INTVAL (operands[2]) < 0
5769 && INTVAL (operands[2]) != -128)))
5771 operands[2] = GEN_INT (-INTVAL (operands[2]));
5772 return "sub{w}\t{%2, %0|%0, %2}";
5774 return "add{w}\t{%2, %0|%0, %2}";
5778 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5779 (const_string "incdec")
5780 (const_string "alu")))
5781 (set_attr "mode" "HI")])
5783 (define_insn "*addhi_2"
5786 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
5787 (match_operand:HI 2 "general_operand" "rmni,rni"))
5789 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
5790 (plus:HI (match_dup 1) (match_dup 2)))]
5791 "ix86_match_ccmode (insn, CCGOCmode)
5792 && ix86_binary_operator_ok (PLUS, HImode, operands)"
5794 switch (get_attr_type (insn))
5797 if (operands[2] == const1_rtx)
5798 return "inc{w}\t%0";
5799 else if (operands[2] == constm1_rtx)
5800 return "dec{w}\t%0";
5804 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5805 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5806 if (GET_CODE (operands[2]) == CONST_INT
5807 && (INTVAL (operands[2]) == 128
5808 || (INTVAL (operands[2]) < 0
5809 && INTVAL (operands[2]) != -128)))
5811 operands[2] = GEN_INT (-INTVAL (operands[2]));
5812 return "sub{w}\t{%2, %0|%0, %2}";
5814 return "add{w}\t{%2, %0|%0, %2}";
5818 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5819 (const_string "incdec")
5820 (const_string "alu")))
5821 (set_attr "mode" "HI")])
5823 (define_insn "*addhi_3"
5825 (compare (neg:HI (match_operand:HI 2 "general_operand" "rmni"))
5826 (match_operand:HI 1 "nonimmediate_operand" "%0")))
5827 (clobber (match_scratch:HI 0 "=r"))]
5828 "ix86_match_ccmode (insn, CCZmode)
5829 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
5831 switch (get_attr_type (insn))
5834 if (operands[2] == const1_rtx)
5835 return "inc{w}\t%0";
5836 else if (operands[2] == constm1_rtx)
5837 return "dec{w}\t%0";
5841 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5842 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5843 if (GET_CODE (operands[2]) == CONST_INT
5844 && (INTVAL (operands[2]) == 128
5845 || (INTVAL (operands[2]) < 0
5846 && INTVAL (operands[2]) != -128)))
5848 operands[2] = GEN_INT (-INTVAL (operands[2]));
5849 return "sub{w}\t{%2, %0|%0, %2}";
5851 return "add{w}\t{%2, %0|%0, %2}";
5855 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5856 (const_string "incdec")
5857 (const_string "alu")))
5858 (set_attr "mode" "HI")])
5860 ; See comments above addsi_3_imm for details.
5861 (define_insn "*addhi_4"
5863 (compare (match_operand:HI 1 "nonimmediate_operand" "0")
5864 (match_operand:HI 2 "const_int_operand" "n")))
5865 (clobber (match_scratch:HI 0 "=rm"))]
5866 "ix86_match_ccmode (insn, CCGCmode)
5867 && (INTVAL (operands[2]) & 0xffff) != 0x8000"
5869 switch (get_attr_type (insn))
5872 if (operands[2] == constm1_rtx)
5873 return "inc{w}\t%0";
5874 else if (operands[2] == const1_rtx)
5875 return "dec{w}\t%0";
5880 if (! rtx_equal_p (operands[0], operands[1]))
5882 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5883 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5884 if ((INTVAL (operands[2]) == -128
5885 || (INTVAL (operands[2]) > 0
5886 && INTVAL (operands[2]) != 128)))
5887 return "sub{w}\t{%2, %0|%0, %2}";
5888 operands[2] = GEN_INT (-INTVAL (operands[2]));
5889 return "add{w}\t{%2, %0|%0, %2}";
5893 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5894 (const_string "incdec")
5895 (const_string "alu")))
5896 (set_attr "mode" "SI")])
5899 (define_insn "*addhi_5"
5902 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
5903 (match_operand:HI 2 "general_operand" "rmni"))
5905 (clobber (match_scratch:HI 0 "=r"))]
5906 "ix86_match_ccmode (insn, CCGOCmode)
5907 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
5909 switch (get_attr_type (insn))
5912 if (operands[2] == const1_rtx)
5913 return "inc{w}\t%0";
5914 else if (operands[2] == constm1_rtx)
5915 return "dec{w}\t%0";
5919 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5920 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5921 if (GET_CODE (operands[2]) == CONST_INT
5922 && (INTVAL (operands[2]) == 128
5923 || (INTVAL (operands[2]) < 0
5924 && INTVAL (operands[2]) != -128)))
5926 operands[2] = GEN_INT (-INTVAL (operands[2]));
5927 return "sub{w}\t{%2, %0|%0, %2}";
5929 return "add{w}\t{%2, %0|%0, %2}";
5933 (if_then_else (match_operand:HI 2 "incdec_operand" "")
5934 (const_string "incdec")
5935 (const_string "alu")))
5936 (set_attr "mode" "HI")])
5938 (define_expand "addqi3"
5939 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
5940 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "")
5941 (match_operand:QI 2 "general_operand" "")))
5942 (clobber (reg:CC 17))])]
5943 "TARGET_QIMODE_MATH"
5944 "ix86_expand_binary_operator (PLUS, QImode, operands); DONE;")
5946 ;; %%% Potential partial reg stall on alternative 2. What to do?
5947 (define_insn "*addqi_1_lea"
5948 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r")
5949 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,r")
5950 (match_operand:QI 2 "general_operand" "qn,qmn,rn,rn")))
5951 (clobber (reg:CC 17))]
5952 "!TARGET_PARTIAL_REG_STALL
5953 && ix86_binary_operator_ok (PLUS, QImode, operands)"
5955 int widen = (which_alternative == 2);
5956 switch (get_attr_type (insn))
5961 if (operands[2] == const1_rtx)
5962 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
5963 else if (operands[2] == constm1_rtx)
5964 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
5968 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5969 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5970 if (GET_CODE (operands[2]) == CONST_INT
5971 && (INTVAL (operands[2]) == 128
5972 || (INTVAL (operands[2]) < 0
5973 && INTVAL (operands[2]) != -128)))
5975 operands[2] = GEN_INT (-INTVAL (operands[2]));
5977 return "sub{l}\t{%2, %k0|%k0, %2}";
5979 return "sub{b}\t{%2, %0|%0, %2}";
5982 return "add{l}\t{%k2, %k0|%k0, %k2}";
5984 return "add{b}\t{%2, %0|%0, %2}";
5988 (if_then_else (eq_attr "alternative" "3")
5989 (const_string "lea")
5990 (if_then_else (match_operand:QI 2 "incdec_operand" "")
5991 (const_string "incdec")
5992 (const_string "alu"))))
5993 (set_attr "mode" "QI,QI,SI,SI")])
5995 (define_insn "*addqi_1"
5996 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
5997 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5998 (match_operand:QI 2 "general_operand" "qn,qmn,rn")))
5999 (clobber (reg:CC 17))]
6000 "TARGET_PARTIAL_REG_STALL
6001 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6003 int widen = (which_alternative == 2);
6004 switch (get_attr_type (insn))
6007 if (operands[2] == const1_rtx)
6008 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6009 else if (operands[2] == constm1_rtx)
6010 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6014 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6015 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6016 if (GET_CODE (operands[2]) == CONST_INT
6017 && (INTVAL (operands[2]) == 128
6018 || (INTVAL (operands[2]) < 0
6019 && INTVAL (operands[2]) != -128)))
6021 operands[2] = GEN_INT (-INTVAL (operands[2]));
6023 return "sub{l}\t{%2, %k0|%k0, %2}";
6025 return "sub{b}\t{%2, %0|%0, %2}";
6028 return "add{l}\t{%k2, %k0|%k0, %k2}";
6030 return "add{b}\t{%2, %0|%0, %2}";
6034 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6035 (const_string "incdec")
6036 (const_string "alu")))
6037 (set_attr "mode" "QI,QI,SI")])
6039 (define_insn "*addqi_1_slp"
6040 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6041 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
6042 (match_operand:QI 2 "general_operand" "qn,qnm")))
6043 (clobber (reg:CC 17))]
6044 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6045 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6047 switch (get_attr_type (insn))
6050 if (operands[2] == const1_rtx)
6051 return "inc{b}\t%0";
6052 else if (operands[2] == constm1_rtx)
6053 return "dec{b}\t%0";
6057 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'. */
6058 if (GET_CODE (operands[2]) == CONST_INT
6059 && INTVAL (operands[2]) < 0)
6061 operands[2] = GEN_INT (-INTVAL (operands[2]));
6062 return "sub{b}\t{%2, %0|%0, %2}";
6064 return "add{b}\t{%2, %0|%0, %2}";
6068 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6069 (const_string "incdec")
6070 (const_string "alu")))
6071 (set_attr "mode" "QI")])
6073 (define_insn "*addqi_2"
6076 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
6077 (match_operand:QI 2 "general_operand" "qmni,qni"))
6079 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
6080 (plus:QI (match_dup 1) (match_dup 2)))]
6081 "ix86_match_ccmode (insn, CCGOCmode)
6082 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6084 switch (get_attr_type (insn))
6087 if (operands[2] == const1_rtx)
6088 return "inc{b}\t%0";
6089 else if (operands[2] == constm1_rtx
6090 || (GET_CODE (operands[2]) == CONST_INT
6091 && INTVAL (operands[2]) == 255))
6092 return "dec{b}\t%0";
6096 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6097 if (GET_CODE (operands[2]) == CONST_INT
6098 && INTVAL (operands[2]) < 0)
6100 operands[2] = GEN_INT (-INTVAL (operands[2]));
6101 return "sub{b}\t{%2, %0|%0, %2}";
6103 return "add{b}\t{%2, %0|%0, %2}";
6107 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6108 (const_string "incdec")
6109 (const_string "alu")))
6110 (set_attr "mode" "QI")])
6112 (define_insn "*addqi_3"
6114 (compare (neg:QI (match_operand:QI 2 "general_operand" "qmni"))
6115 (match_operand:QI 1 "nonimmediate_operand" "%0")))
6116 (clobber (match_scratch:QI 0 "=q"))]
6117 "ix86_match_ccmode (insn, CCZmode)
6118 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6120 switch (get_attr_type (insn))
6123 if (operands[2] == const1_rtx)
6124 return "inc{b}\t%0";
6125 else if (operands[2] == constm1_rtx
6126 || (GET_CODE (operands[2]) == CONST_INT
6127 && INTVAL (operands[2]) == 255))
6128 return "dec{b}\t%0";
6132 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6133 if (GET_CODE (operands[2]) == CONST_INT
6134 && INTVAL (operands[2]) < 0)
6136 operands[2] = GEN_INT (-INTVAL (operands[2]));
6137 return "sub{b}\t{%2, %0|%0, %2}";
6139 return "add{b}\t{%2, %0|%0, %2}";
6143 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6144 (const_string "incdec")
6145 (const_string "alu")))
6146 (set_attr "mode" "QI")])
6148 ; See comments above addsi_3_imm for details.
6149 (define_insn "*addqi_4"
6151 (compare (match_operand:QI 1 "nonimmediate_operand" "0")
6152 (match_operand:QI 2 "const_int_operand" "n")))
6153 (clobber (match_scratch:QI 0 "=qm"))]
6154 "ix86_match_ccmode (insn, CCGCmode)
6155 && (INTVAL (operands[2]) & 0xff) != 0x80"
6157 switch (get_attr_type (insn))
6160 if (operands[2] == constm1_rtx
6161 || (GET_CODE (operands[2]) == CONST_INT
6162 && INTVAL (operands[2]) == 255))
6163 return "inc{b}\t%0";
6164 else if (operands[2] == const1_rtx)
6165 return "dec{b}\t%0";
6170 if (! rtx_equal_p (operands[0], operands[1]))
6172 if (INTVAL (operands[2]) < 0)
6174 operands[2] = GEN_INT (-INTVAL (operands[2]));
6175 return "add{b}\t{%2, %0|%0, %2}";
6177 return "sub{b}\t{%2, %0|%0, %2}";
6181 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6182 (const_string "incdec")
6183 (const_string "alu")))
6184 (set_attr "mode" "QI")])
6187 (define_insn "*addqi_5"
6190 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
6191 (match_operand:QI 2 "general_operand" "qmni"))
6193 (clobber (match_scratch:QI 0 "=q"))]
6194 "ix86_match_ccmode (insn, CCGOCmode)
6195 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6197 switch (get_attr_type (insn))
6200 if (operands[2] == const1_rtx)
6201 return "inc{b}\t%0";
6202 else if (operands[2] == constm1_rtx
6203 || (GET_CODE (operands[2]) == CONST_INT
6204 && INTVAL (operands[2]) == 255))
6205 return "dec{b}\t%0";
6209 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6210 if (GET_CODE (operands[2]) == CONST_INT
6211 && INTVAL (operands[2]) < 0)
6213 operands[2] = GEN_INT (-INTVAL (operands[2]));
6214 return "sub{b}\t{%2, %0|%0, %2}";
6216 return "add{b}\t{%2, %0|%0, %2}";
6220 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6221 (const_string "incdec")
6222 (const_string "alu")))
6223 (set_attr "mode" "QI")])
6226 (define_insn "addqi_ext_1"
6227 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6232 (match_operand 1 "ext_register_operand" "0")
6235 (match_operand:QI 2 "general_operand" "Qmn")))
6236 (clobber (reg:CC 17))]
6239 switch (get_attr_type (insn))
6242 if (operands[2] == const1_rtx)
6243 return "inc{b}\t%h0";
6244 else if (operands[2] == constm1_rtx
6245 || (GET_CODE (operands[2]) == CONST_INT
6246 && INTVAL (operands[2]) == 255))
6247 return "dec{b}\t%h0";
6251 return "add{b}\t{%2, %h0|%h0, %2}";
6255 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6256 (const_string "incdec")
6257 (const_string "alu")))
6258 (set_attr "mode" "QI")])
6260 (define_insn "*addqi_ext_1_rex64"
6261 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6266 (match_operand 1 "ext_register_operand" "0")
6269 (match_operand:QI 2 "nonmemory_operand" "Qn")))
6270 (clobber (reg:CC 17))]
6273 switch (get_attr_type (insn))
6276 if (operands[2] == const1_rtx)
6277 return "inc{b}\t%h0";
6278 else if (operands[2] == constm1_rtx
6279 || (GET_CODE (operands[2]) == CONST_INT
6280 && INTVAL (operands[2]) == 255))
6281 return "dec{b}\t%h0";
6285 return "add{b}\t{%2, %h0|%h0, %2}";
6289 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6290 (const_string "incdec")
6291 (const_string "alu")))
6292 (set_attr "mode" "QI")])
6294 (define_insn "*addqi_ext_2"
6295 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6300 (match_operand 1 "ext_register_operand" "%0")
6304 (match_operand 2 "ext_register_operand" "Q")
6307 (clobber (reg:CC 17))]
6309 "add{b}\t{%h2, %h0|%h0, %h2}"
6310 [(set_attr "type" "alu")
6311 (set_attr "mode" "QI")])
6313 ;; The patterns that match these are at the end of this file.
6315 (define_expand "addxf3"
6316 [(set (match_operand:XF 0 "register_operand" "")
6317 (plus:XF (match_operand:XF 1 "register_operand" "")
6318 (match_operand:XF 2 "register_operand" "")))]
6319 "!TARGET_64BIT && TARGET_80387"
6322 (define_expand "addtf3"
6323 [(set (match_operand:TF 0 "register_operand" "")
6324 (plus:TF (match_operand:TF 1 "register_operand" "")
6325 (match_operand:TF 2 "register_operand" "")))]
6329 (define_expand "adddf3"
6330 [(set (match_operand:DF 0 "register_operand" "")
6331 (plus:DF (match_operand:DF 1 "register_operand" "")
6332 (match_operand:DF 2 "nonimmediate_operand" "")))]
6333 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6336 (define_expand "addsf3"
6337 [(set (match_operand:SF 0 "register_operand" "")
6338 (plus:SF (match_operand:SF 1 "register_operand" "")
6339 (match_operand:SF 2 "nonimmediate_operand" "")))]
6340 "TARGET_80387 || TARGET_SSE_MATH"
6343 ;; Subtract instructions
6345 ;; %%% splits for subsidi3
6347 (define_expand "subdi3"
6348 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
6349 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6350 (match_operand:DI 2 "x86_64_general_operand" "")))
6351 (clobber (reg:CC 17))])]
6353 "ix86_expand_binary_operator (MINUS, DImode, operands); DONE;")
6355 (define_insn "*subdi3_1"
6356 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
6357 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6358 (match_operand:DI 2 "general_operand" "roiF,riF")))
6359 (clobber (reg:CC 17))]
6364 [(set (match_operand:DI 0 "nonimmediate_operand" "")
6365 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6366 (match_operand:DI 2 "general_operand" "")))
6367 (clobber (reg:CC 17))]
6368 "!TARGET_64BIT && reload_completed"
6369 [(parallel [(set (reg:CC 17) (compare:CC (match_dup 1) (match_dup 2)))
6370 (set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))])
6371 (parallel [(set (match_dup 3)
6372 (minus:SI (match_dup 4)
6373 (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
6375 (clobber (reg:CC 17))])]
6376 "split_di (operands+0, 1, operands+0, operands+3);
6377 split_di (operands+1, 1, operands+1, operands+4);
6378 split_di (operands+2, 1, operands+2, operands+5);")
6380 (define_insn "subdi3_carry_rex64"
6381 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6382 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6383 (plus:DI (ltu:DI (reg:CC 17) (const_int 0))
6384 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))))
6385 (clobber (reg:CC 17))]
6386 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6387 "sbb{q}\t{%2, %0|%0, %2}"
6388 [(set_attr "type" "alu")
6389 (set_attr "pent_pair" "pu")
6390 (set_attr "ppro_uops" "few")
6391 (set_attr "mode" "DI")])
6393 (define_insn "*subdi_1_rex64"
6394 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6395 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6396 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6397 (clobber (reg:CC 17))]
6398 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6399 "sub{q}\t{%2, %0|%0, %2}"
6400 [(set_attr "type" "alu")
6401 (set_attr "mode" "DI")])
6403 (define_insn "*subdi_2_rex64"
6406 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6407 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))
6409 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6410 (minus:DI (match_dup 1) (match_dup 2)))]
6411 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6412 && ix86_binary_operator_ok (MINUS, DImode, operands)"
6413 "sub{q}\t{%2, %0|%0, %2}"
6414 [(set_attr "type" "alu")
6415 (set_attr "mode" "DI")])
6417 (define_insn "*subdi_3_rex63"
6419 (compare (match_operand:DI 1 "nonimmediate_operand" "0,0")
6420 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6421 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6422 (minus:DI (match_dup 1) (match_dup 2)))]
6423 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6424 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6425 "sub{q}\t{%2, %0|%0, %2}"
6426 [(set_attr "type" "alu")
6427 (set_attr "mode" "DI")])
6430 (define_insn "subsi3_carry"
6431 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6432 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6433 (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
6434 (match_operand:SI 2 "general_operand" "ri,rm"))))
6435 (clobber (reg:CC 17))]
6436 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6437 "sbb{l}\t{%2, %0|%0, %2}"
6438 [(set_attr "type" "alu")
6439 (set_attr "pent_pair" "pu")
6440 (set_attr "ppro_uops" "few")
6441 (set_attr "mode" "SI")])
6443 (define_insn "subsi3_carry_zext"
6444 [(set (match_operand:DI 0 "register_operand" "=rm,r")
6446 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
6447 (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
6448 (match_operand:SI 2 "general_operand" "ri,rm")))))
6449 (clobber (reg:CC 17))]
6450 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6451 "sbb{l}\t{%2, %k0|%k0, %2}"
6452 [(set_attr "type" "alu")
6453 (set_attr "pent_pair" "pu")
6454 (set_attr "ppro_uops" "few")
6455 (set_attr "mode" "SI")])
6457 (define_expand "subsi3"
6458 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
6459 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "")
6460 (match_operand:SI 2 "general_operand" "")))
6461 (clobber (reg:CC 17))])]
6463 "ix86_expand_binary_operator (MINUS, SImode, operands); DONE;")
6465 (define_insn "*subsi_1"
6466 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6467 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6468 (match_operand:SI 2 "general_operand" "ri,rm")))
6469 (clobber (reg:CC 17))]
6470 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6471 "sub{l}\t{%2, %0|%0, %2}"
6472 [(set_attr "type" "alu")
6473 (set_attr "mode" "SI")])
6475 (define_insn "*subsi_1_zext"
6476 [(set (match_operand:DI 0 "register_operand" "=r")
6478 (minus:SI (match_operand:SI 1 "register_operand" "0")
6479 (match_operand:SI 2 "general_operand" "rim"))))
6480 (clobber (reg:CC 17))]
6481 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6482 "sub{l}\t{%2, %k0|%k0, %2}"
6483 [(set_attr "type" "alu")
6484 (set_attr "mode" "SI")])
6486 (define_insn "*subsi_2"
6489 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6490 (match_operand:SI 2 "general_operand" "ri,rm"))
6492 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6493 (minus:SI (match_dup 1) (match_dup 2)))]
6494 "ix86_match_ccmode (insn, CCGOCmode)
6495 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6496 "sub{l}\t{%2, %0|%0, %2}"
6497 [(set_attr "type" "alu")
6498 (set_attr "mode" "SI")])
6500 (define_insn "*subsi_2_zext"
6503 (minus:SI (match_operand:SI 1 "register_operand" "0")
6504 (match_operand:SI 2 "general_operand" "rim"))
6506 (set (match_operand:DI 0 "register_operand" "=r")
6508 (minus:SI (match_dup 1)
6510 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6511 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6512 "sub{l}\t{%2, %k0|%k0, %2}"
6513 [(set_attr "type" "alu")
6514 (set_attr "mode" "SI")])
6516 (define_insn "*subsi_3"
6518 (compare (match_operand:SI 1 "nonimmediate_operand" "0,0")
6519 (match_operand:SI 2 "general_operand" "ri,rm")))
6520 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6521 (minus:SI (match_dup 1) (match_dup 2)))]
6522 "ix86_match_ccmode (insn, CCmode)
6523 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6524 "sub{l}\t{%2, %0|%0, %2}"
6525 [(set_attr "type" "alu")
6526 (set_attr "mode" "SI")])
6528 (define_insn "*subsi_3_zext"
6530 (compare (match_operand:SI 1 "nonimmediate_operand" "0")
6531 (match_operand:SI 2 "general_operand" "rim")))
6532 (set (match_operand:DI 0 "register_operand" "=r")
6534 (minus:SI (match_dup 1)
6536 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6537 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6538 "sub{q}\t{%2, %0|%0, %2}"
6539 [(set_attr "type" "alu")
6540 (set_attr "mode" "DI")])
6542 (define_expand "subhi3"
6543 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
6544 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "")
6545 (match_operand:HI 2 "general_operand" "")))
6546 (clobber (reg:CC 17))])]
6547 "TARGET_HIMODE_MATH"
6548 "ix86_expand_binary_operator (MINUS, HImode, operands); DONE;")
6550 (define_insn "*subhi_1"
6551 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6552 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6553 (match_operand:HI 2 "general_operand" "ri,rm")))
6554 (clobber (reg:CC 17))]
6555 "ix86_binary_operator_ok (MINUS, HImode, operands)"
6556 "sub{w}\t{%2, %0|%0, %2}"
6557 [(set_attr "type" "alu")
6558 (set_attr "mode" "HI")])
6560 (define_insn "*subhi_2"
6563 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6564 (match_operand:HI 2 "general_operand" "ri,rm"))
6566 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6567 (minus:HI (match_dup 1) (match_dup 2)))]
6568 "ix86_match_ccmode (insn, CCGOCmode)
6569 && ix86_binary_operator_ok (MINUS, HImode, operands)"
6570 "sub{w}\t{%2, %0|%0, %2}"
6571 [(set_attr "type" "alu")
6572 (set_attr "mode" "HI")])
6574 (define_insn "*subhi_3"
6576 (compare (match_operand:HI 1 "nonimmediate_operand" "0,0")
6577 (match_operand:HI 2 "general_operand" "ri,rm")))
6578 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6579 (minus:HI (match_dup 1) (match_dup 2)))]
6580 "ix86_match_ccmode (insn, CCmode)
6581 && ix86_binary_operator_ok (MINUS, HImode, operands)"
6582 "sub{w}\t{%2, %0|%0, %2}"
6583 [(set_attr "type" "alu")
6584 (set_attr "mode" "HI")])
6586 (define_expand "subqi3"
6587 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
6588 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "")
6589 (match_operand:QI 2 "general_operand" "")))
6590 (clobber (reg:CC 17))])]
6591 "TARGET_QIMODE_MATH"
6592 "ix86_expand_binary_operator (MINUS, QImode, operands); DONE;")
6594 (define_insn "*subqi_1"
6595 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
6596 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6597 (match_operand:QI 2 "general_operand" "qn,qmn")))
6598 (clobber (reg:CC 17))]
6599 "ix86_binary_operator_ok (MINUS, QImode, operands)"
6600 "sub{b}\t{%2, %0|%0, %2}"
6601 [(set_attr "type" "alu")
6602 (set_attr "mode" "QI")])
6604 (define_insn "*subqi_1_slp"
6605 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6606 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6607 (match_operand:QI 2 "general_operand" "qn,qmn")))
6608 (clobber (reg:CC 17))]
6609 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6610 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6611 "sub{b}\t{%2, %0|%0, %2}"
6612 [(set_attr "type" "alu")
6613 (set_attr "mode" "QI")])
6615 (define_insn "*subqi_2"
6618 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6619 (match_operand:QI 2 "general_operand" "qi,qm"))
6621 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
6622 (minus:HI (match_dup 1) (match_dup 2)))]
6623 "ix86_match_ccmode (insn, CCGOCmode)
6624 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6625 "sub{b}\t{%2, %0|%0, %2}"
6626 [(set_attr "type" "alu")
6627 (set_attr "mode" "QI")])
6629 (define_insn "*subqi_3"
6631 (compare (match_operand:QI 1 "nonimmediate_operand" "0,0")
6632 (match_operand:QI 2 "general_operand" "qi,qm")))
6633 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
6634 (minus:HI (match_dup 1) (match_dup 2)))]
6635 "ix86_match_ccmode (insn, CCmode)
6636 && ix86_binary_operator_ok (MINUS, QImode, operands)"
6637 "sub{b}\t{%2, %0|%0, %2}"
6638 [(set_attr "type" "alu")
6639 (set_attr "mode" "QI")])
6641 ;; The patterns that match these are at the end of this file.
6643 (define_expand "subxf3"
6644 [(set (match_operand:XF 0 "register_operand" "")
6645 (minus:XF (match_operand:XF 1 "register_operand" "")
6646 (match_operand:XF 2 "register_operand" "")))]
6647 "!TARGET_64BIT && TARGET_80387"
6650 (define_expand "subtf3"
6651 [(set (match_operand:TF 0 "register_operand" "")
6652 (minus:TF (match_operand:TF 1 "register_operand" "")
6653 (match_operand:TF 2 "register_operand" "")))]
6657 (define_expand "subdf3"
6658 [(set (match_operand:DF 0 "register_operand" "")
6659 (minus:DF (match_operand:DF 1 "register_operand" "")
6660 (match_operand:DF 2 "nonimmediate_operand" "")))]
6661 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6664 (define_expand "subsf3"
6665 [(set (match_operand:SF 0 "register_operand" "")
6666 (minus:SF (match_operand:SF 1 "register_operand" "")
6667 (match_operand:SF 2 "nonimmediate_operand" "")))]
6668 "TARGET_80387 || TARGET_SSE_MATH"
6671 ;; Multiply instructions
6673 (define_expand "muldi3"
6674 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6675 (mult:DI (match_operand:DI 1 "register_operand" "")
6676 (match_operand:DI 2 "x86_64_general_operand" "")))
6677 (clobber (reg:CC 17))])]
6681 (define_insn "*muldi3_1_rex64"
6682 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
6683 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%rm,0,0")
6684 (match_operand:DI 2 "x86_64_general_operand" "K,e,mr")))
6685 (clobber (reg:CC 17))]
6687 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6689 imul{q}\t{%2, %1, %0|%0, %1, %2}
6690 imul{q}\t{%2, %1, %0|%0, %1, %2}
6691 imul{q}\t{%2, %0|%0, %2}"
6692 [(set_attr "type" "imul")
6693 (set_attr "prefix_0f" "0,0,1")
6694 (set_attr "mode" "DI")])
6696 (define_expand "mulsi3"
6697 [(parallel [(set (match_operand:SI 0 "register_operand" "")
6698 (mult:SI (match_operand:SI 1 "register_operand" "")
6699 (match_operand:SI 2 "general_operand" "")))
6700 (clobber (reg:CC 17))])]
6704 (define_insn "*mulsi3_1"
6705 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
6706 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,0,0")
6707 (match_operand:SI 2 "general_operand" "K,i,mr")))
6708 (clobber (reg:CC 17))]
6709 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
6710 ; For the {r,0,i} alternative (i.e., register <- register * immediate),
6711 ; there are two ways of writing the exact same machine instruction
6712 ; in assembly language. One, for example, is:
6716 ; while the other is:
6718 ; imul $12, %eax, %eax
6720 ; The first is simply short-hand for the latter. But, some assemblers,
6721 ; like the SCO OSR5 COFF assembler, don't handle the first form.
6723 imul{l}\t{%2, %1, %0|%0, %1, %2}
6724 imul{l}\t{%2, %1, %0|%0, %1, %2}
6725 imul{l}\t{%2, %0|%0, %2}"
6726 [(set_attr "type" "imul")
6727 (set_attr "prefix_0f" "0,0,1")
6728 (set_attr "mode" "SI")])
6730 (define_insn "*mulsi3_1_zext"
6731 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
6733 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,0,0")
6734 (match_operand:SI 2 "general_operand" "K,i,mr"))))
6735 (clobber (reg:CC 17))]
6737 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6738 ; For the {r,0,i} alternative (i.e., register <- register * immediate),
6739 ; there are two ways of writing the exact same machine instruction
6740 ; in assembly language. One, for example, is:
6744 ; while the other is:
6746 ; imul $12, %eax, %eax
6748 ; The first is simply short-hand for the latter. But, some assemblers,
6749 ; like the SCO OSR5 COFF assembler, don't handle the first form.
6751 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
6752 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
6753 imul{l}\t{%2, %k0|%k0, %2}"
6754 [(set_attr "type" "imul")
6755 (set_attr "prefix_0f" "0,0,1")
6756 (set_attr "mode" "SI")])
6758 (define_expand "mulhi3"
6759 [(parallel [(set (match_operand:HI 0 "register_operand" "")
6760 (mult:HI (match_operand:HI 1 "register_operand" "")
6761 (match_operand:HI 2 "general_operand" "")))
6762 (clobber (reg:CC 17))])]
6763 "TARGET_HIMODE_MATH"
6766 (define_insn "*mulhi3_1"
6767 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
6768 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,0,0")
6769 (match_operand:HI 2 "general_operand" "K,i,mr")))
6770 (clobber (reg:CC 17))]
6771 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
6772 ; %%% There was a note about "Assembler has weird restrictions",
6773 ; concerning alternative 1 when op1 == op0. True?
6775 imul{w}\t{%2, %1, %0|%0, %1, %2}
6776 imul{w}\t{%2, %1, %0|%0, %1, %2}
6777 imul{w}\t{%2, %0|%0, %2}"
6778 [(set_attr "type" "imul")
6779 (set_attr "prefix_0f" "0,0,1")
6780 (set_attr "mode" "HI")])
6782 (define_expand "mulqi3"
6783 [(parallel [(set (match_operand:QI 0 "register_operand" "")
6784 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "")
6785 (match_operand:QI 2 "register_operand" "")))
6786 (clobber (reg:CC 17))])]
6787 "TARGET_QIMODE_MATH"
6790 (define_insn "*mulqi3_1"
6791 [(set (match_operand:QI 0 "register_operand" "=a")
6792 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
6793 (match_operand:QI 2 "nonimmediate_operand" "qm")))
6794 (clobber (reg:CC 17))]
6796 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6798 [(set_attr "type" "imul")
6799 (set_attr "length_immediate" "0")
6800 (set_attr "mode" "QI")])
6802 (define_expand "umulqihi3"
6803 [(parallel [(set (match_operand:HI 0 "register_operand" "")
6804 (mult:HI (zero_extend:HI
6805 (match_operand:QI 1 "nonimmediate_operand" ""))
6807 (match_operand:QI 2 "register_operand" ""))))
6808 (clobber (reg:CC 17))])]
6809 "TARGET_QIMODE_MATH"
6812 (define_insn "*umulqihi3_1"
6813 [(set (match_operand:HI 0 "register_operand" "=a")
6814 (mult:HI (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
6815 (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
6816 (clobber (reg:CC 17))]
6818 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6820 [(set_attr "type" "imul")
6821 (set_attr "length_immediate" "0")
6822 (set_attr "mode" "QI")])
6824 (define_expand "mulqihi3"
6825 [(parallel [(set (match_operand:HI 0 "register_operand" "")
6826 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" ""))
6827 (sign_extend:HI (match_operand:QI 2 "register_operand" ""))))
6828 (clobber (reg:CC 17))])]
6829 "TARGET_QIMODE_MATH"
6832 (define_insn "*mulqihi3_insn"
6833 [(set (match_operand:HI 0 "register_operand" "=a")
6834 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
6835 (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
6836 (clobber (reg:CC 17))]
6838 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6840 [(set_attr "type" "imul")
6841 (set_attr "length_immediate" "0")
6842 (set_attr "mode" "QI")])
6844 (define_expand "umulditi3"
6845 [(parallel [(set (match_operand:TI 0 "register_operand" "")
6846 (mult:TI (zero_extend:TI
6847 (match_operand:DI 1 "nonimmediate_operand" ""))
6849 (match_operand:DI 2 "register_operand" ""))))
6850 (clobber (reg:CC 17))])]
6854 (define_insn "*umulditi3_insn"
6855 [(set (match_operand:TI 0 "register_operand" "=A")
6856 (mult:TI (zero_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
6857 (zero_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
6858 (clobber (reg:CC 17))]
6860 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6862 [(set_attr "type" "imul")
6863 (set_attr "ppro_uops" "few")
6864 (set_attr "length_immediate" "0")
6865 (set_attr "mode" "DI")])
6867 ;; We can't use this pattern in 64bit mode, since it results in two separate 32bit registers
6868 (define_expand "umulsidi3"
6869 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6870 (mult:DI (zero_extend:DI
6871 (match_operand:SI 1 "nonimmediate_operand" ""))
6873 (match_operand:SI 2 "register_operand" ""))))
6874 (clobber (reg:CC 17))])]
6878 (define_insn "*umulsidi3_insn"
6879 [(set (match_operand:DI 0 "register_operand" "=A")
6880 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
6881 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
6882 (clobber (reg:CC 17))]
6884 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6886 [(set_attr "type" "imul")
6887 (set_attr "ppro_uops" "few")
6888 (set_attr "length_immediate" "0")
6889 (set_attr "mode" "SI")])
6891 (define_expand "mulditi3"
6892 [(parallel [(set (match_operand:TI 0 "register_operand" "")
6893 (mult:TI (sign_extend:TI
6894 (match_operand:DI 1 "nonimmediate_operand" ""))
6896 (match_operand:DI 2 "register_operand" ""))))
6897 (clobber (reg:CC 17))])]
6901 (define_insn "*mulditi3_insn"
6902 [(set (match_operand:TI 0 "register_operand" "=A")
6903 (mult:TI (sign_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
6904 (sign_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
6905 (clobber (reg:CC 17))]
6907 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6909 [(set_attr "type" "imul")
6910 (set_attr "length_immediate" "0")
6911 (set_attr "mode" "DI")])
6913 (define_expand "mulsidi3"
6914 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6915 (mult:DI (sign_extend:DI
6916 (match_operand:SI 1 "nonimmediate_operand" ""))
6918 (match_operand:SI 2 "register_operand" ""))))
6919 (clobber (reg:CC 17))])]
6923 (define_insn "*mulsidi3_insn"
6924 [(set (match_operand:DI 0 "register_operand" "=A")
6925 (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
6926 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
6927 (clobber (reg:CC 17))]
6929 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6931 [(set_attr "type" "imul")
6932 (set_attr "length_immediate" "0")
6933 (set_attr "mode" "SI")])
6935 (define_expand "umuldi3_highpart"
6936 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6939 (mult:TI (zero_extend:TI
6940 (match_operand:DI 1 "nonimmediate_operand" ""))
6942 (match_operand:DI 2 "register_operand" "")))
6944 (clobber (match_scratch:DI 3 ""))
6945 (clobber (reg:CC 17))])]
6949 (define_insn "*umuldi3_highpart_rex64"
6950 [(set (match_operand:DI 0 "register_operand" "=d")
6953 (mult:TI (zero_extend:TI
6954 (match_operand:DI 1 "nonimmediate_operand" "%a"))
6956 (match_operand:DI 2 "nonimmediate_operand" "rm")))
6958 (clobber (match_scratch:DI 3 "=1"))
6959 (clobber (reg:CC 17))]
6961 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6963 [(set_attr "type" "imul")
6964 (set_attr "ppro_uops" "few")
6965 (set_attr "length_immediate" "0")
6966 (set_attr "mode" "DI")])
6968 (define_expand "umulsi3_highpart"
6969 [(parallel [(set (match_operand:SI 0 "register_operand" "")
6972 (mult:DI (zero_extend:DI
6973 (match_operand:SI 1 "nonimmediate_operand" ""))
6975 (match_operand:SI 2 "register_operand" "")))
6977 (clobber (match_scratch:SI 3 ""))
6978 (clobber (reg:CC 17))])]
6982 (define_insn "*umulsi3_highpart_insn"
6983 [(set (match_operand:SI 0 "register_operand" "=d")
6986 (mult:DI (zero_extend:DI
6987 (match_operand:SI 1 "nonimmediate_operand" "%a"))
6989 (match_operand:SI 2 "nonimmediate_operand" "rm")))
6991 (clobber (match_scratch:SI 3 "=1"))
6992 (clobber (reg:CC 17))]
6993 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
6995 [(set_attr "type" "imul")
6996 (set_attr "ppro_uops" "few")
6997 (set_attr "length_immediate" "0")
6998 (set_attr "mode" "SI")])
7000 (define_insn "*umulsi3_highpart_zext"
7001 [(set (match_operand:DI 0 "register_operand" "=d")
7002 (zero_extend:DI (truncate:SI
7004 (mult:DI (zero_extend:DI
7005 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7007 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7009 (clobber (match_scratch:SI 3 "=1"))
7010 (clobber (reg:CC 17))]
7012 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7014 [(set_attr "type" "imul")
7015 (set_attr "ppro_uops" "few")
7016 (set_attr "length_immediate" "0")
7017 (set_attr "mode" "SI")])
7019 (define_expand "smuldi3_highpart"
7020 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
7023 (mult:TI (sign_extend:TI
7024 (match_operand:DI 1 "nonimmediate_operand" ""))
7026 (match_operand:DI 2 "register_operand" "")))
7028 (clobber (match_scratch:DI 3 ""))
7029 (clobber (reg:CC 17))])]
7033 (define_insn "*smuldi3_highpart_rex64"
7034 [(set (match_operand:DI 0 "register_operand" "=d")
7037 (mult:TI (sign_extend:TI
7038 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7040 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7042 (clobber (match_scratch:DI 3 "=1"))
7043 (clobber (reg:CC 17))]
7045 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7047 [(set_attr "type" "imul")
7048 (set_attr "ppro_uops" "few")
7049 (set_attr "mode" "DI")])
7051 (define_expand "smulsi3_highpart"
7052 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7055 (mult:DI (sign_extend:DI
7056 (match_operand:SI 1 "nonimmediate_operand" ""))
7058 (match_operand:SI 2 "register_operand" "")))
7060 (clobber (match_scratch:SI 3 ""))
7061 (clobber (reg:CC 17))])]
7065 (define_insn "*smulsi3_highpart_insn"
7066 [(set (match_operand:SI 0 "register_operand" "=d")
7069 (mult:DI (sign_extend:DI
7070 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7072 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7074 (clobber (match_scratch:SI 3 "=1"))
7075 (clobber (reg:CC 17))]
7076 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7078 [(set_attr "type" "imul")
7079 (set_attr "ppro_uops" "few")
7080 (set_attr "mode" "SI")])
7082 (define_insn "*smulsi3_highpart_zext"
7083 [(set (match_operand:DI 0 "register_operand" "=d")
7084 (zero_extend:DI (truncate:SI
7086 (mult:DI (sign_extend:DI
7087 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7089 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7091 (clobber (match_scratch:SI 3 "=1"))
7092 (clobber (reg:CC 17))]
7094 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7096 [(set_attr "type" "imul")
7097 (set_attr "ppro_uops" "few")
7098 (set_attr "mode" "SI")])
7100 ;; The patterns that match these are at the end of this file.
7102 (define_expand "mulxf3"
7103 [(set (match_operand:XF 0 "register_operand" "")
7104 (mult:XF (match_operand:XF 1 "register_operand" "")
7105 (match_operand:XF 2 "register_operand" "")))]
7106 "!TARGET_64BIT && TARGET_80387"
7109 (define_expand "multf3"
7110 [(set (match_operand:TF 0 "register_operand" "")
7111 (mult:TF (match_operand:TF 1 "register_operand" "")
7112 (match_operand:TF 2 "register_operand" "")))]
7116 (define_expand "muldf3"
7117 [(set (match_operand:DF 0 "register_operand" "")
7118 (mult:DF (match_operand:DF 1 "register_operand" "")
7119 (match_operand:DF 2 "nonimmediate_operand" "")))]
7120 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7123 (define_expand "mulsf3"
7124 [(set (match_operand:SF 0 "register_operand" "")
7125 (mult:SF (match_operand:SF 1 "register_operand" "")
7126 (match_operand:SF 2 "nonimmediate_operand" "")))]
7127 "TARGET_80387 || TARGET_SSE_MATH"
7130 ;; Divide instructions
7132 (define_insn "divqi3"
7133 [(set (match_operand:QI 0 "register_operand" "=a")
7134 (div:QI (match_operand:HI 1 "register_operand" "0")
7135 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7136 (clobber (reg:CC 17))]
7137 "TARGET_QIMODE_MATH"
7139 [(set_attr "type" "idiv")
7140 (set_attr "mode" "QI")
7141 (set_attr "ppro_uops" "few")])
7143 (define_insn "udivqi3"
7144 [(set (match_operand:QI 0 "register_operand" "=a")
7145 (udiv:QI (match_operand:HI 1 "register_operand" "0")
7146 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7147 (clobber (reg:CC 17))]
7148 "TARGET_QIMODE_MATH"
7150 [(set_attr "type" "idiv")
7151 (set_attr "mode" "QI")
7152 (set_attr "ppro_uops" "few")])
7154 ;; The patterns that match these are at the end of this file.
7156 (define_expand "divxf3"
7157 [(set (match_operand:XF 0 "register_operand" "")
7158 (div:XF (match_operand:XF 1 "register_operand" "")
7159 (match_operand:XF 2 "register_operand" "")))]
7160 "!TARGET_64BIT && TARGET_80387"
7163 (define_expand "divtf3"
7164 [(set (match_operand:TF 0 "register_operand" "")
7165 (div:TF (match_operand:TF 1 "register_operand" "")
7166 (match_operand:TF 2 "register_operand" "")))]
7170 (define_expand "divdf3"
7171 [(set (match_operand:DF 0 "register_operand" "")
7172 (div:DF (match_operand:DF 1 "register_operand" "")
7173 (match_operand:DF 2 "nonimmediate_operand" "")))]
7174 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7177 (define_expand "divsf3"
7178 [(set (match_operand:SF 0 "register_operand" "")
7179 (div:SF (match_operand:SF 1 "register_operand" "")
7180 (match_operand:SF 2 "nonimmediate_operand" "")))]
7181 "TARGET_80387 || TARGET_SSE_MATH"
7184 ;; Remainder instructions.
7186 (define_expand "divmoddi4"
7187 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7188 (div:DI (match_operand:DI 1 "register_operand" "")
7189 (match_operand:DI 2 "nonimmediate_operand" "")))
7190 (set (match_operand:DI 3 "register_operand" "")
7191 (mod:DI (match_dup 1) (match_dup 2)))
7192 (clobber (reg:CC 17))])]
7196 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7197 ;; Penalize eax case sligthly because it results in worse scheduling
7199 (define_insn "*divmoddi4_nocltd_rex64"
7200 [(set (match_operand:DI 0 "register_operand" "=&a,?a")
7201 (div:DI (match_operand:DI 2 "register_operand" "1,0")
7202 (match_operand:DI 3 "nonimmediate_operand" "rm,rm")))
7203 (set (match_operand:DI 1 "register_operand" "=&d,&d")
7204 (mod:DI (match_dup 2) (match_dup 3)))
7205 (clobber (reg:CC 17))]
7206 "TARGET_64BIT && !optimize_size && !TARGET_USE_CLTD"
7208 [(set_attr "type" "multi")])
7210 (define_insn "*divmoddi4_cltd_rex64"
7211 [(set (match_operand:DI 0 "register_operand" "=a")
7212 (div:DI (match_operand:DI 2 "register_operand" "a")
7213 (match_operand:DI 3 "nonimmediate_operand" "rm")))
7214 (set (match_operand:DI 1 "register_operand" "=&d")
7215 (mod:DI (match_dup 2) (match_dup 3)))
7216 (clobber (reg:CC 17))]
7217 "TARGET_64BIT && (optimize_size || TARGET_USE_CLTD)"
7219 [(set_attr "type" "multi")])
7221 (define_insn "*divmoddi_noext_rex64"
7222 [(set (match_operand:DI 0 "register_operand" "=a")
7223 (div:DI (match_operand:DI 1 "register_operand" "0")
7224 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7225 (set (match_operand:DI 3 "register_operand" "=d")
7226 (mod:DI (match_dup 1) (match_dup 2)))
7227 (use (match_operand:DI 4 "register_operand" "3"))
7228 (clobber (reg:CC 17))]
7231 [(set_attr "type" "idiv")
7232 (set_attr "mode" "DI")
7233 (set_attr "ppro_uops" "few")])
7236 [(set (match_operand:DI 0 "register_operand" "")
7237 (div:DI (match_operand:DI 1 "register_operand" "")
7238 (match_operand:DI 2 "nonimmediate_operand" "")))
7239 (set (match_operand:DI 3 "register_operand" "")
7240 (mod:DI (match_dup 1) (match_dup 2)))
7241 (clobber (reg:CC 17))]
7242 "TARGET_64BIT && reload_completed"
7243 [(parallel [(set (match_dup 3)
7244 (ashiftrt:DI (match_dup 4) (const_int 63)))
7245 (clobber (reg:CC 17))])
7246 (parallel [(set (match_dup 0)
7247 (div:DI (reg:DI 0) (match_dup 2)))
7249 (mod:DI (reg:DI 0) (match_dup 2)))
7251 (clobber (reg:CC 17))])]
7253 /* Avoid use of cltd in favour of a mov+shift. */
7254 if (!TARGET_USE_CLTD && !optimize_size)
7256 if (true_regnum (operands[1]))
7257 emit_move_insn (operands[0], operands[1]);
7259 emit_move_insn (operands[3], operands[1]);
7260 operands[4] = operands[3];
7264 if (true_regnum (operands[1]))
7266 operands[4] = operands[1];
7271 (define_expand "divmodsi4"
7272 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7273 (div:SI (match_operand:SI 1 "register_operand" "")
7274 (match_operand:SI 2 "nonimmediate_operand" "")))
7275 (set (match_operand:SI 3 "register_operand" "")
7276 (mod:SI (match_dup 1) (match_dup 2)))
7277 (clobber (reg:CC 17))])]
7281 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7282 ;; Penalize eax case sligthly because it results in worse scheduling
7284 (define_insn "*divmodsi4_nocltd"
7285 [(set (match_operand:SI 0 "register_operand" "=&a,?a")
7286 (div:SI (match_operand:SI 2 "register_operand" "1,0")
7287 (match_operand:SI 3 "nonimmediate_operand" "rm,rm")))
7288 (set (match_operand:SI 1 "register_operand" "=&d,&d")
7289 (mod:SI (match_dup 2) (match_dup 3)))
7290 (clobber (reg:CC 17))]
7291 "!optimize_size && !TARGET_USE_CLTD"
7293 [(set_attr "type" "multi")])
7295 (define_insn "*divmodsi4_cltd"
7296 [(set (match_operand:SI 0 "register_operand" "=a")
7297 (div:SI (match_operand:SI 2 "register_operand" "a")
7298 (match_operand:SI 3 "nonimmediate_operand" "rm")))
7299 (set (match_operand:SI 1 "register_operand" "=&d")
7300 (mod:SI (match_dup 2) (match_dup 3)))
7301 (clobber (reg:CC 17))]
7302 "optimize_size || TARGET_USE_CLTD"
7304 [(set_attr "type" "multi")])
7306 (define_insn "*divmodsi_noext"
7307 [(set (match_operand:SI 0 "register_operand" "=a")
7308 (div:SI (match_operand:SI 1 "register_operand" "0")
7309 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7310 (set (match_operand:SI 3 "register_operand" "=d")
7311 (mod:SI (match_dup 1) (match_dup 2)))
7312 (use (match_operand:SI 4 "register_operand" "3"))
7313 (clobber (reg:CC 17))]
7316 [(set_attr "type" "idiv")
7317 (set_attr "mode" "SI")
7318 (set_attr "ppro_uops" "few")])
7321 [(set (match_operand:SI 0 "register_operand" "")
7322 (div:SI (match_operand:SI 1 "register_operand" "")
7323 (match_operand:SI 2 "nonimmediate_operand" "")))
7324 (set (match_operand:SI 3 "register_operand" "")
7325 (mod:SI (match_dup 1) (match_dup 2)))
7326 (clobber (reg:CC 17))]
7328 [(parallel [(set (match_dup 3)
7329 (ashiftrt:SI (match_dup 4) (const_int 31)))
7330 (clobber (reg:CC 17))])
7331 (parallel [(set (match_dup 0)
7332 (div:SI (reg:SI 0) (match_dup 2)))
7334 (mod:SI (reg:SI 0) (match_dup 2)))
7336 (clobber (reg:CC 17))])]
7338 /* Avoid use of cltd in favour of a mov+shift. */
7339 if (!TARGET_USE_CLTD && !optimize_size)
7341 if (true_regnum (operands[1]))
7342 emit_move_insn (operands[0], operands[1]);
7344 emit_move_insn (operands[3], operands[1]);
7345 operands[4] = operands[3];
7349 if (true_regnum (operands[1]))
7351 operands[4] = operands[1];
7355 (define_insn "divmodhi4"
7356 [(set (match_operand:HI 0 "register_operand" "=a")
7357 (div:HI (match_operand:HI 1 "register_operand" "0")
7358 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7359 (set (match_operand:HI 3 "register_operand" "=&d")
7360 (mod:HI (match_dup 1) (match_dup 2)))
7361 (clobber (reg:CC 17))]
7362 "TARGET_HIMODE_MATH"
7364 [(set_attr "type" "multi")
7365 (set_attr "length_immediate" "0")
7366 (set_attr "mode" "SI")])
7368 (define_insn "udivmoddi4"
7369 [(set (match_operand:DI 0 "register_operand" "=a")
7370 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7371 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7372 (set (match_operand:DI 3 "register_operand" "=&d")
7373 (umod:DI (match_dup 1) (match_dup 2)))
7374 (clobber (reg:CC 17))]
7376 "xor{q}\t%3, %3\;div{q}\t%2"
7377 [(set_attr "type" "multi")
7378 (set_attr "length_immediate" "0")
7379 (set_attr "mode" "DI")])
7381 (define_insn "*udivmoddi4_noext"
7382 [(set (match_operand:DI 0 "register_operand" "=a")
7383 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7384 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7385 (set (match_operand:DI 3 "register_operand" "=d")
7386 (umod:DI (match_dup 1) (match_dup 2)))
7388 (clobber (reg:CC 17))]
7391 [(set_attr "type" "idiv")
7392 (set_attr "ppro_uops" "few")
7393 (set_attr "mode" "DI")])
7396 [(set (match_operand:DI 0 "register_operand" "")
7397 (udiv:DI (match_operand:DI 1 "register_operand" "")
7398 (match_operand:DI 2 "nonimmediate_operand" "")))
7399 (set (match_operand:DI 3 "register_operand" "")
7400 (umod:DI (match_dup 1) (match_dup 2)))
7401 (clobber (reg:CC 17))]
7402 "TARGET_64BIT && reload_completed"
7403 [(set (match_dup 3) (const_int 0))
7404 (parallel [(set (match_dup 0)
7405 (udiv:DI (match_dup 1) (match_dup 2)))
7407 (umod:DI (match_dup 1) (match_dup 2)))
7409 (clobber (reg:CC 17))])]
7412 (define_insn "udivmodsi4"
7413 [(set (match_operand:SI 0 "register_operand" "=a")
7414 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7415 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7416 (set (match_operand:SI 3 "register_operand" "=&d")
7417 (umod:SI (match_dup 1) (match_dup 2)))
7418 (clobber (reg:CC 17))]
7420 "xor{l}\t%3, %3\;div{l}\t%2"
7421 [(set_attr "type" "multi")
7422 (set_attr "length_immediate" "0")
7423 (set_attr "mode" "SI")])
7425 (define_insn "*udivmodsi4_noext"
7426 [(set (match_operand:SI 0 "register_operand" "=a")
7427 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7428 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7429 (set (match_operand:SI 3 "register_operand" "=d")
7430 (umod:SI (match_dup 1) (match_dup 2)))
7432 (clobber (reg:CC 17))]
7435 [(set_attr "type" "idiv")
7436 (set_attr "ppro_uops" "few")
7437 (set_attr "mode" "SI")])
7440 [(set (match_operand:SI 0 "register_operand" "")
7441 (udiv:SI (match_operand:SI 1 "register_operand" "")
7442 (match_operand:SI 2 "nonimmediate_operand" "")))
7443 (set (match_operand:SI 3 "register_operand" "")
7444 (umod:SI (match_dup 1) (match_dup 2)))
7445 (clobber (reg:CC 17))]
7447 [(set (match_dup 3) (const_int 0))
7448 (parallel [(set (match_dup 0)
7449 (udiv:SI (match_dup 1) (match_dup 2)))
7451 (umod:SI (match_dup 1) (match_dup 2)))
7453 (clobber (reg:CC 17))])]
7456 (define_expand "udivmodhi4"
7457 [(set (match_dup 4) (const_int 0))
7458 (parallel [(set (match_operand:HI 0 "register_operand" "")
7459 (udiv:HI (match_operand:HI 1 "register_operand" "")
7460 (match_operand:HI 2 "nonimmediate_operand" "")))
7461 (set (match_operand:HI 3 "register_operand" "")
7462 (umod:HI (match_dup 1) (match_dup 2)))
7464 (clobber (reg:CC 17))])]
7465 "TARGET_HIMODE_MATH"
7466 "operands[4] = gen_reg_rtx (HImode);")
7468 (define_insn "*udivmodhi_noext"
7469 [(set (match_operand:HI 0 "register_operand" "=a")
7470 (udiv:HI (match_operand:HI 1 "register_operand" "0")
7471 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7472 (set (match_operand:HI 3 "register_operand" "=d")
7473 (umod:HI (match_dup 1) (match_dup 2)))
7474 (use (match_operand:HI 4 "register_operand" "3"))
7475 (clobber (reg:CC 17))]
7478 [(set_attr "type" "idiv")
7479 (set_attr "mode" "HI")
7480 (set_attr "ppro_uops" "few")])
7482 ;; We can not use div/idiv for double division, because it causes
7483 ;; "division by zero" on the overflow and that's not what we expect
7484 ;; from truncate. Because true (non truncating) double division is
7485 ;; never generated, we can't create this insn anyway.
7488 ; [(set (match_operand:SI 0 "register_operand" "=a")
7490 ; (udiv:DI (match_operand:DI 1 "register_operand" "A")
7492 ; (match_operand:SI 2 "nonimmediate_operand" "rm")))))
7493 ; (set (match_operand:SI 3 "register_operand" "=d")
7495 ; (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
7496 ; (clobber (reg:CC 17))]
7498 ; "div{l}\t{%2, %0|%0, %2}"
7499 ; [(set_attr "type" "idiv")
7500 ; (set_attr "ppro_uops" "few")])
7502 ;;- Logical AND instructions
7504 ;; On Pentium, "test imm, reg" is pairable only with eax, ax, and al.
7505 ;; Note that this excludes ah.
7507 (define_insn "*testdi_1_rex64"
7510 (and:DI (match_operand:DI 0 "nonimmediate_operand" "%*a,r,*a,r,rm")
7511 (match_operand:DI 1 "x86_64_szext_nonmemory_operand" "Z,Z,e,e,re"))
7513 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
7515 test{l}\t{%k1, %k0|%k0, %k1}
7516 test{l}\t{%k1, %k0|%k0, %k1}
7517 test{q}\t{%1, %0|%0, %1}
7518 test{q}\t{%1, %0|%0, %1}
7519 test{q}\t{%1, %0|%0, %1}"
7520 [(set_attr "type" "test")
7521 (set_attr "modrm" "0,1,0,1,1")
7522 (set_attr "mode" "SI,SI,DI,DI,DI")
7523 (set_attr "pent_pair" "uv,np,uv,np,uv")])
7525 (define_insn "testsi_1"
7528 (and:SI (match_operand:SI 0 "nonimmediate_operand" "%*a,r,rm")
7529 (match_operand:SI 1 "nonmemory_operand" "in,in,rin"))
7531 "ix86_match_ccmode (insn, CCNOmode)"
7532 "test{l}\t{%1, %0|%0, %1}"
7533 [(set_attr "type" "test")
7534 (set_attr "modrm" "0,1,1")
7535 (set_attr "mode" "SI")
7536 (set_attr "pent_pair" "uv,np,uv")])
7538 (define_expand "testsi_ccno_1"
7541 (and:SI (match_operand:SI 0 "nonimmediate_operand" "")
7542 (match_operand:SI 1 "nonmemory_operand" ""))
7547 (define_insn "*testhi_1"
7549 (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%*a,r,rm")
7550 (match_operand:HI 1 "nonmemory_operand" "n,n,rn"))
7552 "ix86_match_ccmode (insn, CCNOmode)"
7553 "test{w}\t{%1, %0|%0, %1}"
7554 [(set_attr "type" "test")
7555 (set_attr "modrm" "0,1,1")
7556 (set_attr "mode" "HI")
7557 (set_attr "pent_pair" "uv,np,uv")])
7559 (define_expand "testqi_ccz_1"
7561 (compare:CCZ (and:QI (match_operand:QI 0 "nonimmediate_operand" "")
7562 (match_operand:QI 1 "nonmemory_operand" ""))
7567 (define_insn "*testqi_1"
7569 (compare (and:QI (match_operand:QI 0 "nonimmediate_operand" "%*a,q,qm,r")
7570 (match_operand:QI 1 "nonmemory_operand" "n,n,qn,n"))
7572 "ix86_match_ccmode (insn, CCNOmode)"
7574 if (which_alternative == 3)
7576 if (GET_CODE (operands[1]) == CONST_INT
7577 && (INTVAL (operands[1]) & 0xffffff00))
7578 operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
7579 return "test{l}\t{%1, %k0|%k0, %1}";
7581 return "test{b}\t{%1, %0|%0, %1}";
7583 [(set_attr "type" "test")
7584 (set_attr "modrm" "0,1,1,1")
7585 (set_attr "mode" "QI,QI,QI,SI")
7586 (set_attr "pent_pair" "uv,np,uv,np")])
7588 (define_expand "testqi_ext_ccno_0"
7593 (match_operand 0 "ext_register_operand" "")
7596 (match_operand 1 "const_int_operand" ""))
7601 (define_insn "*testqi_ext_0"
7606 (match_operand 0 "ext_register_operand" "Q")
7609 (match_operand 1 "const_int_operand" "n"))
7611 "ix86_match_ccmode (insn, CCNOmode)"
7612 "test{b}\t{%1, %h0|%h0, %1}"
7613 [(set_attr "type" "test")
7614 (set_attr "mode" "QI")
7615 (set_attr "length_immediate" "1")
7616 (set_attr "pent_pair" "np")])
7618 (define_insn "*testqi_ext_1"
7623 (match_operand 0 "ext_register_operand" "Q")
7627 (match_operand:QI 1 "nonimmediate_operand" "Qm")))
7629 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
7630 "test{b}\t{%1, %h0|%h0, %1}"
7631 [(set_attr "type" "test")
7632 (set_attr "mode" "QI")])
7634 (define_insn "*testqi_ext_1_rex64"
7639 (match_operand 0 "ext_register_operand" "Q")
7643 (match_operand:QI 1 "register_operand" "Q")))
7645 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
7646 "test{b}\t{%1, %h0|%h0, %1}"
7647 [(set_attr "type" "test")
7648 (set_attr "mode" "QI")])
7650 (define_insn "*testqi_ext_2"
7655 (match_operand 0 "ext_register_operand" "Q")
7659 (match_operand 1 "ext_register_operand" "Q")
7663 "ix86_match_ccmode (insn, CCNOmode)"
7664 "test{b}\t{%h1, %h0|%h0, %h1}"
7665 [(set_attr "type" "test")
7666 (set_attr "mode" "QI")])
7668 ;; Combine likes to form bit extractions for some tests. Humor it.
7669 (define_insn "*testqi_ext_3"
7671 (compare (zero_extract:SI
7672 (match_operand 0 "nonimmediate_operand" "rm")
7673 (match_operand:SI 1 "const_int_operand" "")
7674 (match_operand:SI 2 "const_int_operand" ""))
7676 "ix86_match_ccmode (insn, CCNOmode)
7677 && (GET_MODE (operands[0]) == SImode
7678 || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)
7679 || GET_MODE (operands[0]) == HImode
7680 || GET_MODE (operands[0]) == QImode)"
7683 (define_insn "*testqi_ext_3_rex64"
7685 (compare (zero_extract:DI
7686 (match_operand 0 "nonimmediate_operand" "rm")
7687 (match_operand:DI 1 "const_int_operand" "")
7688 (match_operand:DI 2 "const_int_operand" ""))
7691 && ix86_match_ccmode (insn, CCNOmode)
7692 /* The code below cannot deal with constants outside HOST_WIDE_INT. */
7693 && INTVAL (operands[1]) + INTVAL (operands[2]) < HOST_BITS_PER_WIDE_INT
7694 /* Ensure that resulting mask is zero or sign extended operand. */
7695 && (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
7696 || (INTVAL (operands[1]) + INTVAL (operands[2]) == 64
7697 && INTVAL (operands[1]) > 32))
7698 && (GET_MODE (operands[0]) == SImode
7699 || GET_MODE (operands[0]) == DImode
7700 || GET_MODE (operands[0]) == HImode
7701 || GET_MODE (operands[0]) == QImode)"
7706 (compare (zero_extract
7707 (match_operand 0 "nonimmediate_operand" "")
7708 (match_operand 1 "const_int_operand" "")
7709 (match_operand 2 "const_int_operand" ""))
7711 "ix86_match_ccmode (insn, CCNOmode)"
7712 [(set (reg:CCNO 17) (compare:CCNO (match_dup 3) (const_int 0)))]
7714 HOST_WIDE_INT len = INTVAL (operands[1]);
7715 HOST_WIDE_INT pos = INTVAL (operands[2]);
7717 enum machine_mode mode, submode;
7719 mode = GET_MODE (operands[0]);
7720 if (GET_CODE (operands[0]) == MEM)
7722 /* ??? Combine likes to put non-volatile mem extractions in QImode
7723 no matter the size of the test. So find a mode that works. */
7724 if (! MEM_VOLATILE_P (operands[0]))
7726 mode = smallest_mode_for_size (pos + len, MODE_INT);
7727 operands[0] = adjust_address (operands[0], mode, 0);
7730 else if (GET_CODE (operands[0]) == SUBREG
7731 && (submode = GET_MODE (SUBREG_REG (operands[0])),
7732 GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode))
7733 && pos + len <= GET_MODE_BITSIZE (submode))
7735 /* Narrow a paradoxical subreg to prevent partial register stalls. */
7737 operands[0] = SUBREG_REG (operands[0]);
7739 else if (mode == HImode && pos + len <= 8)
7741 /* Small HImode tests can be converted to QImode. */
7743 operands[0] = gen_lowpart (QImode, operands[0]);
7746 mask = ((HOST_WIDE_INT)1 << (pos + len)) - 1;
7747 mask &= ~(((HOST_WIDE_INT)1 << pos) - 1);
7749 operands[3] = gen_rtx_AND (mode, operands[0], gen_int_mode (mask, mode));
7752 ;; Convert HImode/SImode test instructions with immediate to QImode ones.
7753 ;; i386 does not allow to encode test with 8bit sign extended immediate, so
7754 ;; this is relatively important trick.
7755 ;; Do the converison only post-reload to avoid limiting of the register class
7760 (and (match_operand 0 "register_operand" "")
7761 (match_operand 1 "const_int_operand" ""))
7764 && QI_REG_P (operands[0])
7765 && ((ix86_match_ccmode (insn, CCZmode)
7766 && !(INTVAL (operands[1]) & ~(255 << 8)))
7767 || (ix86_match_ccmode (insn, CCNOmode)
7768 && !(INTVAL (operands[1]) & ~(127 << 8))))
7769 && GET_MODE (operands[0]) != QImode"
7772 (and:SI (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
7775 "operands[0] = gen_lowpart (SImode, operands[0]);
7776 operands[1] = gen_int_mode (INTVAL (operands[1]) >> 8, SImode);")
7781 (and (match_operand 0 "nonimmediate_operand" "")
7782 (match_operand 1 "const_int_operand" ""))
7785 && (!REG_P (operands[0]) || ANY_QI_REG_P (operands[0]))
7786 && ((ix86_match_ccmode (insn, CCZmode)
7787 && !(INTVAL (operands[1]) & ~255))
7788 || (ix86_match_ccmode (insn, CCNOmode)
7789 && !(INTVAL (operands[1]) & ~127)))
7790 && GET_MODE (operands[0]) != QImode"
7793 (and:QI (match_dup 0)
7796 "operands[0] = gen_lowpart (QImode, operands[0]);
7797 operands[1] = gen_lowpart (QImode, operands[1]);")
7800 ;; %%% This used to optimize known byte-wide and operations to memory,
7801 ;; and sometimes to QImode registers. If this is considered useful,
7802 ;; it should be done with splitters.
7804 (define_expand "anddi3"
7805 [(set (match_operand:DI 0 "nonimmediate_operand" "")
7806 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
7807 (match_operand:DI 2 "x86_64_szext_general_operand" "")))
7808 (clobber (reg:CC 17))]
7810 "ix86_expand_binary_operator (AND, DImode, operands); DONE;")
7812 (define_insn "*anddi_1_rex64"
7813 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r,r")
7814 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,qm")
7815 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,re,rm,L")))
7816 (clobber (reg:CC 17))]
7817 "TARGET_64BIT && ix86_binary_operator_ok (AND, DImode, operands)"
7819 switch (get_attr_type (insn))
7823 enum machine_mode mode;
7825 if (GET_CODE (operands[2]) != CONST_INT)
7827 if (INTVAL (operands[2]) == 0xff)
7829 else if (INTVAL (operands[2]) == 0xffff)
7834 operands[1] = gen_lowpart (mode, operands[1]);
7836 return "movz{bq|x}\t{%1,%0|%0, %1}";
7838 return "movz{wq|x}\t{%1,%0|%0, %1}";
7842 if (! rtx_equal_p (operands[0], operands[1]))
7844 if (get_attr_mode (insn) == MODE_SI)
7845 return "and{l}\t{%k2, %k0|%k0, %k2}";
7847 return "and{q}\t{%2, %0|%0, %2}";
7850 [(set_attr "type" "alu,alu,alu,imovx")
7851 (set_attr "length_immediate" "*,*,*,0")
7852 (set_attr "mode" "SI,DI,DI,DI")])
7854 (define_insn "*anddi_2"
7856 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
7857 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,rem,re"))
7859 (set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm")
7860 (and:DI (match_dup 1) (match_dup 2)))]
7861 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
7862 && ix86_binary_operator_ok (AND, DImode, operands)"
7864 and{l}\t{%k2, %k0|%k0, %k2}
7865 and{q}\t{%2, %0|%0, %2}
7866 and{q}\t{%2, %0|%0, %2}"
7867 [(set_attr "type" "alu")
7868 (set_attr "mode" "SI,DI,DI")])
7870 (define_expand "andsi3"
7871 [(set (match_operand:SI 0 "nonimmediate_operand" "")
7872 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
7873 (match_operand:SI 2 "general_operand" "")))
7874 (clobber (reg:CC 17))]
7876 "ix86_expand_binary_operator (AND, SImode, operands); DONE;")
7878 (define_insn "*andsi_1"
7879 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r,r")
7880 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,qm")
7881 (match_operand:SI 2 "general_operand" "ri,rm,L")))
7882 (clobber (reg:CC 17))]
7883 "ix86_binary_operator_ok (AND, SImode, operands)"
7885 switch (get_attr_type (insn))
7889 enum machine_mode mode;
7891 if (GET_CODE (operands[2]) != CONST_INT)
7893 if (INTVAL (operands[2]) == 0xff)
7895 else if (INTVAL (operands[2]) == 0xffff)
7900 operands[1] = gen_lowpart (mode, operands[1]);
7902 return "movz{bl|x}\t{%1,%0|%0, %1}";
7904 return "movz{wl|x}\t{%1,%0|%0, %1}";
7908 if (! rtx_equal_p (operands[0], operands[1]))
7910 return "and{l}\t{%2, %0|%0, %2}";
7913 [(set_attr "type" "alu,alu,imovx")
7914 (set_attr "length_immediate" "*,*,0")
7915 (set_attr "mode" "SI")])
7918 [(set (match_operand 0 "register_operand" "")
7920 (const_int -65536)))
7921 (clobber (reg:CC 17))]
7922 "optimize_size || (TARGET_FAST_PREFIX && !TARGET_PARTIAL_REG_STALL)"
7923 [(set (strict_low_part (match_dup 1)) (const_int 0))]
7924 "operands[1] = gen_lowpart (HImode, operands[0]);")
7927 [(set (match_operand 0 "ext_register_operand" "")
7930 (clobber (reg:CC 17))]
7931 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
7932 [(set (strict_low_part (match_dup 1)) (const_int 0))]
7933 "operands[1] = gen_lowpart (QImode, operands[0]);")
7936 [(set (match_operand 0 "ext_register_operand" "")
7938 (const_int -65281)))
7939 (clobber (reg:CC 17))]
7940 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
7941 [(parallel [(set (zero_extract:SI (match_dup 0)
7945 (zero_extract:SI (match_dup 0)
7948 (zero_extract:SI (match_dup 0)
7951 (clobber (reg:CC 17))])]
7952 "operands[0] = gen_lowpart (SImode, operands[0]);")
7954 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
7955 (define_insn "*andsi_1_zext"
7956 [(set (match_operand:DI 0 "register_operand" "=r")
7958 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
7959 (match_operand:SI 2 "general_operand" "rim"))))
7960 (clobber (reg:CC 17))]
7961 "TARGET_64BIT && ix86_binary_operator_ok (AND, SImode, operands)"
7962 "and{l}\t{%2, %k0|%k0, %2}"
7963 [(set_attr "type" "alu")
7964 (set_attr "mode" "SI")])
7966 (define_insn "*andsi_2"
7968 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
7969 (match_operand:SI 2 "general_operand" "rim,ri"))
7971 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
7972 (and:SI (match_dup 1) (match_dup 2)))]
7973 "ix86_match_ccmode (insn, CCNOmode)
7974 && ix86_binary_operator_ok (AND, SImode, operands)"
7975 "and{l}\t{%2, %0|%0, %2}"
7976 [(set_attr "type" "alu")
7977 (set_attr "mode" "SI")])
7979 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
7980 (define_insn "*andsi_2_zext"
7982 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
7983 (match_operand:SI 2 "general_operand" "rim"))
7985 (set (match_operand:DI 0 "register_operand" "=r")
7986 (zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))]
7987 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
7988 && ix86_binary_operator_ok (AND, SImode, operands)"
7989 "and{l}\t{%2, %k0|%k0, %2}"
7990 [(set_attr "type" "alu")
7991 (set_attr "mode" "SI")])
7993 (define_expand "andhi3"
7994 [(set (match_operand:HI 0 "nonimmediate_operand" "")
7995 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
7996 (match_operand:HI 2 "general_operand" "")))
7997 (clobber (reg:CC 17))]
7998 "TARGET_HIMODE_MATH"
7999 "ix86_expand_binary_operator (AND, HImode, operands); DONE;")
8001 (define_insn "*andhi_1"
8002 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
8003 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm")
8004 (match_operand:HI 2 "general_operand" "ri,rm,L")))
8005 (clobber (reg:CC 17))]
8006 "ix86_binary_operator_ok (AND, HImode, operands)"
8008 switch (get_attr_type (insn))
8011 if (GET_CODE (operands[2]) != CONST_INT)
8013 if (INTVAL (operands[2]) == 0xff)
8014 return "movz{bl|x}\t{%b1, %k0|%k0, %b1}";
8018 if (! rtx_equal_p (operands[0], operands[1]))
8021 return "and{w}\t{%2, %0|%0, %2}";
8024 [(set_attr "type" "alu,alu,imovx")
8025 (set_attr "length_immediate" "*,*,0")
8026 (set_attr "mode" "HI,HI,SI")])
8028 (define_insn "*andhi_2"
8030 (compare (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8031 (match_operand:HI 2 "general_operand" "rim,ri"))
8033 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8034 (and:HI (match_dup 1) (match_dup 2)))]
8035 "ix86_match_ccmode (insn, CCNOmode)
8036 && ix86_binary_operator_ok (AND, HImode, operands)"
8037 "and{w}\t{%2, %0|%0, %2}"
8038 [(set_attr "type" "alu")
8039 (set_attr "mode" "HI")])
8041 (define_expand "andqi3"
8042 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8043 (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
8044 (match_operand:QI 2 "general_operand" "")))
8045 (clobber (reg:CC 17))]
8046 "TARGET_QIMODE_MATH"
8047 "ix86_expand_binary_operator (AND, QImode, operands); DONE;")
8049 ;; %%% Potential partial reg stall on alternative 2. What to do?
8050 (define_insn "*andqi_1"
8051 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
8052 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8053 (match_operand:QI 2 "general_operand" "qi,qmi,ri")))
8054 (clobber (reg:CC 17))]
8055 "ix86_binary_operator_ok (AND, QImode, operands)"
8057 and{b}\t{%2, %0|%0, %2}
8058 and{b}\t{%2, %0|%0, %2}
8059 and{l}\t{%k2, %k0|%k0, %k2}"
8060 [(set_attr "type" "alu")
8061 (set_attr "mode" "QI,QI,SI")])
8063 (define_insn "*andqi_1_slp"
8064 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
8065 (and:QI (match_dup 0)
8066 (match_operand:QI 1 "general_operand" "qi,qmi")))
8067 (clobber (reg:CC 17))]
8068 "! TARGET_PARTIAL_REG_STALL || optimize_size"
8069 "and{b}\t{%1, %0|%0, %1}"
8070 [(set_attr "type" "alu1")
8071 (set_attr "mode" "QI")])
8073 (define_insn "*andqi_2"
8076 (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8077 (match_operand:QI 2 "general_operand" "qim,qi,i"))
8079 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm,*r")
8080 (and:QI (match_dup 1) (match_dup 2)))]
8081 "ix86_match_ccmode (insn, CCNOmode)
8082 && ix86_binary_operator_ok (AND, QImode, operands)"
8084 if (which_alternative == 2)
8086 if (GET_CODE (operands[2]) == CONST_INT
8087 && (INTVAL (operands[2]) & 0xffffff00))
8088 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff);
8089 return "and{l}\t{%2, %k0|%k0, %2}";
8091 return "and{b}\t{%2, %0|%0, %2}";
8093 [(set_attr "type" "alu")
8094 (set_attr "mode" "QI,QI,SI")])
8096 (define_insn "*andqi_2_slp"
8099 (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8100 (match_operand:QI 1 "nonimmediate_operand" "qmi,qi"))
8102 (set (strict_low_part (match_dup 0))
8103 (and:QI (match_dup 0) (match_dup 1)))]
8104 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8105 && ix86_match_ccmode (insn, CCNOmode)"
8106 "and{b}\t{%1, %0|%0, %1}"
8107 [(set_attr "type" "alu1")
8108 (set_attr "mode" "QI")])
8110 ;; ??? A bug in recog prevents it from recognizing a const_int as an
8111 ;; operand to zero_extend in andqi_ext_1. It was checking explicitly
8112 ;; for a QImode operand, which of course failed.
8114 (define_insn "andqi_ext_0"
8115 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8120 (match_operand 1 "ext_register_operand" "0")
8123 (match_operand 2 "const_int_operand" "n")))
8124 (clobber (reg:CC 17))]
8126 "and{b}\t{%2, %h0|%h0, %2}"
8127 [(set_attr "type" "alu")
8128 (set_attr "length_immediate" "1")
8129 (set_attr "mode" "QI")])
8131 ;; Generated by peephole translating test to and. This shows up
8132 ;; often in fp comparisons.
8134 (define_insn "*andqi_ext_0_cc"
8139 (match_operand 1 "ext_register_operand" "0")
8142 (match_operand 2 "const_int_operand" "n"))
8144 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8153 "ix86_match_ccmode (insn, CCNOmode)"
8154 "and{b}\t{%2, %h0|%h0, %2}"
8155 [(set_attr "type" "alu")
8156 (set_attr "length_immediate" "1")
8157 (set_attr "mode" "QI")])
8159 (define_insn "*andqi_ext_1"
8160 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8165 (match_operand 1 "ext_register_operand" "0")
8169 (match_operand:QI 2 "general_operand" "Qm"))))
8170 (clobber (reg:CC 17))]
8172 "and{b}\t{%2, %h0|%h0, %2}"
8173 [(set_attr "type" "alu")
8174 (set_attr "length_immediate" "0")
8175 (set_attr "mode" "QI")])
8177 (define_insn "*andqi_ext_1_rex64"
8178 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8183 (match_operand 1 "ext_register_operand" "0")
8187 (match_operand 2 "ext_register_operand" "Q"))))
8188 (clobber (reg:CC 17))]
8190 "and{b}\t{%2, %h0|%h0, %2}"
8191 [(set_attr "type" "alu")
8192 (set_attr "length_immediate" "0")
8193 (set_attr "mode" "QI")])
8195 (define_insn "*andqi_ext_2"
8196 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8201 (match_operand 1 "ext_register_operand" "%0")
8205 (match_operand 2 "ext_register_operand" "Q")
8208 (clobber (reg:CC 17))]
8210 "and{b}\t{%h2, %h0|%h0, %h2}"
8211 [(set_attr "type" "alu")
8212 (set_attr "length_immediate" "0")
8213 (set_attr "mode" "QI")])
8215 ;; Convert wide AND instructions with immediate operand to shorter QImode
8216 ;; equivalents when possible.
8217 ;; Don't do the splitting with memory operands, since it intoduces risc
8218 ;; of memory mismatch stalls. We may want to do the splitting for optimizing
8219 ;; for size, but that can (should?) be handled by generic code instead.
8221 [(set (match_operand 0 "register_operand" "")
8222 (and (match_operand 1 "register_operand" "")
8223 (match_operand 2 "const_int_operand" "")))
8224 (clobber (reg:CC 17))]
8226 && QI_REG_P (operands[0])
8227 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8228 && !(~INTVAL (operands[2]) & ~(255 << 8))
8229 && GET_MODE (operands[0]) != QImode"
8230 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8231 (and:SI (zero_extract:SI (match_dup 1)
8232 (const_int 8) (const_int 8))
8234 (clobber (reg:CC 17))])]
8235 "operands[0] = gen_lowpart (SImode, operands[0]);
8236 operands[1] = gen_lowpart (SImode, operands[1]);
8237 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8239 ;; Since AND can be encoded with sign extended immediate, this is only
8240 ;; profitable when 7th bit is not set.
8242 [(set (match_operand 0 "register_operand" "")
8243 (and (match_operand 1 "general_operand" "")
8244 (match_operand 2 "const_int_operand" "")))
8245 (clobber (reg:CC 17))]
8247 && ANY_QI_REG_P (operands[0])
8248 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8249 && !(~INTVAL (operands[2]) & ~255)
8250 && !(INTVAL (operands[2]) & 128)
8251 && GET_MODE (operands[0]) != QImode"
8252 [(parallel [(set (strict_low_part (match_dup 0))
8253 (and:QI (match_dup 1)
8255 (clobber (reg:CC 17))])]
8256 "operands[0] = gen_lowpart (QImode, operands[0]);
8257 operands[1] = gen_lowpart (QImode, operands[1]);
8258 operands[2] = gen_lowpart (QImode, operands[2]);")
8260 ;; Logical inclusive OR instructions
8262 ;; %%% This used to optimize known byte-wide and operations to memory.
8263 ;; If this is considered useful, it should be done with splitters.
8265 (define_expand "iordi3"
8266 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8267 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "")
8268 (match_operand:DI 2 "x86_64_general_operand" "")))
8269 (clobber (reg:CC 17))]
8271 "ix86_expand_binary_operator (IOR, DImode, operands); DONE;")
8273 (define_insn "*iordi_1_rex64"
8274 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8275 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8276 (match_operand:DI 2 "x86_64_general_operand" "re,rme")))
8277 (clobber (reg:CC 17))]
8279 && ix86_binary_operator_ok (IOR, DImode, operands)"
8280 "or{q}\t{%2, %0|%0, %2}"
8281 [(set_attr "type" "alu")
8282 (set_attr "mode" "DI")])
8284 (define_insn "*iordi_2_rex64"
8286 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8287 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
8289 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
8290 (ior:DI (match_dup 1) (match_dup 2)))]
8292 && ix86_match_ccmode (insn, CCNOmode)
8293 && ix86_binary_operator_ok (IOR, DImode, operands)"
8294 "or{q}\t{%2, %0|%0, %2}"
8295 [(set_attr "type" "alu")
8296 (set_attr "mode" "DI")])
8298 (define_insn "*iordi_3_rex64"
8300 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
8301 (match_operand:DI 2 "x86_64_general_operand" "rem"))
8303 (clobber (match_scratch:DI 0 "=r"))]
8305 && ix86_match_ccmode (insn, CCNOmode)
8306 && ix86_binary_operator_ok (IOR, DImode, operands)"
8307 "or{q}\t{%2, %0|%0, %2}"
8308 [(set_attr "type" "alu")
8309 (set_attr "mode" "DI")])
8312 (define_expand "iorsi3"
8313 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8314 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
8315 (match_operand:SI 2 "general_operand" "")))
8316 (clobber (reg:CC 17))]
8318 "ix86_expand_binary_operator (IOR, SImode, operands); DONE;")
8320 (define_insn "*iorsi_1"
8321 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
8322 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8323 (match_operand:SI 2 "general_operand" "ri,rmi")))
8324 (clobber (reg:CC 17))]
8325 "ix86_binary_operator_ok (IOR, SImode, operands)"
8326 "or{l}\t{%2, %0|%0, %2}"
8327 [(set_attr "type" "alu")
8328 (set_attr "mode" "SI")])
8330 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8331 (define_insn "*iorsi_1_zext"
8332 [(set (match_operand:DI 0 "register_operand" "=rm")
8334 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8335 (match_operand:SI 2 "general_operand" "rim"))))
8336 (clobber (reg:CC 17))]
8337 "TARGET_64BIT && ix86_binary_operator_ok (IOR, SImode, operands)"
8338 "or{l}\t{%2, %k0|%k0, %2}"
8339 [(set_attr "type" "alu")
8340 (set_attr "mode" "SI")])
8342 (define_insn "*iorsi_1_zext_imm"
8343 [(set (match_operand:DI 0 "register_operand" "=rm")
8344 (ior:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
8345 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
8346 (clobber (reg:CC 17))]
8348 "or{l}\t{%2, %k0|%k0, %2}"
8349 [(set_attr "type" "alu")
8350 (set_attr "mode" "SI")])
8352 (define_insn "*iorsi_2"
8354 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8355 (match_operand:SI 2 "general_operand" "rim,ri"))
8357 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8358 (ior:SI (match_dup 1) (match_dup 2)))]
8359 "ix86_match_ccmode (insn, CCNOmode)
8360 && ix86_binary_operator_ok (IOR, SImode, operands)"
8361 "or{l}\t{%2, %0|%0, %2}"
8362 [(set_attr "type" "alu")
8363 (set_attr "mode" "SI")])
8365 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8366 ;; ??? Special case for immediate operand is missing - it is tricky.
8367 (define_insn "*iorsi_2_zext"
8369 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8370 (match_operand:SI 2 "general_operand" "rim"))
8372 (set (match_operand:DI 0 "register_operand" "=r")
8373 (zero_extend:DI (ior:SI (match_dup 1) (match_dup 2))))]
8374 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8375 && ix86_binary_operator_ok (IOR, SImode, operands)"
8376 "or{l}\t{%2, %k0|%k0, %2}"
8377 [(set_attr "type" "alu")
8378 (set_attr "mode" "SI")])
8380 (define_insn "*iorsi_2_zext_imm"
8382 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8383 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
8385 (set (match_operand:DI 0 "register_operand" "=r")
8386 (ior:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
8387 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8388 && ix86_binary_operator_ok (IOR, SImode, operands)"
8389 "or{l}\t{%2, %k0|%k0, %2}"
8390 [(set_attr "type" "alu")
8391 (set_attr "mode" "SI")])
8393 (define_insn "*iorsi_3"
8395 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8396 (match_operand:SI 2 "general_operand" "rim"))
8398 (clobber (match_scratch:SI 0 "=r"))]
8399 "ix86_match_ccmode (insn, CCNOmode)
8400 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8401 "or{l}\t{%2, %0|%0, %2}"
8402 [(set_attr "type" "alu")
8403 (set_attr "mode" "SI")])
8405 (define_expand "iorhi3"
8406 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8407 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
8408 (match_operand:HI 2 "general_operand" "")))
8409 (clobber (reg:CC 17))]
8410 "TARGET_HIMODE_MATH"
8411 "ix86_expand_binary_operator (IOR, HImode, operands); DONE;")
8413 (define_insn "*iorhi_1"
8414 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
8415 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8416 (match_operand:HI 2 "general_operand" "rmi,ri")))
8417 (clobber (reg:CC 17))]
8418 "ix86_binary_operator_ok (IOR, HImode, operands)"
8419 "or{w}\t{%2, %0|%0, %2}"
8420 [(set_attr "type" "alu")
8421 (set_attr "mode" "HI")])
8423 (define_insn "*iorhi_2"
8425 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8426 (match_operand:HI 2 "general_operand" "rim,ri"))
8428 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8429 (ior:HI (match_dup 1) (match_dup 2)))]
8430 "ix86_match_ccmode (insn, CCNOmode)
8431 && ix86_binary_operator_ok (IOR, HImode, operands)"
8432 "or{w}\t{%2, %0|%0, %2}"
8433 [(set_attr "type" "alu")
8434 (set_attr "mode" "HI")])
8436 (define_insn "*iorhi_3"
8438 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
8439 (match_operand:HI 2 "general_operand" "rim"))
8441 (clobber (match_scratch:HI 0 "=r"))]
8442 "ix86_match_ccmode (insn, CCNOmode)
8443 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8444 "or{w}\t{%2, %0|%0, %2}"
8445 [(set_attr "type" "alu")
8446 (set_attr "mode" "HI")])
8448 (define_expand "iorqi3"
8449 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8450 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
8451 (match_operand:QI 2 "general_operand" "")))
8452 (clobber (reg:CC 17))]
8453 "TARGET_QIMODE_MATH"
8454 "ix86_expand_binary_operator (IOR, QImode, operands); DONE;")
8456 ;; %%% Potential partial reg stall on alternative 2. What to do?
8457 (define_insn "*iorqi_1"
8458 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
8459 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8460 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
8461 (clobber (reg:CC 17))]
8462 "ix86_binary_operator_ok (IOR, QImode, operands)"
8464 or{b}\t{%2, %0|%0, %2}
8465 or{b}\t{%2, %0|%0, %2}
8466 or{l}\t{%k2, %k0|%k0, %k2}"
8467 [(set_attr "type" "alu")
8468 (set_attr "mode" "QI,QI,SI")])
8470 (define_insn "*iorqi_1_slp"
8471 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m"))
8472 (ior:QI (match_dup 0)
8473 (match_operand:QI 1 "general_operand" "qmi,qi")))
8474 (clobber (reg:CC 17))]
8475 "! TARGET_PARTIAL_REG_STALL || optimize_size"
8476 "or{b}\t{%1, %0|%0, %1}"
8477 [(set_attr "type" "alu1")
8478 (set_attr "mode" "QI")])
8480 (define_insn "*iorqi_2"
8482 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
8483 (match_operand:QI 2 "general_operand" "qim,qi"))
8485 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
8486 (ior:QI (match_dup 1) (match_dup 2)))]
8487 "ix86_match_ccmode (insn, CCNOmode)
8488 && ix86_binary_operator_ok (IOR, QImode, operands)"
8489 "or{b}\t{%2, %0|%0, %2}"
8490 [(set_attr "type" "alu")
8491 (set_attr "mode" "QI")])
8493 (define_insn "*iorqi_2_slp"
8495 (compare (ior:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8496 (match_operand:QI 1 "general_operand" "qim,qi"))
8498 (set (strict_low_part (match_dup 0))
8499 (ior:QI (match_dup 0) (match_dup 1)))]
8500 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8501 && ix86_match_ccmode (insn, CCNOmode)"
8502 "or{b}\t{%1, %0|%0, %1}"
8503 [(set_attr "type" "alu1")
8504 (set_attr "mode" "QI")])
8506 (define_insn "*iorqi_3"
8508 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
8509 (match_operand:QI 2 "general_operand" "qim"))
8511 (clobber (match_scratch:QI 0 "=q"))]
8512 "ix86_match_ccmode (insn, CCNOmode)
8513 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8514 "or{b}\t{%2, %0|%0, %2}"
8515 [(set_attr "type" "alu")
8516 (set_attr "mode" "QI")])
8518 (define_insn "iorqi_ext_0"
8519 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8524 (match_operand 1 "ext_register_operand" "0")
8527 (match_operand 2 "const_int_operand" "n")))
8528 (clobber (reg:CC 17))]
8529 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8530 "or{b}\t{%2, %h0|%h0, %2}"
8531 [(set_attr "type" "alu")
8532 (set_attr "length_immediate" "1")
8533 (set_attr "mode" "QI")])
8535 (define_insn "*iorqi_ext_1"
8536 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8541 (match_operand 1 "ext_register_operand" "0")
8545 (match_operand:QI 2 "general_operand" "Qm"))))
8546 (clobber (reg:CC 17))]
8548 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8549 "or{b}\t{%2, %h0|%h0, %2}"
8550 [(set_attr "type" "alu")
8551 (set_attr "length_immediate" "0")
8552 (set_attr "mode" "QI")])
8554 (define_insn "*iorqi_ext_1_rex64"
8555 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8560 (match_operand 1 "ext_register_operand" "0")
8564 (match_operand 2 "ext_register_operand" "Q"))))
8565 (clobber (reg:CC 17))]
8567 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8568 "or{b}\t{%2, %h0|%h0, %2}"
8569 [(set_attr "type" "alu")
8570 (set_attr "length_immediate" "0")
8571 (set_attr "mode" "QI")])
8573 (define_insn "*iorqi_ext_2"
8574 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8578 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
8581 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
8584 (clobber (reg:CC 17))]
8585 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8586 "ior{b}\t{%h2, %h0|%h0, %h2}"
8587 [(set_attr "type" "alu")
8588 (set_attr "length_immediate" "0")
8589 (set_attr "mode" "QI")])
8592 [(set (match_operand 0 "register_operand" "")
8593 (ior (match_operand 1 "register_operand" "")
8594 (match_operand 2 "const_int_operand" "")))
8595 (clobber (reg:CC 17))]
8597 && QI_REG_P (operands[0])
8598 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8599 && !(INTVAL (operands[2]) & ~(255 << 8))
8600 && GET_MODE (operands[0]) != QImode"
8601 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8602 (ior:SI (zero_extract:SI (match_dup 1)
8603 (const_int 8) (const_int 8))
8605 (clobber (reg:CC 17))])]
8606 "operands[0] = gen_lowpart (SImode, operands[0]);
8607 operands[1] = gen_lowpart (SImode, operands[1]);
8608 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8610 ;; Since OR can be encoded with sign extended immediate, this is only
8611 ;; profitable when 7th bit is set.
8613 [(set (match_operand 0 "register_operand" "")
8614 (ior (match_operand 1 "general_operand" "")
8615 (match_operand 2 "const_int_operand" "")))
8616 (clobber (reg:CC 17))]
8618 && ANY_QI_REG_P (operands[0])
8619 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8620 && !(INTVAL (operands[2]) & ~255)
8621 && (INTVAL (operands[2]) & 128)
8622 && GET_MODE (operands[0]) != QImode"
8623 [(parallel [(set (strict_low_part (match_dup 0))
8624 (ior:QI (match_dup 1)
8626 (clobber (reg:CC 17))])]
8627 "operands[0] = gen_lowpart (QImode, operands[0]);
8628 operands[1] = gen_lowpart (QImode, operands[1]);
8629 operands[2] = gen_lowpart (QImode, operands[2]);")
8631 ;; Logical XOR instructions
8633 ;; %%% This used to optimize known byte-wide and operations to memory.
8634 ;; If this is considered useful, it should be done with splitters.
8636 (define_expand "xordi3"
8637 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8638 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "")
8639 (match_operand:DI 2 "x86_64_general_operand" "")))
8640 (clobber (reg:CC 17))]
8642 "ix86_expand_binary_operator (XOR, DImode, operands); DONE;")
8644 (define_insn "*xordi_1_rex64"
8645 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8646 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8647 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
8648 (clobber (reg:CC 17))]
8650 && ix86_binary_operator_ok (XOR, DImode, operands)"
8652 xor{q}\t{%2, %0|%0, %2}
8653 xor{q}\t{%2, %0|%0, %2}"
8654 [(set_attr "type" "alu")
8655 (set_attr "mode" "DI,DI")])
8657 (define_insn "*xordi_2_rex64"
8659 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8660 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
8662 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
8663 (xor:DI (match_dup 1) (match_dup 2)))]
8665 && ix86_match_ccmode (insn, CCNOmode)
8666 && ix86_binary_operator_ok (XOR, DImode, operands)"
8668 xor{q}\t{%2, %0|%0, %2}
8669 xor{q}\t{%2, %0|%0, %2}"
8670 [(set_attr "type" "alu")
8671 (set_attr "mode" "DI,DI")])
8673 (define_insn "*xordi_3_rex64"
8675 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
8676 (match_operand:DI 2 "x86_64_general_operand" "rem"))
8678 (clobber (match_scratch:DI 0 "=r"))]
8680 && ix86_match_ccmode (insn, CCNOmode)
8681 && ix86_binary_operator_ok (XOR, DImode, operands)"
8682 "xor{q}\t{%2, %0|%0, %2}"
8683 [(set_attr "type" "alu")
8684 (set_attr "mode" "DI")])
8686 (define_expand "xorsi3"
8687 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8688 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "")
8689 (match_operand:SI 2 "general_operand" "")))
8690 (clobber (reg:CC 17))]
8692 "ix86_expand_binary_operator (XOR, SImode, operands); DONE;")
8694 (define_insn "*xorsi_1"
8695 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
8696 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8697 (match_operand:SI 2 "general_operand" "ri,rm")))
8698 (clobber (reg:CC 17))]
8699 "ix86_binary_operator_ok (XOR, SImode, operands)"
8700 "xor{l}\t{%2, %0|%0, %2}"
8701 [(set_attr "type" "alu")
8702 (set_attr "mode" "SI")])
8704 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8705 ;; Add speccase for immediates
8706 (define_insn "*xorsi_1_zext"
8707 [(set (match_operand:DI 0 "register_operand" "=r")
8709 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8710 (match_operand:SI 2 "general_operand" "rim"))))
8711 (clobber (reg:CC 17))]
8712 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
8713 "xor{l}\t{%2, %k0|%k0, %2}"
8714 [(set_attr "type" "alu")
8715 (set_attr "mode" "SI")])
8717 (define_insn "*xorsi_1_zext_imm"
8718 [(set (match_operand:DI 0 "register_operand" "=r")
8719 (xor:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
8720 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
8721 (clobber (reg:CC 17))]
8722 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
8723 "xor{l}\t{%2, %k0|%k0, %2}"
8724 [(set_attr "type" "alu")
8725 (set_attr "mode" "SI")])
8727 (define_insn "*xorsi_2"
8729 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8730 (match_operand:SI 2 "general_operand" "rim,ri"))
8732 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8733 (xor:SI (match_dup 1) (match_dup 2)))]
8734 "ix86_match_ccmode (insn, CCNOmode)
8735 && ix86_binary_operator_ok (XOR, SImode, operands)"
8736 "xor{l}\t{%2, %0|%0, %2}"
8737 [(set_attr "type" "alu")
8738 (set_attr "mode" "SI")])
8740 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8741 ;; ??? Special case for immediate operand is missing - it is tricky.
8742 (define_insn "*xorsi_2_zext"
8744 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8745 (match_operand:SI 2 "general_operand" "rim"))
8747 (set (match_operand:DI 0 "register_operand" "=r")
8748 (zero_extend:DI (xor:SI (match_dup 1) (match_dup 2))))]
8749 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8750 && ix86_binary_operator_ok (XOR, SImode, operands)"
8751 "xor{l}\t{%2, %k0|%k0, %2}"
8752 [(set_attr "type" "alu")
8753 (set_attr "mode" "SI")])
8755 (define_insn "*xorsi_2_zext_imm"
8757 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8758 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
8760 (set (match_operand:DI 0 "register_operand" "=r")
8761 (xor:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
8762 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8763 && ix86_binary_operator_ok (XOR, SImode, operands)"
8764 "xor{l}\t{%2, %k0|%k0, %2}"
8765 [(set_attr "type" "alu")
8766 (set_attr "mode" "SI")])
8768 (define_insn "*xorsi_3"
8770 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8771 (match_operand:SI 2 "general_operand" "rim"))
8773 (clobber (match_scratch:SI 0 "=r"))]
8774 "ix86_match_ccmode (insn, CCNOmode)
8775 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8776 "xor{l}\t{%2, %0|%0, %2}"
8777 [(set_attr "type" "alu")
8778 (set_attr "mode" "SI")])
8780 (define_expand "xorhi3"
8781 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8782 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
8783 (match_operand:HI 2 "general_operand" "")))
8784 (clobber (reg:CC 17))]
8785 "TARGET_HIMODE_MATH"
8786 "ix86_expand_binary_operator (XOR, HImode, operands); DONE;")
8788 (define_insn "*xorhi_1"
8789 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
8790 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8791 (match_operand:HI 2 "general_operand" "rmi,ri")))
8792 (clobber (reg:CC 17))]
8793 "ix86_binary_operator_ok (XOR, HImode, operands)"
8794 "xor{w}\t{%2, %0|%0, %2}"
8795 [(set_attr "type" "alu")
8796 (set_attr "mode" "HI")])
8798 (define_insn "*xorhi_2"
8800 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8801 (match_operand:HI 2 "general_operand" "rim,ri"))
8803 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8804 (xor:HI (match_dup 1) (match_dup 2)))]
8805 "ix86_match_ccmode (insn, CCNOmode)
8806 && ix86_binary_operator_ok (XOR, HImode, operands)"
8807 "xor{w}\t{%2, %0|%0, %2}"
8808 [(set_attr "type" "alu")
8809 (set_attr "mode" "HI")])
8811 (define_insn "*xorhi_3"
8813 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
8814 (match_operand:HI 2 "general_operand" "rim"))
8816 (clobber (match_scratch:HI 0 "=r"))]
8817 "ix86_match_ccmode (insn, CCNOmode)
8818 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8819 "xor{w}\t{%2, %0|%0, %2}"
8820 [(set_attr "type" "alu")
8821 (set_attr "mode" "HI")])
8823 (define_expand "xorqi3"
8824 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8825 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
8826 (match_operand:QI 2 "general_operand" "")))
8827 (clobber (reg:CC 17))]
8828 "TARGET_QIMODE_MATH"
8829 "ix86_expand_binary_operator (XOR, QImode, operands); DONE;")
8831 ;; %%% Potential partial reg stall on alternative 2. What to do?
8832 (define_insn "*xorqi_1"
8833 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
8834 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8835 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
8836 (clobber (reg:CC 17))]
8837 "ix86_binary_operator_ok (XOR, QImode, operands)"
8839 xor{b}\t{%2, %0|%0, %2}
8840 xor{b}\t{%2, %0|%0, %2}
8841 xor{l}\t{%k2, %k0|%k0, %k2}"
8842 [(set_attr "type" "alu")
8843 (set_attr "mode" "QI,QI,SI")])
8845 (define_insn "*xorqi_1_slp"
8846 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
8847 (xor:QI (match_dup 0)
8848 (match_operand:QI 1 "general_operand" "qi,qmi")))
8849 (clobber (reg:CC 17))]
8850 "! TARGET_PARTIAL_REG_STALL || optimize_size"
8851 "xor{b}\t{%1, %0|%0, %1}"
8852 [(set_attr "type" "alu1")
8853 (set_attr "mode" "QI")])
8855 (define_insn "xorqi_ext_0"
8856 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8861 (match_operand 1 "ext_register_operand" "0")
8864 (match_operand 2 "const_int_operand" "n")))
8865 (clobber (reg:CC 17))]
8866 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8867 "xor{b}\t{%2, %h0|%h0, %2}"
8868 [(set_attr "type" "alu")
8869 (set_attr "length_immediate" "1")
8870 (set_attr "mode" "QI")])
8872 (define_insn "*xorqi_ext_1"
8873 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8878 (match_operand 1 "ext_register_operand" "0")
8882 (match_operand:QI 2 "general_operand" "Qm"))))
8883 (clobber (reg:CC 17))]
8885 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8886 "xor{b}\t{%2, %h0|%h0, %2}"
8887 [(set_attr "type" "alu")
8888 (set_attr "length_immediate" "0")
8889 (set_attr "mode" "QI")])
8891 (define_insn "*xorqi_ext_1_rex64"
8892 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8897 (match_operand 1 "ext_register_operand" "0")
8901 (match_operand 2 "ext_register_operand" "Q"))))
8902 (clobber (reg:CC 17))]
8904 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
8905 "xor{b}\t{%2, %h0|%h0, %2}"
8906 [(set_attr "type" "alu")
8907 (set_attr "length_immediate" "0")
8908 (set_attr "mode" "QI")])
8910 (define_insn "*xorqi_ext_2"
8911 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8915 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
8918 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
8921 (clobber (reg:CC 17))]
8922 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
8923 "xor{b}\t{%h2, %h0|%h0, %h2}"
8924 [(set_attr "type" "alu")
8925 (set_attr "length_immediate" "0")
8926 (set_attr "mode" "QI")])
8928 (define_insn "*xorqi_cc_1"
8931 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
8932 (match_operand:QI 2 "general_operand" "qim,qi"))
8934 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
8935 (xor:QI (match_dup 1) (match_dup 2)))]
8936 "ix86_match_ccmode (insn, CCNOmode)
8937 && ix86_binary_operator_ok (XOR, QImode, operands)"
8938 "xor{b}\t{%2, %0|%0, %2}"
8939 [(set_attr "type" "alu")
8940 (set_attr "mode" "QI")])
8942 (define_insn "*xorqi_2_slp"
8944 (compare (xor:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8945 (match_operand:QI 1 "general_operand" "qim,qi"))
8947 (set (strict_low_part (match_dup 0))
8948 (xor:QI (match_dup 0) (match_dup 1)))]
8949 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8950 && ix86_match_ccmode (insn, CCNOmode)"
8951 "xor{b}\t{%1, %0|%0, %1}"
8952 [(set_attr "type" "alu1")
8953 (set_attr "mode" "QI")])
8955 (define_insn "*xorqi_cc_2"
8958 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
8959 (match_operand:QI 2 "general_operand" "qim"))
8961 (clobber (match_scratch:QI 0 "=q"))]
8962 "ix86_match_ccmode (insn, CCNOmode)
8963 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8964 "xor{b}\t{%2, %0|%0, %2}"
8965 [(set_attr "type" "alu")
8966 (set_attr "mode" "QI")])
8968 (define_insn "*xorqi_cc_ext_1"
8973 (match_operand 1 "ext_register_operand" "0")
8976 (match_operand:QI 2 "general_operand" "qmn"))
8978 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=q")
8982 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
8984 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
8985 "xor{b}\t{%2, %h0|%h0, %2}"
8986 [(set_attr "type" "alu")
8987 (set_attr "mode" "QI")])
8989 (define_insn "*xorqi_cc_ext_1_rex64"
8994 (match_operand 1 "ext_register_operand" "0")
8997 (match_operand:QI 2 "nonmemory_operand" "Qn"))
8999 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9003 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9005 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9006 "xor{b}\t{%2, %h0|%h0, %2}"
9007 [(set_attr "type" "alu")
9008 (set_attr "mode" "QI")])
9010 (define_expand "xorqi_cc_ext_1"
9016 (match_operand 1 "ext_register_operand" "")
9019 (match_operand:QI 2 "general_operand" ""))
9021 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "")
9025 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9031 [(set (match_operand 0 "register_operand" "")
9032 (xor (match_operand 1 "register_operand" "")
9033 (match_operand 2 "const_int_operand" "")))
9034 (clobber (reg:CC 17))]
9036 && QI_REG_P (operands[0])
9037 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9038 && !(INTVAL (operands[2]) & ~(255 << 8))
9039 && GET_MODE (operands[0]) != QImode"
9040 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
9041 (xor:SI (zero_extract:SI (match_dup 1)
9042 (const_int 8) (const_int 8))
9044 (clobber (reg:CC 17))])]
9045 "operands[0] = gen_lowpart (SImode, operands[0]);
9046 operands[1] = gen_lowpart (SImode, operands[1]);
9047 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
9049 ;; Since XOR can be encoded with sign extended immediate, this is only
9050 ;; profitable when 7th bit is set.
9052 [(set (match_operand 0 "register_operand" "")
9053 (xor (match_operand 1 "general_operand" "")
9054 (match_operand 2 "const_int_operand" "")))
9055 (clobber (reg:CC 17))]
9057 && ANY_QI_REG_P (operands[0])
9058 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9059 && !(INTVAL (operands[2]) & ~255)
9060 && (INTVAL (operands[2]) & 128)
9061 && GET_MODE (operands[0]) != QImode"
9062 [(parallel [(set (strict_low_part (match_dup 0))
9063 (xor:QI (match_dup 1)
9065 (clobber (reg:CC 17))])]
9066 "operands[0] = gen_lowpart (QImode, operands[0]);
9067 operands[1] = gen_lowpart (QImode, operands[1]);
9068 operands[2] = gen_lowpart (QImode, operands[2]);")
9070 ;; Negation instructions
9072 (define_expand "negdi2"
9073 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
9074 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "")))
9075 (clobber (reg:CC 17))])]
9077 "ix86_expand_unary_operator (NEG, DImode, operands); DONE;")
9079 (define_insn "*negdi2_1"
9080 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
9081 (neg:DI (match_operand:DI 1 "general_operand" "0")))
9082 (clobber (reg:CC 17))]
9084 && ix86_unary_operator_ok (NEG, DImode, operands)"
9088 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9089 (neg:DI (match_operand:DI 1 "general_operand" "")))
9090 (clobber (reg:CC 17))]
9091 "!TARGET_64BIT && reload_completed"
9094 (compare:CCZ (neg:SI (match_dup 2)) (const_int 0)))
9095 (set (match_dup 0) (neg:SI (match_dup 2)))])
9098 (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
9101 (clobber (reg:CC 17))])
9104 (neg:SI (match_dup 1)))
9105 (clobber (reg:CC 17))])]
9106 "split_di (operands+1, 1, operands+2, operands+3);
9107 split_di (operands+0, 1, operands+0, operands+1);")
9109 (define_insn "*negdi2_1_rex64"
9110 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9111 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0")))
9112 (clobber (reg:CC 17))]
9113 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9115 [(set_attr "type" "negnot")
9116 (set_attr "mode" "DI")])
9118 ;; The problem with neg is that it does not perform (compare x 0),
9119 ;; it really performs (compare 0 x), which leaves us with the zero
9120 ;; flag being the only useful item.
9122 (define_insn "*negdi2_cmpz_rex64"
9124 (compare:CCZ (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
9126 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9127 (neg:DI (match_dup 1)))]
9128 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9130 [(set_attr "type" "negnot")
9131 (set_attr "mode" "DI")])
9134 (define_expand "negsi2"
9135 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
9136 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "")))
9137 (clobber (reg:CC 17))])]
9139 "ix86_expand_unary_operator (NEG, SImode, operands); DONE;")
9141 (define_insn "*negsi2_1"
9142 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9143 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))
9144 (clobber (reg:CC 17))]
9145 "ix86_unary_operator_ok (NEG, SImode, operands)"
9147 [(set_attr "type" "negnot")
9148 (set_attr "mode" "SI")])
9150 ;; Combine is quite creative about this pattern.
9151 (define_insn "*negsi2_1_zext"
9152 [(set (match_operand:DI 0 "register_operand" "=r")
9153 (lshiftrt:DI (neg:DI (ashift:DI (match_operand:DI 1 "register_operand" "0")
9156 (clobber (reg:CC 17))]
9157 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9159 [(set_attr "type" "negnot")
9160 (set_attr "mode" "SI")])
9162 ;; The problem with neg is that it does not perform (compare x 0),
9163 ;; it really performs (compare 0 x), which leaves us with the zero
9164 ;; flag being the only useful item.
9166 (define_insn "*negsi2_cmpz"
9168 (compare:CCZ (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
9170 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9171 (neg:SI (match_dup 1)))]
9172 "ix86_unary_operator_ok (NEG, SImode, operands)"
9174 [(set_attr "type" "negnot")
9175 (set_attr "mode" "SI")])
9177 (define_insn "*negsi2_cmpz_zext"
9179 (compare:CCZ (lshiftrt:DI
9181 (match_operand:DI 1 "register_operand" "0")
9185 (set (match_operand:DI 0 "register_operand" "=r")
9186 (lshiftrt:DI (neg:DI (ashift:DI (match_dup 1)
9189 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9191 [(set_attr "type" "negnot")
9192 (set_attr "mode" "SI")])
9194 (define_expand "neghi2"
9195 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
9196 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "")))
9197 (clobber (reg:CC 17))])]
9198 "TARGET_HIMODE_MATH"
9199 "ix86_expand_unary_operator (NEG, HImode, operands); DONE;")
9201 (define_insn "*neghi2_1"
9202 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9203 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))
9204 (clobber (reg:CC 17))]
9205 "ix86_unary_operator_ok (NEG, HImode, operands)"
9207 [(set_attr "type" "negnot")
9208 (set_attr "mode" "HI")])
9210 (define_insn "*neghi2_cmpz"
9212 (compare:CCZ (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
9214 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9215 (neg:HI (match_dup 1)))]
9216 "ix86_unary_operator_ok (NEG, HImode, operands)"
9218 [(set_attr "type" "negnot")
9219 (set_attr "mode" "HI")])
9221 (define_expand "negqi2"
9222 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
9223 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "")))
9224 (clobber (reg:CC 17))])]
9225 "TARGET_QIMODE_MATH"
9226 "ix86_expand_unary_operator (NEG, QImode, operands); DONE;")
9228 (define_insn "*negqi2_1"
9229 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9230 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))
9231 (clobber (reg:CC 17))]
9232 "ix86_unary_operator_ok (NEG, QImode, operands)"
9234 [(set_attr "type" "negnot")
9235 (set_attr "mode" "QI")])
9237 (define_insn "*negqi2_cmpz"
9239 (compare:CCZ (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
9241 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9242 (neg:QI (match_dup 1)))]
9243 "ix86_unary_operator_ok (NEG, QImode, operands)"
9245 [(set_attr "type" "negnot")
9246 (set_attr "mode" "QI")])
9248 ;; Changing of sign for FP values is doable using integer unit too.
9250 (define_expand "negsf2"
9251 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
9252 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "")))
9253 (clobber (reg:CC 17))])]
9257 /* In case operand is in memory, we will not use SSE. */
9258 if (memory_operand (operands[0], VOIDmode)
9259 && rtx_equal_p (operands[0], operands[1]))
9260 emit_insn (gen_negsf2_memory (operands[0], operands[1]));
9263 /* Using SSE is tricky, since we need bitwise negation of -0
9265 rtx reg = gen_reg_rtx (SFmode);
9266 rtx dest = operands[0];
9268 operands[1] = force_reg (SFmode, operands[1]);
9269 operands[0] = force_reg (SFmode, operands[0]);
9270 emit_move_insn (reg,
9271 gen_lowpart (SFmode,
9272 gen_int_mode (0x80000000, SImode)));
9273 emit_insn (gen_negsf2_ifs (operands[0], operands[1], reg));
9274 if (dest != operands[0])
9275 emit_move_insn (dest, operands[0]);
9279 ix86_expand_unary_operator (NEG, SFmode, operands); DONE;")
9281 (define_insn "negsf2_memory"
9282 [(set (match_operand:SF 0 "memory_operand" "=m")
9283 (neg:SF (match_operand:SF 1 "memory_operand" "0")))
9284 (clobber (reg:CC 17))]
9285 "ix86_unary_operator_ok (NEG, SFmode, operands)"
9288 (define_insn "negsf2_ifs"
9289 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
9290 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "0,x#fr,0,0")))
9291 (use (match_operand:SF 2 "nonmemory_operand" "x,0#x,*g#x,*g#x"))
9292 (clobber (reg:CC 17))]
9294 && (reload_in_progress || reload_completed
9295 || (register_operand (operands[0], VOIDmode)
9296 && register_operand (operands[1], VOIDmode)))"
9300 [(set (match_operand:SF 0 "memory_operand" "")
9301 (neg:SF (match_operand:SF 1 "memory_operand" "")))
9302 (use (match_operand:SF 2 "" ""))
9303 (clobber (reg:CC 17))]
9305 [(parallel [(set (match_dup 0)
9306 (neg:SF (match_dup 1)))
9307 (clobber (reg:CC 17))])])
9310 [(set (match_operand:SF 0 "register_operand" "")
9311 (neg:SF (match_operand:SF 1 "register_operand" "")))
9312 (use (match_operand:SF 2 "" ""))
9313 (clobber (reg:CC 17))]
9314 "reload_completed && !SSE_REG_P (operands[0])"
9315 [(parallel [(set (match_dup 0)
9316 (neg:SF (match_dup 1)))
9317 (clobber (reg:CC 17))])])
9320 [(set (match_operand:SF 0 "register_operand" "")
9321 (neg:SF (match_operand:SF 1 "register_operand" "")))
9322 (use (match_operand:SF 2 "register_operand" ""))
9323 (clobber (reg:CC 17))]
9324 "reload_completed && SSE_REG_P (operands[0])"
9325 [(set (subreg:TI (match_dup 0) 0)
9326 (xor:TI (subreg:TI (match_dup 1) 0)
9327 (subreg:TI (match_dup 2) 0)))]
9329 if (operands_match_p (operands[0], operands[2]))
9333 operands[1] = operands[2];
9339 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9340 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9342 (define_insn "*negsf2_if"
9343 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
9344 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")))
9345 (clobber (reg:CC 17))]
9346 "TARGET_80387 && !TARGET_SSE
9347 && ix86_unary_operator_ok (NEG, SFmode, operands)"
9351 [(set (match_operand:SF 0 "register_operand" "")
9352 (neg:SF (match_operand:SF 1 "register_operand" "")))
9353 (clobber (reg:CC 17))]
9354 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
9356 (neg:SF (match_dup 1)))]
9360 [(set (match_operand:SF 0 "register_operand" "")
9361 (neg:SF (match_operand:SF 1 "register_operand" "")))
9362 (clobber (reg:CC 17))]
9363 "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
9364 [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
9365 (clobber (reg:CC 17))])]
9366 "operands[1] = gen_int_mode (0x80000000, SImode);
9367 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));")
9370 [(set (match_operand 0 "memory_operand" "")
9371 (neg (match_operand 1 "memory_operand" "")))
9372 (clobber (reg:CC 17))]
9373 "TARGET_80387 && reload_completed && FLOAT_MODE_P (GET_MODE (operands[0]))"
9374 [(parallel [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
9375 (clobber (reg:CC 17))])]
9377 int size = GET_MODE_SIZE (GET_MODE (operands[1]));
9379 /* XFmode's size is 12, TFmode 16, but only 10 bytes are used. */
9382 operands[0] = adjust_address (operands[0], QImode, size - 1);
9383 operands[1] = gen_int_mode (0x80, QImode);
9386 (define_expand "negdf2"
9387 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
9388 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))
9389 (clobber (reg:CC 17))])]
9393 /* In case operand is in memory, we will not use SSE. */
9394 if (memory_operand (operands[0], VOIDmode)
9395 && rtx_equal_p (operands[0], operands[1]))
9396 emit_insn (gen_negdf2_memory (operands[0], operands[1]));
9399 /* Using SSE is tricky, since we need bitwise negation of -0
9401 rtx reg = gen_reg_rtx (DFmode);
9402 #if HOST_BITS_PER_WIDE_INT >= 64
9403 rtx imm = gen_int_mode (((HOST_WIDE_INT)1) << 63, DImode);
9405 rtx imm = immed_double_const (0, 0x80000000, DImode);
9407 rtx dest = operands[0];
9409 operands[1] = force_reg (DFmode, operands[1]);
9410 operands[0] = force_reg (DFmode, operands[0]);
9411 emit_move_insn (reg, gen_lowpart (DFmode, imm));
9412 emit_insn (gen_negdf2_ifs (operands[0], operands[1], reg));
9413 if (dest != operands[0])
9414 emit_move_insn (dest, operands[0]);
9418 ix86_expand_unary_operator (NEG, DFmode, operands); DONE;")
9420 (define_insn "negdf2_memory"
9421 [(set (match_operand:DF 0 "memory_operand" "=m")
9422 (neg:DF (match_operand:DF 1 "memory_operand" "0")))
9423 (clobber (reg:CC 17))]
9424 "ix86_unary_operator_ok (NEG, DFmode, operands)"
9427 (define_insn "negdf2_ifs"
9428 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf")
9429 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0")))
9430 (use (match_operand:DF 2 "nonmemory_operand" "Y,0,*g#Y,*g#Y"))
9431 (clobber (reg:CC 17))]
9432 "!TARGET_64BIT && TARGET_SSE2
9433 && (reload_in_progress || reload_completed
9434 || (register_operand (operands[0], VOIDmode)
9435 && register_operand (operands[1], VOIDmode)))"
9438 (define_insn "*negdf2_ifs_rex64"
9439 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,fm#Yr,r#Yf")
9440 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0")))
9441 (use (match_operand:DF 2 "general_operand" "Y,0,*g#Yr,*rm"))
9442 (clobber (reg:CC 17))]
9443 "TARGET_64BIT && TARGET_SSE2
9444 && (reload_in_progress || reload_completed
9445 || (register_operand (operands[0], VOIDmode)
9446 && register_operand (operands[1], VOIDmode)))"
9450 [(set (match_operand:DF 0 "memory_operand" "")
9451 (neg:DF (match_operand:DF 1 "memory_operand" "")))
9452 (use (match_operand:DF 2 "" ""))
9453 (clobber (reg:CC 17))]
9455 [(parallel [(set (match_dup 0)
9456 (neg:DF (match_dup 1)))
9457 (clobber (reg:CC 17))])])
9460 [(set (match_operand:DF 0 "register_operand" "")
9461 (neg:DF (match_operand:DF 1 "register_operand" "")))
9462 (use (match_operand:DF 2 "" ""))
9463 (clobber (reg:CC 17))]
9464 "reload_completed && !SSE_REG_P (operands[0])
9465 && (!TARGET_64BIT || FP_REG_P (operands[0]))"
9466 [(parallel [(set (match_dup 0)
9467 (neg:DF (match_dup 1)))
9468 (clobber (reg:CC 17))])])
9471 [(set (match_operand:DF 0 "register_operand" "")
9472 (neg:DF (match_operand:DF 1 "register_operand" "")))
9473 (use (match_operand:DF 2 "" ""))
9474 (clobber (reg:CC 17))]
9475 "TARGET_64BIT && reload_completed && GENERAL_REG_P (operands[0])"
9476 [(parallel [(set (match_dup 0)
9477 (xor:DI (match_dup 1) (match_dup 2)))
9478 (clobber (reg:CC 17))])]
9479 "operands[0] = gen_lowpart (DImode, operands[0]);
9480 operands[1] = gen_lowpart (DImode, operands[1]);
9481 operands[2] = gen_lowpart (DImode, operands[2]);")
9484 [(set (match_operand:DF 0 "register_operand" "")
9485 (neg:DF (match_operand:DF 1 "register_operand" "")))
9486 (use (match_operand:DF 2 "register_operand" ""))
9487 (clobber (reg:CC 17))]
9488 "reload_completed && SSE_REG_P (operands[0])"
9489 [(set (subreg:TI (match_dup 0) 0)
9490 (xor:TI (subreg:TI (match_dup 1) 0)
9491 (subreg:TI (match_dup 2) 0)))]
9493 if (operands_match_p (operands[0], operands[2]))
9497 operands[1] = operands[2];
9502 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9503 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9505 (define_insn "*negdf2_if"
9506 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
9507 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
9508 (clobber (reg:CC 17))]
9509 "!TARGET_64BIT && TARGET_80387
9510 && ix86_unary_operator_ok (NEG, DFmode, operands)"
9513 ;; FIXME: We should to allow integer registers here. Problem is that
9514 ;; we need another scratch register to get constant from.
9515 ;; Forcing constant to mem if no register available in peep2 should be
9516 ;; safe even for PIC mode, because of RIP relative addressing.
9517 (define_insn "*negdf2_if_rex64"
9518 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,mf")
9519 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
9520 (clobber (reg:CC 17))]
9521 "TARGET_64BIT && TARGET_80387
9522 && ix86_unary_operator_ok (NEG, DFmode, operands)"
9526 [(set (match_operand:DF 0 "register_operand" "")
9527 (neg:DF (match_operand:DF 1 "register_operand" "")))
9528 (clobber (reg:CC 17))]
9529 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
9531 (neg:DF (match_dup 1)))]
9535 [(set (match_operand:DF 0 "register_operand" "")
9536 (neg:DF (match_operand:DF 1 "register_operand" "")))
9537 (clobber (reg:CC 17))]
9538 "!TARGET_64BIT && TARGET_80387 && reload_completed
9539 && !FP_REGNO_P (REGNO (operands[0]))"
9540 [(parallel [(set (match_dup 3) (xor:SI (match_dup 3) (match_dup 4)))
9541 (clobber (reg:CC 17))])]
9542 "operands[4] = gen_int_mode (0x80000000, SImode);
9543 split_di (operands+0, 1, operands+2, operands+3);")
9545 (define_expand "negxf2"
9546 [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "")
9547 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))
9548 (clobber (reg:CC 17))])]
9549 "!TARGET_64BIT && TARGET_80387"
9550 "ix86_expand_unary_operator (NEG, XFmode, operands); DONE;")
9552 (define_expand "negtf2"
9553 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9554 (neg:TF (match_operand:TF 1 "nonimmediate_operand" "")))
9555 (clobber (reg:CC 17))])]
9557 "ix86_expand_unary_operator (NEG, TFmode, operands); DONE;")
9559 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9560 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9562 (define_insn "*negxf2_if"
9563 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
9564 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "0,0")))
9565 (clobber (reg:CC 17))]
9566 "!TARGET_64BIT && TARGET_80387
9567 && ix86_unary_operator_ok (NEG, XFmode, operands)"
9571 [(set (match_operand:XF 0 "register_operand" "")
9572 (neg:XF (match_operand:XF 1 "register_operand" "")))
9573 (clobber (reg:CC 17))]
9574 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
9576 (neg:XF (match_dup 1)))]
9580 [(set (match_operand:XF 0 "register_operand" "")
9581 (neg:XF (match_operand:XF 1 "register_operand" "")))
9582 (clobber (reg:CC 17))]
9583 "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
9584 [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
9585 (clobber (reg:CC 17))])]
9586 "operands[1] = GEN_INT (0x8000);
9587 operands[0] = gen_rtx_REG (SImode,
9588 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
9590 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9591 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9593 (define_insn "*negtf2_if"
9594 [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f")
9595 (neg:TF (match_operand:TF 1 "nonimmediate_operand" "0,0")))
9596 (clobber (reg:CC 17))]
9597 "TARGET_80387 && ix86_unary_operator_ok (NEG, TFmode, operands)"
9601 [(set (match_operand:TF 0 "register_operand" "")
9602 (neg:TF (match_operand:TF 1 "register_operand" "")))
9603 (clobber (reg:CC 17))]
9604 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
9606 (neg:TF (match_dup 1)))]
9610 [(set (match_operand:TF 0 "register_operand" "")
9611 (neg:TF (match_operand:TF 1 "register_operand" "")))
9612 (clobber (reg:CC 17))]
9613 "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
9614 [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
9615 (clobber (reg:CC 17))])]
9616 "operands[1] = GEN_INT (0x8000);
9617 operands[0] = gen_rtx_REG (SImode,
9618 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
9620 ;; Conditionize these after reload. If they matches before reload, we
9621 ;; lose the clobber and ability to use integer instructions.
9623 (define_insn "*negsf2_1"
9624 [(set (match_operand:SF 0 "register_operand" "=f")
9625 (neg:SF (match_operand:SF 1 "register_operand" "0")))]
9626 "TARGET_80387 && reload_completed"
9628 [(set_attr "type" "fsgn")
9629 (set_attr "mode" "SF")
9630 (set_attr "ppro_uops" "few")])
9632 (define_insn "*negdf2_1"
9633 [(set (match_operand:DF 0 "register_operand" "=f")
9634 (neg:DF (match_operand:DF 1 "register_operand" "0")))]
9635 "TARGET_80387 && reload_completed"
9637 [(set_attr "type" "fsgn")
9638 (set_attr "mode" "DF")
9639 (set_attr "ppro_uops" "few")])
9641 (define_insn "*negextendsfdf2"
9642 [(set (match_operand:DF 0 "register_operand" "=f")
9643 (neg:DF (float_extend:DF
9644 (match_operand:SF 1 "register_operand" "0"))))]
9647 [(set_attr "type" "fsgn")
9648 (set_attr "mode" "DF")
9649 (set_attr "ppro_uops" "few")])
9651 (define_insn "*negxf2_1"
9652 [(set (match_operand:XF 0 "register_operand" "=f")
9653 (neg:XF (match_operand:XF 1 "register_operand" "0")))]
9654 "!TARGET_64BIT && TARGET_80387 && reload_completed"
9656 [(set_attr "type" "fsgn")
9657 (set_attr "mode" "XF")
9658 (set_attr "ppro_uops" "few")])
9660 (define_insn "*negextenddfxf2"
9661 [(set (match_operand:XF 0 "register_operand" "=f")
9662 (neg:XF (float_extend:XF
9663 (match_operand:DF 1 "register_operand" "0"))))]
9664 "!TARGET_64BIT && TARGET_80387"
9666 [(set_attr "type" "fsgn")
9667 (set_attr "mode" "XF")
9668 (set_attr "ppro_uops" "few")])
9670 (define_insn "*negextendsfxf2"
9671 [(set (match_operand:XF 0 "register_operand" "=f")
9672 (neg:XF (float_extend:XF
9673 (match_operand:SF 1 "register_operand" "0"))))]
9674 "!TARGET_64BIT && TARGET_80387"
9676 [(set_attr "type" "fsgn")
9677 (set_attr "mode" "XF")
9678 (set_attr "ppro_uops" "few")])
9680 (define_insn "*negtf2_1"
9681 [(set (match_operand:TF 0 "register_operand" "=f")
9682 (neg:TF (match_operand:TF 1 "register_operand" "0")))]
9683 "TARGET_80387 && reload_completed"
9685 [(set_attr "type" "fsgn")
9686 (set_attr "mode" "XF")
9687 (set_attr "ppro_uops" "few")])
9689 (define_insn "*negextenddftf2"
9690 [(set (match_operand:TF 0 "register_operand" "=f")
9691 (neg:TF (float_extend:TF
9692 (match_operand:DF 1 "register_operand" "0"))))]
9695 [(set_attr "type" "fsgn")
9696 (set_attr "mode" "XF")
9697 (set_attr "ppro_uops" "few")])
9699 (define_insn "*negextendsftf2"
9700 [(set (match_operand:TF 0 "register_operand" "=f")
9701 (neg:TF (float_extend:TF
9702 (match_operand:SF 1 "register_operand" "0"))))]
9705 [(set_attr "type" "fsgn")
9706 (set_attr "mode" "XF")
9707 (set_attr "ppro_uops" "few")])
9709 ;; Absolute value instructions
9711 (define_expand "abssf2"
9712 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
9713 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "")))
9714 (clobber (reg:CC 17))])]
9718 /* In case operand is in memory, we will not use SSE. */
9719 if (memory_operand (operands[0], VOIDmode)
9720 && rtx_equal_p (operands[0], operands[1]))
9721 emit_insn (gen_abssf2_memory (operands[0], operands[1]));
9724 /* Using SSE is tricky, since we need bitwise negation of -0
9726 rtx reg = gen_reg_rtx (SFmode);
9727 rtx dest = operands[0];
9729 operands[1] = force_reg (SFmode, operands[1]);
9730 operands[0] = force_reg (SFmode, operands[0]);
9731 emit_move_insn (reg,
9732 gen_lowpart (SFmode,
9733 gen_int_mode (0x80000000, SImode)));
9734 emit_insn (gen_abssf2_ifs (operands[0], operands[1], reg));
9735 if (dest != operands[0])
9736 emit_move_insn (dest, operands[0]);
9740 ix86_expand_unary_operator (ABS, SFmode, operands); DONE;")
9742 (define_insn "abssf2_memory"
9743 [(set (match_operand:SF 0 "memory_operand" "=m")
9744 (abs:SF (match_operand:SF 1 "memory_operand" "0")))
9745 (clobber (reg:CC 17))]
9746 "ix86_unary_operator_ok (ABS, SFmode, operands)"
9749 (define_insn "abssf2_ifs"
9750 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,f#xr,rm#xf")
9751 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "x,0,0")))
9752 (use (match_operand:SF 2 "nonmemory_operand" "*0#x,*g#x,*g#x"))
9753 (clobber (reg:CC 17))]
9755 && (reload_in_progress || reload_completed
9756 || (register_operand (operands[0], VOIDmode)
9757 && register_operand (operands[1], VOIDmode)))"
9761 [(set (match_operand:SF 0 "memory_operand" "")
9762 (abs:SF (match_operand:SF 1 "memory_operand" "")))
9763 (use (match_operand:SF 2 "" ""))
9764 (clobber (reg:CC 17))]
9766 [(parallel [(set (match_dup 0)
9767 (abs:SF (match_dup 1)))
9768 (clobber (reg:CC 17))])])
9771 [(set (match_operand:SF 0 "register_operand" "")
9772 (abs:SF (match_operand:SF 1 "register_operand" "")))
9773 (use (match_operand:SF 2 "" ""))
9774 (clobber (reg:CC 17))]
9775 "reload_completed && !SSE_REG_P (operands[0])"
9776 [(parallel [(set (match_dup 0)
9777 (abs:SF (match_dup 1)))
9778 (clobber (reg:CC 17))])])
9781 [(set (match_operand:SF 0 "register_operand" "")
9782 (abs:SF (match_operand:SF 1 "register_operand" "")))
9783 (use (match_operand:SF 2 "register_operand" ""))
9784 (clobber (reg:CC 17))]
9785 "reload_completed && SSE_REG_P (operands[0])"
9786 [(set (subreg:TI (match_dup 0) 0)
9787 (and:TI (not:TI (subreg:TI (match_dup 2) 0))
9788 (subreg:TI (match_dup 1) 0)))])
9790 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9791 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9793 (define_insn "*abssf2_if"
9794 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
9795 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")))
9796 (clobber (reg:CC 17))]
9797 "TARGET_80387 && ix86_unary_operator_ok (ABS, SFmode, operands) && !TARGET_SSE"
9801 [(set (match_operand:SF 0 "register_operand" "")
9802 (abs:SF (match_operand:SF 1 "register_operand" "")))
9803 (clobber (reg:CC 17))]
9804 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0]))"
9806 (abs:SF (match_dup 1)))]
9810 [(set (match_operand:SF 0 "register_operand" "")
9811 (abs:SF (match_operand:SF 1 "register_operand" "")))
9812 (clobber (reg:CC 17))]
9813 "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
9814 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
9815 (clobber (reg:CC 17))])]
9816 "operands[1] = gen_int_mode (~0x80000000, SImode);
9817 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));")
9820 [(set (match_operand 0 "memory_operand" "")
9821 (abs (match_operand 1 "memory_operand" "")))
9822 (clobber (reg:CC 17))]
9823 "TARGET_80387 && reload_completed && FLOAT_MODE_P (GET_MODE (operands[0]))"
9824 [(parallel [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
9825 (clobber (reg:CC 17))])]
9827 int size = GET_MODE_SIZE (GET_MODE (operands[1]));
9829 /* XFmode's size is 12, TFmode 16, but only 10 bytes are used. */
9832 operands[0] = adjust_address (operands[0], QImode, size - 1);
9833 operands[1] = gen_int_mode (~0x80, QImode);
9836 (define_expand "absdf2"
9837 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
9838 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))
9839 (clobber (reg:CC 17))])]
9843 /* In case operand is in memory, we will not use SSE. */
9844 if (memory_operand (operands[0], VOIDmode)
9845 && rtx_equal_p (operands[0], operands[1]))
9846 emit_insn (gen_absdf2_memory (operands[0], operands[1]));
9849 /* Using SSE is tricky, since we need bitwise negation of -0
9851 rtx reg = gen_reg_rtx (DFmode);
9852 #if HOST_BITS_PER_WIDE_INT >= 64
9853 rtx imm = gen_int_mode (((HOST_WIDE_INT)1) << 63, DImode);
9855 rtx imm = immed_double_const (0, 0x80000000, DImode);
9857 rtx dest = operands[0];
9859 operands[1] = force_reg (DFmode, operands[1]);
9860 operands[0] = force_reg (DFmode, operands[0]);
9861 emit_move_insn (reg, gen_lowpart (DFmode, imm));
9862 emit_insn (gen_absdf2_ifs (operands[0], operands[1], reg));
9863 if (dest != operands[0])
9864 emit_move_insn (dest, operands[0]);
9868 ix86_expand_unary_operator (ABS, DFmode, operands); DONE;")
9870 (define_insn "absdf2_memory"
9871 [(set (match_operand:DF 0 "memory_operand" "=m")
9872 (abs:DF (match_operand:DF 1 "memory_operand" "0")))
9873 (clobber (reg:CC 17))]
9874 "ix86_unary_operator_ok (ABS, DFmode, operands)"
9877 (define_insn "absdf2_ifs"
9878 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,mf#Yr,mr#Yf")
9879 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "Y,0,0")))
9880 (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*g#Y,*g#Y"))
9881 (clobber (reg:CC 17))]
9882 "!TARGET_64BIT && TARGET_SSE2
9883 && (reload_in_progress || reload_completed
9884 || (register_operand (operands[0], VOIDmode)
9885 && register_operand (operands[1], VOIDmode)))"
9888 (define_insn "*absdf2_ifs_rex64"
9889 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,mf#Yr")
9890 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "Y,0")))
9891 (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*g#Y"))
9892 (clobber (reg:CC 17))]
9893 "TARGET_64BIT && TARGET_SSE2
9894 && (reload_in_progress || reload_completed
9895 || (register_operand (operands[0], VOIDmode)
9896 && register_operand (operands[1], VOIDmode)))"
9900 [(set (match_operand:DF 0 "memory_operand" "")
9901 (abs:DF (match_operand:DF 1 "memory_operand" "")))
9902 (use (match_operand:DF 2 "" ""))
9903 (clobber (reg:CC 17))]
9905 [(parallel [(set (match_dup 0)
9906 (abs:DF (match_dup 1)))
9907 (clobber (reg:CC 17))])])
9910 [(set (match_operand:DF 0 "register_operand" "")
9911 (abs:DF (match_operand:DF 1 "register_operand" "")))
9912 (use (match_operand:DF 2 "" ""))
9913 (clobber (reg:CC 17))]
9914 "reload_completed && !SSE_REG_P (operands[0])"
9915 [(parallel [(set (match_dup 0)
9916 (abs:DF (match_dup 1)))
9917 (clobber (reg:CC 17))])])
9920 [(set (match_operand:DF 0 "register_operand" "")
9921 (abs:DF (match_operand:DF 1 "register_operand" "")))
9922 (use (match_operand:DF 2 "register_operand" ""))
9923 (clobber (reg:CC 17))]
9924 "reload_completed && SSE_REG_P (operands[0])"
9925 [(set (subreg:TI (match_dup 0) 0)
9926 (and:TI (not:TI (subreg:TI (match_dup 2) 0))
9927 (subreg:TI (match_dup 1) 0)))])
9930 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9931 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9933 (define_insn "*absdf2_if"
9934 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
9935 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
9936 (clobber (reg:CC 17))]
9937 "!TARGET_64BIT && TARGET_80387
9938 && ix86_unary_operator_ok (ABS, DFmode, operands)"
9941 ;; FIXME: We should to allow integer registers here. Problem is that
9942 ;; we need another scratch register to get constant from.
9943 ;; Forcing constant to mem if no register available in peep2 should be
9944 ;; safe even for PIC mode, because of RIP relative addressing.
9945 (define_insn "*absdf2_if_rex64"
9946 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,mf")
9947 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
9948 (clobber (reg:CC 17))]
9949 "TARGET_64BIT && TARGET_80387
9950 && ix86_unary_operator_ok (ABS, DFmode, operands)"
9954 [(set (match_operand:DF 0 "register_operand" "")
9955 (abs:DF (match_operand:DF 1 "register_operand" "")))
9956 (clobber (reg:CC 17))]
9957 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
9959 (abs:DF (match_dup 1)))]
9963 [(set (match_operand:DF 0 "register_operand" "")
9964 (abs:DF (match_operand:DF 1 "register_operand" "")))
9965 (clobber (reg:CC 17))]
9966 "!TARGET_64BIT && TARGET_80387 && reload_completed &&
9967 !FP_REGNO_P (REGNO (operands[0]))"
9968 [(parallel [(set (match_dup 3) (and:SI (match_dup 3) (match_dup 4)))
9969 (clobber (reg:CC 17))])]
9970 "operands[4] = gen_int_mode (~0x80000000, SImode);
9971 split_di (operands+0, 1, operands+2, operands+3);")
9973 (define_expand "absxf2"
9974 [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "")
9975 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))
9976 (clobber (reg:CC 17))])]
9977 "!TARGET_64BIT && TARGET_80387"
9978 "ix86_expand_unary_operator (ABS, XFmode, operands); DONE;")
9980 (define_expand "abstf2"
9981 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9982 (neg:TF (match_operand:TF 1 "nonimmediate_operand" "")))
9983 (clobber (reg:CC 17))])]
9985 "ix86_expand_unary_operator (ABS, TFmode, operands); DONE;")
9987 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9988 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9990 (define_insn "*absxf2_if"
9991 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
9992 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "0,0")))
9993 (clobber (reg:CC 17))]
9994 "!TARGET_64BIT && TARGET_80387
9995 && ix86_unary_operator_ok (ABS, XFmode, operands)"
9999 [(set (match_operand:XF 0 "register_operand" "")
10000 (abs:XF (match_operand:XF 1 "register_operand" "")))
10001 (clobber (reg:CC 17))]
10002 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
10003 [(set (match_dup 0)
10004 (abs:XF (match_dup 1)))]
10008 [(set (match_operand:XF 0 "register_operand" "")
10009 (abs:XF (match_operand:XF 1 "register_operand" "")))
10010 (clobber (reg:CC 17))]
10011 "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
10012 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
10013 (clobber (reg:CC 17))])]
10014 "operands[1] = GEN_INT (~0x8000);
10015 operands[0] = gen_rtx_REG (SImode,
10016 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
10018 (define_insn "*abstf2_if"
10019 [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f")
10020 (abs:TF (match_operand:TF 1 "nonimmediate_operand" "0,0")))
10021 (clobber (reg:CC 17))]
10022 "TARGET_80387 && ix86_unary_operator_ok (ABS, TFmode, operands)"
10026 [(set (match_operand:TF 0 "register_operand" "")
10027 (abs:TF (match_operand:TF 1 "register_operand" "")))
10028 (clobber (reg:CC 17))]
10029 "TARGET_80387 && FP_REGNO_P (REGNO (operands[0])) && reload_completed"
10030 [(set (match_dup 0)
10031 (abs:TF (match_dup 1)))]
10035 [(set (match_operand:TF 0 "register_operand" "")
10036 (abs:TF (match_operand:TF 1 "register_operand" "")))
10037 (clobber (reg:CC 17))]
10038 "TARGET_80387 && reload_completed && !FP_REGNO_P (REGNO (operands[0]))"
10039 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
10040 (clobber (reg:CC 17))])]
10041 "operands[1] = GEN_INT (~0x8000);
10042 operands[0] = gen_rtx_REG (SImode,
10043 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
10045 (define_insn "*abssf2_1"
10046 [(set (match_operand:SF 0 "register_operand" "=f")
10047 (abs:SF (match_operand:SF 1 "register_operand" "0")))]
10048 "TARGET_80387 && reload_completed"
10050 [(set_attr "type" "fsgn")
10051 (set_attr "mode" "SF")])
10053 (define_insn "*absdf2_1"
10054 [(set (match_operand:DF 0 "register_operand" "=f")
10055 (abs:DF (match_operand:DF 1 "register_operand" "0")))]
10056 "TARGET_80387 && reload_completed"
10058 [(set_attr "type" "fsgn")
10059 (set_attr "mode" "DF")])
10061 (define_insn "*absextendsfdf2"
10062 [(set (match_operand:DF 0 "register_operand" "=f")
10063 (abs:DF (float_extend:DF
10064 (match_operand:SF 1 "register_operand" "0"))))]
10067 [(set_attr "type" "fsgn")
10068 (set_attr "mode" "DF")])
10070 (define_insn "*absxf2_1"
10071 [(set (match_operand:XF 0 "register_operand" "=f")
10072 (abs:XF (match_operand:XF 1 "register_operand" "0")))]
10073 "!TARGET_64BIT && TARGET_80387 && reload_completed"
10075 [(set_attr "type" "fsgn")
10076 (set_attr "mode" "DF")])
10078 (define_insn "*absextenddfxf2"
10079 [(set (match_operand:XF 0 "register_operand" "=f")
10080 (abs:XF (float_extend:XF
10081 (match_operand:DF 1 "register_operand" "0"))))]
10082 "!TARGET_64BIT && TARGET_80387"
10084 [(set_attr "type" "fsgn")
10085 (set_attr "mode" "XF")])
10087 (define_insn "*absextendsfxf2"
10088 [(set (match_operand:XF 0 "register_operand" "=f")
10089 (abs:XF (float_extend:XF
10090 (match_operand:SF 1 "register_operand" "0"))))]
10091 "!TARGET_64BIT && TARGET_80387"
10093 [(set_attr "type" "fsgn")
10094 (set_attr "mode" "XF")])
10096 (define_insn "*abstf2_1"
10097 [(set (match_operand:TF 0 "register_operand" "=f")
10098 (abs:TF (match_operand:TF 1 "register_operand" "0")))]
10099 "TARGET_80387 && reload_completed"
10101 [(set_attr "type" "fsgn")
10102 (set_attr "mode" "DF")])
10104 (define_insn "*absextenddftf2"
10105 [(set (match_operand:TF 0 "register_operand" "=f")
10106 (abs:TF (float_extend:TF
10107 (match_operand:DF 1 "register_operand" "0"))))]
10110 [(set_attr "type" "fsgn")
10111 (set_attr "mode" "XF")])
10113 (define_insn "*absextendsftf2"
10114 [(set (match_operand:TF 0 "register_operand" "=f")
10115 (abs:TF (float_extend:TF
10116 (match_operand:SF 1 "register_operand" "0"))))]
10119 [(set_attr "type" "fsgn")
10120 (set_attr "mode" "XF")])
10122 ;; One complement instructions
10124 (define_expand "one_cmpldi2"
10125 [(set (match_operand:DI 0 "nonimmediate_operand" "")
10126 (not:DI (match_operand:DI 1 "nonimmediate_operand" "")))]
10128 "ix86_expand_unary_operator (NOT, DImode, operands); DONE;")
10130 (define_insn "*one_cmpldi2_1_rex64"
10131 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10132 (not:DI (match_operand:DI 1 "nonimmediate_operand" "0")))]
10133 "TARGET_64BIT && ix86_unary_operator_ok (NOT, DImode, operands)"
10135 [(set_attr "type" "negnot")
10136 (set_attr "mode" "DI")])
10138 (define_insn "*one_cmpldi2_2_rex64"
10140 (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
10142 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10143 (not:DI (match_dup 1)))]
10144 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
10145 && ix86_unary_operator_ok (NOT, DImode, operands)"
10147 [(set_attr "type" "alu1")
10148 (set_attr "mode" "DI")])
10152 (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" ""))
10154 (set (match_operand:DI 0 "nonimmediate_operand" "")
10155 (not:DI (match_dup 1)))]
10156 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
10157 [(parallel [(set (reg:CCNO 17)
10158 (compare:CCNO (xor:DI (match_dup 1) (const_int -1))
10161 (xor:DI (match_dup 1) (const_int -1)))])]
10164 (define_expand "one_cmplsi2"
10165 [(set (match_operand:SI 0 "nonimmediate_operand" "")
10166 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
10168 "ix86_expand_unary_operator (NOT, SImode, operands); DONE;")
10170 (define_insn "*one_cmplsi2_1"
10171 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10172 (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
10173 "ix86_unary_operator_ok (NOT, SImode, operands)"
10175 [(set_attr "type" "negnot")
10176 (set_attr "mode" "SI")])
10178 ;; ??? Currently never generated - xor is used instead.
10179 (define_insn "*one_cmplsi2_1_zext"
10180 [(set (match_operand:DI 0 "register_operand" "=r")
10181 (zero_extend:DI (not:SI (match_operand:SI 1 "register_operand" "0"))))]
10182 "TARGET_64BIT && ix86_unary_operator_ok (NOT, SImode, operands)"
10184 [(set_attr "type" "negnot")
10185 (set_attr "mode" "SI")])
10187 (define_insn "*one_cmplsi2_2"
10189 (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
10191 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10192 (not:SI (match_dup 1)))]
10193 "ix86_match_ccmode (insn, CCNOmode)
10194 && ix86_unary_operator_ok (NOT, SImode, operands)"
10196 [(set_attr "type" "alu1")
10197 (set_attr "mode" "SI")])
10201 (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" ""))
10203 (set (match_operand:SI 0 "nonimmediate_operand" "")
10204 (not:SI (match_dup 1)))]
10205 "ix86_match_ccmode (insn, CCNOmode)"
10206 [(parallel [(set (reg:CCNO 17)
10207 (compare:CCNO (xor:SI (match_dup 1) (const_int -1))
10210 (xor:SI (match_dup 1) (const_int -1)))])]
10213 ;; ??? Currently never generated - xor is used instead.
10214 (define_insn "*one_cmplsi2_2_zext"
10216 (compare (not:SI (match_operand:SI 1 "register_operand" "0"))
10218 (set (match_operand:DI 0 "register_operand" "=r")
10219 (zero_extend:DI (not:SI (match_dup 1))))]
10220 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
10221 && ix86_unary_operator_ok (NOT, SImode, operands)"
10223 [(set_attr "type" "alu1")
10224 (set_attr "mode" "SI")])
10228 (compare (not:SI (match_operand:SI 1 "register_operand" ""))
10230 (set (match_operand:DI 0 "register_operand" "")
10231 (zero_extend:DI (not:SI (match_dup 1))))]
10232 "ix86_match_ccmode (insn, CCNOmode)"
10233 [(parallel [(set (reg:CCNO 17)
10234 (compare:CCNO (xor:SI (match_dup 1) (const_int -1))
10237 (zero_extend:DI (xor:SI (match_dup 1) (const_int -1))))])]
10240 (define_expand "one_cmplhi2"
10241 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10242 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
10243 "TARGET_HIMODE_MATH"
10244 "ix86_expand_unary_operator (NOT, HImode, operands); DONE;")
10246 (define_insn "*one_cmplhi2_1"
10247 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10248 (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
10249 "ix86_unary_operator_ok (NOT, HImode, operands)"
10251 [(set_attr "type" "negnot")
10252 (set_attr "mode" "HI")])
10254 (define_insn "*one_cmplhi2_2"
10256 (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
10258 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10259 (not:HI (match_dup 1)))]
10260 "ix86_match_ccmode (insn, CCNOmode)
10261 && ix86_unary_operator_ok (NEG, HImode, operands)"
10263 [(set_attr "type" "alu1")
10264 (set_attr "mode" "HI")])
10268 (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" ""))
10270 (set (match_operand:HI 0 "nonimmediate_operand" "")
10271 (not:HI (match_dup 1)))]
10272 "ix86_match_ccmode (insn, CCNOmode)"
10273 [(parallel [(set (reg:CCNO 17)
10274 (compare:CCNO (xor:HI (match_dup 1) (const_int -1))
10277 (xor:HI (match_dup 1) (const_int -1)))])]
10280 ;; %%% Potential partial reg stall on alternative 1. What to do?
10281 (define_expand "one_cmplqi2"
10282 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10283 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
10284 "TARGET_QIMODE_MATH"
10285 "ix86_expand_unary_operator (NOT, QImode, operands); DONE;")
10287 (define_insn "*one_cmplqi2_1"
10288 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10289 (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
10290 "ix86_unary_operator_ok (NOT, QImode, operands)"
10294 [(set_attr "type" "negnot")
10295 (set_attr "mode" "QI,SI")])
10297 (define_insn "*one_cmplqi2_2"
10299 (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
10301 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
10302 (not:QI (match_dup 1)))]
10303 "ix86_match_ccmode (insn, CCNOmode)
10304 && ix86_unary_operator_ok (NOT, QImode, operands)"
10306 [(set_attr "type" "alu1")
10307 (set_attr "mode" "QI")])
10311 (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" ""))
10313 (set (match_operand:QI 0 "nonimmediate_operand" "")
10314 (not:QI (match_dup 1)))]
10315 "ix86_match_ccmode (insn, CCNOmode)"
10316 [(parallel [(set (reg:CCNO 17)
10317 (compare:CCNO (xor:QI (match_dup 1) (const_int -1))
10320 (xor:QI (match_dup 1) (const_int -1)))])]
10323 ;; Arithmetic shift instructions
10325 ;; DImode shifts are implemented using the i386 "shift double" opcode,
10326 ;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count
10327 ;; is variable, then the count is in %cl and the "imm" operand is dropped
10328 ;; from the assembler input.
10330 ;; This instruction shifts the target reg/mem as usual, but instead of
10331 ;; shifting in zeros, bits are shifted in from reg operand. If the insn
10332 ;; is a left shift double, bits are taken from the high order bits of
10333 ;; reg, else if the insn is a shift right double, bits are taken from the
10334 ;; low order bits of reg. So if %eax is "1234" and %edx is "5678",
10335 ;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345".
10337 ;; Since sh[lr]d does not change the `reg' operand, that is done
10338 ;; separately, making all shifts emit pairs of shift double and normal
10339 ;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to
10340 ;; support a 63 bit shift, each shift where the count is in a reg expands
10341 ;; to a pair of shifts, a branch, a shift by 32 and a label.
10343 ;; If the shift count is a constant, we need never emit more than one
10344 ;; shift pair, instead using moves and sign extension for counts greater
10347 (define_expand "ashldi3"
10348 [(parallel [(set (match_operand:DI 0 "shiftdi_operand" "")
10349 (ashift:DI (match_operand:DI 1 "shiftdi_operand" "")
10350 (match_operand:QI 2 "nonmemory_operand" "")))
10351 (clobber (reg:CC 17))])]
10354 if (!TARGET_64BIT && TARGET_CMOVE && ! immediate_operand (operands[2], QImode))
10356 emit_insn (gen_ashldi3_1 (operands[0], operands[1], operands[2]));
10359 ix86_expand_binary_operator (ASHIFT, DImode, operands);
10363 (define_insn "*ashldi3_1_rex64"
10364 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
10365 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0,r")
10366 (match_operand:QI 2 "nonmemory_operand" "cJ,M")))
10367 (clobber (reg:CC 17))]
10368 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10370 switch (get_attr_type (insn))
10373 if (operands[2] != const1_rtx)
10375 if (!rtx_equal_p (operands[0], operands[1]))
10377 return "add{q}\t{%0, %0|%0, %0}";
10380 if (GET_CODE (operands[2]) != CONST_INT
10381 || (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 3)
10383 operands[1] = gen_rtx_MULT (DImode, operands[1],
10384 GEN_INT (1 << INTVAL (operands[2])));
10385 return "lea{q}\t{%a1, %0|%0, %a1}";
10388 if (REG_P (operands[2]))
10389 return "sal{q}\t{%b2, %0|%0, %b2}";
10390 else if (GET_CODE (operands[2]) == CONST_INT
10391 && INTVAL (operands[2]) == 1
10392 && (TARGET_SHIFT1 || optimize_size))
10393 return "sal{q}\t%0";
10395 return "sal{q}\t{%2, %0|%0, %2}";
10398 [(set (attr "type")
10399 (cond [(eq_attr "alternative" "1")
10400 (const_string "lea")
10401 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10403 (match_operand 0 "register_operand" ""))
10404 (match_operand 2 "const1_operand" ""))
10405 (const_string "alu")
10407 (const_string "ishift")))
10408 (set_attr "mode" "DI")])
10410 ;; Convert lea to the lea pattern to avoid flags dependency.
10412 [(set (match_operand:DI 0 "register_operand" "")
10413 (ashift:DI (match_operand:DI 1 "register_operand" "")
10414 (match_operand:QI 2 "immediate_operand" "")))
10415 (clobber (reg:CC 17))]
10416 "TARGET_64BIT && reload_completed
10417 && true_regnum (operands[0]) != true_regnum (operands[1])"
10418 [(set (match_dup 0)
10419 (mult:DI (match_dup 1)
10421 "operands[2] = gen_int_mode (1 << INTVAL (operands[2]), DImode);")
10423 ;; This pattern can't accept a variable shift count, since shifts by
10424 ;; zero don't affect the flags. We assume that shifts by constant
10425 ;; zero are optimized away.
10426 (define_insn "*ashldi3_cmp_rex64"
10429 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0")
10430 (match_operand:QI 2 "immediate_operand" "e"))
10432 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10433 (ashift:DI (match_dup 1) (match_dup 2)))]
10434 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10435 && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10437 switch (get_attr_type (insn))
10440 if (operands[2] != const1_rtx)
10442 return "add{q}\t{%0, %0|%0, %0}";
10445 if (REG_P (operands[2]))
10446 return "sal{q}\t{%b2, %0|%0, %b2}";
10447 else if (GET_CODE (operands[2]) == CONST_INT
10448 && INTVAL (operands[2]) == 1
10449 && (TARGET_SHIFT1 || optimize_size))
10450 return "sal{q}\t%0";
10452 return "sal{q}\t{%2, %0|%0, %2}";
10455 [(set (attr "type")
10456 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10458 (match_operand 0 "register_operand" ""))
10459 (match_operand 2 "const1_operand" ""))
10460 (const_string "alu")
10462 (const_string "ishift")))
10463 (set_attr "mode" "DI")])
10465 (define_insn "ashldi3_1"
10466 [(set (match_operand:DI 0 "register_operand" "=r")
10467 (ashift:DI (match_operand:DI 1 "register_operand" "0")
10468 (match_operand:QI 2 "nonmemory_operand" "Jc")))
10469 (clobber (match_scratch:SI 3 "=&r"))
10470 (clobber (reg:CC 17))]
10471 "!TARGET_64BIT && TARGET_CMOVE"
10473 [(set_attr "type" "multi")])
10475 (define_insn "*ashldi3_2"
10476 [(set (match_operand:DI 0 "register_operand" "=r")
10477 (ashift:DI (match_operand:DI 1 "register_operand" "0")
10478 (match_operand:QI 2 "nonmemory_operand" "Jc")))
10479 (clobber (reg:CC 17))]
10482 [(set_attr "type" "multi")])
10485 [(set (match_operand:DI 0 "register_operand" "")
10486 (ashift:DI (match_operand:DI 1 "register_operand" "")
10487 (match_operand:QI 2 "nonmemory_operand" "")))
10488 (clobber (match_scratch:SI 3 ""))
10489 (clobber (reg:CC 17))]
10490 "!TARGET_64BIT && TARGET_CMOVE && reload_completed"
10492 "ix86_split_ashldi (operands, operands[3]); DONE;")
10495 [(set (match_operand:DI 0 "register_operand" "")
10496 (ashift:DI (match_operand:DI 1 "register_operand" "")
10497 (match_operand:QI 2 "nonmemory_operand" "")))
10498 (clobber (reg:CC 17))]
10499 "!TARGET_64BIT && reload_completed"
10501 "ix86_split_ashldi (operands, NULL_RTX); DONE;")
10503 (define_insn "x86_shld_1"
10504 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
10505 (ior:SI (ashift:SI (match_dup 0)
10506 (match_operand:QI 2 "nonmemory_operand" "I,c"))
10507 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
10508 (minus:QI (const_int 32) (match_dup 2)))))
10509 (clobber (reg:CC 17))]
10512 shld{l}\t{%2, %1, %0|%0, %1, %2}
10513 shld{l}\t{%s2%1, %0|%0, %1, %2}"
10514 [(set_attr "type" "ishift")
10515 (set_attr "prefix_0f" "1")
10516 (set_attr "mode" "SI")
10517 (set_attr "pent_pair" "np")
10518 (set_attr "athlon_decode" "vector")
10519 (set_attr "ppro_uops" "few")])
10521 (define_expand "x86_shift_adj_1"
10523 (compare:CCZ (and:QI (match_operand:QI 2 "register_operand" "")
10526 (set (match_operand:SI 0 "register_operand" "")
10527 (if_then_else:SI (ne (reg:CCZ 17) (const_int 0))
10528 (match_operand:SI 1 "register_operand" "")
10531 (if_then_else:SI (ne (reg:CCZ 17) (const_int 0))
10532 (match_operand:SI 3 "register_operand" "r")
10537 (define_expand "x86_shift_adj_2"
10538 [(use (match_operand:SI 0 "register_operand" ""))
10539 (use (match_operand:SI 1 "register_operand" ""))
10540 (use (match_operand:QI 2 "register_operand" ""))]
10543 rtx label = gen_label_rtx ();
10546 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
10548 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
10549 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
10550 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
10551 gen_rtx_LABEL_REF (VOIDmode, label),
10553 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
10554 JUMP_LABEL (tmp) = label;
10556 emit_move_insn (operands[0], operands[1]);
10557 emit_move_insn (operands[1], const0_rtx);
10559 emit_label (label);
10560 LABEL_NUSES (label) = 1;
10565 (define_expand "ashlsi3"
10566 [(set (match_operand:SI 0 "nonimmediate_operand" "")
10567 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "")
10568 (match_operand:QI 2 "nonmemory_operand" "")))
10569 (clobber (reg:CC 17))]
10571 "ix86_expand_binary_operator (ASHIFT, SImode, operands); DONE;")
10573 (define_insn "*ashlsi3_1"
10574 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
10575 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,r")
10576 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
10577 (clobber (reg:CC 17))]
10578 "ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10580 switch (get_attr_type (insn))
10583 if (operands[2] != const1_rtx)
10585 if (!rtx_equal_p (operands[0], operands[1]))
10587 return "add{l}\t{%0, %0|%0, %0}";
10593 if (REG_P (operands[2]))
10594 return "sal{l}\t{%b2, %0|%0, %b2}";
10595 else if (GET_CODE (operands[2]) == CONST_INT
10596 && INTVAL (operands[2]) == 1
10597 && (TARGET_SHIFT1 || optimize_size))
10598 return "sal{l}\t%0";
10600 return "sal{l}\t{%2, %0|%0, %2}";
10603 [(set (attr "type")
10604 (cond [(eq_attr "alternative" "1")
10605 (const_string "lea")
10606 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10608 (match_operand 0 "register_operand" ""))
10609 (match_operand 2 "const1_operand" ""))
10610 (const_string "alu")
10612 (const_string "ishift")))
10613 (set_attr "mode" "SI")])
10615 ;; Convert lea to the lea pattern to avoid flags dependency.
10617 [(set (match_operand 0 "register_operand" "")
10618 (ashift (match_operand 1 "index_register_operand" "")
10619 (match_operand:QI 2 "const_int_operand" "")))
10620 (clobber (reg:CC 17))]
10622 && true_regnum (operands[0]) != true_regnum (operands[1])"
10626 operands[0] = gen_lowpart (SImode, operands[0]);
10627 operands[1] = gen_lowpart (Pmode, operands[1]);
10628 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
10629 pat = gen_rtx_MULT (Pmode, operands[1], operands[2]);
10630 if (Pmode != SImode)
10631 pat = gen_rtx_SUBREG (SImode, pat, 0);
10632 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
10636 ;; Rare case of shifting RSP is handled by generating move and shift
10638 [(set (match_operand 0 "register_operand" "")
10639 (ashift (match_operand 1 "register_operand" "")
10640 (match_operand:QI 2 "const_int_operand" "")))
10641 (clobber (reg:CC 17))]
10643 && true_regnum (operands[0]) != true_regnum (operands[1])"
10647 emit_move_insn (operands[1], operands[0]);
10648 pat = gen_rtx_SET (VOIDmode, operands[0],
10649 gen_rtx_ASHIFT (GET_MODE (operands[0]),
10650 operands[0], operands[2]));
10651 clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
10652 emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, pat, clob)));
10656 (define_insn "*ashlsi3_1_zext"
10657 [(set (match_operand:DI 0 "register_operand" "=r,r")
10658 (zero_extend:DI (ashift:SI (match_operand:SI 1 "register_operand" "0,r")
10659 (match_operand:QI 2 "nonmemory_operand" "cI,M"))))
10660 (clobber (reg:CC 17))]
10661 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10663 switch (get_attr_type (insn))
10666 if (operands[2] != const1_rtx)
10668 return "add{l}\t{%k0, %k0|%k0, %k0}";
10674 if (REG_P (operands[2]))
10675 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10676 else if (GET_CODE (operands[2]) == CONST_INT
10677 && INTVAL (operands[2]) == 1
10678 && (TARGET_SHIFT1 || optimize_size))
10679 return "sal{l}\t%k0";
10681 return "sal{l}\t{%2, %k0|%k0, %2}";
10684 [(set (attr "type")
10685 (cond [(eq_attr "alternative" "1")
10686 (const_string "lea")
10687 (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10689 (match_operand 2 "const1_operand" ""))
10690 (const_string "alu")
10692 (const_string "ishift")))
10693 (set_attr "mode" "SI")])
10695 ;; Convert lea to the lea pattern to avoid flags dependency.
10697 [(set (match_operand:DI 0 "register_operand" "")
10698 (zero_extend:DI (ashift (match_operand 1 "register_operand" "")
10699 (match_operand:QI 2 "const_int_operand" ""))))
10700 (clobber (reg:CC 17))]
10702 && true_regnum (operands[0]) != true_regnum (operands[1])"
10703 [(set (match_dup 0) (zero_extend:DI (subreg:SI (mult:SI (match_dup 1) (match_dup 2)) 0)))]
10705 operands[1] = gen_lowpart (Pmode, operands[1]);
10706 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
10709 ;; This pattern can't accept a variable shift count, since shifts by
10710 ;; zero don't affect the flags. We assume that shifts by constant
10711 ;; zero are optimized away.
10712 (define_insn "*ashlsi3_cmp"
10715 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
10716 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10718 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10719 (ashift:SI (match_dup 1) (match_dup 2)))]
10720 "ix86_match_ccmode (insn, CCGOCmode)
10721 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10723 switch (get_attr_type (insn))
10726 if (operands[2] != const1_rtx)
10728 return "add{l}\t{%0, %0|%0, %0}";
10731 if (REG_P (operands[2]))
10732 return "sal{l}\t{%b2, %0|%0, %b2}";
10733 else if (GET_CODE (operands[2]) == CONST_INT
10734 && INTVAL (operands[2]) == 1
10735 && (TARGET_SHIFT1 || optimize_size))
10736 return "sal{l}\t%0";
10738 return "sal{l}\t{%2, %0|%0, %2}";
10741 [(set (attr "type")
10742 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10744 (match_operand 0 "register_operand" ""))
10745 (match_operand 2 "const1_operand" ""))
10746 (const_string "alu")
10748 (const_string "ishift")))
10749 (set_attr "mode" "SI")])
10751 (define_insn "*ashlsi3_cmp_zext"
10754 (ashift:SI (match_operand:SI 1 "register_operand" "0")
10755 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10757 (set (match_operand:DI 0 "register_operand" "=r")
10758 (zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))]
10759 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
10760 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
10762 switch (get_attr_type (insn))
10765 if (operands[2] != const1_rtx)
10767 return "add{l}\t{%k0, %k0|%k0, %k0}";
10770 if (REG_P (operands[2]))
10771 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10772 else if (GET_CODE (operands[2]) == CONST_INT
10773 && INTVAL (operands[2]) == 1
10774 && (TARGET_SHIFT1 || optimize_size))
10775 return "sal{l}\t%k0";
10777 return "sal{l}\t{%2, %k0|%k0, %2}";
10780 [(set (attr "type")
10781 (cond [(and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10783 (match_operand 2 "const1_operand" ""))
10784 (const_string "alu")
10786 (const_string "ishift")))
10787 (set_attr "mode" "SI")])
10789 (define_expand "ashlhi3"
10790 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10791 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "")
10792 (match_operand:QI 2 "nonmemory_operand" "")))
10793 (clobber (reg:CC 17))]
10794 "TARGET_HIMODE_MATH"
10795 "ix86_expand_binary_operator (ASHIFT, HImode, operands); DONE;")
10797 (define_insn "*ashlhi3_1_lea"
10798 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
10799 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,r")
10800 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
10801 (clobber (reg:CC 17))]
10802 "!TARGET_PARTIAL_REG_STALL
10803 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10805 switch (get_attr_type (insn))
10810 if (operands[2] != const1_rtx)
10812 return "add{w}\t{%0, %0|%0, %0}";
10815 if (REG_P (operands[2]))
10816 return "sal{w}\t{%b2, %0|%0, %b2}";
10817 else if (GET_CODE (operands[2]) == CONST_INT
10818 && INTVAL (operands[2]) == 1
10819 && (TARGET_SHIFT1 || optimize_size))
10820 return "sal{w}\t%0";
10822 return "sal{w}\t{%2, %0|%0, %2}";
10825 [(set (attr "type")
10826 (cond [(eq_attr "alternative" "1")
10827 (const_string "lea")
10828 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10830 (match_operand 0 "register_operand" ""))
10831 (match_operand 2 "const1_operand" ""))
10832 (const_string "alu")
10834 (const_string "ishift")))
10835 (set_attr "mode" "HI,SI")])
10837 (define_insn "*ashlhi3_1"
10838 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10839 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
10840 (match_operand:QI 2 "nonmemory_operand" "cI")))
10841 (clobber (reg:CC 17))]
10842 "TARGET_PARTIAL_REG_STALL
10843 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10845 switch (get_attr_type (insn))
10848 if (operands[2] != const1_rtx)
10850 return "add{w}\t{%0, %0|%0, %0}";
10853 if (REG_P (operands[2]))
10854 return "sal{w}\t{%b2, %0|%0, %b2}";
10855 else if (GET_CODE (operands[2]) == CONST_INT
10856 && INTVAL (operands[2]) == 1
10857 && (TARGET_SHIFT1 || optimize_size))
10858 return "sal{w}\t%0";
10860 return "sal{w}\t{%2, %0|%0, %2}";
10863 [(set (attr "type")
10864 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10866 (match_operand 0 "register_operand" ""))
10867 (match_operand 2 "const1_operand" ""))
10868 (const_string "alu")
10870 (const_string "ishift")))
10871 (set_attr "mode" "HI")])
10873 ;; This pattern can't accept a variable shift count, since shifts by
10874 ;; zero don't affect the flags. We assume that shifts by constant
10875 ;; zero are optimized away.
10876 (define_insn "*ashlhi3_cmp"
10879 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
10880 (match_operand:QI 2 "const_int_1_31_operand" "I"))
10882 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10883 (ashift:HI (match_dup 1) (match_dup 2)))]
10884 "ix86_match_ccmode (insn, CCGOCmode)
10885 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
10887 switch (get_attr_type (insn))
10890 if (operands[2] != const1_rtx)
10892 return "add{w}\t{%0, %0|%0, %0}";
10895 if (REG_P (operands[2]))
10896 return "sal{w}\t{%b2, %0|%0, %b2}";
10897 else if (GET_CODE (operands[2]) == CONST_INT
10898 && INTVAL (operands[2]) == 1
10899 && (TARGET_SHIFT1 || optimize_size))
10900 return "sal{w}\t%0";
10902 return "sal{w}\t{%2, %0|%0, %2}";
10905 [(set (attr "type")
10906 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10908 (match_operand 0 "register_operand" ""))
10909 (match_operand 2 "const1_operand" ""))
10910 (const_string "alu")
10912 (const_string "ishift")))
10913 (set_attr "mode" "HI")])
10915 (define_expand "ashlqi3"
10916 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10917 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "")
10918 (match_operand:QI 2 "nonmemory_operand" "")))
10919 (clobber (reg:CC 17))]
10920 "TARGET_QIMODE_MATH"
10921 "ix86_expand_binary_operator (ASHIFT, QImode, operands); DONE;")
10923 ;; %%% Potential partial reg stall on alternative 2. What to do?
10925 (define_insn "*ashlqi3_1_lea"
10926 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,r")
10927 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,r")
10928 (match_operand:QI 2 "nonmemory_operand" "cI,cI,M")))
10929 (clobber (reg:CC 17))]
10930 "!TARGET_PARTIAL_REG_STALL
10931 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10933 switch (get_attr_type (insn))
10938 if (operands[2] != const1_rtx)
10940 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
10941 return "add{l}\t{%k0, %k0|%k0, %k0}";
10943 return "add{b}\t{%0, %0|%0, %0}";
10946 if (REG_P (operands[2]))
10948 if (get_attr_mode (insn) == MODE_SI)
10949 return "sal{l}\t{%b2, %k0|%k0, %b2}";
10951 return "sal{b}\t{%b2, %0|%0, %b2}";
10953 else if (GET_CODE (operands[2]) == CONST_INT
10954 && INTVAL (operands[2]) == 1
10955 && (TARGET_SHIFT1 || optimize_size))
10957 if (get_attr_mode (insn) == MODE_SI)
10958 return "sal{l}\t%0";
10960 return "sal{b}\t%0";
10964 if (get_attr_mode (insn) == MODE_SI)
10965 return "sal{l}\t{%2, %k0|%k0, %2}";
10967 return "sal{b}\t{%2, %0|%0, %2}";
10971 [(set (attr "type")
10972 (cond [(eq_attr "alternative" "2")
10973 (const_string "lea")
10974 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
10976 (match_operand 0 "register_operand" ""))
10977 (match_operand 2 "const1_operand" ""))
10978 (const_string "alu")
10980 (const_string "ishift")))
10981 (set_attr "mode" "QI,SI,SI")])
10983 (define_insn "*ashlqi3_1"
10984 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10985 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
10986 (match_operand:QI 2 "nonmemory_operand" "cI,cI")))
10987 (clobber (reg:CC 17))]
10988 "TARGET_PARTIAL_REG_STALL
10989 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
10991 switch (get_attr_type (insn))
10994 if (operands[2] != const1_rtx)
10996 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
10997 return "add{l}\t{%k0, %k0|%k0, %k0}";
10999 return "add{b}\t{%0, %0|%0, %0}";
11002 if (REG_P (operands[2]))
11004 if (get_attr_mode (insn) == MODE_SI)
11005 return "sal{l}\t{%b2, %k0|%k0, %b2}";
11007 return "sal{b}\t{%b2, %0|%0, %b2}";
11009 else if (GET_CODE (operands[2]) == CONST_INT
11010 && INTVAL (operands[2]) == 1
11011 && (TARGET_SHIFT1 || optimize_size))
11013 if (get_attr_mode (insn) == MODE_SI)
11014 return "sal{l}\t%0";
11016 return "sal{b}\t%0";
11020 if (get_attr_mode (insn) == MODE_SI)
11021 return "sal{l}\t{%2, %k0|%k0, %2}";
11023 return "sal{b}\t{%2, %0|%0, %2}";
11027 [(set (attr "type")
11028 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11030 (match_operand 0 "register_operand" ""))
11031 (match_operand 2 "const1_operand" ""))
11032 (const_string "alu")
11034 (const_string "ishift")))
11035 (set_attr "mode" "QI,SI")])
11037 ;; This pattern can't accept a variable shift count, since shifts by
11038 ;; zero don't affect the flags. We assume that shifts by constant
11039 ;; zero are optimized away.
11040 (define_insn "*ashlqi3_cmp"
11043 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11044 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11046 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11047 (ashift:QI (match_dup 1) (match_dup 2)))]
11048 "ix86_match_ccmode (insn, CCGOCmode)
11049 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
11051 switch (get_attr_type (insn))
11054 if (operands[2] != const1_rtx)
11056 return "add{b}\t{%0, %0|%0, %0}";
11059 if (REG_P (operands[2]))
11060 return "sal{b}\t{%b2, %0|%0, %b2}";
11061 else if (GET_CODE (operands[2]) == CONST_INT
11062 && INTVAL (operands[2]) == 1
11063 && (TARGET_SHIFT1 || optimize_size))
11064 return "sal{b}\t%0";
11066 return "sal{b}\t{%2, %0|%0, %2}";
11069 [(set (attr "type")
11070 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11072 (match_operand 0 "register_operand" ""))
11073 (match_operand 2 "const1_operand" ""))
11074 (const_string "alu")
11076 (const_string "ishift")))
11077 (set_attr "mode" "QI")])
11079 ;; See comment above `ashldi3' about how this works.
11081 (define_expand "ashrdi3"
11082 [(parallel [(set (match_operand:DI 0 "shiftdi_operand" "")
11083 (ashiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
11084 (match_operand:QI 2 "nonmemory_operand" "")))
11085 (clobber (reg:CC 17))])]
11088 if (!TARGET_64BIT && TARGET_CMOVE && ! immediate_operand (operands[2], QImode))
11090 emit_insn (gen_ashrdi3_1 (operands[0], operands[1], operands[2]));
11093 ix86_expand_binary_operator (ASHIFTRT, DImode, operands);
11097 (define_insn "ashrdi3_63_rex64"
11098 [(set (match_operand:DI 0 "nonimmediate_operand" "=*d,rm")
11099 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "*a,0")
11100 (match_operand:DI 2 "const_int_operand" "i,i")))
11101 (clobber (reg:CC 17))]
11102 "TARGET_64BIT && INTVAL (operands[2]) == 63 && (TARGET_USE_CLTD || optimize_size)
11103 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11106 sar{q}\t{%2, %0|%0, %2}"
11107 [(set_attr "type" "imovx,ishift")
11108 (set_attr "prefix_0f" "0,*")
11109 (set_attr "length_immediate" "0,*")
11110 (set_attr "modrm" "0,1")
11111 (set_attr "mode" "DI")])
11113 (define_insn "*ashrdi3_1_one_bit_rex64"
11114 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11115 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11116 (match_operand:QI 2 "const_int_1_operand" "")))
11117 (clobber (reg:CC 17))]
11118 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)
11119 && (TARGET_SHIFT1 || optimize_size)"
11121 [(set_attr "type" "ishift")
11122 (set (attr "length")
11123 (if_then_else (match_operand:DI 0 "register_operand" "")
11125 (const_string "*")))])
11127 (define_insn "*ashrdi3_1_rex64"
11128 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11129 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11130 (match_operand:QI 2 "nonmemory_operand" "J,c")))
11131 (clobber (reg:CC 17))]
11132 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11134 sar{q}\t{%2, %0|%0, %2}
11135 sar{q}\t{%b2, %0|%0, %b2}"
11136 [(set_attr "type" "ishift")
11137 (set_attr "mode" "DI")])
11139 ;; This pattern can't accept a variable shift count, since shifts by
11140 ;; zero don't affect the flags. We assume that shifts by constant
11141 ;; zero are optimized away.
11142 (define_insn "*ashrdi3_one_bit_cmp_rex64"
11145 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11146 (match_operand:QI 2 "const_int_1_operand" ""))
11148 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11149 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
11150 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11151 && (TARGET_SHIFT1 || optimize_size)
11152 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11154 [(set_attr "type" "ishift")
11155 (set (attr "length")
11156 (if_then_else (match_operand:DI 0 "register_operand" "")
11158 (const_string "*")))])
11160 ;; This pattern can't accept a variable shift count, since shifts by
11161 ;; zero don't affect the flags. We assume that shifts by constant
11162 ;; zero are optimized away.
11163 (define_insn "*ashrdi3_cmp_rex64"
11166 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11167 (match_operand:QI 2 "const_int_operand" "n"))
11169 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11170 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
11171 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11172 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11173 "sar{q}\t{%2, %0|%0, %2}"
11174 [(set_attr "type" "ishift")
11175 (set_attr "mode" "DI")])
11178 (define_insn "ashrdi3_1"
11179 [(set (match_operand:DI 0 "register_operand" "=r")
11180 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
11181 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11182 (clobber (match_scratch:SI 3 "=&r"))
11183 (clobber (reg:CC 17))]
11184 "!TARGET_64BIT && TARGET_CMOVE"
11186 [(set_attr "type" "multi")])
11188 (define_insn "*ashrdi3_2"
11189 [(set (match_operand:DI 0 "register_operand" "=r")
11190 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
11191 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11192 (clobber (reg:CC 17))]
11195 [(set_attr "type" "multi")])
11198 [(set (match_operand:DI 0 "register_operand" "")
11199 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
11200 (match_operand:QI 2 "nonmemory_operand" "")))
11201 (clobber (match_scratch:SI 3 ""))
11202 (clobber (reg:CC 17))]
11203 "!TARGET_64BIT && TARGET_CMOVE && reload_completed"
11205 "ix86_split_ashrdi (operands, operands[3]); DONE;")
11208 [(set (match_operand:DI 0 "register_operand" "")
11209 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
11210 (match_operand:QI 2 "nonmemory_operand" "")))
11211 (clobber (reg:CC 17))]
11212 "!TARGET_64BIT && reload_completed"
11214 "ix86_split_ashrdi (operands, NULL_RTX); DONE;")
11216 (define_insn "x86_shrd_1"
11217 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
11218 (ior:SI (ashiftrt:SI (match_dup 0)
11219 (match_operand:QI 2 "nonmemory_operand" "I,c"))
11220 (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
11221 (minus:QI (const_int 32) (match_dup 2)))))
11222 (clobber (reg:CC 17))]
11225 shrd{l}\t{%2, %1, %0|%0, %1, %2}
11226 shrd{l}\t{%s2%1, %0|%0, %1, %2}"
11227 [(set_attr "type" "ishift")
11228 (set_attr "prefix_0f" "1")
11229 (set_attr "pent_pair" "np")
11230 (set_attr "ppro_uops" "few")
11231 (set_attr "mode" "SI")])
11233 (define_expand "x86_shift_adj_3"
11234 [(use (match_operand:SI 0 "register_operand" ""))
11235 (use (match_operand:SI 1 "register_operand" ""))
11236 (use (match_operand:QI 2 "register_operand" ""))]
11239 rtx label = gen_label_rtx ();
11242 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
11244 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
11245 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
11246 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
11247 gen_rtx_LABEL_REF (VOIDmode, label),
11249 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
11250 JUMP_LABEL (tmp) = label;
11252 emit_move_insn (operands[0], operands[1]);
11253 emit_insn (gen_ashrsi3_31 (operands[1], operands[1], GEN_INT (31)));
11255 emit_label (label);
11256 LABEL_NUSES (label) = 1;
11261 (define_insn "ashrsi3_31"
11262 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,rm")
11263 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "*a,0")
11264 (match_operand:SI 2 "const_int_operand" "i,i")))
11265 (clobber (reg:CC 17))]
11266 "INTVAL (operands[2]) == 31 && (TARGET_USE_CLTD || optimize_size)
11267 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11270 sar{l}\t{%2, %0|%0, %2}"
11271 [(set_attr "type" "imovx,ishift")
11272 (set_attr "prefix_0f" "0,*")
11273 (set_attr "length_immediate" "0,*")
11274 (set_attr "modrm" "0,1")
11275 (set_attr "mode" "SI")])
11277 (define_insn "*ashrsi3_31_zext"
11278 [(set (match_operand:DI 0 "register_operand" "=*d,r")
11279 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "*a,0")
11280 (match_operand:SI 2 "const_int_operand" "i,i"))))
11281 (clobber (reg:CC 17))]
11282 "TARGET_64BIT && (TARGET_USE_CLTD || optimize_size)
11283 && INTVAL (operands[2]) == 31
11284 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11287 sar{l}\t{%2, %k0|%k0, %2}"
11288 [(set_attr "type" "imovx,ishift")
11289 (set_attr "prefix_0f" "0,*")
11290 (set_attr "length_immediate" "0,*")
11291 (set_attr "modrm" "0,1")
11292 (set_attr "mode" "SI")])
11294 (define_expand "ashrsi3"
11295 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11296 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11297 (match_operand:QI 2 "nonmemory_operand" "")))
11298 (clobber (reg:CC 17))]
11300 "ix86_expand_binary_operator (ASHIFTRT, SImode, operands); DONE;")
11302 (define_insn "*ashrsi3_1_one_bit"
11303 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11304 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11305 (match_operand:QI 2 "const_int_1_operand" "")))
11306 (clobber (reg:CC 17))]
11307 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11308 && (TARGET_SHIFT1 || optimize_size)"
11310 [(set_attr "type" "ishift")
11311 (set (attr "length")
11312 (if_then_else (match_operand:SI 0 "register_operand" "")
11314 (const_string "*")))])
11316 (define_insn "*ashrsi3_1_one_bit_zext"
11317 [(set (match_operand:DI 0 "register_operand" "=r")
11318 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11319 (match_operand:QI 2 "const_int_1_operand" ""))))
11320 (clobber (reg:CC 17))]
11321 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11322 && (TARGET_SHIFT1 || optimize_size)"
11324 [(set_attr "type" "ishift")
11325 (set_attr "length" "2")])
11327 (define_insn "*ashrsi3_1"
11328 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11329 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11330 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11331 (clobber (reg:CC 17))]
11332 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11334 sar{l}\t{%2, %0|%0, %2}
11335 sar{l}\t{%b2, %0|%0, %b2}"
11336 [(set_attr "type" "ishift")
11337 (set_attr "mode" "SI")])
11339 (define_insn "*ashrsi3_1_zext"
11340 [(set (match_operand:DI 0 "register_operand" "=r,r")
11341 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
11342 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11343 (clobber (reg:CC 17))]
11344 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11346 sar{l}\t{%2, %k0|%k0, %2}
11347 sar{l}\t{%b2, %k0|%k0, %b2}"
11348 [(set_attr "type" "ishift")
11349 (set_attr "mode" "SI")])
11351 ;; This pattern can't accept a variable shift count, since shifts by
11352 ;; zero don't affect the flags. We assume that shifts by constant
11353 ;; zero are optimized away.
11354 (define_insn "*ashrsi3_one_bit_cmp"
11357 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11358 (match_operand:QI 2 "const_int_1_operand" ""))
11360 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11361 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11362 "ix86_match_ccmode (insn, CCGOCmode)
11363 && (TARGET_SHIFT1 || optimize_size)
11364 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11366 [(set_attr "type" "ishift")
11367 (set (attr "length")
11368 (if_then_else (match_operand:SI 0 "register_operand" "")
11370 (const_string "*")))])
11372 (define_insn "*ashrsi3_one_bit_cmp_zext"
11375 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11376 (match_operand:QI 2 "const_int_1_operand" ""))
11378 (set (match_operand:DI 0 "register_operand" "=r")
11379 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11380 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
11381 && (TARGET_SHIFT1 || optimize_size)
11382 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11384 [(set_attr "type" "ishift")
11385 (set_attr "length" "2")])
11387 ;; This pattern can't accept a variable shift count, since shifts by
11388 ;; zero don't affect the flags. We assume that shifts by constant
11389 ;; zero are optimized away.
11390 (define_insn "*ashrsi3_cmp"
11393 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11394 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11396 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11397 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11398 "ix86_match_ccmode (insn, CCGOCmode)
11399 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11400 "sar{l}\t{%2, %0|%0, %2}"
11401 [(set_attr "type" "ishift")
11402 (set_attr "mode" "SI")])
11404 (define_insn "*ashrsi3_cmp_zext"
11407 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11408 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11410 (set (match_operand:DI 0 "register_operand" "=r")
11411 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11412 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11413 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11414 "sar{l}\t{%2, %k0|%k0, %2}"
11415 [(set_attr "type" "ishift")
11416 (set_attr "mode" "SI")])
11418 (define_expand "ashrhi3"
11419 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11420 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
11421 (match_operand:QI 2 "nonmemory_operand" "")))
11422 (clobber (reg:CC 17))]
11423 "TARGET_HIMODE_MATH"
11424 "ix86_expand_binary_operator (ASHIFTRT, HImode, operands); DONE;")
11426 (define_insn "*ashrhi3_1_one_bit"
11427 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11428 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11429 (match_operand:QI 2 "const_int_1_operand" "")))
11430 (clobber (reg:CC 17))]
11431 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)
11432 && (TARGET_SHIFT1 || optimize_size)"
11434 [(set_attr "type" "ishift")
11435 (set (attr "length")
11436 (if_then_else (match_operand 0 "register_operand" "")
11438 (const_string "*")))])
11440 (define_insn "*ashrhi3_1"
11441 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11442 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11443 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11444 (clobber (reg:CC 17))]
11445 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11447 sar{w}\t{%2, %0|%0, %2}
11448 sar{w}\t{%b2, %0|%0, %b2}"
11449 [(set_attr "type" "ishift")
11450 (set_attr "mode" "HI")])
11452 ;; This pattern can't accept a variable shift count, since shifts by
11453 ;; zero don't affect the flags. We assume that shifts by constant
11454 ;; zero are optimized away.
11455 (define_insn "*ashrhi3_one_bit_cmp"
11458 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11459 (match_operand:QI 2 "const_int_1_operand" ""))
11461 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11462 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
11463 "ix86_match_ccmode (insn, CCGOCmode)
11464 && (TARGET_SHIFT1 || optimize_size)
11465 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11467 [(set_attr "type" "ishift")
11468 (set (attr "length")
11469 (if_then_else (match_operand 0 "register_operand" "")
11471 (const_string "*")))])
11473 ;; This pattern can't accept a variable shift count, since shifts by
11474 ;; zero don't affect the flags. We assume that shifts by constant
11475 ;; zero are optimized away.
11476 (define_insn "*ashrhi3_cmp"
11479 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11480 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11482 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11483 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
11484 "ix86_match_ccmode (insn, CCGOCmode)
11485 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
11486 "sar{w}\t{%2, %0|%0, %2}"
11487 [(set_attr "type" "ishift")
11488 (set_attr "mode" "HI")])
11490 (define_expand "ashrqi3"
11491 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11492 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
11493 (match_operand:QI 2 "nonmemory_operand" "")))
11494 (clobber (reg:CC 17))]
11495 "TARGET_QIMODE_MATH"
11496 "ix86_expand_binary_operator (ASHIFTRT, QImode, operands); DONE;")
11498 (define_insn "*ashrqi3_1_one_bit"
11499 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11500 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11501 (match_operand:QI 2 "const_int_1_operand" "")))
11502 (clobber (reg:CC 17))]
11503 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
11504 && (TARGET_SHIFT1 || optimize_size)"
11506 [(set_attr "type" "ishift")
11507 (set (attr "length")
11508 (if_then_else (match_operand 0 "register_operand" "")
11510 (const_string "*")))])
11512 (define_insn "*ashrqi3_1_one_bit_slp"
11513 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11514 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11515 (match_operand:QI 2 "const_int_1_operand" "")))
11516 (clobber (reg:CC 17))]
11517 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
11518 && (! TARGET_PARTIAL_REG_STALL || optimize_size)
11519 && (TARGET_SHIFT1 || optimize_size)"
11521 [(set_attr "type" "ishift")
11522 (set (attr "length")
11523 (if_then_else (match_operand 0 "register_operand" "")
11525 (const_string "*")))])
11527 (define_insn "*ashrqi3_1"
11528 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11529 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11530 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11531 (clobber (reg:CC 17))]
11532 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11534 sar{b}\t{%2, %0|%0, %2}
11535 sar{b}\t{%b2, %0|%0, %b2}"
11536 [(set_attr "type" "ishift")
11537 (set_attr "mode" "QI")])
11539 (define_insn "*ashrqi3_1_slp"
11540 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11541 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11542 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11543 (clobber (reg:CC 17))]
11544 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11545 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11547 sar{b}\t{%2, %0|%0, %2}
11548 sar{b}\t{%b2, %0|%0, %b2}"
11549 [(set_attr "type" "ishift")
11550 (set_attr "mode" "QI")])
11552 ;; This pattern can't accept a variable shift count, since shifts by
11553 ;; zero don't affect the flags. We assume that shifts by constant
11554 ;; zero are optimized away.
11555 (define_insn "*ashrqi3_one_bit_cmp"
11558 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11559 (match_operand:QI 2 "const_int_1_operand" "I"))
11561 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11562 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
11563 "ix86_match_ccmode (insn, CCGOCmode)
11564 && (TARGET_SHIFT1 || optimize_size)
11565 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11567 [(set_attr "type" "ishift")
11568 (set (attr "length")
11569 (if_then_else (match_operand 0 "register_operand" "")
11571 (const_string "*")))])
11573 ;; This pattern can't accept a variable shift count, since shifts by
11574 ;; zero don't affect the flags. We assume that shifts by constant
11575 ;; zero are optimized away.
11576 (define_insn "*ashrqi3_cmp"
11579 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11580 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11582 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11583 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
11584 "ix86_match_ccmode (insn, CCGOCmode)
11585 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
11586 "sar{b}\t{%2, %0|%0, %2}"
11587 [(set_attr "type" "ishift")
11588 (set_attr "mode" "QI")])
11590 ;; Logical shift instructions
11592 ;; See comment above `ashldi3' about how this works.
11594 (define_expand "lshrdi3"
11595 [(parallel [(set (match_operand:DI 0 "shiftdi_operand" "")
11596 (lshiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
11597 (match_operand:QI 2 "nonmemory_operand" "")))
11598 (clobber (reg:CC 17))])]
11601 if (!TARGET_64BIT && TARGET_CMOVE && ! immediate_operand (operands[2], QImode))
11603 emit_insn (gen_lshrdi3_1 (operands[0], operands[1], operands[2]));
11606 ix86_expand_binary_operator (LSHIFTRT, DImode, operands);
11610 (define_insn "*lshrdi3_1_one_bit_rex64"
11611 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11612 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11613 (match_operand:QI 2 "const_int_1_operand" "")))
11614 (clobber (reg:CC 17))]
11615 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11616 && (TARGET_SHIFT1 || optimize_size)"
11618 [(set_attr "type" "ishift")
11619 (set (attr "length")
11620 (if_then_else (match_operand:DI 0 "register_operand" "")
11622 (const_string "*")))])
11624 (define_insn "*lshrdi3_1_rex64"
11625 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11626 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11627 (match_operand:QI 2 "nonmemory_operand" "J,c")))
11628 (clobber (reg:CC 17))]
11629 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11631 shr{q}\t{%2, %0|%0, %2}
11632 shr{q}\t{%b2, %0|%0, %b2}"
11633 [(set_attr "type" "ishift")
11634 (set_attr "mode" "DI")])
11636 ;; This pattern can't accept a variable shift count, since shifts by
11637 ;; zero don't affect the flags. We assume that shifts by constant
11638 ;; zero are optimized away.
11639 (define_insn "*lshrdi3_cmp_one_bit_rex64"
11642 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11643 (match_operand:QI 2 "const_int_1_operand" ""))
11645 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11646 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
11647 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11648 && (TARGET_SHIFT1 || optimize_size)
11649 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11651 [(set_attr "type" "ishift")
11652 (set (attr "length")
11653 (if_then_else (match_operand:DI 0 "register_operand" "")
11655 (const_string "*")))])
11657 ;; This pattern can't accept a variable shift count, since shifts by
11658 ;; zero don't affect the flags. We assume that shifts by constant
11659 ;; zero are optimized away.
11660 (define_insn "*lshrdi3_cmp_rex64"
11663 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11664 (match_operand:QI 2 "const_int_operand" "e"))
11666 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11667 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
11668 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11669 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11670 "shr{q}\t{%2, %0|%0, %2}"
11671 [(set_attr "type" "ishift")
11672 (set_attr "mode" "DI")])
11674 (define_insn "lshrdi3_1"
11675 [(set (match_operand:DI 0 "register_operand" "=r")
11676 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
11677 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11678 (clobber (match_scratch:SI 3 "=&r"))
11679 (clobber (reg:CC 17))]
11680 "!TARGET_64BIT && TARGET_CMOVE"
11682 [(set_attr "type" "multi")])
11684 (define_insn "*lshrdi3_2"
11685 [(set (match_operand:DI 0 "register_operand" "=r")
11686 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
11687 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11688 (clobber (reg:CC 17))]
11691 [(set_attr "type" "multi")])
11694 [(set (match_operand:DI 0 "register_operand" "")
11695 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
11696 (match_operand:QI 2 "nonmemory_operand" "")))
11697 (clobber (match_scratch:SI 3 ""))
11698 (clobber (reg:CC 17))]
11699 "!TARGET_64BIT && TARGET_CMOVE && reload_completed"
11701 "ix86_split_lshrdi (operands, operands[3]); DONE;")
11704 [(set (match_operand:DI 0 "register_operand" "")
11705 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
11706 (match_operand:QI 2 "nonmemory_operand" "")))
11707 (clobber (reg:CC 17))]
11708 "!TARGET_64BIT && reload_completed"
11710 "ix86_split_lshrdi (operands, NULL_RTX); DONE;")
11712 (define_expand "lshrsi3"
11713 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11714 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11715 (match_operand:QI 2 "nonmemory_operand" "")))
11716 (clobber (reg:CC 17))]
11718 "ix86_expand_binary_operator (LSHIFTRT, SImode, operands); DONE;")
11720 (define_insn "*lshrsi3_1_one_bit"
11721 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11722 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11723 (match_operand:QI 2 "const_int_1_operand" "")))
11724 (clobber (reg:CC 17))]
11725 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11726 && (TARGET_SHIFT1 || optimize_size)"
11728 [(set_attr "type" "ishift")
11729 (set (attr "length")
11730 (if_then_else (match_operand:SI 0 "register_operand" "")
11732 (const_string "*")))])
11734 (define_insn "*lshrsi3_1_one_bit_zext"
11735 [(set (match_operand:DI 0 "register_operand" "=r")
11736 (lshiftrt:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
11737 (match_operand:QI 2 "const_int_1_operand" "")))
11738 (clobber (reg:CC 17))]
11739 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11740 && (TARGET_SHIFT1 || optimize_size)"
11742 [(set_attr "type" "ishift")
11743 (set_attr "length" "2")])
11745 (define_insn "*lshrsi3_1"
11746 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11747 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11748 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11749 (clobber (reg:CC 17))]
11750 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11752 shr{l}\t{%2, %0|%0, %2}
11753 shr{l}\t{%b2, %0|%0, %b2}"
11754 [(set_attr "type" "ishift")
11755 (set_attr "mode" "SI")])
11757 (define_insn "*lshrsi3_1_zext"
11758 [(set (match_operand:DI 0 "register_operand" "=r,r")
11760 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11761 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11762 (clobber (reg:CC 17))]
11763 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11765 shr{l}\t{%2, %k0|%k0, %2}
11766 shr{l}\t{%b2, %k0|%k0, %b2}"
11767 [(set_attr "type" "ishift")
11768 (set_attr "mode" "SI")])
11770 ;; This pattern can't accept a variable shift count, since shifts by
11771 ;; zero don't affect the flags. We assume that shifts by constant
11772 ;; zero are optimized away.
11773 (define_insn "*lshrsi3_one_bit_cmp"
11776 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11777 (match_operand:QI 2 "const_int_1_operand" ""))
11779 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11780 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
11781 "ix86_match_ccmode (insn, CCGOCmode)
11782 && (TARGET_SHIFT1 || optimize_size)
11783 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11785 [(set_attr "type" "ishift")
11786 (set (attr "length")
11787 (if_then_else (match_operand:SI 0 "register_operand" "")
11789 (const_string "*")))])
11791 (define_insn "*lshrsi3_cmp_one_bit_zext"
11794 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
11795 (match_operand:QI 2 "const_int_1_operand" ""))
11797 (set (match_operand:DI 0 "register_operand" "=r")
11798 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
11799 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11800 && (TARGET_SHIFT1 || optimize_size)
11801 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11803 [(set_attr "type" "ishift")
11804 (set_attr "length" "2")])
11806 ;; This pattern can't accept a variable shift count, since shifts by
11807 ;; zero don't affect the flags. We assume that shifts by constant
11808 ;; zero are optimized away.
11809 (define_insn "*lshrsi3_cmp"
11812 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11813 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11815 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11816 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
11817 "ix86_match_ccmode (insn, CCGOCmode)
11818 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11819 "shr{l}\t{%2, %0|%0, %2}"
11820 [(set_attr "type" "ishift")
11821 (set_attr "mode" "SI")])
11823 (define_insn "*lshrsi3_cmp_zext"
11826 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
11827 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11829 (set (match_operand:DI 0 "register_operand" "=r")
11830 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
11831 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11832 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11833 "shr{l}\t{%2, %k0|%k0, %2}"
11834 [(set_attr "type" "ishift")
11835 (set_attr "mode" "SI")])
11837 (define_expand "lshrhi3"
11838 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11839 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
11840 (match_operand:QI 2 "nonmemory_operand" "")))
11841 (clobber (reg:CC 17))]
11842 "TARGET_HIMODE_MATH"
11843 "ix86_expand_binary_operator (LSHIFTRT, HImode, operands); DONE;")
11845 (define_insn "*lshrhi3_1_one_bit"
11846 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11847 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11848 (match_operand:QI 2 "const_int_1_operand" "")))
11849 (clobber (reg:CC 17))]
11850 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
11851 && (TARGET_SHIFT1 || optimize_size)"
11853 [(set_attr "type" "ishift")
11854 (set (attr "length")
11855 (if_then_else (match_operand 0 "register_operand" "")
11857 (const_string "*")))])
11859 (define_insn "*lshrhi3_1"
11860 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
11861 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
11862 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11863 (clobber (reg:CC 17))]
11864 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11866 shr{w}\t{%2, %0|%0, %2}
11867 shr{w}\t{%b2, %0|%0, %b2}"
11868 [(set_attr "type" "ishift")
11869 (set_attr "mode" "HI")])
11871 ;; This pattern can't accept a variable shift count, since shifts by
11872 ;; zero don't affect the flags. We assume that shifts by constant
11873 ;; zero are optimized away.
11874 (define_insn "*lshrhi3_one_bit_cmp"
11877 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11878 (match_operand:QI 2 "const_int_1_operand" ""))
11880 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11881 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
11882 "ix86_match_ccmode (insn, CCGOCmode)
11883 && (TARGET_SHIFT1 || optimize_size)
11884 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11886 [(set_attr "type" "ishift")
11887 (set (attr "length")
11888 (if_then_else (match_operand:SI 0 "register_operand" "")
11890 (const_string "*")))])
11892 ;; This pattern can't accept a variable shift count, since shifts by
11893 ;; zero don't affect the flags. We assume that shifts by constant
11894 ;; zero are optimized away.
11895 (define_insn "*lshrhi3_cmp"
11898 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11899 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11901 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11902 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
11903 "ix86_match_ccmode (insn, CCGOCmode)
11904 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
11905 "shr{w}\t{%2, %0|%0, %2}"
11906 [(set_attr "type" "ishift")
11907 (set_attr "mode" "HI")])
11909 (define_expand "lshrqi3"
11910 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11911 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
11912 (match_operand:QI 2 "nonmemory_operand" "")))
11913 (clobber (reg:CC 17))]
11914 "TARGET_QIMODE_MATH"
11915 "ix86_expand_binary_operator (LSHIFTRT, QImode, operands); DONE;")
11917 (define_insn "*lshrqi3_1_one_bit"
11918 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11919 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11920 (match_operand:QI 2 "const_int_1_operand" "")))
11921 (clobber (reg:CC 17))]
11922 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)
11923 && (TARGET_SHIFT1 || optimize_size)"
11925 [(set_attr "type" "ishift")
11926 (set (attr "length")
11927 (if_then_else (match_operand 0 "register_operand" "")
11929 (const_string "*")))])
11931 (define_insn "*lshrqi3_1_one_bit_slp"
11932 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
11933 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11934 (match_operand:QI 2 "const_int_1_operand" "")))
11935 (clobber (reg:CC 17))]
11936 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11937 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)
11938 && (TARGET_SHIFT1 || optimize_size)"
11940 [(set_attr "type" "ishift")
11941 (set (attr "length")
11942 (if_then_else (match_operand 0 "register_operand" "")
11944 (const_string "*")))])
11946 (define_insn "*lshrqi3_1"
11947 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
11948 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11949 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11950 (clobber (reg:CC 17))]
11951 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11953 shr{b}\t{%2, %0|%0, %2}
11954 shr{b}\t{%b2, %0|%0, %b2}"
11955 [(set_attr "type" "ishift")
11956 (set_attr "mode" "QI")])
11958 (define_insn "*lshrqi3_1_slp"
11959 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
11960 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11961 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11962 (clobber (reg:CC 17))]
11963 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
11964 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11966 shr{b}\t{%2, %0|%0, %2}
11967 shr{b}\t{%b2, %0|%0, %b2}"
11968 [(set_attr "type" "ishift")
11969 (set_attr "mode" "QI")])
11971 ;; This pattern can't accept a variable shift count, since shifts by
11972 ;; zero don't affect the flags. We assume that shifts by constant
11973 ;; zero are optimized away.
11974 (define_insn "*lshrqi2_one_bit_cmp"
11977 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11978 (match_operand:QI 2 "const_int_1_operand" ""))
11980 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11981 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
11982 "ix86_match_ccmode (insn, CCGOCmode)
11983 && (TARGET_SHIFT1 || optimize_size)
11984 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
11986 [(set_attr "type" "ishift")
11987 (set (attr "length")
11988 (if_then_else (match_operand:SI 0 "register_operand" "")
11990 (const_string "*")))])
11992 ;; This pattern can't accept a variable shift count, since shifts by
11993 ;; zero don't affect the flags. We assume that shifts by constant
11994 ;; zero are optimized away.
11995 (define_insn "*lshrqi2_cmp"
11998 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11999 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12001 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12002 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
12003 "ix86_match_ccmode (insn, CCGOCmode)
12004 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
12005 "shr{b}\t{%2, %0|%0, %2}"
12006 [(set_attr "type" "ishift")
12007 (set_attr "mode" "QI")])
12009 ;; Rotate instructions
12011 (define_expand "rotldi3"
12012 [(set (match_operand:DI 0 "nonimmediate_operand" "")
12013 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "")
12014 (match_operand:QI 2 "nonmemory_operand" "")))
12015 (clobber (reg:CC 17))]
12017 "ix86_expand_binary_operator (ROTATE, DImode, operands); DONE;")
12019 (define_insn "*rotlsi3_1_one_bit_rex64"
12020 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12021 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12022 (match_operand:QI 2 "const_int_1_operand" "")))
12023 (clobber (reg:CC 17))]
12024 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)
12025 && (TARGET_SHIFT1 || optimize_size)"
12027 [(set_attr "type" "rotate")
12028 (set (attr "length")
12029 (if_then_else (match_operand:DI 0 "register_operand" "")
12031 (const_string "*")))])
12033 (define_insn "*rotldi3_1_rex64"
12034 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
12035 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
12036 (match_operand:QI 2 "nonmemory_operand" "e,c")))
12037 (clobber (reg:CC 17))]
12038 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)"
12040 rol{q}\t{%2, %0|%0, %2}
12041 rol{q}\t{%b2, %0|%0, %b2}"
12042 [(set_attr "type" "rotate")
12043 (set_attr "mode" "DI")])
12045 (define_expand "rotlsi3"
12046 [(set (match_operand:SI 0 "nonimmediate_operand" "")
12047 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "")
12048 (match_operand:QI 2 "nonmemory_operand" "")))
12049 (clobber (reg:CC 17))]
12051 "ix86_expand_binary_operator (ROTATE, SImode, operands); DONE;")
12053 (define_insn "*rotlsi3_1_one_bit"
12054 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12055 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12056 (match_operand:QI 2 "const_int_1_operand" "")))
12057 (clobber (reg:CC 17))]
12058 "ix86_binary_operator_ok (ROTATE, SImode, operands)
12059 && (TARGET_SHIFT1 || optimize_size)"
12061 [(set_attr "type" "rotate")
12062 (set (attr "length")
12063 (if_then_else (match_operand:SI 0 "register_operand" "")
12065 (const_string "*")))])
12067 (define_insn "*rotlsi3_1_one_bit_zext"
12068 [(set (match_operand:DI 0 "register_operand" "=r")
12070 (rotate:SI (match_operand:SI 1 "register_operand" "0")
12071 (match_operand:QI 2 "const_int_1_operand" ""))))
12072 (clobber (reg:CC 17))]
12073 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)
12074 && (TARGET_SHIFT1 || optimize_size)"
12076 [(set_attr "type" "rotate")
12077 (set_attr "length" "2")])
12079 (define_insn "*rotlsi3_1"
12080 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12081 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12082 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12083 (clobber (reg:CC 17))]
12084 "ix86_binary_operator_ok (ROTATE, SImode, operands)"
12086 rol{l}\t{%2, %0|%0, %2}
12087 rol{l}\t{%b2, %0|%0, %b2}"
12088 [(set_attr "type" "rotate")
12089 (set_attr "mode" "SI")])
12091 (define_insn "*rotlsi3_1_zext"
12092 [(set (match_operand:DI 0 "register_operand" "=r,r")
12094 (rotate:SI (match_operand:SI 1 "register_operand" "0,0")
12095 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12096 (clobber (reg:CC 17))]
12097 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)"
12099 rol{l}\t{%2, %k0|%k0, %2}
12100 rol{l}\t{%b2, %k0|%k0, %b2}"
12101 [(set_attr "type" "rotate")
12102 (set_attr "mode" "SI")])
12104 (define_expand "rotlhi3"
12105 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12106 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "")
12107 (match_operand:QI 2 "nonmemory_operand" "")))
12108 (clobber (reg:CC 17))]
12109 "TARGET_HIMODE_MATH"
12110 "ix86_expand_binary_operator (ROTATE, HImode, operands); DONE;")
12112 (define_insn "*rotlhi3_1_one_bit"
12113 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12114 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12115 (match_operand:QI 2 "const_int_1_operand" "")))
12116 (clobber (reg:CC 17))]
12117 "ix86_binary_operator_ok (ROTATE, HImode, operands)
12118 && (TARGET_SHIFT1 || optimize_size)"
12120 [(set_attr "type" "rotate")
12121 (set (attr "length")
12122 (if_then_else (match_operand 0 "register_operand" "")
12124 (const_string "*")))])
12126 (define_insn "*rotlhi3_1"
12127 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12128 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12129 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12130 (clobber (reg:CC 17))]
12131 "ix86_binary_operator_ok (ROTATE, HImode, operands)"
12133 rol{w}\t{%2, %0|%0, %2}
12134 rol{w}\t{%b2, %0|%0, %b2}"
12135 [(set_attr "type" "rotate")
12136 (set_attr "mode" "HI")])
12138 (define_expand "rotlqi3"
12139 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12140 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "")
12141 (match_operand:QI 2 "nonmemory_operand" "")))
12142 (clobber (reg:CC 17))]
12143 "TARGET_QIMODE_MATH"
12144 "ix86_expand_binary_operator (ROTATE, QImode, operands); DONE;")
12146 (define_insn "*rotlqi3_1_one_bit_slp"
12147 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12148 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12149 (match_operand:QI 2 "const_int_1_operand" "")))
12150 (clobber (reg:CC 17))]
12151 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12152 && ix86_binary_operator_ok (ROTATE, QImode, operands)
12153 && (TARGET_SHIFT1 || optimize_size)"
12155 [(set_attr "type" "rotate")
12156 (set (attr "length")
12157 (if_then_else (match_operand 0 "register_operand" "")
12159 (const_string "*")))])
12161 (define_insn "*rotlqi3_1_one_bit"
12162 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12163 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12164 (match_operand:QI 2 "const_int_1_operand" "")))
12165 (clobber (reg:CC 17))]
12166 "ix86_binary_operator_ok (ROTATE, QImode, operands)
12167 && (TARGET_SHIFT1 || optimize_size)"
12169 [(set_attr "type" "rotate")
12170 (set (attr "length")
12171 (if_then_else (match_operand 0 "register_operand" "")
12173 (const_string "*")))])
12175 (define_insn "*rotlqi3_1_slp"
12176 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12177 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12178 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12179 (clobber (reg:CC 17))]
12180 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12181 && ix86_binary_operator_ok (ROTATE, QImode, operands)"
12183 rol{b}\t{%2, %0|%0, %2}
12184 rol{b}\t{%b2, %0|%0, %b2}"
12185 [(set_attr "type" "rotate")
12186 (set_attr "mode" "QI")])
12188 (define_insn "*rotlqi3_1"
12189 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12190 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12191 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12192 (clobber (reg:CC 17))]
12193 "ix86_binary_operator_ok (ROTATE, QImode, operands)"
12195 rol{b}\t{%2, %0|%0, %2}
12196 rol{b}\t{%b2, %0|%0, %b2}"
12197 [(set_attr "type" "rotate")
12198 (set_attr "mode" "QI")])
12200 (define_expand "rotrdi3"
12201 [(set (match_operand:DI 0 "nonimmediate_operand" "")
12202 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "")
12203 (match_operand:QI 2 "nonmemory_operand" "")))
12204 (clobber (reg:CC 17))]
12206 "ix86_expand_binary_operator (ROTATERT, DImode, operands); DONE;")
12208 (define_insn "*rotrdi3_1_one_bit_rex64"
12209 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12210 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12211 (match_operand:QI 2 "const_int_1_operand" "")))
12212 (clobber (reg:CC 17))]
12213 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)
12214 && (TARGET_SHIFT1 || optimize_size)"
12216 [(set_attr "type" "rotate")
12217 (set (attr "length")
12218 (if_then_else (match_operand:DI 0 "register_operand" "")
12220 (const_string "*")))])
12222 (define_insn "*rotrdi3_1_rex64"
12223 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
12224 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
12225 (match_operand:QI 2 "nonmemory_operand" "J,c")))
12226 (clobber (reg:CC 17))]
12227 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)"
12229 ror{q}\t{%2, %0|%0, %2}
12230 ror{q}\t{%b2, %0|%0, %b2}"
12231 [(set_attr "type" "rotate")
12232 (set_attr "mode" "DI")])
12234 (define_expand "rotrsi3"
12235 [(set (match_operand:SI 0 "nonimmediate_operand" "")
12236 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "")
12237 (match_operand:QI 2 "nonmemory_operand" "")))
12238 (clobber (reg:CC 17))]
12240 "ix86_expand_binary_operator (ROTATERT, SImode, operands); DONE;")
12242 (define_insn "*rotrsi3_1_one_bit"
12243 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12244 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12245 (match_operand:QI 2 "const_int_1_operand" "")))
12246 (clobber (reg:CC 17))]
12247 "ix86_binary_operator_ok (ROTATERT, SImode, operands)
12248 && (TARGET_SHIFT1 || optimize_size)"
12250 [(set_attr "type" "rotate")
12251 (set (attr "length")
12252 (if_then_else (match_operand:SI 0 "register_operand" "")
12254 (const_string "*")))])
12256 (define_insn "*rotrsi3_1_one_bit_zext"
12257 [(set (match_operand:DI 0 "register_operand" "=r")
12259 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
12260 (match_operand:QI 2 "const_int_1_operand" ""))))
12261 (clobber (reg:CC 17))]
12262 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)
12263 && (TARGET_SHIFT1 || optimize_size)"
12265 [(set_attr "type" "rotate")
12266 (set (attr "length")
12267 (if_then_else (match_operand:SI 0 "register_operand" "")
12269 (const_string "*")))])
12271 (define_insn "*rotrsi3_1"
12272 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12273 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12274 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12275 (clobber (reg:CC 17))]
12276 "ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12278 ror{l}\t{%2, %0|%0, %2}
12279 ror{l}\t{%b2, %0|%0, %b2}"
12280 [(set_attr "type" "rotate")
12281 (set_attr "mode" "SI")])
12283 (define_insn "*rotrsi3_1_zext"
12284 [(set (match_operand:DI 0 "register_operand" "=r,r")
12286 (rotatert:SI (match_operand:SI 1 "register_operand" "0,0")
12287 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12288 (clobber (reg:CC 17))]
12289 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12291 ror{l}\t{%2, %k0|%k0, %2}
12292 ror{l}\t{%b2, %k0|%k0, %b2}"
12293 [(set_attr "type" "rotate")
12294 (set_attr "mode" "SI")])
12296 (define_expand "rotrhi3"
12297 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12298 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "")
12299 (match_operand:QI 2 "nonmemory_operand" "")))
12300 (clobber (reg:CC 17))]
12301 "TARGET_HIMODE_MATH"
12302 "ix86_expand_binary_operator (ROTATERT, HImode, operands); DONE;")
12304 (define_insn "*rotrhi3_one_bit"
12305 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12306 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12307 (match_operand:QI 2 "const_int_1_operand" "")))
12308 (clobber (reg:CC 17))]
12309 "ix86_binary_operator_ok (ROTATERT, HImode, operands)
12310 && (TARGET_SHIFT1 || optimize_size)"
12312 [(set_attr "type" "rotate")
12313 (set (attr "length")
12314 (if_then_else (match_operand 0 "register_operand" "")
12316 (const_string "*")))])
12318 (define_insn "*rotrhi3"
12319 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12320 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12321 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12322 (clobber (reg:CC 17))]
12323 "ix86_binary_operator_ok (ROTATERT, HImode, operands)"
12325 ror{w}\t{%2, %0|%0, %2}
12326 ror{w}\t{%b2, %0|%0, %b2}"
12327 [(set_attr "type" "rotate")
12328 (set_attr "mode" "HI")])
12330 (define_expand "rotrqi3"
12331 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12332 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "")
12333 (match_operand:QI 2 "nonmemory_operand" "")))
12334 (clobber (reg:CC 17))]
12335 "TARGET_QIMODE_MATH"
12336 "ix86_expand_binary_operator (ROTATERT, QImode, operands); DONE;")
12338 (define_insn "*rotrqi3_1_one_bit"
12339 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12340 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12341 (match_operand:QI 2 "const_int_1_operand" "")))
12342 (clobber (reg:CC 17))]
12343 "ix86_binary_operator_ok (ROTATERT, QImode, operands)
12344 && (TARGET_SHIFT1 || optimize_size)"
12346 [(set_attr "type" "rotate")
12347 (set (attr "length")
12348 (if_then_else (match_operand 0 "register_operand" "")
12350 (const_string "*")))])
12352 (define_insn "*rotrqi3_1_one_bit_slp"
12353 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12354 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12355 (match_operand:QI 2 "const_int_1_operand" "")))
12356 (clobber (reg:CC 17))]
12357 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12358 && ix86_binary_operator_ok (ROTATERT, QImode, operands)
12359 && (TARGET_SHIFT1 || optimize_size)"
12361 [(set_attr "type" "rotate")
12362 (set (attr "length")
12363 (if_then_else (match_operand 0 "register_operand" "")
12365 (const_string "*")))])
12367 (define_insn "*rotrqi3_1"
12368 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12369 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12370 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12371 (clobber (reg:CC 17))]
12372 "ix86_binary_operator_ok (ROTATERT, QImode, operands)"
12374 ror{b}\t{%2, %0|%0, %2}
12375 ror{b}\t{%b2, %0|%0, %b2}"
12376 [(set_attr "type" "rotate")
12377 (set_attr "mode" "QI")])
12379 (define_insn "*rotrqi3_1_slp"
12380 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12381 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12382 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12383 (clobber (reg:CC 17))]
12384 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12385 && ix86_binary_operator_ok (ROTATERT, QImode, operands)"
12387 ror{b}\t{%2, %0|%0, %2}
12388 ror{b}\t{%b2, %0|%0, %b2}"
12389 [(set_attr "type" "rotate")
12390 (set_attr "mode" "QI")])
12392 ;; Bit set / bit test instructions
12394 (define_expand "extv"
12395 [(set (match_operand:SI 0 "register_operand" "")
12396 (sign_extract:SI (match_operand:SI 1 "register_operand" "")
12397 (match_operand:SI 2 "immediate_operand" "")
12398 (match_operand:SI 3 "immediate_operand" "")))]
12401 /* Handle extractions from %ah et al. */
12402 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
12405 /* From mips.md: extract_bit_field doesn't verify that our source
12406 matches the predicate, so check it again here. */
12407 if (! register_operand (operands[1], VOIDmode))
12411 (define_expand "extzv"
12412 [(set (match_operand:SI 0 "register_operand" "")
12413 (zero_extract:SI (match_operand 1 "ext_register_operand" "")
12414 (match_operand:SI 2 "immediate_operand" "")
12415 (match_operand:SI 3 "immediate_operand" "")))]
12418 /* Handle extractions from %ah et al. */
12419 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
12422 /* From mips.md: extract_bit_field doesn't verify that our source
12423 matches the predicate, so check it again here. */
12424 if (! register_operand (operands[1], VOIDmode))
12428 (define_expand "insv"
12429 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "")
12430 (match_operand:SI 1 "immediate_operand" "")
12431 (match_operand:SI 2 "immediate_operand" ""))
12432 (match_operand:SI 3 "register_operand" ""))]
12435 /* Handle extractions from %ah et al. */
12436 if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) != 8)
12439 /* From mips.md: insert_bit_field doesn't verify that our source
12440 matches the predicate, so check it again here. */
12441 if (! register_operand (operands[0], VOIDmode))
12445 ;; %%% bts, btr, btc, bt.
12447 ;; Store-flag instructions.
12449 ;; For all sCOND expanders, also expand the compare or test insn that
12450 ;; generates cc0. Generate an equality comparison if `seq' or `sne'.
12452 ;; %%% Do the expansion to SImode. If PII, do things the xor+setcc way
12453 ;; to avoid partial register stalls. Otherwise do things the setcc+movzx
12454 ;; way, which can later delete the movzx if only QImode is needed.
12456 (define_expand "seq"
12457 [(set (match_operand:QI 0 "register_operand" "")
12458 (eq:QI (reg:CC 17) (const_int 0)))]
12460 "if (ix86_expand_setcc (EQ, operands[0])) DONE; else FAIL;")
12462 (define_expand "sne"
12463 [(set (match_operand:QI 0 "register_operand" "")
12464 (ne:QI (reg:CC 17) (const_int 0)))]
12466 "if (ix86_expand_setcc (NE, operands[0])) DONE; else FAIL;")
12468 (define_expand "sgt"
12469 [(set (match_operand:QI 0 "register_operand" "")
12470 (gt:QI (reg:CC 17) (const_int 0)))]
12472 "if (ix86_expand_setcc (GT, operands[0])) DONE; else FAIL;")
12474 (define_expand "sgtu"
12475 [(set (match_operand:QI 0 "register_operand" "")
12476 (gtu:QI (reg:CC 17) (const_int 0)))]
12478 "if (ix86_expand_setcc (GTU, operands[0])) DONE; else FAIL;")
12480 (define_expand "slt"
12481 [(set (match_operand:QI 0 "register_operand" "")
12482 (lt:QI (reg:CC 17) (const_int 0)))]
12484 "if (ix86_expand_setcc (LT, operands[0])) DONE; else FAIL;")
12486 (define_expand "sltu"
12487 [(set (match_operand:QI 0 "register_operand" "")
12488 (ltu:QI (reg:CC 17) (const_int 0)))]
12490 "if (ix86_expand_setcc (LTU, operands[0])) DONE; else FAIL;")
12492 (define_expand "sge"
12493 [(set (match_operand:QI 0 "register_operand" "")
12494 (ge:QI (reg:CC 17) (const_int 0)))]
12496 "if (ix86_expand_setcc (GE, operands[0])) DONE; else FAIL;")
12498 (define_expand "sgeu"
12499 [(set (match_operand:QI 0 "register_operand" "")
12500 (geu:QI (reg:CC 17) (const_int 0)))]
12502 "if (ix86_expand_setcc (GEU, operands[0])) DONE; else FAIL;")
12504 (define_expand "sle"
12505 [(set (match_operand:QI 0 "register_operand" "")
12506 (le:QI (reg:CC 17) (const_int 0)))]
12508 "if (ix86_expand_setcc (LE, operands[0])) DONE; else FAIL;")
12510 (define_expand "sleu"
12511 [(set (match_operand:QI 0 "register_operand" "")
12512 (leu:QI (reg:CC 17) (const_int 0)))]
12514 "if (ix86_expand_setcc (LEU, operands[0])) DONE; else FAIL;")
12516 (define_expand "sunordered"
12517 [(set (match_operand:QI 0 "register_operand" "")
12518 (unordered:QI (reg:CC 17) (const_int 0)))]
12519 "TARGET_80387 || TARGET_SSE"
12520 "if (ix86_expand_setcc (UNORDERED, operands[0])) DONE; else FAIL;")
12522 (define_expand "sordered"
12523 [(set (match_operand:QI 0 "register_operand" "")
12524 (ordered:QI (reg:CC 17) (const_int 0)))]
12526 "if (ix86_expand_setcc (ORDERED, operands[0])) DONE; else FAIL;")
12528 (define_expand "suneq"
12529 [(set (match_operand:QI 0 "register_operand" "")
12530 (uneq:QI (reg:CC 17) (const_int 0)))]
12531 "TARGET_80387 || TARGET_SSE"
12532 "if (ix86_expand_setcc (UNEQ, operands[0])) DONE; else FAIL;")
12534 (define_expand "sunge"
12535 [(set (match_operand:QI 0 "register_operand" "")
12536 (unge:QI (reg:CC 17) (const_int 0)))]
12537 "TARGET_80387 || TARGET_SSE"
12538 "if (ix86_expand_setcc (UNGE, operands[0])) DONE; else FAIL;")
12540 (define_expand "sungt"
12541 [(set (match_operand:QI 0 "register_operand" "")
12542 (ungt:QI (reg:CC 17) (const_int 0)))]
12543 "TARGET_80387 || TARGET_SSE"
12544 "if (ix86_expand_setcc (UNGT, operands[0])) DONE; else FAIL;")
12546 (define_expand "sunle"
12547 [(set (match_operand:QI 0 "register_operand" "")
12548 (unle:QI (reg:CC 17) (const_int 0)))]
12549 "TARGET_80387 || TARGET_SSE"
12550 "if (ix86_expand_setcc (UNLE, operands[0])) DONE; else FAIL;")
12552 (define_expand "sunlt"
12553 [(set (match_operand:QI 0 "register_operand" "")
12554 (unlt:QI (reg:CC 17) (const_int 0)))]
12555 "TARGET_80387 || TARGET_SSE"
12556 "if (ix86_expand_setcc (UNLT, operands[0])) DONE; else FAIL;")
12558 (define_expand "sltgt"
12559 [(set (match_operand:QI 0 "register_operand" "")
12560 (ltgt:QI (reg:CC 17) (const_int 0)))]
12561 "TARGET_80387 || TARGET_SSE"
12562 "if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")
12564 (define_insn "*setcc_1"
12565 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12566 (match_operator:QI 1 "ix86_comparison_operator"
12567 [(reg 17) (const_int 0)]))]
12570 [(set_attr "type" "setcc")
12571 (set_attr "mode" "QI")])
12573 (define_insn "setcc_2"
12574 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12575 (match_operator:QI 1 "ix86_comparison_operator"
12576 [(reg 17) (const_int 0)]))]
12579 [(set_attr "type" "setcc")
12580 (set_attr "mode" "QI")])
12582 ;; In general it is not safe to assume too much about CCmode registers,
12583 ;; so simplify-rtx stops when it sees a second one. Under certain
12584 ;; conditions this is safe on x86, so help combine not create
12591 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12592 (ne:QI (match_operator 1 "ix86_comparison_operator"
12593 [(reg 17) (const_int 0)])
12596 [(set (match_dup 0) (match_dup 1))]
12598 PUT_MODE (operands[1], QImode);
12602 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
12603 (ne:QI (match_operator 1 "ix86_comparison_operator"
12604 [(reg 17) (const_int 0)])
12607 [(set (match_dup 0) (match_dup 1))]
12609 PUT_MODE (operands[1], QImode);
12613 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12614 (eq:QI (match_operator 1 "ix86_comparison_operator"
12615 [(reg 17) (const_int 0)])
12618 [(set (match_dup 0) (match_dup 1))]
12620 rtx new_op1 = copy_rtx (operands[1]);
12621 operands[1] = new_op1;
12622 PUT_MODE (new_op1, QImode);
12623 PUT_CODE (new_op1, REVERSE_CONDITION (GET_CODE (new_op1),
12624 GET_MODE (XEXP (new_op1, 0))));
12626 /* Make sure that (a) the CCmode we have for the flags is strong
12627 enough for the reversed compare or (b) we have a valid FP compare. */
12628 if (! ix86_comparison_operator (new_op1, VOIDmode))
12633 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
12634 (eq:QI (match_operator 1 "ix86_comparison_operator"
12635 [(reg 17) (const_int 0)])
12638 [(set (match_dup 0) (match_dup 1))]
12640 rtx new_op1 = copy_rtx (operands[1]);
12641 operands[1] = new_op1;
12642 PUT_MODE (new_op1, QImode);
12643 PUT_CODE (new_op1, REVERSE_CONDITION (GET_CODE (new_op1),
12644 GET_MODE (XEXP (new_op1, 0))));
12646 /* Make sure that (a) the CCmode we have for the flags is strong
12647 enough for the reversed compare or (b) we have a valid FP compare. */
12648 if (! ix86_comparison_operator (new_op1, VOIDmode))
12652 ;; The SSE store flag instructions saves 0 or 0xffffffff to the result.
12653 ;; subsequent logical operations are used to imitate conditional moves.
12654 ;; 0xffffffff is NaN, but not in normalized form, so we can't represent
12655 ;; it directly. Futher holding this value in pseudo register might bring
12656 ;; problem in implicit normalization in spill code.
12657 ;; So we don't define FLOAT_STORE_FLAG_VALUE and create these
12658 ;; instructions after reload by splitting the conditional move patterns.
12660 (define_insn "*sse_setccsf"
12661 [(set (match_operand:SF 0 "register_operand" "=x")
12662 (match_operator:SF 1 "sse_comparison_operator"
12663 [(match_operand:SF 2 "register_operand" "0")
12664 (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
12665 "TARGET_SSE && reload_completed"
12666 "cmp%D1ss\t{%3, %0|%0, %3}"
12667 [(set_attr "type" "ssecmp")
12668 (set_attr "mode" "SF")])
12670 (define_insn "*sse_setccdf"
12671 [(set (match_operand:DF 0 "register_operand" "=Y")
12672 (match_operator:DF 1 "sse_comparison_operator"
12673 [(match_operand:DF 2 "register_operand" "0")
12674 (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
12675 "TARGET_SSE2 && reload_completed"
12676 "cmp%D1sd\t{%3, %0|%0, %3}"
12677 [(set_attr "type" "ssecmp")
12678 (set_attr "mode" "DF")])
12680 ;; Basic conditional jump instructions.
12681 ;; We ignore the overflow flag for signed branch instructions.
12683 ;; For all bCOND expanders, also expand the compare or test insn that
12684 ;; generates reg 17. Generate an equality comparison if `beq' or `bne'.
12686 (define_expand "beq"
12688 (if_then_else (match_dup 1)
12689 (label_ref (match_operand 0 "" ""))
12692 "ix86_expand_branch (EQ, operands[0]); DONE;")
12694 (define_expand "bne"
12696 (if_then_else (match_dup 1)
12697 (label_ref (match_operand 0 "" ""))
12700 "ix86_expand_branch (NE, operands[0]); DONE;")
12702 (define_expand "bgt"
12704 (if_then_else (match_dup 1)
12705 (label_ref (match_operand 0 "" ""))
12708 "ix86_expand_branch (GT, operands[0]); DONE;")
12710 (define_expand "bgtu"
12712 (if_then_else (match_dup 1)
12713 (label_ref (match_operand 0 "" ""))
12716 "ix86_expand_branch (GTU, operands[0]); DONE;")
12718 (define_expand "blt"
12720 (if_then_else (match_dup 1)
12721 (label_ref (match_operand 0 "" ""))
12724 "ix86_expand_branch (LT, operands[0]); DONE;")
12726 (define_expand "bltu"
12728 (if_then_else (match_dup 1)
12729 (label_ref (match_operand 0 "" ""))
12732 "ix86_expand_branch (LTU, operands[0]); DONE;")
12734 (define_expand "bge"
12736 (if_then_else (match_dup 1)
12737 (label_ref (match_operand 0 "" ""))
12740 "ix86_expand_branch (GE, operands[0]); DONE;")
12742 (define_expand "bgeu"
12744 (if_then_else (match_dup 1)
12745 (label_ref (match_operand 0 "" ""))
12748 "ix86_expand_branch (GEU, operands[0]); DONE;")
12750 (define_expand "ble"
12752 (if_then_else (match_dup 1)
12753 (label_ref (match_operand 0 "" ""))
12756 "ix86_expand_branch (LE, operands[0]); DONE;")
12758 (define_expand "bleu"
12760 (if_then_else (match_dup 1)
12761 (label_ref (match_operand 0 "" ""))
12764 "ix86_expand_branch (LEU, operands[0]); DONE;")
12766 (define_expand "bunordered"
12768 (if_then_else (match_dup 1)
12769 (label_ref (match_operand 0 "" ""))
12771 "TARGET_80387 || TARGET_SSE"
12772 "ix86_expand_branch (UNORDERED, operands[0]); DONE;")
12774 (define_expand "bordered"
12776 (if_then_else (match_dup 1)
12777 (label_ref (match_operand 0 "" ""))
12779 "TARGET_80387 || TARGET_SSE"
12780 "ix86_expand_branch (ORDERED, operands[0]); DONE;")
12782 (define_expand "buneq"
12784 (if_then_else (match_dup 1)
12785 (label_ref (match_operand 0 "" ""))
12787 "TARGET_80387 || TARGET_SSE"
12788 "ix86_expand_branch (UNEQ, operands[0]); DONE;")
12790 (define_expand "bunge"
12792 (if_then_else (match_dup 1)
12793 (label_ref (match_operand 0 "" ""))
12795 "TARGET_80387 || TARGET_SSE"
12796 "ix86_expand_branch (UNGE, operands[0]); DONE;")
12798 (define_expand "bungt"
12800 (if_then_else (match_dup 1)
12801 (label_ref (match_operand 0 "" ""))
12803 "TARGET_80387 || TARGET_SSE"
12804 "ix86_expand_branch (UNGT, operands[0]); DONE;")
12806 (define_expand "bunle"
12808 (if_then_else (match_dup 1)
12809 (label_ref (match_operand 0 "" ""))
12811 "TARGET_80387 || TARGET_SSE"
12812 "ix86_expand_branch (UNLE, operands[0]); DONE;")
12814 (define_expand "bunlt"
12816 (if_then_else (match_dup 1)
12817 (label_ref (match_operand 0 "" ""))
12819 "TARGET_80387 || TARGET_SSE"
12820 "ix86_expand_branch (UNLT, operands[0]); DONE;")
12822 (define_expand "bltgt"
12824 (if_then_else (match_dup 1)
12825 (label_ref (match_operand 0 "" ""))
12827 "TARGET_80387 || TARGET_SSE"
12828 "ix86_expand_branch (LTGT, operands[0]); DONE;")
12830 (define_insn "*jcc_1"
12832 (if_then_else (match_operator 1 "ix86_comparison_operator"
12833 [(reg 17) (const_int 0)])
12834 (label_ref (match_operand 0 "" ""))
12838 [(set_attr "type" "ibr")
12839 (set_attr "modrm" "0")
12840 (set (attr "prefix_0f")
12841 (if_then_else (and (ge (minus (match_dup 0) (pc))
12843 (lt (minus (match_dup 0) (pc))
12848 (define_insn "*jcc_2"
12850 (if_then_else (match_operator 1 "ix86_comparison_operator"
12851 [(reg 17) (const_int 0)])
12853 (label_ref (match_operand 0 "" ""))))]
12856 [(set_attr "type" "ibr")
12857 (set_attr "modrm" "0")
12858 (set (attr "prefix_0f")
12859 (if_then_else (and (ge (minus (match_dup 0) (pc))
12861 (lt (minus (match_dup 0) (pc))
12866 ;; In general it is not safe to assume too much about CCmode registers,
12867 ;; so simplify-rtx stops when it sees a second one. Under certain
12868 ;; conditions this is safe on x86, so help combine not create
12876 (if_then_else (ne (match_operator 0 "ix86_comparison_operator"
12877 [(reg 17) (const_int 0)])
12879 (label_ref (match_operand 1 "" ""))
12883 (if_then_else (match_dup 0)
12884 (label_ref (match_dup 1))
12887 PUT_MODE (operands[0], VOIDmode);
12892 (if_then_else (eq (match_operator 0 "ix86_comparison_operator"
12893 [(reg 17) (const_int 0)])
12895 (label_ref (match_operand 1 "" ""))
12899 (if_then_else (match_dup 0)
12900 (label_ref (match_dup 1))
12903 rtx new_op0 = copy_rtx (operands[0]);
12904 operands[0] = new_op0;
12905 PUT_MODE (new_op0, VOIDmode);
12906 PUT_CODE (new_op0, REVERSE_CONDITION (GET_CODE (new_op0),
12907 GET_MODE (XEXP (new_op0, 0))));
12909 /* Make sure that (a) the CCmode we have for the flags is strong
12910 enough for the reversed compare or (b) we have a valid FP compare. */
12911 if (! ix86_comparison_operator (new_op0, VOIDmode))
12915 ;; Define combination compare-and-branch fp compare instructions to use
12916 ;; during early optimization. Splitting the operation apart early makes
12917 ;; for bad code when we want to reverse the operation.
12919 (define_insn "*fp_jcc_1"
12921 (if_then_else (match_operator 0 "comparison_operator"
12922 [(match_operand 1 "register_operand" "f")
12923 (match_operand 2 "register_operand" "f")])
12924 (label_ref (match_operand 3 "" ""))
12926 (clobber (reg:CCFP 18))
12927 (clobber (reg:CCFP 17))]
12928 "TARGET_CMOVE && TARGET_80387
12929 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12930 && FLOAT_MODE_P (GET_MODE (operands[1]))
12931 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12932 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12935 (define_insn "*fp_jcc_1_sse"
12937 (if_then_else (match_operator 0 "comparison_operator"
12938 [(match_operand 1 "register_operand" "f#x,x#f")
12939 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
12940 (label_ref (match_operand 3 "" ""))
12942 (clobber (reg:CCFP 18))
12943 (clobber (reg:CCFP 17))]
12945 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12946 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12947 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12950 (define_insn "*fp_jcc_1_sse_only"
12952 (if_then_else (match_operator 0 "comparison_operator"
12953 [(match_operand 1 "register_operand" "x")
12954 (match_operand 2 "nonimmediate_operand" "xm")])
12955 (label_ref (match_operand 3 "" ""))
12957 (clobber (reg:CCFP 18))
12958 (clobber (reg:CCFP 17))]
12959 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12960 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12961 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12964 (define_insn "*fp_jcc_2"
12966 (if_then_else (match_operator 0 "comparison_operator"
12967 [(match_operand 1 "register_operand" "f")
12968 (match_operand 2 "register_operand" "f")])
12970 (label_ref (match_operand 3 "" ""))))
12971 (clobber (reg:CCFP 18))
12972 (clobber (reg:CCFP 17))]
12973 "TARGET_CMOVE && TARGET_80387
12974 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12975 && FLOAT_MODE_P (GET_MODE (operands[1]))
12976 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12977 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12980 (define_insn "*fp_jcc_2_sse"
12982 (if_then_else (match_operator 0 "comparison_operator"
12983 [(match_operand 1 "register_operand" "f#x,x#f")
12984 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
12986 (label_ref (match_operand 3 "" ""))))
12987 (clobber (reg:CCFP 18))
12988 (clobber (reg:CCFP 17))]
12990 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
12991 && GET_MODE (operands[1]) == GET_MODE (operands[2])
12992 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
12995 (define_insn "*fp_jcc_2_sse_only"
12997 (if_then_else (match_operator 0 "comparison_operator"
12998 [(match_operand 1 "register_operand" "x")
12999 (match_operand 2 "nonimmediate_operand" "xm")])
13001 (label_ref (match_operand 3 "" ""))))
13002 (clobber (reg:CCFP 18))
13003 (clobber (reg:CCFP 17))]
13004 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13005 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13006 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13009 (define_insn "*fp_jcc_3"
13011 (if_then_else (match_operator 0 "comparison_operator"
13012 [(match_operand 1 "register_operand" "f")
13013 (match_operand 2 "nonimmediate_operand" "fm")])
13014 (label_ref (match_operand 3 "" ""))
13016 (clobber (reg:CCFP 18))
13017 (clobber (reg:CCFP 17))
13018 (clobber (match_scratch:HI 4 "=a"))]
13020 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
13021 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13022 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
13023 && SELECT_CC_MODE (GET_CODE (operands[0]),
13024 operands[1], operands[2]) == CCFPmode
13025 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13028 (define_insn "*fp_jcc_4"
13030 (if_then_else (match_operator 0 "comparison_operator"
13031 [(match_operand 1 "register_operand" "f")
13032 (match_operand 2 "nonimmediate_operand" "fm")])
13034 (label_ref (match_operand 3 "" ""))))
13035 (clobber (reg:CCFP 18))
13036 (clobber (reg:CCFP 17))
13037 (clobber (match_scratch:HI 4 "=a"))]
13039 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
13040 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13041 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
13042 && SELECT_CC_MODE (GET_CODE (operands[0]),
13043 operands[1], operands[2]) == CCFPmode
13044 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13047 (define_insn "*fp_jcc_5"
13049 (if_then_else (match_operator 0 "comparison_operator"
13050 [(match_operand 1 "register_operand" "f")
13051 (match_operand 2 "register_operand" "f")])
13052 (label_ref (match_operand 3 "" ""))
13054 (clobber (reg:CCFP 18))
13055 (clobber (reg:CCFP 17))
13056 (clobber (match_scratch:HI 4 "=a"))]
13058 && FLOAT_MODE_P (GET_MODE (operands[1]))
13059 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13060 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13063 (define_insn "*fp_jcc_6"
13065 (if_then_else (match_operator 0 "comparison_operator"
13066 [(match_operand 1 "register_operand" "f")
13067 (match_operand 2 "register_operand" "f")])
13069 (label_ref (match_operand 3 "" ""))))
13070 (clobber (reg:CCFP 18))
13071 (clobber (reg:CCFP 17))
13072 (clobber (match_scratch:HI 4 "=a"))]
13074 && FLOAT_MODE_P (GET_MODE (operands[1]))
13075 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13076 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13081 (if_then_else (match_operator 0 "comparison_operator"
13082 [(match_operand 1 "register_operand" "")
13083 (match_operand 2 "nonimmediate_operand" "")])
13084 (match_operand 3 "" "")
13085 (match_operand 4 "" "")))
13086 (clobber (reg:CCFP 18))
13087 (clobber (reg:CCFP 17))]
13091 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13092 operands[3], operands[4], NULL_RTX);
13098 (if_then_else (match_operator 0 "comparison_operator"
13099 [(match_operand 1 "register_operand" "")
13100 (match_operand 2 "nonimmediate_operand" "")])
13101 (match_operand 3 "" "")
13102 (match_operand 4 "" "")))
13103 (clobber (reg:CCFP 18))
13104 (clobber (reg:CCFP 17))
13105 (clobber (match_scratch:HI 5 "=a"))]
13108 (if_then_else (match_dup 6)
13112 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13113 operands[3], operands[4], operands[5]);
13117 ;; Unconditional and other jump instructions
13119 (define_insn "jump"
13121 (label_ref (match_operand 0 "" "")))]
13124 [(set_attr "type" "ibr")
13125 (set_attr "modrm" "0")])
13127 (define_expand "indirect_jump"
13128 [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))]
13132 (define_insn "*indirect_jump"
13133 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
13136 [(set_attr "type" "ibr")
13137 (set_attr "length_immediate" "0")])
13139 (define_insn "*indirect_jump_rtx64"
13140 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))]
13143 [(set_attr "type" "ibr")
13144 (set_attr "length_immediate" "0")])
13146 (define_expand "tablejump"
13147 [(parallel [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))
13148 (use (label_ref (match_operand 1 "" "")))])]
13151 /* In PIC mode, the table entries are stored GOT (32-bit) or PC (64-bit)
13152 relative. Convert the relative address to an absolute address. */
13156 enum rtx_code code;
13162 op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
13164 else if (TARGET_MACHO || HAVE_AS_GOTOFF_IN_DATA)
13168 op1 = pic_offset_table_rtx;
13173 op0 = pic_offset_table_rtx;
13177 operands[0] = expand_simple_binop (Pmode, code, op0, op1, NULL_RTX, 0,
13182 (define_insn "*tablejump_1"
13183 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))
13184 (use (label_ref (match_operand 1 "" "")))]
13187 [(set_attr "type" "ibr")
13188 (set_attr "length_immediate" "0")])
13190 (define_insn "*tablejump_1_rtx64"
13191 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))
13192 (use (label_ref (match_operand 1 "" "")))]
13195 [(set_attr "type" "ibr")
13196 (set_attr "length_immediate" "0")])
13198 ;; Loop instruction
13200 ;; This is all complicated by the fact that since this is a jump insn
13201 ;; we must handle our own reloads.
13203 (define_expand "doloop_end"
13204 [(use (match_operand 0 "" "")) ; loop pseudo
13205 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13206 (use (match_operand 2 "" "")) ; max iterations
13207 (use (match_operand 3 "" "")) ; loop level
13208 (use (match_operand 4 "" ""))] ; label
13209 "!TARGET_64BIT && TARGET_USE_LOOP"
13212 /* Only use cloop on innermost loops. */
13213 if (INTVAL (operands[3]) > 1)
13215 if (GET_MODE (operands[0]) != SImode)
13217 emit_jump_insn (gen_doloop_end_internal (operands[4], operands[0],
13222 (define_insn "doloop_end_internal"
13224 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,?*r,?*r")
13226 (label_ref (match_operand 0 "" ""))
13228 (set (match_operand:SI 2 "register_operand" "=1,1,*m*r")
13229 (plus:SI (match_dup 1)
13231 (clobber (match_scratch:SI 3 "=X,X,r"))
13232 (clobber (reg:CC 17))]
13233 "!TARGET_64BIT && TARGET_USE_LOOP"
13235 if (which_alternative != 0)
13237 if (get_attr_length (insn) == 2)
13238 return "%+loop\t%l0";
13240 return "dec{l}\t%1\;%+jne\t%l0";
13242 [(set_attr "ppro_uops" "many")
13243 (set (attr "length")
13244 (if_then_else (and (eq_attr "alternative" "0")
13245 (and (ge (minus (match_dup 0) (pc))
13247 (lt (minus (match_dup 0) (pc))
13252 (if_then_else (and (eq_attr "alternative" "0")
13253 (and (ge (minus (match_dup 0) (pc))
13255 (lt (minus (match_dup 0) (pc))
13257 (const_string "ibr")
13258 (const_string "multi")))])
13262 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13264 (match_operand 0 "" "")
13267 (plus:SI (match_dup 1)
13269 (clobber (match_scratch:SI 2 ""))
13270 (clobber (reg:CC 17))]
13271 "!TARGET_64BIT && TARGET_USE_LOOP
13272 && reload_completed
13273 && REGNO (operands[1]) != 2"
13274 [(parallel [(set (reg:CCZ 17)
13275 (compare:CCZ (plus:SI (match_dup 1) (const_int -1))
13277 (set (match_dup 1) (plus:SI (match_dup 1) (const_int -1)))])
13278 (set (pc) (if_then_else (ne (reg:CCZ 17) (const_int 0))
13285 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13287 (match_operand 0 "" "")
13289 (set (match_operand:SI 2 "nonimmediate_operand" "")
13290 (plus:SI (match_dup 1)
13292 (clobber (match_scratch:SI 3 ""))
13293 (clobber (reg:CC 17))]
13294 "!TARGET_64BIT && TARGET_USE_LOOP
13295 && reload_completed
13296 && (! REG_P (operands[2])
13297 || ! rtx_equal_p (operands[1], operands[2]))"
13298 [(set (match_dup 3) (match_dup 1))
13299 (parallel [(set (reg:CCZ 17)
13300 (compare:CCZ (plus:SI (match_dup 3) (const_int -1))
13302 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
13303 (set (match_dup 2) (match_dup 3))
13304 (set (pc) (if_then_else (ne (reg:CCZ 17) (const_int 0))
13309 ;; Convert setcc + movzbl to xor + setcc if operands don't overlap.
13312 [(set (reg 17) (match_operand 0 "" ""))
13313 (set (match_operand:QI 1 "register_operand" "")
13314 (match_operator:QI 2 "ix86_comparison_operator"
13315 [(reg 17) (const_int 0)]))
13316 (set (match_operand 3 "q_regs_operand" "")
13317 (zero_extend (match_dup 1)))]
13318 "(peep2_reg_dead_p (3, operands[1])
13319 || operands_match_p (operands[1], operands[3]))
13320 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13321 [(set (match_dup 4) (match_dup 0))
13322 (set (strict_low_part (match_dup 5))
13325 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13326 operands[5] = gen_rtx_REG (QImode, REGNO (operands[3]));
13327 ix86_expand_clear (operands[3]);
13330 ;; Similar, but match zero_extendhisi2_and, which adds a clobber.
13333 [(set (reg 17) (match_operand 0 "" ""))
13334 (set (match_operand:QI 1 "register_operand" "")
13335 (match_operator:QI 2 "ix86_comparison_operator"
13336 [(reg 17) (const_int 0)]))
13337 (parallel [(set (match_operand 3 "q_regs_operand" "")
13338 (zero_extend (match_dup 1)))
13339 (clobber (reg:CC 17))])]
13340 "(peep2_reg_dead_p (3, operands[1])
13341 || operands_match_p (operands[1], operands[3]))
13342 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13343 [(set (match_dup 4) (match_dup 0))
13344 (set (strict_low_part (match_dup 5))
13347 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13348 operands[5] = gen_rtx_REG (QImode, REGNO (operands[3]));
13349 ix86_expand_clear (operands[3]);
13352 ;; Call instructions.
13354 ;; The predicates normally associated with named expanders are not properly
13355 ;; checked for calls. This is a bug in the generic code, but it isn't that
13356 ;; easy to fix. Ignore it for now and be prepared to fix things up.
13358 ;; Call subroutine returning no value.
13360 (define_expand "call_pop"
13361 [(parallel [(call (match_operand:QI 0 "" "")
13362 (match_operand:SI 1 "" ""))
13364 (plus:SI (reg:SI 7)
13365 (match_operand:SI 3 "" "")))])]
13368 ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3]);
13372 (define_insn "*call_pop_0"
13373 [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" ""))
13374 (match_operand:SI 1 "" ""))
13375 (set (reg:SI 7) (plus:SI (reg:SI 7)
13376 (match_operand:SI 2 "immediate_operand" "")))]
13379 if (SIBLING_CALL_P (insn))
13382 return "call\t%P0";
13384 [(set_attr "type" "call")])
13386 (define_insn "*call_pop_1"
13387 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
13388 (match_operand:SI 1 "" ""))
13389 (set (reg:SI 7) (plus:SI (reg:SI 7)
13390 (match_operand:SI 2 "immediate_operand" "i")))]
13393 if (constant_call_address_operand (operands[0], Pmode))
13395 if (SIBLING_CALL_P (insn))
13398 return "call\t%P0";
13400 if (SIBLING_CALL_P (insn))
13403 return "call\t%A0";
13405 [(set_attr "type" "call")])
13407 (define_expand "call"
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);
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 "" ""))]
13434 if (constant_call_address_operand (operands[0], QImode))
13436 if (SIBLING_CALL_P (insn))
13439 return "call\t%P0";
13441 if (SIBLING_CALL_P (insn))
13444 return "call\t%A0";
13446 [(set_attr "type" "call")])
13448 (define_insn "*call_1_rex64"
13449 [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm"))
13450 (match_operand 1 "" ""))]
13453 if (constant_call_address_operand (operands[0], QImode))
13455 if (SIBLING_CALL_P (insn))
13458 return "call\t%P0";
13460 if (SIBLING_CALL_P (insn))
13463 return "call\t%A0";
13465 [(set_attr "type" "call")])
13467 ;; Call subroutine, returning value in operand 0
13469 (define_expand "call_value_pop"
13470 [(parallel [(set (match_operand 0 "" "")
13471 (call (match_operand:QI 1 "" "")
13472 (match_operand:SI 2 "" "")))
13474 (plus:SI (reg:SI 7)
13475 (match_operand:SI 4 "" "")))])]
13478 ix86_expand_call (operands[0], operands[1], operands[2],
13479 operands[3], operands[4]);
13483 (define_expand "call_value"
13484 [(set (match_operand 0 "" "")
13485 (call (match_operand:QI 1 "" "")
13486 (match_operand:SI 2 "" "")))
13487 (use (match_operand:SI 3 "" ""))]
13488 ;; Operand 2 not used on the i386.
13491 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL);
13495 ;; Call subroutine returning any type.
13497 (define_expand "untyped_call"
13498 [(parallel [(call (match_operand 0 "" "")
13500 (match_operand 1 "" "")
13501 (match_operand 2 "" "")])]
13506 /* In order to give reg-stack an easier job in validating two
13507 coprocessor registers as containing a possible return value,
13508 simply pretend the untyped call returns a complex long double
13511 ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
13512 ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
13513 operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1),
13516 for (i = 0; i < XVECLEN (operands[2], 0); i++)
13518 rtx set = XVECEXP (operands[2], 0, i);
13519 emit_move_insn (SET_DEST (set), SET_SRC (set));
13522 /* The optimizer does not know that the call sets the function value
13523 registers we stored in the result block. We avoid problems by
13524 claiming that all hard registers are used and clobbered at this
13526 emit_insn (gen_blockage (const0_rtx));
13531 ;; Prologue and epilogue instructions
13533 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13534 ;; all of memory. This blocks insns from being moved across this point.
13536 (define_insn "blockage"
13537 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_BLOCKAGE)]
13540 [(set_attr "length" "0")])
13542 ;; Insn emitted into the body of a function to return from a function.
13543 ;; This is only done if the function's epilogue is known to be simple.
13544 ;; See comments for ix86_can_use_return_insn_p in i386.c.
13546 (define_expand "return"
13548 "ix86_can_use_return_insn_p ()"
13550 if (current_function_pops_args)
13552 rtx popc = GEN_INT (current_function_pops_args);
13553 emit_jump_insn (gen_return_pop_internal (popc));
13558 (define_insn "return_internal"
13562 [(set_attr "length" "1")
13563 (set_attr "length_immediate" "0")
13564 (set_attr "modrm" "0")])
13566 (define_insn "return_pop_internal"
13568 (use (match_operand:SI 0 "const_int_operand" ""))]
13571 [(set_attr "length" "3")
13572 (set_attr "length_immediate" "2")
13573 (set_attr "modrm" "0")])
13575 (define_insn "return_indirect_internal"
13577 (use (match_operand:SI 0 "register_operand" "r"))]
13580 [(set_attr "type" "ibr")
13581 (set_attr "length_immediate" "0")])
13587 [(set_attr "length" "1")
13588 (set_attr "length_immediate" "0")
13589 (set_attr "modrm" "0")
13590 (set_attr "ppro_uops" "one")])
13592 (define_expand "prologue"
13595 "ix86_expand_prologue (); DONE;")
13597 (define_insn "set_got"
13598 [(set (match_operand:SI 0 "register_operand" "=r")
13599 (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
13600 (clobber (reg:CC 17))]
13602 { return output_set_got (operands[0]); }
13603 [(set_attr "type" "multi")
13604 (set_attr "length" "12")])
13606 (define_expand "epilogue"
13609 "ix86_expand_epilogue (1); DONE;")
13611 (define_expand "sibcall_epilogue"
13614 "ix86_expand_epilogue (0); DONE;")
13616 (define_expand "eh_return"
13617 [(use (match_operand 0 "register_operand" ""))
13618 (use (match_operand 1 "register_operand" ""))]
13621 rtx tmp, sa = operands[0], ra = operands[1];
13623 /* Tricky bit: we write the address of the handler to which we will
13624 be returning into someone else's stack frame, one word below the
13625 stack address we wish to restore. */
13626 tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
13627 tmp = plus_constant (tmp, -UNITS_PER_WORD);
13628 tmp = gen_rtx_MEM (Pmode, tmp);
13629 emit_move_insn (tmp, ra);
13631 if (Pmode == SImode)
13632 emit_insn (gen_eh_return_si (sa));
13634 emit_insn (gen_eh_return_di (sa));
13639 (define_insn_and_split "eh_return_si"
13640 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")]
13641 UNSPECV_EH_RETURN)]
13646 "ix86_expand_epilogue (2); DONE;")
13648 (define_insn_and_split "eh_return_di"
13649 [(unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
13650 UNSPECV_EH_RETURN)]
13655 "ix86_expand_epilogue (2); DONE;")
13657 (define_insn "leave"
13658 [(set (reg:SI 7) (plus:SI (reg:SI 6) (const_int 4)))
13659 (set (reg:SI 6) (mem:SI (reg:SI 6)))
13660 (clobber (mem:BLK (scratch)))]
13663 [(set_attr "length_immediate" "0")
13664 (set_attr "length" "1")
13665 (set_attr "modrm" "0")
13666 (set_attr "athlon_decode" "vector")
13667 (set_attr "ppro_uops" "few")])
13669 (define_insn "leave_rex64"
13670 [(set (reg:DI 7) (plus:DI (reg:DI 6) (const_int 8)))
13671 (set (reg:DI 6) (mem:DI (reg:DI 6)))
13672 (clobber (mem:BLK (scratch)))]
13675 [(set_attr "length_immediate" "0")
13676 (set_attr "length" "1")
13677 (set_attr "modrm" "0")
13678 (set_attr "athlon_decode" "vector")
13679 (set_attr "ppro_uops" "few")])
13681 (define_expand "ffssi2"
13682 [(set (match_operand:SI 0 "nonimmediate_operand" "")
13683 (ffs:SI (match_operand:SI 1 "general_operand" "")))]
13686 rtx out = gen_reg_rtx (SImode), tmp = gen_reg_rtx (SImode);
13687 rtx in = operands[1];
13691 emit_move_insn (tmp, constm1_rtx);
13692 emit_insn (gen_ffssi_1 (out, in));
13693 emit_insn (gen_rtx_SET (VOIDmode, out,
13694 gen_rtx_IF_THEN_ELSE (SImode,
13695 gen_rtx_EQ (VOIDmode, gen_rtx_REG (CCZmode, FLAGS_REG),
13699 emit_insn (gen_addsi3 (out, out, const1_rtx));
13700 emit_move_insn (operands[0], out);
13703 /* Pentium bsf instruction is extremly slow. The following code is
13704 recommended by the Intel Optimizing Manual as a reasonable replacement:
13708 MOV DWORD PTR [TEMP+4],ECX
13711 MOV DWORD PTR [TEMP],EAX
13712 FILD QWORD PTR [TEMP]
13713 FSTP QWORD PTR [TEMP]
13714 WAIT ; WAIT only needed for compatibility with
13715 ; earlier processors
13716 MOV ECX, DWORD PTR [TEMP+4]
13719 TEST EAX,EAX ; clear zero flag
13721 Following piece of code expand ffs to similar beast.
13724 else if (TARGET_PENTIUM && !optimize_size && TARGET_80387)
13726 rtx label = gen_label_rtx ();
13728 rtx mem = assign_386_stack_local (DImode, 0);
13729 rtx fptmp = gen_reg_rtx (DFmode);
13730 split_di (&mem, 1, &lo, &hi);
13732 emit_move_insn (out, const0_rtx);
13734 emit_cmp_and_jump_insns (in, const0_rtx, EQ, 0, SImode, 1, label);
13736 emit_move_insn (hi, out);
13737 emit_insn (gen_subsi3 (out, out, in));
13738 emit_insn (gen_andsi3 (out, out, in));
13739 emit_move_insn (lo, out);
13740 emit_insn (gen_floatdidf2 (fptmp,mem));
13741 emit_move_insn (gen_rtx_MEM (DFmode, XEXP (mem, 0)), fptmp);
13742 emit_move_insn (out, hi);
13743 emit_insn (gen_lshrsi3 (out, out, GEN_INT (20)));
13744 emit_insn (gen_subsi3 (out, out, GEN_INT (0x3ff - 1)));
13746 emit_label (label);
13747 LABEL_NUSES (label) = 1;
13749 emit_move_insn (operands[0], out);
13753 emit_move_insn (tmp, const0_rtx);
13754 emit_insn (gen_ffssi_1 (out, in));
13755 emit_insn (gen_rtx_SET (VOIDmode,
13756 gen_rtx_STRICT_LOW_PART (VOIDmode, gen_lowpart (QImode, tmp)),
13757 gen_rtx_EQ (QImode, gen_rtx_REG (CCZmode, FLAGS_REG),
13759 emit_insn (gen_negsi2 (tmp, tmp));
13760 emit_insn (gen_iorsi3 (out, out, tmp));
13761 emit_insn (gen_addsi3 (out, out, const1_rtx));
13762 emit_move_insn (operands[0], out);
13767 (define_insn "ffssi_1"
13769 (compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm")
13771 (set (match_operand:SI 0 "register_operand" "=r")
13772 (unspec:SI [(match_dup 1)] UNSPEC_BSF))]
13774 "bsf{l}\t{%1, %0|%0, %1}"
13775 [(set_attr "prefix_0f" "1")
13776 (set_attr "ppro_uops" "few")])
13778 ;; ffshi2 is not useful -- 4 word prefix ops are needed, which is larger
13779 ;; and slower than the two-byte movzx insn needed to do the work in SImode.
13781 ;; Thread-local storage patterns for ELF.
13783 ;; Note that these code sequences must appear exactly as shown
13784 ;; in order to allow linker relaxation.
13786 (define_insn "*tls_global_dynamic_gnu"
13787 [(set (match_operand:SI 0 "register_operand" "=a")
13788 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13789 (match_operand:SI 2 "tls_symbolic_operand" "")
13790 (match_operand:SI 3 "call_insn_operand" "")]
13792 (clobber (match_scratch:SI 4 "=d"))
13793 (clobber (match_scratch:SI 5 "=c"))
13794 (clobber (reg:CC 17))]
13796 "lea{l}\t{%a2@TLSGD(,%1,1), %0|%0, %a2@TLSGD[%1*1]}\;call\t%P3"
13797 [(set_attr "type" "multi")
13798 (set_attr "length" "12")])
13800 (define_insn "*tls_global_dynamic_sun"
13801 [(set (match_operand:SI 0 "register_operand" "=a")
13802 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13803 (match_operand:SI 2 "tls_symbolic_operand" "")
13804 (match_operand:SI 3 "call_insn_operand" "")]
13806 (clobber (match_scratch:SI 4 "=d"))
13807 (clobber (match_scratch:SI 5 "=c"))
13808 (clobber (reg:CC 17))]
13810 "lea{l}\t{%a2@DTLNDX(%1), %4|%4, %a2@DTLNDX[%1]}
13811 push{l}\t%4\;call\t%a2@TLSPLT\;pop{l}\t%4\;nop"
13812 [(set_attr "type" "multi")
13813 (set_attr "length" "14")])
13815 (define_expand "tls_global_dynamic"
13816 [(parallel [(set (match_operand:SI 0 "register_operand" "")
13819 (match_operand:SI 1 "tls_symbolic_operand" "")
13822 (clobber (match_scratch:SI 4 ""))
13823 (clobber (match_scratch:SI 5 ""))
13824 (clobber (reg:CC 17))])]
13829 operands[2] = pic_offset_table_rtx;
13830 operands[3] = ix86_tls_get_addr ();
13833 (define_insn "*tls_local_dynamic_base_gnu"
13834 [(set (match_operand:SI 0 "register_operand" "=a")
13835 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13836 (match_operand:SI 2 "call_insn_operand" "")]
13837 UNSPEC_TLS_LD_BASE))
13838 (clobber (match_scratch:SI 3 "=d"))
13839 (clobber (match_scratch:SI 4 "=c"))
13840 (clobber (reg:CC 17))]
13842 "lea{l}\t{%&@TLSLDM(%1), %0|%0, %&@TLSLDM[%1]}\;call\t%P2"
13843 [(set_attr "type" "multi")
13844 (set_attr "length" "11")])
13846 (define_insn "*tls_local_dynamic_base_sun"
13847 [(set (match_operand:SI 0 "register_operand" "=a")
13848 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13849 (match_operand:SI 2 "call_insn_operand" "")]
13850 UNSPEC_TLS_LD_BASE))
13851 (clobber (match_scratch:SI 3 "=d"))
13852 (clobber (match_scratch:SI 4 "=c"))
13853 (clobber (reg:CC 17))]
13855 "lea{l}\t{%&@TMDNX(%1), %3|%3, %&@TMDNX[%1]}
13856 push{l}\t%3\;call\t%&@TLSPLT\;pop{l}\t%3"
13857 [(set_attr "type" "multi")
13858 (set_attr "length" "13")])
13860 (define_expand "tls_local_dynamic_base"
13861 [(parallel [(set (match_operand:SI 0 "register_operand" "")
13862 (unspec:SI [(match_dup 1) (match_dup 2)]
13863 UNSPEC_TLS_LD_BASE))
13864 (clobber (match_scratch:SI 3 ""))
13865 (clobber (match_scratch:SI 4 ""))
13866 (clobber (reg:CC 17))])]
13871 operands[1] = pic_offset_table_rtx;
13872 operands[2] = ix86_tls_get_addr ();
13875 ;; Local dynamic of a single variable is a lose. Show combine how
13876 ;; to convert that back to global dynamic.
13878 (define_insn_and_split "*tls_local_dynamic_once"
13879 [(set (match_operand:SI 0 "register_operand" "=a")
13880 (plus:SI (unspec:SI [(match_operand:SI 1 "register_operand" "b")
13881 (match_operand:SI 2 "call_insn_operand" "")]
13882 UNSPEC_TLS_LD_BASE)
13883 (const:SI (unspec:SI
13884 [(match_operand:SI 3 "tls_symbolic_operand" "")]
13886 (clobber (match_scratch:SI 4 "=d"))
13887 (clobber (match_scratch:SI 5 "=c"))
13888 (clobber (reg:CC 17))]
13892 [(parallel [(set (match_dup 0)
13893 (unspec:SI [(match_dup 1) (match_dup 3) (match_dup 2)]
13895 (clobber (match_dup 4))
13896 (clobber (match_dup 5))
13897 (clobber (reg:CC 17))])]
13900 ;; These patterns match the binary 387 instructions for addM3, subM3,
13901 ;; mulM3 and divM3. There are three patterns for each of DFmode and
13902 ;; SFmode. The first is the normal insn, the second the same insn but
13903 ;; with one operand a conversion, and the third the same insn but with
13904 ;; the other operand a conversion. The conversion may be SFmode or
13905 ;; SImode if the target mode DFmode, but only SImode if the target mode
13908 ;; Gcc is slightly more smart about handling normal two address instructions
13909 ;; so use special patterns for add and mull.
13910 (define_insn "*fop_sf_comm_nosse"
13911 [(set (match_operand:SF 0 "register_operand" "=f")
13912 (match_operator:SF 3 "binary_fp_operator"
13913 [(match_operand:SF 1 "nonimmediate_operand" "%0")
13914 (match_operand:SF 2 "nonimmediate_operand" "fm")]))]
13915 "TARGET_80387 && !TARGET_SSE_MATH
13916 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
13917 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
13918 "* return output_387_binary_op (insn, operands);"
13919 [(set (attr "type")
13920 (if_then_else (match_operand:SF 3 "mult_operator" "")
13921 (const_string "fmul")
13922 (const_string "fop")))
13923 (set_attr "mode" "SF")])
13925 (define_insn "*fop_sf_comm"
13926 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
13927 (match_operator:SF 3 "binary_fp_operator"
13928 [(match_operand:SF 1 "nonimmediate_operand" "%0,0")
13929 (match_operand:SF 2 "nonimmediate_operand" "fm#x,xm#f")]))]
13930 "TARGET_80387 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
13931 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
13932 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
13933 "* return output_387_binary_op (insn, operands);"
13934 [(set (attr "type")
13935 (if_then_else (eq_attr "alternative" "1")
13936 (if_then_else (match_operand:SF 3 "mult_operator" "")
13937 (const_string "ssemul")
13938 (const_string "sseadd"))
13939 (if_then_else (match_operand:SF 3 "mult_operator" "")
13940 (const_string "fmul")
13941 (const_string "fop"))))
13942 (set_attr "mode" "SF")])
13944 (define_insn "*fop_sf_comm_sse"
13945 [(set (match_operand:SF 0 "register_operand" "=x")
13946 (match_operator:SF 3 "binary_fp_operator"
13947 [(match_operand:SF 1 "nonimmediate_operand" "%0")
13948 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
13949 "TARGET_SSE_MATH && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
13950 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
13951 "* return output_387_binary_op (insn, operands);"
13952 [(set (attr "type")
13953 (if_then_else (match_operand:SF 3 "mult_operator" "")
13954 (const_string "ssemul")
13955 (const_string "sseadd")))
13956 (set_attr "mode" "SF")])
13958 (define_insn "*fop_df_comm_nosse"
13959 [(set (match_operand:DF 0 "register_operand" "=f")
13960 (match_operator:DF 3 "binary_fp_operator"
13961 [(match_operand:DF 1 "nonimmediate_operand" "%0")
13962 (match_operand:DF 2 "nonimmediate_operand" "fm")]))]
13963 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)
13964 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
13965 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
13966 "* return output_387_binary_op (insn, operands);"
13967 [(set (attr "type")
13968 (if_then_else (match_operand:SF 3 "mult_operator" "")
13969 (const_string "fmul")
13970 (const_string "fop")))
13971 (set_attr "mode" "DF")])
13973 (define_insn "*fop_df_comm"
13974 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
13975 (match_operator:DF 3 "binary_fp_operator"
13976 [(match_operand:DF 1 "nonimmediate_operand" "%0,0")
13977 (match_operand:DF 2 "nonimmediate_operand" "fm#Y,Ym#f")]))]
13978 "TARGET_80387 && TARGET_SSE_MATH && TARGET_SSE2 && TARGET_MIX_SSE_I387
13979 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
13980 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
13981 "* return output_387_binary_op (insn, operands);"
13982 [(set (attr "type")
13983 (if_then_else (eq_attr "alternative" "1")
13984 (if_then_else (match_operand:SF 3 "mult_operator" "")
13985 (const_string "ssemul")
13986 (const_string "sseadd"))
13987 (if_then_else (match_operand:SF 3 "mult_operator" "")
13988 (const_string "fmul")
13989 (const_string "fop"))))
13990 (set_attr "mode" "DF")])
13992 (define_insn "*fop_df_comm_sse"
13993 [(set (match_operand:DF 0 "register_operand" "=Y")
13994 (match_operator:DF 3 "binary_fp_operator"
13995 [(match_operand:DF 1 "nonimmediate_operand" "%0")
13996 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
13997 "TARGET_SSE2 && TARGET_SSE_MATH
13998 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
13999 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14000 "* return output_387_binary_op (insn, operands);"
14001 [(set (attr "type")
14002 (if_then_else (match_operand:SF 3 "mult_operator" "")
14003 (const_string "ssemul")
14004 (const_string "sseadd")))
14005 (set_attr "mode" "DF")])
14007 (define_insn "*fop_xf_comm"
14008 [(set (match_operand:XF 0 "register_operand" "=f")
14009 (match_operator:XF 3 "binary_fp_operator"
14010 [(match_operand:XF 1 "register_operand" "%0")
14011 (match_operand:XF 2 "register_operand" "f")]))]
14012 "!TARGET_64BIT && TARGET_80387
14013 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
14014 "* return output_387_binary_op (insn, operands);"
14015 [(set (attr "type")
14016 (if_then_else (match_operand:XF 3 "mult_operator" "")
14017 (const_string "fmul")
14018 (const_string "fop")))
14019 (set_attr "mode" "XF")])
14021 (define_insn "*fop_tf_comm"
14022 [(set (match_operand:TF 0 "register_operand" "=f")
14023 (match_operator:TF 3 "binary_fp_operator"
14024 [(match_operand:TF 1 "register_operand" "%0")
14025 (match_operand:TF 2 "register_operand" "f")]))]
14026 "TARGET_80387 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
14027 "* return output_387_binary_op (insn, operands);"
14028 [(set (attr "type")
14029 (if_then_else (match_operand:TF 3 "mult_operator" "")
14030 (const_string "fmul")
14031 (const_string "fop")))
14032 (set_attr "mode" "XF")])
14034 (define_insn "*fop_sf_1_nosse"
14035 [(set (match_operand:SF 0 "register_operand" "=f,f")
14036 (match_operator:SF 3 "binary_fp_operator"
14037 [(match_operand:SF 1 "nonimmediate_operand" "0,fm")
14038 (match_operand:SF 2 "nonimmediate_operand" "fm,0")]))]
14039 "TARGET_80387 && !TARGET_SSE_MATH
14040 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14041 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14042 "* return output_387_binary_op (insn, operands);"
14043 [(set (attr "type")
14044 (cond [(match_operand:SF 3 "mult_operator" "")
14045 (const_string "fmul")
14046 (match_operand:SF 3 "div_operator" "")
14047 (const_string "fdiv")
14049 (const_string "fop")))
14050 (set_attr "mode" "SF")])
14052 (define_insn "*fop_sf_1"
14053 [(set (match_operand:SF 0 "register_operand" "=f,f,x")
14054 (match_operator:SF 3 "binary_fp_operator"
14055 [(match_operand:SF 1 "nonimmediate_operand" "0,fm,0")
14056 (match_operand:SF 2 "nonimmediate_operand" "fm,0,xm#f")]))]
14057 "TARGET_80387 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14058 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14059 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14060 "* return output_387_binary_op (insn, operands);"
14061 [(set (attr "type")
14062 (cond [(and (eq_attr "alternative" "2")
14063 (match_operand:SF 3 "mult_operator" ""))
14064 (const_string "ssemul")
14065 (and (eq_attr "alternative" "2")
14066 (match_operand:SF 3 "div_operator" ""))
14067 (const_string "ssediv")
14068 (eq_attr "alternative" "2")
14069 (const_string "sseadd")
14070 (match_operand:SF 3 "mult_operator" "")
14071 (const_string "fmul")
14072 (match_operand:SF 3 "div_operator" "")
14073 (const_string "fdiv")
14075 (const_string "fop")))
14076 (set_attr "mode" "SF")])
14078 (define_insn "*fop_sf_1_sse"
14079 [(set (match_operand:SF 0 "register_operand" "=x")
14080 (match_operator:SF 3 "binary_fp_operator"
14081 [(match_operand:SF 1 "register_operand" "0")
14082 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14084 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14085 "* return output_387_binary_op (insn, operands);"
14086 [(set (attr "type")
14087 (cond [(match_operand:SF 3 "mult_operator" "")
14088 (const_string "ssemul")
14089 (match_operand:SF 3 "div_operator" "")
14090 (const_string "ssediv")
14092 (const_string "sseadd")))
14093 (set_attr "mode" "SF")])
14095 ;; ??? Add SSE splitters for these!
14096 (define_insn "*fop_sf_2"
14097 [(set (match_operand:SF 0 "register_operand" "=f,f")
14098 (match_operator:SF 3 "binary_fp_operator"
14099 [(float:SF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14100 (match_operand:SF 2 "register_operand" "0,0")]))]
14101 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14102 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14103 [(set (attr "type")
14104 (cond [(match_operand:SF 3 "mult_operator" "")
14105 (const_string "fmul")
14106 (match_operand:SF 3 "div_operator" "")
14107 (const_string "fdiv")
14109 (const_string "fop")))
14110 (set_attr "fp_int_src" "true")
14111 (set_attr "ppro_uops" "many")
14112 (set_attr "mode" "SI")])
14114 (define_insn "*fop_sf_3"
14115 [(set (match_operand:SF 0 "register_operand" "=f,f")
14116 (match_operator:SF 3 "binary_fp_operator"
14117 [(match_operand:SF 1 "register_operand" "0,0")
14118 (float:SF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14119 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14120 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14121 [(set (attr "type")
14122 (cond [(match_operand:SF 3 "mult_operator" "")
14123 (const_string "fmul")
14124 (match_operand:SF 3 "div_operator" "")
14125 (const_string "fdiv")
14127 (const_string "fop")))
14128 (set_attr "fp_int_src" "true")
14129 (set_attr "ppro_uops" "many")
14130 (set_attr "mode" "SI")])
14132 (define_insn "*fop_df_1_nosse"
14133 [(set (match_operand:DF 0 "register_operand" "=f,f")
14134 (match_operator:DF 3 "binary_fp_operator"
14135 [(match_operand:DF 1 "nonimmediate_operand" "0,fm")
14136 (match_operand:DF 2 "nonimmediate_operand" "fm,0")]))]
14137 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)
14138 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14139 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14140 "* return output_387_binary_op (insn, operands);"
14141 [(set (attr "type")
14142 (cond [(match_operand:DF 3 "mult_operator" "")
14143 (const_string "fmul")
14144 (match_operand:DF 3 "div_operator" "")
14145 (const_string "fdiv")
14147 (const_string "fop")))
14148 (set_attr "mode" "DF")])
14151 (define_insn "*fop_df_1"
14152 [(set (match_operand:DF 0 "register_operand" "=f#Y,f#Y,Y#f")
14153 (match_operator:DF 3 "binary_fp_operator"
14154 [(match_operand:DF 1 "nonimmediate_operand" "0,fm,0")
14155 (match_operand:DF 2 "nonimmediate_operand" "fm,0,Ym#f")]))]
14156 "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14157 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14158 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14159 "* return output_387_binary_op (insn, operands);"
14160 [(set (attr "type")
14161 (cond [(and (eq_attr "alternative" "2")
14162 (match_operand:SF 3 "mult_operator" ""))
14163 (const_string "ssemul")
14164 (and (eq_attr "alternative" "2")
14165 (match_operand:SF 3 "div_operator" ""))
14166 (const_string "ssediv")
14167 (eq_attr "alternative" "2")
14168 (const_string "sseadd")
14169 (match_operand:DF 3 "mult_operator" "")
14170 (const_string "fmul")
14171 (match_operand:DF 3 "div_operator" "")
14172 (const_string "fdiv")
14174 (const_string "fop")))
14175 (set_attr "mode" "DF")])
14177 (define_insn "*fop_df_1_sse"
14178 [(set (match_operand:DF 0 "register_operand" "=Y")
14179 (match_operator:DF 3 "binary_fp_operator"
14180 [(match_operand:DF 1 "register_operand" "0")
14181 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14182 "TARGET_SSE2 && TARGET_SSE_MATH
14183 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14184 "* return output_387_binary_op (insn, operands);"
14185 [(set_attr "mode" "DF")
14187 (cond [(match_operand:SF 3 "mult_operator" "")
14188 (const_string "ssemul")
14189 (match_operand:SF 3 "div_operator" "")
14190 (const_string "ssediv")
14192 (const_string "sseadd")))])
14194 ;; ??? Add SSE splitters for these!
14195 (define_insn "*fop_df_2"
14196 [(set (match_operand:DF 0 "register_operand" "=f,f")
14197 (match_operator:DF 3 "binary_fp_operator"
14198 [(float:DF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14199 (match_operand:DF 2 "register_operand" "0,0")]))]
14200 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14201 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14202 [(set (attr "type")
14203 (cond [(match_operand:DF 3 "mult_operator" "")
14204 (const_string "fmul")
14205 (match_operand:DF 3 "div_operator" "")
14206 (const_string "fdiv")
14208 (const_string "fop")))
14209 (set_attr "fp_int_src" "true")
14210 (set_attr "ppro_uops" "many")
14211 (set_attr "mode" "SI")])
14213 (define_insn "*fop_df_3"
14214 [(set (match_operand:DF 0 "register_operand" "=f,f")
14215 (match_operator:DF 3 "binary_fp_operator"
14216 [(match_operand:DF 1 "register_operand" "0,0")
14217 (float:DF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14218 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14219 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14220 [(set (attr "type")
14221 (cond [(match_operand:DF 3 "mult_operator" "")
14222 (const_string "fmul")
14223 (match_operand:DF 3 "div_operator" "")
14224 (const_string "fdiv")
14226 (const_string "fop")))
14227 (set_attr "fp_int_src" "true")
14228 (set_attr "ppro_uops" "many")
14229 (set_attr "mode" "SI")])
14231 (define_insn "*fop_df_4"
14232 [(set (match_operand:DF 0 "register_operand" "=f,f")
14233 (match_operator:DF 3 "binary_fp_operator"
14234 [(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
14235 (match_operand:DF 2 "register_operand" "0,f")]))]
14236 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)
14237 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14238 "* return output_387_binary_op (insn, operands);"
14239 [(set (attr "type")
14240 (cond [(match_operand:DF 3 "mult_operator" "")
14241 (const_string "fmul")
14242 (match_operand:DF 3 "div_operator" "")
14243 (const_string "fdiv")
14245 (const_string "fop")))
14246 (set_attr "mode" "SF")])
14248 (define_insn "*fop_df_5"
14249 [(set (match_operand:DF 0 "register_operand" "=f,f")
14250 (match_operator:DF 3 "binary_fp_operator"
14251 [(match_operand:DF 1 "register_operand" "0,f")
14253 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14254 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14255 "* return output_387_binary_op (insn, operands);"
14256 [(set (attr "type")
14257 (cond [(match_operand:DF 3 "mult_operator" "")
14258 (const_string "fmul")
14259 (match_operand:DF 3 "div_operator" "")
14260 (const_string "fdiv")
14262 (const_string "fop")))
14263 (set_attr "mode" "SF")])
14265 (define_insn "*fop_xf_1"
14266 [(set (match_operand:XF 0 "register_operand" "=f,f")
14267 (match_operator:XF 3 "binary_fp_operator"
14268 [(match_operand:XF 1 "register_operand" "0,f")
14269 (match_operand:XF 2 "register_operand" "f,0")]))]
14270 "!TARGET_64BIT && TARGET_80387
14271 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14272 "* return output_387_binary_op (insn, operands);"
14273 [(set (attr "type")
14274 (cond [(match_operand:XF 3 "mult_operator" "")
14275 (const_string "fmul")
14276 (match_operand:XF 3 "div_operator" "")
14277 (const_string "fdiv")
14279 (const_string "fop")))
14280 (set_attr "mode" "XF")])
14282 (define_insn "*fop_tf_1"
14283 [(set (match_operand:TF 0 "register_operand" "=f,f")
14284 (match_operator:TF 3 "binary_fp_operator"
14285 [(match_operand:TF 1 "register_operand" "0,f")
14286 (match_operand:TF 2 "register_operand" "f,0")]))]
14288 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14289 "* return output_387_binary_op (insn, operands);"
14290 [(set (attr "type")
14291 (cond [(match_operand:TF 3 "mult_operator" "")
14292 (const_string "fmul")
14293 (match_operand:TF 3 "div_operator" "")
14294 (const_string "fdiv")
14296 (const_string "fop")))
14297 (set_attr "mode" "XF")])
14299 (define_insn "*fop_xf_2"
14300 [(set (match_operand:XF 0 "register_operand" "=f,f")
14301 (match_operator:XF 3 "binary_fp_operator"
14302 [(float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14303 (match_operand:XF 2 "register_operand" "0,0")]))]
14304 "!TARGET_64BIT && TARGET_80387 && TARGET_USE_FIOP"
14305 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14306 [(set (attr "type")
14307 (cond [(match_operand:XF 3 "mult_operator" "")
14308 (const_string "fmul")
14309 (match_operand:XF 3 "div_operator" "")
14310 (const_string "fdiv")
14312 (const_string "fop")))
14313 (set_attr "fp_int_src" "true")
14314 (set_attr "mode" "SI")
14315 (set_attr "ppro_uops" "many")])
14317 (define_insn "*fop_tf_2"
14318 [(set (match_operand:TF 0 "register_operand" "=f,f")
14319 (match_operator:TF 3 "binary_fp_operator"
14320 [(float:TF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14321 (match_operand:TF 2 "register_operand" "0,0")]))]
14322 "TARGET_80387 && TARGET_USE_FIOP"
14323 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14324 [(set (attr "type")
14325 (cond [(match_operand:TF 3 "mult_operator" "")
14326 (const_string "fmul")
14327 (match_operand:TF 3 "div_operator" "")
14328 (const_string "fdiv")
14330 (const_string "fop")))
14331 (set_attr "fp_int_src" "true")
14332 (set_attr "mode" "SI")
14333 (set_attr "ppro_uops" "many")])
14335 (define_insn "*fop_xf_3"
14336 [(set (match_operand:XF 0 "register_operand" "=f,f")
14337 (match_operator:XF 3 "binary_fp_operator"
14338 [(match_operand:XF 1 "register_operand" "0,0")
14339 (float:XF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14340 "!TARGET_64BIT && TARGET_80387 && TARGET_USE_FIOP"
14341 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14342 [(set (attr "type")
14343 (cond [(match_operand:XF 3 "mult_operator" "")
14344 (const_string "fmul")
14345 (match_operand:XF 3 "div_operator" "")
14346 (const_string "fdiv")
14348 (const_string "fop")))
14349 (set_attr "fp_int_src" "true")
14350 (set_attr "mode" "SI")
14351 (set_attr "ppro_uops" "many")])
14353 (define_insn "*fop_tf_3"
14354 [(set (match_operand:TF 0 "register_operand" "=f,f")
14355 (match_operator:TF 3 "binary_fp_operator"
14356 [(match_operand:TF 1 "register_operand" "0,0")
14357 (float:TF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14358 "TARGET_80387 && TARGET_USE_FIOP"
14359 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14360 [(set (attr "type")
14361 (cond [(match_operand:TF 3 "mult_operator" "")
14362 (const_string "fmul")
14363 (match_operand:TF 3 "div_operator" "")
14364 (const_string "fdiv")
14366 (const_string "fop")))
14367 (set_attr "fp_int_src" "true")
14368 (set_attr "mode" "SI")
14369 (set_attr "ppro_uops" "many")])
14371 (define_insn "*fop_xf_4"
14372 [(set (match_operand:XF 0 "register_operand" "=f,f")
14373 (match_operator:XF 3 "binary_fp_operator"
14374 [(float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
14375 (match_operand:XF 2 "register_operand" "0,f")]))]
14376 "!TARGET_64BIT && TARGET_80387"
14377 "* return output_387_binary_op (insn, operands);"
14378 [(set (attr "type")
14379 (cond [(match_operand:XF 3 "mult_operator" "")
14380 (const_string "fmul")
14381 (match_operand:XF 3 "div_operator" "")
14382 (const_string "fdiv")
14384 (const_string "fop")))
14385 (set_attr "mode" "SF")])
14387 (define_insn "*fop_tf_4"
14388 [(set (match_operand:TF 0 "register_operand" "=f,f")
14389 (match_operator:TF 3 "binary_fp_operator"
14390 [(float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
14391 (match_operand:TF 2 "register_operand" "0,f")]))]
14393 "* return output_387_binary_op (insn, operands);"
14394 [(set (attr "type")
14395 (cond [(match_operand:TF 3 "mult_operator" "")
14396 (const_string "fmul")
14397 (match_operand:TF 3 "div_operator" "")
14398 (const_string "fdiv")
14400 (const_string "fop")))
14401 (set_attr "mode" "SF")])
14403 (define_insn "*fop_xf_5"
14404 [(set (match_operand:XF 0 "register_operand" "=f,f")
14405 (match_operator:XF 3 "binary_fp_operator"
14406 [(match_operand:XF 1 "register_operand" "0,f")
14408 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14409 "!TARGET_64BIT && TARGET_80387"
14410 "* return output_387_binary_op (insn, operands);"
14411 [(set (attr "type")
14412 (cond [(match_operand:XF 3 "mult_operator" "")
14413 (const_string "fmul")
14414 (match_operand:XF 3 "div_operator" "")
14415 (const_string "fdiv")
14417 (const_string "fop")))
14418 (set_attr "mode" "SF")])
14420 (define_insn "*fop_tf_5"
14421 [(set (match_operand:TF 0 "register_operand" "=f,f")
14422 (match_operator:TF 3 "binary_fp_operator"
14423 [(match_operand:TF 1 "register_operand" "0,f")
14425 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14427 "* return output_387_binary_op (insn, operands);"
14428 [(set (attr "type")
14429 (cond [(match_operand:TF 3 "mult_operator" "")
14430 (const_string "fmul")
14431 (match_operand:TF 3 "div_operator" "")
14432 (const_string "fdiv")
14434 (const_string "fop")))
14435 (set_attr "mode" "SF")])
14437 (define_insn "*fop_xf_6"
14438 [(set (match_operand:XF 0 "register_operand" "=f,f")
14439 (match_operator:XF 3 "binary_fp_operator"
14440 [(float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,0"))
14441 (match_operand:XF 2 "register_operand" "0,f")]))]
14442 "!TARGET_64BIT && TARGET_80387"
14443 "* return output_387_binary_op (insn, operands);"
14444 [(set (attr "type")
14445 (cond [(match_operand:XF 3 "mult_operator" "")
14446 (const_string "fmul")
14447 (match_operand:XF 3 "div_operator" "")
14448 (const_string "fdiv")
14450 (const_string "fop")))
14451 (set_attr "mode" "DF")])
14453 (define_insn "*fop_tf_6"
14454 [(set (match_operand:TF 0 "register_operand" "=f,f")
14455 (match_operator:TF 3 "binary_fp_operator"
14456 [(float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "fm,0"))
14457 (match_operand:TF 2 "register_operand" "0,f")]))]
14459 "* return output_387_binary_op (insn, operands);"
14460 [(set (attr "type")
14461 (cond [(match_operand:TF 3 "mult_operator" "")
14462 (const_string "fmul")
14463 (match_operand:TF 3 "div_operator" "")
14464 (const_string "fdiv")
14466 (const_string "fop")))
14467 (set_attr "mode" "DF")])
14469 (define_insn "*fop_xf_7"
14470 [(set (match_operand:XF 0 "register_operand" "=f,f")
14471 (match_operator:XF 3 "binary_fp_operator"
14472 [(match_operand:XF 1 "register_operand" "0,f")
14474 (match_operand:DF 2 "nonimmediate_operand" "fm,0"))]))]
14475 "!TARGET_64BIT && TARGET_80387"
14476 "* return output_387_binary_op (insn, operands);"
14477 [(set (attr "type")
14478 (cond [(match_operand:XF 3 "mult_operator" "")
14479 (const_string "fmul")
14480 (match_operand:XF 3 "div_operator" "")
14481 (const_string "fdiv")
14483 (const_string "fop")))
14484 (set_attr "mode" "DF")])
14486 (define_insn "*fop_tf_7"
14487 [(set (match_operand:TF 0 "register_operand" "=f,f")
14488 (match_operator:TF 3 "binary_fp_operator"
14489 [(match_operand:TF 1 "register_operand" "0,f")
14491 (match_operand:DF 2 "nonimmediate_operand" "fm,0"))]))]
14493 "* return output_387_binary_op (insn, operands);"
14494 [(set (attr "type")
14495 (cond [(match_operand:TF 3 "mult_operator" "")
14496 (const_string "fmul")
14497 (match_operand:TF 3 "div_operator" "")
14498 (const_string "fdiv")
14500 (const_string "fop")))
14501 (set_attr "mode" "DF")])
14504 [(set (match_operand 0 "register_operand" "")
14505 (match_operator 3 "binary_fp_operator"
14506 [(float (match_operand:SI 1 "register_operand" ""))
14507 (match_operand 2 "register_operand" "")]))]
14508 "TARGET_80387 && reload_completed
14509 && FLOAT_MODE_P (GET_MODE (operands[0]))"
14512 operands[4] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
14513 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
14514 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
14515 gen_rtx_fmt_ee (GET_CODE (operands[3]),
14516 GET_MODE (operands[3]),
14519 ix86_free_from_memory (GET_MODE (operands[1]));
14524 [(set (match_operand 0 "register_operand" "")
14525 (match_operator 3 "binary_fp_operator"
14526 [(match_operand 1 "register_operand" "")
14527 (float (match_operand:SI 2 "register_operand" ""))]))]
14528 "TARGET_80387 && reload_completed
14529 && FLOAT_MODE_P (GET_MODE (operands[0]))"
14532 operands[4] = ix86_force_to_memory (GET_MODE (operands[2]), operands[2]);
14533 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
14534 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
14535 gen_rtx_fmt_ee (GET_CODE (operands[3]),
14536 GET_MODE (operands[3]),
14539 ix86_free_from_memory (GET_MODE (operands[2]));
14543 ;; FPU special functions.
14545 (define_expand "sqrtsf2"
14546 [(set (match_operand:SF 0 "register_operand" "")
14547 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
14548 "(! TARGET_NO_FANCY_MATH_387 && TARGET_80387) || TARGET_SSE_MATH"
14550 if (!TARGET_SSE_MATH)
14551 operands[1] = force_reg (SFmode, operands[1]);
14554 (define_insn "sqrtsf2_1"
14555 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
14556 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "0#x,xm#f")))]
14557 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14558 && (TARGET_SSE_MATH && TARGET_MIX_SSE_I387)"
14561 sqrtss\t{%1, %0|%0, %1}"
14562 [(set_attr "type" "fpspc,sse")
14563 (set_attr "mode" "SF,SF")
14564 (set_attr "athlon_decode" "direct,*")])
14566 (define_insn "sqrtsf2_1_sse_only"
14567 [(set (match_operand:SF 0 "register_operand" "=x")
14568 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "xm")))]
14569 "TARGET_SSE_MATH && (!TARGET_80387 || !TARGET_MIX_SSE_I387)"
14570 "sqrtss\t{%1, %0|%0, %1}"
14571 [(set_attr "type" "sse")
14572 (set_attr "mode" "SF")
14573 (set_attr "athlon_decode" "*")])
14575 (define_insn "sqrtsf2_i387"
14576 [(set (match_operand:SF 0 "register_operand" "=f")
14577 (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
14578 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14579 && !TARGET_SSE_MATH"
14581 [(set_attr "type" "fpspc")
14582 (set_attr "mode" "SF")
14583 (set_attr "athlon_decode" "direct")])
14585 (define_expand "sqrtdf2"
14586 [(set (match_operand:DF 0 "register_operand" "")
14587 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
14588 "(! TARGET_NO_FANCY_MATH_387 && TARGET_80387)
14589 || (TARGET_SSE2 && TARGET_SSE_MATH)"
14591 if (!TARGET_SSE2 || !TARGET_SSE_MATH)
14592 operands[1] = force_reg (DFmode, operands[1]);
14595 (define_insn "sqrtdf2_1"
14596 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
14597 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "0#Y,Ym#f")))]
14598 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14599 && (TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387)"
14602 sqrtsd\t{%1, %0|%0, %1}"
14603 [(set_attr "type" "fpspc,sse")
14604 (set_attr "mode" "DF,DF")
14605 (set_attr "athlon_decode" "direct,*")])
14607 (define_insn "sqrtdf2_1_sse_only"
14608 [(set (match_operand:DF 0 "register_operand" "=Y")
14609 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
14610 "TARGET_SSE2 && TARGET_SSE_MATH && (!TARGET_80387 || !TARGET_MIX_SSE_I387)"
14611 "sqrtsd\t{%1, %0|%0, %1}"
14612 [(set_attr "type" "sse")
14613 (set_attr "mode" "DF")
14614 (set_attr "athlon_decode" "*")])
14616 (define_insn "sqrtdf2_i387"
14617 [(set (match_operand:DF 0 "register_operand" "=f")
14618 (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
14619 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14620 && (!TARGET_SSE2 || !TARGET_SSE_MATH)"
14622 [(set_attr "type" "fpspc")
14623 (set_attr "mode" "DF")
14624 (set_attr "athlon_decode" "direct")])
14626 (define_insn "*sqrtextendsfdf2"
14627 [(set (match_operand:DF 0 "register_operand" "=f")
14628 (sqrt:DF (float_extend:DF
14629 (match_operand:SF 1 "register_operand" "0"))))]
14630 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14631 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14633 [(set_attr "type" "fpspc")
14634 (set_attr "mode" "DF")
14635 (set_attr "athlon_decode" "direct")])
14637 (define_insn "sqrtxf2"
14638 [(set (match_operand:XF 0 "register_operand" "=f")
14639 (sqrt:XF (match_operand:XF 1 "register_operand" "0")))]
14640 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387
14641 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
14643 [(set_attr "type" "fpspc")
14644 (set_attr "mode" "XF")
14645 (set_attr "athlon_decode" "direct")])
14647 (define_insn "sqrttf2"
14648 [(set (match_operand:TF 0 "register_operand" "=f")
14649 (sqrt:TF (match_operand:TF 1 "register_operand" "0")))]
14650 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14651 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
14653 [(set_attr "type" "fpspc")
14654 (set_attr "mode" "XF")
14655 (set_attr "athlon_decode" "direct")])
14657 (define_insn "*sqrtextenddfxf2"
14658 [(set (match_operand:XF 0 "register_operand" "=f")
14659 (sqrt:XF (float_extend:XF
14660 (match_operand:DF 1 "register_operand" "0"))))]
14661 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387"
14663 [(set_attr "type" "fpspc")
14664 (set_attr "mode" "XF")
14665 (set_attr "athlon_decode" "direct")])
14667 (define_insn "*sqrtextenddftf2"
14668 [(set (match_operand:TF 0 "register_operand" "=f")
14669 (sqrt:TF (float_extend:TF
14670 (match_operand:DF 1 "register_operand" "0"))))]
14671 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
14673 [(set_attr "type" "fpspc")
14674 (set_attr "mode" "XF")
14675 (set_attr "athlon_decode" "direct")])
14677 (define_insn "*sqrtextendsfxf2"
14678 [(set (match_operand:XF 0 "register_operand" "=f")
14679 (sqrt:XF (float_extend:XF
14680 (match_operand:SF 1 "register_operand" "0"))))]
14681 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387"
14683 [(set_attr "type" "fpspc")
14684 (set_attr "mode" "XF")
14685 (set_attr "athlon_decode" "direct")])
14687 (define_insn "*sqrtextendsftf2"
14688 [(set (match_operand:TF 0 "register_operand" "=f")
14689 (sqrt:TF (float_extend:TF
14690 (match_operand:SF 1 "register_operand" "0"))))]
14691 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
14693 [(set_attr "type" "fpspc")
14694 (set_attr "mode" "XF")
14695 (set_attr "athlon_decode" "direct")])
14697 (define_insn "sindf2"
14698 [(set (match_operand:DF 0 "register_operand" "=f")
14699 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_SIN))]
14700 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14701 && flag_unsafe_math_optimizations"
14703 [(set_attr "type" "fpspc")
14704 (set_attr "mode" "DF")])
14706 (define_insn "sinsf2"
14707 [(set (match_operand:SF 0 "register_operand" "=f")
14708 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_SIN))]
14709 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14710 && flag_unsafe_math_optimizations"
14712 [(set_attr "type" "fpspc")
14713 (set_attr "mode" "SF")])
14715 (define_insn "*sinextendsfdf2"
14716 [(set (match_operand:DF 0 "register_operand" "=f")
14717 (unspec:DF [(float_extend:DF
14718 (match_operand:SF 1 "register_operand" "0"))]
14720 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14721 && flag_unsafe_math_optimizations"
14723 [(set_attr "type" "fpspc")
14724 (set_attr "mode" "DF")])
14726 (define_insn "sinxf2"
14727 [(set (match_operand:XF 0 "register_operand" "=f")
14728 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_SIN))]
14729 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387
14730 && flag_unsafe_math_optimizations"
14732 [(set_attr "type" "fpspc")
14733 (set_attr "mode" "XF")])
14735 (define_insn "sintf2"
14736 [(set (match_operand:TF 0 "register_operand" "=f")
14737 (unspec:TF [(match_operand:TF 1 "register_operand" "0")] UNSPEC_SIN))]
14738 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14739 && flag_unsafe_math_optimizations"
14741 [(set_attr "type" "fpspc")
14742 (set_attr "mode" "XF")])
14744 (define_insn "cosdf2"
14745 [(set (match_operand:DF 0 "register_operand" "=f")
14746 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_COS))]
14747 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14748 && flag_unsafe_math_optimizations"
14750 [(set_attr "type" "fpspc")
14751 (set_attr "mode" "DF")])
14753 (define_insn "cossf2"
14754 [(set (match_operand:SF 0 "register_operand" "=f")
14755 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_COS))]
14756 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14757 && flag_unsafe_math_optimizations"
14759 [(set_attr "type" "fpspc")
14760 (set_attr "mode" "SF")])
14762 (define_insn "*cosextendsfdf2"
14763 [(set (match_operand:DF 0 "register_operand" "=f")
14764 (unspec:DF [(float_extend:DF
14765 (match_operand:SF 1 "register_operand" "0"))]
14767 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14768 && flag_unsafe_math_optimizations"
14770 [(set_attr "type" "fpspc")
14771 (set_attr "mode" "DF")])
14773 (define_insn "cosxf2"
14774 [(set (match_operand:XF 0 "register_operand" "=f")
14775 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_COS))]
14776 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14777 && flag_unsafe_math_optimizations"
14779 [(set_attr "type" "fpspc")
14780 (set_attr "mode" "XF")])
14782 (define_insn "costf2"
14783 [(set (match_operand:TF 0 "register_operand" "=f")
14784 (unspec:TF [(match_operand:TF 1 "register_operand" "0")] UNSPEC_COS))]
14785 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
14786 && flag_unsafe_math_optimizations"
14788 [(set_attr "type" "fpspc")
14789 (set_attr "mode" "XF")])
14791 ;; Block operation instructions
14794 [(set (reg:SI 19) (const_int 0))]
14797 [(set_attr "type" "cld")])
14799 (define_expand "movstrsi"
14800 [(use (match_operand:BLK 0 "memory_operand" ""))
14801 (use (match_operand:BLK 1 "memory_operand" ""))
14802 (use (match_operand:SI 2 "nonmemory_operand" ""))
14803 (use (match_operand:SI 3 "const_int_operand" ""))]
14806 if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3]))
14812 (define_expand "movstrdi"
14813 [(use (match_operand:BLK 0 "memory_operand" ""))
14814 (use (match_operand:BLK 1 "memory_operand" ""))
14815 (use (match_operand:DI 2 "nonmemory_operand" ""))
14816 (use (match_operand:DI 3 "const_int_operand" ""))]
14819 if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3]))
14825 ;; Most CPUs don't like single string operations
14826 ;; Handle this case here to simplify previous expander.
14828 (define_expand "strmovdi_rex64"
14829 [(set (match_dup 2)
14830 (mem:DI (match_operand:DI 1 "register_operand" "")))
14831 (set (mem:DI (match_operand:DI 0 "register_operand" ""))
14833 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 8)))
14834 (clobber (reg:CC 17))])
14835 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 8)))
14836 (clobber (reg:CC 17))])]
14839 if (TARGET_SINGLE_STRINGOP || optimize_size)
14841 emit_insn (gen_strmovdi_rex_1 (operands[0], operands[1], operands[0],
14846 operands[2] = gen_reg_rtx (DImode);
14850 (define_expand "strmovsi"
14851 [(set (match_dup 2)
14852 (mem:SI (match_operand:SI 1 "register_operand" "")))
14853 (set (mem:SI (match_operand:SI 0 "register_operand" ""))
14855 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 4)))
14856 (clobber (reg:CC 17))])
14857 (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 4)))
14858 (clobber (reg:CC 17))])]
14863 emit_insn (gen_strmovsi_rex64 (operands[0], operands[1]));
14866 if (TARGET_SINGLE_STRINGOP || optimize_size)
14868 emit_insn (gen_strmovsi_1 (operands[0], operands[1], operands[0],
14873 operands[2] = gen_reg_rtx (SImode);
14876 (define_expand "strmovsi_rex64"
14877 [(set (match_dup 2)
14878 (mem:SI (match_operand:DI 1 "register_operand" "")))
14879 (set (mem:SI (match_operand:DI 0 "register_operand" ""))
14881 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 4)))
14882 (clobber (reg:CC 17))])
14883 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 4)))
14884 (clobber (reg:CC 17))])]
14887 if (TARGET_SINGLE_STRINGOP || optimize_size)
14889 emit_insn (gen_strmovsi_rex_1 (operands[0], operands[1], operands[0],
14894 operands[2] = gen_reg_rtx (SImode);
14897 (define_expand "strmovhi"
14898 [(set (match_dup 2)
14899 (mem:HI (match_operand:SI 1 "register_operand" "")))
14900 (set (mem:HI (match_operand:SI 0 "register_operand" ""))
14902 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 2)))
14903 (clobber (reg:CC 17))])
14904 (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 2)))
14905 (clobber (reg:CC 17))])]
14910 emit_insn (gen_strmovhi_rex64 (operands[0], operands[1]));
14913 if (TARGET_SINGLE_STRINGOP || optimize_size)
14915 emit_insn (gen_strmovhi_1 (operands[0], operands[1], operands[0],
14920 operands[2] = gen_reg_rtx (HImode);
14923 (define_expand "strmovhi_rex64"
14924 [(set (match_dup 2)
14925 (mem:HI (match_operand:DI 1 "register_operand" "")))
14926 (set (mem:HI (match_operand:DI 0 "register_operand" ""))
14928 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 2)))
14929 (clobber (reg:CC 17))])
14930 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 2)))
14931 (clobber (reg:CC 17))])]
14934 if (TARGET_SINGLE_STRINGOP || optimize_size)
14936 emit_insn (gen_strmovhi_rex_1 (operands[0], operands[1], operands[0],
14941 operands[2] = gen_reg_rtx (HImode);
14944 (define_expand "strmovqi"
14945 [(set (match_dup 2)
14946 (mem:QI (match_operand:SI 1 "register_operand" "")))
14947 (set (mem:QI (match_operand:SI 0 "register_operand" ""))
14949 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
14950 (clobber (reg:CC 17))])
14951 (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 1)))
14952 (clobber (reg:CC 17))])]
14957 emit_insn (gen_strmovqi_rex64 (operands[0], operands[1]));
14960 if (TARGET_SINGLE_STRINGOP || optimize_size)
14962 emit_insn (gen_strmovqi_1 (operands[0], operands[1], operands[0],
14967 operands[2] = gen_reg_rtx (QImode);
14970 (define_expand "strmovqi_rex64"
14971 [(set (match_dup 2)
14972 (mem:QI (match_operand:DI 1 "register_operand" "")))
14973 (set (mem:QI (match_operand:DI 0 "register_operand" ""))
14975 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
14976 (clobber (reg:CC 17))])
14977 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 1)))
14978 (clobber (reg:CC 17))])]
14981 if (TARGET_SINGLE_STRINGOP || optimize_size)
14983 emit_insn (gen_strmovqi_rex_1 (operands[0], operands[1], operands[0],
14988 operands[2] = gen_reg_rtx (QImode);
14991 (define_insn "strmovdi_rex_1"
14992 [(set (mem:DI (match_operand:DI 2 "register_operand" "0"))
14993 (mem:DI (match_operand:DI 3 "register_operand" "1")))
14994 (set (match_operand:DI 0 "register_operand" "=D")
14995 (plus:DI (match_dup 2)
14997 (set (match_operand:DI 1 "register_operand" "=S")
14998 (plus:DI (match_dup 3)
15001 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15003 [(set_attr "type" "str")
15004 (set_attr "mode" "DI")
15005 (set_attr "memory" "both")])
15007 (define_insn "strmovsi_1"
15008 [(set (mem:SI (match_operand:SI 2 "register_operand" "0"))
15009 (mem:SI (match_operand:SI 3 "register_operand" "1")))
15010 (set (match_operand:SI 0 "register_operand" "=D")
15011 (plus:SI (match_dup 2)
15013 (set (match_operand:SI 1 "register_operand" "=S")
15014 (plus:SI (match_dup 3)
15017 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15019 [(set_attr "type" "str")
15020 (set_attr "mode" "SI")
15021 (set_attr "memory" "both")])
15023 (define_insn "strmovsi_rex_1"
15024 [(set (mem:SI (match_operand:DI 2 "register_operand" "0"))
15025 (mem:SI (match_operand:DI 3 "register_operand" "1")))
15026 (set (match_operand:DI 0 "register_operand" "=D")
15027 (plus:DI (match_dup 2)
15029 (set (match_operand:DI 1 "register_operand" "=S")
15030 (plus:DI (match_dup 3)
15033 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15035 [(set_attr "type" "str")
15036 (set_attr "mode" "SI")
15037 (set_attr "memory" "both")])
15039 (define_insn "strmovhi_1"
15040 [(set (mem:HI (match_operand:SI 2 "register_operand" "0"))
15041 (mem:HI (match_operand:SI 3 "register_operand" "1")))
15042 (set (match_operand:SI 0 "register_operand" "=D")
15043 (plus:SI (match_dup 2)
15045 (set (match_operand:SI 1 "register_operand" "=S")
15046 (plus:SI (match_dup 3)
15049 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15051 [(set_attr "type" "str")
15052 (set_attr "memory" "both")
15053 (set_attr "mode" "HI")])
15055 (define_insn "strmovhi_rex_1"
15056 [(set (mem:HI (match_operand:DI 2 "register_operand" "0"))
15057 (mem:HI (match_operand:DI 3 "register_operand" "1")))
15058 (set (match_operand:DI 0 "register_operand" "=D")
15059 (plus:DI (match_dup 2)
15061 (set (match_operand:DI 1 "register_operand" "=S")
15062 (plus:DI (match_dup 3)
15065 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15067 [(set_attr "type" "str")
15068 (set_attr "memory" "both")
15069 (set_attr "mode" "HI")])
15071 (define_insn "strmovqi_1"
15072 [(set (mem:QI (match_operand:SI 2 "register_operand" "0"))
15073 (mem:QI (match_operand:SI 3 "register_operand" "1")))
15074 (set (match_operand:SI 0 "register_operand" "=D")
15075 (plus:SI (match_dup 2)
15077 (set (match_operand:SI 1 "register_operand" "=S")
15078 (plus:SI (match_dup 3)
15081 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15083 [(set_attr "type" "str")
15084 (set_attr "memory" "both")
15085 (set_attr "mode" "QI")])
15087 (define_insn "strmovqi_rex_1"
15088 [(set (mem:QI (match_operand:DI 2 "register_operand" "0"))
15089 (mem:QI (match_operand:DI 3 "register_operand" "1")))
15090 (set (match_operand:DI 0 "register_operand" "=D")
15091 (plus:DI (match_dup 2)
15093 (set (match_operand:DI 1 "register_operand" "=S")
15094 (plus:DI (match_dup 3)
15097 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15099 [(set_attr "type" "str")
15100 (set_attr "memory" "both")
15101 (set_attr "mode" "QI")])
15103 (define_insn "rep_movdi_rex64"
15104 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
15105 (set (match_operand:DI 0 "register_operand" "=D")
15106 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
15108 (match_operand:DI 3 "register_operand" "0")))
15109 (set (match_operand:DI 1 "register_operand" "=S")
15110 (plus:DI (ashift:DI (match_dup 5) (const_int 3))
15111 (match_operand:DI 4 "register_operand" "1")))
15112 (set (mem:BLK (match_dup 3))
15113 (mem:BLK (match_dup 4)))
15114 (use (match_dup 5))
15117 "{rep\;movsq|rep movsq}"
15118 [(set_attr "type" "str")
15119 (set_attr "prefix_rep" "1")
15120 (set_attr "memory" "both")
15121 (set_attr "mode" "DI")])
15123 (define_insn "rep_movsi"
15124 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
15125 (set (match_operand:SI 0 "register_operand" "=D")
15126 (plus:SI (ashift:SI (match_operand:SI 5 "register_operand" "2")
15128 (match_operand:SI 3 "register_operand" "0")))
15129 (set (match_operand:SI 1 "register_operand" "=S")
15130 (plus:SI (ashift:SI (match_dup 5) (const_int 2))
15131 (match_operand:SI 4 "register_operand" "1")))
15132 (set (mem:BLK (match_dup 3))
15133 (mem:BLK (match_dup 4)))
15134 (use (match_dup 5))
15137 "{rep\;movsl|rep movsd}"
15138 [(set_attr "type" "str")
15139 (set_attr "prefix_rep" "1")
15140 (set_attr "memory" "both")
15141 (set_attr "mode" "SI")])
15143 (define_insn "rep_movsi_rex64"
15144 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
15145 (set (match_operand:DI 0 "register_operand" "=D")
15146 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
15148 (match_operand:DI 3 "register_operand" "0")))
15149 (set (match_operand:DI 1 "register_operand" "=S")
15150 (plus:DI (ashift:DI (match_dup 5) (const_int 2))
15151 (match_operand:DI 4 "register_operand" "1")))
15152 (set (mem:BLK (match_dup 3))
15153 (mem:BLK (match_dup 4)))
15154 (use (match_dup 5))
15157 "{rep\;movsl|rep movsd}"
15158 [(set_attr "type" "str")
15159 (set_attr "prefix_rep" "1")
15160 (set_attr "memory" "both")
15161 (set_attr "mode" "SI")])
15163 (define_insn "rep_movqi"
15164 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
15165 (set (match_operand:SI 0 "register_operand" "=D")
15166 (plus:SI (match_operand:SI 3 "register_operand" "0")
15167 (match_operand:SI 5 "register_operand" "2")))
15168 (set (match_operand:SI 1 "register_operand" "=S")
15169 (plus:SI (match_operand:SI 4 "register_operand" "1") (match_dup 5)))
15170 (set (mem:BLK (match_dup 3))
15171 (mem:BLK (match_dup 4)))
15172 (use (match_dup 5))
15175 "{rep\;movsb|rep movsb}"
15176 [(set_attr "type" "str")
15177 (set_attr "prefix_rep" "1")
15178 (set_attr "memory" "both")
15179 (set_attr "mode" "SI")])
15181 (define_insn "rep_movqi_rex64"
15182 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
15183 (set (match_operand:DI 0 "register_operand" "=D")
15184 (plus:DI (match_operand:DI 3 "register_operand" "0")
15185 (match_operand:DI 5 "register_operand" "2")))
15186 (set (match_operand:DI 1 "register_operand" "=S")
15187 (plus:DI (match_operand:DI 4 "register_operand" "1") (match_dup 5)))
15188 (set (mem:BLK (match_dup 3))
15189 (mem:BLK (match_dup 4)))
15190 (use (match_dup 5))
15193 "{rep\;movsb|rep movsb}"
15194 [(set_attr "type" "str")
15195 (set_attr "prefix_rep" "1")
15196 (set_attr "memory" "both")
15197 (set_attr "mode" "SI")])
15199 (define_expand "clrstrsi"
15200 [(use (match_operand:BLK 0 "memory_operand" ""))
15201 (use (match_operand:SI 1 "nonmemory_operand" ""))
15202 (use (match_operand 2 "const_int_operand" ""))]
15205 if (ix86_expand_clrstr (operands[0], operands[1], operands[2]))
15211 (define_expand "clrstrdi"
15212 [(use (match_operand:BLK 0 "memory_operand" ""))
15213 (use (match_operand:DI 1 "nonmemory_operand" ""))
15214 (use (match_operand 2 "const_int_operand" ""))]
15217 if (ix86_expand_clrstr (operands[0], operands[1], operands[2]))
15223 ;; Most CPUs don't like single string operations
15224 ;; Handle this case here to simplify previous expander.
15226 (define_expand "strsetdi_rex64"
15227 [(set (mem:DI (match_operand:DI 0 "register_operand" ""))
15228 (match_operand:DI 1 "register_operand" ""))
15229 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 8)))
15230 (clobber (reg:CC 17))])]
15233 if (TARGET_SINGLE_STRINGOP || optimize_size)
15235 emit_insn (gen_strsetdi_rex_1 (operands[0], operands[0], operands[1]));
15240 (define_expand "strsetsi"
15241 [(set (mem:SI (match_operand:SI 0 "register_operand" ""))
15242 (match_operand:SI 1 "register_operand" ""))
15243 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 4)))
15244 (clobber (reg:CC 17))])]
15249 emit_insn (gen_strsetsi_rex64 (operands[0], operands[1]));
15252 else if (TARGET_SINGLE_STRINGOP || optimize_size)
15254 emit_insn (gen_strsetsi_1 (operands[0], operands[0], operands[1]));
15259 (define_expand "strsetsi_rex64"
15260 [(set (mem:SI (match_operand:DI 0 "register_operand" ""))
15261 (match_operand:SI 1 "register_operand" ""))
15262 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 4)))
15263 (clobber (reg:CC 17))])]
15266 if (TARGET_SINGLE_STRINGOP || optimize_size)
15268 emit_insn (gen_strsetsi_rex_1 (operands[0], operands[0], operands[1]));
15273 (define_expand "strsethi"
15274 [(set (mem:HI (match_operand:SI 0 "register_operand" ""))
15275 (match_operand:HI 1 "register_operand" ""))
15276 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 2)))
15277 (clobber (reg:CC 17))])]
15282 emit_insn (gen_strsethi_rex64 (operands[0], operands[1]));
15285 else if (TARGET_SINGLE_STRINGOP || optimize_size)
15287 emit_insn (gen_strsethi_1 (operands[0], operands[0], operands[1]));
15292 (define_expand "strsethi_rex64"
15293 [(set (mem:HI (match_operand:DI 0 "register_operand" ""))
15294 (match_operand:HI 1 "register_operand" ""))
15295 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 2)))
15296 (clobber (reg:CC 17))])]
15299 if (TARGET_SINGLE_STRINGOP || optimize_size)
15301 emit_insn (gen_strsethi_rex_1 (operands[0], operands[0], operands[1]));
15306 (define_expand "strsetqi"
15307 [(set (mem:QI (match_operand:SI 0 "register_operand" ""))
15308 (match_operand:QI 1 "register_operand" ""))
15309 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
15310 (clobber (reg:CC 17))])]
15315 emit_insn (gen_strsetqi_rex64 (operands[0], operands[1]));
15318 else if (TARGET_SINGLE_STRINGOP || optimize_size)
15320 emit_insn (gen_strsetqi_1 (operands[0], operands[0], operands[1]));
15325 (define_expand "strsetqi_rex64"
15326 [(set (mem:QI (match_operand:DI 0 "register_operand" ""))
15327 (match_operand:QI 1 "register_operand" ""))
15328 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
15329 (clobber (reg:CC 17))])]
15332 if (TARGET_SINGLE_STRINGOP || optimize_size)
15334 emit_insn (gen_strsetqi_rex_1 (operands[0], operands[0], operands[1]));
15339 (define_insn "strsetdi_rex_1"
15340 [(set (mem:SI (match_operand:DI 1 "register_operand" "0"))
15341 (match_operand:SI 2 "register_operand" "a"))
15342 (set (match_operand:DI 0 "register_operand" "=D")
15343 (plus:DI (match_dup 1)
15346 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15348 [(set_attr "type" "str")
15349 (set_attr "memory" "store")
15350 (set_attr "mode" "DI")])
15352 (define_insn "strsetsi_1"
15353 [(set (mem:SI (match_operand:SI 1 "register_operand" "0"))
15354 (match_operand:SI 2 "register_operand" "a"))
15355 (set (match_operand:SI 0 "register_operand" "=D")
15356 (plus:SI (match_dup 1)
15359 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15361 [(set_attr "type" "str")
15362 (set_attr "memory" "store")
15363 (set_attr "mode" "SI")])
15365 (define_insn "strsetsi_rex_1"
15366 [(set (mem:SI (match_operand:DI 1 "register_operand" "0"))
15367 (match_operand:SI 2 "register_operand" "a"))
15368 (set (match_operand:DI 0 "register_operand" "=D")
15369 (plus:DI (match_dup 1)
15372 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15374 [(set_attr "type" "str")
15375 (set_attr "memory" "store")
15376 (set_attr "mode" "SI")])
15378 (define_insn "strsethi_1"
15379 [(set (mem:HI (match_operand:SI 1 "register_operand" "0"))
15380 (match_operand:HI 2 "register_operand" "a"))
15381 (set (match_operand:SI 0 "register_operand" "=D")
15382 (plus:SI (match_dup 1)
15385 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15387 [(set_attr "type" "str")
15388 (set_attr "memory" "store")
15389 (set_attr "mode" "HI")])
15391 (define_insn "strsethi_rex_1"
15392 [(set (mem:HI (match_operand:DI 1 "register_operand" "0"))
15393 (match_operand:HI 2 "register_operand" "a"))
15394 (set (match_operand:DI 0 "register_operand" "=D")
15395 (plus:DI (match_dup 1)
15398 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15400 [(set_attr "type" "str")
15401 (set_attr "memory" "store")
15402 (set_attr "mode" "HI")])
15404 (define_insn "strsetqi_1"
15405 [(set (mem:QI (match_operand:SI 1 "register_operand" "0"))
15406 (match_operand:QI 2 "register_operand" "a"))
15407 (set (match_operand:SI 0 "register_operand" "=D")
15408 (plus:SI (match_dup 1)
15411 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15413 [(set_attr "type" "str")
15414 (set_attr "memory" "store")
15415 (set_attr "mode" "QI")])
15417 (define_insn "strsetqi_rex_1"
15418 [(set (mem:QI (match_operand:DI 1 "register_operand" "0"))
15419 (match_operand:QI 2 "register_operand" "a"))
15420 (set (match_operand:DI 0 "register_operand" "=D")
15421 (plus:DI (match_dup 1)
15424 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15426 [(set_attr "type" "str")
15427 (set_attr "memory" "store")
15428 (set_attr "mode" "QI")])
15430 (define_insn "rep_stosdi_rex64"
15431 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
15432 (set (match_operand:DI 0 "register_operand" "=D")
15433 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
15435 (match_operand:DI 3 "register_operand" "0")))
15436 (set (mem:BLK (match_dup 3))
15438 (use (match_operand:DI 2 "register_operand" "a"))
15439 (use (match_dup 4))
15442 "{rep\;stosq|rep stosq}"
15443 [(set_attr "type" "str")
15444 (set_attr "prefix_rep" "1")
15445 (set_attr "memory" "store")
15446 (set_attr "mode" "DI")])
15448 (define_insn "rep_stossi"
15449 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
15450 (set (match_operand:SI 0 "register_operand" "=D")
15451 (plus:SI (ashift:SI (match_operand:SI 4 "register_operand" "1")
15453 (match_operand:SI 3 "register_operand" "0")))
15454 (set (mem:BLK (match_dup 3))
15456 (use (match_operand:SI 2 "register_operand" "a"))
15457 (use (match_dup 4))
15460 "{rep\;stosl|rep stosd}"
15461 [(set_attr "type" "str")
15462 (set_attr "prefix_rep" "1")
15463 (set_attr "memory" "store")
15464 (set_attr "mode" "SI")])
15466 (define_insn "rep_stossi_rex64"
15467 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
15468 (set (match_operand:DI 0 "register_operand" "=D")
15469 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
15471 (match_operand:DI 3 "register_operand" "0")))
15472 (set (mem:BLK (match_dup 3))
15474 (use (match_operand:SI 2 "register_operand" "a"))
15475 (use (match_dup 4))
15478 "{rep\;stosl|rep stosd}"
15479 [(set_attr "type" "str")
15480 (set_attr "prefix_rep" "1")
15481 (set_attr "memory" "store")
15482 (set_attr "mode" "SI")])
15484 (define_insn "rep_stosqi"
15485 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
15486 (set (match_operand:SI 0 "register_operand" "=D")
15487 (plus:SI (match_operand:SI 3 "register_operand" "0")
15488 (match_operand:SI 4 "register_operand" "1")))
15489 (set (mem:BLK (match_dup 3))
15491 (use (match_operand:QI 2 "register_operand" "a"))
15492 (use (match_dup 4))
15495 "{rep\;stosb|rep stosb}"
15496 [(set_attr "type" "str")
15497 (set_attr "prefix_rep" "1")
15498 (set_attr "memory" "store")
15499 (set_attr "mode" "QI")])
15501 (define_insn "rep_stosqi_rex64"
15502 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
15503 (set (match_operand:DI 0 "register_operand" "=D")
15504 (plus:DI (match_operand:DI 3 "register_operand" "0")
15505 (match_operand:DI 4 "register_operand" "1")))
15506 (set (mem:BLK (match_dup 3))
15508 (use (match_operand:QI 2 "register_operand" "a"))
15509 (use (match_dup 4))
15512 "{rep\;stosb|rep stosb}"
15513 [(set_attr "type" "str")
15514 (set_attr "prefix_rep" "1")
15515 (set_attr "memory" "store")
15516 (set_attr "mode" "QI")])
15518 (define_expand "cmpstrsi"
15519 [(set (match_operand:SI 0 "register_operand" "")
15520 (compare:SI (match_operand:BLK 1 "general_operand" "")
15521 (match_operand:BLK 2 "general_operand" "")))
15522 (use (match_operand 3 "general_operand" ""))
15523 (use (match_operand 4 "immediate_operand" ""))]
15526 rtx addr1, addr2, out, outlow, count, countreg, align;
15529 if (GET_CODE (out) != REG)
15530 out = gen_reg_rtx (SImode);
15532 addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
15533 addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0));
15535 count = operands[3];
15536 countreg = ix86_zero_extend_to_Pmode (count);
15538 /* %%% Iff we are testing strict equality, we can use known alignment
15539 to good advantage. This may be possible with combine, particularly
15540 once cc0 is dead. */
15541 align = operands[4];
15543 emit_insn (gen_cld ());
15544 if (GET_CODE (count) == CONST_INT)
15546 if (INTVAL (count) == 0)
15548 emit_move_insn (operands[0], const0_rtx);
15552 emit_insn (gen_cmpstrqi_nz_rex_1 (addr1, addr2, countreg, align,
15553 addr1, addr2, countreg));
15555 emit_insn (gen_cmpstrqi_nz_1 (addr1, addr2, countreg, align,
15556 addr1, addr2, countreg));
15562 emit_insn (gen_cmpdi_1_rex64 (countreg, countreg));
15563 emit_insn (gen_cmpstrqi_rex_1 (addr1, addr2, countreg, align,
15564 addr1, addr2, countreg));
15568 emit_insn (gen_cmpsi_1 (countreg, countreg));
15569 emit_insn (gen_cmpstrqi_1 (addr1, addr2, countreg, align,
15570 addr1, addr2, countreg));
15574 outlow = gen_lowpart (QImode, out);
15575 emit_insn (gen_cmpintqi (outlow));
15576 emit_move_insn (out, gen_rtx_SIGN_EXTEND (SImode, outlow));
15578 if (operands[0] != out)
15579 emit_move_insn (operands[0], out);
15584 ;; Produce a tri-state integer (-1, 0, 1) from condition codes.
15586 (define_expand "cmpintqi"
15587 [(set (match_dup 1)
15588 (gtu:QI (reg:CC 17) (const_int 0)))
15590 (ltu:QI (reg:CC 17) (const_int 0)))
15591 (parallel [(set (match_operand:QI 0 "register_operand" "")
15592 (minus:QI (match_dup 1)
15594 (clobber (reg:CC 17))])]
15596 "operands[1] = gen_reg_rtx (QImode);
15597 operands[2] = gen_reg_rtx (QImode);")
15599 ;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is
15600 ;; zero. Emit extra code to make sure that a zero-length compare is EQ.
15602 (define_insn "cmpstrqi_nz_1"
15604 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
15605 (mem:BLK (match_operand:SI 5 "register_operand" "1"))))
15606 (use (match_operand:SI 6 "register_operand" "2"))
15607 (use (match_operand:SI 3 "immediate_operand" "i"))
15609 (clobber (match_operand:SI 0 "register_operand" "=S"))
15610 (clobber (match_operand:SI 1 "register_operand" "=D"))
15611 (clobber (match_operand:SI 2 "register_operand" "=c"))]
15614 [(set_attr "type" "str")
15615 (set_attr "mode" "QI")
15616 (set_attr "prefix_rep" "1")])
15618 (define_insn "cmpstrqi_nz_rex_1"
15620 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
15621 (mem:BLK (match_operand:DI 5 "register_operand" "1"))))
15622 (use (match_operand:DI 6 "register_operand" "2"))
15623 (use (match_operand:SI 3 "immediate_operand" "i"))
15625 (clobber (match_operand:DI 0 "register_operand" "=S"))
15626 (clobber (match_operand:DI 1 "register_operand" "=D"))
15627 (clobber (match_operand:DI 2 "register_operand" "=c"))]
15630 [(set_attr "type" "str")
15631 (set_attr "mode" "QI")
15632 (set_attr "prefix_rep" "1")])
15634 ;; The same, but the count is not known to not be zero.
15636 (define_insn "cmpstrqi_1"
15638 (if_then_else:CC (ne (match_operand:SI 6 "register_operand" "2")
15640 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
15641 (mem:BLK (match_operand:SI 5 "register_operand" "1")))
15643 (use (match_operand:SI 3 "immediate_operand" "i"))
15646 (clobber (match_operand:SI 0 "register_operand" "=S"))
15647 (clobber (match_operand:SI 1 "register_operand" "=D"))
15648 (clobber (match_operand:SI 2 "register_operand" "=c"))]
15651 [(set_attr "type" "str")
15652 (set_attr "mode" "QI")
15653 (set_attr "prefix_rep" "1")])
15655 (define_insn "cmpstrqi_rex_1"
15657 (if_then_else:CC (ne (match_operand:DI 6 "register_operand" "2")
15659 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
15660 (mem:BLK (match_operand:DI 5 "register_operand" "1")))
15662 (use (match_operand:SI 3 "immediate_operand" "i"))
15665 (clobber (match_operand:DI 0 "register_operand" "=S"))
15666 (clobber (match_operand:DI 1 "register_operand" "=D"))
15667 (clobber (match_operand:DI 2 "register_operand" "=c"))]
15670 [(set_attr "type" "str")
15671 (set_attr "mode" "QI")
15672 (set_attr "prefix_rep" "1")])
15674 (define_expand "strlensi"
15675 [(set (match_operand:SI 0 "register_operand" "")
15676 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
15677 (match_operand:QI 2 "immediate_operand" "")
15678 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
15681 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
15687 (define_expand "strlendi"
15688 [(set (match_operand:DI 0 "register_operand" "")
15689 (unspec:DI [(match_operand:BLK 1 "general_operand" "")
15690 (match_operand:QI 2 "immediate_operand" "")
15691 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
15694 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
15700 (define_insn "strlenqi_1"
15701 [(set (match_operand:SI 0 "register_operand" "=&c")
15702 (unspec:SI [(mem:BLK (match_operand:SI 5 "register_operand" "1"))
15703 (match_operand:QI 2 "register_operand" "a")
15704 (match_operand:SI 3 "immediate_operand" "i")
15705 (match_operand:SI 4 "register_operand" "0")] UNSPEC_SCAS))
15707 (clobber (match_operand:SI 1 "register_operand" "=D"))
15708 (clobber (reg:CC 17))]
15711 [(set_attr "type" "str")
15712 (set_attr "mode" "QI")
15713 (set_attr "prefix_rep" "1")])
15715 (define_insn "strlenqi_rex_1"
15716 [(set (match_operand:DI 0 "register_operand" "=&c")
15717 (unspec:DI [(mem:BLK (match_operand:DI 5 "register_operand" "1"))
15718 (match_operand:QI 2 "register_operand" "a")
15719 (match_operand:DI 3 "immediate_operand" "i")
15720 (match_operand:DI 4 "register_operand" "0")] UNSPEC_SCAS))
15722 (clobber (match_operand:DI 1 "register_operand" "=D"))
15723 (clobber (reg:CC 17))]
15726 [(set_attr "type" "str")
15727 (set_attr "mode" "QI")
15728 (set_attr "prefix_rep" "1")])
15730 ;; Peephole optimizations to clean up after cmpstr*. This should be
15731 ;; handled in combine, but it is not currently up to the task.
15732 ;; When used for their truth value, the cmpstr* expanders generate
15741 ;; The intermediate three instructions are unnecessary.
15743 ;; This one handles cmpstr*_nz_1...
15747 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
15748 (mem:BLK (match_operand 5 "register_operand" ""))))
15749 (use (match_operand 6 "register_operand" ""))
15750 (use (match_operand:SI 3 "immediate_operand" ""))
15752 (clobber (match_operand 0 "register_operand" ""))
15753 (clobber (match_operand 1 "register_operand" ""))
15754 (clobber (match_operand 2 "register_operand" ""))])
15755 (set (match_operand:QI 7 "register_operand" "")
15756 (gtu:QI (reg:CC 17) (const_int 0)))
15757 (set (match_operand:QI 8 "register_operand" "")
15758 (ltu:QI (reg:CC 17) (const_int 0)))
15760 (compare (match_dup 7) (match_dup 8)))
15762 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
15765 (compare:CC (mem:BLK (match_dup 4))
15766 (mem:BLK (match_dup 5))))
15767 (use (match_dup 6))
15768 (use (match_dup 3))
15770 (clobber (match_dup 0))
15771 (clobber (match_dup 1))
15772 (clobber (match_dup 2))])]
15775 ;; ...and this one handles cmpstr*_1.
15779 (if_then_else:CC (ne (match_operand 6 "register_operand" "")
15781 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
15782 (mem:BLK (match_operand 5 "register_operand" "")))
15784 (use (match_operand:SI 3 "immediate_operand" ""))
15787 (clobber (match_operand 0 "register_operand" ""))
15788 (clobber (match_operand 1 "register_operand" ""))
15789 (clobber (match_operand 2 "register_operand" ""))])
15790 (set (match_operand:QI 7 "register_operand" "")
15791 (gtu:QI (reg:CC 17) (const_int 0)))
15792 (set (match_operand:QI 8 "register_operand" "")
15793 (ltu:QI (reg:CC 17) (const_int 0)))
15795 (compare (match_dup 7) (match_dup 8)))
15797 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
15800 (if_then_else:CC (ne (match_dup 6)
15802 (compare:CC (mem:BLK (match_dup 4))
15803 (mem:BLK (match_dup 5)))
15805 (use (match_dup 3))
15808 (clobber (match_dup 0))
15809 (clobber (match_dup 1))
15810 (clobber (match_dup 2))])]
15815 ;; Conditional move instructions.
15817 (define_expand "movdicc"
15818 [(set (match_operand:DI 0 "register_operand" "")
15819 (if_then_else:DI (match_operand 1 "comparison_operator" "")
15820 (match_operand:DI 2 "general_operand" "")
15821 (match_operand:DI 3 "general_operand" "")))]
15823 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
15825 (define_insn "x86_movdicc_0_m1_rex64"
15826 [(set (match_operand:DI 0 "register_operand" "=r")
15827 (if_then_else:DI (ltu (reg:CC 17) (const_int 0))
15830 (clobber (reg:CC 17))]
15833 ; Since we don't have the proper number of operands for an alu insn,
15834 ; fill in all the blanks.
15835 [(set_attr "type" "alu")
15836 (set_attr "pent_pair" "pu")
15837 (set_attr "memory" "none")
15838 (set_attr "imm_disp" "false")
15839 (set_attr "mode" "DI")
15840 (set_attr "length_immediate" "0")])
15842 (define_insn "*movdicc_c_rex64"
15843 [(set (match_operand:DI 0 "register_operand" "=r,r")
15844 (if_then_else:DI (match_operator 1 "ix86_comparison_operator"
15845 [(reg 17) (const_int 0)])
15846 (match_operand:DI 2 "nonimmediate_operand" "rm,0")
15847 (match_operand:DI 3 "nonimmediate_operand" "0,rm")))]
15848 "TARGET_64BIT && TARGET_CMOVE
15849 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
15851 cmov%O2%C1\t{%2, %0|%0, %2}
15852 cmov%O2%c1\t{%3, %0|%0, %3}"
15853 [(set_attr "type" "icmov")
15854 (set_attr "mode" "DI")])
15856 (define_expand "movsicc"
15857 [(set (match_operand:SI 0 "register_operand" "")
15858 (if_then_else:SI (match_operand 1 "comparison_operator" "")
15859 (match_operand:SI 2 "general_operand" "")
15860 (match_operand:SI 3 "general_operand" "")))]
15862 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
15864 ;; Data flow gets confused by our desire for `sbbl reg,reg', and clearing
15865 ;; the register first winds up with `sbbl $0,reg', which is also weird.
15866 ;; So just document what we're doing explicitly.
15868 (define_insn "x86_movsicc_0_m1"
15869 [(set (match_operand:SI 0 "register_operand" "=r")
15870 (if_then_else:SI (ltu (reg:CC 17) (const_int 0))
15873 (clobber (reg:CC 17))]
15876 ; Since we don't have the proper number of operands for an alu insn,
15877 ; fill in all the blanks.
15878 [(set_attr "type" "alu")
15879 (set_attr "pent_pair" "pu")
15880 (set_attr "memory" "none")
15881 (set_attr "imm_disp" "false")
15882 (set_attr "mode" "SI")
15883 (set_attr "length_immediate" "0")])
15885 (define_insn "*movsicc_noc"
15886 [(set (match_operand:SI 0 "register_operand" "=r,r")
15887 (if_then_else:SI (match_operator 1 "ix86_comparison_operator"
15888 [(reg 17) (const_int 0)])
15889 (match_operand:SI 2 "nonimmediate_operand" "rm,0")
15890 (match_operand:SI 3 "nonimmediate_operand" "0,rm")))]
15892 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
15894 cmov%O2%C1\t{%2, %0|%0, %2}
15895 cmov%O2%c1\t{%3, %0|%0, %3}"
15896 [(set_attr "type" "icmov")
15897 (set_attr "mode" "SI")])
15899 (define_expand "movhicc"
15900 [(set (match_operand:HI 0 "register_operand" "")
15901 (if_then_else:HI (match_operand 1 "comparison_operator" "")
15902 (match_operand:HI 2 "nonimmediate_operand" "")
15903 (match_operand:HI 3 "nonimmediate_operand" "")))]
15904 "TARGET_CMOVE && TARGET_HIMODE_MATH"
15905 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
15907 (define_insn "*movhicc_noc"
15908 [(set (match_operand:HI 0 "register_operand" "=r,r")
15909 (if_then_else:HI (match_operator 1 "ix86_comparison_operator"
15910 [(reg 17) (const_int 0)])
15911 (match_operand:HI 2 "nonimmediate_operand" "rm,0")
15912 (match_operand:HI 3 "nonimmediate_operand" "0,rm")))]
15914 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
15916 cmov%O2%C1\t{%2, %0|%0, %2}
15917 cmov%O2%c1\t{%3, %0|%0, %3}"
15918 [(set_attr "type" "icmov")
15919 (set_attr "mode" "HI")])
15921 (define_expand "movsfcc"
15922 [(set (match_operand:SF 0 "register_operand" "")
15923 (if_then_else:SF (match_operand 1 "comparison_operator" "")
15924 (match_operand:SF 2 "register_operand" "")
15925 (match_operand:SF 3 "register_operand" "")))]
15927 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
15929 (define_insn "*movsfcc_1"
15930 [(set (match_operand:SF 0 "register_operand" "=f,f,r,r")
15931 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
15932 [(reg 17) (const_int 0)])
15933 (match_operand:SF 2 "nonimmediate_operand" "f,0,rm,0")
15934 (match_operand:SF 3 "nonimmediate_operand" "0,f,0,rm")))]
15936 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
15938 fcmov%F1\t{%2, %0|%0, %2}
15939 fcmov%f1\t{%3, %0|%0, %3}
15940 cmov%O2%C1\t{%2, %0|%0, %2}
15941 cmov%O2%c1\t{%3, %0|%0, %3}"
15942 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
15943 (set_attr "mode" "SF,SF,SI,SI")])
15945 (define_expand "movdfcc"
15946 [(set (match_operand:DF 0 "register_operand" "")
15947 (if_then_else:DF (match_operand 1 "comparison_operator" "")
15948 (match_operand:DF 2 "register_operand" "")
15949 (match_operand:DF 3 "register_operand" "")))]
15951 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
15953 (define_insn "*movdfcc_1"
15954 [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r")
15955 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
15956 [(reg 17) (const_int 0)])
15957 (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0")
15958 (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))]
15959 "!TARGET_64BIT && TARGET_CMOVE
15960 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
15962 fcmov%F1\t{%2, %0|%0, %2}
15963 fcmov%f1\t{%3, %0|%0, %3}
15966 [(set_attr "type" "fcmov,fcmov,multi,multi")
15967 (set_attr "mode" "DF")])
15969 (define_insn "*movdfcc_1_rex64"
15970 [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r")
15971 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
15972 [(reg 17) (const_int 0)])
15973 (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0")
15974 (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))]
15975 "TARGET_64BIT && TARGET_CMOVE
15976 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
15978 fcmov%F1\t{%2, %0|%0, %2}
15979 fcmov%f1\t{%3, %0|%0, %3}
15980 cmov%O2%C1\t{%2, %0|%0, %2}
15981 cmov%O2%c1\t{%3, %0|%0, %3}"
15982 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
15983 (set_attr "mode" "DF")])
15986 [(set (match_operand:DF 0 "register_operand" "")
15987 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
15988 [(match_operand 4 "" "") (const_int 0)])
15989 (match_operand:DF 2 "nonimmediate_operand" "")
15990 (match_operand:DF 3 "nonimmediate_operand" "")))]
15991 "!TARGET_64BIT && !ANY_FP_REG_P (operands[0]) && reload_completed"
15992 [(set (match_dup 2)
15993 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
15997 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
16000 "split_di (operands+2, 1, operands+5, operands+6);
16001 split_di (operands+3, 1, operands+7, operands+8);
16002 split_di (operands, 1, operands+2, operands+3);")
16004 (define_expand "movxfcc"
16005 [(set (match_operand:XF 0 "register_operand" "")
16006 (if_then_else:XF (match_operand 1 "comparison_operator" "")
16007 (match_operand:XF 2 "register_operand" "")
16008 (match_operand:XF 3 "register_operand" "")))]
16009 "!TARGET_64BIT && TARGET_CMOVE"
16010 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
16012 (define_expand "movtfcc"
16013 [(set (match_operand:TF 0 "register_operand" "")
16014 (if_then_else:TF (match_operand 1 "comparison_operator" "")
16015 (match_operand:TF 2 "register_operand" "")
16016 (match_operand:TF 3 "register_operand" "")))]
16018 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
16020 (define_insn "*movxfcc_1"
16021 [(set (match_operand:XF 0 "register_operand" "=f,f")
16022 (if_then_else:XF (match_operator 1 "fcmov_comparison_operator"
16023 [(reg 17) (const_int 0)])
16024 (match_operand:XF 2 "register_operand" "f,0")
16025 (match_operand:XF 3 "register_operand" "0,f")))]
16026 "!TARGET_64BIT && TARGET_CMOVE"
16028 fcmov%F1\t{%2, %0|%0, %2}
16029 fcmov%f1\t{%3, %0|%0, %3}"
16030 [(set_attr "type" "fcmov")
16031 (set_attr "mode" "XF")])
16033 (define_insn "*movtfcc_1"
16034 [(set (match_operand:TF 0 "register_operand" "=f,f")
16035 (if_then_else:TF (match_operator 1 "fcmov_comparison_operator"
16036 [(reg 17) (const_int 0)])
16037 (match_operand:TF 2 "register_operand" "f,0")
16038 (match_operand:TF 3 "register_operand" "0,f")))]
16041 fcmov%F1\t{%2, %0|%0, %2}
16042 fcmov%f1\t{%3, %0|%0, %3}"
16043 [(set_attr "type" "fcmov")
16044 (set_attr "mode" "XF")])
16046 (define_expand "minsf3"
16048 (set (match_operand:SF 0 "register_operand" "")
16049 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
16050 (match_operand:SF 2 "nonimmediate_operand" ""))
16053 (clobber (reg:CC 17))])]
16057 (define_insn "*minsf"
16058 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
16059 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0,0,f#x")
16060 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
16063 (clobber (reg:CC 17))]
16064 "TARGET_SSE && TARGET_IEEE_FP"
16067 (define_insn "*minsf_nonieee"
16068 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
16069 (if_then_else:SF (lt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
16070 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
16073 (clobber (reg:CC 17))]
16074 "TARGET_SSE && !TARGET_IEEE_FP
16075 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16079 [(set (match_operand:SF 0 "register_operand" "")
16080 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
16081 (match_operand:SF 2 "nonimmediate_operand" ""))
16082 (match_operand:SF 3 "register_operand" "")
16083 (match_operand:SF 4 "nonimmediate_operand" "")))
16084 (clobber (reg:CC 17))]
16085 "SSE_REG_P (operands[0]) && reload_completed
16086 && ((operands_match_p (operands[1], operands[3])
16087 && operands_match_p (operands[2], operands[4]))
16088 || (operands_match_p (operands[1], operands[4])
16089 && operands_match_p (operands[2], operands[3])))"
16090 [(set (match_dup 0)
16091 (if_then_else:SF (lt (match_dup 1)
16096 ;; We can't represent the LT test directly. Do this by swapping the operands.
16099 [(set (match_operand:SF 0 "register_operand" "")
16100 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
16101 (match_operand:SF 2 "register_operand" ""))
16102 (match_operand:SF 3 "register_operand" "")
16103 (match_operand:SF 4 "register_operand" "")))
16104 (clobber (reg:CC 17))]
16105 "FP_REG_P (operands[0]) && reload_completed
16106 && ((operands_match_p (operands[1], operands[3])
16107 && operands_match_p (operands[2], operands[4]))
16108 || (operands_match_p (operands[1], operands[4])
16109 && operands_match_p (operands[2], operands[3])))"
16110 [(set (reg:CCFP 17)
16111 (compare:CCFP (match_dup 2)
16114 (if_then_else:SF (ge (reg:CCFP 17) (const_int 0))
16118 (define_insn "*minsf_sse"
16119 [(set (match_operand:SF 0 "register_operand" "=x")
16120 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0")
16121 (match_operand:SF 2 "nonimmediate_operand" "xm"))
16124 "TARGET_SSE && reload_completed"
16125 "minss\t{%2, %0|%0, %2}"
16126 [(set_attr "type" "sse")
16127 (set_attr "mode" "SF")])
16129 (define_expand "mindf3"
16131 (set (match_operand:DF 0 "register_operand" "")
16132 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
16133 (match_operand:DF 2 "nonimmediate_operand" ""))
16136 (clobber (reg:CC 17))])]
16137 "TARGET_SSE2 && TARGET_SSE_MATH"
16140 (define_insn "*mindf"
16141 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
16142 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0,0,f#Y")
16143 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
16146 (clobber (reg:CC 17))]
16147 "TARGET_SSE2 && TARGET_IEEE_FP && TARGET_SSE_MATH"
16150 (define_insn "*mindf_nonieee"
16151 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
16152 (if_then_else:DF (lt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
16153 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
16156 (clobber (reg:CC 17))]
16157 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
16158 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16162 [(set (match_operand:DF 0 "register_operand" "")
16163 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
16164 (match_operand:DF 2 "nonimmediate_operand" ""))
16165 (match_operand:DF 3 "register_operand" "")
16166 (match_operand:DF 4 "nonimmediate_operand" "")))
16167 (clobber (reg:CC 17))]
16168 "SSE_REG_P (operands[0]) && reload_completed
16169 && ((operands_match_p (operands[1], operands[3])
16170 && operands_match_p (operands[2], operands[4]))
16171 || (operands_match_p (operands[1], operands[4])
16172 && operands_match_p (operands[2], operands[3])))"
16173 [(set (match_dup 0)
16174 (if_then_else:DF (lt (match_dup 1)
16179 ;; We can't represent the LT test directly. Do this by swapping the operands.
16181 [(set (match_operand:DF 0 "register_operand" "")
16182 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
16183 (match_operand:DF 2 "register_operand" ""))
16184 (match_operand:DF 3 "register_operand" "")
16185 (match_operand:DF 4 "register_operand" "")))
16186 (clobber (reg:CC 17))]
16187 "FP_REG_P (operands[0]) && reload_completed
16188 && ((operands_match_p (operands[1], operands[3])
16189 && operands_match_p (operands[2], operands[4]))
16190 || (operands_match_p (operands[1], operands[4])
16191 && operands_match_p (operands[2], operands[3])))"
16192 [(set (reg:CCFP 17)
16193 (compare:CCFP (match_dup 2)
16196 (if_then_else:DF (ge (reg:CCFP 17) (const_int 0))
16200 (define_insn "*mindf_sse"
16201 [(set (match_operand:DF 0 "register_operand" "=Y")
16202 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0")
16203 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
16206 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
16207 "minsd\t{%2, %0|%0, %2}"
16208 [(set_attr "type" "sse")
16209 (set_attr "mode" "DF")])
16211 (define_expand "maxsf3"
16213 (set (match_operand:SF 0 "register_operand" "")
16214 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
16215 (match_operand:SF 2 "nonimmediate_operand" ""))
16218 (clobber (reg:CC 17))])]
16222 (define_insn "*maxsf"
16223 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
16224 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0,0,f#x")
16225 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
16228 (clobber (reg:CC 17))]
16229 "TARGET_SSE && TARGET_IEEE_FP"
16232 (define_insn "*maxsf_nonieee"
16233 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
16234 (if_then_else:SF (gt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
16235 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
16238 (clobber (reg:CC 17))]
16239 "TARGET_SSE && !TARGET_IEEE_FP
16240 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16244 [(set (match_operand:SF 0 "register_operand" "")
16245 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
16246 (match_operand:SF 2 "nonimmediate_operand" ""))
16247 (match_operand:SF 3 "register_operand" "")
16248 (match_operand:SF 4 "nonimmediate_operand" "")))
16249 (clobber (reg:CC 17))]
16250 "SSE_REG_P (operands[0]) && reload_completed
16251 && ((operands_match_p (operands[1], operands[3])
16252 && operands_match_p (operands[2], operands[4]))
16253 || (operands_match_p (operands[1], operands[4])
16254 && operands_match_p (operands[2], operands[3])))"
16255 [(set (match_dup 0)
16256 (if_then_else:SF (gt (match_dup 1)
16262 [(set (match_operand:SF 0 "register_operand" "")
16263 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
16264 (match_operand:SF 2 "register_operand" ""))
16265 (match_operand:SF 3 "register_operand" "")
16266 (match_operand:SF 4 "register_operand" "")))
16267 (clobber (reg:CC 17))]
16268 "FP_REG_P (operands[0]) && reload_completed
16269 && ((operands_match_p (operands[1], operands[3])
16270 && operands_match_p (operands[2], operands[4]))
16271 || (operands_match_p (operands[1], operands[4])
16272 && operands_match_p (operands[2], operands[3])))"
16273 [(set (reg:CCFP 17)
16274 (compare:CCFP (match_dup 1)
16277 (if_then_else:SF (gt (reg:CCFP 17) (const_int 0))
16281 (define_insn "*maxsf_sse"
16282 [(set (match_operand:SF 0 "register_operand" "=x")
16283 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0")
16284 (match_operand:SF 2 "nonimmediate_operand" "xm"))
16287 "TARGET_SSE && reload_completed"
16288 "maxss\t{%2, %0|%0, %2}"
16289 [(set_attr "type" "sse")
16290 (set_attr "mode" "SF")])
16292 (define_expand "maxdf3"
16294 (set (match_operand:DF 0 "register_operand" "")
16295 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
16296 (match_operand:DF 2 "nonimmediate_operand" ""))
16299 (clobber (reg:CC 17))])]
16300 "TARGET_SSE2 && TARGET_SSE_MATH"
16303 (define_insn "*maxdf"
16304 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
16305 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0,0,f#Y")
16306 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
16309 (clobber (reg:CC 17))]
16310 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_IEEE_FP"
16313 (define_insn "*maxdf_nonieee"
16314 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
16315 (if_then_else:DF (gt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
16316 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
16319 (clobber (reg:CC 17))]
16320 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
16321 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16325 [(set (match_operand:DF 0 "register_operand" "")
16326 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
16327 (match_operand:DF 2 "nonimmediate_operand" ""))
16328 (match_operand:DF 3 "register_operand" "")
16329 (match_operand:DF 4 "nonimmediate_operand" "")))
16330 (clobber (reg:CC 17))]
16331 "SSE_REG_P (operands[0]) && reload_completed
16332 && ((operands_match_p (operands[1], operands[3])
16333 && operands_match_p (operands[2], operands[4]))
16334 || (operands_match_p (operands[1], operands[4])
16335 && operands_match_p (operands[2], operands[3])))"
16336 [(set (match_dup 0)
16337 (if_then_else:DF (gt (match_dup 1)
16343 [(set (match_operand:DF 0 "register_operand" "")
16344 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
16345 (match_operand:DF 2 "register_operand" ""))
16346 (match_operand:DF 3 "register_operand" "")
16347 (match_operand:DF 4 "register_operand" "")))
16348 (clobber (reg:CC 17))]
16349 "FP_REG_P (operands[0]) && reload_completed
16350 && ((operands_match_p (operands[1], operands[3])
16351 && operands_match_p (operands[2], operands[4]))
16352 || (operands_match_p (operands[1], operands[4])
16353 && operands_match_p (operands[2], operands[3])))"
16354 [(set (reg:CCFP 17)
16355 (compare:CCFP (match_dup 1)
16358 (if_then_else:DF (gt (reg:CCFP 17) (const_int 0))
16362 (define_insn "*maxdf_sse"
16363 [(set (match_operand:DF 0 "register_operand" "=Y")
16364 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0")
16365 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
16368 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
16369 "maxsd\t{%2, %0|%0, %2}"
16370 [(set_attr "type" "sse")
16371 (set_attr "mode" "DF")])
16373 ;; Misc patterns (?)
16375 ;; This pattern exists to put a dependency on all ebp-based memory accesses.
16376 ;; Otherwise there will be nothing to keep
16378 ;; [(set (reg ebp) (reg esp))]
16379 ;; [(set (reg esp) (plus (reg esp) (const_int -160000)))
16380 ;; (clobber (eflags)]
16381 ;; [(set (mem (plus (reg ebp) (const_int -160000))) (const_int 0))]
16383 ;; in proper program order.
16384 (define_expand "pro_epilogue_adjust_stack"
16385 [(parallel [(set (match_operand:SI 0 "register_operand" "=r,r")
16386 (plus:SI (match_operand:SI 1 "register_operand" "0,r")
16387 (match_operand:SI 2 "immediate_operand" "i,i")))
16388 (clobber (reg:CC 17))
16389 (clobber (mem:BLK (scratch)))])]
16394 emit_insn (gen_pro_epilogue_adjust_stack_rex64
16395 (operands[0], operands[1], operands[2]));
16400 (define_insn "*pro_epilogue_adjust_stack_1"
16401 [(set (match_operand:SI 0 "register_operand" "=r,r")
16402 (plus:SI (match_operand:SI 1 "register_operand" "0,r")
16403 (match_operand:SI 2 "immediate_operand" "i,i")))
16404 (clobber (reg:CC 17))
16405 (clobber (mem:BLK (scratch)))]
16408 switch (get_attr_type (insn))
16411 return "mov{l}\t{%1, %0|%0, %1}";
16414 if (GET_CODE (operands[2]) == CONST_INT
16415 && (INTVAL (operands[2]) == 128
16416 || (INTVAL (operands[2]) < 0
16417 && INTVAL (operands[2]) != -128)))
16419 operands[2] = GEN_INT (-INTVAL (operands[2]));
16420 return "sub{l}\t{%2, %0|%0, %2}";
16422 return "add{l}\t{%2, %0|%0, %2}";
16425 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
16426 return "lea{l}\t{%a2, %0|%0, %a2}";
16432 [(set (attr "type")
16433 (cond [(eq_attr "alternative" "0")
16434 (const_string "alu")
16435 (match_operand:SI 2 "const0_operand" "")
16436 (const_string "imov")
16438 (const_string "lea")))
16439 (set_attr "mode" "SI")])
16441 (define_insn "pro_epilogue_adjust_stack_rex64"
16442 [(set (match_operand:DI 0 "register_operand" "=r,r")
16443 (plus:DI (match_operand:DI 1 "register_operand" "0,r")
16444 (match_operand:DI 2 "x86_64_immediate_operand" "e,e")))
16445 (clobber (reg:CC 17))
16446 (clobber (mem:BLK (scratch)))]
16449 switch (get_attr_type (insn))
16452 return "mov{q}\t{%1, %0|%0, %1}";
16455 if (GET_CODE (operands[2]) == CONST_INT
16456 && (INTVAL (operands[2]) == 128
16457 || (INTVAL (operands[2]) < 0
16458 && INTVAL (operands[2]) != -128)))
16460 operands[2] = GEN_INT (-INTVAL (operands[2]));
16461 return "sub{q}\t{%2, %0|%0, %2}";
16463 return "add{q}\t{%2, %0|%0, %2}";
16466 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
16467 return "lea{q}\t{%a2, %0|%0, %a2}";
16473 [(set (attr "type")
16474 (cond [(eq_attr "alternative" "0")
16475 (const_string "alu")
16476 (match_operand:DI 2 "const0_operand" "")
16477 (const_string "imov")
16479 (const_string "lea")))
16480 (set_attr "mode" "DI")])
16483 ;; Placeholder for the conditional moves. This one is split either to SSE
16484 ;; based moves emulation or to usual cmove sequence. Little bit unfortunate
16485 ;; fact is that compares supported by the cmp??ss instructions are exactly
16486 ;; swapped of those supported by cmove sequence.
16487 ;; The EQ/NE comparisons also needs bit care, since they are not directly
16488 ;; supported by i387 comparisons and we do need to emit two conditional moves
16491 (define_insn "sse_movsfcc"
16492 [(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")
16493 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
16494 [(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")
16495 (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")])
16496 (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")
16497 (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")))
16498 (clobber (match_scratch:SF 6 "=2,&4,X,X,X,X,X,X,X,X"))
16499 (clobber (reg:CC 17))]
16501 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
16502 && (!TARGET_IEEE_FP
16503 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
16506 (define_insn "sse_movsfcc_eq"
16507 [(set (match_operand:SF 0 "register_operand" "=&x#rf,x#rf,?f#xr,?f#xr,?r#xf,?r#xf")
16508 (if_then_else:SF (eq (match_operand:SF 3 "nonimmediate_operand" "%0#fx,x#fx,f#x,xm#f,f#x,xm#f")
16509 (match_operand:SF 4 "nonimmediate_operand" "xm#f,xm#f,f#x,x#f,f#x,x#f"))
16510 (match_operand:SF 1 "nonimmediate_operand" "x#fr,0#fr,0#fx,0#fx,0#rx,0#rx")
16511 (match_operand:SF 2 "nonimmediate_operand" "x#fr,x#fr,f#fx,f#fx,rm#rx,rm#rx")))
16512 (clobber (match_scratch:SF 5 "=1,&3,X,X,X,X"))
16513 (clobber (reg:CC 17))]
16515 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16518 (define_insn "sse_movdfcc"
16519 [(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")
16520 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
16521 [(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")
16522 (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")])
16523 (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")
16524 (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")))
16525 (clobber (match_scratch:DF 6 "=2,&4,X,X,X,X,X,X,X,X"))
16526 (clobber (reg:CC 17))]
16528 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
16529 && (!TARGET_IEEE_FP
16530 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
16533 (define_insn "sse_movdfcc_eq"
16534 [(set (match_operand:DF 0 "register_operand" "=&Y#rf,Y#rf,?f#Yr,?f#Yr,?r#Yf,?r#Yf")
16535 (if_then_else:DF (eq (match_operand:DF 3 "nonimmediate_operand" "%0#fY,Y#fY,f#Y,Ym#f,f#Y,Ym#f")
16536 (match_operand:DF 4 "nonimmediate_operand" "Ym#f,Ym#f,f#Y,Y#f,f#Y,Y#f"))
16537 (match_operand:DF 1 "nonimmediate_operand" "Y#fr,0#fr,0#fY,0#fY,0#rY,0#rY")
16538 (match_operand:DF 2 "nonimmediate_operand" "Y#fr,Y#fr,f#fY,f#fY,rm#rY,rm#rY")))
16539 (clobber (match_scratch:DF 5 "=1,&3,X,X,X,X"))
16540 (clobber (reg:CC 17))]
16542 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16545 ;; For non-sse moves just expand the usual cmove sequence.
16547 [(set (match_operand 0 "register_operand" "")
16548 (if_then_else (match_operator 1 "comparison_operator"
16549 [(match_operand 4 "nonimmediate_operand" "")
16550 (match_operand 5 "register_operand" "")])
16551 (match_operand 2 "nonimmediate_operand" "")
16552 (match_operand 3 "nonimmediate_operand" "")))
16553 (clobber (match_operand 6 "" ""))
16554 (clobber (reg:CC 17))]
16555 "!SSE_REG_P (operands[0]) && reload_completed
16556 && VALID_SSE_REG_MODE (GET_MODE (operands[0]))"
16559 ix86_compare_op0 = operands[5];
16560 ix86_compare_op1 = operands[4];
16561 operands[1] = gen_rtx_fmt_ee (swap_condition (GET_CODE (operands[1])),
16562 VOIDmode, operands[5], operands[4]);
16563 ix86_expand_fp_movcc (operands);
16567 ;; Split SSE based conditional move into seqence:
16568 ;; cmpCC op0, op4 - set op0 to 0 or ffffffff depending on the comparison
16569 ;; and op2, op0 - zero op2 if comparison was false
16570 ;; nand op0, op3 - load op3 to op0 if comparison was false
16571 ;; or op2, op0 - get the non-zero one into the result.
16573 [(set (match_operand 0 "register_operand" "")
16574 (if_then_else (match_operator 1 "sse_comparison_operator"
16575 [(match_operand 4 "register_operand" "")
16576 (match_operand 5 "nonimmediate_operand" "")])
16577 (match_operand 2 "register_operand" "")
16578 (match_operand 3 "register_operand" "")))
16579 (clobber (match_operand 6 "" ""))
16580 (clobber (reg:CC 17))]
16581 "SSE_REG_P (operands[0]) && reload_completed"
16582 [(set (match_dup 4) (match_op_dup 1 [(match_dup 4) (match_dup 5)]))
16583 (set (subreg:TI (match_dup 2) 0) (and:TI (subreg:TI (match_dup 2) 0)
16584 (subreg:TI (match_dup 4) 0)))
16585 (set (subreg:TI (match_dup 4) 0) (and:TI (not:TI (subreg:TI (match_dup 4) 0))
16586 (subreg:TI (match_dup 3) 0)))
16587 (set (subreg:TI (match_dup 0) 0) (ior:TI (subreg:TI (match_dup 6) 0)
16588 (subreg:TI (match_dup 7) 0)))]
16590 /* If op2 == op3, op3 will be clobbered before it is used.
16591 This should be optimized out though. */
16592 if (operands_match_p (operands[2], operands[3]))
16594 PUT_MODE (operands[1], GET_MODE (operands[0]));
16595 if (operands_match_p (operands[0], operands[4]))
16596 operands[6] = operands[4], operands[7] = operands[2];
16598 operands[6] = operands[2], operands[7] = operands[4];
16601 ;; Special case of conditional move we can handle effectivly.
16602 ;; Do not brother with the integer/floating point case, since these are
16603 ;; bot considerably slower, unlike in the generic case.
16604 (define_insn "*sse_movsfcc_const0_1"
16605 [(set (match_operand:SF 0 "register_operand" "=&x")
16606 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
16607 [(match_operand:SF 4 "register_operand" "0")
16608 (match_operand:SF 5 "nonimmediate_operand" "xm")])
16609 (match_operand:SF 2 "register_operand" "x")
16610 (match_operand:SF 3 "const0_operand" "X")))]
16614 (define_insn "*sse_movsfcc_const0_2"
16615 [(set (match_operand:SF 0 "register_operand" "=&x")
16616 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
16617 [(match_operand:SF 4 "register_operand" "0")
16618 (match_operand:SF 5 "nonimmediate_operand" "xm")])
16619 (match_operand:SF 2 "const0_operand" "X")
16620 (match_operand:SF 3 "register_operand" "x")))]
16624 (define_insn "*sse_movsfcc_const0_3"
16625 [(set (match_operand:SF 0 "register_operand" "=&x")
16626 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
16627 [(match_operand:SF 4 "nonimmediate_operand" "xm")
16628 (match_operand:SF 5 "register_operand" "0")])
16629 (match_operand:SF 2 "register_operand" "x")
16630 (match_operand:SF 3 "const0_operand" "X")))]
16634 (define_insn "*sse_movsfcc_const0_4"
16635 [(set (match_operand:SF 0 "register_operand" "=&x")
16636 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
16637 [(match_operand:SF 4 "nonimmediate_operand" "xm")
16638 (match_operand:SF 5 "register_operand" "0")])
16639 (match_operand:SF 2 "const0_operand" "X")
16640 (match_operand:SF 3 "register_operand" "x")))]
16644 (define_insn "*sse_movdfcc_const0_1"
16645 [(set (match_operand:DF 0 "register_operand" "=&Y")
16646 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
16647 [(match_operand:DF 4 "register_operand" "0")
16648 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
16649 (match_operand:DF 2 "register_operand" "Y")
16650 (match_operand:DF 3 "const0_operand" "X")))]
16654 (define_insn "*sse_movdfcc_const0_2"
16655 [(set (match_operand:DF 0 "register_operand" "=&Y")
16656 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
16657 [(match_operand:DF 4 "register_operand" "0")
16658 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
16659 (match_operand:DF 2 "const0_operand" "X")
16660 (match_operand:DF 3 "register_operand" "Y")))]
16664 (define_insn "*sse_movdfcc_const0_3"
16665 [(set (match_operand:DF 0 "register_operand" "=&Y")
16666 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
16667 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
16668 (match_operand:DF 5 "register_operand" "0")])
16669 (match_operand:DF 2 "register_operand" "Y")
16670 (match_operand:DF 3 "const0_operand" "X")))]
16674 (define_insn "*sse_movdfcc_const0_4"
16675 [(set (match_operand:DF 0 "register_operand" "=&Y")
16676 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
16677 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
16678 (match_operand:DF 5 "register_operand" "0")])
16679 (match_operand:DF 2 "const0_operand" "X")
16680 (match_operand:DF 3 "register_operand" "Y")))]
16685 [(set (match_operand 0 "register_operand" "")
16686 (if_then_else (match_operator 1 "comparison_operator"
16687 [(match_operand 4 "register_operand" "")
16688 (match_operand 5 "nonimmediate_operand" "")])
16689 (match_operand 2 "nonmemory_operand" "")
16690 (match_operand 3 "nonmemory_operand" "")))]
16691 "SSE_REG_P (operands[0]) && reload_completed
16692 && (const0_operand (operands[2], GET_MODE (operands[0]))
16693 || const0_operand (operands[3], GET_MODE (operands[0])))"
16694 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)]))
16695 (set (subreg:TI (match_dup 0) 0) (and:TI (match_dup 6)
16696 (subreg:TI (match_dup 7) 0)))]
16698 PUT_MODE (operands[1], GET_MODE (operands[0]));
16699 if (!sse_comparison_operator (operands[1], VOIDmode))
16701 rtx tmp = operands[5];
16702 operands[5] = operands[4];
16704 PUT_CODE (operands[1], swap_condition (GET_CODE (operands[1])));
16706 if (const0_operand (operands[2], GET_MODE (operands[0])))
16708 operands[7] = operands[3];
16709 operands[6] = gen_rtx_NOT (TImode, gen_rtx_SUBREG (TImode, operands[0],
16714 operands[7] = operands[2];
16715 operands[6] = gen_rtx_SUBREG (TImode, operands[0], 0);
16719 (define_expand "allocate_stack_worker"
16720 [(match_operand:SI 0 "register_operand" "")]
16721 "TARGET_STACK_PROBE"
16724 emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
16726 emit_insn (gen_allocate_stack_worker_1 (operands[0]));
16730 (define_insn "allocate_stack_worker_1"
16731 [(unspec:SI [(match_operand:SI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
16732 (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
16733 (clobber (match_dup 0))
16734 (clobber (reg:CC 17))]
16735 "!TARGET_64BIT && TARGET_STACK_PROBE"
16737 [(set_attr "type" "multi")
16738 (set_attr "length" "5")])
16740 (define_insn "allocate_stack_worker_rex64"
16741 [(unspec:DI [(match_operand:DI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
16742 (set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0)))
16743 (clobber (match_dup 0))
16744 (clobber (reg:CC 17))]
16745 "TARGET_64BIT && TARGET_STACK_PROBE"
16747 [(set_attr "type" "multi")
16748 (set_attr "length" "5")])
16750 (define_expand "allocate_stack"
16751 [(parallel [(set (match_operand:SI 0 "register_operand" "=r")
16752 (minus:SI (reg:SI 7)
16753 (match_operand:SI 1 "general_operand" "")))
16754 (clobber (reg:CC 17))])
16755 (parallel [(set (reg:SI 7)
16756 (minus:SI (reg:SI 7) (match_dup 1)))
16757 (clobber (reg:CC 17))])]
16758 "TARGET_STACK_PROBE"
16760 #ifdef CHECK_STACK_LIMIT
16761 if (GET_CODE (operands[1]) == CONST_INT
16762 && INTVAL (operands[1]) < CHECK_STACK_LIMIT)
16763 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
16767 emit_insn (gen_allocate_stack_worker (copy_to_mode_reg (SImode,
16770 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
16774 (define_expand "builtin_setjmp_receiver"
16775 [(label_ref (match_operand 0 "" ""))]
16776 "!TARGET_64BIT && flag_pic"
16778 emit_insn (gen_set_got (pic_offset_table_rtx));
16782 ;; Avoid redundant prefixes by splitting HImode arithmetic to SImode.
16785 [(set (match_operand 0 "register_operand" "")
16786 (match_operator 3 "promotable_binary_operator"
16787 [(match_operand 1 "register_operand" "")
16788 (match_operand 2 "aligned_operand" "")]))
16789 (clobber (reg:CC 17))]
16790 "! TARGET_PARTIAL_REG_STALL && reload_completed
16791 && ((GET_MODE (operands[0]) == HImode
16792 && ((!optimize_size && !TARGET_FAST_PREFIX)
16793 || GET_CODE (operands[2]) != CONST_INT
16794 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')))
16795 || (GET_MODE (operands[0]) == QImode
16796 && (TARGET_PROMOTE_QImode || optimize_size)))"
16797 [(parallel [(set (match_dup 0)
16798 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
16799 (clobber (reg:CC 17))])]
16800 "operands[0] = gen_lowpart (SImode, operands[0]);
16801 operands[1] = gen_lowpart (SImode, operands[1]);
16802 if (GET_CODE (operands[3]) != ASHIFT)
16803 operands[2] = gen_lowpart (SImode, operands[2]);
16804 PUT_MODE (operands[3], SImode);")
16808 (compare (and (match_operand 1 "aligned_operand" "")
16809 (match_operand 2 "const_int_operand" ""))
16811 (set (match_operand 0 "register_operand" "")
16812 (and (match_dup 1) (match_dup 2)))]
16813 "! TARGET_PARTIAL_REG_STALL && reload_completed
16814 && ix86_match_ccmode (insn, CCNOmode)
16815 && (GET_MODE (operands[0]) == HImode
16816 || (GET_MODE (operands[0]) == QImode
16817 /* Ensure that the operand will remain sign extended immedaite. */
16818 && INTVAL (operands[2]) >= 0
16819 && (TARGET_PROMOTE_QImode || optimize_size)))"
16820 [(parallel [(set (reg:CCNO 17)
16821 (compare:CCNO (and:SI (match_dup 1) (match_dup 2))
16824 (and:SI (match_dup 1) (match_dup 2)))])]
16826 = gen_int_mode (INTVAL (operands[2])
16827 & GET_MODE_MASK (GET_MODE (operands[0])),
16829 operands[0] = gen_lowpart (SImode, operands[0]);
16830 operands[1] = gen_lowpart (SImode, operands[1]);")
16832 ; Don't promote the QImode tests, as i386 don't have encoding of
16833 ; the test instruction with 32bit sign extended immediate and thus
16837 (compare (and (match_operand:HI 0 "aligned_operand" "")
16838 (match_operand:HI 1 "const_int_operand" ""))
16840 "! TARGET_PARTIAL_REG_STALL && reload_completed
16841 && ix86_match_ccmode (insn, CCNOmode)
16842 && GET_MODE (operands[0]) == HImode"
16843 [(set (reg:CCNO 17)
16844 (compare:CCNO (and:SI (match_dup 0) (match_dup 1))
16847 = gen_int_mode (INTVAL (operands[1])
16848 & GET_MODE_MASK (GET_MODE (operands[0])),
16850 operands[0] = gen_lowpart (SImode, operands[0]);")
16853 [(set (match_operand 0 "register_operand" "")
16854 (neg (match_operand 1 "register_operand" "")))
16855 (clobber (reg:CC 17))]
16856 "! TARGET_PARTIAL_REG_STALL && reload_completed
16857 && (GET_MODE (operands[0]) == HImode
16858 || (GET_MODE (operands[0]) == QImode
16859 && (TARGET_PROMOTE_QImode || optimize_size)))"
16860 [(parallel [(set (match_dup 0)
16861 (neg:SI (match_dup 1)))
16862 (clobber (reg:CC 17))])]
16863 "operands[0] = gen_lowpart (SImode, operands[0]);
16864 operands[1] = gen_lowpart (SImode, operands[1]);")
16867 [(set (match_operand 0 "register_operand" "")
16868 (not (match_operand 1 "register_operand" "")))]
16869 "! TARGET_PARTIAL_REG_STALL && reload_completed
16870 && (GET_MODE (operands[0]) == HImode
16871 || (GET_MODE (operands[0]) == QImode
16872 && (TARGET_PROMOTE_QImode || optimize_size)))"
16873 [(set (match_dup 0)
16874 (not:SI (match_dup 1)))]
16875 "operands[0] = gen_lowpart (SImode, operands[0]);
16876 operands[1] = gen_lowpart (SImode, operands[1]);")
16879 [(set (match_operand 0 "register_operand" "")
16880 (if_then_else (match_operator 1 "comparison_operator"
16881 [(reg 17) (const_int 0)])
16882 (match_operand 2 "register_operand" "")
16883 (match_operand 3 "register_operand" "")))]
16884 "! TARGET_PARTIAL_REG_STALL && TARGET_CMOVE
16885 && (GET_MODE (operands[0]) == HImode
16886 || (GET_MODE (operands[0]) == QImode
16887 && (TARGET_PROMOTE_QImode || optimize_size)))"
16888 [(set (match_dup 0)
16889 (if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
16890 "operands[0] = gen_lowpart (SImode, operands[0]);
16891 operands[2] = gen_lowpart (SImode, operands[2]);
16892 operands[3] = gen_lowpart (SImode, operands[3]);")
16895 ;; RTL Peephole optimizations, run before sched2. These primarily look to
16896 ;; transform a complex memory operation into two memory to register operations.
16898 ;; Don't push memory operands
16900 [(set (match_operand:SI 0 "push_operand" "")
16901 (match_operand:SI 1 "memory_operand" ""))
16902 (match_scratch:SI 2 "r")]
16903 "! optimize_size && ! TARGET_PUSH_MEMORY"
16904 [(set (match_dup 2) (match_dup 1))
16905 (set (match_dup 0) (match_dup 2))]
16909 [(set (match_operand:DI 0 "push_operand" "")
16910 (match_operand:DI 1 "memory_operand" ""))
16911 (match_scratch:DI 2 "r")]
16912 "! optimize_size && ! TARGET_PUSH_MEMORY"
16913 [(set (match_dup 2) (match_dup 1))
16914 (set (match_dup 0) (match_dup 2))]
16917 ;; We need to handle SFmode only, because DFmode and XFmode is split to
16920 [(set (match_operand:SF 0 "push_operand" "")
16921 (match_operand:SF 1 "memory_operand" ""))
16922 (match_scratch:SF 2 "r")]
16923 "! optimize_size && ! TARGET_PUSH_MEMORY"
16924 [(set (match_dup 2) (match_dup 1))
16925 (set (match_dup 0) (match_dup 2))]
16929 [(set (match_operand:HI 0 "push_operand" "")
16930 (match_operand:HI 1 "memory_operand" ""))
16931 (match_scratch:HI 2 "r")]
16932 "! optimize_size && ! TARGET_PUSH_MEMORY"
16933 [(set (match_dup 2) (match_dup 1))
16934 (set (match_dup 0) (match_dup 2))]
16938 [(set (match_operand:QI 0 "push_operand" "")
16939 (match_operand:QI 1 "memory_operand" ""))
16940 (match_scratch:QI 2 "q")]
16941 "! optimize_size && ! TARGET_PUSH_MEMORY"
16942 [(set (match_dup 2) (match_dup 1))
16943 (set (match_dup 0) (match_dup 2))]
16946 ;; Don't move an immediate directly to memory when the instruction
16949 [(match_scratch:SI 1 "r")
16950 (set (match_operand:SI 0 "memory_operand" "")
16953 && ! TARGET_USE_MOV0
16954 && TARGET_SPLIT_LONG_MOVES
16955 && get_attr_length (insn) >= ix86_cost->large_insn
16956 && peep2_regno_dead_p (0, FLAGS_REG)"
16957 [(parallel [(set (match_dup 1) (const_int 0))
16958 (clobber (reg:CC 17))])
16959 (set (match_dup 0) (match_dup 1))]
16963 [(match_scratch:HI 1 "r")
16964 (set (match_operand:HI 0 "memory_operand" "")
16967 && ! TARGET_USE_MOV0
16968 && TARGET_SPLIT_LONG_MOVES
16969 && get_attr_length (insn) >= ix86_cost->large_insn
16970 && peep2_regno_dead_p (0, FLAGS_REG)"
16971 [(parallel [(set (match_dup 2) (const_int 0))
16972 (clobber (reg:CC 17))])
16973 (set (match_dup 0) (match_dup 1))]
16974 "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));")
16977 [(match_scratch:QI 1 "q")
16978 (set (match_operand:QI 0 "memory_operand" "")
16981 && ! TARGET_USE_MOV0
16982 && TARGET_SPLIT_LONG_MOVES
16983 && get_attr_length (insn) >= ix86_cost->large_insn
16984 && peep2_regno_dead_p (0, FLAGS_REG)"
16985 [(parallel [(set (match_dup 2) (const_int 0))
16986 (clobber (reg:CC 17))])
16987 (set (match_dup 0) (match_dup 1))]
16988 "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));")
16991 [(match_scratch:SI 2 "r")
16992 (set (match_operand:SI 0 "memory_operand" "")
16993 (match_operand:SI 1 "immediate_operand" ""))]
16995 && get_attr_length (insn) >= ix86_cost->large_insn
16996 && TARGET_SPLIT_LONG_MOVES"
16997 [(set (match_dup 2) (match_dup 1))
16998 (set (match_dup 0) (match_dup 2))]
17002 [(match_scratch:HI 2 "r")
17003 (set (match_operand:HI 0 "memory_operand" "")
17004 (match_operand:HI 1 "immediate_operand" ""))]
17005 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
17006 && TARGET_SPLIT_LONG_MOVES"
17007 [(set (match_dup 2) (match_dup 1))
17008 (set (match_dup 0) (match_dup 2))]
17012 [(match_scratch:QI 2 "q")
17013 (set (match_operand:QI 0 "memory_operand" "")
17014 (match_operand:QI 1 "immediate_operand" ""))]
17015 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
17016 && TARGET_SPLIT_LONG_MOVES"
17017 [(set (match_dup 2) (match_dup 1))
17018 (set (match_dup 0) (match_dup 2))]
17021 ;; Don't compare memory with zero, load and use a test instead.
17024 (compare (match_operand:SI 0 "memory_operand" "")
17026 (match_scratch:SI 3 "r")]
17027 "ix86_match_ccmode (insn, CCNOmode) && ! optimize_size"
17028 [(set (match_dup 3) (match_dup 0))
17029 (set (reg:CCNO 17) (compare:CCNO (match_dup 3) (const_int 0)))]
17032 ;; NOT is not pairable on Pentium, while XOR is, but one byte longer.
17033 ;; Don't split NOTs with a displacement operand, because resulting XOR
17034 ;; will not be pariable anyway.
17036 ;; On AMD K6, NOT is vector decoded with memory operand that can not be
17037 ;; represented using a modRM byte. The XOR replacement is long decoded,
17038 ;; so this split helps here as well.
17040 ;; Note: Can't do this as a regular split because we can't get proper
17041 ;; lifetime information then.
17044 [(set (match_operand:SI 0 "nonimmediate_operand" "")
17045 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
17047 && peep2_regno_dead_p (0, FLAGS_REG)
17048 && ((TARGET_PENTIUM
17049 && (GET_CODE (operands[0]) != MEM
17050 || !memory_displacement_operand (operands[0], SImode)))
17051 || (TARGET_K6 && long_memory_operand (operands[0], SImode)))"
17052 [(parallel [(set (match_dup 0)
17053 (xor:SI (match_dup 1) (const_int -1)))
17054 (clobber (reg:CC 17))])]
17058 [(set (match_operand:HI 0 "nonimmediate_operand" "")
17059 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
17061 && peep2_regno_dead_p (0, FLAGS_REG)
17062 && ((TARGET_PENTIUM
17063 && (GET_CODE (operands[0]) != MEM
17064 || !memory_displacement_operand (operands[0], HImode)))
17065 || (TARGET_K6 && long_memory_operand (operands[0], HImode)))"
17066 [(parallel [(set (match_dup 0)
17067 (xor:HI (match_dup 1) (const_int -1)))
17068 (clobber (reg:CC 17))])]
17072 [(set (match_operand:QI 0 "nonimmediate_operand" "")
17073 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
17075 && peep2_regno_dead_p (0, FLAGS_REG)
17076 && ((TARGET_PENTIUM
17077 && (GET_CODE (operands[0]) != MEM
17078 || !memory_displacement_operand (operands[0], QImode)))
17079 || (TARGET_K6 && long_memory_operand (operands[0], QImode)))"
17080 [(parallel [(set (match_dup 0)
17081 (xor:QI (match_dup 1) (const_int -1)))
17082 (clobber (reg:CC 17))])]
17085 ;; Non pairable "test imm, reg" instructions can be translated to
17086 ;; "and imm, reg" if reg dies. The "and" form is also shorter (one
17087 ;; byte opcode instead of two, have a short form for byte operands),
17088 ;; so do it for other CPUs as well. Given that the value was dead,
17089 ;; this should not create any new dependencies. Pass on the sub-word
17090 ;; versions if we're concerned about partial register stalls.
17094 (compare (and:SI (match_operand:SI 0 "register_operand" "")
17095 (match_operand:SI 1 "immediate_operand" ""))
17097 "ix86_match_ccmode (insn, CCNOmode)
17098 && (true_regnum (operands[0]) != 0
17099 || (GET_CODE (operands[1]) == CONST_INT
17100 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')))
17101 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17103 [(set (reg:CCNO 17)
17104 (compare:CCNO (and:SI (match_dup 0)
17108 (and:SI (match_dup 0) (match_dup 1)))])]
17111 ;; We don't need to handle HImode case, because it will be promoted to SImode
17112 ;; on ! TARGET_PARTIAL_REG_STALL
17116 (compare (and:QI (match_operand:QI 0 "register_operand" "")
17117 (match_operand:QI 1 "immediate_operand" ""))
17119 "! TARGET_PARTIAL_REG_STALL
17120 && ix86_match_ccmode (insn, CCNOmode)
17121 && true_regnum (operands[0]) != 0
17122 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17124 [(set (reg:CCNO 17)
17125 (compare:CCNO (and:QI (match_dup 0)
17129 (and:QI (match_dup 0) (match_dup 1)))])]
17137 (match_operand 0 "ext_register_operand" "")
17140 (match_operand 1 "const_int_operand" ""))
17142 "! TARGET_PARTIAL_REG_STALL
17143 && ix86_match_ccmode (insn, CCNOmode)
17144 && true_regnum (operands[0]) != 0
17145 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17146 [(parallel [(set (reg:CCNO 17)
17155 (set (zero_extract:SI (match_dup 0)
17166 ;; Don't do logical operations with memory inputs.
17168 [(match_scratch:SI 2 "r")
17169 (parallel [(set (match_operand:SI 0 "register_operand" "")
17170 (match_operator:SI 3 "arith_or_logical_operator"
17172 (match_operand:SI 1 "memory_operand" "")]))
17173 (clobber (reg:CC 17))])]
17174 "! optimize_size && ! TARGET_READ_MODIFY"
17175 [(set (match_dup 2) (match_dup 1))
17176 (parallel [(set (match_dup 0)
17177 (match_op_dup 3 [(match_dup 0) (match_dup 2)]))
17178 (clobber (reg:CC 17))])]
17182 [(match_scratch:SI 2 "r")
17183 (parallel [(set (match_operand:SI 0 "register_operand" "")
17184 (match_operator:SI 3 "arith_or_logical_operator"
17185 [(match_operand:SI 1 "memory_operand" "")
17187 (clobber (reg:CC 17))])]
17188 "! optimize_size && ! TARGET_READ_MODIFY"
17189 [(set (match_dup 2) (match_dup 1))
17190 (parallel [(set (match_dup 0)
17191 (match_op_dup 3 [(match_dup 2) (match_dup 0)]))
17192 (clobber (reg:CC 17))])]
17195 ; Don't do logical operations with memory outputs
17197 ; These two don't make sense for PPro/PII -- we're expanding a 4-uop
17198 ; instruction into two 1-uop insns plus a 2-uop insn. That last has
17199 ; the same decoder scheduling characteristics as the original.
17202 [(match_scratch:SI 2 "r")
17203 (parallel [(set (match_operand:SI 0 "memory_operand" "")
17204 (match_operator:SI 3 "arith_or_logical_operator"
17206 (match_operand:SI 1 "nonmemory_operand" "")]))
17207 (clobber (reg:CC 17))])]
17208 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
17209 [(set (match_dup 2) (match_dup 0))
17210 (parallel [(set (match_dup 2)
17211 (match_op_dup 3 [(match_dup 2) (match_dup 1)]))
17212 (clobber (reg:CC 17))])
17213 (set (match_dup 0) (match_dup 2))]
17217 [(match_scratch:SI 2 "r")
17218 (parallel [(set (match_operand:SI 0 "memory_operand" "")
17219 (match_operator:SI 3 "arith_or_logical_operator"
17220 [(match_operand:SI 1 "nonmemory_operand" "")
17222 (clobber (reg:CC 17))])]
17223 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
17224 [(set (match_dup 2) (match_dup 0))
17225 (parallel [(set (match_dup 2)
17226 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
17227 (clobber (reg:CC 17))])
17228 (set (match_dup 0) (match_dup 2))]
17231 ;; Attempt to always use XOR for zeroing registers.
17233 [(set (match_operand 0 "register_operand" "")
17235 "(GET_MODE (operands[0]) == QImode
17236 || GET_MODE (operands[0]) == HImode
17237 || GET_MODE (operands[0]) == SImode
17238 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
17239 && (! TARGET_USE_MOV0 || optimize_size)
17240 && peep2_regno_dead_p (0, FLAGS_REG)"
17241 [(parallel [(set (match_dup 0) (const_int 0))
17242 (clobber (reg:CC 17))])]
17243 "operands[0] = gen_rtx_REG (GET_MODE (operands[0]) == DImode ? DImode : SImode,
17244 true_regnum (operands[0]));")
17247 [(set (strict_low_part (match_operand 0 "register_operand" ""))
17249 "(GET_MODE (operands[0]) == QImode
17250 || GET_MODE (operands[0]) == HImode)
17251 && (! TARGET_USE_MOV0 || optimize_size)
17252 && peep2_regno_dead_p (0, FLAGS_REG)"
17253 [(parallel [(set (strict_low_part (match_dup 0)) (const_int 0))
17254 (clobber (reg:CC 17))])])
17256 ;; For HI and SI modes, or $-1,reg is smaller than mov $-1,reg.
17258 [(set (match_operand 0 "register_operand" "")
17260 "(GET_MODE (operands[0]) == HImode
17261 || GET_MODE (operands[0]) == SImode
17262 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
17263 && (optimize_size || TARGET_PENTIUM)
17264 && peep2_regno_dead_p (0, FLAGS_REG)"
17265 [(parallel [(set (match_dup 0) (const_int -1))
17266 (clobber (reg:CC 17))])]
17267 "operands[0] = gen_rtx_REG (GET_MODE (operands[0]) == DImode ? DImode : SImode,
17268 true_regnum (operands[0]));")
17270 ;; Attempt to convert simple leas to adds. These can be created by
17273 [(set (match_operand:SI 0 "register_operand" "")
17274 (plus:SI (match_dup 0)
17275 (match_operand:SI 1 "nonmemory_operand" "")))]
17276 "peep2_regno_dead_p (0, FLAGS_REG)"
17277 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
17278 (clobber (reg:CC 17))])]
17282 [(set (match_operand:SI 0 "register_operand" "")
17283 (subreg:SI (plus:DI (match_operand:DI 1 "register_operand" "")
17284 (match_operand:DI 2 "nonmemory_operand" "")) 0))]
17285 "peep2_regno_dead_p (0, FLAGS_REG) && REGNO (operands[0]) == REGNO (operands[1])"
17286 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
17287 (clobber (reg:CC 17))])]
17288 "operands[2] = gen_lowpart (SImode, operands[2]);")
17291 [(set (match_operand:DI 0 "register_operand" "")
17292 (plus:DI (match_dup 0)
17293 (match_operand:DI 1 "x86_64_general_operand" "")))]
17294 "peep2_regno_dead_p (0, FLAGS_REG)"
17295 [(parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))
17296 (clobber (reg:CC 17))])]
17300 [(set (match_operand:SI 0 "register_operand" "")
17301 (mult:SI (match_dup 0)
17302 (match_operand:SI 1 "const_int_operand" "")))]
17303 "exact_log2 (INTVAL (operands[1])) >= 0
17304 && peep2_regno_dead_p (0, FLAGS_REG)"
17305 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
17306 (clobber (reg:CC 17))])]
17307 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
17310 [(set (match_operand:DI 0 "register_operand" "")
17311 (mult:DI (match_dup 0)
17312 (match_operand:DI 1 "const_int_operand" "")))]
17313 "exact_log2 (INTVAL (operands[1])) >= 0
17314 && peep2_regno_dead_p (0, FLAGS_REG)"
17315 [(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
17316 (clobber (reg:CC 17))])]
17317 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
17320 [(set (match_operand:SI 0 "register_operand" "")
17321 (subreg:SI (mult:DI (match_operand:DI 1 "register_operand" "")
17322 (match_operand:DI 2 "const_int_operand" "")) 0))]
17323 "exact_log2 (INTVAL (operands[1])) >= 0
17324 && REGNO (operands[0]) == REGNO (operands[1])
17325 && peep2_regno_dead_p (0, FLAGS_REG)"
17326 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
17327 (clobber (reg:CC 17))])]
17328 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[2])));")
17330 ;; The ESP adjustments can be done by the push and pop instructions. Resulting
17331 ;; code is shorter, since push is only 1 byte, while add imm, %esp 3 bytes. On
17332 ;; many CPUs it is also faster, since special hardware to avoid esp
17333 ;; dependencies is present.
17335 ;; While some of these conversions may be done using splitters, we use peepholes
17336 ;; in order to allow combine_stack_adjustments pass to see nonobfuscated RTL.
17338 ;; Convert prologue esp subtractions to push.
17339 ;; We need register to push. In order to keep verify_flow_info happy we have
17341 ;; - use scratch and clobber it in order to avoid dependencies
17342 ;; - use already live register
17343 ;; We can't use the second way right now, since there is no reliable way how to
17344 ;; verify that given register is live. First choice will also most likely in
17345 ;; fewer dependencies. On the place of esp adjustments it is very likely that
17346 ;; call clobbered registers are dead. We may want to use base pointer as an
17347 ;; alternative when no register is available later.
17350 [(match_scratch:SI 0 "r")
17351 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -4)))
17352 (clobber (reg:CC 17))
17353 (clobber (mem:BLK (scratch)))])]
17354 "optimize_size || !TARGET_SUB_ESP_4"
17355 [(clobber (match_dup 0))
17356 (parallel [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
17357 (clobber (mem:BLK (scratch)))])])
17360 [(match_scratch:SI 0 "r")
17361 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
17362 (clobber (reg:CC 17))
17363 (clobber (mem:BLK (scratch)))])]
17364 "optimize_size || !TARGET_SUB_ESP_8"
17365 [(clobber (match_dup 0))
17366 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
17367 (parallel [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
17368 (clobber (mem:BLK (scratch)))])])
17370 ;; Convert esp subtractions to push.
17372 [(match_scratch:SI 0 "r")
17373 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -4)))
17374 (clobber (reg:CC 17))])]
17375 "optimize_size || !TARGET_SUB_ESP_4"
17376 [(clobber (match_dup 0))
17377 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))])
17380 [(match_scratch:SI 0 "r")
17381 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
17382 (clobber (reg:CC 17))])]
17383 "optimize_size || !TARGET_SUB_ESP_8"
17384 [(clobber (match_dup 0))
17385 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
17386 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))])
17388 ;; Convert epilogue deallocator to pop.
17390 [(match_scratch:SI 0 "r")
17391 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
17392 (clobber (reg:CC 17))
17393 (clobber (mem:BLK (scratch)))])]
17394 "optimize_size || !TARGET_ADD_ESP_4"
17395 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17396 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
17397 (clobber (mem:BLK (scratch)))])]
17400 ;; Two pops case is tricky, since pop causes dependency on destination register.
17401 ;; We use two registers if available.
17403 [(match_scratch:SI 0 "r")
17404 (match_scratch:SI 1 "r")
17405 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
17406 (clobber (reg:CC 17))
17407 (clobber (mem:BLK (scratch)))])]
17408 "optimize_size || !TARGET_ADD_ESP_8"
17409 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17410 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
17411 (clobber (mem:BLK (scratch)))])
17412 (parallel [(set (match_dup 1) (mem:SI (reg:SI 7)))
17413 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
17417 [(match_scratch:SI 0 "r")
17418 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
17419 (clobber (reg:CC 17))
17420 (clobber (mem:BLK (scratch)))])]
17422 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17423 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
17424 (clobber (mem:BLK (scratch)))])
17425 (parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17426 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
17429 ;; Convert esp additions to pop.
17431 [(match_scratch:SI 0 "r")
17432 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
17433 (clobber (reg:CC 17))])]
17435 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17436 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
17439 ;; Two pops case is tricky, since pop causes dependency on destination register.
17440 ;; We use two registers if available.
17442 [(match_scratch:SI 0 "r")
17443 (match_scratch:SI 1 "r")
17444 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
17445 (clobber (reg:CC 17))])]
17447 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17448 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])
17449 (parallel [(set (match_dup 1) (mem:SI (reg:SI 7)))
17450 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
17454 [(match_scratch:SI 0 "r")
17455 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
17456 (clobber (reg:CC 17))])]
17458 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17459 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])
17460 (parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
17461 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
17464 ;; Convert compares with 1 to shorter inc/dec operations when CF is not
17465 ;; required and register dies.
17468 (compare (match_operand:SI 0 "register_operand" "")
17469 (match_operand:SI 1 "incdec_operand" "")))]
17470 "ix86_match_ccmode (insn, CCGCmode)
17471 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17472 [(parallel [(set (reg:CCGC 17)
17473 (compare:CCGC (match_dup 0)
17475 (clobber (match_dup 0))])]
17480 (compare (match_operand:HI 0 "register_operand" "")
17481 (match_operand:HI 1 "incdec_operand" "")))]
17482 "ix86_match_ccmode (insn, CCGCmode)
17483 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17484 [(parallel [(set (reg:CCGC 17)
17485 (compare:CCGC (match_dup 0)
17487 (clobber (match_dup 0))])]
17492 (compare (match_operand:QI 0 "register_operand" "")
17493 (match_operand:QI 1 "incdec_operand" "")))]
17494 "ix86_match_ccmode (insn, CCGCmode)
17495 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17496 [(parallel [(set (reg:CCGC 17)
17497 (compare:CCGC (match_dup 0)
17499 (clobber (match_dup 0))])]
17502 ;; Convert compares with 128 to shorter add -128
17505 (compare (match_operand:SI 0 "register_operand" "")
17507 "ix86_match_ccmode (insn, CCGCmode)
17508 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17509 [(parallel [(set (reg:CCGC 17)
17510 (compare:CCGC (match_dup 0)
17512 (clobber (match_dup 0))])]
17517 (compare (match_operand:HI 0 "register_operand" "")
17519 "ix86_match_ccmode (insn, CCGCmode)
17520 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17521 [(parallel [(set (reg:CCGC 17)
17522 (compare:CCGC (match_dup 0)
17524 (clobber (match_dup 0))])]
17528 [(match_scratch:DI 0 "r")
17529 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
17530 (clobber (reg:CC 17))
17531 (clobber (mem:BLK (scratch)))])]
17532 "optimize_size || !TARGET_SUB_ESP_4"
17533 [(clobber (match_dup 0))
17534 (parallel [(set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
17535 (clobber (mem:BLK (scratch)))])])
17538 [(match_scratch:DI 0 "r")
17539 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
17540 (clobber (reg:CC 17))
17541 (clobber (mem:BLK (scratch)))])]
17542 "optimize_size || !TARGET_SUB_ESP_8"
17543 [(clobber (match_dup 0))
17544 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
17545 (parallel [(set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
17546 (clobber (mem:BLK (scratch)))])])
17548 ;; Convert esp subtractions to push.
17550 [(match_scratch:DI 0 "r")
17551 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
17552 (clobber (reg:CC 17))])]
17553 "optimize_size || !TARGET_SUB_ESP_4"
17554 [(clobber (match_dup 0))
17555 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))])
17558 [(match_scratch:DI 0 "r")
17559 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
17560 (clobber (reg:CC 17))])]
17561 "optimize_size || !TARGET_SUB_ESP_8"
17562 [(clobber (match_dup 0))
17563 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
17564 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))])
17566 ;; Convert epilogue deallocator to pop.
17568 [(match_scratch:DI 0 "r")
17569 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
17570 (clobber (reg:CC 17))
17571 (clobber (mem:BLK (scratch)))])]
17572 "optimize_size || !TARGET_ADD_ESP_4"
17573 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17574 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
17575 (clobber (mem:BLK (scratch)))])]
17578 ;; Two pops case is tricky, since pop causes dependency on destination register.
17579 ;; We use two registers if available.
17581 [(match_scratch:DI 0 "r")
17582 (match_scratch:DI 1 "r")
17583 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
17584 (clobber (reg:CC 17))
17585 (clobber (mem:BLK (scratch)))])]
17586 "optimize_size || !TARGET_ADD_ESP_8"
17587 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17588 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
17589 (clobber (mem:BLK (scratch)))])
17590 (parallel [(set (match_dup 1) (mem:DI (reg:DI 7)))
17591 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
17595 [(match_scratch:DI 0 "r")
17596 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
17597 (clobber (reg:CC 17))
17598 (clobber (mem:BLK (scratch)))])]
17600 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17601 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
17602 (clobber (mem:BLK (scratch)))])
17603 (parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17604 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
17607 ;; Convert esp additions to pop.
17609 [(match_scratch:DI 0 "r")
17610 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
17611 (clobber (reg:CC 17))])]
17613 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17614 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
17617 ;; Two pops case is tricky, since pop causes dependency on destination register.
17618 ;; We use two registers if available.
17620 [(match_scratch:DI 0 "r")
17621 (match_scratch:DI 1 "r")
17622 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
17623 (clobber (reg:CC 17))])]
17625 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17626 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])
17627 (parallel [(set (match_dup 1) (mem:DI (reg:DI 7)))
17628 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
17632 [(match_scratch:DI 0 "r")
17633 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
17634 (clobber (reg:CC 17))])]
17636 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17637 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])
17638 (parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
17639 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
17642 ;; Call-value patterns last so that the wildcard operand does not
17643 ;; disrupt insn-recog's switch tables.
17645 (define_insn "*call_value_pop_0"
17646 [(set (match_operand 0 "" "")
17647 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
17648 (match_operand:SI 2 "" "")))
17649 (set (reg:SI 7) (plus:SI (reg:SI 7)
17650 (match_operand:SI 3 "immediate_operand" "")))]
17653 if (SIBLING_CALL_P (insn))
17656 return "call\t%P1";
17658 [(set_attr "type" "callv")])
17660 (define_insn "*call_value_pop_1"
17661 [(set (match_operand 0 "" "")
17662 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
17663 (match_operand:SI 2 "" "")))
17664 (set (reg:SI 7) (plus:SI (reg:SI 7)
17665 (match_operand:SI 3 "immediate_operand" "i")))]
17668 if (constant_call_address_operand (operands[1], QImode))
17670 if (SIBLING_CALL_P (insn))
17673 return "call\t%P1";
17675 if (SIBLING_CALL_P (insn))
17678 return "call\t%A1";
17680 [(set_attr "type" "callv")])
17682 (define_insn "*call_value_0"
17683 [(set (match_operand 0 "" "")
17684 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
17685 (match_operand:SI 2 "" "")))]
17688 if (SIBLING_CALL_P (insn))
17691 return "call\t%P1";
17693 [(set_attr "type" "callv")])
17695 (define_insn "*call_value_0_rex64"
17696 [(set (match_operand 0 "" "")
17697 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
17698 (match_operand:DI 2 "const_int_operand" "")))]
17701 if (SIBLING_CALL_P (insn))
17704 return "call\t%P1";
17706 [(set_attr "type" "callv")])
17708 (define_insn "*call_value_1"
17709 [(set (match_operand 0 "" "")
17710 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
17711 (match_operand:SI 2 "" "")))]
17714 if (constant_call_address_operand (operands[1], QImode))
17716 if (SIBLING_CALL_P (insn))
17719 return "call\t%P1";
17721 if (SIBLING_CALL_P (insn))
17722 return "jmp\t%*%1";
17724 return "call\t%*%1";
17726 [(set_attr "type" "callv")])
17728 (define_insn "*call_value_1_rex64"
17729 [(set (match_operand 0 "" "")
17730 (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm"))
17731 (match_operand:DI 2 "" "")))]
17734 if (constant_call_address_operand (operands[1], QImode))
17736 if (SIBLING_CALL_P (insn))
17739 return "call\t%P1";
17741 if (SIBLING_CALL_P (insn))
17744 return "call\t%A1";
17746 [(set_attr "type" "callv")])
17748 (define_insn "trap"
17749 [(trap_if (const_int 1) (const_int 5))]
17753 ;;; ix86 doesn't have conditional trap instructions, but we fake them
17754 ;;; for the sake of bounds checking. By emitting bounds checks as
17755 ;;; conditional traps rather than as conditional jumps around
17756 ;;; unconditional traps we avoid introducing spurious basic-block
17757 ;;; boundaries and facilitate elimination of redundant checks. In
17758 ;;; honor of the too-inflexible-for-BPs `bound' instruction, we use
17761 ;;; FIXME: Static branch prediction rules for ix86 are such that
17762 ;;; forward conditional branches predict as untaken. As implemented
17763 ;;; below, pseudo conditional traps violate that rule. We should use
17764 ;;; .pushsection/.popsection to place all of the `int 5's in a special
17765 ;;; section loaded at the end of the text segment and branch forward
17766 ;;; there on bounds-failure, and then jump back immediately (in case
17767 ;;; the system chooses to ignore bounds violations, or to report
17768 ;;; violations and continue execution).
17770 (define_expand "conditional_trap"
17771 [(trap_if (match_operator 0 "comparison_operator"
17772 [(match_dup 2) (const_int 0)])
17773 (match_operand 1 "const_int_operand" ""))]
17776 emit_insn (gen_rtx_TRAP_IF (VOIDmode,
17777 ix86_expand_compare (GET_CODE (operands[0]),
17783 (define_insn "*conditional_trap_1"
17784 [(trap_if (match_operator 0 "comparison_operator"
17785 [(reg 17) (const_int 0)])
17786 (match_operand 1 "const_int_operand" ""))]
17789 operands[2] = gen_label_rtx ();
17790 output_asm_insn ("j%c0\t%l2\; int\t%1", operands);
17791 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
17792 CODE_LABEL_NUMBER (operands[2]));
17796 ;; Pentium III SIMD instructions.
17798 ;; Moves for SSE/MMX regs.
17800 (define_insn "movv4sf_internal"
17801 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
17802 (match_operand:V4SF 1 "nonimmediate_operand" "xm,x"))]
17804 ;; @@@ let's try to use movaps here.
17805 "movaps\t{%1, %0|%0, %1}"
17806 [(set_attr "type" "ssemov")
17807 (set_attr "mode" "V4SF")])
17809 (define_insn "movv4si_internal"
17810 [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,m")
17811 (match_operand:V4SI 1 "nonimmediate_operand" "xm,x"))]
17813 ;; @@@ let's try to use movaps here.
17814 "movaps\t{%1, %0|%0, %1}"
17815 [(set_attr "type" "ssemov")
17816 (set_attr "mode" "V4SF")])
17818 (define_insn "movv8qi_internal"
17819 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
17820 (match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
17822 "movq\t{%1, %0|%0, %1}"
17823 [(set_attr "type" "mmxmov")
17824 (set_attr "mode" "DI")])
17826 (define_insn "movv4hi_internal"
17827 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
17828 (match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
17830 "movq\t{%1, %0|%0, %1}"
17831 [(set_attr "type" "mmxmov")
17832 (set_attr "mode" "DI")])
17834 (define_insn "movv2si_internal"
17835 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
17836 (match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
17838 "movq\t{%1, %0|%0, %1}"
17839 [(set_attr "type" "mmxcvt")
17840 (set_attr "mode" "DI")])
17842 (define_insn "movv2sf_internal"
17843 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
17844 (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
17846 "movq\\t{%1, %0|%0, %1}"
17847 [(set_attr "type" "mmxcvt")
17848 (set_attr "mode" "DI")])
17850 (define_expand "movti"
17851 [(set (match_operand:TI 0 "general_operand" "")
17852 (match_operand:TI 1 "general_operand" ""))]
17853 "TARGET_SSE || TARGET_64BIT"
17856 ix86_expand_move (TImode, operands);
17858 ix86_expand_vector_move (TImode, operands);
17862 (define_insn "movv2df_internal"
17863 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
17864 (match_operand:V2DF 1 "general_operand" "xm,x"))]
17866 ;; @@@ let's try to use movaps here.
17867 "movapd\t{%1, %0|%0, %1}"
17868 [(set_attr "type" "ssemov")
17869 (set_attr "mode" "V2DF")])
17871 (define_insn "movv8hi_internal"
17872 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
17873 (match_operand:V8HI 1 "general_operand" "xm,x"))]
17875 ;; @@@ let's try to use movaps here.
17876 "movaps\t{%1, %0|%0, %1}"
17877 [(set_attr "type" "ssemov")
17878 (set_attr "mode" "V4SF")])
17880 (define_insn "movv16qi_internal"
17881 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
17882 (match_operand:V16QI 1 "general_operand" "xm,x"))]
17884 ;; @@@ let's try to use movaps here.
17885 "movaps\t{%1, %0|%0, %1}"
17886 [(set_attr "type" "ssemov")
17887 (set_attr "mode" "V4SF")])
17889 (define_expand "movv2df"
17890 [(set (match_operand:V2DF 0 "general_operand" "")
17891 (match_operand:V2DF 1 "general_operand" ""))]
17894 ix86_expand_vector_move (V2DFmode, operands);
17898 (define_expand "movv8hi"
17899 [(set (match_operand:V8HI 0 "general_operand" "")
17900 (match_operand:V8HI 1 "general_operand" ""))]
17903 ix86_expand_vector_move (V8HImode, operands);
17907 (define_expand "movv16qi"
17908 [(set (match_operand:V16QI 0 "general_operand" "")
17909 (match_operand:V16QI 1 "general_operand" ""))]
17912 ix86_expand_vector_move (V16QImode, operands);
17916 (define_expand "movv4sf"
17917 [(set (match_operand:V4SF 0 "general_operand" "")
17918 (match_operand:V4SF 1 "general_operand" ""))]
17921 ix86_expand_vector_move (V4SFmode, operands);
17925 (define_expand "movv4si"
17926 [(set (match_operand:V4SI 0 "general_operand" "")
17927 (match_operand:V4SI 1 "general_operand" ""))]
17930 ix86_expand_vector_move (V4SImode, operands);
17934 (define_expand "movv2si"
17935 [(set (match_operand:V2SI 0 "general_operand" "")
17936 (match_operand:V2SI 1 "general_operand" ""))]
17939 ix86_expand_vector_move (V2SImode, operands);
17943 (define_expand "movv4hi"
17944 [(set (match_operand:V4HI 0 "general_operand" "")
17945 (match_operand:V4HI 1 "general_operand" ""))]
17948 ix86_expand_vector_move (V4HImode, operands);
17952 (define_expand "movv8qi"
17953 [(set (match_operand:V8QI 0 "general_operand" "")
17954 (match_operand:V8QI 1 "general_operand" ""))]
17957 ix86_expand_vector_move (V8QImode, operands);
17961 (define_expand "movv2sf"
17962 [(set (match_operand:V2SF 0 "general_operand" "")
17963 (match_operand:V2SF 1 "general_operand" ""))]
17966 ix86_expand_vector_move (V2SFmode, operands);
17970 (define_insn_and_split "*pushti"
17971 [(set (match_operand:TI 0 "push_operand" "=<")
17972 (match_operand:TI 1 "nonmemory_operand" "x"))]
17976 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
17977 (set (mem:TI (reg:SI 7)) (match_dup 1))]
17979 [(set_attr "type" "multi")])
17981 (define_insn_and_split "*pushv2df"
17982 [(set (match_operand:V2DF 0 "push_operand" "=<")
17983 (match_operand:V2DF 1 "nonmemory_operand" "x"))]
17987 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
17988 (set (mem:V2DF (reg:SI 7)) (match_dup 1))]
17990 [(set_attr "type" "multi")])
17992 (define_insn_and_split "*pushv8hi"
17993 [(set (match_operand:V8HI 0 "push_operand" "=<")
17994 (match_operand:V8HI 1 "nonmemory_operand" "x"))]
17998 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
17999 (set (mem:V8HI (reg:SI 7)) (match_dup 1))]
18001 [(set_attr "type" "multi")])
18003 (define_insn_and_split "*pushv16qi"
18004 [(set (match_operand:V16QI 0 "push_operand" "=<")
18005 (match_operand:V16QI 1 "nonmemory_operand" "x"))]
18009 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
18010 (set (mem:V16QI (reg:SI 7)) (match_dup 1))]
18012 [(set_attr "type" "multi")])
18014 (define_insn_and_split "*pushv4sf"
18015 [(set (match_operand:V4SF 0 "push_operand" "=<")
18016 (match_operand:V4SF 1 "nonmemory_operand" "x"))]
18020 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
18021 (set (mem:V4SF (reg:SI 7)) (match_dup 1))]
18023 [(set_attr "type" "multi")])
18025 (define_insn_and_split "*pushv4si"
18026 [(set (match_operand:V4SI 0 "push_operand" "=<")
18027 (match_operand:V4SI 1 "nonmemory_operand" "x"))]
18031 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
18032 (set (mem:V4SI (reg:SI 7)) (match_dup 1))]
18034 [(set_attr "type" "multi")])
18036 (define_insn_and_split "*pushv2si"
18037 [(set (match_operand:V2SI 0 "push_operand" "=<")
18038 (match_operand:V2SI 1 "nonmemory_operand" "y"))]
18042 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
18043 (set (mem:V2SI (reg:SI 7)) (match_dup 1))]
18045 [(set_attr "type" "mmx")])
18047 (define_insn_and_split "*pushv4hi"
18048 [(set (match_operand:V4HI 0 "push_operand" "=<")
18049 (match_operand:V4HI 1 "nonmemory_operand" "y"))]
18053 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
18054 (set (mem:V4HI (reg:SI 7)) (match_dup 1))]
18056 [(set_attr "type" "mmx")])
18058 (define_insn_and_split "*pushv8qi"
18059 [(set (match_operand:V8QI 0 "push_operand" "=<")
18060 (match_operand:V8QI 1 "nonmemory_operand" "y"))]
18064 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
18065 (set (mem:V8QI (reg:SI 7)) (match_dup 1))]
18067 [(set_attr "type" "mmx")])
18069 (define_insn_and_split "*pushv2sf"
18070 [(set (match_operand:V2SF 0 "push_operand" "=<")
18071 (match_operand:V2SF 1 "nonmemory_operand" "y"))]
18075 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
18076 (set (mem:V2SF (reg:SI 7)) (match_dup 1))]
18078 [(set_attr "type" "mmx")])
18080 (define_insn "movti_internal"
18081 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
18082 (match_operand:TI 1 "general_operand" "O,xm,x"))]
18083 "TARGET_SSE && !TARGET_64BIT"
18086 movaps\t{%1, %0|%0, %1}
18087 movaps\t{%1, %0|%0, %1}"
18088 [(set_attr "type" "ssemov,ssemov,ssemov")
18089 (set_attr "mode" "V4SF")])
18091 (define_insn "*movti_rex64"
18092 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,mx,x")
18093 (match_operand:TI 1 "general_operand" "riFo,riF,O,x,m"))]
18095 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18100 movaps\\t{%1, %0|%0, %1}
18101 movaps\\t{%1, %0|%0, %1}"
18102 [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
18103 (set_attr "mode" "V4SF")])
18106 [(set (match_operand:TI 0 "nonimmediate_operand" "")
18107 (match_operand:TI 1 "general_operand" ""))]
18108 "reload_completed && !SSE_REG_P (operands[0])
18109 && !SSE_REG_P (operands[1])"
18111 "ix86_split_long_move (operands); DONE;")
18113 ;; These two patterns are useful for specifying exactly whether to use
18114 ;; movaps or movups
18115 (define_insn "sse_movaps"
18116 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
18117 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
18121 movaps\t{%1, %0|%0, %1}
18122 movaps\t{%1, %0|%0, %1}"
18123 [(set_attr "type" "ssemov,ssemov")
18124 (set_attr "mode" "V4SF")])
18126 (define_insn "sse_movups"
18127 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
18128 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
18132 movups\t{%1, %0|%0, %1}
18133 movups\t{%1, %0|%0, %1}"
18134 [(set_attr "type" "ssecvt,ssecvt")
18135 (set_attr "mode" "V4SF")])
18138 ;; SSE Strange Moves.
18140 (define_insn "sse_movmskps"
18141 [(set (match_operand:SI 0 "register_operand" "=r")
18142 (unspec:SI [(match_operand:V4SF 1 "register_operand" "x")]
18145 "movmskps\t{%1, %0|%0, %1}"
18146 [(set_attr "type" "ssecvt")
18147 (set_attr "mode" "V4SF")])
18149 (define_insn "mmx_pmovmskb"
18150 [(set (match_operand:SI 0 "register_operand" "=r")
18151 (unspec:SI [(match_operand:V8QI 1 "register_operand" "y")]
18153 "TARGET_SSE || TARGET_3DNOW_A"
18154 "pmovmskb\t{%1, %0|%0, %1}"
18155 [(set_attr "type" "ssecvt")
18156 (set_attr "mode" "V4SF")])
18159 (define_insn "mmx_maskmovq"
18160 [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
18161 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
18162 (match_operand:V8QI 2 "register_operand" "y")]
18164 "(TARGET_SSE || TARGET_3DNOW_A) && !TARGET_64BIT"
18165 ;; @@@ check ordering of operands in intel/nonintel syntax
18166 "maskmovq\t{%2, %1|%1, %2}"
18167 [(set_attr "type" "mmxcvt")
18168 (set_attr "mode" "DI")])
18170 (define_insn "mmx_maskmovq_rex"
18171 [(set (mem:V8QI (match_operand:DI 0 "register_operand" "D"))
18172 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
18173 (match_operand:V8QI 2 "register_operand" "y")]
18175 "(TARGET_SSE || TARGET_3DNOW_A) && TARGET_64BIT"
18176 ;; @@@ check ordering of operands in intel/nonintel syntax
18177 "maskmovq\t{%2, %1|%1, %2}"
18178 [(set_attr "type" "mmxcvt")
18179 (set_attr "mode" "DI")])
18181 (define_insn "sse_movntv4sf"
18182 [(set (match_operand:V4SF 0 "memory_operand" "=m")
18183 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")]
18186 "movntps\t{%1, %0|%0, %1}"
18187 [(set_attr "type" "ssemov")
18188 (set_attr "mode" "V4SF")])
18190 (define_insn "sse_movntdi"
18191 [(set (match_operand:DI 0 "memory_operand" "=m")
18192 (unspec:DI [(match_operand:DI 1 "register_operand" "y")]
18194 "TARGET_SSE || TARGET_3DNOW_A"
18195 "movntq\t{%1, %0|%0, %1}"
18196 [(set_attr "type" "mmxmov")
18197 (set_attr "mode" "DI")])
18199 (define_insn "sse_movhlps"
18200 [(set (match_operand:V4SF 0 "register_operand" "=x")
18202 (match_operand:V4SF 1 "register_operand" "0")
18203 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
18204 (parallel [(const_int 2)
18210 "movhlps\t{%2, %0|%0, %2}"
18211 [(set_attr "type" "ssecvt")
18212 (set_attr "mode" "V4SF")])
18214 (define_insn "sse_movlhps"
18215 [(set (match_operand:V4SF 0 "register_operand" "=x")
18217 (match_operand:V4SF 1 "register_operand" "0")
18218 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
18219 (parallel [(const_int 2)
18225 "movlhps\t{%2, %0|%0, %2}"
18226 [(set_attr "type" "ssecvt")
18227 (set_attr "mode" "V4SF")])
18229 (define_insn "sse_movhps"
18230 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
18232 (match_operand:V4SF 1 "nonimmediate_operand" "0,0")
18233 (match_operand:V4SF 2 "nonimmediate_operand" "m,x")
18236 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
18237 "movhps\t{%2, %0|%0, %2}"
18238 [(set_attr "type" "ssecvt")
18239 (set_attr "mode" "V4SF")])
18241 (define_insn "sse_movlps"
18242 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
18244 (match_operand:V4SF 1 "nonimmediate_operand" "0,0")
18245 (match_operand:V4SF 2 "nonimmediate_operand" "m,x")
18248 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
18249 "movlps\t{%2, %0|%0, %2}"
18250 [(set_attr "type" "ssecvt")
18251 (set_attr "mode" "V4SF")])
18253 (define_insn "sse_loadss"
18254 [(set (match_operand:V4SF 0 "register_operand" "=x")
18256 (match_operand:V4SF 1 "memory_operand" "m")
18257 (vec_duplicate:V4SF (float:SF (const_int 0)))
18260 "movss\t{%1, %0|%0, %1}"
18261 [(set_attr "type" "ssemov")
18262 (set_attr "mode" "SF")])
18264 (define_insn "sse_movss"
18265 [(set (match_operand:V4SF 0 "register_operand" "=x")
18267 (match_operand:V4SF 1 "register_operand" "0")
18268 (match_operand:V4SF 2 "register_operand" "x")
18271 "movss\t{%2, %0|%0, %2}"
18272 [(set_attr "type" "ssemov")
18273 (set_attr "mode" "SF")])
18275 (define_insn "sse_storess"
18276 [(set (match_operand:SF 0 "memory_operand" "=m")
18278 (match_operand:V4SF 1 "register_operand" "x")
18279 (parallel [(const_int 0)])))]
18281 "movss\t{%1, %0|%0, %1}"
18282 [(set_attr "type" "ssemov")
18283 (set_attr "mode" "SF")])
18285 (define_insn "sse_shufps"
18286 [(set (match_operand:V4SF 0 "register_operand" "=x")
18287 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
18288 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
18289 (match_operand:SI 3 "immediate_operand" "i")]
18292 ;; @@@ check operand order for intel/nonintel syntax
18293 "shufps\t{%3, %2, %0|%0, %2, %3}"
18294 [(set_attr "type" "ssecvt")
18295 (set_attr "mode" "V4SF")])
18300 (define_insn "addv4sf3"
18301 [(set (match_operand:V4SF 0 "register_operand" "=x")
18302 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
18303 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
18305 "addps\t{%2, %0|%0, %2}"
18306 [(set_attr "type" "sseadd")
18307 (set_attr "mode" "V4SF")])
18309 (define_insn "vmaddv4sf3"
18310 [(set (match_operand:V4SF 0 "register_operand" "=x")
18312 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
18313 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
18317 "addss\t{%2, %0|%0, %2}"
18318 [(set_attr "type" "sseadd")
18319 (set_attr "mode" "SF")])
18321 (define_insn "subv4sf3"
18322 [(set (match_operand:V4SF 0 "register_operand" "=x")
18323 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
18324 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
18326 "subps\t{%2, %0|%0, %2}"
18327 [(set_attr "type" "sseadd")
18328 (set_attr "mode" "V4SF")])
18330 (define_insn "vmsubv4sf3"
18331 [(set (match_operand:V4SF 0 "register_operand" "=x")
18333 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
18334 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
18338 "subss\t{%2, %0|%0, %2}"
18339 [(set_attr "type" "sseadd")
18340 (set_attr "mode" "SF")])
18342 (define_insn "mulv4sf3"
18343 [(set (match_operand:V4SF 0 "register_operand" "=x")
18344 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
18345 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
18347 "mulps\t{%2, %0|%0, %2}"
18348 [(set_attr "type" "ssemul")
18349 (set_attr "mode" "V4SF")])
18351 (define_insn "vmmulv4sf3"
18352 [(set (match_operand:V4SF 0 "register_operand" "=x")
18354 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
18355 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
18359 "mulss\t{%2, %0|%0, %2}"
18360 [(set_attr "type" "ssemul")
18361 (set_attr "mode" "SF")])
18363 (define_insn "divv4sf3"
18364 [(set (match_operand:V4SF 0 "register_operand" "=x")
18365 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
18366 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
18368 "divps\t{%2, %0|%0, %2}"
18369 [(set_attr "type" "ssediv")
18370 (set_attr "mode" "V4SF")])
18372 (define_insn "vmdivv4sf3"
18373 [(set (match_operand:V4SF 0 "register_operand" "=x")
18375 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
18376 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
18380 "divss\t{%2, %0|%0, %2}"
18381 [(set_attr "type" "ssediv")
18382 (set_attr "mode" "SF")])
18385 ;; SSE square root/reciprocal
18387 (define_insn "rcpv4sf2"
18388 [(set (match_operand:V4SF 0 "register_operand" "=x")
18390 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RCP))]
18392 "rcpps\t{%1, %0|%0, %1}"
18393 [(set_attr "type" "sse")
18394 (set_attr "mode" "V4SF")])
18396 (define_insn "vmrcpv4sf2"
18397 [(set (match_operand:V4SF 0 "register_operand" "=x")
18399 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
18401 (match_operand:V4SF 2 "register_operand" "0")
18404 "rcpss\t{%1, %0|%0, %1}"
18405 [(set_attr "type" "sse")
18406 (set_attr "mode" "SF")])
18408 (define_insn "rsqrtv4sf2"
18409 [(set (match_operand:V4SF 0 "register_operand" "=x")
18411 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RSQRT))]
18413 "rsqrtps\t{%1, %0|%0, %1}"
18414 [(set_attr "type" "sse")
18415 (set_attr "mode" "V4SF")])
18417 (define_insn "vmrsqrtv4sf2"
18418 [(set (match_operand:V4SF 0 "register_operand" "=x")
18420 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
18422 (match_operand:V4SF 2 "register_operand" "0")
18425 "rsqrtss\t{%1, %0|%0, %1}"
18426 [(set_attr "type" "sse")
18427 (set_attr "mode" "SF")])
18429 (define_insn "sqrtv4sf2"
18430 [(set (match_operand:V4SF 0 "register_operand" "=x")
18431 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
18433 "sqrtps\t{%1, %0|%0, %1}"
18434 [(set_attr "type" "sse")
18435 (set_attr "mode" "V4SF")])
18437 (define_insn "vmsqrtv4sf2"
18438 [(set (match_operand:V4SF 0 "register_operand" "=x")
18440 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
18441 (match_operand:V4SF 2 "register_operand" "0")
18444 "sqrtss\t{%1, %0|%0, %1}"
18445 [(set_attr "type" "sse")
18446 (set_attr "mode" "SF")])
18448 ;; SSE logical operations.
18450 ;; These are not called andti3 etc. because we really really don't want
18451 ;; the compiler to widen DImode ands to TImode ands and then try to move
18452 ;; into DImode subregs of SSE registers, and them together, and move out
18453 ;; of DImode subregs again!
18455 (define_insn "*sse_andti3_df_1"
18456 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18457 (and:TI (subreg:TI (match_operand:DF 1 "register_operand" "%0") 0)
18458 (subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
18460 "andpd\t{%2, %0|%0, %2}"
18461 [(set_attr "type" "sselog")
18462 (set_attr "mode" "V2DF")])
18464 (define_insn "*sse_andti3_df_2"
18465 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18466 (and:TI (subreg:TI (match_operand:DF 1 "register_operand" "0") 0)
18467 (match_operand:TI 2 "nonimmediate_operand" "Ym")))]
18469 "andpd\t{%2, %0|%0, %2}"
18470 [(set_attr "type" "sselog")
18471 (set_attr "mode" "V2DF")])
18473 (define_insn "*sse_andti3_sf_1"
18474 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18475 (and:TI (subreg:TI (match_operand:SF 1 "register_operand" "%0") 0)
18476 (subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
18478 "andps\t{%2, %0|%0, %2}"
18479 [(set_attr "type" "sselog")
18480 (set_attr "mode" "V4SF")])
18482 (define_insn "*sse_andti3_sf_2"
18483 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18484 (and:TI (subreg:TI (match_operand:SF 1 "register_operand" "0") 0)
18485 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18487 "andps\t{%2, %0|%0, %2}"
18488 [(set_attr "type" "sselog")
18489 (set_attr "mode" "V4SF")])
18491 (define_insn "sse_andti3"
18492 [(set (match_operand:TI 0 "register_operand" "=x")
18493 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
18494 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18495 "TARGET_SSE && !TARGET_SSE2
18496 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18497 "andps\t{%2, %0|%0, %2}"
18498 [(set_attr "type" "sselog")
18499 (set_attr "mode" "V4SF")])
18501 (define_insn "sse2_andti3"
18502 [(set (match_operand:TI 0 "register_operand" "=x")
18503 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
18504 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18506 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18507 "pand\t{%2, %0|%0, %2}"
18508 [(set_attr "type" "sselog")
18509 (set_attr "mode" "TI")])
18511 (define_insn "sse2_andv2di3"
18512 [(set (match_operand:V2DI 0 "register_operand" "=x")
18513 (and:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
18514 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
18516 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18517 "pand\t{%2, %0|%0, %2}"
18518 [(set_attr "type" "sselog")
18519 (set_attr "mode" "TI")])
18521 (define_insn "*sse_nandti3_df"
18522 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18523 (and:TI (not:TI (subreg:TI (match_operand:DF 1 "register_operand" "0") 0))
18524 (match_operand:TI 2 "nonimmediate_operand" "Ym")))]
18526 "andnpd\t{%2, %0|%0, %2}"
18527 [(set_attr "type" "sselog")
18528 (set_attr "mode" "V2DF")])
18530 (define_insn "*sse_nandti3_sf"
18531 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18532 (and:TI (not:TI (subreg:TI (match_operand:SF 1 "register_operand" "0") 0))
18533 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18535 "andnps\t{%2, %0|%0, %2}"
18536 [(set_attr "type" "sselog")
18537 (set_attr "mode" "V4SF")])
18539 (define_insn "sse_nandti3"
18540 [(set (match_operand:TI 0 "register_operand" "=x")
18541 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
18542 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18543 "TARGET_SSE && !TARGET_SSE2"
18544 "andnps\t{%2, %0|%0, %2}"
18545 [(set_attr "type" "sselog")
18546 (set_attr "mode" "V4SF")])
18548 (define_insn "sse2_nandti3"
18549 [(set (match_operand:TI 0 "register_operand" "=x")
18550 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
18551 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18553 "pandn\t{%2, %0|%0, %2}"
18554 [(set_attr "type" "sselog")
18555 (set_attr "mode" "TI")])
18557 (define_insn "sse2_nandv2di3"
18558 [(set (match_operand:V2DI 0 "register_operand" "=x")
18559 (and:V2DI (not:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0"))
18560 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
18562 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18563 "pandn\t{%2, %0|%0, %2}"
18564 [(set_attr "type" "sselog")
18565 (set_attr "mode" "TI")])
18567 (define_insn "*sse_iorti3_df_1"
18568 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18569 (ior:TI (subreg:TI (match_operand:DF 1 "register_operand" "%0") 0)
18570 (subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
18572 "orpd\t{%2, %0|%0, %2}"
18573 [(set_attr "type" "sselog")
18574 (set_attr "mode" "V2DF")])
18576 (define_insn "*sse_iorti3_df_2"
18577 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18578 (ior:TI (subreg:TI (match_operand:DF 1 "register_operand" "0") 0)
18579 (match_operand:TI 2 "nonimmediate_operand" "Ym")))]
18581 "orpd\t{%2, %0|%0, %2}"
18582 [(set_attr "type" "sselog")
18583 (set_attr "mode" "V2DF")])
18585 (define_insn "*sse_iorti3_sf_1"
18586 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18587 (ior:TI (subreg:TI (match_operand:SF 1 "register_operand" "%0") 0)
18588 (subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
18590 "orps\t{%2, %0|%0, %2}"
18591 [(set_attr "type" "sselog")
18592 (set_attr "mode" "V4SF")])
18594 (define_insn "*sse_iorti3_sf_2"
18595 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18596 (ior:TI (subreg:TI (match_operand:SF 1 "register_operand" "0") 0)
18597 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18599 "orps\t{%2, %0|%0, %2}"
18600 [(set_attr "type" "sselog")
18601 (set_attr "mode" "V4SF")])
18603 (define_insn "sse_iorti3"
18604 [(set (match_operand:TI 0 "register_operand" "=x")
18605 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
18606 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18607 "TARGET_SSE && !TARGET_SSE2
18608 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18609 "orps\t{%2, %0|%0, %2}"
18610 [(set_attr "type" "sselog")
18611 (set_attr "mode" "V4SF")])
18613 (define_insn "sse2_iorti3"
18614 [(set (match_operand:TI 0 "register_operand" "=x")
18615 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
18616 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18618 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18619 "por\t{%2, %0|%0, %2}"
18620 [(set_attr "type" "sselog")
18621 (set_attr "mode" "TI")])
18623 (define_insn "sse2_iorv2di3"
18624 [(set (match_operand:V2DI 0 "register_operand" "=x")
18625 (ior:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
18626 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
18628 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18629 "por\t{%2, %0|%0, %2}"
18630 [(set_attr "type" "sselog")
18631 (set_attr "mode" "TI")])
18633 (define_insn "*sse_xorti3_df_1"
18634 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18635 (xor:TI (subreg:TI (match_operand:DF 1 "register_operand" "%0") 0)
18636 (subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
18638 "xorpd\t{%2, %0|%0, %2}"
18639 [(set_attr "type" "sselog")
18640 (set_attr "mode" "V2DF")])
18642 (define_insn "*sse_xorti3_df_2"
18643 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
18644 (xor:TI (subreg:TI (match_operand:DF 1 "register_operand" "0") 0)
18645 (match_operand:TI 2 "nonimmediate_operand" "Ym")))]
18647 "xorpd\t{%2, %0|%0, %2}"
18648 [(set_attr "type" "sselog")
18649 (set_attr "mode" "V2DF")])
18651 (define_insn "*sse_xorti3_sf_1"
18652 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18653 (xor:TI (subreg:TI (match_operand:SF 1 "register_operand" "%0") 0)
18654 (subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
18656 "xorps\t{%2, %0|%0, %2}"
18657 [(set_attr "type" "sselog")
18658 (set_attr "mode" "V4SF")])
18660 (define_insn "*sse_xorti3_sf_2"
18661 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
18662 (xor:TI (subreg:TI (match_operand:SF 1 "register_operand" "0") 0)
18663 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18665 "xorps\t{%2, %0|%0, %2}"
18666 [(set_attr "type" "sselog")
18667 (set_attr "mode" "V4SF")])
18669 (define_insn "sse_xorti3"
18670 [(set (match_operand:TI 0 "register_operand" "=x")
18671 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
18672 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18673 "TARGET_SSE && !TARGET_SSE2
18674 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18675 "xorps\t{%2, %0|%0, %2}"
18676 [(set_attr "type" "sselog")
18677 (set_attr "mode" "V4SF")])
18679 (define_insn "sse2_xorti3"
18680 [(set (match_operand:TI 0 "register_operand" "=x")
18681 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
18682 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
18684 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18685 "pxor\t{%2, %0|%0, %2}"
18686 [(set_attr "type" "sselog")
18687 (set_attr "mode" "TI")])
18689 (define_insn "sse2_xorv2di3"
18690 [(set (match_operand:V2DI 0 "register_operand" "=x")
18691 (xor:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
18692 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
18694 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
18695 "pxor\t{%2, %0|%0, %2}"
18696 [(set_attr "type" "sselog")
18697 (set_attr "mode" "TI")])
18699 ;; Use xor, but don't show input operands so they aren't live before
18701 (define_insn "sse_clrv4sf"
18702 [(set (match_operand:V4SF 0 "register_operand" "=x")
18703 (unspec:V4SF [(const_int 0)] UNSPEC_NOP))]
18705 "xorps\t{%0, %0|%0, %0}"
18706 [(set_attr "type" "sselog")
18707 (set_attr "memory" "none")
18708 (set_attr "mode" "V4SF")])
18710 ;; SSE mask-generating compares
18712 (define_insn "maskcmpv4sf3"
18713 [(set (match_operand:V4SI 0 "register_operand" "=x")
18714 (match_operator:V4SI 3 "sse_comparison_operator"
18715 [(match_operand:V4SF 1 "register_operand" "0")
18716 (match_operand:V4SF 2 "register_operand" "x")]))]
18718 "cmp%D3ps\t{%2, %0|%0, %2}"
18719 [(set_attr "type" "ssecmp")
18720 (set_attr "mode" "V4SF")])
18722 (define_insn "maskncmpv4sf3"
18723 [(set (match_operand:V4SI 0 "register_operand" "=x")
18725 (match_operator:V4SI 3 "sse_comparison_operator"
18726 [(match_operand:V4SF 1 "register_operand" "0")
18727 (match_operand:V4SF 2 "register_operand" "x")])))]
18730 if (GET_CODE (operands[3]) == UNORDERED)
18731 return "cmpordps\t{%2, %0|%0, %2}";
18733 return "cmpn%D3ps\t{%2, %0|%0, %2}";
18735 [(set_attr "type" "ssecmp")
18736 (set_attr "mode" "V4SF")])
18738 (define_insn "vmmaskcmpv4sf3"
18739 [(set (match_operand:V4SI 0 "register_operand" "=x")
18741 (match_operator:V4SI 3 "sse_comparison_operator"
18742 [(match_operand:V4SF 1 "register_operand" "0")
18743 (match_operand:V4SF 2 "register_operand" "x")])
18747 "cmp%D3ss\t{%2, %0|%0, %2}"
18748 [(set_attr "type" "ssecmp")
18749 (set_attr "mode" "SF")])
18751 (define_insn "vmmaskncmpv4sf3"
18752 [(set (match_operand:V4SI 0 "register_operand" "=x")
18755 (match_operator:V4SI 3 "sse_comparison_operator"
18756 [(match_operand:V4SF 1 "register_operand" "0")
18757 (match_operand:V4SF 2 "register_operand" "x")]))
18758 (subreg:V4SI (match_dup 1) 0)
18762 if (GET_CODE (operands[3]) == UNORDERED)
18763 return "cmpordss\t{%2, %0|%0, %2}";
18765 return "cmpn%D3ss\t{%2, %0|%0, %2}";
18767 [(set_attr "type" "ssecmp")
18768 (set_attr "mode" "SF")])
18770 (define_insn "sse_comi"
18771 [(set (reg:CCFP 17)
18772 (match_operator:CCFP 2 "sse_comparison_operator"
18774 (match_operand:V4SF 0 "register_operand" "x")
18775 (parallel [(const_int 0)]))
18777 (match_operand:V4SF 1 "register_operand" "x")
18778 (parallel [(const_int 0)]))]))]
18780 "comiss\t{%1, %0|%0, %1}"
18781 [(set_attr "type" "ssecmp")
18782 (set_attr "mode" "SF")])
18784 (define_insn "sse_ucomi"
18785 [(set (reg:CCFPU 17)
18786 (match_operator:CCFPU 2 "sse_comparison_operator"
18788 (match_operand:V4SF 0 "register_operand" "x")
18789 (parallel [(const_int 0)]))
18791 (match_operand:V4SF 1 "register_operand" "x")
18792 (parallel [(const_int 0)]))]))]
18794 "ucomiss\t{%1, %0|%0, %1}"
18795 [(set_attr "type" "ssecmp")
18796 (set_attr "mode" "SF")])
18801 (define_insn "sse_unpckhps"
18802 [(set (match_operand:V4SF 0 "register_operand" "=x")
18804 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
18805 (parallel [(const_int 2)
18809 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
18810 (parallel [(const_int 0)
18816 "unpckhps\t{%2, %0|%0, %2}"
18817 [(set_attr "type" "ssecvt")
18818 (set_attr "mode" "V4SF")])
18820 (define_insn "sse_unpcklps"
18821 [(set (match_operand:V4SF 0 "register_operand" "=x")
18823 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
18824 (parallel [(const_int 0)
18828 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
18829 (parallel [(const_int 2)
18835 "unpcklps\t{%2, %0|%0, %2}"
18836 [(set_attr "type" "ssecvt")
18837 (set_attr "mode" "V4SF")])
18842 (define_insn "smaxv4sf3"
18843 [(set (match_operand:V4SF 0 "register_operand" "=x")
18844 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
18845 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
18847 "maxps\t{%2, %0|%0, %2}"
18848 [(set_attr "type" "sse")
18849 (set_attr "mode" "V4SF")])
18851 (define_insn "vmsmaxv4sf3"
18852 [(set (match_operand:V4SF 0 "register_operand" "=x")
18854 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
18855 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
18859 "maxss\t{%2, %0|%0, %2}"
18860 [(set_attr "type" "sse")
18861 (set_attr "mode" "SF")])
18863 (define_insn "sminv4sf3"
18864 [(set (match_operand:V4SF 0 "register_operand" "=x")
18865 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
18866 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
18868 "minps\t{%2, %0|%0, %2}"
18869 [(set_attr "type" "sse")
18870 (set_attr "mode" "V4SF")])
18872 (define_insn "vmsminv4sf3"
18873 [(set (match_operand:V4SF 0 "register_operand" "=x")
18875 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
18876 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
18880 "minss\t{%2, %0|%0, %2}"
18881 [(set_attr "type" "sse")
18882 (set_attr "mode" "SF")])
18885 ;; SSE <-> integer/MMX conversions
18887 (define_insn "cvtpi2ps"
18888 [(set (match_operand:V4SF 0 "register_operand" "=x")
18890 (match_operand:V4SF 1 "register_operand" "0")
18891 (vec_duplicate:V4SF
18892 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
18895 "cvtpi2ps\t{%2, %0|%0, %2}"
18896 [(set_attr "type" "ssecvt")
18897 (set_attr "mode" "V4SF")])
18899 (define_insn "cvtps2pi"
18900 [(set (match_operand:V2SI 0 "register_operand" "=y")
18902 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
18903 (parallel [(const_int 0) (const_int 1)])))]
18905 "cvtps2pi\t{%1, %0|%0, %1}"
18906 [(set_attr "type" "ssecvt")
18907 (set_attr "mode" "V4SF")])
18909 (define_insn "cvttps2pi"
18910 [(set (match_operand:V2SI 0 "register_operand" "=y")
18912 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
18914 (parallel [(const_int 0) (const_int 1)])))]
18916 "cvttps2pi\t{%1, %0|%0, %1}"
18917 [(set_attr "type" "ssecvt")
18918 (set_attr "mode" "SF")])
18920 (define_insn "cvtsi2ss"
18921 [(set (match_operand:V4SF 0 "register_operand" "=x")
18923 (match_operand:V4SF 1 "register_operand" "0")
18924 (vec_duplicate:V4SF
18925 (float:SF (match_operand:SI 2 "nonimmediate_operand" "rm")))
18928 "cvtsi2ss\t{%2, %0|%0, %2}"
18929 [(set_attr "type" "ssecvt")
18930 (set_attr "mode" "SF")])
18932 (define_insn "cvtss2si"
18933 [(set (match_operand:SI 0 "register_operand" "=r")
18935 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
18936 (parallel [(const_int 0)])))]
18938 "cvtss2si\t{%1, %0|%0, %1}"
18939 [(set_attr "type" "ssecvt")
18940 (set_attr "mode" "SF")])
18942 (define_insn "cvttss2si"
18943 [(set (match_operand:SI 0 "register_operand" "=r")
18945 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
18947 (parallel [(const_int 0)])))]
18949 "cvttss2si\t{%1, %0|%0, %1}"
18950 [(set_attr "type" "ssecvt")
18951 (set_attr "mode" "SF")])
18958 (define_insn "addv8qi3"
18959 [(set (match_operand:V8QI 0 "register_operand" "=y")
18960 (plus:V8QI (match_operand:V8QI 1 "register_operand" "0")
18961 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
18963 "paddb\t{%2, %0|%0, %2}"
18964 [(set_attr "type" "mmxadd")
18965 (set_attr "mode" "DI")])
18967 (define_insn "addv4hi3"
18968 [(set (match_operand:V4HI 0 "register_operand" "=y")
18969 (plus:V4HI (match_operand:V4HI 1 "register_operand" "0")
18970 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
18972 "paddw\t{%2, %0|%0, %2}"
18973 [(set_attr "type" "mmxadd")
18974 (set_attr "mode" "DI")])
18976 (define_insn "addv2si3"
18977 [(set (match_operand:V2SI 0 "register_operand" "=y")
18978 (plus:V2SI (match_operand:V2SI 1 "register_operand" "0")
18979 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
18981 "paddd\t{%2, %0|%0, %2}"
18982 [(set_attr "type" "mmxadd")
18983 (set_attr "mode" "DI")])
18985 (define_insn "ssaddv8qi3"
18986 [(set (match_operand:V8QI 0 "register_operand" "=y")
18987 (ss_plus:V8QI (match_operand:V8QI 1 "register_operand" "0")
18988 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
18990 "paddsb\t{%2, %0|%0, %2}"
18991 [(set_attr "type" "mmxadd")
18992 (set_attr "mode" "DI")])
18994 (define_insn "ssaddv4hi3"
18995 [(set (match_operand:V4HI 0 "register_operand" "=y")
18996 (ss_plus:V4HI (match_operand:V4HI 1 "register_operand" "0")
18997 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
18999 "paddsw\t{%2, %0|%0, %2}"
19000 [(set_attr "type" "mmxadd")
19001 (set_attr "mode" "DI")])
19003 (define_insn "usaddv8qi3"
19004 [(set (match_operand:V8QI 0 "register_operand" "=y")
19005 (us_plus:V8QI (match_operand:V8QI 1 "register_operand" "0")
19006 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19008 "paddusb\t{%2, %0|%0, %2}"
19009 [(set_attr "type" "mmxadd")
19010 (set_attr "mode" "DI")])
19012 (define_insn "usaddv4hi3"
19013 [(set (match_operand:V4HI 0 "register_operand" "=y")
19014 (us_plus:V4HI (match_operand:V4HI 1 "register_operand" "0")
19015 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19017 "paddusw\t{%2, %0|%0, %2}"
19018 [(set_attr "type" "mmxadd")
19019 (set_attr "mode" "DI")])
19021 (define_insn "subv8qi3"
19022 [(set (match_operand:V8QI 0 "register_operand" "=y")
19023 (minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
19024 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19026 "psubb\t{%2, %0|%0, %2}"
19027 [(set_attr "type" "mmxadd")
19028 (set_attr "mode" "DI")])
19030 (define_insn "subv4hi3"
19031 [(set (match_operand:V4HI 0 "register_operand" "=y")
19032 (minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
19033 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19035 "psubw\t{%2, %0|%0, %2}"
19036 [(set_attr "type" "mmxadd")
19037 (set_attr "mode" "DI")])
19039 (define_insn "subv2si3"
19040 [(set (match_operand:V2SI 0 "register_operand" "=y")
19041 (minus:V2SI (match_operand:V2SI 1 "register_operand" "0")
19042 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
19044 "psubd\t{%2, %0|%0, %2}"
19045 [(set_attr "type" "mmxadd")
19046 (set_attr "mode" "DI")])
19048 (define_insn "sssubv8qi3"
19049 [(set (match_operand:V8QI 0 "register_operand" "=y")
19050 (ss_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
19051 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19053 "psubsb\t{%2, %0|%0, %2}"
19054 [(set_attr "type" "mmxadd")
19055 (set_attr "mode" "DI")])
19057 (define_insn "sssubv4hi3"
19058 [(set (match_operand:V4HI 0 "register_operand" "=y")
19059 (ss_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
19060 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19062 "psubsw\t{%2, %0|%0, %2}"
19063 [(set_attr "type" "mmxadd")
19064 (set_attr "mode" "DI")])
19066 (define_insn "ussubv8qi3"
19067 [(set (match_operand:V8QI 0 "register_operand" "=y")
19068 (us_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
19069 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19071 "psubusb\t{%2, %0|%0, %2}"
19072 [(set_attr "type" "mmxadd")
19073 (set_attr "mode" "DI")])
19075 (define_insn "ussubv4hi3"
19076 [(set (match_operand:V4HI 0 "register_operand" "=y")
19077 (us_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
19078 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19080 "psubusw\t{%2, %0|%0, %2}"
19081 [(set_attr "type" "mmxadd")
19082 (set_attr "mode" "DI")])
19084 (define_insn "mulv4hi3"
19085 [(set (match_operand:V4HI 0 "register_operand" "=y")
19086 (mult:V4HI (match_operand:V4HI 1 "register_operand" "0")
19087 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19089 "pmullw\t{%2, %0|%0, %2}"
19090 [(set_attr "type" "mmxmul")
19091 (set_attr "mode" "DI")])
19093 (define_insn "smulv4hi3_highpart"
19094 [(set (match_operand:V4HI 0 "register_operand" "=y")
19097 (mult:V4SI (sign_extend:V4SI
19098 (match_operand:V4HI 1 "register_operand" "0"))
19100 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
19103 "pmulhw\t{%2, %0|%0, %2}"
19104 [(set_attr "type" "mmxmul")
19105 (set_attr "mode" "DI")])
19107 (define_insn "umulv4hi3_highpart"
19108 [(set (match_operand:V4HI 0 "register_operand" "=y")
19111 (mult:V4SI (zero_extend:V4SI
19112 (match_operand:V4HI 1 "register_operand" "0"))
19114 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
19116 "TARGET_SSE || TARGET_3DNOW_A"
19117 "pmulhuw\t{%2, %0|%0, %2}"
19118 [(set_attr "type" "mmxmul")
19119 (set_attr "mode" "DI")])
19121 (define_insn "mmx_pmaddwd"
19122 [(set (match_operand:V2SI 0 "register_operand" "=y")
19126 (vec_select:V2HI (match_operand:V4HI 1 "register_operand" "0")
19127 (parallel [(const_int 0) (const_int 2)])))
19129 (vec_select:V2HI (match_operand:V4HI 2 "nonimmediate_operand" "ym")
19130 (parallel [(const_int 0) (const_int 2)]))))
19132 (sign_extend:V2SI (vec_select:V2HI (match_dup 1)
19133 (parallel [(const_int 1)
19135 (sign_extend:V2SI (vec_select:V2HI (match_dup 2)
19136 (parallel [(const_int 1)
19137 (const_int 3)]))))))]
19139 "pmaddwd\t{%2, %0|%0, %2}"
19140 [(set_attr "type" "mmxmul")
19141 (set_attr "mode" "DI")])
19144 ;; MMX logical operations
19145 ;; Note we don't want to declare these as regular iordi3 insns to prevent
19146 ;; normal code that also wants to use the FPU from getting broken.
19147 ;; The UNSPECs are there to prevent the combiner from getting overly clever.
19148 (define_insn "mmx_iordi3"
19149 [(set (match_operand:DI 0 "register_operand" "=y")
19151 [(ior:DI (match_operand:DI 1 "register_operand" "0")
19152 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
19155 "por\t{%2, %0|%0, %2}"
19156 [(set_attr "type" "mmxadd")
19157 (set_attr "mode" "DI")])
19159 (define_insn "mmx_xordi3"
19160 [(set (match_operand:DI 0 "register_operand" "=y")
19162 [(xor:DI (match_operand:DI 1 "register_operand" "0")
19163 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
19166 "pxor\t{%2, %0|%0, %2}"
19167 [(set_attr "type" "mmxadd")
19168 (set_attr "mode" "DI")
19169 (set_attr "memory" "none")])
19171 ;; Same as pxor, but don't show input operands so that we don't think
19173 (define_insn "mmx_clrdi"
19174 [(set (match_operand:DI 0 "register_operand" "=y")
19175 (unspec:DI [(const_int 0)] UNSPEC_NOP))]
19177 "pxor\t{%0, %0|%0, %0}"
19178 [(set_attr "type" "mmxadd")
19179 (set_attr "mode" "DI")
19180 (set_attr "memory" "none")])
19182 (define_insn "mmx_anddi3"
19183 [(set (match_operand:DI 0 "register_operand" "=y")
19185 [(and:DI (match_operand:DI 1 "register_operand" "0")
19186 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
19189 "pand\t{%2, %0|%0, %2}"
19190 [(set_attr "type" "mmxadd")
19191 (set_attr "mode" "DI")])
19193 (define_insn "mmx_nanddi3"
19194 [(set (match_operand:DI 0 "register_operand" "=y")
19196 [(and:DI (not:DI (match_operand:DI 1 "register_operand" "0"))
19197 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
19200 "pandn\t{%2, %0|%0, %2}"
19201 [(set_attr "type" "mmxadd")
19202 (set_attr "mode" "DI")])
19205 ;; MMX unsigned averages/sum of absolute differences
19207 (define_insn "mmx_uavgv8qi3"
19208 [(set (match_operand:V8QI 0 "register_operand" "=y")
19210 (plus:V8QI (plus:V8QI
19211 (match_operand:V8QI 1 "register_operand" "0")
19212 (match_operand:V8QI 2 "nonimmediate_operand" "ym"))
19213 (const_vector:V8QI [(const_int 1)
19222 "TARGET_SSE || TARGET_3DNOW_A"
19223 "pavgb\t{%2, %0|%0, %2}"
19224 [(set_attr "type" "mmxshft")
19225 (set_attr "mode" "DI")])
19227 (define_insn "mmx_uavgv4hi3"
19228 [(set (match_operand:V4HI 0 "register_operand" "=y")
19230 (plus:V4HI (plus:V4HI
19231 (match_operand:V4HI 1 "register_operand" "0")
19232 (match_operand:V4HI 2 "nonimmediate_operand" "ym"))
19233 (const_vector:V4HI [(const_int 1)
19238 "TARGET_SSE || TARGET_3DNOW_A"
19239 "pavgw\t{%2, %0|%0, %2}"
19240 [(set_attr "type" "mmxshft")
19241 (set_attr "mode" "DI")])
19243 (define_insn "mmx_psadbw"
19244 [(set (match_operand:DI 0 "register_operand" "=y")
19245 (unspec:DI [(match_operand:V8QI 1 "register_operand" "0")
19246 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
19248 "TARGET_SSE || TARGET_3DNOW_A"
19249 "psadbw\t{%2, %0|%0, %2}"
19250 [(set_attr "type" "mmxshft")
19251 (set_attr "mode" "DI")])
19254 ;; MMX insert/extract/shuffle
19256 (define_insn "mmx_pinsrw"
19257 [(set (match_operand:V4HI 0 "register_operand" "=y")
19258 (vec_merge:V4HI (match_operand:V4HI 1 "register_operand" "0")
19259 (vec_duplicate:V4HI
19260 (truncate:HI (match_operand:SI 2 "nonimmediate_operand" "rm")))
19261 (match_operand:SI 3 "immediate_operand" "i")))]
19262 "TARGET_SSE || TARGET_3DNOW_A"
19263 "pinsrw\t{%3, %2, %0|%0, %2, %3}"
19264 [(set_attr "type" "mmxcvt")
19265 (set_attr "mode" "DI")])
19267 (define_insn "mmx_pextrw"
19268 [(set (match_operand:SI 0 "register_operand" "=r")
19269 (zero_extend:SI (vec_select:HI (match_operand:V4HI 1 "register_operand" "y")
19271 [(match_operand:SI 2 "immediate_operand" "i")]))))]
19272 "TARGET_SSE || TARGET_3DNOW_A"
19273 "pextrw\t{%2, %1, %0|%0, %1, %2}"
19274 [(set_attr "type" "mmxcvt")
19275 (set_attr "mode" "DI")])
19277 (define_insn "mmx_pshufw"
19278 [(set (match_operand:V4HI 0 "register_operand" "=y")
19279 (unspec:V4HI [(match_operand:V4HI 1 "register_operand" "0")
19280 (match_operand:SI 2 "immediate_operand" "i")]
19282 "TARGET_SSE || TARGET_3DNOW_A"
19283 "pshufw\t{%2, %1, %0|%0, %1, %2}"
19284 [(set_attr "type" "mmxcvt")
19285 (set_attr "mode" "DI")])
19288 ;; MMX mask-generating comparisons
19290 (define_insn "eqv8qi3"
19291 [(set (match_operand:V8QI 0 "register_operand" "=y")
19292 (eq:V8QI (match_operand:V8QI 1 "register_operand" "0")
19293 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19295 "pcmpeqb\t{%2, %0|%0, %2}"
19296 [(set_attr "type" "mmxcmp")
19297 (set_attr "mode" "DI")])
19299 (define_insn "eqv4hi3"
19300 [(set (match_operand:V4HI 0 "register_operand" "=y")
19301 (eq:V4HI (match_operand:V4HI 1 "register_operand" "0")
19302 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19304 "pcmpeqw\t{%2, %0|%0, %2}"
19305 [(set_attr "type" "mmxcmp")
19306 (set_attr "mode" "DI")])
19308 (define_insn "eqv2si3"
19309 [(set (match_operand:V2SI 0 "register_operand" "=y")
19310 (eq:V2SI (match_operand:V2SI 1 "register_operand" "0")
19311 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
19313 "pcmpeqd\t{%2, %0|%0, %2}"
19314 [(set_attr "type" "mmxcmp")
19315 (set_attr "mode" "DI")])
19317 (define_insn "gtv8qi3"
19318 [(set (match_operand:V8QI 0 "register_operand" "=y")
19319 (gt:V8QI (match_operand:V8QI 1 "register_operand" "0")
19320 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19322 "pcmpgtb\t{%2, %0|%0, %2}"
19323 [(set_attr "type" "mmxcmp")
19324 (set_attr "mode" "DI")])
19326 (define_insn "gtv4hi3"
19327 [(set (match_operand:V4HI 0 "register_operand" "=y")
19328 (gt:V4HI (match_operand:V4HI 1 "register_operand" "0")
19329 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19331 "pcmpgtw\t{%2, %0|%0, %2}"
19332 [(set_attr "type" "mmxcmp")
19333 (set_attr "mode" "DI")])
19335 (define_insn "gtv2si3"
19336 [(set (match_operand:V2SI 0 "register_operand" "=y")
19337 (gt:V2SI (match_operand:V2SI 1 "register_operand" "0")
19338 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
19340 "pcmpgtd\t{%2, %0|%0, %2}"
19341 [(set_attr "type" "mmxcmp")
19342 (set_attr "mode" "DI")])
19345 ;; MMX max/min insns
19347 (define_insn "umaxv8qi3"
19348 [(set (match_operand:V8QI 0 "register_operand" "=y")
19349 (umax:V8QI (match_operand:V8QI 1 "register_operand" "0")
19350 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19351 "TARGET_SSE || TARGET_3DNOW_A"
19352 "pmaxub\t{%2, %0|%0, %2}"
19353 [(set_attr "type" "mmxadd")
19354 (set_attr "mode" "DI")])
19356 (define_insn "smaxv4hi3"
19357 [(set (match_operand:V4HI 0 "register_operand" "=y")
19358 (smax:V4HI (match_operand:V4HI 1 "register_operand" "0")
19359 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19360 "TARGET_SSE || TARGET_3DNOW_A"
19361 "pmaxsw\t{%2, %0|%0, %2}"
19362 [(set_attr "type" "mmxadd")
19363 (set_attr "mode" "DI")])
19365 (define_insn "uminv8qi3"
19366 [(set (match_operand:V8QI 0 "register_operand" "=y")
19367 (umin:V8QI (match_operand:V8QI 1 "register_operand" "0")
19368 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
19369 "TARGET_SSE || TARGET_3DNOW_A"
19370 "pminub\t{%2, %0|%0, %2}"
19371 [(set_attr "type" "mmxadd")
19372 (set_attr "mode" "DI")])
19374 (define_insn "sminv4hi3"
19375 [(set (match_operand:V4HI 0 "register_operand" "=y")
19376 (smin:V4HI (match_operand:V4HI 1 "register_operand" "0")
19377 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
19378 "TARGET_SSE || TARGET_3DNOW_A"
19379 "pminsw\t{%2, %0|%0, %2}"
19380 [(set_attr "type" "mmxadd")
19381 (set_attr "mode" "DI")])
19386 (define_insn "ashrv4hi3"
19387 [(set (match_operand:V4HI 0 "register_operand" "=y")
19388 (ashiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
19389 (match_operand:DI 2 "nonmemory_operand" "yi")))]
19391 "psraw\t{%2, %0|%0, %2}"
19392 [(set_attr "type" "mmxshft")
19393 (set_attr "mode" "DI")])
19395 (define_insn "ashrv2si3"
19396 [(set (match_operand:V2SI 0 "register_operand" "=y")
19397 (ashiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
19398 (match_operand:DI 2 "nonmemory_operand" "yi")))]
19400 "psrad\t{%2, %0|%0, %2}"
19401 [(set_attr "type" "mmxshft")
19402 (set_attr "mode" "DI")])
19404 (define_insn "lshrv4hi3"
19405 [(set (match_operand:V4HI 0 "register_operand" "=y")
19406 (lshiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
19407 (match_operand:DI 2 "nonmemory_operand" "yi")))]
19409 "psrlw\t{%2, %0|%0, %2}"
19410 [(set_attr "type" "mmxshft")
19411 (set_attr "mode" "DI")])
19413 (define_insn "lshrv2si3"
19414 [(set (match_operand:V2SI 0 "register_operand" "=y")
19415 (lshiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
19416 (match_operand:DI 2 "nonmemory_operand" "yi")))]
19418 "psrld\t{%2, %0|%0, %2}"
19419 [(set_attr "type" "mmxshft")
19420 (set_attr "mode" "DI")])
19422 ;; See logical MMX insns.
19423 (define_insn "mmx_lshrdi3"
19424 [(set (match_operand:DI 0 "register_operand" "=y")
19426 [(lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
19427 (match_operand:DI 2 "nonmemory_operand" "yi"))]
19430 "psrlq\t{%2, %0|%0, %2}"
19431 [(set_attr "type" "mmxshft")
19432 (set_attr "mode" "DI")])
19434 (define_insn "ashlv4hi3"
19435 [(set (match_operand:V4HI 0 "register_operand" "=y")
19436 (ashift:V4HI (match_operand:V4HI 1 "register_operand" "0")
19437 (match_operand:DI 2 "nonmemory_operand" "yi")))]
19439 "psllw\t{%2, %0|%0, %2}"
19440 [(set_attr "type" "mmxshft")
19441 (set_attr "mode" "DI")])
19443 (define_insn "ashlv2si3"
19444 [(set (match_operand:V2SI 0 "register_operand" "=y")
19445 (ashift:V2SI (match_operand:V2SI 1 "register_operand" "0")
19446 (match_operand:DI 2 "nonmemory_operand" "yi")))]
19448 "pslld\t{%2, %0|%0, %2}"
19449 [(set_attr "type" "mmxshft")
19450 (set_attr "mode" "DI")])
19452 ;; See logical MMX insns.
19453 (define_insn "mmx_ashldi3"
19454 [(set (match_operand:DI 0 "register_operand" "=y")
19456 [(ashift:DI (match_operand:DI 1 "register_operand" "0")
19457 (match_operand:DI 2 "nonmemory_operand" "yi"))]
19460 "psllq\t{%2, %0|%0, %2}"
19461 [(set_attr "type" "mmxshft")
19462 (set_attr "mode" "DI")])
19465 ;; MMX pack/unpack insns.
19467 (define_insn "mmx_packsswb"
19468 [(set (match_operand:V8QI 0 "register_operand" "=y")
19470 (ss_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
19471 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
19473 "packsswb\t{%2, %0|%0, %2}"
19474 [(set_attr "type" "mmxshft")
19475 (set_attr "mode" "DI")])
19477 (define_insn "mmx_packssdw"
19478 [(set (match_operand:V4HI 0 "register_operand" "=y")
19480 (ss_truncate:V2HI (match_operand:V2SI 1 "register_operand" "0"))
19481 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
19483 "packssdw\t{%2, %0|%0, %2}"
19484 [(set_attr "type" "mmxshft")
19485 (set_attr "mode" "DI")])
19487 (define_insn "mmx_packuswb"
19488 [(set (match_operand:V8QI 0 "register_operand" "=y")
19490 (us_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
19491 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
19493 "packuswb\t{%2, %0|%0, %2}"
19494 [(set_attr "type" "mmxshft")
19495 (set_attr "mode" "DI")])
19497 (define_insn "mmx_punpckhbw"
19498 [(set (match_operand:V8QI 0 "register_operand" "=y")
19500 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
19501 (parallel [(const_int 4)
19509 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
19510 (parallel [(const_int 0)
19520 "punpckhbw\t{%2, %0|%0, %2}"
19521 [(set_attr "type" "mmxcvt")
19522 (set_attr "mode" "DI")])
19524 (define_insn "mmx_punpckhwd"
19525 [(set (match_operand:V4HI 0 "register_operand" "=y")
19527 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
19528 (parallel [(const_int 0)
19532 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
19533 (parallel [(const_int 2)
19539 "punpckhwd\t{%2, %0|%0, %2}"
19540 [(set_attr "type" "mmxcvt")
19541 (set_attr "mode" "DI")])
19543 (define_insn "mmx_punpckhdq"
19544 [(set (match_operand:V2SI 0 "register_operand" "=y")
19546 (vec_select:V2SI (match_operand:V2SI 1 "register_operand" "0")
19547 (parallel [(const_int 0)
19549 (vec_select:V2SI (match_operand:V2SI 2 "register_operand" "y")
19550 (parallel [(const_int 1)
19554 "punpckhdq\t{%2, %0|%0, %2}"
19555 [(set_attr "type" "mmxcvt")
19556 (set_attr "mode" "DI")])
19558 (define_insn "mmx_punpcklbw"
19559 [(set (match_operand:V8QI 0 "register_operand" "=y")
19561 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
19562 (parallel [(const_int 0)
19570 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
19571 (parallel [(const_int 4)
19581 "punpcklbw\t{%2, %0|%0, %2}"
19582 [(set_attr "type" "mmxcvt")
19583 (set_attr "mode" "DI")])
19585 (define_insn "mmx_punpcklwd"
19586 [(set (match_operand:V4HI 0 "register_operand" "=y")
19588 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
19589 (parallel [(const_int 2)
19593 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
19594 (parallel [(const_int 0)
19600 "punpcklwd\t{%2, %0|%0, %2}"
19601 [(set_attr "type" "mmxcvt")
19602 (set_attr "mode" "DI")])
19604 (define_insn "mmx_punpckldq"
19605 [(set (match_operand:V2SI 0 "register_operand" "=y")
19607 (vec_select:V2SI (match_operand:V2SI 1 "register_operand" "0")
19608 (parallel [(const_int 1)
19610 (vec_select:V2SI (match_operand:V2SI 2 "register_operand" "y")
19611 (parallel [(const_int 0)
19615 "punpckldq\t{%2, %0|%0, %2}"
19616 [(set_attr "type" "mmxcvt")
19617 (set_attr "mode" "DI")])
19620 ;; Miscellaneous stuff
19622 (define_insn "emms"
19623 [(unspec_volatile [(const_int 0)] UNSPECV_EMMS)
19624 (clobber (reg:XF 8))
19625 (clobber (reg:XF 9))
19626 (clobber (reg:XF 10))
19627 (clobber (reg:XF 11))
19628 (clobber (reg:XF 12))
19629 (clobber (reg:XF 13))
19630 (clobber (reg:XF 14))
19631 (clobber (reg:XF 15))
19632 (clobber (reg:DI 29))
19633 (clobber (reg:DI 30))
19634 (clobber (reg:DI 31))
19635 (clobber (reg:DI 32))
19636 (clobber (reg:DI 33))
19637 (clobber (reg:DI 34))
19638 (clobber (reg:DI 35))
19639 (clobber (reg:DI 36))]
19642 [(set_attr "type" "mmx")
19643 (set_attr "memory" "unknown")])
19645 (define_insn "ldmxcsr"
19646 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
19650 [(set_attr "type" "mmx")
19651 (set_attr "memory" "load")])
19653 (define_insn "stmxcsr"
19654 [(set (match_operand:SI 0 "memory_operand" "=m")
19655 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
19658 [(set_attr "type" "mmx")
19659 (set_attr "memory" "store")])
19661 (define_expand "sfence"
19662 [(set (match_dup 0)
19663 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
19664 "TARGET_SSE || TARGET_3DNOW_A"
19666 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
19667 MEM_VOLATILE_P (operands[0]) = 1;
19670 (define_insn "*sfence_insn"
19671 [(set (match_operand:BLK 0 "" "")
19672 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
19673 "TARGET_SSE || TARGET_3DNOW_A"
19675 [(set_attr "type" "sse")
19676 (set_attr "memory" "unknown")])
19678 (define_expand "sse_prologue_save"
19679 [(parallel [(set (match_operand:BLK 0 "" "")
19680 (unspec:BLK [(reg:DI 21)
19687 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
19688 (use (match_operand:DI 1 "register_operand" ""))
19689 (use (match_operand:DI 2 "immediate_operand" ""))
19690 (use (label_ref:DI (match_operand 3 "" "")))])]
19694 (define_insn "*sse_prologue_save_insn"
19695 [(set (mem:BLK (plus:DI (match_operand:DI 0 "register_operand" "R")
19696 (match_operand:DI 4 "const_int_operand" "n")))
19697 (unspec:BLK [(reg:DI 21)
19704 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
19705 (use (match_operand:DI 1 "register_operand" "r"))
19706 (use (match_operand:DI 2 "const_int_operand" "i"))
19707 (use (label_ref:DI (match_operand 3 "" "X")))]
19709 && INTVAL (operands[4]) + SSE_REGPARM_MAX * 16 - 16 < 128
19710 && INTVAL (operands[4]) + INTVAL (operands[2]) * 16 >= -128"
19714 operands[0] = gen_rtx_MEM (Pmode,
19715 gen_rtx_PLUS (Pmode, operands[0], operands[4]));
19716 output_asm_insn (\"jmp\\t%A1\", operands);
19717 for (i = SSE_REGPARM_MAX - 1; i >= INTVAL (operands[2]); i--)
19719 operands[4] = adjust_address (operands[0], DImode, i*16);
19720 operands[5] = gen_rtx_REG (TImode, SSE_REGNO (i));
19721 PUT_MODE (operands[4], TImode);
19722 if (GET_CODE (XEXP (operands[0], 0)) != PLUS)
19723 output_asm_insn (\"rex\", operands);
19724 output_asm_insn (\"movaps\\t{%5, %4|%4, %5}\", operands);
19726 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
19727 CODE_LABEL_NUMBER (operands[3]));
19731 [(set_attr "type" "other")
19732 (set_attr "length_immediate" "0")
19733 (set_attr "length_address" "0")
19734 (set_attr "length" "135")
19735 (set_attr "memory" "store")
19736 (set_attr "modrm" "0")
19737 (set_attr "mode" "DI")])
19739 ;; 3Dnow! instructions
19741 (define_insn "addv2sf3"
19742 [(set (match_operand:V2SF 0 "register_operand" "=y")
19743 (plus:V2SF (match_operand:V2SF 1 "register_operand" "0")
19744 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19746 "pfadd\\t{%2, %0|%0, %2}"
19747 [(set_attr "type" "mmxadd")
19748 (set_attr "mode" "V2SF")])
19750 (define_insn "subv2sf3"
19751 [(set (match_operand:V2SF 0 "register_operand" "=y")
19752 (minus:V2SF (match_operand:V2SF 1 "register_operand" "0")
19753 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19755 "pfsub\\t{%2, %0|%0, %2}"
19756 [(set_attr "type" "mmxadd")
19757 (set_attr "mode" "V2SF")])
19759 (define_insn "subrv2sf3"
19760 [(set (match_operand:V2SF 0 "register_operand" "=y")
19761 (minus:V2SF (match_operand:V2SF 2 "nonimmediate_operand" "ym")
19762 (match_operand:V2SF 1 "register_operand" "0")))]
19764 "pfsubr\\t{%2, %0|%0, %2}"
19765 [(set_attr "type" "mmxadd")
19766 (set_attr "mode" "V2SF")])
19768 (define_insn "gtv2sf3"
19769 [(set (match_operand:V2SI 0 "register_operand" "=y")
19770 (gt:V2SI (match_operand:V2SF 1 "register_operand" "0")
19771 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19773 "pfcmpgt\\t{%2, %0|%0, %2}"
19774 [(set_attr "type" "mmxcmp")
19775 (set_attr "mode" "V2SF")])
19777 (define_insn "gev2sf3"
19778 [(set (match_operand:V2SI 0 "register_operand" "=y")
19779 (ge:V2SI (match_operand:V2SF 1 "register_operand" "0")
19780 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19782 "pfcmpge\\t{%2, %0|%0, %2}"
19783 [(set_attr "type" "mmxcmp")
19784 (set_attr "mode" "V2SF")])
19786 (define_insn "eqv2sf3"
19787 [(set (match_operand:V2SI 0 "register_operand" "=y")
19788 (eq:V2SI (match_operand:V2SF 1 "register_operand" "0")
19789 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19791 "pfcmpeq\\t{%2, %0|%0, %2}"
19792 [(set_attr "type" "mmxcmp")
19793 (set_attr "mode" "V2SF")])
19795 (define_insn "pfmaxv2sf3"
19796 [(set (match_operand:V2SF 0 "register_operand" "=y")
19797 (smax:V2SF (match_operand:V2SF 1 "register_operand" "0")
19798 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19800 "pfmax\\t{%2, %0|%0, %2}"
19801 [(set_attr "type" "mmxadd")
19802 (set_attr "mode" "V2SF")])
19804 (define_insn "pfminv2sf3"
19805 [(set (match_operand:V2SF 0 "register_operand" "=y")
19806 (smin:V2SF (match_operand:V2SF 1 "register_operand" "0")
19807 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19809 "pfmin\\t{%2, %0|%0, %2}"
19810 [(set_attr "type" "mmxadd")
19811 (set_attr "mode" "V2SF")])
19813 (define_insn "mulv2sf3"
19814 [(set (match_operand:V2SF 0 "register_operand" "=y")
19815 (mult:V2SF (match_operand:V2SF 1 "register_operand" "0")
19816 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
19818 "pfmul\\t{%2, %0|%0, %2}"
19819 [(set_attr "type" "mmxmul")
19820 (set_attr "mode" "V2SF")])
19822 (define_insn "femms"
19823 [(unspec_volatile [(const_int 0)] UNSPECV_FEMMS)
19824 (clobber (reg:XF 8))
19825 (clobber (reg:XF 9))
19826 (clobber (reg:XF 10))
19827 (clobber (reg:XF 11))
19828 (clobber (reg:XF 12))
19829 (clobber (reg:XF 13))
19830 (clobber (reg:XF 14))
19831 (clobber (reg:XF 15))
19832 (clobber (reg:DI 29))
19833 (clobber (reg:DI 30))
19834 (clobber (reg:DI 31))
19835 (clobber (reg:DI 32))
19836 (clobber (reg:DI 33))
19837 (clobber (reg:DI 34))
19838 (clobber (reg:DI 35))
19839 (clobber (reg:DI 36))]
19842 [(set_attr "type" "mmx")
19843 (set_attr "memory" "none")])
19845 (define_insn "pf2id"
19846 [(set (match_operand:V2SI 0 "register_operand" "=y")
19847 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
19849 "pf2id\\t{%1, %0|%0, %1}"
19850 [(set_attr "type" "mmxcvt")
19851 (set_attr "mode" "V2SF")])
19853 (define_insn "pf2iw"
19854 [(set (match_operand:V2SI 0 "register_operand" "=y")
19857 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
19859 "pf2iw\\t{%1, %0|%0, %1}"
19860 [(set_attr "type" "mmxcvt")
19861 (set_attr "mode" "V2SF")])
19863 (define_insn "pfacc"
19864 [(set (match_operand:V2SF 0 "register_operand" "=y")
19867 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
19868 (parallel [(const_int 0)]))
19869 (vec_select:SF (match_dup 1)
19870 (parallel [(const_int 1)])))
19872 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
19873 (parallel [(const_int 0)]))
19874 (vec_select:SF (match_dup 2)
19875 (parallel [(const_int 1)])))))]
19877 "pfacc\\t{%2, %0|%0, %2}"
19878 [(set_attr "type" "mmxadd")
19879 (set_attr "mode" "V2SF")])
19881 (define_insn "pfnacc"
19882 [(set (match_operand:V2SF 0 "register_operand" "=y")
19885 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
19886 (parallel [(const_int 0)]))
19887 (vec_select:SF (match_dup 1)
19888 (parallel [(const_int 1)])))
19890 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
19891 (parallel [(const_int 0)]))
19892 (vec_select:SF (match_dup 2)
19893 (parallel [(const_int 1)])))))]
19895 "pfnacc\\t{%2, %0|%0, %2}"
19896 [(set_attr "type" "mmxadd")
19897 (set_attr "mode" "V2SF")])
19899 (define_insn "pfpnacc"
19900 [(set (match_operand:V2SF 0 "register_operand" "=y")
19903 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
19904 (parallel [(const_int 0)]))
19905 (vec_select:SF (match_dup 1)
19906 (parallel [(const_int 1)])))
19908 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
19909 (parallel [(const_int 0)]))
19910 (vec_select:SF (match_dup 2)
19911 (parallel [(const_int 1)])))))]
19913 "pfpnacc\\t{%2, %0|%0, %2}"
19914 [(set_attr "type" "mmxadd")
19915 (set_attr "mode" "V2SF")])
19917 (define_insn "pi2fw"
19918 [(set (match_operand:V2SF 0 "register_operand" "=y")
19923 (vec_select:SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
19924 (parallel [(const_int 0)]))))
19927 (vec_select:SI (match_dup 1)
19928 (parallel [(const_int 1)])))))))]
19930 "pi2fw\\t{%1, %0|%0, %1}"
19931 [(set_attr "type" "mmxcvt")
19932 (set_attr "mode" "V2SF")])
19934 (define_insn "floatv2si2"
19935 [(set (match_operand:V2SF 0 "register_operand" "=y")
19936 (float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
19938 "pi2fd\\t{%1, %0|%0, %1}"
19939 [(set_attr "type" "mmxcvt")
19940 (set_attr "mode" "V2SF")])
19942 ;; This insn is identical to pavgb in operation, but the opcode is
19943 ;; different. To avoid accidentally matching pavgb, use an unspec.
19945 (define_insn "pavgusb"
19946 [(set (match_operand:V8QI 0 "register_operand" "=y")
19948 [(match_operand:V8QI 1 "register_operand" "0")
19949 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
19952 "pavgusb\\t{%2, %0|%0, %2}"
19953 [(set_attr "type" "mmxshft")
19954 (set_attr "mode" "TI")])
19956 ;; 3DNow reciprical and sqrt
19958 (define_insn "pfrcpv2sf2"
19959 [(set (match_operand:V2SF 0 "register_operand" "=y")
19960 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
19963 "pfrcp\\t{%1, %0|%0, %1}"
19964 [(set_attr "type" "mmx")
19965 (set_attr "mode" "TI")])
19967 (define_insn "pfrcpit1v2sf3"
19968 [(set (match_operand:V2SF 0 "register_operand" "=y")
19969 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
19970 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
19973 "pfrcpit1\\t{%2, %0|%0, %2}"
19974 [(set_attr "type" "mmx")
19975 (set_attr "mode" "TI")])
19977 (define_insn "pfrcpit2v2sf3"
19978 [(set (match_operand:V2SF 0 "register_operand" "=y")
19979 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
19980 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
19983 "pfrcpit2\\t{%2, %0|%0, %2}"
19984 [(set_attr "type" "mmx")
19985 (set_attr "mode" "TI")])
19987 (define_insn "pfrsqrtv2sf2"
19988 [(set (match_operand:V2SF 0 "register_operand" "=y")
19989 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
19992 "pfrsqrt\\t{%1, %0|%0, %1}"
19993 [(set_attr "type" "mmx")
19994 (set_attr "mode" "TI")])
19996 (define_insn "pfrsqit1v2sf3"
19997 [(set (match_operand:V2SF 0 "register_operand" "=y")
19998 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
19999 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
20002 "pfrsqit1\\t{%2, %0|%0, %2}"
20003 [(set_attr "type" "mmx")
20004 (set_attr "mode" "TI")])
20006 (define_insn "pmulhrwv4hi3"
20007 [(set (match_operand:V4HI 0 "register_operand" "=y")
20013 (match_operand:V4HI 1 "register_operand" "0"))
20015 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
20016 (const_vector:V4SI [(const_int 32768)
20019 (const_int 32768)]))
20022 "pmulhrw\\t{%2, %0|%0, %2}"
20023 [(set_attr "type" "mmxmul")
20024 (set_attr "mode" "TI")])
20026 (define_insn "pswapdv2si2"
20027 [(set (match_operand:V2SI 0 "register_operand" "=y")
20028 (vec_select:V2SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
20029 (parallel [(const_int 1) (const_int 0)])))]
20031 "pswapd\\t{%1, %0|%0, %1}"
20032 [(set_attr "type" "mmxcvt")
20033 (set_attr "mode" "TI")])
20035 (define_insn "pswapdv2sf2"
20036 [(set (match_operand:V2SF 0 "register_operand" "=y")
20037 (vec_select:V2SF (match_operand:V2SF 1 "nonimmediate_operand" "ym")
20038 (parallel [(const_int 1) (const_int 0)])))]
20040 "pswapd\\t{%1, %0|%0, %1}"
20041 [(set_attr "type" "mmxcvt")
20042 (set_attr "mode" "TI")])
20044 (define_expand "prefetch"
20045 [(prefetch (match_operand 0 "address_operand" "")
20046 (match_operand:SI 1 "const_int_operand" "")
20047 (match_operand:SI 2 "const_int_operand" ""))]
20048 "TARGET_PREFETCH_SSE || TARGET_3DNOW"
20050 int rw = INTVAL (operands[1]);
20051 int locality = INTVAL (operands[2]);
20053 if (rw != 0 && rw != 1)
20055 if (locality < 0 || locality > 3)
20057 if (GET_MODE (operands[0]) != Pmode && GET_MODE (operands[0]) != VOIDmode)
20060 /* Use 3dNOW prefetch in case we are asking for write prefetch not
20061 suported by SSE counterpart or the SSE prefetch is not available
20062 (K6 machines). Otherwise use SSE prefetch as it allows specifying
20064 if (TARGET_3DNOW && (!TARGET_PREFETCH_SSE || rw))
20065 operands[2] = GEN_INT (3);
20067 operands[1] = const0_rtx;
20070 (define_insn "*prefetch_sse"
20071 [(prefetch (match_operand:SI 0 "address_operand" "p")
20073 (match_operand:SI 1 "const_int_operand" ""))]
20074 "TARGET_PREFETCH_SSE && !TARGET_64BIT"
20076 static const char * const patterns[4] = {
20077 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
20080 int locality = INTVAL (operands[1]);
20081 if (locality < 0 || locality > 3)
20084 return patterns[locality];
20086 [(set_attr "type" "sse")
20087 (set_attr "memory" "none")])
20089 (define_insn "*prefetch_sse_rex"
20090 [(prefetch (match_operand:DI 0 "address_operand" "p")
20092 (match_operand:SI 1 "const_int_operand" ""))]
20093 "TARGET_PREFETCH_SSE && TARGET_64BIT"
20095 static const char * const patterns[4] = {
20096 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
20099 int locality = INTVAL (operands[1]);
20100 if (locality < 0 || locality > 3)
20103 return patterns[locality];
20105 [(set_attr "type" "sse")
20106 (set_attr "memory" "none")])
20108 (define_insn "*prefetch_3dnow"
20109 [(prefetch (match_operand:SI 0 "address_operand" "p")
20110 (match_operand:SI 1 "const_int_operand" "n")
20112 "TARGET_3DNOW && !TARGET_64BIT"
20114 if (INTVAL (operands[1]) == 0)
20115 return "prefetch\t%a0";
20117 return "prefetchw\t%a0";
20119 [(set_attr "type" "mmx")
20120 (set_attr "memory" "none")])
20122 (define_insn "*prefetch_3dnow_rex"
20123 [(prefetch (match_operand:DI 0 "address_operand" "p")
20124 (match_operand:SI 1 "const_int_operand" "n")
20126 "TARGET_3DNOW && TARGET_64BIT"
20128 if (INTVAL (operands[1]) == 0)
20129 return "prefetch\t%a0";
20131 return "prefetchw\t%a0";
20133 [(set_attr "type" "mmx")
20134 (set_attr "memory" "none")])
20138 (define_insn "addv2df3"
20139 [(set (match_operand:V2DF 0 "register_operand" "=x")
20140 (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
20141 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20143 "addpd\t{%2, %0|%0, %2}"
20144 [(set_attr "type" "sseadd")
20145 (set_attr "mode" "V2DF")])
20147 (define_insn "vmaddv2df3"
20148 [(set (match_operand:V2DF 0 "register_operand" "=x")
20149 (vec_merge:V2DF (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
20150 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
20154 "addsd\t{%2, %0|%0, %2}"
20155 [(set_attr "type" "sseadd")
20156 (set_attr "mode" "DF")])
20158 (define_insn "subv2df3"
20159 [(set (match_operand:V2DF 0 "register_operand" "=x")
20160 (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
20161 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20163 "subpd\t{%2, %0|%0, %2}"
20164 [(set_attr "type" "sseadd")
20165 (set_attr "mode" "V2DF")])
20167 (define_insn "vmsubv2df3"
20168 [(set (match_operand:V2DF 0 "register_operand" "=x")
20169 (vec_merge:V2DF (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
20170 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
20174 "subsd\t{%2, %0|%0, %2}"
20175 [(set_attr "type" "sseadd")
20176 (set_attr "mode" "DF")])
20178 (define_insn "mulv2df3"
20179 [(set (match_operand:V2DF 0 "register_operand" "=x")
20180 (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
20181 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20183 "mulpd\t{%2, %0|%0, %2}"
20184 [(set_attr "type" "ssemul")
20185 (set_attr "mode" "V2DF")])
20187 (define_insn "vmmulv2df3"
20188 [(set (match_operand:V2DF 0 "register_operand" "=x")
20189 (vec_merge:V2DF (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
20190 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
20194 "mulsd\t{%2, %0|%0, %2}"
20195 [(set_attr "type" "ssemul")
20196 (set_attr "mode" "DF")])
20198 (define_insn "divv2df3"
20199 [(set (match_operand:V2DF 0 "register_operand" "=x")
20200 (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
20201 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20203 "divpd\t{%2, %0|%0, %2}"
20204 [(set_attr "type" "ssediv")
20205 (set_attr "mode" "V2DF")])
20207 (define_insn "vmdivv2df3"
20208 [(set (match_operand:V2DF 0 "register_operand" "=x")
20209 (vec_merge:V2DF (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
20210 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
20214 "divsd\t{%2, %0|%0, %2}"
20215 [(set_attr "type" "ssediv")
20216 (set_attr "mode" "DF")])
20220 (define_insn "smaxv2df3"
20221 [(set (match_operand:V2DF 0 "register_operand" "=x")
20222 (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
20223 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20225 "maxpd\t{%2, %0|%0, %2}"
20226 [(set_attr "type" "sseadd")
20227 (set_attr "mode" "V2DF")])
20229 (define_insn "vmsmaxv2df3"
20230 [(set (match_operand:V2DF 0 "register_operand" "=x")
20231 (vec_merge:V2DF (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
20232 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
20236 "maxsd\t{%2, %0|%0, %2}"
20237 [(set_attr "type" "sseadd")
20238 (set_attr "mode" "DF")])
20240 (define_insn "sminv2df3"
20241 [(set (match_operand:V2DF 0 "register_operand" "=x")
20242 (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
20243 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
20245 "minpd\t{%2, %0|%0, %2}"
20246 [(set_attr "type" "sseadd")
20247 (set_attr "mode" "V2DF")])
20249 (define_insn "vmsminv2df3"
20250 [(set (match_operand:V2DF 0 "register_operand" "=x")
20251 (vec_merge:V2DF (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
20252 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
20256 "minsd\t{%2, %0|%0, %2}"
20257 [(set_attr "type" "sseadd")
20258 (set_attr "mode" "DF")])
20260 (define_insn "sse2_anddf3"
20261 [(set (match_operand:V2DF 0 "register_operand" "=x")
20262 (subreg:V2DF (and:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "%0") 0)
20263 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "xm") 0)) 0))]
20265 "andpd\t{%2, %0|%0, %2}"
20266 [(set_attr "type" "sselog")
20267 (set_attr "mode" "V2DF")])
20269 (define_insn "sse2_nanddf3"
20270 [(set (match_operand:V2DF 0 "register_operand" "=x")
20271 (subreg:V2DF (and:TI (not:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "0") 0))
20272 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "xm") 0)) 0))]
20274 "andnpd\t{%2, %0|%0, %2}"
20275 [(set_attr "type" "sselog")
20276 (set_attr "mode" "V2DF")])
20278 (define_insn "sse2_iordf3"
20279 [(set (match_operand:V2DF 0 "register_operand" "=x")
20280 (subreg:V2DF (ior:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "%0") 0)
20281 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "xm") 0)) 0))]
20283 "orpd\t{%2, %0|%0, %2}"
20284 [(set_attr "type" "sselog")
20285 (set_attr "mode" "V2DF")])
20287 (define_insn "sse2_xordf3"
20288 [(set (match_operand:V2DF 0 "register_operand" "=x")
20289 (subreg:V2DF (xor:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "%0") 0)
20290 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "xm") 0)) 0))]
20292 "xorpd\t{%2, %0|%0, %2}"
20293 [(set_attr "type" "sselog")
20294 (set_attr "mode" "V2DF")])
20295 ;; SSE2 square root. There doesn't appear to be an extension for the
20296 ;; reciprocal/rsqrt instructions if the Intel manual is to be believed.
20298 (define_insn "sqrtv2df2"
20299 [(set (match_operand:V2DF 0 "register_operand" "=x")
20300 (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm")))]
20302 "sqrtpd\t{%1, %0|%0, %1}"
20303 [(set_attr "type" "sse")
20304 (set_attr "mode" "V2DF")])
20306 (define_insn "vmsqrtv2df2"
20307 [(set (match_operand:V2DF 0 "register_operand" "=x")
20308 (vec_merge:V2DF (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm"))
20309 (match_operand:V2DF 2 "register_operand" "0")
20312 "sqrtsd\t{%1, %0|%0, %1}"
20313 [(set_attr "type" "sse")
20314 (set_attr "mode" "SF")])
20316 ;; SSE mask-generating compares
20318 (define_insn "maskcmpv2df3"
20319 [(set (match_operand:V2DI 0 "register_operand" "=x")
20320 (match_operator:V2DI 3 "sse_comparison_operator"
20321 [(match_operand:V2DF 1 "register_operand" "0")
20322 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))]
20324 "cmp%D3pd\t{%2, %0|%0, %2}"
20325 [(set_attr "type" "ssecmp")
20326 (set_attr "mode" "V2DF")])
20328 (define_insn "maskncmpv2df3"
20329 [(set (match_operand:V2DI 0 "register_operand" "=x")
20331 (match_operator:V2DI 3 "sse_comparison_operator"
20332 [(match_operand:V2DF 1 "register_operand" "0")
20333 (match_operand:V2DF 2 "nonimmediate_operand" "x")])))]
20335 "cmpn%D3pd\t{%2, %0|%0, %2}"
20336 [(set_attr "type" "ssecmp")
20337 (set_attr "mode" "V2DF")])
20339 (define_insn "vmmaskcmpv2df3"
20340 [(set (match_operand:V2DI 0 "register_operand" "=x")
20342 (match_operator:V2DI 3 "sse_comparison_operator"
20343 [(match_operand:V2DF 1 "register_operand" "0")
20344 (match_operand:V2DF 2 "nonimmediate_operand" "x")])
20348 "cmp%D3sd\t{%2, %0|%0, %2}"
20349 [(set_attr "type" "ssecmp")
20350 (set_attr "mode" "DF")])
20352 (define_insn "vmmaskncmpv2df3"
20353 [(set (match_operand:V2DI 0 "register_operand" "=x")
20356 (match_operator:V2DI 3 "sse_comparison_operator"
20357 [(match_operand:V2DF 1 "register_operand" "0")
20358 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))
20359 (subreg:V2DI (match_dup 1) 0)
20362 "cmp%D3sd\t{%2, %0|%0, %2}"
20363 [(set_attr "type" "ssecmp")
20364 (set_attr "mode" "DF")])
20366 (define_insn "sse2_comi"
20367 [(set (reg:CCFP 17)
20368 (match_operator:CCFP 2 "sse_comparison_operator"
20370 (match_operand:V2DF 0 "register_operand" "x")
20371 (parallel [(const_int 0)]))
20373 (match_operand:V2DF 1 "register_operand" "x")
20374 (parallel [(const_int 0)]))]))]
20376 "comisd\t{%1, %0|%0, %1}"
20377 [(set_attr "type" "ssecmp")
20378 (set_attr "mode" "DF")])
20380 (define_insn "sse2_ucomi"
20381 [(set (reg:CCFPU 17)
20382 (match_operator:CCFPU 2 "sse_comparison_operator"
20384 (match_operand:V2DF 0 "register_operand" "x")
20385 (parallel [(const_int 0)]))
20387 (match_operand:V2DF 1 "register_operand" "x")
20388 (parallel [(const_int 0)]))]))]
20390 "ucomisd\t{%1, %0|%0, %1}"
20391 [(set_attr "type" "ssecmp")
20392 (set_attr "mode" "DF")])
20394 ;; SSE Strange Moves.
20396 (define_insn "sse2_movmskpd"
20397 [(set (match_operand:SI 0 "register_operand" "=r")
20398 (unspec:SI [(match_operand:V2DF 1 "register_operand" "x")]
20401 "movmskpd\t{%1, %0|%0, %1}"
20402 [(set_attr "type" "ssecvt")
20403 (set_attr "mode" "V2DF")])
20405 (define_insn "sse2_pmovmskb"
20406 [(set (match_operand:SI 0 "register_operand" "=r")
20407 (unspec:SI [(match_operand:V16QI 1 "register_operand" "x")]
20410 "pmovmskb\t{%1, %0|%0, %1}"
20411 [(set_attr "type" "ssecvt")
20412 (set_attr "mode" "V2DF")])
20414 (define_insn "sse2_maskmovdqu"
20415 [(set (mem:V16QI (match_operand:SI 0 "register_operand" "D"))
20416 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
20417 (match_operand:V16QI 2 "register_operand" "x")]
20420 ;; @@@ check ordering of operands in intel/nonintel syntax
20421 "maskmovdqu\t{%2, %1|%1, %2}"
20422 [(set_attr "type" "ssecvt")
20423 (set_attr "mode" "TI")])
20425 (define_insn "sse2_movntv2df"
20426 [(set (match_operand:V2DF 0 "memory_operand" "=m")
20427 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")]
20430 "movntpd\t{%1, %0|%0, %1}"
20431 [(set_attr "type" "ssecvt")
20432 (set_attr "mode" "V2DF")])
20434 (define_insn "sse2_movntv2di"
20435 [(set (match_operand:V2DI 0 "memory_operand" "=m")
20436 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "x")]
20439 "movntdq\t{%1, %0|%0, %1}"
20440 [(set_attr "type" "ssecvt")
20441 (set_attr "mode" "TI")])
20443 (define_insn "sse2_movntsi"
20444 [(set (match_operand:SI 0 "memory_operand" "=m")
20445 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
20448 "movnti\t{%1, %0|%0, %1}"
20449 [(set_attr "type" "ssecvt")
20450 (set_attr "mode" "V2DF")])
20452 ;; SSE <-> integer/MMX conversions
20454 ;; Conversions between SI and SF
20456 (define_insn "cvtdq2ps"
20457 [(set (match_operand:V4SF 0 "register_operand" "=x")
20458 (float:V4SF (match_operand:V4SI 1 "nonimmediate_operand" "xm")))]
20460 "cvtdq2ps\t{%1, %0|%0, %1}"
20461 [(set_attr "type" "ssecvt")
20462 (set_attr "mode" "V2DF")])
20464 (define_insn "cvtps2dq"
20465 [(set (match_operand:V4SI 0 "register_operand" "=x")
20466 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
20468 "cvtps2dq\t{%1, %0|%0, %1}"
20469 [(set_attr "type" "ssecvt")
20470 (set_attr "mode" "TI")])
20472 (define_insn "cvttps2dq"
20473 [(set (match_operand:V4SI 0 "register_operand" "=x")
20474 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
20477 "cvttps2dq\t{%1, %0|%0, %1}"
20478 [(set_attr "type" "ssecvt")
20479 (set_attr "mode" "TI")])
20481 ;; Conversions between SI and DF
20483 (define_insn "cvtdq2pd"
20484 [(set (match_operand:V2DF 0 "register_operand" "=x")
20485 (float:V2DF (vec_select:V2SI
20486 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
20489 (const_int 1)]))))]
20491 "cvtdq2pd\t{%1, %0|%0, %1}"
20492 [(set_attr "type" "ssecvt")
20493 (set_attr "mode" "V2DF")])
20495 (define_insn "cvtpd2dq"
20496 [(set (match_operand:V4SI 0 "register_operand" "=x")
20498 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm"))
20499 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
20501 "cvtpd2dq\t{%1, %0|%0, %1}"
20502 [(set_attr "type" "ssecvt")
20503 (set_attr "mode" "TI")])
20505 (define_insn "cvttpd2dq"
20506 [(set (match_operand:V4SI 0 "register_operand" "=x")
20508 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
20510 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
20512 "cvttpd2dq\t{%1, %0|%0, %1}"
20513 [(set_attr "type" "ssecvt")
20514 (set_attr "mode" "TI")])
20516 (define_insn "cvtpd2pi"
20517 [(set (match_operand:V2SI 0 "register_operand" "=y")
20518 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
20520 "cvtpd2pi\t{%1, %0|%0, %1}"
20521 [(set_attr "type" "ssecvt")
20522 (set_attr "mode" "TI")])
20524 (define_insn "cvttpd2pi"
20525 [(set (match_operand:V2SI 0 "register_operand" "=y")
20526 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
20529 "cvttpd2pi\t{%1, %0|%0, %1}"
20530 [(set_attr "type" "ssecvt")
20531 (set_attr "mode" "TI")])
20533 (define_insn "cvtpi2pd"
20534 [(set (match_operand:V2DF 0 "register_operand" "=x")
20535 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
20537 "cvtpi2pd\t{%1, %0|%0, %1}"
20538 [(set_attr "type" "ssecvt")
20539 (set_attr "mode" "TI")])
20541 ;; Conversions between SI and DF
20543 (define_insn "cvtsd2si"
20544 [(set (match_operand:SI 0 "register_operand" "=r")
20545 (fix:SI (vec_select:DF (match_operand:V2DF 1 "register_operand" "xm")
20546 (parallel [(const_int 0)]))))]
20548 "cvtsd2si\t{%1, %0|%0, %1}"
20549 [(set_attr "type" "ssecvt")
20550 (set_attr "mode" "SI")])
20552 (define_insn "cvttsd2si"
20553 [(set (match_operand:SI 0 "register_operand" "=r")
20554 (unspec:SI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "xm")
20555 (parallel [(const_int 0)]))] UNSPEC_FIX))]
20557 "cvttsd2si\t{%1, %0|%0, %1}"
20558 [(set_attr "type" "ssecvt")
20559 (set_attr "mode" "SI")])
20561 (define_insn "cvtsi2sd"
20562 [(set (match_operand:V2DF 0 "register_operand" "=x")
20563 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0")
20564 (vec_duplicate:V2DF
20566 (match_operand:SI 2 "nonimmediate_operand" "rm")))
20569 "cvtsd2si\t{%2, %0|%0, %2}"
20570 [(set_attr "type" "ssecvt")
20571 (set_attr "mode" "DF")])
20573 ;; Conversions between SF and DF
20575 (define_insn "cvtsd2ss"
20576 [(set (match_operand:V4SF 0 "register_operand" "=x")
20577 (vec_merge:V4SF (match_operand:V4SF 1 "register_operand" "0")
20578 (vec_duplicate:V4SF
20579 (float_truncate:V2SF
20580 (match_operand:V2DF 2 "register_operand" "xm")))
20583 "cvtsd2ss\t{%2, %0|%0, %2}"
20584 [(set_attr "type" "ssecvt")
20585 (set_attr "mode" "SF")])
20587 (define_insn "cvtss2sd"
20588 [(set (match_operand:V2DF 0 "register_operand" "=x")
20589 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0")
20592 (match_operand:V4SF 2 "register_operand" "xm")
20593 (parallel [(const_int 0)
20597 "cvtss2sd\t{%2, %0|%0, %2}"
20598 [(set_attr "type" "ssecvt")
20599 (set_attr "mode" "DF")])
20601 (define_insn "cvtpd2ps"
20602 [(set (match_operand:V4SF 0 "register_operand" "=x")
20605 (subreg:V2SI (float_truncate:V2SF
20606 (match_operand:V2DF 1 "nonimmediate_operand" "xm")) 0)
20607 (const_vector:V2SI [(const_int 0) (const_int 0)])) 0))]
20609 "cvtpd2ps\t{%1, %0|%0, %1}"
20610 [(set_attr "type" "ssecvt")
20611 (set_attr "mode" "V4SF")])
20613 (define_insn "cvtps2pd"
20614 [(set (match_operand:V2DF 0 "register_operand" "=x")
20616 (vec_select:V2SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")
20617 (parallel [(const_int 0)
20618 (const_int 1)]))))]
20620 "cvtps2pd\t{%1, %0|%0, %1}"
20621 [(set_attr "type" "ssecvt")
20622 (set_attr "mode" "V2DF")])
20624 ;; SSE2 variants of MMX insns
20628 (define_insn "addv16qi3"
20629 [(set (match_operand:V16QI 0 "register_operand" "=x")
20630 (plus:V16QI (match_operand:V16QI 1 "register_operand" "0")
20631 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20633 "paddb\t{%2, %0|%0, %2}"
20634 [(set_attr "type" "sseiadd")
20635 (set_attr "mode" "TI")])
20637 (define_insn "addv8hi3"
20638 [(set (match_operand:V8HI 0 "register_operand" "=x")
20639 (plus:V8HI (match_operand:V8HI 1 "register_operand" "0")
20640 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20642 "paddw\t{%2, %0|%0, %2}"
20643 [(set_attr "type" "sseiadd")
20644 (set_attr "mode" "TI")])
20646 (define_insn "addv4si3"
20647 [(set (match_operand:V4SI 0 "register_operand" "=x")
20648 (plus:V4SI (match_operand:V4SI 1 "register_operand" "0")
20649 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
20651 "paddd\t{%2, %0|%0, %2}"
20652 [(set_attr "type" "sseiadd")
20653 (set_attr "mode" "TI")])
20655 (define_insn "addv2di3"
20656 [(set (match_operand:V2DI 0 "register_operand" "=x")
20657 (plus:V2DI (match_operand:V2DI 1 "register_operand" "0")
20658 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20660 "paddq\t{%2, %0|%0, %2}"
20661 [(set_attr "type" "sseiadd")
20662 (set_attr "mode" "TI")])
20664 (define_insn "ssaddv16qi3"
20665 [(set (match_operand:V16QI 0 "register_operand" "=x")
20666 (ss_plus:V16QI (match_operand:V16QI 1 "register_operand" "0")
20667 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20669 "paddsb\t{%2, %0|%0, %2}"
20670 [(set_attr "type" "sseiadd")
20671 (set_attr "mode" "TI")])
20673 (define_insn "ssaddv8hi3"
20674 [(set (match_operand:V8HI 0 "register_operand" "=x")
20675 (ss_plus:V8HI (match_operand:V8HI 1 "register_operand" "0")
20676 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20678 "paddsw\t{%2, %0|%0, %2}"
20679 [(set_attr "type" "sseiadd")
20680 (set_attr "mode" "TI")])
20682 (define_insn "usaddv16qi3"
20683 [(set (match_operand:V16QI 0 "register_operand" "=x")
20684 (us_plus:V16QI (match_operand:V16QI 1 "register_operand" "0")
20685 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20687 "paddusb\t{%2, %0|%0, %2}"
20688 [(set_attr "type" "sseiadd")
20689 (set_attr "mode" "TI")])
20691 (define_insn "usaddv8hi3"
20692 [(set (match_operand:V8HI 0 "register_operand" "=x")
20693 (us_plus:V8HI (match_operand:V8HI 1 "register_operand" "0")
20694 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20696 "paddusw\t{%2, %0|%0, %2}"
20697 [(set_attr "type" "sseiadd")
20698 (set_attr "mode" "TI")])
20700 (define_insn "subv16qi3"
20701 [(set (match_operand:V16QI 0 "register_operand" "=x")
20702 (minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
20703 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20705 "psubb\t{%2, %0|%0, %2}"
20706 [(set_attr "type" "sseiadd")
20707 (set_attr "mode" "TI")])
20709 (define_insn "subv8hi3"
20710 [(set (match_operand:V8HI 0 "register_operand" "=x")
20711 (minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
20712 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20714 "psubw\t{%2, %0|%0, %2}"
20715 [(set_attr "type" "sseiadd")
20716 (set_attr "mode" "TI")])
20718 (define_insn "subv4si3"
20719 [(set (match_operand:V4SI 0 "register_operand" "=x")
20720 (minus:V4SI (match_operand:V4SI 1 "register_operand" "0")
20721 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
20723 "psubd\t{%2, %0|%0, %2}"
20724 [(set_attr "type" "sseiadd")
20725 (set_attr "mode" "TI")])
20727 (define_insn "subv2di3"
20728 [(set (match_operand:V2DI 0 "register_operand" "=x")
20729 (minus:V2DI (match_operand:V2DI 1 "register_operand" "0")
20730 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
20732 "psubq\t{%2, %0|%0, %2}"
20733 [(set_attr "type" "sseiadd")
20734 (set_attr "mode" "TI")])
20736 (define_insn "sssubv16qi3"
20737 [(set (match_operand:V16QI 0 "register_operand" "=x")
20738 (ss_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
20739 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20741 "psubsb\t{%2, %0|%0, %2}"
20742 [(set_attr "type" "sseiadd")
20743 (set_attr "mode" "TI")])
20745 (define_insn "sssubv8hi3"
20746 [(set (match_operand:V8HI 0 "register_operand" "=x")
20747 (ss_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
20748 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20750 "psubsw\t{%2, %0|%0, %2}"
20751 [(set_attr "type" "sseiadd")
20752 (set_attr "mode" "TI")])
20754 (define_insn "ussubv16qi3"
20755 [(set (match_operand:V16QI 0 "register_operand" "=x")
20756 (us_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
20757 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20759 "psubusb\t{%2, %0|%0, %2}"
20760 [(set_attr "type" "sseiadd")
20761 (set_attr "mode" "TI")])
20763 (define_insn "ussubv8hi3"
20764 [(set (match_operand:V8HI 0 "register_operand" "=x")
20765 (us_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
20766 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20768 "psubusw\t{%2, %0|%0, %2}"
20769 [(set_attr "type" "sseiadd")
20770 (set_attr "mode" "TI")])
20772 (define_insn "mulv8hi3"
20773 [(set (match_operand:V8HI 0 "register_operand" "=x")
20774 (mult:V8HI (match_operand:V8HI 1 "register_operand" "0")
20775 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20777 "pmullw\t{%2, %0|%0, %2}"
20778 [(set_attr "type" "sseimul")
20779 (set_attr "mode" "TI")])
20781 (define_insn "smulv8hi3_highpart"
20782 [(set (match_operand:V8HI 0 "register_operand" "=x")
20785 (mult:V8SI (sign_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
20786 (sign_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
20789 "pmulhw\t{%2, %0|%0, %2}"
20790 [(set_attr "type" "sseimul")
20791 (set_attr "mode" "TI")])
20793 (define_insn "umulv8hi3_highpart"
20794 [(set (match_operand:V8HI 0 "register_operand" "=x")
20797 (mult:V8SI (zero_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
20798 (zero_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
20801 "pmulhuw\t{%2, %0|%0, %2}"
20802 [(set_attr "type" "sseimul")
20803 (set_attr "mode" "TI")])
20805 (define_insn "sse2_umulsidi3"
20806 [(set (match_operand:DI 0 "register_operand" "=y")
20807 (mult:DI (zero_extend:DI (vec_select:SI
20808 (match_operand:V2SI 1 "register_operand" "0")
20809 (parallel [(const_int 0)])))
20810 (zero_extend:DI (vec_select:SI
20811 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
20812 (parallel [(const_int 0)])))))]
20814 "pmuludq\t{%2, %0|%0, %2}"
20815 [(set_attr "type" "sseimul")
20816 (set_attr "mode" "TI")])
20818 (define_insn "sse2_umulv2siv2di3"
20819 [(set (match_operand:V2DI 0 "register_operand" "=y")
20820 (mult:V2DI (zero_extend:V2DI
20822 (match_operand:V4SI 1 "register_operand" "0")
20823 (parallel [(const_int 0) (const_int 2)])))
20826 (match_operand:V4SI 2 "nonimmediate_operand" "ym")
20827 (parallel [(const_int 0) (const_int 2)])))))]
20829 "pmuludq\t{%2, %0|%0, %2}"
20830 [(set_attr "type" "sseimul")
20831 (set_attr "mode" "TI")])
20833 (define_insn "sse2_pmaddwd"
20834 [(set (match_operand:V4SI 0 "register_operand" "=x")
20837 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 1 "register_operand" "0")
20838 (parallel [(const_int 0)
20842 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 2 "nonimmediate_operand" "xm")
20843 (parallel [(const_int 0)
20848 (sign_extend:V4SI (vec_select:V4HI (match_dup 1)
20849 (parallel [(const_int 1)
20853 (sign_extend:V4SI (vec_select:V4HI (match_dup 2)
20854 (parallel [(const_int 1)
20857 (const_int 7)]))))))]
20859 "pmaddwd\t{%2, %0|%0, %2}"
20860 [(set_attr "type" "sseiadd")
20861 (set_attr "mode" "TI")])
20863 ;; Same as pxor, but don't show input operands so that we don't think
20865 (define_insn "sse2_clrti"
20866 [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))]
20868 "pxor\t{%0, %0|%0, %0}"
20869 [(set_attr "type" "sseiadd")
20870 (set_attr "memory" "none")
20871 (set_attr "mode" "TI")])
20873 ;; MMX unsigned averages/sum of absolute differences
20875 (define_insn "sse2_uavgv16qi3"
20876 [(set (match_operand:V16QI 0 "register_operand" "=x")
20878 (plus:V16QI (plus:V16QI
20879 (match_operand:V16QI 1 "register_operand" "0")
20880 (match_operand:V16QI 2 "nonimmediate_operand" "ym"))
20881 (const_vector:V16QI [(const_int 1) (const_int 1)
20882 (const_int 1) (const_int 1)
20883 (const_int 1) (const_int 1)
20884 (const_int 1) (const_int 1)
20885 (const_int 1) (const_int 1)
20886 (const_int 1) (const_int 1)
20887 (const_int 1) (const_int 1)
20888 (const_int 1) (const_int 1)]))
20891 "pavgb\t{%2, %0|%0, %2}"
20892 [(set_attr "type" "sseiadd")
20893 (set_attr "mode" "TI")])
20895 (define_insn "sse2_uavgv8hi3"
20896 [(set (match_operand:V8HI 0 "register_operand" "=x")
20898 (plus:V8HI (plus:V8HI
20899 (match_operand:V8HI 1 "register_operand" "0")
20900 (match_operand:V8HI 2 "nonimmediate_operand" "ym"))
20901 (const_vector:V8HI [(const_int 1) (const_int 1)
20902 (const_int 1) (const_int 1)
20903 (const_int 1) (const_int 1)
20904 (const_int 1) (const_int 1)]))
20907 "pavgw\t{%2, %0|%0, %2}"
20908 [(set_attr "type" "sseiadd")
20909 (set_attr "mode" "TI")])
20911 ;; @@@ this isn't the right representation.
20912 (define_insn "sse2_psadbw"
20913 [(set (match_operand:V2DI 0 "register_operand" "=x")
20914 (unspec:V2DI [(match_operand:V16QI 1 "register_operand" "0")
20915 (match_operand:V16QI 2 "nonimmediate_operand" "ym")]
20918 "psadbw\t{%2, %0|%0, %2}"
20919 [(set_attr "type" "sseiadd")
20920 (set_attr "mode" "TI")])
20923 ;; MMX insert/extract/shuffle
20925 (define_insn "sse2_pinsrw"
20926 [(set (match_operand:V8HI 0 "register_operand" "=x")
20927 (vec_merge:V8HI (match_operand:V8HI 1 "register_operand" "0")
20928 (vec_duplicate:V8HI
20929 (match_operand:SI 2 "nonimmediate_operand" "rm"))
20930 (match_operand:SI 3 "immediate_operand" "i")))]
20932 "pinsrw\t{%3, %2, %0|%0, %2, %3}"
20933 [(set_attr "type" "ssecvt")
20934 (set_attr "mode" "TI")])
20936 (define_insn "sse2_pextrw"
20937 [(set (match_operand:SI 0 "register_operand" "=r")
20939 (vec_select:HI (match_operand:V8HI 1 "register_operand" "x")
20941 [(match_operand:SI 2 "immediate_operand" "i")]))))]
20943 "pextrw\t{%2, %1, %0|%0, %1, %2}"
20944 [(set_attr "type" "ssecvt")
20945 (set_attr "mode" "TI")])
20947 (define_insn "sse2_pshufd"
20948 [(set (match_operand:V4SI 0 "register_operand" "=x")
20949 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "0")
20950 (match_operand:SI 2 "immediate_operand" "i")]
20953 "pshufd\t{%2, %1, %0|%0, %1, %2}"
20954 [(set_attr "type" "ssecvt")
20955 (set_attr "mode" "TI")])
20957 (define_insn "sse2_pshuflw"
20958 [(set (match_operand:V8HI 0 "register_operand" "=x")
20959 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "0")
20960 (match_operand:SI 2 "immediate_operand" "i")]
20963 "pshuflw\t{%2, %1, %0|%0, %1, %2}"
20964 [(set_attr "type" "ssecvt")
20965 (set_attr "mode" "TI")])
20967 (define_insn "sse2_pshufhw"
20968 [(set (match_operand:V8HI 0 "register_operand" "=x")
20969 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "0")
20970 (match_operand:SI 2 "immediate_operand" "i")]
20973 "pshufhw\t{%2, %1, %0|%0, %1, %2}"
20974 [(set_attr "type" "ssecvt")
20975 (set_attr "mode" "TI")])
20977 ;; MMX mask-generating comparisons
20979 (define_insn "eqv16qi3"
20980 [(set (match_operand:V16QI 0 "register_operand" "=x")
20981 (eq:V16QI (match_operand:V16QI 1 "register_operand" "0")
20982 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
20984 "pcmpeqb\t{%2, %0|%0, %2}"
20985 [(set_attr "type" "ssecmp")
20986 (set_attr "mode" "TI")])
20988 (define_insn "eqv8hi3"
20989 [(set (match_operand:V8HI 0 "register_operand" "=x")
20990 (eq:V8HI (match_operand:V8HI 1 "register_operand" "0")
20991 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
20993 "pcmpeqw\t{%2, %0|%0, %2}"
20994 [(set_attr "type" "ssecmp")
20995 (set_attr "mode" "TI")])
20997 (define_insn "eqv4si3"
20998 [(set (match_operand:V4SI 0 "register_operand" "=x")
20999 (eq:V4SI (match_operand:V4SI 1 "register_operand" "0")
21000 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
21002 "pcmpeqd\t{%2, %0|%0, %2}"
21003 [(set_attr "type" "ssecmp")
21004 (set_attr "mode" "TI")])
21006 (define_insn "gtv16qi3"
21007 [(set (match_operand:V16QI 0 "register_operand" "=x")
21008 (gt:V16QI (match_operand:V16QI 1 "register_operand" "0")
21009 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21011 "pcmpgtb\t{%2, %0|%0, %2}"
21012 [(set_attr "type" "ssecmp")
21013 (set_attr "mode" "TI")])
21015 (define_insn "gtv8hi3"
21016 [(set (match_operand:V8HI 0 "register_operand" "=x")
21017 (gt:V8HI (match_operand:V8HI 1 "register_operand" "0")
21018 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21020 "pcmpgtw\t{%2, %0|%0, %2}"
21021 [(set_attr "type" "ssecmp")
21022 (set_attr "mode" "TI")])
21024 (define_insn "gtv4si3"
21025 [(set (match_operand:V4SI 0 "register_operand" "=x")
21026 (gt:V4SI (match_operand:V4SI 1 "register_operand" "0")
21027 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
21029 "pcmpgtd\t{%2, %0|%0, %2}"
21030 [(set_attr "type" "ssecmp")
21031 (set_attr "mode" "TI")])
21034 ;; MMX max/min insns
21036 (define_insn "umaxv16qi3"
21037 [(set (match_operand:V16QI 0 "register_operand" "=x")
21038 (umax:V16QI (match_operand:V16QI 1 "register_operand" "0")
21039 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21041 "pmaxub\t{%2, %0|%0, %2}"
21042 [(set_attr "type" "sseiadd")
21043 (set_attr "mode" "TI")])
21045 (define_insn "smaxv8hi3"
21046 [(set (match_operand:V8HI 0 "register_operand" "=x")
21047 (smax:V8HI (match_operand:V8HI 1 "register_operand" "0")
21048 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21050 "pmaxsw\t{%2, %0|%0, %2}"
21051 [(set_attr "type" "sseiadd")
21052 (set_attr "mode" "TI")])
21054 (define_insn "uminv16qi3"
21055 [(set (match_operand:V16QI 0 "register_operand" "=x")
21056 (umin:V16QI (match_operand:V16QI 1 "register_operand" "0")
21057 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21059 "pminub\t{%2, %0|%0, %2}"
21060 [(set_attr "type" "sseiadd")
21061 (set_attr "mode" "TI")])
21063 (define_insn "sminv8hi3"
21064 [(set (match_operand:V8HI 0 "register_operand" "=x")
21065 (smin:V8HI (match_operand:V8HI 1 "register_operand" "0")
21066 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21068 "pminsw\t{%2, %0|%0, %2}"
21069 [(set_attr "type" "sseiadd")
21070 (set_attr "mode" "TI")])
21075 (define_insn "ashrv8hi3"
21076 [(set (match_operand:V8HI 0 "register_operand" "=x")
21077 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
21078 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21080 "psraw\t{%2, %0|%0, %2}"
21081 [(set_attr "type" "sseishft")
21082 (set_attr "mode" "TI")])
21084 (define_insn "ashrv4si3"
21085 [(set (match_operand:V4SI 0 "register_operand" "=x")
21086 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
21087 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21089 "psrad\t{%2, %0|%0, %2}"
21090 [(set_attr "type" "sseishft")
21091 (set_attr "mode" "TI")])
21093 (define_insn "lshrv8hi3"
21094 [(set (match_operand:V8HI 0 "register_operand" "=x")
21095 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
21096 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21098 "psrlw\t{%2, %0|%0, %2}"
21099 [(set_attr "type" "sseishft")
21100 (set_attr "mode" "TI")])
21102 (define_insn "lshrv4si3"
21103 [(set (match_operand:V4SI 0 "register_operand" "=x")
21104 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
21105 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21107 "psrld\t{%2, %0|%0, %2}"
21108 [(set_attr "type" "sseishft")
21109 (set_attr "mode" "TI")])
21111 (define_insn "lshrv2di3"
21112 [(set (match_operand:V2DI 0 "register_operand" "=x")
21113 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
21114 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21116 "psrlq\t{%2, %0|%0, %2}"
21117 [(set_attr "type" "sseishft")
21118 (set_attr "mode" "TI")])
21120 (define_insn "ashlv8hi3"
21121 [(set (match_operand:V8HI 0 "register_operand" "=x")
21122 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
21123 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21125 "psllw\t{%2, %0|%0, %2}"
21126 [(set_attr "type" "sseishft")
21127 (set_attr "mode" "TI")])
21129 (define_insn "ashlv4si3"
21130 [(set (match_operand:V4SI 0 "register_operand" "=x")
21131 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
21132 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21134 "pslld\t{%2, %0|%0, %2}"
21135 [(set_attr "type" "sseishft")
21136 (set_attr "mode" "TI")])
21138 (define_insn "ashlv2di3"
21139 [(set (match_operand:V2DI 0 "register_operand" "=x")
21140 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
21141 (match_operand:SI 2 "nonmemory_operand" "ri")))]
21143 "psllq\t{%2, %0|%0, %2}"
21144 [(set_attr "type" "sseishft")
21145 (set_attr "mode" "TI")])
21147 (define_insn "ashrv8hi3_ti"
21148 [(set (match_operand:V8HI 0 "register_operand" "=x")
21149 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
21150 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21152 "psraw\t{%2, %0|%0, %2}"
21153 [(set_attr "type" "sseishft")
21154 (set_attr "mode" "TI")])
21156 (define_insn "ashrv4si3_ti"
21157 [(set (match_operand:V4SI 0 "register_operand" "=x")
21158 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
21159 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21161 "psrad\t{%2, %0|%0, %2}"
21162 [(set_attr "type" "sseishft")
21163 (set_attr "mode" "TI")])
21165 (define_insn "lshrv8hi3_ti"
21166 [(set (match_operand:V8HI 0 "register_operand" "=x")
21167 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
21168 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21170 "psrlw\t{%2, %0|%0, %2}"
21171 [(set_attr "type" "sseishft")
21172 (set_attr "mode" "TI")])
21174 (define_insn "lshrv4si3_ti"
21175 [(set (match_operand:V4SI 0 "register_operand" "=x")
21176 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
21177 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21179 "psrld\t{%2, %0|%0, %2}"
21180 [(set_attr "type" "sseishft")
21181 (set_attr "mode" "TI")])
21183 (define_insn "lshrv2di3_ti"
21184 [(set (match_operand:V2DI 0 "register_operand" "=x")
21185 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
21186 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21188 "psrlq\t{%2, %0|%0, %2}"
21189 [(set_attr "type" "sseishft")
21190 (set_attr "mode" "TI")])
21192 (define_insn "ashlv8hi3_ti"
21193 [(set (match_operand:V8HI 0 "register_operand" "=x")
21194 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
21195 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21197 "psllw\t{%2, %0|%0, %2}"
21198 [(set_attr "type" "sseishft")
21199 (set_attr "mode" "TI")])
21201 (define_insn "ashlv4si3_ti"
21202 [(set (match_operand:V4SI 0 "register_operand" "=x")
21203 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
21204 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21206 "pslld\t{%2, %0|%0, %2}"
21207 [(set_attr "type" "sseishft")
21208 (set_attr "mode" "TI")])
21210 (define_insn "ashlv2di3_ti"
21211 [(set (match_operand:V2DI 0 "register_operand" "=x")
21212 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
21213 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
21215 "psllq\t{%2, %0|%0, %2}"
21216 [(set_attr "type" "sseishft")
21217 (set_attr "mode" "TI")])
21219 ;; See logical MMX insns for the reason for the unspec. Strictly speaking
21220 ;; we wouldn't need here it since we never generate TImode arithmetic.
21222 ;; There has to be some kind of prize for the weirdest new instruction...
21223 (define_insn "sse2_ashlti3"
21224 [(set (match_operand:TI 0 "register_operand" "=x")
21226 [(ashift:TI (match_operand:TI 1 "register_operand" "0")
21227 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
21228 (const_int 8)))] UNSPEC_NOP))]
21230 "pslldq\t{%2, %0|%0, %2}"
21231 [(set_attr "type" "sseishft")
21232 (set_attr "mode" "TI")])
21234 (define_insn "sse2_lshrti3"
21235 [(set (match_operand:TI 0 "register_operand" "=x")
21237 [(lshiftrt:TI (match_operand:TI 1 "register_operand" "0")
21238 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
21239 (const_int 8)))] UNSPEC_NOP))]
21241 "pslrdq\t{%2, %0|%0, %2}"
21242 [(set_attr "type" "sseishft")
21243 (set_attr "mode" "TI")])
21247 (define_insn "sse2_unpckhpd"
21248 [(set (match_operand:V2DF 0 "register_operand" "=x")
21250 (vec_select:V2DF (match_operand:V2DF 1 "register_operand" "0")
21251 (parallel [(const_int 1)]))
21252 (vec_select:V2DF (match_operand:V2DF 2 "register_operand" "x")
21253 (parallel [(const_int 0)]))))]
21255 "unpckhpd\t{%2, %0|%0, %2}"
21256 [(set_attr "type" "ssecvt")
21257 (set_attr "mode" "TI")])
21259 (define_insn "sse2_unpcklpd"
21260 [(set (match_operand:V2DF 0 "register_operand" "=x")
21262 (vec_select:V2DF (match_operand:V2DF 1 "register_operand" "0")
21263 (parallel [(const_int 0)]))
21264 (vec_select:V2DF (match_operand:V2DF 2 "register_operand" "x")
21265 (parallel [(const_int 1)]))))]
21267 "unpcklpd\t{%2, %0|%0, %2}"
21268 [(set_attr "type" "ssecvt")
21269 (set_attr "mode" "TI")])
21271 ;; MMX pack/unpack insns.
21273 (define_insn "sse2_packsswb"
21274 [(set (match_operand:V16QI 0 "register_operand" "=x")
21276 (ss_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
21277 (ss_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
21279 "packsswb\t{%2, %0|%0, %2}"
21280 [(set_attr "type" "ssecvt")
21281 (set_attr "mode" "TI")])
21283 (define_insn "sse2_packssdw"
21284 [(set (match_operand:V8HI 0 "register_operand" "=x")
21286 (ss_truncate:V4HI (match_operand:V4SI 1 "register_operand" "0"))
21287 (ss_truncate:V4HI (match_operand:V4SI 2 "register_operand" "x"))))]
21289 "packssdw\t{%2, %0|%0, %2}"
21290 [(set_attr "type" "ssecvt")
21291 (set_attr "mode" "TI")])
21293 (define_insn "sse2_packuswb"
21294 [(set (match_operand:V16QI 0 "register_operand" "=x")
21296 (us_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
21297 (us_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
21299 "packuswb\t{%2, %0|%0, %2}"
21300 [(set_attr "type" "ssecvt")
21301 (set_attr "mode" "TI")])
21303 (define_insn "sse2_punpckhbw"
21304 [(set (match_operand:V16QI 0 "register_operand" "=x")
21306 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
21307 (parallel [(const_int 8) (const_int 0)
21308 (const_int 9) (const_int 1)
21309 (const_int 10) (const_int 2)
21310 (const_int 11) (const_int 3)
21311 (const_int 12) (const_int 4)
21312 (const_int 13) (const_int 5)
21313 (const_int 14) (const_int 6)
21314 (const_int 15) (const_int 7)]))
21315 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
21316 (parallel [(const_int 0) (const_int 8)
21317 (const_int 1) (const_int 9)
21318 (const_int 2) (const_int 10)
21319 (const_int 3) (const_int 11)
21320 (const_int 4) (const_int 12)
21321 (const_int 5) (const_int 13)
21322 (const_int 6) (const_int 14)
21323 (const_int 7) (const_int 15)]))
21324 (const_int 21845)))]
21326 "punpckhbw\t{%2, %0|%0, %2}"
21327 [(set_attr "type" "ssecvt")
21328 (set_attr "mode" "TI")])
21330 (define_insn "sse2_punpckhwd"
21331 [(set (match_operand:V8HI 0 "register_operand" "=x")
21333 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
21334 (parallel [(const_int 4) (const_int 0)
21335 (const_int 5) (const_int 1)
21336 (const_int 6) (const_int 2)
21337 (const_int 7) (const_int 3)]))
21338 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
21339 (parallel [(const_int 0) (const_int 4)
21340 (const_int 1) (const_int 5)
21341 (const_int 2) (const_int 6)
21342 (const_int 3) (const_int 7)]))
21345 "punpckhwd\t{%2, %0|%0, %2}"
21346 [(set_attr "type" "ssecvt")
21347 (set_attr "mode" "TI")])
21349 (define_insn "sse2_punpckhdq"
21350 [(set (match_operand:V4SI 0 "register_operand" "=x")
21352 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
21353 (parallel [(const_int 2) (const_int 0)
21354 (const_int 3) (const_int 1)]))
21355 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
21356 (parallel [(const_int 0) (const_int 2)
21357 (const_int 1) (const_int 3)]))
21360 "punpckhdq\t{%2, %0|%0, %2}"
21361 [(set_attr "type" "ssecvt")
21362 (set_attr "mode" "TI")])
21364 (define_insn "sse2_punpcklbw"
21365 [(set (match_operand:V16QI 0 "register_operand" "=x")
21367 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
21368 (parallel [(const_int 0) (const_int 8)
21369 (const_int 1) (const_int 9)
21370 (const_int 2) (const_int 10)
21371 (const_int 3) (const_int 11)
21372 (const_int 4) (const_int 12)
21373 (const_int 5) (const_int 13)
21374 (const_int 6) (const_int 14)
21375 (const_int 7) (const_int 15)]))
21376 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
21377 (parallel [(const_int 8) (const_int 0)
21378 (const_int 9) (const_int 1)
21379 (const_int 10) (const_int 2)
21380 (const_int 11) (const_int 3)
21381 (const_int 12) (const_int 4)
21382 (const_int 13) (const_int 5)
21383 (const_int 14) (const_int 6)
21384 (const_int 15) (const_int 7)]))
21385 (const_int 21845)))]
21387 "punpcklbw\t{%2, %0|%0, %2}"
21388 [(set_attr "type" "ssecvt")
21389 (set_attr "mode" "TI")])
21391 (define_insn "sse2_punpcklwd"
21392 [(set (match_operand:V8HI 0 "register_operand" "=x")
21394 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
21395 (parallel [(const_int 0) (const_int 4)
21396 (const_int 1) (const_int 5)
21397 (const_int 2) (const_int 6)
21398 (const_int 3) (const_int 7)]))
21399 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
21400 (parallel [(const_int 4) (const_int 0)
21401 (const_int 5) (const_int 1)
21402 (const_int 6) (const_int 2)
21403 (const_int 7) (const_int 3)]))
21406 "punpcklwd\t{%2, %0|%0, %2}"
21407 [(set_attr "type" "ssecvt")
21408 (set_attr "mode" "TI")])
21410 (define_insn "sse2_punpckldq"
21411 [(set (match_operand:V4SI 0 "register_operand" "=x")
21413 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
21414 (parallel [(const_int 0) (const_int 2)
21415 (const_int 1) (const_int 3)]))
21416 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
21417 (parallel [(const_int 2) (const_int 0)
21418 (const_int 3) (const_int 1)]))
21421 "punpckldq\t{%2, %0|%0, %2}"
21422 [(set_attr "type" "ssecvt")
21423 (set_attr "mode" "TI")])
21427 (define_insn "sse2_movapd"
21428 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
21429 (unspec:V2DF [(match_operand:V2DF 1 "general_operand" "xm,x")]
21433 movapd\t{%1, %0|%0, %1}
21434 movapd\t{%1, %0|%0, %1}"
21435 [(set_attr "type" "ssemov")
21436 (set_attr "mode" "V2DF")])
21438 (define_insn "sse2_movupd"
21439 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
21440 (unspec:V2DF [(match_operand:V2DF 1 "general_operand" "xm,x")]
21444 movupd\t{%1, %0|%0, %1}
21445 movupd\t{%1, %0|%0, %1}"
21446 [(set_attr "type" "ssecvt")
21447 (set_attr "mode" "V2DF")])
21449 (define_insn "sse2_movdqa"
21450 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,m")
21451 (unspec:TI [(match_operand:TI 1 "general_operand" "xm,x")]
21455 movdqa\t{%1, %0|%0, %1}
21456 movdqa\t{%1, %0|%0, %1}"
21457 [(set_attr "type" "ssemov")
21458 (set_attr "mode" "TI")])
21460 (define_insn "sse2_movdqu"
21461 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,m")
21462 (unspec:TI [(match_operand:TI 1 "general_operand" "xm,x")]
21466 movdqu\t{%1, %0|%0, %1}
21467 movdqu\t{%1, %0|%0, %1}"
21468 [(set_attr "type" "ssecvt")
21469 (set_attr "mode" "TI")])
21471 (define_insn "sse2_movdq2q"
21472 [(set (match_operand:DI 0 "nonimmediate_operand" "=y")
21473 (vec_select:DI (match_operand:V2DI 1 "general_operand" "x")
21474 (parallel [(const_int 0)])))]
21476 "movdq2q\t{%1, %0|%0, %1}"
21477 [(set_attr "type" "ssecvt")
21478 (set_attr "mode" "TI")])
21480 (define_insn "sse2_movq2dq"
21481 [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x")
21482 (vec_concat:V2DI (match_operand:DI 1 "general_operand" "y")
21483 (const_vector:DI [(const_int 0)])))]
21485 "movq2dq\t{%1, %0|%0, %1}"
21486 [(set_attr "type" "ssecvt")
21487 (set_attr "mode" "TI")])
21489 (define_insn "sse2_movhpd"
21490 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
21492 (match_operand:V2DF 1 "nonimmediate_operand" "0,0")
21493 (match_operand:V2DF 2 "nonimmediate_operand" "m,x")
21495 "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
21496 "movhpd\t{%2, %0|%0, %2}"
21497 [(set_attr "type" "ssecvt")
21498 (set_attr "mode" "V2DF")])
21500 (define_insn "sse2_movlpd"
21501 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
21503 (match_operand:V2DF 1 "nonimmediate_operand" "0,0")
21504 (match_operand:V2DF 2 "nonimmediate_operand" "m,x")
21506 "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
21507 "movlpd\t{%2, %0|%0, %2}"
21508 [(set_attr "type" "ssecvt")
21509 (set_attr "mode" "V2DF")])
21511 (define_insn "sse2_loadsd"
21512 [(set (match_operand:V2DF 0 "register_operand" "=x")
21514 (match_operand:DF 1 "memory_operand" "m")
21515 (vec_duplicate:DF (float:DF (const_int 0)))
21518 "movsd\t{%1, %0|%0, %1}"
21519 [(set_attr "type" "ssecvt")
21520 (set_attr "mode" "DF")])
21522 (define_insn "sse2_movsd"
21523 [(set (match_operand:V2DF 0 "register_operand" "=x")
21525 (match_operand:V2DF 1 "register_operand" "0")
21526 (match_operand:V2DF 2 "register_operand" "x")
21529 "movsd\t{%2, %0|%0, %2}"
21530 [(set_attr "type" "ssecvt")
21531 (set_attr "mode" "DF")])
21533 (define_insn "sse2_storesd"
21534 [(set (match_operand:DF 0 "memory_operand" "=m")
21536 (match_operand:V2DF 1 "register_operand" "x")
21537 (parallel [(const_int 0)])))]
21539 "movsd\t{%1, %0|%0, %1}"
21540 [(set_attr "type" "ssecvt")
21541 (set_attr "mode" "DF")])
21543 (define_insn "sse2_shufpd"
21544 [(set (match_operand:V2DF 0 "register_operand" "=x")
21545 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
21546 (match_operand:V2DF 2 "nonimmediate_operand" "xm")
21547 (match_operand:SI 3 "immediate_operand" "i")]
21550 ;; @@@ check operand order for intel/nonintel syntax
21551 "shufpd\t{%3, %2, %0|%0, %2, %3}"
21552 [(set_attr "type" "ssecvt")
21553 (set_attr "mode" "V2DF")])
21555 (define_insn "sse2_clflush"
21556 [(unspec_volatile [(match_operand:SI 0 "address_operand" "p")]
21560 [(set_attr "type" "sse")
21561 (set_attr "memory" "unknown")])
21563 (define_expand "sse2_mfence"
21564 [(set (match_dup 0)
21565 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
21568 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
21569 MEM_VOLATILE_P (operands[0]) = 1;
21572 (define_insn "*mfence_insn"
21573 [(set (match_operand:BLK 0 "" "")
21574 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
21577 [(set_attr "type" "sse")
21578 (set_attr "memory" "unknown")])
21580 (define_expand "sse2_lfence"
21581 [(set (match_dup 0)
21582 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
21585 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
21586 MEM_VOLATILE_P (operands[0]) = 1;
21589 (define_insn "*lfence_insn"
21590 [(set (match_operand:BLK 0 "" "")
21591 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
21594 [(set_attr "type" "sse")
21595 (set_attr "memory" "unknown")])