pa.md (movccfp): New expander.
[gcc.git] / gcc / config / pa / pa.md
1 ;;- Machine description for HP PA-RISC architecture for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
3 ;; 2002, 2003 Free Software Foundation, Inc.
4 ;; Contributed by the Center for Software Science at the University
5 ;; of Utah.
6
7 ;; This file is part of GNU CC.
8
9 ;; GNU CC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU CC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU CC; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;; This gcc Version 2 machine description is inspired by sparc.md and
25 ;; mips.md.
26
27 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
28
29 ;; Insn type. Used to default other attribute values.
30
31 ;; type "unary" insns have one input operand (1) and one output operand (0)
32 ;; type "binary" insns have two input operands (1,2) and one output (0)
33
34 (define_attr "type"
35 "move,unary,binary,shift,nullshift,compare,load,store,uncond_branch,branch,cbranch,fbranch,call,dyncall,fpload,fpstore,fpalu,fpcc,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,multi,milli,parallel_branch"
36 (const_string "binary"))
37
38 (define_attr "pa_combine_type"
39 "fmpy,faddsub,uncond_branch,addmove,none"
40 (const_string "none"))
41
42 ;; Processor type (for scheduling, not code generation) -- this attribute
43 ;; must exactly match the processor_type enumeration in pa.h.
44 ;;
45 ;; FIXME: Add 800 scheduling for completeness?
46
47 (define_attr "cpu" "700,7100,7100LC,7200,7300,8000" (const (symbol_ref "pa_cpu_attr")))
48
49 ;; Length (in # of bytes).
50 (define_attr "length" ""
51 (cond [(eq_attr "type" "load,fpload")
52 (if_then_else (match_operand 1 "symbolic_memory_operand" "")
53 (const_int 8) (const_int 4))
54
55 (eq_attr "type" "store,fpstore")
56 (if_then_else (match_operand 0 "symbolic_memory_operand" "")
57 (const_int 8) (const_int 4))
58
59 (eq_attr "type" "binary,shift,nullshift")
60 (if_then_else (match_operand 2 "arith_operand" "")
61 (const_int 4) (const_int 12))
62
63 (eq_attr "type" "move,unary,shift,nullshift")
64 (if_then_else (match_operand 1 "arith_operand" "")
65 (const_int 4) (const_int 8))]
66
67 (const_int 4)))
68
69 (define_asm_attributes
70 [(set_attr "length" "4")
71 (set_attr "type" "multi")])
72
73 ;; Attributes for instruction and branch scheduling
74
75 ;; For conditional branches.
76 (define_attr "in_branch_delay" "false,true"
77 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
78 (eq_attr "length" "4"))
79 (const_string "true")
80 (const_string "false")))
81
82 ;; Disallow instructions which use the FPU since they will tie up the FPU
83 ;; even if the instruction is nullified.
84 (define_attr "in_nullified_branch_delay" "false,true"
85 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch")
86 (eq_attr "length" "4"))
87 (const_string "true")
88 (const_string "false")))
89
90 ;; For calls and millicode calls. Allow unconditional branches in the
91 ;; delay slot.
92 (define_attr "in_call_delay" "false,true"
93 (cond [(and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
94 (eq_attr "length" "4"))
95 (const_string "true")
96 (eq_attr "type" "uncond_branch")
97 (if_then_else (ne (symbol_ref "TARGET_JUMP_IN_DELAY")
98 (const_int 0))
99 (const_string "true")
100 (const_string "false"))]
101 (const_string "false")))
102
103
104 ;; Call delay slot description.
105 (define_delay (eq_attr "type" "call")
106 [(eq_attr "in_call_delay" "true") (nil) (nil)])
107
108 ;; Millicode call delay slot description.
109 (define_delay (eq_attr "type" "milli")
110 [(eq_attr "in_call_delay" "true") (nil) (nil)])
111
112 ;; Return and other similar instructions.
113 (define_delay (eq_attr "type" "branch,parallel_branch")
114 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
115
116 ;; Floating point conditional branch delay slot description and
117 (define_delay (eq_attr "type" "fbranch")
118 [(eq_attr "in_branch_delay" "true")
119 (eq_attr "in_nullified_branch_delay" "true")
120 (nil)])
121
122 ;; Integer conditional branch delay slot description.
123 ;; Nullification of conditional branches on the PA is dependent on the
124 ;; direction of the branch. Forward branches nullify true and
125 ;; backward branches nullify false. If the direction is unknown
126 ;; then nullification is not allowed.
127 (define_delay (eq_attr "type" "cbranch")
128 [(eq_attr "in_branch_delay" "true")
129 (and (eq_attr "in_nullified_branch_delay" "true")
130 (attr_flag "forward"))
131 (and (eq_attr "in_nullified_branch_delay" "true")
132 (attr_flag "backward"))])
133
134 (define_delay (and (eq_attr "type" "uncond_branch")
135 (eq (symbol_ref "following_call (insn)")
136 (const_int 0)))
137 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
138
139 ;; Memory. Disregarding Cache misses, the Mustang memory times are:
140 ;; load: 2, fpload: 3
141 ;; store, fpstore: 3, no D-cache operations should be scheduled.
142
143 ;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
144 ;; Timings:
145 ;; Instruction Time Unit Minimum Distance (unit contention)
146 ;; fcpy 3 ALU 2
147 ;; fabs 3 ALU 2
148 ;; fadd 3 ALU 2
149 ;; fsub 3 ALU 2
150 ;; fcmp 3 ALU 2
151 ;; fcnv 3 ALU 2
152 ;; fmpyadd 3 ALU,MPY 2
153 ;; fmpysub 3 ALU,MPY 2
154 ;; fmpycfxt 3 ALU,MPY 2
155 ;; fmpy 3 MPY 2
156 ;; fmpyi 3 MPY 2
157 ;; fdiv,sgl 10 MPY 10
158 ;; fdiv,dbl 12 MPY 12
159 ;; fsqrt,sgl 14 MPY 14
160 ;; fsqrt,dbl 18 MPY 18
161 ;;
162 ;; We don't model fmpyadd/fmpysub properly as those instructions
163 ;; keep both the FP ALU and MPY units busy. Given that these
164 ;; processors are obsolete, I'm not going to spend the time to
165 ;; model those instructions correctly.
166
167 (define_automaton "pa700")
168 (define_cpu_unit "dummy_700,mem_700,fpalu_700,fpmpy_700" "pa700")
169
170 (define_insn_reservation "W0" 4
171 (and (eq_attr "type" "fpcc")
172 (eq_attr "cpu" "700"))
173 "fpalu_700*2")
174
175 (define_insn_reservation "W1" 3
176 (and (eq_attr "type" "fpalu")
177 (eq_attr "cpu" "700"))
178 "fpalu_700*2")
179
180 (define_insn_reservation "W2" 3
181 (and (eq_attr "type" "fpmulsgl,fpmuldbl")
182 (eq_attr "cpu" "700"))
183 "fpmpy_700*2")
184
185 (define_insn_reservation "W3" 10
186 (and (eq_attr "type" "fpdivsgl")
187 (eq_attr "cpu" "700"))
188 "fpmpy_700*10")
189
190 (define_insn_reservation "W4" 12
191 (and (eq_attr "type" "fpdivdbl")
192 (eq_attr "cpu" "700"))
193 "fpmpy_700*12")
194
195 (define_insn_reservation "W5" 14
196 (and (eq_attr "type" "fpsqrtsgl")
197 (eq_attr "cpu" "700"))
198 "fpmpy_700*14")
199
200 (define_insn_reservation "W6" 18
201 (and (eq_attr "type" "fpsqrtdbl")
202 (eq_attr "cpu" "700"))
203 "fpmpy_700*18")
204
205 (define_insn_reservation "W7" 2
206 (and (eq_attr "type" "load")
207 (eq_attr "cpu" "700"))
208 "mem_700")
209
210 (define_insn_reservation "W8" 2
211 (and (eq_attr "type" "fpload")
212 (eq_attr "cpu" "700"))
213 "mem_700")
214
215 (define_insn_reservation "W9" 3
216 (and (eq_attr "type" "store")
217 (eq_attr "cpu" "700"))
218 "mem_700*3")
219
220 (define_insn_reservation "W10" 3
221 (and (eq_attr "type" "fpstore")
222 (eq_attr "cpu" "700"))
223 "mem_700*3")
224
225 (define_insn_reservation "W11" 1
226 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,load,fpload,store,fpstore")
227 (eq_attr "cpu" "700"))
228 "dummy_700")
229
230 ;; We have a bypass for all computations in the FP unit which feed an
231 ;; FP store as long as the sizes are the same.
232 (define_bypass 2 "W1,W2" "W10" "hppa_fpstore_bypass_p")
233 (define_bypass 9 "W3" "W10" "hppa_fpstore_bypass_p")
234 (define_bypass 11 "W4" "W10" "hppa_fpstore_bypass_p")
235 (define_bypass 13 "W5" "W10" "hppa_fpstore_bypass_p")
236 (define_bypass 17 "W6" "W10" "hppa_fpstore_bypass_p")
237
238 ;; We have an "anti-bypass" for FP loads which feed an FP store.
239 (define_bypass 4 "W8" "W10" "hppa_fpstore_bypass_p")
240
241 ;; Function units for the 7100 and 7150. The 7100/7150 can dual-issue
242 ;; floating point computations with non-floating point computations (fp loads
243 ;; and stores are not fp computations).
244 ;;
245 ;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
246 ;; take two cycles, during which no Dcache operations should be scheduled.
247 ;; Any special cases are handled in pa_adjust_cost. The 7100, 7150 and 7100LC
248 ;; all have the same memory characteristics if one disregards cache misses.
249 ;;
250 ;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
251 ;; There's no value in modeling the ALU and MUL separately though
252 ;; since there can never be a functional unit conflict given the
253 ;; latency and issue rates for those units.
254 ;;
255 ;; Timings:
256 ;; Instruction Time Unit Minimum Distance (unit contention)
257 ;; fcpy 2 ALU 1
258 ;; fabs 2 ALU 1
259 ;; fadd 2 ALU 1
260 ;; fsub 2 ALU 1
261 ;; fcmp 2 ALU 1
262 ;; fcnv 2 ALU 1
263 ;; fmpyadd 2 ALU,MPY 1
264 ;; fmpysub 2 ALU,MPY 1
265 ;; fmpycfxt 2 ALU,MPY 1
266 ;; fmpy 2 MPY 1
267 ;; fmpyi 2 MPY 1
268 ;; fdiv,sgl 8 DIV 8
269 ;; fdiv,dbl 15 DIV 15
270 ;; fsqrt,sgl 8 DIV 8
271 ;; fsqrt,dbl 15 DIV 15
272
273 (define_automaton "pa7100")
274 (define_cpu_unit "i_7100, f_7100,fpmac_7100,fpdivsqrt_7100,mem_7100" "pa7100")
275
276 (define_insn_reservation "X0" 2
277 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
278 (eq_attr "cpu" "7100"))
279 "f_7100,fpmac_7100")
280
281 (define_insn_reservation "X1" 8
282 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
283 (eq_attr "cpu" "7100"))
284 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*7")
285
286 (define_insn_reservation "X2" 15
287 (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
288 (eq_attr "cpu" "7100"))
289 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*14")
290
291 (define_insn_reservation "X3" 2
292 (and (eq_attr "type" "load")
293 (eq_attr "cpu" "7100"))
294 "i_7100+mem_7100")
295
296 (define_insn_reservation "X4" 2
297 (and (eq_attr "type" "fpload")
298 (eq_attr "cpu" "7100"))
299 "i_7100+mem_7100")
300
301 (define_insn_reservation "X5" 2
302 (and (eq_attr "type" "store")
303 (eq_attr "cpu" "7100"))
304 "i_7100+mem_7100,mem_7100")
305
306 (define_insn_reservation "X6" 2
307 (and (eq_attr "type" "fpstore")
308 (eq_attr "cpu" "7100"))
309 "i_7100+mem_7100,mem_7100")
310
311 (define_insn_reservation "X7" 1
312 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore")
313 (eq_attr "cpu" "7100"))
314 "i_7100")
315
316 ;; We have a bypass for all computations in the FP unit which feed an
317 ;; FP store as long as the sizes are the same.
318 (define_bypass 1 "X0" "X6" "hppa_fpstore_bypass_p")
319 (define_bypass 7 "X1" "X6" "hppa_fpstore_bypass_p")
320 (define_bypass 14 "X2" "X6" "hppa_fpstore_bypass_p")
321
322 ;; We have an "anti-bypass" for FP loads which feed an FP store.
323 (define_bypass 3 "X4" "X6" "hppa_fpstore_bypass_p")
324
325 ;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
326 ;; There's no value in modeling the ALU and MUL separately though
327 ;; since there can never be a functional unit conflict that
328 ;; can be avoided given the latency, issue rates and mandatory
329 ;; one cycle cpu-wide lock for a double precision fp multiply.
330 ;;
331 ;; Timings:
332 ;; Instruction Time Unit Minimum Distance (unit contention)
333 ;; fcpy 2 ALU 1
334 ;; fabs 2 ALU 1
335 ;; fadd 2 ALU 1
336 ;; fsub 2 ALU 1
337 ;; fcmp 2 ALU 1
338 ;; fcnv 2 ALU 1
339 ;; fmpyadd,sgl 2 ALU,MPY 1
340 ;; fmpyadd,dbl 3 ALU,MPY 2
341 ;; fmpysub,sgl 2 ALU,MPY 1
342 ;; fmpysub,dbl 3 ALU,MPY 2
343 ;; fmpycfxt,sgl 2 ALU,MPY 1
344 ;; fmpycfxt,dbl 3 ALU,MPY 2
345 ;; fmpy,sgl 2 MPY 1
346 ;; fmpy,dbl 3 MPY 2
347 ;; fmpyi 3 MPY 2
348 ;; fdiv,sgl 8 DIV 8
349 ;; fdiv,dbl 15 DIV 15
350 ;; fsqrt,sgl 8 DIV 8
351 ;; fsqrt,dbl 15 DIV 15
352 ;;
353 ;; The PA7200 is just like the PA7100LC except that there is
354 ;; no store-store penalty.
355 ;;
356 ;; The PA7300 is just like the PA7200 except that there is
357 ;; no store-load penalty.
358 ;;
359 ;; Note there are some aspects of the 7100LC we are not modeling
360 ;; at the moment. I'll be reviewing the 7100LC scheduling info
361 ;; shortly and updating this description.
362 ;;
363 ;; load-load pairs
364 ;; store-store pairs
365 ;; other issue modeling
366
367 (define_automaton "pa7100lc")
368 (define_cpu_unit "i0_7100lc, i1_7100lc, f_7100lc" "pa7100lc")
369 (define_cpu_unit "fpmac_7100lc" "pa7100lc")
370 (define_cpu_unit "mem_7100lc" "pa7100lc")
371
372 ;; Double precision multiplies lock the entire CPU for one
373 ;; cycle. There is no way to avoid this lock and trying to
374 ;; schedule around the lock is pointless and thus there is no
375 ;; value in trying to model this lock.
376 ;;
377 ;; Not modeling the lock allows us to treat fp multiplies just
378 ;; like any other FP alu instruction. It allows for a smaller
379 ;; DFA and may reduce register pressure.
380 (define_insn_reservation "Y0" 2
381 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
382 (eq_attr "cpu" "7100LC,7200,7300"))
383 "f_7100lc,fpmac_7100lc")
384
385 ;; fp division and sqrt instructions lock the entire CPU for
386 ;; 7 cycles (single precision) or 14 cycles (double precision).
387 ;; There is no way to avoid this lock and trying to schedule
388 ;; around the lock is pointless and thus there is no value in
389 ;; trying to model this lock. Not modeling the lock allows
390 ;; for a smaller DFA and may reduce register pressure.
391 (define_insn_reservation "Y1" 1
392 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
393 (eq_attr "cpu" "7100LC,7200,7300"))
394 "f_7100lc")
395
396 (define_insn_reservation "Y2" 2
397 (and (eq_attr "type" "load")
398 (eq_attr "cpu" "7100LC,7200,7300"))
399 "i1_7100lc+mem_7100lc")
400
401 (define_insn_reservation "Y3" 2
402 (and (eq_attr "type" "fpload")
403 (eq_attr "cpu" "7100LC,7200,7300"))
404 "i1_7100lc+mem_7100lc")
405
406 (define_insn_reservation "Y4" 2
407 (and (eq_attr "type" "store")
408 (eq_attr "cpu" "7100LC"))
409 "i1_7100lc+mem_7100lc,mem_7100lc")
410
411 (define_insn_reservation "Y5" 2
412 (and (eq_attr "type" "fpstore")
413 (eq_attr "cpu" "7100LC"))
414 "i1_7100lc+mem_7100lc,mem_7100lc")
415
416 (define_insn_reservation "Y6" 1
417 (and (eq_attr "type" "shift,nullshift")
418 (eq_attr "cpu" "7100LC,7200,7300"))
419 "i1_7100lc")
420
421 (define_insn_reservation "Y7" 1
422 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
423 (eq_attr "cpu" "7100LC,7200,7300"))
424 "(i0_7100lc|i1_7100lc)")
425
426 ;; The 7200 has a store-load penalty
427 (define_insn_reservation "Y8" 2
428 (and (eq_attr "type" "store")
429 (eq_attr "cpu" "7200"))
430 "i1_7100lc,mem_7100lc")
431
432 (define_insn_reservation "Y9" 2
433 (and (eq_attr "type" "fpstore")
434 (eq_attr "cpu" "7200"))
435 "i1_7100lc,mem_7100lc")
436
437 ;; The 7300 has no penalty for store-store or store-load
438 (define_insn_reservation "Y10" 2
439 (and (eq_attr "type" "store")
440 (eq_attr "cpu" "7300"))
441 "i1_7100lc")
442
443 (define_insn_reservation "Y11" 2
444 (and (eq_attr "type" "fpstore")
445 (eq_attr "cpu" "7300"))
446 "i1_7100lc")
447
448 ;; We have an "anti-bypass" for FP loads which feed an FP store.
449 (define_bypass 3 "Y3" "Y5,Y9,Y11" "hppa_fpstore_bypass_p")
450
451 ;; Scheduling for the PA8000 is somewhat different than scheduling for a
452 ;; traditional architecture.
453 ;;
454 ;; The PA8000 has a large (56) entry reorder buffer that is split between
455 ;; memory and non-memory operations.
456 ;;
457 ;; The PA8000 can issue two memory and two non-memory operations per cycle to
458 ;; the function units, with the exception of branches and multi-output
459 ;; instructions. The PA8000 can retire two non-memory operations per cycle
460 ;; and two memory operations per cycle, only one of which may be a store.
461 ;;
462 ;; Given the large reorder buffer, the processor can hide most latencies.
463 ;; According to HP, they've got the best results by scheduling for retirement
464 ;; bandwidth with limited latency scheduling for floating point operations.
465 ;; Latency for integer operations and memory references is ignored.
466 ;;
467 ;;
468 ;; We claim floating point operations have a 2 cycle latency and are
469 ;; fully pipelined, except for div and sqrt which are not pipelined and
470 ;; take from 17 to 31 cycles to complete.
471 ;;
472 ;; It's worth noting that there is no way to saturate all the functional
473 ;; units on the PA8000 as there is not enough issue bandwidth.
474
475 (define_automaton "pa8000")
476 (define_cpu_unit "inm0_8000, inm1_8000, im0_8000, im1_8000" "pa8000")
477 (define_cpu_unit "rnm0_8000, rnm1_8000, rm0_8000, rm1_8000" "pa8000")
478 (define_cpu_unit "store_8000" "pa8000")
479 (define_cpu_unit "f0_8000, f1_8000" "pa8000")
480 (define_cpu_unit "fdivsqrt0_8000, fdivsqrt1_8000" "pa8000")
481 (define_reservation "inm_8000" "inm0_8000 | inm1_8000")
482 (define_reservation "im_8000" "im0_8000 | im1_8000")
483 (define_reservation "rnm_8000" "rnm0_8000 | rnm1_8000")
484 (define_reservation "rm_8000" "rm0_8000 | rm1_8000")
485 (define_reservation "f_8000" "f0_8000 | f1_8000")
486 (define_reservation "fdivsqrt_8000" "fdivsqrt0_8000 | fdivsqrt1_8000")
487
488 ;; We can issue any two memops per cycle, but we can only retire
489 ;; one memory store per cycle. We assume that the reorder buffer
490 ;; will hide any memory latencies per HP's recommendation.
491 (define_insn_reservation "Z0" 0
492 (and
493 (eq_attr "type" "load,fpload")
494 (eq_attr "cpu" "8000"))
495 "im_8000,rm_8000")
496
497 (define_insn_reservation "Z1" 0
498 (and
499 (eq_attr "type" "store,fpstore")
500 (eq_attr "cpu" "8000"))
501 "im_8000,rm_8000+store_8000")
502
503 ;; We can issue and retire two non-memory operations per cycle with
504 ;; a few exceptions (branches). This group catches those we want
505 ;; to assume have zero latency.
506 (define_insn_reservation "Z2" 0
507 (and
508 (eq_attr "type" "!load,fpload,store,fpstore,uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch,fpcc,fpalu,fpmulsgl,fpmuldbl,fpsqrtsgl,fpsqrtdbl,fpdivsgl,fpdivdbl")
509 (eq_attr "cpu" "8000"))
510 "inm_8000,rnm_8000")
511
512 ;; Branches use both slots in the non-memory issue and
513 ;; retirement unit.
514 (define_insn_reservation "Z3" 0
515 (and
516 (eq_attr "type" "uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
517 (eq_attr "cpu" "8000"))
518 "inm0_8000+inm1_8000,rnm0_8000+rnm1_8000")
519
520 ;; We partial latency schedule the floating point units.
521 ;; They can issue/retire two at a time in the non-memory
522 ;; units. We fix their latency at 2 cycles and they
523 ;; are fully pipelined.
524 (define_insn_reservation "Z4" 1
525 (and
526 (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
527 (eq_attr "cpu" "8000"))
528 "inm_8000,f_8000,rnm_8000")
529
530 ;; The fdivsqrt units are not pipelined and have a very long latency.
531 ;; To keep the DFA from exploding, we do not show all the
532 ;; reservations for the divsqrt unit.
533 (define_insn_reservation "Z5" 17
534 (and
535 (eq_attr "type" "fpdivsgl,fpsqrtsgl")
536 (eq_attr "cpu" "8000"))
537 "inm_8000,fdivsqrt_8000*6,rnm_8000")
538
539 (define_insn_reservation "Z6" 31
540 (and
541 (eq_attr "type" "fpdivdbl,fpsqrtdbl")
542 (eq_attr "cpu" "8000"))
543 "inm_8000,fdivsqrt_8000*6,rnm_8000")
544
545
546 \f
547 ;; Compare instructions.
548 ;; This controls RTL generation and register allocation.
549
550 ;; We generate RTL for comparisons and branches by having the cmpxx
551 ;; patterns store away the operands. Then, the scc and bcc patterns
552 ;; emit RTL for both the compare and the branch.
553 ;;
554
555 (define_expand "cmpdi"
556 [(set (reg:CC 0)
557 (compare:CC (match_operand:DI 0 "reg_or_0_operand" "")
558 (match_operand:DI 1 "register_operand" "")))]
559 "TARGET_64BIT"
560
561 "
562 {
563 hppa_compare_op0 = operands[0];
564 hppa_compare_op1 = operands[1];
565 hppa_branch_type = CMP_SI;
566 DONE;
567 }")
568
569 (define_expand "cmpsi"
570 [(set (reg:CC 0)
571 (compare:CC (match_operand:SI 0 "reg_or_0_operand" "")
572 (match_operand:SI 1 "arith5_operand" "")))]
573 ""
574 "
575 {
576 hppa_compare_op0 = operands[0];
577 hppa_compare_op1 = operands[1];
578 hppa_branch_type = CMP_SI;
579 DONE;
580 }")
581
582 (define_expand "cmpsf"
583 [(set (reg:CCFP 0)
584 (compare:CCFP (match_operand:SF 0 "reg_or_0_operand" "")
585 (match_operand:SF 1 "reg_or_0_operand" "")))]
586 "! TARGET_SOFT_FLOAT"
587 "
588 {
589 hppa_compare_op0 = operands[0];
590 hppa_compare_op1 = operands[1];
591 hppa_branch_type = CMP_SF;
592 DONE;
593 }")
594
595 (define_expand "cmpdf"
596 [(set (reg:CCFP 0)
597 (compare:CCFP (match_operand:DF 0 "reg_or_0_operand" "")
598 (match_operand:DF 1 "reg_or_0_operand" "")))]
599 "! TARGET_SOFT_FLOAT"
600 "
601 {
602 hppa_compare_op0 = operands[0];
603 hppa_compare_op1 = operands[1];
604 hppa_branch_type = CMP_DF;
605 DONE;
606 }")
607
608 (define_insn ""
609 [(set (reg:CCFP 0)
610 (match_operator:CCFP 2 "comparison_operator"
611 [(match_operand:SF 0 "reg_or_0_operand" "fG")
612 (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
613 "! TARGET_SOFT_FLOAT"
614 "fcmp,sgl,%Y2 %f0,%f1"
615 [(set_attr "length" "4")
616 (set_attr "type" "fpcc")])
617
618 (define_insn ""
619 [(set (reg:CCFP 0)
620 (match_operator:CCFP 2 "comparison_operator"
621 [(match_operand:DF 0 "reg_or_0_operand" "fG")
622 (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
623 "! TARGET_SOFT_FLOAT"
624 "fcmp,dbl,%Y2 %f0,%f1"
625 [(set_attr "length" "4")
626 (set_attr "type" "fpcc")])
627
628 ;; Provide a means to emit the movccfp0 and movccfp1 optimization
629 ;; placeholders. This is necessary in rare situations when a
630 ;; placeholder is re-emitted (see PR 8705).
631
632 (define_expand "movccfp"
633 [(set (reg:CCFP 0)
634 (match_operand 0 "const_int_operand" ""))]
635 "! TARGET_SOFT_FLOAT"
636 "
637 {
638 if ((unsigned HOST_WIDE_INT) INTVAL (operands[0]) > 1)
639 FAIL;
640 }")
641
642 ;; The following patterns are optimization placeholders. In almost
643 ;; all cases, the user of the condition code will be simplified and the
644 ;; original condition code setting insn should be eliminated.
645
646 (define_insn "*movccfp0"
647 [(set (reg:CCFP 0)
648 (const_int 0))]
649 "! TARGET_SOFT_FLOAT"
650 "fcmp,dbl,= %%fr0,%%fr0"
651 [(set_attr "length" "4")
652 (set_attr "type" "fpcc")])
653
654 (define_insn "*movccfp1"
655 [(set (reg:CCFP 0)
656 (const_int 1))]
657 "! TARGET_SOFT_FLOAT"
658 "fcmp,dbl,!= %%fr0,%%fr0"
659 [(set_attr "length" "4")
660 (set_attr "type" "fpcc")])
661
662 ;; scc insns.
663
664 (define_expand "seq"
665 [(set (match_operand:SI 0 "register_operand" "")
666 (eq:SI (match_dup 1)
667 (match_dup 2)))]
668 "!TARGET_64BIT"
669 "
670 {
671 /* fp scc patterns rarely match, and are not a win on the PA. */
672 if (hppa_branch_type != CMP_SI)
673 FAIL;
674 /* set up operands from compare. */
675 operands[1] = hppa_compare_op0;
676 operands[2] = hppa_compare_op1;
677 /* fall through and generate default code */
678 }")
679
680 (define_expand "sne"
681 [(set (match_operand:SI 0 "register_operand" "")
682 (ne:SI (match_dup 1)
683 (match_dup 2)))]
684 "!TARGET_64BIT"
685 "
686 {
687 /* fp scc patterns rarely match, and are not a win on the PA. */
688 if (hppa_branch_type != CMP_SI)
689 FAIL;
690 operands[1] = hppa_compare_op0;
691 operands[2] = hppa_compare_op1;
692 }")
693
694 (define_expand "slt"
695 [(set (match_operand:SI 0 "register_operand" "")
696 (lt:SI (match_dup 1)
697 (match_dup 2)))]
698 "!TARGET_64BIT"
699 "
700 {
701 /* fp scc patterns rarely match, and are not a win on the PA. */
702 if (hppa_branch_type != CMP_SI)
703 FAIL;
704 operands[1] = hppa_compare_op0;
705 operands[2] = hppa_compare_op1;
706 }")
707
708 (define_expand "sgt"
709 [(set (match_operand:SI 0 "register_operand" "")
710 (gt:SI (match_dup 1)
711 (match_dup 2)))]
712 "!TARGET_64BIT"
713 "
714 {
715 /* fp scc patterns rarely match, and are not a win on the PA. */
716 if (hppa_branch_type != CMP_SI)
717 FAIL;
718 operands[1] = hppa_compare_op0;
719 operands[2] = hppa_compare_op1;
720 }")
721
722 (define_expand "sle"
723 [(set (match_operand:SI 0 "register_operand" "")
724 (le:SI (match_dup 1)
725 (match_dup 2)))]
726 "!TARGET_64BIT"
727 "
728 {
729 /* fp scc patterns rarely match, and are not a win on the PA. */
730 if (hppa_branch_type != CMP_SI)
731 FAIL;
732 operands[1] = hppa_compare_op0;
733 operands[2] = hppa_compare_op1;
734 }")
735
736 (define_expand "sge"
737 [(set (match_operand:SI 0 "register_operand" "")
738 (ge:SI (match_dup 1)
739 (match_dup 2)))]
740 "!TARGET_64BIT"
741 "
742 {
743 /* fp scc patterns rarely match, and are not a win on the PA. */
744 if (hppa_branch_type != CMP_SI)
745 FAIL;
746 operands[1] = hppa_compare_op0;
747 operands[2] = hppa_compare_op1;
748 }")
749
750 (define_expand "sltu"
751 [(set (match_operand:SI 0 "register_operand" "")
752 (ltu:SI (match_dup 1)
753 (match_dup 2)))]
754 "!TARGET_64BIT"
755 "
756 {
757 if (hppa_branch_type != CMP_SI)
758 FAIL;
759 operands[1] = hppa_compare_op0;
760 operands[2] = hppa_compare_op1;
761 }")
762
763 (define_expand "sgtu"
764 [(set (match_operand:SI 0 "register_operand" "")
765 (gtu:SI (match_dup 1)
766 (match_dup 2)))]
767 "!TARGET_64BIT"
768 "
769 {
770 if (hppa_branch_type != CMP_SI)
771 FAIL;
772 operands[1] = hppa_compare_op0;
773 operands[2] = hppa_compare_op1;
774 }")
775
776 (define_expand "sleu"
777 [(set (match_operand:SI 0 "register_operand" "")
778 (leu:SI (match_dup 1)
779 (match_dup 2)))]
780 "!TARGET_64BIT"
781 "
782 {
783 if (hppa_branch_type != CMP_SI)
784 FAIL;
785 operands[1] = hppa_compare_op0;
786 operands[2] = hppa_compare_op1;
787 }")
788
789 (define_expand "sgeu"
790 [(set (match_operand:SI 0 "register_operand" "")
791 (geu:SI (match_dup 1)
792 (match_dup 2)))]
793 "!TARGET_64BIT"
794 "
795 {
796 if (hppa_branch_type != CMP_SI)
797 FAIL;
798 operands[1] = hppa_compare_op0;
799 operands[2] = hppa_compare_op1;
800 }")
801
802 ;; Instruction canonicalization puts immediate operands second, which
803 ;; is the reverse of what we want.
804
805 (define_insn "scc"
806 [(set (match_operand:SI 0 "register_operand" "=r")
807 (match_operator:SI 3 "comparison_operator"
808 [(match_operand:SI 1 "register_operand" "r")
809 (match_operand:SI 2 "arith11_operand" "rI")]))]
810 ""
811 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0"
812 [(set_attr "type" "binary")
813 (set_attr "length" "8")])
814
815 (define_insn ""
816 [(set (match_operand:DI 0 "register_operand" "=r")
817 (match_operator:DI 3 "comparison_operator"
818 [(match_operand:DI 1 "register_operand" "r")
819 (match_operand:DI 2 "arith11_operand" "rI")]))]
820 "TARGET_64BIT"
821 "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0"
822 [(set_attr "type" "binary")
823 (set_attr "length" "8")])
824
825 (define_insn "iorscc"
826 [(set (match_operand:SI 0 "register_operand" "=r")
827 (ior:SI (match_operator:SI 3 "comparison_operator"
828 [(match_operand:SI 1 "register_operand" "r")
829 (match_operand:SI 2 "arith11_operand" "rI")])
830 (match_operator:SI 6 "comparison_operator"
831 [(match_operand:SI 4 "register_operand" "r")
832 (match_operand:SI 5 "arith11_operand" "rI")])))]
833 ""
834 "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0"
835 [(set_attr "type" "binary")
836 (set_attr "length" "12")])
837
838 (define_insn ""
839 [(set (match_operand:DI 0 "register_operand" "=r")
840 (ior:DI (match_operator:DI 3 "comparison_operator"
841 [(match_operand:DI 1 "register_operand" "r")
842 (match_operand:DI 2 "arith11_operand" "rI")])
843 (match_operator:DI 6 "comparison_operator"
844 [(match_operand:DI 4 "register_operand" "r")
845 (match_operand:DI 5 "arith11_operand" "rI")])))]
846 "TARGET_64BIT"
847 "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0"
848 [(set_attr "type" "binary")
849 (set_attr "length" "12")])
850
851 ;; Combiner patterns for common operations performed with the output
852 ;; from an scc insn (negscc and incscc).
853 (define_insn "negscc"
854 [(set (match_operand:SI 0 "register_operand" "=r")
855 (neg:SI (match_operator:SI 3 "comparison_operator"
856 [(match_operand:SI 1 "register_operand" "r")
857 (match_operand:SI 2 "arith11_operand" "rI")])))]
858 ""
859 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0"
860 [(set_attr "type" "binary")
861 (set_attr "length" "8")])
862
863 (define_insn ""
864 [(set (match_operand:DI 0 "register_operand" "=r")
865 (neg:DI (match_operator:DI 3 "comparison_operator"
866 [(match_operand:DI 1 "register_operand" "r")
867 (match_operand:DI 2 "arith11_operand" "rI")])))]
868 "TARGET_64BIT"
869 "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0"
870 [(set_attr "type" "binary")
871 (set_attr "length" "8")])
872
873 ;; Patterns for adding/subtracting the result of a boolean expression from
874 ;; a register. First we have special patterns that make use of the carry
875 ;; bit, and output only two instructions. For the cases we can't in
876 ;; general do in two instructions, the incscc pattern at the end outputs
877 ;; two or three instructions.
878
879 (define_insn ""
880 [(set (match_operand:SI 0 "register_operand" "=r")
881 (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
882 (match_operand:SI 3 "arith11_operand" "rI"))
883 (match_operand:SI 1 "register_operand" "r")))]
884 ""
885 "sub%I3 %3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
886 [(set_attr "type" "binary")
887 (set_attr "length" "8")])
888
889 (define_insn ""
890 [(set (match_operand:DI 0 "register_operand" "=r")
891 (plus:DI (leu:DI (match_operand:DI 2 "register_operand" "r")
892 (match_operand:DI 3 "arith11_operand" "rI"))
893 (match_operand:DI 1 "register_operand" "r")))]
894 "TARGET_64BIT"
895 "sub%I3 %3,%2,%%r0\;add,dc %%r0,%1,%0"
896 [(set_attr "type" "binary")
897 (set_attr "length" "8")])
898
899 ; This need only accept registers for op3, since canonicalization
900 ; replaces geu with gtu when op3 is an integer.
901 (define_insn ""
902 [(set (match_operand:SI 0 "register_operand" "=r")
903 (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
904 (match_operand:SI 3 "register_operand" "r"))
905 (match_operand:SI 1 "register_operand" "r")))]
906 ""
907 "sub %2,%3,%%r0\;{addc|add,c} %%r0,%1,%0"
908 [(set_attr "type" "binary")
909 (set_attr "length" "8")])
910
911 (define_insn ""
912 [(set (match_operand:DI 0 "register_operand" "=r")
913 (plus:DI (geu:DI (match_operand:DI 2 "register_operand" "r")
914 (match_operand:DI 3 "register_operand" "r"))
915 (match_operand:DI 1 "register_operand" "r")))]
916 "TARGET_64BIT"
917 "sub %2,%3,%%r0\;add,dc %%r0,%1,%0"
918 [(set_attr "type" "binary")
919 (set_attr "length" "8")])
920
921 ; Match only integers for op3 here. This is used as canonical form of the
922 ; geu pattern when op3 is an integer. Don't match registers since we can't
923 ; make better code than the general incscc pattern.
924 (define_insn ""
925 [(set (match_operand:SI 0 "register_operand" "=r")
926 (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
927 (match_operand:SI 3 "int11_operand" "I"))
928 (match_operand:SI 1 "register_operand" "r")))]
929 ""
930 "addi %k3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
931 [(set_attr "type" "binary")
932 (set_attr "length" "8")])
933
934 (define_insn ""
935 [(set (match_operand:DI 0 "register_operand" "=r")
936 (plus:DI (gtu:DI (match_operand:DI 2 "register_operand" "r")
937 (match_operand:DI 3 "int11_operand" "I"))
938 (match_operand:DI 1 "register_operand" "r")))]
939 "TARGET_64BIT"
940 "addi %k3,%2,%%r0\;add,dc %%r0,%1,%0"
941 [(set_attr "type" "binary")
942 (set_attr "length" "8")])
943
944 (define_insn "incscc"
945 [(set (match_operand:SI 0 "register_operand" "=r,r")
946 (plus:SI (match_operator:SI 4 "comparison_operator"
947 [(match_operand:SI 2 "register_operand" "r,r")
948 (match_operand:SI 3 "arith11_operand" "rI,rI")])
949 (match_operand:SI 1 "register_operand" "0,?r")))]
950 ""
951 "@
952 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi 1,%0,%0
953 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
954 [(set_attr "type" "binary,binary")
955 (set_attr "length" "8,12")])
956
957 (define_insn ""
958 [(set (match_operand:DI 0 "register_operand" "=r,r")
959 (plus:DI (match_operator:DI 4 "comparison_operator"
960 [(match_operand:DI 2 "register_operand" "r,r")
961 (match_operand:DI 3 "arith11_operand" "rI,rI")])
962 (match_operand:DI 1 "register_operand" "0,?r")))]
963 "TARGET_64BIT"
964 "@
965 cmp%I3clr,*%B4 %3,%2,%%r0\;addi 1,%0,%0
966 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
967 [(set_attr "type" "binary,binary")
968 (set_attr "length" "8,12")])
969
970 (define_insn ""
971 [(set (match_operand:SI 0 "register_operand" "=r")
972 (minus:SI (match_operand:SI 1 "register_operand" "r")
973 (gtu:SI (match_operand:SI 2 "register_operand" "r")
974 (match_operand:SI 3 "arith11_operand" "rI"))))]
975 ""
976 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
977 [(set_attr "type" "binary")
978 (set_attr "length" "8")])
979
980 (define_insn ""
981 [(set (match_operand:DI 0 "register_operand" "=r")
982 (minus:DI (match_operand:DI 1 "register_operand" "r")
983 (gtu:DI (match_operand:DI 2 "register_operand" "r")
984 (match_operand:DI 3 "arith11_operand" "rI"))))]
985 "TARGET_64BIT"
986 "sub%I3 %3,%2,%%r0\;sub,db %1,%%r0,%0"
987 [(set_attr "type" "binary")
988 (set_attr "length" "8")])
989
990 (define_insn ""
991 [(set (match_operand:SI 0 "register_operand" "=r")
992 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
993 (gtu:SI (match_operand:SI 2 "register_operand" "r")
994 (match_operand:SI 3 "arith11_operand" "rI")))
995 (match_operand:SI 4 "register_operand" "r")))]
996 ""
997 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
998 [(set_attr "type" "binary")
999 (set_attr "length" "8")])
1000
1001 (define_insn ""
1002 [(set (match_operand:DI 0 "register_operand" "=r")
1003 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1004 (gtu:DI (match_operand:DI 2 "register_operand" "r")
1005 (match_operand:DI 3 "arith11_operand" "rI")))
1006 (match_operand:DI 4 "register_operand" "r")))]
1007 "TARGET_64BIT"
1008 "sub%I3 %3,%2,%%r0\;sub,db %1,%4,%0"
1009 [(set_attr "type" "binary")
1010 (set_attr "length" "8")])
1011
1012 ; This need only accept registers for op3, since canonicalization
1013 ; replaces ltu with leu when op3 is an integer.
1014 (define_insn ""
1015 [(set (match_operand:SI 0 "register_operand" "=r")
1016 (minus:SI (match_operand:SI 1 "register_operand" "r")
1017 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1018 (match_operand:SI 3 "register_operand" "r"))))]
1019 ""
1020 "sub %2,%3,%%r0\;{subb|sub,b} %1,%%r0,%0"
1021 [(set_attr "type" "binary")
1022 (set_attr "length" "8")])
1023
1024 (define_insn ""
1025 [(set (match_operand:DI 0 "register_operand" "=r")
1026 (minus:DI (match_operand:DI 1 "register_operand" "r")
1027 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1028 (match_operand:DI 3 "register_operand" "r"))))]
1029 "TARGET_64BIT"
1030 "sub %2,%3,%%r0\;sub,db %1,%%r0,%0"
1031 [(set_attr "type" "binary")
1032 (set_attr "length" "8")])
1033
1034 (define_insn ""
1035 [(set (match_operand:SI 0 "register_operand" "=r")
1036 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1037 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1038 (match_operand:SI 3 "register_operand" "r")))
1039 (match_operand:SI 4 "register_operand" "r")))]
1040 ""
1041 "sub %2,%3,%%r0\;{subb|sub,b} %1,%4,%0"
1042 [(set_attr "type" "binary")
1043 (set_attr "length" "8")])
1044
1045 (define_insn ""
1046 [(set (match_operand:DI 0 "register_operand" "=r")
1047 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1048 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1049 (match_operand:DI 3 "register_operand" "r")))
1050 (match_operand:DI 4 "register_operand" "r")))]
1051 "TARGET_64BIT"
1052 "sub %2,%3,%%r0\;sub,db %1,%4,%0"
1053 [(set_attr "type" "binary")
1054 (set_attr "length" "8")])
1055
1056 ; Match only integers for op3 here. This is used as canonical form of the
1057 ; ltu pattern when op3 is an integer. Don't match registers since we can't
1058 ; make better code than the general incscc pattern.
1059 (define_insn ""
1060 [(set (match_operand:SI 0 "register_operand" "=r")
1061 (minus:SI (match_operand:SI 1 "register_operand" "r")
1062 (leu:SI (match_operand:SI 2 "register_operand" "r")
1063 (match_operand:SI 3 "int11_operand" "I"))))]
1064 ""
1065 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1066 [(set_attr "type" "binary")
1067 (set_attr "length" "8")])
1068
1069 (define_insn ""
1070 [(set (match_operand:DI 0 "register_operand" "=r")
1071 (minus:DI (match_operand:DI 1 "register_operand" "r")
1072 (leu:DI (match_operand:DI 2 "register_operand" "r")
1073 (match_operand:DI 3 "int11_operand" "I"))))]
1074 "TARGET_64BIT"
1075 "addi %k3,%2,%%r0\;sub,db %1,%%r0,%0"
1076 [(set_attr "type" "binary")
1077 (set_attr "length" "8")])
1078
1079 (define_insn ""
1080 [(set (match_operand:SI 0 "register_operand" "=r")
1081 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1082 (leu:SI (match_operand:SI 2 "register_operand" "r")
1083 (match_operand:SI 3 "int11_operand" "I")))
1084 (match_operand:SI 4 "register_operand" "r")))]
1085 ""
1086 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1087 [(set_attr "type" "binary")
1088 (set_attr "length" "8")])
1089
1090 (define_insn ""
1091 [(set (match_operand:DI 0 "register_operand" "=r")
1092 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1093 (leu:DI (match_operand:DI 2 "register_operand" "r")
1094 (match_operand:DI 3 "int11_operand" "I")))
1095 (match_operand:DI 4 "register_operand" "r")))]
1096 "TARGET_64BIT"
1097 "addi %k3,%2,%%r0\;sub,db %1,%4,%0"
1098 [(set_attr "type" "binary")
1099 (set_attr "length" "8")])
1100
1101 (define_insn "decscc"
1102 [(set (match_operand:SI 0 "register_operand" "=r,r")
1103 (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
1104 (match_operator:SI 4 "comparison_operator"
1105 [(match_operand:SI 2 "register_operand" "r,r")
1106 (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
1107 ""
1108 "@
1109 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi -1,%0,%0
1110 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1111 [(set_attr "type" "binary,binary")
1112 (set_attr "length" "8,12")])
1113
1114 (define_insn ""
1115 [(set (match_operand:DI 0 "register_operand" "=r,r")
1116 (minus:DI (match_operand:DI 1 "register_operand" "0,?r")
1117 (match_operator:DI 4 "comparison_operator"
1118 [(match_operand:DI 2 "register_operand" "r,r")
1119 (match_operand:DI 3 "arith11_operand" "rI,rI")])))]
1120 "TARGET_64BIT"
1121 "@
1122 cmp%I3clr,*%B4 %3,%2,%%r0\;addi -1,%0,%0
1123 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1124 [(set_attr "type" "binary,binary")
1125 (set_attr "length" "8,12")])
1126
1127 ; Patterns for max and min. (There is no need for an earlyclobber in the
1128 ; last alternative since the middle alternative will match if op0 == op1.)
1129
1130 (define_insn "sminsi3"
1131 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1132 (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1133 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1134 ""
1135 "@
1136 {comclr|cmpclr},> %2,%0,%%r0\;copy %2,%0
1137 {comiclr|cmpiclr},> %2,%0,%%r0\;ldi %2,%0
1138 {comclr|cmpclr},> %1,%r2,%0\;copy %1,%0"
1139 [(set_attr "type" "multi,multi,multi")
1140 (set_attr "length" "8,8,8")])
1141
1142 (define_insn "smindi3"
1143 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1144 (smin:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1145 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1146 "TARGET_64BIT"
1147 "@
1148 cmpclr,*> %2,%0,%%r0\;copy %2,%0
1149 cmpiclr,*> %2,%0,%%r0\;ldi %2,%0
1150 cmpclr,*> %1,%r2,%0\;copy %1,%0"
1151 [(set_attr "type" "multi,multi,multi")
1152 (set_attr "length" "8,8,8")])
1153
1154 (define_insn "uminsi3"
1155 [(set (match_operand:SI 0 "register_operand" "=r,r")
1156 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
1157 (match_operand:SI 2 "arith11_operand" "r,I")))]
1158 ""
1159 "@
1160 {comclr|cmpclr},>> %2,%0,%%r0\;copy %2,%0
1161 {comiclr|cmpiclr},>> %2,%0,%%r0\;ldi %2,%0"
1162 [(set_attr "type" "multi,multi")
1163 (set_attr "length" "8,8")])
1164
1165 (define_insn "umindi3"
1166 [(set (match_operand:DI 0 "register_operand" "=r,r")
1167 (umin:DI (match_operand:DI 1 "register_operand" "%0,0")
1168 (match_operand:DI 2 "arith11_operand" "r,I")))]
1169 "TARGET_64BIT"
1170 "@
1171 cmpclr,*>> %2,%0,%%r0\;copy %2,%0
1172 cmpiclr,*>> %2,%0,%%r0\;ldi %2,%0"
1173 [(set_attr "type" "multi,multi")
1174 (set_attr "length" "8,8")])
1175
1176 (define_insn "smaxsi3"
1177 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1178 (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1179 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1180 ""
1181 "@
1182 {comclr|cmpclr},< %2,%0,%%r0\;copy %2,%0
1183 {comiclr|cmpiclr},< %2,%0,%%r0\;ldi %2,%0
1184 {comclr|cmpclr},< %1,%r2,%0\;copy %1,%0"
1185 [(set_attr "type" "multi,multi,multi")
1186 (set_attr "length" "8,8,8")])
1187
1188 (define_insn "smaxdi3"
1189 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1190 (smax:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1191 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1192 "TARGET_64BIT"
1193 "@
1194 cmpclr,*< %2,%0,%%r0\;copy %2,%0
1195 cmpiclr,*< %2,%0,%%r0\;ldi %2,%0
1196 cmpclr,*< %1,%r2,%0\;copy %1,%0"
1197 [(set_attr "type" "multi,multi,multi")
1198 (set_attr "length" "8,8,8")])
1199
1200 (define_insn "umaxsi3"
1201 [(set (match_operand:SI 0 "register_operand" "=r,r")
1202 (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
1203 (match_operand:SI 2 "arith11_operand" "r,I")))]
1204 ""
1205 "@
1206 {comclr|cmpclr},<< %2,%0,%%r0\;copy %2,%0
1207 {comiclr|cmpiclr},<< %2,%0,%%r0\;ldi %2,%0"
1208 [(set_attr "type" "multi,multi")
1209 (set_attr "length" "8,8")])
1210
1211 (define_insn "umaxdi3"
1212 [(set (match_operand:DI 0 "register_operand" "=r,r")
1213 (umax:DI (match_operand:DI 1 "register_operand" "%0,0")
1214 (match_operand:DI 2 "arith11_operand" "r,I")))]
1215 "TARGET_64BIT"
1216 "@
1217 cmpclr,*<< %2,%0,%%r0\;copy %2,%0
1218 cmpiclr,*<< %2,%0,%%r0\;ldi %2,%0"
1219 [(set_attr "type" "multi,multi")
1220 (set_attr "length" "8,8")])
1221
1222 (define_insn "abssi2"
1223 [(set (match_operand:SI 0 "register_operand" "=r")
1224 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1225 ""
1226 "or,>= %%r0,%1,%0\;subi 0,%0,%0"
1227 [(set_attr "type" "multi")
1228 (set_attr "length" "8")])
1229
1230 (define_insn "absdi2"
1231 [(set (match_operand:DI 0 "register_operand" "=r")
1232 (abs:DI (match_operand:DI 1 "register_operand" "r")))]
1233 "TARGET_64BIT"
1234 "or,*>= %%r0,%1,%0\;subi 0,%0,%0"
1235 [(set_attr "type" "multi")
1236 (set_attr "length" "8")])
1237
1238 ;;; Experimental conditional move patterns
1239
1240 (define_expand "movsicc"
1241 [(set (match_operand:SI 0 "register_operand" "")
1242 (if_then_else:SI
1243 (match_operator 1 "comparison_operator"
1244 [(match_dup 4)
1245 (match_dup 5)])
1246 (match_operand:SI 2 "reg_or_cint_move_operand" "")
1247 (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
1248 ""
1249 "
1250 {
1251 enum rtx_code code = GET_CODE (operands[1]);
1252
1253 if (hppa_branch_type != CMP_SI)
1254 FAIL;
1255
1256 if (GET_MODE (hppa_compare_op0) != GET_MODE (hppa_compare_op1)
1257 || GET_MODE (hppa_compare_op0) != GET_MODE (operands[0]))
1258 FAIL;
1259
1260 /* operands[1] is currently the result of compare_from_rtx. We want to
1261 emit a compare of the original operands. */
1262 operands[1] = gen_rtx_fmt_ee (code, SImode, hppa_compare_op0, hppa_compare_op1);
1263 operands[4] = hppa_compare_op0;
1264 operands[5] = hppa_compare_op1;
1265 }")
1266
1267 ;; We used to accept any register for op1.
1268 ;;
1269 ;; However, it loses sometimes because the compiler will end up using
1270 ;; different registers for op0 and op1 in some critical cases. local-alloc
1271 ;; will not tie op0 and op1 because op0 is used in multiple basic blocks.
1272 ;;
1273 ;; If/when global register allocation supports tying we should allow any
1274 ;; register for op1 again.
1275 (define_insn ""
1276 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1277 (if_then_else:SI
1278 (match_operator 2 "comparison_operator"
1279 [(match_operand:SI 3 "register_operand" "r,r,r,r")
1280 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI")])
1281 (match_operand:SI 1 "reg_or_cint_move_operand" "0,J,N,K")
1282 (const_int 0)))]
1283 ""
1284 "@
1285 {com%I4clr|cmp%I4clr},%S2 %4,%3,%%r0\;ldi 0,%0
1286 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldi %1,%0
1287 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldil L'%1,%0
1288 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;{zdepi|depwi,z} %Z1,%0"
1289 [(set_attr "type" "multi,multi,multi,nullshift")
1290 (set_attr "length" "8,8,8,8")])
1291
1292 (define_insn ""
1293 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1294 (if_then_else:SI
1295 (match_operator 5 "comparison_operator"
1296 [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
1297 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1298 (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1299 (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1300 ""
1301 "@
1302 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;copy %2,%0
1303 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldi %2,%0
1304 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldil L'%2,%0
1305 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;{zdepi|depwi,z} %Z2,%0
1306 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;copy %1,%0
1307 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldi %1,%0
1308 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldil L'%1,%0
1309 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;{zdepi|depwi,z} %Z1,%0"
1310 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1311 (set_attr "length" "8,8,8,8,8,8,8,8")])
1312
1313 (define_expand "movdicc"
1314 [(set (match_operand:DI 0 "register_operand" "")
1315 (if_then_else:DI
1316 (match_operator 1 "comparison_operator"
1317 [(match_dup 4)
1318 (match_dup 5)])
1319 (match_operand:DI 2 "reg_or_cint_move_operand" "")
1320 (match_operand:DI 3 "reg_or_cint_move_operand" "")))]
1321 "TARGET_64BIT"
1322 "
1323 {
1324 enum rtx_code code = GET_CODE (operands[1]);
1325
1326 if (hppa_branch_type != CMP_SI)
1327 FAIL;
1328
1329 if (GET_MODE (hppa_compare_op0) != GET_MODE (hppa_compare_op1)
1330 || GET_MODE (hppa_compare_op0) != GET_MODE (operands[0]))
1331 FAIL;
1332
1333 /* operands[1] is currently the result of compare_from_rtx. We want to
1334 emit a compare of the original operands. */
1335 operands[1] = gen_rtx_fmt_ee (code, DImode, hppa_compare_op0, hppa_compare_op1);
1336 operands[4] = hppa_compare_op0;
1337 operands[5] = hppa_compare_op1;
1338 }")
1339
1340 ; We need the first constraint alternative in order to avoid
1341 ; earlyclobbers on all other alternatives.
1342 (define_insn ""
1343 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1344 (if_then_else:DI
1345 (match_operator 2 "comparison_operator"
1346 [(match_operand:DI 3 "register_operand" "r,r,r,r,r")
1347 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
1348 (match_operand:DI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
1349 (const_int 0)))]
1350 "TARGET_64BIT"
1351 "@
1352 cmp%I4clr,*%S2 %4,%3,%%r0\;ldi 0,%0
1353 cmp%I4clr,*%B2 %4,%3,%0\;copy %1,%0
1354 cmp%I4clr,*%B2 %4,%3,%0\;ldi %1,%0
1355 cmp%I4clr,*%B2 %4,%3,%0\;ldil L'%1,%0
1356 cmp%I4clr,*%B2 %4,%3,%0\;depdi,z %z1,%0"
1357 [(set_attr "type" "multi,multi,multi,multi,nullshift")
1358 (set_attr "length" "8,8,8,8,8")])
1359
1360 (define_insn ""
1361 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1362 (if_then_else:DI
1363 (match_operator 5 "comparison_operator"
1364 [(match_operand:DI 3 "register_operand" "r,r,r,r,r,r,r,r")
1365 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1366 (match_operand:DI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1367 (match_operand:DI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1368 "TARGET_64BIT"
1369 "@
1370 cmp%I4clr,*%S5 %4,%3,%%r0\;copy %2,%0
1371 cmp%I4clr,*%S5 %4,%3,%%r0\;ldi %2,%0
1372 cmp%I4clr,*%S5 %4,%3,%%r0\;ldil L'%2,%0
1373 cmp%I4clr,*%S5 %4,%3,%%r0\;depdi,z %z2,%0
1374 cmp%I4clr,*%B5 %4,%3,%%r0\;copy %1,%0
1375 cmp%I4clr,*%B5 %4,%3,%%r0\;ldi %1,%0
1376 cmp%I4clr,*%B5 %4,%3,%%r0\;ldil L'%1,%0
1377 cmp%I4clr,*%B5 %4,%3,%%r0\;depdi,z %z1,%0"
1378 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1379 (set_attr "length" "8,8,8,8,8,8,8,8")])
1380
1381 ;; Conditional Branches
1382
1383 (define_expand "beq"
1384 [(set (pc)
1385 (if_then_else (eq (match_dup 1) (match_dup 2))
1386 (label_ref (match_operand 0 "" ""))
1387 (pc)))]
1388 ""
1389 "
1390 {
1391 if (hppa_branch_type != CMP_SI)
1392 {
1393 emit_insn (gen_cmp_fp (EQ, hppa_compare_op0, hppa_compare_op1));
1394 emit_bcond_fp (NE, operands[0]);
1395 DONE;
1396 }
1397 /* set up operands from compare. */
1398 operands[1] = hppa_compare_op0;
1399 operands[2] = hppa_compare_op1;
1400 /* fall through and generate default code */
1401 }")
1402
1403 (define_expand "bne"
1404 [(set (pc)
1405 (if_then_else (ne (match_dup 1) (match_dup 2))
1406 (label_ref (match_operand 0 "" ""))
1407 (pc)))]
1408 ""
1409 "
1410 {
1411 if (hppa_branch_type != CMP_SI)
1412 {
1413 emit_insn (gen_cmp_fp (NE, hppa_compare_op0, hppa_compare_op1));
1414 emit_bcond_fp (NE, operands[0]);
1415 DONE;
1416 }
1417 operands[1] = hppa_compare_op0;
1418 operands[2] = hppa_compare_op1;
1419 }")
1420
1421 (define_expand "bgt"
1422 [(set (pc)
1423 (if_then_else (gt (match_dup 1) (match_dup 2))
1424 (label_ref (match_operand 0 "" ""))
1425 (pc)))]
1426 ""
1427 "
1428 {
1429 if (hppa_branch_type != CMP_SI)
1430 {
1431 emit_insn (gen_cmp_fp (GT, hppa_compare_op0, hppa_compare_op1));
1432 emit_bcond_fp (NE, operands[0]);
1433 DONE;
1434 }
1435 operands[1] = hppa_compare_op0;
1436 operands[2] = hppa_compare_op1;
1437 }")
1438
1439 (define_expand "blt"
1440 [(set (pc)
1441 (if_then_else (lt (match_dup 1) (match_dup 2))
1442 (label_ref (match_operand 0 "" ""))
1443 (pc)))]
1444 ""
1445 "
1446 {
1447 if (hppa_branch_type != CMP_SI)
1448 {
1449 emit_insn (gen_cmp_fp (LT, hppa_compare_op0, hppa_compare_op1));
1450 emit_bcond_fp (NE, operands[0]);
1451 DONE;
1452 }
1453 operands[1] = hppa_compare_op0;
1454 operands[2] = hppa_compare_op1;
1455 }")
1456
1457 (define_expand "bge"
1458 [(set (pc)
1459 (if_then_else (ge (match_dup 1) (match_dup 2))
1460 (label_ref (match_operand 0 "" ""))
1461 (pc)))]
1462 ""
1463 "
1464 {
1465 if (hppa_branch_type != CMP_SI)
1466 {
1467 emit_insn (gen_cmp_fp (GE, hppa_compare_op0, hppa_compare_op1));
1468 emit_bcond_fp (NE, operands[0]);
1469 DONE;
1470 }
1471 operands[1] = hppa_compare_op0;
1472 operands[2] = hppa_compare_op1;
1473 }")
1474
1475 (define_expand "ble"
1476 [(set (pc)
1477 (if_then_else (le (match_dup 1) (match_dup 2))
1478 (label_ref (match_operand 0 "" ""))
1479 (pc)))]
1480 ""
1481 "
1482 {
1483 if (hppa_branch_type != CMP_SI)
1484 {
1485 emit_insn (gen_cmp_fp (LE, hppa_compare_op0, hppa_compare_op1));
1486 emit_bcond_fp (NE, operands[0]);
1487 DONE;
1488 }
1489 operands[1] = hppa_compare_op0;
1490 operands[2] = hppa_compare_op1;
1491 }")
1492
1493 (define_expand "bgtu"
1494 [(set (pc)
1495 (if_then_else (gtu (match_dup 1) (match_dup 2))
1496 (label_ref (match_operand 0 "" ""))
1497 (pc)))]
1498 ""
1499 "
1500 {
1501 if (hppa_branch_type != CMP_SI)
1502 FAIL;
1503 operands[1] = hppa_compare_op0;
1504 operands[2] = hppa_compare_op1;
1505 }")
1506
1507 (define_expand "bltu"
1508 [(set (pc)
1509 (if_then_else (ltu (match_dup 1) (match_dup 2))
1510 (label_ref (match_operand 0 "" ""))
1511 (pc)))]
1512 ""
1513 "
1514 {
1515 if (hppa_branch_type != CMP_SI)
1516 FAIL;
1517 operands[1] = hppa_compare_op0;
1518 operands[2] = hppa_compare_op1;
1519 }")
1520
1521 (define_expand "bgeu"
1522 [(set (pc)
1523 (if_then_else (geu (match_dup 1) (match_dup 2))
1524 (label_ref (match_operand 0 "" ""))
1525 (pc)))]
1526 ""
1527 "
1528 {
1529 if (hppa_branch_type != CMP_SI)
1530 FAIL;
1531 operands[1] = hppa_compare_op0;
1532 operands[2] = hppa_compare_op1;
1533 }")
1534
1535 (define_expand "bleu"
1536 [(set (pc)
1537 (if_then_else (leu (match_dup 1) (match_dup 2))
1538 (label_ref (match_operand 0 "" ""))
1539 (pc)))]
1540 ""
1541 "
1542 {
1543 if (hppa_branch_type != CMP_SI)
1544 FAIL;
1545 operands[1] = hppa_compare_op0;
1546 operands[2] = hppa_compare_op1;
1547 }")
1548
1549 (define_expand "bltgt"
1550 [(set (pc)
1551 (if_then_else (ltgt (match_dup 1) (match_dup 2))
1552 (label_ref (match_operand 0 "" ""))
1553 (pc)))]
1554 ""
1555 "
1556 {
1557 if (hppa_branch_type == CMP_SI)
1558 FAIL;
1559 emit_insn (gen_cmp_fp (LTGT, hppa_compare_op0, hppa_compare_op1));
1560 emit_bcond_fp (NE, operands[0]);
1561 DONE;
1562 }")
1563
1564 (define_expand "bunle"
1565 [(set (pc)
1566 (if_then_else (unle (match_dup 1) (match_dup 2))
1567 (label_ref (match_operand 0 "" ""))
1568 (pc)))]
1569 ""
1570 "
1571 {
1572 if (hppa_branch_type == CMP_SI)
1573 FAIL;
1574 emit_insn (gen_cmp_fp (UNLE, hppa_compare_op0, hppa_compare_op1));
1575 emit_bcond_fp (NE, operands[0]);
1576 DONE;
1577 }")
1578
1579 (define_expand "bunlt"
1580 [(set (pc)
1581 (if_then_else (unlt (match_dup 1) (match_dup 2))
1582 (label_ref (match_operand 0 "" ""))
1583 (pc)))]
1584 ""
1585 "
1586 {
1587 if (hppa_branch_type == CMP_SI)
1588 FAIL;
1589 emit_insn (gen_cmp_fp (UNLT, hppa_compare_op0, hppa_compare_op1));
1590 emit_bcond_fp (NE, operands[0]);
1591 DONE;
1592 }")
1593
1594 (define_expand "bunge"
1595 [(set (pc)
1596 (if_then_else (unge (match_dup 1) (match_dup 2))
1597 (label_ref (match_operand 0 "" ""))
1598 (pc)))]
1599 ""
1600 "
1601 {
1602 if (hppa_branch_type == CMP_SI)
1603 FAIL;
1604 emit_insn (gen_cmp_fp (UNGE, hppa_compare_op0, hppa_compare_op1));
1605 emit_bcond_fp (NE, operands[0]);
1606 DONE;
1607 }")
1608
1609 (define_expand "bungt"
1610 [(set (pc)
1611 (if_then_else (ungt (match_dup 1) (match_dup 2))
1612 (label_ref (match_operand 0 "" ""))
1613 (pc)))]
1614 ""
1615 "
1616 {
1617 if (hppa_branch_type == CMP_SI)
1618 FAIL;
1619 emit_insn (gen_cmp_fp (UNGT, hppa_compare_op0, hppa_compare_op1));
1620 emit_bcond_fp (NE, operands[0]);
1621 DONE;
1622 }")
1623
1624 (define_expand "buneq"
1625 [(set (pc)
1626 (if_then_else (uneq (match_dup 1) (match_dup 2))
1627 (label_ref (match_operand 0 "" ""))
1628 (pc)))]
1629 ""
1630 "
1631 {
1632 if (hppa_branch_type == CMP_SI)
1633 FAIL;
1634 emit_insn (gen_cmp_fp (UNEQ, hppa_compare_op0, hppa_compare_op1));
1635 emit_bcond_fp (NE, operands[0]);
1636 DONE;
1637 }")
1638
1639 (define_expand "bunordered"
1640 [(set (pc)
1641 (if_then_else (unordered (match_dup 1) (match_dup 2))
1642 (label_ref (match_operand 0 "" ""))
1643 (pc)))]
1644 ""
1645 "
1646 {
1647 if (hppa_branch_type == CMP_SI)
1648 FAIL;
1649 emit_insn (gen_cmp_fp (UNORDERED, hppa_compare_op0, hppa_compare_op1));
1650 emit_bcond_fp (NE, operands[0]);
1651 DONE;
1652 }")
1653
1654 (define_expand "bordered"
1655 [(set (pc)
1656 (if_then_else (ordered (match_dup 1) (match_dup 2))
1657 (label_ref (match_operand 0 "" ""))
1658 (pc)))]
1659 ""
1660 "
1661 {
1662 if (hppa_branch_type == CMP_SI)
1663 FAIL;
1664 emit_insn (gen_cmp_fp (ORDERED, hppa_compare_op0, hppa_compare_op1));
1665 emit_bcond_fp (NE, operands[0]);
1666 DONE;
1667 }")
1668
1669 ;; Match the branch patterns.
1670
1671
1672 ;; Note a long backward conditional branch with an annulled delay slot
1673 ;; has a length of 12.
1674 (define_insn ""
1675 [(set (pc)
1676 (if_then_else
1677 (match_operator 3 "comparison_operator"
1678 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1679 (match_operand:SI 2 "arith5_operand" "rL")])
1680 (label_ref (match_operand 0 "" ""))
1681 (pc)))]
1682 ""
1683 "*
1684 {
1685 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1686 get_attr_length (insn), 0, insn);
1687 }"
1688 [(set_attr "type" "cbranch")
1689 (set (attr "length")
1690 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1691 (const_int 8184))
1692 (const_int 4)
1693 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1694 (const_int 262100))
1695 (const_int 8)
1696 (eq (symbol_ref "flag_pic") (const_int 0))
1697 (const_int 20)]
1698 (const_int 28)))])
1699
1700 ;; Match the negated branch.
1701
1702 (define_insn ""
1703 [(set (pc)
1704 (if_then_else
1705 (match_operator 3 "comparison_operator"
1706 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1707 (match_operand:SI 2 "arith5_operand" "rL")])
1708 (pc)
1709 (label_ref (match_operand 0 "" ""))))]
1710 ""
1711 "*
1712 {
1713 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1714 get_attr_length (insn), 1, insn);
1715 }"
1716 [(set_attr "type" "cbranch")
1717 (set (attr "length")
1718 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1719 (const_int 8184))
1720 (const_int 4)
1721 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1722 (const_int 262100))
1723 (const_int 8)
1724 (eq (symbol_ref "flag_pic") (const_int 0))
1725 (const_int 20)]
1726 (const_int 28)))])
1727
1728 (define_insn ""
1729 [(set (pc)
1730 (if_then_else
1731 (match_operator 3 "comparison_operator"
1732 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1733 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1734 (label_ref (match_operand 0 "" ""))
1735 (pc)))]
1736 "TARGET_64BIT"
1737 "*
1738 {
1739 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1740 get_attr_length (insn), 0, insn);
1741 }"
1742 [(set_attr "type" "cbranch")
1743 (set (attr "length")
1744 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1745 (const_int 8184))
1746 (const_int 4)
1747 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1748 (const_int 262100))
1749 (const_int 8)
1750 (eq (symbol_ref "flag_pic") (const_int 0))
1751 (const_int 20)]
1752 (const_int 28)))])
1753
1754 ;; Match the negated branch.
1755
1756 (define_insn ""
1757 [(set (pc)
1758 (if_then_else
1759 (match_operator 3 "comparison_operator"
1760 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1761 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1762 (pc)
1763 (label_ref (match_operand 0 "" ""))))]
1764 "TARGET_64BIT"
1765 "*
1766 {
1767 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1768 get_attr_length (insn), 1, insn);
1769 }"
1770 [(set_attr "type" "cbranch")
1771 (set (attr "length")
1772 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1773 (const_int 8184))
1774 (const_int 4)
1775 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1776 (const_int 262100))
1777 (const_int 8)
1778 (eq (symbol_ref "flag_pic") (const_int 0))
1779 (const_int 20)]
1780 (const_int 28)))])
1781 (define_insn ""
1782 [(set (pc)
1783 (if_then_else
1784 (match_operator 3 "cmpib_comparison_operator"
1785 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1786 (match_operand:DI 2 "arith5_operand" "rL")])
1787 (label_ref (match_operand 0 "" ""))
1788 (pc)))]
1789 "TARGET_64BIT"
1790 "*
1791 {
1792 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1793 get_attr_length (insn), 0, insn);
1794 }"
1795 [(set_attr "type" "cbranch")
1796 (set (attr "length")
1797 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1798 (const_int 8184))
1799 (const_int 4)
1800 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1801 (const_int 262100))
1802 (const_int 8)
1803 (eq (symbol_ref "flag_pic") (const_int 0))
1804 (const_int 20)]
1805 (const_int 28)))])
1806
1807 ;; Match the negated branch.
1808
1809 (define_insn ""
1810 [(set (pc)
1811 (if_then_else
1812 (match_operator 3 "cmpib_comparison_operator"
1813 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1814 (match_operand:DI 2 "arith5_operand" "rL")])
1815 (pc)
1816 (label_ref (match_operand 0 "" ""))))]
1817 "TARGET_64BIT"
1818 "*
1819 {
1820 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1821 get_attr_length (insn), 1, insn);
1822 }"
1823 [(set_attr "type" "cbranch")
1824 (set (attr "length")
1825 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1826 (const_int 8184))
1827 (const_int 4)
1828 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1829 (const_int 262100))
1830 (const_int 8)
1831 (eq (symbol_ref "flag_pic") (const_int 0))
1832 (const_int 20)]
1833 (const_int 28)))])
1834
1835 ;; Branch on Bit patterns.
1836 (define_insn ""
1837 [(set (pc)
1838 (if_then_else
1839 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1840 (const_int 1)
1841 (match_operand:SI 1 "uint5_operand" ""))
1842 (const_int 0))
1843 (label_ref (match_operand 2 "" ""))
1844 (pc)))]
1845 ""
1846 "*
1847 {
1848 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1849 get_attr_length (insn), 0, insn, 0);
1850 }"
1851 [(set_attr "type" "cbranch")
1852 (set (attr "length")
1853 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1854 (const_int 8184))
1855 (const_int 4)
1856 (const_int 8)))])
1857
1858 (define_insn ""
1859 [(set (pc)
1860 (if_then_else
1861 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1862 (const_int 1)
1863 (match_operand:DI 1 "uint32_operand" ""))
1864 (const_int 0))
1865 (label_ref (match_operand 2 "" ""))
1866 (pc)))]
1867 "TARGET_64BIT"
1868 "*
1869 {
1870 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1871 get_attr_length (insn), 0, insn, 0);
1872 }"
1873 [(set_attr "type" "cbranch")
1874 (set (attr "length")
1875 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1876 (const_int 8184))
1877 (const_int 4)
1878 (const_int 8)))])
1879
1880 (define_insn ""
1881 [(set (pc)
1882 (if_then_else
1883 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1884 (const_int 1)
1885 (match_operand:SI 1 "uint5_operand" ""))
1886 (const_int 0))
1887 (pc)
1888 (label_ref (match_operand 2 "" ""))))]
1889 ""
1890 "*
1891 {
1892 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1893 get_attr_length (insn), 1, insn, 0);
1894 }"
1895 [(set_attr "type" "cbranch")
1896 (set (attr "length")
1897 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1898 (const_int 8184))
1899 (const_int 4)
1900 (const_int 8)))])
1901
1902 (define_insn ""
1903 [(set (pc)
1904 (if_then_else
1905 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1906 (const_int 1)
1907 (match_operand:DI 1 "uint32_operand" ""))
1908 (const_int 0))
1909 (pc)
1910 (label_ref (match_operand 2 "" ""))))]
1911 "TARGET_64BIT"
1912 "*
1913 {
1914 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1915 get_attr_length (insn), 1, insn, 0);
1916 }"
1917 [(set_attr "type" "cbranch")
1918 (set (attr "length")
1919 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1920 (const_int 8184))
1921 (const_int 4)
1922 (const_int 8)))])
1923
1924 (define_insn ""
1925 [(set (pc)
1926 (if_then_else
1927 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1928 (const_int 1)
1929 (match_operand:SI 1 "uint5_operand" ""))
1930 (const_int 0))
1931 (label_ref (match_operand 2 "" ""))
1932 (pc)))]
1933 ""
1934 "*
1935 {
1936 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1937 get_attr_length (insn), 0, insn, 1);
1938 }"
1939 [(set_attr "type" "cbranch")
1940 (set (attr "length")
1941 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1942 (const_int 8184))
1943 (const_int 4)
1944 (const_int 8)))])
1945
1946 (define_insn ""
1947 [(set (pc)
1948 (if_then_else
1949 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1950 (const_int 1)
1951 (match_operand:DI 1 "uint32_operand" ""))
1952 (const_int 0))
1953 (label_ref (match_operand 2 "" ""))
1954 (pc)))]
1955 "TARGET_64BIT"
1956 "*
1957 {
1958 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1959 get_attr_length (insn), 0, insn, 1);
1960 }"
1961 [(set_attr "type" "cbranch")
1962 (set (attr "length")
1963 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1964 (const_int 8184))
1965 (const_int 4)
1966 (const_int 8)))])
1967
1968 (define_insn ""
1969 [(set (pc)
1970 (if_then_else
1971 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1972 (const_int 1)
1973 (match_operand:SI 1 "uint5_operand" ""))
1974 (const_int 0))
1975 (pc)
1976 (label_ref (match_operand 2 "" ""))))]
1977 ""
1978 "*
1979 {
1980 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1981 get_attr_length (insn), 1, insn, 1);
1982 }"
1983 [(set_attr "type" "cbranch")
1984 (set (attr "length")
1985 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1986 (const_int 8184))
1987 (const_int 4)
1988 (const_int 8)))])
1989
1990 (define_insn ""
1991 [(set (pc)
1992 (if_then_else
1993 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1994 (const_int 1)
1995 (match_operand:DI 1 "uint32_operand" ""))
1996 (const_int 0))
1997 (pc)
1998 (label_ref (match_operand 2 "" ""))))]
1999 "TARGET_64BIT"
2000 "*
2001 {
2002 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
2003 get_attr_length (insn), 1, insn, 1);
2004 }"
2005 [(set_attr "type" "cbranch")
2006 (set (attr "length")
2007 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2008 (const_int 8184))
2009 (const_int 4)
2010 (const_int 8)))])
2011
2012 ;; Branch on Variable Bit patterns.
2013 (define_insn ""
2014 [(set (pc)
2015 (if_then_else
2016 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2017 (const_int 1)
2018 (match_operand:SI 1 "register_operand" "q"))
2019 (const_int 0))
2020 (label_ref (match_operand 2 "" ""))
2021 (pc)))]
2022 ""
2023 "*
2024 {
2025 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2026 get_attr_length (insn), 0, insn, 0);
2027 }"
2028 [(set_attr "type" "cbranch")
2029 (set (attr "length")
2030 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2031 (const_int 8184))
2032 (const_int 4)
2033 (const_int 8)))])
2034
2035 (define_insn ""
2036 [(set (pc)
2037 (if_then_else
2038 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2039 (const_int 1)
2040 (match_operand:DI 1 "register_operand" "q"))
2041 (const_int 0))
2042 (label_ref (match_operand 2 "" ""))
2043 (pc)))]
2044 "TARGET_64BIT"
2045 "*
2046 {
2047 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2048 get_attr_length (insn), 0, insn, 0);
2049 }"
2050 [(set_attr "type" "cbranch")
2051 (set (attr "length")
2052 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2053 (const_int 8184))
2054 (const_int 4)
2055 (const_int 8)))])
2056
2057 (define_insn ""
2058 [(set (pc)
2059 (if_then_else
2060 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2061 (const_int 1)
2062 (match_operand:SI 1 "register_operand" "q"))
2063 (const_int 0))
2064 (pc)
2065 (label_ref (match_operand 2 "" ""))))]
2066 ""
2067 "*
2068 {
2069 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2070 get_attr_length (insn), 1, insn, 0);
2071 }"
2072 [(set_attr "type" "cbranch")
2073 (set (attr "length")
2074 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2075 (const_int 8184))
2076 (const_int 4)
2077 (const_int 8)))])
2078
2079 (define_insn ""
2080 [(set (pc)
2081 (if_then_else
2082 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2083 (const_int 1)
2084 (match_operand:DI 1 "register_operand" "q"))
2085 (const_int 0))
2086 (pc)
2087 (label_ref (match_operand 2 "" ""))))]
2088 "TARGET_64BIT"
2089 "*
2090 {
2091 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2092 get_attr_length (insn), 1, insn, 0);
2093 }"
2094 [(set_attr "type" "cbranch")
2095 (set (attr "length")
2096 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2097 (const_int 8184))
2098 (const_int 4)
2099 (const_int 8)))])
2100
2101 (define_insn ""
2102 [(set (pc)
2103 (if_then_else
2104 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2105 (const_int 1)
2106 (match_operand:SI 1 "register_operand" "q"))
2107 (const_int 0))
2108 (label_ref (match_operand 2 "" ""))
2109 (pc)))]
2110 ""
2111 "*
2112 {
2113 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2114 get_attr_length (insn), 0, insn, 1);
2115 }"
2116 [(set_attr "type" "cbranch")
2117 (set (attr "length")
2118 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2119 (const_int 8184))
2120 (const_int 4)
2121 (const_int 8)))])
2122
2123 (define_insn ""
2124 [(set (pc)
2125 (if_then_else
2126 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2127 (const_int 1)
2128 (match_operand:DI 1 "register_operand" "q"))
2129 (const_int 0))
2130 (label_ref (match_operand 2 "" ""))
2131 (pc)))]
2132 "TARGET_64BIT"
2133 "*
2134 {
2135 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2136 get_attr_length (insn), 0, insn, 1);
2137 }"
2138 [(set_attr "type" "cbranch")
2139 (set (attr "length")
2140 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2141 (const_int 8184))
2142 (const_int 4)
2143 (const_int 8)))])
2144
2145 (define_insn ""
2146 [(set (pc)
2147 (if_then_else
2148 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2149 (const_int 1)
2150 (match_operand:SI 1 "register_operand" "q"))
2151 (const_int 0))
2152 (pc)
2153 (label_ref (match_operand 2 "" ""))))]
2154 ""
2155 "*
2156 {
2157 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2158 get_attr_length (insn), 1, insn, 1);
2159 }"
2160 [(set_attr "type" "cbranch")
2161 (set (attr "length")
2162 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2163 (const_int 8184))
2164 (const_int 4)
2165 (const_int 8)))])
2166
2167 (define_insn ""
2168 [(set (pc)
2169 (if_then_else
2170 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2171 (const_int 1)
2172 (match_operand:DI 1 "register_operand" "q"))
2173 (const_int 0))
2174 (pc)
2175 (label_ref (match_operand 2 "" ""))))]
2176 "TARGET_64BIT"
2177 "*
2178 {
2179 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2180 get_attr_length (insn), 1, insn, 1);
2181 }"
2182 [(set_attr "type" "cbranch")
2183 (set (attr "length")
2184 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2185 (const_int 8184))
2186 (const_int 4)
2187 (const_int 8)))])
2188
2189 ;; Floating point branches
2190 (define_insn ""
2191 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2192 (label_ref (match_operand 0 "" ""))
2193 (pc)))]
2194 "! TARGET_SOFT_FLOAT"
2195 "*
2196 {
2197 if (INSN_ANNULLED_BRANCH_P (insn))
2198 return \"ftest\;b,n %0\";
2199 else
2200 return \"ftest\;b%* %0\";
2201 }"
2202 [(set_attr "type" "fbranch")
2203 (set_attr "length" "8")])
2204
2205 (define_insn ""
2206 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2207 (pc)
2208 (label_ref (match_operand 0 "" ""))))]
2209 "! TARGET_SOFT_FLOAT"
2210 "*
2211 {
2212 if (INSN_ANNULLED_BRANCH_P (insn))
2213 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b,n %0\";
2214 else
2215 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b%* %0\";
2216 }"
2217 [(set_attr "type" "fbranch")
2218 (set_attr "length" "12")])
2219
2220 ;; Move instructions
2221
2222 (define_expand "movsi"
2223 [(set (match_operand:SI 0 "general_operand" "")
2224 (match_operand:SI 1 "general_operand" ""))]
2225 ""
2226 "
2227 {
2228 if (emit_move_sequence (operands, SImode, 0))
2229 DONE;
2230 }")
2231
2232 ;; Reloading an SImode or DImode value requires a scratch register if
2233 ;; going in to or out of float point registers.
2234
2235 (define_expand "reload_insi"
2236 [(set (match_operand:SI 0 "register_operand" "=Z")
2237 (match_operand:SI 1 "non_hard_reg_operand" ""))
2238 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2239 ""
2240 "
2241 {
2242 if (emit_move_sequence (operands, SImode, operands[2]))
2243 DONE;
2244
2245 /* We don't want the clobber emitted, so handle this ourselves. */
2246 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2247 DONE;
2248 }")
2249
2250 (define_expand "reload_outsi"
2251 [(set (match_operand:SI 0 "non_hard_reg_operand" "")
2252 (match_operand:SI 1 "register_operand" "Z"))
2253 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2254 ""
2255 "
2256 {
2257 if (emit_move_sequence (operands, SImode, operands[2]))
2258 DONE;
2259
2260 /* We don't want the clobber emitted, so handle this ourselves. */
2261 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2262 DONE;
2263 }")
2264
2265 (define_insn ""
2266 [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand"
2267 "=r,r,r,r,r,r,Q,*q,!f,f,*TR")
2268 (match_operand:SI 1 "move_operand"
2269 "A,r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
2270 "(register_operand (operands[0], SImode)
2271 || reg_or_0_operand (operands[1], SImode))
2272 && ! TARGET_SOFT_FLOAT"
2273 "@
2274 ldw RT'%A1,%0
2275 copy %1,%0
2276 ldi %1,%0
2277 ldil L'%1,%0
2278 {zdepi|depwi,z} %Z1,%0
2279 ldw%M1 %1,%0
2280 stw%M0 %r1,%0
2281 mtsar %r1
2282 fcpy,sgl %f1,%0
2283 fldw%F1 %1,%0
2284 fstw%F0 %1,%0"
2285 [(set_attr "type" "load,move,move,move,shift,load,store,move,fpalu,fpload,fpstore")
2286 (set_attr "pa_combine_type" "addmove")
2287 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4")])
2288
2289 (define_insn ""
2290 [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand"
2291 "=r,r,r,r,r,r,Q,*q")
2292 (match_operand:SI 1 "move_operand"
2293 "A,r,J,N,K,RQ,rM,rM"))]
2294 "(register_operand (operands[0], SImode)
2295 || reg_or_0_operand (operands[1], SImode))
2296 && TARGET_SOFT_FLOAT"
2297 "@
2298 ldw RT'%A1,%0
2299 copy %1,%0
2300 ldi %1,%0
2301 ldil L'%1,%0
2302 {zdepi|depwi,z} %Z1,%0
2303 ldw%M1 %1,%0
2304 stw%M0 %r1,%0
2305 mtsar %r1"
2306 [(set_attr "type" "load,move,move,move,move,load,store,move")
2307 (set_attr "pa_combine_type" "addmove")
2308 (set_attr "length" "4,4,4,4,4,4,4,4")])
2309
2310 (define_insn ""
2311 [(set (match_operand:SI 0 "register_operand" "=r")
2312 (mem:SI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
2313 (match_operand:SI 2 "register_operand" "r"))))]
2314 "! TARGET_DISABLE_INDEXING"
2315 "{ldwx|ldw} %2(%1),%0"
2316 [(set_attr "type" "load")
2317 (set_attr "length" "4")])
2318
2319 (define_insn ""
2320 [(set (match_operand:SI 0 "register_operand" "=r")
2321 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
2322 (match_operand:SI 2 "basereg_operand" "r"))))]
2323 "! TARGET_DISABLE_INDEXING"
2324 "{ldwx|ldw} %1(%2),%0"
2325 [(set_attr "type" "load")
2326 (set_attr "length" "4")])
2327
2328 ;; Load or store with base-register modification.
2329
2330 (define_expand "pre_load"
2331 [(parallel [(set (match_operand:SI 0 "register_operand" "")
2332 (mem (plus (match_operand 1 "register_operand" "")
2333 (match_operand 2 "pre_cint_operand" ""))))
2334 (set (match_dup 1)
2335 (plus (match_dup 1) (match_dup 2)))])]
2336 ""
2337 "
2338 {
2339 if (TARGET_64BIT)
2340 {
2341 emit_insn (gen_pre_ldd (operands[0], operands[1], operands[2]));
2342 DONE;
2343 }
2344 emit_insn (gen_pre_ldw (operands[0], operands[1], operands[2]));
2345 DONE;
2346 }")
2347
2348 (define_insn "pre_ldw"
2349 [(set (match_operand:SI 0 "register_operand" "=r")
2350 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2351 (match_operand:SI 2 "pre_cint_operand" ""))))
2352 (set (match_dup 1)
2353 (plus:SI (match_dup 1) (match_dup 2)))]
2354 ""
2355 "*
2356 {
2357 if (INTVAL (operands[2]) < 0)
2358 return \"{ldwm|ldw,mb} %2(%1),%0\";
2359 return \"{ldws|ldw},mb %2(%1),%0\";
2360 }"
2361 [(set_attr "type" "load")
2362 (set_attr "length" "4")])
2363
2364 (define_insn "pre_ldd"
2365 [(set (match_operand:DI 0 "register_operand" "=r")
2366 (mem:DI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2367 (match_operand:DI 2 "pre_cint_operand" ""))))
2368 (set (match_dup 1)
2369 (plus:DI (match_dup 1) (match_dup 2)))]
2370 "TARGET_64BIT"
2371 "ldd,mb %2(%1),%0"
2372 [(set_attr "type" "load")
2373 (set_attr "length" "4")])
2374
2375 (define_insn ""
2376 [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2377 (match_operand:SI 1 "pre_cint_operand" "")))
2378 (match_operand:SI 2 "reg_or_0_operand" "rM"))
2379 (set (match_dup 0)
2380 (plus:SI (match_dup 0) (match_dup 1)))]
2381 ""
2382 "*
2383 {
2384 if (INTVAL (operands[1]) < 0)
2385 return \"{stwm|stw,mb} %r2,%1(%0)\";
2386 return \"{stws|stw},mb %r2,%1(%0)\";
2387 }"
2388 [(set_attr "type" "store")
2389 (set_attr "length" "4")])
2390
2391 (define_insn ""
2392 [(set (match_operand:SI 0 "register_operand" "=r")
2393 (mem:SI (match_operand:SI 1 "register_operand" "+r")))
2394 (set (match_dup 1)
2395 (plus:SI (match_dup 1)
2396 (match_operand:SI 2 "post_cint_operand" "")))]
2397 ""
2398 "*
2399 {
2400 if (INTVAL (operands[2]) > 0)
2401 return \"{ldwm|ldw,ma} %2(%1),%0\";
2402 return \"{ldws|ldw},ma %2(%1),%0\";
2403 }"
2404 [(set_attr "type" "load")
2405 (set_attr "length" "4")])
2406
2407 (define_expand "post_store"
2408 [(parallel [(set (mem (match_operand 0 "register_operand" ""))
2409 (match_operand 1 "reg_or_0_operand" ""))
2410 (set (match_dup 0)
2411 (plus (match_dup 0)
2412 (match_operand 2 "post_cint_operand" "")))])]
2413 ""
2414 "
2415 {
2416 if (TARGET_64BIT)
2417 {
2418 emit_insn (gen_post_std (operands[0], operands[1], operands[2]));
2419 DONE;
2420 }
2421 emit_insn (gen_post_stw (operands[0], operands[1], operands[2]));
2422 DONE;
2423 }")
2424
2425 (define_insn "post_stw"
2426 [(set (mem:SI (match_operand:SI 0 "register_operand" "+r"))
2427 (match_operand:SI 1 "reg_or_0_operand" "rM"))
2428 (set (match_dup 0)
2429 (plus:SI (match_dup 0)
2430 (match_operand:SI 2 "post_cint_operand" "")))]
2431 ""
2432 "*
2433 {
2434 if (INTVAL (operands[2]) > 0)
2435 return \"{stwm|stw,ma} %r1,%2(%0)\";
2436 return \"{stws|stw},ma %r1,%2(%0)\";
2437 }"
2438 [(set_attr "type" "store")
2439 (set_attr "length" "4")])
2440
2441 (define_insn "post_std"
2442 [(set (mem:DI (match_operand:DI 0 "register_operand" "+r"))
2443 (match_operand:DI 1 "reg_or_0_operand" "rM"))
2444 (set (match_dup 0)
2445 (plus:DI (match_dup 0)
2446 (match_operand:DI 2 "post_cint_operand" "")))]
2447 "TARGET_64BIT"
2448 "std,ma %r1,%2(%0)"
2449 [(set_attr "type" "store")
2450 (set_attr "length" "4")])
2451
2452 ;; For loading the address of a label while generating PIC code.
2453 ;; Note since this pattern can be created at reload time (via movsi), all
2454 ;; the same rules for movsi apply here. (no new pseudos, no temporaries).
2455 (define_insn ""
2456 [(set (match_operand 0 "pmode_register_operand" "=a")
2457 (match_operand 1 "pic_label_operand" ""))]
2458 ""
2459 "*
2460 {
2461 rtx xoperands[3];
2462 extern FILE *asm_out_file;
2463
2464 xoperands[0] = operands[0];
2465 xoperands[1] = operands[1];
2466 if (TARGET_SOM || ! TARGET_GAS)
2467 xoperands[2] = gen_label_rtx ();
2468
2469 output_asm_insn (\"{bl|b,l} .+8,%0\", xoperands);
2470 output_asm_insn (\"{depi|depwi} 0,31,2,%0\", xoperands);
2471 if (TARGET_SOM || ! TARGET_GAS)
2472 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2473 CODE_LABEL_NUMBER (xoperands[2]));
2474
2475 /* If we're trying to load the address of a label that happens to be
2476 close, then we can use a shorter sequence. */
2477 if (GET_CODE (operands[1]) == LABEL_REF
2478 && INSN_ADDRESSES_SET_P ()
2479 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2480 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2481 {
2482 /* Prefixing with R% here is wrong, it extracts just 11 bits and is
2483 always non-negative. */
2484 if (TARGET_SOM || ! TARGET_GAS)
2485 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2486 else
2487 output_asm_insn (\"ldo %1-$PIC_pcrel$0+8(%0),%0\", xoperands);
2488 }
2489 else
2490 {
2491 if (TARGET_SOM || ! TARGET_GAS)
2492 {
2493 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2494 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2495 }
2496 else
2497 {
2498 output_asm_insn (\"addil L%%%1-$PIC_pcrel$0+8,%0\", xoperands);
2499 output_asm_insn (\"ldo R%%%1-$PIC_pcrel$0+12(%0),%0\",
2500 xoperands);
2501 }
2502 }
2503 return \"\";
2504 }"
2505 [(set_attr "type" "multi")
2506 (set_attr "length" "16")]) ; 12 or 16
2507
2508 (define_insn ""
2509 [(set (match_operand:SI 0 "register_operand" "=a")
2510 (plus:SI (match_operand:SI 1 "register_operand" "r")
2511 (high:SI (match_operand 2 "" ""))))]
2512 "symbolic_operand (operands[2], Pmode)
2513 && ! function_label_operand (operands[2], Pmode)
2514 && flag_pic"
2515 "addil LT'%G2,%1"
2516 [(set_attr "type" "binary")
2517 (set_attr "length" "4")])
2518
2519 (define_insn ""
2520 [(set (match_operand:DI 0 "register_operand" "=a")
2521 (plus:DI (match_operand:DI 1 "register_operand" "r")
2522 (high:DI (match_operand 2 "" ""))))]
2523 "symbolic_operand (operands[2], Pmode)
2524 && ! function_label_operand (operands[2], Pmode)
2525 && TARGET_64BIT
2526 && flag_pic"
2527 "addil LT'%G2,%1"
2528 [(set_attr "type" "binary")
2529 (set_attr "length" "4")])
2530
2531 ;; Always use addil rather than ldil;add sequences. This allows the
2532 ;; HP linker to eliminate the dp relocation if the symbolic operand
2533 ;; lives in the TEXT space.
2534 (define_insn ""
2535 [(set (match_operand:SI 0 "register_operand" "=a")
2536 (high:SI (match_operand 1 "" "")))]
2537 "symbolic_operand (operands[1], Pmode)
2538 && ! function_label_operand (operands[1], Pmode)
2539 && ! read_only_operand (operands[1], Pmode)
2540 && ! flag_pic"
2541 "*
2542 {
2543 if (TARGET_LONG_LOAD_STORE)
2544 return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
2545 else
2546 return \"addil LR'%H1,%%r27\";
2547 }"
2548 [(set_attr "type" "binary")
2549 (set (attr "length")
2550 (if_then_else (eq (symbol_ref "TARGET_LONG_LOAD_STORE") (const_int 0))
2551 (const_int 4)
2552 (const_int 8)))])
2553
2554
2555 ;; This is for use in the prologue/epilogue code. We need it
2556 ;; to add large constants to a stack pointer or frame pointer.
2557 ;; Because of the additional %r1 pressure, we probably do not
2558 ;; want to use this in general code, so make it available
2559 ;; only after reload.
2560 (define_insn ""
2561 [(set (match_operand:SI 0 "register_operand" "=!a,*r")
2562 (plus:SI (match_operand:SI 1 "register_operand" "r,r")
2563 (high:SI (match_operand 2 "const_int_operand" ""))))]
2564 "reload_completed"
2565 "@
2566 addil L'%G2,%1
2567 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2568 [(set_attr "type" "binary,binary")
2569 (set_attr "length" "4,8")])
2570
2571 (define_insn ""
2572 [(set (match_operand:DI 0 "register_operand" "=!a,*r")
2573 (plus:DI (match_operand:DI 1 "register_operand" "r,r")
2574 (high:DI (match_operand 2 "const_int_operand" ""))))]
2575 "reload_completed && TARGET_64BIT"
2576 "@
2577 addil L'%G2,%1
2578 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2579 [(set_attr "type" "binary,binary")
2580 (set_attr "length" "4,8")])
2581
2582 (define_insn ""
2583 [(set (match_operand:SI 0 "register_operand" "=r")
2584 (high:SI (match_operand 1 "" "")))]
2585 "(!flag_pic || !symbolic_operand (operands[1], Pmode))
2586 && !is_function_label_plus_const (operands[1])"
2587 "*
2588 {
2589 if (symbolic_operand (operands[1], Pmode))
2590 return \"ldil LR'%H1,%0\";
2591 else
2592 return \"ldil L'%G1,%0\";
2593 }"
2594 [(set_attr "type" "move")
2595 (set_attr "length" "4")])
2596
2597 (define_insn ""
2598 [(set (match_operand:DI 0 "register_operand" "=r")
2599 (high:DI (match_operand 1 "const_int_operand" "")))]
2600 "TARGET_64BIT"
2601 "ldil L'%G1,%0";
2602 [(set_attr "type" "move")
2603 (set_attr "length" "4")])
2604
2605 (define_insn ""
2606 [(set (match_operand:DI 0 "register_operand" "=r")
2607 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2608 (match_operand:DI 2 "const_int_operand" "i")))]
2609 "TARGET_64BIT"
2610 "ldo R'%G2(%1),%0";
2611 [(set_attr "type" "move")
2612 (set_attr "length" "4")])
2613
2614 (define_insn ""
2615 [(set (match_operand:SI 0 "register_operand" "=r")
2616 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2617 (match_operand:SI 2 "immediate_operand" "i")))]
2618 "!is_function_label_plus_const (operands[2])"
2619 "*
2620 {
2621 if (flag_pic && symbolic_operand (operands[2], Pmode))
2622 abort ();
2623 else if (symbolic_operand (operands[2], Pmode))
2624 return \"ldo RR'%G2(%1),%0\";
2625 else
2626 return \"ldo R'%G2(%1),%0\";
2627 }"
2628 [(set_attr "type" "move")
2629 (set_attr "length" "4")])
2630
2631 ;; Now that a symbolic_address plus a constant is broken up early
2632 ;; in the compilation phase (for better CSE) we need a special
2633 ;; combiner pattern to load the symbolic address plus the constant
2634 ;; in only 2 instructions. (For cases where the symbolic address
2635 ;; was not a common subexpression.)
2636 (define_split
2637 [(set (match_operand:SI 0 "register_operand" "")
2638 (match_operand:SI 1 "symbolic_operand" ""))
2639 (clobber (match_operand:SI 2 "register_operand" ""))]
2640 "! (flag_pic && pic_label_operand (operands[1], SImode))"
2641 [(set (match_dup 2) (high:SI (match_dup 1)))
2642 (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
2643 "")
2644
2645 ;; hppa_legitimize_address goes to a great deal of trouble to
2646 ;; create addresses which use indexing. In some cases, this
2647 ;; is a lose because there isn't any store instructions which
2648 ;; allow indexed addresses (with integer register source).
2649 ;;
2650 ;; These define_splits try to turn a 3 insn store into
2651 ;; a 2 insn store with some creative RTL rewriting.
2652 (define_split
2653 [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2654 (match_operand:SI 1 "shadd_operand" ""))
2655 (plus:SI (match_operand:SI 2 "register_operand" "")
2656 (match_operand:SI 3 "const_int_operand" ""))))
2657 (match_operand:SI 4 "register_operand" ""))
2658 (clobber (match_operand:SI 5 "register_operand" ""))]
2659 ""
2660 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2661 (match_dup 2)))
2662 (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2663 "")
2664
2665 (define_split
2666 [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2667 (match_operand:SI 1 "shadd_operand" ""))
2668 (plus:SI (match_operand:SI 2 "register_operand" "")
2669 (match_operand:SI 3 "const_int_operand" ""))))
2670 (match_operand:HI 4 "register_operand" ""))
2671 (clobber (match_operand:SI 5 "register_operand" ""))]
2672 ""
2673 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2674 (match_dup 2)))
2675 (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2676 "")
2677
2678 (define_split
2679 [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2680 (match_operand:SI 1 "shadd_operand" ""))
2681 (plus:SI (match_operand:SI 2 "register_operand" "")
2682 (match_operand:SI 3 "const_int_operand" ""))))
2683 (match_operand:QI 4 "register_operand" ""))
2684 (clobber (match_operand:SI 5 "register_operand" ""))]
2685 ""
2686 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2687 (match_dup 2)))
2688 (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2689 "")
2690
2691 (define_expand "movhi"
2692 [(set (match_operand:HI 0 "general_operand" "")
2693 (match_operand:HI 1 "general_operand" ""))]
2694 ""
2695 "
2696 {
2697 if (emit_move_sequence (operands, HImode, 0))
2698 DONE;
2699 }")
2700
2701 (define_insn ""
2702 [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q,*q,!*f")
2703 (match_operand:HI 1 "move_operand" "r,J,N,K,RQ,rM,rM,!*fM"))]
2704 "register_operand (operands[0], HImode)
2705 || reg_or_0_operand (operands[1], HImode)"
2706 "@
2707 copy %1,%0
2708 ldi %1,%0
2709 ldil L'%1,%0
2710 {zdepi|depwi,z} %Z1,%0
2711 ldh%M1 %1,%0
2712 sth%M0 %r1,%0
2713 mtsar %r1
2714 fcpy,sgl %f1,%0"
2715 [(set_attr "type" "move,move,move,shift,load,store,move,fpalu")
2716 (set_attr "pa_combine_type" "addmove")
2717 (set_attr "length" "4,4,4,4,4,4,4,4")])
2718
2719 (define_insn ""
2720 [(set (match_operand:HI 0 "register_operand" "=r")
2721 (mem:HI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
2722 (match_operand:SI 2 "register_operand" "r"))))]
2723 "! TARGET_DISABLE_INDEXING"
2724 "{ldhx|ldh} %2(%1),%0"
2725 [(set_attr "type" "load")
2726 (set_attr "length" "4")])
2727
2728 (define_insn ""
2729 [(set (match_operand:HI 0 "register_operand" "=r")
2730 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "r")
2731 (match_operand:SI 2 "basereg_operand" "r"))))]
2732 "! TARGET_DISABLE_INDEXING"
2733 "{ldhx|ldh} %1(%2),%0"
2734 [(set_attr "type" "load")
2735 (set_attr "length" "4")])
2736
2737 ; Now zero extended variants.
2738 (define_insn ""
2739 [(set (match_operand:SI 0 "register_operand" "=r")
2740 (zero_extend:SI (mem:HI
2741 (plus:SI
2742 (match_operand:SI 1 "basereg_operand" "r")
2743 (match_operand:SI 2 "register_operand" "r")))))]
2744 "! TARGET_DISABLE_INDEXING"
2745 "{ldhx|ldh} %2(%1),%0"
2746 [(set_attr "type" "load")
2747 (set_attr "length" "4")])
2748
2749 (define_insn ""
2750 [(set (match_operand:SI 0 "register_operand" "=r")
2751 (zero_extend:SI (mem:HI
2752 (plus:SI
2753 (match_operand:SI 1 "register_operand" "r")
2754 (match_operand:SI 2 "basereg_operand" "r")))))]
2755 "! TARGET_DISABLE_INDEXING"
2756 "{ldhx|ldh} %1(%2),%0"
2757 [(set_attr "type" "load")
2758 (set_attr "length" "4")])
2759
2760 (define_insn ""
2761 [(set (match_operand:HI 0 "register_operand" "=r")
2762 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2763 (match_operand:SI 2 "int5_operand" "L"))))
2764 (set (match_dup 1)
2765 (plus:SI (match_dup 1) (match_dup 2)))]
2766 ""
2767 "{ldhs|ldh},mb %2(%1),%0"
2768 [(set_attr "type" "load")
2769 (set_attr "length" "4")])
2770
2771 ; And a zero extended variant.
2772 (define_insn ""
2773 [(set (match_operand:SI 0 "register_operand" "=r")
2774 (zero_extend:SI (mem:HI
2775 (plus:SI
2776 (match_operand:SI 1 "register_operand" "+r")
2777 (match_operand:SI 2 "int5_operand" "L")))))
2778 (set (match_dup 1)
2779 (plus:SI (match_dup 1) (match_dup 2)))]
2780 ""
2781 "{ldhs|ldh},mb %2(%1),%0"
2782 [(set_attr "type" "load")
2783 (set_attr "length" "4")])
2784
2785 (define_insn ""
2786 [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2787 (match_operand:SI 1 "int5_operand" "L")))
2788 (match_operand:HI 2 "reg_or_0_operand" "rM"))
2789 (set (match_dup 0)
2790 (plus:SI (match_dup 0) (match_dup 1)))]
2791 ""
2792 "{sths|sth},mb %r2,%1(%0)"
2793 [(set_attr "type" "store")
2794 (set_attr "length" "4")])
2795
2796 (define_insn ""
2797 [(set (match_operand:HI 0 "register_operand" "=r")
2798 (plus:HI (match_operand:HI 1 "register_operand" "r")
2799 (match_operand 2 "const_int_operand" "J")))]
2800 ""
2801 "ldo %2(%1),%0"
2802 [(set_attr "type" "binary")
2803 (set_attr "pa_combine_type" "addmove")
2804 (set_attr "length" "4")])
2805
2806 (define_expand "movqi"
2807 [(set (match_operand:QI 0 "general_operand" "")
2808 (match_operand:QI 1 "general_operand" ""))]
2809 ""
2810 "
2811 {
2812 if (emit_move_sequence (operands, QImode, 0))
2813 DONE;
2814 }")
2815
2816 (define_insn ""
2817 [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q,*q,!*f")
2818 (match_operand:QI 1 "move_operand" "r,J,N,K,RQ,rM,rM,!*fM"))]
2819 "register_operand (operands[0], QImode)
2820 || reg_or_0_operand (operands[1], QImode)"
2821 "@
2822 copy %1,%0
2823 ldi %1,%0
2824 ldil L'%1,%0
2825 {zdepi|depwi,z} %Z1,%0
2826 ldb%M1 %1,%0
2827 stb%M0 %r1,%0
2828 mtsar %r1
2829 fcpy,sgl %f1,%0"
2830 [(set_attr "type" "move,move,move,shift,load,store,move,fpalu")
2831 (set_attr "pa_combine_type" "addmove")
2832 (set_attr "length" "4,4,4,4,4,4,4,4")])
2833
2834 (define_insn ""
2835 [(set (match_operand:QI 0 "register_operand" "=r")
2836 (mem:QI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
2837 (match_operand:SI 2 "register_operand" "r"))))]
2838 "! TARGET_DISABLE_INDEXING"
2839 "{ldbx|ldb} %2(%1),%0"
2840 [(set_attr "type" "load")
2841 (set_attr "length" "4")])
2842
2843 (define_insn ""
2844 [(set (match_operand:QI 0 "register_operand" "=r")
2845 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "r")
2846 (match_operand:SI 2 "basereg_operand" "r"))))]
2847 "! TARGET_DISABLE_INDEXING"
2848 "{ldbx|ldb} %1(%2),%0"
2849 [(set_attr "type" "load")
2850 (set_attr "length" "4")])
2851
2852 ; Indexed byte load with zero extension to SImode or HImode.
2853 (define_insn ""
2854 [(set (match_operand:SI 0 "register_operand" "=r")
2855 (zero_extend:SI (mem:QI
2856 (plus:SI
2857 (match_operand:SI 1 "basereg_operand" "r")
2858 (match_operand:SI 2 "register_operand" "r")))))]
2859 "! TARGET_DISABLE_INDEXING"
2860 "{ldbx|ldb} %2(%1),%0"
2861 [(set_attr "type" "load")
2862 (set_attr "length" "4")])
2863
2864 (define_insn ""
2865 [(set (match_operand:SI 0 "register_operand" "=r")
2866 (zero_extend:SI (mem:QI
2867 (plus:SI
2868 (match_operand:SI 1 "register_operand" "r")
2869 (match_operand:SI 2 "basereg_operand" "r")))))]
2870 "! TARGET_DISABLE_INDEXING"
2871 "{ldbx|ldb} %1(%2),%0"
2872 [(set_attr "type" "load")
2873 (set_attr "length" "4")])
2874
2875 (define_insn ""
2876 [(set (match_operand:HI 0 "register_operand" "=r")
2877 (zero_extend:HI (mem:QI
2878 (plus:SI
2879 (match_operand:SI 1 "basereg_operand" "r")
2880 (match_operand:SI 2 "register_operand" "r")))))]
2881 "! TARGET_DISABLE_INDEXING"
2882 "{ldbx|ldb} %2(%1),%0"
2883 [(set_attr "type" "load")
2884 (set_attr "length" "4")])
2885
2886 (define_insn ""
2887 [(set (match_operand:HI 0 "register_operand" "=r")
2888 (zero_extend:HI (mem:QI
2889 (plus:SI
2890 (match_operand:SI 1 "register_operand" "r")
2891 (match_operand:SI 2 "basereg_operand" "r")))))]
2892 "! TARGET_DISABLE_INDEXING"
2893 "{ldbx|ldb} %1(%2),%0"
2894 [(set_attr "type" "load")
2895 (set_attr "length" "4")])
2896
2897 (define_insn ""
2898 [(set (match_operand:QI 0 "register_operand" "=r")
2899 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2900 (match_operand:SI 2 "int5_operand" "L"))))
2901 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
2902 ""
2903 "{ldbs|ldb},mb %2(%1),%0"
2904 [(set_attr "type" "load")
2905 (set_attr "length" "4")])
2906
2907 ; Now the same thing with zero extensions.
2908 (define_insn ""
2909 [(set (match_operand:SI 0 "register_operand" "=r")
2910 (zero_extend:SI (mem:QI (plus:SI
2911 (match_operand:SI 1 "register_operand" "+r")
2912 (match_operand:SI 2 "int5_operand" "L")))))
2913 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
2914 ""
2915 "{ldbs|ldb},mb %2(%1),%0"
2916 [(set_attr "type" "load")
2917 (set_attr "length" "4")])
2918
2919 (define_insn ""
2920 [(set (match_operand:HI 0 "register_operand" "=r")
2921 (zero_extend:HI (mem:QI (plus:SI
2922 (match_operand:SI 1 "register_operand" "+r")
2923 (match_operand:SI 2 "int5_operand" "L")))))
2924 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
2925 ""
2926 "{ldbs|ldb},mb %2(%1),%0"
2927 [(set_attr "type" "load")
2928 (set_attr "length" "4")])
2929
2930 (define_insn ""
2931 [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2932 (match_operand:SI 1 "int5_operand" "L")))
2933 (match_operand:QI 2 "reg_or_0_operand" "rM"))
2934 (set (match_dup 0)
2935 (plus:SI (match_dup 0) (match_dup 1)))]
2936 ""
2937 "{stbs|stb},mb %r2,%1(%0)"
2938 [(set_attr "type" "store")
2939 (set_attr "length" "4")])
2940
2941 ;; The definition of this insn does not really explain what it does,
2942 ;; but it should suffice
2943 ;; that anything generated as this insn will be recognized as one
2944 ;; and that it will not successfully combine with anything.
2945 (define_expand "movstrsi"
2946 [(parallel [(set (match_operand:BLK 0 "" "")
2947 (match_operand:BLK 1 "" ""))
2948 (clobber (match_dup 7))
2949 (clobber (match_dup 8))
2950 (clobber (match_dup 4))
2951 (clobber (match_dup 5))
2952 (clobber (match_dup 6))
2953 (use (match_operand:SI 2 "arith_operand" ""))
2954 (use (match_operand:SI 3 "const_int_operand" ""))])]
2955 "!TARGET_64BIT"
2956 "
2957 {
2958 int size, align;
2959
2960 /* HP provides very fast block move library routine for the PA;
2961 this routine includes:
2962
2963 4x4 byte at a time block moves,
2964 1x4 byte at a time with alignment checked at runtime with
2965 attempts to align the source and destination as needed
2966 1x1 byte loop
2967
2968 With that in mind, here's the heuristics to try and guess when
2969 the inlined block move will be better than the library block
2970 move:
2971
2972 If the size isn't constant, then always use the library routines.
2973
2974 If the size is large in respect to the known alignment, then use
2975 the library routines.
2976
2977 If the size is small in repsect to the known alignment, then open
2978 code the copy (since that will lead to better scheduling).
2979
2980 Else use the block move pattern. */
2981
2982 /* Undetermined size, use the library routine. */
2983 if (GET_CODE (operands[2]) != CONST_INT)
2984 FAIL;
2985
2986 size = INTVAL (operands[2]);
2987 align = INTVAL (operands[3]);
2988 align = align > 4 ? 4 : align;
2989
2990 /* If size/alignment > 8 (eg size is large in respect to alignment),
2991 then use the library routines. */
2992 if (size / align > 16)
2993 FAIL;
2994
2995 /* This does happen, but not often enough to worry much about. */
2996 if (size / align < MOVE_RATIO)
2997 FAIL;
2998
2999 /* Fall through means we're going to use our block move pattern. */
3000 operands[0]
3001 = replace_equiv_address (operands[0],
3002 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3003 operands[1]
3004 = replace_equiv_address (operands[1],
3005 copy_to_mode_reg (SImode, XEXP (operands[1], 0)));
3006 operands[4] = gen_reg_rtx (SImode);
3007 operands[5] = gen_reg_rtx (SImode);
3008 operands[6] = gen_reg_rtx (SImode);
3009 operands[7] = XEXP (operands[0], 0);
3010 operands[8] = XEXP (operands[1], 0);
3011 }")
3012
3013 ;; The operand constraints are written like this to support both compile-time
3014 ;; and run-time determined byte count. If the count is run-time determined,
3015 ;; the register with the byte count is clobbered by the copying code, and
3016 ;; therefore it is forced to operand 2. If the count is compile-time
3017 ;; determined, we need two scratch registers for the unrolled code.
3018 (define_insn "movstrsi_internal"
3019 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3020 (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
3021 (clobber (match_dup 0))
3022 (clobber (match_dup 1))
3023 (clobber (match_operand:SI 2 "register_operand" "=r,r")) ;loop cnt/tmp
3024 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp
3025 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3026 (use (match_operand:SI 4 "arith_operand" "J,2")) ;byte count
3027 (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
3028 "!TARGET_64BIT"
3029 "* return output_block_move (operands, !which_alternative);"
3030 [(set_attr "type" "multi,multi")])
3031 \f
3032 ;; Floating point move insns
3033
3034 ;; This pattern forces (set (reg:DF ...) (const_double ...))
3035 ;; to be reloaded by putting the constant into memory when
3036 ;; reg is a floating point register.
3037 ;;
3038 ;; For integer registers we use ldil;ldo to set the appropriate
3039 ;; value.
3040 ;;
3041 ;; This must come before the movdf pattern, and it must be present
3042 ;; to handle obscure reloading cases.
3043 (define_insn ""
3044 [(set (match_operand:DF 0 "register_operand" "=?r,f")
3045 (match_operand:DF 1 "" "?F,m"))]
3046 "GET_CODE (operands[1]) == CONST_DOUBLE
3047 && operands[1] != CONST0_RTX (DFmode)
3048 && !TARGET_64BIT
3049 && ! TARGET_SOFT_FLOAT"
3050 "* return (which_alternative == 0 ? output_move_double (operands)
3051 : \"fldd%F1 %1,%0\");"
3052 [(set_attr "type" "move,fpload")
3053 (set_attr "length" "16,4")])
3054
3055 (define_expand "movdf"
3056 [(set (match_operand:DF 0 "general_operand" "")
3057 (match_operand:DF 1 "general_operand" ""))]
3058 ""
3059 "
3060 {
3061 if (GET_CODE (operands[1]) == CONST_DOUBLE && TARGET_64BIT)
3062 operands[1] = force_const_mem (DFmode, operands[1]);
3063
3064 if (emit_move_sequence (operands, DFmode, 0))
3065 DONE;
3066 }")
3067
3068 ;; Reloading an SImode or DImode value requires a scratch register if
3069 ;; going in to or out of float point registers.
3070
3071 (define_expand "reload_indf"
3072 [(set (match_operand:DF 0 "register_operand" "=Z")
3073 (match_operand:DF 1 "non_hard_reg_operand" ""))
3074 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3075 ""
3076 "
3077 {
3078 if (emit_move_sequence (operands, DFmode, operands[2]))
3079 DONE;
3080
3081 /* We don't want the clobber emitted, so handle this ourselves. */
3082 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3083 DONE;
3084 }")
3085
3086 (define_expand "reload_outdf"
3087 [(set (match_operand:DF 0 "non_hard_reg_operand" "")
3088 (match_operand:DF 1 "register_operand" "Z"))
3089 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3090 ""
3091 "
3092 {
3093 if (emit_move_sequence (operands, DFmode, operands[2]))
3094 DONE;
3095
3096 /* We don't want the clobber emitted, so handle this ourselves. */
3097 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3098 DONE;
3099 }")
3100
3101 (define_insn ""
3102 [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
3103 "=f,*r,RQ,?o,?Q,f,*r,*r")
3104 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3105 "fG,*rG,f,*r,*r,RQ,o,RQ"))]
3106 "(register_operand (operands[0], DFmode)
3107 || reg_or_0_operand (operands[1], DFmode))
3108 && ! (GET_CODE (operands[1]) == CONST_DOUBLE
3109 && GET_CODE (operands[0]) == MEM)
3110 && ! TARGET_64BIT
3111 && ! TARGET_SOFT_FLOAT"
3112 "*
3113 {
3114 if (FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3115 || operands[1] == CONST0_RTX (DFmode))
3116 return output_fp_move_double (operands);
3117 return output_move_double (operands);
3118 }"
3119 [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load")
3120 (set_attr "length" "4,8,4,8,16,4,8,16")])
3121
3122 (define_insn ""
3123 [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
3124 "=r,?o,?Q,r,r")
3125 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3126 "rG,r,r,o,Q"))]
3127 "(register_operand (operands[0], DFmode)
3128 || reg_or_0_operand (operands[1], DFmode))
3129 && ! TARGET_64BIT
3130 && TARGET_SOFT_FLOAT"
3131 "*
3132 {
3133 return output_move_double (operands);
3134 }"
3135 [(set_attr "type" "move,store,store,load,load")
3136 (set_attr "length" "8,8,16,8,16")])
3137
3138 (define_insn ""
3139 [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
3140 "=r,r,r,r,r,Q,*q,!f,f,*TR")
3141 (match_operand:DF 1 "move_operand"
3142 "r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
3143 "(register_operand (operands[0], DFmode)
3144 || reg_or_0_operand (operands[1], DFmode))
3145 && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
3146 "@
3147 copy %1,%0
3148 ldi %1,%0
3149 ldil L'%1,%0
3150 depdi,z %z1,%0
3151 ldd%M1 %1,%0
3152 std%M0 %r1,%0
3153 mtsar %r1
3154 fcpy,dbl %f1,%0
3155 fldd%F1 %1,%0
3156 fstd%F0 %1,%0"
3157 [(set_attr "type" "move,move,move,shift,load,store,move,fpalu,fpload,fpstore")
3158 (set_attr "pa_combine_type" "addmove")
3159 (set_attr "length" "4,4,4,4,4,4,4,4,4,4")])
3160
3161 (define_insn ""
3162 [(set (match_operand:DF 0 "register_operand" "=fx")
3163 (mem:DF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3164 (match_operand:SI 2 "register_operand" "r"))))]
3165 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3166 "{flddx|fldd} %2(%1),%0"
3167 [(set_attr "type" "fpload")
3168 (set_attr "length" "4")])
3169
3170 (define_insn ""
3171 [(set (match_operand:DF 0 "register_operand" "=fx")
3172 (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "r")
3173 (match_operand:SI 2 "basereg_operand" "r"))))]
3174 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3175 "{flddx|fldd} %1(%2),%0"
3176 [(set_attr "type" "fpload")
3177 (set_attr "length" "4")])
3178
3179 (define_insn ""
3180 [(set (mem:DF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3181 (match_operand:SI 2 "register_operand" "r")))
3182 (match_operand:DF 0 "register_operand" "fx"))]
3183 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3184 "{fstdx|fstd} %0,%2(%1)"
3185 [(set_attr "type" "fpstore")
3186 (set_attr "length" "4")])
3187
3188 (define_insn ""
3189 [(set (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "r")
3190 (match_operand:SI 2 "basereg_operand" "r")))
3191 (match_operand:DF 0 "register_operand" "fx"))]
3192 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3193 "{fstdx|fstd} %0,%1(%2)"
3194 [(set_attr "type" "fpstore")
3195 (set_attr "length" "4")])
3196
3197 (define_expand "movdi"
3198 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "")
3199 (match_operand:DI 1 "general_operand" ""))]
3200 ""
3201 "
3202 {
3203 if (GET_CODE (operands[1]) == CONST_DOUBLE && TARGET_64BIT)
3204 operands[1] = force_const_mem (DImode, operands[1]);
3205
3206 if (emit_move_sequence (operands, DImode, 0))
3207 DONE;
3208 }")
3209
3210 (define_expand "reload_indi"
3211 [(set (match_operand:DI 0 "register_operand" "=Z")
3212 (match_operand:DI 1 "non_hard_reg_operand" ""))
3213 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
3214 ""
3215 "
3216 {
3217 if (emit_move_sequence (operands, DImode, operands[2]))
3218 DONE;
3219
3220 /* We don't want the clobber emitted, so handle this ourselves. */
3221 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3222 DONE;
3223 }")
3224
3225 (define_expand "reload_outdi"
3226 [(set (match_operand:DI 0 "non_hard_reg_operand" "")
3227 (match_operand:DI 1 "register_operand" "Z"))
3228 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
3229 ""
3230 "
3231 {
3232 if (emit_move_sequence (operands, DImode, operands[2]))
3233 DONE;
3234
3235 /* We don't want the clobber emitted, so handle this ourselves. */
3236 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3237 DONE;
3238 }")
3239
3240 (define_insn ""
3241 [(set (match_operand:DI 0 "register_operand" "=r")
3242 (high:DI (match_operand 1 "" "")))]
3243 "!TARGET_64BIT"
3244 "*
3245 {
3246 rtx op0 = operands[0];
3247 rtx op1 = operands[1];
3248
3249 if (GET_CODE (op1) == CONST_INT)
3250 {
3251 operands[0] = operand_subword (op0, 1, 0, DImode);
3252 output_asm_insn (\"ldil L'%1,%0\", operands);
3253
3254 operands[0] = operand_subword (op0, 0, 0, DImode);
3255 if (INTVAL (op1) < 0)
3256 output_asm_insn (\"ldi -1,%0\", operands);
3257 else
3258 output_asm_insn (\"ldi 0,%0\", operands);
3259 return \"\";
3260 }
3261 else if (GET_CODE (op1) == CONST_DOUBLE)
3262 {
3263 operands[0] = operand_subword (op0, 1, 0, DImode);
3264 operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
3265 output_asm_insn (\"ldil L'%1,%0\", operands);
3266
3267 operands[0] = operand_subword (op0, 0, 0, DImode);
3268 operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
3269 output_asm_insn (singlemove_string (operands), operands);
3270 return \"\";
3271 }
3272 else
3273 abort ();
3274 }"
3275 [(set_attr "type" "move")
3276 (set_attr "length" "8")])
3277
3278 (define_insn ""
3279 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
3280 "=r,o,Q,r,r,r,f,f,*TR")
3281 (match_operand:DI 1 "general_operand"
3282 "rM,r,r,o*R,Q,i,fM,*TR,f"))]
3283 "(register_operand (operands[0], DImode)
3284 || reg_or_0_operand (operands[1], DImode))
3285 && ! TARGET_64BIT
3286 && ! TARGET_SOFT_FLOAT"
3287 "*
3288 {
3289 if (FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3290 || (operands[1] == CONST0_RTX (DImode)))
3291 return output_fp_move_double (operands);
3292 return output_move_double (operands);
3293 }"
3294 [(set_attr "type" "move,store,store,load,load,multi,fpalu,fpload,fpstore")
3295 (set_attr "length" "8,8,16,8,16,16,4,4,4")])
3296
3297 (define_insn ""
3298 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
3299 "=r,r,r,r,r,r,Q,*q,!f,f,*TR")
3300 (match_operand:DI 1 "move_operand"
3301 "A,r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
3302 "(register_operand (operands[0], DImode)
3303 || reg_or_0_operand (operands[1], DImode))
3304 && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
3305 "@
3306 ldd RT'%A1,%0
3307 copy %1,%0
3308 ldi %1,%0
3309 ldil L'%1,%0
3310 depdi,z %z1,%0
3311 ldd%M1 %1,%0
3312 std%M0 %r1,%0
3313 mtsar %r1
3314 fcpy,dbl %f1,%0
3315 fldd%F1 %1,%0
3316 fstd%F0 %1,%0"
3317 [(set_attr "type" "load,move,move,move,shift,load,store,move,fpalu,fpload,fpstore")
3318 (set_attr "pa_combine_type" "addmove")
3319 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4")])
3320
3321 (define_insn ""
3322 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
3323 "=r,o,Q,r,r,r")
3324 (match_operand:DI 1 "general_operand"
3325 "rM,r,r,o,Q,i"))]
3326 "(register_operand (operands[0], DImode)
3327 || reg_or_0_operand (operands[1], DImode))
3328 && ! TARGET_64BIT
3329 && TARGET_SOFT_FLOAT"
3330 "*
3331 {
3332 return output_move_double (operands);
3333 }"
3334 [(set_attr "type" "move,store,store,load,load,multi")
3335 (set_attr "length" "8,8,16,8,16,16")])
3336
3337 (define_insn ""
3338 [(set (match_operand:DI 0 "register_operand" "=r,&r")
3339 (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
3340 (match_operand:DI 2 "immediate_operand" "i,i")))]
3341 "!TARGET_64BIT"
3342 "*
3343 {
3344 /* Don't output a 64 bit constant, since we can't trust the assembler to
3345 handle it correctly. */
3346 if (GET_CODE (operands[2]) == CONST_DOUBLE)
3347 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
3348 if (which_alternative == 1)
3349 output_asm_insn (\"copy %1,%0\", operands);
3350 return \"ldo R'%G2(%R1),%R0\";
3351 }"
3352 [(set_attr "type" "move,move")
3353 (set_attr "length" "4,8")])
3354
3355 ;; This pattern forces (set (reg:SF ...) (const_double ...))
3356 ;; to be reloaded by putting the constant into memory when
3357 ;; reg is a floating point register.
3358 ;;
3359 ;; For integer registers we use ldil;ldo to set the appropriate
3360 ;; value.
3361 ;;
3362 ;; This must come before the movsf pattern, and it must be present
3363 ;; to handle obscure reloading cases.
3364 (define_insn ""
3365 [(set (match_operand:SF 0 "register_operand" "=?r,f")
3366 (match_operand:SF 1 "" "?F,m"))]
3367 "GET_CODE (operands[1]) == CONST_DOUBLE
3368 && operands[1] != CONST0_RTX (SFmode)
3369 && ! TARGET_SOFT_FLOAT"
3370 "* return (which_alternative == 0 ? singlemove_string (operands)
3371 : \" fldw%F1 %1,%0\");"
3372 [(set_attr "type" "move,fpload")
3373 (set_attr "length" "8,4")])
3374
3375 (define_expand "movsf"
3376 [(set (match_operand:SF 0 "general_operand" "")
3377 (match_operand:SF 1 "general_operand" ""))]
3378 ""
3379 "
3380 {
3381 if (emit_move_sequence (operands, SFmode, 0))
3382 DONE;
3383 }")
3384
3385 ;; Reloading an SImode or DImode value requires a scratch register if
3386 ;; going in to or out of float point registers.
3387
3388 (define_expand "reload_insf"
3389 [(set (match_operand:SF 0 "register_operand" "=Z")
3390 (match_operand:SF 1 "non_hard_reg_operand" ""))
3391 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
3392 ""
3393 "
3394 {
3395 if (emit_move_sequence (operands, SFmode, operands[2]))
3396 DONE;
3397
3398 /* We don't want the clobber emitted, so handle this ourselves. */
3399 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3400 DONE;
3401 }")
3402
3403 (define_expand "reload_outsf"
3404 [(set (match_operand:SF 0 "non_hard_reg_operand" "")
3405 (match_operand:SF 1 "register_operand" "Z"))
3406 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
3407 ""
3408 "
3409 {
3410 if (emit_move_sequence (operands, SFmode, operands[2]))
3411 DONE;
3412
3413 /* We don't want the clobber emitted, so handle this ourselves. */
3414 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3415 DONE;
3416 }")
3417
3418 (define_insn ""
3419 [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand"
3420 "=f,r,f,r,RQ,Q")
3421 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
3422 "fG,rG,RQ,RQ,f,rG"))]
3423 "(register_operand (operands[0], SFmode)
3424 || reg_or_0_operand (operands[1], SFmode))
3425 && ! TARGET_SOFT_FLOAT"
3426 "@
3427 fcpy,sgl %f1,%0
3428 copy %r1,%0
3429 fldw%F1 %1,%0
3430 ldw%M1 %1,%0
3431 fstw%F0 %r1,%0
3432 stw%M0 %r1,%0"
3433 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
3434 (set_attr "pa_combine_type" "addmove")
3435 (set_attr "length" "4,4,4,4,4,4")])
3436
3437 (define_insn ""
3438 [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand"
3439 "=r,r,Q")
3440 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
3441 "rG,RQ,rG"))]
3442 "(register_operand (operands[0], SFmode)
3443 || reg_or_0_operand (operands[1], SFmode))
3444 && TARGET_SOFT_FLOAT"
3445 "@
3446 copy %r1,%0
3447 ldw%M1 %1,%0
3448 stw%M0 %r1,%0"
3449 [(set_attr "type" "move,load,store")
3450 (set_attr "pa_combine_type" "addmove")
3451 (set_attr "length" "4,4,4")])
3452
3453 (define_insn ""
3454 [(set (match_operand:SF 0 "register_operand" "=fx")
3455 (mem:SF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3456 (match_operand:SI 2 "register_operand" "r"))))]
3457 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3458 "{fldwx|fldw} %2(%1),%0"
3459 [(set_attr "type" "fpload")
3460 (set_attr "length" "4")])
3461
3462 (define_insn ""
3463 [(set (match_operand:SF 0 "register_operand" "=fx")
3464 (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "r")
3465 (match_operand:SI 2 "basereg_operand" "r"))))]
3466 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3467 "{fldwx|fldw} %1(%2),%0"
3468 [(set_attr "type" "fpload")
3469 (set_attr "length" "4")])
3470
3471 (define_insn ""
3472 [(set (mem:SF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3473 (match_operand:SI 2 "register_operand" "r")))
3474 (match_operand:SF 0 "register_operand" "fx"))]
3475 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3476 "{fstwx|fstw} %0,%2(%1)"
3477 [(set_attr "type" "fpstore")
3478 (set_attr "length" "4")])
3479 \f
3480 (define_insn ""
3481 [(set (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "r")
3482 (match_operand:SI 2 "basereg_operand" "r")))
3483 (match_operand:SF 0 "register_operand" "fx"))]
3484 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3485 "{fstwx|fstw} %0,%1(%2)"
3486 [(set_attr "type" "fpstore")
3487 (set_attr "length" "4")])
3488 \f
3489
3490 ;;- zero extension instructions
3491 ;; We have define_expand for zero extension patterns to make sure the
3492 ;; operands get loaded into registers. The define_insns accept
3493 ;; memory operands. This gives us better overall code than just
3494 ;; having a pattern that does or does not accept memory operands.
3495
3496 (define_expand "zero_extendhisi2"
3497 [(set (match_operand:SI 0 "register_operand" "")
3498 (zero_extend:SI
3499 (match_operand:HI 1 "register_operand" "")))]
3500 ""
3501 "")
3502
3503 (define_insn ""
3504 [(set (match_operand:SI 0 "register_operand" "=r,r")
3505 (zero_extend:SI
3506 (match_operand:HI 1 "move_operand" "r,RQ")))]
3507 "GET_CODE (operands[1]) != CONST_INT"
3508 "@
3509 {extru|extrw,u} %1,31,16,%0
3510 ldh%M1 %1,%0"
3511 [(set_attr "type" "shift,load")
3512 (set_attr "length" "4,4")])
3513
3514 (define_expand "zero_extendqihi2"
3515 [(set (match_operand:HI 0 "register_operand" "")
3516 (zero_extend:HI
3517 (match_operand:QI 1 "register_operand" "")))]
3518 ""
3519 "")
3520
3521 (define_insn ""
3522 [(set (match_operand:HI 0 "register_operand" "=r,r")
3523 (zero_extend:HI
3524 (match_operand:QI 1 "move_operand" "r,RQ")))]
3525 "GET_CODE (operands[1]) != CONST_INT"
3526 "@
3527 {extru|extrw,u} %1,31,8,%0
3528 ldb%M1 %1,%0"
3529 [(set_attr "type" "shift,load")
3530 (set_attr "length" "4,4")])
3531
3532 (define_expand "zero_extendqisi2"
3533 [(set (match_operand:SI 0 "register_operand" "")
3534 (zero_extend:SI
3535 (match_operand:QI 1 "register_operand" "")))]
3536 ""
3537 "")
3538
3539 (define_insn ""
3540 [(set (match_operand:SI 0 "register_operand" "=r,r")
3541 (zero_extend:SI
3542 (match_operand:QI 1 "move_operand" "r,RQ")))]
3543 "GET_CODE (operands[1]) != CONST_INT"
3544 "@
3545 {extru|extrw,u} %1,31,8,%0
3546 ldb%M1 %1,%0"
3547 [(set_attr "type" "shift,load")
3548 (set_attr "length" "4,4")])
3549
3550 (define_insn "zero_extendqidi2"
3551 [(set (match_operand:DI 0 "register_operand" "=r")
3552 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
3553 "TARGET_64BIT"
3554 "extrd,u %1,63,8,%0"
3555 [(set_attr "type" "shift")
3556 (set_attr "length" "4")])
3557
3558 (define_insn "zero_extendhidi2"
3559 [(set (match_operand:DI 0 "register_operand" "=r")
3560 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
3561 "TARGET_64BIT"
3562 "extrd,u %1,63,16,%0"
3563 [(set_attr "type" "shift")
3564 (set_attr "length" "4")])
3565
3566 (define_insn "zero_extendsidi2"
3567 [(set (match_operand:DI 0 "register_operand" "=r")
3568 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
3569 "TARGET_64BIT"
3570 "extrd,u %1,63,32,%0"
3571 [(set_attr "type" "shift")
3572 (set_attr "length" "4")])
3573
3574 ;;- sign extension instructions
3575
3576 (define_insn "extendhisi2"
3577 [(set (match_operand:SI 0 "register_operand" "=r")
3578 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
3579 ""
3580 "{extrs|extrw,s} %1,31,16,%0"
3581 [(set_attr "type" "shift")
3582 (set_attr "length" "4")])
3583
3584 (define_insn "extendqihi2"
3585 [(set (match_operand:HI 0 "register_operand" "=r")
3586 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
3587 ""
3588 "{extrs|extrw,s} %1,31,8,%0"
3589 [(set_attr "type" "shift")
3590 (set_attr "length" "4")])
3591
3592 (define_insn "extendqisi2"
3593 [(set (match_operand:SI 0 "register_operand" "=r")
3594 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
3595 ""
3596 "{extrs|extrw,s} %1,31,8,%0"
3597 [(set_attr "type" "shift")
3598 (set_attr "length" "4")])
3599
3600 (define_insn "extendqidi2"
3601 [(set (match_operand:DI 0 "register_operand" "=r")
3602 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
3603 "TARGET_64BIT"
3604 "extrd,s %1,63,8,%0"
3605 [(set_attr "type" "shift")
3606 (set_attr "length" "4")])
3607
3608 (define_insn "extendhidi2"
3609 [(set (match_operand:DI 0 "register_operand" "=r")
3610 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
3611 "TARGET_64BIT"
3612 "extrd,s %1,63,16,%0"
3613 [(set_attr "type" "shift")
3614 (set_attr "length" "4")])
3615
3616 (define_insn "extendsidi2"
3617 [(set (match_operand:DI 0 "register_operand" "=r")
3618 (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))]
3619 "TARGET_64BIT"
3620 "extrd,s %1,63,32,%0"
3621 [(set_attr "type" "shift")
3622 (set_attr "length" "4")])
3623
3624 \f
3625 ;; Conversions between float and double.
3626
3627 (define_insn "extendsfdf2"
3628 [(set (match_operand:DF 0 "register_operand" "=f")
3629 (float_extend:DF
3630 (match_operand:SF 1 "register_operand" "f")))]
3631 "! TARGET_SOFT_FLOAT"
3632 "{fcnvff|fcnv},sgl,dbl %1,%0"
3633 [(set_attr "type" "fpalu")
3634 (set_attr "length" "4")])
3635
3636 (define_insn "truncdfsf2"
3637 [(set (match_operand:SF 0 "register_operand" "=f")
3638 (float_truncate:SF
3639 (match_operand:DF 1 "register_operand" "f")))]
3640 "! TARGET_SOFT_FLOAT"
3641 "{fcnvff|fcnv},dbl,sgl %1,%0"
3642 [(set_attr "type" "fpalu")
3643 (set_attr "length" "4")])
3644
3645 ;; Conversion between fixed point and floating point.
3646 ;; Note that among the fix-to-float insns
3647 ;; the ones that start with SImode come first.
3648 ;; That is so that an operand that is a CONST_INT
3649 ;; (and therefore lacks a specific machine mode).
3650 ;; will be recognized as SImode (which is always valid)
3651 ;; rather than as QImode or HImode.
3652
3653 ;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
3654 ;; to be reloaded by putting the constant into memory.
3655 ;; It must come before the more general floatsisf2 pattern.
3656 (define_insn ""
3657 [(set (match_operand:SF 0 "register_operand" "=f")
3658 (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
3659 "! TARGET_SOFT_FLOAT"
3660 "fldw%F1 %1,%0\;{fcnvxf,sgl,sgl|fcnv,w,sgl} %0,%0"
3661 [(set_attr "type" "fpalu")
3662 (set_attr "length" "8")])
3663
3664 (define_insn "floatsisf2"
3665 [(set (match_operand:SF 0 "register_operand" "=f")
3666 (float:SF (match_operand:SI 1 "register_operand" "f")))]
3667 "! TARGET_SOFT_FLOAT"
3668 "{fcnvxf,sgl,sgl|fcnv,w,sgl} %1,%0"
3669 [(set_attr "type" "fpalu")
3670 (set_attr "length" "4")])
3671
3672 ;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
3673 ;; to be reloaded by putting the constant into memory.
3674 ;; It must come before the more general floatsidf2 pattern.
3675 (define_insn ""
3676 [(set (match_operand:DF 0 "register_operand" "=f")
3677 (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
3678 "! TARGET_SOFT_FLOAT"
3679 "fldw%F1 %1,%0\;{fcnvxf,sgl,dbl|fcnv,w,dbl} %0,%0"
3680 [(set_attr "type" "fpalu")
3681 (set_attr "length" "8")])
3682
3683 (define_insn "floatsidf2"
3684 [(set (match_operand:DF 0 "register_operand" "=f")
3685 (float:DF (match_operand:SI 1 "register_operand" "f")))]
3686 "! TARGET_SOFT_FLOAT"
3687 "{fcnvxf,sgl,dbl|fcnv,w,dbl} %1,%0"
3688 [(set_attr "type" "fpalu")
3689 (set_attr "length" "4")])
3690
3691 (define_expand "floatunssisf2"
3692 [(set (subreg:SI (match_dup 2) 4)
3693 (match_operand:SI 1 "register_operand" ""))
3694 (set (subreg:SI (match_dup 2) 0)
3695 (const_int 0))
3696 (set (match_operand:SF 0 "register_operand" "")
3697 (float:SF (match_dup 2)))]
3698 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3699 "
3700 {
3701 if (TARGET_PA_20)
3702 {
3703 emit_insn (gen_floatunssisf2_pa20 (operands[0], operands[1]));
3704 DONE;
3705 }
3706 operands[2] = gen_reg_rtx (DImode);
3707 }")
3708
3709 (define_expand "floatunssidf2"
3710 [(set (subreg:SI (match_dup 2) 4)
3711 (match_operand:SI 1 "register_operand" ""))
3712 (set (subreg:SI (match_dup 2) 0)
3713 (const_int 0))
3714 (set (match_operand:DF 0 "register_operand" "")
3715 (float:DF (match_dup 2)))]
3716 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3717 "
3718 {
3719 if (TARGET_PA_20)
3720 {
3721 emit_insn (gen_floatunssidf2_pa20 (operands[0], operands[1]));
3722 DONE;
3723 }
3724 operands[2] = gen_reg_rtx (DImode);
3725 }")
3726
3727 (define_insn "floatdisf2"
3728 [(set (match_operand:SF 0 "register_operand" "=f")
3729 (float:SF (match_operand:DI 1 "register_operand" "f")))]
3730 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3731 "{fcnvxf,dbl,sgl|fcnv,dw,sgl} %1,%0"
3732 [(set_attr "type" "fpalu")
3733 (set_attr "length" "4")])
3734
3735 (define_insn "floatdidf2"
3736 [(set (match_operand:DF 0 "register_operand" "=f")
3737 (float:DF (match_operand:DI 1 "register_operand" "f")))]
3738 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3739 "{fcnvxf,dbl,dbl|fcnv,dw,dbl} %1,%0"
3740 [(set_attr "type" "fpalu")
3741 (set_attr "length" "4")])
3742
3743 ;; Convert a float to an actual integer.
3744 ;; Truncation is performed as part of the conversion.
3745
3746 (define_insn "fix_truncsfsi2"
3747 [(set (match_operand:SI 0 "register_operand" "=f")
3748 (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3749 "! TARGET_SOFT_FLOAT"
3750 "{fcnvfxt,sgl,sgl|fcnv,t,sgl,w} %1,%0"
3751 [(set_attr "type" "fpalu")
3752 (set_attr "length" "4")])
3753
3754 (define_insn "fix_truncdfsi2"
3755 [(set (match_operand:SI 0 "register_operand" "=f")
3756 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3757 "! TARGET_SOFT_FLOAT"
3758 "{fcnvfxt,dbl,sgl|fcnv,t,dbl,w} %1,%0"
3759 [(set_attr "type" "fpalu")
3760 (set_attr "length" "4")])
3761
3762 (define_insn "fix_truncsfdi2"
3763 [(set (match_operand:DI 0 "register_operand" "=f")
3764 (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3765 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3766 "{fcnvfxt,sgl,dbl|fcnv,t,sgl,dw} %1,%0"
3767 [(set_attr "type" "fpalu")
3768 (set_attr "length" "4")])
3769
3770 (define_insn "fix_truncdfdi2"
3771 [(set (match_operand:DI 0 "register_operand" "=f")
3772 (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3773 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3774 "{fcnvfxt,dbl,dbl|fcnv,t,dbl,dw} %1,%0"
3775 [(set_attr "type" "fpalu")
3776 (set_attr "length" "4")])
3777
3778 (define_insn "floatunssidf2_pa20"
3779 [(set (match_operand:DF 0 "register_operand" "=f")
3780 (unsigned_float:DF (match_operand:SI 1 "register_operand" "f")))]
3781 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3782 "fcnv,uw,dbl %1,%0"
3783 [(set_attr "type" "fpalu")
3784 (set_attr "length" "4")])
3785
3786 (define_insn "floatunssisf2_pa20"
3787 [(set (match_operand:SF 0 "register_operand" "=f")
3788 (unsigned_float:SF (match_operand:SI 1 "register_operand" "f")))]
3789 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3790 "fcnv,uw,sgl %1,%0"
3791 [(set_attr "type" "fpalu")
3792 (set_attr "length" "4")])
3793
3794 (define_insn "floatunsdisf2"
3795 [(set (match_operand:SF 0 "register_operand" "=f")
3796 (unsigned_float:SF (match_operand:DI 1 "register_operand" "f")))]
3797 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3798 "fcnv,udw,sgl %1,%0"
3799 [(set_attr "type" "fpalu")
3800 (set_attr "length" "4")])
3801
3802 (define_insn "floatunsdidf2"
3803 [(set (match_operand:DF 0 "register_operand" "=f")
3804 (unsigned_float:DF (match_operand:DI 1 "register_operand" "f")))]
3805 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3806 "fcnv,udw,dbl %1,%0"
3807 [(set_attr "type" "fpalu")
3808 (set_attr "length" "4")])
3809
3810 (define_insn "fixuns_truncsfsi2"
3811 [(set (match_operand:SI 0 "register_operand" "=f")
3812 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3813 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3814 "fcnv,t,sgl,uw %1,%0"
3815 [(set_attr "type" "fpalu")
3816 (set_attr "length" "4")])
3817
3818 (define_insn "fixuns_truncdfsi2"
3819 [(set (match_operand:SI 0 "register_operand" "=f")
3820 (unsigned_fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3821 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3822 "fcnv,t,dbl,uw %1,%0"
3823 [(set_attr "type" "fpalu")
3824 (set_attr "length" "4")])
3825
3826 (define_insn "fixuns_truncsfdi2"
3827 [(set (match_operand:DI 0 "register_operand" "=f")
3828 (unsigned_fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3829 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3830 "fcnv,t,sgl,udw %1,%0"
3831 [(set_attr "type" "fpalu")
3832 (set_attr "length" "4")])
3833
3834 (define_insn "fixuns_truncdfdi2"
3835 [(set (match_operand:DI 0 "register_operand" "=f")
3836 (unsigned_fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3837 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3838 "fcnv,t,dbl,udw %1,%0"
3839 [(set_attr "type" "fpalu")
3840 (set_attr "length" "4")])
3841 \f
3842 ;;- arithmetic instructions
3843
3844 (define_expand "adddi3"
3845 [(set (match_operand:DI 0 "register_operand" "")
3846 (plus:DI (match_operand:DI 1 "register_operand" "")
3847 (match_operand:DI 2 "adddi3_operand" "")))]
3848 ""
3849 "")
3850
3851 (define_insn ""
3852 [(set (match_operand:DI 0 "register_operand" "=r")
3853 (plus:DI (match_operand:DI 1 "register_operand" "%r")
3854 (match_operand:DI 2 "arith11_operand" "rI")))]
3855 "!TARGET_64BIT"
3856 "*
3857 {
3858 if (GET_CODE (operands[2]) == CONST_INT)
3859 {
3860 if (INTVAL (operands[2]) >= 0)
3861 return \"addi %2,%R1,%R0\;{addc|add,c} %1,%%r0,%0\";
3862 else
3863 return \"addi %2,%R1,%R0\;{subb|sub,b} %1,%%r0,%0\";
3864 }
3865 else
3866 return \"add %R2,%R1,%R0\;{addc|add,c} %2,%1,%0\";
3867 }"
3868 [(set_attr "type" "binary")
3869 (set_attr "length" "8")])
3870
3871 (define_insn ""
3872 [(set (match_operand:DI 0 "register_operand" "=r,r")
3873 (plus:DI (match_operand:DI 1 "register_operand" "%r,r")
3874 (match_operand:DI 2 "arith_operand" "r,J")))]
3875 "TARGET_64BIT"
3876 "@
3877 {addl|add,l} %1,%2,%0
3878 ldo %2(%1),%0"
3879 [(set_attr "type" "binary,binary")
3880 (set_attr "pa_combine_type" "addmove")
3881 (set_attr "length" "4,4")])
3882
3883 (define_insn ""
3884 [(set (match_operand:DI 0 "register_operand" "=r")
3885 (plus:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
3886 (match_operand:DI 2 "register_operand" "r")))]
3887 "TARGET_64BIT"
3888 "uaddcm %2,%1,%0"
3889 [(set_attr "type" "binary")
3890 (set_attr "length" "4")])
3891
3892 (define_insn ""
3893 [(set (match_operand:SI 0 "register_operand" "=r")
3894 (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
3895 (match_operand:SI 2 "register_operand" "r")))]
3896 ""
3897 "uaddcm %2,%1,%0"
3898 [(set_attr "type" "binary")
3899 (set_attr "length" "4")])
3900
3901 ;; define_splits to optimize cases of adding a constant integer
3902 ;; to a register when the constant does not fit in 14 bits. */
3903 (define_split
3904 [(set (match_operand:SI 0 "register_operand" "")
3905 (plus:SI (match_operand:SI 1 "register_operand" "")
3906 (match_operand:SI 2 "const_int_operand" "")))
3907 (clobber (match_operand:SI 4 "register_operand" ""))]
3908 "! cint_ok_for_move (INTVAL (operands[2]))
3909 && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
3910 [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
3911 (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
3912 "
3913 {
3914 int val = INTVAL (operands[2]);
3915 int low = (val < 0) ? -0x2000 : 0x1fff;
3916 int rest = val - low;
3917
3918 operands[2] = GEN_INT (rest);
3919 operands[3] = GEN_INT (low);
3920 }")
3921
3922 (define_split
3923 [(set (match_operand:SI 0 "register_operand" "")
3924 (plus:SI (match_operand:SI 1 "register_operand" "")
3925 (match_operand:SI 2 "const_int_operand" "")))
3926 (clobber (match_operand:SI 4 "register_operand" ""))]
3927 "! cint_ok_for_move (INTVAL (operands[2]))"
3928 [(set (match_dup 4) (match_dup 2))
3929 (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
3930 (match_dup 1)))]
3931 "
3932 {
3933 HOST_WIDE_INT intval = INTVAL (operands[2]);
3934
3935 /* Try dividing the constant by 2, then 4, and finally 8 to see
3936 if we can get a constant which can be loaded into a register
3937 in a single instruction (cint_ok_for_move).
3938
3939 If that fails, try to negate the constant and subtract it
3940 from our input operand. */
3941 if (intval % 2 == 0 && cint_ok_for_move (intval / 2))
3942 {
3943 operands[2] = GEN_INT (intval / 2);
3944 operands[3] = GEN_INT (2);
3945 }
3946 else if (intval % 4 == 0 && cint_ok_for_move (intval / 4))
3947 {
3948 operands[2] = GEN_INT (intval / 4);
3949 operands[3] = GEN_INT (4);
3950 }
3951 else if (intval % 8 == 0 && cint_ok_for_move (intval / 8))
3952 {
3953 operands[2] = GEN_INT (intval / 8);
3954 operands[3] = GEN_INT (8);
3955 }
3956 else if (cint_ok_for_move (-intval))
3957 {
3958 emit_insn (gen_rtx_SET (VOIDmode, operands[4], GEN_INT (-intval)));
3959 emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
3960 DONE;
3961 }
3962 else
3963 FAIL;
3964 }")
3965
3966 (define_insn "addsi3"
3967 [(set (match_operand:SI 0 "register_operand" "=r,r")
3968 (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
3969 (match_operand:SI 2 "arith_operand" "r,J")))]
3970 ""
3971 "@
3972 {addl|add,l} %1,%2,%0
3973 ldo %2(%1),%0"
3974 [(set_attr "type" "binary,binary")
3975 (set_attr "pa_combine_type" "addmove")
3976 (set_attr "length" "4,4")])
3977
3978 (define_expand "subdi3"
3979 [(set (match_operand:DI 0 "register_operand" "")
3980 (minus:DI (match_operand:DI 1 "register_operand" "")
3981 (match_operand:DI 2 "register_operand" "")))]
3982 ""
3983 "")
3984
3985 (define_insn ""
3986 [(set (match_operand:DI 0 "register_operand" "=r")
3987 (minus:DI (match_operand:DI 1 "register_operand" "r")
3988 (match_operand:DI 2 "register_operand" "r")))]
3989 "!TARGET_64BIT"
3990 "sub %R1,%R2,%R0\;{subb|sub,b} %1,%2,%0"
3991 [(set_attr "type" "binary")
3992 (set_attr "length" "8")])
3993
3994 (define_insn ""
3995 [(set (match_operand:DI 0 "register_operand" "=r,r,q")
3996 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I,U")
3997 (match_operand:DI 2 "register_operand" "r,r,r")))]
3998 "TARGET_64BIT"
3999 "@
4000 sub %1,%2,%0
4001 subi %1,%2,%0
4002 mtsarcm %2"
4003 [(set_attr "type" "binary,binary,move")
4004 (set_attr "length" "4,4,4")])
4005
4006 (define_expand "subsi3"
4007 [(set (match_operand:SI 0 "register_operand" "")
4008 (minus:SI (match_operand:SI 1 "arith11_operand" "")
4009 (match_operand:SI 2 "register_operand" "")))]
4010 ""
4011 "")
4012
4013 (define_insn ""
4014 [(set (match_operand:SI 0 "register_operand" "=r,r")
4015 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
4016 (match_operand:SI 2 "register_operand" "r,r")))]
4017 "!TARGET_PA_20"
4018 "@
4019 sub %1,%2,%0
4020 subi %1,%2,%0"
4021 [(set_attr "type" "binary,binary")
4022 (set_attr "length" "4,4")])
4023
4024 (define_insn ""
4025 [(set (match_operand:SI 0 "register_operand" "=r,r,q")
4026 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I,S")
4027 (match_operand:SI 2 "register_operand" "r,r,r")))]
4028 "TARGET_PA_20"
4029 "@
4030 sub %1,%2,%0
4031 subi %1,%2,%0
4032 mtsarcm %2"
4033 [(set_attr "type" "binary,binary,move")
4034 (set_attr "length" "4,4,4")])
4035
4036 ;; Clobbering a "register_operand" instead of a match_scratch
4037 ;; in operand3 of millicode calls avoids spilling %r1 and
4038 ;; produces better code.
4039
4040 ;; The mulsi3 insns set up registers for the millicode call.
4041 (define_expand "mulsi3"
4042 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4043 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4044 (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
4045 (clobber (match_dup 3))
4046 (clobber (reg:SI 26))
4047 (clobber (reg:SI 25))
4048 (clobber (match_dup 4))])
4049 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4050 ""
4051 "
4052 {
4053 operands[4] = gen_rtx_REG (SImode, TARGET_64BIT ? 2 : 31);
4054 if (TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT)
4055 {
4056 rtx scratch = gen_reg_rtx (DImode);
4057 operands[1] = force_reg (SImode, operands[1]);
4058 operands[2] = force_reg (SImode, operands[2]);
4059 emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
4060 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
4061 gen_rtx_SUBREG (SImode, scratch, GET_MODE_SIZE (SImode))));
4062 DONE;
4063 }
4064 operands[3] = gen_reg_rtx (SImode);
4065 }")
4066
4067 (define_insn "umulsidi3"
4068 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
4069 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
4070 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
4071 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
4072 "xmpyu %1,%2,%0"
4073 [(set_attr "type" "fpmuldbl")
4074 (set_attr "length" "4")])
4075
4076 (define_insn ""
4077 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
4078 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
4079 (match_operand:DI 2 "uint32_operand" "f")))]
4080 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT"
4081 "xmpyu %1,%R2,%0"
4082 [(set_attr "type" "fpmuldbl")
4083 (set_attr "length" "4")])
4084
4085 (define_insn ""
4086 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
4087 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
4088 (match_operand:DI 2 "uint32_operand" "f")))]
4089 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
4090 "xmpyu %1,%2R,%0"
4091 [(set_attr "type" "fpmuldbl")
4092 (set_attr "length" "4")])
4093
4094 (define_insn ""
4095 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
4096 (clobber (match_operand:SI 0 "register_operand" "=a"))
4097 (clobber (reg:SI 26))
4098 (clobber (reg:SI 25))
4099 (clobber (reg:SI 31))]
4100 "!TARGET_64BIT"
4101 "* return output_mul_insn (0, insn);"
4102 [(set_attr "type" "milli")
4103 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4104
4105 (define_insn ""
4106 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
4107 (clobber (match_operand:SI 0 "register_operand" "=a"))
4108 (clobber (reg:SI 26))
4109 (clobber (reg:SI 25))
4110 (clobber (reg:SI 2))]
4111 "TARGET_64BIT"
4112 "* return output_mul_insn (0, insn);"
4113 [(set_attr "type" "milli")
4114 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4115
4116 (define_expand "muldi3"
4117 [(set (match_operand:DI 0 "register_operand" "")
4118 (mult:DI (match_operand:DI 1 "register_operand" "")
4119 (match_operand:DI 2 "register_operand" "")))]
4120 "TARGET_64BIT && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
4121 "
4122 {
4123 rtx low_product = gen_reg_rtx (DImode);
4124 rtx cross_product1 = gen_reg_rtx (DImode);
4125 rtx cross_product2 = gen_reg_rtx (DImode);
4126 rtx cross_scratch = gen_reg_rtx (DImode);
4127 rtx cross_product = gen_reg_rtx (DImode);
4128 rtx op1l, op1r, op2l, op2r;
4129 rtx op1shifted, op2shifted;
4130
4131 op1shifted = gen_reg_rtx (DImode);
4132 op2shifted = gen_reg_rtx (DImode);
4133 op1l = gen_reg_rtx (SImode);
4134 op1r = gen_reg_rtx (SImode);
4135 op2l = gen_reg_rtx (SImode);
4136 op2r = gen_reg_rtx (SImode);
4137
4138 emit_move_insn (op1shifted, gen_rtx_LSHIFTRT (DImode, operands[1],
4139 GEN_INT (32)));
4140 emit_move_insn (op2shifted, gen_rtx_LSHIFTRT (DImode, operands[2],
4141 GEN_INT (32)));
4142 op1r = gen_rtx_SUBREG (SImode, operands[1], 4);
4143 op2r = gen_rtx_SUBREG (SImode, operands[2], 4);
4144 op1l = gen_rtx_SUBREG (SImode, op1shifted, 4);
4145 op2l = gen_rtx_SUBREG (SImode, op2shifted, 4);
4146
4147 /* Emit multiplies for the cross products. */
4148 emit_insn (gen_umulsidi3 (cross_product1, op2r, op1l));
4149 emit_insn (gen_umulsidi3 (cross_product2, op2l, op1r));
4150
4151 /* Emit a multiply for the low sub-word. */
4152 emit_insn (gen_umulsidi3 (low_product, copy_rtx (op2r), copy_rtx (op1r)));
4153
4154 /* Sum the cross products and shift them into proper position. */
4155 emit_insn (gen_adddi3 (cross_scratch, cross_product1, cross_product2));
4156 emit_insn (gen_ashldi3 (cross_product, cross_scratch, GEN_INT (32)));
4157
4158 /* Add the cross product to the low product and store the result
4159 into the output operand . */
4160 emit_insn (gen_adddi3 (operands[0], cross_product, low_product));
4161 DONE;
4162 }")
4163
4164 ;;; Division and mod.
4165 (define_expand "divsi3"
4166 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4167 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4168 (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
4169 (clobber (match_dup 3))
4170 (clobber (match_dup 4))
4171 (clobber (reg:SI 26))
4172 (clobber (reg:SI 25))
4173 (clobber (match_dup 5))])
4174 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4175 ""
4176 "
4177 {
4178 operands[3] = gen_reg_rtx (SImode);
4179 if (TARGET_64BIT)
4180 {
4181 operands[5] = gen_rtx_REG (SImode, 2);
4182 operands[4] = operands[5];
4183 }
4184 else
4185 {
4186 operands[5] = gen_rtx_REG (SImode, 31);
4187 operands[4] = gen_reg_rtx (SImode);
4188 }
4189 if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 0))
4190 DONE;
4191 }")
4192
4193 (define_insn ""
4194 [(set (reg:SI 29)
4195 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4196 (clobber (match_operand:SI 1 "register_operand" "=a"))
4197 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4198 (clobber (reg:SI 26))
4199 (clobber (reg:SI 25))
4200 (clobber (reg:SI 31))]
4201 "!TARGET_64BIT"
4202 "*
4203 return output_div_insn (operands, 0, insn);"
4204 [(set_attr "type" "milli")
4205 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4206
4207 (define_insn ""
4208 [(set (reg:SI 29)
4209 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4210 (clobber (match_operand:SI 1 "register_operand" "=a"))
4211 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4212 (clobber (reg:SI 26))
4213 (clobber (reg:SI 25))
4214 (clobber (reg:SI 2))]
4215 "TARGET_64BIT"
4216 "*
4217 return output_div_insn (operands, 0, insn);"
4218 [(set_attr "type" "milli")
4219 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4220
4221 (define_expand "udivsi3"
4222 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4223 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4224 (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
4225 (clobber (match_dup 3))
4226 (clobber (match_dup 4))
4227 (clobber (reg:SI 26))
4228 (clobber (reg:SI 25))
4229 (clobber (match_dup 5))])
4230 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4231 ""
4232 "
4233 {
4234 operands[3] = gen_reg_rtx (SImode);
4235
4236 if (TARGET_64BIT)
4237 {
4238 operands[5] = gen_rtx_REG (SImode, 2);
4239 operands[4] = operands[5];
4240 }
4241 else
4242 {
4243 operands[5] = gen_rtx_REG (SImode, 31);
4244 operands[4] = gen_reg_rtx (SImode);
4245 }
4246 if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 1))
4247 DONE;
4248 }")
4249
4250 (define_insn ""
4251 [(set (reg:SI 29)
4252 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4253 (clobber (match_operand:SI 1 "register_operand" "=a"))
4254 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4255 (clobber (reg:SI 26))
4256 (clobber (reg:SI 25))
4257 (clobber (reg:SI 31))]
4258 "!TARGET_64BIT"
4259 "*
4260 return output_div_insn (operands, 1, insn);"
4261 [(set_attr "type" "milli")
4262 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4263
4264 (define_insn ""
4265 [(set (reg:SI 29)
4266 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4267 (clobber (match_operand:SI 1 "register_operand" "=a"))
4268 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4269 (clobber (reg:SI 26))
4270 (clobber (reg:SI 25))
4271 (clobber (reg:SI 2))]
4272 "TARGET_64BIT"
4273 "*
4274 return output_div_insn (operands, 1, insn);"
4275 [(set_attr "type" "milli")
4276 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4277
4278 (define_expand "modsi3"
4279 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4280 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4281 (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
4282 (clobber (match_dup 3))
4283 (clobber (match_dup 4))
4284 (clobber (reg:SI 26))
4285 (clobber (reg:SI 25))
4286 (clobber (match_dup 5))])
4287 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4288 ""
4289 "
4290 {
4291 if (TARGET_64BIT)
4292 {
4293 operands[5] = gen_rtx_REG (SImode, 2);
4294 operands[4] = operands[5];
4295 }
4296 else
4297 {
4298 operands[5] = gen_rtx_REG (SImode, 31);
4299 operands[4] = gen_reg_rtx (SImode);
4300 }
4301 operands[3] = gen_reg_rtx (SImode);
4302 }")
4303
4304 (define_insn ""
4305 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
4306 (clobber (match_operand:SI 0 "register_operand" "=a"))
4307 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4308 (clobber (reg:SI 26))
4309 (clobber (reg:SI 25))
4310 (clobber (reg:SI 31))]
4311 "!TARGET_64BIT"
4312 "*
4313 return output_mod_insn (0, insn);"
4314 [(set_attr "type" "milli")
4315 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4316
4317 (define_insn ""
4318 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
4319 (clobber (match_operand:SI 0 "register_operand" "=a"))
4320 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4321 (clobber (reg:SI 26))
4322 (clobber (reg:SI 25))
4323 (clobber (reg:SI 2))]
4324 "TARGET_64BIT"
4325 "*
4326 return output_mod_insn (0, insn);"
4327 [(set_attr "type" "milli")
4328 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4329
4330 (define_expand "umodsi3"
4331 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4332 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4333 (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
4334 (clobber (match_dup 3))
4335 (clobber (match_dup 4))
4336 (clobber (reg:SI 26))
4337 (clobber (reg:SI 25))
4338 (clobber (match_dup 5))])
4339 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4340 ""
4341 "
4342 {
4343 if (TARGET_64BIT)
4344 {
4345 operands[5] = gen_rtx_REG (SImode, 2);
4346 operands[4] = operands[5];
4347 }
4348 else
4349 {
4350 operands[5] = gen_rtx_REG (SImode, 31);
4351 operands[4] = gen_reg_rtx (SImode);
4352 }
4353 operands[3] = gen_reg_rtx (SImode);
4354 }")
4355
4356 (define_insn ""
4357 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
4358 (clobber (match_operand:SI 0 "register_operand" "=a"))
4359 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4360 (clobber (reg:SI 26))
4361 (clobber (reg:SI 25))
4362 (clobber (reg:SI 31))]
4363 "!TARGET_64BIT"
4364 "*
4365 return output_mod_insn (1, insn);"
4366 [(set_attr "type" "milli")
4367 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4368
4369 (define_insn ""
4370 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
4371 (clobber (match_operand:SI 0 "register_operand" "=a"))
4372 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4373 (clobber (reg:SI 26))
4374 (clobber (reg:SI 25))
4375 (clobber (reg:SI 2))]
4376 "TARGET_64BIT"
4377 "*
4378 return output_mod_insn (1, insn);"
4379 [(set_attr "type" "milli")
4380 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
4381
4382 ;;- and instructions
4383 ;; We define DImode `and` so with DImode `not` we can get
4384 ;; DImode `andn`. Other combinations are possible.
4385
4386 (define_expand "anddi3"
4387 [(set (match_operand:DI 0 "register_operand" "")
4388 (and:DI (match_operand:DI 1 "arith_double_operand" "")
4389 (match_operand:DI 2 "arith_double_operand" "")))]
4390 ""
4391 "
4392 {
4393 if (! register_operand (operands[1], DImode)
4394 || ! register_operand (operands[2], DImode))
4395 /* Let GCC break this into word-at-a-time operations. */
4396 FAIL;
4397 }")
4398
4399 (define_insn ""
4400 [(set (match_operand:DI 0 "register_operand" "=r")
4401 (and:DI (match_operand:DI 1 "register_operand" "%r")
4402 (match_operand:DI 2 "register_operand" "r")))]
4403 "!TARGET_64BIT"
4404 "and %1,%2,%0\;and %R1,%R2,%R0"
4405 [(set_attr "type" "binary")
4406 (set_attr "length" "8")])
4407
4408 (define_insn ""
4409 [(set (match_operand:DI 0 "register_operand" "=r,r")
4410 (and:DI (match_operand:DI 1 "register_operand" "%?r,0")
4411 (match_operand:DI 2 "and_operand" "rO,P")))]
4412 "TARGET_64BIT"
4413 "* return output_64bit_and (operands); "
4414 [(set_attr "type" "binary")
4415 (set_attr "length" "4")])
4416
4417 ; The ? for op1 makes reload prefer zdepi instead of loading a huge
4418 ; constant with ldil;ldo.
4419 (define_insn "andsi3"
4420 [(set (match_operand:SI 0 "register_operand" "=r,r")
4421 (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
4422 (match_operand:SI 2 "and_operand" "rO,P")))]
4423 ""
4424 "* return output_and (operands); "
4425 [(set_attr "type" "binary,shift")
4426 (set_attr "length" "4,4")])
4427
4428 (define_insn ""
4429 [(set (match_operand:DI 0 "register_operand" "=r")
4430 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
4431 (match_operand:DI 2 "register_operand" "r")))]
4432 "!TARGET_64BIT"
4433 "andcm %2,%1,%0\;andcm %R2,%R1,%R0"
4434 [(set_attr "type" "binary")
4435 (set_attr "length" "8")])
4436
4437 (define_insn ""
4438 [(set (match_operand:DI 0 "register_operand" "=r")
4439 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
4440 (match_operand:DI 2 "register_operand" "r")))]
4441 "TARGET_64BIT"
4442 "andcm %2,%1,%0"
4443 [(set_attr "type" "binary")
4444 (set_attr "length" "4")])
4445
4446 (define_insn ""
4447 [(set (match_operand:SI 0 "register_operand" "=r")
4448 (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
4449 (match_operand:SI 2 "register_operand" "r")))]
4450 ""
4451 "andcm %2,%1,%0"
4452 [(set_attr "type" "binary")
4453 (set_attr "length" "4")])
4454
4455 (define_expand "iordi3"
4456 [(set (match_operand:DI 0 "register_operand" "")
4457 (ior:DI (match_operand:DI 1 "arith_double_operand" "")
4458 (match_operand:DI 2 "arith_double_operand" "")))]
4459 ""
4460 "
4461 {
4462 if (! register_operand (operands[1], DImode)
4463 || ! register_operand (operands[2], DImode))
4464 /* Let GCC break this into word-at-a-time operations. */
4465 FAIL;
4466 }")
4467
4468 (define_insn ""
4469 [(set (match_operand:DI 0 "register_operand" "=r")
4470 (ior:DI (match_operand:DI 1 "register_operand" "%r")
4471 (match_operand:DI 2 "register_operand" "r")))]
4472 "!TARGET_64BIT"
4473 "or %1,%2,%0\;or %R1,%R2,%R0"
4474 [(set_attr "type" "binary")
4475 (set_attr "length" "8")])
4476
4477 (define_insn ""
4478 [(set (match_operand:DI 0 "register_operand" "=r,r")
4479 (ior:DI (match_operand:DI 1 "register_operand" "0,0")
4480 (match_operand:DI 2 "ior_operand" "M,i")))]
4481 "TARGET_64BIT"
4482 "* return output_64bit_ior (operands); "
4483 [(set_attr "type" "binary,shift")
4484 (set_attr "length" "4,4")])
4485
4486 (define_insn ""
4487 [(set (match_operand:DI 0 "register_operand" "=r")
4488 (ior:DI (match_operand:DI 1 "register_operand" "%r")
4489 (match_operand:DI 2 "register_operand" "r")))]
4490 "TARGET_64BIT"
4491 "or %1,%2,%0"
4492 [(set_attr "type" "binary")
4493 (set_attr "length" "4")])
4494
4495 ;; Need a define_expand because we've run out of CONST_OK... characters.
4496 (define_expand "iorsi3"
4497 [(set (match_operand:SI 0 "register_operand" "")
4498 (ior:SI (match_operand:SI 1 "register_operand" "")
4499 (match_operand:SI 2 "arith32_operand" "")))]
4500 ""
4501 "
4502 {
4503 if (! (ior_operand (operands[2], SImode)
4504 || register_operand (operands[2], SImode)))
4505 operands[2] = force_reg (SImode, operands[2]);
4506 }")
4507
4508 (define_insn ""
4509 [(set (match_operand:SI 0 "register_operand" "=r,r")
4510 (ior:SI (match_operand:SI 1 "register_operand" "0,0")
4511 (match_operand:SI 2 "ior_operand" "M,i")))]
4512 ""
4513 "* return output_ior (operands); "
4514 [(set_attr "type" "binary,shift")
4515 (set_attr "length" "4,4")])
4516
4517 (define_insn ""
4518 [(set (match_operand:SI 0 "register_operand" "=r")
4519 (ior:SI (match_operand:SI 1 "register_operand" "%r")
4520 (match_operand:SI 2 "register_operand" "r")))]
4521 ""
4522 "or %1,%2,%0"
4523 [(set_attr "type" "binary")
4524 (set_attr "length" "4")])
4525
4526 (define_expand "xordi3"
4527 [(set (match_operand:DI 0 "register_operand" "")
4528 (xor:DI (match_operand:DI 1 "arith_double_operand" "")
4529 (match_operand:DI 2 "arith_double_operand" "")))]
4530 ""
4531 "
4532 {
4533 if (! register_operand (operands[1], DImode)
4534 || ! register_operand (operands[2], DImode))
4535 /* Let GCC break this into word-at-a-time operations. */
4536 FAIL;
4537 }")
4538
4539 (define_insn ""
4540 [(set (match_operand:DI 0 "register_operand" "=r")
4541 (xor:DI (match_operand:DI 1 "register_operand" "%r")
4542 (match_operand:DI 2 "register_operand" "r")))]
4543 "!TARGET_64BIT"
4544 "xor %1,%2,%0\;xor %R1,%R2,%R0"
4545 [(set_attr "type" "binary")
4546 (set_attr "length" "8")])
4547
4548 (define_insn ""
4549 [(set (match_operand:DI 0 "register_operand" "=r")
4550 (xor:DI (match_operand:DI 1 "register_operand" "%r")
4551 (match_operand:DI 2 "register_operand" "r")))]
4552 "TARGET_64BIT"
4553 "xor %1,%2,%0"
4554 [(set_attr "type" "binary")
4555 (set_attr "length" "4")])
4556
4557 (define_insn "xorsi3"
4558 [(set (match_operand:SI 0 "register_operand" "=r")
4559 (xor:SI (match_operand:SI 1 "register_operand" "%r")
4560 (match_operand:SI 2 "register_operand" "r")))]
4561 ""
4562 "xor %1,%2,%0"
4563 [(set_attr "type" "binary")
4564 (set_attr "length" "4")])
4565
4566 (define_expand "negdi2"
4567 [(set (match_operand:DI 0 "register_operand" "")
4568 (neg:DI (match_operand:DI 1 "register_operand" "")))]
4569 ""
4570 "")
4571
4572 (define_insn ""
4573 [(set (match_operand:DI 0 "register_operand" "=r")
4574 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
4575 "!TARGET_64BIT"
4576 "sub %%r0,%R1,%R0\;{subb|sub,b} %%r0,%1,%0"
4577 [(set_attr "type" "unary")
4578 (set_attr "length" "8")])
4579
4580 (define_insn ""
4581 [(set (match_operand:DI 0 "register_operand" "=r")
4582 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
4583 "TARGET_64BIT"
4584 "sub %%r0,%1,%0"
4585 [(set_attr "type" "unary")
4586 (set_attr "length" "4")])
4587
4588 (define_insn "negsi2"
4589 [(set (match_operand:SI 0 "register_operand" "=r")
4590 (neg:SI (match_operand:SI 1 "register_operand" "r")))]
4591 ""
4592 "sub %%r0,%1,%0"
4593 [(set_attr "type" "unary")
4594 (set_attr "length" "4")])
4595
4596 (define_expand "one_cmpldi2"
4597 [(set (match_operand:DI 0 "register_operand" "")
4598 (not:DI (match_operand:DI 1 "arith_double_operand" "")))]
4599 ""
4600 "
4601 {
4602 if (! register_operand (operands[1], DImode))
4603 FAIL;
4604 }")
4605
4606 (define_insn ""
4607 [(set (match_operand:DI 0 "register_operand" "=r")
4608 (not:DI (match_operand:DI 1 "register_operand" "r")))]
4609 "!TARGET_64BIT"
4610 "uaddcm %%r0,%1,%0\;uaddcm %%r0,%R1,%R0"
4611 [(set_attr "type" "unary")
4612 (set_attr "length" "8")])
4613
4614 (define_insn ""
4615 [(set (match_operand:DI 0 "register_operand" "=r")
4616 (not:DI (match_operand:DI 1 "register_operand" "r")))]
4617 "TARGET_64BIT"
4618 "uaddcm %%r0,%1,%0"
4619 [(set_attr "type" "unary")
4620 (set_attr "length" "4")])
4621
4622 (define_insn "one_cmplsi2"
4623 [(set (match_operand:SI 0 "register_operand" "=r")
4624 (not:SI (match_operand:SI 1 "register_operand" "r")))]
4625 ""
4626 "uaddcm %%r0,%1,%0"
4627 [(set_attr "type" "unary")
4628 (set_attr "length" "4")])
4629 \f
4630 ;; Floating point arithmetic instructions.
4631
4632 (define_insn "adddf3"
4633 [(set (match_operand:DF 0 "register_operand" "=f")
4634 (plus:DF (match_operand:DF 1 "register_operand" "f")
4635 (match_operand:DF 2 "register_operand" "f")))]
4636 "! TARGET_SOFT_FLOAT"
4637 "fadd,dbl %1,%2,%0"
4638 [(set_attr "type" "fpalu")
4639 (set_attr "pa_combine_type" "faddsub")
4640 (set_attr "length" "4")])
4641
4642 (define_insn "addsf3"
4643 [(set (match_operand:SF 0 "register_operand" "=f")
4644 (plus:SF (match_operand:SF 1 "register_operand" "f")
4645 (match_operand:SF 2 "register_operand" "f")))]
4646 "! TARGET_SOFT_FLOAT"
4647 "fadd,sgl %1,%2,%0"
4648 [(set_attr "type" "fpalu")
4649 (set_attr "pa_combine_type" "faddsub")
4650 (set_attr "length" "4")])
4651
4652 (define_insn "subdf3"
4653 [(set (match_operand:DF 0 "register_operand" "=f")
4654 (minus:DF (match_operand:DF 1 "register_operand" "f")
4655 (match_operand:DF 2 "register_operand" "f")))]
4656 "! TARGET_SOFT_FLOAT"
4657 "fsub,dbl %1,%2,%0"
4658 [(set_attr "type" "fpalu")
4659 (set_attr "pa_combine_type" "faddsub")
4660 (set_attr "length" "4")])
4661
4662 (define_insn "subsf3"
4663 [(set (match_operand:SF 0 "register_operand" "=f")
4664 (minus:SF (match_operand:SF 1 "register_operand" "f")
4665 (match_operand:SF 2 "register_operand" "f")))]
4666 "! TARGET_SOFT_FLOAT"
4667 "fsub,sgl %1,%2,%0"
4668 [(set_attr "type" "fpalu")
4669 (set_attr "pa_combine_type" "faddsub")
4670 (set_attr "length" "4")])
4671
4672 (define_insn "muldf3"
4673 [(set (match_operand:DF 0 "register_operand" "=f")
4674 (mult:DF (match_operand:DF 1 "register_operand" "f")
4675 (match_operand:DF 2 "register_operand" "f")))]
4676 "! TARGET_SOFT_FLOAT"
4677 "fmpy,dbl %1,%2,%0"
4678 [(set_attr "type" "fpmuldbl")
4679 (set_attr "pa_combine_type" "fmpy")
4680 (set_attr "length" "4")])
4681
4682 (define_insn "mulsf3"
4683 [(set (match_operand:SF 0 "register_operand" "=f")
4684 (mult:SF (match_operand:SF 1 "register_operand" "f")
4685 (match_operand:SF 2 "register_operand" "f")))]
4686 "! TARGET_SOFT_FLOAT"
4687 "fmpy,sgl %1,%2,%0"
4688 [(set_attr "type" "fpmulsgl")
4689 (set_attr "pa_combine_type" "fmpy")
4690 (set_attr "length" "4")])
4691
4692 (define_insn "divdf3"
4693 [(set (match_operand:DF 0 "register_operand" "=f")
4694 (div:DF (match_operand:DF 1 "register_operand" "f")
4695 (match_operand:DF 2 "register_operand" "f")))]
4696 "! TARGET_SOFT_FLOAT"
4697 "fdiv,dbl %1,%2,%0"
4698 [(set_attr "type" "fpdivdbl")
4699 (set_attr "length" "4")])
4700
4701 (define_insn "divsf3"
4702 [(set (match_operand:SF 0 "register_operand" "=f")
4703 (div:SF (match_operand:SF 1 "register_operand" "f")
4704 (match_operand:SF 2 "register_operand" "f")))]
4705 "! TARGET_SOFT_FLOAT"
4706 "fdiv,sgl %1,%2,%0"
4707 [(set_attr "type" "fpdivsgl")
4708 (set_attr "length" "4")])
4709
4710 ;; Processors prior to PA 2.0 don't have a fneg instruction. Fast
4711 ;; negation can be done by subtracting from plus zero. However, this
4712 ;; violates the IEEE standard when negating plus and minus zero.
4713 (define_expand "negdf2"
4714 [(parallel [(set (match_operand:DF 0 "register_operand" "")
4715 (neg:DF (match_operand:DF 1 "register_operand" "")))
4716 (use (match_dup 2))])]
4717 "! TARGET_SOFT_FLOAT"
4718 {
4719 if (TARGET_PA_20 || flag_unsafe_math_optimizations)
4720 emit_insn (gen_negdf2_fast (operands[0], operands[1]));
4721 else
4722 {
4723 operands[2] = force_reg (DFmode,
4724 CONST_DOUBLE_FROM_REAL_VALUE (dconstm1, DFmode));
4725 emit_insn (gen_muldf3 (operands[0], operands[1], operands[2]));
4726 }
4727 DONE;
4728 })
4729
4730 (define_insn "negdf2_fast"
4731 [(set (match_operand:DF 0 "register_operand" "=f")
4732 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
4733 "! TARGET_SOFT_FLOAT && (TARGET_PA_20 || flag_unsafe_math_optimizations)"
4734 "*
4735 {
4736 if (TARGET_PA_20)
4737 return \"fneg,dbl %1,%0\";
4738 else
4739 return \"fsub,dbl %%fr0,%1,%0\";
4740 }"
4741 [(set_attr "type" "fpalu")
4742 (set_attr "length" "4")])
4743
4744 (define_expand "negsf2"
4745 [(parallel [(set (match_operand:SF 0 "register_operand" "")
4746 (neg:SF (match_operand:SF 1 "register_operand" "")))
4747 (use (match_dup 2))])]
4748 "! TARGET_SOFT_FLOAT"
4749 {
4750 if (TARGET_PA_20 || flag_unsafe_math_optimizations)
4751 emit_insn (gen_negsf2_fast (operands[0], operands[1]));
4752 else
4753 {
4754 operands[2] = force_reg (SFmode,
4755 CONST_DOUBLE_FROM_REAL_VALUE (dconstm1, SFmode));
4756 emit_insn (gen_mulsf3 (operands[0], operands[1], operands[2]));
4757 }
4758 DONE;
4759 })
4760
4761 (define_insn "negsf2_fast"
4762 [(set (match_operand:SF 0 "register_operand" "=f")
4763 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
4764 "! TARGET_SOFT_FLOAT && (TARGET_PA_20 || flag_unsafe_math_optimizations)"
4765 "*
4766 {
4767 if (TARGET_PA_20)
4768 return \"fneg,sgl %1,%0\";
4769 else
4770 return \"fsub,sgl %%fr0,%1,%0\";
4771 }"
4772 [(set_attr "type" "fpalu")
4773 (set_attr "length" "4")])
4774
4775 (define_insn "absdf2"
4776 [(set (match_operand:DF 0 "register_operand" "=f")
4777 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
4778 "! TARGET_SOFT_FLOAT"
4779 "fabs,dbl %1,%0"
4780 [(set_attr "type" "fpalu")
4781 (set_attr "length" "4")])
4782
4783 (define_insn "abssf2"
4784 [(set (match_operand:SF 0 "register_operand" "=f")
4785 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
4786 "! TARGET_SOFT_FLOAT"
4787 "fabs,sgl %1,%0"
4788 [(set_attr "type" "fpalu")
4789 (set_attr "length" "4")])
4790
4791 (define_insn "sqrtdf2"
4792 [(set (match_operand:DF 0 "register_operand" "=f")
4793 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
4794 "! TARGET_SOFT_FLOAT"
4795 "fsqrt,dbl %1,%0"
4796 [(set_attr "type" "fpsqrtdbl")
4797 (set_attr "length" "4")])
4798
4799 (define_insn "sqrtsf2"
4800 [(set (match_operand:SF 0 "register_operand" "=f")
4801 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
4802 "! TARGET_SOFT_FLOAT"
4803 "fsqrt,sgl %1,%0"
4804 [(set_attr "type" "fpsqrtsgl")
4805 (set_attr "length" "4")])
4806
4807 ;; PA 2.0 floating point instructions
4808
4809 ; fmpyfadd patterns
4810 (define_insn ""
4811 [(set (match_operand:DF 0 "register_operand" "=f")
4812 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
4813 (match_operand:DF 2 "register_operand" "f"))
4814 (match_operand:DF 3 "register_operand" "f")))]
4815 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4816 "fmpyfadd,dbl %1,%2,%3,%0"
4817 [(set_attr "type" "fpmuldbl")
4818 (set_attr "length" "4")])
4819
4820 (define_insn ""
4821 [(set (match_operand:DF 0 "register_operand" "=f")
4822 (plus:DF (match_operand:DF 1 "register_operand" "f")
4823 (mult:DF (match_operand:DF 2 "register_operand" "f")
4824 (match_operand:DF 3 "register_operand" "f"))))]
4825 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4826 "fmpyfadd,dbl %2,%3,%1,%0"
4827 [(set_attr "type" "fpmuldbl")
4828 (set_attr "length" "4")])
4829
4830 (define_insn ""
4831 [(set (match_operand:SF 0 "register_operand" "=f")
4832 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
4833 (match_operand:SF 2 "register_operand" "f"))
4834 (match_operand:SF 3 "register_operand" "f")))]
4835 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4836 "fmpyfadd,sgl %1,%2,%3,%0"
4837 [(set_attr "type" "fpmulsgl")
4838 (set_attr "length" "4")])
4839
4840 (define_insn ""
4841 [(set (match_operand:SF 0 "register_operand" "=f")
4842 (plus:SF (match_operand:SF 1 "register_operand" "f")
4843 (mult:SF (match_operand:SF 2 "register_operand" "f")
4844 (match_operand:SF 3 "register_operand" "f"))))]
4845 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4846 "fmpyfadd,sgl %2,%3,%1,%0"
4847 [(set_attr "type" "fpmulsgl")
4848 (set_attr "length" "4")])
4849
4850 ; fmpynfadd patterns
4851 (define_insn ""
4852 [(set (match_operand:DF 0 "register_operand" "=f")
4853 (minus:DF (match_operand:DF 1 "register_operand" "f")
4854 (mult:DF (match_operand:DF 2 "register_operand" "f")
4855 (match_operand:DF 3 "register_operand" "f"))))]
4856 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4857 "fmpynfadd,dbl %2,%3,%1,%0"
4858 [(set_attr "type" "fpmuldbl")
4859 (set_attr "length" "4")])
4860
4861 (define_insn ""
4862 [(set (match_operand:SF 0 "register_operand" "=f")
4863 (minus:SF (match_operand:SF 1 "register_operand" "f")
4864 (mult:SF (match_operand:SF 2 "register_operand" "f")
4865 (match_operand:SF 3 "register_operand" "f"))))]
4866 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4867 "fmpynfadd,sgl %2,%3,%1,%0"
4868 [(set_attr "type" "fpmulsgl")
4869 (set_attr "length" "4")])
4870
4871 ; fnegabs patterns
4872 (define_insn ""
4873 [(set (match_operand:DF 0 "register_operand" "=f")
4874 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))]
4875 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4876 "fnegabs,dbl %1,%0"
4877 [(set_attr "type" "fpalu")
4878 (set_attr "length" "4")])
4879
4880 (define_insn ""
4881 [(set (match_operand:SF 0 "register_operand" "=f")
4882 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))]
4883 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4884 "fnegabs,sgl %1,%0"
4885 [(set_attr "type" "fpalu")
4886 (set_attr "length" "4")])
4887
4888 ;; Generating a fused multiply sequence is a win for this case as it will
4889 ;; reduce the latency for the fused case without impacting the plain
4890 ;; multiply case.
4891 ;;
4892 ;; Similar possibilities exist for fnegabs, shadd and other insns which
4893 ;; perform two operations with the result of the first feeding the second.
4894 (define_insn ""
4895 [(set (match_operand:DF 0 "register_operand" "=f")
4896 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
4897 (match_operand:DF 2 "register_operand" "f"))
4898 (match_operand:DF 3 "register_operand" "f")))
4899 (set (match_operand:DF 4 "register_operand" "=&f")
4900 (mult:DF (match_dup 1) (match_dup 2)))]
4901 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
4902 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
4903 || reg_overlap_mentioned_p (operands[4], operands[2])))"
4904 "#"
4905 [(set_attr "type" "fpmuldbl")
4906 (set_attr "length" "8")])
4907
4908 ;; We want to split this up during scheduling since we want both insns
4909 ;; to schedule independently.
4910 (define_split
4911 [(set (match_operand:DF 0 "register_operand" "")
4912 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "")
4913 (match_operand:DF 2 "register_operand" ""))
4914 (match_operand:DF 3 "register_operand" "")))
4915 (set (match_operand:DF 4 "register_operand" "")
4916 (mult:DF (match_dup 1) (match_dup 2)))]
4917 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4918 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
4919 (set (match_dup 0) (plus:DF (mult:DF (match_dup 1) (match_dup 2))
4920 (match_dup 3)))]
4921 "")
4922
4923 (define_insn ""
4924 [(set (match_operand:SF 0 "register_operand" "=f")
4925 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
4926 (match_operand:SF 2 "register_operand" "f"))
4927 (match_operand:SF 3 "register_operand" "f")))
4928 (set (match_operand:SF 4 "register_operand" "=&f")
4929 (mult:SF (match_dup 1) (match_dup 2)))]
4930 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
4931 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
4932 || reg_overlap_mentioned_p (operands[4], operands[2])))"
4933 "#"
4934 [(set_attr "type" "fpmuldbl")
4935 (set_attr "length" "8")])
4936
4937 ;; We want to split this up during scheduling since we want both insns
4938 ;; to schedule independently.
4939 (define_split
4940 [(set (match_operand:SF 0 "register_operand" "")
4941 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "")
4942 (match_operand:SF 2 "register_operand" ""))
4943 (match_operand:SF 3 "register_operand" "")))
4944 (set (match_operand:SF 4 "register_operand" "")
4945 (mult:SF (match_dup 1) (match_dup 2)))]
4946 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4947 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
4948 (set (match_dup 0) (plus:SF (mult:SF (match_dup 1) (match_dup 2))
4949 (match_dup 3)))]
4950 "")
4951
4952 ;; Negating a multiply can be faked by adding zero in a fused multiply-add
4953 ;; instruction.
4954 (define_insn ""
4955 [(set (match_operand:DF 0 "register_operand" "=f")
4956 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
4957 (match_operand:DF 2 "register_operand" "f"))))]
4958 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4959 "fmpynfadd,dbl %1,%2,%%fr0,%0"
4960 [(set_attr "type" "fpmuldbl")
4961 (set_attr "length" "4")])
4962
4963 (define_insn ""
4964 [(set (match_operand:SF 0 "register_operand" "=f")
4965 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
4966 (match_operand:SF 2 "register_operand" "f"))))]
4967 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4968 "fmpynfadd,sgl %1,%2,%%fr0,%0"
4969 [(set_attr "type" "fpmuldbl")
4970 (set_attr "length" "4")])
4971
4972 (define_insn ""
4973 [(set (match_operand:DF 0 "register_operand" "=f")
4974 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
4975 (match_operand:DF 2 "register_operand" "f"))))
4976 (set (match_operand:DF 3 "register_operand" "=&f")
4977 (mult:DF (match_dup 1) (match_dup 2)))]
4978 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
4979 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
4980 || reg_overlap_mentioned_p (operands[3], operands[2])))"
4981 "#"
4982 [(set_attr "type" "fpmuldbl")
4983 (set_attr "length" "8")])
4984
4985 (define_split
4986 [(set (match_operand:DF 0 "register_operand" "")
4987 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
4988 (match_operand:DF 2 "register_operand" ""))))
4989 (set (match_operand:DF 3 "register_operand" "")
4990 (mult:DF (match_dup 1) (match_dup 2)))]
4991 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4992 [(set (match_dup 3) (mult:DF (match_dup 1) (match_dup 2)))
4993 (set (match_dup 0) (neg:DF (mult:DF (match_dup 1) (match_dup 2))))]
4994 "")
4995
4996 (define_insn ""
4997 [(set (match_operand:SF 0 "register_operand" "=f")
4998 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
4999 (match_operand:SF 2 "register_operand" "f"))))
5000 (set (match_operand:SF 3 "register_operand" "=&f")
5001 (mult:SF (match_dup 1) (match_dup 2)))]
5002 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5003 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
5004 || reg_overlap_mentioned_p (operands[3], operands[2])))"
5005 "#"
5006 [(set_attr "type" "fpmuldbl")
5007 (set_attr "length" "8")])
5008
5009 (define_split
5010 [(set (match_operand:SF 0 "register_operand" "")
5011 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
5012 (match_operand:SF 2 "register_operand" ""))))
5013 (set (match_operand:SF 3 "register_operand" "")
5014 (mult:SF (match_dup 1) (match_dup 2)))]
5015 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5016 [(set (match_dup 3) (mult:SF (match_dup 1) (match_dup 2)))
5017 (set (match_dup 0) (neg:SF (mult:SF (match_dup 1) (match_dup 2))))]
5018 "")
5019
5020 ;; Now fused multiplies with the result of the multiply negated.
5021 (define_insn ""
5022 [(set (match_operand:DF 0 "register_operand" "=f")
5023 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
5024 (match_operand:DF 2 "register_operand" "f")))
5025 (match_operand:DF 3 "register_operand" "f")))]
5026 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5027 "fmpynfadd,dbl %1,%2,%3,%0"
5028 [(set_attr "type" "fpmuldbl")
5029 (set_attr "length" "4")])
5030
5031 (define_insn ""
5032 [(set (match_operand:SF 0 "register_operand" "=f")
5033 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5034 (match_operand:SF 2 "register_operand" "f")))
5035 (match_operand:SF 3 "register_operand" "f")))]
5036 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5037 "fmpynfadd,sgl %1,%2,%3,%0"
5038 [(set_attr "type" "fpmuldbl")
5039 (set_attr "length" "4")])
5040
5041 (define_insn ""
5042 [(set (match_operand:DF 0 "register_operand" "=f")
5043 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
5044 (match_operand:DF 2 "register_operand" "f")))
5045 (match_operand:DF 3 "register_operand" "f")))
5046 (set (match_operand:DF 4 "register_operand" "=&f")
5047 (mult:DF (match_dup 1) (match_dup 2)))]
5048 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5049 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5050 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5051 "#"
5052 [(set_attr "type" "fpmuldbl")
5053 (set_attr "length" "8")])
5054
5055 (define_split
5056 [(set (match_operand:DF 0 "register_operand" "")
5057 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
5058 (match_operand:DF 2 "register_operand" "")))
5059 (match_operand:DF 3 "register_operand" "")))
5060 (set (match_operand:DF 4 "register_operand" "")
5061 (mult:DF (match_dup 1) (match_dup 2)))]
5062 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5063 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
5064 (set (match_dup 0) (plus:DF (neg:DF (mult:DF (match_dup 1) (match_dup 2)))
5065 (match_dup 3)))]
5066 "")
5067
5068 (define_insn ""
5069 [(set (match_operand:SF 0 "register_operand" "=f")
5070 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5071 (match_operand:SF 2 "register_operand" "f")))
5072 (match_operand:SF 3 "register_operand" "f")))
5073 (set (match_operand:SF 4 "register_operand" "=&f")
5074 (mult:SF (match_dup 1) (match_dup 2)))]
5075 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5076 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5077 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5078 "#"
5079 [(set_attr "type" "fpmuldbl")
5080 (set_attr "length" "8")])
5081
5082 (define_split
5083 [(set (match_operand:SF 0 "register_operand" "")
5084 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
5085 (match_operand:SF 2 "register_operand" "")))
5086 (match_operand:SF 3 "register_operand" "")))
5087 (set (match_operand:SF 4 "register_operand" "")
5088 (mult:SF (match_dup 1) (match_dup 2)))]
5089 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5090 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
5091 (set (match_dup 0) (plus:SF (neg:SF (mult:SF (match_dup 1) (match_dup 2)))
5092 (match_dup 3)))]
5093 "")
5094
5095 (define_insn ""
5096 [(set (match_operand:DF 0 "register_operand" "=f")
5097 (minus:DF (match_operand:DF 3 "register_operand" "f")
5098 (mult:DF (match_operand:DF 1 "register_operand" "f")
5099 (match_operand:DF 2 "register_operand" "f"))))
5100 (set (match_operand:DF 4 "register_operand" "=&f")
5101 (mult:DF (match_dup 1) (match_dup 2)))]
5102 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5103 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5104 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5105 "#"
5106 [(set_attr "type" "fpmuldbl")
5107 (set_attr "length" "8")])
5108
5109 (define_split
5110 [(set (match_operand:DF 0 "register_operand" "")
5111 (minus:DF (match_operand:DF 3 "register_operand" "")
5112 (mult:DF (match_operand:DF 1 "register_operand" "")
5113 (match_operand:DF 2 "register_operand" ""))))
5114 (set (match_operand:DF 4 "register_operand" "")
5115 (mult:DF (match_dup 1) (match_dup 2)))]
5116 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5117 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
5118 (set (match_dup 0) (minus:DF (match_dup 3)
5119 (mult:DF (match_dup 1) (match_dup 2))))]
5120 "")
5121
5122 (define_insn ""
5123 [(set (match_operand:SF 0 "register_operand" "=f")
5124 (minus:SF (match_operand:SF 3 "register_operand" "f")
5125 (mult:SF (match_operand:SF 1 "register_operand" "f")
5126 (match_operand:SF 2 "register_operand" "f"))))
5127 (set (match_operand:SF 4 "register_operand" "=&f")
5128 (mult:SF (match_dup 1) (match_dup 2)))]
5129 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5130 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5131 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5132 "#"
5133 [(set_attr "type" "fpmuldbl")
5134 (set_attr "length" "8")])
5135
5136 (define_split
5137 [(set (match_operand:SF 0 "register_operand" "")
5138 (minus:SF (match_operand:SF 3 "register_operand" "")
5139 (mult:SF (match_operand:SF 1 "register_operand" "")
5140 (match_operand:SF 2 "register_operand" ""))))
5141 (set (match_operand:SF 4 "register_operand" "")
5142 (mult:SF (match_dup 1) (match_dup 2)))]
5143 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5144 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
5145 (set (match_dup 0) (minus:SF (match_dup 3)
5146 (mult:SF (match_dup 1) (match_dup 2))))]
5147 "")
5148
5149 (define_insn ""
5150 [(set (match_operand:DF 0 "register_operand" "=f")
5151 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5152 (set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
5153 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5154 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
5155 "#"
5156 [(set_attr "type" "fpalu")
5157 (set_attr "length" "8")])
5158
5159 (define_split
5160 [(set (match_operand:DF 0 "register_operand" "")
5161 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" ""))))
5162 (set (match_operand:DF 2 "register_operand" "") (abs:DF (match_dup 1)))]
5163 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5164 [(set (match_dup 2) (abs:DF (match_dup 1)))
5165 (set (match_dup 0) (neg:DF (abs:DF (match_dup 1))))]
5166 "")
5167
5168 (define_insn ""
5169 [(set (match_operand:SF 0 "register_operand" "=f")
5170 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5171 (set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
5172 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5173 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
5174 "#"
5175 [(set_attr "type" "fpalu")
5176 (set_attr "length" "8")])
5177
5178 (define_split
5179 [(set (match_operand:SF 0 "register_operand" "")
5180 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" ""))))
5181 (set (match_operand:SF 2 "register_operand" "") (abs:SF (match_dup 1)))]
5182 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5183 [(set (match_dup 2) (abs:SF (match_dup 1)))
5184 (set (match_dup 0) (neg:SF (abs:SF (match_dup 1))))]
5185 "")
5186 \f
5187 ;;- Shift instructions
5188
5189 ;; Optimized special case of shifting.
5190
5191 (define_insn ""
5192 [(set (match_operand:SI 0 "register_operand" "=r")
5193 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
5194 (const_int 24)))]
5195 ""
5196 "ldb%M1 %1,%0"
5197 [(set_attr "type" "load")
5198 (set_attr "length" "4")])
5199
5200 (define_insn ""
5201 [(set (match_operand:SI 0 "register_operand" "=r")
5202 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
5203 (const_int 16)))]
5204 ""
5205 "ldh%M1 %1,%0"
5206 [(set_attr "type" "load")
5207 (set_attr "length" "4")])
5208
5209 (define_insn ""
5210 [(set (match_operand:SI 0 "register_operand" "=r")
5211 (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
5212 (match_operand:SI 3 "shadd_operand" ""))
5213 (match_operand:SI 1 "register_operand" "r")))]
5214 ""
5215 "{sh%O3addl %2,%1,%0|shladd,l %2,%O3,%1,%0} "
5216 [(set_attr "type" "binary")
5217 (set_attr "length" "4")])
5218
5219 (define_insn ""
5220 [(set (match_operand:DI 0 "register_operand" "=r")
5221 (plus:DI (mult:DI (match_operand:DI 2 "register_operand" "r")
5222 (match_operand:DI 3 "shadd_operand" ""))
5223 (match_operand:DI 1 "register_operand" "r")))]
5224 "TARGET_64BIT"
5225 "shladd,l %2,%O3,%1,%0"
5226 [(set_attr "type" "binary")
5227 (set_attr "length" "4")])
5228
5229 (define_expand "ashlsi3"
5230 [(set (match_operand:SI 0 "register_operand" "")
5231 (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
5232 (match_operand:SI 2 "arith32_operand" "")))]
5233 ""
5234 "
5235 {
5236 if (GET_CODE (operands[2]) != CONST_INT)
5237 {
5238 rtx temp = gen_reg_rtx (SImode);
5239 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
5240 if (GET_CODE (operands[1]) == CONST_INT)
5241 emit_insn (gen_zvdep_imm32 (operands[0], operands[1], temp));
5242 else
5243 emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
5244 DONE;
5245 }
5246 /* Make sure both inputs are not constants,
5247 there are no patterns for that. */
5248 operands[1] = force_reg (SImode, operands[1]);
5249 }")
5250
5251 (define_insn ""
5252 [(set (match_operand:SI 0 "register_operand" "=r")
5253 (ashift:SI (match_operand:SI 1 "register_operand" "r")
5254 (match_operand:SI 2 "const_int_operand" "n")))]
5255 ""
5256 "{zdep|depw,z} %1,%P2,%L2,%0"
5257 [(set_attr "type" "shift")
5258 (set_attr "length" "4")])
5259
5260 ; Match cases of op1 a CONST_INT here that zvdep_imm32 doesn't handle.
5261 ; Doing it like this makes slightly better code since reload can
5262 ; replace a register with a known value in range -16..15 with a
5263 ; constant. Ideally, we would like to merge zvdep32 and zvdep_imm32,
5264 ; but since we have no more CONST_OK... characters, that is not
5265 ; possible.
5266 (define_insn "zvdep32"
5267 [(set (match_operand:SI 0 "register_operand" "=r,r")
5268 (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
5269 (minus:SI (const_int 31)
5270 (match_operand:SI 2 "register_operand" "q,q"))))]
5271 ""
5272 "@
5273 {zvdep %1,32,%0|depw,z %1,%%sar,32,%0}
5274 {zvdepi %1,32,%0|depwi,z %1,%%sar,32,%0}"
5275 [(set_attr "type" "shift,shift")
5276 (set_attr "length" "4,4")])
5277
5278 (define_insn "zvdep_imm32"
5279 [(set (match_operand:SI 0 "register_operand" "=r")
5280 (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
5281 (minus:SI (const_int 31)
5282 (match_operand:SI 2 "register_operand" "q"))))]
5283 ""
5284 "*
5285 {
5286 int x = INTVAL (operands[1]);
5287 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
5288 operands[1] = GEN_INT ((x & 0xf) - 0x10);
5289 return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\";
5290 }"
5291 [(set_attr "type" "shift")
5292 (set_attr "length" "4")])
5293
5294 (define_insn "vdepi_ior"
5295 [(set (match_operand:SI 0 "register_operand" "=r")
5296 (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
5297 (minus:SI (const_int 31)
5298 (match_operand:SI 2 "register_operand" "q")))
5299 (match_operand:SI 3 "register_operand" "0")))]
5300 ; accept ...0001...1, can this be generalized?
5301 "exact_log2 (INTVAL (operands[1]) + 1) >= 0"
5302 "*
5303 {
5304 int x = INTVAL (operands[1]);
5305 operands[2] = GEN_INT (exact_log2 (x + 1));
5306 return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\";
5307 }"
5308 [(set_attr "type" "shift")
5309 (set_attr "length" "4")])
5310
5311 (define_insn "vdepi_and"
5312 [(set (match_operand:SI 0 "register_operand" "=r")
5313 (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
5314 (minus:SI (const_int 31)
5315 (match_operand:SI 2 "register_operand" "q")))
5316 (match_operand:SI 3 "register_operand" "0")))]
5317 ; this can be generalized...!
5318 "INTVAL (operands[1]) == -2"
5319 "*
5320 {
5321 int x = INTVAL (operands[1]);
5322 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
5323 return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\";
5324 }"
5325 [(set_attr "type" "shift")
5326 (set_attr "length" "4")])
5327
5328 (define_expand "ashldi3"
5329 [(set (match_operand:DI 0 "register_operand" "")
5330 (ashift:DI (match_operand:DI 1 "lhs_lshift_operand" "")
5331 (match_operand:DI 2 "arith32_operand" "")))]
5332 "TARGET_64BIT"
5333 "
5334 {
5335 if (GET_CODE (operands[2]) != CONST_INT)
5336 {
5337 rtx temp = gen_reg_rtx (DImode);
5338 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
5339 if (GET_CODE (operands[1]) == CONST_INT)
5340 emit_insn (gen_zvdep_imm64 (operands[0], operands[1], temp));
5341 else
5342 emit_insn (gen_zvdep64 (operands[0], operands[1], temp));
5343 DONE;
5344 }
5345 /* Make sure both inputs are not constants,
5346 there are no patterns for that. */
5347 operands[1] = force_reg (DImode, operands[1]);
5348 }")
5349
5350 (define_insn ""
5351 [(set (match_operand:DI 0 "register_operand" "=r")
5352 (ashift:DI (match_operand:DI 1 "register_operand" "r")
5353 (match_operand:DI 2 "const_int_operand" "n")))]
5354 "TARGET_64BIT"
5355 "depd,z %1,%p2,%Q2,%0"
5356 [(set_attr "type" "shift")
5357 (set_attr "length" "4")])
5358
5359 ; Match cases of op1 a CONST_INT here that zvdep_imm64 doesn't handle.
5360 ; Doing it like this makes slightly better code since reload can
5361 ; replace a register with a known value in range -16..15 with a
5362 ; constant. Ideally, we would like to merge zvdep64 and zvdep_imm64,
5363 ; but since we have no more CONST_OK... characters, that is not
5364 ; possible.
5365 (define_insn "zvdep64"
5366 [(set (match_operand:DI 0 "register_operand" "=r,r")
5367 (ashift:DI (match_operand:DI 1 "arith5_operand" "r,L")
5368 (minus:DI (const_int 63)
5369 (match_operand:DI 2 "register_operand" "q,q"))))]
5370 "TARGET_64BIT"
5371 "@
5372 depd,z %1,%%sar,64,%0
5373 depdi,z %1,%%sar,64,%0"
5374 [(set_attr "type" "shift,shift")
5375 (set_attr "length" "4,4")])
5376
5377 (define_insn "zvdep_imm64"
5378 [(set (match_operand:DI 0 "register_operand" "=r")
5379 (ashift:DI (match_operand:DI 1 "lhs_lshift_cint_operand" "")
5380 (minus:DI (const_int 63)
5381 (match_operand:DI 2 "register_operand" "q"))))]
5382 "TARGET_64BIT"
5383 "*
5384 {
5385 int x = INTVAL (operands[1]);
5386 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
5387 operands[1] = GEN_INT ((x & 0x1f) - 0x20);
5388 return \"depdi,z %1,%%sar,%2,%0\";
5389 }"
5390 [(set_attr "type" "shift")
5391 (set_attr "length" "4")])
5392
5393 (define_insn ""
5394 [(set (match_operand:DI 0 "register_operand" "=r")
5395 (ior:DI (ashift:DI (match_operand:DI 1 "const_int_operand" "")
5396 (minus:DI (const_int 63)
5397 (match_operand:DI 2 "register_operand" "q")))
5398 (match_operand:DI 3 "register_operand" "0")))]
5399 ; accept ...0001...1, can this be generalized?
5400 "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) >= 0"
5401 "*
5402 {
5403 int x = INTVAL (operands[1]);
5404 operands[2] = GEN_INT (exact_log2 (x + 1));
5405 return \"depdi -1,%%sar,%2,%0\";
5406 }"
5407 [(set_attr "type" "shift")
5408 (set_attr "length" "4")])
5409
5410 (define_insn ""
5411 [(set (match_operand:DI 0 "register_operand" "=r")
5412 (and:DI (rotate:DI (match_operand:DI 1 "const_int_operand" "")
5413 (minus:DI (const_int 63)
5414 (match_operand:DI 2 "register_operand" "q")))
5415 (match_operand:DI 3 "register_operand" "0")))]
5416 ; this can be generalized...!
5417 "TARGET_64BIT && INTVAL (operands[1]) == -2"
5418 "*
5419 {
5420 int x = INTVAL (operands[1]);
5421 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
5422 return \"depdi 0,%%sar,%2,%0\";
5423 }"
5424 [(set_attr "type" "shift")
5425 (set_attr "length" "4")])
5426
5427 (define_expand "ashrsi3"
5428 [(set (match_operand:SI 0 "register_operand" "")
5429 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
5430 (match_operand:SI 2 "arith32_operand" "")))]
5431 ""
5432 "
5433 {
5434 if (GET_CODE (operands[2]) != CONST_INT)
5435 {
5436 rtx temp = gen_reg_rtx (SImode);
5437 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
5438 emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
5439 DONE;
5440 }
5441 }")
5442
5443 (define_insn ""
5444 [(set (match_operand:SI 0 "register_operand" "=r")
5445 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
5446 (match_operand:SI 2 "const_int_operand" "n")))]
5447 ""
5448 "{extrs|extrw,s} %1,%P2,%L2,%0"
5449 [(set_attr "type" "shift")
5450 (set_attr "length" "4")])
5451
5452 (define_insn "vextrs32"
5453 [(set (match_operand:SI 0 "register_operand" "=r")
5454 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
5455 (minus:SI (const_int 31)
5456 (match_operand:SI 2 "register_operand" "q"))))]
5457 ""
5458 "{vextrs %1,32,%0|extrw,s %1,%%sar,32,%0}"
5459 [(set_attr "type" "shift")
5460 (set_attr "length" "4")])
5461
5462 (define_expand "ashrdi3"
5463 [(set (match_operand:DI 0 "register_operand" "")
5464 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
5465 (match_operand:DI 2 "arith32_operand" "")))]
5466 "TARGET_64BIT"
5467 "
5468 {
5469 if (GET_CODE (operands[2]) != CONST_INT)
5470 {
5471 rtx temp = gen_reg_rtx (DImode);
5472 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
5473 emit_insn (gen_vextrs64 (operands[0], operands[1], temp));
5474 DONE;
5475 }
5476 }")
5477
5478 (define_insn ""
5479 [(set (match_operand:DI 0 "register_operand" "=r")
5480 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
5481 (match_operand:DI 2 "const_int_operand" "n")))]
5482 "TARGET_64BIT"
5483 "extrd,s %1,%p2,%Q2,%0"
5484 [(set_attr "type" "shift")
5485 (set_attr "length" "4")])
5486
5487 (define_insn "vextrs64"
5488 [(set (match_operand:DI 0 "register_operand" "=r")
5489 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
5490 (minus:DI (const_int 63)
5491 (match_operand:DI 2 "register_operand" "q"))))]
5492 "TARGET_64BIT"
5493 "extrd,s %1,%%sar,64,%0"
5494 [(set_attr "type" "shift")
5495 (set_attr "length" "4")])
5496
5497 (define_insn "lshrsi3"
5498 [(set (match_operand:SI 0 "register_operand" "=r,r")
5499 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
5500 (match_operand:SI 2 "arith32_operand" "q,n")))]
5501 ""
5502 "@
5503 {vshd %%r0,%1,%0|shrpw %%r0,%1,%%sar,%0}
5504 {extru|extrw,u} %1,%P2,%L2,%0"
5505 [(set_attr "type" "shift")
5506 (set_attr "length" "4")])
5507
5508 (define_insn "lshrdi3"
5509 [(set (match_operand:DI 0 "register_operand" "=r,r")
5510 (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r")
5511 (match_operand:DI 2 "arith32_operand" "q,n")))]
5512 "TARGET_64BIT"
5513 "@
5514 shrpd %%r0,%1,%%sar,%0
5515 extrd,u %1,%p2,%Q2,%0"
5516 [(set_attr "type" "shift")
5517 (set_attr "length" "4")])
5518
5519 (define_insn "rotrsi3"
5520 [(set (match_operand:SI 0 "register_operand" "=r,r")
5521 (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
5522 (match_operand:SI 2 "arith32_operand" "q,n")))]
5523 ""
5524 "*
5525 {
5526 if (GET_CODE (operands[2]) == CONST_INT)
5527 {
5528 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
5529 return \"{shd|shrpw} %1,%1,%2,%0\";
5530 }
5531 else
5532 return \"{vshd %1,%1,%0|shrpw %1,%1,%%sar,%0}\";
5533 }"
5534 [(set_attr "type" "shift")
5535 (set_attr "length" "4")])
5536
5537 (define_expand "rotlsi3"
5538 [(set (match_operand:SI 0 "register_operand" "")
5539 (rotate:SI (match_operand:SI 1 "register_operand" "")
5540 (match_operand:SI 2 "arith32_operand" "")))]
5541 ""
5542 "
5543 {
5544 if (GET_CODE (operands[2]) != CONST_INT)
5545 {
5546 rtx temp = gen_reg_rtx (SImode);
5547 emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
5548 emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
5549 DONE;
5550 }
5551 /* Else expand normally. */
5552 }")
5553
5554 (define_insn ""
5555 [(set (match_operand:SI 0 "register_operand" "=r")
5556 (rotate:SI (match_operand:SI 1 "register_operand" "r")
5557 (match_operand:SI 2 "const_int_operand" "n")))]
5558 ""
5559 "*
5560 {
5561 operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
5562 return \"{shd|shrpw} %1,%1,%2,%0\";
5563 }"
5564 [(set_attr "type" "shift")
5565 (set_attr "length" "4")])
5566
5567 (define_insn ""
5568 [(set (match_operand:SI 0 "register_operand" "=r")
5569 (match_operator:SI 5 "plus_xor_ior_operator"
5570 [(ashift:SI (match_operand:SI 1 "register_operand" "r")
5571 (match_operand:SI 3 "const_int_operand" "n"))
5572 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
5573 (match_operand:SI 4 "const_int_operand" "n"))]))]
5574 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
5575 "{shd|shrpw} %1,%2,%4,%0"
5576 [(set_attr "type" "shift")
5577 (set_attr "length" "4")])
5578
5579 (define_insn ""
5580 [(set (match_operand:SI 0 "register_operand" "=r")
5581 (match_operator:SI 5 "plus_xor_ior_operator"
5582 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
5583 (match_operand:SI 4 "const_int_operand" "n"))
5584 (ashift:SI (match_operand:SI 1 "register_operand" "r")
5585 (match_operand:SI 3 "const_int_operand" "n"))]))]
5586 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
5587 "{shd|shrpw} %1,%2,%4,%0"
5588 [(set_attr "type" "shift")
5589 (set_attr "length" "4")])
5590
5591 (define_insn ""
5592 [(set (match_operand:SI 0 "register_operand" "=r")
5593 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
5594 (match_operand:SI 2 "const_int_operand" ""))
5595 (match_operand:SI 3 "const_int_operand" "")))]
5596 "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) >= 0"
5597 "*
5598 {
5599 int cnt = INTVAL (operands[2]) & 31;
5600 operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
5601 operands[2] = GEN_INT (31 - cnt);
5602 return \"{zdep|depw,z} %1,%2,%3,%0\";
5603 }"
5604 [(set_attr "type" "shift")
5605 (set_attr "length" "4")])
5606 \f
5607 ;; Unconditional and other jump instructions.
5608
5609 ;; This can only be used in a leaf function, so we do
5610 ;; not need to use the PIC register when generating PIC code.
5611 (define_insn "return"
5612 [(return)
5613 (use (reg:SI 2))
5614 (const_int 0)]
5615 "hppa_can_use_return_insn_p ()"
5616 "*
5617 {
5618 if (TARGET_PA_20)
5619 return \"bve%* (%%r2)\";
5620 return \"bv%* %%r0(%%r2)\";
5621 }"
5622 [(set_attr "type" "branch")
5623 (set_attr "length" "4")])
5624
5625 ;; Emit a different pattern for functions which have non-trivial
5626 ;; epilogues so as not to confuse jump and reorg.
5627 (define_insn "return_internal"
5628 [(return)
5629 (use (reg:SI 2))
5630 (const_int 1)]
5631 ""
5632 "*
5633 {
5634 if (TARGET_PA_20)
5635 return \"bve%* (%%r2)\";
5636 return \"bv%* %%r0(%%r2)\";
5637 }"
5638 [(set_attr "type" "branch")
5639 (set_attr "length" "4")])
5640
5641 ;; This is used for eh returns which bypass the return stub.
5642 (define_insn "return_external_pic"
5643 [(return)
5644 (clobber (reg:SI 1))
5645 (use (reg:SI 2))]
5646 "!TARGET_NO_SPACE_REGS
5647 && !TARGET_PA_20
5648 && flag_pic && current_function_calls_eh_return"
5649 "ldsid (%%sr0,%%r2),%%r1\;mtsp %%r1,%%sr0\;be%* 0(%%sr0,%%r2)"
5650 [(set_attr "type" "branch")
5651 (set_attr "length" "12")])
5652
5653 (define_expand "prologue"
5654 [(const_int 0)]
5655 ""
5656 "hppa_expand_prologue ();DONE;")
5657
5658 (define_expand "sibcall_epilogue"
5659 [(return)]
5660 ""
5661 "
5662 {
5663 hppa_expand_epilogue ();
5664 DONE;
5665 }")
5666
5667 (define_expand "epilogue"
5668 [(return)]
5669 ""
5670 "
5671 {
5672 /* Try to use the trivial return first. Else use the full
5673 epilogue. */
5674 if (hppa_can_use_return_insn_p ())
5675 emit_jump_insn (gen_return ());
5676 else
5677 {
5678 rtx x;
5679
5680 hppa_expand_epilogue ();
5681
5682 /* EH returns bypass the normal return stub. Thus, we must do an
5683 interspace branch to return from functions that call eh_return.
5684 This is only a problem for returns from shared code on ports
5685 using space registers. */
5686 if (!TARGET_NO_SPACE_REGS
5687 && !TARGET_PA_20
5688 && flag_pic && current_function_calls_eh_return)
5689 x = gen_return_external_pic ();
5690 else
5691 x = gen_return_internal ();
5692
5693 emit_jump_insn (x);
5694 }
5695 DONE;
5696 }")
5697
5698 ;; Special because we use the value placed in %r2 by the bl instruction
5699 ;; from within its delay slot to set the value for the 2nd parameter to
5700 ;; the call.
5701 (define_insn "call_profiler"
5702 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
5703 (match_operand 1 "" ""))
5704 (use (match_operand 2 "" ""))
5705 (use (reg:SI 25))
5706 (use (reg:SI 26))
5707 (clobber (reg:SI 2))]
5708 ""
5709 "*
5710 {
5711 rtx xoperands[3];
5712
5713 output_arg_descriptor (insn);
5714
5715 xoperands[0] = operands[0];
5716 xoperands[1] = operands[2];
5717 xoperands[2] = gen_label_rtx ();
5718 output_asm_insn (\"{bl|b,l} %0,%%r2\;ldo %1-%2(%%r2),%%r25\", xoperands);
5719
5720 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
5721 CODE_LABEL_NUMBER (xoperands[2]));
5722 return \"\";
5723 }"
5724 [(set_attr "type" "multi")
5725 (set_attr "length" "8")])
5726
5727 (define_insn "blockage"
5728 [(unspec_volatile [(const_int 2)] 0)]
5729 ""
5730 ""
5731 [(set_attr "length" "0")])
5732
5733 (define_insn "jump"
5734 [(set (pc) (label_ref (match_operand 0 "" "")))]
5735 ""
5736 "*
5737 {
5738 if (GET_MODE (insn) == SImode)
5739 return \"b %l0%#\";
5740
5741 /* An unconditional branch which can reach its target. */
5742 if (get_attr_length (insn) != 24
5743 && get_attr_length (insn) != 16)
5744 return \"b%* %l0\";
5745
5746 return output_lbranch (operands[0], insn);
5747 }"
5748 [(set_attr "type" "uncond_branch")
5749 (set_attr "pa_combine_type" "uncond_branch")
5750 (set (attr "length")
5751 (cond [(eq (symbol_ref "jump_in_call_delay (insn)") (const_int 1))
5752 (if_then_else (lt (abs (minus (match_dup 0)
5753 (plus (pc) (const_int 8))))
5754 (const_int 8184))
5755 (const_int 4)
5756 (const_int 8))
5757 (ge (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
5758 (const_int 262100))
5759 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
5760 (const_int 16)
5761 (const_int 24))]
5762 (const_int 4)))])
5763
5764 ;; Subroutines of "casesi".
5765 ;; operand 0 is index
5766 ;; operand 1 is the minimum bound
5767 ;; operand 2 is the maximum bound - minimum bound + 1
5768 ;; operand 3 is CODE_LABEL for the table;
5769 ;; operand 4 is the CODE_LABEL to go to if index out of range.
5770
5771 (define_expand "casesi"
5772 [(match_operand:SI 0 "general_operand" "")
5773 (match_operand:SI 1 "const_int_operand" "")
5774 (match_operand:SI 2 "const_int_operand" "")
5775 (match_operand 3 "" "")
5776 (match_operand 4 "" "")]
5777 ""
5778 "
5779 {
5780 if (GET_CODE (operands[0]) != REG)
5781 operands[0] = force_reg (SImode, operands[0]);
5782
5783 if (operands[1] != const0_rtx)
5784 {
5785 rtx reg = gen_reg_rtx (SImode);
5786
5787 operands[1] = GEN_INT (-INTVAL (operands[1]));
5788 if (!INT_14_BITS (operands[1]))
5789 operands[1] = force_reg (SImode, operands[1]);
5790 emit_insn (gen_addsi3 (reg, operands[0], operands[1]));
5791
5792 operands[0] = reg;
5793 }
5794
5795 /* In 64bit mode we must make sure to wipe the upper bits of the register
5796 just in case the addition overflowed or we had random bits in the
5797 high part of the register. */
5798 if (TARGET_64BIT)
5799 {
5800 rtx reg = gen_reg_rtx (DImode);
5801 emit_insn (gen_extendsidi2 (reg, operands[0]));
5802 operands[0] = gen_rtx_SUBREG (SImode, reg, 4);
5803 }
5804
5805 if (!INT_5_BITS (operands[2]))
5806 operands[2] = force_reg (SImode, operands[2]);
5807
5808 emit_insn (gen_cmpsi (operands[0], operands[2]));
5809 emit_jump_insn (gen_bgtu (operands[4]));
5810 if (TARGET_BIG_SWITCH)
5811 {
5812 rtx temp = gen_reg_rtx (SImode);
5813 emit_move_insn (temp, gen_rtx_PLUS (SImode, operands[0], operands[0]));
5814 operands[0] = temp;
5815 }
5816 emit_jump_insn (gen_casesi0 (operands[0], operands[3]));
5817 DONE;
5818 }")
5819
5820 (define_insn "casesi0"
5821 [(set (pc) (plus:SI
5822 (mem:SI (plus:SI (pc)
5823 (match_operand:SI 0 "register_operand" "r")))
5824 (label_ref (match_operand 1 "" ""))))]
5825 ""
5826 "blr %0,%%r0\;nop"
5827 [(set_attr "type" "multi")
5828 (set_attr "length" "8")])
5829
5830 ;; Need nops for the calls because execution is supposed to continue
5831 ;; past; we don't want to nullify an instruction that we need.
5832 ;;- jump to subroutine
5833
5834 (define_expand "call"
5835 [(parallel [(call (match_operand:SI 0 "" "")
5836 (match_operand 1 "" ""))
5837 (clobber (reg:SI 2))])]
5838 ""
5839 "
5840 {
5841 rtx op, call_insn;
5842 rtx nb = operands[1];
5843
5844 if (TARGET_PORTABLE_RUNTIME)
5845 op = force_reg (SImode, XEXP (operands[0], 0));
5846 else
5847 op = XEXP (operands[0], 0);
5848
5849 if (TARGET_64BIT)
5850 {
5851 if (!virtuals_instantiated)
5852 emit_move_insn (arg_pointer_rtx,
5853 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
5854 GEN_INT (64)));
5855 else
5856 {
5857 /* The loop pass can generate new libcalls after the virtual
5858 registers are instantiated when fpregs are disabled because
5859 the only method that we have for doing DImode multiplication
5860 is with a libcall. This could be trouble if we haven't
5861 allocated enough space for the outgoing arguments. */
5862 if (INTVAL (nb) > current_function_outgoing_args_size)
5863 abort ();
5864
5865 emit_move_insn (arg_pointer_rtx,
5866 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
5867 GEN_INT (STACK_POINTER_OFFSET + 64)));
5868 }
5869 }
5870
5871 /* Use two different patterns for calls to explicitly named functions
5872 and calls through function pointers. This is necessary as these two
5873 types of calls use different calling conventions, and CSE might try
5874 to change the named call into an indirect call in some cases (using
5875 two patterns keeps CSE from performing this optimization).
5876
5877 We now use even more call patterns as there was a subtle bug in
5878 attempting to restore the pic register after a call using a simple
5879 move insn. During reload, a instruction involving a pseudo register
5880 with no explicit dependence on the PIC register can be converted
5881 to an equivalent load from memory using the PIC register. If we
5882 emit a simple move to restore the PIC register in the initial rtl
5883 generation, then it can potentially be repositioned during scheduling.
5884 and an instruction that eventually uses the PIC register may end up
5885 between the call and the PIC register restore.
5886
5887 This only worked because there is a post call group of instructions
5888 that are scheduled with the call. These instructions are included
5889 in the same basic block as the call. However, calls can throw in
5890 C++ code and a basic block has to terminate at the call if the call
5891 can throw. This results in the PIC register restore being scheduled
5892 independently from the call. So, we now hide the save and restore
5893 of the PIC register in the call pattern until after reload. Then,
5894 we split the moves out. A small side benefit is that we now don't
5895 need to have a use of the PIC register in the return pattern and
5896 the final save/restore operation is not needed.
5897
5898 I elected to just clobber %r4 in the PIC patterns and use it instead
5899 of trying to force hppa_pic_save_rtx () to a callee saved register.
5900 This might have required a new register class and constraint. It
5901 was also simpler to just handle the restore from a register than a
5902 generic pseudo. */
5903 if (TARGET_64BIT)
5904 {
5905 if (GET_CODE (op) == SYMBOL_REF)
5906 call_insn = emit_call_insn (gen_call_symref_64bit (op, nb));
5907 else
5908 {
5909 op = force_reg (word_mode, op);
5910 call_insn = emit_call_insn (gen_call_reg_64bit (op, nb));
5911 }
5912 }
5913 else
5914 {
5915 if (GET_CODE (op) == SYMBOL_REF)
5916 {
5917 if (flag_pic)
5918 call_insn = emit_call_insn (gen_call_symref_pic (op, nb));
5919 else
5920 call_insn = emit_call_insn (gen_call_symref (op, nb));
5921 }
5922 else
5923 {
5924 rtx tmpreg = gen_rtx_REG (word_mode, 22);
5925
5926 emit_move_insn (tmpreg, force_reg (word_mode, op));
5927 if (flag_pic)
5928 call_insn = emit_call_insn (gen_call_reg_pic (nb));
5929 else
5930 call_insn = emit_call_insn (gen_call_reg (nb));
5931 }
5932 }
5933
5934 DONE;
5935 }")
5936
5937 ;; We use function calls to set the attribute length of calls and millicode
5938 ;; calls. This is necessary because of the large variety of call sequences.
5939 ;; Implementing the calculation in rtl is difficult as well as ugly. As
5940 ;; we need the same calculation in several places, maintenance becomes a
5941 ;; nightmare.
5942 ;;
5943 ;; However, this has a subtle impact on branch shortening. When the
5944 ;; expression used to set the length attribute of an instruction depends
5945 ;; on a relative address (e.g., pc or a branch address), genattrtab
5946 ;; notes that the insn's length is variable, and attempts to determine a
5947 ;; worst-case default length and code to compute an insn's current length.
5948
5949 ;; The use of a function call hides the variable dependence of our calls
5950 ;; and millicode calls. The result is genattrtab doesn't treat the operation
5951 ;; as variable and it only generates code for the default case using our
5952 ;; function call. Because of this, calls and millicode calls have a fixed
5953 ;; length in the branch shortening pass, and some branches will use a longer
5954 ;; code sequence than necessary. However, the length of any given call
5955 ;; will still reflect its final code location and it may be shorter than
5956 ;; the initial length estimate.
5957
5958 ;; It's possible to trick genattrtab by adding an expression involving `pc'
5959 ;; in the set. However, when genattrtab hits a function call in its attempt
5960 ;; to compute the default length, it marks the result as unknown and sets
5961 ;; the default result to MAX_INT ;-( One possible fix that would allow
5962 ;; calls to participate in branch shortening would be to make the call to
5963 ;; insn_default_length a target option. Then, we could massage unknown
5964 ;; results. Another fix might be to change genattrtab so that it just does
5965 ;; the call in the variable case as it already does for the fixed case.
5966
5967 (define_insn "call_symref"
5968 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
5969 (match_operand 1 "" "i"))
5970 (clobber (reg:SI 1))
5971 (clobber (reg:SI 2))
5972 (use (const_int 0))]
5973 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
5974 "*
5975 {
5976 output_arg_descriptor (insn);
5977 return output_call (insn, operands[0], 0);
5978 }"
5979 [(set_attr "type" "call")
5980 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
5981
5982 (define_insn "call_symref_pic"
5983 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
5984 (match_operand 1 "" "i"))
5985 (clobber (reg:SI 1))
5986 (clobber (reg:SI 2))
5987 (clobber (reg:SI 4))
5988 (use (reg:SI 19))
5989 (use (const_int 0))]
5990 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
5991 "*
5992 {
5993 output_arg_descriptor (insn);
5994 return output_call (insn, operands[0], 0);
5995 }"
5996 [(set_attr "type" "call")
5997 (set (attr "length")
5998 (plus (symbol_ref "attr_length_call (insn, 0)")
5999 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6000
6001 ;; Split out the PIC register save and restore after reload. This is
6002 ;; done only if the function returns. As the split is done after reload,
6003 ;; there are some situations in which we unnecessarily save and restore
6004 ;; %r4. This happens when there is a single call and the PIC register
6005 ;; is "dead" after the call. This isn't easy to fix as the usage of
6006 ;; the PIC register isn't completely determined until the reload pass.
6007 (define_split
6008 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6009 (match_operand 1 "" ""))
6010 (clobber (reg:SI 1))
6011 (clobber (reg:SI 2))
6012 (clobber (reg:SI 4))
6013 (use (reg:SI 19))
6014 (use (const_int 0))])]
6015 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT
6016 && reload_completed
6017 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6018 [(set (reg:SI 4) (reg:SI 19))
6019 (parallel [(call (mem:SI (match_dup 0))
6020 (match_dup 1))
6021 (clobber (reg:SI 1))
6022 (clobber (reg:SI 2))
6023 (use (reg:SI 19))
6024 (use (const_int 0))])
6025 (set (reg:SI 19) (reg:SI 4))]
6026 "")
6027
6028 ;; Remove the clobber of register 4 when optimizing. This has to be
6029 ;; done with a peephole optimization rather than a split because the
6030 ;; split sequence for a call must be longer than one instruction.
6031 (define_peephole2
6032 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6033 (match_operand 1 "" ""))
6034 (clobber (reg:SI 1))
6035 (clobber (reg:SI 2))
6036 (clobber (reg:SI 4))
6037 (use (reg:SI 19))
6038 (use (const_int 0))])]
6039 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
6040 [(parallel [(call (mem:SI (match_dup 0))
6041 (match_dup 1))
6042 (clobber (reg:SI 1))
6043 (clobber (reg:SI 2))
6044 (use (reg:SI 19))
6045 (use (const_int 0))])]
6046 "")
6047
6048 (define_insn "*call_symref_pic_post_reload"
6049 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6050 (match_operand 1 "" "i"))
6051 (clobber (reg:SI 1))
6052 (clobber (reg:SI 2))
6053 (use (reg:SI 19))
6054 (use (const_int 0))]
6055 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
6056 "*
6057 {
6058 output_arg_descriptor (insn);
6059 return output_call (insn, operands[0], 0);
6060 }"
6061 [(set_attr "type" "call")
6062 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
6063
6064 ;; This pattern is split if it is necessary to save and restore the
6065 ;; PIC register.
6066 (define_insn "call_symref_64bit"
6067 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6068 (match_operand 1 "" "i"))
6069 (clobber (reg:DI 1))
6070 (clobber (reg:DI 2))
6071 (clobber (reg:DI 4))
6072 (use (reg:DI 27))
6073 (use (reg:DI 29))
6074 (use (const_int 0))]
6075 "TARGET_64BIT"
6076 "*
6077 {
6078 output_arg_descriptor (insn);
6079 return output_call (insn, operands[0], 0);
6080 }"
6081 [(set_attr "type" "call")
6082 (set (attr "length")
6083 (plus (symbol_ref "attr_length_call (insn, 0)")
6084 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6085
6086 ;; Split out the PIC register save and restore after reload. This is
6087 ;; done only if the function returns. As the split is done after reload,
6088 ;; there are some situations in which we unnecessarily save and restore
6089 ;; %r4. This happens when there is a single call and the PIC register
6090 ;; is "dead" after the call. This isn't easy to fix as the usage of
6091 ;; the PIC register isn't completely determined until the reload pass.
6092 (define_split
6093 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6094 (match_operand 1 "" ""))
6095 (clobber (reg:DI 1))
6096 (clobber (reg:DI 2))
6097 (clobber (reg:DI 4))
6098 (use (reg:DI 27))
6099 (use (reg:DI 29))
6100 (use (const_int 0))])]
6101 "TARGET_64BIT
6102 && reload_completed
6103 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6104 [(set (reg:DI 4) (reg:DI 27))
6105 (parallel [(call (mem:SI (match_dup 0))
6106 (match_dup 1))
6107 (clobber (reg:DI 1))
6108 (clobber (reg:DI 2))
6109 (use (reg:DI 27))
6110 (use (reg:DI 29))
6111 (use (const_int 0))])
6112 (set (reg:DI 27) (reg:DI 4))]
6113 "")
6114
6115 ;; Remove the clobber of register 4 when optimizing. This has to be
6116 ;; done with a peephole optimization rather than a split because the
6117 ;; split sequence for a call must be longer than one instruction.
6118 (define_peephole2
6119 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6120 (match_operand 1 "" ""))
6121 (clobber (reg:DI 1))
6122 (clobber (reg:DI 2))
6123 (clobber (reg:DI 4))
6124 (use (reg:DI 27))
6125 (use (reg:DI 29))
6126 (use (const_int 0))])]
6127 "TARGET_64BIT && reload_completed"
6128 [(parallel [(call (mem:SI (match_dup 0))
6129 (match_dup 1))
6130 (clobber (reg:DI 1))
6131 (clobber (reg:DI 2))
6132 (use (reg:DI 27))
6133 (use (reg:DI 29))
6134 (use (const_int 0))])]
6135 "")
6136
6137 (define_insn "*call_symref_64bit_post_reload"
6138 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6139 (match_operand 1 "" "i"))
6140 (clobber (reg:DI 1))
6141 (clobber (reg:DI 2))
6142 (use (reg:DI 27))
6143 (use (reg:DI 29))
6144 (use (const_int 0))]
6145 "TARGET_64BIT"
6146 "*
6147 {
6148 output_arg_descriptor (insn);
6149 return output_call (insn, operands[0], 0);
6150 }"
6151 [(set_attr "type" "call")
6152 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
6153
6154 (define_insn "call_reg"
6155 [(call (mem:SI (reg:SI 22))
6156 (match_operand 0 "" "i"))
6157 (clobber (reg:SI 1))
6158 (clobber (reg:SI 2))
6159 (use (const_int 1))]
6160 "!TARGET_64BIT"
6161 "*
6162 {
6163 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
6164 }"
6165 [(set_attr "type" "dyncall")
6166 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
6167
6168 ;; This pattern is split if it is necessary to save and restore the
6169 ;; PIC register.
6170 (define_insn "call_reg_pic"
6171 [(call (mem:SI (reg:SI 22))
6172 (match_operand 0 "" "i"))
6173 (clobber (reg:SI 1))
6174 (clobber (reg:SI 2))
6175 (clobber (reg:SI 4))
6176 (use (reg:SI 19))
6177 (use (const_int 1))]
6178 "!TARGET_64BIT"
6179 "*
6180 {
6181 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
6182 }"
6183 [(set_attr "type" "dyncall")
6184 (set (attr "length")
6185 (plus (symbol_ref "attr_length_indirect_call (insn)")
6186 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6187
6188 ;; Split out the PIC register save and restore after reload. This is
6189 ;; done only if the function returns. As the split is done after reload,
6190 ;; there are some situations in which we unnecessarily save and restore
6191 ;; %r4. This happens when there is a single call and the PIC register
6192 ;; is "dead" after the call. This isn't easy to fix as the usage of
6193 ;; the PIC register isn't completely determined until the reload pass.
6194 (define_split
6195 [(parallel [(call (mem:SI (reg:SI 22))
6196 (match_operand 0 "" ""))
6197 (clobber (reg:SI 1))
6198 (clobber (reg:SI 2))
6199 (clobber (reg:SI 4))
6200 (use (reg:SI 19))
6201 (use (const_int 1))])]
6202 "!TARGET_64BIT
6203 && reload_completed
6204 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6205 [(set (reg:SI 4) (reg:SI 19))
6206 (parallel [(call (mem:SI (reg:SI 22))
6207 (match_dup 0))
6208 (clobber (reg:SI 1))
6209 (clobber (reg:SI 2))
6210 (use (reg:SI 19))
6211 (use (const_int 1))])
6212 (set (reg:SI 19) (reg:SI 4))]
6213 "")
6214
6215 ;; Remove the clobber of register 4 when optimizing. This has to be
6216 ;; done with a peephole optimization rather than a split because the
6217 ;; split sequence for a call must be longer than one instruction.
6218 (define_peephole2
6219 [(parallel [(call (mem:SI (reg:SI 22))
6220 (match_operand 0 "" ""))
6221 (clobber (reg:SI 1))
6222 (clobber (reg:SI 2))
6223 (clobber (reg:SI 4))
6224 (use (reg:SI 19))
6225 (use (const_int 1))])]
6226 "!TARGET_64BIT && reload_completed"
6227 [(parallel [(call (mem:SI (reg:SI 22))
6228 (match_dup 0))
6229 (clobber (reg:SI 1))
6230 (clobber (reg:SI 2))
6231 (use (reg:SI 19))
6232 (use (const_int 1))])]
6233 "")
6234
6235 (define_insn "*call_reg_pic_post_reload"
6236 [(call (mem:SI (reg:SI 22))
6237 (match_operand 0 "" "i"))
6238 (clobber (reg:SI 1))
6239 (clobber (reg:SI 2))
6240 (use (reg:SI 19))
6241 (use (const_int 1))]
6242 "!TARGET_64BIT"
6243 "*
6244 {
6245 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
6246 }"
6247 [(set_attr "type" "dyncall")
6248 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
6249
6250 ;; This pattern is split if it is necessary to save and restore the
6251 ;; PIC register.
6252 (define_insn "call_reg_64bit"
6253 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
6254 (match_operand 1 "" "i"))
6255 (clobber (reg:DI 2))
6256 (clobber (reg:DI 4))
6257 (use (reg:DI 27))
6258 (use (reg:DI 29))
6259 (use (const_int 1))]
6260 "TARGET_64BIT"
6261 "*
6262 {
6263 return output_indirect_call (insn, operands[0]);
6264 }"
6265 [(set_attr "type" "dyncall")
6266 (set (attr "length")
6267 (plus (symbol_ref "attr_length_indirect_call (insn)")
6268 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6269
6270 ;; Split out the PIC register save and restore after reload. This is
6271 ;; done only if the function returns. As the split is done after reload,
6272 ;; there are some situations in which we unnecessarily save and restore
6273 ;; %r4. This happens when there is a single call and the PIC register
6274 ;; is "dead" after the call. This isn't easy to fix as the usage of
6275 ;; the PIC register isn't completely determined until the reload pass.
6276 (define_split
6277 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
6278 (match_operand 1 "" ""))
6279 (clobber (reg:DI 2))
6280 (clobber (reg:DI 4))
6281 (use (reg:DI 27))
6282 (use (reg:DI 29))
6283 (use (const_int 1))])]
6284 "TARGET_64BIT
6285 && reload_completed
6286 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6287 [(set (reg:DI 4) (reg:DI 27))
6288 (parallel [(call (mem:SI (match_dup 0))
6289 (match_dup 1))
6290 (clobber (reg:DI 2))
6291 (use (reg:DI 27))
6292 (use (reg:DI 29))
6293 (use (const_int 1))])
6294 (set (reg:DI 27) (reg:DI 4))]
6295 "")
6296
6297 ;; Remove the clobber of register 4 when optimizing. This has to be
6298 ;; done with a peephole optimization rather than a split because the
6299 ;; split sequence for a call must be longer than one instruction.
6300 (define_peephole2
6301 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
6302 (match_operand 1 "" ""))
6303 (clobber (reg:DI 2))
6304 (clobber (reg:DI 4))
6305 (use (reg:DI 27))
6306 (use (reg:DI 29))
6307 (use (const_int 1))])]
6308 "TARGET_64BIT && reload_completed"
6309 [(parallel [(call (mem:SI (match_dup 0))
6310 (match_dup 1))
6311 (clobber (reg:DI 2))
6312 (use (reg:DI 27))
6313 (use (reg:DI 29))
6314 (use (const_int 1))])]
6315 "")
6316
6317 (define_insn "*call_reg_64bit_post_reload"
6318 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
6319 (match_operand 1 "" "i"))
6320 (clobber (reg:DI 2))
6321 (use (reg:DI 27))
6322 (use (reg:DI 29))
6323 (use (const_int 1))]
6324 "TARGET_64BIT"
6325 "*
6326 {
6327 return output_indirect_call (insn, operands[0]);
6328 }"
6329 [(set_attr "type" "dyncall")
6330 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
6331
6332 (define_expand "call_value"
6333 [(parallel [(set (match_operand 0 "" "")
6334 (call (match_operand:SI 1 "" "")
6335 (match_operand 2 "" "")))
6336 (clobber (reg:SI 2))])]
6337 ""
6338 "
6339 {
6340 rtx op, call_insn;
6341 rtx dst = operands[0];
6342 rtx nb = operands[2];
6343
6344 if (TARGET_PORTABLE_RUNTIME)
6345 op = force_reg (SImode, XEXP (operands[1], 0));
6346 else
6347 op = XEXP (operands[1], 0);
6348
6349 if (TARGET_64BIT)
6350 {
6351 if (!virtuals_instantiated)
6352 emit_move_insn (arg_pointer_rtx,
6353 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
6354 GEN_INT (64)));
6355 else
6356 {
6357 /* The loop pass can generate new libcalls after the virtual
6358 registers are instantiated when fpregs are disabled because
6359 the only method that we have for doing DImode multiplication
6360 is with a libcall. This could be trouble if we haven't
6361 allocated enough space for the outgoing arguments. */
6362 if (INTVAL (nb) > current_function_outgoing_args_size)
6363 abort ();
6364
6365 emit_move_insn (arg_pointer_rtx,
6366 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
6367 GEN_INT (STACK_POINTER_OFFSET + 64)));
6368 }
6369 }
6370
6371 /* Use two different patterns for calls to explicitly named functions
6372 and calls through function pointers. This is necessary as these two
6373 types of calls use different calling conventions, and CSE might try
6374 to change the named call into an indirect call in some cases (using
6375 two patterns keeps CSE from performing this optimization).
6376
6377 We now use even more call patterns as there was a subtle bug in
6378 attempting to restore the pic register after a call using a simple
6379 move insn. During reload, a instruction involving a pseudo register
6380 with no explicit dependence on the PIC register can be converted
6381 to an equivalent load from memory using the PIC register. If we
6382 emit a simple move to restore the PIC register in the initial rtl
6383 generation, then it can potentially be repositioned during scheduling.
6384 and an instruction that eventually uses the PIC register may end up
6385 between the call and the PIC register restore.
6386
6387 This only worked because there is a post call group of instructions
6388 that are scheduled with the call. These instructions are included
6389 in the same basic block as the call. However, calls can throw in
6390 C++ code and a basic block has to terminate at the call if the call
6391 can throw. This results in the PIC register restore being scheduled
6392 independently from the call. So, we now hide the save and restore
6393 of the PIC register in the call pattern until after reload. Then,
6394 we split the moves out. A small side benefit is that we now don't
6395 need to have a use of the PIC register in the return pattern and
6396 the final save/restore operation is not needed.
6397
6398 I elected to just clobber %r4 in the PIC patterns and use it instead
6399 of trying to force hppa_pic_save_rtx () to a callee saved register.
6400 This might have required a new register class and constraint. It
6401 was also simpler to just handle the restore from a register than a
6402 generic pseudo. */
6403 if (TARGET_64BIT)
6404 {
6405 if (GET_CODE (op) == SYMBOL_REF)
6406 call_insn = emit_call_insn (gen_call_val_symref_64bit (dst, op, nb));
6407 else
6408 {
6409 op = force_reg (word_mode, op);
6410 call_insn = emit_call_insn (gen_call_val_reg_64bit (dst, op, nb));
6411 }
6412 }
6413 else
6414 {
6415 if (GET_CODE (op) == SYMBOL_REF)
6416 {
6417 if (flag_pic)
6418 call_insn = emit_call_insn (gen_call_val_symref_pic (dst, op, nb));
6419 else
6420 call_insn = emit_call_insn (gen_call_val_symref (dst, op, nb));
6421 }
6422 else
6423 {
6424 rtx tmpreg = gen_rtx_REG (word_mode, 22);
6425
6426 emit_move_insn (tmpreg, force_reg (word_mode, op));
6427 if (flag_pic)
6428 call_insn = emit_call_insn (gen_call_val_reg_pic (dst, nb));
6429 else
6430 call_insn = emit_call_insn (gen_call_val_reg (dst, nb));
6431 }
6432 }
6433
6434 DONE;
6435 }")
6436
6437 (define_insn "call_val_symref"
6438 [(set (match_operand 0 "" "")
6439 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6440 (match_operand 2 "" "i")))
6441 (clobber (reg:SI 1))
6442 (clobber (reg:SI 2))
6443 (use (const_int 0))]
6444 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
6445 "*
6446 {
6447 output_arg_descriptor (insn);
6448 return output_call (insn, operands[1], 0);
6449 }"
6450 [(set_attr "type" "call")
6451 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
6452
6453 (define_insn "call_val_symref_pic"
6454 [(set (match_operand 0 "" "")
6455 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6456 (match_operand 2 "" "i")))
6457 (clobber (reg:SI 1))
6458 (clobber (reg:SI 2))
6459 (clobber (reg:SI 4))
6460 (use (reg:SI 19))
6461 (use (const_int 0))]
6462 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
6463 "*
6464 {
6465 output_arg_descriptor (insn);
6466 return output_call (insn, operands[1], 0);
6467 }"
6468 [(set_attr "type" "call")
6469 (set (attr "length")
6470 (plus (symbol_ref "attr_length_call (insn, 0)")
6471 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6472
6473 ;; Split out the PIC register save and restore after reload. This is
6474 ;; done only if the function returns. As the split is done after reload,
6475 ;; there are some situations in which we unnecessarily save and restore
6476 ;; %r4. This happens when there is a single call and the PIC register
6477 ;; is "dead" after the call. This isn't easy to fix as the usage of
6478 ;; the PIC register isn't completely determined until the reload pass.
6479 (define_split
6480 [(parallel [(set (match_operand 0 "" "")
6481 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6482 (match_operand 2 "" "")))
6483 (clobber (reg:SI 1))
6484 (clobber (reg:SI 2))
6485 (clobber (reg:SI 4))
6486 (use (reg:SI 19))
6487 (use (const_int 0))])]
6488 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT
6489 && reload_completed
6490 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6491 [(set (reg:SI 4) (reg:SI 19))
6492 (parallel [(set (match_dup 0)
6493 (call (mem:SI (match_dup 1))
6494 (match_dup 2)))
6495 (clobber (reg:SI 1))
6496 (clobber (reg:SI 2))
6497 (use (reg:SI 19))
6498 (use (const_int 0))])
6499 (set (reg:SI 19) (reg:SI 4))]
6500 "")
6501
6502 ;; Remove the clobber of register 4 when optimizing. This has to be
6503 ;; done with a peephole optimization rather than a split because the
6504 ;; split sequence for a call must be longer than one instruction.
6505 (define_peephole2
6506 [(parallel [(set (match_operand 0 "" "")
6507 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6508 (match_operand 2 "" "")))
6509 (clobber (reg:SI 1))
6510 (clobber (reg:SI 2))
6511 (clobber (reg:SI 4))
6512 (use (reg:SI 19))
6513 (use (const_int 0))])]
6514 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
6515 [(parallel [(set (match_dup 0)
6516 (call (mem:SI (match_dup 1))
6517 (match_dup 2)))
6518 (clobber (reg:SI 1))
6519 (clobber (reg:SI 2))
6520 (use (reg:SI 19))
6521 (use (const_int 0))])]
6522 "")
6523
6524 (define_insn "*call_val_symref_pic_post_reload"
6525 [(set (match_operand 0 "" "")
6526 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6527 (match_operand 2 "" "i")))
6528 (clobber (reg:SI 1))
6529 (clobber (reg:SI 2))
6530 (use (reg:SI 19))
6531 (use (const_int 0))]
6532 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
6533 "*
6534 {
6535 output_arg_descriptor (insn);
6536 return output_call (insn, operands[1], 0);
6537 }"
6538 [(set_attr "type" "call")
6539 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
6540
6541 ;; This pattern is split if it is necessary to save and restore the
6542 ;; PIC register.
6543 (define_insn "call_val_symref_64bit"
6544 [(set (match_operand 0 "" "")
6545 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6546 (match_operand 2 "" "i")))
6547 (clobber (reg:DI 1))
6548 (clobber (reg:DI 2))
6549 (clobber (reg:DI 4))
6550 (use (reg:DI 27))
6551 (use (reg:DI 29))
6552 (use (const_int 0))]
6553 "TARGET_64BIT"
6554 "*
6555 {
6556 output_arg_descriptor (insn);
6557 return output_call (insn, operands[1], 0);
6558 }"
6559 [(set_attr "type" "call")
6560 (set (attr "length")
6561 (plus (symbol_ref "attr_length_call (insn, 0)")
6562 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6563
6564 ;; Split out the PIC register save and restore after reload. This is
6565 ;; done only if the function returns. As the split is done after reload,
6566 ;; there are some situations in which we unnecessarily save and restore
6567 ;; %r4. This happens when there is a single call and the PIC register
6568 ;; is "dead" after the call. This isn't easy to fix as the usage of
6569 ;; the PIC register isn't completely determined until the reload pass.
6570 (define_split
6571 [(parallel [(set (match_operand 0 "" "")
6572 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6573 (match_operand 2 "" "")))
6574 (clobber (reg:DI 1))
6575 (clobber (reg:DI 2))
6576 (clobber (reg:DI 4))
6577 (use (reg:DI 27))
6578 (use (reg:DI 29))
6579 (use (const_int 0))])]
6580 "TARGET_64BIT
6581 && reload_completed
6582 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6583 [(set (reg:DI 4) (reg:DI 27))
6584 (parallel [(set (match_dup 0)
6585 (call (mem:SI (match_dup 1))
6586 (match_dup 2)))
6587 (clobber (reg:DI 1))
6588 (clobber (reg:DI 2))
6589 (use (reg:DI 27))
6590 (use (reg:DI 29))
6591 (use (const_int 0))])
6592 (set (reg:DI 27) (reg:DI 4))]
6593 "")
6594
6595 ;; Remove the clobber of register 4 when optimizing. This has to be
6596 ;; done with a peephole optimization rather than a split because the
6597 ;; split sequence for a call must be longer than one instruction.
6598 (define_peephole2
6599 [(parallel [(set (match_operand 0 "" "")
6600 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6601 (match_operand 2 "" "")))
6602 (clobber (reg:DI 1))
6603 (clobber (reg:DI 2))
6604 (clobber (reg:DI 4))
6605 (use (reg:DI 27))
6606 (use (reg:DI 29))
6607 (use (const_int 0))])]
6608 "TARGET_64BIT && reload_completed"
6609 [(parallel [(set (match_dup 0)
6610 (call (mem:SI (match_dup 1))
6611 (match_dup 2)))
6612 (clobber (reg:DI 1))
6613 (clobber (reg:DI 2))
6614 (use (reg:DI 27))
6615 (use (reg:DI 29))
6616 (use (const_int 0))])]
6617 "")
6618
6619 (define_insn "*call_val_symref_64bit_post_reload"
6620 [(set (match_operand 0 "" "")
6621 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6622 (match_operand 2 "" "i")))
6623 (clobber (reg:DI 1))
6624 (clobber (reg:DI 2))
6625 (use (reg:DI 27))
6626 (use (reg:DI 29))
6627 (use (const_int 0))]
6628 "TARGET_64BIT"
6629 "*
6630 {
6631 output_arg_descriptor (insn);
6632 return output_call (insn, operands[1], 0);
6633 }"
6634 [(set_attr "type" "call")
6635 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
6636
6637 (define_insn "call_val_reg"
6638 [(set (match_operand 0 "" "")
6639 (call (mem:SI (reg:SI 22))
6640 (match_operand 1 "" "i")))
6641 (clobber (reg:SI 1))
6642 (clobber (reg:SI 2))
6643 (use (const_int 1))]
6644 "!TARGET_64BIT"
6645 "*
6646 {
6647 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
6648 }"
6649 [(set_attr "type" "dyncall")
6650 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
6651
6652 ;; This pattern is split if it is necessary to save and restore the
6653 ;; PIC register.
6654 (define_insn "call_val_reg_pic"
6655 [(set (match_operand 0 "" "")
6656 (call (mem:SI (reg:SI 22))
6657 (match_operand 1 "" "i")))
6658 (clobber (reg:SI 1))
6659 (clobber (reg:SI 2))
6660 (clobber (reg:SI 4))
6661 (use (reg:SI 19))
6662 (use (const_int 1))]
6663 "!TARGET_64BIT"
6664 "*
6665 {
6666 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
6667 }"
6668 [(set_attr "type" "dyncall")
6669 (set (attr "length")
6670 (plus (symbol_ref "attr_length_indirect_call (insn)")
6671 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6672
6673 ;; Split out the PIC register save and restore after reload. This is
6674 ;; done only if the function returns. As the split is done after reload,
6675 ;; there are some situations in which we unnecessarily save and restore
6676 ;; %r4. This happens when there is a single call and the PIC register
6677 ;; is "dead" after the call. This isn't easy to fix as the usage of
6678 ;; the PIC register isn't completely determined until the reload pass.
6679 (define_split
6680 [(parallel [(set (match_operand 0 "" "")
6681 (call (mem:SI (reg:SI 22))
6682 (match_operand 1 "" "")))
6683 (clobber (reg:SI 1))
6684 (clobber (reg:SI 2))
6685 (clobber (reg:SI 4))
6686 (use (reg:SI 19))
6687 (use (const_int 1))])]
6688 "!TARGET_64BIT
6689 && reload_completed
6690 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6691 [(set (reg:SI 4) (reg:SI 19))
6692 (parallel [(set (match_dup 0)
6693 (call (mem:SI (reg:SI 22))
6694 (match_dup 1)))
6695 (clobber (reg:SI 1))
6696 (clobber (reg:SI 2))
6697 (use (reg:SI 19))
6698 (use (const_int 1))])
6699 (set (reg:SI 19) (reg:SI 4))]
6700 "")
6701
6702 ;; Remove the clobber of register 4 when optimizing. This has to be
6703 ;; done with a peephole optimization rather than a split because the
6704 ;; split sequence for a call must be longer than one instruction.
6705 (define_peephole2
6706 [(parallel [(set (match_operand 0 "" "")
6707 (call (mem:SI (reg:SI 22))
6708 (match_operand 1 "" "")))
6709 (clobber (reg:SI 1))
6710 (clobber (reg:SI 2))
6711 (clobber (reg:SI 4))
6712 (use (reg:SI 19))
6713 (use (const_int 1))])]
6714 "!TARGET_64BIT && reload_completed"
6715 [(parallel [(set (match_dup 0)
6716 (call (mem:SI (reg:SI 22))
6717 (match_dup 1)))
6718 (clobber (reg:SI 1))
6719 (clobber (reg:SI 2))
6720 (use (reg:SI 19))
6721 (use (const_int 1))])]
6722 "")
6723
6724 (define_insn "*call_val_reg_pic_post_reload"
6725 [(set (match_operand 0 "" "")
6726 (call (mem:SI (reg:SI 22))
6727 (match_operand 1 "" "i")))
6728 (clobber (reg:SI 1))
6729 (clobber (reg:SI 2))
6730 (use (reg:SI 19))
6731 (use (const_int 1))]
6732 "!TARGET_64BIT"
6733 "*
6734 {
6735 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
6736 }"
6737 [(set_attr "type" "dyncall")
6738 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
6739
6740 ;; This pattern is split if it is necessary to save and restore the
6741 ;; PIC register.
6742 (define_insn "call_val_reg_64bit"
6743 [(set (match_operand 0 "" "")
6744 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
6745 (match_operand 2 "" "i")))
6746 (clobber (reg:DI 2))
6747 (clobber (reg:DI 4))
6748 (use (reg:DI 27))
6749 (use (reg:DI 29))
6750 (use (const_int 1))]
6751 "TARGET_64BIT"
6752 "*
6753 {
6754 return output_indirect_call (insn, operands[1]);
6755 }"
6756 [(set_attr "type" "dyncall")
6757 (set (attr "length")
6758 (plus (symbol_ref "attr_length_indirect_call (insn)")
6759 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
6760
6761 ;; Split out the PIC register save and restore after reload. This is
6762 ;; done only if the function returns. As the split is done after reload,
6763 ;; there are some situations in which we unnecessarily save and restore
6764 ;; %r4. This happens when there is a single call and the PIC register
6765 ;; is "dead" after the call. This isn't easy to fix as the usage of
6766 ;; the PIC register isn't completely determined until the reload pass.
6767 (define_split
6768 [(parallel [(set (match_operand 0 "" "")
6769 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
6770 (match_operand 2 "" "")))
6771 (clobber (reg:DI 2))
6772 (clobber (reg:DI 4))
6773 (use (reg:DI 27))
6774 (use (reg:DI 29))
6775 (use (const_int 1))])]
6776 "TARGET_64BIT
6777 && reload_completed
6778 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6779 [(set (reg:DI 4) (reg:DI 27))
6780 (parallel [(set (match_dup 0)
6781 (call (mem:SI (match_dup 1))
6782 (match_dup 2)))
6783 (clobber (reg:DI 2))
6784 (use (reg:DI 27))
6785 (use (reg:DI 29))
6786 (use (const_int 1))])
6787 (set (reg:DI 27) (reg:DI 4))]
6788 "")
6789
6790 ;; Remove the clobber of register 4 when optimizing. This has to be
6791 ;; done with a peephole optimization rather than a split because the
6792 ;; split sequence for a call must be longer than one instruction.
6793 (define_peephole2
6794 [(parallel [(set (match_operand 0 "" "")
6795 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
6796 (match_operand 2 "" "")))
6797 (clobber (reg:DI 2))
6798 (clobber (reg:DI 4))
6799 (use (reg:DI 27))
6800 (use (reg:DI 29))
6801 (use (const_int 1))])]
6802 "TARGET_64BIT && reload_completed"
6803 [(parallel [(set (match_dup 0)
6804 (call (mem:SI (match_dup 1))
6805 (match_dup 2)))
6806 (clobber (reg:DI 2))
6807 (use (reg:DI 27))
6808 (use (reg:DI 29))
6809 (use (const_int 1))])]
6810 "")
6811
6812 (define_insn "*call_val_reg_64bit_post_reload"
6813 [(set (match_operand 0 "" "")
6814 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
6815 (match_operand 2 "" "i")))
6816 (clobber (reg:DI 2))
6817 (use (reg:DI 27))
6818 (use (reg:DI 29))
6819 (use (const_int 1))]
6820 "TARGET_64BIT"
6821 "*
6822 {
6823 return output_indirect_call (insn, operands[1]);
6824 }"
6825 [(set_attr "type" "dyncall")
6826 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
6827
6828 ;; Call subroutine returning any type.
6829
6830 (define_expand "untyped_call"
6831 [(parallel [(call (match_operand 0 "" "")
6832 (const_int 0))
6833 (match_operand 1 "" "")
6834 (match_operand 2 "" "")])]
6835 ""
6836 "
6837 {
6838 int i;
6839
6840 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
6841
6842 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6843 {
6844 rtx set = XVECEXP (operands[2], 0, i);
6845 emit_move_insn (SET_DEST (set), SET_SRC (set));
6846 }
6847
6848 /* The optimizer does not know that the call sets the function value
6849 registers we stored in the result block. We avoid problems by
6850 claiming that all hard registers are used and clobbered at this
6851 point. */
6852 emit_insn (gen_blockage ());
6853
6854 DONE;
6855 }")
6856
6857 (define_expand "sibcall"
6858 [(call (match_operand:SI 0 "" "")
6859 (match_operand 1 "" ""))]
6860 "!TARGET_PORTABLE_RUNTIME"
6861 "
6862 {
6863 rtx op, call_insn;
6864 rtx nb = operands[1];
6865
6866 op = XEXP (operands[0], 0);
6867
6868 if (TARGET_64BIT)
6869 {
6870 if (!virtuals_instantiated)
6871 emit_move_insn (arg_pointer_rtx,
6872 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
6873 GEN_INT (64)));
6874 else
6875 {
6876 /* The loop pass can generate new libcalls after the virtual
6877 registers are instantiated when fpregs are disabled because
6878 the only method that we have for doing DImode multiplication
6879 is with a libcall. This could be trouble if we haven't
6880 allocated enough space for the outgoing arguments. */
6881 if (INTVAL (nb) > current_function_outgoing_args_size)
6882 abort ();
6883
6884 emit_move_insn (arg_pointer_rtx,
6885 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
6886 GEN_INT (STACK_POINTER_OFFSET + 64)));
6887 }
6888 }
6889
6890 /* Indirect sibling calls are not allowed. */
6891 if (TARGET_64BIT)
6892 call_insn = gen_sibcall_internal_symref_64bit (op, operands[1]);
6893 else
6894 call_insn = gen_sibcall_internal_symref (op, operands[1]);
6895
6896 call_insn = emit_call_insn (call_insn);
6897
6898 if (TARGET_64BIT)
6899 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
6900
6901 /* We don't have to restore the PIC register. */
6902 if (flag_pic)
6903 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
6904
6905 DONE;
6906 }")
6907
6908 (define_insn "sibcall_internal_symref"
6909 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6910 (match_operand 1 "" "i"))
6911 (clobber (reg:SI 1))
6912 (use (reg:SI 2))
6913 (use (const_int 0))]
6914 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
6915 "*
6916 {
6917 output_arg_descriptor (insn);
6918 return output_call (insn, operands[0], 1);
6919 }"
6920 [(set_attr "type" "call")
6921 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
6922
6923 (define_insn "sibcall_internal_symref_64bit"
6924 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6925 (match_operand 1 "" "i"))
6926 (clobber (reg:DI 1))
6927 (use (reg:DI 2))
6928 (use (const_int 0))]
6929 "TARGET_64BIT"
6930 "*
6931 {
6932 output_arg_descriptor (insn);
6933 return output_call (insn, operands[0], 1);
6934 }"
6935 [(set_attr "type" "call")
6936 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
6937
6938 (define_expand "sibcall_value"
6939 [(set (match_operand 0 "" "")
6940 (call (match_operand:SI 1 "" "")
6941 (match_operand 2 "" "")))]
6942 "!TARGET_PORTABLE_RUNTIME"
6943 "
6944 {
6945 rtx op, call_insn;
6946 rtx nb = operands[1];
6947
6948 op = XEXP (operands[1], 0);
6949
6950 if (TARGET_64BIT)
6951 {
6952 if (!virtuals_instantiated)
6953 emit_move_insn (arg_pointer_rtx,
6954 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
6955 GEN_INT (64)));
6956 else
6957 {
6958 /* The loop pass can generate new libcalls after the virtual
6959 registers are instantiated when fpregs are disabled because
6960 the only method that we have for doing DImode multiplication
6961 is with a libcall. This could be trouble if we haven't
6962 allocated enough space for the outgoing arguments. */
6963 if (INTVAL (nb) > current_function_outgoing_args_size)
6964 abort ();
6965
6966 emit_move_insn (arg_pointer_rtx,
6967 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
6968 GEN_INT (STACK_POINTER_OFFSET + 64)));
6969 }
6970 }
6971
6972 /* Indirect sibling calls are not allowed. */
6973 if (TARGET_64BIT)
6974 call_insn
6975 = gen_sibcall_value_internal_symref_64bit (operands[0], op, operands[2]);
6976 else
6977 call_insn
6978 = gen_sibcall_value_internal_symref (operands[0], op, operands[2]);
6979
6980 call_insn = emit_call_insn (call_insn);
6981
6982 if (TARGET_64BIT)
6983 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
6984
6985 /* We don't have to restore the PIC register. */
6986 if (flag_pic)
6987 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
6988
6989 DONE;
6990 }")
6991
6992 (define_insn "sibcall_value_internal_symref"
6993 [(set (match_operand 0 "" "")
6994 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6995 (match_operand 2 "" "i")))
6996 (clobber (reg:SI 1))
6997 (use (reg:SI 2))
6998 (use (const_int 0))]
6999 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7000 "*
7001 {
7002 output_arg_descriptor (insn);
7003 return output_call (insn, operands[1], 1);
7004 }"
7005 [(set_attr "type" "call")
7006 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
7007
7008 (define_insn "sibcall_value_internal_symref_64bit"
7009 [(set (match_operand 0 "" "")
7010 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7011 (match_operand 2 "" "i")))
7012 (clobber (reg:DI 1))
7013 (use (reg:DI 2))
7014 (use (const_int 0))]
7015 "TARGET_64BIT"
7016 "*
7017 {
7018 output_arg_descriptor (insn);
7019 return output_call (insn, operands[1], 1);
7020 }"
7021 [(set_attr "type" "call")
7022 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
7023
7024 (define_insn "nop"
7025 [(const_int 0)]
7026 ""
7027 "nop"
7028 [(set_attr "type" "move")
7029 (set_attr "length" "4")])
7030
7031 ;; These are just placeholders so we know where branch tables
7032 ;; begin and end.
7033 (define_insn "begin_brtab"
7034 [(const_int 1)]
7035 ""
7036 "*
7037 {
7038 /* Only GAS actually supports this pseudo-op. */
7039 if (TARGET_GAS)
7040 return \".begin_brtab\";
7041 else
7042 return \"\";
7043 }"
7044 [(set_attr "type" "move")
7045 (set_attr "length" "0")])
7046
7047 (define_insn "end_brtab"
7048 [(const_int 2)]
7049 ""
7050 "*
7051 {
7052 /* Only GAS actually supports this pseudo-op. */
7053 if (TARGET_GAS)
7054 return \".end_brtab\";
7055 else
7056 return \"\";
7057 }"
7058 [(set_attr "type" "move")
7059 (set_attr "length" "0")])
7060
7061 ;;; EH does longjmp's from and within the data section. Thus,
7062 ;;; an interspace branch is required for the longjmp implementation.
7063 ;;; Registers r1 and r2 are used as scratch registers for the jump
7064 ;;; when necessary.
7065 (define_expand "interspace_jump"
7066 [(parallel
7067 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
7068 (clobber (match_dup 1))])]
7069 ""
7070 "
7071 {
7072 operands[1] = gen_rtx_REG (word_mode, 2);
7073 }")
7074
7075 (define_insn ""
7076 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
7077 (clobber (reg:SI 2))]
7078 "TARGET_PA_20 && !TARGET_64BIT"
7079 "bve%* (%0)"
7080 [(set_attr "type" "branch")
7081 (set_attr "length" "4")])
7082
7083 (define_insn ""
7084 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
7085 (clobber (reg:SI 2))]
7086 "TARGET_NO_SPACE_REGS && !TARGET_64BIT"
7087 "be%* 0(%%sr4,%0)"
7088 [(set_attr "type" "branch")
7089 (set_attr "length" "4")])
7090
7091 (define_insn ""
7092 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
7093 (clobber (reg:SI 2))]
7094 "!TARGET_64BIT"
7095 "ldsid (%%sr0,%0),%%r2\; mtsp %%r2,%%sr0\; be%* 0(%%sr0,%0)"
7096 [(set_attr "type" "branch")
7097 (set_attr "length" "12")])
7098
7099 (define_insn ""
7100 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
7101 (clobber (reg:DI 2))]
7102 "TARGET_64BIT"
7103 "bve%* (%0)"
7104 [(set_attr "type" "branch")
7105 (set_attr "length" "4")])
7106
7107 (define_expand "builtin_longjmp"
7108 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
7109 ""
7110 "
7111 {
7112 /* The elements of the buffer are, in order: */
7113 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
7114 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0],
7115 POINTER_SIZE / BITS_PER_UNIT));
7116 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0],
7117 (POINTER_SIZE * 2) / BITS_PER_UNIT));
7118 rtx pv = gen_rtx_REG (Pmode, 1);
7119
7120 /* This bit is the same as expand_builtin_longjmp. */
7121 emit_move_insn (hard_frame_pointer_rtx, fp);
7122 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
7123 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
7124 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
7125
7126 /* Load the label we are jumping through into r1 so that we know
7127 where to look for it when we get back to setjmp's function for
7128 restoring the gp. */
7129 emit_move_insn (pv, lab);
7130
7131 /* Prevent the insns above from being scheduled into the delay slot
7132 of the interspace jump because the space register could change. */
7133 emit_insn (gen_blockage ());
7134
7135 emit_jump_insn (gen_interspace_jump (pv));
7136 emit_barrier ();
7137 DONE;
7138 }")
7139
7140 ;;; Hope this is only within a function...
7141 (define_insn "indirect_jump"
7142 [(set (pc) (match_operand 0 "register_operand" "r"))]
7143 "GET_MODE (operands[0]) == word_mode"
7144 "bv%* %%r0(%0)"
7145 [(set_attr "type" "branch")
7146 (set_attr "length" "4")])
7147
7148 (define_expand "extzv"
7149 [(set (match_operand 0 "register_operand" "")
7150 (zero_extract (match_operand 1 "register_operand" "")
7151 (match_operand 2 "uint32_operand" "")
7152 (match_operand 3 "uint32_operand" "")))]
7153 ""
7154 "
7155 {
7156 if (TARGET_64BIT)
7157 emit_insn (gen_extzv_64 (operands[0], operands[1],
7158 operands[2], operands[3]));
7159 else
7160 {
7161 if (! uint5_operand (operands[2], SImode)
7162 || ! uint5_operand (operands[3], SImode))
7163 FAIL;
7164 emit_insn (gen_extzv_32 (operands[0], operands[1],
7165 operands[2], operands[3]));
7166 }
7167 DONE;
7168 }")
7169
7170 (define_insn "extzv_32"
7171 [(set (match_operand:SI 0 "register_operand" "=r")
7172 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
7173 (match_operand:SI 2 "uint5_operand" "")
7174 (match_operand:SI 3 "uint5_operand" "")))]
7175 ""
7176 "{extru|extrw,u} %1,%3+%2-1,%2,%0"
7177 [(set_attr "type" "shift")
7178 (set_attr "length" "4")])
7179
7180 (define_insn ""
7181 [(set (match_operand:SI 0 "register_operand" "=r")
7182 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
7183 (const_int 1)
7184 (match_operand:SI 2 "register_operand" "q")))]
7185 ""
7186 "{vextru %1,1,%0|extrw,u %1,%%sar,1,%0}"
7187 [(set_attr "type" "shift")
7188 (set_attr "length" "4")])
7189
7190 (define_insn "extzv_64"
7191 [(set (match_operand:DI 0 "register_operand" "=r")
7192 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
7193 (match_operand:DI 2 "uint32_operand" "")
7194 (match_operand:DI 3 "uint32_operand" "")))]
7195 "TARGET_64BIT"
7196 "extrd,u %1,%3+%2-1,%2,%0"
7197 [(set_attr "type" "shift")
7198 (set_attr "length" "4")])
7199
7200 (define_insn ""
7201 [(set (match_operand:DI 0 "register_operand" "=r")
7202 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
7203 (const_int 1)
7204 (match_operand:DI 2 "register_operand" "q")))]
7205 "TARGET_64BIT"
7206 "extrd,u %1,%%sar,1,%0"
7207 [(set_attr "type" "shift")
7208 (set_attr "length" "4")])
7209
7210 (define_expand "extv"
7211 [(set (match_operand 0 "register_operand" "")
7212 (sign_extract (match_operand 1 "register_operand" "")
7213 (match_operand 2 "uint32_operand" "")
7214 (match_operand 3 "uint32_operand" "")))]
7215 ""
7216 "
7217 {
7218 if (TARGET_64BIT)
7219 emit_insn (gen_extv_64 (operands[0], operands[1],
7220 operands[2], operands[3]));
7221 else
7222 {
7223 if (! uint5_operand (operands[2], SImode)
7224 || ! uint5_operand (operands[3], SImode))
7225 FAIL;
7226 emit_insn (gen_extv_32 (operands[0], operands[1],
7227 operands[2], operands[3]));
7228 }
7229 DONE;
7230 }")
7231
7232 (define_insn "extv_32"
7233 [(set (match_operand:SI 0 "register_operand" "=r")
7234 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
7235 (match_operand:SI 2 "uint5_operand" "")
7236 (match_operand:SI 3 "uint5_operand" "")))]
7237 ""
7238 "{extrs|extrw,s} %1,%3+%2-1,%2,%0"
7239 [(set_attr "type" "shift")
7240 (set_attr "length" "4")])
7241
7242 (define_insn ""
7243 [(set (match_operand:SI 0 "register_operand" "=r")
7244 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
7245 (const_int 1)
7246 (match_operand:SI 2 "register_operand" "q")))]
7247 "!TARGET_64BIT"
7248 "{vextrs %1,1,%0|extrw,s %1,%%sar,1,%0}"
7249 [(set_attr "type" "shift")
7250 (set_attr "length" "4")])
7251
7252 (define_insn "extv_64"
7253 [(set (match_operand:DI 0 "register_operand" "=r")
7254 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
7255 (match_operand:DI 2 "uint32_operand" "")
7256 (match_operand:DI 3 "uint32_operand" "")))]
7257 "TARGET_64BIT"
7258 "extrd,s %1,%3+%2-1,%2,%0"
7259 [(set_attr "type" "shift")
7260 (set_attr "length" "4")])
7261
7262 (define_insn ""
7263 [(set (match_operand:DI 0 "register_operand" "=r")
7264 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
7265 (const_int 1)
7266 (match_operand:DI 2 "register_operand" "q")))]
7267 "TARGET_64BIT"
7268 "extrd,s %1,%%sar,1,%0"
7269 [(set_attr "type" "shift")
7270 (set_attr "length" "4")])
7271
7272 ;; Only specify the mode operands 0, the rest are assumed to be word_mode.
7273 (define_expand "insv"
7274 [(set (zero_extract (match_operand 0 "register_operand" "")
7275 (match_operand 1 "uint32_operand" "")
7276 (match_operand 2 "uint32_operand" ""))
7277 (match_operand 3 "arith5_operand" ""))]
7278 ""
7279 "
7280 {
7281 if (TARGET_64BIT)
7282 emit_insn (gen_insv_64 (operands[0], operands[1],
7283 operands[2], operands[3]));
7284 else
7285 {
7286 if (! uint5_operand (operands[2], SImode)
7287 || ! uint5_operand (operands[3], SImode))
7288 FAIL;
7289 emit_insn (gen_insv_32 (operands[0], operands[1],
7290 operands[2], operands[3]));
7291 }
7292 DONE;
7293 }")
7294
7295 (define_insn "insv_32"
7296 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
7297 (match_operand:SI 1 "uint5_operand" "")
7298 (match_operand:SI 2 "uint5_operand" ""))
7299 (match_operand:SI 3 "arith5_operand" "r,L"))]
7300 ""
7301 "@
7302 {dep|depw} %3,%2+%1-1,%1,%0
7303 {depi|depwi} %3,%2+%1-1,%1,%0"
7304 [(set_attr "type" "shift,shift")
7305 (set_attr "length" "4,4")])
7306
7307 ;; Optimize insertion of const_int values of type 1...1xxxx.
7308 (define_insn ""
7309 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
7310 (match_operand:SI 1 "uint5_operand" "")
7311 (match_operand:SI 2 "uint5_operand" ""))
7312 (match_operand:SI 3 "const_int_operand" ""))]
7313 "(INTVAL (operands[3]) & 0x10) != 0 &&
7314 (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
7315 "*
7316 {
7317 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
7318 return \"{depi|depwi} %3,%2+%1-1,%1,%0\";
7319 }"
7320 [(set_attr "type" "shift")
7321 (set_attr "length" "4")])
7322
7323 (define_insn "insv_64"
7324 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r,r")
7325 (match_operand:DI 1 "uint32_operand" "")
7326 (match_operand:DI 2 "uint32_operand" ""))
7327 (match_operand:DI 3 "arith32_operand" "r,L"))]
7328 "TARGET_64BIT"
7329 "@
7330 depd %3,%2+%1-1,%1,%0
7331 depdi %3,%2+%1-1,%1,%0"
7332 [(set_attr "type" "shift,shift")
7333 (set_attr "length" "4,4")])
7334
7335 ;; Optimize insertion of const_int values of type 1...1xxxx.
7336 (define_insn ""
7337 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
7338 (match_operand:DI 1 "uint32_operand" "")
7339 (match_operand:DI 2 "uint32_operand" ""))
7340 (match_operand:DI 3 "const_int_operand" ""))]
7341 "(INTVAL (operands[3]) & 0x10) != 0
7342 && TARGET_64BIT
7343 && (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
7344 "*
7345 {
7346 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
7347 return \"depdi %3,%2+%1-1,%1,%0\";
7348 }"
7349 [(set_attr "type" "shift")
7350 (set_attr "length" "4")])
7351
7352 (define_insn ""
7353 [(set (match_operand:DI 0 "register_operand" "=r")
7354 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
7355 (const_int 32)))]
7356 "TARGET_64BIT"
7357 "depd,z %1,31,32,%0"
7358 [(set_attr "type" "shift")
7359 (set_attr "length" "4")])
7360
7361 ;; This insn is used for some loop tests, typically loops reversed when
7362 ;; strength reduction is used. It is actually created when the instruction
7363 ;; combination phase combines the special loop test. Since this insn
7364 ;; is both a jump insn and has an output, it must deal with its own
7365 ;; reloads, hence the `m' constraints. The `!' constraints direct reload
7366 ;; to not choose the register alternatives in the event a reload is needed.
7367 (define_insn "decrement_and_branch_until_zero"
7368 [(set (pc)
7369 (if_then_else
7370 (match_operator 2 "comparison_operator"
7371 [(plus:SI
7372 (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*m")
7373 (match_operand:SI 1 "int5_operand" "L,L,L"))
7374 (const_int 0)])
7375 (label_ref (match_operand 3 "" ""))
7376 (pc)))
7377 (set (match_dup 0)
7378 (plus:SI (match_dup 0) (match_dup 1)))
7379 (clobber (match_scratch:SI 4 "=X,r,r"))]
7380 ""
7381 "* return output_dbra (operands, insn, which_alternative); "
7382 ;; Do not expect to understand this the first time through.
7383 [(set_attr "type" "cbranch,multi,multi")
7384 (set (attr "length")
7385 (if_then_else (eq_attr "alternative" "0")
7386 ;; Loop counter in register case
7387 ;; Short branch has length of 4
7388 ;; Long branch has length of 8
7389 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7390 (const_int 8184))
7391 (const_int 4)
7392 (const_int 8))
7393
7394 ;; Loop counter in FP reg case.
7395 ;; Extra goo to deal with additional reload insns.
7396 (if_then_else (eq_attr "alternative" "1")
7397 (if_then_else (lt (match_dup 3) (pc))
7398 (if_then_else
7399 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
7400 (const_int 8184))
7401 (const_int 24)
7402 (const_int 28))
7403 (if_then_else
7404 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7405 (const_int 8184))
7406 (const_int 24)
7407 (const_int 28)))
7408 ;; Loop counter in memory case.
7409 ;; Extra goo to deal with additional reload insns.
7410 (if_then_else (lt (match_dup 3) (pc))
7411 (if_then_else
7412 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
7413 (const_int 8184))
7414 (const_int 12)
7415 (const_int 16))
7416 (if_then_else
7417 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7418 (const_int 8184))
7419 (const_int 12)
7420 (const_int 16))))))])
7421
7422 (define_insn ""
7423 [(set (pc)
7424 (if_then_else
7425 (match_operator 2 "movb_comparison_operator"
7426 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
7427 (label_ref (match_operand 3 "" ""))
7428 (pc)))
7429 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
7430 (match_dup 1))]
7431 ""
7432 "* return output_movb (operands, insn, which_alternative, 0); "
7433 ;; Do not expect to understand this the first time through.
7434 [(set_attr "type" "cbranch,multi,multi,multi")
7435 (set (attr "length")
7436 (if_then_else (eq_attr "alternative" "0")
7437 ;; Loop counter in register case
7438 ;; Short branch has length of 4
7439 ;; Long branch has length of 8
7440 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7441 (const_int 8184))
7442 (const_int 4)
7443 (const_int 8))
7444
7445 ;; Loop counter in FP reg case.
7446 ;; Extra goo to deal with additional reload insns.
7447 (if_then_else (eq_attr "alternative" "1")
7448 (if_then_else (lt (match_dup 3) (pc))
7449 (if_then_else
7450 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
7451 (const_int 8184))
7452 (const_int 12)
7453 (const_int 16))
7454 (if_then_else
7455 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7456 (const_int 8184))
7457 (const_int 12)
7458 (const_int 16)))
7459 ;; Loop counter in memory or sar case.
7460 ;; Extra goo to deal with additional reload insns.
7461 (if_then_else
7462 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7463 (const_int 8184))
7464 (const_int 8)
7465 (const_int 12)))))])
7466
7467 ;; Handle negated branch.
7468 (define_insn ""
7469 [(set (pc)
7470 (if_then_else
7471 (match_operator 2 "movb_comparison_operator"
7472 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
7473 (pc)
7474 (label_ref (match_operand 3 "" ""))))
7475 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
7476 (match_dup 1))]
7477 ""
7478 "* return output_movb (operands, insn, which_alternative, 1); "
7479 ;; Do not expect to understand this the first time through.
7480 [(set_attr "type" "cbranch,multi,multi,multi")
7481 (set (attr "length")
7482 (if_then_else (eq_attr "alternative" "0")
7483 ;; Loop counter in register case
7484 ;; Short branch has length of 4
7485 ;; Long branch has length of 8
7486 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7487 (const_int 8184))
7488 (const_int 4)
7489 (const_int 8))
7490
7491 ;; Loop counter in FP reg case.
7492 ;; Extra goo to deal with additional reload insns.
7493 (if_then_else (eq_attr "alternative" "1")
7494 (if_then_else (lt (match_dup 3) (pc))
7495 (if_then_else
7496 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
7497 (const_int 8184))
7498 (const_int 12)
7499 (const_int 16))
7500 (if_then_else
7501 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7502 (const_int 8184))
7503 (const_int 12)
7504 (const_int 16)))
7505 ;; Loop counter in memory or SAR case.
7506 ;; Extra goo to deal with additional reload insns.
7507 (if_then_else
7508 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7509 (const_int 8184))
7510 (const_int 8)
7511 (const_int 12)))))])
7512
7513 (define_insn ""
7514 [(set (pc) (label_ref (match_operand 3 "" "" )))
7515 (set (match_operand:SI 0 "ireg_operand" "=r")
7516 (plus:SI (match_operand:SI 1 "ireg_operand" "r")
7517 (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
7518 "(reload_completed && operands[0] == operands[1]) || operands[0] == operands[2]"
7519 "*
7520 {
7521 return output_parallel_addb (operands, get_attr_length (insn));
7522 }"
7523 [(set_attr "type" "parallel_branch")
7524 (set (attr "length")
7525 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
7526 (const_int 8184))
7527 (const_int 4)
7528 (const_int 8)))])
7529
7530 (define_insn ""
7531 [(set (pc) (label_ref (match_operand 2 "" "" )))
7532 (set (match_operand:SF 0 "ireg_operand" "=r")
7533 (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
7534 "reload_completed"
7535 "*
7536 {
7537 return output_parallel_movb (operands, get_attr_length (insn));
7538 }"
7539 [(set_attr "type" "parallel_branch")
7540 (set (attr "length")
7541 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
7542 (const_int 8184))
7543 (const_int 4)
7544 (const_int 8)))])
7545
7546 (define_insn ""
7547 [(set (pc) (label_ref (match_operand 2 "" "" )))
7548 (set (match_operand:SI 0 "ireg_operand" "=r")
7549 (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
7550 "reload_completed"
7551 "*
7552 {
7553 return output_parallel_movb (operands, get_attr_length (insn));
7554 }"
7555 [(set_attr "type" "parallel_branch")
7556 (set (attr "length")
7557 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
7558 (const_int 8184))
7559 (const_int 4)
7560 (const_int 8)))])
7561
7562 (define_insn ""
7563 [(set (pc) (label_ref (match_operand 2 "" "" )))
7564 (set (match_operand:HI 0 "ireg_operand" "=r")
7565 (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
7566 "reload_completed"
7567 "*
7568 {
7569 return output_parallel_movb (operands, get_attr_length (insn));
7570 }"
7571 [(set_attr "type" "parallel_branch")
7572 (set (attr "length")
7573 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
7574 (const_int 8184))
7575 (const_int 4)
7576 (const_int 8)))])
7577
7578 (define_insn ""
7579 [(set (pc) (label_ref (match_operand 2 "" "" )))
7580 (set (match_operand:QI 0 "ireg_operand" "=r")
7581 (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
7582 "reload_completed"
7583 "*
7584 {
7585 return output_parallel_movb (operands, get_attr_length (insn));
7586 }"
7587 [(set_attr "type" "parallel_branch")
7588 (set (attr "length")
7589 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
7590 (const_int 8184))
7591 (const_int 4)
7592 (const_int 8)))])
7593
7594 (define_insn ""
7595 [(set (match_operand 0 "register_operand" "=f")
7596 (mult (match_operand 1 "register_operand" "f")
7597 (match_operand 2 "register_operand" "f")))
7598 (set (match_operand 3 "register_operand" "+f")
7599 (plus (match_operand 4 "register_operand" "f")
7600 (match_operand 5 "register_operand" "f")))]
7601 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7602 && reload_completed && fmpyaddoperands (operands)"
7603 "*
7604 {
7605 if (GET_MODE (operands[0]) == DFmode)
7606 {
7607 if (rtx_equal_p (operands[3], operands[5]))
7608 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
7609 else
7610 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
7611 }
7612 else
7613 {
7614 if (rtx_equal_p (operands[3], operands[5]))
7615 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
7616 else
7617 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
7618 }
7619 }"
7620 [(set_attr "type" "fpalu")
7621 (set_attr "length" "4")])
7622
7623 (define_insn ""
7624 [(set (match_operand 3 "register_operand" "+f")
7625 (plus (match_operand 4 "register_operand" "f")
7626 (match_operand 5 "register_operand" "f")))
7627 (set (match_operand 0 "register_operand" "=f")
7628 (mult (match_operand 1 "register_operand" "f")
7629 (match_operand 2 "register_operand" "f")))]
7630 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7631 && reload_completed && fmpyaddoperands (operands)"
7632 "*
7633 {
7634 if (GET_MODE (operands[0]) == DFmode)
7635 {
7636 if (rtx_equal_p (operands[3], operands[5]))
7637 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
7638 else
7639 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
7640 }
7641 else
7642 {
7643 if (rtx_equal_p (operands[3], operands[5]))
7644 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
7645 else
7646 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
7647 }
7648 }"
7649 [(set_attr "type" "fpalu")
7650 (set_attr "length" "4")])
7651
7652 (define_insn ""
7653 [(set (match_operand 0 "register_operand" "=f")
7654 (mult (match_operand 1 "register_operand" "f")
7655 (match_operand 2 "register_operand" "f")))
7656 (set (match_operand 3 "register_operand" "+f")
7657 (minus (match_operand 4 "register_operand" "f")
7658 (match_operand 5 "register_operand" "f")))]
7659 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7660 && reload_completed && fmpysuboperands (operands)"
7661 "*
7662 {
7663 if (GET_MODE (operands[0]) == DFmode)
7664 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
7665 else
7666 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
7667 }"
7668 [(set_attr "type" "fpalu")
7669 (set_attr "length" "4")])
7670
7671 (define_insn ""
7672 [(set (match_operand 3 "register_operand" "+f")
7673 (minus (match_operand 4 "register_operand" "f")
7674 (match_operand 5 "register_operand" "f")))
7675 (set (match_operand 0 "register_operand" "=f")
7676 (mult (match_operand 1 "register_operand" "f")
7677 (match_operand 2 "register_operand" "f")))]
7678 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7679 && reload_completed && fmpysuboperands (operands)"
7680 "*
7681 {
7682 if (GET_MODE (operands[0]) == DFmode)
7683 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
7684 else
7685 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
7686 }"
7687 [(set_attr "type" "fpalu")
7688 (set_attr "length" "4")])
7689
7690 ;; Clean up turds left by reload.
7691 (define_peephole
7692 [(set (match_operand 0 "reg_or_nonsymb_mem_operand" "")
7693 (match_operand 1 "register_operand" "fr"))
7694 (set (match_operand 2 "register_operand" "fr")
7695 (match_dup 0))]
7696 "! TARGET_SOFT_FLOAT
7697 && GET_CODE (operands[0]) == MEM
7698 && ! MEM_VOLATILE_P (operands[0])
7699 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7700 && GET_MODE (operands[0]) == GET_MODE (operands[2])
7701 && GET_MODE (operands[0]) == DFmode
7702 && GET_CODE (operands[1]) == REG
7703 && GET_CODE (operands[2]) == REG
7704 && ! side_effects_p (XEXP (operands[0], 0))
7705 && REGNO_REG_CLASS (REGNO (operands[1]))
7706 == REGNO_REG_CLASS (REGNO (operands[2]))"
7707 "*
7708 {
7709 rtx xoperands[2];
7710
7711 if (FP_REG_P (operands[1]))
7712 output_asm_insn (output_fp_move_double (operands), operands);
7713 else
7714 output_asm_insn (output_move_double (operands), operands);
7715
7716 if (rtx_equal_p (operands[1], operands[2]))
7717 return \"\";
7718
7719 xoperands[0] = operands[2];
7720 xoperands[1] = operands[1];
7721
7722 if (FP_REG_P (xoperands[1]))
7723 output_asm_insn (output_fp_move_double (xoperands), xoperands);
7724 else
7725 output_asm_insn (output_move_double (xoperands), xoperands);
7726
7727 return \"\";
7728 }")
7729
7730 (define_peephole
7731 [(set (match_operand 0 "register_operand" "fr")
7732 (match_operand 1 "reg_or_nonsymb_mem_operand" ""))
7733 (set (match_operand 2 "register_operand" "fr")
7734 (match_dup 1))]
7735 "! TARGET_SOFT_FLOAT
7736 && GET_CODE (operands[1]) == MEM
7737 && ! MEM_VOLATILE_P (operands[1])
7738 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7739 && GET_MODE (operands[0]) == GET_MODE (operands[2])
7740 && GET_MODE (operands[0]) == DFmode
7741 && GET_CODE (operands[0]) == REG
7742 && GET_CODE (operands[2]) == REG
7743 && ! side_effects_p (XEXP (operands[1], 0))
7744 && REGNO_REG_CLASS (REGNO (operands[0]))
7745 == REGNO_REG_CLASS (REGNO (operands[2]))"
7746 "*
7747 {
7748 rtx xoperands[2];
7749
7750 if (FP_REG_P (operands[0]))
7751 output_asm_insn (output_fp_move_double (operands), operands);
7752 else
7753 output_asm_insn (output_move_double (operands), operands);
7754
7755 xoperands[0] = operands[2];
7756 xoperands[1] = operands[0];
7757
7758 if (FP_REG_P (xoperands[1]))
7759 output_asm_insn (output_fp_move_double (xoperands), xoperands);
7760 else
7761 output_asm_insn (output_move_double (xoperands), xoperands);
7762
7763 return \"\";
7764 }")
7765
7766 ;; Flush the I and D cache line found at the address in operand 0.
7767 ;; This is used by the trampoline code for nested functions.
7768 ;; So long as the trampoline itself is less than 32 bytes this
7769 ;; is sufficient.
7770
7771 (define_insn "dcacheflush"
7772 [(unspec_volatile [(const_int 1)] 0)
7773 (use (mem:SI (match_operand 0 "pmode_register_operand" "r")))
7774 (use (mem:SI (match_operand 1 "pmode_register_operand" "r")))]
7775 ""
7776 "fdc 0(%0)\;fdc 0(%1)\;sync"
7777 [(set_attr "type" "multi")
7778 (set_attr "length" "12")])
7779
7780 (define_insn "icacheflush"
7781 [(unspec_volatile [(const_int 2)] 0)
7782 (use (mem:SI (match_operand 0 "pmode_register_operand" "r")))
7783 (use (mem:SI (match_operand 1 "pmode_register_operand" "r")))
7784 (use (match_operand 2 "pmode_register_operand" "r"))
7785 (clobber (match_operand 3 "pmode_register_operand" "=&r"))
7786 (clobber (match_operand 4 "pmode_register_operand" "=&r"))]
7787 ""
7788 "mfsp %%sr0,%4\;ldsid (%2),%3\;mtsp %3,%%sr0\;fic 0(%%sr0,%0)\;fic 0(%%sr0,%1)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop"
7789 [(set_attr "type" "multi")
7790 (set_attr "length" "52")])
7791
7792 ;; An out-of-line prologue.
7793 (define_insn "outline_prologue_call"
7794 [(unspec_volatile [(const_int 0)] 0)
7795 (clobber (reg:SI 31))
7796 (clobber (reg:SI 22))
7797 (clobber (reg:SI 21))
7798 (clobber (reg:SI 20))
7799 (clobber (reg:SI 19))
7800 (clobber (reg:SI 1))]
7801 ""
7802 "*
7803 {
7804 extern int frame_pointer_needed;
7805
7806 /* We need two different versions depending on whether or not we
7807 need a frame pointer. Also note that we return to the instruction
7808 immediately after the branch rather than two instructions after the
7809 break as normally is the case. */
7810 if (frame_pointer_needed)
7811 {
7812 /* Must import the magic millicode routine(s). */
7813 output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
7814
7815 if (TARGET_PORTABLE_RUNTIME)
7816 {
7817 output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
7818 output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
7819 NULL);
7820 }
7821 else
7822 output_asm_insn (\"{bl|b,l},n __outline_prologue_fp,%%r31\", NULL);
7823 }
7824 else
7825 {
7826 /* Must import the magic millicode routine(s). */
7827 output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
7828
7829 if (TARGET_PORTABLE_RUNTIME)
7830 {
7831 output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
7832 output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
7833 }
7834 else
7835 output_asm_insn (\"{bl|b,l},n __outline_prologue,%%r31\", NULL);
7836 }
7837 return \"\";
7838 }"
7839 [(set_attr "type" "multi")
7840 (set_attr "length" "8")])
7841
7842 ;; An out-of-line epilogue.
7843 (define_insn "outline_epilogue_call"
7844 [(unspec_volatile [(const_int 1)] 0)
7845 (use (reg:SI 29))
7846 (use (reg:SI 28))
7847 (clobber (reg:SI 31))
7848 (clobber (reg:SI 22))
7849 (clobber (reg:SI 21))
7850 (clobber (reg:SI 20))
7851 (clobber (reg:SI 19))
7852 (clobber (reg:SI 2))
7853 (clobber (reg:SI 1))]
7854 ""
7855 "*
7856 {
7857 extern int frame_pointer_needed;
7858
7859 /* We need two different versions depending on whether or not we
7860 need a frame pointer. Also note that we return to the instruction
7861 immediately after the branch rather than two instructions after the
7862 break as normally is the case. */
7863 if (frame_pointer_needed)
7864 {
7865 /* Must import the magic millicode routine. */
7866 output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
7867
7868 /* The out-of-line prologue will make sure we return to the right
7869 instruction. */
7870 if (TARGET_PORTABLE_RUNTIME)
7871 {
7872 output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
7873 output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
7874 NULL);
7875 }
7876 else
7877 output_asm_insn (\"{bl|b,l},n __outline_epilogue_fp,%%r31\", NULL);
7878 }
7879 else
7880 {
7881 /* Must import the magic millicode routine. */
7882 output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
7883
7884 /* The out-of-line prologue will make sure we return to the right
7885 instruction. */
7886 if (TARGET_PORTABLE_RUNTIME)
7887 {
7888 output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
7889 output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
7890 }
7891 else
7892 output_asm_insn (\"{bl|b,l},n __outline_epilogue,%%r31\", NULL);
7893 }
7894 return \"\";
7895 }"
7896 [(set_attr "type" "multi")
7897 (set_attr "length" "8")])
7898
7899 ;; Given a function pointer, canonicalize it so it can be
7900 ;; reliably compared to another function pointer. */
7901 (define_expand "canonicalize_funcptr_for_compare"
7902 [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
7903 (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] 0))
7904 (clobber (match_dup 2))
7905 (clobber (reg:SI 26))
7906 (clobber (reg:SI 22))
7907 (clobber (reg:SI 31))])
7908 (set (match_operand:SI 0 "register_operand" "")
7909 (reg:SI 29))]
7910 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7911 "
7912 {
7913 if (TARGET_ELF32)
7914 {
7915 rtx canonicalize_funcptr_for_compare_libfunc
7916 = init_one_libfunc (CANONICALIZE_FUNCPTR_FOR_COMPARE_LIBCALL);
7917
7918 emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
7919 operands[0], LCT_NORMAL, Pmode,
7920 1, operands[1], Pmode);
7921 DONE;
7922 }
7923
7924 operands[2] = gen_reg_rtx (SImode);
7925 if (GET_CODE (operands[1]) != REG)
7926 {
7927 rtx tmp = gen_reg_rtx (Pmode);
7928 emit_move_insn (tmp, operands[1]);
7929 operands[1] = tmp;
7930 }
7931 }")
7932
7933 (define_insn ""
7934 [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] 0))
7935 (clobber (match_operand:SI 0 "register_operand" "=a"))
7936 (clobber (reg:SI 26))
7937 (clobber (reg:SI 22))
7938 (clobber (reg:SI 31))]
7939 "!TARGET_64BIT"
7940 "*
7941 {
7942 int length = get_attr_length (insn);
7943 rtx xoperands[2];
7944
7945 xoperands[0] = GEN_INT (length - 8);
7946 xoperands[1] = GEN_INT (length - 16);
7947
7948 /* Must import the magic millicode routine. */
7949 output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
7950
7951 /* This is absolutely amazing.
7952
7953 First, copy our input parameter into %r29 just in case we don't
7954 need to call $$sh_func_adrs. */
7955 output_asm_insn (\"copy %%r26,%%r29\", NULL);
7956 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\", NULL);
7957
7958 /* Next, examine the low two bits in %r26, if they aren't 0x2, then
7959 we use %r26 unchanged. */
7960 output_asm_insn (\"{comib|cmpib},<>,n 2,%%r31,.+%0\", xoperands);
7961 output_asm_insn (\"ldi 4096,%%r31\", NULL);
7962
7963 /* Next, compare %r26 with 4096, if %r26 is less than or equal to
7964 4096, then again we use %r26 unchanged. */
7965 output_asm_insn (\"{comb|cmpb},<<,n %%r26,%%r31,.+%1\", xoperands);
7966
7967 /* Finally, call $$sh_func_adrs to extract the function's real add24. */
7968 return output_millicode_call (insn,
7969 gen_rtx_SYMBOL_REF (SImode,
7970 \"$$sh_func_adrs\"));
7971 }"
7972 [(set_attr "type" "multi")
7973 (set (attr "length")
7974 (plus (symbol_ref "attr_length_millicode_call (insn)")
7975 (const_int 20)))])
7976
7977 ;; On the PA, the PIC register is call clobbered, so it must
7978 ;; be saved & restored around calls by the caller. If the call
7979 ;; doesn't return normally (nonlocal goto, or an exception is
7980 ;; thrown), then the code at the exception handler label must
7981 ;; restore the PIC register.
7982 (define_expand "exception_receiver"
7983 [(const_int 4)]
7984 "flag_pic"
7985 "
7986 {
7987 /* On the 64-bit port, we need a blockage because there is
7988 confusion regarding the dependence of the restore on the
7989 frame pointer. As a result, the frame pointer and pic
7990 register restores sometimes are interchanged erroneously. */
7991 if (TARGET_64BIT)
7992 emit_insn (gen_blockage ());
7993 /* Restore the PIC register using hppa_pic_save_rtx (). The
7994 PIC register is not saved in the frame in 64-bit ABI. */
7995 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
7996 emit_insn (gen_blockage ());
7997 DONE;
7998 }")
7999
8000 (define_expand "builtin_setjmp_receiver"
8001 [(label_ref (match_operand 0 "" ""))]
8002 "flag_pic"
8003 "
8004 {
8005 if (TARGET_64BIT)
8006 emit_insn (gen_blockage ());
8007 /* Restore the PIC register. Hopefully, this will always be from
8008 a stack slot. The only registers that are valid after a
8009 builtin_longjmp are the stack and frame pointers. */
8010 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
8011 emit_insn (gen_blockage ());
8012 DONE;
8013 }")
8014
8015 ;; Allocate new stack space and update the saved stack pointer in the
8016 ;; frame marker. The HP C compilers also copy additional words in the
8017 ;; frame marker. The 64-bit compiler copies words at -48, -32 and -24.
8018 ;; The 32-bit compiler copies the word at -16 (Static Link). We
8019 ;; currently don't copy these values.
8020 ;;
8021 ;; Since the copy of the frame marker can't be done atomically, I
8022 ;; suspect that using it for unwind purposes may be somewhat unreliable.
8023 ;; The HP compilers appear to raise the stack and copy the frame
8024 ;; marker in a strict instruction sequence. This suggests that the
8025 ;; unwind library may check for an alloca sequence when ALLOCA_FRAME
8026 ;; is set in the callinfo data. We currently don't set ALLOCA_FRAME
8027 ;; as GAS doesn't support it, or try to keep the instructions emitted
8028 ;; here in strict sequence.
8029 (define_expand "allocate_stack"
8030 [(match_operand 0 "" "")
8031 (match_operand 1 "" "")]
8032 ""
8033 "
8034 {
8035 /* Since the stack grows upward, we need to store virtual_stack_dynamic_rtx
8036 in operand 0 before adjusting the stack. */
8037 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
8038 anti_adjust_stack (operands[1]);
8039 if (TARGET_HPUX_UNWIND_LIBRARY)
8040 {
8041 rtx dst = gen_rtx_MEM (word_mode,
8042 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8043 GEN_INT (TARGET_64BIT ? -8 : -4)));
8044
8045 emit_move_insn (dst, frame_pointer_rtx);
8046 }
8047 DONE;
8048 }")