OSDN Git Service

ia64: Use define_c_enum for unspec constants.
[pf3gnuchains/gcc-fork.git] / gcc / config / ia64 / ia64.md
1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 ;; 2009, 2010 Free Software Foundation, Inc.
4 ;; Contributed by James E. Wilson <wilson@cygnus.com> and
5 ;;                David Mosberger <davidm@hpl.hp.com>.
6
7 ;; This file is part of GCC.
8
9 ;; GCC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; any later version.
13
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3.  If not see
21 ;; <http://www.gnu.org/licenses/>.
22
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24
25 ;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
26 ;; reload.  This will be fixed once scheduling support is turned on.
27
28 ;; ??? Optimize for post-increment addressing modes.
29
30 ;; ??? fselect is not supported, because there is no integer register
31 ;; equivalent.
32
33 ;; ??? fp abs/min/max instructions may also work for integer values.
34
35 ;; ??? Would a predicate_reg_operand predicate be useful?  The HP one is buggy,
36 ;; it assumes the operand is a register and takes REGNO of it without checking.
37
38 ;; ??? Would a branch_reg_operand predicate be useful?  The HP one is buggy,
39 ;; it assumes the operand is a register and takes REGNO of it without checking.
40
41 ;; ??? Go through list of documented named patterns and look for more to
42 ;; implement.
43
44 ;; ??? Go through instruction manual and look for more instructions that
45 ;; can be emitted.
46
47 ;; ??? Add function unit scheduling info for Itanium (TM) processor.
48
49 ;; ??? Need a better way to describe alternate fp status registers.
50
51 (define_c_enum "unspec"
52   [; Relocations
53    UNSPEC_LTOFF_DTPMOD
54    UNSPEC_LTOFF_DTPREL
55    UNSPEC_DTPREL
56    UNSPEC_LTOFF_TPREL
57    UNSPEC_TPREL
58    UNSPEC_DTPMOD
59
60    UNSPEC_LD_BASE
61    UNSPEC_GR_SPILL
62    UNSPEC_GR_RESTORE
63    UNSPEC_FR_SPILL
64    UNSPEC_FR_RESTORE
65    UNSPEC_FR_RECIP_APPROX
66    UNSPEC_PRED_REL_MUTEX
67    UNSPEC_GETF_EXP
68    UNSPEC_PIC_CALL
69    UNSPEC_MF
70    UNSPEC_CMPXCHG_ACQ
71    UNSPEC_FETCHADD_ACQ
72    UNSPEC_BSP_VALUE
73    UNSPEC_FLUSHRS
74    UNSPEC_BUNDLE_SELECTOR
75    UNSPEC_ADDP4
76    UNSPEC_PROLOGUE_USE
77    UNSPEC_RET_ADDR
78    UNSPEC_SETF_EXP
79    UNSPEC_FR_SQRT_RECIP_APPROX
80    UNSPEC_SHRP
81    UNSPEC_COPYSIGN
82    UNSPEC_VECT_EXTR
83    UNSPEC_LDA
84    UNSPEC_LDS
85    UNSPEC_LDS_A
86    UNSPEC_LDSA
87    UNSPEC_LDCCLR
88    UNSPEC_LDCNC
89    UNSPEC_CHKACLR
90    UNSPEC_CHKANC
91    UNSPEC_CHKS
92    UNSPEC_FR_RECIP_APPROX_RES
93    UNSPEC_FR_SQRT_RECIP_APPROX_RES
94   ])
95
96 (define_c_enum "unspecv" [
97    UNSPECV_ALLOC
98    UNSPECV_BLOCKAGE
99    UNSPECV_INSN_GROUP_BARRIER
100    UNSPECV_BREAK
101    UNSPECV_SET_BSP
102    UNSPECV_PSAC_ALL             ; pred.safe_across_calls
103    UNSPECV_PSAC_NORMAL
104    UNSPECV_SETJMP_RECEIVER
105    UNSPECV_GOTO_RECEIVER
106   ])
107
108 (include "predicates.md")
109 (include "constraints.md")
110 \f
111 ;; ::::::::::::::::::::
112 ;; ::
113 ;; :: Attributes
114 ;; ::
115 ;; ::::::::::::::::::::
116
117 ;; Processor type.  This attribute must exactly match the processor_type
118 ;; enumeration in ia64.h.
119 (define_attr "cpu" "itanium,itanium2"
120   (const (symbol_ref "((enum attr_cpu) ia64_tune)")))
121
122 ;; Instruction type.  This primarily determines how instructions can be
123 ;; packed in bundles, and secondarily affects scheduling to function units.
124
125 ;; A alu, can go in I or M syllable of a bundle
126 ;; I integer
127 ;; M memory
128 ;; F floating-point
129 ;; B branch
130 ;; L long immediate, takes two syllables
131 ;; S stop bit
132
133 ;; ??? Should not have any pattern with type unknown.  Perhaps add code to
134 ;; check this in md_reorg?  Currently use unknown for patterns which emit
135 ;; multiple instructions, patterns which emit 0 instructions, and patterns
136 ;; which emit instruction that can go in any slot (e.g. nop).
137
138 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
139         fldp,fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,
140         ld,chk_s_i,chk_s_f,chk_a,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
141         st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
142         nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
143   (const_string "unknown"))
144
145 ;; chk_s_i has an I and an M form; use type A for convenience.
146 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
147   (cond [(eq_attr "itanium_class" "ld,st,fld,fldp,stf,sem,nop_m") (const_string "M")
148          (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
149          (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
150          (eq_attr "itanium_class" "lfetch") (const_string "M")
151          (eq_attr "itanium_class" "chk_s_f,chk_a") (const_string "M")
152          (eq_attr "itanium_class" "chk_s_i,ialu,icmp,ilog,mmalua")
153            (const_string "A")
154          (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
155          (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
156          (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
157          (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
158          (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
159          (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
160          (eq_attr "itanium_class" "stop_bit") (const_string "S")
161          (eq_attr "itanium_class" "nop_x") (const_string "X")
162          (eq_attr "itanium_class" "long_i") (const_string "L")]
163         (const_string "unknown")))
164
165 (define_attr "itanium_requires_unit0" "no,yes"
166   (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
167          (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
168          (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
169          (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
170          (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
171          (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
172         (const_string "no")))
173
174 ;; Predication.  True iff this instruction can be predicated.
175
176 (define_attr "predicable" "no,yes" (const_string "yes"))
177
178 ;; Empty.  True iff this insn does not generate any code.
179
180 (define_attr "empty" "no,yes" (const_string "no"))
181
182 ;; True iff this insn must be the first insn of an instruction group.
183 ;; This is true for the alloc instruction, and will also be true of others
184 ;; when we have full intrinsics support.
185
186 (define_attr "first_insn" "no,yes" (const_string "no"))
187
188 (define_attr "data_speculative" "no,yes" (const_string "no"))
189
190 (define_attr "control_speculative" "no,yes" (const_string "no"))
191
192 (define_attr "check_load" "no,yes" (const_string "no"))
193
194 (define_attr "speculable1" "no,yes" (const_string "no"))
195
196 (define_attr "speculable2" "no,yes" (const_string "no"))
197 \f
198 ;; DFA descriptions of ia64 processors used for insn scheduling and
199 ;; bundling.
200
201 (automata_option "ndfa")
202
203 ;; Uncomment the following line to output automata for debugging.
204 ;; (automata_option "v")
205
206 (automata_option "w")
207
208 (include "itanium2.md")
209 \f
210 ;; Mode iterators
211
212 ; Used for truncations from XFmode.
213 (define_mode_iterator MODE_SDF [SF DF])
214
215 (define_mode_attr suffix [
216   (SF ".s")
217   (DF ".d")
218   (XF "")
219   ])
220 \f
221 ;; ::::::::::::::::::::
222 ;; ::
223 ;; :: Moves
224 ;; ::
225 ;; ::::::::::::::::::::
226
227 ;; Set of a single predicate register.  This is only used to implement
228 ;; pr-to-pr move and complement.
229
230 (define_insn "movcci"
231   [(set (match_operand:CCI 0 "destination_operand" "=c,c,?c,?*r, c,*r,*m,*r")
232         (match_operand:CCI 1 "move_operand"        " O,n, c,  c,*r,*m,*r,*r"))]
233   ""
234   "@
235    cmp.ne %0, p0 = r0, r0
236    cmp.eq %0, p0 = r0, r0
237    (%1) cmp.eq.unc %0, p0 = r0, r0
238    #
239    tbit.nz %0, p0 = %1, 0
240    ld1%O1 %0 = %1%P1
241    st1%Q0 %0 = %1%P0
242    mov %0 = %1"
243   [(set_attr "itanium_class" "icmp,icmp,icmp,unknown,tbit,ld,st,ialu")
244    (set_attr "predicable" "no")])
245
246 (define_split
247   [(set (match_operand:CCI 0 "register_operand" "")
248         (match_operand:CCI 1 "register_operand" ""))]
249   "reload_completed
250    && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
251    && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
252   [(set (match_dup 2) (const_int 0))
253    (cond_exec (ne (match_dup 3) (const_int 0))
254      (set (match_dup 2) (const_int 1)))]
255   "operands[2] = gen_rtx_REG (BImode, REGNO (operands[0]));
256    operands[3] = gen_rtx_REG (BImode, REGNO (operands[1]));")
257
258 (define_insn "movbi"
259   [(set (match_operand:BI 0 "destination_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
260         (match_operand:BI 1 "move_operand"        " O,n, c,  c,*r, n,*m,*r,*r"))]
261   ""
262   "@
263    cmp.ne %0, %I0 = r0, r0
264    cmp.eq %0, %I0 = r0, r0
265    #
266    #
267    tbit.nz %0, %I0 = %1, 0
268    adds %0 = %1, r0
269    ld1%O1 %0 = %1%P1
270    st1%Q0 %0 = %1%P0
271    mov %0 = %1"
272   [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")
273    (set_attr "speculable1"   "yes")
274    (set_attr "speculable2"   "no,  no,  no,     no,     no,  no, yes,no,no")])
275
276 (define_split
277   [(set (match_operand:BI 0 "register_operand" "")
278         (match_operand:BI 1 "register_operand" ""))]
279   "reload_completed
280    && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
281    && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
282   [(cond_exec (ne (match_dup 1) (const_int 0))
283      (set (match_dup 0) (const_int 1)))
284    (cond_exec (eq (match_dup 1) (const_int 0))
285      (set (match_dup 0) (const_int 0)))]
286   "")
287
288 (define_split
289   [(set (match_operand:BI 0 "register_operand" "")
290         (match_operand:BI 1 "register_operand" ""))]
291   "reload_completed
292    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
293    && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
294   [(set (match_dup 2) (match_dup 4))
295    (set (match_dup 3) (match_dup 5))
296    (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
297   "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
298    operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
299    operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
300    operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
301
302 (define_expand "movqi"
303   [(set (match_operand:QI 0 "general_operand" "")
304         (match_operand:QI 1 "general_operand" ""))]
305   ""
306 {
307   rtx op1 = ia64_expand_move (operands[0], operands[1]);
308   if (!op1)
309     DONE;
310   operands[1] = op1;
311 })
312
313 (define_insn "movqi_internal"
314   [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
315         (match_operand:QI 1 "move_operand"        "rO,J,m,rO,*f,rO,*f"))]
316   "ia64_move_ok (operands[0], operands[1])"
317   "@
318    mov %0 = %r1
319    addl %0 = %1, r0
320    ld1%O1 %0 = %1%P1
321    st1%Q0 %0 = %r1%P0
322    getf.sig %0 = %1
323    setf.sig %0 = %r1
324    mov %0 = %1"
325   [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
326    (set_attr "speculable1"   "yes")
327    (set_attr "speculable2"   "no,  no, yes,no,no,  no,  no")])
328
329 (define_expand "movhi"
330   [(set (match_operand:HI 0 "general_operand" "")
331         (match_operand:HI 1 "general_operand" ""))]
332   ""
333 {
334   rtx op1 = ia64_expand_move (operands[0], operands[1]);
335   if (!op1)
336     DONE;
337   operands[1] = op1;
338 })
339
340 (define_insn "movhi_internal"
341   [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
342         (match_operand:HI 1 "move_operand"        "rO,J,m,rO,*f,rO,*f"))]
343   "ia64_move_ok (operands[0], operands[1])"
344   "@
345    mov %0 = %r1
346    addl %0 = %1, r0
347    ld2%O1 %0 = %1%P1
348    st2%Q0 %0 = %r1%P0
349    getf.sig %0 = %1
350    setf.sig %0 = %r1
351    mov %0 = %1"
352   [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
353    (set_attr "speculable1"   "yes")
354    (set_attr "speculable2"   "no,  no, yes,no,no,  no,  no")])
355
356 (define_expand "movsi"
357   [(set (match_operand:SI 0 "general_operand" "")
358         (match_operand:SI 1 "general_operand" ""))]
359   ""
360 {
361   rtx op1 = ia64_expand_move (operands[0], operands[1]);
362   if (!op1)
363     DONE;
364   operands[1] = op1;
365 })
366
367 (define_insn "movsi_internal"
368   [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r,r, m, r,*f,*f, r,*d")
369         (match_operand:SI 1 "move_operand"        "rO,J,j,i,m,rO,*f,rO,*f,*d,rK"))]
370   "ia64_move_ok (operands[0], operands[1])"
371   "@
372   mov %0 = %r1
373   addl %0 = %1, r0
374   addp4 %0 = %1 - 0x100000000, r0
375   movl %0 = %1
376   ld4%O1 %0 = %1%P1
377   st4%Q0 %0 = %r1%P0
378   getf.sig %0 = %1
379   setf.sig %0 = %r1
380   mov %0 = %1
381   mov %0 = %1
382   mov %0 = %r1"
383   ;; frar_m, toar_m ??? why not frar_i and toar_i
384   [(set_attr "itanium_class" "ialu,ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")
385    (set_attr "speculable1"   "yes")
386    (set_attr "speculable2"   "no,  no,  no,  no,   yes,no,no,  no,  no,   no,    no")])
387
388 (define_expand "movdi"
389   [(set (match_operand:DI 0 "general_operand" "")
390         (match_operand:DI 1 "general_operand" ""))]
391   ""
392 {
393   rtx op1 = ia64_expand_move (operands[0], operands[1]);
394   if (!op1)
395     DONE;
396   operands[1] = op1;
397 })
398
399 (define_insn "movdi_internal"
400   [(set (match_operand:DI 0 "destination_operand"
401                     "=r,r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
402         (match_operand:DI 1 "move_operand"
403                     "rO,JT,j,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
404   "ia64_move_ok (operands[0], operands[1])"
405 {
406   static const char * const alt[] = {
407     "%,mov %0 = %r1",
408     "%,addl %0 = %1, r0",
409     "%,addp4 %0 = %1 - 0x100000000, r0",
410     "%,movl %0 = %1",
411     "%,ld8%O1 %0 = %1%P1",
412     "%,st8%Q0 %0 = %r1%P0",
413     "%,getf.sig %0 = %1",
414     "%,setf.sig %0 = %r1",
415     "%,mov %0 = %1",
416     "%,ldf8 %0 = %1%P1",
417     "%,stf8 %0 = %1%P0",
418     "%,mov %0 = %1",
419     "%,mov %0 = %r1",
420     "%,mov %0 = %1",
421     "%,mov %0 = %1",
422     "%,mov %0 = %1",
423     "%,mov %0 = %1",
424     "mov %0 = pr",
425     "mov pr = %1, -1"
426   };
427
428   gcc_assert (which_alternative != 2 || TARGET_NO_PIC
429               || !symbolic_operand (operands[1], VOIDmode));
430
431   return alt[which_alternative];
432 }
433   [(set_attr "itanium_class" "ialu,ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")
434    (set_attr "speculable1"   "yes")
435    (set_attr "speculable2"   "no,  no,  no,  no,   yes,no,no,  no,  no,   yes,no, no,  no,  no,    no,    no,    no,    no,  no")])
436
437 (define_mode_iterator MODE [BI QI HI SI DI SF DF XF TI])
438 (define_mode_iterator MODE_FOR_CMP [BI SI DI SF DF XF (TF "TARGET_HPUX")])
439 (define_mode_iterator MODE_FOR_EXTEND [QI HI SI])
440
441 (define_mode_attr output_a [
442   (BI "ld1.a %0 = %1%P1")
443   (QI "ld1.a %0 = %1%P1")
444   (HI "ld2.a %0 = %1%P1")
445   (SI "ld4.a %0 = %1%P1")
446   (DI
447    "@
448     ld8.a %0 = %1%P1
449     ldf8.a %0 = %1%P1")
450   (SF
451    "@
452     ldfs.a %0 = %1%P1
453     ld4.a %0 = %1%P1")
454   (DF
455    "@
456     ldfd.a %0 = %1%P1
457     ld8.a %0 = %1%P1")
458   (XF "ldfe.a %0 = %1%P1")
459   (TI "ldfp8.a %X0 = %1%P1")])
460
461 (define_mode_attr output_s [
462   (BI "ld1.s %0 = %1%P1")
463   (QI "ld1.s %0 = %1%P1")
464   (HI "ld2.s %0 = %1%P1")
465   (SI "ld4.s %0 = %1%P1")
466   (DI
467    "@
468     ld8.s %0 = %1%P1
469     ldf8.s %0 = %1%P1")
470   (SF
471    "@
472     ldfs.s %0 = %1%P1
473     ld4.s %0 = %1%P1")
474   (DF
475    "@
476     ldfd.s %0 = %1%P1
477     ld8.s %0 = %1%P1")
478   (XF "ldfe.s %0 = %1%P1")
479   (TI "ldfp8.s %X0 = %1%P1")])
480
481 (define_mode_attr output_sa [
482   (BI "ld1.sa %0 = %1%P1")
483   (QI "ld1.sa %0 = %1%P1")
484   (HI "ld2.sa %0 = %1%P1")
485   (SI "ld4.sa %0 = %1%P1")
486   (DI
487    "@
488     ld8.sa %0 = %1%P1
489     ldf8.sa %0 = %1%P1")
490   (SF
491    "@
492     ldfs.sa %0 = %1%P1
493     ld4.sa %0 = %1%P1")
494   (DF
495    "@
496     ldfd.sa %0 = %1%P1
497     ld8.sa %0 = %1%P1")
498   (XF "ldfe.sa %0 = %1%P1")
499   (TI "ldfp8.sa %X0 = %1%P1")])
500
501 (define_mode_attr output_c_clr [
502   (BI "ld1.c.clr%O1 %0 = %1%P1")
503   (QI "ld1.c.clr%O1 %0 = %1%P1")
504   (HI "ld2.c.clr%O1 %0 = %1%P1")
505   (SI "ld4.c.clr%O1 %0 = %1%P1")
506   (DI
507    "@
508     ld8.c.clr%O1 %0 = %1%P1
509     ldf8.c.clr %0 = %1%P1")
510   (SF
511    "@
512     ldfs.c.clr %0 = %1%P1
513     ld4.c.clr%O1 %0 = %1%P1")
514   (DF
515    "@
516     ldfd.c.clr %0 = %1%P1
517     ld8.c.clr%O1 %0 = %1%P1")
518   (XF "ldfe.c.clr %0 = %1%P1")
519   (TI "ldfp8.c.clr %X0 = %1%P1")])
520
521 (define_mode_attr output_c_nc [
522   (BI "ld1.c.nc%O1 %0 = %1%P1")
523   (QI "ld1.c.nc%O1 %0 = %1%P1")
524   (HI "ld2.c.nc%O1 %0 = %1%P1")
525   (SI "ld4.c.nc%O1 %0 = %1%P1")
526   (DI
527    "@
528     ld8.c.nc%O1 %0 = %1%P1
529     ldf8.c.nc %0 = %1%P1")
530   (SF
531    "@
532     ldfs.c.nc %0 = %1%P1
533     ld4.c.nc%O1 %0 = %1%P1")
534   (DF
535    "@
536     ldfd.c.nc %0 = %1%P1
537     ld8.c.nc%O1 %0 = %1%P1")
538   (XF "ldfe.c.nc %0 = %1%P1")
539   (TI "ldfp8.c.nc %X0 = %1%P1")])
540
541 (define_mode_attr ld_reg_constr [(BI "=*r") (QI "=r") (HI "=r") (SI "=r") (DI "=r,*f") (SF "=f,*r") (DF "=f,*r") (XF "=f") (TI "=*x")])
542 (define_mode_attr ldc_reg_constr [(BI "+*r") (QI "+r") (HI "+r") (SI "+r") (DI "+r,*f") (SF "+f,*r") (DF "+f,*r") (XF "+f") (TI "+*x")])
543 (define_mode_attr chk_reg_constr [(BI "*r") (QI "r") (HI "r") (SI "r") (DI "r,*f") (SF "f,*r") (DF "f,*r") (XF "f") (TI "*x")])
544
545 (define_mode_attr mem_constr [(BI "*m") (QI "m") (HI "m") (SI "m") (DI "m,Q") (SF "Q,m") (DF "Q,m") (XF "m") (TI "Q")])
546
547 ;; Define register predicate prefix.
548 ;; We can generate speculative loads only for general and fp registers - this
549 ;; is constrained in ia64.c: ia64_speculate_insn ().
550 (define_mode_attr reg_pred_prefix [(BI "gr") (QI "gr") (HI "gr") (SI "gr") (DI "grfr") (SF "grfr") (DF "grfr") (XF "fr") (TI "fr")])
551
552 (define_mode_attr ld_class [(BI "ld") (QI "ld") (HI "ld") (SI "ld") (DI "ld,fld") (SF "fld,ld") (DF "fld,ld") (XF "fld") (TI "fldp")])
553 (define_mode_attr chka_class [(BI "chk_a") (QI "chk_a") (HI "chk_a") (SI "chk_a") (DI "chk_a,chk_a") (SF "chk_a,chk_a") (DF "chk_a,chk_a") (XF "chk_a") (TI "chk_a")])
554 (define_mode_attr chks_class [(BI "chk_s_i") (QI "chk_s_i") (HI "chk_s_i") (SI "chk_s_i") (DI "chk_s_i,chk_s_f") (SF "chk_s_f,chk_s_i") (DF "chk_s_f,chk_s_i") (XF "chk_s_f") (TI "chk_s_i")])
555
556 (define_mode_attr attr_yes [(BI "yes") (QI "yes") (HI "yes") (SI "yes") (DI "yes,yes") (SF "yes,yes") (DF "yes,yes") (XF "yes") (TI "yes")])
557
558 (define_insn "mov<mode>_advanced"
559   [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
560         (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA))]
561   "ia64_move_ok (operands[0], operands[1])"
562   "<output_a>"
563   [(set_attr "itanium_class" "<ld_class>")
564    (set_attr "data_speculative" "<attr_yes>")])
565
566 (define_insn "zero_extend<mode>di2_advanced"
567   [(set (match_operand:DI 0 "gr_register_operand" "=r")
568         (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA)))]
569   ""
570   "<output_a>"
571   [(set_attr "itanium_class" "<ld_class>")
572    (set_attr "data_speculative" "<attr_yes>")])
573
574 (define_insn "mov<mode>_speculative"
575   [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
576         (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS))]
577   "ia64_move_ok (operands[0], operands[1])"
578   "<output_s>"
579   [(set_attr "itanium_class" "<ld_class>")
580    (set_attr "control_speculative" "<attr_yes>")])
581
582 (define_insn "zero_extend<mode>di2_speculative"
583   [(set (match_operand:DI 0 "gr_register_operand" "=r")
584         (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS)))]
585   ""
586   "<output_s>"
587   [(set_attr "itanium_class" "<ld_class>")
588    (set_attr "control_speculative" "<attr_yes>")])
589
590 (define_insn "mov<mode>_speculative_advanced"
591   [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
592         (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA))]
593   "ia64_move_ok (operands[0], operands[1])"
594   "<output_sa>"
595   [(set_attr "itanium_class" "<ld_class>")
596    (set_attr "data_speculative" "<attr_yes>")
597    (set_attr "control_speculative" "<attr_yes>")])
598
599 (define_insn "mov<mode>_speculative_a"
600   [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
601         (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS_A))]
602   "ia64_move_ok (operands[0], operands[1])"
603   "<output_sa>"
604   [(set_attr "itanium_class" "<ld_class>")
605    (set_attr "data_speculative" "<attr_yes>")
606    (set_attr "control_speculative" "<attr_yes>")])
607
608 (define_insn "zero_extend<mode>di2_speculative_advanced"
609   [(set (match_operand:DI 0 "gr_register_operand" "=r")
610         (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA)))]
611   ""
612   "<output_sa>"
613   [(set_attr "itanium_class" "<ld_class>")
614    (set_attr "data_speculative" "<attr_yes>")
615    (set_attr "control_speculative" "<attr_yes>")])
616
617 (define_insn "zero_extend<mode>di2_speculative_a"
618   [(set (match_operand:DI 0 "gr_register_operand" "=r")
619         (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS_A)))]
620   ""
621   "<output_sa>"
622   [(set_attr "itanium_class" "<ld_class>")
623    (set_attr "data_speculative" "<attr_yes>")
624    (set_attr "control_speculative" "<attr_yes>")])
625
626 (define_insn "mov<mode>_clr"
627   [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
628         (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
629                            (match_operand:MODE 1 "memory_operand" "<mem_constr>")
630                            (match_dup 0)))]
631   "ia64_move_ok (operands[0], operands[1])"
632   "<output_c_clr>"
633   [(set_attr "itanium_class" "<ld_class>")
634    (set_attr "check_load" "<attr_yes>")])
635
636 (define_insn "mov<mode>_nc"
637   [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
638         (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCNC) (const_int 0))
639                            (match_operand:MODE 1 "memory_operand" "<mem_constr>")
640                            (match_dup 0)))]
641   "ia64_move_ok (operands[0], operands[1])"
642   "<output_c_nc>"
643   [(set_attr "itanium_class" "<ld_class>")
644    (set_attr "check_load" "<attr_yes>")])
645
646 (define_insn "zero_extend<mode>di2_clr"
647   [(set (match_operand:DI 0 "gr_register_operand" "+r")
648         (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
649                          (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
650                          (match_dup 0)))]
651   ""
652   "<output_c_clr>"
653   [(set_attr "itanium_class" "<ld_class>")
654    (set_attr "check_load" "<attr_yes>")])
655
656 (define_insn "zero_extend<mode>di2_nc"
657   [(set (match_operand:DI 0 "gr_register_operand" "+r")
658         (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCNC) (const_int 0))
659                          (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
660                          (match_dup 0)))]
661   ""
662   "<output_c_nc>"
663   [(set_attr "itanium_class" "<ld_class>")
664    (set_attr "check_load" "<attr_yes>")])
665
666 (define_insn "advanced_load_check_clr_<mode>"
667   [(set (pc)
668         (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKACLR) (const_int 0))
669                       (pc)
670                       (label_ref (match_operand 1 "" ""))))]
671   ""
672   "chk.a.clr %0, %l1"
673   [(set_attr "itanium_class" "<chka_class>")])
674
675 (define_insn "advanced_load_check_nc_<mode>"
676   [(set (pc)
677         (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKANC) (const_int 0))
678                       (pc)
679                       (label_ref (match_operand 1 "" ""))))]
680   ""
681   "chk.a.clr %0, %l1"
682   [(set_attr "itanium_class" "<chka_class>")])
683
684 (define_insn "speculation_check_<mode>"
685   [(set (pc) 
686         (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKS) (const_int 0))
687                       (pc)
688                       (label_ref (match_operand 1 "" ""))))]
689   ""
690   "chk.s %0, %l1"
691   [(set_attr "itanium_class" "<chks_class>")])
692
693 (define_split
694   [(set (match_operand 0 "register_operand" "")
695         (match_operand 1 "symbolic_operand" ""))]
696   "reload_completed"
697   [(const_int 0)]
698 {
699   if (ia64_expand_load_address (operands[0], operands[1]))
700     DONE;
701   else
702     FAIL;
703 })
704
705 (define_expand "load_fptr"
706   [(set (match_operand:DI 0 "register_operand" "")
707         (plus:DI (match_dup 2) (match_operand 1 "function_operand" "")))
708    (set (match_dup 0) (match_dup 3))]
709   "reload_completed"
710 {
711   operands[2] = pic_offset_table_rtx;
712   operands[3] = gen_const_mem (DImode, operands[0]);
713 })
714
715 (define_insn "*load_fptr_internal1"
716   [(set (match_operand:DI 0 "register_operand" "=r")
717         (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
718   "reload_completed"
719   "addl %0 = @ltoff(@fptr(%1)), gp"
720   [(set_attr "itanium_class" "ialu")])
721
722 (define_insn "load_gprel"
723   [(set (match_operand:DI 0 "register_operand" "=r")
724         (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
725   "reload_completed"
726   "addl %0 = @gprel(%1), gp"
727   [(set_attr "itanium_class" "ialu")])
728
729 (define_insn "*gprel64_offset"
730   [(set (match_operand:DI 0 "register_operand" "=r")
731         (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
732   "reload_completed"
733   "movl %0 = @gprel(%1)"
734   [(set_attr "itanium_class" "long_i")])
735
736 (define_expand "load_gprel64"
737   [(set (match_operand:DI 0 "register_operand" "")
738         (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 2)))
739    (set (match_dup 0)
740         (plus:DI (match_dup 2) (match_dup 0)))]
741   "reload_completed"
742 {
743   operands[2] = pic_offset_table_rtx;
744 })
745
746 ;; This is used as a placeholder for the return address during early
747 ;; compilation.  We won't know where we've placed this until during
748 ;; reload, at which point it can wind up in b0, a general register,
749 ;; or memory.  The only safe destination under these conditions is a
750 ;; general register.
751
752 (define_insn_and_split "*movdi_ret_addr"
753   [(set (match_operand:DI 0 "register_operand" "=r")
754         (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
755   ""
756   "#"
757   "reload_completed"
758   [(const_int 0)]
759 {
760   ia64_split_return_addr_rtx (operands[0]);
761   DONE;
762 }
763   [(set_attr "itanium_class" "ialu")])
764
765 (define_insn "*load_symptr_high"
766   [(set (match_operand:DI 0 "register_operand" "=r")
767         (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
768                  (match_operand:DI 2 "register_operand" "a")))]
769   "reload_completed"
770 {
771   if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
772     return "%,addl %0 = @ltoffx(%1), %2";
773   else
774     return "%,addl %0 = @ltoff(%1), %2";
775 }
776   [(set_attr "itanium_class" "ialu")])
777
778 (define_insn "*load_symptr_low"
779   [(set (match_operand:DI 0 "register_operand" "=r")
780         (lo_sum:DI (mem:DI (match_operand:DI 1 "register_operand" "r"))
781                    (match_operand 2 "got_symbolic_operand" "s")))]
782   "reload_completed"
783 {
784   if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
785     return "%,ld8.mov %0 = [%1], %2";
786   else
787     return "%,ld8 %0 = [%1]";
788 }
789   [(set_attr "itanium_class" "ld")])
790
791 (define_insn_and_split "load_dtpmod"
792   [(set (match_operand:DI 0 "register_operand" "=r")
793         (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
794                    UNSPEC_DTPMOD))]
795   ""
796   "#"
797   "reload_completed"
798   [(set (match_dup 0)
799         (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPMOD)
800                  (match_dup 2)))
801    (set (match_dup 0) (match_dup 3))]
802 {
803   operands[2] = pic_offset_table_rtx;
804   operands[3] = gen_const_mem (DImode, operands[0]);
805 })
806
807 (define_insn "*load_ltoff_dtpmod"
808   [(set (match_operand:DI 0 "register_operand" "=r")
809         (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
810                             UNSPEC_LTOFF_DTPMOD)
811                  (match_operand:DI 2 "register_operand" "a")))]
812   "reload_completed"
813   "addl %0 = @ltoff(@dtpmod(%1)), %2"
814   [(set_attr "itanium_class" "ialu")])
815
816 (define_expand "load_dtprel"
817   [(set (match_operand:DI 0 "register_operand" "")
818         (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
819                    UNSPEC_DTPREL))]
820   ""
821   "")
822
823 (define_insn "*load_dtprel64"
824   [(set (match_operand:DI 0 "register_operand" "=r")
825         (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
826                    UNSPEC_DTPREL))]
827   "TARGET_TLS64"
828   "movl %0 = @dtprel(%1)"
829   [(set_attr "itanium_class" "long_i")])
830
831 (define_insn "*load_dtprel22"
832   [(set (match_operand:DI 0 "register_operand" "=r")
833         (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
834                    UNSPEC_DTPREL))]
835   ""
836   "addl %0 = @dtprel(%1), r0"
837   [(set_attr "itanium_class" "ialu")])
838
839 (define_insn_and_split "*load_dtprel_gd"
840   [(set (match_operand:DI 0 "register_operand" "=r")
841         (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
842                    UNSPEC_DTPREL))]
843   ""
844   "#"
845   "reload_completed"
846   [(set (match_dup 0)
847         (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPREL)
848                  (match_dup 2)))
849    (set (match_dup 0) (match_dup 3))]
850 {
851   operands[2] = pic_offset_table_rtx;
852   operands[3] = gen_const_mem (DImode, operands[0]);
853 })
854
855 (define_insn "*load_ltoff_dtprel"
856   [(set (match_operand:DI 0 "register_operand" "=r")
857         (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
858                             UNSPEC_LTOFF_DTPREL)
859                  (match_operand:DI 2 "register_operand" "a")))]
860   ""
861   "addl %0 = @ltoff(@dtprel(%1)), %2"
862   [(set_attr "itanium_class" "ialu")])
863
864 (define_expand "add_dtprel"
865   [(set (match_operand:DI 0 "register_operand" "")
866         (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
867                             UNSPEC_DTPREL)
868                  (match_operand:DI 2 "register_operand" "")))]
869   "!TARGET_TLS64"
870   "")
871
872 (define_insn "*add_dtprel14"
873   [(set (match_operand:DI 0 "register_operand" "=r")
874         (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
875                             UNSPEC_DTPREL)
876                  (match_operand:DI 2 "register_operand" "r")))]
877   "TARGET_TLS14"
878   "adds %0 = @dtprel(%1), %2"
879   [(set_attr "itanium_class" "ialu")])
880
881 (define_insn "*add_dtprel22"
882   [(set (match_operand:DI 0 "register_operand" "=r")
883         (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
884                             UNSPEC_DTPREL)
885                  (match_operand:DI 2 "register_operand" "a")))]
886   "TARGET_TLS22"
887   "addl %0 = @dtprel(%1), %2"
888   [(set_attr "itanium_class" "ialu")])
889
890 (define_expand "load_tprel"
891   [(set (match_operand:DI 0 "register_operand" "")
892         (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
893                    UNSPEC_TPREL))]
894   ""
895   "")
896
897 (define_insn "*load_tprel64"
898   [(set (match_operand:DI 0 "register_operand" "=r")
899         (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
900                    UNSPEC_TPREL))]
901   "TARGET_TLS64"
902   "movl %0 = @tprel(%1)"
903   [(set_attr "itanium_class" "long_i")])
904
905 (define_insn "*load_tprel22"
906   [(set (match_operand:DI 0 "register_operand" "=r")
907         (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
908                    UNSPEC_TPREL))]
909   ""
910   "addl %0 = @tprel(%1), r0"
911   [(set_attr "itanium_class" "ialu")])
912
913 (define_insn_and_split "*load_tprel_ie"
914   [(set (match_operand:DI 0 "register_operand" "=r")
915         (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
916                    UNSPEC_TPREL))]
917   ""
918   "#"
919   "reload_completed"
920   [(set (match_dup 0)
921         (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_TPREL)
922                  (match_dup 2)))
923    (set (match_dup 0) (match_dup 3))]
924 {
925   operands[2] = pic_offset_table_rtx;
926   operands[3] = gen_const_mem (DImode, operands[0]);
927 })
928
929 (define_insn "*load_ltoff_tprel"
930   [(set (match_operand:DI 0 "register_operand" "=r")
931         (plus:DI (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
932                             UNSPEC_LTOFF_TPREL)
933                  (match_operand:DI 2 "register_operand" "a")))]
934   ""
935   "addl %0 = @ltoff(@tprel(%1)), %2"
936   [(set_attr "itanium_class" "ialu")])
937
938 (define_expand "add_tprel"
939   [(set (match_operand:DI 0 "register_operand" "")
940         (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
941                             UNSPEC_TPREL)
942                  (match_operand:DI 2 "register_operand" "")))]
943   "!TARGET_TLS64"
944   "")
945
946 (define_insn "*add_tprel14"
947   [(set (match_operand:DI 0 "register_operand" "=r")
948         (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
949                             UNSPEC_TPREL)
950                  (match_operand:DI 2 "register_operand" "r")))]
951   "TARGET_TLS14"
952   "adds %0 = @tprel(%1), %2"
953   [(set_attr "itanium_class" "ialu")])
954
955 (define_insn "*add_tprel22"
956   [(set (match_operand:DI 0 "register_operand" "=r")
957         (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
958                             UNSPEC_TPREL)
959                  (match_operand:DI 2 "register_operand" "a")))]
960   "TARGET_TLS22"
961   "addl %0 = @tprel(%1), %2"
962   [(set_attr "itanium_class" "ialu")])
963
964 ;; With no offsettable memory references, we've got to have a scratch
965 ;; around to play with the second word.  However, in order to avoid a
966 ;; reload nightmare we lie, claim we don't need one, and fix it up
967 ;; in ia64_split_tmode_move.
968 (define_expand "movti"
969   [(set (match_operand:TI 0 "general_operand" "")
970         (match_operand:TI 1 "general_operand" ""))]
971   ""
972 {
973   rtx op1 = ia64_expand_move (operands[0], operands[1]);
974   if (!op1)
975     DONE;
976   operands[1] = op1;
977 })
978
979 (define_insn_and_split "movti_internal"
980   [(set (match_operand:TI 0 "destination_operand" "=r,   *fm,*x,*f,  Q")
981         (match_operand:TI 1 "general_operand"     "r*fim,r,  Q, *fOQ,*f"))]
982   "ia64_move_ok (operands[0], operands[1])"
983   "@
984    #
985    #
986    ldfp8 %X0 = %1%P1
987    #
988    #"
989   "reload_completed && !ia64_load_pair_ok(operands[0], operands[1])"
990   [(const_int 0)]
991 {
992   ia64_split_tmode_move (operands);
993   DONE;
994 }
995   [(set_attr "itanium_class" "unknown,unknown,fldp,unknown,unknown")
996    (set_attr "speculable1"   "yes")
997    (set_attr "speculable2"   "no,     no,     yes, no,     no")])
998
999 ;; Floating Point Moves
1000 ;;
1001 ;; Note - Patterns for SF mode moves are compulsory, but
1002 ;; patterns for DF are optional, as GCC can synthesize them.
1003
1004 (define_expand "movsf"
1005   [(set (match_operand:SF 0 "general_operand" "")
1006         (match_operand:SF 1 "general_operand" ""))]
1007   ""
1008 {
1009   rtx op1 = ia64_expand_move (operands[0], operands[1]);
1010   if (!op1)
1011     DONE;
1012   operands[1] = op1;
1013 })
1014
1015 (define_insn "movsf_internal"
1016   [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m,*r")
1017         (match_operand:SF 1 "general_operand"     "fG,Q,fG,fG,*r,*r, m,*r, F"))]
1018   "ia64_move_ok (operands[0], operands[1])"
1019   "@
1020    mov %0 = %F1
1021    ldfs %0 = %1%P1
1022    stfs %0 = %F1%P0
1023    getf.s %0 = %F1
1024    setf.s %0 = %1
1025    mov %0 = %1
1026    ld4%O1 %0 = %1%P1
1027    st4%Q0 %0 = %1%P0
1028    movl %0 = %G1"
1029   [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st,long_i")
1030    (set_attr "speculable1"   "yes")
1031    (set_attr "speculable2"   "no,   yes,no, no,  no,  no, yes,no,no")])
1032
1033 (define_expand "movdf"
1034   [(set (match_operand:DF 0 "general_operand" "")
1035         (match_operand:DF 1 "general_operand" ""))]
1036   ""
1037 {
1038   rtx op1 = ia64_expand_move (operands[0], operands[1]);
1039   if (!op1)
1040     DONE;
1041   operands[1] = op1;
1042 })
1043
1044 (define_insn "movdf_internal"
1045   [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m,*r")
1046         (match_operand:DF 1 "general_operand"     "fG,Q,fG,fG,*r,*r, m,*r, F"))]
1047   "ia64_move_ok (operands[0], operands[1])"
1048   "@
1049    mov %0 = %F1
1050    ldfd %0 = %1%P1
1051    stfd %0 = %F1%P0
1052    getf.d %0 = %F1
1053    setf.d %0 = %1
1054    mov %0 = %1
1055    ld8%O1 %0 = %1%P1
1056    st8%Q0 %0 = %1%P0
1057    movl %0 = %G1"
1058   [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st,long_i")
1059    (set_attr "speculable1"   "yes")
1060    (set_attr "speculable2"   "no,   yes,no, no,  no,  no, yes,no,no")])
1061
1062 ;; With no offsettable memory references, we've got to have a scratch
1063 ;; around to play with the second word if the variable winds up in GRs.
1064 (define_expand "movxf"
1065   [(set (match_operand:XF 0 "general_operand" "")
1066         (match_operand:XF 1 "general_operand" ""))]
1067   ""
1068 {
1069   if (ia64_expand_movxf_movrf (XFmode, operands))
1070     DONE;
1071 })
1072
1073 ;; ??? There's no easy way to mind volatile acquire/release semantics.
1074
1075 (define_insn "movxf_internal"
1076   [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
1077         (match_operand:XF 1 "general_operand"     "fG,m,fG"))]
1078   "ia64_move_ok (operands[0], operands[1])"
1079   "@
1080    mov %0 = %F1
1081    ldfe %0 = %1%P1
1082    stfe %0 = %F1%P0"
1083   [(set_attr "itanium_class" "fmisc,fld,stf")
1084    (set_attr "speculable1"   "yes")
1085    (set_attr "speculable2"   "no,   yes,no")])
1086
1087 ;; Same as for movxf, but for RFmode.
1088 (define_expand "movrf"
1089   [(set (match_operand:RF 0 "general_operand" "")
1090         (match_operand:RF 1 "general_operand" ""))]
1091   ""
1092 {
1093   if (ia64_expand_movxf_movrf (RFmode, operands))
1094     DONE;
1095 })
1096
1097 (define_insn "*movrf_internal"
1098   [(set (match_operand:RF 0 "destination_operand" "=f,f, m")
1099         (match_operand:RF 1 "general_operand"     "fG,m,fG"))]
1100   "ia64_move_ok (operands[0], operands[1])"
1101   "@
1102    mov %0 = %F1
1103    ldf.fill %0 = %1%P1
1104    stf.spill %0 = %F1%P0"
1105   [(set_attr "itanium_class" "fmisc,fld,stf")])
1106
1107 ;; Better code generation via insns that deal with TFmode register pairs
1108 ;; directly.  Same concerns apply as for TImode.
1109 (define_expand "movtf"
1110   [(set (match_operand:TF 0 "general_operand" "")
1111         (match_operand:TF 1 "general_operand" ""))]
1112   ""
1113 {
1114   rtx op1 = ia64_expand_move (operands[0], operands[1]);
1115   if (!op1)
1116     DONE;
1117   operands[1] = op1;
1118 })
1119
1120 (define_insn_and_split "*movtf_internal"
1121   [(set (match_operand:TF 0 "destination_operand"  "=r,r,m")
1122         (match_operand:TF 1 "general_operand"      "ri,m,r"))]
1123   "ia64_move_ok (operands[0], operands[1])"
1124   "#"
1125   "reload_completed"
1126   [(const_int 0)]
1127 {
1128   ia64_split_tmode_move (operands);
1129   DONE;
1130 }
1131   [(set_attr "itanium_class" "unknown")
1132    (set_attr "predicable" "no")])
1133
1134 \f
1135 ;; ::::::::::::::::::::
1136 ;; ::
1137 ;; :: Conversions
1138 ;; ::
1139 ;; ::::::::::::::::::::
1140
1141 ;; Signed conversions from a smaller integer to a larger integer
1142
1143 (define_insn "extendqidi2"
1144   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1145         (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
1146   ""
1147   "sxt1 %0 = %1"
1148   [(set_attr "itanium_class" "xtd")])
1149
1150 (define_insn "extendhidi2"
1151   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1152         (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
1153   ""
1154   "sxt2 %0 = %1"
1155   [(set_attr "itanium_class" "xtd")])
1156
1157 (define_insn "extendsidi2"
1158   [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
1159         (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
1160   ""
1161   "@
1162    sxt4 %0 = %1
1163    fsxt.r %0 = %1, %1"
1164   [(set_attr "itanium_class" "xtd,fmisc")])
1165
1166 ;; Unsigned conversions from a smaller integer to a larger integer
1167
1168 (define_insn "zero_extendqidi2"
1169   [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1170         (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
1171   ""
1172   "@
1173    zxt1 %0 = %1
1174    ld1%O1 %0 = %1%P1"
1175   [(set_attr "itanium_class" "xtd,ld")
1176    (set_attr "speculable1"   "yes")
1177    (set_attr "speculable2"   "no, yes")])
1178
1179 (define_insn "zero_extendhidi2"
1180   [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1181         (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
1182   ""
1183   "@
1184    zxt2 %0 = %1
1185    ld2%O1 %0 = %1%P1"
1186   [(set_attr "itanium_class" "xtd,ld")
1187    (set_attr "speculable1"   "yes")
1188    (set_attr "speculable2"   "no, yes")])
1189
1190 (define_insn "zero_extendsidi2"
1191   [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
1192         (zero_extend:DI
1193           (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
1194   ""
1195   "@
1196    addp4 %0 = %1, r0
1197    ld4%O1 %0 = %1%P1
1198    fmix.r %0 = f0, %1"
1199   [(set_attr "itanium_class" "ialu,ld,fmisc")
1200    (set_attr "speculable1"   "yes")
1201    (set_attr "speculable2"   "no, yes,no")])
1202
1203 ;; Convert between floating point types of different sizes.
1204
1205 ;; At first glance, it would appear that emitting fnorm for an extending
1206 ;; conversion is unnecessary.  However, the stf and getf instructions work
1207 ;; correctly only if the input is properly rounded for its type.  In
1208 ;; particular, we get the wrong result for getf.d/stfd if the input is a
1209 ;; denorm single.  Since we don't know what the next instruction will be, we
1210 ;; have to emit an fnorm.
1211
1212 ;; ??? Optimization opportunity here.  Get rid of the insn altogether
1213 ;; when we can.  Should probably use a scheme like has been proposed
1214 ;; for ia32 in dealing with operands that match unary operators.  This
1215 ;; would let combine merge the thing into adjacent insns.  See also how the
1216 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
1217 ;; se_register_operand.
1218
1219 (define_insn "extendsfdf2"
1220   [(set (match_operand:DF 0 "fr_register_operand" "=f")
1221         (float_extend:DF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1222   ""
1223   "fnorm.d %0 = %F1"
1224   [(set_attr "itanium_class" "fmac")])
1225
1226 (define_insn "extendsfxf2"
1227   [(set (match_operand:XF 0 "fr_register_operand" "=f")
1228         (float_extend:XF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1229   ""
1230   "fnorm %0 = %F1"
1231   [(set_attr "itanium_class" "fmac")])
1232
1233 (define_insn "extenddfxf2"
1234   [(set (match_operand:XF 0 "fr_register_operand" "=f")
1235         (float_extend:XF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1236   ""
1237   "fnorm %0 = %F1"
1238   [(set_attr "itanium_class" "fmac")])
1239
1240 (define_insn "truncdfsf2"
1241   [(set (match_operand:SF 0 "fr_register_operand" "=f")
1242         (float_truncate:SF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1243   ""
1244   "fnorm.s %0 = %F1"
1245   [(set_attr "itanium_class" "fmac")])
1246
1247 (define_insn "truncxfsf2"
1248   [(set (match_operand:SF 0 "fr_register_operand" "=f")
1249         (float_truncate:SF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1250   ""
1251   "fnorm.s %0 = %F1"
1252   [(set_attr "itanium_class" "fmac")])
1253
1254 (define_insn "truncxfdf2"
1255   [(set (match_operand:DF 0 "fr_register_operand" "=f")
1256         (float_truncate:DF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1257   ""
1258   "fnorm.d %0 = %F1"
1259   [(set_attr "itanium_class" "fmac")])
1260
1261 ;; Convert between signed integer types and floating point.
1262
1263 (define_insn "floatdirf2"
1264   [(set (match_operand:RF 0 "fr_register_operand" "=f")
1265         (float:RF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1266   ""
1267   "fcvt.xf %0 = %F1"
1268   [(set_attr "itanium_class" "fcvtfx")])
1269
1270 (define_insn "floatdixf2"
1271   [(set (match_operand:XF 0 "fr_register_operand" "=f")
1272         (float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1273   ""
1274   "fcvt.xf %0 = %F1"
1275   [(set_attr "itanium_class" "fcvtfx")])
1276
1277 (define_insn "fix_truncsfdi2"
1278   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1279         (fix:DI (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1280   ""
1281   "fcvt.fx.trunc %0 = %F1"
1282   [(set_attr "itanium_class" "fcvtfx")])
1283
1284 (define_insn "fix_truncdfdi2"
1285   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1286         (fix:DI (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1287   ""
1288   "fcvt.fx.trunc %0 = %F1"
1289   [(set_attr "itanium_class" "fcvtfx")])
1290
1291 (define_insn "fix_truncxfdi2"
1292   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1293         (fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1294   ""
1295   "fcvt.fx.trunc %0 = %F1"
1296   [(set_attr "itanium_class" "fcvtfx")])
1297
1298 (define_insn "fix_truncrfdi2"
1299   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1300         (fix:DI (match_operand:RF 1 "fr_reg_or_fp01_operand" "fG")))]
1301   ""
1302   "fcvt.fx.trunc %0 = %F1"
1303   [(set_attr "itanium_class" "fcvtfx")])
1304
1305 ;; Convert between unsigned integer types and floating point.
1306
1307 (define_insn "floatunsdisf2"
1308   [(set (match_operand:SF 0 "fr_register_operand" "=f")
1309         (unsigned_float:SF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1310   ""
1311   "fcvt.xuf.s %0 = %F1"
1312   [(set_attr "itanium_class" "fcvtfx")])
1313
1314 (define_insn "floatunsdidf2"
1315   [(set (match_operand:DF 0 "fr_register_operand" "=f")
1316         (unsigned_float:DF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1317   ""
1318   "fcvt.xuf.d %0 = %F1"
1319   [(set_attr "itanium_class" "fcvtfx")])
1320
1321 (define_insn "floatunsdixf2"
1322   [(set (match_operand:XF 0 "fr_register_operand" "=f")
1323         (unsigned_float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1324   ""
1325   "fcvt.xuf %0 = %F1"
1326   [(set_attr "itanium_class" "fcvtfx")])
1327
1328 (define_insn "floatunsdirf2"
1329   [(set (match_operand:RF 0 "fr_register_operand" "=f")
1330         (unsigned_float:RF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1331   ""
1332   "fcvt.xuf %0 = %F1"
1333   [(set_attr "itanium_class" "fcvtfx")])
1334
1335 (define_insn "fixuns_truncsfdi2"
1336   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1337         (unsigned_fix:DI (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1338   ""
1339   "fcvt.fxu.trunc %0 = %F1"
1340   [(set_attr "itanium_class" "fcvtfx")])
1341
1342 (define_insn "fixuns_truncdfdi2"
1343   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1344         (unsigned_fix:DI (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1345   ""
1346   "fcvt.fxu.trunc %0 = %F1"
1347   [(set_attr "itanium_class" "fcvtfx")])
1348
1349 (define_insn "fixuns_truncxfdi2"
1350   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1351         (unsigned_fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1352   ""
1353   "fcvt.fxu.trunc %0 = %F1"
1354   [(set_attr "itanium_class" "fcvtfx")])
1355
1356 (define_insn "fixuns_truncrfdi2"
1357   [(set (match_operand:DI 0 "fr_register_operand" "=f")
1358         (unsigned_fix:DI (match_operand:RF 1 "fr_reg_or_fp01_operand" "fG")))]
1359   ""
1360   "fcvt.fxu.trunc %0 = %F1"
1361   [(set_attr "itanium_class" "fcvtfx")])
1362 \f
1363 ;; ::::::::::::::::::::
1364 ;; ::
1365 ;; :: Bit field extraction
1366 ;; ::
1367 ;; ::::::::::::::::::::
1368
1369 (define_insn "extv"
1370   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1371         (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1372                          (match_operand:DI 2 "extr_len_operand" "n")
1373                          (match_operand:DI 3 "shift_count_operand" "M")))]
1374   ""
1375   "extr %0 = %1, %3, %2"
1376   [(set_attr "itanium_class" "ishf")])
1377
1378 (define_insn "extzv"
1379   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1380         (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1381                          (match_operand:DI 2 "extr_len_operand" "n")
1382                          (match_operand:DI 3 "shift_count_operand" "M")))]
1383   ""
1384   "extr.u %0 = %1, %3, %2"
1385   [(set_attr "itanium_class" "ishf")])
1386
1387 ;; Insert a bit field.
1388 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1389 ;; Source1 can be 0 or -1.
1390 ;; Source2 can be 0.
1391
1392 ;; ??? Actual dep instruction is more powerful than what these insv
1393 ;; patterns support.  Unfortunately, combine is unable to create patterns
1394 ;; where source2 != dest.
1395
1396 (define_expand "insv"
1397   [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1398                          (match_operand:DI 1 "const_int_operand" "")
1399                          (match_operand:DI 2 "const_int_operand" ""))
1400         (match_operand:DI 3 "nonmemory_operand" ""))]
1401   ""
1402 {
1403   int width = INTVAL (operands[1]);
1404   int shift = INTVAL (operands[2]);
1405
1406   /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1407      pseudo.  */
1408   if (! register_operand (operands[3], DImode)
1409       && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1410     operands[3] = force_reg (DImode, operands[3]);
1411
1412   /* If this is a single dep instruction, we have nothing to do.  */
1413   if (! ((register_operand (operands[3], DImode) && width <= 16)
1414          || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1415     {
1416       /* Check for cases that can be implemented with a mix instruction.  */
1417       if (width == 32 && shift == 0)
1418         {
1419           /* Directly generating the mix4left instruction confuses
1420              optimize_bit_field in function.c.  Since this is performing
1421              a useful optimization, we defer generation of the complicated
1422              mix4left RTL to the first splitting phase.  */
1423           rtx tmp = gen_reg_rtx (DImode);
1424           emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1425           DONE;
1426         }
1427       else if (width == 32 && shift == 32)
1428         {
1429           emit_insn (gen_mix4right (operands[0], operands[3]));
1430           DONE;
1431         }
1432
1433       /* We could handle remaining cases by emitting multiple dep
1434          instructions.
1435
1436          If we need more than two dep instructions then we lose.  A 6
1437          insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1438          mov;;dep,shr;;dep,shr;;dep.  The former can be executed in 3 cycles,
1439          the latter is 6 cycles on an Itanium (TM) processor, because there is
1440          only one function unit that can execute dep and shr immed.
1441
1442          If we only need two dep instruction, then we still lose.
1443          mov;;dep,shr;;dep is still 4 cycles.  Even if we optimize away
1444          the unnecessary mov, this is still undesirable because it will be
1445          hard to optimize, and it creates unnecessary pressure on the I0
1446          function unit.  */
1447
1448       FAIL;
1449
1450 #if 0
1451       /* This code may be useful for other IA-64 processors, so we leave it in
1452          for now.  */
1453       while (width > 16)
1454         {
1455           rtx tmp;
1456
1457           emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1458                                operands[3]));
1459           shift += 16;
1460           width -= 16;
1461           tmp = gen_reg_rtx (DImode);
1462           emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1463           operands[3] = tmp;
1464         }
1465       operands[1] = GEN_INT (width);
1466       operands[2] = GEN_INT (shift);
1467 #endif
1468     }
1469 })
1470
1471 (define_insn "*insv_internal"
1472   [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1473                          (match_operand:DI 1 "const_int_operand" "n")
1474                          (match_operand:DI 2 "const_int_operand" "n"))
1475         (match_operand:DI 3 "nonmemory_operand" "rP"))]
1476   "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1477    || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1478   "dep %0 = %3, %0, %2, %1"
1479   [(set_attr "itanium_class" "ishf")])
1480
1481 ;; Combine doesn't like to create bit-field insertions into zero.
1482 (define_insn "*shladdp4_internal"
1483   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1484         (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1485                            (match_operand:DI 2 "shladd_log2_operand" "n"))
1486                 (match_operand:DI 3 "const_int_operand" "n")))]
1487   "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1488   "shladdp4 %0 = %1, %2, r0"
1489   [(set_attr "itanium_class" "ialu")])
1490
1491 (define_insn "*depz_internal"
1492   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1493         (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1494                            (match_operand:DI 2 "const_int_operand" "M"))
1495                 (match_operand:DI 3 "const_int_operand" "n")))]
1496   "satisfies_constraint_M (operands[2])
1497    && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1498 {
1499   operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1500   return "%,dep.z %0 = %1, %2, %3";
1501 }
1502   [(set_attr "itanium_class" "ishf")])
1503
1504 (define_insn "shift_mix4left"
1505   [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1506                          (const_int 32) (const_int 0))
1507         (match_operand:DI 1 "gr_register_operand" "r"))
1508    (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1509   ""
1510   "#"
1511   [(set_attr "itanium_class" "unknown")])
1512
1513 (define_split
1514   [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1515                          (const_int 32) (const_int 0))
1516         (match_operand:DI 1 "register_operand" ""))
1517    (clobber (match_operand:DI 2 "register_operand" ""))]
1518   ""
1519   [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1520    (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1521         (lshiftrt:DI (match_dup 3) (const_int 32)))]
1522   "operands[3] = operands[2];")
1523
1524 (define_insn "*mix4left"
1525   [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1526                          (const_int 32) (const_int 0))
1527         (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1528                      (const_int 32)))]
1529   ""
1530   "mix4.l %0 = %0, %r1"
1531   [(set_attr "itanium_class" "mmshf")])
1532
1533 (define_insn "mix4right"
1534   [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1535                          (const_int 32) (const_int 32))
1536         (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1537   ""
1538   "mix4.r %0 = %r1, %0"
1539   [(set_attr "itanium_class" "mmshf")])
1540
1541 ;; This is used by the rotrsi3 pattern.
1542
1543 (define_insn "*mix4right_3op"
1544   [(set (match_operand:DI 0 "gr_register_operand" "=r")
1545         (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1546                 (ashift:DI (zero_extend:DI
1547                              (match_operand:SI 2 "gr_register_operand" "r"))
1548                            (const_int 32))))]
1549   ""
1550   "mix4.r %0 = %2, %1"
1551   [(set_attr "itanium_class" "mmshf")])
1552
1553 \f
1554 ;; ::::::::::::::::::::
1555 ;; ::
1556 ;; :: 1-bit Integer arithmetic
1557 ;; ::
1558 ;; ::::::::::::::::::::
1559
1560 (define_insn_and_split "andbi3"
1561   [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1562         (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1563                 (match_operand:BI 2 "register_operand" "c,r,r")))]
1564   ""
1565   "@
1566    #
1567    tbit.nz.and.orcm %0, %I0 = %2, 0
1568    and %0 = %2, %1"
1569   "reload_completed
1570    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1571    && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1572   [(cond_exec (eq (match_dup 2) (const_int 0))
1573      (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1574                                 (match_dup 0))))]
1575   ""
1576   [(set_attr "itanium_class" "unknown,tbit,ilog")])
1577
1578 (define_insn_and_split "*andcmbi3"
1579   [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1580         (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1581                 (match_operand:BI 2 "register_operand" "0,0,r")))]
1582   ""
1583   "@
1584    #
1585    tbit.z.and.orcm %0, %I0 = %1, 0
1586    andcm %0 = %2, %1"
1587   "reload_completed
1588    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1589    && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1590   [(cond_exec (ne (match_dup 1) (const_int 0))
1591      (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1592                                 (match_dup 0))))]
1593   ""
1594   [(set_attr "itanium_class" "unknown,tbit,ilog")])
1595
1596 (define_insn_and_split "iorbi3"
1597   [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1598         (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1599                 (match_operand:BI 2 "register_operand" "c,r,r")))]
1600   ""
1601   "@
1602    #
1603    tbit.nz.or.andcm %0, %I0 = %2, 0
1604    or %0 = %2, %1"
1605   "reload_completed
1606    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1607    && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1608   [(cond_exec (ne (match_dup 2) (const_int 0))
1609      (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1610                                 (match_dup 0))))]
1611   ""
1612   [(set_attr "itanium_class" "unknown,tbit,ilog")])
1613
1614 (define_insn_and_split "*iorcmbi3"
1615   [(set (match_operand:BI 0 "register_operand" "=c,c")
1616         (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1617                 (match_operand:BI 2 "register_operand" "0,0")))]
1618   ""
1619   "@
1620    #
1621    tbit.z.or.andcm %0, %I0 = %1, 0"
1622   "reload_completed
1623    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1624    && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1625   [(cond_exec (eq (match_dup 1) (const_int 0))
1626      (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1627                                 (match_dup 0))))]
1628   ""
1629   [(set_attr "itanium_class" "unknown,tbit")])
1630
1631 (define_insn "one_cmplbi2"
1632   [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1633         (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1634    (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1635   ""
1636   "@
1637    tbit.z %0, %I0 = %1, 0
1638    xor %0 = 1, %1
1639    #
1640    #"
1641   [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1642
1643 (define_split
1644   [(set (match_operand:BI 0 "register_operand" "")
1645         (not:BI (match_operand:BI 1 "register_operand" "")))
1646    (clobber (match_scratch:BI 2 ""))]
1647   "reload_completed
1648    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1649    && rtx_equal_p (operands[0], operands[1])"
1650   [(set (match_dup 4) (match_dup 3))
1651    (set (match_dup 0) (const_int 1))
1652    (cond_exec (ne (match_dup 2) (const_int 0))
1653      (set (match_dup 0) (const_int 0)))
1654    (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1655   "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1656    operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1657
1658 (define_split
1659   [(set (match_operand:BI 0 "register_operand" "")
1660         (not:BI (match_operand:BI 1 "register_operand" "")))
1661    (clobber (match_scratch:BI 2 ""))]
1662   "reload_completed
1663    && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1664    && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1665    && ! rtx_equal_p (operands[0], operands[1])"
1666   [(cond_exec (ne (match_dup 1) (const_int 0))
1667      (set (match_dup 0) (const_int 0)))
1668    (cond_exec (eq (match_dup 1) (const_int 0))
1669      (set (match_dup 0) (const_int 1)))
1670    (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1671   "")
1672
1673 (define_insn "*cmpsi_and_0"
1674   [(set (match_operand:BI 0 "register_operand" "=c")
1675         (and:BI (match_operator:BI 4 "predicate_operator"
1676                   [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1677                    (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1678                 (match_operand:BI 1 "register_operand" "0")))]
1679   ""
1680   "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1681   [(set_attr "itanium_class" "icmp")])
1682
1683 (define_insn "*cmpsi_and_1"
1684   [(set (match_operand:BI 0 "register_operand" "=c")
1685         (and:BI (match_operator:BI 3 "signed_inequality_operator"
1686                   [(match_operand:SI 2 "gr_register_operand" "r")
1687                    (const_int 0)])
1688                 (match_operand:BI 1 "register_operand" "0")))]
1689   ""
1690   "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1691   [(set_attr "itanium_class" "icmp")])
1692
1693 (define_insn "*cmpsi_andnot_0"
1694   [(set (match_operand:BI 0 "register_operand" "=c")
1695         (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1696                          [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1697                           (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1698                 (match_operand:BI 1 "register_operand" "0")))]
1699   ""
1700   "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1701   [(set_attr "itanium_class" "icmp")])
1702
1703 (define_insn "*cmpsi_andnot_1"
1704   [(set (match_operand:BI 0 "register_operand" "=c")
1705         (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1706                           [(match_operand:SI 2 "gr_register_operand" "r")
1707                            (const_int 0)]))
1708                 (match_operand:BI 1 "register_operand" "0")))]
1709   ""
1710   "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1711   [(set_attr "itanium_class" "icmp")])
1712
1713 (define_insn "*cmpdi_and_0"
1714   [(set (match_operand:BI 0 "register_operand" "=c")
1715         (and:BI (match_operator:BI 4 "predicate_operator"
1716                   [(match_operand:DI 2 "gr_register_operand" "r")
1717                    (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1718                 (match_operand:BI 1 "register_operand" "0")))]
1719   ""
1720   "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1721   [(set_attr "itanium_class" "icmp")])
1722
1723 (define_insn "*cmpdi_and_1"
1724   [(set (match_operand:BI 0 "register_operand" "=c")
1725         (and:BI (match_operator:BI 3 "signed_inequality_operator"
1726                   [(match_operand:DI 2 "gr_register_operand" "r")
1727                    (const_int 0)])
1728                 (match_operand:BI 1 "register_operand" "0")))]
1729   ""
1730   "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1731   [(set_attr "itanium_class" "icmp")])
1732
1733 (define_insn "*cmpdi_andnot_0"
1734   [(set (match_operand:BI 0 "register_operand" "=c")
1735         (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1736                          [(match_operand:DI 2 "gr_register_operand" "r")
1737                           (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1738                 (match_operand:BI 1 "register_operand" "0")))]
1739   ""
1740   "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1741   [(set_attr "itanium_class" "icmp")])
1742
1743 (define_insn "*cmpdi_andnot_1"
1744   [(set (match_operand:BI 0 "register_operand" "=c")
1745         (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1746                           [(match_operand:DI 2 "gr_register_operand" "r")
1747                            (const_int 0)]))
1748                 (match_operand:BI 1 "register_operand" "0")))]
1749   ""
1750   "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1751   [(set_attr "itanium_class" "icmp")])
1752
1753 (define_insn "*tbit_and_0"
1754   [(set (match_operand:BI 0 "register_operand" "=c")
1755         (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1756                                (const_int 1))
1757                        (const_int 0))
1758                 (match_operand:BI 2 "register_operand" "0")))]
1759   ""
1760   "tbit.nz.and.orcm %0, %I0 = %1, 0"
1761   [(set_attr "itanium_class" "tbit")])
1762
1763 (define_insn "*tbit_and_1"
1764   [(set (match_operand:BI 0 "register_operand" "=c")
1765         (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1766                                (const_int 1))
1767                        (const_int 0))
1768                 (match_operand:BI 2 "register_operand" "0")))]
1769   ""
1770   "tbit.z.and.orcm %0, %I0 = %1, 0"
1771   [(set_attr "itanium_class" "tbit")])
1772
1773 (define_insn "*tbit_and_2"
1774   [(set (match_operand:BI 0 "register_operand" "=c")
1775         (and:BI (ne:BI (zero_extract:DI
1776                          (match_operand:DI 1 "gr_register_operand" "r")
1777                          (const_int 1)
1778                          (match_operand:DI 2 "shift_count_operand" "M"))
1779                        (const_int 0))
1780                 (match_operand:BI 3 "register_operand" "0")))]
1781   ""
1782   "tbit.nz.and.orcm %0, %I0 = %1, %2"
1783   [(set_attr "itanium_class" "tbit")])
1784
1785 (define_insn "*tbit_and_3"
1786   [(set (match_operand:BI 0 "register_operand" "=c")
1787         (and:BI (eq:BI (zero_extract:DI
1788                          (match_operand:DI 1 "gr_register_operand" "r")
1789                          (const_int 1)
1790                          (match_operand:DI 2 "shift_count_operand" "M"))
1791                        (const_int 0))
1792                 (match_operand:BI 3 "register_operand" "0")))]
1793   ""
1794   "tbit.z.and.orcm %0, %I0 = %1, %2"
1795   [(set_attr "itanium_class" "tbit")])
1796
1797 (define_insn "*cmpsi_or_0"
1798   [(set (match_operand:BI 0 "register_operand" "=c")
1799         (ior:BI (match_operator:BI 4 "predicate_operator"
1800                   [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1801                    (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1802                 (match_operand:BI 1 "register_operand" "0")))]
1803   ""
1804   "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1805   [(set_attr "itanium_class" "icmp")])
1806
1807 (define_insn "*cmpsi_or_1"
1808   [(set (match_operand:BI 0 "register_operand" "=c")
1809         (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1810                   [(match_operand:SI 2 "gr_register_operand" "r")
1811                    (const_int 0)])
1812                 (match_operand:BI 1 "register_operand" "0")))]
1813   ""
1814   "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1815   [(set_attr "itanium_class" "icmp")])
1816
1817 (define_insn "*cmpsi_orcm_0"
1818   [(set (match_operand:BI 0 "register_operand" "=c")
1819         (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1820                          [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1821                           (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1822                 (match_operand:BI 1 "register_operand" "0")))]
1823   ""
1824   "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1825   [(set_attr "itanium_class" "icmp")])
1826
1827 (define_insn "*cmpsi_orcm_1"
1828   [(set (match_operand:BI 0 "register_operand" "=c")
1829         (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1830                           [(match_operand:SI 2 "gr_register_operand" "r")
1831                            (const_int 0)]))
1832                 (match_operand:BI 1 "register_operand" "0")))]
1833   ""
1834   "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1835   [(set_attr "itanium_class" "icmp")])
1836
1837 (define_insn "*cmpdi_or_0"
1838   [(set (match_operand:BI 0 "register_operand" "=c")
1839         (ior:BI (match_operator:BI 4 "predicate_operator"
1840                   [(match_operand:DI 2 "gr_register_operand" "r")
1841                    (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1842                 (match_operand:BI 1 "register_operand" "0")))]
1843   ""
1844   "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1845   [(set_attr "itanium_class" "icmp")])
1846
1847 (define_insn "*cmpdi_or_1"
1848   [(set (match_operand:BI 0 "register_operand" "=c")
1849         (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1850                   [(match_operand:DI 2 "gr_register_operand" "r")
1851                    (const_int 0)])
1852                 (match_operand:BI 1 "register_operand" "0")))]
1853   ""
1854   "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1855   [(set_attr "itanium_class" "icmp")])
1856
1857 (define_insn "*cmpdi_orcm_0"
1858   [(set (match_operand:BI 0 "register_operand" "=c")
1859         (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1860                          [(match_operand:DI 2 "gr_register_operand" "r")
1861                           (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1862                 (match_operand:BI 1 "register_operand" "0")))]
1863   ""
1864   "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1865   [(set_attr "itanium_class" "icmp")])
1866
1867 (define_insn "*cmpdi_orcm_1"
1868   [(set (match_operand:BI 0 "register_operand" "=c")
1869         (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1870                           [(match_operand:DI 2 "gr_register_operand" "r")
1871                            (const_int 0)]))
1872                 (match_operand:BI 1 "register_operand" "0")))]
1873   ""
1874   "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1875   [(set_attr "itanium_class" "icmp")])
1876
1877 (define_insn "*tbit_or_0"
1878   [(set (match_operand:BI 0 "register_operand" "=c")
1879         (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1880                                (const_int 1))
1881                        (const_int 0))
1882                 (match_operand:BI 2 "register_operand" "0")))]
1883   ""
1884   "tbit.nz.or.andcm %0, %I0 = %1, 0"
1885   [(set_attr "itanium_class" "tbit")])
1886
1887 (define_insn "*tbit_or_1"
1888   [(set (match_operand:BI 0 "register_operand" "=c")
1889         (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1890                                (const_int 1))
1891                        (const_int 0))
1892                 (match_operand:BI 2 "register_operand" "0")))]
1893   ""
1894   "tbit.z.or.andcm %0, %I0 = %1, 0"
1895   [(set_attr "itanium_class" "tbit")])
1896
1897 (define_insn "*tbit_or_2"
1898   [(set (match_operand:BI 0 "register_operand" "=c")
1899         (ior:BI (ne:BI (zero_extract:DI
1900                          (match_operand:DI 1 "gr_register_operand" "r")
1901                          (const_int 1)
1902                          (match_operand:DI 2 "shift_count_operand" "M"))
1903                        (const_int 0))
1904                 (match_operand:BI 3 "register_operand" "0")))]
1905   ""
1906   "tbit.nz.or.andcm %0, %I0 = %1, %2"
1907   [(set_attr "itanium_class" "tbit")])
1908
1909 (define_insn "*tbit_or_3"
1910   [(set (match_operand:BI 0 "register_operand" "=c")
1911         (ior:BI (eq:BI (zero_extract:DI
1912                          (match_operand:DI 1 "gr_register_operand" "r")
1913                          (const_int 1)
1914                          (match_operand:DI 2 "shift_count_operand" "M"))
1915                        (const_int 0))
1916                 (match_operand:BI 3 "register_operand" "0")))]
1917   ""
1918   "tbit.z.or.andcm %0, %I0 = %1, %2"
1919   [(set_attr "itanium_class" "tbit")])
1920
1921 ;; Transform test of and/or of setcc into parallel comparisons.
1922
1923 (define_split
1924   [(set (match_operand:BI 0 "register_operand" "")
1925         (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1926                               (const_int 0))
1927                        (match_operand:DI 3 "register_operand" ""))
1928                (const_int 0)))]
1929   ""
1930   [(set (match_dup 0)
1931         (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1932                 (match_dup 2)))]
1933   "")
1934
1935 (define_split
1936   [(set (match_operand:BI 0 "register_operand" "")
1937         (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1938                               (const_int 0))
1939                        (match_operand:DI 3 "register_operand" ""))
1940                (const_int 0)))]
1941   ""
1942   [(set (match_dup 0)
1943         (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1944                 (match_dup 2)))
1945    (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1946               (clobber (scratch))])]
1947   "")
1948
1949 (define_split
1950   [(set (match_operand:BI 0 "register_operand" "")
1951         (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1952                               (const_int 0))
1953                        (match_operand:DI 3 "register_operand" ""))
1954                (const_int 0)))]
1955   ""
1956   [(set (match_dup 0) 
1957         (ior:BI (ne:BI (match_dup 3) (const_int 0))
1958                 (match_dup 2)))]
1959   "")
1960
1961 (define_split
1962   [(set (match_operand:BI 0 "register_operand" "")
1963         (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1964                               (const_int 0))
1965                        (match_operand:DI 3 "register_operand" ""))
1966                (const_int 0)))]
1967   ""
1968   [(set (match_dup 0) 
1969         (ior:BI (ne:BI (match_dup 3) (const_int 0))
1970                 (match_dup 2)))
1971    (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1972               (clobber (scratch))])]
1973   "")
1974
1975 ;; ??? Incredibly hackish.  Either need four proper patterns with all
1976 ;; the alternatives, or rely on sched1 to split the insn and hope that
1977 ;; nothing bad happens to the comparisons in the meantime.
1978 ;;
1979 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1980 ;; that we're doing height reduction.
1981 ;
1982 ;(define_insn_and_split ""
1983 ;  [(set (match_operand:BI 0 "register_operand" "=c")
1984 ;       (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1985 ;                         [(match_operand 2 "" "")
1986 ;                          (match_operand 3 "" "")])
1987 ;                       (match_operator:BI 4 "comparison_operator"
1988 ;                         [(match_operand 5 "" "")
1989 ;                          (match_operand 6 "" "")]))
1990 ;               (match_dup 0)))]
1991 ;  "flag_schedule_insns"
1992 ;  "#"
1993 ;  ""
1994 ;  [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1995 ;   (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1996 ;  "")
1997 ;
1998 ;(define_insn_and_split ""
1999 ;  [(set (match_operand:BI 0 "register_operand" "=c")
2000 ;       (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
2001 ;                         [(match_operand 2 "" "")
2002 ;                          (match_operand 3 "" "")])
2003 ;                       (match_operator:BI 4 "comparison_operator"
2004 ;                         [(match_operand 5 "" "")
2005 ;                          (match_operand 6 "" "")]))
2006 ;               (match_dup 0)))]
2007 ;  "flag_schedule_insns"
2008 ;  "#"
2009 ;  ""
2010 ;  [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
2011 ;   (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
2012 ;  "")
2013 ;
2014 ;(define_split
2015 ;  [(set (match_operand:BI 0 "register_operand" "")
2016 ;       (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
2017 ;                         [(match_operand 2 "" "")
2018 ;                          (match_operand 3 "" "")])
2019 ;                       (match_operand:BI 7 "register_operand" ""))
2020 ;               (and:BI (match_operator:BI 4 "comparison_operator"
2021 ;                         [(match_operand 5 "" "")
2022 ;                          (match_operand 6 "" "")])
2023 ;                       (match_operand:BI 8 "register_operand" ""))))]
2024 ;  ""
2025 ;  [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
2026 ;   (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
2027 ;                             (match_dup 0)))]
2028 ;  "")
2029 ;
2030 ;(define_split
2031 ;  [(set (match_operand:BI 0 "register_operand" "")
2032 ;       (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
2033 ;                         [(match_operand 2 "" "")
2034 ;                          (match_operand 3 "" "")])
2035 ;                       (match_operand:BI 7 "register_operand" ""))
2036 ;               (ior:BI (match_operator:BI 4 "comparison_operator"
2037 ;                         [(match_operand 5 "" "")
2038 ;                          (match_operand 6 "" "")])
2039 ;                       (match_operand:BI 8 "register_operand" ""))))]
2040 ;  ""
2041 ;  [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
2042 ;   (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
2043 ;                             (match_dup 0)))]
2044 ;  "")
2045
2046 ;; Try harder to avoid predicate copies by duplicating compares.
2047 ;; Note that we'll have already split the predicate copy, which
2048 ;; is kind of a pain, but oh well.
2049
2050 (define_peephole2
2051   [(set (match_operand:BI 0 "register_operand" "")
2052         (match_operand:BI 1 "comparison_operator" ""))
2053    (set (match_operand:CCI 2 "register_operand" "")
2054         (match_operand:CCI 3 "register_operand" ""))
2055    (set (match_operand:CCI 4 "register_operand" "")
2056         (match_operand:CCI 5 "register_operand" ""))
2057    (set (match_operand:BI 6 "register_operand" "")
2058         (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
2059   "REGNO (operands[3]) == REGNO (operands[0])
2060    && REGNO (operands[4]) == REGNO (operands[0]) + 1
2061    && REGNO (operands[4]) == REGNO (operands[2]) + 1
2062    && REGNO (operands[6]) == REGNO (operands[2])"
2063   [(set (match_dup 0) (match_dup 1))
2064    (set (match_dup 6) (match_dup 7))]
2065   "operands[7] = copy_rtx (operands[1]);")
2066 \f
2067 ;; ::::::::::::::::::::
2068 ;; ::
2069 ;; :: 16-bit Integer arithmetic
2070 ;; ::
2071 ;; ::::::::::::::::::::
2072
2073 (define_insn "mulhi3"
2074   [(set (match_operand:HI 0 "gr_register_operand" "=r")
2075         (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
2076                  (match_operand:HI 2 "gr_register_operand" "r")))]
2077   ""
2078   "pmpy2.r %0 = %1, %2"
2079   [(set_attr "itanium_class" "mmmul")])
2080
2081 \f
2082 ;; ::::::::::::::::::::
2083 ;; ::
2084 ;; :: 32-bit Integer arithmetic
2085 ;; ::
2086 ;; ::::::::::::::::::::
2087
2088 (define_insn "addsi3"
2089   [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
2090         (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
2091                  (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2092   ""
2093   "@
2094    add %0 = %1, %2
2095    adds %0 = %2, %1
2096    addl %0 = %2, %1"
2097   [(set_attr "itanium_class" "ialu")])
2098
2099 (define_insn "*addsi3_plus1"
2100   [(set (match_operand:SI 0 "gr_register_operand" "=r")
2101         (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
2102                           (match_operand:SI 2 "gr_register_operand" "r"))
2103                  (const_int 1)))]
2104   ""
2105   "add %0 = %1, %2, 1"
2106   [(set_attr "itanium_class" "ialu")])
2107
2108 (define_insn "*addsi3_plus1_alt"
2109   [(set (match_operand:SI 0 "gr_register_operand" "=r")
2110         (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2111                           (const_int 2))
2112                  (const_int 1)))]
2113   ""
2114   "add %0 = %1, %1, 1"
2115   [(set_attr "itanium_class" "ialu")])
2116
2117 (define_insn "*addsi3_shladd"
2118   [(set (match_operand:SI 0 "gr_register_operand" "=r")
2119         (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2120                           (match_operand:SI 2 "shladd_operand" "n"))
2121                  (match_operand:SI 3 "gr_register_operand" "r")))]
2122   ""
2123   "shladd %0 = %1, %S2, %3"
2124   [(set_attr "itanium_class" "ialu")])
2125
2126 (define_insn "subsi3"
2127   [(set (match_operand:SI 0 "gr_register_operand" "=r")
2128         (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
2129                   (match_operand:SI 2 "gr_register_operand" "r")))]
2130   ""
2131   "sub %0 = %1, %2"
2132   [(set_attr "itanium_class" "ialu")])
2133
2134 (define_insn "*subsi3_minus1"
2135   [(set (match_operand:SI 0 "gr_register_operand" "=r")
2136         (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
2137                  (match_operand:SI 2 "gr_register_operand" "r")))]
2138   ""
2139   "sub %0 = %2, %1, 1"
2140   [(set_attr "itanium_class" "ialu")])
2141
2142 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
2143
2144 (define_insn "mulsi3"
2145   [(set (match_operand:SI 0 "fr_register_operand" "=f")
2146         (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2147                  (match_operand:SI 2 "grfr_register_operand" "f")))]
2148   ""
2149   "xmpy.l %0 = %1, %2"
2150   [(set_attr "itanium_class" "xmpy")])
2151
2152 (define_insn "maddsi4"
2153   [(set (match_operand:SI 0 "fr_register_operand" "=f")
2154         (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2155                           (match_operand:SI 2 "grfr_register_operand" "f"))
2156                  (match_operand:SI 3 "grfr_register_operand" "f")))]
2157   ""
2158   "xma.l %0 = %1, %2, %3"
2159   [(set_attr "itanium_class" "xmpy")])
2160
2161 (define_insn "negsi2"
2162   [(set (match_operand:SI 0 "gr_register_operand" "=r")
2163         (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
2164   ""
2165   "sub %0 = r0, %1"
2166   [(set_attr "itanium_class" "ialu")])
2167
2168 (define_expand "abssi2"
2169   [(set (match_dup 2)
2170         (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
2171    (set (match_operand:SI 0 "gr_register_operand" "")
2172         (if_then_else:SI (eq (match_dup 2) (const_int 0))
2173                          (neg:SI (match_dup 1))
2174                          (match_dup 1)))]
2175   ""
2176   { operands[2] = gen_reg_rtx (BImode); })
2177
2178 (define_expand "sminsi3"
2179   [(set (match_dup 3)
2180         (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2181                (match_operand:SI 2 "gr_register_operand" "")))
2182    (set (match_operand:SI 0 "gr_register_operand" "")
2183         (if_then_else:SI (ne (match_dup 3) (const_int 0))
2184                          (match_dup 2) (match_dup 1)))]
2185   ""
2186   { operands[3] = gen_reg_rtx (BImode); })
2187
2188 (define_expand "smaxsi3"
2189   [(set (match_dup 3)
2190         (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2191                (match_operand:SI 2 "gr_register_operand" "")))
2192    (set (match_operand:SI 0 "gr_register_operand" "")
2193         (if_then_else:SI (ne (match_dup 3) (const_int 0))
2194                          (match_dup 1) (match_dup 2)))]
2195   ""
2196   { operands[3] = gen_reg_rtx (BImode); })
2197
2198 (define_expand "uminsi3"
2199   [(set (match_dup 3)
2200         (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2201                 (match_operand:SI 2 "gr_register_operand" "")))
2202    (set (match_operand:SI 0 "gr_register_operand" "")
2203         (if_then_else:SI (ne (match_dup 3) (const_int 0))
2204                          (match_dup 2) (match_dup 1)))]
2205   ""
2206   { operands[3] = gen_reg_rtx (BImode); })
2207
2208 (define_expand "umaxsi3"
2209   [(set (match_dup 3)
2210         (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2211                 (match_operand:SI 2 "gr_register_operand" "")))
2212    (set (match_operand:SI 0 "gr_register_operand" "")
2213         (if_then_else:SI (ne (match_dup 3) (const_int 0))
2214                          (match_dup 1) (match_dup 2)))]
2215   ""
2216   { operands[3] = gen_reg_rtx (BImode); })
2217 \f
2218 ;; ::::::::::::::::::::
2219 ;; ::
2220 ;; :: 64-bit Integer arithmetic
2221 ;; ::
2222 ;; ::::::::::::::::::::
2223
2224 (define_insn "adddi3"
2225   [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2226         (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2227                  (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2228   ""
2229   "@
2230    add %0 = %1, %2
2231    adds %0 = %2, %1
2232    addl %0 = %2, %1"
2233   [(set_attr "itanium_class" "ialu")])
2234
2235 (define_insn "*adddi3_plus1"
2236   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2237         (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2238                           (match_operand:DI 2 "gr_register_operand" "r"))
2239                  (const_int 1)))]
2240   ""
2241   "add %0 = %1, %2, 1"
2242   [(set_attr "itanium_class" "ialu")])
2243
2244 ;; This has some of the same problems as shladd.  We let the shladd
2245 ;; eliminator hack handle it, which results in the 1 being forced into
2246 ;; a register, but not more ugliness here.
2247 (define_insn "*adddi3_plus1_alt"
2248   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2249         (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2250                           (const_int 2))
2251                  (const_int 1)))]
2252   ""
2253   "add %0 = %1, %1, 1"
2254   [(set_attr "itanium_class" "ialu")])
2255
2256 (define_insn "subdi3"
2257   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2258         (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2259                   (match_operand:DI 2 "gr_register_operand" "r")))]
2260   ""
2261   "sub %0 = %1, %2"
2262   [(set_attr "itanium_class" "ialu")])
2263
2264 (define_insn "*subdi3_minus1"
2265   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2266         (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2267                  (match_operand:DI 2 "gr_register_operand" "r")))]
2268   ""
2269   "sub %0 = %2, %1, 1"
2270   [(set_attr "itanium_class" "ialu")])
2271
2272 ;; ??? Use grfr instead of fr because of virtual register elimination
2273 ;; and silly test cases multiplying by the frame pointer.
2274 (define_insn "muldi3"
2275   [(set (match_operand:DI 0 "fr_register_operand" "=f")
2276         (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2277                  (match_operand:DI 2 "grfr_register_operand" "f")))]
2278   ""
2279   "xmpy.l %0 = %1, %2"
2280   [(set_attr "itanium_class" "xmpy")])
2281
2282 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2283 ;; same problem that we have with shladd below.  Unfortunately, this case is
2284 ;; much harder to fix because the multiply puts the result in an FP register,
2285 ;; but the add needs inputs from a general register.  We add a spurious clobber
2286 ;; here so that it will be present just in case register elimination gives us
2287 ;; the funny result.
2288
2289 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2290
2291 ;; ??? Maybe we should change how adds are canonicalized.
2292
2293 (define_insn "madddi4"
2294   [(set (match_operand:DI 0 "fr_register_operand" "=f")
2295         (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2296                           (match_operand:DI 2 "grfr_register_operand" "f"))
2297                  (match_operand:DI 3 "grfr_register_operand" "f")))
2298    (clobber (match_scratch:DI 4 "=X"))]
2299   ""
2300   "xma.l %0 = %1, %2, %3"
2301   [(set_attr "itanium_class" "xmpy")])
2302
2303 ;; This can be created by register elimination if operand3 of shladd is an
2304 ;; eliminable register or has reg_equiv_constant set.
2305
2306 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2307 ;; validate_changes call inside eliminate_regs will always succeed.  If it
2308 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2309 ;; incorrectly.
2310
2311 (define_insn "*madddi4_elim"
2312   [(set (match_operand:DI 0 "register_operand" "=&r")
2313         (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2314                                    (match_operand:DI 2 "register_operand" "f"))
2315                           (match_operand:DI 3 "register_operand" "f"))
2316                  (match_operand:DI 4 "nonmemory_operand" "rI")))
2317    (clobber (match_scratch:DI 5 "=f"))]
2318   "reload_in_progress"
2319   "#"
2320   [(set_attr "itanium_class" "unknown")])
2321
2322 (define_split
2323   [(set (match_operand:DI 0 "register_operand" "")
2324         (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2325                                    (match_operand:DI 2 "register_operand" ""))
2326                           (match_operand:DI 3 "register_operand" ""))
2327                  (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2328    (clobber (match_scratch:DI 5 ""))]
2329   "reload_completed"
2330   [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2331                                           (match_dup 3)))
2332               (clobber (match_dup 0))])
2333    (set (match_dup 0) (match_dup 5))
2334    (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2335   "")
2336
2337 (define_insn "smuldi3_highpart"
2338   [(set (match_operand:DI 0 "fr_register_operand" "=f")
2339         (truncate:DI
2340          (lshiftrt:TI
2341           (mult:TI (sign_extend:TI
2342                      (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2343                    (sign_extend:TI
2344                      (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG")))
2345           (const_int 64))))]
2346   ""
2347   "xmpy.h %0 = %F1, %F2"
2348   [(set_attr "itanium_class" "xmpy")])
2349
2350 (define_insn "umuldi3_highpart"
2351   [(set (match_operand:DI 0 "fr_register_operand" "=f")
2352         (truncate:DI
2353          (lshiftrt:TI
2354           (mult:TI (zero_extend:TI
2355                      (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2356                    (zero_extend:TI
2357                      (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG")))
2358           (const_int 64))))]
2359   ""
2360   "xmpy.hu %0 = %F1, %F2"
2361   [(set_attr "itanium_class" "xmpy")])
2362
2363 (define_insn "negdi2"
2364   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2365         (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2366   ""
2367   "sub %0 = r0, %1"
2368   [(set_attr "itanium_class" "ialu")])
2369
2370 (define_expand "absdi2"
2371   [(set (match_dup 2)
2372         (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2373    (set (match_operand:DI 0 "gr_register_operand" "")
2374         (if_then_else:DI (eq (match_dup 2) (const_int 0))
2375                          (neg:DI (match_dup 1))
2376                          (match_dup 1)))]
2377   ""
2378   { operands[2] = gen_reg_rtx (BImode); })
2379
2380 (define_expand "smindi3"
2381   [(set (match_dup 3)
2382         (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2383                (match_operand:DI 2 "gr_register_operand" "")))
2384    (set (match_operand:DI 0 "gr_register_operand" "")
2385         (if_then_else:DI (ne (match_dup 3) (const_int 0))
2386                          (match_dup 2) (match_dup 1)))]
2387   ""
2388   { operands[3] = gen_reg_rtx (BImode); })
2389
2390 (define_expand "smaxdi3"
2391   [(set (match_dup 3)
2392         (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2393                (match_operand:DI 2 "gr_register_operand" "")))
2394    (set (match_operand:DI 0 "gr_register_operand" "")
2395         (if_then_else:DI (ne (match_dup 3) (const_int 0))
2396                          (match_dup 1) (match_dup 2)))]
2397   ""
2398   { operands[3] = gen_reg_rtx (BImode); })
2399
2400 (define_expand "umindi3"
2401   [(set (match_dup 3)
2402         (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2403                 (match_operand:DI 2 "gr_register_operand" "")))
2404    (set (match_operand:DI 0 "gr_register_operand" "")
2405         (if_then_else:DI (ne (match_dup 3) (const_int 0))
2406                          (match_dup 2) (match_dup 1)))]
2407   ""
2408   { operands[3] = gen_reg_rtx (BImode); })
2409
2410 (define_expand "umaxdi3"
2411   [(set (match_dup 3)
2412         (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2413                 (match_operand:DI 2 "gr_register_operand" "")))
2414    (set (match_operand:DI 0 "gr_register_operand" "")
2415         (if_then_else:DI (ne (match_dup 3) (const_int 0))
2416                          (match_dup 1) (match_dup 2)))]
2417   ""
2418   { operands[3] = gen_reg_rtx (BImode); })
2419
2420 (define_expand "ffsdi2"
2421   [(set (match_dup 6)
2422         (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2423    (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2424    (set (match_dup 5) (const_int 0))
2425    (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2426    (set (match_dup 4) (popcount:DI (match_dup 3)))
2427    (set (match_operand:DI 0 "gr_register_operand" "")
2428         (if_then_else:DI (ne (match_dup 6) (const_int 0))
2429                          (match_dup 5) (match_dup 4)))]
2430   ""
2431 {
2432   operands[2] = gen_reg_rtx (DImode);
2433   operands[3] = gen_reg_rtx (DImode);
2434   operands[4] = gen_reg_rtx (DImode);
2435   operands[5] = gen_reg_rtx (DImode);
2436   operands[6] = gen_reg_rtx (BImode);
2437 })
2438
2439 (define_expand "ctzdi2"
2440   [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2441                                (const_int -1)))
2442    (set (match_dup 3) (not:DI (match_dup 1)))
2443    (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2444    (set (match_operand:DI 0 "gr_register_operand" "")
2445         (popcount:DI (match_dup 4)))]
2446   ""
2447 {
2448   operands[2] = gen_reg_rtx (DImode);
2449   operands[3] = gen_reg_rtx (DImode);
2450   operands[4] = gen_reg_rtx (DImode);
2451 })
2452
2453 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2454 (define_expand "clzdi2"
2455   [(set (match_dup 2)
2456         (unsigned_float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "")))
2457    (set (match_dup 3)
2458         (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2459    (set (match_dup 4) (const_int 65598))
2460    (set (match_operand:DI 0 "gr_register_operand" "")
2461         (minus:DI (match_dup 4) (match_dup 3)))]
2462   ""
2463 {
2464   operands[2] = gen_reg_rtx (XFmode);
2465   operands[3] = gen_reg_rtx (DImode);
2466   operands[4] = gen_reg_rtx (DImode);
2467 })
2468
2469 (define_insn "popcountdi2"
2470   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2471         (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2472   ""
2473   "popcnt %0 = %1"
2474   [(set_attr "itanium_class" "mmmul")])
2475
2476 (define_insn "bswapdi2"
2477   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2478         (bswap:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2479   ""
2480   "mux1 %0 = %1, @rev"
2481   [(set_attr "itanium_class" "mmshf")])
2482
2483 (define_insn "*getf_exp_xf"
2484   [(set (match_operand:DI 0 "gr_register_operand" "=r")
2485         (unspec:DI [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")]
2486                    UNSPEC_GETF_EXP))]
2487   ""
2488   "getf.exp %0 = %F1"
2489   [(set_attr "itanium_class" "frfr")])
2490 \f
2491 ;; ::::::::::::::::::::
2492 ;; ::
2493 ;; :: 128-bit Integer arithmetic
2494 ;; ::
2495 ;; ::::::::::::::::::::
2496
2497 (define_insn "addti3"
2498   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2499         (plus:TI (match_operand:TI 1 "gr_register_operand" "%r")
2500                  (match_operand:TI 2 "gr_reg_or_14bit_operand" "rI")))
2501    (clobber (match_scratch:BI 3 "=&c"))]
2502   ""
2503   "#"
2504   [(set_attr "itanium_class" "unknown")])
2505
2506 (define_split
2507   [(set (match_operand:TI 0 "register_operand" "")
2508         (plus:TI (match_operand:TI 1 "register_operand" "")
2509                  (match_operand:TI 2 "register_operand" "")))
2510    (clobber (match_scratch:BI 3 ""))]
2511   "reload_completed"
2512   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2513    (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2514    (cond_exec (eq (match_dup 3) (const_int 0))
2515               (set (match_dup 4) (plus:DI (match_dup 5) (match_dup 6))))
2516    (cond_exec (ne (match_dup 3) (const_int 0))
2517               (set (match_dup 4)
2518                    (plus:DI (plus:DI (match_dup 5) (match_dup 6))
2519                             (const_int 1))))]
2520 {
2521   operands[4] = gen_highpart (DImode, operands[0]);
2522   operands[0] = gen_lowpart (DImode, operands[0]);
2523   operands[5] = gen_highpart (DImode, operands[1]);
2524   operands[1] = gen_lowpart (DImode, operands[1]);
2525   operands[6] = gen_highpart (DImode, operands[2]);
2526   operands[2] = gen_lowpart (DImode, operands[2]);
2527 })
2528
2529 (define_split
2530   [(set (match_operand:TI 0 "register_operand" "")
2531         (plus:TI (match_operand:TI 1 "register_operand" "")
2532                  (match_operand:TI 2 "immediate_operand" "")))
2533    (clobber (match_scratch:BI 3 ""))]
2534   "reload_completed"
2535   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2536    (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2537    (cond_exec (eq (match_dup 3) (const_int 0))
2538               (set (match_dup 4)
2539                    (plus:DI (match_dup 5) (match_dup 6))))
2540    (cond_exec (ne (match_dup 3) (const_int 0))
2541               (set (match_dup 4)
2542                    (plus:DI (match_dup 5) (match_dup 7))))]
2543 {
2544   operands[4] = gen_highpart (DImode, operands[0]);
2545   operands[0] = gen_lowpart (DImode, operands[0]);
2546   operands[5] = gen_highpart (DImode, operands[1]);
2547   operands[1] = gen_lowpart (DImode, operands[1]);
2548   operands[6] = INTVAL (operands[2]) < 0 ? constm1_rtx : const0_rtx;
2549   operands[7] = INTVAL (operands[2]) < 0 ? const0_rtx : const1_rtx;
2550 })
2551
2552 (define_insn "subti3"
2553   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2554         (minus:TI (match_operand:TI 1 "gr_reg_or_8bit_operand" "rK")
2555                   (match_operand:TI 2 "gr_register_operand" "r")))
2556    (clobber (match_scratch:BI 3 "=&c"))]
2557   ""
2558   "#"
2559   [(set_attr "itanium_class" "unknown")])
2560
2561 (define_split
2562   [(set (match_operand:TI 0 "register_operand" "")
2563         (minus:TI (match_operand:TI 1 "register_operand" "")
2564                   (match_operand:TI 2 "register_operand" "")))
2565    (clobber (match_scratch:BI 3 "=&c"))]
2566   "reload_completed"
2567   [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2568    (set (match_dup 3) (ltu:BI (match_dup 1) (match_dup 0)))
2569    (cond_exec (eq (match_dup 3) (const_int 0))
2570               (set (match_dup 4) (minus:DI (match_dup 5) (match_dup 6))))
2571    (cond_exec (ne (match_dup 3) (const_int 0))
2572               (set (match_dup 4)
2573                    (plus:DI (not:DI (match_dup 6)) (match_dup 5))))]
2574 {
2575   operands[4] = gen_highpart (DImode, operands[0]);
2576   operands[0] = gen_lowpart (DImode, operands[0]);
2577   operands[5] = gen_highpart (DImode, operands[1]);
2578   operands[1] = gen_lowpart (DImode, operands[1]);
2579   operands[6] = gen_highpart (DImode, operands[2]);
2580   operands[2] = gen_lowpart (DImode, operands[2]);
2581 })
2582
2583 (define_split
2584   [(set (match_operand:TI 0 "register_operand" "")
2585         (minus:TI (match_operand:TI 1 "immediate_operand" "")
2586                   (match_operand:TI 2 "register_operand" "")))
2587    (clobber (match_scratch:BI 3 "=&c"))]
2588   "reload_completed && satisfies_constraint_K (operands[1])"
2589   [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2590    (set (match_dup 3) (gtu:BI (match_dup 0) (match_dup 1)))
2591    (cond_exec (ne (match_dup 3) (const_int 0))
2592               (set (match_dup 4) (minus:DI (match_dup 6) (match_dup 5))))
2593    (cond_exec (eq (match_dup 3) (const_int 0))
2594               (set (match_dup 4) (minus:DI (match_dup 7) (match_dup 5))))]
2595 {
2596   operands[4] = gen_highpart (DImode, operands[0]);
2597   operands[0] = gen_lowpart (DImode, operands[0]);
2598   operands[5] = gen_highpart (DImode, operands[2]);
2599   operands[2] = gen_lowpart (DImode, operands[2]);
2600   operands[6] = INTVAL (operands[1]) < 0 ? GEN_INT (-2) : constm1_rtx;
2601   operands[7] = INTVAL (operands[1]) < 0 ? constm1_rtx : const0_rtx;
2602 })
2603
2604 (define_expand "mulditi3"
2605   [(set (match_operand:TI 0 "fr_register_operand" "")
2606         (mult:TI (sign_extend:TI
2607                    (match_operand:DI 1 "fr_reg_or_fp01_operand" ""))
2608                  (sign_extend:TI
2609                    (match_operand:DI 2 "fr_reg_or_fp01_operand" ""))))]
2610   ""
2611   "")
2612
2613 (define_insn_and_split "*mulditi3_internal"
2614   [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2615         (mult:TI (sign_extend:TI
2616                    (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2617                  (sign_extend:TI
2618                    (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG"))))]
2619   ""
2620   "#"
2621   "reload_completed"
2622   [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2623    (set (match_dup 3) (truncate:DI
2624                         (lshiftrt:TI
2625                           (mult:TI (sign_extend:TI (match_dup 1))
2626                                    (sign_extend:TI (match_dup 2)))
2627                           (const_int 64))))]
2628 {
2629   operands[3] = gen_highpart (DImode, operands[0]);
2630   operands[0] = gen_lowpart (DImode, operands[0]);
2631 }
2632   [(set_attr "itanium_class" "unknown")])
2633
2634 (define_expand "umulditi3"
2635   [(set (match_operand:TI 0 "fr_register_operand" "")
2636         (mult:TI (zero_extend:TI
2637                    (match_operand:DI 1 "fr_reg_or_fp01_operand" ""))
2638                  (zero_extend:TI
2639                    (match_operand:DI 2 "fr_reg_or_fp01_operand" ""))))]
2640   ""
2641   "")
2642
2643 (define_insn_and_split "*umulditi3_internal"
2644   [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2645         (mult:TI (zero_extend:TI
2646                    (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2647                  (zero_extend:TI
2648                    (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG"))))]
2649   ""
2650   "#"
2651   "reload_completed"
2652   [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2653    (set (match_dup 3) (truncate:DI
2654                         (lshiftrt:TI
2655                           (mult:TI (zero_extend:TI (match_dup 1))
2656                                    (zero_extend:TI (match_dup 2)))
2657                           (const_int 64))))]
2658 {
2659   operands[3] = gen_highpart (DImode, operands[0]);
2660   operands[0] = gen_lowpart (DImode, operands[0]);
2661 }
2662   [(set_attr "itanium_class" "unknown")])
2663
2664 (define_insn_and_split "negti2"
2665   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2666         (neg:TI (match_operand:TI 1 "gr_register_operand" "r")))
2667    (clobber (match_scratch:BI 2 "=&c"))]
2668   ""
2669   "#"
2670   "reload_completed"
2671   [(set (match_dup 2) (eq:BI (match_dup 1) (const_int 0)))
2672    (set (match_dup 0) (minus:DI (const_int 0) (match_dup 1)))
2673    (cond_exec (eq (match_dup 2) (const_int 0))
2674               (set (match_dup 3) (minus:DI (const_int -1) (match_dup 4))))
2675    (cond_exec (ne (match_dup 2) (const_int 0))
2676               (set (match_dup 3) (minus:DI (const_int 0) (match_dup 4))))]
2677 {
2678   operands[3] = gen_highpart (DImode, operands[0]);
2679   operands[0] = gen_lowpart (DImode, operands[0]);
2680   operands[4] = gen_highpart (DImode, operands[1]);
2681   operands[1] = gen_lowpart (DImode, operands[1]);
2682 }
2683   [(set_attr "itanium_class" "unknown")])
2684 \f
2685 ;; ::::::::::::::::::::
2686 ;; ::
2687 ;; :: 32-bit floating point arithmetic
2688 ;; ::
2689 ;; ::::::::::::::::::::
2690
2691 (define_insn "addsf3"
2692   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2693         (plus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "%fG")
2694                  (match_operand:SF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2695   ""
2696   "fadd.s %0 = %F1, %F2"
2697   [(set_attr "itanium_class" "fmac")])
2698
2699 (define_insn "subsf3"
2700   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2701         (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2702                   (match_operand:SF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2703   ""
2704   "fsub.s %0 = %F1, %F2"
2705   [(set_attr "itanium_class" "fmac")])
2706
2707 (define_insn "mulsf3"
2708   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2709         (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2710                  (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2711   ""
2712   "fmpy.s %0 = %F1, %F2"
2713   [(set_attr "itanium_class" "fmac")])
2714
2715 (define_insn "abssf2"
2716   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2717         (abs:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
2718   ""
2719   "fabs %0 = %F1"
2720   [(set_attr "itanium_class" "fmisc")])
2721
2722 (define_insn "negsf2"
2723   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2724         (neg:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
2725   ""
2726   "fneg %0 = %F1"
2727   [(set_attr "itanium_class" "fmisc")])
2728
2729 (define_insn "*nabssf2"
2730   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2731         (neg:SF (abs:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG"))))]
2732   ""
2733   "fnegabs %0 = %F1"
2734   [(set_attr "itanium_class" "fmisc")])
2735
2736 (define_insn "copysignsf3"
2737   [(set (match_operand:SF 0 "register_operand" "=f")
2738         (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2739                     (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2740                    UNSPEC_COPYSIGN))]
2741   ""
2742   "fmerge.s %0 = %F2, %F1"
2743   [(set_attr "itanium_class" "fmisc")])
2744
2745 (define_insn "*ncopysignsf3"
2746   [(set (match_operand:SF 0 "register_operand" "=f")
2747         (neg:SF (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2748                             (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2749                            UNSPEC_COPYSIGN)))]
2750   ""
2751   "fmerge.ns %0 = %F2, %F1"
2752   [(set_attr "itanium_class" "fmisc")])
2753
2754 (define_insn "sminsf3"
2755   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2756         (smin:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2757                  (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2758   ""
2759   "fmin %0 = %F1, %F2"
2760   [(set_attr "itanium_class" "fmisc")])
2761
2762 (define_insn "smaxsf3"
2763   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2764         (smax:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2765                  (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2766   ""
2767   "fmax %0 = %F1, %F2"
2768   [(set_attr "itanium_class" "fmisc")])
2769
2770 (define_insn "*nmulsf3"
2771   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2772         (neg:SF (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2773                          (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))))]
2774   ""
2775   "fnmpy.s %0 = %F1, %F2"
2776   [(set_attr "itanium_class" "fmac")])
2777
2778 (define_insn "fmasf4"
2779   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2780         (fma:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2781                 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
2782                 (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2783   ""
2784   "fma.s %0 = %F1, %F2, %F3"
2785   [(set_attr "itanium_class" "fmac")])
2786
2787 (define_insn "fmssf4"
2788   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2789         (fma:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2790                 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
2791                 (neg:SF
2792                   (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2793   ""
2794   "fms.s %0 = %F1, %F2, %F3"
2795   [(set_attr "itanium_class" "fmac")])
2796
2797 (define_insn "fnmasf4"
2798   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2799         (fma:SF (neg:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG"))
2800                 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
2801                 (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2802   ""
2803   "fnma.s %0 = %F1, %F2, %F3"
2804   [(set_attr "itanium_class" "fmac")])
2805 \f
2806 ;; ::::::::::::::::::::
2807 ;; ::
2808 ;; :: 64-bit floating point arithmetic
2809 ;; ::
2810 ;; ::::::::::::::::::::
2811
2812 (define_insn "adddf3"
2813   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2814         (plus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "%fG")
2815                  (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2816   ""
2817   "fadd.d %0 = %F1, %F2"
2818   [(set_attr "itanium_class" "fmac")])
2819
2820 (define_insn "*adddf3_trunc"
2821   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2822         (float_truncate:SF
2823           (plus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "%fG")
2824                    (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2825   ""
2826   "fadd.s %0 = %F1, %F2"
2827   [(set_attr "itanium_class" "fmac")])
2828
2829 (define_insn "subdf3"
2830   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2831         (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2832                   (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2833   ""
2834   "fsub.d %0 = %F1, %F2"
2835   [(set_attr "itanium_class" "fmac")])
2836
2837 (define_insn "*subdf3_trunc"
2838   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2839         (float_truncate:SF
2840           (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2841                     (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2842   ""
2843   "fsub.s %0 = %F1, %F2"
2844   [(set_attr "itanium_class" "fmac")])
2845
2846 (define_insn "muldf3"
2847   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2848         (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2849                  (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2850   ""
2851   "fmpy.d %0 = %F1, %F2"
2852   [(set_attr "itanium_class" "fmac")])
2853
2854 (define_insn "*muldf3_trunc"
2855   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2856         (float_truncate:SF
2857           (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2858                    (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2859   ""
2860   "fmpy.s %0 = %F1, %F2"
2861   [(set_attr "itanium_class" "fmac")])
2862
2863 (define_insn "absdf2"
2864   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2865         (abs:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
2866   ""
2867   "fabs %0 = %F1"
2868   [(set_attr "itanium_class" "fmisc")])
2869
2870 (define_insn "negdf2"
2871   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2872         (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
2873   ""
2874   "fneg %0 = %F1"
2875   [(set_attr "itanium_class" "fmisc")])
2876
2877 (define_insn "*nabsdf2"
2878   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2879         (neg:DF (abs:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))))]
2880   ""
2881   "fnegabs %0 = %F1"
2882   [(set_attr "itanium_class" "fmisc")])
2883
2884 (define_insn "copysigndf3"
2885   [(set (match_operand:DF 0 "register_operand" "=f")
2886         (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2887                     (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
2888                    UNSPEC_COPYSIGN))]
2889   ""
2890   "fmerge.s %0 = %F2, %F1"
2891   [(set_attr "itanium_class" "fmisc")])
2892
2893 (define_insn "*ncopysigndf3"
2894   [(set (match_operand:DF 0 "register_operand" "=f")
2895         (neg:DF (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2896                             (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
2897                            UNSPEC_COPYSIGN)))]
2898   ""
2899   "fmerge.ns %0 = %F2, %F1"
2900   [(set_attr "itanium_class" "fmisc")])
2901
2902 (define_insn "smindf3"
2903   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2904         (smin:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2905                  (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2906   ""
2907   "fmin %0 = %F1, %F2"
2908   [(set_attr "itanium_class" "fmisc")])
2909
2910 (define_insn "smaxdf3"
2911   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2912         (smax:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2913                  (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2914   ""
2915   "fmax %0 = %F1, %F2"
2916   [(set_attr "itanium_class" "fmisc")])
2917
2918 (define_insn "*nmuldf3"
2919   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2920         (neg:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2921                          (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2922   ""
2923   "fnmpy.d %0 = %F1, %F2"
2924   [(set_attr "itanium_class" "fmac")])
2925
2926 (define_insn "*nmuldf3_trunc"
2927   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2928         (float_truncate:SF
2929           (neg:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2930                            (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))))]
2931   ""
2932   "fnmpy.s %0 = %F1, %F2"
2933   [(set_attr "itanium_class" "fmac")])
2934
2935 (define_insn "fmadf4"
2936   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2937         (fma:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2938                 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2939                 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2940   ""
2941   "fma.d %0 = %F1, %F2, %F3"
2942   [(set_attr "itanium_class" "fmac")])
2943
2944 (define_insn "*fmadf_trunc_sf"
2945   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2946         (float_truncate:SF
2947           (fma:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2948                   (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2949                   (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2950   ""
2951   "fma.s %0 = %F1, %F2, %F3"
2952   [(set_attr "itanium_class" "fmac")])
2953
2954 (define_insn "fmsdf4"
2955   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2956         (fma:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2957                 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2958                 (neg:DF
2959                   (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2960   ""
2961   "fms.d %0 = %F1, %F2, %F3"
2962   [(set_attr "itanium_class" "fmac")])
2963
2964 (define_insn "*fmsdf_trunc_sf"
2965   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2966         (float_truncate:SF
2967           (fma:DF
2968             (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2969             (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2970             (neg:DF
2971               (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ")))))]
2972   ""
2973   "fms.s %0 = %F1, %F2, %F3"
2974   [(set_attr "itanium_class" "fmac")])
2975
2976 (define_insn "fnmadf4"
2977   [(set (match_operand:DF 0 "fr_register_operand" "=f")
2978         (fma:DF (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))
2979                 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2980                 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2981   ""
2982   "fnma.d %0 = %F1, %F2, %F3"
2983   [(set_attr "itanium_class" "fmac")])
2984
2985 (define_insn "*fnmadf_trunc_sf"
2986   [(set (match_operand:SF 0 "fr_register_operand" "=f")
2987         (float_truncate:SF
2988           (fma:DF
2989             (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))
2990             (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2991             (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2992   ""
2993   "fnma.s %0 = %F1, %F2, %F3"
2994   [(set_attr "itanium_class" "fmac")])
2995 \f
2996 ;; ::::::::::::::::::::
2997 ;; ::
2998 ;; :: 80-bit floating point arithmetic
2999 ;; ::
3000 ;; ::::::::::::::::::::
3001
3002 (define_insn "addxf3"
3003   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3004         (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "%fG")
3005                  (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ")))]
3006   ""
3007   "fadd %0 = %F1, %F2"
3008   [(set_attr "itanium_class" "fmac")])
3009
3010 (define_insn "*addxf3_truncsf"
3011   [(set (match_operand:SF 0 "fr_register_operand" "=f")
3012         (float_truncate:SF
3013           (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "%fG")
3014                    (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3015   ""
3016   "fadd.s %0 = %F1, %F2"
3017   [(set_attr "itanium_class" "fmac")])
3018
3019 (define_insn "*addxf3_truncdf"
3020   [(set (match_operand:DF 0 "fr_register_operand" "=f")
3021         (float_truncate:DF
3022           (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "%fG")
3023                    (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3024   ""
3025   "fadd.d %0 = %F1, %F2"
3026   [(set_attr "itanium_class" "fmac")])
3027
3028 (define_insn "subxf3"
3029   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3030         (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3031                   (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ")))]
3032   ""
3033   "fsub %0 = %F1, %F2"
3034   [(set_attr "itanium_class" "fmac")])
3035
3036 (define_insn "*subxf3_truncsf"
3037   [(set (match_operand:SF 0 "fr_register_operand" "=f")
3038         (float_truncate:SF
3039           (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3040                     (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3041   ""
3042   "fsub.s %0 = %F1, %F2"
3043   [(set_attr "itanium_class" "fmac")])
3044
3045 (define_insn "*subxf3_truncdf"
3046   [(set (match_operand:DF 0 "fr_register_operand" "=f")
3047         (float_truncate:DF
3048           (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3049                     (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3050   ""
3051   "fsub.d %0 = %F1, %F2"
3052   [(set_attr "itanium_class" "fmac")])
3053
3054 (define_insn "mulxf3"
3055   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3056         (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3057                  (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3058   ""
3059   "fmpy %0 = %F1, %F2"
3060   [(set_attr "itanium_class" "fmac")])
3061
3062 (define_insn "*mulxf3_truncsf"
3063   [(set (match_operand:SF 0 "fr_register_operand" "=f")
3064         (float_truncate:SF
3065           (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3066                    (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3067   ""
3068   "fmpy.s %0 = %F1, %F2"
3069   [(set_attr "itanium_class" "fmac")])
3070
3071 (define_insn "*mulxf3_truncdf"
3072   [(set (match_operand:DF 0 "fr_register_operand" "=f")
3073         (float_truncate:DF
3074           (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3075                    (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3076   ""
3077   "fmpy.d %0 = %F1, %F2"
3078   [(set_attr "itanium_class" "fmac")])
3079
3080 (define_insn "absxf2"
3081   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3082         (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3083   ""
3084   "fabs %0 = %F1"
3085   [(set_attr "itanium_class" "fmisc")])
3086
3087 (define_insn "negxf2"
3088   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3089         (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3090   ""
3091   "fneg %0 = %F1"
3092   [(set_attr "itanium_class" "fmisc")])
3093
3094 (define_insn "*nabsxf2"
3095   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3096         (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3097   ""
3098   "fnegabs %0 = %F1"
3099   [(set_attr "itanium_class" "fmisc")])
3100
3101 (define_insn "copysignxf3"
3102   [(set (match_operand:XF 0 "register_operand" "=f")
3103         (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3104                     (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3105                    UNSPEC_COPYSIGN))]
3106   ""
3107   "fmerge.s %0 = %F2, %F1"
3108   [(set_attr "itanium_class" "fmisc")])
3109
3110 (define_insn "*ncopysignxf3"
3111   [(set (match_operand:XF 0 "register_operand" "=f")
3112         (neg:XF (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3113                             (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3114                            UNSPEC_COPYSIGN)))]
3115   ""
3116   "fmerge.ns %0 = %F2, %F1"
3117   [(set_attr "itanium_class" "fmisc")])
3118
3119 (define_insn "sminxf3"
3120   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3121         (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3122                  (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3123   ""
3124   "fmin %0 = %F1, %F2"
3125   [(set_attr "itanium_class" "fmisc")])
3126
3127 (define_insn "smaxxf3"
3128   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3129         (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3130                  (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3131   ""
3132   "fmax %0 = %F1, %F2"
3133   [(set_attr "itanium_class" "fmisc")])
3134
3135 (define_insn "*nmulxf3"
3136   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3137         (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3138                          (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3139   ""
3140   "fnmpy %0 = %F1, %F2"
3141   [(set_attr "itanium_class" "fmac")])
3142
3143 (define_insn "*nmulxf3_truncsf"
3144   [(set (match_operand:SF 0 "fr_register_operand" "=f")
3145         (float_truncate:SF
3146           (neg:XF (mult:XF
3147                     (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3148                     (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3149   ""
3150   "fnmpy.s %0 = %F1, %F2"
3151   [(set_attr "itanium_class" "fmac")])
3152
3153 (define_insn "*nmulxf3_truncdf"
3154   [(set (match_operand:DF 0 "fr_register_operand" "=f")
3155         (float_truncate:DF
3156           (neg:XF (mult:XF
3157                     (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3158                     (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3159   ""
3160   "fnmpy.d %0 = %F1, %F2"
3161   [(set_attr "itanium_class" "fmac")])
3162
3163 (define_insn "fmaxf4"
3164   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3165         (fma:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3166                 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3167                 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
3168   ""
3169   "fma %0 = %F1, %F2, %F3"
3170   [(set_attr "itanium_class" "fmac")])
3171
3172 (define_insn "*fmaxf_trunc_<mode>"
3173   [(set (match_operand:MODE_SDF 0 "fr_register_operand" "=f")
3174         (float_truncate:MODE_SDF
3175           (fma:XF
3176             (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3177             (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3178             (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
3179   ""
3180   "fma<suffix> %0 = %F1, %F2, %F3"
3181   [(set_attr "itanium_class" "fmac")])
3182
3183 (define_insn "fmsxf4"
3184   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3185         (fma:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3186                 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3187                 (neg:XF
3188                   (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
3189   ""
3190   "fms %0 = %F1, %F2, %F3"
3191   [(set_attr "itanium_class" "fmac")])
3192
3193 (define_insn "*fmsxf_trunc_<mode>"
3194   [(set (match_operand:MODE_SDF 0 "fr_register_operand" "=f")
3195         (float_truncate:MODE_SDF
3196           (fma:XF
3197             (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3198             (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3199             (neg:XF
3200               (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ")))))]
3201   ""
3202   "fms<suffix> %0 = %F1, %F2, %F3"
3203   [(set_attr "itanium_class" "fmac")])
3204
3205 (define_insn "fnmaxf4"
3206   [(set (match_operand:XF 0 "fr_register_operand" "=f")
3207         (fma:XF (neg:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG"))
3208                 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3209                 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
3210   ""
3211   "fnma %0 = %F1, %F2, %F3"
3212   [(set_attr "itanium_class" "fmac")])
3213
3214 (define_insn "*fnmaxf_trunc_<mode>"
3215   [(set (match_operand:MODE_SDF 0 "fr_register_operand" "=f")
3216         (float_truncate:MODE_SDF
3217           (fma:XF
3218             (neg:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG"))
3219             (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3220             (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
3221   ""
3222   "fnma<suffix> %0 = %F1, %F2, %F3"
3223   [(set_attr "itanium_class" "fmac")])
3224 \f
3225 ;; ::::::::::::::::::::
3226 ;; ::
3227 ;; :: 32-bit Integer Shifts and Rotates
3228 ;; ::
3229 ;; ::::::::::::::::::::
3230
3231 (define_expand "ashlsi3"
3232   [(set (match_operand:SI 0 "gr_register_operand" "")
3233         (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
3234                    (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3235   ""
3236 {
3237   if (GET_CODE (operands[2]) != CONST_INT)
3238     {
3239       /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED?  Now
3240          we've got to get rid of stray bits outside the SImode register.  */
3241       rtx subshift = gen_reg_rtx (DImode);
3242       emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3243       operands[2] = subshift;
3244     }
3245 })
3246
3247 (define_insn "*ashlsi3_internal"
3248   [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
3249         (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
3250                    (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
3251   ""
3252   "@
3253    shladd %0 = %1, %2, r0
3254    dep.z %0 = %1, %2, %E2
3255    shl %0 = %1, %2"
3256   [(set_attr "itanium_class" "ialu,ishf,mmshf")])
3257
3258 (define_expand "ashrsi3"
3259   [(set (match_operand:SI 0 "gr_register_operand" "")
3260         (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3261                      (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3262   ""
3263 {
3264   rtx subtarget = gen_reg_rtx (DImode);
3265   if (GET_CODE (operands[2]) == CONST_INT)
3266     emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
3267                          GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3268   else
3269     {
3270       rtx subshift = gen_reg_rtx (DImode);
3271       emit_insn (gen_extendsidi2 (subtarget, operands[1]));
3272       emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3273       emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
3274     }
3275   emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3276   DONE;
3277 })
3278
3279 (define_expand "lshrsi3"
3280   [(set (match_operand:SI 0 "gr_register_operand" "")
3281         (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3282                      (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3283   ""
3284 {
3285   rtx subtarget = gen_reg_rtx (DImode);
3286   if (GET_CODE (operands[2]) == CONST_INT)
3287     emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
3288                           GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3289   else
3290     {
3291       rtx subshift = gen_reg_rtx (DImode);
3292       emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
3293       emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3294       emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
3295     }
3296   emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3297   DONE;
3298 })
3299
3300 ;; Use mix4.r/shr to implement rotrsi3.  We only get 32 bits of valid result
3301 ;; here, instead of 64 like the patterns above.  Keep the pattern together
3302 ;; until after combine; otherwise it won't get matched often.
3303
3304 (define_expand "rotrsi3"
3305   [(set (match_operand:SI 0 "gr_register_operand" "")
3306         (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
3307                      (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3308   ""
3309 {
3310   if (GET_MODE (operands[2]) != VOIDmode)
3311     {
3312       rtx tmp = gen_reg_rtx (DImode);
3313       emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
3314       operands[2] = tmp;
3315     }
3316 })
3317
3318 (define_insn_and_split "*rotrsi3_internal"
3319   [(set (match_operand:SI 0 "gr_register_operand" "=&r")
3320         (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
3321                      (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
3322   ""
3323   "#"
3324   "reload_completed"
3325   [(set (match_dup 3)
3326         (ior:DI (zero_extend:DI (match_dup 1))
3327                 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3328    (set (match_dup 3)
3329         (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3330   "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
3331
3332 (define_expand "rotlsi3"
3333   [(set (match_operand:SI 0 "gr_register_operand" "")
3334         (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
3335                    (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3336   ""
3337 {
3338   if (! shift_32bit_count_operand (operands[2], SImode))
3339     {
3340       rtx tmp = gen_reg_rtx (SImode);
3341       emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
3342       emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
3343       DONE;
3344     }
3345 })
3346
3347 (define_insn_and_split "*rotlsi3_internal"
3348   [(set (match_operand:SI 0 "gr_register_operand" "=r")
3349         (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
3350                    (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
3351   ""
3352   "mux2 %0 = %1, 0xe1"
3353   "reload_completed && INTVAL (operands[2]) != 16"
3354   [(set (match_dup 3)
3355         (ior:DI (zero_extend:DI (match_dup 1))
3356                 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3357    (set (match_dup 3)
3358         (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3359 {
3360   operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
3361   operands[2] = GEN_INT (32 - INTVAL (operands[2]));
3362 }
3363   [(set_attr "itanium_class" "mmshf")])
3364 \f
3365 ;; ::::::::::::::::::::
3366 ;; ::
3367 ;; :: 64-bit Integer Shifts and Rotates
3368 ;; ::
3369 ;; ::::::::::::::::::::
3370
3371 (define_insn "ashldi3"
3372   [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
3373         (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
3374                    (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
3375   ""
3376   "@
3377    shladd %0 = %1, %2, r0
3378    shl %0 = %1, %2
3379    shl %0 = %1, %2"
3380   [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
3381
3382 ;; ??? Maybe combine this with the multiply and add instruction?
3383
3384 (define_insn "*shladd"
3385   [(set (match_operand:DI 0 "gr_register_operand" "=r")
3386         (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3387                           (match_operand:DI 2 "shladd_operand" "n"))
3388                  (match_operand:DI 3 "gr_register_operand" "r")))]
3389   ""
3390   "shladd %0 = %1, %S2, %3"
3391   [(set_attr "itanium_class" "ialu")])
3392
3393 ;; This can be created by register elimination if operand3 of shladd is an
3394 ;; eliminable register or has reg_equiv_constant set.
3395
3396 ;; We have to use nonmemory_operand for operand 4, to ensure that the
3397 ;; validate_changes call inside eliminate_regs will always succeed.  If it
3398 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
3399 ;; incorrectly.
3400
3401 (define_insn_and_split "*shladd_elim"
3402   [(set (match_operand:DI 0 "gr_register_operand" "=&r")
3403         (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3404                                    (match_operand:DI 2 "shladd_operand" "n"))
3405                           (match_operand:DI 3 "nonmemory_operand" "r"))
3406                  (match_operand:DI 4 "nonmemory_operand" "rI")))]
3407   "reload_in_progress"
3408   "* gcc_unreachable ();"
3409   "reload_completed"
3410   [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
3411                                (match_dup 3)))
3412    (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
3413   ""
3414   [(set_attr "itanium_class" "unknown")])
3415
3416 (define_insn "ashrdi3"
3417   [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3418         (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3419                      (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
3420   ""
3421   "@
3422    shr %0 = %1, %2
3423    shr %0 = %1, %2"
3424   [(set_attr "itanium_class" "mmshf,mmshfi")])
3425
3426 (define_insn "lshrdi3"
3427   [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3428         (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3429                      (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
3430   ""
3431   "@
3432    shr.u %0 = %1, %2
3433    shr.u %0 = %1, %2"
3434   [(set_attr "itanium_class" "mmshf,mmshfi")])
3435
3436 ;; Using a predicate that accepts only constants doesn't work, because optabs
3437 ;; will load the operand into a register and call the pattern if the predicate
3438 ;; did not accept it on the first try.  So we use nonmemory_operand and then
3439 ;; verify that we have an appropriate constant in the expander.
3440
3441 (define_expand "rotrdi3"
3442   [(set (match_operand:DI 0 "gr_register_operand" "")
3443         (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
3444                      (match_operand:DI 2 "nonmemory_operand" "")))]
3445   ""
3446 {
3447   if (! shift_count_operand (operands[2], DImode))
3448     FAIL;
3449 })
3450
3451 (define_insn "*rotrdi3_internal"
3452   [(set (match_operand:DI 0 "gr_register_operand" "=r")
3453         (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
3454                      (match_operand:DI 2 "shift_count_operand" "M")))]
3455   ""
3456   "shrp %0 = %1, %1, %2"
3457   [(set_attr "itanium_class" "ishf")])
3458
3459 (define_expand "rotldi3"
3460   [(set (match_operand:DI 0 "gr_register_operand" "")
3461         (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
3462                    (match_operand:DI 2 "nonmemory_operand" "")))]
3463   ""
3464 {
3465   if (! shift_count_operand (operands[2], DImode))
3466     FAIL;
3467 })
3468
3469 (define_insn "*rotldi3_internal"
3470   [(set (match_operand:DI 0 "gr_register_operand" "=r")
3471         (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
3472                    (match_operand:DI 2 "shift_count_operand" "M")))]
3473   ""
3474   "shrp %0 = %1, %1, %e2"
3475   [(set_attr "itanium_class" "ishf")])
3476 \f
3477 ;; ::::::::::::::::::::
3478 ;; ::
3479 ;; :: 128-bit Integer Shifts and Rotates
3480 ;; ::
3481 ;; ::::::::::::::::::::
3482
3483 (define_expand "ashlti3"
3484   [(set (match_operand:TI 0 "gr_register_operand" "")
3485         (ashift:TI (match_operand:TI 1 "gr_register_operand" "")
3486                    (match_operand:DI 2 "nonmemory_operand" "")))]
3487   ""
3488 {
3489   if (!dshift_count_operand (operands[2], DImode))
3490     FAIL;
3491 })
3492
3493 (define_insn_and_split "*ashlti3_internal"
3494   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3495         (ashift:TI (match_operand:TI 1 "gr_register_operand" "r")
3496                    (match_operand:DI 2 "dshift_count_operand" "n")))]
3497   ""
3498   "#"
3499   "reload_completed"
3500   [(const_int 0)]
3501 {
3502   HOST_WIDE_INT shift = INTVAL (operands[2]);
3503   rtx rl = gen_lowpart (DImode, operands[0]);
3504   rtx rh = gen_highpart (DImode, operands[0]);
3505   rtx lo = gen_lowpart (DImode, operands[1]);
3506   rtx shiftlo = GEN_INT (shift & 63);
3507
3508   if (shift & 64)
3509     {
3510       emit_move_insn (rl, const0_rtx);
3511       if (shift & 63)
3512         emit_insn (gen_ashldi3 (rh, lo, shiftlo));
3513       else
3514         emit_move_insn (rh, lo);
3515     }
3516   else
3517     {
3518       rtx hi = gen_highpart (DImode, operands[1]);
3519
3520       emit_insn (gen_shrp (rh, hi, lo, GEN_INT (-shift & 63)));
3521       emit_insn (gen_ashldi3 (rl, lo, shiftlo));
3522     }
3523   DONE;
3524 })
3525
3526 (define_expand "ashrti3"
3527   [(set (match_operand:TI 0 "gr_register_operand" "")
3528         (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
3529                      (match_operand:DI 2 "nonmemory_operand" "")))]
3530   ""
3531 {
3532   if (!dshift_count_operand (operands[2], DImode))
3533     FAIL;
3534 })
3535
3536 (define_insn_and_split "*ashrti3_internal"
3537   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3538         (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
3539                      (match_operand:DI 2 "dshift_count_operand" "n")))]
3540   ""
3541   "#"
3542   "reload_completed"
3543   [(const_int 0)]
3544 {
3545   HOST_WIDE_INT shift = INTVAL (operands[2]);
3546   rtx rl = gen_lowpart (DImode, operands[0]);
3547   rtx rh = gen_highpart (DImode, operands[0]);
3548   rtx hi = gen_highpart (DImode, operands[1]);
3549   rtx shiftlo = GEN_INT (shift & 63);
3550
3551   if (shift & 64)
3552     {
3553       if (shift & 63)
3554         emit_insn (gen_ashrdi3 (rl, hi, shiftlo));
3555       else
3556         emit_move_insn (rl, hi);
3557       emit_insn (gen_ashrdi3 (rh, hi, GEN_INT (63)));
3558     }
3559   else
3560     {
3561       rtx lo = gen_lowpart (DImode, operands[1]);
3562
3563       emit_insn (gen_shrp (rl, hi, lo, shiftlo));
3564       emit_insn (gen_ashrdi3 (rh, hi, shiftlo));
3565     }
3566   DONE;
3567 })
3568
3569 (define_expand "lshrti3"
3570   [(set (match_operand:TI 0 "gr_register_operand" "")
3571         (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
3572                      (match_operand:DI 2 "nonmemory_operand" "")))]
3573   ""
3574
3575   if (!dshift_count_operand (operands[2], DImode))
3576     FAIL;
3577 }) 
3578
3579 (define_insn_and_split "*lshrti3_internal"
3580   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3581         (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
3582                      (match_operand:DI 2 "dshift_count_operand" "n")))]
3583   ""
3584   "#"
3585   "reload_completed"
3586   [(const_int 0)]
3587 {
3588   HOST_WIDE_INT shift = INTVAL (operands[2]);
3589   rtx rl = gen_lowpart (DImode, operands[0]);
3590   rtx rh = gen_highpart (DImode, operands[0]);
3591   rtx hi = gen_highpart (DImode, operands[1]);
3592   rtx shiftlo = GEN_INT (shift & 63);
3593
3594   if (shift & 64)
3595     {
3596       if (shift & 63)
3597         emit_insn (gen_lshrdi3 (rl, hi, shiftlo));
3598       else
3599         emit_move_insn (rl, hi);
3600       emit_move_insn (rh, const0_rtx);
3601     }
3602   else
3603     {
3604       rtx lo = gen_lowpart (DImode, operands[1]);
3605
3606       emit_insn (gen_shrp (rl, hi, lo, shiftlo));
3607       emit_insn (gen_lshrdi3 (rh, hi, shiftlo));
3608     }
3609   DONE;
3610 })
3611
3612 (define_expand "rotlti3"
3613   [(set (match_operand:TI 0 "gr_register_operand" "")
3614         (rotate:TI (match_operand:TI 1 "gr_register_operand" "")
3615                    (match_operand:DI 2 "nonmemory_operand" "")))]
3616   ""
3617 {
3618   if (! dshift_count_operand (operands[2], DImode))
3619     FAIL;
3620 })
3621
3622 (define_insn_and_split "*rotlti3_internal"
3623   [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3624         (rotate:TI (match_operand:TI 1 "gr_register_operand" "r")
3625                    (match_operand:DI 2 "dshift_count_operand" "n")))]
3626   ""
3627   "#"
3628   "reload_completed"
3629   [(const_int 0)]
3630 {
3631   HOST_WIDE_INT count = INTVAL (operands[2]);
3632   rtx rl = gen_lowpart (DImode, operands[0]);
3633   rtx rh = gen_highpart (DImode, operands[0]);
3634   rtx lo = gen_lowpart (DImode, operands[1]);
3635   rtx hi = gen_highpart (DImode, operands[1]);
3636   rtx countlo = GEN_INT (-count & 63);
3637
3638   if (count & 64)
3639     {
3640       if (count & 63)
3641         {
3642           emit_insn (gen_shrp (rl, hi, lo, countlo));
3643           emit_insn (gen_shrp (rh, lo, hi, countlo));
3644         }
3645       else
3646         {
3647           emit_move_insn (rl, hi);
3648           emit_move_insn (rh, lo);
3649         }
3650     }
3651   else
3652     {
3653       emit_insn (gen_shrp (rl, lo, hi, countlo));
3654       emit_insn (gen_shrp (rh, hi, lo, countlo));
3655     }
3656   DONE;
3657 }
3658   [(set_attr "itanium_class" "unknown")])
3659
3660 (define_insn "shrp"
3661   [(set (match_operand:DI 0 "gr_register_operand" "=r")
3662         (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
3663                     (match_operand:DI 2 "gr_register_operand" "r")
3664                     (match_operand:DI 3 "shift_count_operand" "M")]
3665                    UNSPEC_SHRP))]
3666   ""
3667   "shrp %0 = %1, %2, %3"
3668   [(set_attr "itanium_class" "ishf")])
3669 \f
3670 ;; ::::::::::::::::::::
3671 ;; ::
3672 ;; :: 32-bit Integer Logical operations
3673 ;; ::
3674 ;; ::::::::::::::::::::
3675
3676 ;; We don't seem to need any other 32-bit logical operations, because gcc
3677 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
3678 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
3679 ;; This doesn't work for unary logical operations, because we don't call
3680 ;; apply_distributive_law for them.
3681
3682 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
3683 ;; apply_distributive_law.  We get inefficient code for
3684 ;; int sub4 (int i, int j) { return i & ~j; }
3685 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
3686 ;; (zero_extend (and (not A) B)) in combine.
3687 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
3688 ;; one_cmplsi2 pattern.
3689
3690 (define_insn "one_cmplsi2"
3691   [(set (match_operand:SI 0 "gr_register_operand" "=r")
3692         (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
3693   ""
3694   "andcm %0 = -1, %1"
3695   [(set_attr "itanium_class" "ilog")])
3696 \f
3697 ;; ::::::::::::::::::::
3698 ;; ::
3699 ;; :: 64-bit Integer Logical operations
3700 ;; ::
3701 ;; ::::::::::::::::::::
3702
3703 (define_insn "anddi3"
3704   [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3705         (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3706                 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3707   ""
3708   "@
3709    and %0 = %2, %1
3710    fand %0 = %2, %1"
3711   [(set_attr "itanium_class" "ilog,fmisc")])
3712
3713 (define_insn "*andnot"
3714   [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3715         (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
3716                 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3717   ""
3718   "@
3719    andcm %0 = %2, %1
3720    fandcm %0 = %2, %1"
3721   [(set_attr "itanium_class" "ilog,fmisc")])
3722
3723 (define_insn "iordi3"
3724   [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3725         (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3726                 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3727   ""
3728   "@
3729    or %0 = %2, %1
3730    for %0 = %2, %1"
3731   [(set_attr "itanium_class" "ilog,fmisc")])
3732
3733 (define_insn "xordi3"
3734   [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3735         (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3736                 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3737   ""
3738   "@
3739    xor %0 = %2, %1
3740    fxor %0 = %2, %1"
3741   [(set_attr "itanium_class" "ilog,fmisc")])
3742
3743 (define_insn "one_cmpldi2"
3744   [(set (match_operand:DI 0 "gr_register_operand" "=r")
3745         (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
3746   ""
3747   "andcm %0 = -1, %1"
3748   [(set_attr "itanium_class" "ilog")])
3749 \f
3750 ;; ::::::::::::::::::::
3751 ;; ::
3752 ;; :: Comparisons
3753 ;; ::
3754 ;; ::::::::::::::::::::
3755
3756 (define_expand "cbranchbi4"
3757   [(set (pc)
3758         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3759                        [(match_operand:BI 1 "register_operand" "")
3760                         (match_operand:BI 2 "const_int_operand" "")])
3761                       (label_ref (match_operand 3 "" ""))
3762                       (pc)))]
3763   ""
3764   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3765
3766 (define_expand "cbranchsi4"
3767   [(set (pc)
3768         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3769                        [(match_operand:SI 1 "gr_register_operand" "")
3770                         (match_operand:SI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
3771                       (label_ref (match_operand 3 "" ""))
3772                       (pc)))]
3773   ""
3774   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3775
3776 (define_expand "cbranchdi4"
3777   [(set (pc)
3778         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3779                        [(match_operand:DI 1 "gr_register_operand" "")
3780                         (match_operand:DI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
3781                       (label_ref (match_operand 3 "" ""))
3782                       (pc)))]
3783   ""
3784   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3785
3786 (define_expand "cbranchsf4"
3787   [(set (pc)
3788         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3789                        [(match_operand:SF 1 "fr_reg_or_fp01_operand" "")
3790                         (match_operand:SF 2 "fr_reg_or_fp01_operand" "")])
3791                       (label_ref (match_operand 3 "" ""))
3792                       (pc)))]
3793   ""
3794   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3795
3796 (define_expand "cbranchdf4"
3797   [(set (pc)
3798         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3799                        [(match_operand:DF 1 "fr_reg_or_fp01_operand" "")
3800                         (match_operand:DF 2 "fr_reg_or_fp01_operand" "")])
3801                       (label_ref (match_operand 3 "" ""))
3802                       (pc)))]
3803   ""
3804   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3805
3806 (define_expand "cbranchxf4"
3807   [(set (pc)
3808         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3809                        [(match_operand:XF 1 "xfreg_or_fp01_operand" "")
3810                         (match_operand:XF 2 "xfreg_or_fp01_operand" "")])
3811                       (label_ref (match_operand 3 "" ""))
3812                       (pc)))]
3813   ""
3814   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3815
3816 (define_expand "cbranchtf4"
3817   [(set (pc)
3818         (if_then_else (match_operator 0 "ia64_cbranch_operator"
3819                        [(match_operand:TF 1 "gr_register_operand" "")
3820                         (match_operand:TF 2 "gr_register_operand" "")])
3821                       (label_ref (match_operand 3 "" ""))
3822                       (pc)))]
3823   "TARGET_HPUX"
3824   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3825
3826
3827 (define_insn "*cmpsi_normal"
3828   [(set (match_operand:BI 0 "register_operand" "=c")
3829         (match_operator:BI 1 "normal_comparison_operator"
3830            [(match_operand:SI 2 "gr_register_operand" "r")
3831             (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
3832   ""
3833   "cmp4.%C1 %0, %I0 = %3, %2"
3834   [(set_attr "itanium_class" "icmp")])
3835
3836 ;; We use %r3 because it is possible for us to match a 0, and two of the
3837 ;; unsigned comparisons don't accept immediate operands of zero.
3838
3839 (define_insn "*cmpsi_adjusted"
3840   [(set (match_operand:BI 0 "register_operand" "=c")
3841         (match_operator:BI 1 "adjusted_comparison_operator"
3842            [(match_operand:SI 2 "gr_register_operand" "r")
3843             (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
3844   ""
3845   "cmp4.%C1 %0, %I0 = %r3, %2"
3846   [(set_attr "itanium_class" "icmp")])
3847
3848 (define_insn "*cmpdi_normal"
3849   [(set (match_operand:BI 0 "register_operand" "=c")
3850         (match_operator:BI 1 "normal_comparison_operator"
3851            [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
3852             (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
3853   ""
3854   "cmp.%C1 %0, %I0 = %3, %r2"
3855   [(set_attr "itanium_class" "icmp")])
3856
3857 ;; We use %r3 because it is possible for us to match a 0, and two of the
3858 ;; unsigned comparisons don't accept immediate operands of zero.
3859
3860 (define_insn "*cmpdi_adjusted"
3861   [(set (match_operand:BI 0 "register_operand" "=c")
3862         (match_operator:BI 1 "adjusted_comparison_operator"
3863            [(match_operand:DI 2 "gr_register_operand" "r")
3864             (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
3865   ""
3866   "cmp.%C1 %0, %I0 = %r3, %2"
3867   [(set_attr "itanium_class" "icmp")])
3868
3869 (define_insn "*cmpsf_internal"
3870   [(set (match_operand:BI 0 "register_operand" "=c")
3871         (match_operator:BI 1 "comparison_operator"
3872            [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
3873             (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
3874   ""
3875   "fcmp.%D1 %0, %I0 = %F2, %F3"
3876   [(set_attr "itanium_class" "fcmp")])
3877
3878 (define_insn "*cmpdf_internal"
3879   [(set (match_operand:BI 0 "register_operand" "=c")
3880         (match_operator:BI 1 "comparison_operator"
3881            [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
3882             (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
3883   ""
3884   "fcmp.%D1 %0, %I0 = %F2, %F3"
3885   [(set_attr "itanium_class" "fcmp")])
3886
3887 (define_insn "*cmpxf_internal"
3888   [(set (match_operand:BI 0 "register_operand" "=c")
3889         (match_operator:BI 1 "comparison_operator"
3890                    [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3891                     (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
3892   ""
3893   "fcmp.%D1 %0, %I0 = %F2, %F3"
3894   [(set_attr "itanium_class" "fcmp")])
3895
3896 ;; ??? Can this pattern be generated?
3897
3898 (define_insn "*bit_zero"
3899   [(set (match_operand:BI 0 "register_operand" "=c")
3900         (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
3901                                 (const_int 1)
3902                                 (match_operand:DI 2 "shift_count_operand" "M"))
3903                (const_int 0)))]
3904   ""
3905   "tbit.z %0, %I0 = %1, %2"
3906   [(set_attr "itanium_class" "tbit")])
3907
3908 (define_insn "*bit_one"
3909   [(set (match_operand:BI 0 "register_operand" "=c")
3910         (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
3911                                 (const_int 1)
3912                                 (match_operand:DI 2 "shift_count_operand" "M"))
3913                (const_int 0)))]
3914   ""
3915   "tbit.nz %0, %I0 = %1, %2"
3916   [(set_attr "itanium_class" "tbit")])
3917 \f
3918 ;; ::::::::::::::::::::
3919 ;; ::
3920 ;; :: Branches
3921 ;; ::
3922 ;; ::::::::::::::::::::
3923
3924 (define_insn "*br_true"
3925   [(set (pc)
3926         (if_then_else (match_operator 0 "predicate_operator"
3927                         [(match_operand:BI 1 "register_operand" "c")
3928                          (const_int 0)])
3929                       (label_ref (match_operand 2 "" ""))
3930                       (pc)))]
3931   ""
3932   "(%J0) br.cond%+ %l2"
3933   [(set_attr "itanium_class" "br")
3934    (set_attr "predicable" "no")])
3935
3936 (define_insn "*br_false"
3937   [(set (pc)
3938         (if_then_else (match_operator 0 "predicate_operator"
3939                         [(match_operand:BI 1 "register_operand" "c")
3940                          (const_int 0)])
3941                       (pc)
3942                       (label_ref (match_operand 2 "" ""))))]
3943   ""
3944   "(%j0) br.cond%+ %l2"
3945   [(set_attr "itanium_class" "br")
3946    (set_attr "predicable" "no")])
3947 \f
3948 ;; ::::::::::::::::::::
3949 ;; ::
3950 ;; :: Counted loop operations
3951 ;; ::
3952 ;; ::::::::::::::::::::
3953
3954 (define_expand "doloop_end"
3955   [(use (match_operand 0 "" ""))        ; loop pseudo
3956    (use (match_operand 1 "" ""))        ; iterations; zero if unknown
3957    (use (match_operand 2 "" ""))        ; max iterations
3958    (use (match_operand 3 "" ""))        ; loop level
3959    (use (match_operand 4 "" ""))]       ; label
3960   ""
3961 {
3962   /* Only use cloop on innermost loops.  */
3963   if (INTVAL (operands[3]) > 1)
3964     FAIL;
3965   emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
3966                                            operands[4]));
3967   DONE;
3968 })
3969
3970 (define_insn "doloop_end_internal"
3971   [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
3972                                (const_int 0))
3973                 (label_ref (match_operand 1 "" ""))
3974                 (pc)))
3975    (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
3976                          (plus:DI (match_dup 0) (const_int -1))
3977                          (match_dup 0)))]
3978   ""
3979   "br.cloop.sptk.few %l1"
3980   [(set_attr "itanium_class" "br")
3981    (set_attr "predicable" "no")])
3982 \f
3983 ;; ::::::::::::::::::::
3984 ;; ::
3985 ;; :: Set flag operations
3986 ;; ::
3987 ;; ::::::::::::::::::::
3988
3989 (define_expand "cstorebi4"
3990   [(set (match_operand:DI 0 "gr_register_operand" "") 
3991         (match_operator:DI 1 "ia64_cbranch_operator"
3992                        [(match_operand:BI 2 "register_operand" "")
3993                         (match_operand:BI 3 "const_int_operand" "")]))]
3994   ""
3995   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
3996
3997 (define_expand "cstoresi4"
3998   [(set (match_operand:DI 0 "gr_register_operand" "") 
3999         (match_operator:DI 1 "ia64_cbranch_operator"
4000                        [(match_operand:SI 2 "gr_register_operand" "")
4001                         (match_operand:SI 3 "gr_reg_or_8bit_and_adjusted_operand" "")]))]
4002   ""
4003   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4004
4005 (define_expand "cstoredi4"
4006   [(set (match_operand:DI 0 "gr_register_operand" "") 
4007         (match_operator:DI 1 "ia64_cbranch_operator"
4008                        [(match_operand:DI 2 "gr_register_operand" "")
4009                         (match_operand:DI 3 "gr_reg_or_8bit_and_adjusted_operand" "")]))]
4010   ""
4011   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4012
4013 (define_expand "cstoresf4"
4014   [(set (match_operand:DI 0 "gr_register_operand" "") 
4015         (match_operator:DI 1 "ia64_cbranch_operator"
4016                        [(match_operand:SF 2 "fr_reg_or_fp01_operand" "")
4017                         (match_operand:SF 3 "fr_reg_or_fp01_operand" "")]))]
4018   ""
4019   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4020
4021 (define_expand "cstoredf4"
4022   [(set (match_operand:DI 0 "gr_register_operand" "") 
4023         (match_operator:DI 1 "ia64_cbranch_operator"
4024                        [(match_operand:DF 2 "fr_reg_or_fp01_operand" "")
4025                         (match_operand:DF 3 "fr_reg_or_fp01_operand" "")]))]
4026   ""
4027   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4028
4029 (define_expand "cstorexf4"
4030   [(set (match_operand:DI 0 "gr_register_operand" "") 
4031         (match_operator:DI 1 "ia64_cbranch_operator"
4032                        [(match_operand:XF 2 "xfreg_or_fp01_operand" "")
4033                         (match_operand:XF 3 "xfreg_or_fp01_operand" "")]))]
4034   ""
4035   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4036
4037 (define_expand "cstoretf4"
4038   [(set (match_operand:DI 0 "gr_register_operand" "") 
4039         (match_operator:DI 1 "ia64_cbranch_operator"
4040                        [(match_operand:TF 2 "gr_register_operand" "")
4041                         (match_operand:TF 3 "gr_register_operand" "")]))]
4042   "TARGET_HPUX"
4043   "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4044
4045 ;; Don't allow memory as destination here, because cmov/cmov/st is more
4046 ;; efficient than mov/mov/cst/cst.
4047
4048 (define_insn_and_split "*sne_internal"
4049   [(set (match_operand:DI 0 "gr_register_operand" "=r")
4050         (ne:DI (match_operand:BI 1 "register_operand" "c")
4051                (const_int 0)))]
4052   ""
4053   "#"
4054   "reload_completed"
4055   [(cond_exec (ne (match_dup 1) (const_int 0))
4056      (set (match_dup 0) (const_int 1)))
4057    (cond_exec (eq (match_dup 1) (const_int 0))
4058      (set (match_dup 0) (const_int 0)))]
4059   ""
4060   [(set_attr "itanium_class" "unknown")])
4061
4062 (define_insn_and_split "*seq_internal"
4063   [(set (match_operand:DI 0 "gr_register_operand" "=r")
4064         (eq:DI (match_operand:BI 1 "register_operand" "c")
4065                (const_int 0)))]
4066   ""
4067   "#"
4068   "reload_completed"
4069   [(cond_exec (ne (match_dup 1) (const_int 0))
4070      (set (match_dup 0) (const_int 0)))
4071    (cond_exec (eq (match_dup 1) (const_int 0))
4072      (set (match_dup 0) (const_int 1)))]
4073   ""
4074   [(set_attr "itanium_class" "unknown")])
4075 \f
4076 ;; ::::::::::::::::::::
4077 ;; ::
4078 ;; :: Conditional move instructions.
4079 ;; ::
4080 ;; ::::::::::::::::::::
4081
4082 ;; ??? Add movXXcc patterns?
4083
4084 ;;
4085 ;; DImode if_then_else patterns.
4086 ;;
4087
4088 (define_insn "*cmovdi_internal"
4089   [(set (match_operand:DI 0 "not_postinc_destination_operand"
4090            "= r,  r,  r,   r,  r,  r,   r, r, r,   r, m, Q, *f,*b,*d*e")
4091         (if_then_else:DI
4092           (match_operator 4 "predicate_operator"
4093             [(match_operand:BI 1 "register_operand"
4094                 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
4095              (const_int 0)])
4096           (match_operand:DI 2 "not_postinc_move_operand"
4097            "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO,  rK")
4098           (match_operand:DI 3 "not_postinc_move_operand"
4099            "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO,  rK")))]
4100   "ia64_move_ok (operands[0], operands[2])
4101    && ia64_move_ok (operands[0], operands[3])"
4102   { gcc_unreachable (); }
4103   [(set_attr "predicable" "no")])
4104
4105 (define_split
4106   [(set (match_operand 0 "not_postinc_destination_operand" "")
4107         (if_then_else
4108           (match_operator 4 "predicate_operator"
4109             [(match_operand:BI 1 "register_operand" "")
4110              (const_int 0)])
4111           (match_operand 2 "not_postinc_move_operand" "")
4112           (match_operand 3 "not_postinc_move_operand" "")))]
4113   "reload_completed"
4114   [(const_int 0)]
4115 {
4116   bool emitted_something = false;
4117   rtx dest = operands[0];
4118   rtx srct = operands[2];
4119   rtx srcf = operands[3];
4120   rtx cond = operands[4];
4121
4122   if (! rtx_equal_p (dest, srct))
4123     {
4124       ia64_emit_cond_move (dest, srct, cond);
4125       emitted_something = true;
4126     }
4127   if (! rtx_equal_p (dest, srcf))
4128     {
4129       cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
4130                              VOIDmode, operands[1], const0_rtx);
4131       ia64_emit_cond_move (dest, srcf, cond);
4132       emitted_something = true;
4133     }
4134   if (! emitted_something)
4135     emit_note (NOTE_INSN_DELETED);
4136   DONE;
4137 })
4138
4139 ;; Absolute value pattern.
4140
4141 (define_insn "*absdi2_internal"
4142   [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4143         (if_then_else:DI
4144           (match_operator 4 "predicate_operator"
4145             [(match_operand:BI 1 "register_operand" "c,c")
4146              (const_int 0)])
4147           (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
4148           (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
4149   ""
4150   "#"
4151   [(set_attr "itanium_class" "ialu,unknown")
4152    (set_attr "predicable" "no")])
4153
4154 (define_split
4155   [(set (match_operand:DI 0 "register_operand" "")
4156         (if_then_else:DI
4157           (match_operator 4 "predicate_operator"
4158             [(match_operand:BI 1 "register_operand" "c,c")
4159              (const_int 0)])
4160           (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4161           (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4162   "reload_completed && rtx_equal_p (operands[0], operands[3])"
4163   [(cond_exec
4164      (match_dup 4)
4165      (set (match_dup 0)
4166           (neg:DI (match_dup 2))))]
4167   "")
4168
4169 (define_split
4170   [(set (match_operand:DI 0 "register_operand" "")
4171         (if_then_else:DI
4172           (match_operator 4 "predicate_operator"
4173             [(match_operand:BI 1 "register_operand" "c,c")
4174              (const_int 0)])
4175           (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4176           (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4177   "reload_completed"
4178   [(cond_exec
4179      (match_dup 4)
4180      (set (match_dup 0) (neg:DI (match_dup 2))))
4181    (cond_exec
4182      (match_dup 5)
4183      (set (match_dup 0) (match_dup 3)))]
4184 {
4185   operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4186                                 VOIDmode, operands[1], const0_rtx);
4187 })
4188
4189 ;;
4190 ;; SImode if_then_else patterns.
4191 ;;
4192
4193 (define_insn "*cmovsi_internal"
4194   [(set (match_operand:SI 0 "not_postinc_destination_operand"
4195                 "=r,m,*f,r,m,*f,r,m,*f")
4196         (if_then_else:SI
4197           (match_operator 4 "predicate_operator"
4198             [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
4199              (const_int 0)])
4200           (match_operand:SI 2 "not_postinc_move_operand"
4201                     "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
4202           (match_operand:SI 3 "not_postinc_move_operand"
4203                     "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
4204   "ia64_move_ok (operands[0], operands[2])
4205    && ia64_move_ok (operands[0], operands[3])"
4206   { gcc_unreachable (); }
4207   [(set_attr "predicable" "no")])
4208
4209 (define_insn "*abssi2_internal"
4210   [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
4211         (if_then_else:SI
4212           (match_operator 4 "predicate_operator"
4213             [(match_operand:BI 1 "register_operand" "c,c")
4214              (const_int 0)])
4215           (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
4216           (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
4217   ""
4218   "#"
4219   [(set_attr "itanium_class" "ialu,unknown")
4220    (set_attr "predicable" "no")])
4221
4222 (define_split
4223   [(set (match_operand:SI 0 "register_operand" "")
4224         (if_then_else:SI
4225           (match_operator 4 "predicate_operator"
4226             [(match_operand:BI 1 "register_operand" "c,c")
4227              (const_int 0)])
4228           (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4229           (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4230   "reload_completed && rtx_equal_p (operands[0], operands[3])"
4231   [(cond_exec
4232      (match_dup 4)
4233      (set (match_dup 0)
4234           (neg:SI (match_dup 2))))]
4235   "")
4236
4237 (define_split
4238   [(set (match_operand:SI 0 "register_operand" "")
4239         (if_then_else:SI
4240           (match_operator 4 "predicate_operator"
4241             [(match_operand:BI 1 "register_operand" "c,c")
4242              (const_int 0)])
4243           (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4244           (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4245   "reload_completed"
4246   [(cond_exec
4247      (match_dup 4)
4248      (set (match_dup 0) (neg:SI (match_dup 2))))
4249    (cond_exec
4250      (match_dup 5)
4251      (set (match_dup 0) (match_dup 3)))]
4252 {
4253   operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4254                                 VOIDmode, operands[1], const0_rtx);
4255 })
4256
4257 (define_insn_and_split "*cond_opsi2_internal"
4258   [(set (match_operand:SI 0 "gr_register_operand" "=r")
4259         (match_operator:SI 5 "condop_operator"
4260           [(if_then_else:SI
4261              (match_operator 6 "predicate_operator"
4262                [(match_operand:BI 1 "register_operand" "c")
4263                 (const_int 0)])
4264              (match_operand:SI 2 "gr_register_operand" "r")
4265              (match_operand:SI 3 "gr_register_operand" "r"))
4266            (match_operand:SI 4 "gr_register_operand" "r")]))]
4267   ""
4268   "#"
4269   "reload_completed"
4270   [(cond_exec
4271      (match_dup 6)
4272      (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
4273    (cond_exec
4274      (match_dup 7)
4275      (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
4276 {
4277   operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
4278                                 VOIDmode, operands[1], const0_rtx);
4279 }
4280   [(set_attr "itanium_class" "ialu")
4281    (set_attr "predicable" "no")])
4282
4283
4284 (define_insn_and_split "*cond_opsi2_internal_b"
4285   [(set (match_operand:SI 0 "gr_register_operand" "=r")
4286         (match_operator:SI 5 "condop_operator"
4287           [(match_operand:SI 4 "gr_register_operand" "r")
4288            (if_then_else:SI
4289              (match_operator 6 "predicate_operator"
4290                [(match_operand:BI 1 "register_operand" "c")
4291                 (const_int 0)])
4292              (match_operand:SI 2 "gr_register_operand" "r")
4293              (match_operand:SI 3 "gr_register_operand" "r"))]))]
4294   ""
4295   "#"
4296   "reload_completed"
4297   [(cond_exec
4298      (match_dup 6)
4299      (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
4300    (cond_exec
4301      (match_dup 7)
4302      (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
4303 {
4304   operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
4305                                 VOIDmode, operands[1], const0_rtx);
4306 }
4307   [(set_attr "itanium_class" "ialu")
4308    (set_attr "predicable" "no")])
4309
4310 \f
4311 ;; ::::::::::::::::::::
4312 ;; ::
4313 ;; :: Call and branch instructions
4314 ;; ::
4315 ;; ::::::::::::::::::::
4316
4317 ;; Subroutine call instruction returning no value.  Operand 0 is the function
4318 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
4319 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
4320 ;; registers used as operands.
4321
4322 ;; On most machines, operand 2 is not actually stored into the RTL pattern.  It
4323 ;; is supplied for the sake of some RISC machines which need to put this
4324 ;; information into the assembler code; they can put it in the RTL instead of
4325 ;; operand 1.
4326
4327 (define_expand "call"
4328   [(use (match_operand:DI 0 "" ""))
4329    (use (match_operand 1 "" ""))
4330    (use (match_operand 2 "" ""))
4331    (use (match_operand 3 "" ""))]
4332   ""
4333 {
4334   ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
4335   DONE;
4336 })
4337
4338 (define_expand "sibcall"
4339   [(use (match_operand:DI 0 "" ""))
4340    (use (match_operand 1 "" ""))
4341    (use (match_operand 2 "" ""))
4342    (use (match_operand 3 "" ""))]
4343   ""
4344 {
4345   ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
4346   DONE;
4347 })
4348
4349 ;; Subroutine call instruction returning a value.  Operand 0 is the hard
4350 ;; register in which the value is returned.  There are three more operands,
4351 ;; the same as the three operands of the `call' instruction (but with numbers
4352 ;; increased by one).
4353 ;;
4354 ;; Subroutines that return `BLKmode' objects use the `call' insn.
4355
4356 (define_expand "call_value"
4357   [(use (match_operand 0 "" ""))
4358    (use (match_operand:DI 1 "" ""))
4359    (use (match_operand 2 "" ""))
4360    (use (match_operand 3 "" ""))
4361    (use (match_operand 4 "" ""))]
4362   ""
4363 {
4364   ia64_expand_call (operands[0], operands[1], operands[3], false);
4365   DONE;
4366 })
4367
4368 (define_expand "sibcall_value"
4369   [(use (match_operand 0 "" ""))
4370    (use (match_operand:DI 1 "" ""))
4371    (use (match_operand 2 "" ""))
4372    (use (match_operand 3 "" ""))
4373    (use (match_operand 4 "" ""))]
4374   ""
4375 {
4376   ia64_expand_call (operands[0], operands[1], operands[3], true);
4377   DONE;
4378 })
4379
4380 ;; Call subroutine returning any type.
4381
4382 (define_expand "untyped_call"
4383   [(parallel [(call (match_operand 0 "" "")
4384                     (const_int 0))
4385               (match_operand 1 "" "")
4386               (match_operand 2 "" "")])]
4387   ""
4388 {
4389   int i;
4390
4391   emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
4392
4393   for (i = 0; i < XVECLEN (operands[2], 0); i++)
4394     {
4395       rtx set = XVECEXP (operands[2], 0, i);
4396       emit_move_insn (SET_DEST (set), SET_SRC (set));
4397     }
4398
4399   /* The optimizer does not know that the call sets the function value
4400      registers we stored in the result block.  We avoid problems by
4401      claiming that all hard registers are used and clobbered at this
4402      point.  */
4403   emit_insn (gen_blockage ());
4404
4405   DONE;
4406 })
4407
4408 (define_insn "call_nogp"
4409   [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,s"))
4410          (const_int 0))
4411    (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
4412   ""
4413   "br.call%+.many %1 = %0"
4414   [(set_attr "itanium_class" "br,scall")])
4415
4416 (define_insn "call_value_nogp"
4417   [(set (match_operand 0 "" "=X,X")
4418         (call (mem:DI (match_operand:DI 1 "call_operand" "?b,s"))
4419               (const_int 0)))
4420    (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
4421   ""
4422   "br.call%+.many %2 = %1"
4423   [(set_attr "itanium_class" "br,scall")])
4424
4425 (define_insn "sibcall_nogp"
4426   [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,s"))
4427          (const_int 0))]
4428   ""
4429   "br%+.many %0"
4430   [(set_attr "itanium_class" "br,scall")])
4431
4432 (define_insn "call_gp"
4433   [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,s"))
4434          (const_int 1))
4435    (clobber (match_operand:DI 1 "register_operand" "=b,b"))
4436    (clobber (match_scratch:DI 2 "=&r,X"))
4437    (clobber (match_scratch:DI 3 "=b,X"))]
4438   ""
4439   "#"
4440   [(set_attr "itanium_class" "br,scall")])
4441
4442 ;; Irritatingly, we don't have access to INSN within the split body.
4443 ;; See commentary in ia64_split_call as to why these aren't peep2.
4444 (define_split
4445   [(call (mem (match_operand 0 "call_operand" ""))
4446          (const_int 1))
4447    (clobber (match_operand:DI 1 "register_operand" ""))
4448    (clobber (match_scratch:DI 2 ""))
4449    (clobber (match_scratch:DI 3 ""))]
4450   "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4451   [(const_int 0)]
4452 {
4453   ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
4454                    operands[3], true, false);
4455   DONE;
4456 })
4457
4458 (define_split
4459   [(call (mem (match_operand 0 "call_operand" ""))
4460          (const_int 1))
4461    (clobber (match_operand:DI 1 "register_operand" ""))
4462    (clobber (match_scratch:DI 2 ""))
4463    (clobber (match_scratch:DI 3 ""))]
4464   "reload_completed"
4465   [(const_int 0)]
4466 {
4467   ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
4468                    operands[3], false, false);
4469   DONE;
4470 })
4471
4472 (define_insn "call_value_gp"
4473   [(set (match_operand 0 "" "=X,X")
4474         (call (mem:DI (match_operand:DI 1 "call_operand" "?r,s"))
4475               (const_int 1)))
4476    (clobber (match_operand:DI 2 "register_operand" "=b,b"))
4477    (clobber (match_scratch:DI 3 "=&r,X"))
4478    (clobber (match_scratch:DI 4 "=b,X"))]
4479   ""
4480   "#"
4481   [(set_attr "itanium_class" "br,scall")])
4482
4483 (define_split
4484   [(set (match_operand 0 "" "")
4485         (call (mem:DI (match_operand:DI 1 "call_operand" ""))
4486               (const_int 1)))
4487    (clobber (match_operand:DI 2 "register_operand" ""))
4488    (clobber (match_scratch:DI 3 ""))
4489    (clobber (match_scratch:DI 4 ""))]
4490   "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4491   [(const_int 0)]
4492 {
4493   ia64_split_call (operands[0], operands[1], operands[2], operands[3],
4494                    operands[4], true, false);
4495   DONE;
4496 })
4497
4498 (define_split
4499   [(set (match_operand 0 "" "")
4500         (call (mem:DI (match_operand:DI 1 "call_operand" ""))
4501               (const_int 1)))
4502    (clobber (match_operand:DI 2 "register_operand" ""))
4503    (clobber (match_scratch:DI 3 ""))
4504    (clobber (match_scratch:DI 4 ""))]
4505   "reload_completed"
4506   [(const_int 0)]
4507 {
4508   ia64_split_call (operands[0], operands[1], operands[2], operands[3],
4509                    operands[4], false, false);
4510   DONE;
4511 })
4512
4513 (define_insn_and_split "sibcall_gp"
4514   [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,s"))
4515          (const_int 1))
4516    (clobber (match_scratch:DI 1 "=&r,X"))
4517    (clobber (match_scratch:DI 2 "=b,X"))]
4518   ""
4519   "#"
4520   "reload_completed"
4521   [(const_int 0)]
4522 {
4523   ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
4524                    operands[2], true, true);
4525   DONE;
4526 }
4527   [(set_attr "itanium_class" "br")])
4528
4529 (define_insn "return_internal"
4530   [(return)
4531    (use (match_operand:DI 0 "register_operand" "b"))]
4532   ""
4533   "br.ret.sptk.many %0"
4534   [(set_attr "itanium_class" "br")])
4535
4536 (define_insn "return"
4537   [(return)]
4538   "ia64_direct_return ()"
4539   "br.ret.sptk.many rp"
4540   [(set_attr "itanium_class" "br")])
4541
4542 (define_insn "*return_true"
4543   [(set (pc)
4544         (if_then_else (match_operator 0 "predicate_operator"
4545                         [(match_operand:BI 1 "register_operand" "c")
4546                          (const_int 0)])
4547                       (return)
4548                       (pc)))]
4549   "ia64_direct_return ()"
4550   "(%J0) br.ret%+.many rp"
4551   [(set_attr "itanium_class" "br")
4552    (set_attr "predicable" "no")])
4553
4554 (define_insn "*return_false"
4555   [(set (pc)
4556         (if_then_else (match_operator 0 "predicate_operator"
4557                         [(match_operand:BI 1 "register_operand" "c")
4558                          (const_int 0)])
4559                       (pc)
4560                       (return)))]
4561   "ia64_direct_return ()"
4562   "(%j0) br.ret%+.many rp"
4563   [(set_attr "itanium_class" "br")
4564    (set_attr "predicable" "no")])
4565
4566 (define_insn "jump"
4567   [(set (pc) (label_ref (match_operand 0 "" "")))]
4568   ""
4569   "br %l0"
4570   [(set_attr "itanium_class" "br")])
4571
4572 (define_insn "indirect_jump"
4573   [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
4574   ""
4575   "br %0"
4576   [(set_attr "itanium_class" "br")])
4577
4578 (define_expand "tablejump"
4579   [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
4580               (use (label_ref (match_operand 1 "" "")))])]
4581   ""
4582 {
4583   rtx op0 = operands[0];
4584   rtx addr;
4585
4586   /* ??? Bother -- do_tablejump is "helpful" and pulls the table
4587      element into a register without bothering to see whether that
4588      is necessary given the operand predicate.  Check for MEM just
4589      in case someone fixes this.  */
4590   if (GET_CODE (op0) == MEM)
4591     addr = XEXP (op0, 0);
4592   else
4593     {
4594       /* Otherwise, cheat and guess that the previous insn in the
4595          stream was the memory load.  Grab the address from that.
4596          Note we have to momentarily pop out of the sequence started
4597          by the insn-emit wrapper in order to grab the last insn.  */
4598       rtx last, set;
4599
4600       end_sequence ();
4601       last = get_last_insn ();
4602       start_sequence ();
4603       set = single_set (last);
4604
4605       gcc_assert (rtx_equal_p (SET_DEST (set), op0)
4606                   && GET_CODE (SET_SRC (set)) == MEM);
4607       addr = XEXP (SET_SRC (set), 0);
4608       gcc_assert (!rtx_equal_p (addr, op0));
4609     }
4610
4611   /* Jump table elements are stored pc-relative.  That is, a displacement
4612      from the entry to the label.  Thus to convert to an absolute address
4613      we add the address of the memory from which the value is loaded.  */
4614   operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
4615                                      NULL_RTX, 1, OPTAB_DIRECT);
4616 })
4617
4618 (define_insn "*tablejump_internal"
4619   [(set (pc) (match_operand:DI 0 "register_operand" "b"))
4620    (use (label_ref (match_operand 1 "" "")))]
4621   ""
4622   "br %0"
4623   [(set_attr "itanium_class" "br")])
4624
4625 \f
4626 ;; ::::::::::::::::::::
4627 ;; ::
4628 ;; :: Prologue and Epilogue instructions
4629 ;; ::
4630 ;; ::::::::::::::::::::
4631
4632 (define_expand "prologue"
4633   [(const_int 1)]
4634   ""
4635 {
4636   ia64_expand_prologue ();
4637   DONE;
4638 })
4639
4640 (define_expand "epilogue"
4641   [(return)]
4642   ""
4643 {
4644   ia64_expand_epilogue (0);
4645   DONE;
4646 })
4647
4648 (define_expand "sibcall_epilogue"
4649   [(return)]
4650   ""
4651 {
4652   ia64_expand_epilogue (1);
4653   DONE;
4654 })
4655
4656 ;; This prevents the scheduler from moving the SP decrement past FP-relative
4657 ;; stack accesses.  This is the same as adddi3 plus the extra set.
4658
4659 (define_insn "prologue_allocate_stack"
4660   [(set (match_operand:DI 0 "register_operand" "=r,r,r")
4661         (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
4662                  (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
4663    (set (match_operand:DI 3 "register_operand" "+r,r,r")
4664         (match_dup 3))]
4665   ""
4666   "@
4667    add %0 = %1, %2
4668    adds %0 = %2, %1
4669    addl %0 = %2, %1"
4670   [(set_attr "itanium_class" "ialu")])
4671
4672 ;; This prevents the scheduler from moving the SP restore past FP-relative
4673 ;; stack accesses.  This is similar to movdi plus the extra set.
4674
4675 (define_insn "epilogue_deallocate_stack"
4676   [(set (match_operand:DI 0 "register_operand" "=r")
4677         (match_operand:DI 1 "register_operand" "+r"))
4678    (set (match_dup 1) (match_dup 1))]
4679   ""
4680   "mov %0 = %1"
4681   [(set_attr "itanium_class" "ialu")])
4682
4683 ;; As USE insns aren't meaningful after reload, this is used instead
4684 ;; to prevent deleting instructions setting registers for EH handling
4685 (define_insn "prologue_use"
4686   [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
4687               UNSPEC_PROLOGUE_USE)]
4688   ""
4689   ""
4690   [(set_attr "itanium_class" "ignore")
4691    (set_attr "predicable" "no")
4692    (set_attr "empty" "yes")])
4693
4694 ;; Allocate a new register frame.
4695
4696 (define_insn "alloc"
4697   [(set (match_operand:DI 0 "register_operand" "=r")
4698         (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
4699    (use (match_operand:DI 1 "const_int_operand" "i"))
4700    (use (match_operand:DI 2 "const_int_operand" "i"))
4701    (use (match_operand:DI 3 "const_int_operand" "i"))
4702    (use (match_operand:DI 4 "const_int_operand" "i"))]
4703   ""
4704   "alloc %0 = ar.pfs, %1, %2, %3, %4"
4705   [(set_attr "itanium_class" "syst_m0")
4706    (set_attr "predicable" "no")
4707    (set_attr "first_insn" "yes")])
4708
4709 ;; Modifies ar.unat
4710 (define_expand "gr_spill"
4711   [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
4712                    (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4713                                (match_operand:DI 2 "const_int_operand" "")]
4714                               UNSPEC_GR_SPILL))
4715               (clobber (match_dup 3))])]
4716   ""
4717   "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
4718
4719 (define_insn "gr_spill_internal"
4720   [(set (match_operand:DI 0 "destination_operand" "=m")
4721         (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4722                     (match_operand:DI 2 "const_int_operand" "")]
4723                    UNSPEC_GR_SPILL))
4724    (clobber (match_operand:DI 3 "register_operand" ""))]
4725   ""
4726 {
4727   /* Note that we use a C output pattern here to avoid the predicate
4728      being automatically added before the .mem.offset directive.  */
4729   return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
4730 }
4731   [(set_attr "itanium_class" "st")])
4732
4733 ;; Reads ar.unat
4734 (define_expand "gr_restore"
4735   [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
4736                    (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
4737                                (match_operand:DI 2 "const_int_operand" "")]
4738                               UNSPEC_GR_RESTORE))
4739               (use (match_dup 3))])]
4740   ""
4741   "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
4742
4743 (define_insn "gr_restore_internal"
4744   [(set (match_operand:DI 0 "register_operand" "=r")
4745         (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
4746                     (match_operand:DI 2 "const_int_operand" "")]
4747                    UNSPEC_GR_RESTORE))
4748    (use (match_operand:DI 3 "register_operand" ""))]
4749   ""
4750   { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
4751   [(set_attr "itanium_class" "ld")])
4752
4753 (define_insn "fr_spill"
4754   [(set (match_operand:XF 0 "destination_operand" "=m")
4755         (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
4756                    UNSPEC_FR_SPILL))]
4757   ""
4758   "stf.spill %0 = %1%P0"
4759   [(set_attr "itanium_class" "stf")])
4760
4761 (define_insn "fr_restore"
4762   [(set (match_operand:XF 0 "register_operand" "=f")
4763         (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
4764                    UNSPEC_FR_RESTORE))]
4765   ""
4766   "ldf.fill %0 = %1%P1"
4767   [(set_attr "itanium_class" "fld")])
4768
4769 ;; ??? The explicit stop is not ideal.  It would be better if
4770 ;; rtx_needs_barrier took care of this, but this is something that can be
4771 ;; fixed later.  This avoids an RSE DV.
4772
4773 (define_insn "bsp_value"
4774   [(set (match_operand:DI 0 "register_operand" "=r")
4775         (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
4776   ""
4777   "*
4778 {
4779   return \";;\;%,mov %0 = ar.bsp\";
4780 }"
4781   [(set_attr "itanium_class" "frar_i")])
4782
4783 (define_insn "set_bsp"
4784   [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
4785                     UNSPECV_SET_BSP)]
4786   ""
4787   "flushrs
4788         mov r19=ar.rsc
4789         ;;
4790         and r19=0x1c,r19
4791         ;;
4792         mov ar.rsc=r19
4793         ;;
4794         mov ar.bspstore=%0
4795         ;;
4796         or r19=0x3,r19
4797         ;;
4798         loadrs
4799         invala
4800         ;;
4801         mov ar.rsc=r19"
4802   [(set_attr "itanium_class" "unknown")
4803    (set_attr "predicable" "no")])
4804
4805 ;; ??? The explicit stops are not ideal.  It would be better if
4806 ;; rtx_needs_barrier took care of this, but this is something that can be
4807 ;; fixed later.  This avoids an RSE DV.
4808
4809 (define_insn "flushrs"
4810   [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
4811   ""
4812   ";;\;flushrs\;;;"
4813   [(set_attr "itanium_class" "rse_m")
4814    (set_attr "predicable" "no")])
4815 \f
4816 ;; ::::::::::::::::::::
4817 ;; ::
4818 ;; :: Miscellaneous instructions
4819 ;; ::
4820 ;; ::::::::::::::::::::
4821
4822 ;; ??? Emitting a NOP instruction isn't very useful.  This should probably
4823 ;; be emitting ";;" to force a break in the instruction packing.
4824
4825 ;; No operation, needed in case the user uses -g but not -O.
4826 (define_insn "nop"
4827   [(const_int 0)]
4828   ""
4829   "nop 0"
4830   [(set_attr "itanium_class" "nop")])
4831
4832 (define_insn "nop_m"
4833   [(const_int 1)]
4834   ""
4835   "nop.m 0"
4836   [(set_attr "itanium_class" "nop_m")])
4837
4838 (define_insn "nop_i"
4839   [(const_int 2)]
4840   ""
4841   "nop.i 0"
4842   [(set_attr "itanium_class" "nop_i")])
4843
4844 (define_insn "nop_f"
4845   [(const_int 3)]
4846   ""
4847   "nop.f 0"
4848   [(set_attr "itanium_class" "nop_f")])
4849
4850 (define_insn "nop_b"
4851   [(const_int 4)]
4852   ""
4853   "nop.b 0"
4854   [(set_attr "itanium_class" "nop_b")])
4855
4856 (define_insn "nop_x"
4857   [(const_int 5)]
4858   ""
4859   ""
4860   [(set_attr "itanium_class" "nop_x")
4861    (set_attr "empty" "yes")])
4862
4863 ;; The following insn will be never generated.  It is used only by
4864 ;; insn scheduler to change state before advancing cycle.
4865 (define_insn "pre_cycle"
4866   [(const_int 6)]
4867   ""
4868   ""
4869   [(set_attr "itanium_class" "pre_cycle")])
4870
4871 (define_insn "bundle_selector"
4872   [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
4873   ""
4874   { return get_bundle_name (INTVAL (operands[0])); }
4875   [(set_attr "itanium_class" "ignore")
4876    (set_attr "predicable" "no")])
4877
4878 ;; Pseudo instruction that prevents the scheduler from moving code above this
4879 ;; point.
4880 (define_insn "blockage"
4881   [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4882   ""
4883   ""
4884   [(set_attr "itanium_class" "ignore")
4885    (set_attr "predicable" "no")])
4886
4887 (define_insn "insn_group_barrier"
4888   [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
4889                     UNSPECV_INSN_GROUP_BARRIER)]
4890   ""
4891   ";;"
4892   [(set_attr "itanium_class" "stop_bit")
4893    (set_attr "predicable" "no")
4894    (set_attr "empty" "yes")])
4895
4896 (define_expand "trap"
4897   [(trap_if (const_int 1) (const_int 0))]
4898   ""
4899   "")
4900
4901 ;; ??? We don't have a match-any slot type.  Setting the type to unknown
4902 ;; produces worse code that setting the slot type to A.
4903
4904 (define_insn "*trap"
4905   [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
4906   ""
4907   "break %0"
4908   [(set_attr "itanium_class" "chk_s_i")])
4909
4910 (define_expand "ctrapbi4"
4911   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4912                        [(match_operand:BI 1 "register_operand" "")
4913                         (match_operand:BI 2 "const_int_operand" "")])
4914                       (match_operand 3 "" ""))]
4915   ""
4916   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4917
4918 (define_expand "ctrapsi4"
4919   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4920                        [(match_operand:SI 1 "gr_register_operand" "")
4921                         (match_operand:SI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
4922                        (match_operand 3 "" ""))]
4923   ""
4924   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4925
4926 (define_expand "ctrapdi4"
4927   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4928                        [(match_operand:DI 1 "gr_register_operand" "")
4929                         (match_operand:DI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
4930                        (match_operand 3 "" ""))]
4931   ""
4932   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4933
4934 (define_expand "ctrapsf4"
4935   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4936                        [(match_operand:SF 1 "fr_reg_or_fp01_operand" "")
4937                         (match_operand:SF 2 "fr_reg_or_fp01_operand" "")])
4938                        (match_operand 3 "" ""))]
4939   ""
4940   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4941
4942 (define_expand "ctrapdf4"
4943   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4944                        [(match_operand:DF 1 "fr_reg_or_fp01_operand" "")
4945                         (match_operand:DF 2 "fr_reg_or_fp01_operand" "")])
4946                        (match_operand 3 "" ""))]
4947   ""
4948   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4949
4950 (define_expand "ctrapxf4"
4951   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4952                        [(match_operand:XF 1 "xfreg_or_fp01_operand" "")
4953                         (match_operand:XF 2 "xfreg_or_fp01_operand" "")])
4954                        (match_operand 3 "" ""))]
4955   ""
4956   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4957
4958 (define_expand "ctraptf4"
4959   [(trap_if (match_operator 0 "ia64_cbranch_operator"
4960                        [(match_operand:TF 1 "gr_register_operand" "")
4961                         (match_operand:TF 2 "gr_register_operand" "")])
4962                        (match_operand 3 "" ""))]
4963   "TARGET_HPUX"
4964   "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4965
4966
4967 (define_insn "*conditional_trap"
4968   [(trap_if (match_operator 0 "predicate_operator"
4969               [(match_operand:BI 1 "register_operand" "c")
4970                (const_int 0)])  
4971             (match_operand 2 "const_int_operand" ""))]
4972   ""
4973   "(%J0) break %2"
4974   [(set_attr "itanium_class" "chk_s_i")
4975    (set_attr "predicable" "no")])
4976
4977 (define_insn "break_f"
4978   [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
4979   ""
4980   "break.f 0"
4981   [(set_attr "itanium_class" "nop_f")])
4982
4983 (define_insn "prefetch"
4984   [(prefetch (match_operand:DI 0 "address_operand" "p")
4985              (match_operand:DI 1 "const_int_operand" "n")
4986              (match_operand:DI 2 "const_int_operand" "n"))]
4987   ""
4988 {
4989   static const char * const alt[2][4] = {
4990     {
4991       "%,lfetch.nta [%0]",
4992       "%,lfetch.nt1 [%0]",
4993       "%,lfetch.nt2 [%0]",
4994       "%,lfetch [%0]"
4995     },
4996     {
4997       "%,lfetch.excl.nta [%0]",
4998       "%,lfetch.excl.nt1 [%0]",
4999       "%,lfetch.excl.nt2 [%0]",
5000       "%,lfetch.excl [%0]"
5001     }
5002   };
5003   int i = (INTVAL (operands[1]));
5004   int j = (INTVAL (operands[2]));
5005
5006   gcc_assert (i == 0 || i == 1);
5007   gcc_assert (j >= 0 && j <= 3);
5008   return alt[i][j];
5009 }
5010   [(set_attr "itanium_class" "lfetch")])
5011 \f
5012 ;; Non-local goto support.
5013
5014 (define_expand "save_stack_nonlocal"
5015   [(use (match_operand:OI 0 "memory_operand" ""))
5016    (use (match_operand:DI 1 "register_operand" ""))]
5017   ""
5018 {
5019   emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5020                                          \"__ia64_save_stack_nonlocal\"),
5021                      LCT_NORMAL, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
5022                      operands[1], Pmode);
5023   DONE;
5024 })
5025
5026 (define_expand "nonlocal_goto"
5027   [(use (match_operand 0 "general_operand" ""))
5028    (use (match_operand 1 "general_operand" ""))
5029    (use (match_operand 2 "general_operand" ""))
5030    (use (match_operand 3 "general_operand" ""))]
5031   ""
5032 {
5033   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
5034                      LCT_NORETURN, VOIDmode, 3,
5035                      operands[1], Pmode,
5036                      copy_to_reg (XEXP (operands[2], 0)), Pmode,
5037                      operands[3], Pmode);
5038   emit_barrier ();
5039   DONE;
5040 })
5041
5042 (define_insn_and_split "nonlocal_goto_receiver"
5043   [(unspec_volatile [(const_int 0)] UNSPECV_GOTO_RECEIVER)]
5044   ""
5045   "#"
5046   "reload_completed"
5047   [(const_int 0)]
5048 {
5049   ia64_reload_gp ();
5050   DONE;
5051 })
5052
5053 (define_insn_and_split "builtin_setjmp_receiver"
5054   [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
5055   ""
5056   "#"
5057   "reload_completed"
5058   [(const_int 0)]
5059 {
5060   ia64_reload_gp ();
5061   DONE;
5062 })
5063
5064 (define_expand "eh_epilogue"
5065   [(use (match_operand:DI 0 "register_operand" "r"))
5066    (use (match_operand:DI 1 "register_operand" "r"))
5067    (use (match_operand:DI 2 "register_operand" "r"))]
5068   ""
5069 {
5070   rtx bsp = gen_rtx_REG (Pmode, 10);
5071   rtx sp = gen_rtx_REG (Pmode, 9);
5072
5073   if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
5074     {
5075       emit_move_insn (bsp, operands[0]);
5076       operands[0] = bsp;
5077     }
5078   if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
5079     {
5080       emit_move_insn (sp, operands[2]);
5081       operands[2] = sp;
5082     }
5083   emit_use (sp);
5084   emit_use (bsp);
5085
5086   cfun->machine->ia64_eh_epilogue_sp = sp;
5087   cfun->machine->ia64_eh_epilogue_bsp = bsp;
5088 })
5089 \f
5090 ;; Builtin apply support.
5091
5092 (define_expand "restore_stack_nonlocal"
5093   [(use (match_operand:DI 0 "register_operand" ""))
5094    (use (match_operand:OI 1 "memory_operand" ""))]
5095   ""
5096 {
5097   emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5098                                          "__ia64_restore_stack_nonlocal"),
5099                      LCT_NORMAL, VOIDmode, 1,
5100                      copy_to_reg (XEXP (operands[1], 0)), Pmode);
5101   DONE;
5102 })
5103
5104 \f
5105 ;; Predication.
5106
5107 (define_cond_exec
5108   [(match_operator 0 "predicate_operator"
5109      [(match_operand:BI 1 "register_operand" "c")
5110       (const_int 0)])]
5111   ""
5112   "(%J0)")
5113
5114 (define_insn "pred_rel_mutex"
5115   [(set (match_operand:BI 0 "register_operand" "+c")
5116        (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
5117   ""
5118   ".pred.rel.mutex %0, %I0"
5119   [(set_attr "itanium_class" "ignore")
5120    (set_attr "predicable" "no")])
5121
5122 (define_insn "safe_across_calls_all"
5123   [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
5124   ""
5125   ".pred.safe_across_calls p1-p63"
5126   [(set_attr "itanium_class" "ignore")
5127    (set_attr "predicable" "no")])
5128
5129 (define_insn "safe_across_calls_normal"
5130   [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
5131   ""
5132 {
5133   emit_safe_across_calls ();
5134   return "";
5135 }
5136   [(set_attr "itanium_class" "ignore")
5137    (set_attr "predicable" "no")])
5138
5139 ;; UNSPEC instruction definition to "swizzle" 32-bit pointer into 64-bit
5140 ;; pointer.  This is used by the HP-UX 32 bit mode.
5141
5142 (define_insn "ptr_extend"
5143   [(set (match_operand:DI 0 "gr_register_operand" "=r")
5144         (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
5145                    UNSPEC_ADDP4))]
5146   ""
5147   "addp4 %0 = 0,%1"
5148   [(set_attr "itanium_class" "ialu")])
5149
5150 ;;
5151 ;; Optimizations for ptr_extend
5152
5153 (define_insn "ptr_extend_plus_imm"
5154   [(set (match_operand:DI 0 "gr_register_operand" "=r")
5155         (unspec:DI
5156          [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
5157                    (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
5158          UNSPEC_ADDP4))]
5159   "addp4_optimize_ok (operands[1], operands[2])"
5160   "addp4 %0 = %2, %1"
5161   [(set_attr "itanium_class" "ialu")])
5162
5163 (define_insn "*ptr_extend_plus_2"
5164   [(set (match_operand:DI 0 "gr_register_operand" "=r")
5165         (unspec:DI
5166          [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
5167                    (match_operand:SI 2 "basereg_operand" "r"))]
5168          UNSPEC_ADDP4))]
5169   "addp4_optimize_ok (operands[1], operands[2])"
5170   "addp4 %0 = %1, %2"
5171   [(set_attr "itanium_class" "ialu")])
5172
5173 ;;
5174 ;; Get instruction pointer
5175
5176 (define_insn "ip_value"
5177   [(set (match_operand:DI 0 "register_operand" "=r")
5178         (pc))]
5179  ""
5180  "mov %0 = ip"
5181   [(set_attr "itanium_class" "frbr")])
5182
5183 ;; Vector operations
5184 (include "vect.md")
5185 ;; Atomic operations
5186 (include "sync.md")
5187 ;; New division operations
5188 (include "div.md")