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