1 ;; GCC machine description for IA-32 and x86-64.
2 ;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 ;; Free Software Foundation, Inc.
5 ;; Mostly by William Schelter.
6 ;; x86_64 support added by Jan Hubicka
8 ;; This file is part of GNU CC.
10 ;; GNU CC is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU CC is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU CC; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA. */
25 ;; The original PO technology requires these to be ordered by speed,
26 ;; so that assigner will pick the fastest.
28 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 ;; Macro #define NOTICE_UPDATE_CC in file i386.h handles condition code
31 ;; updates for most instructions.
33 ;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register
34 ;; constraint letters.
36 ;; The special asm out single letter directives following a '%' are:
37 ;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of
39 ;; 'L' Print the opcode suffix for a 32-bit integer opcode.
40 ;; 'W' Print the opcode suffix for a 16-bit integer opcode.
41 ;; 'B' Print the opcode suffix for an 8-bit integer opcode.
42 ;; 'Q' Print the opcode suffix for a 64-bit float opcode.
43 ;; 'S' Print the opcode suffix for a 32-bit float opcode.
44 ;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode.
45 ;; 'J' Print the appropriate jump operand.
47 ;; 'b' Print the QImode name of the register for the indicated operand.
48 ;; %b0 would print %al if operands[0] is reg 0.
49 ;; 'w' Likewise, print the HImode name of the register.
50 ;; 'k' Likewise, print the SImode name of the register.
51 ;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.
52 ;; 'y' Print "st(0)" instead of "st" as a register.
57 [; Relocation specifiers
69 (UNSPEC_STACK_PROBE 10)
70 (UNSPEC_STACK_ALLOC 11)
72 (UNSPEC_SSE_PROLOGUE_SAVE 13)
77 (UNSPEC_TLS_LD_BASE 17)
79 ; Other random patterns
89 ; For SSE/MMX support:
100 (UNSPEC_NOP 45) ; prevents combiner cleverness
115 [(UNSPECV_BLOCKAGE 0)
116 (UNSPECV_EH_RETURN 13)
124 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
127 ;; In C guard expressions, put expressions which may be compile-time
128 ;; constants first. This allows for better optimization. For
129 ;; example, write "TARGET_64BIT && reload_completed", not
130 ;; "reload_completed && TARGET_64BIT".
133 ;; Processor type. This attribute must exactly match the processor_type
134 ;; enumeration in i386.h.
135 (define_attr "cpu" "i386,i486,pentium,pentiumpro,k6,athlon,pentium4,k8"
136 (const (symbol_ref "ix86_cpu")))
138 ;; A basic instruction type. Refinements due to arguments to be
139 ;; provided in other attributes.
142 alu,alu1,negnot,imov,imovx,lea,
143 incdec,ishift,ishift1,rotate,rotate1,imul,idiv,
144 icmp,test,ibr,setcc,icmov,
145 push,pop,call,callv,leave,
147 fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,
148 sselog,sseiadd,sseishft,sseimul,
149 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,sseicvt,ssediv,
150 mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
151 (const_string "other"))
153 ;; Main data type used by the insn
155 "unknown,none,QI,HI,SI,DI,SF,DF,XF,TI,V4SF,V2DF,V2SF"
156 (const_string "unknown"))
158 ;; The CPU unit operations uses.
159 (define_attr "unit" "integer,i387,sse,mmx,unknown"
160 (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
161 (const_string "i387")
162 (eq_attr "type" "sselog,sseiadd,sseishft,sseimul,
163 sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,sseicvt,ssediv")
165 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
167 (eq_attr "type" "other")
168 (const_string "unknown")]
169 (const_string "integer")))
171 ;; The (bounding maximum) length of an instruction immediate.
172 (define_attr "length_immediate" ""
173 (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv,leave")
175 (eq_attr "unit" "i387,sse,mmx")
177 (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,ishift1,rotate1,
179 (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
180 (eq_attr "type" "imov,test")
181 (symbol_ref "ix86_attr_length_immediate_default(insn,0)")
182 (eq_attr "type" "call")
183 (if_then_else (match_operand 0 "constant_call_address_operand" "")
186 (eq_attr "type" "callv")
187 (if_then_else (match_operand 1 "constant_call_address_operand" "")
190 ;; We don't know the size before shorten_branches. Expect
191 ;; the instruction to fit for better scheduling.
192 (eq_attr "type" "ibr")
195 (symbol_ref "/* Update immediate_length and other attributes! */
198 ;; The (bounding maximum) length of an instruction address.
199 (define_attr "length_address" ""
200 (cond [(eq_attr "type" "str,cld,other,multi,fxch")
202 (and (eq_attr "type" "call")
203 (match_operand 0 "constant_call_address_operand" ""))
205 (and (eq_attr "type" "callv")
206 (match_operand 1 "constant_call_address_operand" ""))
209 (symbol_ref "ix86_attr_length_address_default (insn)")))
211 ;; Set when length prefix is used.
212 (define_attr "prefix_data16" ""
213 (if_then_else (ior (eq_attr "mode" "HI")
214 (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))
218 ;; Set when string REP prefix is used.
219 (define_attr "prefix_rep" ""
220 (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
224 ;; Set when 0f opcode prefix is used.
225 (define_attr "prefix_0f" ""
227 (ior (eq_attr "type" "imovx,setcc,icmov")
228 (eq_attr "unit" "sse,mmx"))
232 ;; Set when 0f opcode prefix is used.
233 (define_attr "prefix_rex" ""
234 (cond [(and (eq_attr "mode" "DI")
235 (eq_attr "type" "!push,pop,call,callv,leave,ibr"))
237 (and (eq_attr "mode" "QI")
238 (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)")
241 (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)")
247 ;; Set when modrm byte is used.
248 (define_attr "modrm" ""
249 (cond [(eq_attr "type" "str,cld,leave")
251 (eq_attr "unit" "i387")
253 (and (eq_attr "type" "incdec")
254 (ior (match_operand:SI 1 "register_operand" "")
255 (match_operand:HI 1 "register_operand" "")))
257 (and (eq_attr "type" "push")
258 (not (match_operand 1 "memory_operand" "")))
260 (and (eq_attr "type" "pop")
261 (not (match_operand 0 "memory_operand" "")))
263 (and (eq_attr "type" "imov")
264 (and (match_operand 0 "register_operand" "")
265 (match_operand 1 "immediate_operand" "")))
267 (and (eq_attr "type" "call")
268 (match_operand 0 "constant_call_address_operand" ""))
270 (and (eq_attr "type" "callv")
271 (match_operand 1 "constant_call_address_operand" ""))
276 ;; The (bounding maximum) length of an instruction in bytes.
277 ;; ??? fistp is in fact fldcw/fistp/fldcw sequence. Later we may want
278 ;; to split it and compute proper length as for other insns.
279 (define_attr "length" ""
280 (cond [(eq_attr "type" "other,multi,fistp")
282 (eq_attr "unit" "i387")
284 (plus (attr "prefix_data16")
285 (attr "length_address")))]
286 (plus (plus (attr "modrm")
287 (plus (attr "prefix_0f")
288 (plus (attr "prefix_rex")
290 (plus (attr "prefix_rep")
291 (plus (attr "prefix_data16")
292 (plus (attr "length_immediate")
293 (attr "length_address")))))))
295 ;; The `memory' attribute is `none' if no memory is referenced, `load' or
296 ;; `store' if there is a simple memory reference therein, or `unknown'
297 ;; if the instruction is complex.
299 (define_attr "memory" "none,load,store,both,unknown"
300 (cond [(eq_attr "type" "other,multi,str")
301 (const_string "unknown")
302 (eq_attr "type" "lea,fcmov,fpspc,cld")
303 (const_string "none")
304 (eq_attr "type" "fistp,leave")
305 (const_string "both")
306 (eq_attr "type" "push")
307 (if_then_else (match_operand 1 "memory_operand" "")
308 (const_string "both")
309 (const_string "store"))
310 (eq_attr "type" "pop")
311 (if_then_else (match_operand 0 "memory_operand" "")
312 (const_string "both")
313 (const_string "load"))
314 (eq_attr "type" "setcc")
315 (if_then_else (match_operand 0 "memory_operand" "")
316 (const_string "store")
317 (const_string "none"))
318 (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp")
319 (if_then_else (ior (match_operand 0 "memory_operand" "")
320 (match_operand 1 "memory_operand" ""))
321 (const_string "load")
322 (const_string "none"))
323 (eq_attr "type" "ibr")
324 (if_then_else (match_operand 0 "memory_operand" "")
325 (const_string "load")
326 (const_string "none"))
327 (eq_attr "type" "call")
328 (if_then_else (match_operand 0 "constant_call_address_operand" "")
329 (const_string "none")
330 (const_string "load"))
331 (eq_attr "type" "callv")
332 (if_then_else (match_operand 1 "constant_call_address_operand" "")
333 (const_string "none")
334 (const_string "load"))
335 (and (eq_attr "type" "alu1,negnot")
336 (match_operand 1 "memory_operand" ""))
337 (const_string "both")
338 (and (match_operand 0 "memory_operand" "")
339 (match_operand 1 "memory_operand" ""))
340 (const_string "both")
341 (match_operand 0 "memory_operand" "")
342 (const_string "store")
343 (match_operand 1 "memory_operand" "")
344 (const_string "load")
347 imov,imovx,icmp,test,
349 sse,ssemov,ssecmp,ssecomi,ssecvt,sseicvt,
350 mmx,mmxmov,mmxcmp,mmxcvt")
351 (match_operand 2 "memory_operand" ""))
352 (const_string "load")
353 (and (eq_attr "type" "icmov")
354 (match_operand 3 "memory_operand" ""))
355 (const_string "load")
357 (const_string "none")))
359 ;; Indicates if an instruction has both an immediate and a displacement.
361 (define_attr "imm_disp" "false,true,unknown"
362 (cond [(eq_attr "type" "other,multi")
363 (const_string "unknown")
364 (and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1")
365 (and (match_operand 0 "memory_displacement_operand" "")
366 (match_operand 1 "immediate_operand" "")))
367 (const_string "true")
368 (and (eq_attr "type" "alu,ishift,rotate,imul,idiv")
369 (and (match_operand 0 "memory_displacement_operand" "")
370 (match_operand 2 "immediate_operand" "")))
371 (const_string "true")
373 (const_string "false")))
375 ;; Indicates if an FP operation has an integer source.
377 (define_attr "fp_int_src" "false,true"
378 (const_string "false"))
380 ;; Describe a user's asm statement.
381 (define_asm_attributes
382 [(set_attr "length" "128")
383 (set_attr "type" "multi")])
385 (include "pentium.md")
388 (include "athlon.md")
390 ;; Compare instructions.
392 ;; All compare insns have expanders that save the operands away without
393 ;; actually generating RTL. The bCOND or sCOND (emitted immediately
394 ;; after the cmp) will actually emit the cmpM.
396 (define_expand "cmpdi"
398 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
399 (match_operand:DI 1 "x86_64_general_operand" "")))]
402 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
403 operands[0] = force_reg (DImode, operands[0]);
404 ix86_compare_op0 = operands[0];
405 ix86_compare_op1 = operands[1];
409 (define_expand "cmpsi"
411 (compare:CC (match_operand:SI 0 "cmpsi_operand" "")
412 (match_operand:SI 1 "general_operand" "")))]
415 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
416 operands[0] = force_reg (SImode, operands[0]);
417 ix86_compare_op0 = operands[0];
418 ix86_compare_op1 = operands[1];
422 (define_expand "cmphi"
424 (compare:CC (match_operand:HI 0 "nonimmediate_operand" "")
425 (match_operand:HI 1 "general_operand" "")))]
428 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
429 operands[0] = force_reg (HImode, operands[0]);
430 ix86_compare_op0 = operands[0];
431 ix86_compare_op1 = operands[1];
435 (define_expand "cmpqi"
437 (compare:CC (match_operand:QI 0 "nonimmediate_operand" "")
438 (match_operand:QI 1 "general_operand" "")))]
441 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
442 operands[0] = force_reg (QImode, operands[0]);
443 ix86_compare_op0 = operands[0];
444 ix86_compare_op1 = operands[1];
448 (define_insn "cmpdi_ccno_1_rex64"
450 (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr")
451 (match_operand:DI 1 "const0_operand" "n,n")))]
452 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
454 test{q}\t{%0, %0|%0, %0}
455 cmp{q}\t{%1, %0|%0, %1}"
456 [(set_attr "type" "test,icmp")
457 (set_attr "length_immediate" "0,1")
458 (set_attr "mode" "DI")])
460 (define_insn "*cmpdi_minus_1_rex64"
462 (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r")
463 (match_operand:DI 1 "x86_64_general_operand" "re,mr"))
465 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)"
466 "cmp{q}\t{%1, %0|%0, %1}"
467 [(set_attr "type" "icmp")
468 (set_attr "mode" "DI")])
470 (define_expand "cmpdi_1_rex64"
472 (compare:CC (match_operand:DI 0 "nonimmediate_operand" "")
473 (match_operand:DI 1 "general_operand" "")))]
477 (define_insn "cmpdi_1_insn_rex64"
479 (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r")
480 (match_operand:DI 1 "x86_64_general_operand" "re,mr")))]
481 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
482 "cmp{q}\t{%1, %0|%0, %1}"
483 [(set_attr "type" "icmp")
484 (set_attr "mode" "DI")])
487 (define_insn "*cmpsi_ccno_1"
489 (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr")
490 (match_operand:SI 1 "const0_operand" "n,n")))]
491 "ix86_match_ccmode (insn, CCNOmode)"
493 test{l}\t{%0, %0|%0, %0}
494 cmp{l}\t{%1, %0|%0, %1}"
495 [(set_attr "type" "test,icmp")
496 (set_attr "length_immediate" "0,1")
497 (set_attr "mode" "SI")])
499 (define_insn "*cmpsi_minus_1"
501 (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r")
502 (match_operand:SI 1 "general_operand" "ri,mr"))
504 "ix86_match_ccmode (insn, CCGOCmode)"
505 "cmp{l}\t{%1, %0|%0, %1}"
506 [(set_attr "type" "icmp")
507 (set_attr "mode" "SI")])
509 (define_expand "cmpsi_1"
511 (compare:CC (match_operand:SI 0 "nonimmediate_operand" "rm,r")
512 (match_operand:SI 1 "general_operand" "ri,mr")))]
516 (define_insn "*cmpsi_1_insn"
518 (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r")
519 (match_operand:SI 1 "general_operand" "ri,mr")))]
520 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
521 && ix86_match_ccmode (insn, CCmode)"
522 "cmp{l}\t{%1, %0|%0, %1}"
523 [(set_attr "type" "icmp")
524 (set_attr "mode" "SI")])
526 (define_insn "*cmphi_ccno_1"
528 (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr")
529 (match_operand:HI 1 "const0_operand" "n,n")))]
530 "ix86_match_ccmode (insn, CCNOmode)"
532 test{w}\t{%0, %0|%0, %0}
533 cmp{w}\t{%1, %0|%0, %1}"
534 [(set_attr "type" "test,icmp")
535 (set_attr "length_immediate" "0,1")
536 (set_attr "mode" "HI")])
538 (define_insn "*cmphi_minus_1"
540 (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r")
541 (match_operand:HI 1 "general_operand" "ri,mr"))
543 "ix86_match_ccmode (insn, CCGOCmode)"
544 "cmp{w}\t{%1, %0|%0, %1}"
545 [(set_attr "type" "icmp")
546 (set_attr "mode" "HI")])
548 (define_insn "*cmphi_1"
550 (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r")
551 (match_operand:HI 1 "general_operand" "ri,mr")))]
552 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
553 && ix86_match_ccmode (insn, CCmode)"
554 "cmp{w}\t{%1, %0|%0, %1}"
555 [(set_attr "type" "icmp")
556 (set_attr "mode" "HI")])
558 (define_insn "*cmpqi_ccno_1"
560 (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq")
561 (match_operand:QI 1 "const0_operand" "n,n")))]
562 "ix86_match_ccmode (insn, CCNOmode)"
564 test{b}\t{%0, %0|%0, %0}
565 cmp{b}\t{$0, %0|%0, 0}"
566 [(set_attr "type" "test,icmp")
567 (set_attr "length_immediate" "0,1")
568 (set_attr "mode" "QI")])
570 (define_insn "*cmpqi_1"
572 (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q")
573 (match_operand:QI 1 "general_operand" "qi,mq")))]
574 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
575 && ix86_match_ccmode (insn, CCmode)"
576 "cmp{b}\t{%1, %0|%0, %1}"
577 [(set_attr "type" "icmp")
578 (set_attr "mode" "QI")])
580 (define_insn "*cmpqi_minus_1"
582 (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q")
583 (match_operand:QI 1 "general_operand" "qi,mq"))
585 "ix86_match_ccmode (insn, CCGOCmode)"
586 "cmp{b}\t{%1, %0|%0, %1}"
587 [(set_attr "type" "icmp")
588 (set_attr "mode" "QI")])
590 (define_insn "*cmpqi_ext_1"
593 (match_operand:QI 0 "general_operand" "Qm")
596 (match_operand 1 "ext_register_operand" "Q")
599 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
600 "cmp{b}\t{%h1, %0|%0, %h1}"
601 [(set_attr "type" "icmp")
602 (set_attr "mode" "QI")])
604 (define_insn "*cmpqi_ext_1_rex64"
607 (match_operand:QI 0 "register_operand" "Q")
610 (match_operand 1 "ext_register_operand" "Q")
613 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
614 "cmp{b}\t{%h1, %0|%0, %h1}"
615 [(set_attr "type" "icmp")
616 (set_attr "mode" "QI")])
618 (define_insn "*cmpqi_ext_2"
623 (match_operand 0 "ext_register_operand" "Q")
626 (match_operand:QI 1 "const0_operand" "n")))]
627 "ix86_match_ccmode (insn, CCNOmode)"
629 [(set_attr "type" "test")
630 (set_attr "length_immediate" "0")
631 (set_attr "mode" "QI")])
633 (define_expand "cmpqi_ext_3"
638 (match_operand 0 "ext_register_operand" "")
641 (match_operand:QI 1 "general_operand" "")))]
645 (define_insn "cmpqi_ext_3_insn"
650 (match_operand 0 "ext_register_operand" "Q")
653 (match_operand:QI 1 "general_operand" "Qmn")))]
654 "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
655 "cmp{b}\t{%1, %h0|%h0, %1}"
656 [(set_attr "type" "icmp")
657 (set_attr "mode" "QI")])
659 (define_insn "cmpqi_ext_3_insn_rex64"
664 (match_operand 0 "ext_register_operand" "Q")
667 (match_operand:QI 1 "nonmemory_operand" "Qn")))]
668 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
669 "cmp{b}\t{%1, %h0|%h0, %1}"
670 [(set_attr "type" "icmp")
671 (set_attr "mode" "QI")])
673 (define_insn "*cmpqi_ext_4"
678 (match_operand 0 "ext_register_operand" "Q")
683 (match_operand 1 "ext_register_operand" "Q")
686 "ix86_match_ccmode (insn, CCmode)"
687 "cmp{b}\t{%h1, %h0|%h0, %h1}"
688 [(set_attr "type" "icmp")
689 (set_attr "mode" "QI")])
691 ;; These implement float point compares.
692 ;; %%% See if we can get away with VOIDmode operands on the actual insns,
693 ;; which would allow mix and match FP modes on the compares. Which is what
694 ;; the old patterns did, but with many more of them.
696 (define_expand "cmpxf"
698 (compare:CC (match_operand:XF 0 "cmp_fp_expander_operand" "")
699 (match_operand:XF 1 "cmp_fp_expander_operand" "")))]
700 "!TARGET_64BIT && TARGET_80387"
702 ix86_compare_op0 = operands[0];
703 ix86_compare_op1 = operands[1];
707 (define_expand "cmptf"
709 (compare:CC (match_operand:TF 0 "cmp_fp_expander_operand" "")
710 (match_operand:TF 1 "cmp_fp_expander_operand" "")))]
713 ix86_compare_op0 = operands[0];
714 ix86_compare_op1 = operands[1];
718 (define_expand "cmpdf"
720 (compare:CC (match_operand:DF 0 "cmp_fp_expander_operand" "")
721 (match_operand:DF 1 "cmp_fp_expander_operand" "")))]
722 "TARGET_80387 || TARGET_SSE2"
724 ix86_compare_op0 = operands[0];
725 ix86_compare_op1 = operands[1];
729 (define_expand "cmpsf"
731 (compare:CC (match_operand:SF 0 "cmp_fp_expander_operand" "")
732 (match_operand:SF 1 "cmp_fp_expander_operand" "")))]
733 "TARGET_80387 || TARGET_SSE"
735 ix86_compare_op0 = operands[0];
736 ix86_compare_op1 = operands[1];
740 ;; FP compares, step 1:
741 ;; Set the FP condition codes.
743 ;; CCFPmode compare with exceptions
744 ;; CCFPUmode compare with no exceptions
746 ;; %%% It is an unfortunate fact that ftst has no non-popping variant,
747 ;; and that fp moves clobber the condition codes, and that there is
748 ;; currently no way to describe this fact to reg-stack. So there are
749 ;; no splitters yet for this.
751 ;; %%% YIKES! This scheme does not retain a strong connection between
752 ;; the real compare and the ultimate cc0 user, so CC_REVERSE does not
753 ;; work! Only allow tos/mem with tos in op 0.
755 ;; Hmm, of course, this is what the actual _hardware_ does. Perhaps
756 ;; things aren't as bad as they sound...
758 (define_insn "*cmpfp_0"
759 [(set (match_operand:HI 0 "register_operand" "=a")
761 [(compare:CCFP (match_operand 1 "register_operand" "f")
762 (match_operand 2 "const0_operand" "X"))]
765 && FLOAT_MODE_P (GET_MODE (operands[1]))
766 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
768 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
769 return "ftst\;fnstsw\t%0\;fstp\t%y0";
771 return "ftst\;fnstsw\t%0";
773 [(set_attr "type" "multi")
775 (cond [(match_operand:SF 1 "" "")
777 (match_operand:DF 1 "" "")
780 (const_string "XF")))])
782 ;; We may not use "#" to split and emit these, since the REG_DEAD notes
783 ;; used to manage the reg stack popping would not be preserved.
785 (define_insn "*cmpfp_2_sf"
788 (match_operand:SF 0 "register_operand" "f")
789 (match_operand:SF 1 "nonimmediate_operand" "fm")))]
791 "* return output_fp_compare (insn, operands, 0, 0);"
792 [(set_attr "type" "fcmp")
793 (set_attr "mode" "SF")])
795 (define_insn "*cmpfp_2_sf_1"
796 [(set (match_operand:HI 0 "register_operand" "=a")
799 (match_operand:SF 1 "register_operand" "f")
800 (match_operand:SF 2 "nonimmediate_operand" "fm"))]
803 "* return output_fp_compare (insn, operands, 2, 0);"
804 [(set_attr "type" "fcmp")
805 (set_attr "mode" "SF")])
807 (define_insn "*cmpfp_2_df"
810 (match_operand:DF 0 "register_operand" "f")
811 (match_operand:DF 1 "nonimmediate_operand" "fm")))]
813 "* return output_fp_compare (insn, operands, 0, 0);"
814 [(set_attr "type" "fcmp")
815 (set_attr "mode" "DF")])
817 (define_insn "*cmpfp_2_df_1"
818 [(set (match_operand:HI 0 "register_operand" "=a")
821 (match_operand:DF 1 "register_operand" "f")
822 (match_operand:DF 2 "nonimmediate_operand" "fm"))]
825 "* return output_fp_compare (insn, operands, 2, 0);"
826 [(set_attr "type" "multi")
827 (set_attr "mode" "DF")])
829 (define_insn "*cmpfp_2_xf"
832 (match_operand:XF 0 "register_operand" "f")
833 (match_operand:XF 1 "register_operand" "f")))]
834 "!TARGET_64BIT && TARGET_80387"
835 "* return output_fp_compare (insn, operands, 0, 0);"
836 [(set_attr "type" "fcmp")
837 (set_attr "mode" "XF")])
839 (define_insn "*cmpfp_2_tf"
842 (match_operand:TF 0 "register_operand" "f")
843 (match_operand:TF 1 "register_operand" "f")))]
845 "* return output_fp_compare (insn, operands, 0, 0);"
846 [(set_attr "type" "fcmp")
847 (set_attr "mode" "XF")])
849 (define_insn "*cmpfp_2_xf_1"
850 [(set (match_operand:HI 0 "register_operand" "=a")
853 (match_operand:XF 1 "register_operand" "f")
854 (match_operand:XF 2 "register_operand" "f"))]
856 "!TARGET_64BIT && TARGET_80387"
857 "* return output_fp_compare (insn, operands, 2, 0);"
858 [(set_attr "type" "multi")
859 (set_attr "mode" "XF")])
861 (define_insn "*cmpfp_2_tf_1"
862 [(set (match_operand:HI 0 "register_operand" "=a")
865 (match_operand:TF 1 "register_operand" "f")
866 (match_operand:TF 2 "register_operand" "f"))]
869 "* return output_fp_compare (insn, operands, 2, 0);"
870 [(set_attr "type" "multi")
871 (set_attr "mode" "XF")])
873 (define_insn "*cmpfp_2u"
876 (match_operand 0 "register_operand" "f")
877 (match_operand 1 "register_operand" "f")))]
879 && FLOAT_MODE_P (GET_MODE (operands[0]))
880 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
881 "* return output_fp_compare (insn, operands, 0, 1);"
882 [(set_attr "type" "fcmp")
884 (cond [(match_operand:SF 1 "" "")
886 (match_operand:DF 1 "" "")
889 (const_string "XF")))])
891 (define_insn "*cmpfp_2u_1"
892 [(set (match_operand:HI 0 "register_operand" "=a")
895 (match_operand 1 "register_operand" "f")
896 (match_operand 2 "register_operand" "f"))]
899 && FLOAT_MODE_P (GET_MODE (operands[1]))
900 && GET_MODE (operands[1]) == GET_MODE (operands[2])"
901 "* return output_fp_compare (insn, operands, 2, 1);"
902 [(set_attr "type" "multi")
904 (cond [(match_operand:SF 1 "" "")
906 (match_operand:DF 1 "" "")
909 (const_string "XF")))])
911 ;; Patterns to match the SImode-in-memory ficom instructions.
913 ;; %%% Play games with accepting gp registers, as otherwise we have to
914 ;; force them to memory during rtl generation, which is no good. We
915 ;; can get rid of this once we teach reload to do memory input reloads
918 (define_insn "*ficom_1"
921 (match_operand 0 "register_operand" "f,f")
922 (float (match_operand:SI 1 "nonimmediate_operand" "m,?r"))))]
923 "0 && TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[0]))
924 && GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 1)) == GET_MODE (operands[0])"
927 ;; Split the not-really-implemented gp register case into a
928 ;; push-op-pop sequence.
930 ;; %%% This is most efficient, but am I gonna get in trouble
931 ;; for separating cc0_setter and cc0_user?
936 (match_operand:SF 0 "register_operand" "")
937 (float (match_operand:SI 1 "register_operand" ""))))]
938 "0 && TARGET_80387 && reload_completed"
939 [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 1))
940 (set (reg:CCFP 18) (compare:CCFP (match_dup 0) (match_dup 2)))
941 (parallel [(set (match_dup 1) (mem:SI (reg:SI 7)))
942 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
943 "operands[2] = gen_rtx_MEM (Pmode, stack_pointer_rtx);
944 operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);")
946 ;; FP compares, step 2
947 ;; Move the fpsw to ax.
949 (define_insn "*x86_fnstsw_1"
950 [(set (match_operand:HI 0 "register_operand" "=a")
951 (unspec:HI [(reg 18)] UNSPEC_FNSTSW))]
954 [(set_attr "length" "2")
955 (set_attr "mode" "SI")
956 (set_attr "unit" "i387")
957 (set_attr "ppro_uops" "few")])
959 ;; FP compares, step 3
960 ;; Get ax into flags, general case.
962 (define_insn "x86_sahf_1"
964 (unspec:CC [(match_operand:HI 0 "register_operand" "a")] UNSPEC_SAHF))]
967 [(set_attr "length" "1")
968 (set_attr "athlon_decode" "vector")
969 (set_attr "mode" "SI")
970 (set_attr "ppro_uops" "one")])
972 ;; Pentium Pro can do steps 1 through 3 in one go.
974 (define_insn "*cmpfp_i"
976 (compare:CCFP (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[0])"
982 "* return output_fp_compare (insn, operands, 1, 0);"
983 [(set_attr "type" "fcmp")
985 (cond [(match_operand:SF 1 "" "")
987 (match_operand:DF 1 "" "")
990 (const_string "XF")))
991 (set_attr "athlon_decode" "vector")])
993 (define_insn "*cmpfp_i_sse"
995 (compare:CCFP (match_operand 0 "register_operand" "f#x,x#f")
996 (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))]
998 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
999 && GET_MODE (operands[0]) == GET_MODE (operands[0])"
1000 "* return output_fp_compare (insn, operands, 1, 0);"
1001 [(set_attr "type" "fcmp,ssecomi")
1003 (if_then_else (match_operand:SF 1 "" "")
1005 (const_string "DF")))
1006 (set_attr "athlon_decode" "vector")])
1008 (define_insn "*cmpfp_i_sse_only"
1010 (compare:CCFP (match_operand 0 "register_operand" "x")
1011 (match_operand 1 "nonimmediate_operand" "xm")))]
1012 "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1013 && GET_MODE (operands[0]) == GET_MODE (operands[0])"
1014 "* return output_fp_compare (insn, operands, 1, 0);"
1015 [(set_attr "type" "ssecomi")
1017 (if_then_else (match_operand:SF 1 "" "")
1019 (const_string "DF")))
1020 (set_attr "athlon_decode" "vector")])
1022 (define_insn "*cmpfp_iu"
1023 [(set (reg:CCFPU 17)
1024 (compare:CCFPU (match_operand 0 "register_operand" "f")
1025 (match_operand 1 "register_operand" "f")))]
1026 "TARGET_80387 && TARGET_CMOVE
1027 && !SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1028 && FLOAT_MODE_P (GET_MODE (operands[0]))
1029 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1030 "* return output_fp_compare (insn, operands, 1, 1);"
1031 [(set_attr "type" "fcmp")
1033 (cond [(match_operand:SF 1 "" "")
1035 (match_operand:DF 1 "" "")
1038 (const_string "XF")))
1039 (set_attr "athlon_decode" "vector")])
1041 (define_insn "*cmpfp_iu_sse"
1042 [(set (reg:CCFPU 17)
1043 (compare:CCFPU (match_operand 0 "register_operand" "f#x,x#f")
1044 (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))]
1046 && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1047 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1048 "* return output_fp_compare (insn, operands, 1, 1);"
1049 [(set_attr "type" "fcmp,ssecomi")
1051 (if_then_else (match_operand:SF 1 "" "")
1053 (const_string "DF")))
1054 (set_attr "athlon_decode" "vector")])
1056 (define_insn "*cmpfp_iu_sse_only"
1057 [(set (reg:CCFPU 17)
1058 (compare:CCFPU (match_operand 0 "register_operand" "x")
1059 (match_operand 1 "nonimmediate_operand" "xm")))]
1060 "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
1061 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
1062 "* return output_fp_compare (insn, operands, 1, 1);"
1063 [(set_attr "type" "ssecomi")
1065 (if_then_else (match_operand:SF 1 "" "")
1067 (const_string "DF")))
1068 (set_attr "athlon_decode" "vector")])
1070 ;; Move instructions.
1072 ;; General case of fullword move.
1074 (define_expand "movsi"
1075 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1076 (match_operand:SI 1 "general_operand" ""))]
1078 "ix86_expand_move (SImode, operands); DONE;")
1080 ;; Push/pop instructions. They are separate since autoinc/dec is not a
1083 ;; %%% We don't use a post-inc memory reference because x86 is not a
1084 ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.
1085 ;; Changing this impacts compiler performance on other non-AUTO_INC_DEC
1086 ;; targets without our curiosities, and it is just as easy to represent
1087 ;; this differently.
1089 (define_insn "*pushsi2"
1090 [(set (match_operand:SI 0 "push_operand" "=<")
1091 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))]
1094 [(set_attr "type" "push")
1095 (set_attr "mode" "SI")])
1097 ;; For 64BIT abi we always round up to 8 bytes.
1098 (define_insn "*pushsi2_rex64"
1099 [(set (match_operand:SI 0 "push_operand" "=X")
1100 (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))]
1103 [(set_attr "type" "push")
1104 (set_attr "mode" "SI")])
1106 (define_insn "*pushsi2_prologue"
1107 [(set (match_operand:SI 0 "push_operand" "=<")
1108 (match_operand:SI 1 "general_no_elim_operand" "ri*m"))
1109 (clobber (mem:BLK (scratch)))]
1112 [(set_attr "type" "push")
1113 (set_attr "mode" "SI")])
1115 (define_insn "*popsi1_epilogue"
1116 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1117 (mem:SI (reg:SI 7)))
1119 (plus:SI (reg:SI 7) (const_int 4)))
1120 (clobber (mem:BLK (scratch)))]
1123 [(set_attr "type" "pop")
1124 (set_attr "mode" "SI")])
1126 (define_insn "popsi1"
1127 [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m")
1128 (mem:SI (reg:SI 7)))
1130 (plus:SI (reg:SI 7) (const_int 4)))]
1133 [(set_attr "type" "pop")
1134 (set_attr "mode" "SI")])
1136 (define_insn "*movsi_xor"
1137 [(set (match_operand:SI 0 "register_operand" "=r")
1138 (match_operand:SI 1 "const0_operand" "i"))
1139 (clobber (reg:CC 17))]
1140 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1141 "xor{l}\t{%0, %0|%0, %0}"
1142 [(set_attr "type" "alu1")
1143 (set_attr "mode" "SI")
1144 (set_attr "length_immediate" "0")])
1146 (define_insn "*movsi_or"
1147 [(set (match_operand:SI 0 "register_operand" "=r")
1148 (match_operand:SI 1 "immediate_operand" "i"))
1149 (clobber (reg:CC 17))]
1150 "reload_completed && GET_CODE (operands[1]) == CONST_INT
1151 && INTVAL (operands[1]) == -1
1152 && (TARGET_PENTIUM || optimize_size)"
1154 operands[1] = constm1_rtx;
1155 return "or{l}\t{%1, %0|%0, %1}";
1157 [(set_attr "type" "alu1")
1158 (set_attr "mode" "SI")
1159 (set_attr "length_immediate" "1")])
1161 ; The first alternative is used only to compute proper length of instruction.
1162 ; Reload's algorithm does not take into account the cost of spill instructions
1163 ; needed to free register in given class, so avoid it from choosing the first
1164 ; alternative when eax is not available.
1166 (define_insn "*movsi_1"
1167 [(set (match_operand:SI 0 "nonimmediate_operand" "=*?a,r,*?a,m,!*y,!rm,!*y,!*Y,!rm,!*Y")
1168 (match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,*y,*y,rm,*Y,*Y,rm"))]
1169 "(TARGET_INTER_UNIT_MOVES || optimize_size)
1170 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1172 switch (get_attr_type (insn))
1175 if (get_attr_mode (insn) == TImode)
1176 return "movdqa\t{%1, %0|%0, %1}";
1177 return "movd\t{%1, %0|%0, %1}";
1180 if (get_attr_mode (insn) == DImode)
1181 return "movq\t{%1, %0|%0, %1}";
1182 return "movd\t{%1, %0|%0, %1}";
1185 return "lea{l}\t{%1, %0|%0, %1}";
1188 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1190 return "mov{l}\t{%1, %0|%0, %1}";
1194 (cond [(eq_attr "alternative" "4,5,6")
1195 (const_string "mmxmov")
1196 (eq_attr "alternative" "7,8,9")
1197 (const_string "ssemov")
1198 (and (ne (symbol_ref "flag_pic") (const_int 0))
1199 (match_operand:SI 1 "symbolic_operand" ""))
1200 (const_string "lea")
1202 (const_string "imov")))
1203 (set_attr "modrm" "0,*,0,*,*,*,*,*,*,*")
1204 (set_attr "mode" "SI,SI,SI,SI,DI,SI,SI,TI,SI,SI")])
1206 (define_insn "*movsi_1_nointernunit"
1207 [(set (match_operand:SI 0 "nonimmediate_operand" "=*?a,r,*?a,m,!*y,!m,!*y,!*Y,!m,!*Y")
1208 (match_operand:SI 1 "general_operand" "im,rinm,rinm,rin,*y,*y,m,*Y,*Y,m"))]
1209 "(!TARGET_INTER_UNIT_MOVES && !optimize_size)
1210 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1212 switch (get_attr_type (insn))
1215 if (get_attr_mode (insn) == TImode || which_alternative == 9)
1216 return "movdqa\t{%1, %0|%0, %1}";
1217 return "movd\t{%1, %0|%0, %1}";
1220 if (get_attr_mode (insn) == DImode)
1221 return "movq\t{%1, %0|%0, %1}";
1222 return "movd\t{%1, %0|%0, %1}";
1225 return "lea{l}\t{%1, %0|%0, %1}";
1228 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
1230 return "mov{l}\t{%1, %0|%0, %1}";
1234 (cond [(eq_attr "alternative" "4,5,6")
1235 (const_string "mmxmov")
1236 (eq_attr "alternative" "7,8,9")
1237 (const_string "ssemov")
1238 (and (ne (symbol_ref "flag_pic") (const_int 0))
1239 (match_operand:SI 1 "symbolic_operand" ""))
1240 (const_string "lea")
1242 (const_string "imov")))
1243 (set_attr "modrm" "0,*,0,*,*,*,*,*,*,*")
1244 (set_attr "mode" "SI,SI,SI,SI,DI,SI,SI,TI,SI,SI")])
1246 ;; Stores and loads of ax to arbitrary constant address.
1247 ;; We fake an second form of instruction to force reload to load address
1248 ;; into register when rax is not available
1249 (define_insn "*movabssi_1_rex64"
1250 [(set (mem:SI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1251 (match_operand:SI 1 "nonmemory_operand" "a,er,i"))]
1254 movabs{l}\t{%1, %P0|%P0, %1}
1255 mov{l}\t{%1, %a0|%a0, %1}
1256 movabs{l}\t{%1, %a0|%a0, %1}"
1257 [(set_attr "type" "imov")
1258 (set_attr "modrm" "0,*,*")
1259 (set_attr "length_address" "8,0,0")
1260 (set_attr "length_immediate" "0,*,*")
1261 (set_attr "memory" "store")
1262 (set_attr "mode" "SI")])
1264 (define_insn "*movabssi_2_rex64"
1265 [(set (match_operand:SI 0 "register_operand" "=a,r")
1266 (mem:SI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1269 movabs{l}\t{%P1, %0|%0, %P1}
1270 mov{l}\t{%a1, %0|%0, %a1}"
1271 [(set_attr "type" "imov")
1272 (set_attr "modrm" "0,*")
1273 (set_attr "length_address" "8,0")
1274 (set_attr "length_immediate" "0")
1275 (set_attr "memory" "load")
1276 (set_attr "mode" "SI")])
1278 (define_insn "*swapsi"
1279 [(set (match_operand:SI 0 "register_operand" "+r")
1280 (match_operand:SI 1 "register_operand" "+r"))
1285 [(set_attr "type" "imov")
1286 (set_attr "pent_pair" "np")
1287 (set_attr "athlon_decode" "vector")
1288 (set_attr "mode" "SI")
1289 (set_attr "modrm" "0")
1290 (set_attr "ppro_uops" "few")])
1292 (define_expand "movhi"
1293 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1294 (match_operand:HI 1 "general_operand" ""))]
1296 "ix86_expand_move (HImode, operands); DONE;")
1298 (define_insn "*pushhi2"
1299 [(set (match_operand:HI 0 "push_operand" "=<,<")
1300 (match_operand:HI 1 "general_no_elim_operand" "n,r*m"))]
1303 push{w}\t{|WORD PTR }%1
1305 [(set_attr "type" "push")
1306 (set_attr "mode" "HI")])
1308 ;; For 64BIT abi we always round up to 8 bytes.
1309 (define_insn "*pushhi2_rex64"
1310 [(set (match_operand:HI 0 "push_operand" "=X")
1311 (match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))]
1314 [(set_attr "type" "push")
1315 (set_attr "mode" "QI")])
1317 ; The first alternative is used only to compute proper length of instruction.
1318 ; Reload's algorithm does not take into account the cost of spill instructions
1319 ; needed to free register in given class, so avoid it from choosing the first
1320 ; alternative when eax is not available.
1322 (define_insn "*movhi_1"
1323 [(set (match_operand:HI 0 "nonimmediate_operand" "=*?a,r,r,*?a,r,m")
1324 (match_operand:HI 1 "general_operand" "i,r,rn,rm,rm,rn"))]
1325 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1327 switch (get_attr_type (insn))
1330 /* movzwl is faster than movw on p2 due to partial word stalls,
1331 though not as fast as an aligned movl. */
1332 return "movz{wl|x}\t{%1, %k0|%k0, %1}";
1334 if (get_attr_mode (insn) == MODE_SI)
1335 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1337 return "mov{w}\t{%1, %0|%0, %1}";
1341 (cond [(and (eq_attr "alternative" "0,1")
1342 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1344 (eq (symbol_ref "TARGET_HIMODE_MATH")
1346 (const_string "imov")
1347 (and (eq_attr "alternative" "2,3,4")
1348 (match_operand:HI 1 "aligned_operand" ""))
1349 (const_string "imov")
1350 (and (ne (symbol_ref "TARGET_MOVX")
1352 (eq_attr "alternative" "0,1,3,4"))
1353 (const_string "imovx")
1355 (const_string "imov")))
1357 (cond [(eq_attr "type" "imovx")
1359 (and (eq_attr "alternative" "2,3,4")
1360 (match_operand:HI 1 "aligned_operand" ""))
1362 (and (eq_attr "alternative" "0,1")
1363 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1365 (eq (symbol_ref "TARGET_HIMODE_MATH")
1369 (const_string "HI")))
1370 (set_attr "modrm" "0,*,*,0,*,*")])
1372 ;; Stores and loads of ax to arbitrary constant address.
1373 ;; We fake an second form of instruction to force reload to load address
1374 ;; into register when rax is not available
1375 (define_insn "*movabshi_1_rex64"
1376 [(set (mem:HI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1377 (match_operand:HI 1 "nonmemory_operand" "a,er,i"))]
1380 movabs{w}\t{%1, %P0|%P0, %1}
1381 mov{w}\t{%1, %a0|%a0, %1}
1382 movabs{w}\t{%1, %a0|%a0, %1}"
1383 [(set_attr "type" "imov")
1384 (set_attr "modrm" "0,*,*")
1385 (set_attr "length_address" "8,0,0")
1386 (set_attr "length_immediate" "0,*,*")
1387 (set_attr "memory" "store")
1388 (set_attr "mode" "HI")])
1390 (define_insn "*movabshi_2_rex64"
1391 [(set (match_operand:HI 0 "register_operand" "=a,r")
1392 (mem:HI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1395 movabs{w}\t{%P1, %0|%0, %P1}
1396 mov{w}\t{%a1, %0|%0, %a1}"
1397 [(set_attr "type" "imov")
1398 (set_attr "modrm" "0,*")
1399 (set_attr "length_address" "8,0")
1400 (set_attr "length_immediate" "0")
1401 (set_attr "memory" "load")
1402 (set_attr "mode" "HI")])
1404 (define_insn "*swaphi_1"
1405 [(set (match_operand:HI 0 "register_operand" "+r")
1406 (match_operand:HI 1 "register_operand" "+r"))
1409 "TARGET_PARTIAL_REG_STALL"
1411 [(set_attr "type" "imov")
1412 (set_attr "pent_pair" "np")
1413 (set_attr "mode" "HI")
1414 (set_attr "modrm" "0")
1415 (set_attr "ppro_uops" "few")])
1417 (define_insn "*swaphi_2"
1418 [(set (match_operand:HI 0 "register_operand" "+r")
1419 (match_operand:HI 1 "register_operand" "+r"))
1422 "! TARGET_PARTIAL_REG_STALL"
1424 [(set_attr "type" "imov")
1425 (set_attr "pent_pair" "np")
1426 (set_attr "mode" "SI")
1427 (set_attr "modrm" "0")
1428 (set_attr "ppro_uops" "few")])
1430 (define_expand "movstricthi"
1431 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1432 (match_operand:HI 1 "general_operand" ""))]
1433 "! TARGET_PARTIAL_REG_STALL || optimize_size"
1435 /* Don't generate memory->memory moves, go through a register */
1436 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1437 operands[1] = force_reg (HImode, operands[1]);
1440 (define_insn "*movstricthi_1"
1441 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+rm,r"))
1442 (match_operand:HI 1 "general_operand" "rn,m"))]
1443 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
1444 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1445 "mov{w}\t{%1, %0|%0, %1}"
1446 [(set_attr "type" "imov")
1447 (set_attr "mode" "HI")])
1449 (define_insn "*movstricthi_xor"
1450 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r"))
1451 (match_operand:HI 1 "const0_operand" "i"))
1452 (clobber (reg:CC 17))]
1454 && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)"
1455 "xor{w}\t{%0, %0|%0, %0}"
1456 [(set_attr "type" "alu1")
1457 (set_attr "mode" "HI")
1458 (set_attr "length_immediate" "0")])
1460 (define_expand "movqi"
1461 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1462 (match_operand:QI 1 "general_operand" ""))]
1464 "ix86_expand_move (QImode, operands); DONE;")
1466 ;; emit_push_insn when it calls move_by_pieces requires an insn to
1467 ;; "push a byte". But actually we use pushw, which has the effect
1468 ;; of rounding the amount pushed up to a halfword.
1470 (define_insn "*pushqi2"
1471 [(set (match_operand:QI 0 "push_operand" "=X,X")
1472 (match_operand:QI 1 "nonmemory_no_elim_operand" "n,r"))]
1475 push{w}\t{|word ptr }%1
1477 [(set_attr "type" "push")
1478 (set_attr "mode" "HI")])
1480 ;; For 64BIT abi we always round up to 8 bytes.
1481 (define_insn "*pushqi2_rex64"
1482 [(set (match_operand:QI 0 "push_operand" "=X")
1483 (match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))]
1486 [(set_attr "type" "push")
1487 (set_attr "mode" "QI")])
1489 ;; Situation is quite tricky about when to choose full sized (SImode) move
1490 ;; over QImode moves. For Q_REG -> Q_REG move we use full size only for
1491 ;; partial register dependency machines (such as AMD Athlon), where QImode
1492 ;; moves issue extra dependency and for partial register stalls machines
1493 ;; that don't use QImode patterns (and QImode move cause stall on the next
1496 ;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial
1497 ;; register stall machines with, where we use QImode instructions, since
1498 ;; partial register stall can be caused there. Then we use movzx.
1499 (define_insn "*movqi_1"
1500 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
1501 (match_operand:QI 1 "general_operand" " q,qn,qm,q,rn,qm,qn"))]
1502 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1504 switch (get_attr_type (insn))
1507 if (!ANY_QI_REG_P (operands[1]) && GET_CODE (operands[1]) != MEM)
1509 return "movz{bl|x}\t{%1, %k0|%k0, %1}";
1511 if (get_attr_mode (insn) == MODE_SI)
1512 return "mov{l}\t{%k1, %k0|%k0, %k1}";
1514 return "mov{b}\t{%1, %0|%0, %1}";
1518 (cond [(and (eq_attr "alternative" "3")
1519 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
1521 (eq (symbol_ref "TARGET_QIMODE_MATH")
1523 (const_string "imov")
1524 (eq_attr "alternative" "3,5")
1525 (const_string "imovx")
1526 (and (ne (symbol_ref "TARGET_MOVX")
1528 (eq_attr "alternative" "2"))
1529 (const_string "imovx")
1531 (const_string "imov")))
1533 (cond [(eq_attr "alternative" "3,4,5")
1535 (eq_attr "alternative" "6")
1537 (eq_attr "type" "imovx")
1539 (and (eq_attr "type" "imov")
1540 (and (eq_attr "alternative" "0,1,2")
1541 (ne (symbol_ref "TARGET_PARTIAL_REG_DEPENDENCY")
1544 ;; Avoid partial register stalls when not using QImode arithmetic
1545 (and (eq_attr "type" "imov")
1546 (and (eq_attr "alternative" "0,1,2")
1547 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
1549 (eq (symbol_ref "TARGET_QIMODE_MATH")
1553 (const_string "QI")))])
1555 (define_expand "reload_outqi"
1556 [(parallel [(match_operand:QI 0 "" "=m")
1557 (match_operand:QI 1 "register_operand" "r")
1558 (match_operand:QI 2 "register_operand" "=&q")])]
1562 op0 = operands[0]; op1 = operands[1]; op2 = operands[2];
1564 if (reg_overlap_mentioned_p (op2, op0))
1566 if (! q_regs_operand (op1, QImode))
1568 emit_insn (gen_movqi (op2, op1));
1571 emit_insn (gen_movqi (op0, op1));
1575 (define_insn "*swapqi"
1576 [(set (match_operand:QI 0 "register_operand" "+r")
1577 (match_operand:QI 1 "register_operand" "+r"))
1582 [(set_attr "type" "imov")
1583 (set_attr "pent_pair" "np")
1584 (set_attr "mode" "QI")
1585 (set_attr "modrm" "0")
1586 (set_attr "ppro_uops" "few")])
1588 (define_expand "movstrictqi"
1589 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1590 (match_operand:QI 1 "general_operand" ""))]
1591 "! TARGET_PARTIAL_REG_STALL"
1593 /* Don't generate memory->memory moves, go through a register. */
1594 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
1595 operands[1] = force_reg (QImode, operands[1]);
1598 (define_insn "*movstrictqi_1"
1599 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
1600 (match_operand:QI 1 "general_operand" "*qn,m"))]
1601 "! TARGET_PARTIAL_REG_STALL
1602 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1603 "mov{b}\t{%1, %0|%0, %1}"
1604 [(set_attr "type" "imov")
1605 (set_attr "mode" "QI")])
1607 (define_insn "*movstrictqi_xor"
1608 [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q"))
1609 (match_operand:QI 1 "const0_operand" "i"))
1610 (clobber (reg:CC 17))]
1611 "reload_completed && (!TARGET_USE_MOV0 || optimize_size)"
1612 "xor{b}\t{%0, %0|%0, %0}"
1613 [(set_attr "type" "alu1")
1614 (set_attr "mode" "QI")
1615 (set_attr "length_immediate" "0")])
1617 (define_insn "*movsi_extv_1"
1618 [(set (match_operand:SI 0 "register_operand" "=R")
1619 (sign_extract:SI (match_operand 1 "ext_register_operand" "Q")
1623 "movs{bl|x}\t{%h1, %0|%0, %h1}"
1624 [(set_attr "type" "imovx")
1625 (set_attr "mode" "SI")])
1627 (define_insn "*movhi_extv_1"
1628 [(set (match_operand:HI 0 "register_operand" "=R")
1629 (sign_extract:HI (match_operand 1 "ext_register_operand" "Q")
1633 "movs{bl|x}\t{%h1, %k0|%k0, %h1}"
1634 [(set_attr "type" "imovx")
1635 (set_attr "mode" "SI")])
1637 (define_insn "*movqi_extv_1"
1638 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?r")
1639 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1644 switch (get_attr_type (insn))
1647 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1649 return "mov{b}\t{%h1, %0|%0, %h1}";
1653 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1654 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1655 (ne (symbol_ref "TARGET_MOVX")
1657 (const_string "imovx")
1658 (const_string "imov")))
1660 (if_then_else (eq_attr "type" "imovx")
1662 (const_string "QI")))])
1664 (define_insn "*movqi_extv_1_rex64"
1665 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1666 (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q")
1671 switch (get_attr_type (insn))
1674 return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
1676 return "mov{b}\t{%h1, %0|%0, %h1}";
1680 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1681 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1682 (ne (symbol_ref "TARGET_MOVX")
1684 (const_string "imovx")
1685 (const_string "imov")))
1687 (if_then_else (eq_attr "type" "imovx")
1689 (const_string "QI")))])
1691 ;; Stores and loads of ax to arbitrary constant address.
1692 ;; We fake an second form of instruction to force reload to load address
1693 ;; into register when rax is not available
1694 (define_insn "*movabsqi_1_rex64"
1695 [(set (mem:QI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
1696 (match_operand:QI 1 "nonmemory_operand" "a,er,i"))]
1699 movabs{b}\t{%1, %P0|%P0, %1}
1700 mov{b}\t{%1, %a0|%a0, %1}
1701 movabs{b}\t{%1, %a0|%a0, %1}"
1702 [(set_attr "type" "imov")
1703 (set_attr "modrm" "0,*,*")
1704 (set_attr "length_address" "8,0,0")
1705 (set_attr "length_immediate" "0,*,*")
1706 (set_attr "memory" "store")
1707 (set_attr "mode" "QI")])
1709 (define_insn "*movabsqi_2_rex64"
1710 [(set (match_operand:QI 0 "register_operand" "=a,r")
1711 (mem:QI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
1714 movabs{b}\t{%P1, %0|%0, %P1}
1715 mov{b}\t{%a1, %0|%0, %a1}"
1716 [(set_attr "type" "imov")
1717 (set_attr "modrm" "0,*")
1718 (set_attr "length_address" "8,0")
1719 (set_attr "length_immediate" "0")
1720 (set_attr "memory" "load")
1721 (set_attr "mode" "QI")])
1723 (define_insn "*movsi_extzv_1"
1724 [(set (match_operand:SI 0 "register_operand" "=R")
1725 (zero_extract:SI (match_operand 1 "ext_register_operand" "Q")
1729 "movz{bl|x}\t{%h1, %0|%0, %h1}"
1730 [(set_attr "type" "imovx")
1731 (set_attr "mode" "SI")])
1733 (define_insn "*movqi_extzv_2"
1734 [(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
1735 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1740 switch (get_attr_type (insn))
1743 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1745 return "mov{b}\t{%h1, %0|%0, %h1}";
1749 (if_then_else (and (match_operand:QI 0 "register_operand" "")
1750 (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1751 (ne (symbol_ref "TARGET_MOVX")
1753 (const_string "imovx")
1754 (const_string "imov")))
1756 (if_then_else (eq_attr "type" "imovx")
1758 (const_string "QI")))])
1760 (define_insn "*movqi_extzv_2_rex64"
1761 [(set (match_operand:QI 0 "register_operand" "=Q,?R")
1762 (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q")
1767 switch (get_attr_type (insn))
1770 return "movz{bl|x}\t{%h1, %k0|%k0, %h1}";
1772 return "mov{b}\t{%h1, %0|%0, %h1}";
1776 (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
1777 (ne (symbol_ref "TARGET_MOVX")
1779 (const_string "imovx")
1780 (const_string "imov")))
1782 (if_then_else (eq_attr "type" "imovx")
1784 (const_string "QI")))])
1786 (define_insn "movsi_insv_1"
1787 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1790 (match_operand:SI 1 "general_operand" "Qmn"))]
1792 "mov{b}\t{%b1, %h0|%h0, %b1}"
1793 [(set_attr "type" "imov")
1794 (set_attr "mode" "QI")])
1796 (define_insn "*movsi_insv_1_rex64"
1797 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1800 (match_operand:SI 1 "nonmemory_operand" "Qn"))]
1802 "mov{b}\t{%b1, %h0|%h0, %b1}"
1803 [(set_attr "type" "imov")
1804 (set_attr "mode" "QI")])
1806 (define_insn "*movqi_insv_2"
1807 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
1810 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
1814 "mov{b}\t{%h1, %h0|%h0, %h1}"
1815 [(set_attr "type" "imov")
1816 (set_attr "mode" "QI")])
1818 (define_expand "movdi"
1819 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1820 (match_operand:DI 1 "general_operand" ""))]
1822 "ix86_expand_move (DImode, operands); DONE;")
1824 (define_insn "*pushdi"
1825 [(set (match_operand:DI 0 "push_operand" "=<")
1826 (match_operand:DI 1 "general_no_elim_operand" "riF*m"))]
1830 (define_insn "pushdi2_rex64"
1831 [(set (match_operand:DI 0 "push_operand" "=<,!<")
1832 (match_operand:DI 1 "general_no_elim_operand" "re*m,n"))]
1837 [(set_attr "type" "push,multi")
1838 (set_attr "mode" "DI")])
1840 ;; Convert impossible pushes of immediate to existing instructions.
1841 ;; First try to get scratch register and go through it. In case this
1842 ;; fails, push sign extended lower part first and then overwrite
1843 ;; upper part by 32bit move.
1845 [(match_scratch:DI 2 "r")
1846 (set (match_operand:DI 0 "push_operand" "")
1847 (match_operand:DI 1 "immediate_operand" ""))]
1848 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1849 && !x86_64_immediate_operand (operands[1], DImode)"
1850 [(set (match_dup 2) (match_dup 1))
1851 (set (match_dup 0) (match_dup 2))]
1854 ;; We need to define this as both peepholer and splitter for case
1855 ;; peephole2 pass is not run.
1857 [(set (match_operand:DI 0 "push_operand" "")
1858 (match_operand:DI 1 "immediate_operand" ""))]
1859 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
1860 && !x86_64_immediate_operand (operands[1], DImode) && 1"
1861 [(set (match_dup 0) (match_dup 1))
1862 (set (match_dup 2) (match_dup 3))]
1863 "split_di (operands + 1, 1, operands + 2, operands + 3);
1864 operands[1] = gen_lowpart (DImode, operands[2]);
1865 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1870 [(set (match_operand:DI 0 "push_operand" "")
1871 (match_operand:DI 1 "immediate_operand" ""))]
1872 "TARGET_64BIT && (flow2_completed || (reload_completed && !flag_peephole2))
1873 && !symbolic_operand (operands[1], DImode)
1874 && !x86_64_immediate_operand (operands[1], DImode)"
1875 [(set (match_dup 0) (match_dup 1))
1876 (set (match_dup 2) (match_dup 3))]
1877 "split_di (operands + 1, 1, operands + 2, operands + 3);
1878 operands[1] = gen_lowpart (DImode, operands[2]);
1879 operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx,
1883 (define_insn "*pushdi2_prologue_rex64"
1884 [(set (match_operand:DI 0 "push_operand" "=<")
1885 (match_operand:DI 1 "general_no_elim_operand" "re*m"))
1886 (clobber (mem:BLK (scratch)))]
1889 [(set_attr "type" "push")
1890 (set_attr "mode" "DI")])
1892 (define_insn "*popdi1_epilogue_rex64"
1893 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1894 (mem:DI (reg:DI 7)))
1896 (plus:DI (reg:DI 7) (const_int 8)))
1897 (clobber (mem:BLK (scratch)))]
1900 [(set_attr "type" "pop")
1901 (set_attr "mode" "DI")])
1903 (define_insn "popdi1"
1904 [(set (match_operand:DI 0 "nonimmediate_operand" "=r*m")
1905 (mem:DI (reg:DI 7)))
1907 (plus:DI (reg:DI 7) (const_int 8)))]
1910 [(set_attr "type" "pop")
1911 (set_attr "mode" "DI")])
1913 (define_insn "*movdi_xor_rex64"
1914 [(set (match_operand:DI 0 "register_operand" "=r")
1915 (match_operand:DI 1 "const0_operand" "i"))
1916 (clobber (reg:CC 17))]
1917 "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size)
1918 && reload_completed"
1919 "xor{l}\t{%k0, %k0|%k0, %k0}"
1920 [(set_attr "type" "alu1")
1921 (set_attr "mode" "SI")
1922 (set_attr "length_immediate" "0")])
1924 (define_insn "*movdi_or_rex64"
1925 [(set (match_operand:DI 0 "register_operand" "=r")
1926 (match_operand:DI 1 "const_int_operand" "i"))
1927 (clobber (reg:CC 17))]
1928 "TARGET_64BIT && (TARGET_PENTIUM || optimize_size)
1930 && GET_CODE (operands[1]) == CONST_INT
1931 && INTVAL (operands[1]) == -1"
1933 operands[1] = constm1_rtx;
1934 return "or{q}\t{%1, %0|%0, %1}";
1936 [(set_attr "type" "alu1")
1937 (set_attr "mode" "DI")
1938 (set_attr "length_immediate" "1")])
1940 (define_insn "*movdi_2"
1941 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!m*y,!*y,!m,!*Y,!*Y")
1942 (match_operand:DI 1 "general_operand" "riFo,riF,*y,m,*Y,*Y,m"))]
1944 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1948 movq\t{%1, %0|%0, %1}
1949 movq\t{%1, %0|%0, %1}
1950 movq\t{%1, %0|%0, %1}
1951 movdqa\t{%1, %0|%0, %1}
1952 movq\t{%1, %0|%0, %1}"
1953 [(set_attr "type" "*,*,mmx,mmx,ssemov,ssemov,ssemov")
1954 (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
1957 [(set (match_operand:DI 0 "push_operand" "")
1958 (match_operand:DI 1 "general_operand" ""))]
1959 "!TARGET_64BIT && reload_completed
1960 && (! MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1962 "ix86_split_long_move (operands); DONE;")
1964 ;; %%% This multiword shite has got to go.
1966 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1967 (match_operand:DI 1 "general_operand" ""))]
1968 "!TARGET_64BIT && reload_completed
1969 && (!MMX_REG_P (operands[0]) && !SSE_REG_P (operands[0]))
1970 && (!MMX_REG_P (operands[1]) && !SSE_REG_P (operands[1]))"
1972 "ix86_split_long_move (operands); DONE;")
1974 (define_insn "*movdi_1_rex64"
1975 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!*y,!rm,!*y,!*Y,!rm,!*Y")
1976 (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,*y,rm,*Y,*Y,rm"))]
1978 && (TARGET_INTER_UNIT_MOVES || optimize_size)
1979 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
1981 switch (get_attr_type (insn))
1984 if (get_attr_mode (insn) == MODE_TI)
1985 return "movdqa\t{%1, %0|%0, %1}";
1986 /* Moves from and into integer register is done using movd opcode with
1988 if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
1989 return "movd\t{%1, %0|%0, %1}";
1992 return "movq\t{%1, %0|%0, %1}";
1996 return "lea{q}\t{%a1, %0|%0, %a1}";
1998 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
2000 if (get_attr_mode (insn) == MODE_SI)
2001 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2002 else if (which_alternative == 2)
2003 return "movabs{q}\t{%1, %0|%0, %1}";
2005 return "mov{q}\t{%1, %0|%0, %1}";
2009 (cond [(eq_attr "alternative" "5,6,7")
2010 (const_string "mmxmov")
2011 (eq_attr "alternative" "8,9,10")
2012 (const_string "ssemov")
2013 (eq_attr "alternative" "4")
2014 (const_string "multi")
2015 (and (ne (symbol_ref "flag_pic") (const_int 0))
2016 (match_operand:DI 1 "symbolic_operand" ""))
2017 (const_string "lea")
2019 (const_string "imov")))
2020 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*")
2021 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*")
2022 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI")])
2024 (define_insn "*movdi_1_rex64_nointerunit"
2025 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!*y,!m,!*y,!*Y,!m,!*Y")
2026 (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,*y,m,*Y,*Y,m"))]
2028 && (!TARGET_INTER_UNIT_MOVES && !optimize_size)
2029 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
2031 switch (get_attr_type (insn))
2034 if (get_attr_mode (insn) == MODE_TI)
2035 return "movdqa\t{%1, %0|%0, %1}";
2038 return "movq\t{%1, %0|%0, %1}";
2042 return "lea{q}\t{%a1, %0|%0, %a1}";
2044 if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1]))
2046 if (get_attr_mode (insn) == MODE_SI)
2047 return "mov{l}\t{%k1, %k0|%k0, %k1}";
2048 else if (which_alternative == 2)
2049 return "movabs{q}\t{%1, %0|%0, %1}";
2051 return "mov{q}\t{%1, %0|%0, %1}";
2055 (cond [(eq_attr "alternative" "5,6,7")
2056 (const_string "mmxmov")
2057 (eq_attr "alternative" "8,9,10")
2058 (const_string "ssemov")
2059 (eq_attr "alternative" "4")
2060 (const_string "multi")
2061 (and (ne (symbol_ref "flag_pic") (const_int 0))
2062 (match_operand:DI 1 "symbolic_operand" ""))
2063 (const_string "lea")
2065 (const_string "imov")))
2066 (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*")
2067 (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*")
2068 (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI")])
2070 ;; Stores and loads of ax to arbitrary constant address.
2071 ;; We fake an second form of instruction to force reload to load address
2072 ;; into register when rax is not available
2073 (define_insn "*movabsdi_1_rex64"
2074 [(set (mem:DI (match_operand:DI 0 "x86_64_movabs_operand" "i,r,r"))
2075 (match_operand:DI 1 "nonmemory_operand" "a,er,i"))]
2078 movabs{q}\t{%1, %P0|%P0, %1}
2079 mov{q}\t{%1, %a0|%a0, %1}
2080 movabs{q}\t{%1, %a0|%a0, %1}"
2081 [(set_attr "type" "imov")
2082 (set_attr "modrm" "0,*,*")
2083 (set_attr "length_address" "8,0,0")
2084 (set_attr "length_immediate" "0,*,*")
2085 (set_attr "memory" "store")
2086 (set_attr "mode" "DI")])
2088 (define_insn "*movabsdi_2_rex64"
2089 [(set (match_operand:DI 0 "register_operand" "=a,r")
2090 (mem:DI (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
2093 movabs{q}\t{%P1, %0|%0, %P1}
2094 mov{q}\t{%a1, %0|%0, %a1}"
2095 [(set_attr "type" "imov")
2096 (set_attr "modrm" "0,*")
2097 (set_attr "length_address" "8,0")
2098 (set_attr "length_immediate" "0")
2099 (set_attr "memory" "load")
2100 (set_attr "mode" "DI")])
2102 ;; Convert impossible stores of immediate to existing instructions.
2103 ;; First try to get scratch register and go through it. In case this
2104 ;; fails, move by 32bit parts.
2106 [(match_scratch:DI 2 "r")
2107 (set (match_operand:DI 0 "memory_operand" "")
2108 (match_operand:DI 1 "immediate_operand" ""))]
2109 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2110 && !x86_64_immediate_operand (operands[1], DImode)"
2111 [(set (match_dup 2) (match_dup 1))
2112 (set (match_dup 0) (match_dup 2))]
2115 ;; We need to define this as both peepholer and splitter for case
2116 ;; peephole2 pass is not run.
2118 [(set (match_operand:DI 0 "memory_operand" "")
2119 (match_operand:DI 1 "immediate_operand" ""))]
2120 "TARGET_64BIT && !symbolic_operand (operands[1], DImode)
2121 && !x86_64_immediate_operand (operands[1], DImode) && 1"
2122 [(set (match_dup 2) (match_dup 3))
2123 (set (match_dup 4) (match_dup 5))]
2124 "split_di (operands, 2, operands + 2, operands + 4);")
2127 [(set (match_operand:DI 0 "memory_operand" "")
2128 (match_operand:DI 1 "immediate_operand" ""))]
2129 "TARGET_64BIT && (flow2_completed || (reload_completed && !flag_peephole2))
2130 && !symbolic_operand (operands[1], DImode)
2131 && !x86_64_immediate_operand (operands[1], DImode)"
2132 [(set (match_dup 2) (match_dup 3))
2133 (set (match_dup 4) (match_dup 5))]
2134 "split_di (operands, 2, operands + 2, operands + 4);")
2136 (define_insn "*swapdi_rex64"
2137 [(set (match_operand:DI 0 "register_operand" "+r")
2138 (match_operand:DI 1 "register_operand" "+r"))
2143 [(set_attr "type" "imov")
2144 (set_attr "pent_pair" "np")
2145 (set_attr "athlon_decode" "vector")
2146 (set_attr "mode" "DI")
2147 (set_attr "modrm" "0")
2148 (set_attr "ppro_uops" "few")])
2151 (define_expand "movsf"
2152 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2153 (match_operand:SF 1 "general_operand" ""))]
2155 "ix86_expand_move (SFmode, operands); DONE;")
2157 (define_insn "*pushsf"
2158 [(set (match_operand:SF 0 "push_operand" "=<,<,<")
2159 (match_operand:SF 1 "general_no_elim_operand" "f#rx,rFm#fx,x#rf"))]
2162 switch (which_alternative)
2165 return "push{l}\t%1";
2168 /* This insn should be already splitted before reg-stack. */
2172 [(set_attr "type" "multi,push,multi")
2173 (set_attr "mode" "SF,SI,SF")])
2175 (define_insn "*pushsf_rex64"
2176 [(set (match_operand:SF 0 "push_operand" "=X,X,X")
2177 (match_operand:SF 1 "nonmemory_no_elim_operand" "f#rx,rF#fx,x#rf"))]
2180 switch (which_alternative)
2183 return "push{q}\t%q1";
2186 /* This insn should be already splitted before reg-stack. */
2190 [(set_attr "type" "multi,push,multi")
2191 (set_attr "mode" "SF,DI,SF")])
2194 [(set (match_operand:SF 0 "push_operand" "")
2195 (match_operand:SF 1 "memory_operand" ""))]
2197 && GET_CODE (operands[1]) == MEM
2198 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
2199 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
2202 "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
2205 ;; %%% Kill this when call knows how to work this out.
2207 [(set (match_operand:SF 0 "push_operand" "")
2208 (match_operand:SF 1 "any_fp_register_operand" ""))]
2210 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -4)))
2211 (set (mem:SF (reg:SI 7)) (match_dup 1))])
2214 [(set (match_operand:SF 0 "push_operand" "")
2215 (match_operand:SF 1 "any_fp_register_operand" ""))]
2217 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
2218 (set (mem:SF (reg:DI 7)) (match_dup 1))])
2220 (define_insn "*movsf_1"
2221 [(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")
2222 (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,C,x,xm#rf,x#rf,rm,*y,*y"))]
2223 "(TARGET_INTER_UNIT_MOVES || optimize_size)
2224 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2225 && (reload_in_progress || reload_completed
2226 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2227 || GET_CODE (operands[1]) != CONST_DOUBLE
2228 || memory_operand (operands[0], SFmode))"
2230 switch (which_alternative)
2233 if (REG_P (operands[1])
2234 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2236 else if (STACK_TOP_P (operands[0]))
2237 return "fld%z1\t%y1";
2242 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2243 return "fstp%z0\t%y0";
2245 return "fst%z0\t%y0";
2248 switch (standard_80387_constant_p (operands[1]))
2259 return "mov{l}\t{%1, %0|%0, %1}";
2261 if (get_attr_mode (insn) == MODE_TI)
2262 return "pxor\t%0, %0";
2264 return "xorps\t%0, %0";
2266 if (get_attr_mode (insn) == MODE_V4SF)
2267 return "movaps\t{%1, %0|%0, %1}";
2269 return "movss\t{%1, %0|%0, %1}";
2272 return "movss\t{%1, %0|%0, %1}";
2276 return "movd\t{%1, %0|%0, %1}";
2279 return "movq\t{%1, %0|%0, %1}";
2285 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2287 (cond [(eq_attr "alternative" "3,4,9,10")
2289 (eq_attr "alternative" "5")
2291 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2293 (ne (symbol_ref "TARGET_SSE2")
2295 (eq (symbol_ref "optimize_size")
2298 (const_string "V4SF"))
2299 /* For architectures resolving dependencies on
2300 whole SSE registers use APS move to break dependency
2301 chains, otherwise use short move to avoid extra work.
2303 Do the same for architectures resolving dependencies on
2304 the parts. While in DF mode it is better to always handle
2305 just register parts, the SF mode is different due to lack
2306 of instructions to load just part of the register. It is
2307 better to maintain the whole registers in single format
2308 to avoid problems on using packed logical operations. */
2309 (eq_attr "alternative" "6")
2311 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2313 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2315 (const_string "V4SF")
2316 (const_string "SF"))
2317 (eq_attr "alternative" "11")
2318 (const_string "DI")]
2319 (const_string "SF")))])
2321 (define_insn "*movsf_1_nointerunit"
2322 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#xr,m,f#xr,r#xf,m,x#rf,x#rf,x#rf,m,!*y,!m,!*y")
2323 (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,C,x,xm#rf,x#rf,m,*y,*y"))]
2324 "(!TARGET_INTER_UNIT_MOVES && !optimize_size)
2325 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2326 && (reload_in_progress || reload_completed
2327 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2328 || GET_CODE (operands[1]) != CONST_DOUBLE
2329 || memory_operand (operands[0], SFmode))"
2331 switch (which_alternative)
2334 if (REG_P (operands[1])
2335 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2337 if (REGNO (operands[0]) == FIRST_STACK_REG
2338 && TARGET_USE_FFREEP)
2339 return "ffreep\t%y0";
2342 else if (STACK_TOP_P (operands[0]))
2343 return "fld%z1\t%y1";
2348 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2349 return "fstp%z0\t%y0";
2351 return "fst%z0\t%y0";
2354 switch (standard_80387_constant_p (operands[1]))
2365 return "mov{l}\t{%1, %0|%0, %1}";
2367 if (get_attr_mode (insn) == MODE_TI)
2368 return "pxor\t%0, %0";
2370 return "xorps\t%0, %0";
2372 if (get_attr_mode (insn) == MODE_V4SF)
2373 return "movaps\t{%1, %0|%0, %1}";
2375 return "movss\t{%1, %0|%0, %1}";
2378 return "movss\t{%1, %0|%0, %1}";
2382 return "movd\t{%1, %0|%0, %1}";
2385 return "movq\t{%1, %0|%0, %1}";
2391 [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
2393 (cond [(eq_attr "alternative" "3,4,9,10")
2395 (eq_attr "alternative" "5")
2397 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2399 (ne (symbol_ref "TARGET_SSE2")
2401 (eq (symbol_ref "optimize_size")
2404 (const_string "V4SF"))
2405 /* For architectures resolving dependencies on
2406 whole SSE registers use APS move to break dependency
2407 chains, otherwise use short move to avoid extra work.
2409 Do the same for architectures resolving dependencies on
2410 the parts. While in DF mode it is better to always handle
2411 just register parts, the SF mode is different due to lack
2412 of instructions to load just part of the register. It is
2413 better to maintain the whole registers in single format
2414 to avoid problems on using packed logical operations. */
2415 (eq_attr "alternative" "6")
2417 (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2419 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2421 (const_string "V4SF")
2422 (const_string "SF"))
2423 (eq_attr "alternative" "11")
2424 (const_string "DI")]
2425 (const_string "SF")))])
2427 (define_insn "*swapsf"
2428 [(set (match_operand:SF 0 "register_operand" "+f")
2429 (match_operand:SF 1 "register_operand" "+f"))
2432 "reload_completed || !TARGET_SSE"
2434 if (STACK_TOP_P (operands[0]))
2439 [(set_attr "type" "fxch")
2440 (set_attr "mode" "SF")])
2442 (define_expand "movdf"
2443 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2444 (match_operand:DF 1 "general_operand" ""))]
2446 "ix86_expand_move (DFmode, operands); DONE;")
2448 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2449 ;; Size of pushdf using integer instructions is 2+2*memory operand size
2450 ;; On the average, pushdf using integers can be still shorter. Allow this
2451 ;; pattern for optimize_size too.
2453 (define_insn "*pushdf_nointeger"
2454 [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
2455 (match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))]
2456 "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
2458 /* This insn should be already splitted before reg-stack. */
2461 [(set_attr "type" "multi")
2462 (set_attr "mode" "DF,SI,SI,DF")])
2464 (define_insn "*pushdf_integer"
2465 [(set (match_operand:DF 0 "push_operand" "=<,<,<")
2466 (match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))]
2467 "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
2469 /* This insn should be already splitted before reg-stack. */
2472 [(set_attr "type" "multi")
2473 (set_attr "mode" "DF,SI,DF")])
2475 ;; %%% Kill this when call knows how to work this out.
2477 [(set (match_operand:DF 0 "push_operand" "")
2478 (match_operand:DF 1 "any_fp_register_operand" ""))]
2479 "!TARGET_64BIT && reload_completed"
2480 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
2481 (set (mem:DF (reg:SI 7)) (match_dup 1))]
2485 [(set (match_operand:DF 0 "push_operand" "")
2486 (match_operand:DF 1 "any_fp_register_operand" ""))]
2487 "TARGET_64BIT && reload_completed"
2488 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
2489 (set (mem:DF (reg:DI 7)) (match_dup 1))]
2493 [(set (match_operand:DF 0 "push_operand" "")
2494 (match_operand:DF 1 "general_operand" ""))]
2497 "ix86_split_long_move (operands); DONE;")
2499 ;; Moving is usually shorter when only FP registers are used. This separate
2500 ;; movdf pattern avoids the use of integer registers for FP operations
2501 ;; when optimizing for size.
2503 (define_insn "*movdf_nointeger"
2504 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,m,f#Y,*r,o,Y#f,Y#f,Y#f,m")
2505 (match_operand:DF 1 "general_operand" "fm#Y,f#Y,G,*roF,F*r,C,Y#f,YHm#f,Y#f"))]
2506 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2507 && ((optimize_size || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT)
2508 && (reload_in_progress || reload_completed
2509 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2510 || GET_CODE (operands[1]) != CONST_DOUBLE
2511 || memory_operand (operands[0], DFmode))"
2513 switch (which_alternative)
2516 if (REG_P (operands[1])
2517 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2519 if (REGNO (operands[0]) == FIRST_STACK_REG
2520 && TARGET_USE_FFREEP)
2521 return "ffreep\t%y0";
2524 else if (STACK_TOP_P (operands[0]))
2525 return "fld%z1\t%y1";
2530 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2531 return "fstp%z0\t%y0";
2533 return "fst%z0\t%y0";
2536 switch (standard_80387_constant_p (operands[1]))
2549 switch (get_attr_mode (insn))
2552 return "xorps\t%0, %0";
2554 return "xorpd\t%0, %0";
2556 return "pxor\t%0, %0";
2561 switch (get_attr_mode (insn))
2564 return "movaps\t{%1, %0|%0, %1}";
2566 return "movapd\t{%1, %0|%0, %1}";
2568 return "movsd\t{%1, %0|%0, %1}";
2573 if (get_attr_mode (insn) == MODE_V2DF)
2574 return "movlpd\t{%1, %0|%0, %1}";
2576 return "movsd\t{%1, %0|%0, %1}";
2578 return "movsd\t{%1, %0|%0, %1}";
2584 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2586 (cond [(eq_attr "alternative" "3,4")
2588 /* xorps is one byte shorter. */
2589 (eq_attr "alternative" "5")
2590 (cond [(ne (symbol_ref "optimize_size")
2592 (const_string "V4SF")
2593 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2595 (const_string "TI")]
2596 (const_string "V2DF"))
2597 /* For architectures resolving dependencies on
2598 whole SSE registers use APD move to break dependency
2599 chains, otherwise use short move to avoid extra work.
2601 movaps encodes one byte shorter. */
2602 (eq_attr "alternative" "6")
2604 [(ne (symbol_ref "optimize_size")
2606 (const_string "V4SF")
2607 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2609 (const_string "V2DF")]
2610 (const_string "DF"))
2611 /* For architectures resolving dependencies on register
2612 parts we may avoid extra work to zero out upper part
2614 (eq_attr "alternative" "7")
2616 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2618 (const_string "V2DF")
2619 (const_string "DF"))]
2620 (const_string "DF")))])
2622 (define_insn "*movdf_integer"
2623 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Yr,m,f#Yr,r#Yf,o,Y#rf,Y#rf,Y#rf,m")
2624 (match_operand:DF 1 "general_operand" "fm#Yr,f#Yr,G,roF#Yf,Fr#Yf,C,Y#rf,Ym#rf,Y#rf"))]
2625 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2626 && ((!optimize_size && TARGET_INTEGER_DFMODE_MOVES) || TARGET_64BIT)
2627 && (reload_in_progress || reload_completed
2628 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2629 || GET_CODE (operands[1]) != CONST_DOUBLE
2630 || memory_operand (operands[0], DFmode))"
2632 switch (which_alternative)
2635 if (REG_P (operands[1])
2636 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2638 if (REGNO (operands[0]) == FIRST_STACK_REG
2639 && TARGET_USE_FFREEP)
2640 return "ffreep\t%y0";
2643 else if (STACK_TOP_P (operands[0]))
2644 return "fld%z1\t%y1";
2649 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2650 return "fstp%z0\t%y0";
2652 return "fst%z0\t%y0";
2655 switch (standard_80387_constant_p (operands[1]))
2669 switch (get_attr_mode (insn))
2672 return "xorps\t%0, %0";
2674 return "xorpd\t%0, %0";
2676 return "pxor\t%0, %0";
2681 switch (get_attr_mode (insn))
2684 return "movaps\t{%1, %0|%0, %1}";
2686 return "movapd\t{%1, %0|%0, %1}";
2688 return "movsd\t{%1, %0|%0, %1}";
2693 if (get_attr_mode (insn) == MODE_V2DF)
2694 return "movlpd\t{%1, %0|%0, %1}";
2696 return "movsd\t{%1, %0|%0, %1}";
2698 return "movsd\t{%1, %0|%0, %1}";
2704 [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
2706 (cond [(eq_attr "alternative" "3,4")
2708 /* xorps is one byte shorter. */
2709 (eq_attr "alternative" "5")
2710 (cond [(ne (symbol_ref "optimize_size")
2712 (const_string "V4SF")
2713 (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
2715 (const_string "TI")]
2716 (const_string "V2DF"))
2717 /* For architectures resolving dependencies on
2718 whole SSE registers use APD move to break dependency
2719 chains, otherwise use short move to avoid extra work.
2721 movaps encodes one byte shorter. */
2722 (eq_attr "alternative" "6")
2724 [(ne (symbol_ref "optimize_size")
2726 (const_string "V4SF")
2727 (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY")
2729 (const_string "V2DF")]
2730 (const_string "DF"))
2731 /* For architectures resolving dependencies on register
2732 parts we may avoid extra work to zero out upper part
2734 (eq_attr "alternative" "7")
2736 (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS")
2738 (const_string "V2DF")
2739 (const_string "DF"))]
2740 (const_string "DF")))])
2743 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2744 (match_operand:DF 1 "general_operand" ""))]
2746 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2747 && ! (ANY_FP_REG_P (operands[0]) ||
2748 (GET_CODE (operands[0]) == SUBREG
2749 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
2750 && ! (ANY_FP_REG_P (operands[1]) ||
2751 (GET_CODE (operands[1]) == SUBREG
2752 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
2754 "ix86_split_long_move (operands); DONE;")
2756 (define_insn "*swapdf"
2757 [(set (match_operand:DF 0 "register_operand" "+f")
2758 (match_operand:DF 1 "register_operand" "+f"))
2761 "reload_completed || !TARGET_SSE2"
2763 if (STACK_TOP_P (operands[0]))
2768 [(set_attr "type" "fxch")
2769 (set_attr "mode" "DF")])
2771 (define_expand "movxf"
2772 [(set (match_operand:XF 0 "nonimmediate_operand" "")
2773 (match_operand:XF 1 "general_operand" ""))]
2775 "ix86_expand_move (XFmode, operands); DONE;")
2777 (define_expand "movtf"
2778 [(set (match_operand:TF 0 "nonimmediate_operand" "")
2779 (match_operand:TF 1 "general_operand" ""))]
2781 "ix86_expand_move (TFmode, operands); DONE;")
2783 ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size.
2784 ;; Size of pushdf using integer instructions is 3+3*memory operand size
2785 ;; Pushing using integer instructions is longer except for constants
2786 ;; and direct memory references.
2787 ;; (assuming that any given constant is pushed only once, but this ought to be
2788 ;; handled elsewhere).
2790 (define_insn "*pushxf_nointeger"
2791 [(set (match_operand:XF 0 "push_operand" "=X,X,X")
2792 (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
2793 "!TARGET_64BIT && optimize_size"
2795 /* This insn should be already splitted before reg-stack. */
2798 [(set_attr "type" "multi")
2799 (set_attr "mode" "XF,SI,SI")])
2801 (define_insn "*pushtf_nointeger"
2802 [(set (match_operand:TF 0 "push_operand" "=<,<,<")
2803 (match_operand:TF 1 "general_no_elim_operand" "f,Fo,*r"))]
2806 /* This insn should be already splitted before reg-stack. */
2809 [(set_attr "type" "multi")
2810 (set_attr "mode" "XF,SI,SI")])
2812 (define_insn "*pushxf_integer"
2813 [(set (match_operand:XF 0 "push_operand" "=<,<")
2814 (match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))]
2815 "!TARGET_64BIT && !optimize_size"
2817 /* This insn should be already splitted before reg-stack. */
2820 [(set_attr "type" "multi")
2821 (set_attr "mode" "XF,SI")])
2823 (define_insn "*pushtf_integer"
2824 [(set (match_operand:TF 0 "push_operand" "=<,<")
2825 (match_operand:TF 1 "general_no_elim_operand" "f#r,rFo#f"))]
2828 /* This insn should be already splitted before reg-stack. */
2831 [(set_attr "type" "multi")
2832 (set_attr "mode" "XF,SI")])
2835 [(set (match_operand 0 "push_operand" "")
2836 (match_operand 1 "general_operand" ""))]
2838 && (GET_MODE (operands[0]) == XFmode
2839 || GET_MODE (operands[0]) == TFmode
2840 || GET_MODE (operands[0]) == DFmode)
2841 && !ANY_FP_REG_P (operands[1])"
2843 "ix86_split_long_move (operands); DONE;")
2846 [(set (match_operand:XF 0 "push_operand" "")
2847 (match_operand:XF 1 "any_fp_register_operand" ""))]
2849 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12)))
2850 (set (mem:XF (reg:SI 7)) (match_dup 1))])
2853 [(set (match_operand:TF 0 "push_operand" "")
2854 (match_operand:TF 1 "any_fp_register_operand" ""))]
2856 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
2857 (set (mem:TF (reg:SI 7)) (match_dup 1))])
2860 [(set (match_operand:TF 0 "push_operand" "")
2861 (match_operand:TF 1 "any_fp_register_operand" ""))]
2863 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
2864 (set (mem:TF (reg:DI 7)) (match_dup 1))])
2866 ;; Do not use integer registers when optimizing for size
2867 (define_insn "*movxf_nointeger"
2868 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2869 (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2872 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2873 && (reload_in_progress || reload_completed
2874 || GET_CODE (operands[1]) != CONST_DOUBLE
2875 || memory_operand (operands[0], XFmode))"
2877 switch (which_alternative)
2880 if (REG_P (operands[1])
2881 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2883 if (REGNO (operands[0]) == FIRST_STACK_REG
2884 && TARGET_USE_FFREEP)
2885 return "ffreep\t%y0";
2888 else if (STACK_TOP_P (operands[0]))
2889 return "fld%z1\t%y1";
2894 /* There is no non-popping store to memory for XFmode. So if
2895 we need one, follow the store with a load. */
2896 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2897 return "fstp%z0\t%y0\;fld%z0\t%y0";
2899 return "fstp%z0\t%y0";
2902 switch (standard_80387_constant_p (operands[1]))
2916 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2917 (set_attr "mode" "XF,XF,XF,SI,SI")])
2919 (define_insn "*movtf_nointeger"
2920 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m,f,*r,o")
2921 (match_operand:TF 1 "general_operand" "fm,f,G,*roF,F*r"))]
2922 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2924 && (reload_in_progress || reload_completed
2925 || GET_CODE (operands[1]) != CONST_DOUBLE
2926 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
2927 || memory_operand (operands[0], TFmode))"
2929 switch (which_alternative)
2932 if (REG_P (operands[1])
2933 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2935 if (REGNO (operands[0]) == FIRST_STACK_REG
2936 && TARGET_USE_FFREEP)
2937 return "ffreep\t%y0";
2940 else if (STACK_TOP_P (operands[0]))
2941 return "fld%z1\t%y1";
2946 /* There is no non-popping store to memory for XFmode. So if
2947 we need one, follow the store with a load. */
2948 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2949 return "fstp%z0\t%y0\;fld%z0\t%y0";
2951 return "fstp%z0\t%y0";
2954 switch (standard_80387_constant_p (operands[1]))
2968 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
2969 (set_attr "mode" "XF,XF,XF,SI,SI")])
2971 (define_insn "*movxf_integer"
2972 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
2973 (match_operand:XF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
2976 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
2977 && (reload_in_progress || reload_completed
2978 || GET_CODE (operands[1]) != CONST_DOUBLE
2979 || memory_operand (operands[0], XFmode))"
2981 switch (which_alternative)
2984 if (REG_P (operands[1])
2985 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
2987 if (REGNO (operands[0]) == FIRST_STACK_REG
2988 && TARGET_USE_FFREEP)
2989 return "ffreep\t%y0";
2992 else if (STACK_TOP_P (operands[0]))
2993 return "fld%z1\t%y1";
2998 /* There is no non-popping store to memory for XFmode. So if
2999 we need one, follow the store with a load. */
3000 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3001 return "fstp%z0\t%y0\;fld%z0\t%y0";
3003 return "fstp%z0\t%y0";
3006 switch (standard_80387_constant_p (operands[1]))
3020 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3021 (set_attr "mode" "XF,XF,XF,SI,SI")])
3023 (define_insn "*movtf_integer"
3024 [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
3025 (match_operand:TF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
3026 "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
3028 && (reload_in_progress || reload_completed
3029 || GET_CODE (operands[1]) != CONST_DOUBLE
3030 || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
3031 || memory_operand (operands[0], TFmode))"
3033 switch (which_alternative)
3036 if (REG_P (operands[1])
3037 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3039 if (REGNO (operands[0]) == FIRST_STACK_REG
3040 && TARGET_USE_FFREEP)
3041 return "ffreep\t%y0";
3044 else if (STACK_TOP_P (operands[0]))
3045 return "fld%z1\t%y1";
3050 /* There is no non-popping store to memory for XFmode. So if
3051 we need one, follow the store with a load. */
3052 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3053 return "fstp%z0\t%y0\;fld%z0\t%y0";
3055 return "fstp%z0\t%y0";
3058 switch (standard_80387_constant_p (operands[1]))
3072 [(set_attr "type" "fmov,fmov,fmov,multi,multi")
3073 (set_attr "mode" "XF,XF,XF,SI,SI")])
3076 [(set (match_operand 0 "nonimmediate_operand" "")
3077 (match_operand 1 "general_operand" ""))]
3079 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
3080 && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == TFmode)
3081 && ! (ANY_FP_REG_P (operands[0]) ||
3082 (GET_CODE (operands[0]) == SUBREG
3083 && ANY_FP_REG_P (SUBREG_REG (operands[0]))))
3084 && ! (ANY_FP_REG_P (operands[1]) ||
3085 (GET_CODE (operands[1]) == SUBREG
3086 && ANY_FP_REG_P (SUBREG_REG (operands[1]))))"
3088 "ix86_split_long_move (operands); DONE;")
3091 [(set (match_operand 0 "register_operand" "")
3092 (match_operand 1 "memory_operand" ""))]
3094 && GET_CODE (operands[1]) == MEM
3095 && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == TFmode
3096 || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
3097 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
3098 && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))
3099 && (!(SSE_REG_P (operands[0]) ||
3100 (GET_CODE (operands[0]) == SUBREG
3101 && SSE_REG_P (SUBREG_REG (operands[0]))))
3102 || standard_sse_constant_p (get_pool_constant (XEXP (operands[1], 0))))
3103 && (!(FP_REG_P (operands[0]) ||
3104 (GET_CODE (operands[0]) == SUBREG
3105 && FP_REG_P (SUBREG_REG (operands[0]))))
3106 || standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0))))"
3109 "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
3111 (define_insn "swapxf"
3112 [(set (match_operand:XF 0 "register_operand" "+f")
3113 (match_operand:XF 1 "register_operand" "+f"))
3118 if (STACK_TOP_P (operands[0]))
3123 [(set_attr "type" "fxch")
3124 (set_attr "mode" "XF")])
3126 (define_insn "swaptf"
3127 [(set (match_operand:TF 0 "register_operand" "+f")
3128 (match_operand:TF 1 "register_operand" "+f"))
3133 if (STACK_TOP_P (operands[0]))
3138 [(set_attr "type" "fxch")
3139 (set_attr "mode" "XF")])
3141 ;; Zero extension instructions
3143 (define_expand "zero_extendhisi2"
3144 [(set (match_operand:SI 0 "register_operand" "")
3145 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3148 if (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3150 operands[1] = force_reg (HImode, operands[1]);
3151 emit_insn (gen_zero_extendhisi2_and (operands[0], operands[1]));
3156 (define_insn "zero_extendhisi2_and"
3157 [(set (match_operand:SI 0 "register_operand" "=r")
3158 (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))
3159 (clobber (reg:CC 17))]
3160 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
3162 [(set_attr "type" "alu1")
3163 (set_attr "mode" "SI")])
3166 [(set (match_operand:SI 0 "register_operand" "")
3167 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
3168 (clobber (reg:CC 17))]
3169 "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
3170 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 65535)))
3171 (clobber (reg:CC 17))])]
3174 (define_insn "*zero_extendhisi2_movzwl"
3175 [(set (match_operand:SI 0 "register_operand" "=r")
3176 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3177 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
3178 "movz{wl|x}\t{%1, %0|%0, %1}"
3179 [(set_attr "type" "imovx")
3180 (set_attr "mode" "SI")])
3182 (define_expand "zero_extendqihi2"
3184 [(set (match_operand:HI 0 "register_operand" "")
3185 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3186 (clobber (reg:CC 17))])]
3190 (define_insn "*zero_extendqihi2_and"
3191 [(set (match_operand:HI 0 "register_operand" "=r,?&q")
3192 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3193 (clobber (reg:CC 17))]
3194 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
3196 [(set_attr "type" "alu1")
3197 (set_attr "mode" "HI")])
3199 (define_insn "*zero_extendqihi2_movzbw_and"
3200 [(set (match_operand:HI 0 "register_operand" "=r,r")
3201 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3202 (clobber (reg:CC 17))]
3203 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
3205 [(set_attr "type" "imovx,alu1")
3206 (set_attr "mode" "HI")])
3208 (define_insn "*zero_extendqihi2_movzbw"
3209 [(set (match_operand:HI 0 "register_operand" "=r")
3210 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3211 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
3212 "movz{bw|x}\t{%1, %0|%0, %1}"
3213 [(set_attr "type" "imovx")
3214 (set_attr "mode" "HI")])
3216 ;; For the movzbw case strip only the clobber
3218 [(set (match_operand:HI 0 "register_operand" "")
3219 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3220 (clobber (reg:CC 17))]
3222 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
3223 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3224 [(set (match_operand:HI 0 "register_operand" "")
3225 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))])
3227 ;; When source and destination does not overlap, clear destination
3228 ;; first and then do the movb
3230 [(set (match_operand:HI 0 "register_operand" "")
3231 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))
3232 (clobber (reg:CC 17))]
3234 && ANY_QI_REG_P (operands[0])
3235 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3236 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3237 [(set (match_dup 0) (const_int 0))
3238 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3239 "operands[2] = gen_lowpart (QImode, operands[0]);")
3241 ;; Rest is handled by single and.
3243 [(set (match_operand:HI 0 "register_operand" "")
3244 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))
3245 (clobber (reg:CC 17))]
3247 && true_regnum (operands[0]) == true_regnum (operands[1])"
3248 [(parallel [(set (match_dup 0) (and:HI (match_dup 0) (const_int 255)))
3249 (clobber (reg:CC 17))])]
3252 (define_expand "zero_extendqisi2"
3254 [(set (match_operand:SI 0 "register_operand" "")
3255 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3256 (clobber (reg:CC 17))])]
3260 (define_insn "*zero_extendqisi2_and"
3261 [(set (match_operand:SI 0 "register_operand" "=r,?&q")
3262 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,qm")))
3263 (clobber (reg:CC 17))]
3264 "TARGET_ZERO_EXTEND_WITH_AND && !optimize_size"
3266 [(set_attr "type" "alu1")
3267 (set_attr "mode" "SI")])
3269 (define_insn "*zero_extendqisi2_movzbw_and"
3270 [(set (match_operand:SI 0 "register_operand" "=r,r")
3271 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm,0")))
3272 (clobber (reg:CC 17))]
3273 "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
3275 [(set_attr "type" "imovx,alu1")
3276 (set_attr "mode" "SI")])
3278 (define_insn "*zero_extendqisi2_movzbw"
3279 [(set (match_operand:SI 0 "register_operand" "=r")
3280 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3281 "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
3282 "movz{bl|x}\t{%1, %0|%0, %1}"
3283 [(set_attr "type" "imovx")
3284 (set_attr "mode" "SI")])
3286 ;; For the movzbl case strip only the clobber
3288 [(set (match_operand:SI 0 "register_operand" "")
3289 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3290 (clobber (reg:CC 17))]
3292 && (!TARGET_ZERO_EXTEND_WITH_AND || optimize_size)
3293 && (!REG_P (operands[1]) || ANY_QI_REG_P (operands[1]))"
3295 (zero_extend:SI (match_dup 1)))])
3297 ;; When source and destination does not overlap, clear destination
3298 ;; first and then do the movb
3300 [(set (match_operand:SI 0 "register_operand" "")
3301 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))
3302 (clobber (reg:CC 17))]
3304 && ANY_QI_REG_P (operands[0])
3305 && (ANY_QI_REG_P (operands[1]) || GET_CODE (operands[1]) == MEM)
3306 && (TARGET_ZERO_EXTEND_WITH_AND && !optimize_size)
3307 && !reg_overlap_mentioned_p (operands[0], operands[1])"
3308 [(set (match_dup 0) (const_int 0))
3309 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3310 "operands[2] = gen_lowpart (QImode, operands[0]);")
3312 ;; Rest is handled by single and.
3314 [(set (match_operand:SI 0 "register_operand" "")
3315 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
3316 (clobber (reg:CC 17))]
3318 && true_regnum (operands[0]) == true_regnum (operands[1])"
3319 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 255)))
3320 (clobber (reg:CC 17))])]
3323 ;; %%% Kill me once multi-word ops are sane.
3324 (define_expand "zero_extendsidi2"
3325 [(set (match_operand:DI 0 "register_operand" "=r")
3326 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
3330 emit_insn (gen_zero_extendsidi2_32 (operands[0], operands[1]));
3335 (define_insn "zero_extendsidi2_32"
3336 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o")
3337 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r")))
3338 (clobber (reg:CC 17))]
3341 [(set_attr "mode" "SI")])
3343 (define_insn "zero_extendsidi2_rex64"
3344 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
3345 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0")))]
3348 mov\t{%k1, %k0|%k0, %k1}
3350 [(set_attr "type" "imovx,imov")
3351 (set_attr "mode" "SI,DI")])
3354 [(set (match_operand:DI 0 "memory_operand" "")
3355 (zero_extend:DI (match_dup 0)))]
3357 [(set (match_dup 4) (const_int 0))]
3358 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3361 [(set (match_operand:DI 0 "register_operand" "")
3362 (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
3363 (clobber (reg:CC 17))]
3364 "!TARGET_64BIT && reload_completed
3365 && true_regnum (operands[0]) == true_regnum (operands[1])"
3366 [(set (match_dup 4) (const_int 0))]
3367 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3370 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3371 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))
3372 (clobber (reg:CC 17))]
3373 "!TARGET_64BIT && reload_completed"
3374 [(set (match_dup 3) (match_dup 1))
3375 (set (match_dup 4) (const_int 0))]
3376 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3378 (define_insn "zero_extendhidi2"
3379 [(set (match_operand:DI 0 "register_operand" "=r,r")
3380 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
3383 movz{wl|x}\t{%1, %k0|%k0, %1}
3384 movz{wq|x}\t{%1, %0|%0, %1}"
3385 [(set_attr "type" "imovx")
3386 (set_attr "mode" "SI,DI")])
3388 (define_insn "zero_extendqidi2"
3389 [(set (match_operand:DI 0 "register_operand" "=r,r")
3390 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "Q,m")))]
3393 movz{bl|x}\t{%1, %k0|%k0, %1}
3394 movz{bq|x}\t{%1, %0|%0, %1}"
3395 [(set_attr "type" "imovx")
3396 (set_attr "mode" "SI,DI")])
3398 ;; Sign extension instructions
3400 (define_expand "extendsidi2"
3401 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3402 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3403 (clobber (reg:CC 17))
3404 (clobber (match_scratch:SI 2 ""))])]
3409 emit_insn (gen_extendsidi2_rex64 (operands[0], operands[1]));
3414 (define_insn "*extendsidi2_1"
3415 [(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o")
3416 (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r")))
3417 (clobber (reg:CC 17))
3418 (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
3422 (define_insn "extendsidi2_rex64"
3423 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3424 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))]
3428 movs{lq|x}\t{%1,%0|%0, %1}"
3429 [(set_attr "type" "imovx")
3430 (set_attr "mode" "DI")
3431 (set_attr "prefix_0f" "0")
3432 (set_attr "modrm" "0,1")])
3434 (define_insn "extendhidi2"
3435 [(set (match_operand:DI 0 "register_operand" "=r")
3436 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
3438 "movs{wq|x}\t{%1,%0|%0, %1}"
3439 [(set_attr "type" "imovx")
3440 (set_attr "mode" "DI")])
3442 (define_insn "extendqidi2"
3443 [(set (match_operand:DI 0 "register_operand" "=r")
3444 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3446 "movs{bq|x}\t{%1,%0|%0, %1}"
3447 [(set_attr "type" "imovx")
3448 (set_attr "mode" "DI")])
3450 ;; Extend to memory case when source register does die.
3452 [(set (match_operand:DI 0 "memory_operand" "")
3453 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3454 (clobber (reg:CC 17))
3455 (clobber (match_operand:SI 2 "register_operand" ""))]
3457 && dead_or_set_p (insn, operands[1])
3458 && !reg_mentioned_p (operands[1], operands[0]))"
3459 [(set (match_dup 3) (match_dup 1))
3460 (parallel [(set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31)))
3461 (clobber (reg:CC 17))])
3462 (set (match_dup 4) (match_dup 1))]
3463 "split_di (&operands[0], 1, &operands[3], &operands[4]);")
3465 ;; Extend to memory case when source register does not die.
3467 [(set (match_operand:DI 0 "memory_operand" "")
3468 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3469 (clobber (reg:CC 17))
3470 (clobber (match_operand:SI 2 "register_operand" ""))]
3474 split_di (&operands[0], 1, &operands[3], &operands[4]);
3476 emit_move_insn (operands[3], operands[1]);
3478 /* Generate a cltd if possible and doing so it profitable. */
3479 if (true_regnum (operands[1]) == 0
3480 && true_regnum (operands[2]) == 1
3481 && (optimize_size || TARGET_USE_CLTD))
3483 emit_insn (gen_ashrsi3_31 (operands[2], operands[1], GEN_INT (31)));
3487 emit_move_insn (operands[2], operands[1]);
3488 emit_insn (gen_ashrsi3_31 (operands[2], operands[2], GEN_INT (31)));
3490 emit_move_insn (operands[4], operands[2]);
3494 ;; Extend to register case. Optimize case where source and destination
3495 ;; registers match and cases where we can use cltd.
3497 [(set (match_operand:DI 0 "register_operand" "")
3498 (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
3499 (clobber (reg:CC 17))
3500 (clobber (match_scratch:SI 2 ""))]
3504 split_di (&operands[0], 1, &operands[3], &operands[4]);
3506 if (true_regnum (operands[3]) != true_regnum (operands[1]))
3507 emit_move_insn (operands[3], operands[1]);
3509 /* Generate a cltd if possible and doing so it profitable. */
3510 if (true_regnum (operands[3]) == 0
3511 && (optimize_size || TARGET_USE_CLTD))
3513 emit_insn (gen_ashrsi3_31 (operands[4], operands[3], GEN_INT (31)));
3517 if (true_regnum (operands[4]) != true_regnum (operands[1]))
3518 emit_move_insn (operands[4], operands[1]);
3520 emit_insn (gen_ashrsi3_31 (operands[4], operands[4], GEN_INT (31)));
3524 (define_insn "extendhisi2"
3525 [(set (match_operand:SI 0 "register_operand" "=*a,r")
3526 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))]
3529 switch (get_attr_prefix_0f (insn))
3532 return "{cwtl|cwde}";
3534 return "movs{wl|x}\t{%1,%0|%0, %1}";
3537 [(set_attr "type" "imovx")
3538 (set_attr "mode" "SI")
3539 (set (attr "prefix_0f")
3540 ;; movsx is short decodable while cwtl is vector decoded.
3541 (if_then_else (and (eq_attr "cpu" "!k6")
3542 (eq_attr "alternative" "0"))
3544 (const_string "1")))
3546 (if_then_else (eq_attr "prefix_0f" "0")
3548 (const_string "1")))])
3550 (define_insn "*extendhisi2_zext"
3551 [(set (match_operand:DI 0 "register_operand" "=*a,r")
3553 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm"))))]
3556 switch (get_attr_prefix_0f (insn))
3559 return "{cwtl|cwde}";
3561 return "movs{wl|x}\t{%1,%k0|%k0, %1}";
3564 [(set_attr "type" "imovx")
3565 (set_attr "mode" "SI")
3566 (set (attr "prefix_0f")
3567 ;; movsx is short decodable while cwtl is vector decoded.
3568 (if_then_else (and (eq_attr "cpu" "!k6")
3569 (eq_attr "alternative" "0"))
3571 (const_string "1")))
3573 (if_then_else (eq_attr "prefix_0f" "0")
3575 (const_string "1")))])
3577 (define_insn "extendqihi2"
3578 [(set (match_operand:HI 0 "register_operand" "=*a,r")
3579 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "*0,qm")))]
3582 switch (get_attr_prefix_0f (insn))
3585 return "{cbtw|cbw}";
3587 return "movs{bw|x}\t{%1,%0|%0, %1}";
3590 [(set_attr "type" "imovx")
3591 (set_attr "mode" "HI")
3592 (set (attr "prefix_0f")
3593 ;; movsx is short decodable while cwtl is vector decoded.
3594 (if_then_else (and (eq_attr "cpu" "!k6")
3595 (eq_attr "alternative" "0"))
3597 (const_string "1")))
3599 (if_then_else (eq_attr "prefix_0f" "0")
3601 (const_string "1")))])
3603 (define_insn "extendqisi2"
3604 [(set (match_operand:SI 0 "register_operand" "=r")
3605 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
3607 "movs{bl|x}\t{%1,%0|%0, %1}"
3608 [(set_attr "type" "imovx")
3609 (set_attr "mode" "SI")])
3611 (define_insn "*extendqisi2_zext"
3612 [(set (match_operand:DI 0 "register_operand" "=r")
3614 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm"))))]
3616 "movs{bl|x}\t{%1,%k0|%k0, %1}"
3617 [(set_attr "type" "imovx")
3618 (set_attr "mode" "SI")])
3620 ;; Conversions between float and double.
3622 ;; These are all no-ops in the model used for the 80387. So just
3625 ;; %%% Kill these when call knows how to work out a DFmode push earlier.
3626 (define_insn "*dummy_extendsfdf2"
3627 [(set (match_operand:DF 0 "push_operand" "=<")
3628 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fY")))]
3633 [(set (match_operand:DF 0 "push_operand" "")
3634 (float_extend:DF (match_operand:SF 1 "fp_register_operand" "")))]
3636 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
3637 (set (mem:DF (reg:SI 7)) (float_extend:DF (match_dup 1)))])
3640 [(set (match_operand:DF 0 "push_operand" "")
3641 (float_extend:DF (match_operand:SF 1 "fp_register_operand" "")))]
3643 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
3644 (set (mem:DF (reg:DI 7)) (float_extend:DF (match_dup 1)))])
3646 (define_insn "*dummy_extendsfxf2"
3647 [(set (match_operand:XF 0 "push_operand" "=<")
3648 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "f")))]
3653 [(set (match_operand:XF 0 "push_operand" "")
3654 (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
3656 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12)))
3657 (set (mem:XF (reg:SI 7)) (float_extend:XF (match_dup 1)))])
3659 (define_insn "*dummy_extendsftf2"
3660 [(set (match_operand:TF 0 "push_operand" "=<")
3661 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f")))]
3666 [(set (match_operand:TF 0 "push_operand" "")
3667 (float_extend:TF (match_operand:SF 1 "fp_register_operand" "")))]
3669 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
3670 (set (mem:TF (reg:SI 7)) (float_extend:TF (match_dup 1)))])
3673 [(set (match_operand:TF 0 "push_operand" "")
3674 (float_extend:TF (match_operand:SF 1 "fp_register_operand" "")))]
3676 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
3677 (set (mem:DF (reg:DI 7)) (float_extend:TF (match_dup 1)))])
3679 (define_insn "*dummy_extenddfxf2"
3680 [(set (match_operand:XF 0 "push_operand" "=<")
3681 (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "f")))]
3686 [(set (match_operand:XF 0 "push_operand" "")
3687 (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))]
3689 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12)))
3690 (set (mem:DF (reg:SI 7)) (float_extend:XF (match_dup 1)))])
3692 (define_insn "*dummy_extenddftf2"
3693 [(set (match_operand:TF 0 "push_operand" "=<")
3694 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f")))]
3699 [(set (match_operand:TF 0 "push_operand" "")
3700 (float_extend:TF (match_operand:DF 1 "fp_register_operand" "")))]
3702 [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
3703 (set (mem:TF (reg:SI 7)) (float_extend:XF (match_dup 1)))])
3706 [(set (match_operand:TF 0 "push_operand" "")
3707 (float_extend:TF (match_operand:DF 1 "fp_register_operand" "")))]
3709 [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
3710 (set (mem:TF (reg:DI 7)) (float_extend:TF (match_dup 1)))])
3712 (define_expand "extendsfdf2"
3713 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3714 (float_extend:DF (match_operand:SF 1 "general_operand" "")))]
3715 "TARGET_80387 || TARGET_SSE2"
3717 /* ??? Needed for compress_float_constant since all fp constants
3718 are LEGITIMATE_CONSTANT_P. */
3719 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3720 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3721 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3722 operands[1] = force_reg (SFmode, operands[1]);
3725 (define_insn "*extendsfdf2_1"
3726 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,mf#Y,Y#f")
3727 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm#Y,f#Y,mY#f")))]
3728 "(TARGET_80387 || TARGET_SSE2)
3729 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3731 switch (which_alternative)
3734 if (REG_P (operands[1])
3735 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3737 else if (STACK_TOP_P (operands[0]))
3738 return "fld%z1\t%y1";
3743 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3744 return "fstp%z0\t%y0";
3747 return "fst%z0\t%y0";
3749 return "cvtss2sd\t{%1, %0|%0, %1}";
3755 [(set_attr "type" "fmov,fmov,ssecvt")
3756 (set_attr "mode" "SF,XF,DF")])
3758 (define_insn "*extendsfdf2_1_sse_only"
3759 [(set (match_operand:DF 0 "register_operand" "=Y")
3760 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "mY")))]
3761 "!TARGET_80387 && TARGET_SSE2
3762 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3763 "cvtss2sd\t{%1, %0|%0, %1}"
3764 [(set_attr "type" "ssecvt")
3765 (set_attr "mode" "DF")])
3767 (define_expand "extendsfxf2"
3768 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3769 (float_extend:XF (match_operand:SF 1 "general_operand" "")))]
3770 "!TARGET_64BIT && TARGET_80387"
3772 /* ??? Needed for compress_float_constant since all fp constants
3773 are LEGITIMATE_CONSTANT_P. */
3774 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3775 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3776 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3777 operands[1] = force_reg (SFmode, operands[1]);
3780 (define_insn "*extendsfxf2_1"
3781 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3782 (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3783 "!TARGET_64BIT && TARGET_80387
3784 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3786 switch (which_alternative)
3789 if (REG_P (operands[1])
3790 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3792 else if (STACK_TOP_P (operands[0]))
3793 return "fld%z1\t%y1";
3798 /* There is no non-popping store to memory for XFmode. So if
3799 we need one, follow the store with a load. */
3800 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3801 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3803 return "fstp%z0\t%y0";
3809 [(set_attr "type" "fmov")
3810 (set_attr "mode" "SF,XF")])
3812 (define_expand "extendsftf2"
3813 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3814 (float_extend:TF (match_operand:SF 1 "general_operand" "")))]
3817 /* ??? Needed for compress_float_constant since all fp constants
3818 are LEGITIMATE_CONSTANT_P. */
3819 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3820 operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
3821 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3822 operands[1] = force_reg (SFmode, operands[1]);
3825 (define_insn "*extendsftf2_1"
3826 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m")
3827 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
3829 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3831 switch (which_alternative)
3834 if (REG_P (operands[1])
3835 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3837 else if (STACK_TOP_P (operands[0]))
3838 return "fld%z1\t%y1";
3843 /* There is no non-popping store to memory for XFmode. So if
3844 we need one, follow the store with a load. */
3845 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3846 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3848 return "fstp%z0\t%y0";
3854 [(set_attr "type" "fmov")
3855 (set_attr "mode" "SF,XF")])
3857 (define_expand "extenddfxf2"
3858 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3859 (float_extend:XF (match_operand:DF 1 "general_operand" "")))]
3860 "!TARGET_64BIT && TARGET_80387"
3862 /* ??? Needed for compress_float_constant since all fp constants
3863 are LEGITIMATE_CONSTANT_P. */
3864 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3865 operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
3866 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3867 operands[1] = force_reg (DFmode, operands[1]);
3870 (define_insn "*extenddfxf2_1"
3871 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
3872 (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
3873 "!TARGET_64BIT && TARGET_80387
3874 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3876 switch (which_alternative)
3879 if (REG_P (operands[1])
3880 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3882 else if (STACK_TOP_P (operands[0]))
3883 return "fld%z1\t%y1";
3888 /* There is no non-popping store to memory for XFmode. So if
3889 we need one, follow the store with a load. */
3890 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3891 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3893 return "fstp%z0\t%y0";
3899 [(set_attr "type" "fmov")
3900 (set_attr "mode" "DF,XF")])
3902 (define_expand "extenddftf2"
3903 [(set (match_operand:TF 0 "nonimmediate_operand" "")
3904 (float_extend:TF (match_operand:DF 1 "general_operand" "")))]
3907 /* ??? Needed for compress_float_constant since all fp constants
3908 are LEGITIMATE_CONSTANT_P. */
3909 if (GET_CODE (operands[1]) == CONST_DOUBLE)
3910 operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
3911 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
3912 operands[1] = force_reg (DFmode, operands[1]);
3915 (define_insn "*extenddftf2_1"
3916 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m")
3917 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
3919 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
3921 switch (which_alternative)
3924 if (REG_P (operands[1])
3925 && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3927 else if (STACK_TOP_P (operands[0]))
3928 return "fld%z1\t%y1";
3933 /* There is no non-popping store to memory for XFmode. So if
3934 we need one, follow the store with a load. */
3935 if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3936 return "fstp%z0\t%y0\n\tfld%z0\t%y0";
3938 return "fstp%z0\t%y0";
3944 [(set_attr "type" "fmov")
3945 (set_attr "mode" "DF,XF")])
3947 ;; %%% This seems bad bad news.
3948 ;; This cannot output into an f-reg because there is no way to be sure
3949 ;; of truncating in that case. Otherwise this is just like a simple move
3950 ;; insn. So we pretend we can output to a reg in order to get better
3951 ;; register preferencing, but we really use a stack slot.
3953 (define_expand "truncdfsf2"
3954 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
3956 (match_operand:DF 1 "register_operand" "")))
3957 (clobber (match_dup 2))])]
3958 "TARGET_80387 || TARGET_SSE2"
3961 operands[2] = assign_386_stack_local (SFmode, 0);
3964 emit_insn (gen_truncdfsf2_sse_only (operands[0], operands[1]));
3969 (define_insn "*truncdfsf2_1"
3970 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
3972 (match_operand:DF 1 "register_operand" "f,f,f,f")))
3973 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
3974 "TARGET_80387 && !TARGET_SSE2"
3976 switch (which_alternative)
3979 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
3980 return "fstp%z0\t%y0";
3982 return "fst%z0\t%y0";
3987 [(set_attr "type" "fmov,multi,multi,multi")
3988 (set_attr "mode" "SF,SF,SF,SF")])
3990 (define_insn "*truncdfsf2_1_sse"
3991 [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m#fxr,?f#xr,?r#fx,?x#fr,Y#fr")
3993 (match_operand:DF 1 "nonimmediate_operand" "f#Y,f#Y,f#Y,f#Y,mY#f")))
3994 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))]
3995 "TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
3997 switch (which_alternative)
4000 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4001 return "fstp%z0\t%y0";
4003 return "fst%z0\t%y0";
4010 [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
4011 (set_attr "mode" "SF,SF,SF,SF,DF")])
4013 (define_insn "*truncdfsf2_1_sse_nooverlap"
4014 [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m,?f#rx,?r#fx,?x#rf,&Y")
4016 (match_operand:DF 1 "nonimmediate_operand" "f#Y,f#Y,f#Y,f#Y,mY#f")))
4017 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))]
4018 "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
4020 switch (which_alternative)
4023 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4024 return "fstp%z0\t%y0";
4026 return "fst%z0\t%y0";
4033 [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
4034 (set_attr "mode" "SF,SF,SF,SF,DF")])
4036 (define_insn "*truncdfsf2_2"
4037 [(set (match_operand:SF 0 "nonimmediate_operand" "=Y,Y,!m")
4039 (match_operand:DF 1 "nonimmediate_operand" "Y,mY,f#Y")))]
4040 "TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS
4041 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
4043 switch (which_alternative)
4047 return "cvtsd2ss\t{%1, %0|%0, %1}";
4049 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4050 return "fstp%z0\t%y0";
4052 return "fst%z0\t%y0";
4057 [(set_attr "type" "ssecvt,ssecvt,fmov")
4058 (set_attr "athlon_decode" "vector,double,*")
4059 (set_attr "mode" "DF,DF,SF")])
4061 (define_insn "*truncdfsf2_2_nooverlap"
4062 [(set (match_operand:SF 0 "nonimmediate_operand" "=&Y,!m")
4064 (match_operand:DF 1 "nonimmediate_operand" "mY,f")))]
4065 "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS
4066 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
4068 switch (which_alternative)
4073 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4074 return "fstp%z0\t%y0";
4076 return "fst%z0\t%y0";
4081 [(set_attr "type" "ssecvt,fmov")
4082 (set_attr "mode" "DF,SF")])
4084 (define_insn "*truncdfsf2_3"
4085 [(set (match_operand:SF 0 "memory_operand" "=m")
4087 (match_operand:DF 1 "register_operand" "f")))]
4090 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4091 return "fstp%z0\t%y0";
4093 return "fst%z0\t%y0";
4095 [(set_attr "type" "fmov")
4096 (set_attr "mode" "SF")])
4098 (define_insn "truncdfsf2_sse_only"
4099 [(set (match_operand:SF 0 "register_operand" "=Y,Y")
4101 (match_operand:DF 1 "nonimmediate_operand" "Y,mY")))]
4102 "!TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
4103 "cvtsd2ss\t{%1, %0|%0, %1}"
4104 [(set_attr "type" "ssecvt")
4105 (set_attr "athlon_decode" "vector,double")
4106 (set_attr "mode" "DF")])
4108 (define_insn "*truncdfsf2_sse_only_nooverlap"
4109 [(set (match_operand:SF 0 "register_operand" "=&Y")
4111 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
4112 "!TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
4114 [(set_attr "type" "ssecvt")
4115 (set_attr "mode" "DF")])
4118 [(set (match_operand:SF 0 "memory_operand" "")
4120 (match_operand:DF 1 "register_operand" "")))
4121 (clobber (match_operand:SF 2 "memory_operand" ""))]
4123 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
4126 ; Avoid possible reformatting penalty on the destination by first
4129 [(set (match_operand:SF 0 "register_operand" "")
4131 (match_operand:DF 1 "nonimmediate_operand" "")))
4132 (clobber (match_operand 2 "" ""))]
4133 "TARGET_80387 && reload_completed
4134 && SSE_REG_P (operands[0])
4135 && !STACK_REG_P (operands[1])"
4139 if (!TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS)
4140 emit_insn (gen_truncdfsf2_sse_only (operands[0], operands[1]));
4143 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
4144 src = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0);
4145 /* simplify_gen_subreg refuses to widen memory references. */
4146 if (GET_CODE (src) == SUBREG)
4147 alter_subreg (&src);
4148 if (reg_overlap_mentioned_p (operands[0], operands[1]))
4150 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
4151 emit_insn (gen_cvtsd2ss (dest, dest, src));
4157 [(set (match_operand:SF 0 "register_operand" "")
4159 (match_operand:DF 1 "nonimmediate_operand" "")))]
4160 "TARGET_80387 && reload_completed
4161 && SSE_REG_P (operands[0]) && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS"
4165 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
4166 src = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0);
4167 /* simplify_gen_subreg refuses to widen memory references. */
4168 if (GET_CODE (src) == SUBREG)
4169 alter_subreg (&src);
4170 if (reg_overlap_mentioned_p (operands[0], operands[1]))
4172 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
4173 emit_insn (gen_cvtsd2ss (dest, dest, src));
4178 [(set (match_operand:SF 0 "register_operand" "")
4180 (match_operand:DF 1 "fp_register_operand" "")))
4181 (clobber (match_operand:SF 2 "memory_operand" ""))]
4182 "TARGET_80387 && reload_completed"
4183 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
4184 (set (match_dup 0) (match_dup 2))]
4187 (define_expand "truncxfsf2"
4188 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
4190 (match_operand:XF 1 "register_operand" "")))
4191 (clobber (match_dup 2))])]
4192 "!TARGET_64BIT && TARGET_80387"
4193 "operands[2] = assign_386_stack_local (SFmode, 0);")
4195 (define_insn "*truncxfsf2_1"
4196 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
4198 (match_operand:XF 1 "register_operand" "f,f,f,f")))
4199 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
4200 "!TARGET_64BIT && TARGET_80387"
4202 switch (which_alternative)
4205 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4206 return "fstp%z0\t%y0";
4208 return "fst%z0\t%y0";
4213 [(set_attr "type" "fmov,multi,multi,multi")
4214 (set_attr "mode" "SF")])
4216 (define_insn "*truncxfsf2_2"
4217 [(set (match_operand:SF 0 "memory_operand" "=m")
4219 (match_operand:XF 1 "register_operand" "f")))]
4220 "!TARGET_64BIT && TARGET_80387"
4222 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4223 return "fstp%z0\t%y0";
4225 return "fst%z0\t%y0";
4227 [(set_attr "type" "fmov")
4228 (set_attr "mode" "SF")])
4231 [(set (match_operand:SF 0 "memory_operand" "")
4233 (match_operand:XF 1 "register_operand" "")))
4234 (clobber (match_operand:SF 2 "memory_operand" ""))]
4236 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
4240 [(set (match_operand:SF 0 "register_operand" "")
4242 (match_operand:XF 1 "register_operand" "")))
4243 (clobber (match_operand:SF 2 "memory_operand" ""))]
4244 "TARGET_80387 && reload_completed"
4245 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
4246 (set (match_dup 0) (match_dup 2))]
4249 (define_expand "trunctfsf2"
4250 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
4252 (match_operand:TF 1 "register_operand" "")))
4253 (clobber (match_dup 2))])]
4255 "operands[2] = assign_386_stack_local (SFmode, 0);")
4257 (define_insn "*trunctfsf2_1"
4258 [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf")
4260 (match_operand:TF 1 "register_operand" "f,f,f,f")))
4261 (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))]
4264 switch (which_alternative)
4267 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4268 return "fstp%z0\t%y0";
4270 return "fst%z0\t%y0";
4275 [(set_attr "type" "fmov,multi,multi,multi")
4276 (set_attr "mode" "SF")])
4278 (define_insn "*trunctfsf2_2"
4279 [(set (match_operand:SF 0 "memory_operand" "=m")
4281 (match_operand:TF 1 "register_operand" "f")))]
4284 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4285 return "fstp%z0\t%y0";
4287 return "fst%z0\t%y0";
4289 [(set_attr "type" "fmov")
4290 (set_attr "mode" "SF")])
4293 [(set (match_operand:SF 0 "memory_operand" "")
4295 (match_operand:TF 1 "register_operand" "")))
4296 (clobber (match_operand:SF 2 "memory_operand" ""))]
4298 [(set (match_dup 0) (float_truncate:SF (match_dup 1)))]
4302 [(set (match_operand:SF 0 "register_operand" "")
4304 (match_operand:TF 1 "register_operand" "")))
4305 (clobber (match_operand:SF 2 "memory_operand" ""))]
4306 "TARGET_80387 && reload_completed"
4307 [(set (match_dup 2) (float_truncate:SF (match_dup 1)))
4308 (set (match_dup 0) (match_dup 2))]
4312 (define_expand "truncxfdf2"
4313 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
4315 (match_operand:XF 1 "register_operand" "")))
4316 (clobber (match_dup 2))])]
4317 "!TARGET_64BIT && TARGET_80387"
4318 "operands[2] = assign_386_stack_local (DFmode, 0);")
4320 (define_insn "*truncxfdf2_1"
4321 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")
4323 (match_operand:XF 1 "register_operand" "f,f,f,f")))
4324 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))]
4325 "!TARGET_64BIT && TARGET_80387"
4327 switch (which_alternative)
4330 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4331 return "fstp%z0\t%y0";
4333 return "fst%z0\t%y0";
4339 [(set_attr "type" "fmov,multi,multi,multi")
4340 (set_attr "mode" "DF")])
4342 (define_insn "*truncxfdf2_2"
4343 [(set (match_operand:DF 0 "memory_operand" "=m")
4345 (match_operand:XF 1 "register_operand" "f")))]
4346 "!TARGET_64BIT && TARGET_80387"
4348 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4349 return "fstp%z0\t%y0";
4351 return "fst%z0\t%y0";
4353 [(set_attr "type" "fmov")
4354 (set_attr "mode" "DF")])
4357 [(set (match_operand:DF 0 "memory_operand" "")
4359 (match_operand:XF 1 "register_operand" "")))
4360 (clobber (match_operand:DF 2 "memory_operand" ""))]
4362 [(set (match_dup 0) (float_truncate:DF (match_dup 1)))]
4366 [(set (match_operand:DF 0 "register_operand" "")
4368 (match_operand:XF 1 "register_operand" "")))
4369 (clobber (match_operand:DF 2 "memory_operand" ""))]
4370 "TARGET_80387 && reload_completed"
4371 [(set (match_dup 2) (float_truncate:DF (match_dup 1)))
4372 (set (match_dup 0) (match_dup 2))]
4375 (define_expand "trunctfdf2"
4376 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
4378 (match_operand:TF 1 "register_operand" "")))
4379 (clobber (match_dup 2))])]
4381 "operands[2] = assign_386_stack_local (DFmode, 0);")
4383 (define_insn "*trunctfdf2_1"
4384 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf")
4386 (match_operand:TF 1 "register_operand" "f,f,f,f")))
4387 (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))]
4390 switch (which_alternative)
4393 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4394 return "fstp%z0\t%y0";
4396 return "fst%z0\t%y0";
4402 [(set_attr "type" "fmov,multi,multi,multi")
4403 (set_attr "mode" "DF")])
4405 (define_insn "*trunctfdf2_2"
4406 [(set (match_operand:DF 0 "memory_operand" "=m")
4408 (match_operand:TF 1 "register_operand" "f")))]
4411 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
4412 return "fstp%z0\t%y0";
4414 return "fst%z0\t%y0";
4416 [(set_attr "type" "fmov")
4417 (set_attr "mode" "DF")])
4420 [(set (match_operand:DF 0 "memory_operand" "")
4422 (match_operand:TF 1 "register_operand" "")))
4423 (clobber (match_operand:DF 2 "memory_operand" ""))]
4425 [(set (match_dup 0) (float_truncate:DF (match_dup 1)))]
4429 [(set (match_operand:DF 0 "register_operand" "")
4431 (match_operand:TF 1 "register_operand" "")))
4432 (clobber (match_operand:DF 2 "memory_operand" ""))]
4433 "TARGET_80387 && reload_completed"
4434 [(set (match_dup 2) (float_truncate:DF (match_dup 1)))
4435 (set (match_dup 0) (match_dup 2))]
4439 ;; %%% Break up all these bad boys.
4441 ;; Signed conversion to DImode.
4443 (define_expand "fix_truncxfdi2"
4444 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4445 (fix:DI (match_operand:XF 1 "register_operand" "")))]
4446 "!TARGET_64BIT && TARGET_80387"
4449 (define_expand "fix_trunctfdi2"
4450 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4451 (fix:DI (match_operand:TF 1 "register_operand" "")))]
4455 (define_expand "fix_truncdfdi2"
4456 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4457 (fix:DI (match_operand:DF 1 "register_operand" "")))]
4458 "TARGET_80387 || (TARGET_SSE2 && TARGET_64BIT)"
4460 if (TARGET_64BIT && TARGET_SSE2)
4462 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4463 emit_insn (gen_fix_truncdfdi_sse (out, operands[1]));
4464 if (out != operands[0])
4465 emit_move_insn (operands[0], out);
4470 (define_expand "fix_truncsfdi2"
4471 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4472 (fix:DI (match_operand:SF 1 "register_operand" "")))]
4473 "TARGET_80387 || (TARGET_SSE && TARGET_64BIT)"
4475 if (TARGET_SSE && TARGET_64BIT)
4477 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode);
4478 emit_insn (gen_fix_truncsfdi_sse (out, operands[1]));
4479 if (out != operands[0])
4480 emit_move_insn (operands[0], out);
4485 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4486 ;; of the machinery.
4487 (define_insn_and_split "*fix_truncdi_1"
4488 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4489 (fix:DI (match_operand 1 "register_operand" "f,f")))]
4490 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4491 && !reload_completed && !reload_in_progress
4492 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4497 operands[2] = assign_386_stack_local (HImode, 1);
4498 operands[3] = assign_386_stack_local (HImode, 2);
4499 if (memory_operand (operands[0], VOIDmode))
4500 emit_insn (gen_fix_truncdi_memory (operands[0], operands[1],
4501 operands[2], operands[3]));
4504 operands[4] = assign_386_stack_local (DImode, 0);
4505 emit_insn (gen_fix_truncdi_nomemory (operands[0], operands[1],
4506 operands[2], operands[3],
4511 [(set_attr "type" "fistp")])
4513 (define_insn "fix_truncdi_nomemory"
4514 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
4515 (fix:DI (match_operand 1 "register_operand" "f,f")))
4516 (use (match_operand:HI 2 "memory_operand" "m,m"))
4517 (use (match_operand:HI 3 "memory_operand" "m,m"))
4518 (clobber (match_operand:DI 4 "memory_operand" "=m,m"))
4519 (clobber (match_scratch:DF 5 "=&1f,&1f"))]
4520 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4521 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4523 [(set_attr "type" "fistp")])
4525 (define_insn "fix_truncdi_memory"
4526 [(set (match_operand:DI 0 "memory_operand" "=m")
4527 (fix:DI (match_operand 1 "register_operand" "f")))
4528 (use (match_operand:HI 2 "memory_operand" "m"))
4529 (use (match_operand:HI 3 "memory_operand" "m"))
4530 (clobber (match_scratch:DF 4 "=&1f"))]
4531 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4532 && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)"
4533 "* operands[5] = operands[4]; return output_fix_trunc (insn, operands);"
4534 [(set_attr "type" "fistp")])
4537 [(set (match_operand:DI 0 "register_operand" "")
4538 (fix:DI (match_operand 1 "register_operand" "")))
4539 (use (match_operand:HI 2 "memory_operand" ""))
4540 (use (match_operand:HI 3 "memory_operand" ""))
4541 (clobber (match_operand:DI 4 "memory_operand" ""))
4542 (clobber (match_scratch 5 ""))]
4544 [(parallel [(set (match_dup 4) (fix:DI (match_dup 1)))
4547 (clobber (match_dup 5))])
4548 (set (match_dup 0) (match_dup 4))]
4552 [(set (match_operand:DI 0 "memory_operand" "")
4553 (fix:DI (match_operand 1 "register_operand" "")))
4554 (use (match_operand:HI 2 "memory_operand" ""))
4555 (use (match_operand:HI 3 "memory_operand" ""))
4556 (clobber (match_operand:DI 4 "memory_operand" ""))
4557 (clobber (match_scratch 5 ""))]
4559 [(parallel [(set (match_dup 0) (fix:DI (match_dup 1)))
4562 (clobber (match_dup 5))])]
4565 ;; When SSE available, it is always faster to use it!
4566 (define_insn "fix_truncsfdi_sse"
4567 [(set (match_operand:DI 0 "register_operand" "=r,r")
4568 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))]
4569 "TARGET_64BIT && TARGET_SSE"
4570 "cvttss2si{q}\t{%1, %0|%0, %1}"
4571 [(set_attr "type" "sseicvt")
4572 (set_attr "athlon_decode" "double,vector")])
4574 (define_insn "fix_truncdfdi_sse"
4575 [(set (match_operand:DI 0 "register_operand" "=r,r")
4576 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))]
4577 "TARGET_64BIT && TARGET_SSE2"
4578 "cvttsd2si{q}\t{%1, %0|%0, %1}"
4579 [(set_attr "type" "sseicvt,sseicvt")
4580 (set_attr "athlon_decode" "double,vector")])
4582 ;; Signed conversion to SImode.
4584 (define_expand "fix_truncxfsi2"
4585 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4586 (fix:SI (match_operand:XF 1 "register_operand" "")))]
4587 "!TARGET_64BIT && TARGET_80387"
4590 (define_expand "fix_trunctfsi2"
4591 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4592 (fix:SI (match_operand:TF 1 "register_operand" "")))]
4596 (define_expand "fix_truncdfsi2"
4597 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4598 (fix:SI (match_operand:DF 1 "register_operand" "")))]
4599 "TARGET_80387 || TARGET_SSE2"
4603 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4604 emit_insn (gen_fix_truncdfsi_sse (out, operands[1]));
4605 if (out != operands[0])
4606 emit_move_insn (operands[0], out);
4611 (define_expand "fix_truncsfsi2"
4612 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4613 (fix:SI (match_operand:SF 1 "register_operand" "")))]
4614 "TARGET_80387 || TARGET_SSE"
4618 rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
4619 emit_insn (gen_fix_truncsfsi_sse (out, operands[1]));
4620 if (out != operands[0])
4621 emit_move_insn (operands[0], out);
4626 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4627 ;; of the machinery.
4628 (define_insn_and_split "*fix_truncsi_1"
4629 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4630 (fix:SI (match_operand 1 "register_operand" "f,f")))]
4631 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4632 && !reload_completed && !reload_in_progress
4633 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4638 operands[2] = assign_386_stack_local (HImode, 1);
4639 operands[3] = assign_386_stack_local (HImode, 2);
4640 if (memory_operand (operands[0], VOIDmode))
4641 emit_insn (gen_fix_truncsi_memory (operands[0], operands[1],
4642 operands[2], operands[3]));
4645 operands[4] = assign_386_stack_local (SImode, 0);
4646 emit_insn (gen_fix_truncsi_nomemory (operands[0], operands[1],
4647 operands[2], operands[3],
4652 [(set_attr "type" "fistp")])
4654 (define_insn "fix_truncsi_nomemory"
4655 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r")
4656 (fix:SI (match_operand 1 "register_operand" "f,f")))
4657 (use (match_operand:HI 2 "memory_operand" "m,m"))
4658 (use (match_operand:HI 3 "memory_operand" "m,m"))
4659 (clobber (match_operand:SI 4 "memory_operand" "=m,m"))]
4660 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4661 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4663 [(set_attr "type" "fistp")])
4665 (define_insn "fix_truncsi_memory"
4666 [(set (match_operand:SI 0 "memory_operand" "=m")
4667 (fix:SI (match_operand 1 "register_operand" "f")))
4668 (use (match_operand:HI 2 "memory_operand" "m"))
4669 (use (match_operand:HI 3 "memory_operand" "m"))]
4670 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4671 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4672 "* return output_fix_trunc (insn, operands);"
4673 [(set_attr "type" "fistp")])
4675 ;; When SSE available, it is always faster to use it!
4676 (define_insn "fix_truncsfsi_sse"
4677 [(set (match_operand:SI 0 "register_operand" "=r,r")
4678 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))]
4680 "cvttss2si\t{%1, %0|%0, %1}"
4681 [(set_attr "type" "sseicvt")
4682 (set_attr "athlon_decode" "double,vector")])
4684 (define_insn "fix_truncdfsi_sse"
4685 [(set (match_operand:SI 0 "register_operand" "=r,r")
4686 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))]
4688 "cvttsd2si\t{%1, %0|%0, %1}"
4689 [(set_attr "type" "sseicvt")
4690 (set_attr "athlon_decode" "double,vector")])
4693 [(set (match_operand:SI 0 "register_operand" "")
4694 (fix:SI (match_operand 1 "register_operand" "")))
4695 (use (match_operand:HI 2 "memory_operand" ""))
4696 (use (match_operand:HI 3 "memory_operand" ""))
4697 (clobber (match_operand:SI 4 "memory_operand" ""))]
4699 [(parallel [(set (match_dup 4) (fix:SI (match_dup 1)))
4701 (use (match_dup 3))])
4702 (set (match_dup 0) (match_dup 4))]
4706 [(set (match_operand:SI 0 "memory_operand" "")
4707 (fix:SI (match_operand 1 "register_operand" "")))
4708 (use (match_operand:HI 2 "memory_operand" ""))
4709 (use (match_operand:HI 3 "memory_operand" ""))
4710 (clobber (match_operand:SI 4 "memory_operand" ""))]
4712 [(parallel [(set (match_dup 0) (fix:SI (match_dup 1)))
4714 (use (match_dup 3))])]
4717 ;; Signed conversion to HImode.
4719 (define_expand "fix_truncxfhi2"
4720 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4721 (fix:HI (match_operand:XF 1 "register_operand" "")))]
4722 "!TARGET_64BIT && TARGET_80387"
4725 (define_expand "fix_trunctfhi2"
4726 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4727 (fix:HI (match_operand:TF 1 "register_operand" "")))]
4731 (define_expand "fix_truncdfhi2"
4732 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4733 (fix:HI (match_operand:DF 1 "register_operand" "")))]
4734 "TARGET_80387 && !TARGET_SSE2"
4737 (define_expand "fix_truncsfhi2"
4738 [(set (match_operand:HI 0 "nonimmediate_operand" "")
4739 (fix:HI (match_operand:SF 1 "register_operand" "")))]
4740 "TARGET_80387 && !TARGET_SSE"
4743 ;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description
4744 ;; of the machinery.
4745 (define_insn_and_split "*fix_trunchi_1"
4746 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4747 (fix:HI (match_operand 1 "register_operand" "f,f")))]
4748 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4749 && !reload_completed && !reload_in_progress
4750 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4755 operands[2] = assign_386_stack_local (HImode, 1);
4756 operands[3] = assign_386_stack_local (HImode, 2);
4757 if (memory_operand (operands[0], VOIDmode))
4758 emit_insn (gen_fix_trunchi_memory (operands[0], operands[1],
4759 operands[2], operands[3]));
4762 operands[4] = assign_386_stack_local (HImode, 0);
4763 emit_insn (gen_fix_trunchi_nomemory (operands[0], operands[1],
4764 operands[2], operands[3],
4769 [(set_attr "type" "fistp")])
4771 (define_insn "fix_trunchi_nomemory"
4772 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
4773 (fix:HI (match_operand 1 "register_operand" "f,f")))
4774 (use (match_operand:HI 2 "memory_operand" "m,m"))
4775 (use (match_operand:HI 3 "memory_operand" "m,m"))
4776 (clobber (match_operand:HI 4 "memory_operand" "=m,m"))]
4777 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4778 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4780 [(set_attr "type" "fistp")])
4782 (define_insn "fix_trunchi_memory"
4783 [(set (match_operand:HI 0 "memory_operand" "=m")
4784 (fix:HI (match_operand 1 "register_operand" "f")))
4785 (use (match_operand:HI 2 "memory_operand" "m"))
4786 (use (match_operand:HI 3 "memory_operand" "m"))]
4787 "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))
4788 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))"
4789 "* return output_fix_trunc (insn, operands);"
4790 [(set_attr "type" "fistp")])
4793 [(set (match_operand:HI 0 "memory_operand" "")
4794 (fix:HI (match_operand 1 "register_operand" "")))
4795 (use (match_operand:HI 2 "memory_operand" ""))
4796 (use (match_operand:HI 3 "memory_operand" ""))
4797 (clobber (match_operand:HI 4 "memory_operand" ""))]
4799 [(parallel [(set (match_dup 0) (fix:HI (match_dup 1)))
4801 (use (match_dup 3))])]
4805 [(set (match_operand:HI 0 "register_operand" "")
4806 (fix:HI (match_operand 1 "register_operand" "")))
4807 (use (match_operand:HI 2 "memory_operand" ""))
4808 (use (match_operand:HI 3 "memory_operand" ""))
4809 (clobber (match_operand:HI 4 "memory_operand" ""))]
4811 [(parallel [(set (match_dup 4) (fix:HI (match_dup 1)))
4814 (clobber (match_dup 4))])
4815 (set (match_dup 0) (match_dup 4))]
4819 (define_insn "x86_fnstcw_1"
4820 [(set (match_operand:HI 0 "memory_operand" "=m")
4821 (unspec:HI [(reg:HI 18)] UNSPEC_FSTCW))]
4824 [(set_attr "length" "2")
4825 (set_attr "mode" "HI")
4826 (set_attr "unit" "i387")
4827 (set_attr "ppro_uops" "few")])
4829 (define_insn "x86_fldcw_1"
4831 (unspec:HI [(match_operand:HI 0 "memory_operand" "m")] UNSPEC_FLDCW))]
4834 [(set_attr "length" "2")
4835 (set_attr "mode" "HI")
4836 (set_attr "unit" "i387")
4837 (set_attr "athlon_decode" "vector")
4838 (set_attr "ppro_uops" "few")])
4840 ;; Conversion between fixed point and floating point.
4842 ;; Even though we only accept memory inputs, the backend _really_
4843 ;; wants to be able to do this between registers.
4845 (define_insn "floathisf2"
4846 [(set (match_operand:SF 0 "register_operand" "=f,f")
4847 (float:SF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
4848 "TARGET_80387 && !TARGET_SSE"
4852 [(set_attr "type" "fmov,multi")
4853 (set_attr "mode" "SF")
4854 (set_attr "fp_int_src" "true")])
4856 (define_expand "floatsisf2"
4857 [(set (match_operand:SF 0 "register_operand" "")
4858 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
4859 "TARGET_SSE || TARGET_80387"
4862 (define_insn "*floatsisf2_i387"
4863 [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f")
4864 (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))]
4865 "TARGET_80387 && (!TARGET_SSE || TARGET_MIX_SSE_I387)"
4869 cvtsi2ss\t{%1, %0|%0, %1}
4870 cvtsi2ss\t{%1, %0|%0, %1}"
4871 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4872 (set_attr "mode" "SF")
4873 (set_attr "athlon_decode" "*,*,vector,double")
4874 (set_attr "fp_int_src" "true")])
4876 (define_insn "*floatsisf2_sse"
4877 [(set (match_operand:SF 0 "register_operand" "=x,x")
4878 (float:SF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))]
4880 "cvtsi2ss\t{%1, %0|%0, %1}"
4881 [(set_attr "type" "sseicvt")
4882 (set_attr "mode" "SF")
4883 (set_attr "athlon_decode" "vector,double")
4884 (set_attr "fp_int_src" "true")])
4886 ; Avoid possible reformatting penalty on the destination by first
4889 [(set (match_operand:SF 0 "register_operand" "")
4890 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
4891 "TARGET_80387 && reload_completed && TARGET_SSE_PARTIAL_REGS
4892 && SSE_REG_P (operands[0])"
4896 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
4897 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
4898 emit_insn (gen_cvtsi2ss (dest, dest, operands[1]));
4902 (define_expand "floatdisf2"
4903 [(set (match_operand:SF 0 "register_operand" "")
4904 (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
4905 "(TARGET_64BIT && TARGET_SSE) || TARGET_80387"
4908 (define_insn "*floatdisf2_i387_only"
4909 [(set (match_operand:SF 0 "register_operand" "=f,?f")
4910 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
4911 "TARGET_80387 && (!TARGET_SSE || !TARGET_64BIT || TARGET_MIX_SSE_I387)"
4915 [(set_attr "type" "fmov,multi")
4916 (set_attr "mode" "SF")
4917 (set_attr "fp_int_src" "true")])
4919 (define_insn "*floatdisf2_i387"
4920 [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f")
4921 (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))]
4922 "TARGET_64BIT && TARGET_80387 && (!TARGET_SSE || TARGET_MIX_SSE_I387)"
4926 cvtsi2ss{q}\t{%1, %0|%0, %1}
4927 cvtsi2ss{q}\t{%1, %0|%0, %1}"
4928 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4929 (set_attr "mode" "SF")
4930 (set_attr "athlon_decode" "*,*,vector,double")
4931 (set_attr "fp_int_src" "true")])
4933 (define_insn "*floatdisf2_sse"
4934 [(set (match_operand:SF 0 "register_operand" "=x,x")
4935 (float:SF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))]
4936 "TARGET_64BIT && TARGET_SSE"
4937 "cvtsi2ss{q}\t{%1, %0|%0, %1}"
4938 [(set_attr "type" "sseicvt")
4939 (set_attr "mode" "SF")
4940 (set_attr "athlon_decode" "vector,double")
4941 (set_attr "fp_int_src" "true")])
4943 ; Avoid possible reformatting penalty on the destination by first
4946 [(set (match_operand:SF 0 "register_operand" "")
4947 (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
4948 "TARGET_80387 && reload_completed && TARGET_SSE_PARTIAL_REGS
4949 && SSE_REG_P (operands[0])"
4953 dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0);
4954 emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode)));
4955 emit_insn (gen_cvtsi2ssq (dest, dest, operands[1]));
4959 (define_insn "floathidf2"
4960 [(set (match_operand:DF 0 "register_operand" "=f,f")
4961 (float:DF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
4962 "TARGET_80387 && !TARGET_SSE2"
4966 [(set_attr "type" "fmov,multi")
4967 (set_attr "mode" "DF")
4968 (set_attr "fp_int_src" "true")])
4970 (define_expand "floatsidf2"
4971 [(set (match_operand:DF 0 "register_operand" "")
4972 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))]
4973 "TARGET_80387 || TARGET_SSE2"
4976 (define_insn "*floatsidf2_i387"
4977 [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f")
4978 (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))]
4979 "TARGET_80387 && (!TARGET_SSE2 || TARGET_MIX_SSE_I387)"
4983 cvtsi2sd\t{%1, %0|%0, %1}
4984 cvtsi2sd\t{%1, %0|%0, %1}"
4985 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
4986 (set_attr "mode" "DF")
4987 (set_attr "athlon_decode" "*,*,double,direct")
4988 (set_attr "fp_int_src" "true")])
4990 (define_insn "*floatsidf2_sse"
4991 [(set (match_operand:DF 0 "register_operand" "=Y,Y")
4992 (float:DF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))]
4994 "cvtsi2sd\t{%1, %0|%0, %1}"
4995 [(set_attr "type" "sseicvt")
4996 (set_attr "mode" "DF")
4997 (set_attr "athlon_decode" "double,direct")
4998 (set_attr "fp_int_src" "true")])
5000 (define_expand "floatdidf2"
5001 [(set (match_operand:DF 0 "register_operand" "")
5002 (float:DF (match_operand:DI 1 "nonimmediate_operand" "")))]
5003 "(TARGET_64BIT && TARGET_SSE2) || TARGET_80387"
5006 (define_insn "*floatdidf2_i387_only"
5007 [(set (match_operand:DF 0 "register_operand" "=f,?f")
5008 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
5009 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_64BIT)"
5013 [(set_attr "type" "fmov,multi")
5014 (set_attr "mode" "DF")
5015 (set_attr "fp_int_src" "true")])
5017 (define_insn "*floatdidf2_i387"
5018 [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f")
5019 (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))]
5020 "TARGET_64BIT && TARGET_80387 && (!TARGET_SSE2 || TARGET_MIX_SSE_I387)"
5024 cvtsi2sd{q}\t{%1, %0|%0, %1}
5025 cvtsi2sd{q}\t{%1, %0|%0, %1}"
5026 [(set_attr "type" "fmov,multi,sseicvt,sseicvt")
5027 (set_attr "mode" "DF")
5028 (set_attr "athlon_decode" "*,*,double,direct")
5029 (set_attr "fp_int_src" "true")])
5031 (define_insn "*floatdidf2_sse"
5032 [(set (match_operand:DF 0 "register_operand" "=Y,Y")
5033 (float:DF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))]
5035 "cvtsi2sd{q}\t{%1, %0|%0, %1}"
5036 [(set_attr "type" "sseicvt")
5037 (set_attr "mode" "DF")
5038 (set_attr "athlon_decode" "double,direct")
5039 (set_attr "fp_int_src" "true")])
5041 (define_insn "floathixf2"
5042 [(set (match_operand:XF 0 "register_operand" "=f,f")
5043 (float:XF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
5044 "!TARGET_64BIT && TARGET_80387"
5048 [(set_attr "type" "fmov,multi")
5049 (set_attr "mode" "XF")
5050 (set_attr "fp_int_src" "true")])
5052 (define_insn "floathitf2"
5053 [(set (match_operand:TF 0 "register_operand" "=f,f")
5054 (float:TF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
5059 [(set_attr "type" "fmov,multi")
5060 (set_attr "mode" "XF")
5061 (set_attr "fp_int_src" "true")])
5063 (define_insn "floatsixf2"
5064 [(set (match_operand:XF 0 "register_operand" "=f,f")
5065 (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,r")))]
5066 "!TARGET_64BIT && TARGET_80387"
5070 [(set_attr "type" "fmov,multi")
5071 (set_attr "mode" "XF")
5072 (set_attr "fp_int_src" "true")])
5074 (define_insn "floatsitf2"
5075 [(set (match_operand:TF 0 "register_operand" "=f,f")
5076 (float:TF (match_operand:SI 1 "nonimmediate_operand" "m,r")))]
5081 [(set_attr "type" "fmov,multi")
5082 (set_attr "mode" "XF")
5083 (set_attr "fp_int_src" "true")])
5085 (define_insn "floatdixf2"
5086 [(set (match_operand:XF 0 "register_operand" "=f,f")
5087 (float:XF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
5088 "!TARGET_64BIT && TARGET_80387"
5092 [(set_attr "type" "fmov,multi")
5093 (set_attr "mode" "XF")
5094 (set_attr "fp_int_src" "true")])
5096 (define_insn "floatditf2"
5097 [(set (match_operand:TF 0 "register_operand" "=f,f")
5098 (float:TF (match_operand:DI 1 "nonimmediate_operand" "m,r")))]
5103 [(set_attr "type" "fmov,multi")
5104 (set_attr "mode" "XF")
5105 (set_attr "fp_int_src" "true")])
5107 ;; %%% Kill these when reload knows how to do it.
5109 [(set (match_operand 0 "fp_register_operand" "")
5110 (float (match_operand 1 "register_operand" "")))]
5111 "reload_completed && FLOAT_MODE_P (GET_MODE (operands[0]))"
5114 operands[2] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
5115 operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);
5116 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[2]));
5117 ix86_free_from_memory (GET_MODE (operands[1]));
5121 (define_expand "floatunssisf2"
5122 [(use (match_operand:SF 0 "register_operand" ""))
5123 (use (match_operand:SI 1 "register_operand" ""))]
5124 "TARGET_SSE && TARGET_SSE_MATH && !TARGET_64BIT"
5125 "x86_emit_floatuns (operands); DONE;")
5127 (define_expand "floatunsdisf2"
5128 [(use (match_operand:SF 0 "register_operand" ""))
5129 (use (match_operand:DI 1 "register_operand" ""))]
5130 "TARGET_SSE && TARGET_SSE_MATH && TARGET_64BIT"
5131 "x86_emit_floatuns (operands); DONE;")
5133 (define_expand "floatunsdidf2"
5134 [(use (match_operand:DF 0 "register_operand" ""))
5135 (use (match_operand:DI 1 "register_operand" ""))]
5136 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_64BIT"
5137 "x86_emit_floatuns (operands); DONE;")
5141 ;; %%% splits for addsidi3
5142 ; [(set (match_operand:DI 0 "nonimmediate_operand" "")
5143 ; (plus:DI (match_operand:DI 1 "general_operand" "")
5144 ; (zero_extend:DI (match_operand:SI 2 "general_operand" ""))))]
5146 (define_expand "adddi3"
5147 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5148 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
5149 (match_operand:DI 2 "x86_64_general_operand" "")))
5150 (clobber (reg:CC 17))]
5152 "ix86_expand_binary_operator (PLUS, DImode, operands); DONE;")
5154 (define_insn "*adddi3_1"
5155 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
5156 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5157 (match_operand:DI 2 "general_operand" "roiF,riF")))
5158 (clobber (reg:CC 17))]
5159 "!TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5163 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5164 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
5165 (match_operand:DI 2 "general_operand" "")))
5166 (clobber (reg:CC 17))]
5167 "!TARGET_64BIT && reload_completed"
5168 [(parallel [(set (reg:CC 17) (unspec:CC [(match_dup 1) (match_dup 2)]
5170 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
5171 (parallel [(set (match_dup 3)
5172 (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
5175 (clobber (reg:CC 17))])]
5176 "split_di (operands+0, 1, operands+0, operands+3);
5177 split_di (operands+1, 1, operands+1, operands+4);
5178 split_di (operands+2, 1, operands+2, operands+5);")
5180 (define_insn "adddi3_carry_rex64"
5181 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
5182 (plus:DI (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "")
5183 (match_operand:DI 1 "nonimmediate_operand" "%0,0"))
5184 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
5185 (clobber (reg:CC 17))]
5186 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5187 "adc{q}\t{%2, %0|%0, %2}"
5188 [(set_attr "type" "alu")
5189 (set_attr "pent_pair" "pu")
5190 (set_attr "mode" "DI")
5191 (set_attr "ppro_uops" "few")])
5193 (define_insn "*adddi3_cc_rex64"
5195 (unspec:CC [(match_operand:DI 1 "nonimmediate_operand" "%0,0")
5196 (match_operand:DI 2 "x86_64_general_operand" "re,rm")]
5198 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
5199 (plus:DI (match_dup 1) (match_dup 2)))]
5200 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5201 "add{q}\t{%2, %0|%0, %2}"
5202 [(set_attr "type" "alu")
5203 (set_attr "mode" "DI")])
5205 (define_insn "addqi3_carry"
5206 [(set (match_operand:QI 0 "nonimmediate_operand" "=rm,r")
5207 (plus:QI (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "")
5208 (match_operand:QI 1 "nonimmediate_operand" "%0,0"))
5209 (match_operand:QI 2 "general_operand" "ri,rm")))
5210 (clobber (reg:CC 17))]
5211 "ix86_binary_operator_ok (PLUS, QImode, operands)"
5212 "adc{b}\t{%2, %0|%0, %2}"
5213 [(set_attr "type" "alu")
5214 (set_attr "pent_pair" "pu")
5215 (set_attr "mode" "QI")
5216 (set_attr "ppro_uops" "few")])
5218 (define_insn "addhi3_carry"
5219 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
5220 (plus:HI (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "")
5221 (match_operand:HI 1 "nonimmediate_operand" "%0,0"))
5222 (match_operand:HI 2 "general_operand" "ri,rm")))
5223 (clobber (reg:CC 17))]
5224 "ix86_binary_operator_ok (PLUS, HImode, operands)"
5225 "adc{w}\t{%2, %0|%0, %2}"
5226 [(set_attr "type" "alu")
5227 (set_attr "pent_pair" "pu")
5228 (set_attr "mode" "HI")
5229 (set_attr "ppro_uops" "few")])
5231 (define_insn "addsi3_carry"
5232 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
5233 (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
5234 (match_operand:SI 1 "nonimmediate_operand" "%0,0"))
5235 (match_operand:SI 2 "general_operand" "ri,rm")))
5236 (clobber (reg:CC 17))]
5237 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5238 "adc{l}\t{%2, %0|%0, %2}"
5239 [(set_attr "type" "alu")
5240 (set_attr "pent_pair" "pu")
5241 (set_attr "mode" "SI")
5242 (set_attr "ppro_uops" "few")])
5244 (define_insn "*addsi3_carry_zext"
5245 [(set (match_operand:DI 0 "register_operand" "=r")
5247 (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
5248 (match_operand:SI 1 "nonimmediate_operand" "%0"))
5249 (match_operand:SI 2 "general_operand" "rim"))))
5250 (clobber (reg:CC 17))]
5251 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5252 "adc{l}\t{%2, %k0|%k0, %2}"
5253 [(set_attr "type" "alu")
5254 (set_attr "pent_pair" "pu")
5255 (set_attr "mode" "SI")
5256 (set_attr "ppro_uops" "few")])
5258 (define_insn "*addsi3_cc"
5260 (unspec:CC [(match_operand:SI 1 "nonimmediate_operand" "%0,0")
5261 (match_operand:SI 2 "general_operand" "ri,rm")]
5263 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
5264 (plus:SI (match_dup 1) (match_dup 2)))]
5265 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5266 "add{l}\t{%2, %0|%0, %2}"
5267 [(set_attr "type" "alu")
5268 (set_attr "mode" "SI")])
5270 (define_insn "addqi3_cc"
5272 (unspec:CC [(match_operand:QI 1 "nonimmediate_operand" "%0,0")
5273 (match_operand:QI 2 "general_operand" "qi,qm")]
5275 (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
5276 (plus:QI (match_dup 1) (match_dup 2)))]
5277 "ix86_binary_operator_ok (PLUS, QImode, operands)"
5278 "add{b}\t{%2, %0|%0, %2}"
5279 [(set_attr "type" "alu")
5280 (set_attr "mode" "QI")])
5282 (define_expand "addsi3"
5283 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
5284 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5285 (match_operand:SI 2 "general_operand" "")))
5286 (clobber (reg:CC 17))])]
5288 "ix86_expand_binary_operator (PLUS, SImode, operands); DONE;")
5290 (define_insn "*lea_1"
5291 [(set (match_operand:SI 0 "register_operand" "=r")
5292 (match_operand:SI 1 "address_operand" "p"))]
5294 "lea{l}\t{%a1, %0|%0, %a1}"
5295 [(set_attr "type" "lea")
5296 (set_attr "mode" "SI")])
5298 (define_insn "*lea_1_rex64"
5299 [(set (match_operand:SI 0 "register_operand" "=r")
5300 (subreg:SI (match_operand:DI 1 "address_operand" "p") 0))]
5302 "lea{l}\t{%a1, %0|%0, %a1}"
5303 [(set_attr "type" "lea")
5304 (set_attr "mode" "SI")])
5306 (define_insn "*lea_1_zext"
5307 [(set (match_operand:DI 0 "register_operand" "=r")
5308 (zero_extend:DI (subreg:SI (match_operand:DI 1 "address_operand" "p") 0)))]
5310 "lea{l}\t{%a1, %k0|%k0, %a1}"
5311 [(set_attr "type" "lea")
5312 (set_attr "mode" "SI")])
5314 (define_insn "*lea_2_rex64"
5315 [(set (match_operand:DI 0 "register_operand" "=r")
5316 (match_operand:DI 1 "address_operand" "p"))]
5318 "lea{q}\t{%a1, %0|%0, %a1}"
5319 [(set_attr "type" "lea")
5320 (set_attr "mode" "DI")])
5322 ;; The lea patterns for non-Pmodes needs to be matched by several
5323 ;; insns converted to real lea by splitters.
5325 (define_insn_and_split "*lea_general_1"
5326 [(set (match_operand 0 "register_operand" "=r")
5327 (plus (plus (match_operand 1 "index_register_operand" "r")
5328 (match_operand 2 "register_operand" "r"))
5329 (match_operand 3 "immediate_operand" "i")))]
5330 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5331 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5332 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5333 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5334 && GET_MODE (operands[0]) == GET_MODE (operands[2])
5335 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
5336 || GET_MODE (operands[3]) == VOIDmode)"
5338 "&& reload_completed"
5342 operands[0] = gen_lowpart (SImode, operands[0]);
5343 operands[1] = gen_lowpart (Pmode, operands[1]);
5344 operands[2] = gen_lowpart (Pmode, operands[2]);
5345 operands[3] = gen_lowpart (Pmode, operands[3]);
5346 pat = gen_rtx_PLUS (Pmode, gen_rtx_PLUS (Pmode, operands[1], operands[2]),
5348 if (Pmode != SImode)
5349 pat = gen_rtx_SUBREG (SImode, pat, 0);
5350 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5353 [(set_attr "type" "lea")
5354 (set_attr "mode" "SI")])
5356 (define_insn_and_split "*lea_general_1_zext"
5357 [(set (match_operand:DI 0 "register_operand" "=r")
5359 (plus:SI (plus:SI (match_operand:SI 1 "index_register_operand" "r")
5360 (match_operand:SI 2 "register_operand" "r"))
5361 (match_operand:SI 3 "immediate_operand" "i"))))]
5364 "&& reload_completed"
5366 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (match_dup 1)
5368 (match_dup 3)) 0)))]
5370 operands[1] = gen_lowpart (Pmode, operands[1]);
5371 operands[2] = gen_lowpart (Pmode, operands[2]);
5372 operands[3] = gen_lowpart (Pmode, operands[3]);
5374 [(set_attr "type" "lea")
5375 (set_attr "mode" "SI")])
5377 (define_insn_and_split "*lea_general_2"
5378 [(set (match_operand 0 "register_operand" "=r")
5379 (plus (mult (match_operand 1 "index_register_operand" "r")
5380 (match_operand 2 "const248_operand" "i"))
5381 (match_operand 3 "nonmemory_operand" "ri")))]
5382 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5383 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5384 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5385 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5386 && (GET_MODE (operands[0]) == GET_MODE (operands[3])
5387 || GET_MODE (operands[3]) == VOIDmode)"
5389 "&& reload_completed"
5393 operands[0] = gen_lowpart (SImode, operands[0]);
5394 operands[1] = gen_lowpart (Pmode, operands[1]);
5395 operands[3] = gen_lowpart (Pmode, operands[3]);
5396 pat = gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1], operands[2]),
5398 if (Pmode != SImode)
5399 pat = gen_rtx_SUBREG (SImode, pat, 0);
5400 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5403 [(set_attr "type" "lea")
5404 (set_attr "mode" "SI")])
5406 (define_insn_and_split "*lea_general_2_zext"
5407 [(set (match_operand:DI 0 "register_operand" "=r")
5409 (plus:SI (mult:SI (match_operand:SI 1 "index_register_operand" "r")
5410 (match_operand:SI 2 "const248_operand" "n"))
5411 (match_operand:SI 3 "nonmemory_operand" "ri"))))]
5414 "&& reload_completed"
5416 (zero_extend:DI (subreg:SI (plus:DI (mult:DI (match_dup 1)
5418 (match_dup 3)) 0)))]
5420 operands[1] = gen_lowpart (Pmode, operands[1]);
5421 operands[3] = gen_lowpart (Pmode, operands[3]);
5423 [(set_attr "type" "lea")
5424 (set_attr "mode" "SI")])
5426 (define_insn_and_split "*lea_general_3"
5427 [(set (match_operand 0 "register_operand" "=r")
5428 (plus (plus (mult (match_operand 1 "index_register_operand" "r")
5429 (match_operand 2 "const248_operand" "i"))
5430 (match_operand 3 "register_operand" "r"))
5431 (match_operand 4 "immediate_operand" "i")))]
5432 "(GET_MODE (operands[0]) == QImode || GET_MODE (operands[0]) == HImode
5433 || (TARGET_64BIT && GET_MODE (operands[0]) == SImode))
5434 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
5435 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5436 && GET_MODE (operands[0]) == GET_MODE (operands[3])"
5438 "&& reload_completed"
5442 operands[0] = gen_lowpart (SImode, operands[0]);
5443 operands[1] = gen_lowpart (Pmode, operands[1]);
5444 operands[3] = gen_lowpart (Pmode, operands[3]);
5445 operands[4] = gen_lowpart (Pmode, operands[4]);
5446 pat = gen_rtx_PLUS (Pmode,
5447 gen_rtx_PLUS (Pmode, gen_rtx_MULT (Pmode, operands[1],
5451 if (Pmode != SImode)
5452 pat = gen_rtx_SUBREG (SImode, pat, 0);
5453 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5456 [(set_attr "type" "lea")
5457 (set_attr "mode" "SI")])
5459 (define_insn_and_split "*lea_general_3_zext"
5460 [(set (match_operand:DI 0 "register_operand" "=r")
5462 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "index_register_operand" "r")
5463 (match_operand:SI 2 "const248_operand" "n"))
5464 (match_operand:SI 3 "register_operand" "r"))
5465 (match_operand:SI 4 "immediate_operand" "i"))))]
5468 "&& reload_completed"
5470 (zero_extend:DI (subreg:SI (plus:DI (plus:DI (mult:DI (match_dup 1)
5473 (match_dup 4)) 0)))]
5475 operands[1] = gen_lowpart (Pmode, operands[1]);
5476 operands[3] = gen_lowpart (Pmode, operands[3]);
5477 operands[4] = gen_lowpart (Pmode, operands[4]);
5479 [(set_attr "type" "lea")
5480 (set_attr "mode" "SI")])
5482 (define_insn "*adddi_1_rex64"
5483 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r")
5484 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,r")
5485 (match_operand:DI 2 "x86_64_general_operand" "rme,re,re")))
5486 (clobber (reg:CC 17))]
5487 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
5489 switch (get_attr_type (insn))
5492 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5493 return "lea{q}\t{%a2, %0|%0, %a2}";
5496 if (! rtx_equal_p (operands[0], operands[1]))
5498 if (operands[2] == const1_rtx)
5499 return "inc{q}\t%0";
5500 else if (operands[2] == constm1_rtx)
5501 return "dec{q}\t%0";
5506 if (! rtx_equal_p (operands[0], operands[1]))
5509 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5510 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5511 if (GET_CODE (operands[2]) == CONST_INT
5512 /* Avoid overflows. */
5513 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5514 && (INTVAL (operands[2]) == 128
5515 || (INTVAL (operands[2]) < 0
5516 && INTVAL (operands[2]) != -128)))
5518 operands[2] = GEN_INT (-INTVAL (operands[2]));
5519 return "sub{q}\t{%2, %0|%0, %2}";
5521 return "add{q}\t{%2, %0|%0, %2}";
5525 (cond [(eq_attr "alternative" "2")
5526 (const_string "lea")
5527 ; Current assemblers are broken and do not allow @GOTOFF in
5528 ; ought but a memory context.
5529 (match_operand:DI 2 "pic_symbolic_operand" "")
5530 (const_string "lea")
5531 (match_operand:DI 2 "incdec_operand" "")
5532 (const_string "incdec")
5534 (const_string "alu")))
5535 (set_attr "mode" "DI")])
5537 ;; Convert lea to the lea pattern to avoid flags dependency.
5539 [(set (match_operand:DI 0 "register_operand" "")
5540 (plus:DI (match_operand:DI 1 "register_operand" "")
5541 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
5542 (clobber (reg:CC 17))]
5543 "TARGET_64BIT && reload_completed
5544 && true_regnum (operands[0]) != true_regnum (operands[1])"
5546 (plus:DI (match_dup 1)
5550 (define_insn "*adddi_2_rex64"
5553 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5554 (match_operand:DI 2 "x86_64_general_operand" "rme,re"))
5556 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
5557 (plus:DI (match_dup 1) (match_dup 2)))]
5558 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5559 && ix86_binary_operator_ok (PLUS, DImode, operands)
5560 /* Current assemblers are broken and do not allow @GOTOFF in
5561 ought but a memory context. */
5562 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5564 switch (get_attr_type (insn))
5567 if (! rtx_equal_p (operands[0], operands[1]))
5569 if (operands[2] == const1_rtx)
5570 return "inc{q}\t%0";
5571 else if (operands[2] == constm1_rtx)
5572 return "dec{q}\t%0";
5577 if (! rtx_equal_p (operands[0], operands[1]))
5579 /* ???? We ought to handle there the 32bit case too
5580 - do we need new constraint? */
5581 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5582 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5583 if (GET_CODE (operands[2]) == CONST_INT
5584 /* Avoid overflows. */
5585 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5586 && (INTVAL (operands[2]) == 128
5587 || (INTVAL (operands[2]) < 0
5588 && INTVAL (operands[2]) != -128)))
5590 operands[2] = GEN_INT (-INTVAL (operands[2]));
5591 return "sub{q}\t{%2, %0|%0, %2}";
5593 return "add{q}\t{%2, %0|%0, %2}";
5597 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5598 (const_string "incdec")
5599 (const_string "alu")))
5600 (set_attr "mode" "DI")])
5602 (define_insn "*adddi_3_rex64"
5604 (compare (neg:DI (match_operand:DI 2 "x86_64_general_operand" "rme"))
5605 (match_operand:DI 1 "x86_64_general_operand" "%0")))
5606 (clobber (match_scratch:DI 0 "=r"))]
5608 && ix86_match_ccmode (insn, CCZmode)
5609 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5610 /* Current assemblers are broken and do not allow @GOTOFF in
5611 ought but a memory context. */
5612 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5614 switch (get_attr_type (insn))
5617 if (! rtx_equal_p (operands[0], operands[1]))
5619 if (operands[2] == const1_rtx)
5620 return "inc{q}\t%0";
5621 else if (operands[2] == constm1_rtx)
5622 return "dec{q}\t%0";
5627 if (! rtx_equal_p (operands[0], operands[1]))
5629 /* ???? We ought to handle there the 32bit case too
5630 - do we need new constraint? */
5631 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5632 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5633 if (GET_CODE (operands[2]) == CONST_INT
5634 /* Avoid overflows. */
5635 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5636 && (INTVAL (operands[2]) == 128
5637 || (INTVAL (operands[2]) < 0
5638 && INTVAL (operands[2]) != -128)))
5640 operands[2] = GEN_INT (-INTVAL (operands[2]));
5641 return "sub{q}\t{%2, %0|%0, %2}";
5643 return "add{q}\t{%2, %0|%0, %2}";
5647 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5648 (const_string "incdec")
5649 (const_string "alu")))
5650 (set_attr "mode" "DI")])
5652 ; For comparisons against 1, -1 and 128, we may generate better code
5653 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
5654 ; is matched then. We can't accept general immediate, because for
5655 ; case of overflows, the result is messed up.
5656 ; This pattern also don't hold of 0x8000000000000000, since the value overflows
5658 ; Also carry flag is reversed compared to cmp, so this conversion is valid
5659 ; only for comparisons not depending on it.
5660 (define_insn "*adddi_4_rex64"
5662 (compare (match_operand:DI 1 "nonimmediate_operand" "0")
5663 (match_operand:DI 2 "x86_64_immediate_operand" "e")))
5664 (clobber (match_scratch:DI 0 "=rm"))]
5666 && ix86_match_ccmode (insn, CCGCmode)"
5668 switch (get_attr_type (insn))
5671 if (operands[2] == constm1_rtx)
5672 return "inc{q}\t%0";
5673 else if (operands[2] == const1_rtx)
5674 return "dec{q}\t%0";
5679 if (! rtx_equal_p (operands[0], operands[1]))
5681 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5682 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5683 if ((INTVAL (operands[2]) == -128
5684 || (INTVAL (operands[2]) > 0
5685 && INTVAL (operands[2]) != 128))
5686 /* Avoid overflows. */
5687 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))))
5688 return "sub{q}\t{%2, %0|%0, %2}";
5689 operands[2] = GEN_INT (-INTVAL (operands[2]));
5690 return "add{q}\t{%2, %0|%0, %2}";
5694 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5695 (const_string "incdec")
5696 (const_string "alu")))
5697 (set_attr "mode" "DI")])
5699 (define_insn "*adddi_5_rex64"
5702 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5703 (match_operand:DI 2 "x86_64_general_operand" "rme"))
5705 (clobber (match_scratch:DI 0 "=r"))]
5707 && ix86_match_ccmode (insn, CCGOCmode)
5708 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5709 /* Current assemblers are broken and do not allow @GOTOFF in
5710 ought but a memory context. */
5711 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5713 switch (get_attr_type (insn))
5716 if (! rtx_equal_p (operands[0], operands[1]))
5718 if (operands[2] == const1_rtx)
5719 return "inc{q}\t%0";
5720 else if (operands[2] == constm1_rtx)
5721 return "dec{q}\t%0";
5726 if (! rtx_equal_p (operands[0], operands[1]))
5728 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5729 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5730 if (GET_CODE (operands[2]) == CONST_INT
5731 /* Avoid overflows. */
5732 && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1)))
5733 && (INTVAL (operands[2]) == 128
5734 || (INTVAL (operands[2]) < 0
5735 && INTVAL (operands[2]) != -128)))
5737 operands[2] = GEN_INT (-INTVAL (operands[2]));
5738 return "sub{q}\t{%2, %0|%0, %2}";
5740 return "add{q}\t{%2, %0|%0, %2}";
5744 (if_then_else (match_operand:DI 2 "incdec_operand" "")
5745 (const_string "incdec")
5746 (const_string "alu")))
5747 (set_attr "mode" "DI")])
5750 (define_insn "*addsi_1"
5751 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r")
5752 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r")
5753 (match_operand:SI 2 "general_operand" "rmni,rni,rni")))
5754 (clobber (reg:CC 17))]
5755 "ix86_binary_operator_ok (PLUS, SImode, operands)"
5757 switch (get_attr_type (insn))
5760 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5761 return "lea{l}\t{%a2, %0|%0, %a2}";
5764 if (! rtx_equal_p (operands[0], operands[1]))
5766 if (operands[2] == const1_rtx)
5767 return "inc{l}\t%0";
5768 else if (operands[2] == constm1_rtx)
5769 return "dec{l}\t%0";
5774 if (! rtx_equal_p (operands[0], operands[1]))
5777 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5778 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5779 if (GET_CODE (operands[2]) == CONST_INT
5780 && (INTVAL (operands[2]) == 128
5781 || (INTVAL (operands[2]) < 0
5782 && INTVAL (operands[2]) != -128)))
5784 operands[2] = GEN_INT (-INTVAL (operands[2]));
5785 return "sub{l}\t{%2, %0|%0, %2}";
5787 return "add{l}\t{%2, %0|%0, %2}";
5791 (cond [(eq_attr "alternative" "2")
5792 (const_string "lea")
5793 ; Current assemblers are broken and do not allow @GOTOFF in
5794 ; ought but a memory context.
5795 (match_operand:SI 2 "pic_symbolic_operand" "")
5796 (const_string "lea")
5797 (match_operand:SI 2 "incdec_operand" "")
5798 (const_string "incdec")
5800 (const_string "alu")))
5801 (set_attr "mode" "SI")])
5803 ;; Convert lea to the lea pattern to avoid flags dependency.
5805 [(set (match_operand 0 "register_operand" "")
5806 (plus (match_operand 1 "register_operand" "")
5807 (match_operand 2 "nonmemory_operand" "")))
5808 (clobber (reg:CC 17))]
5810 && true_regnum (operands[0]) != true_regnum (operands[1])"
5814 /* In -fPIC mode the constructs like (const (unspec [symbol_ref]))
5815 may confuse gen_lowpart. */
5816 if (GET_MODE (operands[0]) != Pmode)
5818 operands[1] = gen_lowpart (Pmode, operands[1]);
5819 operands[2] = gen_lowpart (Pmode, operands[2]);
5821 operands[0] = gen_lowpart (SImode, operands[0]);
5822 pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
5823 if (Pmode != SImode)
5824 pat = gen_rtx_SUBREG (SImode, pat, 0);
5825 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
5829 ;; It may seem that nonimmediate operand is proper one for operand 1.
5830 ;; The addsi_1 pattern allows nonimmediate operand at that place and
5831 ;; we take care in ix86_binary_operator_ok to not allow two memory
5832 ;; operands so proper swapping will be done in reload. This allow
5833 ;; patterns constructed from addsi_1 to match.
5834 (define_insn "addsi_1_zext"
5835 [(set (match_operand:DI 0 "register_operand" "=r,r")
5837 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r")
5838 (match_operand:SI 2 "general_operand" "rmni,rni"))))
5839 (clobber (reg:CC 17))]
5840 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
5842 switch (get_attr_type (insn))
5845 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
5846 return "lea{l}\t{%a2, %k0|%k0, %a2}";
5849 if (operands[2] == const1_rtx)
5850 return "inc{l}\t%k0";
5851 else if (operands[2] == constm1_rtx)
5852 return "dec{l}\t%k0";
5857 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5858 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5859 if (GET_CODE (operands[2]) == CONST_INT
5860 && (INTVAL (operands[2]) == 128
5861 || (INTVAL (operands[2]) < 0
5862 && INTVAL (operands[2]) != -128)))
5864 operands[2] = GEN_INT (-INTVAL (operands[2]));
5865 return "sub{l}\t{%2, %k0|%k0, %2}";
5867 return "add{l}\t{%2, %k0|%k0, %2}";
5871 (cond [(eq_attr "alternative" "1")
5872 (const_string "lea")
5873 ; Current assemblers are broken and do not allow @GOTOFF in
5874 ; ought but a memory context.
5875 (match_operand:SI 2 "pic_symbolic_operand" "")
5876 (const_string "lea")
5877 (match_operand:SI 2 "incdec_operand" "")
5878 (const_string "incdec")
5880 (const_string "alu")))
5881 (set_attr "mode" "SI")])
5883 ;; Convert lea to the lea pattern to avoid flags dependency.
5885 [(set (match_operand:DI 0 "register_operand" "")
5887 (plus:SI (match_operand:SI 1 "register_operand" "")
5888 (match_operand:SI 2 "nonmemory_operand" ""))))
5889 (clobber (reg:CC 17))]
5890 "TARGET_64BIT && reload_completed
5891 && true_regnum (operands[0]) != true_regnum (operands[1])"
5893 (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))]
5895 operands[1] = gen_lowpart (Pmode, operands[1]);
5896 operands[2] = gen_lowpart (Pmode, operands[2]);
5899 (define_insn "*addsi_2"
5902 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5903 (match_operand:SI 2 "general_operand" "rmni,rni"))
5905 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
5906 (plus:SI (match_dup 1) (match_dup 2)))]
5907 "ix86_match_ccmode (insn, CCGOCmode)
5908 && ix86_binary_operator_ok (PLUS, SImode, operands)
5909 /* Current assemblers are broken and do not allow @GOTOFF in
5910 ought but a memory context. */
5911 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5913 switch (get_attr_type (insn))
5916 if (! rtx_equal_p (operands[0], operands[1]))
5918 if (operands[2] == const1_rtx)
5919 return "inc{l}\t%0";
5920 else if (operands[2] == constm1_rtx)
5921 return "dec{l}\t%0";
5926 if (! rtx_equal_p (operands[0], operands[1]))
5928 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5929 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5930 if (GET_CODE (operands[2]) == CONST_INT
5931 && (INTVAL (operands[2]) == 128
5932 || (INTVAL (operands[2]) < 0
5933 && INTVAL (operands[2]) != -128)))
5935 operands[2] = GEN_INT (-INTVAL (operands[2]));
5936 return "sub{l}\t{%2, %0|%0, %2}";
5938 return "add{l}\t{%2, %0|%0, %2}";
5942 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5943 (const_string "incdec")
5944 (const_string "alu")))
5945 (set_attr "mode" "SI")])
5947 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
5948 (define_insn "*addsi_2_zext"
5951 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
5952 (match_operand:SI 2 "general_operand" "rmni"))
5954 (set (match_operand:DI 0 "register_operand" "=r")
5955 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
5956 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
5957 && ix86_binary_operator_ok (PLUS, SImode, operands)
5958 /* Current assemblers are broken and do not allow @GOTOFF in
5959 ought but a memory context. */
5960 && ! pic_symbolic_operand (operands[2], VOIDmode)"
5962 switch (get_attr_type (insn))
5965 if (operands[2] == const1_rtx)
5966 return "inc{l}\t%k0";
5967 else if (operands[2] == constm1_rtx)
5968 return "dec{l}\t%k0";
5973 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
5974 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
5975 if (GET_CODE (operands[2]) == CONST_INT
5976 && (INTVAL (operands[2]) == 128
5977 || (INTVAL (operands[2]) < 0
5978 && INTVAL (operands[2]) != -128)))
5980 operands[2] = GEN_INT (-INTVAL (operands[2]));
5981 return "sub{l}\t{%2, %k0|%k0, %2}";
5983 return "add{l}\t{%2, %k0|%k0, %2}";
5987 (if_then_else (match_operand:SI 2 "incdec_operand" "")
5988 (const_string "incdec")
5989 (const_string "alu")))
5990 (set_attr "mode" "SI")])
5992 (define_insn "*addsi_3"
5994 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
5995 (match_operand:SI 1 "nonimmediate_operand" "%0")))
5996 (clobber (match_scratch:SI 0 "=r"))]
5997 "ix86_match_ccmode (insn, CCZmode)
5998 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
5999 /* Current assemblers are broken and do not allow @GOTOFF in
6000 ought but a memory context. */
6001 && ! pic_symbolic_operand (operands[2], VOIDmode)"
6003 switch (get_attr_type (insn))
6006 if (! rtx_equal_p (operands[0], operands[1]))
6008 if (operands[2] == const1_rtx)
6009 return "inc{l}\t%0";
6010 else if (operands[2] == constm1_rtx)
6011 return "dec{l}\t%0";
6016 if (! rtx_equal_p (operands[0], operands[1]))
6018 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6019 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6020 if (GET_CODE (operands[2]) == CONST_INT
6021 && (INTVAL (operands[2]) == 128
6022 || (INTVAL (operands[2]) < 0
6023 && INTVAL (operands[2]) != -128)))
6025 operands[2] = GEN_INT (-INTVAL (operands[2]));
6026 return "sub{l}\t{%2, %0|%0, %2}";
6028 return "add{l}\t{%2, %0|%0, %2}";
6032 (if_then_else (match_operand:SI 2 "incdec_operand" "")
6033 (const_string "incdec")
6034 (const_string "alu")))
6035 (set_attr "mode" "SI")])
6037 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
6038 (define_insn "*addsi_3_zext"
6040 (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
6041 (match_operand:SI 1 "nonimmediate_operand" "%0")))
6042 (set (match_operand:DI 0 "register_operand" "=r")
6043 (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
6044 "TARGET_64BIT && ix86_match_ccmode (insn, CCZmode)
6045 && ix86_binary_operator_ok (PLUS, SImode, operands)
6046 /* Current assemblers are broken and do not allow @GOTOFF in
6047 ought but a memory context. */
6048 && ! pic_symbolic_operand (operands[2], VOIDmode)"
6050 switch (get_attr_type (insn))
6053 if (operands[2] == const1_rtx)
6054 return "inc{l}\t%k0";
6055 else if (operands[2] == constm1_rtx)
6056 return "dec{l}\t%k0";
6061 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6062 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6063 if (GET_CODE (operands[2]) == CONST_INT
6064 && (INTVAL (operands[2]) == 128
6065 || (INTVAL (operands[2]) < 0
6066 && INTVAL (operands[2]) != -128)))
6068 operands[2] = GEN_INT (-INTVAL (operands[2]));
6069 return "sub{l}\t{%2, %k0|%k0, %2}";
6071 return "add{l}\t{%2, %k0|%k0, %2}";
6075 (if_then_else (match_operand:SI 2 "incdec_operand" "")
6076 (const_string "incdec")
6077 (const_string "alu")))
6078 (set_attr "mode" "SI")])
6080 ; For comparisons against 1, -1 and 128, we may generate better code
6081 ; by converting cmp to add, inc or dec as done by peephole2. This pattern
6082 ; is matched then. We can't accept general immediate, because for
6083 ; case of overflows, the result is messed up.
6084 ; This pattern also don't hold of 0x80000000, since the value overflows
6086 ; Also carry flag is reversed compared to cmp, so this conversion is valid
6087 ; only for comparisons not depending on it.
6088 (define_insn "*addsi_4"
6090 (compare (match_operand:SI 1 "nonimmediate_operand" "0")
6091 (match_operand:SI 2 "const_int_operand" "n")))
6092 (clobber (match_scratch:SI 0 "=rm"))]
6093 "ix86_match_ccmode (insn, CCGCmode)
6094 && (INTVAL (operands[2]) & 0xffffffff) != 0x80000000"
6096 switch (get_attr_type (insn))
6099 if (operands[2] == constm1_rtx)
6100 return "inc{l}\t%0";
6101 else if (operands[2] == const1_rtx)
6102 return "dec{l}\t%0";
6107 if (! rtx_equal_p (operands[0], operands[1]))
6109 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6110 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6111 if ((INTVAL (operands[2]) == -128
6112 || (INTVAL (operands[2]) > 0
6113 && INTVAL (operands[2]) != 128)))
6114 return "sub{l}\t{%2, %0|%0, %2}";
6115 operands[2] = GEN_INT (-INTVAL (operands[2]));
6116 return "add{l}\t{%2, %0|%0, %2}";
6120 (if_then_else (match_operand:SI 2 "incdec_operand" "")
6121 (const_string "incdec")
6122 (const_string "alu")))
6123 (set_attr "mode" "SI")])
6125 (define_insn "*addsi_5"
6128 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
6129 (match_operand:SI 2 "general_operand" "rmni"))
6131 (clobber (match_scratch:SI 0 "=r"))]
6132 "ix86_match_ccmode (insn, CCGOCmode)
6133 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
6134 /* Current assemblers are broken and do not allow @GOTOFF in
6135 ought but a memory context. */
6136 && ! pic_symbolic_operand (operands[2], VOIDmode)"
6138 switch (get_attr_type (insn))
6141 if (! rtx_equal_p (operands[0], operands[1]))
6143 if (operands[2] == const1_rtx)
6144 return "inc{l}\t%0";
6145 else if (operands[2] == constm1_rtx)
6146 return "dec{l}\t%0";
6151 if (! rtx_equal_p (operands[0], operands[1]))
6153 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6154 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6155 if (GET_CODE (operands[2]) == CONST_INT
6156 && (INTVAL (operands[2]) == 128
6157 || (INTVAL (operands[2]) < 0
6158 && INTVAL (operands[2]) != -128)))
6160 operands[2] = GEN_INT (-INTVAL (operands[2]));
6161 return "sub{l}\t{%2, %0|%0, %2}";
6163 return "add{l}\t{%2, %0|%0, %2}";
6167 (if_then_else (match_operand:SI 2 "incdec_operand" "")
6168 (const_string "incdec")
6169 (const_string "alu")))
6170 (set_attr "mode" "SI")])
6172 (define_expand "addhi3"
6173 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
6174 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "")
6175 (match_operand:HI 2 "general_operand" "")))
6176 (clobber (reg:CC 17))])]
6177 "TARGET_HIMODE_MATH"
6178 "ix86_expand_binary_operator (PLUS, HImode, operands); DONE;")
6180 ;; %%% After Dave's SUBREG_BYTE stuff goes in, re-enable incb %ah
6181 ;; type optimizations enabled by define-splits. This is not important
6182 ;; for PII, and in fact harmful because of partial register stalls.
6184 (define_insn "*addhi_1_lea"
6185 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
6186 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r")
6187 (match_operand:HI 2 "general_operand" "ri,rm,rni")))
6188 (clobber (reg:CC 17))]
6189 "!TARGET_PARTIAL_REG_STALL
6190 && ix86_binary_operator_ok (PLUS, HImode, operands)"
6192 switch (get_attr_type (insn))
6197 if (operands[2] == const1_rtx)
6198 return "inc{w}\t%0";
6199 else if (operands[2] == constm1_rtx)
6200 return "dec{w}\t%0";
6204 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6205 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6206 if (GET_CODE (operands[2]) == CONST_INT
6207 && (INTVAL (operands[2]) == 128
6208 || (INTVAL (operands[2]) < 0
6209 && INTVAL (operands[2]) != -128)))
6211 operands[2] = GEN_INT (-INTVAL (operands[2]));
6212 return "sub{w}\t{%2, %0|%0, %2}";
6214 return "add{w}\t{%2, %0|%0, %2}";
6218 (if_then_else (eq_attr "alternative" "2")
6219 (const_string "lea")
6220 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6221 (const_string "incdec")
6222 (const_string "alu"))))
6223 (set_attr "mode" "HI,HI,SI")])
6225 (define_insn "*addhi_1"
6226 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6227 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
6228 (match_operand:HI 2 "general_operand" "ri,rm")))
6229 (clobber (reg:CC 17))]
6230 "TARGET_PARTIAL_REG_STALL
6231 && ix86_binary_operator_ok (PLUS, HImode, operands)"
6233 switch (get_attr_type (insn))
6236 if (operands[2] == const1_rtx)
6237 return "inc{w}\t%0";
6238 else if (operands[2] == constm1_rtx)
6239 return "dec{w}\t%0";
6243 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6244 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6245 if (GET_CODE (operands[2]) == CONST_INT
6246 && (INTVAL (operands[2]) == 128
6247 || (INTVAL (operands[2]) < 0
6248 && INTVAL (operands[2]) != -128)))
6250 operands[2] = GEN_INT (-INTVAL (operands[2]));
6251 return "sub{w}\t{%2, %0|%0, %2}";
6253 return "add{w}\t{%2, %0|%0, %2}";
6257 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6258 (const_string "incdec")
6259 (const_string "alu")))
6260 (set_attr "mode" "HI")])
6262 (define_insn "*addhi_2"
6265 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
6266 (match_operand:HI 2 "general_operand" "rmni,rni"))
6268 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
6269 (plus:HI (match_dup 1) (match_dup 2)))]
6270 "ix86_match_ccmode (insn, CCGOCmode)
6271 && ix86_binary_operator_ok (PLUS, HImode, operands)"
6273 switch (get_attr_type (insn))
6276 if (operands[2] == const1_rtx)
6277 return "inc{w}\t%0";
6278 else if (operands[2] == constm1_rtx)
6279 return "dec{w}\t%0";
6283 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6284 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6285 if (GET_CODE (operands[2]) == CONST_INT
6286 && (INTVAL (operands[2]) == 128
6287 || (INTVAL (operands[2]) < 0
6288 && INTVAL (operands[2]) != -128)))
6290 operands[2] = GEN_INT (-INTVAL (operands[2]));
6291 return "sub{w}\t{%2, %0|%0, %2}";
6293 return "add{w}\t{%2, %0|%0, %2}";
6297 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6298 (const_string "incdec")
6299 (const_string "alu")))
6300 (set_attr "mode" "HI")])
6302 (define_insn "*addhi_3"
6304 (compare (neg:HI (match_operand:HI 2 "general_operand" "rmni"))
6305 (match_operand:HI 1 "nonimmediate_operand" "%0")))
6306 (clobber (match_scratch:HI 0 "=r"))]
6307 "ix86_match_ccmode (insn, CCZmode)
6308 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6310 switch (get_attr_type (insn))
6313 if (operands[2] == const1_rtx)
6314 return "inc{w}\t%0";
6315 else if (operands[2] == constm1_rtx)
6316 return "dec{w}\t%0";
6320 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6321 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6322 if (GET_CODE (operands[2]) == CONST_INT
6323 && (INTVAL (operands[2]) == 128
6324 || (INTVAL (operands[2]) < 0
6325 && INTVAL (operands[2]) != -128)))
6327 operands[2] = GEN_INT (-INTVAL (operands[2]));
6328 return "sub{w}\t{%2, %0|%0, %2}";
6330 return "add{w}\t{%2, %0|%0, %2}";
6334 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6335 (const_string "incdec")
6336 (const_string "alu")))
6337 (set_attr "mode" "HI")])
6339 ; See comments above addsi_3_imm for details.
6340 (define_insn "*addhi_4"
6342 (compare (match_operand:HI 1 "nonimmediate_operand" "0")
6343 (match_operand:HI 2 "const_int_operand" "n")))
6344 (clobber (match_scratch:HI 0 "=rm"))]
6345 "ix86_match_ccmode (insn, CCGCmode)
6346 && (INTVAL (operands[2]) & 0xffff) != 0x8000"
6348 switch (get_attr_type (insn))
6351 if (operands[2] == constm1_rtx)
6352 return "inc{w}\t%0";
6353 else if (operands[2] == const1_rtx)
6354 return "dec{w}\t%0";
6359 if (! rtx_equal_p (operands[0], operands[1]))
6361 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6362 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6363 if ((INTVAL (operands[2]) == -128
6364 || (INTVAL (operands[2]) > 0
6365 && INTVAL (operands[2]) != 128)))
6366 return "sub{w}\t{%2, %0|%0, %2}";
6367 operands[2] = GEN_INT (-INTVAL (operands[2]));
6368 return "add{w}\t{%2, %0|%0, %2}";
6372 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6373 (const_string "incdec")
6374 (const_string "alu")))
6375 (set_attr "mode" "SI")])
6378 (define_insn "*addhi_5"
6381 (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
6382 (match_operand:HI 2 "general_operand" "rmni"))
6384 (clobber (match_scratch:HI 0 "=r"))]
6385 "ix86_match_ccmode (insn, CCGOCmode)
6386 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6388 switch (get_attr_type (insn))
6391 if (operands[2] == const1_rtx)
6392 return "inc{w}\t%0";
6393 else if (operands[2] == constm1_rtx)
6394 return "dec{w}\t%0";
6398 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6399 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6400 if (GET_CODE (operands[2]) == CONST_INT
6401 && (INTVAL (operands[2]) == 128
6402 || (INTVAL (operands[2]) < 0
6403 && INTVAL (operands[2]) != -128)))
6405 operands[2] = GEN_INT (-INTVAL (operands[2]));
6406 return "sub{w}\t{%2, %0|%0, %2}";
6408 return "add{w}\t{%2, %0|%0, %2}";
6412 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6413 (const_string "incdec")
6414 (const_string "alu")))
6415 (set_attr "mode" "HI")])
6417 (define_expand "addqi3"
6418 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
6419 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "")
6420 (match_operand:QI 2 "general_operand" "")))
6421 (clobber (reg:CC 17))])]
6422 "TARGET_QIMODE_MATH"
6423 "ix86_expand_binary_operator (PLUS, QImode, operands); DONE;")
6425 ;; %%% Potential partial reg stall on alternative 2. What to do?
6426 (define_insn "*addqi_1_lea"
6427 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r")
6428 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,r")
6429 (match_operand:QI 2 "general_operand" "qn,qmn,rn,rn")))
6430 (clobber (reg:CC 17))]
6431 "!TARGET_PARTIAL_REG_STALL
6432 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6434 int widen = (which_alternative == 2);
6435 switch (get_attr_type (insn))
6440 if (operands[2] == const1_rtx)
6441 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6442 else if (operands[2] == constm1_rtx)
6443 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6447 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6448 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6449 if (GET_CODE (operands[2]) == CONST_INT
6450 && (INTVAL (operands[2]) == 128
6451 || (INTVAL (operands[2]) < 0
6452 && INTVAL (operands[2]) != -128)))
6454 operands[2] = GEN_INT (-INTVAL (operands[2]));
6456 return "sub{l}\t{%2, %k0|%k0, %2}";
6458 return "sub{b}\t{%2, %0|%0, %2}";
6461 return "add{l}\t{%k2, %k0|%k0, %k2}";
6463 return "add{b}\t{%2, %0|%0, %2}";
6467 (if_then_else (eq_attr "alternative" "3")
6468 (const_string "lea")
6469 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6470 (const_string "incdec")
6471 (const_string "alu"))))
6472 (set_attr "mode" "QI,QI,SI,SI")])
6474 (define_insn "*addqi_1"
6475 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
6476 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
6477 (match_operand:QI 2 "general_operand" "qn,qmn,rn")))
6478 (clobber (reg:CC 17))]
6479 "TARGET_PARTIAL_REG_STALL
6480 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6482 int widen = (which_alternative == 2);
6483 switch (get_attr_type (insn))
6486 if (operands[2] == const1_rtx)
6487 return widen ? "inc{l}\t%k0" : "inc{b}\t%0";
6488 else if (operands[2] == constm1_rtx)
6489 return widen ? "dec{l}\t%k0" : "dec{b}\t%0";
6493 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
6494 Exceptions: -128 encodes smaller than 128, so swap sign and op. */
6495 if (GET_CODE (operands[2]) == CONST_INT
6496 && (INTVAL (operands[2]) == 128
6497 || (INTVAL (operands[2]) < 0
6498 && INTVAL (operands[2]) != -128)))
6500 operands[2] = GEN_INT (-INTVAL (operands[2]));
6502 return "sub{l}\t{%2, %k0|%k0, %2}";
6504 return "sub{b}\t{%2, %0|%0, %2}";
6507 return "add{l}\t{%k2, %k0|%k0, %k2}";
6509 return "add{b}\t{%2, %0|%0, %2}";
6513 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6514 (const_string "incdec")
6515 (const_string "alu")))
6516 (set_attr "mode" "QI,QI,SI")])
6518 (define_insn "*addqi_1_slp"
6519 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
6520 (plus:QI (match_dup 0)
6521 (match_operand:QI 1 "general_operand" "qn,qnm")))
6522 (clobber (reg:CC 17))]
6523 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
6524 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
6526 switch (get_attr_type (insn))
6529 if (operands[1] == const1_rtx)
6530 return "inc{b}\t%0";
6531 else if (operands[1] == constm1_rtx)
6532 return "dec{b}\t%0";
6536 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'. */
6537 if (GET_CODE (operands[1]) == CONST_INT
6538 && INTVAL (operands[1]) < 0)
6540 operands[2] = GEN_INT (-INTVAL (operands[2]));
6541 return "sub{b}\t{%1, %0|%0, %1}";
6543 return "add{b}\t{%1, %0|%0, %1}";
6547 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6548 (const_string "incdec")
6549 (const_string "alu1")))
6550 (set_attr "mode" "QI")])
6552 (define_insn "*addqi_2"
6555 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
6556 (match_operand:QI 2 "general_operand" "qmni,qni"))
6558 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
6559 (plus:QI (match_dup 1) (match_dup 2)))]
6560 "ix86_match_ccmode (insn, CCGOCmode)
6561 && ix86_binary_operator_ok (PLUS, QImode, operands)"
6563 switch (get_attr_type (insn))
6566 if (operands[2] == const1_rtx)
6567 return "inc{b}\t%0";
6568 else if (operands[2] == constm1_rtx
6569 || (GET_CODE (operands[2]) == CONST_INT
6570 && INTVAL (operands[2]) == 255))
6571 return "dec{b}\t%0";
6575 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6576 if (GET_CODE (operands[2]) == CONST_INT
6577 && INTVAL (operands[2]) < 0)
6579 operands[2] = GEN_INT (-INTVAL (operands[2]));
6580 return "sub{b}\t{%2, %0|%0, %2}";
6582 return "add{b}\t{%2, %0|%0, %2}";
6586 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6587 (const_string "incdec")
6588 (const_string "alu")))
6589 (set_attr "mode" "QI")])
6591 (define_insn "*addqi_3"
6593 (compare (neg:QI (match_operand:QI 2 "general_operand" "qmni"))
6594 (match_operand:QI 1 "nonimmediate_operand" "%0")))
6595 (clobber (match_scratch:QI 0 "=q"))]
6596 "ix86_match_ccmode (insn, CCZmode)
6597 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6599 switch (get_attr_type (insn))
6602 if (operands[2] == const1_rtx)
6603 return "inc{b}\t%0";
6604 else if (operands[2] == constm1_rtx
6605 || (GET_CODE (operands[2]) == CONST_INT
6606 && INTVAL (operands[2]) == 255))
6607 return "dec{b}\t%0";
6611 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6612 if (GET_CODE (operands[2]) == CONST_INT
6613 && INTVAL (operands[2]) < 0)
6615 operands[2] = GEN_INT (-INTVAL (operands[2]));
6616 return "sub{b}\t{%2, %0|%0, %2}";
6618 return "add{b}\t{%2, %0|%0, %2}";
6622 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6623 (const_string "incdec")
6624 (const_string "alu")))
6625 (set_attr "mode" "QI")])
6627 ; See comments above addsi_3_imm for details.
6628 (define_insn "*addqi_4"
6630 (compare (match_operand:QI 1 "nonimmediate_operand" "0")
6631 (match_operand:QI 2 "const_int_operand" "n")))
6632 (clobber (match_scratch:QI 0 "=qm"))]
6633 "ix86_match_ccmode (insn, CCGCmode)
6634 && (INTVAL (operands[2]) & 0xff) != 0x80"
6636 switch (get_attr_type (insn))
6639 if (operands[2] == constm1_rtx
6640 || (GET_CODE (operands[2]) == CONST_INT
6641 && INTVAL (operands[2]) == 255))
6642 return "inc{b}\t%0";
6643 else if (operands[2] == const1_rtx)
6644 return "dec{b}\t%0";
6649 if (! rtx_equal_p (operands[0], operands[1]))
6651 if (INTVAL (operands[2]) < 0)
6653 operands[2] = GEN_INT (-INTVAL (operands[2]));
6654 return "add{b}\t{%2, %0|%0, %2}";
6656 return "sub{b}\t{%2, %0|%0, %2}";
6660 (if_then_else (match_operand:HI 2 "incdec_operand" "")
6661 (const_string "incdec")
6662 (const_string "alu")))
6663 (set_attr "mode" "QI")])
6666 (define_insn "*addqi_5"
6669 (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
6670 (match_operand:QI 2 "general_operand" "qmni"))
6672 (clobber (match_scratch:QI 0 "=q"))]
6673 "ix86_match_ccmode (insn, CCGOCmode)
6674 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
6676 switch (get_attr_type (insn))
6679 if (operands[2] == const1_rtx)
6680 return "inc{b}\t%0";
6681 else if (operands[2] == constm1_rtx
6682 || (GET_CODE (operands[2]) == CONST_INT
6683 && INTVAL (operands[2]) == 255))
6684 return "dec{b}\t%0";
6688 /* Make things pretty and `subb $4,%al' rather than `addb $-4, %al'. */
6689 if (GET_CODE (operands[2]) == CONST_INT
6690 && INTVAL (operands[2]) < 0)
6692 operands[2] = GEN_INT (-INTVAL (operands[2]));
6693 return "sub{b}\t{%2, %0|%0, %2}";
6695 return "add{b}\t{%2, %0|%0, %2}";
6699 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6700 (const_string "incdec")
6701 (const_string "alu")))
6702 (set_attr "mode" "QI")])
6705 (define_insn "addqi_ext_1"
6706 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6711 (match_operand 1 "ext_register_operand" "0")
6714 (match_operand:QI 2 "general_operand" "Qmn")))
6715 (clobber (reg:CC 17))]
6718 switch (get_attr_type (insn))
6721 if (operands[2] == const1_rtx)
6722 return "inc{b}\t%h0";
6723 else if (operands[2] == constm1_rtx
6724 || (GET_CODE (operands[2]) == CONST_INT
6725 && INTVAL (operands[2]) == 255))
6726 return "dec{b}\t%h0";
6730 return "add{b}\t{%2, %h0|%h0, %2}";
6734 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6735 (const_string "incdec")
6736 (const_string "alu")))
6737 (set_attr "mode" "QI")])
6739 (define_insn "*addqi_ext_1_rex64"
6740 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6745 (match_operand 1 "ext_register_operand" "0")
6748 (match_operand:QI 2 "nonmemory_operand" "Qn")))
6749 (clobber (reg:CC 17))]
6752 switch (get_attr_type (insn))
6755 if (operands[2] == const1_rtx)
6756 return "inc{b}\t%h0";
6757 else if (operands[2] == constm1_rtx
6758 || (GET_CODE (operands[2]) == CONST_INT
6759 && INTVAL (operands[2]) == 255))
6760 return "dec{b}\t%h0";
6764 return "add{b}\t{%2, %h0|%h0, %2}";
6768 (if_then_else (match_operand:QI 2 "incdec_operand" "")
6769 (const_string "incdec")
6770 (const_string "alu")))
6771 (set_attr "mode" "QI")])
6773 (define_insn "*addqi_ext_2"
6774 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
6779 (match_operand 1 "ext_register_operand" "%0")
6783 (match_operand 2 "ext_register_operand" "Q")
6786 (clobber (reg:CC 17))]
6788 "add{b}\t{%h2, %h0|%h0, %h2}"
6789 [(set_attr "type" "alu")
6790 (set_attr "mode" "QI")])
6792 ;; The patterns that match these are at the end of this file.
6794 (define_expand "addxf3"
6795 [(set (match_operand:XF 0 "register_operand" "")
6796 (plus:XF (match_operand:XF 1 "register_operand" "")
6797 (match_operand:XF 2 "register_operand" "")))]
6798 "!TARGET_64BIT && TARGET_80387"
6801 (define_expand "addtf3"
6802 [(set (match_operand:TF 0 "register_operand" "")
6803 (plus:TF (match_operand:TF 1 "register_operand" "")
6804 (match_operand:TF 2 "register_operand" "")))]
6808 (define_expand "adddf3"
6809 [(set (match_operand:DF 0 "register_operand" "")
6810 (plus:DF (match_operand:DF 1 "register_operand" "")
6811 (match_operand:DF 2 "nonimmediate_operand" "")))]
6812 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
6815 (define_expand "addsf3"
6816 [(set (match_operand:SF 0 "register_operand" "")
6817 (plus:SF (match_operand:SF 1 "register_operand" "")
6818 (match_operand:SF 2 "nonimmediate_operand" "")))]
6819 "TARGET_80387 || TARGET_SSE_MATH"
6822 ;; Subtract instructions
6824 ;; %%% splits for subsidi3
6826 (define_expand "subdi3"
6827 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
6828 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6829 (match_operand:DI 2 "x86_64_general_operand" "")))
6830 (clobber (reg:CC 17))])]
6832 "ix86_expand_binary_operator (MINUS, DImode, operands); DONE;")
6834 (define_insn "*subdi3_1"
6835 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
6836 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6837 (match_operand:DI 2 "general_operand" "roiF,riF")))
6838 (clobber (reg:CC 17))]
6839 "!TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6843 [(set (match_operand:DI 0 "nonimmediate_operand" "")
6844 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
6845 (match_operand:DI 2 "general_operand" "")))
6846 (clobber (reg:CC 17))]
6847 "!TARGET_64BIT && reload_completed"
6848 [(parallel [(set (reg:CC 17) (compare:CC (match_dup 1) (match_dup 2)))
6849 (set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))])
6850 (parallel [(set (match_dup 3)
6851 (minus:SI (match_dup 4)
6852 (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
6854 (clobber (reg:CC 17))])]
6855 "split_di (operands+0, 1, operands+0, operands+3);
6856 split_di (operands+1, 1, operands+1, operands+4);
6857 split_di (operands+2, 1, operands+2, operands+5);")
6859 (define_insn "subdi3_carry_rex64"
6860 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6861 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6862 (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "")
6863 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))))
6864 (clobber (reg:CC 17))]
6865 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6866 "sbb{q}\t{%2, %0|%0, %2}"
6867 [(set_attr "type" "alu")
6868 (set_attr "pent_pair" "pu")
6869 (set_attr "ppro_uops" "few")
6870 (set_attr "mode" "DI")])
6872 (define_insn "*subdi_1_rex64"
6873 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6874 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6875 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6876 (clobber (reg:CC 17))]
6877 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
6878 "sub{q}\t{%2, %0|%0, %2}"
6879 [(set_attr "type" "alu")
6880 (set_attr "mode" "DI")])
6882 (define_insn "*subdi_2_rex64"
6885 (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
6886 (match_operand:DI 2 "x86_64_general_operand" "re,rm"))
6888 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6889 (minus:DI (match_dup 1) (match_dup 2)))]
6890 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
6891 && ix86_binary_operator_ok (MINUS, DImode, operands)"
6892 "sub{q}\t{%2, %0|%0, %2}"
6893 [(set_attr "type" "alu")
6894 (set_attr "mode" "DI")])
6896 (define_insn "*subdi_3_rex63"
6898 (compare (match_operand:DI 1 "nonimmediate_operand" "0,0")
6899 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
6900 (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
6901 (minus:DI (match_dup 1) (match_dup 2)))]
6902 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
6903 && ix86_binary_operator_ok (MINUS, SImode, operands)"
6904 "sub{q}\t{%2, %0|%0, %2}"
6905 [(set_attr "type" "alu")
6906 (set_attr "mode" "DI")])
6908 (define_insn "subqi3_carry"
6909 [(set (match_operand:QI 0 "nonimmediate_operand" "=rm,r")
6910 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
6911 (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "")
6912 (match_operand:QI 2 "general_operand" "ri,rm"))))
6913 (clobber (reg:CC 17))]
6914 "ix86_binary_operator_ok (MINUS, QImode, operands)"
6915 "sbb{b}\t{%2, %0|%0, %2}"
6916 [(set_attr "type" "alu")
6917 (set_attr "pent_pair" "pu")
6918 (set_attr "ppro_uops" "few")
6919 (set_attr "mode" "QI")])
6921 (define_insn "subhi3_carry"
6922 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
6923 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
6924 (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "")
6925 (match_operand:HI 2 "general_operand" "ri,rm"))))
6926 (clobber (reg:CC 17))]
6927 "ix86_binary_operator_ok (MINUS, HImode, operands)"
6928 "sbb{w}\t{%2, %0|%0, %2}"
6929 [(set_attr "type" "alu")
6930 (set_attr "pent_pair" "pu")
6931 (set_attr "ppro_uops" "few")
6932 (set_attr "mode" "HI")])
6934 (define_insn "subsi3_carry"
6935 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6936 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6937 (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
6938 (match_operand:SI 2 "general_operand" "ri,rm"))))
6939 (clobber (reg:CC 17))]
6940 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6941 "sbb{l}\t{%2, %0|%0, %2}"
6942 [(set_attr "type" "alu")
6943 (set_attr "pent_pair" "pu")
6944 (set_attr "ppro_uops" "few")
6945 (set_attr "mode" "SI")])
6947 (define_insn "subsi3_carry_zext"
6948 [(set (match_operand:DI 0 "register_operand" "=rm,r")
6950 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
6951 (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
6952 (match_operand:SI 2 "general_operand" "ri,rm")))))
6953 (clobber (reg:CC 17))]
6954 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6955 "sbb{l}\t{%2, %k0|%k0, %2}"
6956 [(set_attr "type" "alu")
6957 (set_attr "pent_pair" "pu")
6958 (set_attr "ppro_uops" "few")
6959 (set_attr "mode" "SI")])
6961 (define_expand "subsi3"
6962 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
6963 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "")
6964 (match_operand:SI 2 "general_operand" "")))
6965 (clobber (reg:CC 17))])]
6967 "ix86_expand_binary_operator (MINUS, SImode, operands); DONE;")
6969 (define_insn "*subsi_1"
6970 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6971 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6972 (match_operand:SI 2 "general_operand" "ri,rm")))
6973 (clobber (reg:CC 17))]
6974 "ix86_binary_operator_ok (MINUS, SImode, operands)"
6975 "sub{l}\t{%2, %0|%0, %2}"
6976 [(set_attr "type" "alu")
6977 (set_attr "mode" "SI")])
6979 (define_insn "*subsi_1_zext"
6980 [(set (match_operand:DI 0 "register_operand" "=r")
6982 (minus:SI (match_operand:SI 1 "register_operand" "0")
6983 (match_operand:SI 2 "general_operand" "rim"))))
6984 (clobber (reg:CC 17))]
6985 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
6986 "sub{l}\t{%2, %k0|%k0, %2}"
6987 [(set_attr "type" "alu")
6988 (set_attr "mode" "SI")])
6990 (define_insn "*subsi_2"
6993 (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
6994 (match_operand:SI 2 "general_operand" "ri,rm"))
6996 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
6997 (minus:SI (match_dup 1) (match_dup 2)))]
6998 "ix86_match_ccmode (insn, CCGOCmode)
6999 && ix86_binary_operator_ok (MINUS, SImode, operands)"
7000 "sub{l}\t{%2, %0|%0, %2}"
7001 [(set_attr "type" "alu")
7002 (set_attr "mode" "SI")])
7004 (define_insn "*subsi_2_zext"
7007 (minus:SI (match_operand:SI 1 "register_operand" "0")
7008 (match_operand:SI 2 "general_operand" "rim"))
7010 (set (match_operand:DI 0 "register_operand" "=r")
7012 (minus:SI (match_dup 1)
7014 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
7015 && ix86_binary_operator_ok (MINUS, SImode, operands)"
7016 "sub{l}\t{%2, %k0|%k0, %2}"
7017 [(set_attr "type" "alu")
7018 (set_attr "mode" "SI")])
7020 (define_insn "*subsi_3"
7022 (compare (match_operand:SI 1 "nonimmediate_operand" "0,0")
7023 (match_operand:SI 2 "general_operand" "ri,rm")))
7024 (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
7025 (minus:SI (match_dup 1) (match_dup 2)))]
7026 "ix86_match_ccmode (insn, CCmode)
7027 && ix86_binary_operator_ok (MINUS, SImode, operands)"
7028 "sub{l}\t{%2, %0|%0, %2}"
7029 [(set_attr "type" "alu")
7030 (set_attr "mode" "SI")])
7032 (define_insn "*subsi_3_zext"
7034 (compare (match_operand:SI 1 "nonimmediate_operand" "0")
7035 (match_operand:SI 2 "general_operand" "rim")))
7036 (set (match_operand:DI 0 "register_operand" "=r")
7038 (minus:SI (match_dup 1)
7040 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
7041 && ix86_binary_operator_ok (MINUS, SImode, operands)"
7042 "sub{q}\t{%2, %0|%0, %2}"
7043 [(set_attr "type" "alu")
7044 (set_attr "mode" "DI")])
7046 (define_expand "subhi3"
7047 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
7048 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "")
7049 (match_operand:HI 2 "general_operand" "")))
7050 (clobber (reg:CC 17))])]
7051 "TARGET_HIMODE_MATH"
7052 "ix86_expand_binary_operator (MINUS, HImode, operands); DONE;")
7054 (define_insn "*subhi_1"
7055 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
7056 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
7057 (match_operand:HI 2 "general_operand" "ri,rm")))
7058 (clobber (reg:CC 17))]
7059 "ix86_binary_operator_ok (MINUS, HImode, operands)"
7060 "sub{w}\t{%2, %0|%0, %2}"
7061 [(set_attr "type" "alu")
7062 (set_attr "mode" "HI")])
7064 (define_insn "*subhi_2"
7067 (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
7068 (match_operand:HI 2 "general_operand" "ri,rm"))
7070 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
7071 (minus:HI (match_dup 1) (match_dup 2)))]
7072 "ix86_match_ccmode (insn, CCGOCmode)
7073 && ix86_binary_operator_ok (MINUS, HImode, operands)"
7074 "sub{w}\t{%2, %0|%0, %2}"
7075 [(set_attr "type" "alu")
7076 (set_attr "mode" "HI")])
7078 (define_insn "*subhi_3"
7080 (compare (match_operand:HI 1 "nonimmediate_operand" "0,0")
7081 (match_operand:HI 2 "general_operand" "ri,rm")))
7082 (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
7083 (minus:HI (match_dup 1) (match_dup 2)))]
7084 "ix86_match_ccmode (insn, CCmode)
7085 && ix86_binary_operator_ok (MINUS, HImode, operands)"
7086 "sub{w}\t{%2, %0|%0, %2}"
7087 [(set_attr "type" "alu")
7088 (set_attr "mode" "HI")])
7090 (define_expand "subqi3"
7091 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
7092 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "")
7093 (match_operand:QI 2 "general_operand" "")))
7094 (clobber (reg:CC 17))])]
7095 "TARGET_QIMODE_MATH"
7096 "ix86_expand_binary_operator (MINUS, QImode, operands); DONE;")
7098 (define_insn "*subqi_1"
7099 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
7100 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
7101 (match_operand:QI 2 "general_operand" "qn,qmn")))
7102 (clobber (reg:CC 17))]
7103 "ix86_binary_operator_ok (MINUS, QImode, operands)"
7104 "sub{b}\t{%2, %0|%0, %2}"
7105 [(set_attr "type" "alu")
7106 (set_attr "mode" "QI")])
7108 (define_insn "*subqi_1_slp"
7109 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
7110 (minus:QI (match_dup 0)
7111 (match_operand:QI 1 "general_operand" "qn,qmn")))
7112 (clobber (reg:CC 17))]
7113 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
7114 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
7115 "sub{b}\t{%1, %0|%0, %1}"
7116 [(set_attr "type" "alu1")
7117 (set_attr "mode" "QI")])
7119 (define_insn "*subqi_2"
7122 (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
7123 (match_operand:QI 2 "general_operand" "qi,qm"))
7125 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
7126 (minus:HI (match_dup 1) (match_dup 2)))]
7127 "ix86_match_ccmode (insn, CCGOCmode)
7128 && ix86_binary_operator_ok (MINUS, QImode, operands)"
7129 "sub{b}\t{%2, %0|%0, %2}"
7130 [(set_attr "type" "alu")
7131 (set_attr "mode" "QI")])
7133 (define_insn "*subqi_3"
7135 (compare (match_operand:QI 1 "nonimmediate_operand" "0,0")
7136 (match_operand:QI 2 "general_operand" "qi,qm")))
7137 (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
7138 (minus:HI (match_dup 1) (match_dup 2)))]
7139 "ix86_match_ccmode (insn, CCmode)
7140 && ix86_binary_operator_ok (MINUS, QImode, operands)"
7141 "sub{b}\t{%2, %0|%0, %2}"
7142 [(set_attr "type" "alu")
7143 (set_attr "mode" "QI")])
7145 ;; The patterns that match these are at the end of this file.
7147 (define_expand "subxf3"
7148 [(set (match_operand:XF 0 "register_operand" "")
7149 (minus:XF (match_operand:XF 1 "register_operand" "")
7150 (match_operand:XF 2 "register_operand" "")))]
7151 "!TARGET_64BIT && TARGET_80387"
7154 (define_expand "subtf3"
7155 [(set (match_operand:TF 0 "register_operand" "")
7156 (minus:TF (match_operand:TF 1 "register_operand" "")
7157 (match_operand:TF 2 "register_operand" "")))]
7161 (define_expand "subdf3"
7162 [(set (match_operand:DF 0 "register_operand" "")
7163 (minus:DF (match_operand:DF 1 "register_operand" "")
7164 (match_operand:DF 2 "nonimmediate_operand" "")))]
7165 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7168 (define_expand "subsf3"
7169 [(set (match_operand:SF 0 "register_operand" "")
7170 (minus:SF (match_operand:SF 1 "register_operand" "")
7171 (match_operand:SF 2 "nonimmediate_operand" "")))]
7172 "TARGET_80387 || TARGET_SSE_MATH"
7175 ;; Multiply instructions
7177 (define_expand "muldi3"
7178 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7179 (mult:DI (match_operand:DI 1 "register_operand" "")
7180 (match_operand:DI 2 "x86_64_general_operand" "")))
7181 (clobber (reg:CC 17))])]
7185 (define_insn "*muldi3_1_rex64"
7186 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
7187 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%rm,rm,0")
7188 (match_operand:DI 2 "x86_64_general_operand" "K,e,mr")))
7189 (clobber (reg:CC 17))]
7191 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7193 imul{q}\t{%2, %1, %0|%0, %1, %2}
7194 imul{q}\t{%2, %1, %0|%0, %1, %2}
7195 imul{q}\t{%2, %0|%0, %2}"
7196 [(set_attr "type" "imul")
7197 (set_attr "prefix_0f" "0,0,1")
7198 (set (attr "athlon_decode")
7199 (cond [(eq_attr "cpu" "athlon")
7200 (const_string "vector")
7201 (eq_attr "alternative" "1")
7202 (const_string "vector")
7203 (and (eq_attr "alternative" "2")
7204 (match_operand 1 "memory_operand" ""))
7205 (const_string "vector")]
7206 (const_string "direct")))
7207 (set_attr "mode" "DI")])
7209 (define_expand "mulsi3"
7210 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7211 (mult:SI (match_operand:SI 1 "register_operand" "")
7212 (match_operand:SI 2 "general_operand" "")))
7213 (clobber (reg:CC 17))])]
7217 (define_insn "*mulsi3_1"
7218 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
7219 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0")
7220 (match_operand:SI 2 "general_operand" "K,i,mr")))
7221 (clobber (reg:CC 17))]
7222 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7224 imul{l}\t{%2, %1, %0|%0, %1, %2}
7225 imul{l}\t{%2, %1, %0|%0, %1, %2}
7226 imul{l}\t{%2, %0|%0, %2}"
7227 [(set_attr "type" "imul")
7228 (set_attr "prefix_0f" "0,0,1")
7229 (set (attr "athlon_decode")
7230 (cond [(eq_attr "cpu" "athlon")
7231 (const_string "vector")
7232 (eq_attr "alternative" "1")
7233 (const_string "vector")
7234 (and (eq_attr "alternative" "2")
7235 (match_operand 1 "memory_operand" ""))
7236 (const_string "vector")]
7237 (const_string "direct")))
7238 (set_attr "mode" "SI")])
7240 (define_insn "*mulsi3_1_zext"
7241 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
7243 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0")
7244 (match_operand:SI 2 "general_operand" "K,i,mr"))))
7245 (clobber (reg:CC 17))]
7247 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7249 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
7250 imul{l}\t{%2, %1, %k0|%k0, %1, %2}
7251 imul{l}\t{%2, %k0|%k0, %2}"
7252 [(set_attr "type" "imul")
7253 (set_attr "prefix_0f" "0,0,1")
7254 (set (attr "athlon_decode")
7255 (cond [(eq_attr "cpu" "athlon")
7256 (const_string "vector")
7257 (eq_attr "alternative" "1")
7258 (const_string "vector")
7259 (and (eq_attr "alternative" "2")
7260 (match_operand 1 "memory_operand" ""))
7261 (const_string "vector")]
7262 (const_string "direct")))
7263 (set_attr "mode" "SI")])
7265 (define_expand "mulhi3"
7266 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7267 (mult:HI (match_operand:HI 1 "register_operand" "")
7268 (match_operand:HI 2 "general_operand" "")))
7269 (clobber (reg:CC 17))])]
7270 "TARGET_HIMODE_MATH"
7273 (define_insn "*mulhi3_1"
7274 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
7275 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,rm,0")
7276 (match_operand:HI 2 "general_operand" "K,i,mr")))
7277 (clobber (reg:CC 17))]
7278 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7280 imul{w}\t{%2, %1, %0|%0, %1, %2}
7281 imul{w}\t{%2, %1, %0|%0, %1, %2}
7282 imul{w}\t{%2, %0|%0, %2}"
7283 [(set_attr "type" "imul")
7284 (set_attr "prefix_0f" "0,0,1")
7285 (set (attr "athlon_decode")
7286 (cond [(eq_attr "cpu" "athlon")
7287 (const_string "vector")
7288 (eq_attr "alternative" "1,2")
7289 (const_string "vector")]
7290 (const_string "direct")))
7291 (set_attr "mode" "HI")])
7293 (define_expand "mulqi3"
7294 [(parallel [(set (match_operand:QI 0 "register_operand" "")
7295 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "")
7296 (match_operand:QI 2 "register_operand" "")))
7297 (clobber (reg:CC 17))])]
7298 "TARGET_QIMODE_MATH"
7301 (define_insn "*mulqi3_1"
7302 [(set (match_operand:QI 0 "register_operand" "=a")
7303 (mult:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
7304 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7305 (clobber (reg:CC 17))]
7307 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7309 [(set_attr "type" "imul")
7310 (set_attr "length_immediate" "0")
7311 (set (attr "athlon_decode")
7312 (if_then_else (eq_attr "cpu" "athlon")
7313 (const_string "vector")
7314 (const_string "direct")))
7315 (set_attr "mode" "QI")])
7317 (define_expand "umulqihi3"
7318 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7319 (mult:HI (zero_extend:HI
7320 (match_operand:QI 1 "nonimmediate_operand" ""))
7322 (match_operand:QI 2 "register_operand" ""))))
7323 (clobber (reg:CC 17))])]
7324 "TARGET_QIMODE_MATH"
7327 (define_insn "*umulqihi3_1"
7328 [(set (match_operand:HI 0 "register_operand" "=a")
7329 (mult:HI (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
7330 (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
7331 (clobber (reg:CC 17))]
7333 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7335 [(set_attr "type" "imul")
7336 (set_attr "length_immediate" "0")
7337 (set (attr "athlon_decode")
7338 (if_then_else (eq_attr "cpu" "athlon")
7339 (const_string "vector")
7340 (const_string "direct")))
7341 (set_attr "mode" "QI")])
7343 (define_expand "mulqihi3"
7344 [(parallel [(set (match_operand:HI 0 "register_operand" "")
7345 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" ""))
7346 (sign_extend:HI (match_operand:QI 2 "register_operand" ""))))
7347 (clobber (reg:CC 17))])]
7348 "TARGET_QIMODE_MATH"
7351 (define_insn "*mulqihi3_insn"
7352 [(set (match_operand:HI 0 "register_operand" "=a")
7353 (mult:HI (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "%0"))
7354 (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
7355 (clobber (reg:CC 17))]
7357 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7359 [(set_attr "type" "imul")
7360 (set_attr "length_immediate" "0")
7361 (set (attr "athlon_decode")
7362 (if_then_else (eq_attr "cpu" "athlon")
7363 (const_string "vector")
7364 (const_string "direct")))
7365 (set_attr "mode" "QI")])
7367 (define_expand "umulditi3"
7368 [(parallel [(set (match_operand:TI 0 "register_operand" "")
7369 (mult:TI (zero_extend:TI
7370 (match_operand:DI 1 "nonimmediate_operand" ""))
7372 (match_operand:DI 2 "register_operand" ""))))
7373 (clobber (reg:CC 17))])]
7377 (define_insn "*umulditi3_insn"
7378 [(set (match_operand:TI 0 "register_operand" "=A")
7379 (mult:TI (zero_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
7380 (zero_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
7381 (clobber (reg:CC 17))]
7383 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7385 [(set_attr "type" "imul")
7386 (set_attr "ppro_uops" "few")
7387 (set_attr "length_immediate" "0")
7388 (set (attr "athlon_decode")
7389 (if_then_else (eq_attr "cpu" "athlon")
7390 (const_string "vector")
7391 (const_string "double")))
7392 (set_attr "mode" "DI")])
7394 ;; We can't use this pattern in 64bit mode, since it results in two separate 32bit registers
7395 (define_expand "umulsidi3"
7396 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7397 (mult:DI (zero_extend:DI
7398 (match_operand:SI 1 "nonimmediate_operand" ""))
7400 (match_operand:SI 2 "register_operand" ""))))
7401 (clobber (reg:CC 17))])]
7405 (define_insn "*umulsidi3_insn"
7406 [(set (match_operand:DI 0 "register_operand" "=A")
7407 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
7408 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
7409 (clobber (reg:CC 17))]
7411 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7413 [(set_attr "type" "imul")
7414 (set_attr "ppro_uops" "few")
7415 (set_attr "length_immediate" "0")
7416 (set (attr "athlon_decode")
7417 (if_then_else (eq_attr "cpu" "athlon")
7418 (const_string "vector")
7419 (const_string "double")))
7420 (set_attr "mode" "SI")])
7422 (define_expand "mulditi3"
7423 [(parallel [(set (match_operand:TI 0 "register_operand" "")
7424 (mult:TI (sign_extend:TI
7425 (match_operand:DI 1 "nonimmediate_operand" ""))
7427 (match_operand:DI 2 "register_operand" ""))))
7428 (clobber (reg:CC 17))])]
7432 (define_insn "*mulditi3_insn"
7433 [(set (match_operand:TI 0 "register_operand" "=A")
7434 (mult:TI (sign_extend:TI (match_operand:DI 1 "nonimmediate_operand" "%0"))
7435 (sign_extend:TI (match_operand:DI 2 "nonimmediate_operand" "rm"))))
7436 (clobber (reg:CC 17))]
7438 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7440 [(set_attr "type" "imul")
7441 (set_attr "length_immediate" "0")
7442 (set (attr "athlon_decode")
7443 (if_then_else (eq_attr "cpu" "athlon")
7444 (const_string "vector")
7445 (const_string "double")))
7446 (set_attr "mode" "DI")])
7448 (define_expand "mulsidi3"
7449 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7450 (mult:DI (sign_extend:DI
7451 (match_operand:SI 1 "nonimmediate_operand" ""))
7453 (match_operand:SI 2 "register_operand" ""))))
7454 (clobber (reg:CC 17))])]
7458 (define_insn "*mulsidi3_insn"
7459 [(set (match_operand:DI 0 "register_operand" "=A")
7460 (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0"))
7461 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))
7462 (clobber (reg:CC 17))]
7464 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7466 [(set_attr "type" "imul")
7467 (set_attr "length_immediate" "0")
7468 (set (attr "athlon_decode")
7469 (if_then_else (eq_attr "cpu" "athlon")
7470 (const_string "vector")
7471 (const_string "double")))
7472 (set_attr "mode" "SI")])
7474 (define_expand "umuldi3_highpart"
7475 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7478 (mult:TI (zero_extend:TI
7479 (match_operand:DI 1 "nonimmediate_operand" ""))
7481 (match_operand:DI 2 "register_operand" "")))
7483 (clobber (match_scratch:DI 3 ""))
7484 (clobber (reg:CC 17))])]
7488 (define_insn "*umuldi3_highpart_rex64"
7489 [(set (match_operand:DI 0 "register_operand" "=d")
7492 (mult:TI (zero_extend:TI
7493 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7495 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7497 (clobber (match_scratch:DI 3 "=1"))
7498 (clobber (reg:CC 17))]
7500 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7502 [(set_attr "type" "imul")
7503 (set_attr "ppro_uops" "few")
7504 (set_attr "length_immediate" "0")
7505 (set (attr "athlon_decode")
7506 (if_then_else (eq_attr "cpu" "athlon")
7507 (const_string "vector")
7508 (const_string "double")))
7509 (set_attr "mode" "DI")])
7511 (define_expand "umulsi3_highpart"
7512 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7515 (mult:DI (zero_extend:DI
7516 (match_operand:SI 1 "nonimmediate_operand" ""))
7518 (match_operand:SI 2 "register_operand" "")))
7520 (clobber (match_scratch:SI 3 ""))
7521 (clobber (reg:CC 17))])]
7525 (define_insn "*umulsi3_highpart_insn"
7526 [(set (match_operand:SI 0 "register_operand" "=d")
7529 (mult:DI (zero_extend:DI
7530 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7532 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7534 (clobber (match_scratch:SI 3 "=1"))
7535 (clobber (reg:CC 17))]
7536 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7538 [(set_attr "type" "imul")
7539 (set_attr "ppro_uops" "few")
7540 (set_attr "length_immediate" "0")
7541 (set (attr "athlon_decode")
7542 (if_then_else (eq_attr "cpu" "athlon")
7543 (const_string "vector")
7544 (const_string "double")))
7545 (set_attr "mode" "SI")])
7547 (define_insn "*umulsi3_highpart_zext"
7548 [(set (match_operand:DI 0 "register_operand" "=d")
7549 (zero_extend:DI (truncate:SI
7551 (mult:DI (zero_extend:DI
7552 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7554 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7556 (clobber (match_scratch:SI 3 "=1"))
7557 (clobber (reg:CC 17))]
7559 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7561 [(set_attr "type" "imul")
7562 (set_attr "ppro_uops" "few")
7563 (set_attr "length_immediate" "0")
7564 (set (attr "athlon_decode")
7565 (if_then_else (eq_attr "cpu" "athlon")
7566 (const_string "vector")
7567 (const_string "double")))
7568 (set_attr "mode" "SI")])
7570 (define_expand "smuldi3_highpart"
7571 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
7574 (mult:TI (sign_extend:TI
7575 (match_operand:DI 1 "nonimmediate_operand" ""))
7577 (match_operand:DI 2 "register_operand" "")))
7579 (clobber (match_scratch:DI 3 ""))
7580 (clobber (reg:CC 17))])]
7584 (define_insn "*smuldi3_highpart_rex64"
7585 [(set (match_operand:DI 0 "register_operand" "=d")
7588 (mult:TI (sign_extend:TI
7589 (match_operand:DI 1 "nonimmediate_operand" "%a"))
7591 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7593 (clobber (match_scratch:DI 3 "=1"))
7594 (clobber (reg:CC 17))]
7596 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7598 [(set_attr "type" "imul")
7599 (set_attr "ppro_uops" "few")
7600 (set (attr "athlon_decode")
7601 (if_then_else (eq_attr "cpu" "athlon")
7602 (const_string "vector")
7603 (const_string "double")))
7604 (set_attr "mode" "DI")])
7606 (define_expand "smulsi3_highpart"
7607 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7610 (mult:DI (sign_extend:DI
7611 (match_operand:SI 1 "nonimmediate_operand" ""))
7613 (match_operand:SI 2 "register_operand" "")))
7615 (clobber (match_scratch:SI 3 ""))
7616 (clobber (reg:CC 17))])]
7620 (define_insn "*smulsi3_highpart_insn"
7621 [(set (match_operand:SI 0 "register_operand" "=d")
7624 (mult:DI (sign_extend:DI
7625 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7627 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7629 (clobber (match_scratch:SI 3 "=1"))
7630 (clobber (reg:CC 17))]
7631 "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM"
7633 [(set_attr "type" "imul")
7634 (set_attr "ppro_uops" "few")
7635 (set (attr "athlon_decode")
7636 (if_then_else (eq_attr "cpu" "athlon")
7637 (const_string "vector")
7638 (const_string "double")))
7639 (set_attr "mode" "SI")])
7641 (define_insn "*smulsi3_highpart_zext"
7642 [(set (match_operand:DI 0 "register_operand" "=d")
7643 (zero_extend:DI (truncate:SI
7645 (mult:DI (sign_extend:DI
7646 (match_operand:SI 1 "nonimmediate_operand" "%a"))
7648 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7650 (clobber (match_scratch:SI 3 "=1"))
7651 (clobber (reg:CC 17))]
7653 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
7655 [(set_attr "type" "imul")
7656 (set_attr "ppro_uops" "few")
7657 (set (attr "athlon_decode")
7658 (if_then_else (eq_attr "cpu" "athlon")
7659 (const_string "vector")
7660 (const_string "double")))
7661 (set_attr "mode" "SI")])
7663 ;; The patterns that match these are at the end of this file.
7665 (define_expand "mulxf3"
7666 [(set (match_operand:XF 0 "register_operand" "")
7667 (mult:XF (match_operand:XF 1 "register_operand" "")
7668 (match_operand:XF 2 "register_operand" "")))]
7669 "!TARGET_64BIT && TARGET_80387"
7672 (define_expand "multf3"
7673 [(set (match_operand:TF 0 "register_operand" "")
7674 (mult:TF (match_operand:TF 1 "register_operand" "")
7675 (match_operand:TF 2 "register_operand" "")))]
7679 (define_expand "muldf3"
7680 [(set (match_operand:DF 0 "register_operand" "")
7681 (mult:DF (match_operand:DF 1 "register_operand" "")
7682 (match_operand:DF 2 "nonimmediate_operand" "")))]
7683 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7686 (define_expand "mulsf3"
7687 [(set (match_operand:SF 0 "register_operand" "")
7688 (mult:SF (match_operand:SF 1 "register_operand" "")
7689 (match_operand:SF 2 "nonimmediate_operand" "")))]
7690 "TARGET_80387 || TARGET_SSE_MATH"
7693 ;; Divide instructions
7695 (define_insn "divqi3"
7696 [(set (match_operand:QI 0 "register_operand" "=a")
7697 (div:QI (match_operand:HI 1 "register_operand" "0")
7698 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7699 (clobber (reg:CC 17))]
7700 "TARGET_QIMODE_MATH"
7702 [(set_attr "type" "idiv")
7703 (set_attr "mode" "QI")
7704 (set_attr "ppro_uops" "few")])
7706 (define_insn "udivqi3"
7707 [(set (match_operand:QI 0 "register_operand" "=a")
7708 (udiv:QI (match_operand:HI 1 "register_operand" "0")
7709 (match_operand:QI 2 "nonimmediate_operand" "qm")))
7710 (clobber (reg:CC 17))]
7711 "TARGET_QIMODE_MATH"
7713 [(set_attr "type" "idiv")
7714 (set_attr "mode" "QI")
7715 (set_attr "ppro_uops" "few")])
7717 ;; The patterns that match these are at the end of this file.
7719 (define_expand "divxf3"
7720 [(set (match_operand:XF 0 "register_operand" "")
7721 (div:XF (match_operand:XF 1 "register_operand" "")
7722 (match_operand:XF 2 "register_operand" "")))]
7723 "!TARGET_64BIT && TARGET_80387"
7726 (define_expand "divtf3"
7727 [(set (match_operand:TF 0 "register_operand" "")
7728 (div:TF (match_operand:TF 1 "register_operand" "")
7729 (match_operand:TF 2 "register_operand" "")))]
7733 (define_expand "divdf3"
7734 [(set (match_operand:DF 0 "register_operand" "")
7735 (div:DF (match_operand:DF 1 "register_operand" "")
7736 (match_operand:DF 2 "nonimmediate_operand" "")))]
7737 "TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
7740 (define_expand "divsf3"
7741 [(set (match_operand:SF 0 "register_operand" "")
7742 (div:SF (match_operand:SF 1 "register_operand" "")
7743 (match_operand:SF 2 "nonimmediate_operand" "")))]
7744 "TARGET_80387 || TARGET_SSE_MATH"
7747 ;; Remainder instructions.
7749 (define_expand "divmoddi4"
7750 [(parallel [(set (match_operand:DI 0 "register_operand" "")
7751 (div:DI (match_operand:DI 1 "register_operand" "")
7752 (match_operand:DI 2 "nonimmediate_operand" "")))
7753 (set (match_operand:DI 3 "register_operand" "")
7754 (mod:DI (match_dup 1) (match_dup 2)))
7755 (clobber (reg:CC 17))])]
7759 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7760 ;; Penalize eax case slightly because it results in worse scheduling
7762 (define_insn "*divmoddi4_nocltd_rex64"
7763 [(set (match_operand:DI 0 "register_operand" "=&a,?a")
7764 (div:DI (match_operand:DI 2 "register_operand" "1,0")
7765 (match_operand:DI 3 "nonimmediate_operand" "rm,rm")))
7766 (set (match_operand:DI 1 "register_operand" "=&d,&d")
7767 (mod:DI (match_dup 2) (match_dup 3)))
7768 (clobber (reg:CC 17))]
7769 "TARGET_64BIT && !optimize_size && !TARGET_USE_CLTD"
7771 [(set_attr "type" "multi")])
7773 (define_insn "*divmoddi4_cltd_rex64"
7774 [(set (match_operand:DI 0 "register_operand" "=a")
7775 (div:DI (match_operand:DI 2 "register_operand" "a")
7776 (match_operand:DI 3 "nonimmediate_operand" "rm")))
7777 (set (match_operand:DI 1 "register_operand" "=&d")
7778 (mod:DI (match_dup 2) (match_dup 3)))
7779 (clobber (reg:CC 17))]
7780 "TARGET_64BIT && (optimize_size || TARGET_USE_CLTD)"
7782 [(set_attr "type" "multi")])
7784 (define_insn "*divmoddi_noext_rex64"
7785 [(set (match_operand:DI 0 "register_operand" "=a")
7786 (div:DI (match_operand:DI 1 "register_operand" "0")
7787 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7788 (set (match_operand:DI 3 "register_operand" "=d")
7789 (mod:DI (match_dup 1) (match_dup 2)))
7790 (use (match_operand:DI 4 "register_operand" "3"))
7791 (clobber (reg:CC 17))]
7794 [(set_attr "type" "idiv")
7795 (set_attr "mode" "DI")
7796 (set_attr "ppro_uops" "few")])
7799 [(set (match_operand:DI 0 "register_operand" "")
7800 (div:DI (match_operand:DI 1 "register_operand" "")
7801 (match_operand:DI 2 "nonimmediate_operand" "")))
7802 (set (match_operand:DI 3 "register_operand" "")
7803 (mod:DI (match_dup 1) (match_dup 2)))
7804 (clobber (reg:CC 17))]
7805 "TARGET_64BIT && reload_completed"
7806 [(parallel [(set (match_dup 3)
7807 (ashiftrt:DI (match_dup 4) (const_int 63)))
7808 (clobber (reg:CC 17))])
7809 (parallel [(set (match_dup 0)
7810 (div:DI (reg:DI 0) (match_dup 2)))
7812 (mod:DI (reg:DI 0) (match_dup 2)))
7814 (clobber (reg:CC 17))])]
7816 /* Avoid use of cltd in favor of a mov+shift. */
7817 if (!TARGET_USE_CLTD && !optimize_size)
7819 if (true_regnum (operands[1]))
7820 emit_move_insn (operands[0], operands[1]);
7822 emit_move_insn (operands[3], operands[1]);
7823 operands[4] = operands[3];
7827 if (true_regnum (operands[1]))
7829 operands[4] = operands[1];
7834 (define_expand "divmodsi4"
7835 [(parallel [(set (match_operand:SI 0 "register_operand" "")
7836 (div:SI (match_operand:SI 1 "register_operand" "")
7837 (match_operand:SI 2 "nonimmediate_operand" "")))
7838 (set (match_operand:SI 3 "register_operand" "")
7839 (mod:SI (match_dup 1) (match_dup 2)))
7840 (clobber (reg:CC 17))])]
7844 ;; Allow to come the parameter in eax or edx to avoid extra moves.
7845 ;; Penalize eax case slightly because it results in worse scheduling
7847 (define_insn "*divmodsi4_nocltd"
7848 [(set (match_operand:SI 0 "register_operand" "=&a,?a")
7849 (div:SI (match_operand:SI 2 "register_operand" "1,0")
7850 (match_operand:SI 3 "nonimmediate_operand" "rm,rm")))
7851 (set (match_operand:SI 1 "register_operand" "=&d,&d")
7852 (mod:SI (match_dup 2) (match_dup 3)))
7853 (clobber (reg:CC 17))]
7854 "!optimize_size && !TARGET_USE_CLTD"
7856 [(set_attr "type" "multi")])
7858 (define_insn "*divmodsi4_cltd"
7859 [(set (match_operand:SI 0 "register_operand" "=a")
7860 (div:SI (match_operand:SI 2 "register_operand" "a")
7861 (match_operand:SI 3 "nonimmediate_operand" "rm")))
7862 (set (match_operand:SI 1 "register_operand" "=&d")
7863 (mod:SI (match_dup 2) (match_dup 3)))
7864 (clobber (reg:CC 17))]
7865 "optimize_size || TARGET_USE_CLTD"
7867 [(set_attr "type" "multi")])
7869 (define_insn "*divmodsi_noext"
7870 [(set (match_operand:SI 0 "register_operand" "=a")
7871 (div:SI (match_operand:SI 1 "register_operand" "0")
7872 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7873 (set (match_operand:SI 3 "register_operand" "=d")
7874 (mod:SI (match_dup 1) (match_dup 2)))
7875 (use (match_operand:SI 4 "register_operand" "3"))
7876 (clobber (reg:CC 17))]
7879 [(set_attr "type" "idiv")
7880 (set_attr "mode" "SI")
7881 (set_attr "ppro_uops" "few")])
7884 [(set (match_operand:SI 0 "register_operand" "")
7885 (div:SI (match_operand:SI 1 "register_operand" "")
7886 (match_operand:SI 2 "nonimmediate_operand" "")))
7887 (set (match_operand:SI 3 "register_operand" "")
7888 (mod:SI (match_dup 1) (match_dup 2)))
7889 (clobber (reg:CC 17))]
7891 [(parallel [(set (match_dup 3)
7892 (ashiftrt:SI (match_dup 4) (const_int 31)))
7893 (clobber (reg:CC 17))])
7894 (parallel [(set (match_dup 0)
7895 (div:SI (reg:SI 0) (match_dup 2)))
7897 (mod:SI (reg:SI 0) (match_dup 2)))
7899 (clobber (reg:CC 17))])]
7901 /* Avoid use of cltd in favor of a mov+shift. */
7902 if (!TARGET_USE_CLTD && !optimize_size)
7904 if (true_regnum (operands[1]))
7905 emit_move_insn (operands[0], operands[1]);
7907 emit_move_insn (operands[3], operands[1]);
7908 operands[4] = operands[3];
7912 if (true_regnum (operands[1]))
7914 operands[4] = operands[1];
7918 (define_insn "divmodhi4"
7919 [(set (match_operand:HI 0 "register_operand" "=a")
7920 (div:HI (match_operand:HI 1 "register_operand" "0")
7921 (match_operand:HI 2 "nonimmediate_operand" "rm")))
7922 (set (match_operand:HI 3 "register_operand" "=&d")
7923 (mod:HI (match_dup 1) (match_dup 2)))
7924 (clobber (reg:CC 17))]
7925 "TARGET_HIMODE_MATH"
7927 [(set_attr "type" "multi")
7928 (set_attr "length_immediate" "0")
7929 (set_attr "mode" "SI")])
7931 (define_insn "udivmoddi4"
7932 [(set (match_operand:DI 0 "register_operand" "=a")
7933 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7934 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7935 (set (match_operand:DI 3 "register_operand" "=&d")
7936 (umod:DI (match_dup 1) (match_dup 2)))
7937 (clobber (reg:CC 17))]
7939 "xor{q}\t%3, %3\;div{q}\t%2"
7940 [(set_attr "type" "multi")
7941 (set_attr "length_immediate" "0")
7942 (set_attr "mode" "DI")])
7944 (define_insn "*udivmoddi4_noext"
7945 [(set (match_operand:DI 0 "register_operand" "=a")
7946 (udiv:DI (match_operand:DI 1 "register_operand" "0")
7947 (match_operand:DI 2 "nonimmediate_operand" "rm")))
7948 (set (match_operand:DI 3 "register_operand" "=d")
7949 (umod:DI (match_dup 1) (match_dup 2)))
7951 (clobber (reg:CC 17))]
7954 [(set_attr "type" "idiv")
7955 (set_attr "ppro_uops" "few")
7956 (set_attr "mode" "DI")])
7959 [(set (match_operand:DI 0 "register_operand" "")
7960 (udiv:DI (match_operand:DI 1 "register_operand" "")
7961 (match_operand:DI 2 "nonimmediate_operand" "")))
7962 (set (match_operand:DI 3 "register_operand" "")
7963 (umod:DI (match_dup 1) (match_dup 2)))
7964 (clobber (reg:CC 17))]
7965 "TARGET_64BIT && reload_completed"
7966 [(set (match_dup 3) (const_int 0))
7967 (parallel [(set (match_dup 0)
7968 (udiv:DI (match_dup 1) (match_dup 2)))
7970 (umod:DI (match_dup 1) (match_dup 2)))
7972 (clobber (reg:CC 17))])]
7975 (define_insn "udivmodsi4"
7976 [(set (match_operand:SI 0 "register_operand" "=a")
7977 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7978 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7979 (set (match_operand:SI 3 "register_operand" "=&d")
7980 (umod:SI (match_dup 1) (match_dup 2)))
7981 (clobber (reg:CC 17))]
7983 "xor{l}\t%3, %3\;div{l}\t%2"
7984 [(set_attr "type" "multi")
7985 (set_attr "length_immediate" "0")
7986 (set_attr "mode" "SI")])
7988 (define_insn "*udivmodsi4_noext"
7989 [(set (match_operand:SI 0 "register_operand" "=a")
7990 (udiv:SI (match_operand:SI 1 "register_operand" "0")
7991 (match_operand:SI 2 "nonimmediate_operand" "rm")))
7992 (set (match_operand:SI 3 "register_operand" "=d")
7993 (umod:SI (match_dup 1) (match_dup 2)))
7995 (clobber (reg:CC 17))]
7998 [(set_attr "type" "idiv")
7999 (set_attr "ppro_uops" "few")
8000 (set_attr "mode" "SI")])
8003 [(set (match_operand:SI 0 "register_operand" "")
8004 (udiv:SI (match_operand:SI 1 "register_operand" "")
8005 (match_operand:SI 2 "nonimmediate_operand" "")))
8006 (set (match_operand:SI 3 "register_operand" "")
8007 (umod:SI (match_dup 1) (match_dup 2)))
8008 (clobber (reg:CC 17))]
8010 [(set (match_dup 3) (const_int 0))
8011 (parallel [(set (match_dup 0)
8012 (udiv:SI (match_dup 1) (match_dup 2)))
8014 (umod:SI (match_dup 1) (match_dup 2)))
8016 (clobber (reg:CC 17))])]
8019 (define_expand "udivmodhi4"
8020 [(set (match_dup 4) (const_int 0))
8021 (parallel [(set (match_operand:HI 0 "register_operand" "")
8022 (udiv:HI (match_operand:HI 1 "register_operand" "")
8023 (match_operand:HI 2 "nonimmediate_operand" "")))
8024 (set (match_operand:HI 3 "register_operand" "")
8025 (umod:HI (match_dup 1) (match_dup 2)))
8027 (clobber (reg:CC 17))])]
8028 "TARGET_HIMODE_MATH"
8029 "operands[4] = gen_reg_rtx (HImode);")
8031 (define_insn "*udivmodhi_noext"
8032 [(set (match_operand:HI 0 "register_operand" "=a")
8033 (udiv:HI (match_operand:HI 1 "register_operand" "0")
8034 (match_operand:HI 2 "nonimmediate_operand" "rm")))
8035 (set (match_operand:HI 3 "register_operand" "=d")
8036 (umod:HI (match_dup 1) (match_dup 2)))
8037 (use (match_operand:HI 4 "register_operand" "3"))
8038 (clobber (reg:CC 17))]
8041 [(set_attr "type" "idiv")
8042 (set_attr "mode" "HI")
8043 (set_attr "ppro_uops" "few")])
8045 ;; We can not use div/idiv for double division, because it causes
8046 ;; "division by zero" on the overflow and that's not what we expect
8047 ;; from truncate. Because true (non truncating) double division is
8048 ;; never generated, we can't create this insn anyway.
8051 ; [(set (match_operand:SI 0 "register_operand" "=a")
8053 ; (udiv:DI (match_operand:DI 1 "register_operand" "A")
8055 ; (match_operand:SI 2 "nonimmediate_operand" "rm")))))
8056 ; (set (match_operand:SI 3 "register_operand" "=d")
8058 ; (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
8059 ; (clobber (reg:CC 17))]
8061 ; "div{l}\t{%2, %0|%0, %2}"
8062 ; [(set_attr "type" "idiv")
8063 ; (set_attr "ppro_uops" "few")])
8065 ;;- Logical AND instructions
8067 ;; On Pentium, "test imm, reg" is pairable only with eax, ax, and al.
8068 ;; Note that this excludes ah.
8070 (define_insn "*testdi_1_rex64"
8073 (and:DI (match_operand:DI 0 "nonimmediate_operand" "%*a,r,*a,r,rm")
8074 (match_operand:DI 1 "x86_64_szext_nonmemory_operand" "Z,Z,e,e,re"))
8076 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
8078 test{l}\t{%k1, %k0|%k0, %k1}
8079 test{l}\t{%k1, %k0|%k0, %k1}
8080 test{q}\t{%1, %0|%0, %1}
8081 test{q}\t{%1, %0|%0, %1}
8082 test{q}\t{%1, %0|%0, %1}"
8083 [(set_attr "type" "test")
8084 (set_attr "modrm" "0,1,0,1,1")
8085 (set_attr "mode" "SI,SI,DI,DI,DI")
8086 (set_attr "pent_pair" "uv,np,uv,np,uv")])
8088 (define_insn "testsi_1"
8091 (and:SI (match_operand:SI 0 "nonimmediate_operand" "%*a,r,rm")
8092 (match_operand:SI 1 "nonmemory_operand" "in,in,rin"))
8094 "ix86_match_ccmode (insn, CCNOmode)"
8095 "test{l}\t{%1, %0|%0, %1}"
8096 [(set_attr "type" "test")
8097 (set_attr "modrm" "0,1,1")
8098 (set_attr "mode" "SI")
8099 (set_attr "pent_pair" "uv,np,uv")])
8101 (define_expand "testsi_ccno_1"
8104 (and:SI (match_operand:SI 0 "nonimmediate_operand" "")
8105 (match_operand:SI 1 "nonmemory_operand" ""))
8110 (define_insn "*testhi_1"
8112 (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%*a,r,rm")
8113 (match_operand:HI 1 "nonmemory_operand" "n,n,rn"))
8115 "ix86_match_ccmode (insn, CCNOmode)"
8116 "test{w}\t{%1, %0|%0, %1}"
8117 [(set_attr "type" "test")
8118 (set_attr "modrm" "0,1,1")
8119 (set_attr "mode" "HI")
8120 (set_attr "pent_pair" "uv,np,uv")])
8122 (define_expand "testqi_ccz_1"
8124 (compare:CCZ (and:QI (match_operand:QI 0 "nonimmediate_operand" "")
8125 (match_operand:QI 1 "nonmemory_operand" ""))
8130 (define_insn "*testqi_1"
8132 (compare (and:QI (match_operand:QI 0 "nonimmediate_operand" "%*a,q,qm,r")
8133 (match_operand:QI 1 "nonmemory_operand" "n,n,qn,n"))
8135 "ix86_match_ccmode (insn, CCNOmode)"
8137 if (which_alternative == 3)
8139 if (GET_CODE (operands[1]) == CONST_INT
8140 && (INTVAL (operands[1]) & 0xffffff00))
8141 operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
8142 return "test{l}\t{%1, %k0|%k0, %1}";
8144 return "test{b}\t{%1, %0|%0, %1}";
8146 [(set_attr "type" "test")
8147 (set_attr "modrm" "0,1,1,1")
8148 (set_attr "mode" "QI,QI,QI,SI")
8149 (set_attr "pent_pair" "uv,np,uv,np")])
8151 (define_expand "testqi_ext_ccno_0"
8156 (match_operand 0 "ext_register_operand" "")
8159 (match_operand 1 "const_int_operand" ""))
8164 (define_insn "*testqi_ext_0"
8169 (match_operand 0 "ext_register_operand" "Q")
8172 (match_operand 1 "const_int_operand" "n"))
8174 "ix86_match_ccmode (insn, CCNOmode)"
8175 "test{b}\t{%1, %h0|%h0, %1}"
8176 [(set_attr "type" "test")
8177 (set_attr "mode" "QI")
8178 (set_attr "length_immediate" "1")
8179 (set_attr "pent_pair" "np")])
8181 (define_insn "*testqi_ext_1"
8186 (match_operand 0 "ext_register_operand" "Q")
8190 (match_operand:QI 1 "nonimmediate_operand" "Qm")))
8192 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
8193 "test{b}\t{%1, %h0|%h0, %1}"
8194 [(set_attr "type" "test")
8195 (set_attr "mode" "QI")])
8197 (define_insn "*testqi_ext_1_rex64"
8202 (match_operand 0 "ext_register_operand" "Q")
8206 (match_operand:QI 1 "register_operand" "Q")))
8208 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
8209 "test{b}\t{%1, %h0|%h0, %1}"
8210 [(set_attr "type" "test")
8211 (set_attr "mode" "QI")])
8213 (define_insn "*testqi_ext_2"
8218 (match_operand 0 "ext_register_operand" "Q")
8222 (match_operand 1 "ext_register_operand" "Q")
8226 "ix86_match_ccmode (insn, CCNOmode)"
8227 "test{b}\t{%h1, %h0|%h0, %h1}"
8228 [(set_attr "type" "test")
8229 (set_attr "mode" "QI")])
8231 ;; Combine likes to form bit extractions for some tests. Humor it.
8232 (define_insn "*testqi_ext_3"
8234 (compare (zero_extract:SI
8235 (match_operand 0 "nonimmediate_operand" "rm")
8236 (match_operand:SI 1 "const_int_operand" "")
8237 (match_operand:SI 2 "const_int_operand" ""))
8239 "ix86_match_ccmode (insn, CCNOmode)
8240 && (GET_MODE (operands[0]) == SImode
8241 || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)
8242 || GET_MODE (operands[0]) == HImode
8243 || GET_MODE (operands[0]) == QImode)"
8246 (define_insn "*testqi_ext_3_rex64"
8248 (compare (zero_extract:DI
8249 (match_operand 0 "nonimmediate_operand" "rm")
8250 (match_operand:DI 1 "const_int_operand" "")
8251 (match_operand:DI 2 "const_int_operand" ""))
8254 && ix86_match_ccmode (insn, CCNOmode)
8255 /* The code below cannot deal with constants outside HOST_WIDE_INT. */
8256 && INTVAL (operands[1]) + INTVAL (operands[2]) < HOST_BITS_PER_WIDE_INT
8257 /* Ensure that resulting mask is zero or sign extended operand. */
8258 && (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
8259 || (INTVAL (operands[1]) + INTVAL (operands[2]) == 64
8260 && INTVAL (operands[1]) > 32))
8261 && (GET_MODE (operands[0]) == SImode
8262 || GET_MODE (operands[0]) == DImode
8263 || GET_MODE (operands[0]) == HImode
8264 || GET_MODE (operands[0]) == QImode)"
8269 (compare (zero_extract
8270 (match_operand 0 "nonimmediate_operand" "")
8271 (match_operand 1 "const_int_operand" "")
8272 (match_operand 2 "const_int_operand" ""))
8274 "ix86_match_ccmode (insn, CCNOmode)"
8275 [(set (reg:CCNO 17) (compare:CCNO (match_dup 3) (const_int 0)))]
8277 HOST_WIDE_INT len = INTVAL (operands[1]);
8278 HOST_WIDE_INT pos = INTVAL (operands[2]);
8280 enum machine_mode mode, submode;
8282 mode = GET_MODE (operands[0]);
8283 if (GET_CODE (operands[0]) == MEM)
8285 /* ??? Combine likes to put non-volatile mem extractions in QImode
8286 no matter the size of the test. So find a mode that works. */
8287 if (! MEM_VOLATILE_P (operands[0]))
8289 mode = smallest_mode_for_size (pos + len, MODE_INT);
8290 operands[0] = adjust_address (operands[0], mode, 0);
8293 else if (GET_CODE (operands[0]) == SUBREG
8294 && (submode = GET_MODE (SUBREG_REG (operands[0])),
8295 GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode))
8296 && pos + len <= GET_MODE_BITSIZE (submode))
8298 /* Narrow a paradoxical subreg to prevent partial register stalls. */
8300 operands[0] = SUBREG_REG (operands[0]);
8302 else if (mode == HImode && pos + len <= 8)
8304 /* Small HImode tests can be converted to QImode. */
8306 operands[0] = gen_lowpart (QImode, operands[0]);
8309 mask = ((HOST_WIDE_INT)1 << (pos + len)) - 1;
8310 mask &= ~(((HOST_WIDE_INT)1 << pos) - 1);
8312 operands[3] = gen_rtx_AND (mode, operands[0], gen_int_mode (mask, mode));
8315 ;; Convert HImode/SImode test instructions with immediate to QImode ones.
8316 ;; i386 does not allow to encode test with 8bit sign extended immediate, so
8317 ;; this is relatively important trick.
8318 ;; Do the conversion only post-reload to avoid limiting of the register class
8323 (and (match_operand 0 "register_operand" "")
8324 (match_operand 1 "const_int_operand" ""))
8327 && QI_REG_P (operands[0])
8328 && ((ix86_match_ccmode (insn, CCZmode)
8329 && !(INTVAL (operands[1]) & ~(255 << 8)))
8330 || (ix86_match_ccmode (insn, CCNOmode)
8331 && !(INTVAL (operands[1]) & ~(127 << 8))))
8332 && GET_MODE (operands[0]) != QImode"
8335 (and:SI (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8338 "operands[0] = gen_lowpart (SImode, operands[0]);
8339 operands[1] = gen_int_mode (INTVAL (operands[1]) >> 8, SImode);")
8344 (and (match_operand 0 "nonimmediate_operand" "")
8345 (match_operand 1 "const_int_operand" ""))
8348 && (!REG_P (operands[0]) || ANY_QI_REG_P (operands[0]))
8349 && ((ix86_match_ccmode (insn, CCZmode)
8350 && !(INTVAL (operands[1]) & ~255))
8351 || (ix86_match_ccmode (insn, CCNOmode)
8352 && !(INTVAL (operands[1]) & ~127)))
8353 && GET_MODE (operands[0]) != QImode"
8356 (and:QI (match_dup 0)
8359 "operands[0] = gen_lowpart (QImode, operands[0]);
8360 operands[1] = gen_lowpart (QImode, operands[1]);")
8363 ;; %%% This used to optimize known byte-wide and operations to memory,
8364 ;; and sometimes to QImode registers. If this is considered useful,
8365 ;; it should be done with splitters.
8367 (define_expand "anddi3"
8368 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8369 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
8370 (match_operand:DI 2 "x86_64_szext_general_operand" "")))
8371 (clobber (reg:CC 17))]
8373 "ix86_expand_binary_operator (AND, DImode, operands); DONE;")
8375 (define_insn "*anddi_1_rex64"
8376 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r,r")
8377 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,qm")
8378 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,re,rm,L")))
8379 (clobber (reg:CC 17))]
8380 "TARGET_64BIT && ix86_binary_operator_ok (AND, DImode, operands)"
8382 switch (get_attr_type (insn))
8386 enum machine_mode mode;
8388 if (GET_CODE (operands[2]) != CONST_INT)
8390 if (INTVAL (operands[2]) == 0xff)
8392 else if (INTVAL (operands[2]) == 0xffff)
8397 operands[1] = gen_lowpart (mode, operands[1]);
8399 return "movz{bq|x}\t{%1,%0|%0, %1}";
8401 return "movz{wq|x}\t{%1,%0|%0, %1}";
8405 if (! rtx_equal_p (operands[0], operands[1]))
8407 if (get_attr_mode (insn) == MODE_SI)
8408 return "and{l}\t{%k2, %k0|%k0, %k2}";
8410 return "and{q}\t{%2, %0|%0, %2}";
8413 [(set_attr "type" "alu,alu,alu,imovx")
8414 (set_attr "length_immediate" "*,*,*,0")
8415 (set_attr "mode" "SI,DI,DI,DI")])
8417 (define_insn "*anddi_2"
8419 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
8420 (match_operand:DI 2 "x86_64_szext_general_operand" "Z,rem,re"))
8422 (set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm")
8423 (and:DI (match_dup 1) (match_dup 2)))]
8424 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8425 && ix86_binary_operator_ok (AND, DImode, operands)"
8427 and{l}\t{%k2, %k0|%k0, %k2}
8428 and{q}\t{%2, %0|%0, %2}
8429 and{q}\t{%2, %0|%0, %2}"
8430 [(set_attr "type" "alu")
8431 (set_attr "mode" "SI,DI,DI")])
8433 (define_expand "andsi3"
8434 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8435 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
8436 (match_operand:SI 2 "general_operand" "")))
8437 (clobber (reg:CC 17))]
8439 "ix86_expand_binary_operator (AND, SImode, operands); DONE;")
8441 (define_insn "*andsi_1"
8442 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r,r")
8443 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,qm")
8444 (match_operand:SI 2 "general_operand" "ri,rm,L")))
8445 (clobber (reg:CC 17))]
8446 "ix86_binary_operator_ok (AND, SImode, operands)"
8448 switch (get_attr_type (insn))
8452 enum machine_mode mode;
8454 if (GET_CODE (operands[2]) != CONST_INT)
8456 if (INTVAL (operands[2]) == 0xff)
8458 else if (INTVAL (operands[2]) == 0xffff)
8463 operands[1] = gen_lowpart (mode, operands[1]);
8465 return "movz{bl|x}\t{%1,%0|%0, %1}";
8467 return "movz{wl|x}\t{%1,%0|%0, %1}";
8471 if (! rtx_equal_p (operands[0], operands[1]))
8473 return "and{l}\t{%2, %0|%0, %2}";
8476 [(set_attr "type" "alu,alu,imovx")
8477 (set_attr "length_immediate" "*,*,0")
8478 (set_attr "mode" "SI")])
8481 [(set (match_operand 0 "register_operand" "")
8483 (const_int -65536)))
8484 (clobber (reg:CC 17))]
8485 "optimize_size || (TARGET_FAST_PREFIX && !TARGET_PARTIAL_REG_STALL)"
8486 [(set (strict_low_part (match_dup 1)) (const_int 0))]
8487 "operands[1] = gen_lowpart (HImode, operands[0]);")
8490 [(set (match_operand 0 "ext_register_operand" "")
8493 (clobber (reg:CC 17))]
8494 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
8495 [(set (strict_low_part (match_dup 1)) (const_int 0))]
8496 "operands[1] = gen_lowpart (QImode, operands[0]);")
8499 [(set (match_operand 0 "ext_register_operand" "")
8501 (const_int -65281)))
8502 (clobber (reg:CC 17))]
8503 "(optimize_size || !TARGET_PARTIAL_REG_STALL) && reload_completed"
8504 [(parallel [(set (zero_extract:SI (match_dup 0)
8508 (zero_extract:SI (match_dup 0)
8511 (zero_extract:SI (match_dup 0)
8514 (clobber (reg:CC 17))])]
8515 "operands[0] = gen_lowpart (SImode, operands[0]);")
8517 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8518 (define_insn "*andsi_1_zext"
8519 [(set (match_operand:DI 0 "register_operand" "=r")
8521 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8522 (match_operand:SI 2 "general_operand" "rim"))))
8523 (clobber (reg:CC 17))]
8524 "TARGET_64BIT && ix86_binary_operator_ok (AND, SImode, operands)"
8525 "and{l}\t{%2, %k0|%k0, %2}"
8526 [(set_attr "type" "alu")
8527 (set_attr "mode" "SI")])
8529 (define_insn "*andsi_2"
8531 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8532 (match_operand:SI 2 "general_operand" "rim,ri"))
8534 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8535 (and:SI (match_dup 1) (match_dup 2)))]
8536 "ix86_match_ccmode (insn, CCNOmode)
8537 && ix86_binary_operator_ok (AND, SImode, operands)"
8538 "and{l}\t{%2, %0|%0, %2}"
8539 [(set_attr "type" "alu")
8540 (set_attr "mode" "SI")])
8542 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8543 (define_insn "*andsi_2_zext"
8545 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8546 (match_operand:SI 2 "general_operand" "rim"))
8548 (set (match_operand:DI 0 "register_operand" "=r")
8549 (zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))]
8550 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8551 && ix86_binary_operator_ok (AND, SImode, operands)"
8552 "and{l}\t{%2, %k0|%k0, %2}"
8553 [(set_attr "type" "alu")
8554 (set_attr "mode" "SI")])
8556 (define_expand "andhi3"
8557 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8558 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
8559 (match_operand:HI 2 "general_operand" "")))
8560 (clobber (reg:CC 17))]
8561 "TARGET_HIMODE_MATH"
8562 "ix86_expand_binary_operator (AND, HImode, operands); DONE;")
8564 (define_insn "*andhi_1"
8565 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r")
8566 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm")
8567 (match_operand:HI 2 "general_operand" "ri,rm,L")))
8568 (clobber (reg:CC 17))]
8569 "ix86_binary_operator_ok (AND, HImode, operands)"
8571 switch (get_attr_type (insn))
8574 if (GET_CODE (operands[2]) != CONST_INT)
8576 if (INTVAL (operands[2]) == 0xff)
8577 return "movz{bl|x}\t{%b1, %k0|%k0, %b1}";
8581 if (! rtx_equal_p (operands[0], operands[1]))
8584 return "and{w}\t{%2, %0|%0, %2}";
8587 [(set_attr "type" "alu,alu,imovx")
8588 (set_attr "length_immediate" "*,*,0")
8589 (set_attr "mode" "HI,HI,SI")])
8591 (define_insn "*andhi_2"
8593 (compare (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8594 (match_operand:HI 2 "general_operand" "rim,ri"))
8596 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8597 (and:HI (match_dup 1) (match_dup 2)))]
8598 "ix86_match_ccmode (insn, CCNOmode)
8599 && ix86_binary_operator_ok (AND, HImode, operands)"
8600 "and{w}\t{%2, %0|%0, %2}"
8601 [(set_attr "type" "alu")
8602 (set_attr "mode" "HI")])
8604 (define_expand "andqi3"
8605 [(set (match_operand:QI 0 "nonimmediate_operand" "")
8606 (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
8607 (match_operand:QI 2 "general_operand" "")))
8608 (clobber (reg:CC 17))]
8609 "TARGET_QIMODE_MATH"
8610 "ix86_expand_binary_operator (AND, QImode, operands); DONE;")
8612 ;; %%% Potential partial reg stall on alternative 2. What to do?
8613 (define_insn "*andqi_1"
8614 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
8615 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8616 (match_operand:QI 2 "general_operand" "qi,qmi,ri")))
8617 (clobber (reg:CC 17))]
8618 "ix86_binary_operator_ok (AND, QImode, operands)"
8620 and{b}\t{%2, %0|%0, %2}
8621 and{b}\t{%2, %0|%0, %2}
8622 and{l}\t{%k2, %k0|%k0, %k2}"
8623 [(set_attr "type" "alu")
8624 (set_attr "mode" "QI,QI,SI")])
8626 (define_insn "*andqi_1_slp"
8627 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
8628 (and:QI (match_dup 0)
8629 (match_operand:QI 1 "general_operand" "qi,qmi")))
8630 (clobber (reg:CC 17))]
8631 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8632 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8633 "and{b}\t{%1, %0|%0, %1}"
8634 [(set_attr "type" "alu1")
8635 (set_attr "mode" "QI")])
8637 (define_insn "*andqi_2"
8640 (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
8641 (match_operand:QI 2 "general_operand" "qim,qi,i"))
8643 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm,*r")
8644 (and:QI (match_dup 1) (match_dup 2)))]
8645 "ix86_match_ccmode (insn, CCNOmode)
8646 && ix86_binary_operator_ok (AND, QImode, operands)"
8648 if (which_alternative == 2)
8650 if (GET_CODE (operands[2]) == CONST_INT
8651 && (INTVAL (operands[2]) & 0xffffff00))
8652 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff);
8653 return "and{l}\t{%2, %k0|%k0, %2}";
8655 return "and{b}\t{%2, %0|%0, %2}";
8657 [(set_attr "type" "alu")
8658 (set_attr "mode" "QI,QI,SI")])
8660 (define_insn "*andqi_2_slp"
8663 (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
8664 (match_operand:QI 1 "nonimmediate_operand" "qmi,qi"))
8666 (set (strict_low_part (match_dup 0))
8667 (and:QI (match_dup 0) (match_dup 1)))]
8668 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
8669 && ix86_match_ccmode (insn, CCNOmode)
8670 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
8671 "and{b}\t{%1, %0|%0, %1}"
8672 [(set_attr "type" "alu1")
8673 (set_attr "mode" "QI")])
8675 ;; ??? A bug in recog prevents it from recognizing a const_int as an
8676 ;; operand to zero_extend in andqi_ext_1. It was checking explicitly
8677 ;; for a QImode operand, which of course failed.
8679 (define_insn "andqi_ext_0"
8680 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8685 (match_operand 1 "ext_register_operand" "0")
8688 (match_operand 2 "const_int_operand" "n")))
8689 (clobber (reg:CC 17))]
8691 "and{b}\t{%2, %h0|%h0, %2}"
8692 [(set_attr "type" "alu")
8693 (set_attr "length_immediate" "1")
8694 (set_attr "mode" "QI")])
8696 ;; Generated by peephole translating test to and. This shows up
8697 ;; often in fp comparisons.
8699 (define_insn "*andqi_ext_0_cc"
8704 (match_operand 1 "ext_register_operand" "0")
8707 (match_operand 2 "const_int_operand" "n"))
8709 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8718 "ix86_match_ccmode (insn, CCNOmode)"
8719 "and{b}\t{%2, %h0|%h0, %2}"
8720 [(set_attr "type" "alu")
8721 (set_attr "length_immediate" "1")
8722 (set_attr "mode" "QI")])
8724 (define_insn "*andqi_ext_1"
8725 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8730 (match_operand 1 "ext_register_operand" "0")
8734 (match_operand:QI 2 "general_operand" "Qm"))))
8735 (clobber (reg:CC 17))]
8737 "and{b}\t{%2, %h0|%h0, %2}"
8738 [(set_attr "type" "alu")
8739 (set_attr "length_immediate" "0")
8740 (set_attr "mode" "QI")])
8742 (define_insn "*andqi_ext_1_rex64"
8743 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8748 (match_operand 1 "ext_register_operand" "0")
8752 (match_operand 2 "ext_register_operand" "Q"))))
8753 (clobber (reg:CC 17))]
8755 "and{b}\t{%2, %h0|%h0, %2}"
8756 [(set_attr "type" "alu")
8757 (set_attr "length_immediate" "0")
8758 (set_attr "mode" "QI")])
8760 (define_insn "*andqi_ext_2"
8761 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
8766 (match_operand 1 "ext_register_operand" "%0")
8770 (match_operand 2 "ext_register_operand" "Q")
8773 (clobber (reg:CC 17))]
8775 "and{b}\t{%h2, %h0|%h0, %h2}"
8776 [(set_attr "type" "alu")
8777 (set_attr "length_immediate" "0")
8778 (set_attr "mode" "QI")])
8780 ;; Convert wide AND instructions with immediate operand to shorter QImode
8781 ;; equivalents when possible.
8782 ;; Don't do the splitting with memory operands, since it introduces risk
8783 ;; of memory mismatch stalls. We may want to do the splitting for optimizing
8784 ;; for size, but that can (should?) be handled by generic code instead.
8786 [(set (match_operand 0 "register_operand" "")
8787 (and (match_operand 1 "register_operand" "")
8788 (match_operand 2 "const_int_operand" "")))
8789 (clobber (reg:CC 17))]
8791 && QI_REG_P (operands[0])
8792 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8793 && !(~INTVAL (operands[2]) & ~(255 << 8))
8794 && GET_MODE (operands[0]) != QImode"
8795 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
8796 (and:SI (zero_extract:SI (match_dup 1)
8797 (const_int 8) (const_int 8))
8799 (clobber (reg:CC 17))])]
8800 "operands[0] = gen_lowpart (SImode, operands[0]);
8801 operands[1] = gen_lowpart (SImode, operands[1]);
8802 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
8804 ;; Since AND can be encoded with sign extended immediate, this is only
8805 ;; profitable when 7th bit is not set.
8807 [(set (match_operand 0 "register_operand" "")
8808 (and (match_operand 1 "general_operand" "")
8809 (match_operand 2 "const_int_operand" "")))
8810 (clobber (reg:CC 17))]
8812 && ANY_QI_REG_P (operands[0])
8813 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
8814 && !(~INTVAL (operands[2]) & ~255)
8815 && !(INTVAL (operands[2]) & 128)
8816 && GET_MODE (operands[0]) != QImode"
8817 [(parallel [(set (strict_low_part (match_dup 0))
8818 (and:QI (match_dup 1)
8820 (clobber (reg:CC 17))])]
8821 "operands[0] = gen_lowpart (QImode, operands[0]);
8822 operands[1] = gen_lowpart (QImode, operands[1]);
8823 operands[2] = gen_lowpart (QImode, operands[2]);")
8825 ;; Logical inclusive OR instructions
8827 ;; %%% This used to optimize known byte-wide and operations to memory.
8828 ;; If this is considered useful, it should be done with splitters.
8830 (define_expand "iordi3"
8831 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8832 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "")
8833 (match_operand:DI 2 "x86_64_general_operand" "")))
8834 (clobber (reg:CC 17))]
8836 "ix86_expand_binary_operator (IOR, DImode, operands); DONE;")
8838 (define_insn "*iordi_1_rex64"
8839 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
8840 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8841 (match_operand:DI 2 "x86_64_general_operand" "re,rme")))
8842 (clobber (reg:CC 17))]
8844 && ix86_binary_operator_ok (IOR, DImode, operands)"
8845 "or{q}\t{%2, %0|%0, %2}"
8846 [(set_attr "type" "alu")
8847 (set_attr "mode" "DI")])
8849 (define_insn "*iordi_2_rex64"
8851 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
8852 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
8854 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
8855 (ior:DI (match_dup 1) (match_dup 2)))]
8857 && ix86_match_ccmode (insn, CCNOmode)
8858 && ix86_binary_operator_ok (IOR, DImode, operands)"
8859 "or{q}\t{%2, %0|%0, %2}"
8860 [(set_attr "type" "alu")
8861 (set_attr "mode" "DI")])
8863 (define_insn "*iordi_3_rex64"
8865 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
8866 (match_operand:DI 2 "x86_64_general_operand" "rem"))
8868 (clobber (match_scratch:DI 0 "=r"))]
8870 && ix86_match_ccmode (insn, CCNOmode)
8871 && ix86_binary_operator_ok (IOR, DImode, operands)"
8872 "or{q}\t{%2, %0|%0, %2}"
8873 [(set_attr "type" "alu")
8874 (set_attr "mode" "DI")])
8877 (define_expand "iorsi3"
8878 [(set (match_operand:SI 0 "nonimmediate_operand" "")
8879 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
8880 (match_operand:SI 2 "general_operand" "")))
8881 (clobber (reg:CC 17))]
8883 "ix86_expand_binary_operator (IOR, SImode, operands); DONE;")
8885 (define_insn "*iorsi_1"
8886 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
8887 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8888 (match_operand:SI 2 "general_operand" "ri,rmi")))
8889 (clobber (reg:CC 17))]
8890 "ix86_binary_operator_ok (IOR, SImode, operands)"
8891 "or{l}\t{%2, %0|%0, %2}"
8892 [(set_attr "type" "alu")
8893 (set_attr "mode" "SI")])
8895 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8896 (define_insn "*iorsi_1_zext"
8897 [(set (match_operand:DI 0 "register_operand" "=rm")
8899 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8900 (match_operand:SI 2 "general_operand" "rim"))))
8901 (clobber (reg:CC 17))]
8902 "TARGET_64BIT && ix86_binary_operator_ok (IOR, SImode, operands)"
8903 "or{l}\t{%2, %k0|%k0, %2}"
8904 [(set_attr "type" "alu")
8905 (set_attr "mode" "SI")])
8907 (define_insn "*iorsi_1_zext_imm"
8908 [(set (match_operand:DI 0 "register_operand" "=rm")
8909 (ior:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
8910 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
8911 (clobber (reg:CC 17))]
8913 "or{l}\t{%2, %k0|%k0, %2}"
8914 [(set_attr "type" "alu")
8915 (set_attr "mode" "SI")])
8917 (define_insn "*iorsi_2"
8919 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
8920 (match_operand:SI 2 "general_operand" "rim,ri"))
8922 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
8923 (ior:SI (match_dup 1) (match_dup 2)))]
8924 "ix86_match_ccmode (insn, CCNOmode)
8925 && ix86_binary_operator_ok (IOR, SImode, operands)"
8926 "or{l}\t{%2, %0|%0, %2}"
8927 [(set_attr "type" "alu")
8928 (set_attr "mode" "SI")])
8930 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
8931 ;; ??? Special case for immediate operand is missing - it is tricky.
8932 (define_insn "*iorsi_2_zext"
8934 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8935 (match_operand:SI 2 "general_operand" "rim"))
8937 (set (match_operand:DI 0 "register_operand" "=r")
8938 (zero_extend:DI (ior:SI (match_dup 1) (match_dup 2))))]
8939 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8940 && ix86_binary_operator_ok (IOR, SImode, operands)"
8941 "or{l}\t{%2, %k0|%k0, %2}"
8942 [(set_attr "type" "alu")
8943 (set_attr "mode" "SI")])
8945 (define_insn "*iorsi_2_zext_imm"
8947 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8948 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
8950 (set (match_operand:DI 0 "register_operand" "=r")
8951 (ior:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
8952 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
8953 && ix86_binary_operator_ok (IOR, SImode, operands)"
8954 "or{l}\t{%2, %k0|%k0, %2}"
8955 [(set_attr "type" "alu")
8956 (set_attr "mode" "SI")])
8958 (define_insn "*iorsi_3"
8960 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
8961 (match_operand:SI 2 "general_operand" "rim"))
8963 (clobber (match_scratch:SI 0 "=r"))]
8964 "ix86_match_ccmode (insn, CCNOmode)
8965 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
8966 "or{l}\t{%2, %0|%0, %2}"
8967 [(set_attr "type" "alu")
8968 (set_attr "mode" "SI")])
8970 (define_expand "iorhi3"
8971 [(set (match_operand:HI 0 "nonimmediate_operand" "")
8972 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
8973 (match_operand:HI 2 "general_operand" "")))
8974 (clobber (reg:CC 17))]
8975 "TARGET_HIMODE_MATH"
8976 "ix86_expand_binary_operator (IOR, HImode, operands); DONE;")
8978 (define_insn "*iorhi_1"
8979 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
8980 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8981 (match_operand:HI 2 "general_operand" "rmi,ri")))
8982 (clobber (reg:CC 17))]
8983 "ix86_binary_operator_ok (IOR, HImode, operands)"
8984 "or{w}\t{%2, %0|%0, %2}"
8985 [(set_attr "type" "alu")
8986 (set_attr "mode" "HI")])
8988 (define_insn "*iorhi_2"
8990 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
8991 (match_operand:HI 2 "general_operand" "rim,ri"))
8993 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
8994 (ior:HI (match_dup 1) (match_dup 2)))]
8995 "ix86_match_ccmode (insn, CCNOmode)
8996 && ix86_binary_operator_ok (IOR, HImode, operands)"
8997 "or{w}\t{%2, %0|%0, %2}"
8998 [(set_attr "type" "alu")
8999 (set_attr "mode" "HI")])
9001 (define_insn "*iorhi_3"
9003 (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
9004 (match_operand:HI 2 "general_operand" "rim"))
9006 (clobber (match_scratch:HI 0 "=r"))]
9007 "ix86_match_ccmode (insn, CCNOmode)
9008 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9009 "or{w}\t{%2, %0|%0, %2}"
9010 [(set_attr "type" "alu")
9011 (set_attr "mode" "HI")])
9013 (define_expand "iorqi3"
9014 [(set (match_operand:QI 0 "nonimmediate_operand" "")
9015 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
9016 (match_operand:QI 2 "general_operand" "")))
9017 (clobber (reg:CC 17))]
9018 "TARGET_QIMODE_MATH"
9019 "ix86_expand_binary_operator (IOR, QImode, operands); DONE;")
9021 ;; %%% Potential partial reg stall on alternative 2. What to do?
9022 (define_insn "*iorqi_1"
9023 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
9024 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
9025 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
9026 (clobber (reg:CC 17))]
9027 "ix86_binary_operator_ok (IOR, QImode, operands)"
9029 or{b}\t{%2, %0|%0, %2}
9030 or{b}\t{%2, %0|%0, %2}
9031 or{l}\t{%k2, %k0|%k0, %k2}"
9032 [(set_attr "type" "alu")
9033 (set_attr "mode" "QI,QI,SI")])
9035 (define_insn "*iorqi_1_slp"
9036 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m"))
9037 (ior:QI (match_dup 0)
9038 (match_operand:QI 1 "general_operand" "qmi,qi")))
9039 (clobber (reg:CC 17))]
9040 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9041 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9042 "or{b}\t{%1, %0|%0, %1}"
9043 [(set_attr "type" "alu1")
9044 (set_attr "mode" "QI")])
9046 (define_insn "*iorqi_2"
9048 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
9049 (match_operand:QI 2 "general_operand" "qim,qi"))
9051 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
9052 (ior:QI (match_dup 1) (match_dup 2)))]
9053 "ix86_match_ccmode (insn, CCNOmode)
9054 && ix86_binary_operator_ok (IOR, QImode, operands)"
9055 "or{b}\t{%2, %0|%0, %2}"
9056 [(set_attr "type" "alu")
9057 (set_attr "mode" "QI")])
9059 (define_insn "*iorqi_2_slp"
9061 (compare (ior:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
9062 (match_operand:QI 1 "general_operand" "qim,qi"))
9064 (set (strict_low_part (match_dup 0))
9065 (ior:QI (match_dup 0) (match_dup 1)))]
9066 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9067 && ix86_match_ccmode (insn, CCNOmode)
9068 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9069 "or{b}\t{%1, %0|%0, %1}"
9070 [(set_attr "type" "alu1")
9071 (set_attr "mode" "QI")])
9073 (define_insn "*iorqi_3"
9075 (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
9076 (match_operand:QI 2 "general_operand" "qim"))
9078 (clobber (match_scratch:QI 0 "=q"))]
9079 "ix86_match_ccmode (insn, CCNOmode)
9080 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9081 "or{b}\t{%2, %0|%0, %2}"
9082 [(set_attr "type" "alu")
9083 (set_attr "mode" "QI")])
9085 (define_insn "iorqi_ext_0"
9086 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9091 (match_operand 1 "ext_register_operand" "0")
9094 (match_operand 2 "const_int_operand" "n")))
9095 (clobber (reg:CC 17))]
9096 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9097 "or{b}\t{%2, %h0|%h0, %2}"
9098 [(set_attr "type" "alu")
9099 (set_attr "length_immediate" "1")
9100 (set_attr "mode" "QI")])
9102 (define_insn "*iorqi_ext_1"
9103 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9108 (match_operand 1 "ext_register_operand" "0")
9112 (match_operand:QI 2 "general_operand" "Qm"))))
9113 (clobber (reg:CC 17))]
9115 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9116 "or{b}\t{%2, %h0|%h0, %2}"
9117 [(set_attr "type" "alu")
9118 (set_attr "length_immediate" "0")
9119 (set_attr "mode" "QI")])
9121 (define_insn "*iorqi_ext_1_rex64"
9122 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9127 (match_operand 1 "ext_register_operand" "0")
9131 (match_operand 2 "ext_register_operand" "Q"))))
9132 (clobber (reg:CC 17))]
9134 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9135 "or{b}\t{%2, %h0|%h0, %2}"
9136 [(set_attr "type" "alu")
9137 (set_attr "length_immediate" "0")
9138 (set_attr "mode" "QI")])
9140 (define_insn "*iorqi_ext_2"
9141 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9145 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
9148 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
9151 (clobber (reg:CC 17))]
9152 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9153 "ior{b}\t{%h2, %h0|%h0, %h2}"
9154 [(set_attr "type" "alu")
9155 (set_attr "length_immediate" "0")
9156 (set_attr "mode" "QI")])
9159 [(set (match_operand 0 "register_operand" "")
9160 (ior (match_operand 1 "register_operand" "")
9161 (match_operand 2 "const_int_operand" "")))
9162 (clobber (reg:CC 17))]
9164 && QI_REG_P (operands[0])
9165 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9166 && !(INTVAL (operands[2]) & ~(255 << 8))
9167 && GET_MODE (operands[0]) != QImode"
9168 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
9169 (ior:SI (zero_extract:SI (match_dup 1)
9170 (const_int 8) (const_int 8))
9172 (clobber (reg:CC 17))])]
9173 "operands[0] = gen_lowpart (SImode, operands[0]);
9174 operands[1] = gen_lowpart (SImode, operands[1]);
9175 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
9177 ;; Since OR can be encoded with sign extended immediate, this is only
9178 ;; profitable when 7th bit is set.
9180 [(set (match_operand 0 "register_operand" "")
9181 (ior (match_operand 1 "general_operand" "")
9182 (match_operand 2 "const_int_operand" "")))
9183 (clobber (reg:CC 17))]
9185 && ANY_QI_REG_P (operands[0])
9186 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9187 && !(INTVAL (operands[2]) & ~255)
9188 && (INTVAL (operands[2]) & 128)
9189 && GET_MODE (operands[0]) != QImode"
9190 [(parallel [(set (strict_low_part (match_dup 0))
9191 (ior:QI (match_dup 1)
9193 (clobber (reg:CC 17))])]
9194 "operands[0] = gen_lowpart (QImode, operands[0]);
9195 operands[1] = gen_lowpart (QImode, operands[1]);
9196 operands[2] = gen_lowpart (QImode, operands[2]);")
9198 ;; Logical XOR instructions
9200 ;; %%% This used to optimize known byte-wide and operations to memory.
9201 ;; If this is considered useful, it should be done with splitters.
9203 (define_expand "xordi3"
9204 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9205 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "")
9206 (match_operand:DI 2 "x86_64_general_operand" "")))
9207 (clobber (reg:CC 17))]
9209 "ix86_expand_binary_operator (XOR, DImode, operands); DONE;")
9211 (define_insn "*xordi_1_rex64"
9212 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
9213 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
9214 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
9215 (clobber (reg:CC 17))]
9217 && ix86_binary_operator_ok (XOR, DImode, operands)"
9219 xor{q}\t{%2, %0|%0, %2}
9220 xor{q}\t{%2, %0|%0, %2}"
9221 [(set_attr "type" "alu")
9222 (set_attr "mode" "DI,DI")])
9224 (define_insn "*xordi_2_rex64"
9226 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
9227 (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
9229 (set (match_operand:DI 0 "nonimmediate_operand" "=r,rm")
9230 (xor:DI (match_dup 1) (match_dup 2)))]
9232 && ix86_match_ccmode (insn, CCNOmode)
9233 && ix86_binary_operator_ok (XOR, DImode, operands)"
9235 xor{q}\t{%2, %0|%0, %2}
9236 xor{q}\t{%2, %0|%0, %2}"
9237 [(set_attr "type" "alu")
9238 (set_attr "mode" "DI,DI")])
9240 (define_insn "*xordi_3_rex64"
9242 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
9243 (match_operand:DI 2 "x86_64_general_operand" "rem"))
9245 (clobber (match_scratch:DI 0 "=r"))]
9247 && ix86_match_ccmode (insn, CCNOmode)
9248 && ix86_binary_operator_ok (XOR, DImode, operands)"
9249 "xor{q}\t{%2, %0|%0, %2}"
9250 [(set_attr "type" "alu")
9251 (set_attr "mode" "DI")])
9253 (define_expand "xorsi3"
9254 [(set (match_operand:SI 0 "nonimmediate_operand" "")
9255 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "")
9256 (match_operand:SI 2 "general_operand" "")))
9257 (clobber (reg:CC 17))]
9259 "ix86_expand_binary_operator (XOR, SImode, operands); DONE;")
9261 (define_insn "*xorsi_1"
9262 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
9263 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
9264 (match_operand:SI 2 "general_operand" "ri,rm")))
9265 (clobber (reg:CC 17))]
9266 "ix86_binary_operator_ok (XOR, SImode, operands)"
9267 "xor{l}\t{%2, %0|%0, %2}"
9268 [(set_attr "type" "alu")
9269 (set_attr "mode" "SI")])
9271 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
9272 ;; Add speccase for immediates
9273 (define_insn "*xorsi_1_zext"
9274 [(set (match_operand:DI 0 "register_operand" "=r")
9276 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9277 (match_operand:SI 2 "general_operand" "rim"))))
9278 (clobber (reg:CC 17))]
9279 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
9280 "xor{l}\t{%2, %k0|%k0, %2}"
9281 [(set_attr "type" "alu")
9282 (set_attr "mode" "SI")])
9284 (define_insn "*xorsi_1_zext_imm"
9285 [(set (match_operand:DI 0 "register_operand" "=r")
9286 (xor:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
9287 (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z")))
9288 (clobber (reg:CC 17))]
9289 "TARGET_64BIT && ix86_binary_operator_ok (XOR, SImode, operands)"
9290 "xor{l}\t{%2, %k0|%k0, %2}"
9291 [(set_attr "type" "alu")
9292 (set_attr "mode" "SI")])
9294 (define_insn "*xorsi_2"
9296 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
9297 (match_operand:SI 2 "general_operand" "rim,ri"))
9299 (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
9300 (xor:SI (match_dup 1) (match_dup 2)))]
9301 "ix86_match_ccmode (insn, CCNOmode)
9302 && ix86_binary_operator_ok (XOR, SImode, operands)"
9303 "xor{l}\t{%2, %0|%0, %2}"
9304 [(set_attr "type" "alu")
9305 (set_attr "mode" "SI")])
9307 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
9308 ;; ??? Special case for immediate operand is missing - it is tricky.
9309 (define_insn "*xorsi_2_zext"
9311 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9312 (match_operand:SI 2 "general_operand" "rim"))
9314 (set (match_operand:DI 0 "register_operand" "=r")
9315 (zero_extend:DI (xor:SI (match_dup 1) (match_dup 2))))]
9316 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9317 && ix86_binary_operator_ok (XOR, SImode, operands)"
9318 "xor{l}\t{%2, %k0|%k0, %2}"
9319 [(set_attr "type" "alu")
9320 (set_attr "mode" "SI")])
9322 (define_insn "*xorsi_2_zext_imm"
9324 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9325 (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
9327 (set (match_operand:DI 0 "register_operand" "=r")
9328 (xor:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
9329 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
9330 && ix86_binary_operator_ok (XOR, SImode, operands)"
9331 "xor{l}\t{%2, %k0|%k0, %2}"
9332 [(set_attr "type" "alu")
9333 (set_attr "mode" "SI")])
9335 (define_insn "*xorsi_3"
9337 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
9338 (match_operand:SI 2 "general_operand" "rim"))
9340 (clobber (match_scratch:SI 0 "=r"))]
9341 "ix86_match_ccmode (insn, CCNOmode)
9342 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9343 "xor{l}\t{%2, %0|%0, %2}"
9344 [(set_attr "type" "alu")
9345 (set_attr "mode" "SI")])
9347 (define_expand "xorhi3"
9348 [(set (match_operand:HI 0 "nonimmediate_operand" "")
9349 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
9350 (match_operand:HI 2 "general_operand" "")))
9351 (clobber (reg:CC 17))]
9352 "TARGET_HIMODE_MATH"
9353 "ix86_expand_binary_operator (XOR, HImode, operands); DONE;")
9355 (define_insn "*xorhi_1"
9356 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m")
9357 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
9358 (match_operand:HI 2 "general_operand" "rmi,ri")))
9359 (clobber (reg:CC 17))]
9360 "ix86_binary_operator_ok (XOR, HImode, operands)"
9361 "xor{w}\t{%2, %0|%0, %2}"
9362 [(set_attr "type" "alu")
9363 (set_attr "mode" "HI")])
9365 (define_insn "*xorhi_2"
9367 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
9368 (match_operand:HI 2 "general_operand" "rim,ri"))
9370 (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
9371 (xor:HI (match_dup 1) (match_dup 2)))]
9372 "ix86_match_ccmode (insn, CCNOmode)
9373 && ix86_binary_operator_ok (XOR, HImode, operands)"
9374 "xor{w}\t{%2, %0|%0, %2}"
9375 [(set_attr "type" "alu")
9376 (set_attr "mode" "HI")])
9378 (define_insn "*xorhi_3"
9380 (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
9381 (match_operand:HI 2 "general_operand" "rim"))
9383 (clobber (match_scratch:HI 0 "=r"))]
9384 "ix86_match_ccmode (insn, CCNOmode)
9385 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9386 "xor{w}\t{%2, %0|%0, %2}"
9387 [(set_attr "type" "alu")
9388 (set_attr "mode" "HI")])
9390 (define_expand "xorqi3"
9391 [(set (match_operand:QI 0 "nonimmediate_operand" "")
9392 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
9393 (match_operand:QI 2 "general_operand" "")))
9394 (clobber (reg:CC 17))]
9395 "TARGET_QIMODE_MATH"
9396 "ix86_expand_binary_operator (XOR, QImode, operands); DONE;")
9398 ;; %%% Potential partial reg stall on alternative 2. What to do?
9399 (define_insn "*xorqi_1"
9400 [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
9401 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
9402 (match_operand:QI 2 "general_operand" "qmi,qi,ri")))
9403 (clobber (reg:CC 17))]
9404 "ix86_binary_operator_ok (XOR, QImode, operands)"
9406 xor{b}\t{%2, %0|%0, %2}
9407 xor{b}\t{%2, %0|%0, %2}
9408 xor{l}\t{%k2, %k0|%k0, %k2}"
9409 [(set_attr "type" "alu")
9410 (set_attr "mode" "QI,QI,SI")])
9412 (define_insn "*xorqi_1_slp"
9413 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
9414 (xor:QI (match_dup 0)
9415 (match_operand:QI 1 "general_operand" "qi,qmi")))
9416 (clobber (reg:CC 17))]
9417 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9418 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9419 "xor{b}\t{%1, %0|%0, %1}"
9420 [(set_attr "type" "alu1")
9421 (set_attr "mode" "QI")])
9423 (define_insn "xorqi_ext_0"
9424 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9429 (match_operand 1 "ext_register_operand" "0")
9432 (match_operand 2 "const_int_operand" "n")))
9433 (clobber (reg:CC 17))]
9434 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9435 "xor{b}\t{%2, %h0|%h0, %2}"
9436 [(set_attr "type" "alu")
9437 (set_attr "length_immediate" "1")
9438 (set_attr "mode" "QI")])
9440 (define_insn "*xorqi_ext_1"
9441 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9446 (match_operand 1 "ext_register_operand" "0")
9450 (match_operand:QI 2 "general_operand" "Qm"))))
9451 (clobber (reg:CC 17))]
9453 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9454 "xor{b}\t{%2, %h0|%h0, %2}"
9455 [(set_attr "type" "alu")
9456 (set_attr "length_immediate" "0")
9457 (set_attr "mode" "QI")])
9459 (define_insn "*xorqi_ext_1_rex64"
9460 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9465 (match_operand 1 "ext_register_operand" "0")
9469 (match_operand 2 "ext_register_operand" "Q"))))
9470 (clobber (reg:CC 17))]
9472 && (!TARGET_PARTIAL_REG_STALL || optimize_size)"
9473 "xor{b}\t{%2, %h0|%h0, %2}"
9474 [(set_attr "type" "alu")
9475 (set_attr "length_immediate" "0")
9476 (set_attr "mode" "QI")])
9478 (define_insn "*xorqi_ext_2"
9479 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9483 (zero_extract:SI (match_operand 1 "ext_register_operand" "0")
9486 (zero_extract:SI (match_operand 2 "ext_register_operand" "Q")
9489 (clobber (reg:CC 17))]
9490 "(!TARGET_PARTIAL_REG_STALL || optimize_size)"
9491 "xor{b}\t{%h2, %h0|%h0, %h2}"
9492 [(set_attr "type" "alu")
9493 (set_attr "length_immediate" "0")
9494 (set_attr "mode" "QI")])
9496 (define_insn "*xorqi_cc_1"
9499 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
9500 (match_operand:QI 2 "general_operand" "qim,qi"))
9502 (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm")
9503 (xor:QI (match_dup 1) (match_dup 2)))]
9504 "ix86_match_ccmode (insn, CCNOmode)
9505 && ix86_binary_operator_ok (XOR, QImode, operands)"
9506 "xor{b}\t{%2, %0|%0, %2}"
9507 [(set_attr "type" "alu")
9508 (set_attr "mode" "QI")])
9510 (define_insn "*xorqi_2_slp"
9512 (compare (xor:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
9513 (match_operand:QI 1 "general_operand" "qim,qi"))
9515 (set (strict_low_part (match_dup 0))
9516 (xor:QI (match_dup 0) (match_dup 1)))]
9517 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
9518 && ix86_match_ccmode (insn, CCNOmode)
9519 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
9520 "xor{b}\t{%1, %0|%0, %1}"
9521 [(set_attr "type" "alu1")
9522 (set_attr "mode" "QI")])
9524 (define_insn "*xorqi_cc_2"
9527 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
9528 (match_operand:QI 2 "general_operand" "qim"))
9530 (clobber (match_scratch:QI 0 "=q"))]
9531 "ix86_match_ccmode (insn, CCNOmode)
9532 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
9533 "xor{b}\t{%2, %0|%0, %2}"
9534 [(set_attr "type" "alu")
9535 (set_attr "mode" "QI")])
9537 (define_insn "*xorqi_cc_ext_1"
9542 (match_operand 1 "ext_register_operand" "0")
9545 (match_operand:QI 2 "general_operand" "qmn"))
9547 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=q")
9551 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9553 "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9554 "xor{b}\t{%2, %h0|%h0, %2}"
9555 [(set_attr "type" "alu")
9556 (set_attr "mode" "QI")])
9558 (define_insn "*xorqi_cc_ext_1_rex64"
9563 (match_operand 1 "ext_register_operand" "0")
9566 (match_operand:QI 2 "nonmemory_operand" "Qn"))
9568 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q")
9572 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9574 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
9575 "xor{b}\t{%2, %h0|%h0, %2}"
9576 [(set_attr "type" "alu")
9577 (set_attr "mode" "QI")])
9579 (define_expand "xorqi_cc_ext_1"
9585 (match_operand 1 "ext_register_operand" "")
9588 (match_operand:QI 2 "general_operand" ""))
9590 (set (zero_extract:SI (match_operand 0 "ext_register_operand" "")
9594 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8))
9600 [(set (match_operand 0 "register_operand" "")
9601 (xor (match_operand 1 "register_operand" "")
9602 (match_operand 2 "const_int_operand" "")))
9603 (clobber (reg:CC 17))]
9605 && QI_REG_P (operands[0])
9606 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9607 && !(INTVAL (operands[2]) & ~(255 << 8))
9608 && GET_MODE (operands[0]) != QImode"
9609 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
9610 (xor:SI (zero_extract:SI (match_dup 1)
9611 (const_int 8) (const_int 8))
9613 (clobber (reg:CC 17))])]
9614 "operands[0] = gen_lowpart (SImode, operands[0]);
9615 operands[1] = gen_lowpart (SImode, operands[1]);
9616 operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
9618 ;; Since XOR can be encoded with sign extended immediate, this is only
9619 ;; profitable when 7th bit is set.
9621 [(set (match_operand 0 "register_operand" "")
9622 (xor (match_operand 1 "general_operand" "")
9623 (match_operand 2 "const_int_operand" "")))
9624 (clobber (reg:CC 17))]
9626 && ANY_QI_REG_P (operands[0])
9627 && (!TARGET_PARTIAL_REG_STALL || optimize_size)
9628 && !(INTVAL (operands[2]) & ~255)
9629 && (INTVAL (operands[2]) & 128)
9630 && GET_MODE (operands[0]) != QImode"
9631 [(parallel [(set (strict_low_part (match_dup 0))
9632 (xor:QI (match_dup 1)
9634 (clobber (reg:CC 17))])]
9635 "operands[0] = gen_lowpart (QImode, operands[0]);
9636 operands[1] = gen_lowpart (QImode, operands[1]);
9637 operands[2] = gen_lowpart (QImode, operands[2]);")
9639 ;; Negation instructions
9641 (define_expand "negdi2"
9642 [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
9643 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "")))
9644 (clobber (reg:CC 17))])]
9646 "ix86_expand_unary_operator (NEG, DImode, operands); DONE;")
9648 (define_insn "*negdi2_1"
9649 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
9650 (neg:DI (match_operand:DI 1 "general_operand" "0")))
9651 (clobber (reg:CC 17))]
9653 && ix86_unary_operator_ok (NEG, DImode, operands)"
9657 [(set (match_operand:DI 0 "nonimmediate_operand" "")
9658 (neg:DI (match_operand:DI 1 "general_operand" "")))
9659 (clobber (reg:CC 17))]
9660 "!TARGET_64BIT && reload_completed"
9663 (compare:CCZ (neg:SI (match_dup 2)) (const_int 0)))
9664 (set (match_dup 0) (neg:SI (match_dup 2)))])
9667 (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
9670 (clobber (reg:CC 17))])
9673 (neg:SI (match_dup 1)))
9674 (clobber (reg:CC 17))])]
9675 "split_di (operands+1, 1, operands+2, operands+3);
9676 split_di (operands+0, 1, operands+0, operands+1);")
9678 (define_insn "*negdi2_1_rex64"
9679 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9680 (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0")))
9681 (clobber (reg:CC 17))]
9682 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9684 [(set_attr "type" "negnot")
9685 (set_attr "mode" "DI")])
9687 ;; The problem with neg is that it does not perform (compare x 0),
9688 ;; it really performs (compare 0 x), which leaves us with the zero
9689 ;; flag being the only useful item.
9691 (define_insn "*negdi2_cmpz_rex64"
9693 (compare:CCZ (neg:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
9695 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
9696 (neg:DI (match_dup 1)))]
9697 "TARGET_64BIT && ix86_unary_operator_ok (NEG, DImode, operands)"
9699 [(set_attr "type" "negnot")
9700 (set_attr "mode" "DI")])
9703 (define_expand "negsi2"
9704 [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
9705 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "")))
9706 (clobber (reg:CC 17))])]
9708 "ix86_expand_unary_operator (NEG, SImode, operands); DONE;")
9710 (define_insn "*negsi2_1"
9711 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9712 (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))
9713 (clobber (reg:CC 17))]
9714 "ix86_unary_operator_ok (NEG, SImode, operands)"
9716 [(set_attr "type" "negnot")
9717 (set_attr "mode" "SI")])
9719 ;; Combine is quite creative about this pattern.
9720 (define_insn "*negsi2_1_zext"
9721 [(set (match_operand:DI 0 "register_operand" "=r")
9722 (lshiftrt:DI (neg:DI (ashift:DI (match_operand:DI 1 "register_operand" "0")
9725 (clobber (reg:CC 17))]
9726 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9728 [(set_attr "type" "negnot")
9729 (set_attr "mode" "SI")])
9731 ;; The problem with neg is that it does not perform (compare x 0),
9732 ;; it really performs (compare 0 x), which leaves us with the zero
9733 ;; flag being the only useful item.
9735 (define_insn "*negsi2_cmpz"
9737 (compare:CCZ (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
9739 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
9740 (neg:SI (match_dup 1)))]
9741 "ix86_unary_operator_ok (NEG, SImode, operands)"
9743 [(set_attr "type" "negnot")
9744 (set_attr "mode" "SI")])
9746 (define_insn "*negsi2_cmpz_zext"
9748 (compare:CCZ (lshiftrt:DI
9750 (match_operand:DI 1 "register_operand" "0")
9754 (set (match_operand:DI 0 "register_operand" "=r")
9755 (lshiftrt:DI (neg:DI (ashift:DI (match_dup 1)
9758 "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
9760 [(set_attr "type" "negnot")
9761 (set_attr "mode" "SI")])
9763 (define_expand "neghi2"
9764 [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
9765 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "")))
9766 (clobber (reg:CC 17))])]
9767 "TARGET_HIMODE_MATH"
9768 "ix86_expand_unary_operator (NEG, HImode, operands); DONE;")
9770 (define_insn "*neghi2_1"
9771 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9772 (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))
9773 (clobber (reg:CC 17))]
9774 "ix86_unary_operator_ok (NEG, HImode, operands)"
9776 [(set_attr "type" "negnot")
9777 (set_attr "mode" "HI")])
9779 (define_insn "*neghi2_cmpz"
9781 (compare:CCZ (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
9783 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
9784 (neg:HI (match_dup 1)))]
9785 "ix86_unary_operator_ok (NEG, HImode, operands)"
9787 [(set_attr "type" "negnot")
9788 (set_attr "mode" "HI")])
9790 (define_expand "negqi2"
9791 [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
9792 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "")))
9793 (clobber (reg:CC 17))])]
9794 "TARGET_QIMODE_MATH"
9795 "ix86_expand_unary_operator (NEG, QImode, operands); DONE;")
9797 (define_insn "*negqi2_1"
9798 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9799 (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))
9800 (clobber (reg:CC 17))]
9801 "ix86_unary_operator_ok (NEG, QImode, operands)"
9803 [(set_attr "type" "negnot")
9804 (set_attr "mode" "QI")])
9806 (define_insn "*negqi2_cmpz"
9808 (compare:CCZ (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
9810 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
9811 (neg:QI (match_dup 1)))]
9812 "ix86_unary_operator_ok (NEG, QImode, operands)"
9814 [(set_attr "type" "negnot")
9815 (set_attr "mode" "QI")])
9817 ;; Changing of sign for FP values is doable using integer unit too.
9819 (define_expand "negsf2"
9820 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
9821 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "")))
9822 (clobber (reg:CC 17))])]
9826 /* In case operand is in memory, we will not use SSE. */
9827 if (memory_operand (operands[0], VOIDmode)
9828 && rtx_equal_p (operands[0], operands[1]))
9829 emit_insn (gen_negsf2_memory (operands[0], operands[1]));
9832 /* Using SSE is tricky, since we need bitwise negation of -0
9834 rtx reg = gen_reg_rtx (SFmode);
9835 rtx dest = operands[0];
9836 rtx imm = gen_lowpart (SFmode, gen_int_mode (0x80000000, SImode));
9838 operands[1] = force_reg (SFmode, operands[1]);
9839 operands[0] = force_reg (SFmode, operands[0]);
9840 reg = force_reg (V4SFmode,
9841 gen_rtx_CONST_VECTOR (V4SFmode,
9842 gen_rtvec (4, imm, CONST0_RTX (SFmode),
9843 CONST0_RTX (SFmode),
9844 CONST0_RTX (SFmode))));
9845 emit_insn (gen_negsf2_ifs (operands[0], operands[1], reg));
9846 if (dest != operands[0])
9847 emit_move_insn (dest, operands[0]);
9851 ix86_expand_unary_operator (NEG, SFmode, operands); DONE;")
9853 (define_insn "negsf2_memory"
9854 [(set (match_operand:SF 0 "memory_operand" "=m")
9855 (neg:SF (match_operand:SF 1 "memory_operand" "0")))
9856 (clobber (reg:CC 17))]
9857 "ix86_unary_operator_ok (NEG, SFmode, operands)"
9860 (define_insn "negsf2_ifs"
9861 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
9862 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "0,x#fr,0,0")))
9863 (use (match_operand:V4SF 2 "nonimmediate_operand" "xm,0,xm*r,xm*r"))
9864 (clobber (reg:CC 17))]
9866 && (reload_in_progress || reload_completed
9867 || (register_operand (operands[0], VOIDmode)
9868 && register_operand (operands[1], VOIDmode)))"
9872 [(set (match_operand:SF 0 "memory_operand" "")
9873 (neg:SF (match_operand:SF 1 "memory_operand" "")))
9874 (use (match_operand:SF 2 "" ""))
9875 (clobber (reg:CC 17))]
9877 [(parallel [(set (match_dup 0)
9878 (neg:SF (match_dup 1)))
9879 (clobber (reg:CC 17))])])
9882 [(set (match_operand:SF 0 "register_operand" "")
9883 (neg:SF (match_operand:SF 1 "register_operand" "")))
9884 (use (match_operand:V4SF 2 "" ""))
9885 (clobber (reg:CC 17))]
9886 "reload_completed && !SSE_REG_P (operands[0])"
9887 [(parallel [(set (match_dup 0)
9888 (neg:SF (match_dup 1)))
9889 (clobber (reg:CC 17))])])
9892 [(set (match_operand:SF 0 "register_operand" "")
9893 (neg:SF (match_operand:SF 1 "register_operand" "")))
9894 (use (match_operand:V4SF 2 "nonimmediate_operand" ""))
9895 (clobber (reg:CC 17))]
9896 "reload_completed && SSE_REG_P (operands[0])"
9897 [(set (subreg:TI (match_dup 0) 0)
9898 (xor:TI (match_dup 1)
9901 operands[1] = simplify_gen_subreg (TImode, operands[1], SFmode, 0);
9902 operands[2] = simplify_gen_subreg (TImode, operands[2], V4SFmode, 0);
9903 if (operands_match_p (operands[0], operands[2]))
9907 operands[1] = operands[2];
9913 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
9914 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
9916 (define_insn "*negsf2_if"
9917 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
9918 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")))
9919 (clobber (reg:CC 17))]
9920 "TARGET_80387 && !TARGET_SSE
9921 && ix86_unary_operator_ok (NEG, SFmode, operands)"
9925 [(set (match_operand:SF 0 "fp_register_operand" "")
9926 (neg:SF (match_operand:SF 1 "register_operand" "")))
9927 (clobber (reg:CC 17))]
9928 "TARGET_80387 && reload_completed"
9930 (neg:SF (match_dup 1)))]
9934 [(set (match_operand:SF 0 "register_and_not_fp_reg_operand" "")
9935 (neg:SF (match_operand:SF 1 "register_operand" "")))
9936 (clobber (reg:CC 17))]
9937 "TARGET_80387 && reload_completed"
9938 [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
9939 (clobber (reg:CC 17))])]
9940 "operands[1] = gen_int_mode (0x80000000, SImode);
9941 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));")
9944 [(set (match_operand 0 "memory_operand" "")
9945 (neg (match_operand 1 "memory_operand" "")))
9946 (clobber (reg:CC 17))]
9947 "TARGET_80387 && reload_completed && FLOAT_MODE_P (GET_MODE (operands[0]))"
9948 [(parallel [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
9949 (clobber (reg:CC 17))])]
9951 int size = GET_MODE_SIZE (GET_MODE (operands[1]));
9953 /* XFmode's size is 12, TFmode 16, but only 10 bytes are used. */
9956 operands[0] = adjust_address (operands[0], QImode, size - 1);
9957 operands[1] = gen_int_mode (0x80, QImode);
9960 (define_expand "negdf2"
9961 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
9962 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))
9963 (clobber (reg:CC 17))])]
9967 /* In case operand is in memory, we will not use SSE. */
9968 if (memory_operand (operands[0], VOIDmode)
9969 && rtx_equal_p (operands[0], operands[1]))
9970 emit_insn (gen_negdf2_memory (operands[0], operands[1]));
9973 /* Using SSE is tricky, since we need bitwise negation of -0
9976 #if HOST_BITS_PER_WIDE_INT >= 64
9977 rtx imm = gen_int_mode (((HOST_WIDE_INT)1) << 63, DImode);
9979 rtx imm = immed_double_const (0, 0x80000000, DImode);
9981 rtx dest = operands[0];
9983 operands[1] = force_reg (DFmode, operands[1]);
9984 operands[0] = force_reg (DFmode, operands[0]);
9985 imm = gen_lowpart (DFmode, imm);
9986 reg = force_reg (V2DFmode,
9987 gen_rtx_CONST_VECTOR (V2DFmode,
9988 gen_rtvec (2, imm, CONST0_RTX (DFmode))));
9989 emit_insn (gen_negdf2_ifs (operands[0], operands[1], reg));
9990 if (dest != operands[0])
9991 emit_move_insn (dest, operands[0]);
9995 ix86_expand_unary_operator (NEG, DFmode, operands); DONE;")
9997 (define_insn "negdf2_memory"
9998 [(set (match_operand:DF 0 "memory_operand" "=m")
9999 (neg:DF (match_operand:DF 1 "memory_operand" "0")))
10000 (clobber (reg:CC 17))]
10001 "ix86_unary_operator_ok (NEG, DFmode, operands)"
10004 (define_insn "negdf2_ifs"
10005 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf")
10006 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0")))
10007 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r,Ym*r"))
10008 (clobber (reg:CC 17))]
10009 "!TARGET_64BIT && TARGET_SSE2
10010 && (reload_in_progress || reload_completed
10011 || (register_operand (operands[0], VOIDmode)
10012 && register_operand (operands[1], VOIDmode)))"
10015 (define_insn "*negdf2_ifs_rex64"
10016 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#f,Y#f,fm#Y")
10017 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0")))
10018 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r"))
10019 (clobber (reg:CC 17))]
10020 "TARGET_64BIT && TARGET_SSE2
10021 && (reload_in_progress || reload_completed
10022 || (register_operand (operands[0], VOIDmode)
10023 && register_operand (operands[1], VOIDmode)))"
10027 [(set (match_operand:DF 0 "memory_operand" "")
10028 (neg:DF (match_operand:DF 1 "memory_operand" "")))
10029 (use (match_operand:V2DF 2 "" ""))
10030 (clobber (reg:CC 17))]
10032 [(parallel [(set (match_dup 0)
10033 (neg:DF (match_dup 1)))
10034 (clobber (reg:CC 17))])])
10037 [(set (match_operand:DF 0 "register_operand" "")
10038 (neg:DF (match_operand:DF 1 "register_operand" "")))
10039 (use (match_operand:V2DF 2 "" ""))
10040 (clobber (reg:CC 17))]
10041 "reload_completed && !SSE_REG_P (operands[0])
10042 && (!TARGET_64BIT || FP_REG_P (operands[0]))"
10043 [(parallel [(set (match_dup 0)
10044 (neg:DF (match_dup 1)))
10045 (clobber (reg:CC 17))])])
10048 [(set (match_operand:DF 0 "register_operand" "")
10049 (neg:DF (match_operand:DF 1 "register_operand" "")))
10050 (use (match_operand:V2DF 2 "" ""))
10051 (clobber (reg:CC 17))]
10052 "TARGET_64BIT && reload_completed && GENERAL_REG_P (operands[0])"
10053 [(parallel [(set (match_dup 0)
10054 (xor:DI (match_dup 1) (match_dup 2)))
10055 (clobber (reg:CC 17))])]
10056 "operands[0] = gen_lowpart (DImode, operands[0]);
10057 operands[1] = gen_lowpart (DImode, operands[1]);
10058 operands[2] = gen_lowpart (DImode, operands[2]);")
10061 [(set (match_operand:DF 0 "register_operand" "")
10062 (neg:DF (match_operand:DF 1 "register_operand" "")))
10063 (use (match_operand:V2DF 2 "nonimmediate_operand" ""))
10064 (clobber (reg:CC 17))]
10065 "reload_completed && SSE_REG_P (operands[0])"
10066 [(set (subreg:TI (match_dup 0) 0)
10067 (xor:TI (match_dup 1)
10070 operands[0] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
10071 operands[1] = simplify_gen_subreg (TImode, operands[1], DFmode, 0);
10072 operands[2] = simplify_gen_subreg (TImode, operands[2], V2DFmode, 0);
10073 /* Avoid possible reformatting on the operands. */
10074 if (TARGET_SSE_PARTIAL_REGS && !optimize_size)
10075 emit_insn (gen_sse2_unpcklpd (operands[0], operands[0], operands[0]));
10076 if (operands_match_p (operands[0], operands[2]))
10080 operands[1] = operands[2];
10085 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
10086 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
10088 (define_insn "*negdf2_if"
10089 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
10090 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
10091 (clobber (reg:CC 17))]
10092 "!TARGET_64BIT && TARGET_80387
10093 && ix86_unary_operator_ok (NEG, DFmode, operands)"
10096 ;; FIXME: We should to allow integer registers here. Problem is that
10097 ;; we need another scratch register to get constant from.
10098 ;; Forcing constant to mem if no register available in peep2 should be
10099 ;; safe even for PIC mode, because of RIP relative addressing.
10100 (define_insn "*negdf2_if_rex64"
10101 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,mf")
10102 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
10103 (clobber (reg:CC 17))]
10104 "TARGET_64BIT && TARGET_80387
10105 && ix86_unary_operator_ok (NEG, DFmode, operands)"
10109 [(set (match_operand:DF 0 "fp_register_operand" "")
10110 (neg:DF (match_operand:DF 1 "register_operand" "")))
10111 (clobber (reg:CC 17))]
10112 "TARGET_80387 && reload_completed"
10113 [(set (match_dup 0)
10114 (neg:DF (match_dup 1)))]
10118 [(set (match_operand:DF 0 "register_and_not_fp_reg_operand" "")
10119 (neg:DF (match_operand:DF 1 "register_operand" "")))
10120 (clobber (reg:CC 17))]
10121 "!TARGET_64BIT && TARGET_80387 && reload_completed"
10122 [(parallel [(set (match_dup 3) (xor:SI (match_dup 3) (match_dup 4)))
10123 (clobber (reg:CC 17))])]
10124 "operands[4] = gen_int_mode (0x80000000, SImode);
10125 split_di (operands+0, 1, operands+2, operands+3);")
10127 (define_expand "negxf2"
10128 [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "")
10129 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))
10130 (clobber (reg:CC 17))])]
10131 "!TARGET_64BIT && TARGET_80387"
10132 "ix86_expand_unary_operator (NEG, XFmode, operands); DONE;")
10134 (define_expand "negtf2"
10135 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
10136 (neg:TF (match_operand:TF 1 "nonimmediate_operand" "")))
10137 (clobber (reg:CC 17))])]
10139 "ix86_expand_unary_operator (NEG, TFmode, operands); DONE;")
10141 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
10142 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
10144 (define_insn "*negxf2_if"
10145 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
10146 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "0,0")))
10147 (clobber (reg:CC 17))]
10148 "!TARGET_64BIT && TARGET_80387
10149 && ix86_unary_operator_ok (NEG, XFmode, operands)"
10153 [(set (match_operand:XF 0 "fp_register_operand" "")
10154 (neg:XF (match_operand:XF 1 "register_operand" "")))
10155 (clobber (reg:CC 17))]
10156 "TARGET_80387 && reload_completed"
10157 [(set (match_dup 0)
10158 (neg:XF (match_dup 1)))]
10162 [(set (match_operand:XF 0 "register_and_not_fp_reg_operand" "")
10163 (neg:XF (match_operand:XF 1 "register_operand" "")))
10164 (clobber (reg:CC 17))]
10165 "TARGET_80387 && reload_completed"
10166 [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
10167 (clobber (reg:CC 17))])]
10168 "operands[1] = GEN_INT (0x8000);
10169 operands[0] = gen_rtx_REG (SImode,
10170 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
10172 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
10173 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
10175 (define_insn "*negtf2_if"
10176 [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f")
10177 (neg:TF (match_operand:TF 1 "nonimmediate_operand" "0,0")))
10178 (clobber (reg:CC 17))]
10179 "TARGET_80387 && ix86_unary_operator_ok (NEG, TFmode, operands)"
10183 [(set (match_operand:TF 0 "fp_register_operand" "")
10184 (neg:TF (match_operand:TF 1 "register_operand" "")))
10185 (clobber (reg:CC 17))]
10186 "TARGET_80387 && reload_completed"
10187 [(set (match_dup 0)
10188 (neg:TF (match_dup 1)))]
10192 [(set (match_operand:TF 0 "register_and_not_fp_reg_operand" "")
10193 (neg:TF (match_operand:TF 1 "register_operand" "")))
10194 (clobber (reg:CC 17))]
10195 "TARGET_80387 && reload_completed"
10196 [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))
10197 (clobber (reg:CC 17))])]
10198 "operands[1] = GEN_INT (0x8000);
10199 operands[0] = gen_rtx_REG (SImode,
10200 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
10202 ;; Conditionalize these after reload. If they matches before reload, we
10203 ;; lose the clobber and ability to use integer instructions.
10205 (define_insn "*negsf2_1"
10206 [(set (match_operand:SF 0 "register_operand" "=f")
10207 (neg:SF (match_operand:SF 1 "register_operand" "0")))]
10208 "TARGET_80387 && reload_completed"
10210 [(set_attr "type" "fsgn")
10211 (set_attr "mode" "SF")
10212 (set_attr "ppro_uops" "few")])
10214 (define_insn "*negdf2_1"
10215 [(set (match_operand:DF 0 "register_operand" "=f")
10216 (neg:DF (match_operand:DF 1 "register_operand" "0")))]
10217 "TARGET_80387 && reload_completed"
10219 [(set_attr "type" "fsgn")
10220 (set_attr "mode" "DF")
10221 (set_attr "ppro_uops" "few")])
10223 (define_insn "*negextendsfdf2"
10224 [(set (match_operand:DF 0 "register_operand" "=f")
10225 (neg:DF (float_extend:DF
10226 (match_operand:SF 1 "register_operand" "0"))))]
10229 [(set_attr "type" "fsgn")
10230 (set_attr "mode" "DF")
10231 (set_attr "ppro_uops" "few")])
10233 (define_insn "*negxf2_1"
10234 [(set (match_operand:XF 0 "register_operand" "=f")
10235 (neg:XF (match_operand:XF 1 "register_operand" "0")))]
10236 "!TARGET_64BIT && TARGET_80387 && reload_completed"
10238 [(set_attr "type" "fsgn")
10239 (set_attr "mode" "XF")
10240 (set_attr "ppro_uops" "few")])
10242 (define_insn "*negextenddfxf2"
10243 [(set (match_operand:XF 0 "register_operand" "=f")
10244 (neg:XF (float_extend:XF
10245 (match_operand:DF 1 "register_operand" "0"))))]
10246 "!TARGET_64BIT && TARGET_80387"
10248 [(set_attr "type" "fsgn")
10249 (set_attr "mode" "XF")
10250 (set_attr "ppro_uops" "few")])
10252 (define_insn "*negextendsfxf2"
10253 [(set (match_operand:XF 0 "register_operand" "=f")
10254 (neg:XF (float_extend:XF
10255 (match_operand:SF 1 "register_operand" "0"))))]
10256 "!TARGET_64BIT && TARGET_80387"
10258 [(set_attr "type" "fsgn")
10259 (set_attr "mode" "XF")
10260 (set_attr "ppro_uops" "few")])
10262 (define_insn "*negtf2_1"
10263 [(set (match_operand:TF 0 "register_operand" "=f")
10264 (neg:TF (match_operand:TF 1 "register_operand" "0")))]
10265 "TARGET_80387 && reload_completed"
10267 [(set_attr "type" "fsgn")
10268 (set_attr "mode" "XF")
10269 (set_attr "ppro_uops" "few")])
10271 (define_insn "*negextenddftf2"
10272 [(set (match_operand:TF 0 "register_operand" "=f")
10273 (neg:TF (float_extend:TF
10274 (match_operand:DF 1 "register_operand" "0"))))]
10277 [(set_attr "type" "fsgn")
10278 (set_attr "mode" "XF")
10279 (set_attr "ppro_uops" "few")])
10281 (define_insn "*negextendsftf2"
10282 [(set (match_operand:TF 0 "register_operand" "=f")
10283 (neg:TF (float_extend:TF
10284 (match_operand:SF 1 "register_operand" "0"))))]
10287 [(set_attr "type" "fsgn")
10288 (set_attr "mode" "XF")
10289 (set_attr "ppro_uops" "few")])
10291 ;; Absolute value instructions
10293 (define_expand "abssf2"
10294 [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
10295 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "")))
10296 (clobber (reg:CC 17))])]
10300 /* In case operand is in memory, we will not use SSE. */
10301 if (memory_operand (operands[0], VOIDmode)
10302 && rtx_equal_p (operands[0], operands[1]))
10303 emit_insn (gen_abssf2_memory (operands[0], operands[1]));
10306 /* Using SSE is tricky, since we need bitwise negation of -0
10308 rtx reg = gen_reg_rtx (V4SFmode);
10309 rtx dest = operands[0];
10312 operands[1] = force_reg (SFmode, operands[1]);
10313 operands[0] = force_reg (SFmode, operands[0]);
10314 imm = gen_lowpart (SFmode, gen_int_mode(~0x80000000, SImode));
10315 reg = force_reg (V4SFmode,
10316 gen_rtx_CONST_VECTOR (V4SFmode,
10317 gen_rtvec (4, imm, CONST0_RTX (SFmode),
10318 CONST0_RTX (SFmode),
10319 CONST0_RTX (SFmode))));
10320 emit_insn (gen_abssf2_ifs (operands[0], operands[1], reg));
10321 if (dest != operands[0])
10322 emit_move_insn (dest, operands[0]);
10326 ix86_expand_unary_operator (ABS, SFmode, operands); DONE;")
10328 (define_insn "abssf2_memory"
10329 [(set (match_operand:SF 0 "memory_operand" "=m")
10330 (abs:SF (match_operand:SF 1 "memory_operand" "0")))
10331 (clobber (reg:CC 17))]
10332 "ix86_unary_operator_ok (ABS, SFmode, operands)"
10335 (define_insn "abssf2_ifs"
10336 [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
10337 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "0,x#fr,0,0")))
10338 (use (match_operand:V4SF 2 "nonimmediate_operand" "xm,0,xm*r,xm*r"))
10339 (clobber (reg:CC 17))]
10341 && (reload_in_progress || reload_completed
10342 || (register_operand (operands[0], VOIDmode)
10343 && register_operand (operands[1], VOIDmode)))"
10347 [(set (match_operand:SF 0 "memory_operand" "")
10348 (abs:SF (match_operand:SF 1 "memory_operand" "")))
10349 (use (match_operand:V4SF 2 "" ""))
10350 (clobber (reg:CC 17))]
10352 [(parallel [(set (match_dup 0)
10353 (abs:SF (match_dup 1)))
10354 (clobber (reg:CC 17))])])
10357 [(set (match_operand:SF 0 "register_operand" "")
10358 (abs:SF (match_operand:SF 1 "register_operand" "")))
10359 (use (match_operand:V4SF 2 "" ""))
10360 (clobber (reg:CC 17))]
10361 "reload_completed && !SSE_REG_P (operands[0])"
10362 [(parallel [(set (match_dup 0)
10363 (abs:SF (match_dup 1)))
10364 (clobber (reg:CC 17))])])
10367 [(set (match_operand:SF 0 "register_operand" "")
10368 (abs:SF (match_operand:SF 1 "register_operand" "")))
10369 (use (match_operand:V4SF 2 "nonimmediate_operand" ""))
10370 (clobber (reg:CC 17))]
10371 "reload_completed && SSE_REG_P (operands[0])"
10372 [(set (subreg:TI (match_dup 0) 0)
10373 (and:TI (match_dup 1)
10376 operands[1] = simplify_gen_subreg (TImode, operands[1], SFmode, 0);
10377 operands[2] = simplify_gen_subreg (TImode, operands[2], V4SFmode, 0);
10378 if (operands_match_p (operands[0], operands[2]))
10382 operands[1] = operands[2];
10387 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
10388 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
10390 (define_insn "*abssf2_if"
10391 [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
10392 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")))
10393 (clobber (reg:CC 17))]
10394 "TARGET_80387 && ix86_unary_operator_ok (ABS, SFmode, operands) && !TARGET_SSE"
10398 [(set (match_operand:SF 0 "fp_register_operand" "")
10399 (abs:SF (match_operand:SF 1 "register_operand" "")))
10400 (clobber (reg:CC 17))]
10402 [(set (match_dup 0)
10403 (abs:SF (match_dup 1)))]
10407 [(set (match_operand:SF 0 "register_and_not_fp_reg_operand" "")
10408 (abs:SF (match_operand:SF 1 "register_operand" "")))
10409 (clobber (reg:CC 17))]
10410 "TARGET_80387 && reload_completed"
10411 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
10412 (clobber (reg:CC 17))])]
10413 "operands[1] = gen_int_mode (~0x80000000, SImode);
10414 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));")
10417 [(set (match_operand 0 "memory_operand" "")
10418 (abs (match_operand 1 "memory_operand" "")))
10419 (clobber (reg:CC 17))]
10420 "TARGET_80387 && reload_completed && FLOAT_MODE_P (GET_MODE (operands[0]))"
10421 [(parallel [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
10422 (clobber (reg:CC 17))])]
10424 int size = GET_MODE_SIZE (GET_MODE (operands[1]));
10426 /* XFmode's size is 12, TFmode 16, but only 10 bytes are used. */
10429 operands[0] = adjust_address (operands[0], QImode, size - 1);
10430 operands[1] = gen_int_mode (~0x80, QImode);
10433 (define_expand "absdf2"
10434 [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
10435 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "")))
10436 (clobber (reg:CC 17))])]
10440 /* In case operand is in memory, we will not use SSE. */
10441 if (memory_operand (operands[0], VOIDmode)
10442 && rtx_equal_p (operands[0], operands[1]))
10443 emit_insn (gen_absdf2_memory (operands[0], operands[1]));
10446 /* Using SSE is tricky, since we need bitwise negation of -0
10448 rtx reg = gen_reg_rtx (V2DFmode);
10449 #if HOST_BITS_PER_WIDE_INT >= 64
10450 rtx imm = gen_int_mode (~(((HOST_WIDE_INT)1) << 63), DImode);
10452 rtx imm = immed_double_const (~0, ~0x80000000, DImode);
10454 rtx dest = operands[0];
10456 operands[1] = force_reg (DFmode, operands[1]);
10457 operands[0] = force_reg (DFmode, operands[0]);
10459 /* Produce LONG_DOUBLE with the proper immediate argument. */
10460 imm = gen_lowpart (DFmode, imm);
10461 reg = force_reg (V2DFmode,
10462 gen_rtx_CONST_VECTOR (V2DFmode,
10463 gen_rtvec (2, imm, CONST0_RTX (DFmode))));
10464 emit_insn (gen_absdf2_ifs (operands[0], operands[1], reg));
10465 if (dest != operands[0])
10466 emit_move_insn (dest, operands[0]);
10470 ix86_expand_unary_operator (ABS, DFmode, operands); DONE;")
10472 (define_insn "absdf2_memory"
10473 [(set (match_operand:DF 0 "memory_operand" "=m")
10474 (abs:DF (match_operand:DF 1 "memory_operand" "0")))
10475 (clobber (reg:CC 17))]
10476 "ix86_unary_operator_ok (ABS, DFmode, operands)"
10479 (define_insn "absdf2_ifs"
10480 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,mf#Yr,mr#Yf")
10481 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0")))
10482 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r,Ym*r"))
10483 (clobber (reg:CC 17))]
10484 "!TARGET_64BIT && TARGET_SSE2
10485 && (reload_in_progress || reload_completed
10486 || (register_operand (operands[0], VOIDmode)
10487 && register_operand (operands[1], VOIDmode)))"
10490 (define_insn "*absdf2_ifs_rex64"
10491 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,mf#Yr")
10492 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0")))
10493 (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r"))
10494 (clobber (reg:CC 17))]
10495 "TARGET_64BIT && TARGET_SSE2
10496 && (reload_in_progress || reload_completed
10497 || (register_operand (operands[0], VOIDmode)
10498 && register_operand (operands[1], VOIDmode)))"
10502 [(set (match_operand:DF 0 "memory_operand" "")
10503 (abs:DF (match_operand:DF 1 "memory_operand" "")))
10504 (use (match_operand:V2DF 2 "" ""))
10505 (clobber (reg:CC 17))]
10507 [(parallel [(set (match_dup 0)
10508 (abs:DF (match_dup 1)))
10509 (clobber (reg:CC 17))])])
10512 [(set (match_operand:DF 0 "register_operand" "")
10513 (abs:DF (match_operand:DF 1 "register_operand" "")))
10514 (use (match_operand:V2DF 2 "" ""))
10515 (clobber (reg:CC 17))]
10516 "reload_completed && !SSE_REG_P (operands[0])"
10517 [(parallel [(set (match_dup 0)
10518 (abs:DF (match_dup 1)))
10519 (clobber (reg:CC 17))])])
10522 [(set (match_operand:DF 0 "register_operand" "")
10523 (abs:DF (match_operand:DF 1 "register_operand" "")))
10524 (use (match_operand:V2DF 2 "nonimmediate_operand" ""))
10525 (clobber (reg:CC 17))]
10526 "reload_completed && SSE_REG_P (operands[0])"
10527 [(set (subreg:TI (match_dup 0) 0)
10528 (and:TI (match_dup 1)
10531 operands[0] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0);
10532 operands[1] = simplify_gen_subreg (TImode, operands[1], DFmode, 0);
10533 operands[2] = simplify_gen_subreg (TImode, operands[2], V2DFmode, 0);
10534 /* Avoid possible reformatting on the operands. */
10535 if (TARGET_SSE_PARTIAL_REGS && !optimize_size)
10536 emit_insn (gen_sse2_unpcklpd (operands[0], operands[0], operands[0]));
10537 if (operands_match_p (operands[0], operands[2]))
10541 operands[1] = operands[2];
10547 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
10548 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
10550 (define_insn "*absdf2_if"
10551 [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
10552 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
10553 (clobber (reg:CC 17))]
10554 "!TARGET_64BIT && TARGET_80387
10555 && ix86_unary_operator_ok (ABS, DFmode, operands)"
10558 ;; FIXME: We should to allow integer registers here. Problem is that
10559 ;; we need another scratch register to get constant from.
10560 ;; Forcing constant to mem if no register available in peep2 should be
10561 ;; safe even for PIC mode, because of RIP relative addressing.
10562 (define_insn "*absdf2_if_rex64"
10563 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,mf")
10564 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")))
10565 (clobber (reg:CC 17))]
10566 "TARGET_64BIT && TARGET_80387
10567 && ix86_unary_operator_ok (ABS, DFmode, operands)"
10571 [(set (match_operand:DF 0 "fp_register_operand" "")
10572 (abs:DF (match_operand:DF 1 "register_operand" "")))
10573 (clobber (reg:CC 17))]
10574 "TARGET_80387 && reload_completed"
10575 [(set (match_dup 0)
10576 (abs:DF (match_dup 1)))]
10580 [(set (match_operand:DF 0 "register_and_not_fp_reg_operand" "")
10581 (abs:DF (match_operand:DF 1 "register_operand" "")))
10582 (clobber (reg:CC 17))]
10583 "!TARGET_64BIT && TARGET_80387 && reload_completed"
10584 [(parallel [(set (match_dup 3) (and:SI (match_dup 3) (match_dup 4)))
10585 (clobber (reg:CC 17))])]
10586 "operands[4] = gen_int_mode (~0x80000000, SImode);
10587 split_di (operands+0, 1, operands+2, operands+3);")
10589 (define_expand "absxf2"
10590 [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "")
10591 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))
10592 (clobber (reg:CC 17))])]
10593 "!TARGET_64BIT && TARGET_80387"
10594 "ix86_expand_unary_operator (ABS, XFmode, operands); DONE;")
10596 (define_expand "abstf2"
10597 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
10598 (neg:TF (match_operand:TF 1 "nonimmediate_operand" "")))
10599 (clobber (reg:CC 17))])]
10601 "ix86_expand_unary_operator (ABS, TFmode, operands); DONE;")
10603 ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems
10604 ;; because of secondary memory needed to reload from class FLOAT_INT_REGS
10606 (define_insn "*absxf2_if"
10607 [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
10608 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "0,0")))
10609 (clobber (reg:CC 17))]
10610 "!TARGET_64BIT && TARGET_80387
10611 && ix86_unary_operator_ok (ABS, XFmode, operands)"
10615 [(set (match_operand:XF 0 "fp_register_operand" "")
10616 (abs:XF (match_operand:XF 1 "register_operand" "")))
10617 (clobber (reg:CC 17))]
10618 "TARGET_80387 && reload_completed"
10619 [(set (match_dup 0)
10620 (abs:XF (match_dup 1)))]
10624 [(set (match_operand:XF 0 "register_and_not_fp_reg_operand" "")
10625 (abs:XF (match_operand:XF 1 "register_operand" "")))
10626 (clobber (reg:CC 17))]
10627 "TARGET_80387 && reload_completed"
10628 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
10629 (clobber (reg:CC 17))])]
10630 "operands[1] = GEN_INT (~0x8000);
10631 operands[0] = gen_rtx_REG (SImode,
10632 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
10634 (define_insn "*abstf2_if"
10635 [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f")
10636 (abs:TF (match_operand:TF 1 "nonimmediate_operand" "0,0")))
10637 (clobber (reg:CC 17))]
10638 "TARGET_80387 && ix86_unary_operator_ok (ABS, TFmode, operands)"
10642 [(set (match_operand:TF 0 "fp_register_operand" "")
10643 (abs:TF (match_operand:TF 1 "register_operand" "")))
10644 (clobber (reg:CC 17))]
10645 "TARGET_80387 && reload_completed"
10646 [(set (match_dup 0)
10647 (abs:TF (match_dup 1)))]
10651 [(set (match_operand:TF 0 "register_and_not_any_fp_reg_operand" "")
10652 (abs:TF (match_operand:TF 1 "register_operand" "")))
10653 (clobber (reg:CC 17))]
10654 "TARGET_80387 && reload_completed"
10655 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))
10656 (clobber (reg:CC 17))])]
10657 "operands[1] = GEN_INT (~0x8000);
10658 operands[0] = gen_rtx_REG (SImode,
10659 true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));")
10661 (define_insn "*abssf2_1"
10662 [(set (match_operand:SF 0 "register_operand" "=f")
10663 (abs:SF (match_operand:SF 1 "register_operand" "0")))]
10664 "TARGET_80387 && reload_completed"
10666 [(set_attr "type" "fsgn")
10667 (set_attr "mode" "SF")])
10669 (define_insn "*absdf2_1"
10670 [(set (match_operand:DF 0 "register_operand" "=f")
10671 (abs:DF (match_operand:DF 1 "register_operand" "0")))]
10672 "TARGET_80387 && reload_completed"
10674 [(set_attr "type" "fsgn")
10675 (set_attr "mode" "DF")])
10677 (define_insn "*absextendsfdf2"
10678 [(set (match_operand:DF 0 "register_operand" "=f")
10679 (abs:DF (float_extend:DF
10680 (match_operand:SF 1 "register_operand" "0"))))]
10683 [(set_attr "type" "fsgn")
10684 (set_attr "mode" "DF")])
10686 (define_insn "*absxf2_1"
10687 [(set (match_operand:XF 0 "register_operand" "=f")
10688 (abs:XF (match_operand:XF 1 "register_operand" "0")))]
10689 "!TARGET_64BIT && TARGET_80387 && reload_completed"
10691 [(set_attr "type" "fsgn")
10692 (set_attr "mode" "DF")])
10694 (define_insn "*absextenddfxf2"
10695 [(set (match_operand:XF 0 "register_operand" "=f")
10696 (abs:XF (float_extend:XF
10697 (match_operand:DF 1 "register_operand" "0"))))]
10698 "!TARGET_64BIT && TARGET_80387"
10700 [(set_attr "type" "fsgn")
10701 (set_attr "mode" "XF")])
10703 (define_insn "*absextendsfxf2"
10704 [(set (match_operand:XF 0 "register_operand" "=f")
10705 (abs:XF (float_extend:XF
10706 (match_operand:SF 1 "register_operand" "0"))))]
10707 "!TARGET_64BIT && TARGET_80387"
10709 [(set_attr "type" "fsgn")
10710 (set_attr "mode" "XF")])
10712 (define_insn "*abstf2_1"
10713 [(set (match_operand:TF 0 "register_operand" "=f")
10714 (abs:TF (match_operand:TF 1 "register_operand" "0")))]
10715 "TARGET_80387 && reload_completed"
10717 [(set_attr "type" "fsgn")
10718 (set_attr "mode" "DF")])
10720 (define_insn "*absextenddftf2"
10721 [(set (match_operand:TF 0 "register_operand" "=f")
10722 (abs:TF (float_extend:TF
10723 (match_operand:DF 1 "register_operand" "0"))))]
10726 [(set_attr "type" "fsgn")
10727 (set_attr "mode" "XF")])
10729 (define_insn "*absextendsftf2"
10730 [(set (match_operand:TF 0 "register_operand" "=f")
10731 (abs:TF (float_extend:TF
10732 (match_operand:SF 1 "register_operand" "0"))))]
10735 [(set_attr "type" "fsgn")
10736 (set_attr "mode" "XF")])
10738 ;; One complement instructions
10740 (define_expand "one_cmpldi2"
10741 [(set (match_operand:DI 0 "nonimmediate_operand" "")
10742 (not:DI (match_operand:DI 1 "nonimmediate_operand" "")))]
10744 "ix86_expand_unary_operator (NOT, DImode, operands); DONE;")
10746 (define_insn "*one_cmpldi2_1_rex64"
10747 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10748 (not:DI (match_operand:DI 1 "nonimmediate_operand" "0")))]
10749 "TARGET_64BIT && ix86_unary_operator_ok (NOT, DImode, operands)"
10751 [(set_attr "type" "negnot")
10752 (set_attr "mode" "DI")])
10754 (define_insn "*one_cmpldi2_2_rex64"
10756 (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
10758 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
10759 (not:DI (match_dup 1)))]
10760 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
10761 && ix86_unary_operator_ok (NOT, DImode, operands)"
10763 [(set_attr "type" "alu1")
10764 (set_attr "mode" "DI")])
10768 (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" ""))
10770 (set (match_operand:DI 0 "nonimmediate_operand" "")
10771 (not:DI (match_dup 1)))]
10772 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
10773 [(parallel [(set (reg:CCNO 17)
10774 (compare:CCNO (xor:DI (match_dup 1) (const_int -1))
10777 (xor:DI (match_dup 1) (const_int -1)))])]
10780 (define_expand "one_cmplsi2"
10781 [(set (match_operand:SI 0 "nonimmediate_operand" "")
10782 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
10784 "ix86_expand_unary_operator (NOT, SImode, operands); DONE;")
10786 (define_insn "*one_cmplsi2_1"
10787 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10788 (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
10789 "ix86_unary_operator_ok (NOT, SImode, operands)"
10791 [(set_attr "type" "negnot")
10792 (set_attr "mode" "SI")])
10794 ;; ??? Currently never generated - xor is used instead.
10795 (define_insn "*one_cmplsi2_1_zext"
10796 [(set (match_operand:DI 0 "register_operand" "=r")
10797 (zero_extend:DI (not:SI (match_operand:SI 1 "register_operand" "0"))))]
10798 "TARGET_64BIT && ix86_unary_operator_ok (NOT, SImode, operands)"
10800 [(set_attr "type" "negnot")
10801 (set_attr "mode" "SI")])
10803 (define_insn "*one_cmplsi2_2"
10805 (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
10807 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
10808 (not:SI (match_dup 1)))]
10809 "ix86_match_ccmode (insn, CCNOmode)
10810 && ix86_unary_operator_ok (NOT, SImode, operands)"
10812 [(set_attr "type" "alu1")
10813 (set_attr "mode" "SI")])
10817 (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" ""))
10819 (set (match_operand:SI 0 "nonimmediate_operand" "")
10820 (not:SI (match_dup 1)))]
10821 "ix86_match_ccmode (insn, CCNOmode)"
10822 [(parallel [(set (reg:CCNO 17)
10823 (compare:CCNO (xor:SI (match_dup 1) (const_int -1))
10826 (xor:SI (match_dup 1) (const_int -1)))])]
10829 ;; ??? Currently never generated - xor is used instead.
10830 (define_insn "*one_cmplsi2_2_zext"
10832 (compare (not:SI (match_operand:SI 1 "register_operand" "0"))
10834 (set (match_operand:DI 0 "register_operand" "=r")
10835 (zero_extend:DI (not:SI (match_dup 1))))]
10836 "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
10837 && ix86_unary_operator_ok (NOT, SImode, operands)"
10839 [(set_attr "type" "alu1")
10840 (set_attr "mode" "SI")])
10844 (compare (not:SI (match_operand:SI 1 "register_operand" ""))
10846 (set (match_operand:DI 0 "register_operand" "")
10847 (zero_extend:DI (not:SI (match_dup 1))))]
10848 "ix86_match_ccmode (insn, CCNOmode)"
10849 [(parallel [(set (reg:CCNO 17)
10850 (compare:CCNO (xor:SI (match_dup 1) (const_int -1))
10853 (zero_extend:DI (xor:SI (match_dup 1) (const_int -1))))])]
10856 (define_expand "one_cmplhi2"
10857 [(set (match_operand:HI 0 "nonimmediate_operand" "")
10858 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
10859 "TARGET_HIMODE_MATH"
10860 "ix86_expand_unary_operator (NOT, HImode, operands); DONE;")
10862 (define_insn "*one_cmplhi2_1"
10863 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10864 (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
10865 "ix86_unary_operator_ok (NOT, HImode, operands)"
10867 [(set_attr "type" "negnot")
10868 (set_attr "mode" "HI")])
10870 (define_insn "*one_cmplhi2_2"
10872 (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
10874 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
10875 (not:HI (match_dup 1)))]
10876 "ix86_match_ccmode (insn, CCNOmode)
10877 && ix86_unary_operator_ok (NEG, HImode, operands)"
10879 [(set_attr "type" "alu1")
10880 (set_attr "mode" "HI")])
10884 (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" ""))
10886 (set (match_operand:HI 0 "nonimmediate_operand" "")
10887 (not:HI (match_dup 1)))]
10888 "ix86_match_ccmode (insn, CCNOmode)"
10889 [(parallel [(set (reg:CCNO 17)
10890 (compare:CCNO (xor:HI (match_dup 1) (const_int -1))
10893 (xor:HI (match_dup 1) (const_int -1)))])]
10896 ;; %%% Potential partial reg stall on alternative 1. What to do?
10897 (define_expand "one_cmplqi2"
10898 [(set (match_operand:QI 0 "nonimmediate_operand" "")
10899 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
10900 "TARGET_QIMODE_MATH"
10901 "ix86_expand_unary_operator (NOT, QImode, operands); DONE;")
10903 (define_insn "*one_cmplqi2_1"
10904 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
10905 (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
10906 "ix86_unary_operator_ok (NOT, QImode, operands)"
10910 [(set_attr "type" "negnot")
10911 (set_attr "mode" "QI,SI")])
10913 (define_insn "*one_cmplqi2_2"
10915 (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
10917 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
10918 (not:QI (match_dup 1)))]
10919 "ix86_match_ccmode (insn, CCNOmode)
10920 && ix86_unary_operator_ok (NOT, QImode, operands)"
10922 [(set_attr "type" "alu1")
10923 (set_attr "mode" "QI")])
10927 (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" ""))
10929 (set (match_operand:QI 0 "nonimmediate_operand" "")
10930 (not:QI (match_dup 1)))]
10931 "ix86_match_ccmode (insn, CCNOmode)"
10932 [(parallel [(set (reg:CCNO 17)
10933 (compare:CCNO (xor:QI (match_dup 1) (const_int -1))
10936 (xor:QI (match_dup 1) (const_int -1)))])]
10939 ;; Arithmetic shift instructions
10941 ;; DImode shifts are implemented using the i386 "shift double" opcode,
10942 ;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count
10943 ;; is variable, then the count is in %cl and the "imm" operand is dropped
10944 ;; from the assembler input.
10946 ;; This instruction shifts the target reg/mem as usual, but instead of
10947 ;; shifting in zeros, bits are shifted in from reg operand. If the insn
10948 ;; is a left shift double, bits are taken from the high order bits of
10949 ;; reg, else if the insn is a shift right double, bits are taken from the
10950 ;; low order bits of reg. So if %eax is "1234" and %edx is "5678",
10951 ;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345".
10953 ;; Since sh[lr]d does not change the `reg' operand, that is done
10954 ;; separately, making all shifts emit pairs of shift double and normal
10955 ;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to
10956 ;; support a 63 bit shift, each shift where the count is in a reg expands
10957 ;; to a pair of shifts, a branch, a shift by 32 and a label.
10959 ;; If the shift count is a constant, we need never emit more than one
10960 ;; shift pair, instead using moves and sign extension for counts greater
10963 (define_expand "ashldi3"
10964 [(parallel [(set (match_operand:DI 0 "shiftdi_operand" "")
10965 (ashift:DI (match_operand:DI 1 "shiftdi_operand" "")
10966 (match_operand:QI 2 "nonmemory_operand" "")))
10967 (clobber (reg:CC 17))])]
10970 if (!TARGET_64BIT && TARGET_CMOVE && ! immediate_operand (operands[2], QImode))
10972 emit_insn (gen_ashldi3_1 (operands[0], operands[1], operands[2]));
10975 ix86_expand_binary_operator (ASHIFT, DImode, operands);
10979 (define_insn "*ashldi3_1_rex64"
10980 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
10981 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0,r")
10982 (match_operand:QI 2 "nonmemory_operand" "cJ,M")))
10983 (clobber (reg:CC 17))]
10984 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
10986 switch (get_attr_type (insn))
10989 if (operands[2] != const1_rtx)
10991 if (!rtx_equal_p (operands[0], operands[1]))
10993 return "add{q}\t{%0, %0|%0, %0}";
10996 if (GET_CODE (operands[2]) != CONST_INT
10997 || (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 3)
10999 operands[1] = gen_rtx_MULT (DImode, operands[1],
11000 GEN_INT (1 << INTVAL (operands[2])));
11001 return "lea{q}\t{%a1, %0|%0, %a1}";
11004 if (REG_P (operands[2]))
11005 return "sal{q}\t{%b2, %0|%0, %b2}";
11006 else if (GET_CODE (operands[2]) == CONST_INT
11007 && INTVAL (operands[2]) == 1
11008 && (TARGET_SHIFT1 || optimize_size))
11009 return "sal{q}\t%0";
11011 return "sal{q}\t{%2, %0|%0, %2}";
11014 [(set (attr "type")
11015 (cond [(eq_attr "alternative" "1")
11016 (const_string "lea")
11017 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11019 (match_operand 0 "register_operand" ""))
11020 (match_operand 2 "const1_operand" ""))
11021 (const_string "alu")
11023 (const_string "ishift")))
11024 (set_attr "mode" "DI")])
11026 ;; Convert lea to the lea pattern to avoid flags dependency.
11028 [(set (match_operand:DI 0 "register_operand" "")
11029 (ashift:DI (match_operand:DI 1 "register_operand" "")
11030 (match_operand:QI 2 "immediate_operand" "")))
11031 (clobber (reg:CC 17))]
11032 "TARGET_64BIT && reload_completed
11033 && true_regnum (operands[0]) != true_regnum (operands[1])"
11034 [(set (match_dup 0)
11035 (mult:DI (match_dup 1)
11037 "operands[2] = gen_int_mode (1 << INTVAL (operands[2]), DImode);")
11039 ;; This pattern can't accept a variable shift count, since shifts by
11040 ;; zero don't affect the flags. We assume that shifts by constant
11041 ;; zero are optimized away.
11042 (define_insn "*ashldi3_cmp_rex64"
11045 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11046 (match_operand:QI 2 "immediate_operand" "e"))
11048 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11049 (ashift:DI (match_dup 1) (match_dup 2)))]
11050 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11051 && ix86_binary_operator_ok (ASHIFT, DImode, operands)"
11053 switch (get_attr_type (insn))
11056 if (operands[2] != const1_rtx)
11058 return "add{q}\t{%0, %0|%0, %0}";
11061 if (REG_P (operands[2]))
11062 return "sal{q}\t{%b2, %0|%0, %b2}";
11063 else if (GET_CODE (operands[2]) == CONST_INT
11064 && INTVAL (operands[2]) == 1
11065 && (TARGET_SHIFT1 || optimize_size))
11066 return "sal{q}\t%0";
11068 return "sal{q}\t{%2, %0|%0, %2}";
11071 [(set (attr "type")
11072 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11074 (match_operand 0 "register_operand" ""))
11075 (match_operand 2 "const1_operand" ""))
11076 (const_string "alu")
11078 (const_string "ishift")))
11079 (set_attr "mode" "DI")])
11081 (define_insn "ashldi3_1"
11082 [(set (match_operand:DI 0 "register_operand" "=r")
11083 (ashift:DI (match_operand:DI 1 "register_operand" "0")
11084 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11085 (clobber (match_scratch:SI 3 "=&r"))
11086 (clobber (reg:CC 17))]
11087 "!TARGET_64BIT && TARGET_CMOVE"
11089 [(set_attr "type" "multi")])
11091 (define_insn "*ashldi3_2"
11092 [(set (match_operand:DI 0 "register_operand" "=r")
11093 (ashift:DI (match_operand:DI 1 "register_operand" "0")
11094 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11095 (clobber (reg:CC 17))]
11098 [(set_attr "type" "multi")])
11101 [(set (match_operand:DI 0 "register_operand" "")
11102 (ashift:DI (match_operand:DI 1 "register_operand" "")
11103 (match_operand:QI 2 "nonmemory_operand" "")))
11104 (clobber (match_scratch:SI 3 ""))
11105 (clobber (reg:CC 17))]
11106 "!TARGET_64BIT && TARGET_CMOVE && reload_completed"
11108 "ix86_split_ashldi (operands, operands[3]); DONE;")
11111 [(set (match_operand:DI 0 "register_operand" "")
11112 (ashift:DI (match_operand:DI 1 "register_operand" "")
11113 (match_operand:QI 2 "nonmemory_operand" "")))
11114 (clobber (reg:CC 17))]
11115 "!TARGET_64BIT && reload_completed"
11117 "ix86_split_ashldi (operands, NULL_RTX); DONE;")
11119 (define_insn "x86_shld_1"
11120 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
11121 (ior:SI (ashift:SI (match_dup 0)
11122 (match_operand:QI 2 "nonmemory_operand" "I,c"))
11123 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
11124 (minus:QI (const_int 32) (match_dup 2)))))
11125 (clobber (reg:CC 17))]
11128 shld{l}\t{%2, %1, %0|%0, %1, %2}
11129 shld{l}\t{%s2%1, %0|%0, %1, %2}"
11130 [(set_attr "type" "ishift")
11131 (set_attr "prefix_0f" "1")
11132 (set_attr "mode" "SI")
11133 (set_attr "pent_pair" "np")
11134 (set_attr "athlon_decode" "vector")
11135 (set_attr "ppro_uops" "few")])
11137 (define_expand "x86_shift_adj_1"
11139 (compare:CCZ (and:QI (match_operand:QI 2 "register_operand" "")
11142 (set (match_operand:SI 0 "register_operand" "")
11143 (if_then_else:SI (ne (reg:CCZ 17) (const_int 0))
11144 (match_operand:SI 1 "register_operand" "")
11147 (if_then_else:SI (ne (reg:CCZ 17) (const_int 0))
11148 (match_operand:SI 3 "register_operand" "r")
11153 (define_expand "x86_shift_adj_2"
11154 [(use (match_operand:SI 0 "register_operand" ""))
11155 (use (match_operand:SI 1 "register_operand" ""))
11156 (use (match_operand:QI 2 "register_operand" ""))]
11159 rtx label = gen_label_rtx ();
11162 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
11164 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
11165 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
11166 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
11167 gen_rtx_LABEL_REF (VOIDmode, label),
11169 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
11170 JUMP_LABEL (tmp) = label;
11172 emit_move_insn (operands[0], operands[1]);
11173 emit_move_insn (operands[1], const0_rtx);
11175 emit_label (label);
11176 LABEL_NUSES (label) = 1;
11181 (define_expand "ashlsi3"
11182 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11183 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "")
11184 (match_operand:QI 2 "nonmemory_operand" "")))
11185 (clobber (reg:CC 17))]
11187 "ix86_expand_binary_operator (ASHIFT, SImode, operands); DONE;")
11189 (define_insn "*ashlsi3_1"
11190 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
11191 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,r")
11192 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
11193 (clobber (reg:CC 17))]
11194 "ix86_binary_operator_ok (ASHIFT, SImode, operands)"
11196 switch (get_attr_type (insn))
11199 if (operands[2] != const1_rtx)
11201 if (!rtx_equal_p (operands[0], operands[1]))
11203 return "add{l}\t{%0, %0|%0, %0}";
11209 if (REG_P (operands[2]))
11210 return "sal{l}\t{%b2, %0|%0, %b2}";
11211 else if (GET_CODE (operands[2]) == CONST_INT
11212 && INTVAL (operands[2]) == 1
11213 && (TARGET_SHIFT1 || optimize_size))
11214 return "sal{l}\t%0";
11216 return "sal{l}\t{%2, %0|%0, %2}";
11219 [(set (attr "type")
11220 (cond [(eq_attr "alternative" "1")
11221 (const_string "lea")
11222 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11224 (match_operand 0 "register_operand" ""))
11225 (match_operand 2 "const1_operand" ""))
11226 (const_string "alu")
11228 (const_string "ishift")))
11229 (set_attr "mode" "SI")])
11231 ;; Convert lea to the lea pattern to avoid flags dependency.
11233 [(set (match_operand 0 "register_operand" "")
11234 (ashift (match_operand 1 "index_register_operand" "")
11235 (match_operand:QI 2 "const_int_operand" "")))
11236 (clobber (reg:CC 17))]
11238 && true_regnum (operands[0]) != true_regnum (operands[1])"
11242 operands[0] = gen_lowpart (SImode, operands[0]);
11243 operands[1] = gen_lowpart (Pmode, operands[1]);
11244 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
11245 pat = gen_rtx_MULT (Pmode, operands[1], operands[2]);
11246 if (Pmode != SImode)
11247 pat = gen_rtx_SUBREG (SImode, pat, 0);
11248 emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
11252 ;; Rare case of shifting RSP is handled by generating move and shift
11254 [(set (match_operand 0 "register_operand" "")
11255 (ashift (match_operand 1 "register_operand" "")
11256 (match_operand:QI 2 "const_int_operand" "")))
11257 (clobber (reg:CC 17))]
11259 && true_regnum (operands[0]) != true_regnum (operands[1])"
11263 emit_move_insn (operands[1], operands[0]);
11264 pat = gen_rtx_SET (VOIDmode, operands[0],
11265 gen_rtx_ASHIFT (GET_MODE (operands[0]),
11266 operands[0], operands[2]));
11267 clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
11268 emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, pat, clob)));
11272 (define_insn "*ashlsi3_1_zext"
11273 [(set (match_operand:DI 0 "register_operand" "=r,r")
11274 (zero_extend:DI (ashift:SI (match_operand:SI 1 "register_operand" "0,r")
11275 (match_operand:QI 2 "nonmemory_operand" "cI,M"))))
11276 (clobber (reg:CC 17))]
11277 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
11279 switch (get_attr_type (insn))
11282 if (operands[2] != const1_rtx)
11284 return "add{l}\t{%k0, %k0|%k0, %k0}";
11290 if (REG_P (operands[2]))
11291 return "sal{l}\t{%b2, %k0|%k0, %b2}";
11292 else if (GET_CODE (operands[2]) == CONST_INT
11293 && INTVAL (operands[2]) == 1
11294 && (TARGET_SHIFT1 || optimize_size))
11295 return "sal{l}\t%k0";
11297 return "sal{l}\t{%2, %k0|%k0, %2}";
11300 [(set (attr "type")
11301 (cond [(eq_attr "alternative" "1")
11302 (const_string "lea")
11303 (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11305 (match_operand 2 "const1_operand" ""))
11306 (const_string "alu")
11308 (const_string "ishift")))
11309 (set_attr "mode" "SI")])
11311 ;; Convert lea to the lea pattern to avoid flags dependency.
11313 [(set (match_operand:DI 0 "register_operand" "")
11314 (zero_extend:DI (ashift (match_operand 1 "register_operand" "")
11315 (match_operand:QI 2 "const_int_operand" ""))))
11316 (clobber (reg:CC 17))]
11317 "TARGET_64BIT && reload_completed
11318 && true_regnum (operands[0]) != true_regnum (operands[1])"
11319 [(set (match_dup 0) (zero_extend:DI
11320 (subreg:SI (mult:SI (match_dup 1)
11321 (match_dup 2)) 0)))]
11323 operands[1] = gen_lowpart (Pmode, operands[1]);
11324 operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
11327 ;; This pattern can't accept a variable shift count, since shifts by
11328 ;; zero don't affect the flags. We assume that shifts by constant
11329 ;; zero are optimized away.
11330 (define_insn "*ashlsi3_cmp"
11333 (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11334 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11336 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11337 (ashift:SI (match_dup 1) (match_dup 2)))]
11338 "ix86_match_ccmode (insn, CCGOCmode)
11339 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
11341 switch (get_attr_type (insn))
11344 if (operands[2] != const1_rtx)
11346 return "add{l}\t{%0, %0|%0, %0}";
11349 if (REG_P (operands[2]))
11350 return "sal{l}\t{%b2, %0|%0, %b2}";
11351 else if (GET_CODE (operands[2]) == CONST_INT
11352 && INTVAL (operands[2]) == 1
11353 && (TARGET_SHIFT1 || optimize_size))
11354 return "sal{l}\t%0";
11356 return "sal{l}\t{%2, %0|%0, %2}";
11359 [(set (attr "type")
11360 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11362 (match_operand 0 "register_operand" ""))
11363 (match_operand 2 "const1_operand" ""))
11364 (const_string "alu")
11366 (const_string "ishift")))
11367 (set_attr "mode" "SI")])
11369 (define_insn "*ashlsi3_cmp_zext"
11372 (ashift:SI (match_operand:SI 1 "register_operand" "0")
11373 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11375 (set (match_operand:DI 0 "register_operand" "=r")
11376 (zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))]
11377 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11378 && ix86_binary_operator_ok (ASHIFT, SImode, operands)"
11380 switch (get_attr_type (insn))
11383 if (operands[2] != const1_rtx)
11385 return "add{l}\t{%k0, %k0|%k0, %k0}";
11388 if (REG_P (operands[2]))
11389 return "sal{l}\t{%b2, %k0|%k0, %b2}";
11390 else if (GET_CODE (operands[2]) == CONST_INT
11391 && INTVAL (operands[2]) == 1
11392 && (TARGET_SHIFT1 || optimize_size))
11393 return "sal{l}\t%k0";
11395 return "sal{l}\t{%2, %k0|%k0, %2}";
11398 [(set (attr "type")
11399 (cond [(and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11401 (match_operand 2 "const1_operand" ""))
11402 (const_string "alu")
11404 (const_string "ishift")))
11405 (set_attr "mode" "SI")])
11407 (define_expand "ashlhi3"
11408 [(set (match_operand:HI 0 "nonimmediate_operand" "")
11409 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "")
11410 (match_operand:QI 2 "nonmemory_operand" "")))
11411 (clobber (reg:CC 17))]
11412 "TARGET_HIMODE_MATH"
11413 "ix86_expand_binary_operator (ASHIFT, HImode, operands); DONE;")
11415 (define_insn "*ashlhi3_1_lea"
11416 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
11417 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,r")
11418 (match_operand:QI 2 "nonmemory_operand" "cI,M")))
11419 (clobber (reg:CC 17))]
11420 "!TARGET_PARTIAL_REG_STALL
11421 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
11423 switch (get_attr_type (insn))
11428 if (operands[2] != const1_rtx)
11430 return "add{w}\t{%0, %0|%0, %0}";
11433 if (REG_P (operands[2]))
11434 return "sal{w}\t{%b2, %0|%0, %b2}";
11435 else if (GET_CODE (operands[2]) == CONST_INT
11436 && INTVAL (operands[2]) == 1
11437 && (TARGET_SHIFT1 || optimize_size))
11438 return "sal{w}\t%0";
11440 return "sal{w}\t{%2, %0|%0, %2}";
11443 [(set (attr "type")
11444 (cond [(eq_attr "alternative" "1")
11445 (const_string "lea")
11446 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11448 (match_operand 0 "register_operand" ""))
11449 (match_operand 2 "const1_operand" ""))
11450 (const_string "alu")
11452 (const_string "ishift")))
11453 (set_attr "mode" "HI,SI")])
11455 (define_insn "*ashlhi3_1"
11456 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11457 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11458 (match_operand:QI 2 "nonmemory_operand" "cI")))
11459 (clobber (reg:CC 17))]
11460 "TARGET_PARTIAL_REG_STALL
11461 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
11463 switch (get_attr_type (insn))
11466 if (operands[2] != const1_rtx)
11468 return "add{w}\t{%0, %0|%0, %0}";
11471 if (REG_P (operands[2]))
11472 return "sal{w}\t{%b2, %0|%0, %b2}";
11473 else if (GET_CODE (operands[2]) == CONST_INT
11474 && INTVAL (operands[2]) == 1
11475 && (TARGET_SHIFT1 || optimize_size))
11476 return "sal{w}\t%0";
11478 return "sal{w}\t{%2, %0|%0, %2}";
11481 [(set (attr "type")
11482 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11484 (match_operand 0 "register_operand" ""))
11485 (match_operand 2 "const1_operand" ""))
11486 (const_string "alu")
11488 (const_string "ishift")))
11489 (set_attr "mode" "HI")])
11491 ;; This pattern can't accept a variable shift count, since shifts by
11492 ;; zero don't affect the flags. We assume that shifts by constant
11493 ;; zero are optimized away.
11494 (define_insn "*ashlhi3_cmp"
11497 (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
11498 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11500 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
11501 (ashift:HI (match_dup 1) (match_dup 2)))]
11502 "ix86_match_ccmode (insn, CCGOCmode)
11503 && ix86_binary_operator_ok (ASHIFT, HImode, operands)"
11505 switch (get_attr_type (insn))
11508 if (operands[2] != const1_rtx)
11510 return "add{w}\t{%0, %0|%0, %0}";
11513 if (REG_P (operands[2]))
11514 return "sal{w}\t{%b2, %0|%0, %b2}";
11515 else if (GET_CODE (operands[2]) == CONST_INT
11516 && INTVAL (operands[2]) == 1
11517 && (TARGET_SHIFT1 || optimize_size))
11518 return "sal{w}\t%0";
11520 return "sal{w}\t{%2, %0|%0, %2}";
11523 [(set (attr "type")
11524 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11526 (match_operand 0 "register_operand" ""))
11527 (match_operand 2 "const1_operand" ""))
11528 (const_string "alu")
11530 (const_string "ishift")))
11531 (set_attr "mode" "HI")])
11533 (define_expand "ashlqi3"
11534 [(set (match_operand:QI 0 "nonimmediate_operand" "")
11535 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "")
11536 (match_operand:QI 2 "nonmemory_operand" "")))
11537 (clobber (reg:CC 17))]
11538 "TARGET_QIMODE_MATH"
11539 "ix86_expand_binary_operator (ASHIFT, QImode, operands); DONE;")
11541 ;; %%% Potential partial reg stall on alternative 2. What to do?
11543 (define_insn "*ashlqi3_1_lea"
11544 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,r")
11545 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,r")
11546 (match_operand:QI 2 "nonmemory_operand" "cI,cI,M")))
11547 (clobber (reg:CC 17))]
11548 "!TARGET_PARTIAL_REG_STALL
11549 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
11551 switch (get_attr_type (insn))
11556 if (operands[2] != const1_rtx)
11558 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
11559 return "add{l}\t{%k0, %k0|%k0, %k0}";
11561 return "add{b}\t{%0, %0|%0, %0}";
11564 if (REG_P (operands[2]))
11566 if (get_attr_mode (insn) == MODE_SI)
11567 return "sal{l}\t{%b2, %k0|%k0, %b2}";
11569 return "sal{b}\t{%b2, %0|%0, %b2}";
11571 else if (GET_CODE (operands[2]) == CONST_INT
11572 && INTVAL (operands[2]) == 1
11573 && (TARGET_SHIFT1 || optimize_size))
11575 if (get_attr_mode (insn) == MODE_SI)
11576 return "sal{l}\t%0";
11578 return "sal{b}\t%0";
11582 if (get_attr_mode (insn) == MODE_SI)
11583 return "sal{l}\t{%2, %k0|%k0, %2}";
11585 return "sal{b}\t{%2, %0|%0, %2}";
11589 [(set (attr "type")
11590 (cond [(eq_attr "alternative" "2")
11591 (const_string "lea")
11592 (and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11594 (match_operand 0 "register_operand" ""))
11595 (match_operand 2 "const1_operand" ""))
11596 (const_string "alu")
11598 (const_string "ishift")))
11599 (set_attr "mode" "QI,SI,SI")])
11601 (define_insn "*ashlqi3_1"
11602 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
11603 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
11604 (match_operand:QI 2 "nonmemory_operand" "cI,cI")))
11605 (clobber (reg:CC 17))]
11606 "TARGET_PARTIAL_REG_STALL
11607 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
11609 switch (get_attr_type (insn))
11612 if (operands[2] != const1_rtx)
11614 if (REG_P (operands[1]) && !ANY_QI_REG_P (operands[1]))
11615 return "add{l}\t{%k0, %k0|%k0, %k0}";
11617 return "add{b}\t{%0, %0|%0, %0}";
11620 if (REG_P (operands[2]))
11622 if (get_attr_mode (insn) == MODE_SI)
11623 return "sal{l}\t{%b2, %k0|%k0, %b2}";
11625 return "sal{b}\t{%b2, %0|%0, %b2}";
11627 else if (GET_CODE (operands[2]) == CONST_INT
11628 && INTVAL (operands[2]) == 1
11629 && (TARGET_SHIFT1 || optimize_size))
11631 if (get_attr_mode (insn) == MODE_SI)
11632 return "sal{l}\t%0";
11634 return "sal{b}\t%0";
11638 if (get_attr_mode (insn) == MODE_SI)
11639 return "sal{l}\t{%2, %k0|%k0, %2}";
11641 return "sal{b}\t{%2, %0|%0, %2}";
11645 [(set (attr "type")
11646 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11648 (match_operand 0 "register_operand" ""))
11649 (match_operand 2 "const1_operand" ""))
11650 (const_string "alu")
11652 (const_string "ishift")))
11653 (set_attr "mode" "QI,SI")])
11655 ;; This pattern can't accept a variable shift count, since shifts by
11656 ;; zero don't affect the flags. We assume that shifts by constant
11657 ;; zero are optimized away.
11658 (define_insn "*ashlqi3_cmp"
11661 (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
11662 (match_operand:QI 2 "const_int_1_31_operand" "I"))
11664 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
11665 (ashift:QI (match_dup 1) (match_dup 2)))]
11666 "ix86_match_ccmode (insn, CCGOCmode)
11667 && ix86_binary_operator_ok (ASHIFT, QImode, operands)"
11669 switch (get_attr_type (insn))
11672 if (operands[2] != const1_rtx)
11674 return "add{b}\t{%0, %0|%0, %0}";
11677 if (REG_P (operands[2]))
11678 return "sal{b}\t{%b2, %0|%0, %b2}";
11679 else if (GET_CODE (operands[2]) == CONST_INT
11680 && INTVAL (operands[2]) == 1
11681 && (TARGET_SHIFT1 || optimize_size))
11682 return "sal{b}\t%0";
11684 return "sal{b}\t{%2, %0|%0, %2}";
11687 [(set (attr "type")
11688 (cond [(and (and (ne (symbol_ref "TARGET_DOUBLE_WITH_ADD")
11690 (match_operand 0 "register_operand" ""))
11691 (match_operand 2 "const1_operand" ""))
11692 (const_string "alu")
11694 (const_string "ishift")))
11695 (set_attr "mode" "QI")])
11697 ;; See comment above `ashldi3' about how this works.
11699 (define_expand "ashrdi3"
11700 [(parallel [(set (match_operand:DI 0 "shiftdi_operand" "")
11701 (ashiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
11702 (match_operand:QI 2 "nonmemory_operand" "")))
11703 (clobber (reg:CC 17))])]
11706 if (!TARGET_64BIT && TARGET_CMOVE && ! immediate_operand (operands[2], QImode))
11708 emit_insn (gen_ashrdi3_1 (operands[0], operands[1], operands[2]));
11711 ix86_expand_binary_operator (ASHIFTRT, DImode, operands);
11715 (define_insn "ashrdi3_63_rex64"
11716 [(set (match_operand:DI 0 "nonimmediate_operand" "=*d,rm")
11717 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "*a,0")
11718 (match_operand:DI 2 "const_int_operand" "i,i")))
11719 (clobber (reg:CC 17))]
11720 "TARGET_64BIT && INTVAL (operands[2]) == 63 && (TARGET_USE_CLTD || optimize_size)
11721 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11724 sar{q}\t{%2, %0|%0, %2}"
11725 [(set_attr "type" "imovx,ishift")
11726 (set_attr "prefix_0f" "0,*")
11727 (set_attr "length_immediate" "0,*")
11728 (set_attr "modrm" "0,1")
11729 (set_attr "mode" "DI")])
11731 (define_insn "*ashrdi3_1_one_bit_rex64"
11732 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11733 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11734 (match_operand:QI 2 "const_int_1_operand" "")))
11735 (clobber (reg:CC 17))]
11736 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)
11737 && (TARGET_SHIFT1 || optimize_size)"
11739 [(set_attr "type" "ishift")
11740 (set (attr "length")
11741 (if_then_else (match_operand:DI 0 "register_operand" "")
11743 (const_string "*")))])
11745 (define_insn "*ashrdi3_1_rex64"
11746 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
11747 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
11748 (match_operand:QI 2 "nonmemory_operand" "J,c")))
11749 (clobber (reg:CC 17))]
11750 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11752 sar{q}\t{%2, %0|%0, %2}
11753 sar{q}\t{%b2, %0|%0, %b2}"
11754 [(set_attr "type" "ishift")
11755 (set_attr "mode" "DI")])
11757 ;; This pattern can't accept a variable shift count, since shifts by
11758 ;; zero don't affect the flags. We assume that shifts by constant
11759 ;; zero are optimized away.
11760 (define_insn "*ashrdi3_one_bit_cmp_rex64"
11763 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11764 (match_operand:QI 2 "const_int_1_operand" ""))
11766 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11767 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
11768 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11769 && (TARGET_SHIFT1 || optimize_size)
11770 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11772 [(set_attr "type" "ishift")
11773 (set (attr "length")
11774 (if_then_else (match_operand:DI 0 "register_operand" "")
11776 (const_string "*")))])
11778 ;; This pattern can't accept a variable shift count, since shifts by
11779 ;; zero don't affect the flags. We assume that shifts by constant
11780 ;; zero are optimized away.
11781 (define_insn "*ashrdi3_cmp_rex64"
11784 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
11785 (match_operand:QI 2 "const_int_operand" "n"))
11787 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
11788 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
11789 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
11790 && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
11791 "sar{q}\t{%2, %0|%0, %2}"
11792 [(set_attr "type" "ishift")
11793 (set_attr "mode" "DI")])
11796 (define_insn "ashrdi3_1"
11797 [(set (match_operand:DI 0 "register_operand" "=r")
11798 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
11799 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11800 (clobber (match_scratch:SI 3 "=&r"))
11801 (clobber (reg:CC 17))]
11802 "!TARGET_64BIT && TARGET_CMOVE"
11804 [(set_attr "type" "multi")])
11806 (define_insn "*ashrdi3_2"
11807 [(set (match_operand:DI 0 "register_operand" "=r")
11808 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
11809 (match_operand:QI 2 "nonmemory_operand" "Jc")))
11810 (clobber (reg:CC 17))]
11813 [(set_attr "type" "multi")])
11816 [(set (match_operand:DI 0 "register_operand" "")
11817 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
11818 (match_operand:QI 2 "nonmemory_operand" "")))
11819 (clobber (match_scratch:SI 3 ""))
11820 (clobber (reg:CC 17))]
11821 "!TARGET_64BIT && TARGET_CMOVE && reload_completed"
11823 "ix86_split_ashrdi (operands, operands[3]); DONE;")
11826 [(set (match_operand:DI 0 "register_operand" "")
11827 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
11828 (match_operand:QI 2 "nonmemory_operand" "")))
11829 (clobber (reg:CC 17))]
11830 "!TARGET_64BIT && reload_completed"
11832 "ix86_split_ashrdi (operands, NULL_RTX); DONE;")
11834 (define_insn "x86_shrd_1"
11835 [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m")
11836 (ior:SI (ashiftrt:SI (match_dup 0)
11837 (match_operand:QI 2 "nonmemory_operand" "I,c"))
11838 (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
11839 (minus:QI (const_int 32) (match_dup 2)))))
11840 (clobber (reg:CC 17))]
11843 shrd{l}\t{%2, %1, %0|%0, %1, %2}
11844 shrd{l}\t{%s2%1, %0|%0, %1, %2}"
11845 [(set_attr "type" "ishift")
11846 (set_attr "prefix_0f" "1")
11847 (set_attr "pent_pair" "np")
11848 (set_attr "ppro_uops" "few")
11849 (set_attr "mode" "SI")])
11851 (define_expand "x86_shift_adj_3"
11852 [(use (match_operand:SI 0 "register_operand" ""))
11853 (use (match_operand:SI 1 "register_operand" ""))
11854 (use (match_operand:QI 2 "register_operand" ""))]
11857 rtx label = gen_label_rtx ();
11860 emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (32)));
11862 tmp = gen_rtx_REG (CCZmode, FLAGS_REG);
11863 tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx);
11864 tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
11865 gen_rtx_LABEL_REF (VOIDmode, label),
11867 tmp = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
11868 JUMP_LABEL (tmp) = label;
11870 emit_move_insn (operands[0], operands[1]);
11871 emit_insn (gen_ashrsi3_31 (operands[1], operands[1], GEN_INT (31)));
11873 emit_label (label);
11874 LABEL_NUSES (label) = 1;
11879 (define_insn "ashrsi3_31"
11880 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,rm")
11881 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "*a,0")
11882 (match_operand:SI 2 "const_int_operand" "i,i")))
11883 (clobber (reg:CC 17))]
11884 "INTVAL (operands[2]) == 31 && (TARGET_USE_CLTD || optimize_size)
11885 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11888 sar{l}\t{%2, %0|%0, %2}"
11889 [(set_attr "type" "imovx,ishift")
11890 (set_attr "prefix_0f" "0,*")
11891 (set_attr "length_immediate" "0,*")
11892 (set_attr "modrm" "0,1")
11893 (set_attr "mode" "SI")])
11895 (define_insn "*ashrsi3_31_zext"
11896 [(set (match_operand:DI 0 "register_operand" "=*d,r")
11897 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "*a,0")
11898 (match_operand:SI 2 "const_int_operand" "i,i"))))
11899 (clobber (reg:CC 17))]
11900 "TARGET_64BIT && (TARGET_USE_CLTD || optimize_size)
11901 && INTVAL (operands[2]) == 31
11902 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11905 sar{l}\t{%2, %k0|%k0, %2}"
11906 [(set_attr "type" "imovx,ishift")
11907 (set_attr "prefix_0f" "0,*")
11908 (set_attr "length_immediate" "0,*")
11909 (set_attr "modrm" "0,1")
11910 (set_attr "mode" "SI")])
11912 (define_expand "ashrsi3"
11913 [(set (match_operand:SI 0 "nonimmediate_operand" "")
11914 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
11915 (match_operand:QI 2 "nonmemory_operand" "")))
11916 (clobber (reg:CC 17))]
11918 "ix86_expand_binary_operator (ASHIFTRT, SImode, operands); DONE;")
11920 (define_insn "*ashrsi3_1_one_bit"
11921 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11922 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11923 (match_operand:QI 2 "const_int_1_operand" "")))
11924 (clobber (reg:CC 17))]
11925 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11926 && (TARGET_SHIFT1 || optimize_size)"
11928 [(set_attr "type" "ishift")
11929 (set (attr "length")
11930 (if_then_else (match_operand:SI 0 "register_operand" "")
11932 (const_string "*")))])
11934 (define_insn "*ashrsi3_1_one_bit_zext"
11935 [(set (match_operand:DI 0 "register_operand" "=r")
11936 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11937 (match_operand:QI 2 "const_int_1_operand" ""))))
11938 (clobber (reg:CC 17))]
11939 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
11940 && (TARGET_SHIFT1 || optimize_size)"
11942 [(set_attr "type" "ishift")
11943 (set_attr "length" "2")])
11945 (define_insn "*ashrsi3_1"
11946 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
11947 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
11948 (match_operand:QI 2 "nonmemory_operand" "I,c")))
11949 (clobber (reg:CC 17))]
11950 "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11952 sar{l}\t{%2, %0|%0, %2}
11953 sar{l}\t{%b2, %0|%0, %b2}"
11954 [(set_attr "type" "ishift")
11955 (set_attr "mode" "SI")])
11957 (define_insn "*ashrsi3_1_zext"
11958 [(set (match_operand:DI 0 "register_operand" "=r,r")
11959 (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
11960 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
11961 (clobber (reg:CC 17))]
11962 "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11964 sar{l}\t{%2, %k0|%k0, %2}
11965 sar{l}\t{%b2, %k0|%k0, %b2}"
11966 [(set_attr "type" "ishift")
11967 (set_attr "mode" "SI")])
11969 ;; This pattern can't accept a variable shift count, since shifts by
11970 ;; zero don't affect the flags. We assume that shifts by constant
11971 ;; zero are optimized away.
11972 (define_insn "*ashrsi3_one_bit_cmp"
11975 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
11976 (match_operand:QI 2 "const_int_1_operand" ""))
11978 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
11979 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
11980 "ix86_match_ccmode (insn, CCGOCmode)
11981 && (TARGET_SHIFT1 || optimize_size)
11982 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
11984 [(set_attr "type" "ishift")
11985 (set (attr "length")
11986 (if_then_else (match_operand:SI 0 "register_operand" "")
11988 (const_string "*")))])
11990 (define_insn "*ashrsi3_one_bit_cmp_zext"
11993 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
11994 (match_operand:QI 2 "const_int_1_operand" ""))
11996 (set (match_operand:DI 0 "register_operand" "=r")
11997 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
11998 "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
11999 && (TARGET_SHIFT1 || optimize_size)
12000 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
12002 [(set_attr "type" "ishift")
12003 (set_attr "length" "2")])
12005 ;; This pattern can't accept a variable shift count, since shifts by
12006 ;; zero don't affect the flags. We assume that shifts by constant
12007 ;; zero are optimized away.
12008 (define_insn "*ashrsi3_cmp"
12011 (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12012 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12014 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12015 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
12016 "ix86_match_ccmode (insn, CCGOCmode)
12017 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
12018 "sar{l}\t{%2, %0|%0, %2}"
12019 [(set_attr "type" "ishift")
12020 (set_attr "mode" "SI")])
12022 (define_insn "*ashrsi3_cmp_zext"
12025 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
12026 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12028 (set (match_operand:DI 0 "register_operand" "=r")
12029 (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
12030 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
12031 && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
12032 "sar{l}\t{%2, %k0|%k0, %2}"
12033 [(set_attr "type" "ishift")
12034 (set_attr "mode" "SI")])
12036 (define_expand "ashrhi3"
12037 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12038 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
12039 (match_operand:QI 2 "nonmemory_operand" "")))
12040 (clobber (reg:CC 17))]
12041 "TARGET_HIMODE_MATH"
12042 "ix86_expand_binary_operator (ASHIFTRT, HImode, operands); DONE;")
12044 (define_insn "*ashrhi3_1_one_bit"
12045 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12046 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12047 (match_operand:QI 2 "const_int_1_operand" "")))
12048 (clobber (reg:CC 17))]
12049 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)
12050 && (TARGET_SHIFT1 || optimize_size)"
12052 [(set_attr "type" "ishift")
12053 (set (attr "length")
12054 (if_then_else (match_operand 0 "register_operand" "")
12056 (const_string "*")))])
12058 (define_insn "*ashrhi3_1"
12059 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12060 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12061 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12062 (clobber (reg:CC 17))]
12063 "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
12065 sar{w}\t{%2, %0|%0, %2}
12066 sar{w}\t{%b2, %0|%0, %b2}"
12067 [(set_attr "type" "ishift")
12068 (set_attr "mode" "HI")])
12070 ;; This pattern can't accept a variable shift count, since shifts by
12071 ;; zero don't affect the flags. We assume that shifts by constant
12072 ;; zero are optimized away.
12073 (define_insn "*ashrhi3_one_bit_cmp"
12076 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12077 (match_operand:QI 2 "const_int_1_operand" ""))
12079 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12080 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
12081 "ix86_match_ccmode (insn, CCGOCmode)
12082 && (TARGET_SHIFT1 || optimize_size)
12083 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
12085 [(set_attr "type" "ishift")
12086 (set (attr "length")
12087 (if_then_else (match_operand 0 "register_operand" "")
12089 (const_string "*")))])
12091 ;; This pattern can't accept a variable shift count, since shifts by
12092 ;; zero don't affect the flags. We assume that shifts by constant
12093 ;; zero are optimized away.
12094 (define_insn "*ashrhi3_cmp"
12097 (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12098 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12100 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12101 (ashiftrt:HI (match_dup 1) (match_dup 2)))]
12102 "ix86_match_ccmode (insn, CCGOCmode)
12103 && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
12104 "sar{w}\t{%2, %0|%0, %2}"
12105 [(set_attr "type" "ishift")
12106 (set_attr "mode" "HI")])
12108 (define_expand "ashrqi3"
12109 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12110 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
12111 (match_operand:QI 2 "nonmemory_operand" "")))
12112 (clobber (reg:CC 17))]
12113 "TARGET_QIMODE_MATH"
12114 "ix86_expand_binary_operator (ASHIFTRT, QImode, operands); DONE;")
12116 (define_insn "*ashrqi3_1_one_bit"
12117 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12118 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12119 (match_operand:QI 2 "const_int_1_operand" "")))
12120 (clobber (reg:CC 17))]
12121 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
12122 && (TARGET_SHIFT1 || optimize_size)"
12124 [(set_attr "type" "ishift")
12125 (set (attr "length")
12126 (if_then_else (match_operand 0 "register_operand" "")
12128 (const_string "*")))])
12130 (define_insn "*ashrqi3_1_one_bit_slp"
12131 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12132 (ashiftrt:QI (match_dup 0)
12133 (match_operand:QI 1 "const_int_1_operand" "")))
12134 (clobber (reg:CC 17))]
12135 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)
12136 && (! TARGET_PARTIAL_REG_STALL || optimize_size)
12137 && (TARGET_SHIFT1 || optimize_size)"
12139 [(set_attr "type" "ishift1")
12140 (set (attr "length")
12141 (if_then_else (match_operand 0 "register_operand" "")
12143 (const_string "*")))])
12145 (define_insn "*ashrqi3_1"
12146 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12147 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12148 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12149 (clobber (reg:CC 17))]
12150 "ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
12152 sar{b}\t{%2, %0|%0, %2}
12153 sar{b}\t{%b2, %0|%0, %b2}"
12154 [(set_attr "type" "ishift")
12155 (set_attr "mode" "QI")])
12157 (define_insn "*ashrqi3_1_slp"
12158 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12159 (ashiftrt:QI (match_dup 0)
12160 (match_operand:QI 1 "nonmemory_operand" "I,c")))
12161 (clobber (reg:CC 17))]
12162 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12163 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
12165 sar{b}\t{%1, %0|%0, %1}
12166 sar{b}\t{%b1, %0|%0, %b1}"
12167 [(set_attr "type" "ishift1")
12168 (set_attr "mode" "QI")])
12170 ;; This pattern can't accept a variable shift count, since shifts by
12171 ;; zero don't affect the flags. We assume that shifts by constant
12172 ;; zero are optimized away.
12173 (define_insn "*ashrqi3_one_bit_cmp"
12176 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12177 (match_operand:QI 2 "const_int_1_operand" "I"))
12179 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12180 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
12181 "ix86_match_ccmode (insn, CCGOCmode)
12182 && (TARGET_SHIFT1 || optimize_size)
12183 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
12185 [(set_attr "type" "ishift")
12186 (set (attr "length")
12187 (if_then_else (match_operand 0 "register_operand" "")
12189 (const_string "*")))])
12191 ;; This pattern can't accept a variable shift count, since shifts by
12192 ;; zero don't affect the flags. We assume that shifts by constant
12193 ;; zero are optimized away.
12194 (define_insn "*ashrqi3_cmp"
12197 (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12198 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12200 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12201 (ashiftrt:QI (match_dup 1) (match_dup 2)))]
12202 "ix86_match_ccmode (insn, CCGOCmode)
12203 && ix86_binary_operator_ok (ASHIFTRT, QImode, operands)"
12204 "sar{b}\t{%2, %0|%0, %2}"
12205 [(set_attr "type" "ishift")
12206 (set_attr "mode" "QI")])
12208 ;; Logical shift instructions
12210 ;; See comment above `ashldi3' about how this works.
12212 (define_expand "lshrdi3"
12213 [(parallel [(set (match_operand:DI 0 "shiftdi_operand" "")
12214 (lshiftrt:DI (match_operand:DI 1 "shiftdi_operand" "")
12215 (match_operand:QI 2 "nonmemory_operand" "")))
12216 (clobber (reg:CC 17))])]
12219 if (!TARGET_64BIT && TARGET_CMOVE && ! immediate_operand (operands[2], QImode))
12221 emit_insn (gen_lshrdi3_1 (operands[0], operands[1], operands[2]));
12224 ix86_expand_binary_operator (LSHIFTRT, DImode, operands);
12228 (define_insn "*lshrdi3_1_one_bit_rex64"
12229 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12230 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12231 (match_operand:QI 2 "const_int_1_operand" "")))
12232 (clobber (reg:CC 17))]
12233 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
12234 && (TARGET_SHIFT1 || optimize_size)"
12236 [(set_attr "type" "ishift")
12237 (set (attr "length")
12238 (if_then_else (match_operand:DI 0 "register_operand" "")
12240 (const_string "*")))])
12242 (define_insn "*lshrdi3_1_rex64"
12243 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
12244 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
12245 (match_operand:QI 2 "nonmemory_operand" "J,c")))
12246 (clobber (reg:CC 17))]
12247 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12249 shr{q}\t{%2, %0|%0, %2}
12250 shr{q}\t{%b2, %0|%0, %b2}"
12251 [(set_attr "type" "ishift")
12252 (set_attr "mode" "DI")])
12254 ;; This pattern can't accept a variable shift count, since shifts by
12255 ;; zero don't affect the flags. We assume that shifts by constant
12256 ;; zero are optimized away.
12257 (define_insn "*lshrdi3_cmp_one_bit_rex64"
12260 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12261 (match_operand:QI 2 "const_int_1_operand" ""))
12263 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12264 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
12265 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
12266 && (TARGET_SHIFT1 || optimize_size)
12267 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12269 [(set_attr "type" "ishift")
12270 (set (attr "length")
12271 (if_then_else (match_operand:DI 0 "register_operand" "")
12273 (const_string "*")))])
12275 ;; This pattern can't accept a variable shift count, since shifts by
12276 ;; zero don't affect the flags. We assume that shifts by constant
12277 ;; zero are optimized away.
12278 (define_insn "*lshrdi3_cmp_rex64"
12281 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12282 (match_operand:QI 2 "const_int_operand" "e"))
12284 (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12285 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
12286 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
12287 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12288 "shr{q}\t{%2, %0|%0, %2}"
12289 [(set_attr "type" "ishift")
12290 (set_attr "mode" "DI")])
12292 (define_insn "lshrdi3_1"
12293 [(set (match_operand:DI 0 "register_operand" "=r")
12294 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
12295 (match_operand:QI 2 "nonmemory_operand" "Jc")))
12296 (clobber (match_scratch:SI 3 "=&r"))
12297 (clobber (reg:CC 17))]
12298 "!TARGET_64BIT && TARGET_CMOVE"
12300 [(set_attr "type" "multi")])
12302 (define_insn "*lshrdi3_2"
12303 [(set (match_operand:DI 0 "register_operand" "=r")
12304 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
12305 (match_operand:QI 2 "nonmemory_operand" "Jc")))
12306 (clobber (reg:CC 17))]
12309 [(set_attr "type" "multi")])
12312 [(set (match_operand:DI 0 "register_operand" "")
12313 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
12314 (match_operand:QI 2 "nonmemory_operand" "")))
12315 (clobber (match_scratch:SI 3 ""))
12316 (clobber (reg:CC 17))]
12317 "!TARGET_64BIT && TARGET_CMOVE && reload_completed"
12319 "ix86_split_lshrdi (operands, operands[3]); DONE;")
12322 [(set (match_operand:DI 0 "register_operand" "")
12323 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
12324 (match_operand:QI 2 "nonmemory_operand" "")))
12325 (clobber (reg:CC 17))]
12326 "!TARGET_64BIT && reload_completed"
12328 "ix86_split_lshrdi (operands, NULL_RTX); DONE;")
12330 (define_expand "lshrsi3"
12331 [(set (match_operand:SI 0 "nonimmediate_operand" "")
12332 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "")
12333 (match_operand:QI 2 "nonmemory_operand" "")))
12334 (clobber (reg:CC 17))]
12336 "ix86_expand_binary_operator (LSHIFTRT, SImode, operands); DONE;")
12338 (define_insn "*lshrsi3_1_one_bit"
12339 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12340 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12341 (match_operand:QI 2 "const_int_1_operand" "")))
12342 (clobber (reg:CC 17))]
12343 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
12344 && (TARGET_SHIFT1 || optimize_size)"
12346 [(set_attr "type" "ishift")
12347 (set (attr "length")
12348 (if_then_else (match_operand:SI 0 "register_operand" "")
12350 (const_string "*")))])
12352 (define_insn "*lshrsi3_1_one_bit_zext"
12353 [(set (match_operand:DI 0 "register_operand" "=r")
12354 (lshiftrt:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
12355 (match_operand:QI 2 "const_int_1_operand" "")))
12356 (clobber (reg:CC 17))]
12357 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
12358 && (TARGET_SHIFT1 || optimize_size)"
12360 [(set_attr "type" "ishift")
12361 (set_attr "length" "2")])
12363 (define_insn "*lshrsi3_1"
12364 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12365 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12366 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12367 (clobber (reg:CC 17))]
12368 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12370 shr{l}\t{%2, %0|%0, %2}
12371 shr{l}\t{%b2, %0|%0, %b2}"
12372 [(set_attr "type" "ishift")
12373 (set_attr "mode" "SI")])
12375 (define_insn "*lshrsi3_1_zext"
12376 [(set (match_operand:DI 0 "register_operand" "=r,r")
12378 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12379 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12380 (clobber (reg:CC 17))]
12381 "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12383 shr{l}\t{%2, %k0|%k0, %2}
12384 shr{l}\t{%b2, %k0|%k0, %b2}"
12385 [(set_attr "type" "ishift")
12386 (set_attr "mode" "SI")])
12388 ;; This pattern can't accept a variable shift count, since shifts by
12389 ;; zero don't affect the flags. We assume that shifts by constant
12390 ;; zero are optimized away.
12391 (define_insn "*lshrsi3_one_bit_cmp"
12394 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12395 (match_operand:QI 2 "const_int_1_operand" ""))
12397 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12398 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
12399 "ix86_match_ccmode (insn, CCGOCmode)
12400 && (TARGET_SHIFT1 || optimize_size)
12401 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12403 [(set_attr "type" "ishift")
12404 (set (attr "length")
12405 (if_then_else (match_operand:SI 0 "register_operand" "")
12407 (const_string "*")))])
12409 (define_insn "*lshrsi3_cmp_one_bit_zext"
12412 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
12413 (match_operand:QI 2 "const_int_1_operand" ""))
12415 (set (match_operand:DI 0 "register_operand" "=r")
12416 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
12417 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
12418 && (TARGET_SHIFT1 || optimize_size)
12419 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12421 [(set_attr "type" "ishift")
12422 (set_attr "length" "2")])
12424 ;; This pattern can't accept a variable shift count, since shifts by
12425 ;; zero don't affect the flags. We assume that shifts by constant
12426 ;; zero are optimized away.
12427 (define_insn "*lshrsi3_cmp"
12430 (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12431 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12433 (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12434 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
12435 "ix86_match_ccmode (insn, CCGOCmode)
12436 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12437 "shr{l}\t{%2, %0|%0, %2}"
12438 [(set_attr "type" "ishift")
12439 (set_attr "mode" "SI")])
12441 (define_insn "*lshrsi3_cmp_zext"
12444 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
12445 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12447 (set (match_operand:DI 0 "register_operand" "=r")
12448 (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
12449 "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
12450 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12451 "shr{l}\t{%2, %k0|%k0, %2}"
12452 [(set_attr "type" "ishift")
12453 (set_attr "mode" "SI")])
12455 (define_expand "lshrhi3"
12456 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12457 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
12458 (match_operand:QI 2 "nonmemory_operand" "")))
12459 (clobber (reg:CC 17))]
12460 "TARGET_HIMODE_MATH"
12461 "ix86_expand_binary_operator (LSHIFTRT, HImode, operands); DONE;")
12463 (define_insn "*lshrhi3_1_one_bit"
12464 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12465 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12466 (match_operand:QI 2 "const_int_1_operand" "")))
12467 (clobber (reg:CC 17))]
12468 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)
12469 && (TARGET_SHIFT1 || optimize_size)"
12471 [(set_attr "type" "ishift")
12472 (set (attr "length")
12473 (if_then_else (match_operand 0 "register_operand" "")
12475 (const_string "*")))])
12477 (define_insn "*lshrhi3_1"
12478 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12479 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12480 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12481 (clobber (reg:CC 17))]
12482 "ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12484 shr{w}\t{%2, %0|%0, %2}
12485 shr{w}\t{%b2, %0|%0, %b2}"
12486 [(set_attr "type" "ishift")
12487 (set_attr "mode" "HI")])
12489 ;; This pattern can't accept a variable shift count, since shifts by
12490 ;; zero don't affect the flags. We assume that shifts by constant
12491 ;; zero are optimized away.
12492 (define_insn "*lshrhi3_one_bit_cmp"
12495 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12496 (match_operand:QI 2 "const_int_1_operand" ""))
12498 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12499 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
12500 "ix86_match_ccmode (insn, CCGOCmode)
12501 && (TARGET_SHIFT1 || optimize_size)
12502 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12504 [(set_attr "type" "ishift")
12505 (set (attr "length")
12506 (if_then_else (match_operand:SI 0 "register_operand" "")
12508 (const_string "*")))])
12510 ;; This pattern can't accept a variable shift count, since shifts by
12511 ;; zero don't affect the flags. We assume that shifts by constant
12512 ;; zero are optimized away.
12513 (define_insn "*lshrhi3_cmp"
12516 (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12517 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12519 (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12520 (lshiftrt:HI (match_dup 1) (match_dup 2)))]
12521 "ix86_match_ccmode (insn, CCGOCmode)
12522 && ix86_binary_operator_ok (LSHIFTRT, HImode, operands)"
12523 "shr{w}\t{%2, %0|%0, %2}"
12524 [(set_attr "type" "ishift")
12525 (set_attr "mode" "HI")])
12527 (define_expand "lshrqi3"
12528 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12529 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
12530 (match_operand:QI 2 "nonmemory_operand" "")))
12531 (clobber (reg:CC 17))]
12532 "TARGET_QIMODE_MATH"
12533 "ix86_expand_binary_operator (LSHIFTRT, QImode, operands); DONE;")
12535 (define_insn "*lshrqi3_1_one_bit"
12536 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12537 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12538 (match_operand:QI 2 "const_int_1_operand" "")))
12539 (clobber (reg:CC 17))]
12540 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)
12541 && (TARGET_SHIFT1 || optimize_size)"
12543 [(set_attr "type" "ishift")
12544 (set (attr "length")
12545 (if_then_else (match_operand 0 "register_operand" "")
12547 (const_string "*")))])
12549 (define_insn "*lshrqi3_1_one_bit_slp"
12550 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12551 (lshiftrt:QI (match_dup 0)
12552 (match_operand:QI 1 "const_int_1_operand" "")))
12553 (clobber (reg:CC 17))]
12554 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12555 && (TARGET_SHIFT1 || optimize_size)"
12557 [(set_attr "type" "ishift1")
12558 (set (attr "length")
12559 (if_then_else (match_operand 0 "register_operand" "")
12561 (const_string "*")))])
12563 (define_insn "*lshrqi3_1"
12564 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12565 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12566 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12567 (clobber (reg:CC 17))]
12568 "ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
12570 shr{b}\t{%2, %0|%0, %2}
12571 shr{b}\t{%b2, %0|%0, %b2}"
12572 [(set_attr "type" "ishift")
12573 (set_attr "mode" "QI")])
12575 (define_insn "*lshrqi3_1_slp"
12576 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12577 (lshiftrt:QI (match_dup 0)
12578 (match_operand:QI 1 "nonmemory_operand" "I,c")))
12579 (clobber (reg:CC 17))]
12580 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12581 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
12583 shr{b}\t{%1, %0|%0, %1}
12584 shr{b}\t{%b1, %0|%0, %b1}"
12585 [(set_attr "type" "ishift1")
12586 (set_attr "mode" "QI")])
12588 ;; This pattern can't accept a variable shift count, since shifts by
12589 ;; zero don't affect the flags. We assume that shifts by constant
12590 ;; zero are optimized away.
12591 (define_insn "*lshrqi2_one_bit_cmp"
12594 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12595 (match_operand:QI 2 "const_int_1_operand" ""))
12597 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12598 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
12599 "ix86_match_ccmode (insn, CCGOCmode)
12600 && (TARGET_SHIFT1 || optimize_size)
12601 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
12603 [(set_attr "type" "ishift")
12604 (set (attr "length")
12605 (if_then_else (match_operand:SI 0 "register_operand" "")
12607 (const_string "*")))])
12609 ;; This pattern can't accept a variable shift count, since shifts by
12610 ;; zero don't affect the flags. We assume that shifts by constant
12611 ;; zero are optimized away.
12612 (define_insn "*lshrqi2_cmp"
12615 (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12616 (match_operand:QI 2 "const_int_1_31_operand" "I"))
12618 (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12619 (lshiftrt:QI (match_dup 1) (match_dup 2)))]
12620 "ix86_match_ccmode (insn, CCGOCmode)
12621 && ix86_binary_operator_ok (LSHIFTRT, QImode, operands)"
12622 "shr{b}\t{%2, %0|%0, %2}"
12623 [(set_attr "type" "ishift")
12624 (set_attr "mode" "QI")])
12626 ;; Rotate instructions
12628 (define_expand "rotldi3"
12629 [(set (match_operand:DI 0 "nonimmediate_operand" "")
12630 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "")
12631 (match_operand:QI 2 "nonmemory_operand" "")))
12632 (clobber (reg:CC 17))]
12634 "ix86_expand_binary_operator (ROTATE, DImode, operands); DONE;")
12636 (define_insn "*rotlsi3_1_one_bit_rex64"
12637 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12638 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12639 (match_operand:QI 2 "const_int_1_operand" "")))
12640 (clobber (reg:CC 17))]
12641 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)
12642 && (TARGET_SHIFT1 || optimize_size)"
12644 [(set_attr "type" "rotate")
12645 (set (attr "length")
12646 (if_then_else (match_operand:DI 0 "register_operand" "")
12648 (const_string "*")))])
12650 (define_insn "*rotldi3_1_rex64"
12651 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
12652 (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
12653 (match_operand:QI 2 "nonmemory_operand" "e,c")))
12654 (clobber (reg:CC 17))]
12655 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands)"
12657 rol{q}\t{%2, %0|%0, %2}
12658 rol{q}\t{%b2, %0|%0, %b2}"
12659 [(set_attr "type" "rotate")
12660 (set_attr "mode" "DI")])
12662 (define_expand "rotlsi3"
12663 [(set (match_operand:SI 0 "nonimmediate_operand" "")
12664 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "")
12665 (match_operand:QI 2 "nonmemory_operand" "")))
12666 (clobber (reg:CC 17))]
12668 "ix86_expand_binary_operator (ROTATE, SImode, operands); DONE;")
12670 (define_insn "*rotlsi3_1_one_bit"
12671 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12672 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12673 (match_operand:QI 2 "const_int_1_operand" "")))
12674 (clobber (reg:CC 17))]
12675 "ix86_binary_operator_ok (ROTATE, SImode, operands)
12676 && (TARGET_SHIFT1 || optimize_size)"
12678 [(set_attr "type" "rotate")
12679 (set (attr "length")
12680 (if_then_else (match_operand:SI 0 "register_operand" "")
12682 (const_string "*")))])
12684 (define_insn "*rotlsi3_1_one_bit_zext"
12685 [(set (match_operand:DI 0 "register_operand" "=r")
12687 (rotate:SI (match_operand:SI 1 "register_operand" "0")
12688 (match_operand:QI 2 "const_int_1_operand" ""))))
12689 (clobber (reg:CC 17))]
12690 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)
12691 && (TARGET_SHIFT1 || optimize_size)"
12693 [(set_attr "type" "rotate")
12694 (set_attr "length" "2")])
12696 (define_insn "*rotlsi3_1"
12697 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12698 (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12699 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12700 (clobber (reg:CC 17))]
12701 "ix86_binary_operator_ok (ROTATE, SImode, operands)"
12703 rol{l}\t{%2, %0|%0, %2}
12704 rol{l}\t{%b2, %0|%0, %b2}"
12705 [(set_attr "type" "rotate")
12706 (set_attr "mode" "SI")])
12708 (define_insn "*rotlsi3_1_zext"
12709 [(set (match_operand:DI 0 "register_operand" "=r,r")
12711 (rotate:SI (match_operand:SI 1 "register_operand" "0,0")
12712 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12713 (clobber (reg:CC 17))]
12714 "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands)"
12716 rol{l}\t{%2, %k0|%k0, %2}
12717 rol{l}\t{%b2, %k0|%k0, %b2}"
12718 [(set_attr "type" "rotate")
12719 (set_attr "mode" "SI")])
12721 (define_expand "rotlhi3"
12722 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12723 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "")
12724 (match_operand:QI 2 "nonmemory_operand" "")))
12725 (clobber (reg:CC 17))]
12726 "TARGET_HIMODE_MATH"
12727 "ix86_expand_binary_operator (ROTATE, HImode, operands); DONE;")
12729 (define_insn "*rotlhi3_1_one_bit"
12730 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12731 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12732 (match_operand:QI 2 "const_int_1_operand" "")))
12733 (clobber (reg:CC 17))]
12734 "ix86_binary_operator_ok (ROTATE, HImode, operands)
12735 && (TARGET_SHIFT1 || optimize_size)"
12737 [(set_attr "type" "rotate")
12738 (set (attr "length")
12739 (if_then_else (match_operand 0 "register_operand" "")
12741 (const_string "*")))])
12743 (define_insn "*rotlhi3_1"
12744 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12745 (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12746 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12747 (clobber (reg:CC 17))]
12748 "ix86_binary_operator_ok (ROTATE, HImode, operands)"
12750 rol{w}\t{%2, %0|%0, %2}
12751 rol{w}\t{%b2, %0|%0, %b2}"
12752 [(set_attr "type" "rotate")
12753 (set_attr "mode" "HI")])
12755 (define_expand "rotlqi3"
12756 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12757 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "")
12758 (match_operand:QI 2 "nonmemory_operand" "")))
12759 (clobber (reg:CC 17))]
12760 "TARGET_QIMODE_MATH"
12761 "ix86_expand_binary_operator (ROTATE, QImode, operands); DONE;")
12763 (define_insn "*rotlqi3_1_one_bit_slp"
12764 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12765 (rotate:QI (match_dup 0)
12766 (match_operand:QI 1 "const_int_1_operand" "")))
12767 (clobber (reg:CC 17))]
12768 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12769 && (TARGET_SHIFT1 || optimize_size)"
12771 [(set_attr "type" "rotate1")
12772 (set (attr "length")
12773 (if_then_else (match_operand 0 "register_operand" "")
12775 (const_string "*")))])
12777 (define_insn "*rotlqi3_1_one_bit"
12778 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12779 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12780 (match_operand:QI 2 "const_int_1_operand" "")))
12781 (clobber (reg:CC 17))]
12782 "ix86_binary_operator_ok (ROTATE, QImode, operands)
12783 && (TARGET_SHIFT1 || optimize_size)"
12785 [(set_attr "type" "rotate")
12786 (set (attr "length")
12787 (if_then_else (match_operand 0 "register_operand" "")
12789 (const_string "*")))])
12791 (define_insn "*rotlqi3_1_slp"
12792 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12793 (rotate:QI (match_dup 0)
12794 (match_operand:QI 1 "nonmemory_operand" "I,c")))
12795 (clobber (reg:CC 17))]
12796 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12797 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
12799 rol{b}\t{%1, %0|%0, %1}
12800 rol{b}\t{%b1, %0|%0, %b1}"
12801 [(set_attr "type" "rotate1")
12802 (set_attr "mode" "QI")])
12804 (define_insn "*rotlqi3_1"
12805 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12806 (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12807 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12808 (clobber (reg:CC 17))]
12809 "ix86_binary_operator_ok (ROTATE, QImode, operands)"
12811 rol{b}\t{%2, %0|%0, %2}
12812 rol{b}\t{%b2, %0|%0, %b2}"
12813 [(set_attr "type" "rotate")
12814 (set_attr "mode" "QI")])
12816 (define_expand "rotrdi3"
12817 [(set (match_operand:DI 0 "nonimmediate_operand" "")
12818 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "")
12819 (match_operand:QI 2 "nonmemory_operand" "")))
12820 (clobber (reg:CC 17))]
12822 "ix86_expand_binary_operator (ROTATERT, DImode, operands); DONE;")
12824 (define_insn "*rotrdi3_1_one_bit_rex64"
12825 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
12826 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0")
12827 (match_operand:QI 2 "const_int_1_operand" "")))
12828 (clobber (reg:CC 17))]
12829 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)
12830 && (TARGET_SHIFT1 || optimize_size)"
12832 [(set_attr "type" "rotate")
12833 (set (attr "length")
12834 (if_then_else (match_operand:DI 0 "register_operand" "")
12836 (const_string "*")))])
12838 (define_insn "*rotrdi3_1_rex64"
12839 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm")
12840 (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
12841 (match_operand:QI 2 "nonmemory_operand" "J,c")))
12842 (clobber (reg:CC 17))]
12843 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands)"
12845 ror{q}\t{%2, %0|%0, %2}
12846 ror{q}\t{%b2, %0|%0, %b2}"
12847 [(set_attr "type" "rotate")
12848 (set_attr "mode" "DI")])
12850 (define_expand "rotrsi3"
12851 [(set (match_operand:SI 0 "nonimmediate_operand" "")
12852 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "")
12853 (match_operand:QI 2 "nonmemory_operand" "")))
12854 (clobber (reg:CC 17))]
12856 "ix86_expand_binary_operator (ROTATERT, SImode, operands); DONE;")
12858 (define_insn "*rotrsi3_1_one_bit"
12859 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
12860 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0")
12861 (match_operand:QI 2 "const_int_1_operand" "")))
12862 (clobber (reg:CC 17))]
12863 "ix86_binary_operator_ok (ROTATERT, SImode, operands)
12864 && (TARGET_SHIFT1 || optimize_size)"
12866 [(set_attr "type" "rotate")
12867 (set (attr "length")
12868 (if_then_else (match_operand:SI 0 "register_operand" "")
12870 (const_string "*")))])
12872 (define_insn "*rotrsi3_1_one_bit_zext"
12873 [(set (match_operand:DI 0 "register_operand" "=r")
12875 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
12876 (match_operand:QI 2 "const_int_1_operand" ""))))
12877 (clobber (reg:CC 17))]
12878 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)
12879 && (TARGET_SHIFT1 || optimize_size)"
12881 [(set_attr "type" "rotate")
12882 (set (attr "length")
12883 (if_then_else (match_operand:SI 0 "register_operand" "")
12885 (const_string "*")))])
12887 (define_insn "*rotrsi3_1"
12888 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm")
12889 (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
12890 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12891 (clobber (reg:CC 17))]
12892 "ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12894 ror{l}\t{%2, %0|%0, %2}
12895 ror{l}\t{%b2, %0|%0, %b2}"
12896 [(set_attr "type" "rotate")
12897 (set_attr "mode" "SI")])
12899 (define_insn "*rotrsi3_1_zext"
12900 [(set (match_operand:DI 0 "register_operand" "=r,r")
12902 (rotatert:SI (match_operand:SI 1 "register_operand" "0,0")
12903 (match_operand:QI 2 "nonmemory_operand" "I,c"))))
12904 (clobber (reg:CC 17))]
12905 "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands)"
12907 ror{l}\t{%2, %k0|%k0, %2}
12908 ror{l}\t{%b2, %k0|%k0, %b2}"
12909 [(set_attr "type" "rotate")
12910 (set_attr "mode" "SI")])
12912 (define_expand "rotrhi3"
12913 [(set (match_operand:HI 0 "nonimmediate_operand" "")
12914 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "")
12915 (match_operand:QI 2 "nonmemory_operand" "")))
12916 (clobber (reg:CC 17))]
12917 "TARGET_HIMODE_MATH"
12918 "ix86_expand_binary_operator (ROTATERT, HImode, operands); DONE;")
12920 (define_insn "*rotrhi3_one_bit"
12921 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
12922 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0")
12923 (match_operand:QI 2 "const_int_1_operand" "")))
12924 (clobber (reg:CC 17))]
12925 "ix86_binary_operator_ok (ROTATERT, HImode, operands)
12926 && (TARGET_SHIFT1 || optimize_size)"
12928 [(set_attr "type" "rotate")
12929 (set (attr "length")
12930 (if_then_else (match_operand 0 "register_operand" "")
12932 (const_string "*")))])
12934 (define_insn "*rotrhi3"
12935 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,rm")
12936 (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
12937 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12938 (clobber (reg:CC 17))]
12939 "ix86_binary_operator_ok (ROTATERT, HImode, operands)"
12941 ror{w}\t{%2, %0|%0, %2}
12942 ror{w}\t{%b2, %0|%0, %b2}"
12943 [(set_attr "type" "rotate")
12944 (set_attr "mode" "HI")])
12946 (define_expand "rotrqi3"
12947 [(set (match_operand:QI 0 "nonimmediate_operand" "")
12948 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "")
12949 (match_operand:QI 2 "nonmemory_operand" "")))
12950 (clobber (reg:CC 17))]
12951 "TARGET_QIMODE_MATH"
12952 "ix86_expand_binary_operator (ROTATERT, QImode, operands); DONE;")
12954 (define_insn "*rotrqi3_1_one_bit"
12955 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
12956 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0")
12957 (match_operand:QI 2 "const_int_1_operand" "")))
12958 (clobber (reg:CC 17))]
12959 "ix86_binary_operator_ok (ROTATERT, QImode, operands)
12960 && (TARGET_SHIFT1 || optimize_size)"
12962 [(set_attr "type" "rotate")
12963 (set (attr "length")
12964 (if_then_else (match_operand 0 "register_operand" "")
12966 (const_string "*")))])
12968 (define_insn "*rotrqi3_1_one_bit_slp"
12969 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
12970 (rotatert:QI (match_dup 0)
12971 (match_operand:QI 1 "const_int_1_operand" "")))
12972 (clobber (reg:CC 17))]
12973 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
12974 && (TARGET_SHIFT1 || optimize_size)"
12976 [(set_attr "type" "rotate1")
12977 (set (attr "length")
12978 (if_then_else (match_operand 0 "register_operand" "")
12980 (const_string "*")))])
12982 (define_insn "*rotrqi3_1"
12983 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,qm")
12984 (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
12985 (match_operand:QI 2 "nonmemory_operand" "I,c")))
12986 (clobber (reg:CC 17))]
12987 "ix86_binary_operator_ok (ROTATERT, QImode, operands)"
12989 ror{b}\t{%2, %0|%0, %2}
12990 ror{b}\t{%b2, %0|%0, %b2}"
12991 [(set_attr "type" "rotate")
12992 (set_attr "mode" "QI")])
12994 (define_insn "*rotrqi3_1_slp"
12995 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,qm"))
12996 (rotatert:QI (match_dup 0)
12997 (match_operand:QI 1 "nonmemory_operand" "I,c")))
12998 (clobber (reg:CC 17))]
12999 "(! TARGET_PARTIAL_REG_STALL || optimize_size)
13000 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
13002 ror{b}\t{%1, %0|%0, %1}
13003 ror{b}\t{%b1, %0|%0, %b1}"
13004 [(set_attr "type" "rotate1")
13005 (set_attr "mode" "QI")])
13007 ;; Bit set / bit test instructions
13009 (define_expand "extv"
13010 [(set (match_operand:SI 0 "register_operand" "")
13011 (sign_extract:SI (match_operand:SI 1 "register_operand" "")
13012 (match_operand:SI 2 "immediate_operand" "")
13013 (match_operand:SI 3 "immediate_operand" "")))]
13016 /* Handle extractions from %ah et al. */
13017 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
13020 /* From mips.md: extract_bit_field doesn't verify that our source
13021 matches the predicate, so check it again here. */
13022 if (! register_operand (operands[1], VOIDmode))
13026 (define_expand "extzv"
13027 [(set (match_operand:SI 0 "register_operand" "")
13028 (zero_extract:SI (match_operand 1 "ext_register_operand" "")
13029 (match_operand:SI 2 "immediate_operand" "")
13030 (match_operand:SI 3 "immediate_operand" "")))]
13033 /* Handle extractions from %ah et al. */
13034 if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8)
13037 /* From mips.md: extract_bit_field doesn't verify that our source
13038 matches the predicate, so check it again here. */
13039 if (! register_operand (operands[1], VOIDmode))
13043 (define_expand "insv"
13044 [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "")
13045 (match_operand:SI 1 "immediate_operand" "")
13046 (match_operand:SI 2 "immediate_operand" ""))
13047 (match_operand:SI 3 "register_operand" ""))]
13050 /* Handle extractions from %ah et al. */
13051 if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) != 8)
13054 /* From mips.md: insert_bit_field doesn't verify that our source
13055 matches the predicate, so check it again here. */
13056 if (! register_operand (operands[0], VOIDmode))
13060 ;; %%% bts, btr, btc, bt.
13062 ;; Store-flag instructions.
13064 ;; For all sCOND expanders, also expand the compare or test insn that
13065 ;; generates cc0. Generate an equality comparison if `seq' or `sne'.
13067 ;; %%% Do the expansion to SImode. If PII, do things the xor+setcc way
13068 ;; to avoid partial register stalls. Otherwise do things the setcc+movzx
13069 ;; way, which can later delete the movzx if only QImode is needed.
13071 (define_expand "seq"
13072 [(set (match_operand:QI 0 "register_operand" "")
13073 (eq:QI (reg:CC 17) (const_int 0)))]
13075 "if (ix86_expand_setcc (EQ, operands[0])) DONE; else FAIL;")
13077 (define_expand "sne"
13078 [(set (match_operand:QI 0 "register_operand" "")
13079 (ne:QI (reg:CC 17) (const_int 0)))]
13081 "if (ix86_expand_setcc (NE, operands[0])) DONE; else FAIL;")
13083 (define_expand "sgt"
13084 [(set (match_operand:QI 0 "register_operand" "")
13085 (gt:QI (reg:CC 17) (const_int 0)))]
13087 "if (ix86_expand_setcc (GT, operands[0])) DONE; else FAIL;")
13089 (define_expand "sgtu"
13090 [(set (match_operand:QI 0 "register_operand" "")
13091 (gtu:QI (reg:CC 17) (const_int 0)))]
13093 "if (ix86_expand_setcc (GTU, operands[0])) DONE; else FAIL;")
13095 (define_expand "slt"
13096 [(set (match_operand:QI 0 "register_operand" "")
13097 (lt:QI (reg:CC 17) (const_int 0)))]
13099 "if (ix86_expand_setcc (LT, operands[0])) DONE; else FAIL;")
13101 (define_expand "sltu"
13102 [(set (match_operand:QI 0 "register_operand" "")
13103 (ltu:QI (reg:CC 17) (const_int 0)))]
13105 "if (ix86_expand_setcc (LTU, operands[0])) DONE; else FAIL;")
13107 (define_expand "sge"
13108 [(set (match_operand:QI 0 "register_operand" "")
13109 (ge:QI (reg:CC 17) (const_int 0)))]
13111 "if (ix86_expand_setcc (GE, operands[0])) DONE; else FAIL;")
13113 (define_expand "sgeu"
13114 [(set (match_operand:QI 0 "register_operand" "")
13115 (geu:QI (reg:CC 17) (const_int 0)))]
13117 "if (ix86_expand_setcc (GEU, operands[0])) DONE; else FAIL;")
13119 (define_expand "sle"
13120 [(set (match_operand:QI 0 "register_operand" "")
13121 (le:QI (reg:CC 17) (const_int 0)))]
13123 "if (ix86_expand_setcc (LE, operands[0])) DONE; else FAIL;")
13125 (define_expand "sleu"
13126 [(set (match_operand:QI 0 "register_operand" "")
13127 (leu:QI (reg:CC 17) (const_int 0)))]
13129 "if (ix86_expand_setcc (LEU, operands[0])) DONE; else FAIL;")
13131 (define_expand "sunordered"
13132 [(set (match_operand:QI 0 "register_operand" "")
13133 (unordered:QI (reg:CC 17) (const_int 0)))]
13134 "TARGET_80387 || TARGET_SSE"
13135 "if (ix86_expand_setcc (UNORDERED, operands[0])) DONE; else FAIL;")
13137 (define_expand "sordered"
13138 [(set (match_operand:QI 0 "register_operand" "")
13139 (ordered:QI (reg:CC 17) (const_int 0)))]
13141 "if (ix86_expand_setcc (ORDERED, operands[0])) DONE; else FAIL;")
13143 (define_expand "suneq"
13144 [(set (match_operand:QI 0 "register_operand" "")
13145 (uneq:QI (reg:CC 17) (const_int 0)))]
13146 "TARGET_80387 || TARGET_SSE"
13147 "if (ix86_expand_setcc (UNEQ, operands[0])) DONE; else FAIL;")
13149 (define_expand "sunge"
13150 [(set (match_operand:QI 0 "register_operand" "")
13151 (unge:QI (reg:CC 17) (const_int 0)))]
13152 "TARGET_80387 || TARGET_SSE"
13153 "if (ix86_expand_setcc (UNGE, operands[0])) DONE; else FAIL;")
13155 (define_expand "sungt"
13156 [(set (match_operand:QI 0 "register_operand" "")
13157 (ungt:QI (reg:CC 17) (const_int 0)))]
13158 "TARGET_80387 || TARGET_SSE"
13159 "if (ix86_expand_setcc (UNGT, operands[0])) DONE; else FAIL;")
13161 (define_expand "sunle"
13162 [(set (match_operand:QI 0 "register_operand" "")
13163 (unle:QI (reg:CC 17) (const_int 0)))]
13164 "TARGET_80387 || TARGET_SSE"
13165 "if (ix86_expand_setcc (UNLE, operands[0])) DONE; else FAIL;")
13167 (define_expand "sunlt"
13168 [(set (match_operand:QI 0 "register_operand" "")
13169 (unlt:QI (reg:CC 17) (const_int 0)))]
13170 "TARGET_80387 || TARGET_SSE"
13171 "if (ix86_expand_setcc (UNLT, operands[0])) DONE; else FAIL;")
13173 (define_expand "sltgt"
13174 [(set (match_operand:QI 0 "register_operand" "")
13175 (ltgt:QI (reg:CC 17) (const_int 0)))]
13176 "TARGET_80387 || TARGET_SSE"
13177 "if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")
13179 (define_insn "*setcc_1"
13180 [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
13181 (match_operator:QI 1 "ix86_comparison_operator"
13182 [(reg 17) (const_int 0)]))]
13185 [(set_attr "type" "setcc")
13186 (set_attr "mode" "QI")])
13188 (define_insn "setcc_2"
13189 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
13190 (match_operator:QI 1 "ix86_comparison_operator"
13191 [(reg 17) (const_int 0)]))]
13194 [(set_attr "type" "setcc")
13195 (set_attr "mode" "QI")])
13197 ;; In general it is not safe to assume too much about CCmode registers,
13198 ;; so simplify-rtx stops when it sees a second one. Under certain
13199 ;; conditions this is safe on x86, so help combine not create
13206 [(set (match_operand:QI 0 "nonimmediate_operand" "")
13207 (ne:QI (match_operator 1 "ix86_comparison_operator"
13208 [(reg 17) (const_int 0)])
13211 [(set (match_dup 0) (match_dup 1))]
13213 PUT_MODE (operands[1], QImode);
13217 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
13218 (ne:QI (match_operator 1 "ix86_comparison_operator"
13219 [(reg 17) (const_int 0)])
13222 [(set (match_dup 0) (match_dup 1))]
13224 PUT_MODE (operands[1], QImode);
13228 [(set (match_operand:QI 0 "nonimmediate_operand" "")
13229 (eq:QI (match_operator 1 "ix86_comparison_operator"
13230 [(reg 17) (const_int 0)])
13233 [(set (match_dup 0) (match_dup 1))]
13235 rtx new_op1 = copy_rtx (operands[1]);
13236 operands[1] = new_op1;
13237 PUT_MODE (new_op1, QImode);
13238 PUT_CODE (new_op1, REVERSE_CONDITION (GET_CODE (new_op1),
13239 GET_MODE (XEXP (new_op1, 0))));
13241 /* Make sure that (a) the CCmode we have for the flags is strong
13242 enough for the reversed compare or (b) we have a valid FP compare. */
13243 if (! ix86_comparison_operator (new_op1, VOIDmode))
13248 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
13249 (eq:QI (match_operator 1 "ix86_comparison_operator"
13250 [(reg 17) (const_int 0)])
13253 [(set (match_dup 0) (match_dup 1))]
13255 rtx new_op1 = copy_rtx (operands[1]);
13256 operands[1] = new_op1;
13257 PUT_MODE (new_op1, QImode);
13258 PUT_CODE (new_op1, REVERSE_CONDITION (GET_CODE (new_op1),
13259 GET_MODE (XEXP (new_op1, 0))));
13261 /* Make sure that (a) the CCmode we have for the flags is strong
13262 enough for the reversed compare or (b) we have a valid FP compare. */
13263 if (! ix86_comparison_operator (new_op1, VOIDmode))
13267 ;; The SSE store flag instructions saves 0 or 0xffffffff to the result.
13268 ;; subsequent logical operations are used to imitate conditional moves.
13269 ;; 0xffffffff is NaN, but not in normalized form, so we can't represent
13270 ;; it directly. Further holding this value in pseudo register might bring
13271 ;; problem in implicit normalization in spill code.
13272 ;; So we don't define FLOAT_STORE_FLAG_VALUE and create these
13273 ;; instructions after reload by splitting the conditional move patterns.
13275 (define_insn "*sse_setccsf"
13276 [(set (match_operand:SF 0 "register_operand" "=x")
13277 (match_operator:SF 1 "sse_comparison_operator"
13278 [(match_operand:SF 2 "register_operand" "0")
13279 (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
13280 "TARGET_SSE && reload_completed"
13281 "cmp%D1ss\t{%3, %0|%0, %3}"
13282 [(set_attr "type" "ssecmp")
13283 (set_attr "mode" "SF")])
13285 (define_insn "*sse_setccdf"
13286 [(set (match_operand:DF 0 "register_operand" "=Y")
13287 (match_operator:DF 1 "sse_comparison_operator"
13288 [(match_operand:DF 2 "register_operand" "0")
13289 (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
13290 "TARGET_SSE2 && reload_completed"
13291 "cmp%D1sd\t{%3, %0|%0, %3}"
13292 [(set_attr "type" "ssecmp")
13293 (set_attr "mode" "DF")])
13295 ;; Basic conditional jump instructions.
13296 ;; We ignore the overflow flag for signed branch instructions.
13298 ;; For all bCOND expanders, also expand the compare or test insn that
13299 ;; generates reg 17. Generate an equality comparison if `beq' or `bne'.
13301 (define_expand "beq"
13303 (if_then_else (match_dup 1)
13304 (label_ref (match_operand 0 "" ""))
13307 "ix86_expand_branch (EQ, operands[0]); DONE;")
13309 (define_expand "bne"
13311 (if_then_else (match_dup 1)
13312 (label_ref (match_operand 0 "" ""))
13315 "ix86_expand_branch (NE, operands[0]); DONE;")
13317 (define_expand "bgt"
13319 (if_then_else (match_dup 1)
13320 (label_ref (match_operand 0 "" ""))
13323 "ix86_expand_branch (GT, operands[0]); DONE;")
13325 (define_expand "bgtu"
13327 (if_then_else (match_dup 1)
13328 (label_ref (match_operand 0 "" ""))
13331 "ix86_expand_branch (GTU, operands[0]); DONE;")
13333 (define_expand "blt"
13335 (if_then_else (match_dup 1)
13336 (label_ref (match_operand 0 "" ""))
13339 "ix86_expand_branch (LT, operands[0]); DONE;")
13341 (define_expand "bltu"
13343 (if_then_else (match_dup 1)
13344 (label_ref (match_operand 0 "" ""))
13347 "ix86_expand_branch (LTU, operands[0]); DONE;")
13349 (define_expand "bge"
13351 (if_then_else (match_dup 1)
13352 (label_ref (match_operand 0 "" ""))
13355 "ix86_expand_branch (GE, operands[0]); DONE;")
13357 (define_expand "bgeu"
13359 (if_then_else (match_dup 1)
13360 (label_ref (match_operand 0 "" ""))
13363 "ix86_expand_branch (GEU, operands[0]); DONE;")
13365 (define_expand "ble"
13367 (if_then_else (match_dup 1)
13368 (label_ref (match_operand 0 "" ""))
13371 "ix86_expand_branch (LE, operands[0]); DONE;")
13373 (define_expand "bleu"
13375 (if_then_else (match_dup 1)
13376 (label_ref (match_operand 0 "" ""))
13379 "ix86_expand_branch (LEU, operands[0]); DONE;")
13381 (define_expand "bunordered"
13383 (if_then_else (match_dup 1)
13384 (label_ref (match_operand 0 "" ""))
13386 "TARGET_80387 || TARGET_SSE"
13387 "ix86_expand_branch (UNORDERED, operands[0]); DONE;")
13389 (define_expand "bordered"
13391 (if_then_else (match_dup 1)
13392 (label_ref (match_operand 0 "" ""))
13394 "TARGET_80387 || TARGET_SSE"
13395 "ix86_expand_branch (ORDERED, operands[0]); DONE;")
13397 (define_expand "buneq"
13399 (if_then_else (match_dup 1)
13400 (label_ref (match_operand 0 "" ""))
13402 "TARGET_80387 || TARGET_SSE"
13403 "ix86_expand_branch (UNEQ, operands[0]); DONE;")
13405 (define_expand "bunge"
13407 (if_then_else (match_dup 1)
13408 (label_ref (match_operand 0 "" ""))
13410 "TARGET_80387 || TARGET_SSE"
13411 "ix86_expand_branch (UNGE, operands[0]); DONE;")
13413 (define_expand "bungt"
13415 (if_then_else (match_dup 1)
13416 (label_ref (match_operand 0 "" ""))
13418 "TARGET_80387 || TARGET_SSE"
13419 "ix86_expand_branch (UNGT, operands[0]); DONE;")
13421 (define_expand "bunle"
13423 (if_then_else (match_dup 1)
13424 (label_ref (match_operand 0 "" ""))
13426 "TARGET_80387 || TARGET_SSE"
13427 "ix86_expand_branch (UNLE, operands[0]); DONE;")
13429 (define_expand "bunlt"
13431 (if_then_else (match_dup 1)
13432 (label_ref (match_operand 0 "" ""))
13434 "TARGET_80387 || TARGET_SSE"
13435 "ix86_expand_branch (UNLT, operands[0]); DONE;")
13437 (define_expand "bltgt"
13439 (if_then_else (match_dup 1)
13440 (label_ref (match_operand 0 "" ""))
13442 "TARGET_80387 || TARGET_SSE"
13443 "ix86_expand_branch (LTGT, operands[0]); DONE;")
13445 (define_insn "*jcc_1"
13447 (if_then_else (match_operator 1 "ix86_comparison_operator"
13448 [(reg 17) (const_int 0)])
13449 (label_ref (match_operand 0 "" ""))
13453 [(set_attr "type" "ibr")
13454 (set_attr "modrm" "0")
13455 (set (attr "length")
13456 (if_then_else (and (ge (minus (match_dup 0) (pc))
13458 (lt (minus (match_dup 0) (pc))
13463 (define_insn "*jcc_2"
13465 (if_then_else (match_operator 1 "ix86_comparison_operator"
13466 [(reg 17) (const_int 0)])
13468 (label_ref (match_operand 0 "" ""))))]
13471 [(set_attr "type" "ibr")
13472 (set_attr "modrm" "0")
13473 (set (attr "length")
13474 (if_then_else (and (ge (minus (match_dup 0) (pc))
13476 (lt (minus (match_dup 0) (pc))
13481 ;; In general it is not safe to assume too much about CCmode registers,
13482 ;; so simplify-rtx stops when it sees a second one. Under certain
13483 ;; conditions this is safe on x86, so help combine not create
13491 (if_then_else (ne (match_operator 0 "ix86_comparison_operator"
13492 [(reg 17) (const_int 0)])
13494 (label_ref (match_operand 1 "" ""))
13498 (if_then_else (match_dup 0)
13499 (label_ref (match_dup 1))
13502 PUT_MODE (operands[0], VOIDmode);
13507 (if_then_else (eq (match_operator 0 "ix86_comparison_operator"
13508 [(reg 17) (const_int 0)])
13510 (label_ref (match_operand 1 "" ""))
13514 (if_then_else (match_dup 0)
13515 (label_ref (match_dup 1))
13518 rtx new_op0 = copy_rtx (operands[0]);
13519 operands[0] = new_op0;
13520 PUT_MODE (new_op0, VOIDmode);
13521 PUT_CODE (new_op0, REVERSE_CONDITION (GET_CODE (new_op0),
13522 GET_MODE (XEXP (new_op0, 0))));
13524 /* Make sure that (a) the CCmode we have for the flags is strong
13525 enough for the reversed compare or (b) we have a valid FP compare. */
13526 if (! ix86_comparison_operator (new_op0, VOIDmode))
13530 ;; Define combination compare-and-branch fp compare instructions to use
13531 ;; during early optimization. Splitting the operation apart early makes
13532 ;; for bad code when we want to reverse the operation.
13534 (define_insn "*fp_jcc_1"
13536 (if_then_else (match_operator 0 "comparison_operator"
13537 [(match_operand 1 "register_operand" "f")
13538 (match_operand 2 "register_operand" "f")])
13539 (label_ref (match_operand 3 "" ""))
13541 (clobber (reg:CCFP 18))
13542 (clobber (reg:CCFP 17))]
13543 "TARGET_CMOVE && TARGET_80387
13544 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13545 && FLOAT_MODE_P (GET_MODE (operands[1]))
13546 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13547 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13550 (define_insn "*fp_jcc_1_sse"
13552 (if_then_else (match_operator 0 "comparison_operator"
13553 [(match_operand 1 "register_operand" "f#x,x#f")
13554 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
13555 (label_ref (match_operand 3 "" ""))
13557 (clobber (reg:CCFP 18))
13558 (clobber (reg:CCFP 17))]
13560 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13561 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13562 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13565 (define_insn "*fp_jcc_1_sse_only"
13567 (if_then_else (match_operator 0 "comparison_operator"
13568 [(match_operand 1 "register_operand" "x")
13569 (match_operand 2 "nonimmediate_operand" "xm")])
13570 (label_ref (match_operand 3 "" ""))
13572 (clobber (reg:CCFP 18))
13573 (clobber (reg:CCFP 17))]
13574 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13575 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13576 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13579 (define_insn "*fp_jcc_2"
13581 (if_then_else (match_operator 0 "comparison_operator"
13582 [(match_operand 1 "register_operand" "f")
13583 (match_operand 2 "register_operand" "f")])
13585 (label_ref (match_operand 3 "" ""))))
13586 (clobber (reg:CCFP 18))
13587 (clobber (reg:CCFP 17))]
13588 "TARGET_CMOVE && TARGET_80387
13589 && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13590 && FLOAT_MODE_P (GET_MODE (operands[1]))
13591 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13592 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13595 (define_insn "*fp_jcc_2_sse"
13597 (if_then_else (match_operator 0 "comparison_operator"
13598 [(match_operand 1 "register_operand" "f#x,x#f")
13599 (match_operand 2 "nonimmediate_operand" "f#x,xm#f")])
13601 (label_ref (match_operand 3 "" ""))))
13602 (clobber (reg:CCFP 18))
13603 (clobber (reg:CCFP 17))]
13605 && SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13606 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13607 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13610 (define_insn "*fp_jcc_2_sse_only"
13612 (if_then_else (match_operator 0 "comparison_operator"
13613 [(match_operand 1 "register_operand" "x")
13614 (match_operand 2 "nonimmediate_operand" "xm")])
13616 (label_ref (match_operand 3 "" ""))))
13617 (clobber (reg:CCFP 18))
13618 (clobber (reg:CCFP 17))]
13619 "SSE_FLOAT_MODE_P (GET_MODE (operands[1]))
13620 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13621 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13624 (define_insn "*fp_jcc_3"
13626 (if_then_else (match_operator 0 "comparison_operator"
13627 [(match_operand 1 "register_operand" "f")
13628 (match_operand 2 "nonimmediate_operand" "fm")])
13629 (label_ref (match_operand 3 "" ""))
13631 (clobber (reg:CCFP 18))
13632 (clobber (reg:CCFP 17))
13633 (clobber (match_scratch:HI 4 "=a"))]
13635 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
13636 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13637 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
13638 && SELECT_CC_MODE (GET_CODE (operands[0]),
13639 operands[1], operands[2]) == CCFPmode
13640 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13643 (define_insn "*fp_jcc_4"
13645 (if_then_else (match_operator 0 "comparison_operator"
13646 [(match_operand 1 "register_operand" "f")
13647 (match_operand 2 "nonimmediate_operand" "fm")])
13649 (label_ref (match_operand 3 "" ""))))
13650 (clobber (reg:CCFP 18))
13651 (clobber (reg:CCFP 17))
13652 (clobber (match_scratch:HI 4 "=a"))]
13654 && (GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode)
13655 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13656 && !ix86_use_fcomi_compare (GET_CODE (operands[0]))
13657 && SELECT_CC_MODE (GET_CODE (operands[0]),
13658 operands[1], operands[2]) == CCFPmode
13659 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13662 (define_insn "*fp_jcc_5"
13664 (if_then_else (match_operator 0 "comparison_operator"
13665 [(match_operand 1 "register_operand" "f")
13666 (match_operand 2 "register_operand" "f")])
13667 (label_ref (match_operand 3 "" ""))
13669 (clobber (reg:CCFP 18))
13670 (clobber (reg:CCFP 17))
13671 (clobber (match_scratch:HI 4 "=a"))]
13673 && FLOAT_MODE_P (GET_MODE (operands[1]))
13674 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13675 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13678 (define_insn "*fp_jcc_6"
13680 (if_then_else (match_operator 0 "comparison_operator"
13681 [(match_operand 1 "register_operand" "f")
13682 (match_operand 2 "register_operand" "f")])
13684 (label_ref (match_operand 3 "" ""))))
13685 (clobber (reg:CCFP 18))
13686 (clobber (reg:CCFP 17))
13687 (clobber (match_scratch:HI 4 "=a"))]
13689 && FLOAT_MODE_P (GET_MODE (operands[1]))
13690 && GET_MODE (operands[1]) == GET_MODE (operands[2])
13691 && ix86_fp_jump_nontrivial_p (GET_CODE (operands[0]))"
13696 (if_then_else (match_operator 0 "comparison_operator"
13697 [(match_operand 1 "register_operand" "")
13698 (match_operand 2 "nonimmediate_operand" "")])
13699 (match_operand 3 "" "")
13700 (match_operand 4 "" "")))
13701 (clobber (reg:CCFP 18))
13702 (clobber (reg:CCFP 17))]
13706 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13707 operands[3], operands[4], NULL_RTX);
13713 (if_then_else (match_operator 0 "comparison_operator"
13714 [(match_operand 1 "register_operand" "")
13715 (match_operand 2 "nonimmediate_operand" "")])
13716 (match_operand 3 "" "")
13717 (match_operand 4 "" "")))
13718 (clobber (reg:CCFP 18))
13719 (clobber (reg:CCFP 17))
13720 (clobber (match_scratch:HI 5 "=a"))]
13723 (if_then_else (match_dup 6)
13727 ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
13728 operands[3], operands[4], operands[5]);
13732 ;; Unconditional and other jump instructions
13734 (define_insn "jump"
13736 (label_ref (match_operand 0 "" "")))]
13739 [(set_attr "type" "ibr")
13740 (set (attr "length")
13741 (if_then_else (and (ge (minus (match_dup 0) (pc))
13743 (lt (minus (match_dup 0) (pc))
13747 (set_attr "modrm" "0")])
13749 (define_expand "indirect_jump"
13750 [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))]
13754 (define_insn "*indirect_jump"
13755 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
13758 [(set_attr "type" "ibr")
13759 (set_attr "length_immediate" "0")])
13761 (define_insn "*indirect_jump_rtx64"
13762 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))]
13765 [(set_attr "type" "ibr")
13766 (set_attr "length_immediate" "0")])
13768 (define_expand "tablejump"
13769 [(parallel [(set (pc) (match_operand 0 "nonimmediate_operand" "rm"))
13770 (use (label_ref (match_operand 1 "" "")))])]
13773 /* In PIC mode, the table entries are stored GOT (32-bit) or PC (64-bit)
13774 relative. Convert the relative address to an absolute address. */
13778 enum rtx_code code;
13784 op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
13786 else if (TARGET_MACHO || HAVE_AS_GOTOFF_IN_DATA)
13790 op1 = pic_offset_table_rtx;
13795 op0 = pic_offset_table_rtx;
13799 operands[0] = expand_simple_binop (Pmode, code, op0, op1, NULL_RTX, 0,
13804 (define_insn "*tablejump_1"
13805 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))
13806 (use (label_ref (match_operand 1 "" "")))]
13809 [(set_attr "type" "ibr")
13810 (set_attr "length_immediate" "0")])
13812 (define_insn "*tablejump_1_rtx64"
13813 [(set (pc) (match_operand:DI 0 "nonimmediate_operand" "rm"))
13814 (use (label_ref (match_operand 1 "" "")))]
13817 [(set_attr "type" "ibr")
13818 (set_attr "length_immediate" "0")])
13820 ;; Loop instruction
13822 ;; This is all complicated by the fact that since this is a jump insn
13823 ;; we must handle our own reloads.
13825 (define_expand "doloop_end"
13826 [(use (match_operand 0 "" "")) ; loop pseudo
13827 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13828 (use (match_operand 2 "" "")) ; max iterations
13829 (use (match_operand 3 "" "")) ; loop level
13830 (use (match_operand 4 "" ""))] ; label
13831 "!TARGET_64BIT && TARGET_USE_LOOP"
13834 /* Only use cloop on innermost loops. */
13835 if (INTVAL (operands[3]) > 1)
13837 if (GET_MODE (operands[0]) != SImode)
13839 emit_jump_insn (gen_doloop_end_internal (operands[4], operands[0],
13844 (define_insn "doloop_end_internal"
13846 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,?*r,?*r")
13848 (label_ref (match_operand 0 "" ""))
13850 (set (match_operand:SI 2 "register_operand" "=1,1,*m*r")
13851 (plus:SI (match_dup 1)
13853 (clobber (match_scratch:SI 3 "=X,X,r"))
13854 (clobber (reg:CC 17))]
13855 "!TARGET_64BIT && TARGET_USE_LOOP"
13857 if (which_alternative != 0)
13859 if (get_attr_length (insn) == 2)
13860 return "%+loop\t%l0";
13862 return "dec{l}\t%1\;%+jne\t%l0";
13864 [(set_attr "ppro_uops" "many")
13865 (set (attr "length")
13866 (if_then_else (and (eq_attr "alternative" "0")
13867 (and (ge (minus (match_dup 0) (pc))
13869 (lt (minus (match_dup 0) (pc))
13873 ;; We don't know the type before shorten branches. Optimistically expect
13874 ;; the loop instruction to match.
13875 (set (attr "type") (const_string "ibr"))])
13879 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13881 (match_operand 0 "" "")
13884 (plus:SI (match_dup 1)
13886 (clobber (match_scratch:SI 2 ""))
13887 (clobber (reg:CC 17))]
13888 "!TARGET_64BIT && TARGET_USE_LOOP
13889 && reload_completed
13890 && REGNO (operands[1]) != 2"
13891 [(parallel [(set (reg:CCZ 17)
13892 (compare:CCZ (plus:SI (match_dup 1) (const_int -1))
13894 (set (match_dup 1) (plus:SI (match_dup 1) (const_int -1)))])
13895 (set (pc) (if_then_else (ne (reg:CCZ 17) (const_int 0))
13902 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
13904 (match_operand 0 "" "")
13906 (set (match_operand:SI 2 "nonimmediate_operand" "")
13907 (plus:SI (match_dup 1)
13909 (clobber (match_scratch:SI 3 ""))
13910 (clobber (reg:CC 17))]
13911 "!TARGET_64BIT && TARGET_USE_LOOP
13912 && reload_completed
13913 && (! REG_P (operands[2])
13914 || ! rtx_equal_p (operands[1], operands[2]))"
13915 [(set (match_dup 3) (match_dup 1))
13916 (parallel [(set (reg:CCZ 17)
13917 (compare:CCZ (plus:SI (match_dup 3) (const_int -1))
13919 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
13920 (set (match_dup 2) (match_dup 3))
13921 (set (pc) (if_then_else (ne (reg:CCZ 17) (const_int 0))
13926 ;; Convert setcc + movzbl to xor + setcc if operands don't overlap.
13929 [(set (reg 17) (match_operand 0 "" ""))
13930 (set (match_operand:QI 1 "register_operand" "")
13931 (match_operator:QI 2 "ix86_comparison_operator"
13932 [(reg 17) (const_int 0)]))
13933 (set (match_operand 3 "q_regs_operand" "")
13934 (zero_extend (match_dup 1)))]
13935 "(peep2_reg_dead_p (3, operands[1])
13936 || operands_match_p (operands[1], operands[3]))
13937 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13938 [(set (match_dup 4) (match_dup 0))
13939 (set (strict_low_part (match_dup 5))
13942 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13943 operands[5] = gen_rtx_REG (QImode, REGNO (operands[3]));
13944 ix86_expand_clear (operands[3]);
13947 ;; Similar, but match zero_extendhisi2_and, which adds a clobber.
13950 [(set (reg 17) (match_operand 0 "" ""))
13951 (set (match_operand:QI 1 "register_operand" "")
13952 (match_operator:QI 2 "ix86_comparison_operator"
13953 [(reg 17) (const_int 0)]))
13954 (parallel [(set (match_operand 3 "q_regs_operand" "")
13955 (zero_extend (match_dup 1)))
13956 (clobber (reg:CC 17))])]
13957 "(peep2_reg_dead_p (3, operands[1])
13958 || operands_match_p (operands[1], operands[3]))
13959 && ! reg_overlap_mentioned_p (operands[3], operands[0])"
13960 [(set (match_dup 4) (match_dup 0))
13961 (set (strict_low_part (match_dup 5))
13964 operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
13965 operands[5] = gen_rtx_REG (QImode, REGNO (operands[3]));
13966 ix86_expand_clear (operands[3]);
13969 ;; Call instructions.
13971 ;; The predicates normally associated with named expanders are not properly
13972 ;; checked for calls. This is a bug in the generic code, but it isn't that
13973 ;; easy to fix. Ignore it for now and be prepared to fix things up.
13975 ;; Call subroutine returning no value.
13977 (define_expand "call_pop"
13978 [(parallel [(call (match_operand:QI 0 "" "")
13979 (match_operand:SI 1 "" ""))
13981 (plus:SI (reg:SI 7)
13982 (match_operand:SI 3 "" "")))])]
13985 ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3], 0);
13989 (define_insn "*call_pop_0"
13990 [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" ""))
13991 (match_operand:SI 1 "" ""))
13992 (set (reg:SI 7) (plus:SI (reg:SI 7)
13993 (match_operand:SI 2 "immediate_operand" "")))]
13996 if (SIBLING_CALL_P (insn))
13999 return "call\t%P0";
14001 [(set_attr "type" "call")])
14003 (define_insn "*call_pop_1"
14004 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
14005 (match_operand:SI 1 "" ""))
14006 (set (reg:SI 7) (plus:SI (reg:SI 7)
14007 (match_operand:SI 2 "immediate_operand" "i")))]
14010 if (constant_call_address_operand (operands[0], Pmode))
14012 if (SIBLING_CALL_P (insn))
14015 return "call\t%P0";
14017 if (SIBLING_CALL_P (insn))
14020 return "call\t%A0";
14022 [(set_attr "type" "call")])
14024 (define_expand "call"
14025 [(call (match_operand:QI 0 "" "")
14026 (match_operand 1 "" ""))
14027 (use (match_operand 2 "" ""))]
14030 ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 0);
14034 (define_expand "sibcall"
14035 [(call (match_operand:QI 0 "" "")
14036 (match_operand 1 "" ""))
14037 (use (match_operand 2 "" ""))]
14040 ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 1);
14044 (define_insn "*call_0"
14045 [(call (mem:QI (match_operand 0 "constant_call_address_operand" ""))
14046 (match_operand 1 "" ""))]
14049 if (SIBLING_CALL_P (insn))
14052 return "call\t%P0";
14054 [(set_attr "type" "call")])
14056 (define_insn "*call_1"
14057 [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm"))
14058 (match_operand 1 "" ""))]
14059 "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
14061 if (constant_call_address_operand (operands[0], QImode))
14062 return "call\t%P0";
14063 return "call\t%A0";
14065 [(set_attr "type" "call")])
14067 (define_insn "*sibcall_1"
14068 [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,c,d,a"))
14069 (match_operand 1 "" ""))]
14070 "SIBLING_CALL_P (insn) && !TARGET_64BIT"
14072 if (constant_call_address_operand (operands[0], QImode))
14076 [(set_attr "type" "call")])
14078 (define_insn "*call_1_rex64"
14079 [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm"))
14080 (match_operand 1 "" ""))]
14081 "!SIBLING_CALL_P (insn) && TARGET_64BIT"
14083 if (constant_call_address_operand (operands[0], QImode))
14084 return "call\t%P0";
14085 return "call\t%A0";
14087 [(set_attr "type" "call")])
14089 (define_insn "*sibcall_1_rex64"
14090 [(call (mem:QI (match_operand:DI 0 "constant_call_address_operand" ""))
14091 (match_operand 1 "" ""))]
14092 "SIBLING_CALL_P (insn) && TARGET_64BIT"
14094 [(set_attr "type" "call")])
14096 (define_insn "*sibcall_1_rex64_v"
14097 [(call (mem:QI (reg:DI 40))
14098 (match_operand 0 "" ""))]
14099 "SIBLING_CALL_P (insn) && TARGET_64BIT"
14101 [(set_attr "type" "call")])
14104 ;; Call subroutine, returning value in operand 0
14106 (define_expand "call_value_pop"
14107 [(parallel [(set (match_operand 0 "" "")
14108 (call (match_operand:QI 1 "" "")
14109 (match_operand:SI 2 "" "")))
14111 (plus:SI (reg:SI 7)
14112 (match_operand:SI 4 "" "")))])]
14115 ix86_expand_call (operands[0], operands[1], operands[2],
14116 operands[3], operands[4], 0);
14120 (define_expand "call_value"
14121 [(set (match_operand 0 "" "")
14122 (call (match_operand:QI 1 "" "")
14123 (match_operand:SI 2 "" "")))
14124 (use (match_operand:SI 3 "" ""))]
14125 ;; Operand 2 not used on the i386.
14128 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 0);
14132 (define_expand "sibcall_value"
14133 [(set (match_operand 0 "" "")
14134 (call (match_operand:QI 1 "" "")
14135 (match_operand:SI 2 "" "")))
14136 (use (match_operand:SI 3 "" ""))]
14137 ;; Operand 2 not used on the i386.
14140 ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 1);
14144 ;; Call subroutine returning any type.
14146 (define_expand "untyped_call"
14147 [(parallel [(call (match_operand 0 "" "")
14149 (match_operand 1 "" "")
14150 (match_operand 2 "" "")])]
14155 /* In order to give reg-stack an easier job in validating two
14156 coprocessor registers as containing a possible return value,
14157 simply pretend the untyped call returns a complex long double
14160 ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
14161 ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
14162 operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1),
14165 for (i = 0; i < XVECLEN (operands[2], 0); i++)
14167 rtx set = XVECEXP (operands[2], 0, i);
14168 emit_move_insn (SET_DEST (set), SET_SRC (set));
14171 /* The optimizer does not know that the call sets the function value
14172 registers we stored in the result block. We avoid problems by
14173 claiming that all hard registers are used and clobbered at this
14175 emit_insn (gen_blockage (const0_rtx));
14180 ;; Prologue and epilogue instructions
14182 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
14183 ;; all of memory. This blocks insns from being moved across this point.
14185 (define_insn "blockage"
14186 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_BLOCKAGE)]
14189 [(set_attr "length" "0")])
14191 ;; Insn emitted into the body of a function to return from a function.
14192 ;; This is only done if the function's epilogue is known to be simple.
14193 ;; See comments for ix86_can_use_return_insn_p in i386.c.
14195 (define_expand "return"
14197 "ix86_can_use_return_insn_p ()"
14199 if (current_function_pops_args)
14201 rtx popc = GEN_INT (current_function_pops_args);
14202 emit_jump_insn (gen_return_pop_internal (popc));
14207 (define_insn "return_internal"
14211 [(set_attr "length" "1")
14212 (set_attr "length_immediate" "0")
14213 (set_attr "modrm" "0")])
14215 (define_insn "return_pop_internal"
14217 (use (match_operand:SI 0 "const_int_operand" ""))]
14220 [(set_attr "length" "3")
14221 (set_attr "length_immediate" "2")
14222 (set_attr "modrm" "0")])
14224 (define_insn "return_indirect_internal"
14226 (use (match_operand:SI 0 "register_operand" "r"))]
14229 [(set_attr "type" "ibr")
14230 (set_attr "length_immediate" "0")])
14236 [(set_attr "length" "1")
14237 (set_attr "length_immediate" "0")
14238 (set_attr "modrm" "0")
14239 (set_attr "ppro_uops" "one")])
14241 (define_expand "prologue"
14244 "ix86_expand_prologue (); DONE;")
14246 (define_insn "set_got"
14247 [(set (match_operand:SI 0 "register_operand" "=r")
14248 (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
14249 (clobber (reg:CC 17))]
14251 { return output_set_got (operands[0]); }
14252 [(set_attr "type" "multi")
14253 (set_attr "length" "12")])
14255 (define_expand "epilogue"
14258 "ix86_expand_epilogue (1); DONE;")
14260 (define_expand "sibcall_epilogue"
14263 "ix86_expand_epilogue (0); DONE;")
14265 (define_expand "eh_return"
14266 [(use (match_operand 0 "register_operand" ""))
14267 (use (match_operand 1 "register_operand" ""))]
14270 rtx tmp, sa = operands[0], ra = operands[1];
14272 /* Tricky bit: we write the address of the handler to which we will
14273 be returning into someone else's stack frame, one word below the
14274 stack address we wish to restore. */
14275 tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
14276 tmp = plus_constant (tmp, -UNITS_PER_WORD);
14277 tmp = gen_rtx_MEM (Pmode, tmp);
14278 emit_move_insn (tmp, ra);
14280 if (Pmode == SImode)
14281 emit_insn (gen_eh_return_si (sa));
14283 emit_insn (gen_eh_return_di (sa));
14288 (define_insn_and_split "eh_return_si"
14289 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")]
14290 UNSPECV_EH_RETURN)]
14295 "ix86_expand_epilogue (2); DONE;")
14297 (define_insn_and_split "eh_return_di"
14298 [(unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
14299 UNSPECV_EH_RETURN)]
14304 "ix86_expand_epilogue (2); DONE;")
14306 (define_insn "leave"
14307 [(set (reg:SI 7) (plus:SI (reg:SI 6) (const_int 4)))
14308 (set (reg:SI 6) (mem:SI (reg:SI 6)))
14309 (clobber (mem:BLK (scratch)))]
14312 [(set_attr "type" "leave")])
14314 (define_insn "leave_rex64"
14315 [(set (reg:DI 7) (plus:DI (reg:DI 6) (const_int 8)))
14316 (set (reg:DI 6) (mem:DI (reg:DI 6)))
14317 (clobber (mem:BLK (scratch)))]
14320 [(set_attr "type" "leave")])
14322 (define_expand "ffssi2"
14324 [(set (match_operand:SI 0 "register_operand" "")
14325 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "")))
14326 (clobber (match_scratch:SI 2 ""))
14327 (clobber (reg:CC 17))])]
14331 (define_insn_and_split "*ffs_cmove"
14332 [(set (match_operand:SI 0 "register_operand" "=r")
14333 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
14334 (clobber (match_scratch:SI 2 "=&r"))
14335 (clobber (reg:CC 17))]
14338 "&& reload_completed"
14339 [(set (match_dup 2) (const_int -1))
14340 (parallel [(set (reg:CCZ 17) (compare:CCZ (match_dup 1) (const_int 0)))
14341 (set (match_dup 0) (ctz:SI (match_dup 1)))])
14342 (set (match_dup 0) (if_then_else:SI
14343 (eq (reg:CCZ 17) (const_int 0))
14346 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
14347 (clobber (reg:CC 17))])]
14350 (define_insn_and_split "*ffs_no_cmove"
14351 [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
14352 (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
14353 (clobber (match_scratch:SI 2 "=&r"))
14354 (clobber (reg:CC 17))]
14358 [(parallel [(set (match_dup 2) (const_int 0))
14359 (clobber (reg:CC 17))])
14360 (parallel [(set (reg:CCZ 17) (compare:CCZ (match_dup 1) (const_int 0)))
14361 (set (match_dup 0) (ctz:SI (match_dup 1)))])
14362 (set (strict_low_part (match_dup 3))
14363 (eq:QI (reg:CCZ 17) (const_int 0)))
14364 (parallel [(set (match_dup 2) (neg:SI (match_dup 2)))
14365 (clobber (reg:CC 17))])
14366 (parallel [(set (match_dup 0) (ior:SI (match_dup 0) (match_dup 2)))
14367 (clobber (reg:CC 17))])
14368 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
14369 (clobber (reg:CC 17))])]
14371 operands[3] = gen_lowpart (QImode, operands[2]);
14374 (define_insn "*ffssi_1"
14376 (compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm")
14378 (set (match_operand:SI 0 "register_operand" "=r")
14379 (ctz:SI (match_dup 1)))]
14381 "bsf{l}\t{%1, %0|%0, %1}"
14382 [(set_attr "prefix_0f" "1")
14383 (set_attr "ppro_uops" "few")])
14385 (define_insn "ctzsi2"
14386 [(set (match_operand:SI 0 "register_operand" "=r")
14387 (ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
14388 (clobber (reg:CC 17))]
14390 "bsf{l}\t{%1, %0|%0, %1}"
14391 [(set_attr "prefix_0f" "1")
14392 (set_attr "ppro_uops" "few")])
14394 (define_expand "clzsi2"
14396 [(set (match_operand:SI 0 "register_operand" "")
14397 (minus:SI (const_int 31)
14398 (clz:SI (match_operand:SI 1 "nonimmediate_operand" ""))))
14399 (clobber (reg:CC 17))])
14401 [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 31)))
14402 (clobber (reg:CC 17))])]
14406 (define_insn "*bsr"
14407 [(set (match_operand:SI 0 "register_operand" "=r")
14408 (minus:SI (const_int 31)
14409 (clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))))
14410 (clobber (reg:CC 17))]
14412 "bsr{l}\t{%1, %0|%0, %1}"
14413 [(set_attr "prefix_0f" "1")
14414 (set_attr "ppro_uops" "few")])
14416 ;; Thread-local storage patterns for ELF.
14418 ;; Note that these code sequences must appear exactly as shown
14419 ;; in order to allow linker relaxation.
14421 (define_insn "*tls_global_dynamic_32_gnu"
14422 [(set (match_operand:SI 0 "register_operand" "=a")
14423 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14424 (match_operand:SI 2 "tls_symbolic_operand" "")
14425 (match_operand:SI 3 "call_insn_operand" "")]
14427 (clobber (match_scratch:SI 4 "=d"))
14428 (clobber (match_scratch:SI 5 "=c"))
14429 (clobber (reg:CC 17))]
14430 "!TARGET_64BIT && TARGET_GNU_TLS"
14431 "lea{l}\t{%a2@TLSGD(,%1,1), %0|%0, %a2@TLSGD[%1*1]}\;call\t%P3"
14432 [(set_attr "type" "multi")
14433 (set_attr "length" "12")])
14435 (define_insn "*tls_global_dynamic_32_sun"
14436 [(set (match_operand:SI 0 "register_operand" "=a")
14437 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14438 (match_operand:SI 2 "tls_symbolic_operand" "")
14439 (match_operand:SI 3 "call_insn_operand" "")]
14441 (clobber (match_scratch:SI 4 "=d"))
14442 (clobber (match_scratch:SI 5 "=c"))
14443 (clobber (reg:CC 17))]
14444 "!TARGET_64BIT && TARGET_SUN_TLS"
14445 "lea{l}\t{%a2@DTLNDX(%1), %4|%4, %a2@DTLNDX[%1]}
14446 push{l}\t%4\;call\t%a2@TLSPLT\;pop{l}\t%4\;nop"
14447 [(set_attr "type" "multi")
14448 (set_attr "length" "14")])
14450 (define_expand "tls_global_dynamic_32"
14451 [(parallel [(set (match_operand:SI 0 "register_operand" "")
14454 (match_operand:SI 1 "tls_symbolic_operand" "")
14457 (clobber (match_scratch:SI 4 ""))
14458 (clobber (match_scratch:SI 5 ""))
14459 (clobber (reg:CC 17))])]
14463 operands[2] = pic_offset_table_rtx;
14466 operands[2] = gen_reg_rtx (Pmode);
14467 emit_insn (gen_set_got (operands[2]));
14469 operands[3] = ix86_tls_get_addr ();
14472 (define_insn "*tls_global_dynamic_64"
14473 [(set (match_operand:DI 0 "register_operand" "=a")
14474 (call (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
14475 (match_operand:DI 3 "" "")))
14476 (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
14479 ".byte\t0x66\;lea{q}\t{%a1@TLSGD(%%rip), %%rdi|%%rdi, %a1@TLSGD[%%rip]}\;.word\t0x6666\;rex64\;call\t%P2"
14480 [(set_attr "type" "multi")
14481 (set_attr "length" "16")])
14483 (define_expand "tls_global_dynamic_64"
14484 [(parallel [(set (match_operand:DI 0 "register_operand" "")
14485 (call (mem:QI (match_dup 2)) (const_int 0)))
14486 (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
14490 operands[2] = ix86_tls_get_addr ();
14493 (define_insn "*tls_local_dynamic_base_32_gnu"
14494 [(set (match_operand:SI 0 "register_operand" "=a")
14495 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14496 (match_operand:SI 2 "call_insn_operand" "")]
14497 UNSPEC_TLS_LD_BASE))
14498 (clobber (match_scratch:SI 3 "=d"))
14499 (clobber (match_scratch:SI 4 "=c"))
14500 (clobber (reg:CC 17))]
14501 "!TARGET_64BIT && TARGET_GNU_TLS"
14502 "lea{l}\t{%&@TLSLDM(%1), %0|%0, %&@TLSLDM[%1]}\;call\t%P2"
14503 [(set_attr "type" "multi")
14504 (set_attr "length" "11")])
14506 (define_insn "*tls_local_dynamic_base_32_sun"
14507 [(set (match_operand:SI 0 "register_operand" "=a")
14508 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14509 (match_operand:SI 2 "call_insn_operand" "")]
14510 UNSPEC_TLS_LD_BASE))
14511 (clobber (match_scratch:SI 3 "=d"))
14512 (clobber (match_scratch:SI 4 "=c"))
14513 (clobber (reg:CC 17))]
14514 "!TARGET_64BIT && TARGET_SUN_TLS"
14515 "lea{l}\t{%&@TMDNX(%1), %3|%3, %&@TMDNX[%1]}
14516 push{l}\t%3\;call\t%&@TLSPLT\;pop{l}\t%3"
14517 [(set_attr "type" "multi")
14518 (set_attr "length" "13")])
14520 (define_expand "tls_local_dynamic_base_32"
14521 [(parallel [(set (match_operand:SI 0 "register_operand" "")
14522 (unspec:SI [(match_dup 1) (match_dup 2)]
14523 UNSPEC_TLS_LD_BASE))
14524 (clobber (match_scratch:SI 3 ""))
14525 (clobber (match_scratch:SI 4 ""))
14526 (clobber (reg:CC 17))])]
14530 operands[1] = pic_offset_table_rtx;
14533 operands[1] = gen_reg_rtx (Pmode);
14534 emit_insn (gen_set_got (operands[1]));
14536 operands[2] = ix86_tls_get_addr ();
14539 (define_insn "*tls_local_dynamic_base_64"
14540 [(set (match_operand:DI 0 "register_operand" "=a")
14541 (call (mem:QI (match_operand:DI 1 "call_insn_operand" ""))
14542 (match_operand:DI 2 "" "")))
14543 (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)]
14545 "lea{q}\t{%&@TLSLD(%%rip), %%rdi|%%rdi, %&@TLSLD[%%rip]}\;call\t%P1"
14546 [(set_attr "type" "multi")
14547 (set_attr "length" "12")])
14549 (define_expand "tls_local_dynamic_base_64"
14550 [(parallel [(set (match_operand:DI 0 "register_operand" "")
14551 (call (mem:QI (match_dup 1)) (const_int 0)))
14552 (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)])]
14555 operands[1] = ix86_tls_get_addr ();
14558 ;; Local dynamic of a single variable is a lose. Show combine how
14559 ;; to convert that back to global dynamic.
14561 (define_insn_and_split "*tls_local_dynamic_32_once"
14562 [(set (match_operand:SI 0 "register_operand" "=a")
14563 (plus:SI (unspec:SI [(match_operand:SI 1 "register_operand" "b")
14564 (match_operand:SI 2 "call_insn_operand" "")]
14565 UNSPEC_TLS_LD_BASE)
14566 (const:SI (unspec:SI
14567 [(match_operand:SI 3 "tls_symbolic_operand" "")]
14569 (clobber (match_scratch:SI 4 "=d"))
14570 (clobber (match_scratch:SI 5 "=c"))
14571 (clobber (reg:CC 17))]
14575 [(parallel [(set (match_dup 0)
14576 (unspec:SI [(match_dup 1) (match_dup 3) (match_dup 2)]
14578 (clobber (match_dup 4))
14579 (clobber (match_dup 5))
14580 (clobber (reg:CC 17))])]
14583 ;; These patterns match the binary 387 instructions for addM3, subM3,
14584 ;; mulM3 and divM3. There are three patterns for each of DFmode and
14585 ;; SFmode. The first is the normal insn, the second the same insn but
14586 ;; with one operand a conversion, and the third the same insn but with
14587 ;; the other operand a conversion. The conversion may be SFmode or
14588 ;; SImode if the target mode DFmode, but only SImode if the target mode
14591 ;; Gcc is slightly more smart about handling normal two address instructions
14592 ;; so use special patterns for add and mull.
14593 (define_insn "*fop_sf_comm_nosse"
14594 [(set (match_operand:SF 0 "register_operand" "=f")
14595 (match_operator:SF 3 "binary_fp_operator"
14596 [(match_operand:SF 1 "nonimmediate_operand" "%0")
14597 (match_operand:SF 2 "nonimmediate_operand" "fm")]))]
14598 "TARGET_80387 && !TARGET_SSE_MATH
14599 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
14600 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14601 "* return output_387_binary_op (insn, operands);"
14602 [(set (attr "type")
14603 (if_then_else (match_operand:SF 3 "mult_operator" "")
14604 (const_string "fmul")
14605 (const_string "fop")))
14606 (set_attr "mode" "SF")])
14608 (define_insn "*fop_sf_comm"
14609 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
14610 (match_operator:SF 3 "binary_fp_operator"
14611 [(match_operand:SF 1 "nonimmediate_operand" "%0,0")
14612 (match_operand:SF 2 "nonimmediate_operand" "fm#x,xm#f")]))]
14613 "TARGET_80387 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14614 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
14615 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14616 "* return output_387_binary_op (insn, operands);"
14617 [(set (attr "type")
14618 (if_then_else (eq_attr "alternative" "1")
14619 (if_then_else (match_operand:SF 3 "mult_operator" "")
14620 (const_string "ssemul")
14621 (const_string "sseadd"))
14622 (if_then_else (match_operand:SF 3 "mult_operator" "")
14623 (const_string "fmul")
14624 (const_string "fop"))))
14625 (set_attr "mode" "SF")])
14627 (define_insn "*fop_sf_comm_sse"
14628 [(set (match_operand:SF 0 "register_operand" "=x")
14629 (match_operator:SF 3 "binary_fp_operator"
14630 [(match_operand:SF 1 "nonimmediate_operand" "%0")
14631 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14632 "TARGET_SSE_MATH && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
14633 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14634 "* return output_387_binary_op (insn, operands);"
14635 [(set (attr "type")
14636 (if_then_else (match_operand:SF 3 "mult_operator" "")
14637 (const_string "ssemul")
14638 (const_string "sseadd")))
14639 (set_attr "mode" "SF")])
14641 (define_insn "*fop_df_comm_nosse"
14642 [(set (match_operand:DF 0 "register_operand" "=f")
14643 (match_operator:DF 3 "binary_fp_operator"
14644 [(match_operand:DF 1 "nonimmediate_operand" "%0")
14645 (match_operand:DF 2 "nonimmediate_operand" "fm")]))]
14646 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)
14647 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
14648 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14649 "* return output_387_binary_op (insn, operands);"
14650 [(set (attr "type")
14651 (if_then_else (match_operand:SF 3 "mult_operator" "")
14652 (const_string "fmul")
14653 (const_string "fop")))
14654 (set_attr "mode" "DF")])
14656 (define_insn "*fop_df_comm"
14657 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
14658 (match_operator:DF 3 "binary_fp_operator"
14659 [(match_operand:DF 1 "nonimmediate_operand" "%0,0")
14660 (match_operand:DF 2 "nonimmediate_operand" "fm#Y,Ym#f")]))]
14661 "TARGET_80387 && TARGET_SSE_MATH && TARGET_SSE2 && TARGET_MIX_SSE_I387
14662 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
14663 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14664 "* return output_387_binary_op (insn, operands);"
14665 [(set (attr "type")
14666 (if_then_else (eq_attr "alternative" "1")
14667 (if_then_else (match_operand:SF 3 "mult_operator" "")
14668 (const_string "ssemul")
14669 (const_string "sseadd"))
14670 (if_then_else (match_operand:SF 3 "mult_operator" "")
14671 (const_string "fmul")
14672 (const_string "fop"))))
14673 (set_attr "mode" "DF")])
14675 (define_insn "*fop_df_comm_sse"
14676 [(set (match_operand:DF 0 "register_operand" "=Y")
14677 (match_operator:DF 3 "binary_fp_operator"
14678 [(match_operand:DF 1 "nonimmediate_operand" "%0")
14679 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14680 "TARGET_SSE2 && TARGET_SSE_MATH
14681 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
14682 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14683 "* return output_387_binary_op (insn, operands);"
14684 [(set (attr "type")
14685 (if_then_else (match_operand:SF 3 "mult_operator" "")
14686 (const_string "ssemul")
14687 (const_string "sseadd")))
14688 (set_attr "mode" "DF")])
14690 (define_insn "*fop_xf_comm"
14691 [(set (match_operand:XF 0 "register_operand" "=f")
14692 (match_operator:XF 3 "binary_fp_operator"
14693 [(match_operand:XF 1 "register_operand" "%0")
14694 (match_operand:XF 2 "register_operand" "f")]))]
14695 "!TARGET_64BIT && TARGET_80387
14696 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
14697 "* return output_387_binary_op (insn, operands);"
14698 [(set (attr "type")
14699 (if_then_else (match_operand:XF 3 "mult_operator" "")
14700 (const_string "fmul")
14701 (const_string "fop")))
14702 (set_attr "mode" "XF")])
14704 (define_insn "*fop_tf_comm"
14705 [(set (match_operand:TF 0 "register_operand" "=f")
14706 (match_operator:TF 3 "binary_fp_operator"
14707 [(match_operand:TF 1 "register_operand" "%0")
14708 (match_operand:TF 2 "register_operand" "f")]))]
14709 "TARGET_80387 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
14710 "* return output_387_binary_op (insn, operands);"
14711 [(set (attr "type")
14712 (if_then_else (match_operand:TF 3 "mult_operator" "")
14713 (const_string "fmul")
14714 (const_string "fop")))
14715 (set_attr "mode" "XF")])
14717 (define_insn "*fop_sf_1_nosse"
14718 [(set (match_operand:SF 0 "register_operand" "=f,f")
14719 (match_operator:SF 3 "binary_fp_operator"
14720 [(match_operand:SF 1 "nonimmediate_operand" "0,fm")
14721 (match_operand:SF 2 "nonimmediate_operand" "fm,0")]))]
14722 "TARGET_80387 && !TARGET_SSE_MATH
14723 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14724 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14725 "* return output_387_binary_op (insn, operands);"
14726 [(set (attr "type")
14727 (cond [(match_operand:SF 3 "mult_operator" "")
14728 (const_string "fmul")
14729 (match_operand:SF 3 "div_operator" "")
14730 (const_string "fdiv")
14732 (const_string "fop")))
14733 (set_attr "mode" "SF")])
14735 (define_insn "*fop_sf_1"
14736 [(set (match_operand:SF 0 "register_operand" "=f,f,x")
14737 (match_operator:SF 3 "binary_fp_operator"
14738 [(match_operand:SF 1 "nonimmediate_operand" "0,fm,0")
14739 (match_operand:SF 2 "nonimmediate_operand" "fm,0,xm#f")]))]
14740 "TARGET_80387 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14741 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14742 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14743 "* return output_387_binary_op (insn, operands);"
14744 [(set (attr "type")
14745 (cond [(and (eq_attr "alternative" "2")
14746 (match_operand:SF 3 "mult_operator" ""))
14747 (const_string "ssemul")
14748 (and (eq_attr "alternative" "2")
14749 (match_operand:SF 3 "div_operator" ""))
14750 (const_string "ssediv")
14751 (eq_attr "alternative" "2")
14752 (const_string "sseadd")
14753 (match_operand:SF 3 "mult_operator" "")
14754 (const_string "fmul")
14755 (match_operand:SF 3 "div_operator" "")
14756 (const_string "fdiv")
14758 (const_string "fop")))
14759 (set_attr "mode" "SF")])
14761 (define_insn "*fop_sf_1_sse"
14762 [(set (match_operand:SF 0 "register_operand" "=x")
14763 (match_operator:SF 3 "binary_fp_operator"
14764 [(match_operand:SF 1 "register_operand" "0")
14765 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
14767 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14768 "* return output_387_binary_op (insn, operands);"
14769 [(set (attr "type")
14770 (cond [(match_operand:SF 3 "mult_operator" "")
14771 (const_string "ssemul")
14772 (match_operand:SF 3 "div_operator" "")
14773 (const_string "ssediv")
14775 (const_string "sseadd")))
14776 (set_attr "mode" "SF")])
14778 ;; ??? Add SSE splitters for these!
14779 (define_insn "*fop_sf_2"
14780 [(set (match_operand:SF 0 "register_operand" "=f,f")
14781 (match_operator:SF 3 "binary_fp_operator"
14782 [(float:SF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14783 (match_operand:SF 2 "register_operand" "0,0")]))]
14784 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14785 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14786 [(set (attr "type")
14787 (cond [(match_operand:SF 3 "mult_operator" "")
14788 (const_string "fmul")
14789 (match_operand:SF 3 "div_operator" "")
14790 (const_string "fdiv")
14792 (const_string "fop")))
14793 (set_attr "fp_int_src" "true")
14794 (set_attr "ppro_uops" "many")
14795 (set_attr "mode" "SI")])
14797 (define_insn "*fop_sf_3"
14798 [(set (match_operand:SF 0 "register_operand" "=f,f")
14799 (match_operator:SF 3 "binary_fp_operator"
14800 [(match_operand:SF 1 "register_operand" "0,0")
14801 (float:SF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14802 "TARGET_80387 && TARGET_USE_FIOP && !TARGET_SSE_MATH"
14803 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14804 [(set (attr "type")
14805 (cond [(match_operand:SF 3 "mult_operator" "")
14806 (const_string "fmul")
14807 (match_operand:SF 3 "div_operator" "")
14808 (const_string "fdiv")
14810 (const_string "fop")))
14811 (set_attr "fp_int_src" "true")
14812 (set_attr "ppro_uops" "many")
14813 (set_attr "mode" "SI")])
14815 (define_insn "*fop_df_1_nosse"
14816 [(set (match_operand:DF 0 "register_operand" "=f,f")
14817 (match_operator:DF 3 "binary_fp_operator"
14818 [(match_operand:DF 1 "nonimmediate_operand" "0,fm")
14819 (match_operand:DF 2 "nonimmediate_operand" "fm,0")]))]
14820 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)
14821 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14822 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14823 "* return output_387_binary_op (insn, operands);"
14824 [(set (attr "type")
14825 (cond [(match_operand:DF 3 "mult_operator" "")
14826 (const_string "fmul")
14827 (match_operand:DF 3 "div_operator" "")
14828 (const_string "fdiv")
14830 (const_string "fop")))
14831 (set_attr "mode" "DF")])
14834 (define_insn "*fop_df_1"
14835 [(set (match_operand:DF 0 "register_operand" "=f#Y,f#Y,Y#f")
14836 (match_operator:DF 3 "binary_fp_operator"
14837 [(match_operand:DF 1 "nonimmediate_operand" "0,fm,0")
14838 (match_operand:DF 2 "nonimmediate_operand" "fm,0,Ym#f")]))]
14839 "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
14840 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'
14841 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14842 "* return output_387_binary_op (insn, operands);"
14843 [(set (attr "type")
14844 (cond [(and (eq_attr "alternative" "2")
14845 (match_operand:SF 3 "mult_operator" ""))
14846 (const_string "ssemul")
14847 (and (eq_attr "alternative" "2")
14848 (match_operand:SF 3 "div_operator" ""))
14849 (const_string "ssediv")
14850 (eq_attr "alternative" "2")
14851 (const_string "sseadd")
14852 (match_operand:DF 3 "mult_operator" "")
14853 (const_string "fmul")
14854 (match_operand:DF 3 "div_operator" "")
14855 (const_string "fdiv")
14857 (const_string "fop")))
14858 (set_attr "mode" "DF")])
14860 (define_insn "*fop_df_1_sse"
14861 [(set (match_operand:DF 0 "register_operand" "=Y")
14862 (match_operator:DF 3 "binary_fp_operator"
14863 [(match_operand:DF 1 "register_operand" "0")
14864 (match_operand:DF 2 "nonimmediate_operand" "Ym")]))]
14865 "TARGET_SSE2 && TARGET_SSE_MATH
14866 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14867 "* return output_387_binary_op (insn, operands);"
14868 [(set_attr "mode" "DF")
14870 (cond [(match_operand:SF 3 "mult_operator" "")
14871 (const_string "ssemul")
14872 (match_operand:SF 3 "div_operator" "")
14873 (const_string "ssediv")
14875 (const_string "sseadd")))])
14877 ;; ??? Add SSE splitters for these!
14878 (define_insn "*fop_df_2"
14879 [(set (match_operand:DF 0 "register_operand" "=f,f")
14880 (match_operator:DF 3 "binary_fp_operator"
14881 [(float:DF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
14882 (match_operand:DF 2 "register_operand" "0,0")]))]
14883 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14884 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14885 [(set (attr "type")
14886 (cond [(match_operand:DF 3 "mult_operator" "")
14887 (const_string "fmul")
14888 (match_operand:DF 3 "div_operator" "")
14889 (const_string "fdiv")
14891 (const_string "fop")))
14892 (set_attr "fp_int_src" "true")
14893 (set_attr "ppro_uops" "many")
14894 (set_attr "mode" "SI")])
14896 (define_insn "*fop_df_3"
14897 [(set (match_operand:DF 0 "register_operand" "=f,f")
14898 (match_operator:DF 3 "binary_fp_operator"
14899 [(match_operand:DF 1 "register_operand" "0,0")
14900 (float:DF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
14901 "TARGET_80387 && TARGET_USE_FIOP && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14902 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
14903 [(set (attr "type")
14904 (cond [(match_operand:DF 3 "mult_operator" "")
14905 (const_string "fmul")
14906 (match_operand:DF 3 "div_operator" "")
14907 (const_string "fdiv")
14909 (const_string "fop")))
14910 (set_attr "fp_int_src" "true")
14911 (set_attr "ppro_uops" "many")
14912 (set_attr "mode" "SI")])
14914 (define_insn "*fop_df_4"
14915 [(set (match_operand:DF 0 "register_operand" "=f,f")
14916 (match_operator:DF 3 "binary_fp_operator"
14917 [(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
14918 (match_operand:DF 2 "register_operand" "0,f")]))]
14919 "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)
14920 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
14921 "* return output_387_binary_op (insn, operands);"
14922 [(set (attr "type")
14923 (cond [(match_operand:DF 3 "mult_operator" "")
14924 (const_string "fmul")
14925 (match_operand:DF 3 "div_operator" "")
14926 (const_string "fdiv")
14928 (const_string "fop")))
14929 (set_attr "mode" "SF")])
14931 (define_insn "*fop_df_5"
14932 [(set (match_operand:DF 0 "register_operand" "=f,f")
14933 (match_operator:DF 3 "binary_fp_operator"
14934 [(match_operand:DF 1 "register_operand" "0,f")
14936 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14937 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14938 "* return output_387_binary_op (insn, operands);"
14939 [(set (attr "type")
14940 (cond [(match_operand:DF 3 "mult_operator" "")
14941 (const_string "fmul")
14942 (match_operand:DF 3 "div_operator" "")
14943 (const_string "fdiv")
14945 (const_string "fop")))
14946 (set_attr "mode" "SF")])
14948 (define_insn "*fop_df_6"
14949 [(set (match_operand:DF 0 "register_operand" "=f,f")
14950 (match_operator:DF 3 "binary_fp_operator"
14952 (match_operand:SF 1 "register_operand" "0,f"))
14954 (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
14955 "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
14956 "* return output_387_binary_op (insn, operands);"
14957 [(set (attr "type")
14958 (cond [(match_operand:DF 3 "mult_operator" "")
14959 (const_string "fmul")
14960 (match_operand:DF 3 "div_operator" "")
14961 (const_string "fdiv")
14963 (const_string "fop")))
14964 (set_attr "mode" "SF")])
14966 (define_insn "*fop_xf_1"
14967 [(set (match_operand:XF 0 "register_operand" "=f,f")
14968 (match_operator:XF 3 "binary_fp_operator"
14969 [(match_operand:XF 1 "register_operand" "0,f")
14970 (match_operand:XF 2 "register_operand" "f,0")]))]
14971 "!TARGET_64BIT && TARGET_80387
14972 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14973 "* return output_387_binary_op (insn, operands);"
14974 [(set (attr "type")
14975 (cond [(match_operand:XF 3 "mult_operator" "")
14976 (const_string "fmul")
14977 (match_operand:XF 3 "div_operator" "")
14978 (const_string "fdiv")
14980 (const_string "fop")))
14981 (set_attr "mode" "XF")])
14983 (define_insn "*fop_tf_1"
14984 [(set (match_operand:TF 0 "register_operand" "=f,f")
14985 (match_operator:TF 3 "binary_fp_operator"
14986 [(match_operand:TF 1 "register_operand" "0,f")
14987 (match_operand:TF 2 "register_operand" "f,0")]))]
14989 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
14990 "* return output_387_binary_op (insn, operands);"
14991 [(set (attr "type")
14992 (cond [(match_operand:TF 3 "mult_operator" "")
14993 (const_string "fmul")
14994 (match_operand:TF 3 "div_operator" "")
14995 (const_string "fdiv")
14997 (const_string "fop")))
14998 (set_attr "mode" "XF")])
15000 (define_insn "*fop_xf_2"
15001 [(set (match_operand:XF 0 "register_operand" "=f,f")
15002 (match_operator:XF 3 "binary_fp_operator"
15003 [(float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
15004 (match_operand:XF 2 "register_operand" "0,0")]))]
15005 "!TARGET_64BIT && TARGET_80387 && TARGET_USE_FIOP"
15006 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
15007 [(set (attr "type")
15008 (cond [(match_operand:XF 3 "mult_operator" "")
15009 (const_string "fmul")
15010 (match_operand:XF 3 "div_operator" "")
15011 (const_string "fdiv")
15013 (const_string "fop")))
15014 (set_attr "fp_int_src" "true")
15015 (set_attr "mode" "SI")
15016 (set_attr "ppro_uops" "many")])
15018 (define_insn "*fop_tf_2"
15019 [(set (match_operand:TF 0 "register_operand" "=f,f")
15020 (match_operator:TF 3 "binary_fp_operator"
15021 [(float:TF (match_operand:SI 1 "nonimmediate_operand" "m,?r"))
15022 (match_operand:TF 2 "register_operand" "0,0")]))]
15023 "TARGET_80387 && TARGET_USE_FIOP"
15024 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
15025 [(set (attr "type")
15026 (cond [(match_operand:TF 3 "mult_operator" "")
15027 (const_string "fmul")
15028 (match_operand:TF 3 "div_operator" "")
15029 (const_string "fdiv")
15031 (const_string "fop")))
15032 (set_attr "fp_int_src" "true")
15033 (set_attr "mode" "SI")
15034 (set_attr "ppro_uops" "many")])
15036 (define_insn "*fop_xf_3"
15037 [(set (match_operand:XF 0 "register_operand" "=f,f")
15038 (match_operator:XF 3 "binary_fp_operator"
15039 [(match_operand:XF 1 "register_operand" "0,0")
15040 (float:XF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
15041 "!TARGET_64BIT && TARGET_80387 && TARGET_USE_FIOP"
15042 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
15043 [(set (attr "type")
15044 (cond [(match_operand:XF 3 "mult_operator" "")
15045 (const_string "fmul")
15046 (match_operand:XF 3 "div_operator" "")
15047 (const_string "fdiv")
15049 (const_string "fop")))
15050 (set_attr "fp_int_src" "true")
15051 (set_attr "mode" "SI")
15052 (set_attr "ppro_uops" "many")])
15054 (define_insn "*fop_tf_3"
15055 [(set (match_operand:TF 0 "register_operand" "=f,f")
15056 (match_operator:TF 3 "binary_fp_operator"
15057 [(match_operand:TF 1 "register_operand" "0,0")
15058 (float:TF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))]
15059 "TARGET_80387 && TARGET_USE_FIOP"
15060 "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);"
15061 [(set (attr "type")
15062 (cond [(match_operand:TF 3 "mult_operator" "")
15063 (const_string "fmul")
15064 (match_operand:TF 3 "div_operator" "")
15065 (const_string "fdiv")
15067 (const_string "fop")))
15068 (set_attr "fp_int_src" "true")
15069 (set_attr "mode" "SI")
15070 (set_attr "ppro_uops" "many")])
15072 (define_insn "*fop_xf_4"
15073 [(set (match_operand:XF 0 "register_operand" "=f,f")
15074 (match_operator:XF 3 "binary_fp_operator"
15075 [(float_extend:XF (match_operand 1 "nonimmediate_operand" "fm,0"))
15076 (match_operand:XF 2 "register_operand" "0,f")]))]
15077 "!TARGET_64BIT && TARGET_80387"
15078 "* return output_387_binary_op (insn, operands);"
15079 [(set (attr "type")
15080 (cond [(match_operand:XF 3 "mult_operator" "")
15081 (const_string "fmul")
15082 (match_operand:XF 3 "div_operator" "")
15083 (const_string "fdiv")
15085 (const_string "fop")))
15086 (set_attr "mode" "SF")])
15088 (define_insn "*fop_tf_4"
15089 [(set (match_operand:TF 0 "register_operand" "=f,f")
15090 (match_operator:TF 3 "binary_fp_operator"
15091 [(float_extend:TF (match_operand 1 "nonimmediate_operand" "fm,0"))
15092 (match_operand:TF 2 "register_operand" "0,f")]))]
15094 "* return output_387_binary_op (insn, operands);"
15095 [(set (attr "type")
15096 (cond [(match_operand:TF 3 "mult_operator" "")
15097 (const_string "fmul")
15098 (match_operand:TF 3 "div_operator" "")
15099 (const_string "fdiv")
15101 (const_string "fop")))
15102 (set_attr "mode" "SF")])
15104 (define_insn "*fop_xf_5"
15105 [(set (match_operand:XF 0 "register_operand" "=f,f")
15106 (match_operator:XF 3 "binary_fp_operator"
15107 [(match_operand:XF 1 "register_operand" "0,f")
15109 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
15110 "!TARGET_64BIT && TARGET_80387"
15111 "* return output_387_binary_op (insn, operands);"
15112 [(set (attr "type")
15113 (cond [(match_operand:XF 3 "mult_operator" "")
15114 (const_string "fmul")
15115 (match_operand:XF 3 "div_operator" "")
15116 (const_string "fdiv")
15118 (const_string "fop")))
15119 (set_attr "mode" "SF")])
15121 (define_insn "*fop_tf_5"
15122 [(set (match_operand:TF 0 "register_operand" "=f,f")
15123 (match_operator:TF 3 "binary_fp_operator"
15124 [(match_operand:TF 1 "register_operand" "0,f")
15126 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
15128 "* return output_387_binary_op (insn, operands);"
15129 [(set (attr "type")
15130 (cond [(match_operand:TF 3 "mult_operator" "")
15131 (const_string "fmul")
15132 (match_operand:TF 3 "div_operator" "")
15133 (const_string "fdiv")
15135 (const_string "fop")))
15136 (set_attr "mode" "SF")])
15138 (define_insn "*fop_xf_6"
15139 [(set (match_operand:XF 0 "register_operand" "=f,f")
15140 (match_operator:XF 3 "binary_fp_operator"
15142 (match_operand 1 "register_operand" "0,f"))
15144 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
15145 "!TARGET_64BIT && TARGET_80387"
15146 "* return output_387_binary_op (insn, operands);"
15147 [(set (attr "type")
15148 (cond [(match_operand:XF 3 "mult_operator" "")
15149 (const_string "fmul")
15150 (match_operand:XF 3 "div_operator" "")
15151 (const_string "fdiv")
15153 (const_string "fop")))
15154 (set_attr "mode" "SF")])
15156 (define_insn "*fop_tf_6"
15157 [(set (match_operand:TF 0 "register_operand" "=f,f")
15158 (match_operator:TF 3 "binary_fp_operator"
15160 (match_operand 1 "register_operand" "0,f"))
15162 (match_operand 2 "nonimmediate_operand" "fm,0"))]))]
15164 "* return output_387_binary_op (insn, operands);"
15165 [(set (attr "type")
15166 (cond [(match_operand:TF 3 "mult_operator" "")
15167 (const_string "fmul")
15168 (match_operand:TF 3 "div_operator" "")
15169 (const_string "fdiv")
15171 (const_string "fop")))
15172 (set_attr "mode" "SF")])
15175 [(set (match_operand 0 "register_operand" "")
15176 (match_operator 3 "binary_fp_operator"
15177 [(float (match_operand:SI 1 "register_operand" ""))
15178 (match_operand 2 "register_operand" "")]))]
15179 "TARGET_80387 && reload_completed
15180 && FLOAT_MODE_P (GET_MODE (operands[0]))"
15183 operands[4] = ix86_force_to_memory (GET_MODE (operands[1]), operands[1]);
15184 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
15185 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
15186 gen_rtx_fmt_ee (GET_CODE (operands[3]),
15187 GET_MODE (operands[3]),
15190 ix86_free_from_memory (GET_MODE (operands[1]));
15195 [(set (match_operand 0 "register_operand" "")
15196 (match_operator 3 "binary_fp_operator"
15197 [(match_operand 1 "register_operand" "")
15198 (float (match_operand:SI 2 "register_operand" ""))]))]
15199 "TARGET_80387 && reload_completed
15200 && FLOAT_MODE_P (GET_MODE (operands[0]))"
15203 operands[4] = ix86_force_to_memory (GET_MODE (operands[2]), operands[2]);
15204 operands[4] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[4]);
15205 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
15206 gen_rtx_fmt_ee (GET_CODE (operands[3]),
15207 GET_MODE (operands[3]),
15210 ix86_free_from_memory (GET_MODE (operands[2]));
15214 ;; FPU special functions.
15216 (define_expand "sqrtsf2"
15217 [(set (match_operand:SF 0 "register_operand" "")
15218 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "")))]
15219 "(! TARGET_NO_FANCY_MATH_387 && TARGET_80387) || TARGET_SSE_MATH"
15221 if (!TARGET_SSE_MATH)
15222 operands[1] = force_reg (SFmode, operands[1]);
15225 (define_insn "sqrtsf2_1"
15226 [(set (match_operand:SF 0 "register_operand" "=f#x,x#f")
15227 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "0#x,xm#f")))]
15228 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15229 && (TARGET_SSE_MATH && TARGET_MIX_SSE_I387)"
15232 sqrtss\t{%1, %0|%0, %1}"
15233 [(set_attr "type" "fpspc,sse")
15234 (set_attr "mode" "SF,SF")
15235 (set_attr "athlon_decode" "direct,*")])
15237 (define_insn "sqrtsf2_1_sse_only"
15238 [(set (match_operand:SF 0 "register_operand" "=x")
15239 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "xm")))]
15240 "TARGET_SSE_MATH && (!TARGET_80387 || !TARGET_MIX_SSE_I387)"
15241 "sqrtss\t{%1, %0|%0, %1}"
15242 [(set_attr "type" "sse")
15243 (set_attr "mode" "SF")
15244 (set_attr "athlon_decode" "*")])
15246 (define_insn "sqrtsf2_i387"
15247 [(set (match_operand:SF 0 "register_operand" "=f")
15248 (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
15249 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15250 && !TARGET_SSE_MATH"
15252 [(set_attr "type" "fpspc")
15253 (set_attr "mode" "SF")
15254 (set_attr "athlon_decode" "direct")])
15256 (define_expand "sqrtdf2"
15257 [(set (match_operand:DF 0 "register_operand" "")
15258 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "")))]
15259 "(! TARGET_NO_FANCY_MATH_387 && TARGET_80387)
15260 || (TARGET_SSE2 && TARGET_SSE_MATH)"
15262 if (!TARGET_SSE2 || !TARGET_SSE_MATH)
15263 operands[1] = force_reg (DFmode, operands[1]);
15266 (define_insn "sqrtdf2_1"
15267 [(set (match_operand:DF 0 "register_operand" "=f#Y,Y#f")
15268 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "0#Y,Ym#f")))]
15269 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15270 && (TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387)"
15273 sqrtsd\t{%1, %0|%0, %1}"
15274 [(set_attr "type" "fpspc,sse")
15275 (set_attr "mode" "DF,DF")
15276 (set_attr "athlon_decode" "direct,*")])
15278 (define_insn "sqrtdf2_1_sse_only"
15279 [(set (match_operand:DF 0 "register_operand" "=Y")
15280 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
15281 "TARGET_SSE2 && TARGET_SSE_MATH && (!TARGET_80387 || !TARGET_MIX_SSE_I387)"
15282 "sqrtsd\t{%1, %0|%0, %1}"
15283 [(set_attr "type" "sse")
15284 (set_attr "mode" "DF")
15285 (set_attr "athlon_decode" "*")])
15287 (define_insn "sqrtdf2_i387"
15288 [(set (match_operand:DF 0 "register_operand" "=f")
15289 (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
15290 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15291 && (!TARGET_SSE2 || !TARGET_SSE_MATH)"
15293 [(set_attr "type" "fpspc")
15294 (set_attr "mode" "DF")
15295 (set_attr "athlon_decode" "direct")])
15297 (define_insn "*sqrtextendsfdf2"
15298 [(set (match_operand:DF 0 "register_operand" "=f")
15299 (sqrt:DF (float_extend:DF
15300 (match_operand:SF 1 "register_operand" "0"))))]
15301 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15302 && !(TARGET_SSE2 && TARGET_SSE_MATH)"
15304 [(set_attr "type" "fpspc")
15305 (set_attr "mode" "DF")
15306 (set_attr "athlon_decode" "direct")])
15308 (define_insn "sqrtxf2"
15309 [(set (match_operand:XF 0 "register_operand" "=f")
15310 (sqrt:XF (match_operand:XF 1 "register_operand" "0")))]
15311 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387
15312 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
15314 [(set_attr "type" "fpspc")
15315 (set_attr "mode" "XF")
15316 (set_attr "athlon_decode" "direct")])
15318 (define_insn "sqrttf2"
15319 [(set (match_operand:TF 0 "register_operand" "=f")
15320 (sqrt:TF (match_operand:TF 1 "register_operand" "0")))]
15321 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15322 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
15324 [(set_attr "type" "fpspc")
15325 (set_attr "mode" "XF")
15326 (set_attr "athlon_decode" "direct")])
15328 (define_insn "*sqrtextenddfxf2"
15329 [(set (match_operand:XF 0 "register_operand" "=f")
15330 (sqrt:XF (float_extend:XF
15331 (match_operand:DF 1 "register_operand" "0"))))]
15332 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387"
15334 [(set_attr "type" "fpspc")
15335 (set_attr "mode" "XF")
15336 (set_attr "athlon_decode" "direct")])
15338 (define_insn "*sqrtextenddftf2"
15339 [(set (match_operand:TF 0 "register_operand" "=f")
15340 (sqrt:TF (float_extend:TF
15341 (match_operand:DF 1 "register_operand" "0"))))]
15342 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
15344 [(set_attr "type" "fpspc")
15345 (set_attr "mode" "XF")
15346 (set_attr "athlon_decode" "direct")])
15348 (define_insn "*sqrtextendsfxf2"
15349 [(set (match_operand:XF 0 "register_operand" "=f")
15350 (sqrt:XF (float_extend:XF
15351 (match_operand:SF 1 "register_operand" "0"))))]
15352 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387"
15354 [(set_attr "type" "fpspc")
15355 (set_attr "mode" "XF")
15356 (set_attr "athlon_decode" "direct")])
15358 (define_insn "*sqrtextendsftf2"
15359 [(set (match_operand:TF 0 "register_operand" "=f")
15360 (sqrt:TF (float_extend:TF
15361 (match_operand:SF 1 "register_operand" "0"))))]
15362 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
15364 [(set_attr "type" "fpspc")
15365 (set_attr "mode" "XF")
15366 (set_attr "athlon_decode" "direct")])
15368 (define_insn "sindf2"
15369 [(set (match_operand:DF 0 "register_operand" "=f")
15370 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_SIN))]
15371 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15372 && flag_unsafe_math_optimizations"
15374 [(set_attr "type" "fpspc")
15375 (set_attr "mode" "DF")])
15377 (define_insn "sinsf2"
15378 [(set (match_operand:SF 0 "register_operand" "=f")
15379 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_SIN))]
15380 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15381 && flag_unsafe_math_optimizations"
15383 [(set_attr "type" "fpspc")
15384 (set_attr "mode" "SF")])
15386 (define_insn "*sinextendsfdf2"
15387 [(set (match_operand:DF 0 "register_operand" "=f")
15388 (unspec:DF [(float_extend:DF
15389 (match_operand:SF 1 "register_operand" "0"))]
15391 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15392 && flag_unsafe_math_optimizations"
15394 [(set_attr "type" "fpspc")
15395 (set_attr "mode" "DF")])
15397 (define_insn "sinxf2"
15398 [(set (match_operand:XF 0 "register_operand" "=f")
15399 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_SIN))]
15400 "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387
15401 && flag_unsafe_math_optimizations"
15403 [(set_attr "type" "fpspc")
15404 (set_attr "mode" "XF")])
15406 (define_insn "sintf2"
15407 [(set (match_operand:TF 0 "register_operand" "=f")
15408 (unspec:TF [(match_operand:TF 1 "register_operand" "0")] UNSPEC_SIN))]
15409 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15410 && flag_unsafe_math_optimizations"
15412 [(set_attr "type" "fpspc")
15413 (set_attr "mode" "XF")])
15415 (define_insn "cosdf2"
15416 [(set (match_operand:DF 0 "register_operand" "=f")
15417 (unspec:DF [(match_operand:DF 1 "register_operand" "0")] UNSPEC_COS))]
15418 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15419 && flag_unsafe_math_optimizations"
15421 [(set_attr "type" "fpspc")
15422 (set_attr "mode" "DF")])
15424 (define_insn "cossf2"
15425 [(set (match_operand:SF 0 "register_operand" "=f")
15426 (unspec:SF [(match_operand:SF 1 "register_operand" "0")] UNSPEC_COS))]
15427 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15428 && flag_unsafe_math_optimizations"
15430 [(set_attr "type" "fpspc")
15431 (set_attr "mode" "SF")])
15433 (define_insn "*cosextendsfdf2"
15434 [(set (match_operand:DF 0 "register_operand" "=f")
15435 (unspec:DF [(float_extend:DF
15436 (match_operand:SF 1 "register_operand" "0"))]
15438 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15439 && flag_unsafe_math_optimizations"
15441 [(set_attr "type" "fpspc")
15442 (set_attr "mode" "DF")])
15444 (define_insn "cosxf2"
15445 [(set (match_operand:XF 0 "register_operand" "=f")
15446 (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_COS))]
15447 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15448 && flag_unsafe_math_optimizations"
15450 [(set_attr "type" "fpspc")
15451 (set_attr "mode" "XF")])
15453 (define_insn "costf2"
15454 [(set (match_operand:TF 0 "register_operand" "=f")
15455 (unspec:TF [(match_operand:TF 1 "register_operand" "0")] UNSPEC_COS))]
15456 "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
15457 && flag_unsafe_math_optimizations"
15459 [(set_attr "type" "fpspc")
15460 (set_attr "mode" "XF")])
15462 ;; Block operation instructions
15465 [(set (reg:SI 19) (const_int 0))]
15468 [(set_attr "type" "cld")])
15470 (define_expand "movstrsi"
15471 [(use (match_operand:BLK 0 "memory_operand" ""))
15472 (use (match_operand:BLK 1 "memory_operand" ""))
15473 (use (match_operand:SI 2 "nonmemory_operand" ""))
15474 (use (match_operand:SI 3 "const_int_operand" ""))]
15477 if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3]))
15483 (define_expand "movstrdi"
15484 [(use (match_operand:BLK 0 "memory_operand" ""))
15485 (use (match_operand:BLK 1 "memory_operand" ""))
15486 (use (match_operand:DI 2 "nonmemory_operand" ""))
15487 (use (match_operand:DI 3 "const_int_operand" ""))]
15490 if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3]))
15496 ;; Most CPUs don't like single string operations
15497 ;; Handle this case here to simplify previous expander.
15499 (define_expand "strmovdi_rex64"
15500 [(set (match_dup 2)
15501 (mem:DI (match_operand:DI 1 "register_operand" "")))
15502 (set (mem:DI (match_operand:DI 0 "register_operand" ""))
15504 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 8)))
15505 (clobber (reg:CC 17))])
15506 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 8)))
15507 (clobber (reg:CC 17))])]
15510 if (TARGET_SINGLE_STRINGOP || optimize_size)
15512 emit_insn (gen_strmovdi_rex_1 (operands[0], operands[1], operands[0],
15517 operands[2] = gen_reg_rtx (DImode);
15521 (define_expand "strmovsi"
15522 [(set (match_dup 2)
15523 (mem:SI (match_operand:SI 1 "register_operand" "")))
15524 (set (mem:SI (match_operand:SI 0 "register_operand" ""))
15526 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 4)))
15527 (clobber (reg:CC 17))])
15528 (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 4)))
15529 (clobber (reg:CC 17))])]
15534 emit_insn (gen_strmovsi_rex64 (operands[0], operands[1]));
15537 if (TARGET_SINGLE_STRINGOP || optimize_size)
15539 emit_insn (gen_strmovsi_1 (operands[0], operands[1], operands[0],
15544 operands[2] = gen_reg_rtx (SImode);
15547 (define_expand "strmovsi_rex64"
15548 [(set (match_dup 2)
15549 (mem:SI (match_operand:DI 1 "register_operand" "")))
15550 (set (mem:SI (match_operand:DI 0 "register_operand" ""))
15552 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 4)))
15553 (clobber (reg:CC 17))])
15554 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 4)))
15555 (clobber (reg:CC 17))])]
15558 if (TARGET_SINGLE_STRINGOP || optimize_size)
15560 emit_insn (gen_strmovsi_rex_1 (operands[0], operands[1], operands[0],
15565 operands[2] = gen_reg_rtx (SImode);
15568 (define_expand "strmovhi"
15569 [(set (match_dup 2)
15570 (mem:HI (match_operand:SI 1 "register_operand" "")))
15571 (set (mem:HI (match_operand:SI 0 "register_operand" ""))
15573 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 2)))
15574 (clobber (reg:CC 17))])
15575 (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 2)))
15576 (clobber (reg:CC 17))])]
15581 emit_insn (gen_strmovhi_rex64 (operands[0], operands[1]));
15584 if (TARGET_SINGLE_STRINGOP || optimize_size)
15586 emit_insn (gen_strmovhi_1 (operands[0], operands[1], operands[0],
15591 operands[2] = gen_reg_rtx (HImode);
15594 (define_expand "strmovhi_rex64"
15595 [(set (match_dup 2)
15596 (mem:HI (match_operand:DI 1 "register_operand" "")))
15597 (set (mem:HI (match_operand:DI 0 "register_operand" ""))
15599 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 2)))
15600 (clobber (reg:CC 17))])
15601 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 2)))
15602 (clobber (reg:CC 17))])]
15605 if (TARGET_SINGLE_STRINGOP || optimize_size)
15607 emit_insn (gen_strmovhi_rex_1 (operands[0], operands[1], operands[0],
15612 operands[2] = gen_reg_rtx (HImode);
15615 (define_expand "strmovqi"
15616 [(set (match_dup 2)
15617 (mem:QI (match_operand:SI 1 "register_operand" "")))
15618 (set (mem:QI (match_operand:SI 0 "register_operand" ""))
15620 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
15621 (clobber (reg:CC 17))])
15622 (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 1)))
15623 (clobber (reg:CC 17))])]
15628 emit_insn (gen_strmovqi_rex64 (operands[0], operands[1]));
15631 if (TARGET_SINGLE_STRINGOP || optimize_size)
15633 emit_insn (gen_strmovqi_1 (operands[0], operands[1], operands[0],
15638 operands[2] = gen_reg_rtx (QImode);
15641 (define_expand "strmovqi_rex64"
15642 [(set (match_dup 2)
15643 (mem:QI (match_operand:DI 1 "register_operand" "")))
15644 (set (mem:QI (match_operand:DI 0 "register_operand" ""))
15646 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
15647 (clobber (reg:CC 17))])
15648 (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 1)))
15649 (clobber (reg:CC 17))])]
15652 if (TARGET_SINGLE_STRINGOP || optimize_size)
15654 emit_insn (gen_strmovqi_rex_1 (operands[0], operands[1], operands[0],
15659 operands[2] = gen_reg_rtx (QImode);
15662 (define_insn "strmovdi_rex_1"
15663 [(set (mem:DI (match_operand:DI 2 "register_operand" "0"))
15664 (mem:DI (match_operand:DI 3 "register_operand" "1")))
15665 (set (match_operand:DI 0 "register_operand" "=D")
15666 (plus:DI (match_dup 2)
15668 (set (match_operand:DI 1 "register_operand" "=S")
15669 (plus:DI (match_dup 3)
15672 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15674 [(set_attr "type" "str")
15675 (set_attr "mode" "DI")
15676 (set_attr "memory" "both")])
15678 (define_insn "strmovsi_1"
15679 [(set (mem:SI (match_operand:SI 2 "register_operand" "0"))
15680 (mem:SI (match_operand:SI 3 "register_operand" "1")))
15681 (set (match_operand:SI 0 "register_operand" "=D")
15682 (plus:SI (match_dup 2)
15684 (set (match_operand:SI 1 "register_operand" "=S")
15685 (plus:SI (match_dup 3)
15688 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15690 [(set_attr "type" "str")
15691 (set_attr "mode" "SI")
15692 (set_attr "memory" "both")])
15694 (define_insn "strmovsi_rex_1"
15695 [(set (mem:SI (match_operand:DI 2 "register_operand" "0"))
15696 (mem:SI (match_operand:DI 3 "register_operand" "1")))
15697 (set (match_operand:DI 0 "register_operand" "=D")
15698 (plus:DI (match_dup 2)
15700 (set (match_operand:DI 1 "register_operand" "=S")
15701 (plus:DI (match_dup 3)
15704 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15706 [(set_attr "type" "str")
15707 (set_attr "mode" "SI")
15708 (set_attr "memory" "both")])
15710 (define_insn "strmovhi_1"
15711 [(set (mem:HI (match_operand:SI 2 "register_operand" "0"))
15712 (mem:HI (match_operand:SI 3 "register_operand" "1")))
15713 (set (match_operand:SI 0 "register_operand" "=D")
15714 (plus:SI (match_dup 2)
15716 (set (match_operand:SI 1 "register_operand" "=S")
15717 (plus:SI (match_dup 3)
15720 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15722 [(set_attr "type" "str")
15723 (set_attr "memory" "both")
15724 (set_attr "mode" "HI")])
15726 (define_insn "strmovhi_rex_1"
15727 [(set (mem:HI (match_operand:DI 2 "register_operand" "0"))
15728 (mem:HI (match_operand:DI 3 "register_operand" "1")))
15729 (set (match_operand:DI 0 "register_operand" "=D")
15730 (plus:DI (match_dup 2)
15732 (set (match_operand:DI 1 "register_operand" "=S")
15733 (plus:DI (match_dup 3)
15736 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15738 [(set_attr "type" "str")
15739 (set_attr "memory" "both")
15740 (set_attr "mode" "HI")])
15742 (define_insn "strmovqi_1"
15743 [(set (mem:QI (match_operand:SI 2 "register_operand" "0"))
15744 (mem:QI (match_operand:SI 3 "register_operand" "1")))
15745 (set (match_operand:SI 0 "register_operand" "=D")
15746 (plus:SI (match_dup 2)
15748 (set (match_operand:SI 1 "register_operand" "=S")
15749 (plus:SI (match_dup 3)
15752 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15754 [(set_attr "type" "str")
15755 (set_attr "memory" "both")
15756 (set_attr "mode" "QI")])
15758 (define_insn "strmovqi_rex_1"
15759 [(set (mem:QI (match_operand:DI 2 "register_operand" "0"))
15760 (mem:QI (match_operand:DI 3 "register_operand" "1")))
15761 (set (match_operand:DI 0 "register_operand" "=D")
15762 (plus:DI (match_dup 2)
15764 (set (match_operand:DI 1 "register_operand" "=S")
15765 (plus:DI (match_dup 3)
15768 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
15770 [(set_attr "type" "str")
15771 (set_attr "memory" "both")
15772 (set_attr "mode" "QI")])
15774 (define_insn "rep_movdi_rex64"
15775 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
15776 (set (match_operand:DI 0 "register_operand" "=D")
15777 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
15779 (match_operand:DI 3 "register_operand" "0")))
15780 (set (match_operand:DI 1 "register_operand" "=S")
15781 (plus:DI (ashift:DI (match_dup 5) (const_int 3))
15782 (match_operand:DI 4 "register_operand" "1")))
15783 (set (mem:BLK (match_dup 3))
15784 (mem:BLK (match_dup 4)))
15785 (use (match_dup 5))
15788 "{rep\;movsq|rep movsq}"
15789 [(set_attr "type" "str")
15790 (set_attr "prefix_rep" "1")
15791 (set_attr "memory" "both")
15792 (set_attr "mode" "DI")])
15794 (define_insn "rep_movsi"
15795 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
15796 (set (match_operand:SI 0 "register_operand" "=D")
15797 (plus:SI (ashift:SI (match_operand:SI 5 "register_operand" "2")
15799 (match_operand:SI 3 "register_operand" "0")))
15800 (set (match_operand:SI 1 "register_operand" "=S")
15801 (plus:SI (ashift:SI (match_dup 5) (const_int 2))
15802 (match_operand:SI 4 "register_operand" "1")))
15803 (set (mem:BLK (match_dup 3))
15804 (mem:BLK (match_dup 4)))
15805 (use (match_dup 5))
15808 "{rep\;movsl|rep movsd}"
15809 [(set_attr "type" "str")
15810 (set_attr "prefix_rep" "1")
15811 (set_attr "memory" "both")
15812 (set_attr "mode" "SI")])
15814 (define_insn "rep_movsi_rex64"
15815 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
15816 (set (match_operand:DI 0 "register_operand" "=D")
15817 (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2")
15819 (match_operand:DI 3 "register_operand" "0")))
15820 (set (match_operand:DI 1 "register_operand" "=S")
15821 (plus:DI (ashift:DI (match_dup 5) (const_int 2))
15822 (match_operand:DI 4 "register_operand" "1")))
15823 (set (mem:BLK (match_dup 3))
15824 (mem:BLK (match_dup 4)))
15825 (use (match_dup 5))
15828 "{rep\;movsl|rep movsd}"
15829 [(set_attr "type" "str")
15830 (set_attr "prefix_rep" "1")
15831 (set_attr "memory" "both")
15832 (set_attr "mode" "SI")])
15834 (define_insn "rep_movqi"
15835 [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
15836 (set (match_operand:SI 0 "register_operand" "=D")
15837 (plus:SI (match_operand:SI 3 "register_operand" "0")
15838 (match_operand:SI 5 "register_operand" "2")))
15839 (set (match_operand:SI 1 "register_operand" "=S")
15840 (plus:SI (match_operand:SI 4 "register_operand" "1") (match_dup 5)))
15841 (set (mem:BLK (match_dup 3))
15842 (mem:BLK (match_dup 4)))
15843 (use (match_dup 5))
15846 "{rep\;movsb|rep movsb}"
15847 [(set_attr "type" "str")
15848 (set_attr "prefix_rep" "1")
15849 (set_attr "memory" "both")
15850 (set_attr "mode" "SI")])
15852 (define_insn "rep_movqi_rex64"
15853 [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0))
15854 (set (match_operand:DI 0 "register_operand" "=D")
15855 (plus:DI (match_operand:DI 3 "register_operand" "0")
15856 (match_operand:DI 5 "register_operand" "2")))
15857 (set (match_operand:DI 1 "register_operand" "=S")
15858 (plus:DI (match_operand:DI 4 "register_operand" "1") (match_dup 5)))
15859 (set (mem:BLK (match_dup 3))
15860 (mem:BLK (match_dup 4)))
15861 (use (match_dup 5))
15864 "{rep\;movsb|rep movsb}"
15865 [(set_attr "type" "str")
15866 (set_attr "prefix_rep" "1")
15867 (set_attr "memory" "both")
15868 (set_attr "mode" "SI")])
15870 (define_expand "clrstrsi"
15871 [(use (match_operand:BLK 0 "memory_operand" ""))
15872 (use (match_operand:SI 1 "nonmemory_operand" ""))
15873 (use (match_operand 2 "const_int_operand" ""))]
15876 if (ix86_expand_clrstr (operands[0], operands[1], operands[2]))
15882 (define_expand "clrstrdi"
15883 [(use (match_operand:BLK 0 "memory_operand" ""))
15884 (use (match_operand:DI 1 "nonmemory_operand" ""))
15885 (use (match_operand 2 "const_int_operand" ""))]
15888 if (ix86_expand_clrstr (operands[0], operands[1], operands[2]))
15894 ;; Most CPUs don't like single string operations
15895 ;; Handle this case here to simplify previous expander.
15897 (define_expand "strsetdi_rex64"
15898 [(set (mem:DI (match_operand:DI 0 "register_operand" ""))
15899 (match_operand:DI 1 "register_operand" ""))
15900 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 8)))
15901 (clobber (reg:CC 17))])]
15904 if (TARGET_SINGLE_STRINGOP || optimize_size)
15906 emit_insn (gen_strsetdi_rex_1 (operands[0], operands[0], operands[1]));
15911 (define_expand "strsetsi"
15912 [(set (mem:SI (match_operand:SI 0 "register_operand" ""))
15913 (match_operand:SI 1 "register_operand" ""))
15914 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 4)))
15915 (clobber (reg:CC 17))])]
15920 emit_insn (gen_strsetsi_rex64 (operands[0], operands[1]));
15923 else if (TARGET_SINGLE_STRINGOP || optimize_size)
15925 emit_insn (gen_strsetsi_1 (operands[0], operands[0], operands[1]));
15930 (define_expand "strsetsi_rex64"
15931 [(set (mem:SI (match_operand:DI 0 "register_operand" ""))
15932 (match_operand:SI 1 "register_operand" ""))
15933 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 4)))
15934 (clobber (reg:CC 17))])]
15937 if (TARGET_SINGLE_STRINGOP || optimize_size)
15939 emit_insn (gen_strsetsi_rex_1 (operands[0], operands[0], operands[1]));
15944 (define_expand "strsethi"
15945 [(set (mem:HI (match_operand:SI 0 "register_operand" ""))
15946 (match_operand:HI 1 "register_operand" ""))
15947 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 2)))
15948 (clobber (reg:CC 17))])]
15953 emit_insn (gen_strsethi_rex64 (operands[0], operands[1]));
15956 else if (TARGET_SINGLE_STRINGOP || optimize_size)
15958 emit_insn (gen_strsethi_1 (operands[0], operands[0], operands[1]));
15963 (define_expand "strsethi_rex64"
15964 [(set (mem:HI (match_operand:DI 0 "register_operand" ""))
15965 (match_operand:HI 1 "register_operand" ""))
15966 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 2)))
15967 (clobber (reg:CC 17))])]
15970 if (TARGET_SINGLE_STRINGOP || optimize_size)
15972 emit_insn (gen_strsethi_rex_1 (operands[0], operands[0], operands[1]));
15977 (define_expand "strsetqi"
15978 [(set (mem:QI (match_operand:SI 0 "register_operand" ""))
15979 (match_operand:QI 1 "register_operand" ""))
15980 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))
15981 (clobber (reg:CC 17))])]
15986 emit_insn (gen_strsetqi_rex64 (operands[0], operands[1]));
15989 else if (TARGET_SINGLE_STRINGOP || optimize_size)
15991 emit_insn (gen_strsetqi_1 (operands[0], operands[0], operands[1]));
15996 (define_expand "strsetqi_rex64"
15997 [(set (mem:QI (match_operand:DI 0 "register_operand" ""))
15998 (match_operand:QI 1 "register_operand" ""))
15999 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
16000 (clobber (reg:CC 17))])]
16003 if (TARGET_SINGLE_STRINGOP || optimize_size)
16005 emit_insn (gen_strsetqi_rex_1 (operands[0], operands[0], operands[1]));
16010 (define_insn "strsetdi_rex_1"
16011 [(set (mem:SI (match_operand:DI 1 "register_operand" "0"))
16012 (match_operand:SI 2 "register_operand" "a"))
16013 (set (match_operand:DI 0 "register_operand" "=D")
16014 (plus:DI (match_dup 1)
16017 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16019 [(set_attr "type" "str")
16020 (set_attr "memory" "store")
16021 (set_attr "mode" "DI")])
16023 (define_insn "strsetsi_1"
16024 [(set (mem:SI (match_operand:SI 1 "register_operand" "0"))
16025 (match_operand:SI 2 "register_operand" "a"))
16026 (set (match_operand:SI 0 "register_operand" "=D")
16027 (plus:SI (match_dup 1)
16030 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16032 [(set_attr "type" "str")
16033 (set_attr "memory" "store")
16034 (set_attr "mode" "SI")])
16036 (define_insn "strsetsi_rex_1"
16037 [(set (mem:SI (match_operand:DI 1 "register_operand" "0"))
16038 (match_operand:SI 2 "register_operand" "a"))
16039 (set (match_operand:DI 0 "register_operand" "=D")
16040 (plus:DI (match_dup 1)
16043 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16045 [(set_attr "type" "str")
16046 (set_attr "memory" "store")
16047 (set_attr "mode" "SI")])
16049 (define_insn "strsethi_1"
16050 [(set (mem:HI (match_operand:SI 1 "register_operand" "0"))
16051 (match_operand:HI 2 "register_operand" "a"))
16052 (set (match_operand:SI 0 "register_operand" "=D")
16053 (plus:SI (match_dup 1)
16056 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16058 [(set_attr "type" "str")
16059 (set_attr "memory" "store")
16060 (set_attr "mode" "HI")])
16062 (define_insn "strsethi_rex_1"
16063 [(set (mem:HI (match_operand:DI 1 "register_operand" "0"))
16064 (match_operand:HI 2 "register_operand" "a"))
16065 (set (match_operand:DI 0 "register_operand" "=D")
16066 (plus:DI (match_dup 1)
16069 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16071 [(set_attr "type" "str")
16072 (set_attr "memory" "store")
16073 (set_attr "mode" "HI")])
16075 (define_insn "strsetqi_1"
16076 [(set (mem:QI (match_operand:SI 1 "register_operand" "0"))
16077 (match_operand:QI 2 "register_operand" "a"))
16078 (set (match_operand:SI 0 "register_operand" "=D")
16079 (plus:SI (match_dup 1)
16082 "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16084 [(set_attr "type" "str")
16085 (set_attr "memory" "store")
16086 (set_attr "mode" "QI")])
16088 (define_insn "strsetqi_rex_1"
16089 [(set (mem:QI (match_operand:DI 1 "register_operand" "0"))
16090 (match_operand:QI 2 "register_operand" "a"))
16091 (set (match_operand:DI 0 "register_operand" "=D")
16092 (plus:DI (match_dup 1)
16095 "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
16097 [(set_attr "type" "str")
16098 (set_attr "memory" "store")
16099 (set_attr "mode" "QI")])
16101 (define_insn "rep_stosdi_rex64"
16102 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
16103 (set (match_operand:DI 0 "register_operand" "=D")
16104 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
16106 (match_operand:DI 3 "register_operand" "0")))
16107 (set (mem:BLK (match_dup 3))
16109 (use (match_operand:DI 2 "register_operand" "a"))
16110 (use (match_dup 4))
16113 "{rep\;stosq|rep stosq}"
16114 [(set_attr "type" "str")
16115 (set_attr "prefix_rep" "1")
16116 (set_attr "memory" "store")
16117 (set_attr "mode" "DI")])
16119 (define_insn "rep_stossi"
16120 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
16121 (set (match_operand:SI 0 "register_operand" "=D")
16122 (plus:SI (ashift:SI (match_operand:SI 4 "register_operand" "1")
16124 (match_operand:SI 3 "register_operand" "0")))
16125 (set (mem:BLK (match_dup 3))
16127 (use (match_operand:SI 2 "register_operand" "a"))
16128 (use (match_dup 4))
16131 "{rep\;stosl|rep stosd}"
16132 [(set_attr "type" "str")
16133 (set_attr "prefix_rep" "1")
16134 (set_attr "memory" "store")
16135 (set_attr "mode" "SI")])
16137 (define_insn "rep_stossi_rex64"
16138 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
16139 (set (match_operand:DI 0 "register_operand" "=D")
16140 (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1")
16142 (match_operand:DI 3 "register_operand" "0")))
16143 (set (mem:BLK (match_dup 3))
16145 (use (match_operand:SI 2 "register_operand" "a"))
16146 (use (match_dup 4))
16149 "{rep\;stosl|rep stosd}"
16150 [(set_attr "type" "str")
16151 (set_attr "prefix_rep" "1")
16152 (set_attr "memory" "store")
16153 (set_attr "mode" "SI")])
16155 (define_insn "rep_stosqi"
16156 [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0))
16157 (set (match_operand:SI 0 "register_operand" "=D")
16158 (plus:SI (match_operand:SI 3 "register_operand" "0")
16159 (match_operand:SI 4 "register_operand" "1")))
16160 (set (mem:BLK (match_dup 3))
16162 (use (match_operand:QI 2 "register_operand" "a"))
16163 (use (match_dup 4))
16166 "{rep\;stosb|rep stosb}"
16167 [(set_attr "type" "str")
16168 (set_attr "prefix_rep" "1")
16169 (set_attr "memory" "store")
16170 (set_attr "mode" "QI")])
16172 (define_insn "rep_stosqi_rex64"
16173 [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0))
16174 (set (match_operand:DI 0 "register_operand" "=D")
16175 (plus:DI (match_operand:DI 3 "register_operand" "0")
16176 (match_operand:DI 4 "register_operand" "1")))
16177 (set (mem:BLK (match_dup 3))
16179 (use (match_operand:QI 2 "register_operand" "a"))
16180 (use (match_dup 4))
16183 "{rep\;stosb|rep stosb}"
16184 [(set_attr "type" "str")
16185 (set_attr "prefix_rep" "1")
16186 (set_attr "memory" "store")
16187 (set_attr "mode" "QI")])
16189 (define_expand "cmpstrsi"
16190 [(set (match_operand:SI 0 "register_operand" "")
16191 (compare:SI (match_operand:BLK 1 "general_operand" "")
16192 (match_operand:BLK 2 "general_operand" "")))
16193 (use (match_operand 3 "general_operand" ""))
16194 (use (match_operand 4 "immediate_operand" ""))]
16197 rtx addr1, addr2, out, outlow, count, countreg, align;
16200 if (GET_CODE (out) != REG)
16201 out = gen_reg_rtx (SImode);
16203 addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
16204 addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0));
16206 count = operands[3];
16207 countreg = ix86_zero_extend_to_Pmode (count);
16209 /* %%% Iff we are testing strict equality, we can use known alignment
16210 to good advantage. This may be possible with combine, particularly
16211 once cc0 is dead. */
16212 align = operands[4];
16214 emit_insn (gen_cld ());
16215 if (GET_CODE (count) == CONST_INT)
16217 if (INTVAL (count) == 0)
16219 emit_move_insn (operands[0], const0_rtx);
16223 emit_insn (gen_cmpstrqi_nz_rex_1 (addr1, addr2, countreg, align,
16224 addr1, addr2, countreg));
16226 emit_insn (gen_cmpstrqi_nz_1 (addr1, addr2, countreg, align,
16227 addr1, addr2, countreg));
16233 emit_insn (gen_cmpdi_1_rex64 (countreg, countreg));
16234 emit_insn (gen_cmpstrqi_rex_1 (addr1, addr2, countreg, align,
16235 addr1, addr2, countreg));
16239 emit_insn (gen_cmpsi_1 (countreg, countreg));
16240 emit_insn (gen_cmpstrqi_1 (addr1, addr2, countreg, align,
16241 addr1, addr2, countreg));
16245 outlow = gen_lowpart (QImode, out);
16246 emit_insn (gen_cmpintqi (outlow));
16247 emit_move_insn (out, gen_rtx_SIGN_EXTEND (SImode, outlow));
16249 if (operands[0] != out)
16250 emit_move_insn (operands[0], out);
16255 ;; Produce a tri-state integer (-1, 0, 1) from condition codes.
16257 (define_expand "cmpintqi"
16258 [(set (match_dup 1)
16259 (gtu:QI (reg:CC 17) (const_int 0)))
16261 (ltu:QI (reg:CC 17) (const_int 0)))
16262 (parallel [(set (match_operand:QI 0 "register_operand" "")
16263 (minus:QI (match_dup 1)
16265 (clobber (reg:CC 17))])]
16267 "operands[1] = gen_reg_rtx (QImode);
16268 operands[2] = gen_reg_rtx (QImode);")
16270 ;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is
16271 ;; zero. Emit extra code to make sure that a zero-length compare is EQ.
16273 (define_insn "cmpstrqi_nz_1"
16275 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
16276 (mem:BLK (match_operand:SI 5 "register_operand" "1"))))
16277 (use (match_operand:SI 6 "register_operand" "2"))
16278 (use (match_operand:SI 3 "immediate_operand" "i"))
16280 (clobber (match_operand:SI 0 "register_operand" "=S"))
16281 (clobber (match_operand:SI 1 "register_operand" "=D"))
16282 (clobber (match_operand:SI 2 "register_operand" "=c"))]
16285 [(set_attr "type" "str")
16286 (set_attr "mode" "QI")
16287 (set_attr "prefix_rep" "1")])
16289 (define_insn "cmpstrqi_nz_rex_1"
16291 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
16292 (mem:BLK (match_operand:DI 5 "register_operand" "1"))))
16293 (use (match_operand:DI 6 "register_operand" "2"))
16294 (use (match_operand:SI 3 "immediate_operand" "i"))
16296 (clobber (match_operand:DI 0 "register_operand" "=S"))
16297 (clobber (match_operand:DI 1 "register_operand" "=D"))
16298 (clobber (match_operand:DI 2 "register_operand" "=c"))]
16301 [(set_attr "type" "str")
16302 (set_attr "mode" "QI")
16303 (set_attr "prefix_rep" "1")])
16305 ;; The same, but the count is not known to not be zero.
16307 (define_insn "cmpstrqi_1"
16309 (if_then_else:CC (ne (match_operand:SI 6 "register_operand" "2")
16311 (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0"))
16312 (mem:BLK (match_operand:SI 5 "register_operand" "1")))
16314 (use (match_operand:SI 3 "immediate_operand" "i"))
16317 (clobber (match_operand:SI 0 "register_operand" "=S"))
16318 (clobber (match_operand:SI 1 "register_operand" "=D"))
16319 (clobber (match_operand:SI 2 "register_operand" "=c"))]
16322 [(set_attr "type" "str")
16323 (set_attr "mode" "QI")
16324 (set_attr "prefix_rep" "1")])
16326 (define_insn "cmpstrqi_rex_1"
16328 (if_then_else:CC (ne (match_operand:DI 6 "register_operand" "2")
16330 (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0"))
16331 (mem:BLK (match_operand:DI 5 "register_operand" "1")))
16333 (use (match_operand:SI 3 "immediate_operand" "i"))
16336 (clobber (match_operand:DI 0 "register_operand" "=S"))
16337 (clobber (match_operand:DI 1 "register_operand" "=D"))
16338 (clobber (match_operand:DI 2 "register_operand" "=c"))]
16341 [(set_attr "type" "str")
16342 (set_attr "mode" "QI")
16343 (set_attr "prefix_rep" "1")])
16345 (define_expand "strlensi"
16346 [(set (match_operand:SI 0 "register_operand" "")
16347 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
16348 (match_operand:QI 2 "immediate_operand" "")
16349 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
16352 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
16358 (define_expand "strlendi"
16359 [(set (match_operand:DI 0 "register_operand" "")
16360 (unspec:DI [(match_operand:BLK 1 "general_operand" "")
16361 (match_operand:QI 2 "immediate_operand" "")
16362 (match_operand 3 "immediate_operand" "")] UNSPEC_SCAS))]
16365 if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))
16371 (define_insn "strlenqi_1"
16372 [(set (match_operand:SI 0 "register_operand" "=&c")
16373 (unspec:SI [(mem:BLK (match_operand:SI 5 "register_operand" "1"))
16374 (match_operand:QI 2 "register_operand" "a")
16375 (match_operand:SI 3 "immediate_operand" "i")
16376 (match_operand:SI 4 "register_operand" "0")] UNSPEC_SCAS))
16378 (clobber (match_operand:SI 1 "register_operand" "=D"))
16379 (clobber (reg:CC 17))]
16382 [(set_attr "type" "str")
16383 (set_attr "mode" "QI")
16384 (set_attr "prefix_rep" "1")])
16386 (define_insn "strlenqi_rex_1"
16387 [(set (match_operand:DI 0 "register_operand" "=&c")
16388 (unspec:DI [(mem:BLK (match_operand:DI 5 "register_operand" "1"))
16389 (match_operand:QI 2 "register_operand" "a")
16390 (match_operand:DI 3 "immediate_operand" "i")
16391 (match_operand:DI 4 "register_operand" "0")] UNSPEC_SCAS))
16393 (clobber (match_operand:DI 1 "register_operand" "=D"))
16394 (clobber (reg:CC 17))]
16397 [(set_attr "type" "str")
16398 (set_attr "mode" "QI")
16399 (set_attr "prefix_rep" "1")])
16401 ;; Peephole optimizations to clean up after cmpstr*. This should be
16402 ;; handled in combine, but it is not currently up to the task.
16403 ;; When used for their truth value, the cmpstr* expanders generate
16412 ;; The intermediate three instructions are unnecessary.
16414 ;; This one handles cmpstr*_nz_1...
16418 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
16419 (mem:BLK (match_operand 5 "register_operand" ""))))
16420 (use (match_operand 6 "register_operand" ""))
16421 (use (match_operand:SI 3 "immediate_operand" ""))
16423 (clobber (match_operand 0 "register_operand" ""))
16424 (clobber (match_operand 1 "register_operand" ""))
16425 (clobber (match_operand 2 "register_operand" ""))])
16426 (set (match_operand:QI 7 "register_operand" "")
16427 (gtu:QI (reg:CC 17) (const_int 0)))
16428 (set (match_operand:QI 8 "register_operand" "")
16429 (ltu:QI (reg:CC 17) (const_int 0)))
16431 (compare (match_dup 7) (match_dup 8)))
16433 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
16436 (compare:CC (mem:BLK (match_dup 4))
16437 (mem:BLK (match_dup 5))))
16438 (use (match_dup 6))
16439 (use (match_dup 3))
16441 (clobber (match_dup 0))
16442 (clobber (match_dup 1))
16443 (clobber (match_dup 2))])]
16446 ;; ...and this one handles cmpstr*_1.
16450 (if_then_else:CC (ne (match_operand 6 "register_operand" "")
16452 (compare:CC (mem:BLK (match_operand 4 "register_operand" ""))
16453 (mem:BLK (match_operand 5 "register_operand" "")))
16455 (use (match_operand:SI 3 "immediate_operand" ""))
16458 (clobber (match_operand 0 "register_operand" ""))
16459 (clobber (match_operand 1 "register_operand" ""))
16460 (clobber (match_operand 2 "register_operand" ""))])
16461 (set (match_operand:QI 7 "register_operand" "")
16462 (gtu:QI (reg:CC 17) (const_int 0)))
16463 (set (match_operand:QI 8 "register_operand" "")
16464 (ltu:QI (reg:CC 17) (const_int 0)))
16466 (compare (match_dup 7) (match_dup 8)))
16468 "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
16471 (if_then_else:CC (ne (match_dup 6)
16473 (compare:CC (mem:BLK (match_dup 4))
16474 (mem:BLK (match_dup 5)))
16476 (use (match_dup 3))
16479 (clobber (match_dup 0))
16480 (clobber (match_dup 1))
16481 (clobber (match_dup 2))])]
16486 ;; Conditional move instructions.
16488 (define_expand "movdicc"
16489 [(set (match_operand:DI 0 "register_operand" "")
16490 (if_then_else:DI (match_operand 1 "comparison_operator" "")
16491 (match_operand:DI 2 "general_operand" "")
16492 (match_operand:DI 3 "general_operand" "")))]
16494 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
16496 (define_insn "x86_movdicc_0_m1_rex64"
16497 [(set (match_operand:DI 0 "register_operand" "=r")
16498 (if_then_else:DI (match_operand 1 "ix86_carry_flag_operator" "")
16501 (clobber (reg:CC 17))]
16504 ; Since we don't have the proper number of operands for an alu insn,
16505 ; fill in all the blanks.
16506 [(set_attr "type" "alu")
16507 (set_attr "pent_pair" "pu")
16508 (set_attr "memory" "none")
16509 (set_attr "imm_disp" "false")
16510 (set_attr "mode" "DI")
16511 (set_attr "length_immediate" "0")])
16513 (define_insn "movdicc_c_rex64"
16514 [(set (match_operand:DI 0 "register_operand" "=r,r")
16515 (if_then_else:DI (match_operator 1 "ix86_comparison_operator"
16516 [(reg 17) (const_int 0)])
16517 (match_operand:DI 2 "nonimmediate_operand" "rm,0")
16518 (match_operand:DI 3 "nonimmediate_operand" "0,rm")))]
16519 "TARGET_64BIT && TARGET_CMOVE
16520 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16522 cmov%O2%C1\t{%2, %0|%0, %2}
16523 cmov%O2%c1\t{%3, %0|%0, %3}"
16524 [(set_attr "type" "icmov")
16525 (set_attr "mode" "DI")])
16527 (define_expand "movsicc"
16528 [(set (match_operand:SI 0 "register_operand" "")
16529 (if_then_else:SI (match_operand 1 "comparison_operator" "")
16530 (match_operand:SI 2 "general_operand" "")
16531 (match_operand:SI 3 "general_operand" "")))]
16533 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
16535 ;; Data flow gets confused by our desire for `sbbl reg,reg', and clearing
16536 ;; the register first winds up with `sbbl $0,reg', which is also weird.
16537 ;; So just document what we're doing explicitly.
16539 (define_insn "x86_movsicc_0_m1"
16540 [(set (match_operand:SI 0 "register_operand" "=r")
16541 (if_then_else:SI (match_operand 1 "ix86_carry_flag_operator" "")
16544 (clobber (reg:CC 17))]
16547 ; Since we don't have the proper number of operands for an alu insn,
16548 ; fill in all the blanks.
16549 [(set_attr "type" "alu")
16550 (set_attr "pent_pair" "pu")
16551 (set_attr "memory" "none")
16552 (set_attr "imm_disp" "false")
16553 (set_attr "mode" "SI")
16554 (set_attr "length_immediate" "0")])
16556 (define_insn "*movsicc_noc"
16557 [(set (match_operand:SI 0 "register_operand" "=r,r")
16558 (if_then_else:SI (match_operator 1 "ix86_comparison_operator"
16559 [(reg 17) (const_int 0)])
16560 (match_operand:SI 2 "nonimmediate_operand" "rm,0")
16561 (match_operand:SI 3 "nonimmediate_operand" "0,rm")))]
16563 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16565 cmov%O2%C1\t{%2, %0|%0, %2}
16566 cmov%O2%c1\t{%3, %0|%0, %3}"
16567 [(set_attr "type" "icmov")
16568 (set_attr "mode" "SI")])
16570 (define_expand "movhicc"
16571 [(set (match_operand:HI 0 "register_operand" "")
16572 (if_then_else:HI (match_operand 1 "comparison_operator" "")
16573 (match_operand:HI 2 "general_operand" "")
16574 (match_operand:HI 3 "general_operand" "")))]
16575 "TARGET_HIMODE_MATH"
16576 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
16578 (define_insn "*movhicc_noc"
16579 [(set (match_operand:HI 0 "register_operand" "=r,r")
16580 (if_then_else:HI (match_operator 1 "ix86_comparison_operator"
16581 [(reg 17) (const_int 0)])
16582 (match_operand:HI 2 "nonimmediate_operand" "rm,0")
16583 (match_operand:HI 3 "nonimmediate_operand" "0,rm")))]
16585 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16587 cmov%O2%C1\t{%2, %0|%0, %2}
16588 cmov%O2%c1\t{%3, %0|%0, %3}"
16589 [(set_attr "type" "icmov")
16590 (set_attr "mode" "HI")])
16592 (define_expand "movqicc"
16593 [(set (match_operand:QI 0 "register_operand" "")
16594 (if_then_else:QI (match_operand 1 "comparison_operator" "")
16595 (match_operand:QI 2 "general_operand" "")
16596 (match_operand:QI 3 "general_operand" "")))]
16597 "TARGET_QIMODE_MATH"
16598 "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
16600 (define_insn_and_split "*movqicc_noc"
16601 [(set (match_operand:QI 0 "register_operand" "=r,r")
16602 (if_then_else:QI (match_operator 1 "ix86_comparison_operator"
16603 [(match_operand 4 "flags_reg_operand" "") (const_int 0)])
16604 (match_operand:QI 2 "register_operand" "r,0")
16605 (match_operand:QI 3 "register_operand" "0,r")))]
16606 "TARGET_CMOVE && !TARGET_PARTIAL_REG_STALL"
16608 "&& reload_completed"
16609 [(set (match_dup 0)
16610 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
16613 "operands[0] = gen_lowpart (SImode, operands[0]);
16614 operands[2] = gen_lowpart (SImode, operands[2]);
16615 operands[3] = gen_lowpart (SImode, operands[3]);"
16616 [(set_attr "type" "icmov")
16617 (set_attr "mode" "SI")])
16619 (define_expand "movsfcc"
16620 [(set (match_operand:SF 0 "register_operand" "")
16621 (if_then_else:SF (match_operand 1 "comparison_operator" "")
16622 (match_operand:SF 2 "register_operand" "")
16623 (match_operand:SF 3 "register_operand" "")))]
16625 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
16627 (define_insn "*movsfcc_1"
16628 [(set (match_operand:SF 0 "register_operand" "=f,f,r,r")
16629 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
16630 [(reg 17) (const_int 0)])
16631 (match_operand:SF 2 "nonimmediate_operand" "f,0,rm,0")
16632 (match_operand:SF 3 "nonimmediate_operand" "0,f,0,rm")))]
16634 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16636 fcmov%F1\t{%2, %0|%0, %2}
16637 fcmov%f1\t{%3, %0|%0, %3}
16638 cmov%O2%C1\t{%2, %0|%0, %2}
16639 cmov%O2%c1\t{%3, %0|%0, %3}"
16640 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
16641 (set_attr "mode" "SF,SF,SI,SI")])
16643 (define_expand "movdfcc"
16644 [(set (match_operand:DF 0 "register_operand" "")
16645 (if_then_else:DF (match_operand 1 "comparison_operator" "")
16646 (match_operand:DF 2 "register_operand" "")
16647 (match_operand:DF 3 "register_operand" "")))]
16649 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
16651 (define_insn "*movdfcc_1"
16652 [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r")
16653 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
16654 [(reg 17) (const_int 0)])
16655 (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0")
16656 (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))]
16657 "!TARGET_64BIT && TARGET_CMOVE
16658 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16660 fcmov%F1\t{%2, %0|%0, %2}
16661 fcmov%f1\t{%3, %0|%0, %3}
16664 [(set_attr "type" "fcmov,fcmov,multi,multi")
16665 (set_attr "mode" "DF")])
16667 (define_insn "*movdfcc_1_rex64"
16668 [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r")
16669 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
16670 [(reg 17) (const_int 0)])
16671 (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0")
16672 (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))]
16673 "TARGET_64BIT && TARGET_CMOVE
16674 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
16676 fcmov%F1\t{%2, %0|%0, %2}
16677 fcmov%f1\t{%3, %0|%0, %3}
16678 cmov%O2%C1\t{%2, %0|%0, %2}
16679 cmov%O2%c1\t{%3, %0|%0, %3}"
16680 [(set_attr "type" "fcmov,fcmov,icmov,icmov")
16681 (set_attr "mode" "DF")])
16684 [(set (match_operand:DF 0 "register_and_not_any_fp_reg_operand" "")
16685 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
16686 [(match_operand 4 "flags_reg_operand" "") (const_int 0)])
16687 (match_operand:DF 2 "nonimmediate_operand" "")
16688 (match_operand:DF 3 "nonimmediate_operand" "")))]
16689 "!TARGET_64BIT && reload_completed"
16690 [(set (match_dup 2)
16691 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
16695 (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)])
16698 "split_di (operands+2, 1, operands+5, operands+6);
16699 split_di (operands+3, 1, operands+7, operands+8);
16700 split_di (operands, 1, operands+2, operands+3);")
16702 (define_expand "movxfcc"
16703 [(set (match_operand:XF 0 "register_operand" "")
16704 (if_then_else:XF (match_operand 1 "comparison_operator" "")
16705 (match_operand:XF 2 "register_operand" "")
16706 (match_operand:XF 3 "register_operand" "")))]
16707 "!TARGET_64BIT && TARGET_CMOVE"
16708 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
16710 (define_expand "movtfcc"
16711 [(set (match_operand:TF 0 "register_operand" "")
16712 (if_then_else:TF (match_operand 1 "comparison_operator" "")
16713 (match_operand:TF 2 "register_operand" "")
16714 (match_operand:TF 3 "register_operand" "")))]
16716 "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;")
16718 (define_insn "*movxfcc_1"
16719 [(set (match_operand:XF 0 "register_operand" "=f,f")
16720 (if_then_else:XF (match_operator 1 "fcmov_comparison_operator"
16721 [(reg 17) (const_int 0)])
16722 (match_operand:XF 2 "register_operand" "f,0")
16723 (match_operand:XF 3 "register_operand" "0,f")))]
16724 "!TARGET_64BIT && TARGET_CMOVE"
16726 fcmov%F1\t{%2, %0|%0, %2}
16727 fcmov%f1\t{%3, %0|%0, %3}"
16728 [(set_attr "type" "fcmov")
16729 (set_attr "mode" "XF")])
16731 (define_insn "*movtfcc_1"
16732 [(set (match_operand:TF 0 "register_operand" "=f,f")
16733 (if_then_else:TF (match_operator 1 "fcmov_comparison_operator"
16734 [(reg 17) (const_int 0)])
16735 (match_operand:TF 2 "register_operand" "f,0")
16736 (match_operand:TF 3 "register_operand" "0,f")))]
16739 fcmov%F1\t{%2, %0|%0, %2}
16740 fcmov%f1\t{%3, %0|%0, %3}"
16741 [(set_attr "type" "fcmov")
16742 (set_attr "mode" "XF")])
16744 (define_expand "minsf3"
16746 (set (match_operand:SF 0 "register_operand" "")
16747 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
16748 (match_operand:SF 2 "nonimmediate_operand" ""))
16751 (clobber (reg:CC 17))])]
16755 (define_insn "*minsf"
16756 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
16757 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0,0,f#x")
16758 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
16761 (clobber (reg:CC 17))]
16762 "TARGET_SSE && TARGET_IEEE_FP"
16765 (define_insn "*minsf_nonieee"
16766 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
16767 (if_then_else:SF (lt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
16768 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
16771 (clobber (reg:CC 17))]
16772 "TARGET_SSE && !TARGET_IEEE_FP
16773 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16777 [(set (match_operand:SF 0 "register_operand" "")
16778 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
16779 (match_operand:SF 2 "nonimmediate_operand" ""))
16780 (match_operand:SF 3 "register_operand" "")
16781 (match_operand:SF 4 "nonimmediate_operand" "")))
16782 (clobber (reg:CC 17))]
16783 "SSE_REG_P (operands[0]) && reload_completed
16784 && ((operands_match_p (operands[1], operands[3])
16785 && operands_match_p (operands[2], operands[4]))
16786 || (operands_match_p (operands[1], operands[4])
16787 && operands_match_p (operands[2], operands[3])))"
16788 [(set (match_dup 0)
16789 (if_then_else:SF (lt (match_dup 1)
16794 ;; Conditional addition patterns
16795 (define_expand "addqicc"
16796 [(match_operand:QI 0 "register_operand" "")
16797 (match_operand 1 "comparison_operator" "")
16798 (match_operand:QI 2 "register_operand" "")
16799 (match_operand:QI 3 "const_int_operand" "")]
16801 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
16803 (define_expand "addhicc"
16804 [(match_operand:HI 0 "register_operand" "")
16805 (match_operand 1 "comparison_operator" "")
16806 (match_operand:HI 2 "register_operand" "")
16807 (match_operand:HI 3 "const_int_operand" "")]
16809 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
16811 (define_expand "addsicc"
16812 [(match_operand:SI 0 "register_operand" "")
16813 (match_operand 1 "comparison_operator" "")
16814 (match_operand:SI 2 "register_operand" "")
16815 (match_operand:SI 3 "const_int_operand" "")]
16817 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
16819 (define_expand "adddicc"
16820 [(match_operand:DI 0 "register_operand" "")
16821 (match_operand 1 "comparison_operator" "")
16822 (match_operand:DI 2 "register_operand" "")
16823 (match_operand:DI 3 "const_int_operand" "")]
16825 "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;")
16827 ;; We can't represent the LT test directly. Do this by swapping the operands.
16830 [(set (match_operand:SF 0 "fp_register_operand" "")
16831 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "")
16832 (match_operand:SF 2 "register_operand" ""))
16833 (match_operand:SF 3 "register_operand" "")
16834 (match_operand:SF 4 "register_operand" "")))
16835 (clobber (reg:CC 17))]
16837 && ((operands_match_p (operands[1], operands[3])
16838 && operands_match_p (operands[2], operands[4]))
16839 || (operands_match_p (operands[1], operands[4])
16840 && operands_match_p (operands[2], operands[3])))"
16841 [(set (reg:CCFP 17)
16842 (compare:CCFP (match_dup 2)
16845 (if_then_else:SF (ge (reg:CCFP 17) (const_int 0))
16849 (define_insn "*minsf_sse"
16850 [(set (match_operand:SF 0 "register_operand" "=x")
16851 (if_then_else:SF (lt (match_operand:SF 1 "register_operand" "0")
16852 (match_operand:SF 2 "nonimmediate_operand" "xm"))
16855 "TARGET_SSE && reload_completed"
16856 "minss\t{%2, %0|%0, %2}"
16857 [(set_attr "type" "sse")
16858 (set_attr "mode" "SF")])
16860 (define_expand "mindf3"
16862 (set (match_operand:DF 0 "register_operand" "")
16863 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
16864 (match_operand:DF 2 "nonimmediate_operand" ""))
16867 (clobber (reg:CC 17))])]
16868 "TARGET_SSE2 && TARGET_SSE_MATH"
16871 (define_insn "*mindf"
16872 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
16873 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0,0,f#Y")
16874 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
16877 (clobber (reg:CC 17))]
16878 "TARGET_SSE2 && TARGET_IEEE_FP && TARGET_SSE_MATH"
16881 (define_insn "*mindf_nonieee"
16882 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
16883 (if_then_else:DF (lt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
16884 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
16887 (clobber (reg:CC 17))]
16888 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
16889 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16893 [(set (match_operand:DF 0 "register_operand" "")
16894 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
16895 (match_operand:DF 2 "nonimmediate_operand" ""))
16896 (match_operand:DF 3 "register_operand" "")
16897 (match_operand:DF 4 "nonimmediate_operand" "")))
16898 (clobber (reg:CC 17))]
16899 "SSE_REG_P (operands[0]) && reload_completed
16900 && ((operands_match_p (operands[1], operands[3])
16901 && operands_match_p (operands[2], operands[4]))
16902 || (operands_match_p (operands[1], operands[4])
16903 && operands_match_p (operands[2], operands[3])))"
16904 [(set (match_dup 0)
16905 (if_then_else:DF (lt (match_dup 1)
16910 ;; We can't represent the LT test directly. Do this by swapping the operands.
16912 [(set (match_operand:DF 0 "fp_register_operand" "")
16913 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "")
16914 (match_operand:DF 2 "register_operand" ""))
16915 (match_operand:DF 3 "register_operand" "")
16916 (match_operand:DF 4 "register_operand" "")))
16917 (clobber (reg:CC 17))]
16919 && ((operands_match_p (operands[1], operands[3])
16920 && operands_match_p (operands[2], operands[4]))
16921 || (operands_match_p (operands[1], operands[4])
16922 && operands_match_p (operands[2], operands[3])))"
16923 [(set (reg:CCFP 17)
16924 (compare:CCFP (match_dup 2)
16927 (if_then_else:DF (ge (reg:CCFP 17) (const_int 0))
16931 (define_insn "*mindf_sse"
16932 [(set (match_operand:DF 0 "register_operand" "=Y")
16933 (if_then_else:DF (lt (match_operand:DF 1 "register_operand" "0")
16934 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
16937 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
16938 "minsd\t{%2, %0|%0, %2}"
16939 [(set_attr "type" "sse")
16940 (set_attr "mode" "DF")])
16942 (define_expand "maxsf3"
16944 (set (match_operand:SF 0 "register_operand" "")
16945 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
16946 (match_operand:SF 2 "nonimmediate_operand" ""))
16949 (clobber (reg:CC 17))])]
16953 (define_insn "*maxsf"
16954 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x,f#x")
16955 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0,0,f#x")
16956 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x,0"))
16959 (clobber (reg:CC 17))]
16960 "TARGET_SSE && TARGET_IEEE_FP"
16963 (define_insn "*maxsf_nonieee"
16964 [(set (match_operand:SF 0 "register_operand" "=x#f,f#x")
16965 (if_then_else:SF (gt (match_operand:SF 1 "nonimmediate_operand" "%0,0")
16966 (match_operand:SF 2 "nonimmediate_operand" "xm#f,f#x"))
16969 (clobber (reg:CC 17))]
16970 "TARGET_SSE && !TARGET_IEEE_FP
16971 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
16975 [(set (match_operand:SF 0 "register_operand" "")
16976 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
16977 (match_operand:SF 2 "nonimmediate_operand" ""))
16978 (match_operand:SF 3 "register_operand" "")
16979 (match_operand:SF 4 "nonimmediate_operand" "")))
16980 (clobber (reg:CC 17))]
16981 "SSE_REG_P (operands[0]) && reload_completed
16982 && ((operands_match_p (operands[1], operands[3])
16983 && operands_match_p (operands[2], operands[4]))
16984 || (operands_match_p (operands[1], operands[4])
16985 && operands_match_p (operands[2], operands[3])))"
16986 [(set (match_dup 0)
16987 (if_then_else:SF (gt (match_dup 1)
16993 [(set (match_operand:SF 0 "fp_register_operand" "")
16994 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "")
16995 (match_operand:SF 2 "register_operand" ""))
16996 (match_operand:SF 3 "register_operand" "")
16997 (match_operand:SF 4 "register_operand" "")))
16998 (clobber (reg:CC 17))]
17000 && ((operands_match_p (operands[1], operands[3])
17001 && operands_match_p (operands[2], operands[4]))
17002 || (operands_match_p (operands[1], operands[4])
17003 && operands_match_p (operands[2], operands[3])))"
17004 [(set (reg:CCFP 17)
17005 (compare:CCFP (match_dup 1)
17008 (if_then_else:SF (gt (reg:CCFP 17) (const_int 0))
17012 (define_insn "*maxsf_sse"
17013 [(set (match_operand:SF 0 "register_operand" "=x")
17014 (if_then_else:SF (gt (match_operand:SF 1 "register_operand" "0")
17015 (match_operand:SF 2 "nonimmediate_operand" "xm"))
17018 "TARGET_SSE && reload_completed"
17019 "maxss\t{%2, %0|%0, %2}"
17020 [(set_attr "type" "sse")
17021 (set_attr "mode" "SF")])
17023 (define_expand "maxdf3"
17025 (set (match_operand:DF 0 "register_operand" "")
17026 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17027 (match_operand:DF 2 "nonimmediate_operand" ""))
17030 (clobber (reg:CC 17))])]
17031 "TARGET_SSE2 && TARGET_SSE_MATH"
17034 (define_insn "*maxdf"
17035 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y,f#Y")
17036 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0,0,f#Y")
17037 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y,0"))
17040 (clobber (reg:CC 17))]
17041 "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_IEEE_FP"
17044 (define_insn "*maxdf_nonieee"
17045 [(set (match_operand:DF 0 "register_operand" "=Y#f,f#Y")
17046 (if_then_else:DF (gt (match_operand:DF 1 "nonimmediate_operand" "%0,0")
17047 (match_operand:DF 2 "nonimmediate_operand" "Ym#f,f#Y"))
17050 (clobber (reg:CC 17))]
17051 "TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_IEEE_FP
17052 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
17056 [(set (match_operand:DF 0 "register_operand" "")
17057 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17058 (match_operand:DF 2 "nonimmediate_operand" ""))
17059 (match_operand:DF 3 "register_operand" "")
17060 (match_operand:DF 4 "nonimmediate_operand" "")))
17061 (clobber (reg:CC 17))]
17062 "SSE_REG_P (operands[0]) && reload_completed
17063 && ((operands_match_p (operands[1], operands[3])
17064 && operands_match_p (operands[2], operands[4]))
17065 || (operands_match_p (operands[1], operands[4])
17066 && operands_match_p (operands[2], operands[3])))"
17067 [(set (match_dup 0)
17068 (if_then_else:DF (gt (match_dup 1)
17074 [(set (match_operand:DF 0 "fp_register_operand" "")
17075 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "")
17076 (match_operand:DF 2 "register_operand" ""))
17077 (match_operand:DF 3 "register_operand" "")
17078 (match_operand:DF 4 "register_operand" "")))
17079 (clobber (reg:CC 17))]
17081 && ((operands_match_p (operands[1], operands[3])
17082 && operands_match_p (operands[2], operands[4]))
17083 || (operands_match_p (operands[1], operands[4])
17084 && operands_match_p (operands[2], operands[3])))"
17085 [(set (reg:CCFP 17)
17086 (compare:CCFP (match_dup 1)
17089 (if_then_else:DF (gt (reg:CCFP 17) (const_int 0))
17093 (define_insn "*maxdf_sse"
17094 [(set (match_operand:DF 0 "register_operand" "=Y")
17095 (if_then_else:DF (gt (match_operand:DF 1 "register_operand" "0")
17096 (match_operand:DF 2 "nonimmediate_operand" "Ym"))
17099 "TARGET_SSE2 && TARGET_SSE_MATH && reload_completed"
17100 "maxsd\t{%2, %0|%0, %2}"
17101 [(set_attr "type" "sse")
17102 (set_attr "mode" "DF")])
17104 ;; Misc patterns (?)
17106 ;; This pattern exists to put a dependency on all ebp-based memory accesses.
17107 ;; Otherwise there will be nothing to keep
17109 ;; [(set (reg ebp) (reg esp))]
17110 ;; [(set (reg esp) (plus (reg esp) (const_int -160000)))
17111 ;; (clobber (eflags)]
17112 ;; [(set (mem (plus (reg ebp) (const_int -160000))) (const_int 0))]
17114 ;; in proper program order.
17115 (define_expand "pro_epilogue_adjust_stack"
17116 [(parallel [(set (match_operand:SI 0 "register_operand" "=r,r")
17117 (plus:SI (match_operand:SI 1 "register_operand" "0,r")
17118 (match_operand:SI 2 "immediate_operand" "i,i")))
17119 (clobber (reg:CC 17))
17120 (clobber (mem:BLK (scratch)))])]
17125 emit_insn (gen_pro_epilogue_adjust_stack_rex64
17126 (operands[0], operands[1], operands[2]));
17131 (define_insn "*pro_epilogue_adjust_stack_1"
17132 [(set (match_operand:SI 0 "register_operand" "=r,r")
17133 (plus:SI (match_operand:SI 1 "register_operand" "0,r")
17134 (match_operand:SI 2 "immediate_operand" "i,i")))
17135 (clobber (reg:CC 17))
17136 (clobber (mem:BLK (scratch)))]
17139 switch (get_attr_type (insn))
17142 return "mov{l}\t{%1, %0|%0, %1}";
17145 if (GET_CODE (operands[2]) == CONST_INT
17146 && (INTVAL (operands[2]) == 128
17147 || (INTVAL (operands[2]) < 0
17148 && INTVAL (operands[2]) != -128)))
17150 operands[2] = GEN_INT (-INTVAL (operands[2]));
17151 return "sub{l}\t{%2, %0|%0, %2}";
17153 return "add{l}\t{%2, %0|%0, %2}";
17156 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
17157 return "lea{l}\t{%a2, %0|%0, %a2}";
17163 [(set (attr "type")
17164 (cond [(eq_attr "alternative" "0")
17165 (const_string "alu")
17166 (match_operand:SI 2 "const0_operand" "")
17167 (const_string "imov")
17169 (const_string "lea")))
17170 (set_attr "mode" "SI")])
17172 (define_insn "pro_epilogue_adjust_stack_rex64"
17173 [(set (match_operand:DI 0 "register_operand" "=r,r")
17174 (plus:DI (match_operand:DI 1 "register_operand" "0,r")
17175 (match_operand:DI 2 "x86_64_immediate_operand" "e,e")))
17176 (clobber (reg:CC 17))
17177 (clobber (mem:BLK (scratch)))]
17180 switch (get_attr_type (insn))
17183 return "mov{q}\t{%1, %0|%0, %1}";
17186 if (GET_CODE (operands[2]) == CONST_INT
17187 && (INTVAL (operands[2]) == 128
17188 || (INTVAL (operands[2]) < 0
17189 && INTVAL (operands[2]) != -128)))
17191 operands[2] = GEN_INT (-INTVAL (operands[2]));
17192 return "sub{q}\t{%2, %0|%0, %2}";
17194 return "add{q}\t{%2, %0|%0, %2}";
17197 operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
17198 return "lea{q}\t{%a2, %0|%0, %a2}";
17204 [(set (attr "type")
17205 (cond [(eq_attr "alternative" "0")
17206 (const_string "alu")
17207 (match_operand:DI 2 "const0_operand" "")
17208 (const_string "imov")
17210 (const_string "lea")))
17211 (set_attr "mode" "DI")])
17214 ;; Placeholder for the conditional moves. This one is split either to SSE
17215 ;; based moves emulation or to usual cmove sequence. Little bit unfortunate
17216 ;; fact is that compares supported by the cmp??ss instructions are exactly
17217 ;; swapped of those supported by cmove sequence.
17218 ;; The EQ/NE comparisons also needs bit care, since they are not directly
17219 ;; supported by i387 comparisons and we do need to emit two conditional moves
17222 (define_insn "sse_movsfcc"
17223 [(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")
17224 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
17225 [(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")
17226 (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")])
17227 (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")
17228 (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")))
17229 (clobber (match_scratch:SF 6 "=2,&4,X,X,X,X,X,X,X,X"))
17230 (clobber (reg:CC 17))]
17232 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
17233 /* Avoid combine from being smart and converting min/max
17234 instruction patterns into conditional moves. */
17235 && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT
17236 && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE)
17237 || !rtx_equal_p (operands[4], operands[2])
17238 || !rtx_equal_p (operands[5], operands[3]))
17239 && (!TARGET_IEEE_FP
17240 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
17243 (define_insn "sse_movsfcc_eq"
17244 [(set (match_operand:SF 0 "register_operand" "=&x#rf,x#rf,?f#xr,?f#xr,?r#xf,?r#xf")
17245 (if_then_else:SF (eq (match_operand:SF 3 "nonimmediate_operand" "%0#fx,x#fx,f#x,xm#f,f#x,xm#f")
17246 (match_operand:SF 4 "nonimmediate_operand" "xm#f,xm#f,f#x,x#f,f#x,x#f"))
17247 (match_operand:SF 1 "nonimmediate_operand" "x#fr,0#fr,0#fx,0#fx,0#rx,0#rx")
17248 (match_operand:SF 2 "nonimmediate_operand" "x#fr,x#fr,f#fx,f#fx,rm#rx,rm#rx")))
17249 (clobber (match_scratch:SF 5 "=1,&3,X,X,X,X"))
17250 (clobber (reg:CC 17))]
17252 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17255 (define_insn "sse_movdfcc"
17256 [(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")
17257 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
17258 [(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")
17259 (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")])
17260 (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")
17261 (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")))
17262 (clobber (match_scratch:DF 6 "=2,&4,X,X,X,X,X,X,X,X"))
17263 (clobber (reg:CC 17))]
17265 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)
17266 /* Avoid combine from being smart and converting min/max
17267 instruction patterns into conditional moves. */
17268 && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT
17269 && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE)
17270 || !rtx_equal_p (operands[4], operands[2])
17271 || !rtx_equal_p (operands[5], operands[3]))
17272 && (!TARGET_IEEE_FP
17273 || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))"
17276 (define_insn "sse_movdfcc_eq"
17277 [(set (match_operand:DF 0 "register_operand" "=&Y#rf,Y#rf,?f#Yr,?f#Yr,?r#Yf,?r#Yf")
17278 (if_then_else:DF (eq (match_operand:DF 3 "nonimmediate_operand" "%0#fY,Y#fY,f#Y,Ym#f,f#Y,Ym#f")
17279 (match_operand:DF 4 "nonimmediate_operand" "Ym#f,Ym#f,f#Y,Y#f,f#Y,Y#f"))
17280 (match_operand:DF 1 "nonimmediate_operand" "Y#fr,0#fr,0#fY,0#fY,0#rY,0#rY")
17281 (match_operand:DF 2 "nonimmediate_operand" "Y#fr,Y#fr,f#fY,f#fY,rm#rY,rm#rY")))
17282 (clobber (match_scratch:DF 5 "=1,&3,X,X,X,X"))
17283 (clobber (reg:CC 17))]
17285 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
17288 ;; For non-sse moves just expand the usual cmove sequence.
17290 [(set (match_operand 0 "register_operand" "")
17291 (if_then_else (match_operator 1 "comparison_operator"
17292 [(match_operand 4 "nonimmediate_operand" "")
17293 (match_operand 5 "register_operand" "")])
17294 (match_operand 2 "nonimmediate_operand" "")
17295 (match_operand 3 "nonimmediate_operand" "")))
17296 (clobber (match_operand 6 "" ""))
17297 (clobber (reg:CC 17))]
17298 "!SSE_REG_P (operands[0]) && reload_completed
17299 && VALID_SSE_REG_MODE (GET_MODE (operands[0]))"
17302 ix86_compare_op0 = operands[5];
17303 ix86_compare_op1 = operands[4];
17304 operands[1] = gen_rtx_fmt_ee (swap_condition (GET_CODE (operands[1])),
17305 VOIDmode, operands[5], operands[4]);
17306 ix86_expand_fp_movcc (operands);
17310 ;; Split SSE based conditional move into sequence:
17311 ;; cmpCC op0, op4 - set op0 to 0 or ffffffff depending on the comparison
17312 ;; and op2, op0 - zero op2 if comparison was false
17313 ;; nand op0, op3 - load op3 to op0 if comparison was false
17314 ;; or op2, op0 - get the nonzero one into the result.
17316 [(set (match_operand 0 "register_operand" "")
17317 (if_then_else (match_operator 1 "sse_comparison_operator"
17318 [(match_operand 4 "register_operand" "")
17319 (match_operand 5 "nonimmediate_operand" "")])
17320 (match_operand 2 "register_operand" "")
17321 (match_operand 3 "register_operand" "")))
17322 (clobber (match_operand 6 "" ""))
17323 (clobber (reg:CC 17))]
17324 "SSE_REG_P (operands[0]) && reload_completed"
17325 [(set (match_dup 4) (match_op_dup 1 [(match_dup 4) (match_dup 5)]))
17326 (set (subreg:TI (match_dup 2) 0) (and:TI (subreg:TI (match_dup 2) 0)
17327 (subreg:TI (match_dup 4) 0)))
17328 (set (subreg:TI (match_dup 4) 0) (and:TI (not:TI (subreg:TI (match_dup 4) 0))
17329 (subreg:TI (match_dup 3) 0)))
17330 (set (subreg:TI (match_dup 0) 0) (ior:TI (subreg:TI (match_dup 6) 0)
17331 (subreg:TI (match_dup 7) 0)))]
17333 if (GET_MODE (operands[2]) == DFmode
17334 && TARGET_SSE_PARTIAL_REGS && !optimize_size)
17336 rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
17337 emit_insn (gen_sse2_unpcklpd (op, op, op));
17338 op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
17339 emit_insn (gen_sse2_unpcklpd (op, op, op));
17342 /* If op2 == op3, op3 would be clobbered before it is used. */
17343 if (operands_match_p (operands[2], operands[3]))
17345 emit_move_insn (operands[0], operands[2]);
17349 PUT_MODE (operands[1], GET_MODE (operands[0]));
17350 if (operands_match_p (operands[0], operands[4]))
17351 operands[6] = operands[4], operands[7] = operands[2];
17353 operands[6] = operands[2], operands[7] = operands[4];
17356 ;; Special case of conditional move we can handle effectively.
17357 ;; Do not brother with the integer/floating point case, since these are
17358 ;; bot considerably slower, unlike in the generic case.
17359 (define_insn "*sse_movsfcc_const0_1"
17360 [(set (match_operand:SF 0 "register_operand" "=&x")
17361 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
17362 [(match_operand:SF 4 "register_operand" "0")
17363 (match_operand:SF 5 "nonimmediate_operand" "xm")])
17364 (match_operand:SF 2 "register_operand" "x")
17365 (match_operand:SF 3 "const0_operand" "X")))]
17369 (define_insn "*sse_movsfcc_const0_2"
17370 [(set (match_operand:SF 0 "register_operand" "=&x")
17371 (if_then_else:SF (match_operator 1 "sse_comparison_operator"
17372 [(match_operand:SF 4 "register_operand" "0")
17373 (match_operand:SF 5 "nonimmediate_operand" "xm")])
17374 (match_operand:SF 2 "const0_operand" "X")
17375 (match_operand:SF 3 "register_operand" "x")))]
17379 (define_insn "*sse_movsfcc_const0_3"
17380 [(set (match_operand:SF 0 "register_operand" "=&x")
17381 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
17382 [(match_operand:SF 4 "nonimmediate_operand" "xm")
17383 (match_operand:SF 5 "register_operand" "0")])
17384 (match_operand:SF 2 "register_operand" "x")
17385 (match_operand:SF 3 "const0_operand" "X")))]
17389 (define_insn "*sse_movsfcc_const0_4"
17390 [(set (match_operand:SF 0 "register_operand" "=&x")
17391 (if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
17392 [(match_operand:SF 4 "nonimmediate_operand" "xm")
17393 (match_operand:SF 5 "register_operand" "0")])
17394 (match_operand:SF 2 "const0_operand" "X")
17395 (match_operand:SF 3 "register_operand" "x")))]
17399 (define_insn "*sse_movdfcc_const0_1"
17400 [(set (match_operand:DF 0 "register_operand" "=&Y")
17401 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
17402 [(match_operand:DF 4 "register_operand" "0")
17403 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
17404 (match_operand:DF 2 "register_operand" "Y")
17405 (match_operand:DF 3 "const0_operand" "X")))]
17409 (define_insn "*sse_movdfcc_const0_2"
17410 [(set (match_operand:DF 0 "register_operand" "=&Y")
17411 (if_then_else:DF (match_operator 1 "sse_comparison_operator"
17412 [(match_operand:DF 4 "register_operand" "0")
17413 (match_operand:DF 5 "nonimmediate_operand" "Ym")])
17414 (match_operand:DF 2 "const0_operand" "X")
17415 (match_operand:DF 3 "register_operand" "Y")))]
17419 (define_insn "*sse_movdfcc_const0_3"
17420 [(set (match_operand:DF 0 "register_operand" "=&Y")
17421 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17422 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
17423 (match_operand:DF 5 "register_operand" "0")])
17424 (match_operand:DF 2 "register_operand" "Y")
17425 (match_operand:DF 3 "const0_operand" "X")))]
17429 (define_insn "*sse_movdfcc_const0_4"
17430 [(set (match_operand:DF 0 "register_operand" "=&Y")
17431 (if_then_else:DF (match_operator 1 "fcmov_comparison_operator"
17432 [(match_operand:DF 4 "nonimmediate_operand" "Ym")
17433 (match_operand:DF 5 "register_operand" "0")])
17434 (match_operand:DF 2 "const0_operand" "X")
17435 (match_operand:DF 3 "register_operand" "Y")))]
17440 [(set (match_operand 0 "register_operand" "")
17441 (if_then_else (match_operator 1 "comparison_operator"
17442 [(match_operand 4 "nonimmediate_operand" "")
17443 (match_operand 5 "nonimmediate_operand" "")])
17444 (match_operand 2 "nonmemory_operand" "")
17445 (match_operand 3 "nonmemory_operand" "")))]
17446 "SSE_REG_P (operands[0]) && reload_completed
17447 && (const0_operand (operands[2], GET_MODE (operands[0]))
17448 || const0_operand (operands[3], GET_MODE (operands[0])))"
17449 [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)]))
17450 (set (subreg:TI (match_dup 0) 0) (and:TI (match_dup 6)
17453 if (TARGET_SSE_PARTIAL_REGS && !optimize_size
17454 && GET_MODE (operands[2]) == DFmode)
17456 if (REG_P (operands[2]))
17458 rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0);
17459 emit_insn (gen_sse2_unpcklpd (op, op, op));
17461 if (REG_P (operands[3]))
17463 rtx op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0);
17464 emit_insn (gen_sse2_unpcklpd (op, op, op));
17467 PUT_MODE (operands[1], GET_MODE (operands[0]));
17468 if (!sse_comparison_operator (operands[1], VOIDmode)
17469 || !rtx_equal_p (operands[0], operands[4]))
17471 rtx tmp = operands[5];
17472 operands[5] = operands[4];
17474 PUT_CODE (operands[1], swap_condition (GET_CODE (operands[1])));
17476 if (!rtx_equal_p (operands[0], operands[4]))
17478 if (const0_operand (operands[2], GET_MODE (operands[0])))
17480 operands[7] = operands[3];
17481 operands[6] = gen_rtx_NOT (TImode, gen_rtx_SUBREG (TImode, operands[0],
17486 operands[7] = operands[2];
17487 operands[6] = gen_rtx_SUBREG (TImode, operands[0], 0);
17489 operands[7] = simplify_gen_subreg (TImode, operands[7],
17490 GET_MODE (operands[7]), 0);
17493 (define_expand "allocate_stack_worker"
17494 [(match_operand:SI 0 "register_operand" "")]
17495 "TARGET_STACK_PROBE"
17498 emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
17500 emit_insn (gen_allocate_stack_worker_1 (operands[0]));
17504 (define_insn "allocate_stack_worker_1"
17505 [(unspec:SI [(match_operand:SI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
17506 (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
17507 (clobber (match_dup 0))
17508 (clobber (reg:CC 17))]
17509 "!TARGET_64BIT && TARGET_STACK_PROBE"
17511 [(set_attr "type" "multi")
17512 (set_attr "length" "5")])
17514 (define_insn "allocate_stack_worker_rex64"
17515 [(unspec:DI [(match_operand:DI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
17516 (set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0)))
17517 (clobber (match_dup 0))
17518 (clobber (reg:CC 17))]
17519 "TARGET_64BIT && TARGET_STACK_PROBE"
17521 [(set_attr "type" "multi")
17522 (set_attr "length" "5")])
17524 (define_expand "allocate_stack"
17525 [(parallel [(set (match_operand:SI 0 "register_operand" "=r")
17526 (minus:SI (reg:SI 7)
17527 (match_operand:SI 1 "general_operand" "")))
17528 (clobber (reg:CC 17))])
17529 (parallel [(set (reg:SI 7)
17530 (minus:SI (reg:SI 7) (match_dup 1)))
17531 (clobber (reg:CC 17))])]
17532 "TARGET_STACK_PROBE"
17534 #ifdef CHECK_STACK_LIMIT
17535 if (GET_CODE (operands[1]) == CONST_INT
17536 && INTVAL (operands[1]) < CHECK_STACK_LIMIT)
17537 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
17541 emit_insn (gen_allocate_stack_worker (copy_to_mode_reg (SImode,
17544 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
17548 (define_expand "builtin_setjmp_receiver"
17549 [(label_ref (match_operand 0 "" ""))]
17550 "!TARGET_64BIT && flag_pic"
17552 emit_insn (gen_set_got (pic_offset_table_rtx));
17556 ;; Avoid redundant prefixes by splitting HImode arithmetic to SImode.
17559 [(set (match_operand 0 "register_operand" "")
17560 (match_operator 3 "promotable_binary_operator"
17561 [(match_operand 1 "register_operand" "")
17562 (match_operand 2 "aligned_operand" "")]))
17563 (clobber (reg:CC 17))]
17564 "! TARGET_PARTIAL_REG_STALL && reload_completed
17565 && ((GET_MODE (operands[0]) == HImode
17566 && ((!optimize_size && !TARGET_FAST_PREFIX)
17567 || GET_CODE (operands[2]) != CONST_INT
17568 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')))
17569 || (GET_MODE (operands[0]) == QImode
17570 && (TARGET_PROMOTE_QImode || optimize_size)))"
17571 [(parallel [(set (match_dup 0)
17572 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
17573 (clobber (reg:CC 17))])]
17574 "operands[0] = gen_lowpart (SImode, operands[0]);
17575 operands[1] = gen_lowpart (SImode, operands[1]);
17576 if (GET_CODE (operands[3]) != ASHIFT)
17577 operands[2] = gen_lowpart (SImode, operands[2]);
17578 PUT_MODE (operands[3], SImode);")
17582 (compare (and (match_operand 1 "aligned_operand" "")
17583 (match_operand 2 "const_int_operand" ""))
17585 (set (match_operand 0 "register_operand" "")
17586 (and (match_dup 1) (match_dup 2)))]
17587 "! TARGET_PARTIAL_REG_STALL && reload_completed
17588 && ix86_match_ccmode (insn, CCNOmode)
17589 && (GET_MODE (operands[0]) == HImode
17590 || (GET_MODE (operands[0]) == QImode
17591 /* Ensure that the operand will remain sign extended immediate. */
17592 && INTVAL (operands[2]) >= 0
17593 && (TARGET_PROMOTE_QImode || optimize_size)))"
17594 [(parallel [(set (reg:CCNO 17)
17595 (compare:CCNO (and:SI (match_dup 1) (match_dup 2))
17598 (and:SI (match_dup 1) (match_dup 2)))])]
17600 = gen_int_mode (INTVAL (operands[2])
17601 & GET_MODE_MASK (GET_MODE (operands[0])),
17603 operands[0] = gen_lowpart (SImode, operands[0]);
17604 operands[1] = gen_lowpart (SImode, operands[1]);")
17606 ; Don't promote the QImode tests, as i386 don't have encoding of
17607 ; the test instruction with 32bit sign extended immediate and thus
17611 (compare (and (match_operand:HI 0 "aligned_operand" "")
17612 (match_operand:HI 1 "const_int_operand" ""))
17614 "! TARGET_PARTIAL_REG_STALL && reload_completed
17615 && ix86_match_ccmode (insn, CCNOmode)
17616 && GET_MODE (operands[0]) == HImode"
17617 [(set (reg:CCNO 17)
17618 (compare:CCNO (and:SI (match_dup 0) (match_dup 1))
17621 = gen_int_mode (INTVAL (operands[1])
17622 & GET_MODE_MASK (GET_MODE (operands[0])),
17624 operands[0] = gen_lowpart (SImode, operands[0]);")
17627 [(set (match_operand 0 "register_operand" "")
17628 (neg (match_operand 1 "register_operand" "")))
17629 (clobber (reg:CC 17))]
17630 "! TARGET_PARTIAL_REG_STALL && reload_completed
17631 && (GET_MODE (operands[0]) == HImode
17632 || (GET_MODE (operands[0]) == QImode
17633 && (TARGET_PROMOTE_QImode || optimize_size)))"
17634 [(parallel [(set (match_dup 0)
17635 (neg:SI (match_dup 1)))
17636 (clobber (reg:CC 17))])]
17637 "operands[0] = gen_lowpart (SImode, operands[0]);
17638 operands[1] = gen_lowpart (SImode, operands[1]);")
17641 [(set (match_operand 0 "register_operand" "")
17642 (not (match_operand 1 "register_operand" "")))]
17643 "! TARGET_PARTIAL_REG_STALL && reload_completed
17644 && (GET_MODE (operands[0]) == HImode
17645 || (GET_MODE (operands[0]) == QImode
17646 && (TARGET_PROMOTE_QImode || optimize_size)))"
17647 [(set (match_dup 0)
17648 (not:SI (match_dup 1)))]
17649 "operands[0] = gen_lowpart (SImode, operands[0]);
17650 operands[1] = gen_lowpart (SImode, operands[1]);")
17653 [(set (match_operand 0 "register_operand" "")
17654 (if_then_else (match_operator 1 "comparison_operator"
17655 [(reg 17) (const_int 0)])
17656 (match_operand 2 "register_operand" "")
17657 (match_operand 3 "register_operand" "")))]
17658 "! TARGET_PARTIAL_REG_STALL && TARGET_CMOVE
17659 && (GET_MODE (operands[0]) == HImode
17660 || (GET_MODE (operands[0]) == QImode
17661 && (TARGET_PROMOTE_QImode || optimize_size)))"
17662 [(set (match_dup 0)
17663 (if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
17664 "operands[0] = gen_lowpart (SImode, operands[0]);
17665 operands[2] = gen_lowpart (SImode, operands[2]);
17666 operands[3] = gen_lowpart (SImode, operands[3]);")
17669 ;; RTL Peephole optimizations, run before sched2. These primarily look to
17670 ;; transform a complex memory operation into two memory to register operations.
17672 ;; Don't push memory operands
17674 [(set (match_operand:SI 0 "push_operand" "")
17675 (match_operand:SI 1 "memory_operand" ""))
17676 (match_scratch:SI 2 "r")]
17677 "! optimize_size && ! TARGET_PUSH_MEMORY"
17678 [(set (match_dup 2) (match_dup 1))
17679 (set (match_dup 0) (match_dup 2))]
17683 [(set (match_operand:DI 0 "push_operand" "")
17684 (match_operand:DI 1 "memory_operand" ""))
17685 (match_scratch:DI 2 "r")]
17686 "! optimize_size && ! TARGET_PUSH_MEMORY"
17687 [(set (match_dup 2) (match_dup 1))
17688 (set (match_dup 0) (match_dup 2))]
17691 ;; We need to handle SFmode only, because DFmode and XFmode is split to
17694 [(set (match_operand:SF 0 "push_operand" "")
17695 (match_operand:SF 1 "memory_operand" ""))
17696 (match_scratch:SF 2 "r")]
17697 "! optimize_size && ! TARGET_PUSH_MEMORY"
17698 [(set (match_dup 2) (match_dup 1))
17699 (set (match_dup 0) (match_dup 2))]
17703 [(set (match_operand:HI 0 "push_operand" "")
17704 (match_operand:HI 1 "memory_operand" ""))
17705 (match_scratch:HI 2 "r")]
17706 "! optimize_size && ! TARGET_PUSH_MEMORY"
17707 [(set (match_dup 2) (match_dup 1))
17708 (set (match_dup 0) (match_dup 2))]
17712 [(set (match_operand:QI 0 "push_operand" "")
17713 (match_operand:QI 1 "memory_operand" ""))
17714 (match_scratch:QI 2 "q")]
17715 "! optimize_size && ! TARGET_PUSH_MEMORY"
17716 [(set (match_dup 2) (match_dup 1))
17717 (set (match_dup 0) (match_dup 2))]
17720 ;; Don't move an immediate directly to memory when the instruction
17723 [(match_scratch:SI 1 "r")
17724 (set (match_operand:SI 0 "memory_operand" "")
17727 && ! TARGET_USE_MOV0
17728 && TARGET_SPLIT_LONG_MOVES
17729 && get_attr_length (insn) >= ix86_cost->large_insn
17730 && peep2_regno_dead_p (0, FLAGS_REG)"
17731 [(parallel [(set (match_dup 1) (const_int 0))
17732 (clobber (reg:CC 17))])
17733 (set (match_dup 0) (match_dup 1))]
17737 [(match_scratch:HI 1 "r")
17738 (set (match_operand:HI 0 "memory_operand" "")
17741 && ! TARGET_USE_MOV0
17742 && TARGET_SPLIT_LONG_MOVES
17743 && get_attr_length (insn) >= ix86_cost->large_insn
17744 && peep2_regno_dead_p (0, FLAGS_REG)"
17745 [(parallel [(set (match_dup 2) (const_int 0))
17746 (clobber (reg:CC 17))])
17747 (set (match_dup 0) (match_dup 1))]
17748 "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));")
17751 [(match_scratch:QI 1 "q")
17752 (set (match_operand:QI 0 "memory_operand" "")
17755 && ! TARGET_USE_MOV0
17756 && TARGET_SPLIT_LONG_MOVES
17757 && get_attr_length (insn) >= ix86_cost->large_insn
17758 && peep2_regno_dead_p (0, FLAGS_REG)"
17759 [(parallel [(set (match_dup 2) (const_int 0))
17760 (clobber (reg:CC 17))])
17761 (set (match_dup 0) (match_dup 1))]
17762 "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));")
17765 [(match_scratch:SI 2 "r")
17766 (set (match_operand:SI 0 "memory_operand" "")
17767 (match_operand:SI 1 "immediate_operand" ""))]
17769 && get_attr_length (insn) >= ix86_cost->large_insn
17770 && TARGET_SPLIT_LONG_MOVES"
17771 [(set (match_dup 2) (match_dup 1))
17772 (set (match_dup 0) (match_dup 2))]
17776 [(match_scratch:HI 2 "r")
17777 (set (match_operand:HI 0 "memory_operand" "")
17778 (match_operand:HI 1 "immediate_operand" ""))]
17779 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
17780 && TARGET_SPLIT_LONG_MOVES"
17781 [(set (match_dup 2) (match_dup 1))
17782 (set (match_dup 0) (match_dup 2))]
17786 [(match_scratch:QI 2 "q")
17787 (set (match_operand:QI 0 "memory_operand" "")
17788 (match_operand:QI 1 "immediate_operand" ""))]
17789 "! optimize_size && get_attr_length (insn) >= ix86_cost->large_insn
17790 && TARGET_SPLIT_LONG_MOVES"
17791 [(set (match_dup 2) (match_dup 1))
17792 (set (match_dup 0) (match_dup 2))]
17795 ;; Don't compare memory with zero, load and use a test instead.
17798 (compare (match_operand:SI 0 "memory_operand" "")
17800 (match_scratch:SI 3 "r")]
17801 "ix86_match_ccmode (insn, CCNOmode) && ! optimize_size"
17802 [(set (match_dup 3) (match_dup 0))
17803 (set (reg:CCNO 17) (compare:CCNO (match_dup 3) (const_int 0)))]
17806 ;; NOT is not pairable on Pentium, while XOR is, but one byte longer.
17807 ;; Don't split NOTs with a displacement operand, because resulting XOR
17808 ;; will not be pairable anyway.
17810 ;; On AMD K6, NOT is vector decoded with memory operand that can not be
17811 ;; represented using a modRM byte. The XOR replacement is long decoded,
17812 ;; so this split helps here as well.
17814 ;; Note: Can't do this as a regular split because we can't get proper
17815 ;; lifetime information then.
17818 [(set (match_operand:SI 0 "nonimmediate_operand" "")
17819 (not:SI (match_operand:SI 1 "nonimmediate_operand" "")))]
17821 && peep2_regno_dead_p (0, FLAGS_REG)
17822 && ((TARGET_PENTIUM
17823 && (GET_CODE (operands[0]) != MEM
17824 || !memory_displacement_operand (operands[0], SImode)))
17825 || (TARGET_K6 && long_memory_operand (operands[0], SImode)))"
17826 [(parallel [(set (match_dup 0)
17827 (xor:SI (match_dup 1) (const_int -1)))
17828 (clobber (reg:CC 17))])]
17832 [(set (match_operand:HI 0 "nonimmediate_operand" "")
17833 (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
17835 && peep2_regno_dead_p (0, FLAGS_REG)
17836 && ((TARGET_PENTIUM
17837 && (GET_CODE (operands[0]) != MEM
17838 || !memory_displacement_operand (operands[0], HImode)))
17839 || (TARGET_K6 && long_memory_operand (operands[0], HImode)))"
17840 [(parallel [(set (match_dup 0)
17841 (xor:HI (match_dup 1) (const_int -1)))
17842 (clobber (reg:CC 17))])]
17846 [(set (match_operand:QI 0 "nonimmediate_operand" "")
17847 (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
17849 && peep2_regno_dead_p (0, FLAGS_REG)
17850 && ((TARGET_PENTIUM
17851 && (GET_CODE (operands[0]) != MEM
17852 || !memory_displacement_operand (operands[0], QImode)))
17853 || (TARGET_K6 && long_memory_operand (operands[0], QImode)))"
17854 [(parallel [(set (match_dup 0)
17855 (xor:QI (match_dup 1) (const_int -1)))
17856 (clobber (reg:CC 17))])]
17859 ;; Non pairable "test imm, reg" instructions can be translated to
17860 ;; "and imm, reg" if reg dies. The "and" form is also shorter (one
17861 ;; byte opcode instead of two, have a short form for byte operands),
17862 ;; so do it for other CPUs as well. Given that the value was dead,
17863 ;; this should not create any new dependencies. Pass on the sub-word
17864 ;; versions if we're concerned about partial register stalls.
17868 (compare (and:SI (match_operand:SI 0 "register_operand" "")
17869 (match_operand:SI 1 "immediate_operand" ""))
17871 "ix86_match_ccmode (insn, CCNOmode)
17872 && (true_regnum (operands[0]) != 0
17873 || (GET_CODE (operands[1]) == CONST_INT
17874 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')))
17875 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17877 [(set (reg:CCNO 17)
17878 (compare:CCNO (and:SI (match_dup 0)
17882 (and:SI (match_dup 0) (match_dup 1)))])]
17885 ;; We don't need to handle HImode case, because it will be promoted to SImode
17886 ;; on ! TARGET_PARTIAL_REG_STALL
17890 (compare (and:QI (match_operand:QI 0 "register_operand" "")
17891 (match_operand:QI 1 "immediate_operand" ""))
17893 "! TARGET_PARTIAL_REG_STALL
17894 && ix86_match_ccmode (insn, CCNOmode)
17895 && true_regnum (operands[0]) != 0
17896 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17898 [(set (reg:CCNO 17)
17899 (compare:CCNO (and:QI (match_dup 0)
17903 (and:QI (match_dup 0) (match_dup 1)))])]
17911 (match_operand 0 "ext_register_operand" "")
17914 (match_operand 1 "const_int_operand" ""))
17916 "! TARGET_PARTIAL_REG_STALL
17917 && ix86_match_ccmode (insn, CCNOmode)
17918 && true_regnum (operands[0]) != 0
17919 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
17920 [(parallel [(set (reg:CCNO 17)
17929 (set (zero_extract:SI (match_dup 0)
17940 ;; Don't do logical operations with memory inputs.
17942 [(match_scratch:SI 2 "r")
17943 (parallel [(set (match_operand:SI 0 "register_operand" "")
17944 (match_operator:SI 3 "arith_or_logical_operator"
17946 (match_operand:SI 1 "memory_operand" "")]))
17947 (clobber (reg:CC 17))])]
17948 "! optimize_size && ! TARGET_READ_MODIFY"
17949 [(set (match_dup 2) (match_dup 1))
17950 (parallel [(set (match_dup 0)
17951 (match_op_dup 3 [(match_dup 0) (match_dup 2)]))
17952 (clobber (reg:CC 17))])]
17956 [(match_scratch:SI 2 "r")
17957 (parallel [(set (match_operand:SI 0 "register_operand" "")
17958 (match_operator:SI 3 "arith_or_logical_operator"
17959 [(match_operand:SI 1 "memory_operand" "")
17961 (clobber (reg:CC 17))])]
17962 "! optimize_size && ! TARGET_READ_MODIFY"
17963 [(set (match_dup 2) (match_dup 1))
17964 (parallel [(set (match_dup 0)
17965 (match_op_dup 3 [(match_dup 2) (match_dup 0)]))
17966 (clobber (reg:CC 17))])]
17969 ; Don't do logical operations with memory outputs
17971 ; These two don't make sense for PPro/PII -- we're expanding a 4-uop
17972 ; instruction into two 1-uop insns plus a 2-uop insn. That last has
17973 ; the same decoder scheduling characteristics as the original.
17976 [(match_scratch:SI 2 "r")
17977 (parallel [(set (match_operand:SI 0 "memory_operand" "")
17978 (match_operator:SI 3 "arith_or_logical_operator"
17980 (match_operand:SI 1 "nonmemory_operand" "")]))
17981 (clobber (reg:CC 17))])]
17982 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
17983 [(set (match_dup 2) (match_dup 0))
17984 (parallel [(set (match_dup 2)
17985 (match_op_dup 3 [(match_dup 2) (match_dup 1)]))
17986 (clobber (reg:CC 17))])
17987 (set (match_dup 0) (match_dup 2))]
17991 [(match_scratch:SI 2 "r")
17992 (parallel [(set (match_operand:SI 0 "memory_operand" "")
17993 (match_operator:SI 3 "arith_or_logical_operator"
17994 [(match_operand:SI 1 "nonmemory_operand" "")
17996 (clobber (reg:CC 17))])]
17997 "! optimize_size && ! TARGET_READ_MODIFY_WRITE"
17998 [(set (match_dup 2) (match_dup 0))
17999 (parallel [(set (match_dup 2)
18000 (match_op_dup 3 [(match_dup 1) (match_dup 2)]))
18001 (clobber (reg:CC 17))])
18002 (set (match_dup 0) (match_dup 2))]
18005 ;; Attempt to always use XOR for zeroing registers.
18007 [(set (match_operand 0 "register_operand" "")
18009 "(GET_MODE (operands[0]) == QImode
18010 || GET_MODE (operands[0]) == HImode
18011 || GET_MODE (operands[0]) == SImode
18012 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
18013 && (! TARGET_USE_MOV0 || optimize_size)
18014 && peep2_regno_dead_p (0, FLAGS_REG)"
18015 [(parallel [(set (match_dup 0) (const_int 0))
18016 (clobber (reg:CC 17))])]
18017 "operands[0] = gen_rtx_REG (GET_MODE (operands[0]) == DImode ? DImode : SImode,
18018 true_regnum (operands[0]));")
18021 [(set (strict_low_part (match_operand 0 "register_operand" ""))
18023 "(GET_MODE (operands[0]) == QImode
18024 || GET_MODE (operands[0]) == HImode)
18025 && (! TARGET_USE_MOV0 || optimize_size)
18026 && peep2_regno_dead_p (0, FLAGS_REG)"
18027 [(parallel [(set (strict_low_part (match_dup 0)) (const_int 0))
18028 (clobber (reg:CC 17))])])
18030 ;; For HI and SI modes, or $-1,reg is smaller than mov $-1,reg.
18032 [(set (match_operand 0 "register_operand" "")
18034 "(GET_MODE (operands[0]) == HImode
18035 || GET_MODE (operands[0]) == SImode
18036 || (GET_MODE (operands[0]) == DImode && TARGET_64BIT))
18037 && (optimize_size || TARGET_PENTIUM)
18038 && peep2_regno_dead_p (0, FLAGS_REG)"
18039 [(parallel [(set (match_dup 0) (const_int -1))
18040 (clobber (reg:CC 17))])]
18041 "operands[0] = gen_rtx_REG (GET_MODE (operands[0]) == DImode ? DImode : SImode,
18042 true_regnum (operands[0]));")
18044 ;; Attempt to convert simple leas to adds. These can be created by
18047 [(set (match_operand:SI 0 "register_operand" "")
18048 (plus:SI (match_dup 0)
18049 (match_operand:SI 1 "nonmemory_operand" "")))]
18050 "peep2_regno_dead_p (0, FLAGS_REG)"
18051 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
18052 (clobber (reg:CC 17))])]
18056 [(set (match_operand:SI 0 "register_operand" "")
18057 (subreg:SI (plus:DI (match_operand:DI 1 "register_operand" "")
18058 (match_operand:DI 2 "nonmemory_operand" "")) 0))]
18059 "peep2_regno_dead_p (0, FLAGS_REG) && REGNO (operands[0]) == REGNO (operands[1])"
18060 [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
18061 (clobber (reg:CC 17))])]
18062 "operands[2] = gen_lowpart (SImode, operands[2]);")
18065 [(set (match_operand:DI 0 "register_operand" "")
18066 (plus:DI (match_dup 0)
18067 (match_operand:DI 1 "x86_64_general_operand" "")))]
18068 "peep2_regno_dead_p (0, FLAGS_REG)"
18069 [(parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))
18070 (clobber (reg:CC 17))])]
18074 [(set (match_operand:SI 0 "register_operand" "")
18075 (mult:SI (match_dup 0)
18076 (match_operand:SI 1 "const_int_operand" "")))]
18077 "exact_log2 (INTVAL (operands[1])) >= 0
18078 && peep2_regno_dead_p (0, FLAGS_REG)"
18079 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
18080 (clobber (reg:CC 17))])]
18081 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
18084 [(set (match_operand:DI 0 "register_operand" "")
18085 (mult:DI (match_dup 0)
18086 (match_operand:DI 1 "const_int_operand" "")))]
18087 "exact_log2 (INTVAL (operands[1])) >= 0
18088 && peep2_regno_dead_p (0, FLAGS_REG)"
18089 [(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
18090 (clobber (reg:CC 17))])]
18091 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
18094 [(set (match_operand:SI 0 "register_operand" "")
18095 (subreg:SI (mult:DI (match_operand:DI 1 "register_operand" "")
18096 (match_operand:DI 2 "const_int_operand" "")) 0))]
18097 "exact_log2 (INTVAL (operands[2])) >= 0
18098 && REGNO (operands[0]) == REGNO (operands[1])
18099 && peep2_regno_dead_p (0, FLAGS_REG)"
18100 [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
18101 (clobber (reg:CC 17))])]
18102 "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[2])));")
18104 ;; The ESP adjustments can be done by the push and pop instructions. Resulting
18105 ;; code is shorter, since push is only 1 byte, while add imm, %esp 3 bytes. On
18106 ;; many CPUs it is also faster, since special hardware to avoid esp
18107 ;; dependencies is present.
18109 ;; While some of these conversions may be done using splitters, we use peepholes
18110 ;; in order to allow combine_stack_adjustments pass to see nonobfuscated RTL.
18112 ;; Convert prologue esp subtractions to push.
18113 ;; We need register to push. In order to keep verify_flow_info happy we have
18115 ;; - use scratch and clobber it in order to avoid dependencies
18116 ;; - use already live register
18117 ;; We can't use the second way right now, since there is no reliable way how to
18118 ;; verify that given register is live. First choice will also most likely in
18119 ;; fewer dependencies. On the place of esp adjustments it is very likely that
18120 ;; call clobbered registers are dead. We may want to use base pointer as an
18121 ;; alternative when no register is available later.
18124 [(match_scratch:SI 0 "r")
18125 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -4)))
18126 (clobber (reg:CC 17))
18127 (clobber (mem:BLK (scratch)))])]
18128 "optimize_size || !TARGET_SUB_ESP_4"
18129 [(clobber (match_dup 0))
18130 (parallel [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
18131 (clobber (mem:BLK (scratch)))])])
18134 [(match_scratch:SI 0 "r")
18135 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
18136 (clobber (reg:CC 17))
18137 (clobber (mem:BLK (scratch)))])]
18138 "optimize_size || !TARGET_SUB_ESP_8"
18139 [(clobber (match_dup 0))
18140 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
18141 (parallel [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
18142 (clobber (mem:BLK (scratch)))])])
18144 ;; Convert esp subtractions to push.
18146 [(match_scratch:SI 0 "r")
18147 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -4)))
18148 (clobber (reg:CC 17))])]
18149 "optimize_size || !TARGET_SUB_ESP_4"
18150 [(clobber (match_dup 0))
18151 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))])
18154 [(match_scratch:SI 0 "r")
18155 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
18156 (clobber (reg:CC 17))])]
18157 "optimize_size || !TARGET_SUB_ESP_8"
18158 [(clobber (match_dup 0))
18159 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))
18160 (set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 0))])
18162 ;; Convert epilogue deallocator to pop.
18164 [(match_scratch:SI 0 "r")
18165 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
18166 (clobber (reg:CC 17))
18167 (clobber (mem:BLK (scratch)))])]
18168 "optimize_size || !TARGET_ADD_ESP_4"
18169 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18170 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
18171 (clobber (mem:BLK (scratch)))])]
18174 ;; Two pops case is tricky, since pop causes dependency on destination register.
18175 ;; We use two registers if available.
18177 [(match_scratch:SI 0 "r")
18178 (match_scratch:SI 1 "r")
18179 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
18180 (clobber (reg:CC 17))
18181 (clobber (mem:BLK (scratch)))])]
18182 "optimize_size || !TARGET_ADD_ESP_8"
18183 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18184 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
18185 (clobber (mem:BLK (scratch)))])
18186 (parallel [(set (match_dup 1) (mem:SI (reg:SI 7)))
18187 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
18191 [(match_scratch:SI 0 "r")
18192 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
18193 (clobber (reg:CC 17))
18194 (clobber (mem:BLK (scratch)))])]
18196 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18197 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
18198 (clobber (mem:BLK (scratch)))])
18199 (parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18200 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
18203 ;; Convert esp additions to pop.
18205 [(match_scratch:SI 0 "r")
18206 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))
18207 (clobber (reg:CC 17))])]
18209 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18210 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
18213 ;; Two pops case is tricky, since pop causes dependency on destination register.
18214 ;; We use two registers if available.
18216 [(match_scratch:SI 0 "r")
18217 (match_scratch:SI 1 "r")
18218 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
18219 (clobber (reg:CC 17))])]
18221 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18222 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])
18223 (parallel [(set (match_dup 1) (mem:SI (reg:SI 7)))
18224 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
18228 [(match_scratch:SI 0 "r")
18229 (parallel [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 8)))
18230 (clobber (reg:CC 17))])]
18232 [(parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18233 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])
18234 (parallel [(set (match_dup 0) (mem:SI (reg:SI 7)))
18235 (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])]
18238 ;; Convert compares with 1 to shorter inc/dec operations when CF is not
18239 ;; required and register dies.
18242 (compare (match_operand:SI 0 "register_operand" "")
18243 (match_operand:SI 1 "incdec_operand" "")))]
18244 "ix86_match_ccmode (insn, CCGCmode)
18245 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
18246 [(parallel [(set (reg:CCGC 17)
18247 (compare:CCGC (match_dup 0)
18249 (clobber (match_dup 0))])]
18254 (compare (match_operand:HI 0 "register_operand" "")
18255 (match_operand:HI 1 "incdec_operand" "")))]
18256 "ix86_match_ccmode (insn, CCGCmode)
18257 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
18258 [(parallel [(set (reg:CCGC 17)
18259 (compare:CCGC (match_dup 0)
18261 (clobber (match_dup 0))])]
18266 (compare (match_operand:QI 0 "register_operand" "")
18267 (match_operand:QI 1 "incdec_operand" "")))]
18268 "ix86_match_ccmode (insn, CCGCmode)
18269 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
18270 [(parallel [(set (reg:CCGC 17)
18271 (compare:CCGC (match_dup 0)
18273 (clobber (match_dup 0))])]
18276 ;; Convert compares with 128 to shorter add -128
18279 (compare (match_operand:SI 0 "register_operand" "")
18281 "ix86_match_ccmode (insn, CCGCmode)
18282 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
18283 [(parallel [(set (reg:CCGC 17)
18284 (compare:CCGC (match_dup 0)
18286 (clobber (match_dup 0))])]
18291 (compare (match_operand:HI 0 "register_operand" "")
18293 "ix86_match_ccmode (insn, CCGCmode)
18294 && find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
18295 [(parallel [(set (reg:CCGC 17)
18296 (compare:CCGC (match_dup 0)
18298 (clobber (match_dup 0))])]
18302 [(match_scratch:DI 0 "r")
18303 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
18304 (clobber (reg:CC 17))
18305 (clobber (mem:BLK (scratch)))])]
18306 "optimize_size || !TARGET_SUB_ESP_4"
18307 [(clobber (match_dup 0))
18308 (parallel [(set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
18309 (clobber (mem:BLK (scratch)))])])
18312 [(match_scratch:DI 0 "r")
18313 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
18314 (clobber (reg:CC 17))
18315 (clobber (mem:BLK (scratch)))])]
18316 "optimize_size || !TARGET_SUB_ESP_8"
18317 [(clobber (match_dup 0))
18318 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
18319 (parallel [(set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
18320 (clobber (mem:BLK (scratch)))])])
18322 ;; Convert esp subtractions to push.
18324 [(match_scratch:DI 0 "r")
18325 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -8)))
18326 (clobber (reg:CC 17))])]
18327 "optimize_size || !TARGET_SUB_ESP_4"
18328 [(clobber (match_dup 0))
18329 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))])
18332 [(match_scratch:DI 0 "r")
18333 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16)))
18334 (clobber (reg:CC 17))])]
18335 "optimize_size || !TARGET_SUB_ESP_8"
18336 [(clobber (match_dup 0))
18337 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))
18338 (set (mem:DI (pre_dec:DI (reg:DI 7))) (match_dup 0))])
18340 ;; Convert epilogue deallocator to pop.
18342 [(match_scratch:DI 0 "r")
18343 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
18344 (clobber (reg:CC 17))
18345 (clobber (mem:BLK (scratch)))])]
18346 "optimize_size || !TARGET_ADD_ESP_4"
18347 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18348 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
18349 (clobber (mem:BLK (scratch)))])]
18352 ;; Two pops case is tricky, since pop causes dependency on destination register.
18353 ;; We use two registers if available.
18355 [(match_scratch:DI 0 "r")
18356 (match_scratch:DI 1 "r")
18357 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
18358 (clobber (reg:CC 17))
18359 (clobber (mem:BLK (scratch)))])]
18360 "optimize_size || !TARGET_ADD_ESP_8"
18361 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18362 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
18363 (clobber (mem:BLK (scratch)))])
18364 (parallel [(set (match_dup 1) (mem:DI (reg:DI 7)))
18365 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
18369 [(match_scratch:DI 0 "r")
18370 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
18371 (clobber (reg:CC 17))
18372 (clobber (mem:BLK (scratch)))])]
18374 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18375 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
18376 (clobber (mem:BLK (scratch)))])
18377 (parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18378 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
18381 ;; Convert esp additions to pop.
18383 [(match_scratch:DI 0 "r")
18384 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))
18385 (clobber (reg:CC 17))])]
18387 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18388 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
18391 ;; Two pops case is tricky, since pop causes dependency on destination register.
18392 ;; We use two registers if available.
18394 [(match_scratch:DI 0 "r")
18395 (match_scratch:DI 1 "r")
18396 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
18397 (clobber (reg:CC 17))])]
18399 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18400 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])
18401 (parallel [(set (match_dup 1) (mem:DI (reg:DI 7)))
18402 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
18406 [(match_scratch:DI 0 "r")
18407 (parallel [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 16)))
18408 (clobber (reg:CC 17))])]
18410 [(parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18411 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])
18412 (parallel [(set (match_dup 0) (mem:DI (reg:DI 7)))
18413 (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])]
18416 ;; Imul $32bit_imm, mem, reg is vector decoded, while
18417 ;; imul $32bit_imm, reg, reg is direct decoded.
18419 [(match_scratch:DI 3 "r")
18420 (parallel [(set (match_operand:DI 0 "register_operand" "")
18421 (mult:DI (match_operand:DI 1 "memory_operand" "")
18422 (match_operand:DI 2 "immediate_operand" "")))
18423 (clobber (reg:CC 17))])]
18424 "TARGET_K8 && !optimize_size
18425 && (GET_CODE (operands[2]) != CONST_INT
18426 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
18427 [(set (match_dup 3) (match_dup 1))
18428 (parallel [(set (match_dup 0) (mult:DI (match_dup 3) (match_dup 2)))
18429 (clobber (reg:CC 17))])]
18433 [(match_scratch:SI 3 "r")
18434 (parallel [(set (match_operand:SI 0 "register_operand" "")
18435 (mult:SI (match_operand:SI 1 "memory_operand" "")
18436 (match_operand:SI 2 "immediate_operand" "")))
18437 (clobber (reg:CC 17))])]
18438 "TARGET_K8 && !optimize_size
18439 && (GET_CODE (operands[2]) != CONST_INT
18440 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
18441 [(set (match_dup 3) (match_dup 1))
18442 (parallel [(set (match_dup 0) (mult:SI (match_dup 3) (match_dup 2)))
18443 (clobber (reg:CC 17))])]
18447 [(match_scratch:SI 3 "r")
18448 (parallel [(set (match_operand:DI 0 "register_operand" "")
18450 (mult:SI (match_operand:SI 1 "memory_operand" "")
18451 (match_operand:SI 2 "immediate_operand" ""))))
18452 (clobber (reg:CC 17))])]
18453 "TARGET_K8 && !optimize_size
18454 && (GET_CODE (operands[2]) != CONST_INT
18455 || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
18456 [(set (match_dup 3) (match_dup 1))
18457 (parallel [(set (match_dup 0) (zero_extend:DI (mult:SI (match_dup 3) (match_dup 2))))
18458 (clobber (reg:CC 17))])]
18461 ;; imul $8/16bit_imm, regmem, reg is vector decoded.
18462 ;; Convert it into imul reg, reg
18463 ;; It would be better to force assembler to encode instruction using long
18464 ;; immediate, but there is apparently no way to do so.
18466 [(parallel [(set (match_operand:DI 0 "register_operand" "")
18467 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "")
18468 (match_operand:DI 2 "const_int_operand" "")))
18469 (clobber (reg:CC 17))])
18470 (match_scratch:DI 3 "r")]
18471 "TARGET_K8 && !optimize_size
18472 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
18473 [(set (match_dup 3) (match_dup 2))
18474 (parallel [(set (match_dup 0) (mult:DI (match_dup 0) (match_dup 3)))
18475 (clobber (reg:CC 17))])]
18477 if (!rtx_equal_p (operands[0], operands[1]))
18478 emit_move_insn (operands[0], operands[1]);
18482 [(parallel [(set (match_operand:SI 0 "register_operand" "")
18483 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "")
18484 (match_operand:SI 2 "const_int_operand" "")))
18485 (clobber (reg:CC 17))])
18486 (match_scratch:SI 3 "r")]
18487 "TARGET_K8 && !optimize_size
18488 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
18489 [(set (match_dup 3) (match_dup 2))
18490 (parallel [(set (match_dup 0) (mult:SI (match_dup 0) (match_dup 3)))
18491 (clobber (reg:CC 17))])]
18493 if (!rtx_equal_p (operands[0], operands[1]))
18494 emit_move_insn (operands[0], operands[1]);
18498 [(parallel [(set (match_operand:HI 0 "register_operand" "")
18499 (mult:HI (match_operand:HI 1 "nonimmediate_operand" "")
18500 (match_operand:HI 2 "immediate_operand" "")))
18501 (clobber (reg:CC 17))])
18502 (match_scratch:HI 3 "r")]
18503 "TARGET_K8 && !optimize_size"
18504 [(set (match_dup 3) (match_dup 2))
18505 (parallel [(set (match_dup 0) (mult:HI (match_dup 0) (match_dup 3)))
18506 (clobber (reg:CC 17))])]
18508 if (!rtx_equal_p (operands[0], operands[1]))
18509 emit_move_insn (operands[0], operands[1]);
18512 ;; Call-value patterns last so that the wildcard operand does not
18513 ;; disrupt insn-recog's switch tables.
18515 (define_insn "*call_value_pop_0"
18516 [(set (match_operand 0 "" "")
18517 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
18518 (match_operand:SI 2 "" "")))
18519 (set (reg:SI 7) (plus:SI (reg:SI 7)
18520 (match_operand:SI 3 "immediate_operand" "")))]
18523 if (SIBLING_CALL_P (insn))
18526 return "call\t%P1";
18528 [(set_attr "type" "callv")])
18530 (define_insn "*call_value_pop_1"
18531 [(set (match_operand 0 "" "")
18532 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
18533 (match_operand:SI 2 "" "")))
18534 (set (reg:SI 7) (plus:SI (reg:SI 7)
18535 (match_operand:SI 3 "immediate_operand" "i")))]
18538 if (constant_call_address_operand (operands[1], QImode))
18540 if (SIBLING_CALL_P (insn))
18543 return "call\t%P1";
18545 if (SIBLING_CALL_P (insn))
18548 return "call\t%A1";
18550 [(set_attr "type" "callv")])
18552 (define_insn "*call_value_0"
18553 [(set (match_operand 0 "" "")
18554 (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
18555 (match_operand:SI 2 "" "")))]
18558 if (SIBLING_CALL_P (insn))
18561 return "call\t%P1";
18563 [(set_attr "type" "callv")])
18565 (define_insn "*call_value_0_rex64"
18566 [(set (match_operand 0 "" "")
18567 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
18568 (match_operand:DI 2 "const_int_operand" "")))]
18571 if (SIBLING_CALL_P (insn))
18574 return "call\t%P1";
18576 [(set_attr "type" "callv")])
18578 (define_insn "*call_value_1"
18579 [(set (match_operand 0 "" "")
18580 (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm"))
18581 (match_operand:SI 2 "" "")))]
18582 "!SIBLING_CALL_P (insn) && !TARGET_64BIT"
18584 if (constant_call_address_operand (operands[1], QImode))
18585 return "call\t%P1";
18586 return "call\t%*%1";
18588 [(set_attr "type" "callv")])
18590 (define_insn "*sibcall_value_1"
18591 [(set (match_operand 0 "" "")
18592 (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,c,d,a"))
18593 (match_operand:SI 2 "" "")))]
18594 "SIBLING_CALL_P (insn) && !TARGET_64BIT"
18596 if (constant_call_address_operand (operands[1], QImode))
18598 return "jmp\t%*%1";
18600 [(set_attr "type" "callv")])
18602 (define_insn "*call_value_1_rex64"
18603 [(set (match_operand 0 "" "")
18604 (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm"))
18605 (match_operand:DI 2 "" "")))]
18606 "!SIBLING_CALL_P (insn) && TARGET_64BIT"
18608 if (constant_call_address_operand (operands[1], QImode))
18609 return "call\t%P1";
18610 return "call\t%A1";
18612 [(set_attr "type" "callv")])
18614 (define_insn "*sibcall_value_1_rex64"
18615 [(set (match_operand 0 "" "")
18616 (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" ""))
18617 (match_operand:DI 2 "" "")))]
18618 "SIBLING_CALL_P (insn) && TARGET_64BIT"
18620 [(set_attr "type" "callv")])
18622 (define_insn "*sibcall_value_1_rex64_v"
18623 [(set (match_operand 0 "" "")
18624 (call (mem:QI (reg:DI 40))
18625 (match_operand:DI 1 "" "")))]
18626 "SIBLING_CALL_P (insn) && TARGET_64BIT"
18628 [(set_attr "type" "callv")])
18630 (define_insn "trap"
18631 [(trap_if (const_int 1) (const_int 5))]
18635 ;;; ix86 doesn't have conditional trap instructions, but we fake them
18636 ;;; for the sake of bounds checking. By emitting bounds checks as
18637 ;;; conditional traps rather than as conditional jumps around
18638 ;;; unconditional traps we avoid introducing spurious basic-block
18639 ;;; boundaries and facilitate elimination of redundant checks. In
18640 ;;; honor of the too-inflexible-for-BPs `bound' instruction, we use
18643 ;;; FIXME: Static branch prediction rules for ix86 are such that
18644 ;;; forward conditional branches predict as untaken. As implemented
18645 ;;; below, pseudo conditional traps violate that rule. We should use
18646 ;;; .pushsection/.popsection to place all of the `int 5's in a special
18647 ;;; section loaded at the end of the text segment and branch forward
18648 ;;; there on bounds-failure, and then jump back immediately (in case
18649 ;;; the system chooses to ignore bounds violations, or to report
18650 ;;; violations and continue execution).
18652 (define_expand "conditional_trap"
18653 [(trap_if (match_operator 0 "comparison_operator"
18654 [(match_dup 2) (const_int 0)])
18655 (match_operand 1 "const_int_operand" ""))]
18658 emit_insn (gen_rtx_TRAP_IF (VOIDmode,
18659 ix86_expand_compare (GET_CODE (operands[0]),
18665 (define_insn "*conditional_trap_1"
18666 [(trap_if (match_operator 0 "comparison_operator"
18667 [(reg 17) (const_int 0)])
18668 (match_operand 1 "const_int_operand" ""))]
18671 operands[2] = gen_label_rtx ();
18672 output_asm_insn ("j%c0\t%l2\; int\t%1", operands);
18673 (*targetm.asm_out.internal_label) (asm_out_file, "L",
18674 CODE_LABEL_NUMBER (operands[2]));
18678 ;; Pentium III SIMD instructions.
18680 ;; Moves for SSE/MMX regs.
18682 (define_insn "movv4sf_internal"
18683 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
18684 (match_operand:V4SF 1 "nonimmediate_operand" "xm,x"))]
18686 "movaps\t{%1, %0|%0, %1}"
18687 [(set_attr "type" "ssemov")
18688 (set_attr "mode" "V4SF")])
18691 [(set (match_operand:V4SF 0 "register_operand" "")
18692 (match_operand:V4SF 1 "zero_extended_scalar_load_operand" ""))]
18694 [(set (match_dup 0)
18696 (vec_duplicate:V4SF (match_dup 1))
18700 operands[1] = simplify_gen_subreg (SFmode, operands[1], V4SFmode, 0);
18701 operands[2] = CONST0_RTX (V4SFmode);
18704 (define_insn "movv4si_internal"
18705 [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,m")
18706 (match_operand:V4SI 1 "nonimmediate_operand" "xm,x"))]
18709 if (get_attr_mode (insn) == MODE_V4SF)
18710 return "movaps\t{%1, %0|%0, %1}";
18712 return "movdqa\t{%1, %0|%0, %1}";
18714 [(set_attr "type" "ssemov")
18716 (cond [(eq_attr "alternative" "0")
18718 (ne (symbol_ref "optimize_size")
18720 (const_string "V4SF")
18721 (const_string "TI"))
18722 (eq_attr "alternative" "1")
18724 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
18726 (ne (symbol_ref "optimize_size")
18728 (const_string "V4SF")
18729 (const_string "TI"))]
18730 (const_string "TI")))])
18732 (define_insn "movv2di_internal"
18733 [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x,m")
18734 (match_operand:V2DI 1 "nonimmediate_operand" "xm,x"))]
18737 if (get_attr_mode (insn) == MODE_V4SF)
18738 return "movaps\t{%1, %0|%0, %1}";
18740 return "movdqa\t{%1, %0|%0, %1}";
18742 [(set_attr "type" "ssemov")
18744 (cond [(eq_attr "alternative" "0")
18746 (ne (symbol_ref "optimize_size")
18748 (const_string "V4SF")
18749 (const_string "TI"))
18750 (eq_attr "alternative" "1")
18752 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
18754 (ne (symbol_ref "optimize_size")
18756 (const_string "V4SF")
18757 (const_string "TI"))]
18758 (const_string "TI")))])
18761 [(set (match_operand:V2DF 0 "register_operand" "")
18762 (match_operand:V2DF 1 "zero_extended_scalar_load_operand" ""))]
18764 [(set (match_dup 0)
18766 (vec_duplicate:V2DF (match_dup 1))
18770 operands[1] = simplify_gen_subreg (DFmode, operands[1], V2DFmode, 0);
18771 operands[2] = CONST0_RTX (V2DFmode);
18774 (define_insn "movv8qi_internal"
18775 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
18776 (match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
18778 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18779 "movq\t{%1, %0|%0, %1}"
18780 [(set_attr "type" "mmxmov")
18781 (set_attr "mode" "DI")])
18783 (define_insn "movv4hi_internal"
18784 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
18785 (match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
18787 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18788 "movq\t{%1, %0|%0, %1}"
18789 [(set_attr "type" "mmxmov")
18790 (set_attr "mode" "DI")])
18792 (define_insn "movv2si_internal"
18793 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
18794 (match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
18796 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18797 "movq\t{%1, %0|%0, %1}"
18798 [(set_attr "type" "mmxcvt")
18799 (set_attr "mode" "DI")])
18801 (define_insn "movv2sf_internal"
18802 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
18803 (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
18805 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18806 "movq\\t{%1, %0|%0, %1}"
18807 [(set_attr "type" "mmxcvt")
18808 (set_attr "mode" "DI")])
18810 (define_expand "movti"
18811 [(set (match_operand:TI 0 "nonimmediate_operand" "")
18812 (match_operand:TI 1 "nonimmediate_operand" ""))]
18813 "TARGET_SSE || TARGET_64BIT"
18816 ix86_expand_move (TImode, operands);
18818 ix86_expand_vector_move (TImode, operands);
18822 (define_insn "movv2df_internal"
18823 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
18824 (match_operand:V2DF 1 "nonimmediate_operand" "xm,x"))]
18826 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18828 if (get_attr_mode (insn) == MODE_V4SF)
18829 return "movaps\t{%1, %0|%0, %1}";
18831 return "movapd\t{%1, %0|%0, %1}";
18833 [(set_attr "type" "ssemov")
18835 (cond [(eq_attr "alternative" "0")
18837 (ne (symbol_ref "optimize_size")
18839 (const_string "V4SF")
18840 (const_string "V2DF"))
18841 (eq_attr "alternative" "1")
18843 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
18845 (ne (symbol_ref "optimize_size")
18847 (const_string "V4SF")
18848 (const_string "V2DF"))]
18849 (const_string "V2DF")))])
18851 (define_insn "movv8hi_internal"
18852 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
18853 (match_operand:V8HI 1 "nonimmediate_operand" "xm,x"))]
18855 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18857 if (get_attr_mode (insn) == MODE_V4SF)
18858 return "movaps\t{%1, %0|%0, %1}";
18860 return "movdqa\t{%1, %0|%0, %1}";
18862 [(set_attr "type" "ssemov")
18864 (cond [(eq_attr "alternative" "0")
18866 (ne (symbol_ref "optimize_size")
18868 (const_string "V4SF")
18869 (const_string "TI"))
18870 (eq_attr "alternative" "1")
18872 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
18874 (ne (symbol_ref "optimize_size")
18876 (const_string "V4SF")
18877 (const_string "TI"))]
18878 (const_string "TI")))])
18880 (define_insn "movv16qi_internal"
18881 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
18882 (match_operand:V16QI 1 "nonimmediate_operand" "xm,x"))]
18884 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
18886 if (get_attr_mode (insn) == MODE_V4SF)
18887 return "movaps\t{%1, %0|%0, %1}";
18889 return "movdqa\t{%1, %0|%0, %1}";
18891 [(set_attr "type" "ssemov")
18893 (cond [(eq_attr "alternative" "0")
18895 (ne (symbol_ref "optimize_size")
18897 (const_string "V4SF")
18898 (const_string "TI"))
18899 (eq_attr "alternative" "1")
18901 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
18903 (ne (symbol_ref "optimize_size")
18905 (const_string "V4SF")
18906 (const_string "TI"))]
18907 (const_string "TI")))])
18909 (define_expand "movv2df"
18910 [(set (match_operand:V2DF 0 "nonimmediate_operand" "")
18911 (match_operand:V2DF 1 "nonimmediate_operand" ""))]
18914 ix86_expand_vector_move (V2DFmode, operands);
18918 (define_expand "movv8hi"
18919 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
18920 (match_operand:V8HI 1 "nonimmediate_operand" ""))]
18923 ix86_expand_vector_move (V8HImode, operands);
18927 (define_expand "movv16qi"
18928 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
18929 (match_operand:V16QI 1 "nonimmediate_operand" ""))]
18932 ix86_expand_vector_move (V16QImode, operands);
18936 (define_expand "movv4sf"
18937 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
18938 (match_operand:V4SF 1 "nonimmediate_operand" ""))]
18941 ix86_expand_vector_move (V4SFmode, operands);
18945 (define_expand "movv4si"
18946 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
18947 (match_operand:V4SI 1 "nonimmediate_operand" ""))]
18950 ix86_expand_vector_move (V4SImode, operands);
18954 (define_expand "movv2di"
18955 [(set (match_operand:V2DI 0 "nonimmediate_operand" "")
18956 (match_operand:V2DI 1 "nonimmediate_operand" ""))]
18959 ix86_expand_vector_move (V2DImode, operands);
18963 (define_expand "movv2si"
18964 [(set (match_operand:V2SI 0 "nonimmediate_operand" "")
18965 (match_operand:V2SI 1 "nonimmediate_operand" ""))]
18968 ix86_expand_vector_move (V2SImode, operands);
18972 (define_expand "movv4hi"
18973 [(set (match_operand:V4HI 0 "nonimmediate_operand" "")
18974 (match_operand:V4HI 1 "nonimmediate_operand" ""))]
18977 ix86_expand_vector_move (V4HImode, operands);
18981 (define_expand "movv8qi"
18982 [(set (match_operand:V8QI 0 "nonimmediate_operand" "")
18983 (match_operand:V8QI 1 "nonimmediate_operand" ""))]
18986 ix86_expand_vector_move (V8QImode, operands);
18990 (define_expand "movv2sf"
18991 [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
18992 (match_operand:V2SF 1 "nonimmediate_operand" ""))]
18995 ix86_expand_vector_move (V2SFmode, operands);
18999 (define_insn "*pushti"
19000 [(set (match_operand:TI 0 "push_operand" "=<")
19001 (match_operand:TI 1 "register_operand" "x"))]
19005 (define_insn "*pushv2df"
19006 [(set (match_operand:V2DF 0 "push_operand" "=<")
19007 (match_operand:V2DF 1 "register_operand" "x"))]
19011 (define_insn "*pushv2di"
19012 [(set (match_operand:V2DI 0 "push_operand" "=<")
19013 (match_operand:V2DI 1 "register_operand" "x"))]
19017 (define_insn "*pushv8hi"
19018 [(set (match_operand:V8HI 0 "push_operand" "=<")
19019 (match_operand:V8HI 1 "register_operand" "x"))]
19023 (define_insn "*pushv16qi"
19024 [(set (match_operand:V16QI 0 "push_operand" "=<")
19025 (match_operand:V16QI 1 "register_operand" "x"))]
19029 (define_insn "*pushv4sf"
19030 [(set (match_operand:V4SF 0 "push_operand" "=<")
19031 (match_operand:V4SF 1 "register_operand" "x"))]
19035 (define_insn "*pushv4si"
19036 [(set (match_operand:V4SI 0 "push_operand" "=<")
19037 (match_operand:V4SI 1 "register_operand" "x"))]
19041 (define_insn "*pushv2si"
19042 [(set (match_operand:V2SI 0 "push_operand" "=<")
19043 (match_operand:V2SI 1 "register_operand" "y"))]
19047 (define_insn "*pushv4hi"
19048 [(set (match_operand:V4HI 0 "push_operand" "=<")
19049 (match_operand:V4HI 1 "register_operand" "y"))]
19053 (define_insn "*pushv8qi"
19054 [(set (match_operand:V8QI 0 "push_operand" "=<")
19055 (match_operand:V8QI 1 "register_operand" "y"))]
19059 (define_insn "*pushv2sf"
19060 [(set (match_operand:V2SF 0 "push_operand" "=<")
19061 (match_operand:V2SF 1 "register_operand" "y"))]
19066 [(set (match_operand 0 "push_operand" "")
19067 (match_operand 1 "register_operand" ""))]
19068 "!TARGET_64BIT && reload_completed
19069 && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
19070 [(set (reg:SI 7) (plus:SI (reg:SI 7) (match_dup 3)))
19071 (set (match_dup 2) (match_dup 1))]
19072 "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
19073 stack_pointer_rtx);
19074 operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));")
19077 [(set (match_operand 0 "push_operand" "")
19078 (match_operand 1 "register_operand" ""))]
19079 "TARGET_64BIT && reload_completed
19080 && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
19081 [(set (reg:DI 7) (plus:DI (reg:DI 7) (match_dup 3)))
19082 (set (match_dup 2) (match_dup 1))]
19083 "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
19084 stack_pointer_rtx);
19085 operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));")
19088 (define_insn "movti_internal"
19089 [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
19090 (match_operand:TI 1 "general_operand" "C,xm,x"))]
19091 "TARGET_SSE && !TARGET_64BIT
19092 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19094 switch (which_alternative)
19097 if (get_attr_mode (insn) == MODE_V4SF)
19098 return "xorps\t%0, %0";
19100 return "pxor\t%0, %0";
19103 if (get_attr_mode (insn) == MODE_V4SF)
19104 return "movaps\t{%1, %0|%0, %1}";
19106 return "movdqa\t{%1, %0|%0, %1}";
19111 [(set_attr "type" "ssemov,ssemov,ssemov")
19113 (cond [(eq_attr "alternative" "0,1")
19115 (ne (symbol_ref "optimize_size")
19117 (const_string "V4SF")
19118 (const_string "TI"))
19119 (eq_attr "alternative" "2")
19121 (ne (symbol_ref "optimize_size")
19123 (const_string "V4SF")
19124 (const_string "TI"))]
19125 (const_string "TI")))])
19127 (define_insn "*movti_rex64"
19128 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,x,xm")
19129 (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))]
19131 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19133 switch (which_alternative)
19139 if (get_attr_mode (insn) == MODE_V4SF)
19140 return "xorps\t%0, %0";
19142 return "pxor\t%0, %0";
19145 if (get_attr_mode (insn) == MODE_V4SF)
19146 return "movaps\t{%1, %0|%0, %1}";
19148 return "movdqa\t{%1, %0|%0, %1}";
19153 [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
19155 (cond [(eq_attr "alternative" "2,3")
19157 (ne (symbol_ref "optimize_size")
19159 (const_string "V4SF")
19160 (const_string "TI"))
19161 (eq_attr "alternative" "4")
19163 (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES")
19165 (ne (symbol_ref "optimize_size")
19167 (const_string "V4SF")
19168 (const_string "TI"))]
19169 (const_string "DI")))])
19172 [(set (match_operand:TI 0 "nonimmediate_operand" "")
19173 (match_operand:TI 1 "general_operand" ""))]
19174 "reload_completed && !SSE_REG_P (operands[0])
19175 && !SSE_REG_P (operands[1])"
19177 "ix86_split_long_move (operands); DONE;")
19179 ;; These two patterns are useful for specifying exactly whether to use
19180 ;; movaps or movups
19181 (define_insn "sse_movaps"
19182 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
19183 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
19186 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19187 "movaps\t{%1, %0|%0, %1}"
19188 [(set_attr "type" "ssemov,ssemov")
19189 (set_attr "mode" "V4SF")])
19191 (define_insn "sse_movups"
19192 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
19193 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
19196 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
19197 "movups\t{%1, %0|%0, %1}"
19198 [(set_attr "type" "ssecvt,ssecvt")
19199 (set_attr "mode" "V4SF")])
19202 ;; SSE Strange Moves.
19204 (define_insn "sse_movmskps"
19205 [(set (match_operand:SI 0 "register_operand" "=r")
19206 (unspec:SI [(match_operand:V4SF 1 "register_operand" "x")]
19209 "movmskps\t{%1, %0|%0, %1}"
19210 [(set_attr "type" "ssecvt")
19211 (set_attr "mode" "V4SF")])
19213 (define_insn "mmx_pmovmskb"
19214 [(set (match_operand:SI 0 "register_operand" "=r")
19215 (unspec:SI [(match_operand:V8QI 1 "register_operand" "y")]
19217 "TARGET_SSE || TARGET_3DNOW_A"
19218 "pmovmskb\t{%1, %0|%0, %1}"
19219 [(set_attr "type" "ssecvt")
19220 (set_attr "mode" "V4SF")])
19223 (define_insn "mmx_maskmovq"
19224 [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
19225 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
19226 (match_operand:V8QI 2 "register_operand" "y")]
19228 "(TARGET_SSE || TARGET_3DNOW_A) && !TARGET_64BIT"
19229 ;; @@@ check ordering of operands in intel/nonintel syntax
19230 "maskmovq\t{%2, %1|%1, %2}"
19231 [(set_attr "type" "mmxcvt")
19232 (set_attr "mode" "DI")])
19234 (define_insn "mmx_maskmovq_rex"
19235 [(set (mem:V8QI (match_operand:DI 0 "register_operand" "D"))
19236 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "y")
19237 (match_operand:V8QI 2 "register_operand" "y")]
19239 "(TARGET_SSE || TARGET_3DNOW_A) && TARGET_64BIT"
19240 ;; @@@ check ordering of operands in intel/nonintel syntax
19241 "maskmovq\t{%2, %1|%1, %2}"
19242 [(set_attr "type" "mmxcvt")
19243 (set_attr "mode" "DI")])
19245 (define_insn "sse_movntv4sf"
19246 [(set (match_operand:V4SF 0 "memory_operand" "=m")
19247 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")]
19250 "movntps\t{%1, %0|%0, %1}"
19251 [(set_attr "type" "ssemov")
19252 (set_attr "mode" "V4SF")])
19254 (define_insn "sse_movntdi"
19255 [(set (match_operand:DI 0 "memory_operand" "=m")
19256 (unspec:DI [(match_operand:DI 1 "register_operand" "y")]
19258 "TARGET_SSE || TARGET_3DNOW_A"
19259 "movntq\t{%1, %0|%0, %1}"
19260 [(set_attr "type" "mmxmov")
19261 (set_attr "mode" "DI")])
19263 (define_insn "sse_movhlps"
19264 [(set (match_operand:V4SF 0 "register_operand" "=x")
19266 (match_operand:V4SF 1 "register_operand" "0")
19267 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
19268 (parallel [(const_int 2)
19274 "movhlps\t{%2, %0|%0, %2}"
19275 [(set_attr "type" "ssecvt")
19276 (set_attr "mode" "V4SF")])
19278 (define_insn "sse_movlhps"
19279 [(set (match_operand:V4SF 0 "register_operand" "=x")
19281 (match_operand:V4SF 1 "register_operand" "0")
19282 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
19283 (parallel [(const_int 2)
19289 "movlhps\t{%2, %0|%0, %2}"
19290 [(set_attr "type" "ssecvt")
19291 (set_attr "mode" "V4SF")])
19293 (define_insn "sse_movhps"
19294 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
19296 (match_operand:V4SF 1 "nonimmediate_operand" "0,0")
19297 (match_operand:V4SF 2 "nonimmediate_operand" "m,x")
19300 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
19301 "movhps\t{%2, %0|%0, %2}"
19302 [(set_attr "type" "ssecvt")
19303 (set_attr "mode" "V4SF")])
19305 (define_insn "sse_movlps"
19306 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
19308 (match_operand:V4SF 1 "nonimmediate_operand" "0,0")
19309 (match_operand:V4SF 2 "nonimmediate_operand" "m,x")
19312 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
19313 "movlps\t{%2, %0|%0, %2}"
19314 [(set_attr "type" "ssecvt")
19315 (set_attr "mode" "V4SF")])
19317 (define_expand "sse_loadss"
19318 [(match_operand:V4SF 0 "register_operand" "")
19319 (match_operand:SF 1 "memory_operand" "")]
19322 emit_insn (gen_sse_loadss_1 (operands[0], operands[1],
19323 CONST0_RTX (V4SFmode)));
19327 (define_insn "sse_loadss_1"
19328 [(set (match_operand:V4SF 0 "register_operand" "=x")
19330 (vec_duplicate:V4SF (match_operand:SF 1 "memory_operand" "m"))
19331 (match_operand:V4SF 2 "const0_operand" "X")
19334 "movss\t{%1, %0|%0, %1}"
19335 [(set_attr "type" "ssemov")
19336 (set_attr "mode" "SF")])
19338 (define_insn "sse_movss"
19339 [(set (match_operand:V4SF 0 "register_operand" "=x")
19341 (match_operand:V4SF 1 "register_operand" "0")
19342 (match_operand:V4SF 2 "register_operand" "x")
19345 "movss\t{%2, %0|%0, %2}"
19346 [(set_attr "type" "ssemov")
19347 (set_attr "mode" "SF")])
19349 (define_insn "sse_storess"
19350 [(set (match_operand:SF 0 "memory_operand" "=m")
19352 (match_operand:V4SF 1 "register_operand" "x")
19353 (parallel [(const_int 0)])))]
19355 "movss\t{%1, %0|%0, %1}"
19356 [(set_attr "type" "ssemov")
19357 (set_attr "mode" "SF")])
19359 (define_insn "sse_shufps"
19360 [(set (match_operand:V4SF 0 "register_operand" "=x")
19361 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0")
19362 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
19363 (match_operand:SI 3 "immediate_operand" "i")]
19366 ;; @@@ check operand order for intel/nonintel syntax
19367 "shufps\t{%3, %2, %0|%0, %2, %3}"
19368 [(set_attr "type" "ssecvt")
19369 (set_attr "mode" "V4SF")])
19374 (define_insn "addv4sf3"
19375 [(set (match_operand:V4SF 0 "register_operand" "=x")
19376 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
19377 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
19379 "addps\t{%2, %0|%0, %2}"
19380 [(set_attr "type" "sseadd")
19381 (set_attr "mode" "V4SF")])
19383 (define_insn "vmaddv4sf3"
19384 [(set (match_operand:V4SF 0 "register_operand" "=x")
19386 (plus:V4SF (match_operand:V4SF 1 "register_operand" "0")
19387 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
19391 "addss\t{%2, %0|%0, %2}"
19392 [(set_attr "type" "sseadd")
19393 (set_attr "mode" "SF")])
19395 (define_insn "subv4sf3"
19396 [(set (match_operand:V4SF 0 "register_operand" "=x")
19397 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
19398 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
19400 "subps\t{%2, %0|%0, %2}"
19401 [(set_attr "type" "sseadd")
19402 (set_attr "mode" "V4SF")])
19404 (define_insn "vmsubv4sf3"
19405 [(set (match_operand:V4SF 0 "register_operand" "=x")
19407 (minus:V4SF (match_operand:V4SF 1 "register_operand" "0")
19408 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
19412 "subss\t{%2, %0|%0, %2}"
19413 [(set_attr "type" "sseadd")
19414 (set_attr "mode" "SF")])
19416 (define_insn "mulv4sf3"
19417 [(set (match_operand:V4SF 0 "register_operand" "=x")
19418 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
19419 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
19421 "mulps\t{%2, %0|%0, %2}"
19422 [(set_attr "type" "ssemul")
19423 (set_attr "mode" "V4SF")])
19425 (define_insn "vmmulv4sf3"
19426 [(set (match_operand:V4SF 0 "register_operand" "=x")
19428 (mult:V4SF (match_operand:V4SF 1 "register_operand" "0")
19429 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
19433 "mulss\t{%2, %0|%0, %2}"
19434 [(set_attr "type" "ssemul")
19435 (set_attr "mode" "SF")])
19437 (define_insn "divv4sf3"
19438 [(set (match_operand:V4SF 0 "register_operand" "=x")
19439 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
19440 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
19442 "divps\t{%2, %0|%0, %2}"
19443 [(set_attr "type" "ssediv")
19444 (set_attr "mode" "V4SF")])
19446 (define_insn "vmdivv4sf3"
19447 [(set (match_operand:V4SF 0 "register_operand" "=x")
19449 (div:V4SF (match_operand:V4SF 1 "register_operand" "0")
19450 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
19454 "divss\t{%2, %0|%0, %2}"
19455 [(set_attr "type" "ssediv")
19456 (set_attr "mode" "SF")])
19459 ;; SSE square root/reciprocal
19461 (define_insn "rcpv4sf2"
19462 [(set (match_operand:V4SF 0 "register_operand" "=x")
19464 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RCP))]
19466 "rcpps\t{%1, %0|%0, %1}"
19467 [(set_attr "type" "sse")
19468 (set_attr "mode" "V4SF")])
19470 (define_insn "vmrcpv4sf2"
19471 [(set (match_operand:V4SF 0 "register_operand" "=x")
19473 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
19475 (match_operand:V4SF 2 "register_operand" "0")
19478 "rcpss\t{%1, %0|%0, %1}"
19479 [(set_attr "type" "sse")
19480 (set_attr "mode" "SF")])
19482 (define_insn "rsqrtv4sf2"
19483 [(set (match_operand:V4SF 0 "register_operand" "=x")
19485 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_RSQRT))]
19487 "rsqrtps\t{%1, %0|%0, %1}"
19488 [(set_attr "type" "sse")
19489 (set_attr "mode" "V4SF")])
19491 (define_insn "vmrsqrtv4sf2"
19492 [(set (match_operand:V4SF 0 "register_operand" "=x")
19494 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
19496 (match_operand:V4SF 2 "register_operand" "0")
19499 "rsqrtss\t{%1, %0|%0, %1}"
19500 [(set_attr "type" "sse")
19501 (set_attr "mode" "SF")])
19503 (define_insn "sqrtv4sf2"
19504 [(set (match_operand:V4SF 0 "register_operand" "=x")
19505 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
19507 "sqrtps\t{%1, %0|%0, %1}"
19508 [(set_attr "type" "sse")
19509 (set_attr "mode" "V4SF")])
19511 (define_insn "vmsqrtv4sf2"
19512 [(set (match_operand:V4SF 0 "register_operand" "=x")
19514 (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
19515 (match_operand:V4SF 2 "register_operand" "0")
19518 "sqrtss\t{%1, %0|%0, %1}"
19519 [(set_attr "type" "sse")
19520 (set_attr "mode" "SF")])
19522 ;; SSE logical operations.
19524 ;; SSE defines logical operations on floating point values. This brings
19525 ;; interesting challenge to RTL representation where logicals are only valid
19526 ;; on integral types. We deal with this by representing the floating point
19527 ;; logical as logical on arguments casted to TImode as this is what hardware
19528 ;; really does. Unfortunately hardware requires the type information to be
19529 ;; present and thus we must avoid subregs from being simplified and eliminated
19530 ;; in later compilation phases.
19532 ;; We have following variants from each instruction:
19533 ;; sse_andsf3 - the operation taking V4SF vector operands
19534 ;; and doing TImode cast on them
19535 ;; *sse_andsf3_memory - the operation taking one memory operand casted to
19536 ;; TImode, since backend insist on eliminating casts
19537 ;; on memory operands
19538 ;; sse_andti3_sf_1 - the operation taking SF scalar operands.
19539 ;; We can not accept memory operand here as instruction reads
19540 ;; whole scalar. This is generated only post reload by GCC
19541 ;; scalar float operations that expands to logicals (fabs)
19542 ;; sse_andti3_sf_2 - the operation taking SF scalar input and TImode
19543 ;; memory operand. Eventually combine can be able
19544 ;; to synthesize these using splitter.
19545 ;; sse2_anddf3, *sse2_anddf3_memory
19548 ;; These are not called andti3 etc. because we really really don't want
19549 ;; the compiler to widen DImode ands to TImode ands and then try to move
19550 ;; into DImode subregs of SSE registers, and them together, and move out
19551 ;; of DImode subregs again!
19552 ;; SSE1 single precision floating point logical operation
19553 (define_expand "sse_andv4sf3"
19554 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "") 0)
19555 (and:TI (subreg:TI (match_operand:V4SF 1 "register_operand" "") 0)
19556 (subreg:TI (match_operand:V4SF 2 "nonimmediate_operand" "") 0)))]
19560 (define_insn "*sse_andv4sf3"
19561 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "=x") 0)
19562 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19563 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19565 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19566 "andps\t{%2, %0|%0, %2}"
19567 [(set_attr "type" "sselog")
19568 (set_attr "mode" "V4SF")])
19570 (define_insn "*sse_andsf3"
19571 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
19572 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19573 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19575 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19576 "andps\t{%2, %0|%0, %2}"
19577 [(set_attr "type" "sselog")
19578 (set_attr "mode" "V4SF")])
19580 (define_expand "sse_nandv4sf3"
19581 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "") 0)
19582 (and:TI (not:TI (subreg:TI (match_operand:V4SF 1 "register_operand" "") 0))
19583 (subreg:TI (match_operand:V4SF 2 "nonimmediate_operand" "") 0)))]
19587 (define_insn "*sse_nandv4sf3"
19588 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "=x") 0)
19589 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
19590 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19592 "andnps\t{%2, %0|%0, %2}"
19593 [(set_attr "type" "sselog")
19594 (set_attr "mode" "V4SF")])
19596 (define_insn "*sse_nandsf3"
19597 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
19598 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
19599 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19601 "andnps\t{%2, %0|%0, %2}"
19602 [(set_attr "type" "sselog")
19603 (set_attr "mode" "V4SF")])
19605 (define_expand "sse_iorv4sf3"
19606 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "") 0)
19607 (ior:TI (subreg:TI (match_operand:V4SF 1 "register_operand" "") 0)
19608 (subreg:TI (match_operand:V4SF 2 "nonimmediate_operand" "") 0)))]
19612 (define_insn "*sse_iorv4sf3"
19613 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "=x") 0)
19614 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19615 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19617 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19618 "orps\t{%2, %0|%0, %2}"
19619 [(set_attr "type" "sselog")
19620 (set_attr "mode" "V4SF")])
19622 (define_insn "*sse_iorsf3"
19623 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
19624 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19625 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19627 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19628 "orps\t{%2, %0|%0, %2}"
19629 [(set_attr "type" "sselog")
19630 (set_attr "mode" "V4SF")])
19632 (define_expand "sse_xorv4sf3"
19633 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "") 0)
19634 (xor:TI (subreg:TI (match_operand:V4SF 1 "register_operand" "") 0)
19635 (subreg:TI (match_operand:V4SF 2 "nonimmediate_operand" "") 0)))]
19637 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19640 (define_insn "*sse_xorv4sf3"
19641 [(set (subreg:TI (match_operand:V4SF 0 "register_operand" "=x") 0)
19642 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19643 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19645 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19646 "xorps\t{%2, %0|%0, %2}"
19647 [(set_attr "type" "sselog")
19648 (set_attr "mode" "V4SF")])
19650 (define_insn "*sse_xorsf3"
19651 [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
19652 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19653 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19655 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19656 "xorps\t{%2, %0|%0, %2}"
19657 [(set_attr "type" "sselog")
19658 (set_attr "mode" "V4SF")])
19660 ;; SSE2 double precision floating point logical operation
19662 (define_expand "sse2_andv2df3"
19663 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "") 0)
19664 (and:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "") 0)
19665 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "") 0)))]
19669 (define_insn "*sse2_andv2df3"
19670 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "=x") 0)
19671 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19672 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19674 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19675 "andpd\t{%2, %0|%0, %2}"
19676 [(set_attr "type" "sselog")
19677 (set_attr "mode" "V2DF")])
19679 (define_insn "*sse2_andv2df3"
19680 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=x") 0)
19681 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19682 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19684 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19685 "andpd\t{%2, %0|%0, %2}"
19686 [(set_attr "type" "sselog")
19687 (set_attr "mode" "V2DF")])
19689 (define_expand "sse2_nandv2df3"
19690 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "") 0)
19691 (and:TI (not:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "") 0))
19692 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "") 0)))]
19696 (define_insn "*sse2_nandv2df3"
19697 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "=x") 0)
19698 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
19699 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19701 "andnpd\t{%2, %0|%0, %2}"
19702 [(set_attr "type" "sselog")
19703 (set_attr "mode" "V2DF")])
19705 (define_insn "*sse_nandti3_df"
19706 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
19707 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
19708 (match_operand:TI 2 "nonimmediate_operand" "Ym")))]
19710 "andnpd\t{%2, %0|%0, %2}"
19711 [(set_attr "type" "sselog")
19712 (set_attr "mode" "V2DF")])
19714 (define_expand "sse2_iorv2df3"
19715 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "") 0)
19716 (ior:TI (subreg:TI (match_operand:V2DF 1 "register_operand" "") 0)
19717 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "") 0)))]
19721 (define_insn "*sse2_iorv2df3"
19722 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "=x") 0)
19723 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19724 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19726 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19727 "orpd\t{%2, %0|%0, %2}"
19728 [(set_attr "type" "sselog")
19729 (set_attr "mode" "V2DF")])
19731 (define_insn "*sse2_iordf3"
19732 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=x") 0)
19733 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19734 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19736 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19737 "orpd\t{%2, %0|%0, %2}"
19738 [(set_attr "type" "sselog")
19739 (set_attr "mode" "V2DF")])
19741 (define_expand "sse2_xorv2df3"
19742 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "") 0)
19743 (xor:TI (subreg:TI (match_operand:V2DF 1 "nonimmediate_operand" "") 0)
19744 (subreg:TI (match_operand:V2DF 2 "nonimmediate_operand" "") 0)))]
19748 (define_insn "*sse2_xorv2df3"
19749 [(set (subreg:TI (match_operand:V2DF 0 "register_operand" "=x") 0)
19750 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19751 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19753 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19754 "xorpd\t{%2, %0|%0, %2}"
19755 [(set_attr "type" "sselog")
19756 (set_attr "mode" "V2DF")])
19758 (define_insn "*sse2_xordf3"
19759 [(set (subreg:TI (match_operand:DF 0 "register_operand" "=x") 0)
19760 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19761 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19763 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19764 "xorpd\t{%2, %0|%0, %2}"
19765 [(set_attr "type" "sselog")
19766 (set_attr "mode" "V2DF")])
19768 ;; SSE2 integral logicals. These patterns must always come after floating
19769 ;; point ones since we don't want compiler to use integer opcodes on floating
19770 ;; point SSE values to avoid matching of subregs in the match_operand.
19771 (define_insn "*sse2_andti3"
19772 [(set (match_operand:TI 0 "register_operand" "=x")
19773 (and:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19774 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19776 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19777 "pand\t{%2, %0|%0, %2}"
19778 [(set_attr "type" "sselog")
19779 (set_attr "mode" "TI")])
19781 (define_insn "sse2_andv2di3"
19782 [(set (match_operand:V2DI 0 "register_operand" "=x")
19783 (and:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
19784 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
19786 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19787 "pand\t{%2, %0|%0, %2}"
19788 [(set_attr "type" "sselog")
19789 (set_attr "mode" "TI")])
19791 (define_insn "*sse2_nandti3"
19792 [(set (match_operand:TI 0 "register_operand" "=x")
19793 (and:TI (not:TI (match_operand:TI 1 "register_operand" "0"))
19794 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19796 "pandn\t{%2, %0|%0, %2}"
19797 [(set_attr "type" "sselog")
19798 (set_attr "mode" "TI")])
19800 (define_insn "sse2_nandv2di3"
19801 [(set (match_operand:V2DI 0 "register_operand" "=x")
19802 (and:V2DI (not:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0"))
19803 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
19805 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19806 "pandn\t{%2, %0|%0, %2}"
19807 [(set_attr "type" "sselog")
19808 (set_attr "mode" "TI")])
19810 (define_insn "*sse2_iorti3"
19811 [(set (match_operand:TI 0 "register_operand" "=x")
19812 (ior:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19813 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19815 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19816 "por\t{%2, %0|%0, %2}"
19817 [(set_attr "type" "sselog")
19818 (set_attr "mode" "TI")])
19820 (define_insn "sse2_iorv2di3"
19821 [(set (match_operand:V2DI 0 "register_operand" "=x")
19822 (ior:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
19823 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
19825 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19826 "por\t{%2, %0|%0, %2}"
19827 [(set_attr "type" "sselog")
19828 (set_attr "mode" "TI")])
19830 (define_insn "*sse2_xorti3"
19831 [(set (match_operand:TI 0 "register_operand" "=x")
19832 (xor:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
19833 (match_operand:TI 2 "nonimmediate_operand" "xm")))]
19835 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19836 "pxor\t{%2, %0|%0, %2}"
19837 [(set_attr "type" "sselog")
19838 (set_attr "mode" "TI")])
19840 (define_insn "sse2_xorv2di3"
19841 [(set (match_operand:V2DI 0 "register_operand" "=x")
19842 (xor:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "%0")
19843 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
19845 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
19846 "pxor\t{%2, %0|%0, %2}"
19847 [(set_attr "type" "sselog")
19848 (set_attr "mode" "TI")])
19850 ;; Use xor, but don't show input operands so they aren't live before
19852 (define_insn "sse_clrv4sf"
19853 [(set (match_operand:V4SF 0 "register_operand" "=x")
19854 (match_operand:V4SF 1 "const0_operand" "X"))]
19857 if (get_attr_mode (insn) == MODE_TI)
19858 return "pxor\t{%0, %0|%0, %0}";
19860 return "xorps\t{%0, %0|%0, %0}";
19862 [(set_attr "type" "sselog")
19863 (set_attr "memory" "none")
19866 (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR")
19868 (ne (symbol_ref "TARGET_SSE2")
19870 (eq (symbol_ref "optimize_size")
19872 (const_string "TI")
19873 (const_string "V4SF")))])
19875 ;; Use xor, but don't show input operands so they aren't live before
19877 (define_insn "sse_clrv2df"
19878 [(set (match_operand:V2DF 0 "register_operand" "=x")
19879 (unspec:V2DF [(const_int 0)] UNSPEC_NOP))]
19881 "xorpd\t{%0, %0|%0, %0}"
19882 [(set_attr "type" "sselog")
19883 (set_attr "memory" "none")
19884 (set_attr "mode" "V4SF")])
19886 ;; SSE mask-generating compares
19888 (define_insn "maskcmpv4sf3"
19889 [(set (match_operand:V4SI 0 "register_operand" "=x")
19890 (match_operator:V4SI 3 "sse_comparison_operator"
19891 [(match_operand:V4SF 1 "register_operand" "0")
19892 (match_operand:V4SF 2 "register_operand" "x")]))]
19894 "cmp%D3ps\t{%2, %0|%0, %2}"
19895 [(set_attr "type" "ssecmp")
19896 (set_attr "mode" "V4SF")])
19898 (define_insn "maskncmpv4sf3"
19899 [(set (match_operand:V4SI 0 "register_operand" "=x")
19901 (match_operator:V4SI 3 "sse_comparison_operator"
19902 [(match_operand:V4SF 1 "register_operand" "0")
19903 (match_operand:V4SF 2 "register_operand" "x")])))]
19906 if (GET_CODE (operands[3]) == UNORDERED)
19907 return "cmpordps\t{%2, %0|%0, %2}";
19909 return "cmpn%D3ps\t{%2, %0|%0, %2}";
19911 [(set_attr "type" "ssecmp")
19912 (set_attr "mode" "V4SF")])
19914 (define_insn "vmmaskcmpv4sf3"
19915 [(set (match_operand:V4SI 0 "register_operand" "=x")
19917 (match_operator:V4SI 3 "sse_comparison_operator"
19918 [(match_operand:V4SF 1 "register_operand" "0")
19919 (match_operand:V4SF 2 "register_operand" "x")])
19923 "cmp%D3ss\t{%2, %0|%0, %2}"
19924 [(set_attr "type" "ssecmp")
19925 (set_attr "mode" "SF")])
19927 (define_insn "vmmaskncmpv4sf3"
19928 [(set (match_operand:V4SI 0 "register_operand" "=x")
19931 (match_operator:V4SI 3 "sse_comparison_operator"
19932 [(match_operand:V4SF 1 "register_operand" "0")
19933 (match_operand:V4SF 2 "register_operand" "x")]))
19934 (subreg:V4SI (match_dup 1) 0)
19938 if (GET_CODE (operands[3]) == UNORDERED)
19939 return "cmpordss\t{%2, %0|%0, %2}";
19941 return "cmpn%D3ss\t{%2, %0|%0, %2}";
19943 [(set_attr "type" "ssecmp")
19944 (set_attr "mode" "SF")])
19946 (define_insn "sse_comi"
19947 [(set (reg:CCFP 17)
19948 (compare:CCFP (vec_select:SF
19949 (match_operand:V4SF 0 "register_operand" "x")
19950 (parallel [(const_int 0)]))
19952 (match_operand:V4SF 1 "register_operand" "x")
19953 (parallel [(const_int 0)]))))]
19955 "comiss\t{%1, %0|%0, %1}"
19956 [(set_attr "type" "ssecomi")
19957 (set_attr "mode" "SF")])
19959 (define_insn "sse_ucomi"
19960 [(set (reg:CCFPU 17)
19961 (compare:CCFPU (vec_select:SF
19962 (match_operand:V4SF 0 "register_operand" "x")
19963 (parallel [(const_int 0)]))
19965 (match_operand:V4SF 1 "register_operand" "x")
19966 (parallel [(const_int 0)]))))]
19968 "ucomiss\t{%1, %0|%0, %1}"
19969 [(set_attr "type" "ssecomi")
19970 (set_attr "mode" "SF")])
19975 (define_insn "sse_unpckhps"
19976 [(set (match_operand:V4SF 0 "register_operand" "=x")
19978 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
19979 (parallel [(const_int 2)
19983 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
19984 (parallel [(const_int 0)
19990 "unpckhps\t{%2, %0|%0, %2}"
19991 [(set_attr "type" "ssecvt")
19992 (set_attr "mode" "V4SF")])
19994 (define_insn "sse_unpcklps"
19995 [(set (match_operand:V4SF 0 "register_operand" "=x")
19997 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "0")
19998 (parallel [(const_int 0)
20002 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "x")
20003 (parallel [(const_int 2)
20009 "unpcklps\t{%2, %0|%0, %2}"
20010 [(set_attr "type" "ssecvt")
20011 (set_attr "mode" "V4SF")])
20016 (define_insn "smaxv4sf3"
20017 [(set (match_operand:V4SF 0 "register_operand" "=x")
20018 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
20019 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20021 "maxps\t{%2, %0|%0, %2}"
20022 [(set_attr "type" "sse")
20023 (set_attr "mode" "V4SF")])
20025 (define_insn "vmsmaxv4sf3"
20026 [(set (match_operand:V4SF 0 "register_operand" "=x")
20028 (smax:V4SF (match_operand:V4SF 1 "register_operand" "0")
20029 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20033 "maxss\t{%2, %0|%0, %2}"
20034 [(set_attr "type" "sse")
20035 (set_attr "mode" "SF")])
20037 (define_insn "sminv4sf3"
20038 [(set (match_operand:V4SF 0 "register_operand" "=x")
20039 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
20040 (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
20042 "minps\t{%2, %0|%0, %2}"
20043 [(set_attr "type" "sse")
20044 (set_attr "mode" "V4SF")])
20046 (define_insn "vmsminv4sf3"
20047 [(set (match_operand:V4SF 0 "register_operand" "=x")
20049 (smin:V4SF (match_operand:V4SF 1 "register_operand" "0")
20050 (match_operand:V4SF 2 "nonimmediate_operand" "xm"))
20054 "minss\t{%2, %0|%0, %2}"
20055 [(set_attr "type" "sse")
20056 (set_attr "mode" "SF")])
20058 ;; SSE <-> integer/MMX conversions
20060 (define_insn "cvtpi2ps"
20061 [(set (match_operand:V4SF 0 "register_operand" "=x")
20063 (match_operand:V4SF 1 "register_operand" "0")
20064 (vec_duplicate:V4SF
20065 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
20068 "cvtpi2ps\t{%2, %0|%0, %2}"
20069 [(set_attr "type" "ssecvt")
20070 (set_attr "mode" "V4SF")])
20072 (define_insn "cvtps2pi"
20073 [(set (match_operand:V2SI 0 "register_operand" "=y")
20075 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
20076 (parallel [(const_int 0) (const_int 1)])))]
20078 "cvtps2pi\t{%1, %0|%0, %1}"
20079 [(set_attr "type" "ssecvt")
20080 (set_attr "mode" "V4SF")])
20082 (define_insn "cvttps2pi"
20083 [(set (match_operand:V2SI 0 "register_operand" "=y")
20085 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
20087 (parallel [(const_int 0) (const_int 1)])))]
20089 "cvttps2pi\t{%1, %0|%0, %1}"
20090 [(set_attr "type" "ssecvt")
20091 (set_attr "mode" "SF")])
20093 (define_insn "cvtsi2ss"
20094 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
20096 (match_operand:V4SF 1 "register_operand" "0,0")
20097 (vec_duplicate:V4SF
20098 (float:SF (match_operand:SI 2 "nonimmediate_operand" "r,rm")))
20101 "cvtsi2ss\t{%2, %0|%0, %2}"
20102 [(set_attr "type" "sseicvt")
20103 (set_attr "athlon_decode" "vector,double")
20104 (set_attr "mode" "SF")])
20106 (define_insn "cvtsi2ssq"
20107 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
20109 (match_operand:V4SF 1 "register_operand" "0,0")
20110 (vec_duplicate:V4SF
20111 (float:SF (match_operand:DI 2 "nonimmediate_operand" "r,rm")))
20113 "TARGET_SSE && TARGET_64BIT"
20114 "cvtsi2ssq\t{%2, %0|%0, %2}"
20115 [(set_attr "type" "sseicvt")
20116 (set_attr "athlon_decode" "vector,double")
20117 (set_attr "mode" "SF")])
20119 (define_insn "cvtss2si"
20120 [(set (match_operand:SI 0 "register_operand" "=r,r")
20122 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "x,m"))
20123 (parallel [(const_int 0)])))]
20125 "cvtss2si\t{%1, %0|%0, %1}"
20126 [(set_attr "type" "sseicvt")
20127 (set_attr "athlon_decode" "double,vector")
20128 (set_attr "mode" "SF")])
20130 (define_insn "cvttss2si"
20131 [(set (match_operand:SI 0 "register_operand" "=r,r")
20133 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "x,xm")]
20135 (parallel [(const_int 0)])))]
20137 "cvttss2si\t{%1, %0|%0, %1}"
20138 [(set_attr "type" "sseicvt")
20139 (set_attr "mode" "SF")
20140 (set_attr "athlon_decode" "double,vector")])
20147 (define_insn "addv8qi3"
20148 [(set (match_operand:V8QI 0 "register_operand" "=y")
20149 (plus:V8QI (match_operand:V8QI 1 "register_operand" "0")
20150 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20152 "paddb\t{%2, %0|%0, %2}"
20153 [(set_attr "type" "mmxadd")
20154 (set_attr "mode" "DI")])
20156 (define_insn "addv4hi3"
20157 [(set (match_operand:V4HI 0 "register_operand" "=y")
20158 (plus:V4HI (match_operand:V4HI 1 "register_operand" "0")
20159 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20161 "paddw\t{%2, %0|%0, %2}"
20162 [(set_attr "type" "mmxadd")
20163 (set_attr "mode" "DI")])
20165 (define_insn "addv2si3"
20166 [(set (match_operand:V2SI 0 "register_operand" "=y")
20167 (plus:V2SI (match_operand:V2SI 1 "register_operand" "0")
20168 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
20170 "paddd\t{%2, %0|%0, %2}"
20171 [(set_attr "type" "mmxadd")
20172 (set_attr "mode" "DI")])
20174 (define_insn "ssaddv8qi3"
20175 [(set (match_operand:V8QI 0 "register_operand" "=y")
20176 (ss_plus:V8QI (match_operand:V8QI 1 "register_operand" "0")
20177 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20179 "paddsb\t{%2, %0|%0, %2}"
20180 [(set_attr "type" "mmxadd")
20181 (set_attr "mode" "DI")])
20183 (define_insn "ssaddv4hi3"
20184 [(set (match_operand:V4HI 0 "register_operand" "=y")
20185 (ss_plus:V4HI (match_operand:V4HI 1 "register_operand" "0")
20186 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20188 "paddsw\t{%2, %0|%0, %2}"
20189 [(set_attr "type" "mmxadd")
20190 (set_attr "mode" "DI")])
20192 (define_insn "usaddv8qi3"
20193 [(set (match_operand:V8QI 0 "register_operand" "=y")
20194 (us_plus:V8QI (match_operand:V8QI 1 "register_operand" "0")
20195 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20197 "paddusb\t{%2, %0|%0, %2}"
20198 [(set_attr "type" "mmxadd")
20199 (set_attr "mode" "DI")])
20201 (define_insn "usaddv4hi3"
20202 [(set (match_operand:V4HI 0 "register_operand" "=y")
20203 (us_plus:V4HI (match_operand:V4HI 1 "register_operand" "0")
20204 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20206 "paddusw\t{%2, %0|%0, %2}"
20207 [(set_attr "type" "mmxadd")
20208 (set_attr "mode" "DI")])
20210 (define_insn "subv8qi3"
20211 [(set (match_operand:V8QI 0 "register_operand" "=y")
20212 (minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
20213 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20215 "psubb\t{%2, %0|%0, %2}"
20216 [(set_attr "type" "mmxadd")
20217 (set_attr "mode" "DI")])
20219 (define_insn "subv4hi3"
20220 [(set (match_operand:V4HI 0 "register_operand" "=y")
20221 (minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
20222 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20224 "psubw\t{%2, %0|%0, %2}"
20225 [(set_attr "type" "mmxadd")
20226 (set_attr "mode" "DI")])
20228 (define_insn "subv2si3"
20229 [(set (match_operand:V2SI 0 "register_operand" "=y")
20230 (minus:V2SI (match_operand:V2SI 1 "register_operand" "0")
20231 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
20233 "psubd\t{%2, %0|%0, %2}"
20234 [(set_attr "type" "mmxadd")
20235 (set_attr "mode" "DI")])
20237 (define_insn "sssubv8qi3"
20238 [(set (match_operand:V8QI 0 "register_operand" "=y")
20239 (ss_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
20240 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20242 "psubsb\t{%2, %0|%0, %2}"
20243 [(set_attr "type" "mmxadd")
20244 (set_attr "mode" "DI")])
20246 (define_insn "sssubv4hi3"
20247 [(set (match_operand:V4HI 0 "register_operand" "=y")
20248 (ss_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
20249 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20251 "psubsw\t{%2, %0|%0, %2}"
20252 [(set_attr "type" "mmxadd")
20253 (set_attr "mode" "DI")])
20255 (define_insn "ussubv8qi3"
20256 [(set (match_operand:V8QI 0 "register_operand" "=y")
20257 (us_minus:V8QI (match_operand:V8QI 1 "register_operand" "0")
20258 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20260 "psubusb\t{%2, %0|%0, %2}"
20261 [(set_attr "type" "mmxadd")
20262 (set_attr "mode" "DI")])
20264 (define_insn "ussubv4hi3"
20265 [(set (match_operand:V4HI 0 "register_operand" "=y")
20266 (us_minus:V4HI (match_operand:V4HI 1 "register_operand" "0")
20267 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20269 "psubusw\t{%2, %0|%0, %2}"
20270 [(set_attr "type" "mmxadd")
20271 (set_attr "mode" "DI")])
20273 (define_insn "mulv4hi3"
20274 [(set (match_operand:V4HI 0 "register_operand" "=y")
20275 (mult:V4HI (match_operand:V4HI 1 "register_operand" "0")
20276 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20278 "pmullw\t{%2, %0|%0, %2}"
20279 [(set_attr "type" "mmxmul")
20280 (set_attr "mode" "DI")])
20282 (define_insn "smulv4hi3_highpart"
20283 [(set (match_operand:V4HI 0 "register_operand" "=y")
20286 (mult:V4SI (sign_extend:V4SI
20287 (match_operand:V4HI 1 "register_operand" "0"))
20289 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
20292 "pmulhw\t{%2, %0|%0, %2}"
20293 [(set_attr "type" "mmxmul")
20294 (set_attr "mode" "DI")])
20296 (define_insn "umulv4hi3_highpart"
20297 [(set (match_operand:V4HI 0 "register_operand" "=y")
20300 (mult:V4SI (zero_extend:V4SI
20301 (match_operand:V4HI 1 "register_operand" "0"))
20303 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
20305 "TARGET_SSE || TARGET_3DNOW_A"
20306 "pmulhuw\t{%2, %0|%0, %2}"
20307 [(set_attr "type" "mmxmul")
20308 (set_attr "mode" "DI")])
20310 (define_insn "mmx_pmaddwd"
20311 [(set (match_operand:V2SI 0 "register_operand" "=y")
20315 (vec_select:V2HI (match_operand:V4HI 1 "register_operand" "0")
20316 (parallel [(const_int 0) (const_int 2)])))
20318 (vec_select:V2HI (match_operand:V4HI 2 "nonimmediate_operand" "ym")
20319 (parallel [(const_int 0) (const_int 2)]))))
20321 (sign_extend:V2SI (vec_select:V2HI (match_dup 1)
20322 (parallel [(const_int 1)
20324 (sign_extend:V2SI (vec_select:V2HI (match_dup 2)
20325 (parallel [(const_int 1)
20326 (const_int 3)]))))))]
20328 "pmaddwd\t{%2, %0|%0, %2}"
20329 [(set_attr "type" "mmxmul")
20330 (set_attr "mode" "DI")])
20333 ;; MMX logical operations
20334 ;; Note we don't want to declare these as regular iordi3 insns to prevent
20335 ;; normal code that also wants to use the FPU from getting broken.
20336 ;; The UNSPECs are there to prevent the combiner from getting overly clever.
20337 (define_insn "mmx_iordi3"
20338 [(set (match_operand:DI 0 "register_operand" "=y")
20340 [(ior:DI (match_operand:DI 1 "register_operand" "0")
20341 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
20344 "por\t{%2, %0|%0, %2}"
20345 [(set_attr "type" "mmxadd")
20346 (set_attr "mode" "DI")])
20348 (define_insn "mmx_xordi3"
20349 [(set (match_operand:DI 0 "register_operand" "=y")
20351 [(xor:DI (match_operand:DI 1 "register_operand" "0")
20352 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
20355 "pxor\t{%2, %0|%0, %2}"
20356 [(set_attr "type" "mmxadd")
20357 (set_attr "mode" "DI")
20358 (set_attr "memory" "none")])
20360 ;; Same as pxor, but don't show input operands so that we don't think
20362 (define_insn "mmx_clrdi"
20363 [(set (match_operand:DI 0 "register_operand" "=y")
20364 (unspec:DI [(const_int 0)] UNSPEC_NOP))]
20366 "pxor\t{%0, %0|%0, %0}"
20367 [(set_attr "type" "mmxadd")
20368 (set_attr "mode" "DI")
20369 (set_attr "memory" "none")])
20371 (define_insn "mmx_anddi3"
20372 [(set (match_operand:DI 0 "register_operand" "=y")
20374 [(and:DI (match_operand:DI 1 "register_operand" "0")
20375 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
20378 "pand\t{%2, %0|%0, %2}"
20379 [(set_attr "type" "mmxadd")
20380 (set_attr "mode" "DI")])
20382 (define_insn "mmx_nanddi3"
20383 [(set (match_operand:DI 0 "register_operand" "=y")
20385 [(and:DI (not:DI (match_operand:DI 1 "register_operand" "0"))
20386 (match_operand:DI 2 "nonimmediate_operand" "ym"))]
20389 "pandn\t{%2, %0|%0, %2}"
20390 [(set_attr "type" "mmxadd")
20391 (set_attr "mode" "DI")])
20394 ;; MMX unsigned averages/sum of absolute differences
20396 (define_insn "mmx_uavgv8qi3"
20397 [(set (match_operand:V8QI 0 "register_operand" "=y")
20399 (plus:V8QI (plus:V8QI
20400 (match_operand:V8QI 1 "register_operand" "0")
20401 (match_operand:V8QI 2 "nonimmediate_operand" "ym"))
20402 (const_vector:V8QI [(const_int 1)
20411 "TARGET_SSE || TARGET_3DNOW_A"
20412 "pavgb\t{%2, %0|%0, %2}"
20413 [(set_attr "type" "mmxshft")
20414 (set_attr "mode" "DI")])
20416 (define_insn "mmx_uavgv4hi3"
20417 [(set (match_operand:V4HI 0 "register_operand" "=y")
20419 (plus:V4HI (plus:V4HI
20420 (match_operand:V4HI 1 "register_operand" "0")
20421 (match_operand:V4HI 2 "nonimmediate_operand" "ym"))
20422 (const_vector:V4HI [(const_int 1)
20427 "TARGET_SSE || TARGET_3DNOW_A"
20428 "pavgw\t{%2, %0|%0, %2}"
20429 [(set_attr "type" "mmxshft")
20430 (set_attr "mode" "DI")])
20432 (define_insn "mmx_psadbw"
20433 [(set (match_operand:DI 0 "register_operand" "=y")
20434 (unspec:DI [(match_operand:V8QI 1 "register_operand" "0")
20435 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
20437 "TARGET_SSE || TARGET_3DNOW_A"
20438 "psadbw\t{%2, %0|%0, %2}"
20439 [(set_attr "type" "mmxshft")
20440 (set_attr "mode" "DI")])
20443 ;; MMX insert/extract/shuffle
20445 (define_insn "mmx_pinsrw"
20446 [(set (match_operand:V4HI 0 "register_operand" "=y")
20447 (vec_merge:V4HI (match_operand:V4HI 1 "register_operand" "0")
20448 (vec_duplicate:V4HI
20449 (truncate:HI (match_operand:SI 2 "nonimmediate_operand" "rm")))
20450 (match_operand:SI 3 "immediate_operand" "i")))]
20451 "TARGET_SSE || TARGET_3DNOW_A"
20452 "pinsrw\t{%3, %2, %0|%0, %2, %3}"
20453 [(set_attr "type" "mmxcvt")
20454 (set_attr "mode" "DI")])
20456 (define_insn "mmx_pextrw"
20457 [(set (match_operand:SI 0 "register_operand" "=r")
20458 (zero_extend:SI (vec_select:HI (match_operand:V4HI 1 "register_operand" "y")
20460 [(match_operand:SI 2 "immediate_operand" "i")]))))]
20461 "TARGET_SSE || TARGET_3DNOW_A"
20462 "pextrw\t{%2, %1, %0|%0, %1, %2}"
20463 [(set_attr "type" "mmxcvt")
20464 (set_attr "mode" "DI")])
20466 (define_insn "mmx_pshufw"
20467 [(set (match_operand:V4HI 0 "register_operand" "=y")
20468 (unspec:V4HI [(match_operand:V4HI 1 "register_operand" "0")
20469 (match_operand:SI 2 "immediate_operand" "i")]
20471 "TARGET_SSE || TARGET_3DNOW_A"
20472 "pshufw\t{%2, %1, %0|%0, %1, %2}"
20473 [(set_attr "type" "mmxcvt")
20474 (set_attr "mode" "DI")])
20477 ;; MMX mask-generating comparisons
20479 (define_insn "eqv8qi3"
20480 [(set (match_operand:V8QI 0 "register_operand" "=y")
20481 (eq:V8QI (match_operand:V8QI 1 "register_operand" "0")
20482 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20484 "pcmpeqb\t{%2, %0|%0, %2}"
20485 [(set_attr "type" "mmxcmp")
20486 (set_attr "mode" "DI")])
20488 (define_insn "eqv4hi3"
20489 [(set (match_operand:V4HI 0 "register_operand" "=y")
20490 (eq:V4HI (match_operand:V4HI 1 "register_operand" "0")
20491 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20493 "pcmpeqw\t{%2, %0|%0, %2}"
20494 [(set_attr "type" "mmxcmp")
20495 (set_attr "mode" "DI")])
20497 (define_insn "eqv2si3"
20498 [(set (match_operand:V2SI 0 "register_operand" "=y")
20499 (eq:V2SI (match_operand:V2SI 1 "register_operand" "0")
20500 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
20502 "pcmpeqd\t{%2, %0|%0, %2}"
20503 [(set_attr "type" "mmxcmp")
20504 (set_attr "mode" "DI")])
20506 (define_insn "gtv8qi3"
20507 [(set (match_operand:V8QI 0 "register_operand" "=y")
20508 (gt:V8QI (match_operand:V8QI 1 "register_operand" "0")
20509 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20511 "pcmpgtb\t{%2, %0|%0, %2}"
20512 [(set_attr "type" "mmxcmp")
20513 (set_attr "mode" "DI")])
20515 (define_insn "gtv4hi3"
20516 [(set (match_operand:V4HI 0 "register_operand" "=y")
20517 (gt:V4HI (match_operand:V4HI 1 "register_operand" "0")
20518 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20520 "pcmpgtw\t{%2, %0|%0, %2}"
20521 [(set_attr "type" "mmxcmp")
20522 (set_attr "mode" "DI")])
20524 (define_insn "gtv2si3"
20525 [(set (match_operand:V2SI 0 "register_operand" "=y")
20526 (gt:V2SI (match_operand:V2SI 1 "register_operand" "0")
20527 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
20529 "pcmpgtd\t{%2, %0|%0, %2}"
20530 [(set_attr "type" "mmxcmp")
20531 (set_attr "mode" "DI")])
20534 ;; MMX max/min insns
20536 (define_insn "umaxv8qi3"
20537 [(set (match_operand:V8QI 0 "register_operand" "=y")
20538 (umax:V8QI (match_operand:V8QI 1 "register_operand" "0")
20539 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20540 "TARGET_SSE || TARGET_3DNOW_A"
20541 "pmaxub\t{%2, %0|%0, %2}"
20542 [(set_attr "type" "mmxadd")
20543 (set_attr "mode" "DI")])
20545 (define_insn "smaxv4hi3"
20546 [(set (match_operand:V4HI 0 "register_operand" "=y")
20547 (smax:V4HI (match_operand:V4HI 1 "register_operand" "0")
20548 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20549 "TARGET_SSE || TARGET_3DNOW_A"
20550 "pmaxsw\t{%2, %0|%0, %2}"
20551 [(set_attr "type" "mmxadd")
20552 (set_attr "mode" "DI")])
20554 (define_insn "uminv8qi3"
20555 [(set (match_operand:V8QI 0 "register_operand" "=y")
20556 (umin:V8QI (match_operand:V8QI 1 "register_operand" "0")
20557 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
20558 "TARGET_SSE || TARGET_3DNOW_A"
20559 "pminub\t{%2, %0|%0, %2}"
20560 [(set_attr "type" "mmxadd")
20561 (set_attr "mode" "DI")])
20563 (define_insn "sminv4hi3"
20564 [(set (match_operand:V4HI 0 "register_operand" "=y")
20565 (smin:V4HI (match_operand:V4HI 1 "register_operand" "0")
20566 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
20567 "TARGET_SSE || TARGET_3DNOW_A"
20568 "pminsw\t{%2, %0|%0, %2}"
20569 [(set_attr "type" "mmxadd")
20570 (set_attr "mode" "DI")])
20575 (define_insn "ashrv4hi3"
20576 [(set (match_operand:V4HI 0 "register_operand" "=y")
20577 (ashiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
20578 (match_operand:DI 2 "nonmemory_operand" "yi")))]
20580 "psraw\t{%2, %0|%0, %2}"
20581 [(set_attr "type" "mmxshft")
20582 (set_attr "mode" "DI")])
20584 (define_insn "ashrv2si3"
20585 [(set (match_operand:V2SI 0 "register_operand" "=y")
20586 (ashiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
20587 (match_operand:DI 2 "nonmemory_operand" "yi")))]
20589 "psrad\t{%2, %0|%0, %2}"
20590 [(set_attr "type" "mmxshft")
20591 (set_attr "mode" "DI")])
20593 (define_insn "lshrv4hi3"
20594 [(set (match_operand:V4HI 0 "register_operand" "=y")
20595 (lshiftrt:V4HI (match_operand:V4HI 1 "register_operand" "0")
20596 (match_operand:DI 2 "nonmemory_operand" "yi")))]
20598 "psrlw\t{%2, %0|%0, %2}"
20599 [(set_attr "type" "mmxshft")
20600 (set_attr "mode" "DI")])
20602 (define_insn "lshrv2si3"
20603 [(set (match_operand:V2SI 0 "register_operand" "=y")
20604 (lshiftrt:V2SI (match_operand:V2SI 1 "register_operand" "0")
20605 (match_operand:DI 2 "nonmemory_operand" "yi")))]
20607 "psrld\t{%2, %0|%0, %2}"
20608 [(set_attr "type" "mmxshft")
20609 (set_attr "mode" "DI")])
20611 ;; See logical MMX insns.
20612 (define_insn "mmx_lshrdi3"
20613 [(set (match_operand:DI 0 "register_operand" "=y")
20615 [(lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
20616 (match_operand:DI 2 "nonmemory_operand" "yi"))]
20619 "psrlq\t{%2, %0|%0, %2}"
20620 [(set_attr "type" "mmxshft")
20621 (set_attr "mode" "DI")])
20623 (define_insn "ashlv4hi3"
20624 [(set (match_operand:V4HI 0 "register_operand" "=y")
20625 (ashift:V4HI (match_operand:V4HI 1 "register_operand" "0")
20626 (match_operand:DI 2 "nonmemory_operand" "yi")))]
20628 "psllw\t{%2, %0|%0, %2}"
20629 [(set_attr "type" "mmxshft")
20630 (set_attr "mode" "DI")])
20632 (define_insn "ashlv2si3"
20633 [(set (match_operand:V2SI 0 "register_operand" "=y")
20634 (ashift:V2SI (match_operand:V2SI 1 "register_operand" "0")
20635 (match_operand:DI 2 "nonmemory_operand" "yi")))]
20637 "pslld\t{%2, %0|%0, %2}"
20638 [(set_attr "type" "mmxshft")
20639 (set_attr "mode" "DI")])
20641 ;; See logical MMX insns.
20642 (define_insn "mmx_ashldi3"
20643 [(set (match_operand:DI 0 "register_operand" "=y")
20645 [(ashift:DI (match_operand:DI 1 "register_operand" "0")
20646 (match_operand:DI 2 "nonmemory_operand" "yi"))]
20649 "psllq\t{%2, %0|%0, %2}"
20650 [(set_attr "type" "mmxshft")
20651 (set_attr "mode" "DI")])
20654 ;; MMX pack/unpack insns.
20656 (define_insn "mmx_packsswb"
20657 [(set (match_operand:V8QI 0 "register_operand" "=y")
20659 (ss_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
20660 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
20662 "packsswb\t{%2, %0|%0, %2}"
20663 [(set_attr "type" "mmxshft")
20664 (set_attr "mode" "DI")])
20666 (define_insn "mmx_packssdw"
20667 [(set (match_operand:V4HI 0 "register_operand" "=y")
20669 (ss_truncate:V2HI (match_operand:V2SI 1 "register_operand" "0"))
20670 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
20672 "packssdw\t{%2, %0|%0, %2}"
20673 [(set_attr "type" "mmxshft")
20674 (set_attr "mode" "DI")])
20676 (define_insn "mmx_packuswb"
20677 [(set (match_operand:V8QI 0 "register_operand" "=y")
20679 (us_truncate:V4QI (match_operand:V4HI 1 "register_operand" "0"))
20680 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
20682 "packuswb\t{%2, %0|%0, %2}"
20683 [(set_attr "type" "mmxshft")
20684 (set_attr "mode" "DI")])
20686 (define_insn "mmx_punpckhbw"
20687 [(set (match_operand:V8QI 0 "register_operand" "=y")
20689 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
20690 (parallel [(const_int 4)
20698 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
20699 (parallel [(const_int 0)
20709 "punpckhbw\t{%2, %0|%0, %2}"
20710 [(set_attr "type" "mmxcvt")
20711 (set_attr "mode" "DI")])
20713 (define_insn "mmx_punpckhwd"
20714 [(set (match_operand:V4HI 0 "register_operand" "=y")
20716 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
20717 (parallel [(const_int 0)
20721 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
20722 (parallel [(const_int 2)
20728 "punpckhwd\t{%2, %0|%0, %2}"
20729 [(set_attr "type" "mmxcvt")
20730 (set_attr "mode" "DI")])
20732 (define_insn "mmx_punpckhdq"
20733 [(set (match_operand:V2SI 0 "register_operand" "=y")
20735 (match_operand:V2SI 1 "register_operand" "0")
20736 (vec_select:V2SI (match_operand:V2SI 2 "register_operand" "y")
20737 (parallel [(const_int 1)
20741 "punpckhdq\t{%2, %0|%0, %2}"
20742 [(set_attr "type" "mmxcvt")
20743 (set_attr "mode" "DI")])
20745 (define_insn "mmx_punpcklbw"
20746 [(set (match_operand:V8QI 0 "register_operand" "=y")
20748 (vec_select:V8QI (match_operand:V8QI 1 "register_operand" "0")
20749 (parallel [(const_int 0)
20757 (vec_select:V8QI (match_operand:V8QI 2 "register_operand" "y")
20758 (parallel [(const_int 4)
20768 "punpcklbw\t{%2, %0|%0, %2}"
20769 [(set_attr "type" "mmxcvt")
20770 (set_attr "mode" "DI")])
20772 (define_insn "mmx_punpcklwd"
20773 [(set (match_operand:V4HI 0 "register_operand" "=y")
20775 (vec_select:V4HI (match_operand:V4HI 1 "register_operand" "0")
20776 (parallel [(const_int 2)
20780 (vec_select:V4HI (match_operand:V4HI 2 "register_operand" "y")
20781 (parallel [(const_int 0)
20787 "punpcklwd\t{%2, %0|%0, %2}"
20788 [(set_attr "type" "mmxcvt")
20789 (set_attr "mode" "DI")])
20791 (define_insn "mmx_punpckldq"
20792 [(set (match_operand:V2SI 0 "register_operand" "=y")
20794 (vec_select:V2SI (match_operand:V2SI 1 "register_operand" "0")
20795 (parallel [(const_int 1)
20797 (match_operand:V2SI 2 "register_operand" "y")
20800 "punpckldq\t{%2, %0|%0, %2}"
20801 [(set_attr "type" "mmxcvt")
20802 (set_attr "mode" "DI")])
20805 ;; Miscellaneous stuff
20807 (define_insn "emms"
20808 [(unspec_volatile [(const_int 0)] UNSPECV_EMMS)
20809 (clobber (reg:XF 8))
20810 (clobber (reg:XF 9))
20811 (clobber (reg:XF 10))
20812 (clobber (reg:XF 11))
20813 (clobber (reg:XF 12))
20814 (clobber (reg:XF 13))
20815 (clobber (reg:XF 14))
20816 (clobber (reg:XF 15))
20817 (clobber (reg:DI 29))
20818 (clobber (reg:DI 30))
20819 (clobber (reg:DI 31))
20820 (clobber (reg:DI 32))
20821 (clobber (reg:DI 33))
20822 (clobber (reg:DI 34))
20823 (clobber (reg:DI 35))
20824 (clobber (reg:DI 36))]
20827 [(set_attr "type" "mmx")
20828 (set_attr "memory" "unknown")])
20830 (define_insn "ldmxcsr"
20831 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
20835 [(set_attr "type" "sse")
20836 (set_attr "memory" "load")])
20838 (define_insn "stmxcsr"
20839 [(set (match_operand:SI 0 "memory_operand" "=m")
20840 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
20843 [(set_attr "type" "sse")
20844 (set_attr "memory" "store")])
20846 (define_expand "sfence"
20847 [(set (match_dup 0)
20848 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
20849 "TARGET_SSE || TARGET_3DNOW_A"
20851 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
20852 MEM_VOLATILE_P (operands[0]) = 1;
20855 (define_insn "*sfence_insn"
20856 [(set (match_operand:BLK 0 "" "")
20857 (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
20858 "TARGET_SSE || TARGET_3DNOW_A"
20860 [(set_attr "type" "sse")
20861 (set_attr "memory" "unknown")])
20863 (define_expand "sse_prologue_save"
20864 [(parallel [(set (match_operand:BLK 0 "" "")
20865 (unspec:BLK [(reg:DI 21)
20872 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
20873 (use (match_operand:DI 1 "register_operand" ""))
20874 (use (match_operand:DI 2 "immediate_operand" ""))
20875 (use (label_ref:DI (match_operand 3 "" "")))])]
20879 (define_insn "*sse_prologue_save_insn"
20880 [(set (mem:BLK (plus:DI (match_operand:DI 0 "register_operand" "R")
20881 (match_operand:DI 4 "const_int_operand" "n")))
20882 (unspec:BLK [(reg:DI 21)
20889 (reg:DI 28)] UNSPEC_SSE_PROLOGUE_SAVE))
20890 (use (match_operand:DI 1 "register_operand" "r"))
20891 (use (match_operand:DI 2 "const_int_operand" "i"))
20892 (use (label_ref:DI (match_operand 3 "" "X")))]
20894 && INTVAL (operands[4]) + SSE_REGPARM_MAX * 16 - 16 < 128
20895 && INTVAL (operands[4]) + INTVAL (operands[2]) * 16 >= -128"
20899 operands[0] = gen_rtx_MEM (Pmode,
20900 gen_rtx_PLUS (Pmode, operands[0], operands[4]));
20901 output_asm_insn (\"jmp\\t%A1\", operands);
20902 for (i = SSE_REGPARM_MAX - 1; i >= INTVAL (operands[2]); i--)
20904 operands[4] = adjust_address (operands[0], DImode, i*16);
20905 operands[5] = gen_rtx_REG (TImode, SSE_REGNO (i));
20906 PUT_MODE (operands[4], TImode);
20907 if (GET_CODE (XEXP (operands[0], 0)) != PLUS)
20908 output_asm_insn (\"rex\", operands);
20909 output_asm_insn (\"movaps\\t{%5, %4|%4, %5}\", operands);
20911 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
20912 CODE_LABEL_NUMBER (operands[3]));
20916 [(set_attr "type" "other")
20917 (set_attr "length_immediate" "0")
20918 (set_attr "length_address" "0")
20919 (set_attr "length" "135")
20920 (set_attr "memory" "store")
20921 (set_attr "modrm" "0")
20922 (set_attr "mode" "DI")])
20924 ;; 3Dnow! instructions
20926 (define_insn "addv2sf3"
20927 [(set (match_operand:V2SF 0 "register_operand" "=y")
20928 (plus:V2SF (match_operand:V2SF 1 "register_operand" "0")
20929 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20931 "pfadd\\t{%2, %0|%0, %2}"
20932 [(set_attr "type" "mmxadd")
20933 (set_attr "mode" "V2SF")])
20935 (define_insn "subv2sf3"
20936 [(set (match_operand:V2SF 0 "register_operand" "=y")
20937 (minus:V2SF (match_operand:V2SF 1 "register_operand" "0")
20938 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20940 "pfsub\\t{%2, %0|%0, %2}"
20941 [(set_attr "type" "mmxadd")
20942 (set_attr "mode" "V2SF")])
20944 (define_insn "subrv2sf3"
20945 [(set (match_operand:V2SF 0 "register_operand" "=y")
20946 (minus:V2SF (match_operand:V2SF 2 "nonimmediate_operand" "ym")
20947 (match_operand:V2SF 1 "register_operand" "0")))]
20949 "pfsubr\\t{%2, %0|%0, %2}"
20950 [(set_attr "type" "mmxadd")
20951 (set_attr "mode" "V2SF")])
20953 (define_insn "gtv2sf3"
20954 [(set (match_operand:V2SI 0 "register_operand" "=y")
20955 (gt:V2SI (match_operand:V2SF 1 "register_operand" "0")
20956 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20958 "pfcmpgt\\t{%2, %0|%0, %2}"
20959 [(set_attr "type" "mmxcmp")
20960 (set_attr "mode" "V2SF")])
20962 (define_insn "gev2sf3"
20963 [(set (match_operand:V2SI 0 "register_operand" "=y")
20964 (ge:V2SI (match_operand:V2SF 1 "register_operand" "0")
20965 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20967 "pfcmpge\\t{%2, %0|%0, %2}"
20968 [(set_attr "type" "mmxcmp")
20969 (set_attr "mode" "V2SF")])
20971 (define_insn "eqv2sf3"
20972 [(set (match_operand:V2SI 0 "register_operand" "=y")
20973 (eq:V2SI (match_operand:V2SF 1 "register_operand" "0")
20974 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20976 "pfcmpeq\\t{%2, %0|%0, %2}"
20977 [(set_attr "type" "mmxcmp")
20978 (set_attr "mode" "V2SF")])
20980 (define_insn "pfmaxv2sf3"
20981 [(set (match_operand:V2SF 0 "register_operand" "=y")
20982 (smax:V2SF (match_operand:V2SF 1 "register_operand" "0")
20983 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20985 "pfmax\\t{%2, %0|%0, %2}"
20986 [(set_attr "type" "mmxadd")
20987 (set_attr "mode" "V2SF")])
20989 (define_insn "pfminv2sf3"
20990 [(set (match_operand:V2SF 0 "register_operand" "=y")
20991 (smin:V2SF (match_operand:V2SF 1 "register_operand" "0")
20992 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
20994 "pfmin\\t{%2, %0|%0, %2}"
20995 [(set_attr "type" "mmxadd")
20996 (set_attr "mode" "V2SF")])
20998 (define_insn "mulv2sf3"
20999 [(set (match_operand:V2SF 0 "register_operand" "=y")
21000 (mult:V2SF (match_operand:V2SF 1 "register_operand" "0")
21001 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
21003 "pfmul\\t{%2, %0|%0, %2}"
21004 [(set_attr "type" "mmxmul")
21005 (set_attr "mode" "V2SF")])
21007 (define_insn "femms"
21008 [(unspec_volatile [(const_int 0)] UNSPECV_FEMMS)
21009 (clobber (reg:XF 8))
21010 (clobber (reg:XF 9))
21011 (clobber (reg:XF 10))
21012 (clobber (reg:XF 11))
21013 (clobber (reg:XF 12))
21014 (clobber (reg:XF 13))
21015 (clobber (reg:XF 14))
21016 (clobber (reg:XF 15))
21017 (clobber (reg:DI 29))
21018 (clobber (reg:DI 30))
21019 (clobber (reg:DI 31))
21020 (clobber (reg:DI 32))
21021 (clobber (reg:DI 33))
21022 (clobber (reg:DI 34))
21023 (clobber (reg:DI 35))
21024 (clobber (reg:DI 36))]
21027 [(set_attr "type" "mmx")
21028 (set_attr "memory" "none")])
21030 (define_insn "pf2id"
21031 [(set (match_operand:V2SI 0 "register_operand" "=y")
21032 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
21034 "pf2id\\t{%1, %0|%0, %1}"
21035 [(set_attr "type" "mmxcvt")
21036 (set_attr "mode" "V2SF")])
21038 (define_insn "pf2iw"
21039 [(set (match_operand:V2SI 0 "register_operand" "=y")
21042 (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
21044 "pf2iw\\t{%1, %0|%0, %1}"
21045 [(set_attr "type" "mmxcvt")
21046 (set_attr "mode" "V2SF")])
21048 (define_insn "pfacc"
21049 [(set (match_operand:V2SF 0 "register_operand" "=y")
21052 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
21053 (parallel [(const_int 0)]))
21054 (vec_select:SF (match_dup 1)
21055 (parallel [(const_int 1)])))
21057 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
21058 (parallel [(const_int 0)]))
21059 (vec_select:SF (match_dup 2)
21060 (parallel [(const_int 1)])))))]
21062 "pfacc\\t{%2, %0|%0, %2}"
21063 [(set_attr "type" "mmxadd")
21064 (set_attr "mode" "V2SF")])
21066 (define_insn "pfnacc"
21067 [(set (match_operand:V2SF 0 "register_operand" "=y")
21070 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
21071 (parallel [(const_int 0)]))
21072 (vec_select:SF (match_dup 1)
21073 (parallel [(const_int 1)])))
21075 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
21076 (parallel [(const_int 0)]))
21077 (vec_select:SF (match_dup 2)
21078 (parallel [(const_int 1)])))))]
21080 "pfnacc\\t{%2, %0|%0, %2}"
21081 [(set_attr "type" "mmxadd")
21082 (set_attr "mode" "V2SF")])
21084 (define_insn "pfpnacc"
21085 [(set (match_operand:V2SF 0 "register_operand" "=y")
21088 (vec_select:SF (match_operand:V2SF 1 "register_operand" "0")
21089 (parallel [(const_int 0)]))
21090 (vec_select:SF (match_dup 1)
21091 (parallel [(const_int 1)])))
21093 (vec_select:SF (match_operand:V2SF 2 "nonimmediate_operand" "y")
21094 (parallel [(const_int 0)]))
21095 (vec_select:SF (match_dup 2)
21096 (parallel [(const_int 1)])))))]
21098 "pfpnacc\\t{%2, %0|%0, %2}"
21099 [(set_attr "type" "mmxadd")
21100 (set_attr "mode" "V2SF")])
21102 (define_insn "pi2fw"
21103 [(set (match_operand:V2SF 0 "register_operand" "=y")
21108 (vec_select:SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
21109 (parallel [(const_int 0)]))))
21112 (vec_select:SI (match_dup 1)
21113 (parallel [(const_int 1)])))))))]
21115 "pi2fw\\t{%1, %0|%0, %1}"
21116 [(set_attr "type" "mmxcvt")
21117 (set_attr "mode" "V2SF")])
21119 (define_insn "floatv2si2"
21120 [(set (match_operand:V2SF 0 "register_operand" "=y")
21121 (float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
21123 "pi2fd\\t{%1, %0|%0, %1}"
21124 [(set_attr "type" "mmxcvt")
21125 (set_attr "mode" "V2SF")])
21127 ;; This insn is identical to pavgb in operation, but the opcode is
21128 ;; different. To avoid accidentally matching pavgb, use an unspec.
21130 (define_insn "pavgusb"
21131 [(set (match_operand:V8QI 0 "register_operand" "=y")
21133 [(match_operand:V8QI 1 "register_operand" "0")
21134 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
21137 "pavgusb\\t{%2, %0|%0, %2}"
21138 [(set_attr "type" "mmxshft")
21139 (set_attr "mode" "TI")])
21141 ;; 3DNow reciprocal and sqrt
21143 (define_insn "pfrcpv2sf2"
21144 [(set (match_operand:V2SF 0 "register_operand" "=y")
21145 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
21148 "pfrcp\\t{%1, %0|%0, %1}"
21149 [(set_attr "type" "mmx")
21150 (set_attr "mode" "TI")])
21152 (define_insn "pfrcpit1v2sf3"
21153 [(set (match_operand:V2SF 0 "register_operand" "=y")
21154 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
21155 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
21158 "pfrcpit1\\t{%2, %0|%0, %2}"
21159 [(set_attr "type" "mmx")
21160 (set_attr "mode" "TI")])
21162 (define_insn "pfrcpit2v2sf3"
21163 [(set (match_operand:V2SF 0 "register_operand" "=y")
21164 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
21165 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
21168 "pfrcpit2\\t{%2, %0|%0, %2}"
21169 [(set_attr "type" "mmx")
21170 (set_attr "mode" "TI")])
21172 (define_insn "pfrsqrtv2sf2"
21173 [(set (match_operand:V2SF 0 "register_operand" "=y")
21174 (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")]
21177 "pfrsqrt\\t{%1, %0|%0, %1}"
21178 [(set_attr "type" "mmx")
21179 (set_attr "mode" "TI")])
21181 (define_insn "pfrsqit1v2sf3"
21182 [(set (match_operand:V2SF 0 "register_operand" "=y")
21183 (unspec:V2SF [(match_operand:V2SF 1 "register_operand" "0")
21184 (match_operand:V2SF 2 "nonimmediate_operand" "ym")]
21187 "pfrsqit1\\t{%2, %0|%0, %2}"
21188 [(set_attr "type" "mmx")
21189 (set_attr "mode" "TI")])
21191 (define_insn "pmulhrwv4hi3"
21192 [(set (match_operand:V4HI 0 "register_operand" "=y")
21198 (match_operand:V4HI 1 "register_operand" "0"))
21200 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
21201 (const_vector:V4SI [(const_int 32768)
21204 (const_int 32768)]))
21207 "pmulhrw\\t{%2, %0|%0, %2}"
21208 [(set_attr "type" "mmxmul")
21209 (set_attr "mode" "TI")])
21211 (define_insn "pswapdv2si2"
21212 [(set (match_operand:V2SI 0 "register_operand" "=y")
21213 (vec_select:V2SI (match_operand:V2SI 1 "nonimmediate_operand" "ym")
21214 (parallel [(const_int 1) (const_int 0)])))]
21216 "pswapd\\t{%1, %0|%0, %1}"
21217 [(set_attr "type" "mmxcvt")
21218 (set_attr "mode" "TI")])
21220 (define_insn "pswapdv2sf2"
21221 [(set (match_operand:V2SF 0 "register_operand" "=y")
21222 (vec_select:V2SF (match_operand:V2SF 1 "nonimmediate_operand" "ym")
21223 (parallel [(const_int 1) (const_int 0)])))]
21225 "pswapd\\t{%1, %0|%0, %1}"
21226 [(set_attr "type" "mmxcvt")
21227 (set_attr "mode" "TI")])
21229 (define_expand "prefetch"
21230 [(prefetch (match_operand 0 "address_operand" "")
21231 (match_operand:SI 1 "const_int_operand" "")
21232 (match_operand:SI 2 "const_int_operand" ""))]
21233 "TARGET_PREFETCH_SSE || TARGET_3DNOW"
21235 int rw = INTVAL (operands[1]);
21236 int locality = INTVAL (operands[2]);
21238 if (rw != 0 && rw != 1)
21240 if (locality < 0 || locality > 3)
21242 if (GET_MODE (operands[0]) != Pmode && GET_MODE (operands[0]) != VOIDmode)
21245 /* Use 3dNOW prefetch in case we are asking for write prefetch not
21246 suported by SSE counterpart or the SSE prefetch is not available
21247 (K6 machines). Otherwise use SSE prefetch as it allows specifying
21249 if (TARGET_3DNOW && (!TARGET_PREFETCH_SSE || rw))
21250 operands[2] = GEN_INT (3);
21252 operands[1] = const0_rtx;
21255 (define_insn "*prefetch_sse"
21256 [(prefetch (match_operand:SI 0 "address_operand" "p")
21258 (match_operand:SI 1 "const_int_operand" ""))]
21259 "TARGET_PREFETCH_SSE && !TARGET_64BIT"
21261 static const char * const patterns[4] = {
21262 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
21265 int locality = INTVAL (operands[1]);
21266 if (locality < 0 || locality > 3)
21269 return patterns[locality];
21271 [(set_attr "type" "sse")
21272 (set_attr "memory" "none")])
21274 (define_insn "*prefetch_sse_rex"
21275 [(prefetch (match_operand:DI 0 "address_operand" "p")
21277 (match_operand:SI 1 "const_int_operand" ""))]
21278 "TARGET_PREFETCH_SSE && TARGET_64BIT"
21280 static const char * const patterns[4] = {
21281 "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0"
21284 int locality = INTVAL (operands[1]);
21285 if (locality < 0 || locality > 3)
21288 return patterns[locality];
21290 [(set_attr "type" "sse")
21291 (set_attr "memory" "none")])
21293 (define_insn "*prefetch_3dnow"
21294 [(prefetch (match_operand:SI 0 "address_operand" "p")
21295 (match_operand:SI 1 "const_int_operand" "n")
21297 "TARGET_3DNOW && !TARGET_64BIT"
21299 if (INTVAL (operands[1]) == 0)
21300 return "prefetch\t%a0";
21302 return "prefetchw\t%a0";
21304 [(set_attr "type" "mmx")
21305 (set_attr "memory" "none")])
21307 (define_insn "*prefetch_3dnow_rex"
21308 [(prefetch (match_operand:DI 0 "address_operand" "p")
21309 (match_operand:SI 1 "const_int_operand" "n")
21311 "TARGET_3DNOW && TARGET_64BIT"
21313 if (INTVAL (operands[1]) == 0)
21314 return "prefetch\t%a0";
21316 return "prefetchw\t%a0";
21318 [(set_attr "type" "mmx")
21319 (set_attr "memory" "none")])
21323 (define_insn "addv2df3"
21324 [(set (match_operand:V2DF 0 "register_operand" "=x")
21325 (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
21326 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
21328 "addpd\t{%2, %0|%0, %2}"
21329 [(set_attr "type" "sseadd")
21330 (set_attr "mode" "V2DF")])
21332 (define_insn "vmaddv2df3"
21333 [(set (match_operand:V2DF 0 "register_operand" "=x")
21334 (vec_merge:V2DF (plus:V2DF (match_operand:V2DF 1 "register_operand" "0")
21335 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
21339 "addsd\t{%2, %0|%0, %2}"
21340 [(set_attr "type" "sseadd")
21341 (set_attr "mode" "DF")])
21343 (define_insn "subv2df3"
21344 [(set (match_operand:V2DF 0 "register_operand" "=x")
21345 (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
21346 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
21348 "subpd\t{%2, %0|%0, %2}"
21349 [(set_attr "type" "sseadd")
21350 (set_attr "mode" "V2DF")])
21352 (define_insn "vmsubv2df3"
21353 [(set (match_operand:V2DF 0 "register_operand" "=x")
21354 (vec_merge:V2DF (minus:V2DF (match_operand:V2DF 1 "register_operand" "0")
21355 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
21359 "subsd\t{%2, %0|%0, %2}"
21360 [(set_attr "type" "sseadd")
21361 (set_attr "mode" "DF")])
21363 (define_insn "mulv2df3"
21364 [(set (match_operand:V2DF 0 "register_operand" "=x")
21365 (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
21366 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
21368 "mulpd\t{%2, %0|%0, %2}"
21369 [(set_attr "type" "ssemul")
21370 (set_attr "mode" "V2DF")])
21372 (define_insn "vmmulv2df3"
21373 [(set (match_operand:V2DF 0 "register_operand" "=x")
21374 (vec_merge:V2DF (mult:V2DF (match_operand:V2DF 1 "register_operand" "0")
21375 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
21379 "mulsd\t{%2, %0|%0, %2}"
21380 [(set_attr "type" "ssemul")
21381 (set_attr "mode" "DF")])
21383 (define_insn "divv2df3"
21384 [(set (match_operand:V2DF 0 "register_operand" "=x")
21385 (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
21386 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
21388 "divpd\t{%2, %0|%0, %2}"
21389 [(set_attr "type" "ssediv")
21390 (set_attr "mode" "V2DF")])
21392 (define_insn "vmdivv2df3"
21393 [(set (match_operand:V2DF 0 "register_operand" "=x")
21394 (vec_merge:V2DF (div:V2DF (match_operand:V2DF 1 "register_operand" "0")
21395 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
21399 "divsd\t{%2, %0|%0, %2}"
21400 [(set_attr "type" "ssediv")
21401 (set_attr "mode" "DF")])
21405 (define_insn "smaxv2df3"
21406 [(set (match_operand:V2DF 0 "register_operand" "=x")
21407 (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
21408 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
21410 "maxpd\t{%2, %0|%0, %2}"
21411 [(set_attr "type" "sseadd")
21412 (set_attr "mode" "V2DF")])
21414 (define_insn "vmsmaxv2df3"
21415 [(set (match_operand:V2DF 0 "register_operand" "=x")
21416 (vec_merge:V2DF (smax:V2DF (match_operand:V2DF 1 "register_operand" "0")
21417 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
21421 "maxsd\t{%2, %0|%0, %2}"
21422 [(set_attr "type" "sseadd")
21423 (set_attr "mode" "DF")])
21425 (define_insn "sminv2df3"
21426 [(set (match_operand:V2DF 0 "register_operand" "=x")
21427 (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
21428 (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
21430 "minpd\t{%2, %0|%0, %2}"
21431 [(set_attr "type" "sseadd")
21432 (set_attr "mode" "V2DF")])
21434 (define_insn "vmsminv2df3"
21435 [(set (match_operand:V2DF 0 "register_operand" "=x")
21436 (vec_merge:V2DF (smin:V2DF (match_operand:V2DF 1 "register_operand" "0")
21437 (match_operand:V2DF 2 "nonimmediate_operand" "xm"))
21441 "minsd\t{%2, %0|%0, %2}"
21442 [(set_attr "type" "sseadd")
21443 (set_attr "mode" "DF")])
21444 ;; SSE2 square root. There doesn't appear to be an extension for the
21445 ;; reciprocal/rsqrt instructions if the Intel manual is to be believed.
21447 (define_insn "sqrtv2df2"
21448 [(set (match_operand:V2DF 0 "register_operand" "=x")
21449 (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm")))]
21451 "sqrtpd\t{%1, %0|%0, %1}"
21452 [(set_attr "type" "sse")
21453 (set_attr "mode" "V2DF")])
21455 (define_insn "vmsqrtv2df2"
21456 [(set (match_operand:V2DF 0 "register_operand" "=x")
21457 (vec_merge:V2DF (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm"))
21458 (match_operand:V2DF 2 "register_operand" "0")
21461 "sqrtsd\t{%1, %0|%0, %1}"
21462 [(set_attr "type" "sse")
21463 (set_attr "mode" "SF")])
21465 ;; SSE mask-generating compares
21467 (define_insn "maskcmpv2df3"
21468 [(set (match_operand:V2DI 0 "register_operand" "=x")
21469 (match_operator:V2DI 3 "sse_comparison_operator"
21470 [(match_operand:V2DF 1 "register_operand" "0")
21471 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))]
21473 "cmp%D3pd\t{%2, %0|%0, %2}"
21474 [(set_attr "type" "ssecmp")
21475 (set_attr "mode" "V2DF")])
21477 (define_insn "maskncmpv2df3"
21478 [(set (match_operand:V2DI 0 "register_operand" "=x")
21480 (match_operator:V2DI 3 "sse_comparison_operator"
21481 [(match_operand:V2DF 1 "register_operand" "0")
21482 (match_operand:V2DF 2 "nonimmediate_operand" "x")])))]
21485 if (GET_CODE (operands[3]) == UNORDERED)
21486 return "cmpordps\t{%2, %0|%0, %2}";
21488 return "cmpn%D3pd\t{%2, %0|%0, %2}";
21490 [(set_attr "type" "ssecmp")
21491 (set_attr "mode" "V2DF")])
21493 (define_insn "vmmaskcmpv2df3"
21494 [(set (match_operand:V2DI 0 "register_operand" "=x")
21496 (match_operator:V2DI 3 "sse_comparison_operator"
21497 [(match_operand:V2DF 1 "register_operand" "0")
21498 (match_operand:V2DF 2 "nonimmediate_operand" "x")])
21502 "cmp%D3sd\t{%2, %0|%0, %2}"
21503 [(set_attr "type" "ssecmp")
21504 (set_attr "mode" "DF")])
21506 (define_insn "vmmaskncmpv2df3"
21507 [(set (match_operand:V2DI 0 "register_operand" "=x")
21510 (match_operator:V2DI 3 "sse_comparison_operator"
21511 [(match_operand:V2DF 1 "register_operand" "0")
21512 (match_operand:V2DF 2 "nonimmediate_operand" "x")]))
21513 (subreg:V2DI (match_dup 1) 0)
21517 if (GET_CODE (operands[3]) == UNORDERED)
21518 return "cmpordsd\t{%2, %0|%0, %2}";
21520 return "cmpn%D3sd\t{%2, %0|%0, %2}";
21522 [(set_attr "type" "ssecmp")
21523 (set_attr "mode" "DF")])
21525 (define_insn "sse2_comi"
21526 [(set (reg:CCFP 17)
21527 (compare:CCFP (vec_select:DF
21528 (match_operand:V2DF 0 "register_operand" "x")
21529 (parallel [(const_int 0)]))
21531 (match_operand:V2DF 1 "register_operand" "x")
21532 (parallel [(const_int 0)]))))]
21534 "comisd\t{%1, %0|%0, %1}"
21535 [(set_attr "type" "ssecomi")
21536 (set_attr "mode" "DF")])
21538 (define_insn "sse2_ucomi"
21539 [(set (reg:CCFPU 17)
21540 (compare:CCFPU (vec_select:DF
21541 (match_operand:V2DF 0 "register_operand" "x")
21542 (parallel [(const_int 0)]))
21544 (match_operand:V2DF 1 "register_operand" "x")
21545 (parallel [(const_int 0)]))))]
21547 "ucomisd\t{%1, %0|%0, %1}"
21548 [(set_attr "type" "ssecomi")
21549 (set_attr "mode" "DF")])
21551 ;; SSE Strange Moves.
21553 (define_insn "sse2_movmskpd"
21554 [(set (match_operand:SI 0 "register_operand" "=r")
21555 (unspec:SI [(match_operand:V2DF 1 "register_operand" "x")]
21558 "movmskpd\t{%1, %0|%0, %1}"
21559 [(set_attr "type" "ssecvt")
21560 (set_attr "mode" "V2DF")])
21562 (define_insn "sse2_pmovmskb"
21563 [(set (match_operand:SI 0 "register_operand" "=r")
21564 (unspec:SI [(match_operand:V16QI 1 "register_operand" "x")]
21567 "pmovmskb\t{%1, %0|%0, %1}"
21568 [(set_attr "type" "ssecvt")
21569 (set_attr "mode" "V2DF")])
21571 (define_insn "sse2_maskmovdqu"
21572 [(set (mem:V16QI (match_operand:SI 0 "register_operand" "D"))
21573 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
21574 (match_operand:V16QI 2 "register_operand" "x")]
21577 ;; @@@ check ordering of operands in intel/nonintel syntax
21578 "maskmovdqu\t{%2, %1|%1, %2}"
21579 [(set_attr "type" "ssecvt")
21580 (set_attr "mode" "TI")])
21582 (define_insn "sse2_maskmovdqu_rex64"
21583 [(set (mem:V16QI (match_operand:DI 0 "register_operand" "D"))
21584 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
21585 (match_operand:V16QI 2 "register_operand" "x")]
21588 ;; @@@ check ordering of operands in intel/nonintel syntax
21589 "maskmovdqu\t{%2, %1|%1, %2}"
21590 [(set_attr "type" "ssecvt")
21591 (set_attr "mode" "TI")])
21593 (define_insn "sse2_movntv2df"
21594 [(set (match_operand:V2DF 0 "memory_operand" "=m")
21595 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")]
21598 "movntpd\t{%1, %0|%0, %1}"
21599 [(set_attr "type" "ssecvt")
21600 (set_attr "mode" "V2DF")])
21602 (define_insn "sse2_movntv2di"
21603 [(set (match_operand:V2DI 0 "memory_operand" "=m")
21604 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "x")]
21607 "movntdq\t{%1, %0|%0, %1}"
21608 [(set_attr "type" "ssecvt")
21609 (set_attr "mode" "TI")])
21611 (define_insn "sse2_movntsi"
21612 [(set (match_operand:SI 0 "memory_operand" "=m")
21613 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
21616 "movnti\t{%1, %0|%0, %1}"
21617 [(set_attr "type" "ssecvt")
21618 (set_attr "mode" "V2DF")])
21620 ;; SSE <-> integer/MMX conversions
21622 ;; Conversions between SI and SF
21624 (define_insn "cvtdq2ps"
21625 [(set (match_operand:V4SF 0 "register_operand" "=x")
21626 (float:V4SF (match_operand:V4SI 1 "nonimmediate_operand" "xm")))]
21628 "cvtdq2ps\t{%1, %0|%0, %1}"
21629 [(set_attr "type" "ssecvt")
21630 (set_attr "mode" "V2DF")])
21632 (define_insn "cvtps2dq"
21633 [(set (match_operand:V4SI 0 "register_operand" "=x")
21634 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
21636 "cvtps2dq\t{%1, %0|%0, %1}"
21637 [(set_attr "type" "ssecvt")
21638 (set_attr "mode" "TI")])
21640 (define_insn "cvttps2dq"
21641 [(set (match_operand:V4SI 0 "register_operand" "=x")
21642 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
21645 "cvttps2dq\t{%1, %0|%0, %1}"
21646 [(set_attr "type" "ssecvt")
21647 (set_attr "mode" "TI")])
21649 ;; Conversions between SI and DF
21651 (define_insn "cvtdq2pd"
21652 [(set (match_operand:V2DF 0 "register_operand" "=x")
21653 (float:V2DF (vec_select:V2SI
21654 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
21657 (const_int 1)]))))]
21659 "cvtdq2pd\t{%1, %0|%0, %1}"
21660 [(set_attr "type" "ssecvt")
21661 (set_attr "mode" "V2DF")])
21663 (define_insn "cvtpd2dq"
21664 [(set (match_operand:V4SI 0 "register_operand" "=x")
21666 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm"))
21667 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
21669 "cvtpd2dq\t{%1, %0|%0, %1}"
21670 [(set_attr "type" "ssecvt")
21671 (set_attr "mode" "TI")])
21673 (define_insn "cvttpd2dq"
21674 [(set (match_operand:V4SI 0 "register_operand" "=x")
21676 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
21678 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
21680 "cvttpd2dq\t{%1, %0|%0, %1}"
21681 [(set_attr "type" "ssecvt")
21682 (set_attr "mode" "TI")])
21684 (define_insn "cvtpd2pi"
21685 [(set (match_operand:V2SI 0 "register_operand" "=y")
21686 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
21688 "cvtpd2pi\t{%1, %0|%0, %1}"
21689 [(set_attr "type" "ssecvt")
21690 (set_attr "mode" "TI")])
21692 (define_insn "cvttpd2pi"
21693 [(set (match_operand:V2SI 0 "register_operand" "=y")
21694 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
21697 "cvttpd2pi\t{%1, %0|%0, %1}"
21698 [(set_attr "type" "ssecvt")
21699 (set_attr "mode" "TI")])
21701 (define_insn "cvtpi2pd"
21702 [(set (match_operand:V2DF 0 "register_operand" "=x")
21703 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
21705 "cvtpi2pd\t{%1, %0|%0, %1}"
21706 [(set_attr "type" "ssecvt")
21707 (set_attr "mode" "TI")])
21709 ;; Conversions between SI and DF
21711 (define_insn "cvtsd2si"
21712 [(set (match_operand:SI 0 "register_operand" "=r")
21713 (fix:SI (vec_select:DF (match_operand:V2DF 1 "register_operand" "xm")
21714 (parallel [(const_int 0)]))))]
21716 "cvtsd2si\t{%1, %0|%0, %1}"
21717 [(set_attr "type" "sseicvt")
21718 (set_attr "mode" "SI")])
21720 (define_insn "cvttsd2si"
21721 [(set (match_operand:SI 0 "register_operand" "=r,r")
21722 (unspec:SI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "x,xm")
21723 (parallel [(const_int 0)]))] UNSPEC_FIX))]
21725 "cvttsd2si\t{%1, %0|%0, %1}"
21726 [(set_attr "type" "sseicvt")
21727 (set_attr "mode" "SI")
21728 (set_attr "athlon_decode" "double,vector")])
21730 (define_insn "cvtsi2sd"
21731 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
21732 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0,0")
21733 (vec_duplicate:V2DF
21735 (match_operand:SI 2 "nonimmediate_operand" "r,rm")))
21738 "cvtsi2sd\t{%2, %0|%0, %2}"
21739 [(set_attr "type" "sseicvt")
21740 (set_attr "mode" "DF")
21741 (set_attr "athlon_decode" "double,direct")])
21743 ;; Conversions between SF and DF
21745 (define_insn "cvtsd2ss"
21746 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
21747 (vec_merge:V4SF (match_operand:V4SF 1 "register_operand" "0,0")
21748 (vec_duplicate:V4SF
21749 (float_truncate:V2SF
21750 (match_operand:V2DF 2 "nonimmediate_operand" "x,xm")))
21753 "cvtsd2ss\t{%2, %0|%0, %2}"
21754 [(set_attr "type" "ssecvt")
21755 (set_attr "athlon_decode" "vector,double")
21756 (set_attr "mode" "SF")])
21758 (define_insn "cvtss2sd"
21759 [(set (match_operand:V2DF 0 "register_operand" "=x")
21760 (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0")
21763 (match_operand:V4SF 2 "nonimmediate_operand" "xm")
21764 (parallel [(const_int 0)
21768 "cvtss2sd\t{%2, %0|%0, %2}"
21769 [(set_attr "type" "ssecvt")
21770 (set_attr "mode" "DF")])
21772 (define_insn "cvtpd2ps"
21773 [(set (match_operand:V4SF 0 "register_operand" "=x")
21776 (subreg:V2SI (float_truncate:V2SF
21777 (match_operand:V2DF 1 "nonimmediate_operand" "xm")) 0)
21778 (const_vector:V2SI [(const_int 0) (const_int 0)])) 0))]
21780 "cvtpd2ps\t{%1, %0|%0, %1}"
21781 [(set_attr "type" "ssecvt")
21782 (set_attr "mode" "V4SF")])
21784 (define_insn "cvtps2pd"
21785 [(set (match_operand:V2DF 0 "register_operand" "=x")
21787 (vec_select:V2SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")
21788 (parallel [(const_int 0)
21789 (const_int 1)]))))]
21791 "cvtps2pd\t{%1, %0|%0, %1}"
21792 [(set_attr "type" "ssecvt")
21793 (set_attr "mode" "V2DF")])
21795 ;; SSE2 variants of MMX insns
21799 (define_insn "addv16qi3"
21800 [(set (match_operand:V16QI 0 "register_operand" "=x")
21801 (plus:V16QI (match_operand:V16QI 1 "register_operand" "0")
21802 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21804 "paddb\t{%2, %0|%0, %2}"
21805 [(set_attr "type" "sseiadd")
21806 (set_attr "mode" "TI")])
21808 (define_insn "addv8hi3"
21809 [(set (match_operand:V8HI 0 "register_operand" "=x")
21810 (plus:V8HI (match_operand:V8HI 1 "register_operand" "0")
21811 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21813 "paddw\t{%2, %0|%0, %2}"
21814 [(set_attr "type" "sseiadd")
21815 (set_attr "mode" "TI")])
21817 (define_insn "addv4si3"
21818 [(set (match_operand:V4SI 0 "register_operand" "=x")
21819 (plus:V4SI (match_operand:V4SI 1 "register_operand" "0")
21820 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
21822 "paddd\t{%2, %0|%0, %2}"
21823 [(set_attr "type" "sseiadd")
21824 (set_attr "mode" "TI")])
21826 (define_insn "addv2di3"
21827 [(set (match_operand:V2DI 0 "register_operand" "=x")
21828 (plus:V2DI (match_operand:V2DI 1 "register_operand" "0")
21829 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
21831 "paddq\t{%2, %0|%0, %2}"
21832 [(set_attr "type" "sseiadd")
21833 (set_attr "mode" "TI")])
21835 (define_insn "ssaddv16qi3"
21836 [(set (match_operand:V16QI 0 "register_operand" "=x")
21837 (ss_plus:V16QI (match_operand:V16QI 1 "register_operand" "0")
21838 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21840 "paddsb\t{%2, %0|%0, %2}"
21841 [(set_attr "type" "sseiadd")
21842 (set_attr "mode" "TI")])
21844 (define_insn "ssaddv8hi3"
21845 [(set (match_operand:V8HI 0 "register_operand" "=x")
21846 (ss_plus:V8HI (match_operand:V8HI 1 "register_operand" "0")
21847 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21849 "paddsw\t{%2, %0|%0, %2}"
21850 [(set_attr "type" "sseiadd")
21851 (set_attr "mode" "TI")])
21853 (define_insn "usaddv16qi3"
21854 [(set (match_operand:V16QI 0 "register_operand" "=x")
21855 (us_plus:V16QI (match_operand:V16QI 1 "register_operand" "0")
21856 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21858 "paddusb\t{%2, %0|%0, %2}"
21859 [(set_attr "type" "sseiadd")
21860 (set_attr "mode" "TI")])
21862 (define_insn "usaddv8hi3"
21863 [(set (match_operand:V8HI 0 "register_operand" "=x")
21864 (us_plus:V8HI (match_operand:V8HI 1 "register_operand" "0")
21865 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21867 "paddusw\t{%2, %0|%0, %2}"
21868 [(set_attr "type" "sseiadd")
21869 (set_attr "mode" "TI")])
21871 (define_insn "subv16qi3"
21872 [(set (match_operand:V16QI 0 "register_operand" "=x")
21873 (minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
21874 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21876 "psubb\t{%2, %0|%0, %2}"
21877 [(set_attr "type" "sseiadd")
21878 (set_attr "mode" "TI")])
21880 (define_insn "subv8hi3"
21881 [(set (match_operand:V8HI 0 "register_operand" "=x")
21882 (minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
21883 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21885 "psubw\t{%2, %0|%0, %2}"
21886 [(set_attr "type" "sseiadd")
21887 (set_attr "mode" "TI")])
21889 (define_insn "subv4si3"
21890 [(set (match_operand:V4SI 0 "register_operand" "=x")
21891 (minus:V4SI (match_operand:V4SI 1 "register_operand" "0")
21892 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
21894 "psubd\t{%2, %0|%0, %2}"
21895 [(set_attr "type" "sseiadd")
21896 (set_attr "mode" "TI")])
21898 (define_insn "subv2di3"
21899 [(set (match_operand:V2DI 0 "register_operand" "=x")
21900 (minus:V2DI (match_operand:V2DI 1 "register_operand" "0")
21901 (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
21903 "psubq\t{%2, %0|%0, %2}"
21904 [(set_attr "type" "sseiadd")
21905 (set_attr "mode" "TI")])
21907 (define_insn "sssubv16qi3"
21908 [(set (match_operand:V16QI 0 "register_operand" "=x")
21909 (ss_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
21910 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21912 "psubsb\t{%2, %0|%0, %2}"
21913 [(set_attr "type" "sseiadd")
21914 (set_attr "mode" "TI")])
21916 (define_insn "sssubv8hi3"
21917 [(set (match_operand:V8HI 0 "register_operand" "=x")
21918 (ss_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
21919 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21921 "psubsw\t{%2, %0|%0, %2}"
21922 [(set_attr "type" "sseiadd")
21923 (set_attr "mode" "TI")])
21925 (define_insn "ussubv16qi3"
21926 [(set (match_operand:V16QI 0 "register_operand" "=x")
21927 (us_minus:V16QI (match_operand:V16QI 1 "register_operand" "0")
21928 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
21930 "psubusb\t{%2, %0|%0, %2}"
21931 [(set_attr "type" "sseiadd")
21932 (set_attr "mode" "TI")])
21934 (define_insn "ussubv8hi3"
21935 [(set (match_operand:V8HI 0 "register_operand" "=x")
21936 (us_minus:V8HI (match_operand:V8HI 1 "register_operand" "0")
21937 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21939 "psubusw\t{%2, %0|%0, %2}"
21940 [(set_attr "type" "sseiadd")
21941 (set_attr "mode" "TI")])
21943 (define_insn "mulv8hi3"
21944 [(set (match_operand:V8HI 0 "register_operand" "=x")
21945 (mult:V8HI (match_operand:V8HI 1 "register_operand" "0")
21946 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
21948 "pmullw\t{%2, %0|%0, %2}"
21949 [(set_attr "type" "sseimul")
21950 (set_attr "mode" "TI")])
21952 (define_insn "smulv8hi3_highpart"
21953 [(set (match_operand:V8HI 0 "register_operand" "=x")
21956 (mult:V8SI (sign_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
21957 (sign_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
21960 "pmulhw\t{%2, %0|%0, %2}"
21961 [(set_attr "type" "sseimul")
21962 (set_attr "mode" "TI")])
21964 (define_insn "umulv8hi3_highpart"
21965 [(set (match_operand:V8HI 0 "register_operand" "=x")
21968 (mult:V8SI (zero_extend:V8SI (match_operand:V8HI 1 "register_operand" "0"))
21969 (zero_extend:V8SI (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
21972 "pmulhuw\t{%2, %0|%0, %2}"
21973 [(set_attr "type" "sseimul")
21974 (set_attr "mode" "TI")])
21976 (define_insn "sse2_umulsidi3"
21977 [(set (match_operand:DI 0 "register_operand" "=y")
21978 (mult:DI (zero_extend:DI (vec_select:SI
21979 (match_operand:V2SI 1 "register_operand" "0")
21980 (parallel [(const_int 0)])))
21981 (zero_extend:DI (vec_select:SI
21982 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
21983 (parallel [(const_int 0)])))))]
21985 "pmuludq\t{%2, %0|%0, %2}"
21986 [(set_attr "type" "sseimul")
21987 (set_attr "mode" "TI")])
21989 (define_insn "sse2_umulv2siv2di3"
21990 [(set (match_operand:V2DI 0 "register_operand" "=x")
21991 (mult:V2DI (zero_extend:V2DI
21993 (match_operand:V4SI 1 "register_operand" "0")
21994 (parallel [(const_int 0) (const_int 2)])))
21997 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
21998 (parallel [(const_int 0) (const_int 2)])))))]
22000 "pmuludq\t{%2, %0|%0, %2}"
22001 [(set_attr "type" "sseimul")
22002 (set_attr "mode" "TI")])
22004 (define_insn "sse2_pmaddwd"
22005 [(set (match_operand:V4SI 0 "register_operand" "=x")
22008 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 1 "register_operand" "0")
22009 (parallel [(const_int 0)
22013 (sign_extend:V4SI (vec_select:V4HI (match_operand:V8HI 2 "nonimmediate_operand" "xm")
22014 (parallel [(const_int 0)
22019 (sign_extend:V4SI (vec_select:V4HI (match_dup 1)
22020 (parallel [(const_int 1)
22024 (sign_extend:V4SI (vec_select:V4HI (match_dup 2)
22025 (parallel [(const_int 1)
22028 (const_int 7)]))))))]
22030 "pmaddwd\t{%2, %0|%0, %2}"
22031 [(set_attr "type" "sseiadd")
22032 (set_attr "mode" "TI")])
22034 ;; Same as pxor, but don't show input operands so that we don't think
22036 (define_insn "sse2_clrti"
22037 [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))]
22040 if (get_attr_mode (insn) == MODE_TI)
22041 return "pxor\t%0, %0";
22043 return "xorps\t%0, %0";
22045 [(set_attr "type" "ssemov")
22046 (set_attr "memory" "none")
22049 (ne (symbol_ref "optimize_size")
22051 (const_string "V4SF")
22052 (const_string "TI")))])
22054 ;; MMX unsigned averages/sum of absolute differences
22056 (define_insn "sse2_uavgv16qi3"
22057 [(set (match_operand:V16QI 0 "register_operand" "=x")
22059 (plus:V16QI (plus:V16QI
22060 (match_operand:V16QI 1 "register_operand" "0")
22061 (match_operand:V16QI 2 "nonimmediate_operand" "xm"))
22062 (const_vector:V16QI [(const_int 1) (const_int 1)
22063 (const_int 1) (const_int 1)
22064 (const_int 1) (const_int 1)
22065 (const_int 1) (const_int 1)
22066 (const_int 1) (const_int 1)
22067 (const_int 1) (const_int 1)
22068 (const_int 1) (const_int 1)
22069 (const_int 1) (const_int 1)]))
22072 "pavgb\t{%2, %0|%0, %2}"
22073 [(set_attr "type" "sseiadd")
22074 (set_attr "mode" "TI")])
22076 (define_insn "sse2_uavgv8hi3"
22077 [(set (match_operand:V8HI 0 "register_operand" "=x")
22079 (plus:V8HI (plus:V8HI
22080 (match_operand:V8HI 1 "register_operand" "0")
22081 (match_operand:V8HI 2 "nonimmediate_operand" "xm"))
22082 (const_vector:V8HI [(const_int 1) (const_int 1)
22083 (const_int 1) (const_int 1)
22084 (const_int 1) (const_int 1)
22085 (const_int 1) (const_int 1)]))
22088 "pavgw\t{%2, %0|%0, %2}"
22089 [(set_attr "type" "sseiadd")
22090 (set_attr "mode" "TI")])
22092 ;; @@@ this isn't the right representation.
22093 (define_insn "sse2_psadbw"
22094 [(set (match_operand:V2DI 0 "register_operand" "=x")
22095 (unspec:V2DI [(match_operand:V16QI 1 "register_operand" "0")
22096 (match_operand:V16QI 2 "nonimmediate_operand" "xm")]
22099 "psadbw\t{%2, %0|%0, %2}"
22100 [(set_attr "type" "sseiadd")
22101 (set_attr "mode" "TI")])
22104 ;; MMX insert/extract/shuffle
22106 (define_insn "sse2_pinsrw"
22107 [(set (match_operand:V8HI 0 "register_operand" "=x")
22108 (vec_merge:V8HI (match_operand:V8HI 1 "register_operand" "0")
22109 (vec_duplicate:V8HI
22110 (match_operand:SI 2 "nonimmediate_operand" "rm"))
22111 (match_operand:SI 3 "immediate_operand" "i")))]
22113 "pinsrw\t{%3, %2, %0|%0, %2, %3}"
22114 [(set_attr "type" "ssecvt")
22115 (set_attr "mode" "TI")])
22117 (define_insn "sse2_pextrw"
22118 [(set (match_operand:SI 0 "register_operand" "=r")
22120 (vec_select:HI (match_operand:V8HI 1 "register_operand" "x")
22122 [(match_operand:SI 2 "immediate_operand" "i")]))))]
22124 "pextrw\t{%2, %1, %0|%0, %1, %2}"
22125 [(set_attr "type" "ssecvt")
22126 (set_attr "mode" "TI")])
22128 (define_insn "sse2_pshufd"
22129 [(set (match_operand:V4SI 0 "register_operand" "=x")
22130 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "0")
22131 (match_operand:SI 2 "immediate_operand" "i")]
22134 "pshufd\t{%2, %1, %0|%0, %1, %2}"
22135 [(set_attr "type" "ssecvt")
22136 (set_attr "mode" "TI")])
22138 (define_insn "sse2_pshuflw"
22139 [(set (match_operand:V8HI 0 "register_operand" "=x")
22140 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "0")
22141 (match_operand:SI 2 "immediate_operand" "i")]
22144 "pshuflw\t{%2, %1, %0|%0, %1, %2}"
22145 [(set_attr "type" "ssecvt")
22146 (set_attr "mode" "TI")])
22148 (define_insn "sse2_pshufhw"
22149 [(set (match_operand:V8HI 0 "register_operand" "=x")
22150 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "0")
22151 (match_operand:SI 2 "immediate_operand" "i")]
22154 "pshufhw\t{%2, %1, %0|%0, %1, %2}"
22155 [(set_attr "type" "ssecvt")
22156 (set_attr "mode" "TI")])
22158 ;; MMX mask-generating comparisons
22160 (define_insn "eqv16qi3"
22161 [(set (match_operand:V16QI 0 "register_operand" "=x")
22162 (eq:V16QI (match_operand:V16QI 1 "register_operand" "0")
22163 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
22165 "pcmpeqb\t{%2, %0|%0, %2}"
22166 [(set_attr "type" "ssecmp")
22167 (set_attr "mode" "TI")])
22169 (define_insn "eqv8hi3"
22170 [(set (match_operand:V8HI 0 "register_operand" "=x")
22171 (eq:V8HI (match_operand:V8HI 1 "register_operand" "0")
22172 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
22174 "pcmpeqw\t{%2, %0|%0, %2}"
22175 [(set_attr "type" "ssecmp")
22176 (set_attr "mode" "TI")])
22178 (define_insn "eqv4si3"
22179 [(set (match_operand:V4SI 0 "register_operand" "=x")
22180 (eq:V4SI (match_operand:V4SI 1 "register_operand" "0")
22181 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
22183 "pcmpeqd\t{%2, %0|%0, %2}"
22184 [(set_attr "type" "ssecmp")
22185 (set_attr "mode" "TI")])
22187 (define_insn "gtv16qi3"
22188 [(set (match_operand:V16QI 0 "register_operand" "=x")
22189 (gt:V16QI (match_operand:V16QI 1 "register_operand" "0")
22190 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
22192 "pcmpgtb\t{%2, %0|%0, %2}"
22193 [(set_attr "type" "ssecmp")
22194 (set_attr "mode" "TI")])
22196 (define_insn "gtv8hi3"
22197 [(set (match_operand:V8HI 0 "register_operand" "=x")
22198 (gt:V8HI (match_operand:V8HI 1 "register_operand" "0")
22199 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
22201 "pcmpgtw\t{%2, %0|%0, %2}"
22202 [(set_attr "type" "ssecmp")
22203 (set_attr "mode" "TI")])
22205 (define_insn "gtv4si3"
22206 [(set (match_operand:V4SI 0 "register_operand" "=x")
22207 (gt:V4SI (match_operand:V4SI 1 "register_operand" "0")
22208 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
22210 "pcmpgtd\t{%2, %0|%0, %2}"
22211 [(set_attr "type" "ssecmp")
22212 (set_attr "mode" "TI")])
22215 ;; MMX max/min insns
22217 (define_insn "umaxv16qi3"
22218 [(set (match_operand:V16QI 0 "register_operand" "=x")
22219 (umax:V16QI (match_operand:V16QI 1 "register_operand" "0")
22220 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
22222 "pmaxub\t{%2, %0|%0, %2}"
22223 [(set_attr "type" "sseiadd")
22224 (set_attr "mode" "TI")])
22226 (define_insn "smaxv8hi3"
22227 [(set (match_operand:V8HI 0 "register_operand" "=x")
22228 (smax:V8HI (match_operand:V8HI 1 "register_operand" "0")
22229 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
22231 "pmaxsw\t{%2, %0|%0, %2}"
22232 [(set_attr "type" "sseiadd")
22233 (set_attr "mode" "TI")])
22235 (define_insn "uminv16qi3"
22236 [(set (match_operand:V16QI 0 "register_operand" "=x")
22237 (umin:V16QI (match_operand:V16QI 1 "register_operand" "0")
22238 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
22240 "pminub\t{%2, %0|%0, %2}"
22241 [(set_attr "type" "sseiadd")
22242 (set_attr "mode" "TI")])
22244 (define_insn "sminv8hi3"
22245 [(set (match_operand:V8HI 0 "register_operand" "=x")
22246 (smin:V8HI (match_operand:V8HI 1 "register_operand" "0")
22247 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
22249 "pminsw\t{%2, %0|%0, %2}"
22250 [(set_attr "type" "sseiadd")
22251 (set_attr "mode" "TI")])
22256 (define_insn "ashrv8hi3"
22257 [(set (match_operand:V8HI 0 "register_operand" "=x")
22258 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
22259 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22261 "psraw\t{%2, %0|%0, %2}"
22262 [(set_attr "type" "sseishft")
22263 (set_attr "mode" "TI")])
22265 (define_insn "ashrv4si3"
22266 [(set (match_operand:V4SI 0 "register_operand" "=x")
22267 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
22268 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22270 "psrad\t{%2, %0|%0, %2}"
22271 [(set_attr "type" "sseishft")
22272 (set_attr "mode" "TI")])
22274 (define_insn "lshrv8hi3"
22275 [(set (match_operand:V8HI 0 "register_operand" "=x")
22276 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
22277 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22279 "psrlw\t{%2, %0|%0, %2}"
22280 [(set_attr "type" "sseishft")
22281 (set_attr "mode" "TI")])
22283 (define_insn "lshrv4si3"
22284 [(set (match_operand:V4SI 0 "register_operand" "=x")
22285 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
22286 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22288 "psrld\t{%2, %0|%0, %2}"
22289 [(set_attr "type" "sseishft")
22290 (set_attr "mode" "TI")])
22292 (define_insn "lshrv2di3"
22293 [(set (match_operand:V2DI 0 "register_operand" "=x")
22294 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
22295 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22297 "psrlq\t{%2, %0|%0, %2}"
22298 [(set_attr "type" "sseishft")
22299 (set_attr "mode" "TI")])
22301 (define_insn "ashlv8hi3"
22302 [(set (match_operand:V8HI 0 "register_operand" "=x")
22303 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
22304 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22306 "psllw\t{%2, %0|%0, %2}"
22307 [(set_attr "type" "sseishft")
22308 (set_attr "mode" "TI")])
22310 (define_insn "ashlv4si3"
22311 [(set (match_operand:V4SI 0 "register_operand" "=x")
22312 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
22313 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22315 "pslld\t{%2, %0|%0, %2}"
22316 [(set_attr "type" "sseishft")
22317 (set_attr "mode" "TI")])
22319 (define_insn "ashlv2di3"
22320 [(set (match_operand:V2DI 0 "register_operand" "=x")
22321 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
22322 (match_operand:SI 2 "nonmemory_operand" "xi")))]
22324 "psllq\t{%2, %0|%0, %2}"
22325 [(set_attr "type" "sseishft")
22326 (set_attr "mode" "TI")])
22328 (define_insn "ashrv8hi3_ti"
22329 [(set (match_operand:V8HI 0 "register_operand" "=x")
22330 (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
22331 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22333 "psraw\t{%2, %0|%0, %2}"
22334 [(set_attr "type" "sseishft")
22335 (set_attr "mode" "TI")])
22337 (define_insn "ashrv4si3_ti"
22338 [(set (match_operand:V4SI 0 "register_operand" "=x")
22339 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
22340 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22342 "psrad\t{%2, %0|%0, %2}"
22343 [(set_attr "type" "sseishft")
22344 (set_attr "mode" "TI")])
22346 (define_insn "lshrv8hi3_ti"
22347 [(set (match_operand:V8HI 0 "register_operand" "=x")
22348 (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0")
22349 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22351 "psrlw\t{%2, %0|%0, %2}"
22352 [(set_attr "type" "sseishft")
22353 (set_attr "mode" "TI")])
22355 (define_insn "lshrv4si3_ti"
22356 [(set (match_operand:V4SI 0 "register_operand" "=x")
22357 (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0")
22358 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22360 "psrld\t{%2, %0|%0, %2}"
22361 [(set_attr "type" "sseishft")
22362 (set_attr "mode" "TI")])
22364 (define_insn "lshrv2di3_ti"
22365 [(set (match_operand:V2DI 0 "register_operand" "=x")
22366 (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0")
22367 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22369 "psrlq\t{%2, %0|%0, %2}"
22370 [(set_attr "type" "sseishft")
22371 (set_attr "mode" "TI")])
22373 (define_insn "ashlv8hi3_ti"
22374 [(set (match_operand:V8HI 0 "register_operand" "=x")
22375 (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0")
22376 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22378 "psllw\t{%2, %0|%0, %2}"
22379 [(set_attr "type" "sseishft")
22380 (set_attr "mode" "TI")])
22382 (define_insn "ashlv4si3_ti"
22383 [(set (match_operand:V4SI 0 "register_operand" "=x")
22384 (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0")
22385 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22387 "pslld\t{%2, %0|%0, %2}"
22388 [(set_attr "type" "sseishft")
22389 (set_attr "mode" "TI")])
22391 (define_insn "ashlv2di3_ti"
22392 [(set (match_operand:V2DI 0 "register_operand" "=x")
22393 (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0")
22394 (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))]
22396 "psllq\t{%2, %0|%0, %2}"
22397 [(set_attr "type" "sseishft")
22398 (set_attr "mode" "TI")])
22400 ;; See logical MMX insns for the reason for the unspec. Strictly speaking
22401 ;; we wouldn't need here it since we never generate TImode arithmetic.
22403 ;; There has to be some kind of prize for the weirdest new instruction...
22404 (define_insn "sse2_ashlti3"
22405 [(set (match_operand:TI 0 "register_operand" "=x")
22407 [(ashift:TI (match_operand:TI 1 "register_operand" "0")
22408 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
22409 (const_int 8)))] UNSPEC_NOP))]
22411 "pslldq\t{%2, %0|%0, %2}"
22412 [(set_attr "type" "sseishft")
22413 (set_attr "mode" "TI")])
22415 (define_insn "sse2_lshrti3"
22416 [(set (match_operand:TI 0 "register_operand" "=x")
22418 [(lshiftrt:TI (match_operand:TI 1 "register_operand" "0")
22419 (mult:SI (match_operand:SI 2 "immediate_operand" "i")
22420 (const_int 8)))] UNSPEC_NOP))]
22422 "psrldq\t{%2, %0|%0, %2}"
22423 [(set_attr "type" "sseishft")
22424 (set_attr "mode" "TI")])
22428 (define_insn "sse2_unpckhpd"
22429 [(set (match_operand:V2DF 0 "register_operand" "=x")
22431 (vec_select:DF (match_operand:V2DF 1 "register_operand" "0")
22432 (parallel [(const_int 1)]))
22433 (vec_select:DF (match_operand:V2DF 2 "register_operand" "x")
22434 (parallel [(const_int 0)]))))]
22436 "unpckhpd\t{%2, %0|%0, %2}"
22437 [(set_attr "type" "ssecvt")
22438 (set_attr "mode" "TI")])
22440 (define_insn "sse2_unpcklpd"
22441 [(set (match_operand:V2DF 0 "register_operand" "=x")
22443 (vec_select:DF (match_operand:V2DF 1 "register_operand" "0")
22444 (parallel [(const_int 0)]))
22445 (vec_select:DF (match_operand:V2DF 2 "register_operand" "x")
22446 (parallel [(const_int 1)]))))]
22448 "unpcklpd\t{%2, %0|%0, %2}"
22449 [(set_attr "type" "ssecvt")
22450 (set_attr "mode" "TI")])
22452 ;; MMX pack/unpack insns.
22454 (define_insn "sse2_packsswb"
22455 [(set (match_operand:V16QI 0 "register_operand" "=x")
22457 (ss_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
22458 (ss_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
22460 "packsswb\t{%2, %0|%0, %2}"
22461 [(set_attr "type" "ssecvt")
22462 (set_attr "mode" "TI")])
22464 (define_insn "sse2_packssdw"
22465 [(set (match_operand:V8HI 0 "register_operand" "=x")
22467 (ss_truncate:V4HI (match_operand:V4SI 1 "register_operand" "0"))
22468 (ss_truncate:V4HI (match_operand:V4SI 2 "register_operand" "x"))))]
22470 "packssdw\t{%2, %0|%0, %2}"
22471 [(set_attr "type" "ssecvt")
22472 (set_attr "mode" "TI")])
22474 (define_insn "sse2_packuswb"
22475 [(set (match_operand:V16QI 0 "register_operand" "=x")
22477 (us_truncate:V8QI (match_operand:V8HI 1 "register_operand" "0"))
22478 (us_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
22480 "packuswb\t{%2, %0|%0, %2}"
22481 [(set_attr "type" "ssecvt")
22482 (set_attr "mode" "TI")])
22484 (define_insn "sse2_punpckhbw"
22485 [(set (match_operand:V16QI 0 "register_operand" "=x")
22487 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
22488 (parallel [(const_int 8) (const_int 0)
22489 (const_int 9) (const_int 1)
22490 (const_int 10) (const_int 2)
22491 (const_int 11) (const_int 3)
22492 (const_int 12) (const_int 4)
22493 (const_int 13) (const_int 5)
22494 (const_int 14) (const_int 6)
22495 (const_int 15) (const_int 7)]))
22496 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
22497 (parallel [(const_int 0) (const_int 8)
22498 (const_int 1) (const_int 9)
22499 (const_int 2) (const_int 10)
22500 (const_int 3) (const_int 11)
22501 (const_int 4) (const_int 12)
22502 (const_int 5) (const_int 13)
22503 (const_int 6) (const_int 14)
22504 (const_int 7) (const_int 15)]))
22505 (const_int 21845)))]
22507 "punpckhbw\t{%2, %0|%0, %2}"
22508 [(set_attr "type" "ssecvt")
22509 (set_attr "mode" "TI")])
22511 (define_insn "sse2_punpckhwd"
22512 [(set (match_operand:V8HI 0 "register_operand" "=x")
22514 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
22515 (parallel [(const_int 4) (const_int 0)
22516 (const_int 5) (const_int 1)
22517 (const_int 6) (const_int 2)
22518 (const_int 7) (const_int 3)]))
22519 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
22520 (parallel [(const_int 0) (const_int 4)
22521 (const_int 1) (const_int 5)
22522 (const_int 2) (const_int 6)
22523 (const_int 3) (const_int 7)]))
22526 "punpckhwd\t{%2, %0|%0, %2}"
22527 [(set_attr "type" "ssecvt")
22528 (set_attr "mode" "TI")])
22530 (define_insn "sse2_punpckhdq"
22531 [(set (match_operand:V4SI 0 "register_operand" "=x")
22533 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
22534 (parallel [(const_int 2) (const_int 0)
22535 (const_int 3) (const_int 1)]))
22536 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
22537 (parallel [(const_int 0) (const_int 2)
22538 (const_int 1) (const_int 3)]))
22541 "punpckhdq\t{%2, %0|%0, %2}"
22542 [(set_attr "type" "ssecvt")
22543 (set_attr "mode" "TI")])
22545 (define_insn "sse2_punpcklbw"
22546 [(set (match_operand:V16QI 0 "register_operand" "=x")
22548 (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "0")
22549 (parallel [(const_int 0) (const_int 8)
22550 (const_int 1) (const_int 9)
22551 (const_int 2) (const_int 10)
22552 (const_int 3) (const_int 11)
22553 (const_int 4) (const_int 12)
22554 (const_int 5) (const_int 13)
22555 (const_int 6) (const_int 14)
22556 (const_int 7) (const_int 15)]))
22557 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "x")
22558 (parallel [(const_int 8) (const_int 0)
22559 (const_int 9) (const_int 1)
22560 (const_int 10) (const_int 2)
22561 (const_int 11) (const_int 3)
22562 (const_int 12) (const_int 4)
22563 (const_int 13) (const_int 5)
22564 (const_int 14) (const_int 6)
22565 (const_int 15) (const_int 7)]))
22566 (const_int 21845)))]
22568 "punpcklbw\t{%2, %0|%0, %2}"
22569 [(set_attr "type" "ssecvt")
22570 (set_attr "mode" "TI")])
22572 (define_insn "sse2_punpcklwd"
22573 [(set (match_operand:V8HI 0 "register_operand" "=x")
22575 (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "0")
22576 (parallel [(const_int 0) (const_int 4)
22577 (const_int 1) (const_int 5)
22578 (const_int 2) (const_int 6)
22579 (const_int 3) (const_int 7)]))
22580 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "x")
22581 (parallel [(const_int 4) (const_int 0)
22582 (const_int 5) (const_int 1)
22583 (const_int 6) (const_int 2)
22584 (const_int 7) (const_int 3)]))
22587 "punpcklwd\t{%2, %0|%0, %2}"
22588 [(set_attr "type" "ssecvt")
22589 (set_attr "mode" "TI")])
22591 (define_insn "sse2_punpckldq"
22592 [(set (match_operand:V4SI 0 "register_operand" "=x")
22594 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "0")
22595 (parallel [(const_int 0) (const_int 2)
22596 (const_int 1) (const_int 3)]))
22597 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "x")
22598 (parallel [(const_int 2) (const_int 0)
22599 (const_int 3) (const_int 1)]))
22602 "punpckldq\t{%2, %0|%0, %2}"
22603 [(set_attr "type" "ssecvt")
22604 (set_attr "mode" "TI")])
22606 (define_insn "sse2_punpcklqdq"
22607 [(set (match_operand:V2DI 0 "register_operand" "=x")
22609 (vec_select:V2DI (match_operand:V2DI 2 "register_operand" "x")
22610 (parallel [(const_int 1)
22612 (match_operand:V2DI 1 "register_operand" "0")
22615 "punpcklqdq\t{%2, %0|%0, %2}"
22616 [(set_attr "type" "ssecvt")
22617 (set_attr "mode" "TI")])
22619 (define_insn "sse2_punpckhqdq"
22620 [(set (match_operand:V2DI 0 "register_operand" "=x")
22622 (match_operand:V2DI 1 "register_operand" "0")
22623 (vec_select:V2DI (match_operand:V2DI 2 "register_operand" "x")
22624 (parallel [(const_int 1)
22628 "punpckhqdq\t{%2, %0|%0, %2}"
22629 [(set_attr "type" "ssecvt")
22630 (set_attr "mode" "TI")])
22634 (define_insn "sse2_movapd"
22635 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
22636 (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
22639 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
22640 "movapd\t{%1, %0|%0, %1}"
22641 [(set_attr "type" "ssemov")
22642 (set_attr "mode" "V2DF")])
22644 (define_insn "sse2_movupd"
22645 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
22646 (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
22649 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
22650 "movupd\t{%1, %0|%0, %1}"
22651 [(set_attr "type" "ssecvt")
22652 (set_attr "mode" "V2DF")])
22654 (define_insn "sse2_movdqa"
22655 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
22656 (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
22659 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
22660 "movdqa\t{%1, %0|%0, %1}"
22661 [(set_attr "type" "ssemov")
22662 (set_attr "mode" "TI")])
22664 (define_insn "sse2_movdqu"
22665 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
22666 (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
22669 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
22670 "movdqu\t{%1, %0|%0, %1}"
22671 [(set_attr "type" "ssecvt")
22672 (set_attr "mode" "TI")])
22674 (define_insn "sse2_movdq2q"
22675 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,y")
22676 (vec_select:DI (match_operand:V2DI 1 "register_operand" "x,x")
22677 (parallel [(const_int 0)])))]
22680 movq\t{%1, %0|%0, %1}
22681 movdq2q\t{%1, %0|%0, %1}"
22682 [(set_attr "type" "ssecvt")
22683 (set_attr "mode" "TI")])
22685 (define_insn "sse2_movq2dq"
22686 [(set (match_operand:V2DI 0 "register_operand" "=x,?x")
22687 (vec_concat:V2DI (match_operand:DI 1 "nonimmediate_operand" "m,y")
22691 movq\t{%1, %0|%0, %1}
22692 movq2dq\t{%1, %0|%0, %1}"
22693 [(set_attr "type" "ssecvt,ssemov")
22694 (set_attr "mode" "TI")])
22696 (define_insn "sse2_movq"
22697 [(set (match_operand:V2DI 0 "register_operand" "=x")
22698 (vec_concat:V2DI (vec_select:DI
22699 (match_operand:V2DI 1 "nonimmediate_operand" "xm")
22700 (parallel [(const_int 0)]))
22703 "movq\t{%1, %0|%0, %1}"
22704 [(set_attr "type" "ssemov")
22705 (set_attr "mode" "TI")])
22707 (define_insn "sse2_loadd"
22708 [(set (match_operand:V4SI 0 "register_operand" "=x")
22710 (vec_duplicate:V4HI (match_operand:SI 1 "nonimmediate_operand" "mr"))
22711 (const_vector:V4SI [(const_int 0)
22717 "movd\t{%1, %0|%0, %1}"
22718 [(set_attr "type" "ssemov")
22719 (set_attr "mode" "TI")])
22721 (define_insn "sse2_stored"
22722 [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
22724 (match_operand:V4SI 1 "register_operand" "x")
22725 (parallel [(const_int 0)])))]
22727 "movd\t{%1, %0|%0, %1}"
22728 [(set_attr "type" "ssemov")
22729 (set_attr "mode" "TI")])
22731 (define_insn "sse2_movhpd"
22732 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
22734 (match_operand:V2DF 1 "nonimmediate_operand" "0,0")
22735 (match_operand:V2DF 2 "nonimmediate_operand" "m,x")
22737 "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
22738 "movhpd\t{%2, %0|%0, %2}"
22739 [(set_attr "type" "ssecvt")
22740 (set_attr "mode" "V2DF")])
22742 (define_insn "sse2_movlpd"
22743 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
22745 (match_operand:V2DF 1 "nonimmediate_operand" "0,0")
22746 (match_operand:V2DF 2 "nonimmediate_operand" "m,x")
22748 "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
22749 "movlpd\t{%2, %0|%0, %2}"
22750 [(set_attr "type" "ssecvt")
22751 (set_attr "mode" "V2DF")])
22753 (define_expand "sse2_loadsd"
22754 [(match_operand:V2DF 0 "register_operand" "")
22755 (match_operand:DF 1 "memory_operand" "")]
22758 emit_insn (gen_sse2_loadsd_1 (operands[0], operands[1],
22759 CONST0_RTX (V2DFmode)));
22763 (define_insn "sse2_loadsd_1"
22764 [(set (match_operand:V2DF 0 "register_operand" "=x")
22766 (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m"))
22767 (match_operand:V2DF 2 "const0_operand" "X")
22770 "movsd\t{%1, %0|%0, %1}"
22771 [(set_attr "type" "ssecvt")
22772 (set_attr "mode" "DF")])
22774 (define_insn "sse2_movsd"
22775 [(set (match_operand:V2DF 0 "register_operand" "=x")
22777 (match_operand:V2DF 1 "register_operand" "0")
22778 (match_operand:V2DF 2 "register_operand" "x")
22781 "movsd\t{%2, %0|%0, %2}"
22782 [(set_attr "type" "ssecvt")
22783 (set_attr "mode" "DF")])
22785 (define_insn "sse2_storesd"
22786 [(set (match_operand:DF 0 "memory_operand" "=m")
22788 (match_operand:V2DF 1 "register_operand" "x")
22789 (parallel [(const_int 0)])))]
22791 "movsd\t{%1, %0|%0, %1}"
22792 [(set_attr "type" "ssecvt")
22793 (set_attr "mode" "DF")])
22795 (define_insn "sse2_shufpd"
22796 [(set (match_operand:V2DF 0 "register_operand" "=x")
22797 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0")
22798 (match_operand:V2DF 2 "nonimmediate_operand" "xm")
22799 (match_operand:SI 3 "immediate_operand" "i")]
22802 ;; @@@ check operand order for intel/nonintel syntax
22803 "shufpd\t{%3, %2, %0|%0, %2, %3}"
22804 [(set_attr "type" "ssecvt")
22805 (set_attr "mode" "V2DF")])
22807 (define_insn "sse2_clflush"
22808 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
22812 [(set_attr "type" "sse")
22813 (set_attr "memory" "unknown")])
22815 (define_expand "sse2_mfence"
22816 [(set (match_dup 0)
22817 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
22820 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
22821 MEM_VOLATILE_P (operands[0]) = 1;
22824 (define_insn "*mfence_insn"
22825 [(set (match_operand:BLK 0 "" "")
22826 (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
22829 [(set_attr "type" "sse")
22830 (set_attr "memory" "unknown")])
22832 (define_expand "sse2_lfence"
22833 [(set (match_dup 0)
22834 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
22837 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
22838 MEM_VOLATILE_P (operands[0]) = 1;
22841 (define_insn "*lfence_insn"
22842 [(set (match_operand:BLK 0 "" "")
22843 (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
22846 [(set_attr "type" "sse")
22847 (set_attr "memory" "unknown")])