* config/pa/pa.md (add-with-constant splitter): Use ASHIFT rather
[official-gcc.git] / gcc / config / pa / pa.md
blobaaec27d985e773497dcba6ab4e55956fd552e477
1 ;;- Machine description for HP PA-RISC architecture for GCC compiler
2 ;;   Copyright (C) 1992-2015 Free Software Foundation, Inc.
3 ;;   Contributed by the Center for Software Science at the University
4 ;;   of Utah.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; any later version.
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3.  If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;; This machine description is inspired by sparc.md and to a lesser
23 ;; extent mips.md.
25 ;; Possible improvements:
27 ;; * With PA1.1, most computational instructions can conditionally nullify
28 ;;   the execution of the following instruction.  A nullified instruction
29 ;;   does not cause the instruction pipeline to stall, making it a very
30 ;;   efficient alternative to e.g. branching or conditional moves.
32 ;;   Nullification is performed conditionally based on the outcome of a
33 ;;   test specified in the opcode.  The test result is stored in PSW[N]
34 ;;   and can only be used to nullify the instruction following immediately
35 ;;   after the test.  For example:
37 ;;      ldi 10,%r26
38 ;;      ldi 5,%r25
39 ;;      sub,< %r26,%r25,%r28
40 ;;      sub   %r28,%r25,%r28    ; %r28 == 0
41 ;;      sub,> %r26,%r25,%r29
42 ;;      sub   %r29,%r25,%r29    ; %r29 == 5
44 ;;   This could be tricky to implement because the result of the test has
45 ;;   to be propagated one instruction forward, which, in the worst case,
46 ;;   would involve (1) adding a fake register for PSW[N]; (2) adding the
47 ;;   variants of the computational instructions that set or consume this
48 ;;   fake register.  The cond_exec infrastructure is probably not helpful
49 ;;   for this.
51 ;; * PA-RISC includes a set of conventions for branch instruction usage
52 ;;   to indicate whether a particular branch is more likely to be taken
53 ;;   or not taken.  For example, the prediction for CMPB instructions
54 ;;   (CMPB,cond,n r1,r2,target) depends on the direction of the branch
55 ;;   (forward or backward) and on the order of the operands:
57 ;;     | branch    | operand  | branch     |
58 ;;     | direction | compare  | prediction |
59 ;;     +-----------+----------+------------+
60 ;;     | backward  | r1 < r2  | taken      |
61 ;;     | backward  | r1 >= r2 | not taken  |
62 ;;     | forward   | r1 < r2  | not taken  |
63 ;;     | forward   | r1 >= r2 | taken      |
64 ;;    
65 ;;   By choosing instructions and operand order carefully, the compiler
66 ;;   could give the CPU branch predictor some help.
67 ;;   
69 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
71 ;; Uses of UNSPEC in this file:
73 (define_c_enum "unspec"
74   [UNSPEC_CFFC          ; canonicalize_funcptr_for_compare
75    UNSPEC_GOTO          ; indirect_goto
76    UNSPEC_DLTIND14R
77    UNSPEC_TP
78    UNSPEC_TLSGD
79    UNSPEC_TLSLDM
80    UNSPEC_TLSLDO
81    UNSPEC_TLSLDBASE
82    UNSPEC_TLSIE
83    UNSPEC_TLSLE 
84    UNSPEC_TLSGD_PIC
85    UNSPEC_TLSLDM_PIC
86    UNSPEC_TLSIE_PIC
87   ])
89 ;; UNSPEC_VOLATILE:
91 (define_c_enum "unspecv"
92   [UNSPECV_BLOCKAGE     ; blockage
93    UNSPECV_DCACHE       ; dcacheflush
94    UNSPECV_ICACHE       ; icacheflush
95    UNSPECV_OPC          ; outline_prologue_call
96    UNSPECV_OEC          ; outline_epilogue_call
97    UNSPECV_LONGJMP      ; builtin_longjmp
98   ])
100 ;; Maximum pc-relative branch offsets.
102 ;; These numbers are a bit smaller than the maximum allowable offsets
103 ;; so that a few instructions may be inserted before the actual branch.
105 (define_constants
106   [(MAX_12BIT_OFFSET     8184)  ; 12-bit branch
107    (MAX_17BIT_OFFSET   262100)  ; 17-bit branch
108   ])
110 ;; Mode and code iterators
112 ;; This mode iterator allows :P to be used for patterns that operate on
113 ;; pointer-sized quantities.  Exactly one of the two alternatives will match.
114 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
116 ;; This attribute defines the condition prefix for word and double word
117 ;; add, compare, subtract and logical instructions.
118 (define_mode_attr dwc [(SI "") (DI "*")])
120 ;; Insn type.  Used to default other attribute values.
122 ;; type "unary" insns have one input operand (1) and one output operand (0)
123 ;; type "binary" insns have two input operands (1,2) and one output (0)
125 (define_attr "type"
126   "move,unary,binary,shift,nullshift,compare,load,store,uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,fpload,fpstore,fpalu,fpcc,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,multi,milli,sh_func_adrs,parallel_branch,fpstore_load,store_fpload,trap"
127   (const_string "binary"))
129 (define_attr "pa_combine_type"
130   "fmpy,faddsub,uncond_branch,addmove,none"
131   (const_string "none"))
133 ;; Processor type (for scheduling, not code generation) -- this attribute
134 ;; must exactly match the processor_type enumeration in pa.h.
136 ;; FIXME: Add 800 scheduling for completeness?
138 (define_attr "cpu" "700,7100,7100LC,7200,7300,8000" (const (symbol_ref "pa_cpu_attr")))
140 ;; Length (in # of bytes).
141 (define_attr "length" ""
142   (cond [(eq_attr "type" "load,fpload")
143          (if_then_else (match_operand 1 "symbolic_memory_operand" "")
144                        (const_int 8) (const_int 4))
146          (eq_attr "type" "store,fpstore")
147          (if_then_else (match_operand 0 "symbolic_memory_operand" "")
148                        (const_int 8) (const_int 4))
150          (eq_attr "type" "binary,shift,nullshift")
151          (if_then_else (match_operand 2 "arith14_operand" "")
152                        (const_int 4) (const_int 12))
154          (eq_attr "type" "move,unary,shift,nullshift")
155          (if_then_else (match_operand 1 "arith14_operand" "")
156                        (const_int 4) (const_int 8))]
158         (const_int 4)))
160 (define_asm_attributes
161   [(set_attr "length" "4")
162    (set_attr "type" "multi")])
164 ;; Attributes for instruction and branch scheduling
166 ;; For conditional branches. Frame related instructions are not allowed
167 ;; because they confuse the unwind support.
168 (define_attr "in_branch_delay" "false,true"
169   (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch,trap")
170                      (eq_attr "length" "4")
171                      (not (match_test "RTX_FRAME_RELATED_P (insn)")))
172                 (const_string "true")
173                 (const_string "false")))
175 ;; Disallow instructions which use the FPU since they will tie up the FPU
176 ;; even if the instruction is nullified.
177 (define_attr "in_nullified_branch_delay" "false,true"
178   (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch,trap")
179                      (eq_attr "length" "4")
180                      (not (match_test "RTX_FRAME_RELATED_P (insn)")))
181                 (const_string "true")
182                 (const_string "false")))
184 ;; For calls and millicode calls.
185 (define_attr "in_call_delay" "false,true"
186   (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch,trap")
187                      (eq_attr "length" "4")
188                      (not (match_test "RTX_FRAME_RELATED_P (insn)")))
189                 (const_string "true")
190                 (const_string "false")))
192 ;; Call delay slot description.
193 (define_delay (eq_attr "type" "call")
194   [(eq_attr "in_call_delay" "true") (nil) (nil)])
196 ;; Sibcall delay slot description.
197 (define_delay (eq_attr "type" "sibcall")
198   [(eq_attr "in_call_delay" "true") (nil) (nil)])
200 ;; Millicode call delay slot description.
201 (define_delay (eq_attr "type" "milli")
202   [(eq_attr "in_call_delay" "true") (nil) (nil)])
204 ;; Return and other similar instructions.
205 (define_delay (eq_attr "type" "branch,parallel_branch")
206   [(eq_attr "in_branch_delay" "true") (nil) (nil)])
208 ;; Floating point conditional branch delay slot description.
209 (define_delay (eq_attr "type" "fbranch")
210   [(eq_attr "in_branch_delay" "true")
211    (eq_attr "in_nullified_branch_delay" "true")
212    (nil)])
214 ;; Integer conditional branch delay slot description.
215 ;; Nullification of conditional branches on the PA is dependent on the
216 ;; direction of the branch.  Forward branches nullify true and
217 ;; backward branches nullify false.  If the direction is unknown
218 ;; then nullification is not allowed.
219 (define_delay (eq_attr "type" "cbranch")
220   [(eq_attr "in_branch_delay" "true")
221    (and (eq_attr "in_nullified_branch_delay" "true")
222         (attr_flag "forward"))
223    (and (eq_attr "in_nullified_branch_delay" "true")
224         (attr_flag "backward"))])
226 (define_delay (eq_attr "type" "uncond_branch")
227   [(eq_attr "in_branch_delay" "true") (nil) (nil)])
229 ;; Memory. Disregarding Cache misses, the Mustang memory times are:
230 ;; load: 2, fpload: 3
231 ;; store, fpstore: 3, no D-cache operations should be scheduled.
233 ;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
234 ;; Timings:
235 ;; Instruction  Time    Unit    Minimum Distance (unit contention)
236 ;; fcpy         3       ALU     2
237 ;; fabs         3       ALU     2
238 ;; fadd         3       ALU     2
239 ;; fsub         3       ALU     2
240 ;; fcmp         3       ALU     2
241 ;; fcnv         3       ALU     2
242 ;; fmpyadd      3       ALU,MPY 2
243 ;; fmpysub      3       ALU,MPY 2
244 ;; fmpycfxt     3       ALU,MPY 2
245 ;; fmpy         3       MPY     2
246 ;; fmpyi        3       MPY     2
247 ;; fdiv,sgl     10      MPY     10
248 ;; fdiv,dbl     12      MPY     12
249 ;; fsqrt,sgl    14      MPY     14
250 ;; fsqrt,dbl    18      MPY     18
252 ;; We don't model fmpyadd/fmpysub properly as those instructions
253 ;; keep both the FP ALU and MPY units busy.  Given that these
254 ;; processors are obsolete, I'm not going to spend the time to
255 ;; model those instructions correctly.
257 (define_automaton "pa700")
258 (define_cpu_unit "dummy_700,mem_700,fpalu_700,fpmpy_700" "pa700")
260 (define_insn_reservation "W0" 4
261   (and (eq_attr "type" "fpcc")
262        (eq_attr "cpu" "700"))
263   "fpalu_700*2")
265 (define_insn_reservation "W1" 3
266   (and (eq_attr "type" "fpalu")
267        (eq_attr "cpu" "700"))
268   "fpalu_700*2")
270 (define_insn_reservation "W2" 3
271   (and (eq_attr "type" "fpmulsgl,fpmuldbl")
272        (eq_attr "cpu" "700"))
273   "fpmpy_700*2")
275 (define_insn_reservation "W3" 10
276   (and (eq_attr "type" "fpdivsgl")
277        (eq_attr "cpu" "700"))
278   "fpmpy_700*10")
280 (define_insn_reservation "W4" 12
281   (and (eq_attr "type" "fpdivdbl")
282        (eq_attr "cpu" "700"))
283   "fpmpy_700*12")
285 (define_insn_reservation "W5" 14
286   (and (eq_attr "type" "fpsqrtsgl")
287        (eq_attr "cpu" "700"))
288   "fpmpy_700*14")
290 (define_insn_reservation "W6" 18
291   (and (eq_attr "type" "fpsqrtdbl")
292        (eq_attr "cpu" "700"))
293   "fpmpy_700*18")
295 (define_insn_reservation "W7" 2
296   (and (eq_attr "type" "load")
297        (eq_attr "cpu" "700"))
298   "mem_700")
300 (define_insn_reservation "W8" 2
301   (and (eq_attr "type" "fpload")
302        (eq_attr "cpu" "700"))
303   "mem_700")
305 (define_insn_reservation "W9" 3
306   (and (eq_attr "type" "store")
307        (eq_attr "cpu" "700"))
308   "mem_700*3")
310 (define_insn_reservation "W10" 3
311   (and (eq_attr "type" "fpstore")
312        (eq_attr "cpu" "700"))
313   "mem_700*3")
315 (define_insn_reservation "W11" 5
316   (and (eq_attr "type" "fpstore_load")
317        (eq_attr "cpu" "700"))
318   "mem_700*5")
320 (define_insn_reservation "W12" 6
321   (and (eq_attr "type" "store_fpload")
322        (eq_attr "cpu" "700"))
323   "mem_700*6")
325 (define_insn_reservation "W13" 1
326   (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,load,fpload,store,fpstore,fpstore_load,store_fpload")
327        (eq_attr "cpu" "700"))
328   "dummy_700")
330 ;; We have a bypass for all computations in the FP unit which feed an
331 ;; FP store as long as the sizes are the same.
332 (define_bypass 2 "W1,W2" "W10,W11" "pa_fpstore_bypass_p")
333 (define_bypass 9 "W3" "W10,W11" "pa_fpstore_bypass_p")
334 (define_bypass 11 "W4" "W10,W11" "pa_fpstore_bypass_p")
335 (define_bypass 13 "W5" "W10,W11" "pa_fpstore_bypass_p")
336 (define_bypass 17 "W6" "W10,W11" "pa_fpstore_bypass_p")
338 ;; We have an "anti-bypass" for FP loads which feed an FP store.
339 (define_bypass 4 "W8,W12" "W10,W11" "pa_fpstore_bypass_p")
341 ;; Function units for the 7100 and 7150.  The 7100/7150 can dual-issue
342 ;; floating point computations with non-floating point computations (fp loads
343 ;; and stores are not fp computations).
345 ;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
346 ;; take two cycles, during which no Dcache operations should be scheduled.
347 ;; Any special cases are handled in pa_adjust_cost.  The 7100, 7150 and 7100LC
348 ;; all have the same memory characteristics if one disregards cache misses.
350 ;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
351 ;; There's no value in modeling the ALU and MUL separately though
352 ;; since there can never be a functional unit conflict given the
353 ;; latency and issue rates for those units.
355 ;; Timings:
356 ;; Instruction  Time    Unit    Minimum Distance (unit contention)
357 ;; fcpy         2       ALU     1
358 ;; fabs         2       ALU     1
359 ;; fadd         2       ALU     1
360 ;; fsub         2       ALU     1
361 ;; fcmp         2       ALU     1
362 ;; fcnv         2       ALU     1
363 ;; fmpyadd      2       ALU,MPY 1
364 ;; fmpysub      2       ALU,MPY 1
365 ;; fmpycfxt     2       ALU,MPY 1
366 ;; fmpy         2       MPY     1
367 ;; fmpyi        2       MPY     1
368 ;; fdiv,sgl     8       DIV     8
369 ;; fdiv,dbl     15      DIV     15
370 ;; fsqrt,sgl    8       DIV     8
371 ;; fsqrt,dbl    15      DIV     15
373 (define_automaton "pa7100")
374 (define_cpu_unit "i_7100, f_7100,fpmac_7100,fpdivsqrt_7100,mem_7100" "pa7100")
376 (define_insn_reservation "X0" 2
377   (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
378        (eq_attr "cpu" "7100"))
379   "f_7100,fpmac_7100")
381 (define_insn_reservation "X1" 8
382   (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
383        (eq_attr "cpu" "7100"))
384   "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*7")
386 (define_insn_reservation "X2" 15
387   (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
388        (eq_attr "cpu" "7100"))
389   "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*14")
391 (define_insn_reservation "X3" 2
392   (and (eq_attr "type" "load")
393        (eq_attr "cpu" "7100"))
394   "i_7100+mem_7100")
396 (define_insn_reservation "X4" 2
397   (and (eq_attr "type" "fpload")
398        (eq_attr "cpu" "7100"))
399   "i_7100+mem_7100")
401 (define_insn_reservation "X5" 2
402   (and (eq_attr "type" "store")
403        (eq_attr "cpu" "7100"))
404   "i_7100+mem_7100,mem_7100")
406 (define_insn_reservation "X6" 2
407   (and (eq_attr "type" "fpstore")
408        (eq_attr "cpu" "7100"))
409   "i_7100+mem_7100,mem_7100")
411 (define_insn_reservation "X7" 4
412   (and (eq_attr "type" "fpstore_load")
413        (eq_attr "cpu" "7100"))
414   "i_7100+mem_7100,mem_7100*3")
416 (define_insn_reservation "X8" 4
417   (and (eq_attr "type" "store_fpload")
418        (eq_attr "cpu" "7100"))
419   "i_7100+mem_7100,mem_7100*3")
421 (define_insn_reservation "X9" 1
422   (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,fpstore_load,store_fpload")
423        (eq_attr "cpu" "7100"))
424   "i_7100")
426 ;; We have a bypass for all computations in the FP unit which feed an
427 ;; FP store as long as the sizes are the same.
428 (define_bypass 1 "X0" "X6,X7" "pa_fpstore_bypass_p")
429 (define_bypass 7 "X1" "X6,X7" "pa_fpstore_bypass_p")
430 (define_bypass 14 "X2" "X6,X7" "pa_fpstore_bypass_p")
432 ;; We have an "anti-bypass" for FP loads which feed an FP store.
433 (define_bypass 3 "X4,X8" "X6,X7" "pa_fpstore_bypass_p")
435 ;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
436 ;; There's no value in modeling the ALU and MUL separately though
437 ;; since there can never be a functional unit conflict that
438 ;; can be avoided given the latency, issue rates and mandatory
439 ;; one cycle cpu-wide lock for a double precision fp multiply.
441 ;; Timings:
442 ;; Instruction  Time    Unit    Minimum Distance (unit contention)
443 ;; fcpy         2       ALU     1
444 ;; fabs         2       ALU     1
445 ;; fadd         2       ALU     1
446 ;; fsub         2       ALU     1
447 ;; fcmp         2       ALU     1
448 ;; fcnv         2       ALU     1
449 ;; fmpyadd,sgl  2       ALU,MPY 1
450 ;; fmpyadd,dbl  3       ALU,MPY 2
451 ;; fmpysub,sgl  2       ALU,MPY 1
452 ;; fmpysub,dbl  3       ALU,MPY 2
453 ;; fmpycfxt,sgl 2       ALU,MPY 1
454 ;; fmpycfxt,dbl 3       ALU,MPY 2
455 ;; fmpy,sgl     2       MPY     1
456 ;; fmpy,dbl     3       MPY     2
457 ;; fmpyi        3       MPY     2
458 ;; fdiv,sgl     8       DIV     8
459 ;; fdiv,dbl     15      DIV     15
460 ;; fsqrt,sgl    8       DIV     8
461 ;; fsqrt,dbl    15      DIV     15
463 ;; The PA7200 is just like the PA7100LC except that there is
464 ;; no store-store penalty.
466 ;; The PA7300 is just like the PA7200 except that there is
467 ;; no store-load penalty.
469 ;; Note there are some aspects of the 7100LC we are not modeling
470 ;; at the moment.  I'll be reviewing the 7100LC scheduling info
471 ;; shortly and updating this description.
473 ;;   load-load pairs
474 ;;   store-store pairs
475 ;;   other issue modeling
477 (define_automaton "pa7100lc")
478 (define_cpu_unit "i0_7100lc, i1_7100lc, f_7100lc" "pa7100lc")
479 (define_cpu_unit "fpmac_7100lc" "pa7100lc")
480 (define_cpu_unit "mem_7100lc" "pa7100lc")
482 ;; Double precision multiplies lock the entire CPU for one
483 ;; cycle.  There is no way to avoid this lock and trying to
484 ;; schedule around the lock is pointless and thus there is no
485 ;; value in trying to model this lock.
487 ;; Not modeling the lock allows us to treat fp multiplies just
488 ;; like any other FP alu instruction.  It allows for a smaller
489 ;; DFA and may reduce register pressure.
490 (define_insn_reservation "Y0" 2
491   (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
492        (eq_attr "cpu" "7100LC,7200,7300"))
493   "f_7100lc,fpmac_7100lc")
495 ;; fp division and sqrt instructions lock the entire CPU for
496 ;; 7 cycles (single precision) or 14 cycles (double precision).
497 ;; There is no way to avoid this lock and trying to schedule
498 ;; around the lock is pointless and thus there is no value in
499 ;; trying to model this lock.  Not modeling the lock allows
500 ;; for a smaller DFA and may reduce register pressure.
501 (define_insn_reservation "Y1" 1
502   (and (eq_attr "type" "fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
503        (eq_attr "cpu" "7100LC,7200,7300"))
504   "f_7100lc")
506 (define_insn_reservation "Y2" 2
507   (and (eq_attr "type" "load")
508        (eq_attr "cpu" "7100LC,7200,7300"))
509   "i1_7100lc+mem_7100lc")
511 (define_insn_reservation "Y3" 2
512   (and (eq_attr "type" "fpload")
513        (eq_attr "cpu" "7100LC,7200,7300"))
514   "i1_7100lc+mem_7100lc")
516 (define_insn_reservation "Y4" 2
517   (and (eq_attr "type" "store")
518        (eq_attr "cpu" "7100LC"))
519   "i1_7100lc+mem_7100lc,mem_7100lc")
521 (define_insn_reservation "Y5" 2
522   (and (eq_attr "type" "fpstore")
523        (eq_attr "cpu" "7100LC"))
524   "i1_7100lc+mem_7100lc,mem_7100lc")
526 (define_insn_reservation "Y6" 4
527   (and (eq_attr "type" "fpstore_load")
528        (eq_attr "cpu" "7100LC"))
529   "i1_7100lc+mem_7100lc,mem_7100lc*3")
531 (define_insn_reservation "Y7" 4
532   (and (eq_attr "type" "store_fpload")
533        (eq_attr "cpu" "7100LC"))
534   "i1_7100lc+mem_7100lc,mem_7100lc*3")
536 (define_insn_reservation "Y8" 1
537   (and (eq_attr "type" "shift,nullshift")
538        (eq_attr "cpu" "7100LC,7200,7300"))
539   "i1_7100lc")
541 (define_insn_reservation "Y9" 1
542   (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
543        (eq_attr "cpu" "7100LC,7200,7300"))
544   "(i0_7100lc|i1_7100lc)")
546 ;; The 7200 has a store-load penalty
547 (define_insn_reservation "Y10" 2
548   (and (eq_attr "type" "store")
549        (eq_attr "cpu" "7200"))
550   "i1_7100lc,mem_7100lc")
552 (define_insn_reservation "Y11" 2
553   (and (eq_attr "type" "fpstore")
554        (eq_attr "cpu" "7200"))
555   "i1_7100lc,mem_7100lc")
557 (define_insn_reservation "Y12" 4
558   (and (eq_attr "type" "fpstore_load")
559        (eq_attr "cpu" "7200"))
560   "i1_7100lc,mem_7100lc,i1_7100lc+mem_7100lc")
562 (define_insn_reservation "Y13" 4
563   (and (eq_attr "type" "store_fpload")
564        (eq_attr "cpu" "7200"))
565   "i1_7100lc,mem_7100lc,i1_7100lc+mem_7100lc")
567 ;; The 7300 has no penalty for store-store or store-load
568 (define_insn_reservation "Y14" 2
569   (and (eq_attr "type" "store")
570        (eq_attr "cpu" "7300"))
571   "i1_7100lc")
573 (define_insn_reservation "Y15" 2
574   (and (eq_attr "type" "fpstore")
575        (eq_attr "cpu" "7300"))
576   "i1_7100lc")
578 (define_insn_reservation "Y16" 4
579   (and (eq_attr "type" "fpstore_load")
580        (eq_attr "cpu" "7300"))
581   "i1_7100lc,i1_7100lc+mem_7100lc")
583 (define_insn_reservation "Y17" 4
584   (and (eq_attr "type" "store_fpload")
585        (eq_attr "cpu" "7300"))
586   "i1_7100lc,i1_7100lc+mem_7100lc")
588 ;; We have an "anti-bypass" for FP loads which feed an FP store.
589 (define_bypass 3 "Y3,Y7,Y13,Y17" "Y5,Y6,Y11,Y12,Y15,Y16" "pa_fpstore_bypass_p")
591 ;; Scheduling for the PA8000 is somewhat different than scheduling for a
592 ;; traditional architecture.
594 ;; The PA8000 has a large (56) entry reorder buffer that is split between
595 ;; memory and non-memory operations.
597 ;; The PA8000 can issue two memory and two non-memory operations per cycle to
598 ;; the function units, with the exception of branches and multi-output
599 ;; instructions.  The PA8000 can retire two non-memory operations per cycle
600 ;; and two memory operations per cycle, only one of which may be a store.
602 ;; Given the large reorder buffer, the processor can hide most latencies.
603 ;; According to HP, they've got the best results by scheduling for retirement
604 ;; bandwidth with limited latency scheduling for floating point operations.
605 ;; Latency for integer operations and memory references is ignored.
608 ;; We claim floating point operations have a 2 cycle latency and are
609 ;; fully pipelined, except for div and sqrt which are not pipelined and
610 ;; take from 17 to 31 cycles to complete.
612 ;; It's worth noting that there is no way to saturate all the functional
613 ;; units on the PA8000 as there is not enough issue bandwidth.
615 (define_automaton "pa8000")
616 (define_cpu_unit "inm0_8000, inm1_8000, im0_8000, im1_8000" "pa8000")
617 (define_cpu_unit "rnm0_8000, rnm1_8000, rm0_8000, rm1_8000" "pa8000")
618 (define_cpu_unit "store_8000" "pa8000")
619 (define_cpu_unit "f0_8000, f1_8000" "pa8000")
620 (define_cpu_unit "fdivsqrt0_8000, fdivsqrt1_8000" "pa8000")
621 (define_reservation "inm_8000" "inm0_8000 | inm1_8000")
622 (define_reservation "im_8000" "im0_8000 | im1_8000")
623 (define_reservation "rnm_8000" "rnm0_8000 | rnm1_8000")
624 (define_reservation "rm_8000" "rm0_8000 | rm1_8000")
625 (define_reservation "f_8000" "f0_8000 | f1_8000")
626 (define_reservation "fdivsqrt_8000" "fdivsqrt0_8000 | fdivsqrt1_8000")
628 ;; We can issue any two memops per cycle, but we can only retire
629 ;; one memory store per cycle.  We assume that the reorder buffer
630 ;; will hide any memory latencies per HP's recommendation.
631 (define_insn_reservation "Z0" 0
632   (and
633     (eq_attr "type" "load,fpload")
634     (eq_attr "cpu" "8000"))
635   "im_8000,rm_8000")
637 (define_insn_reservation "Z1" 0
638   (and
639     (eq_attr "type" "store,fpstore")
640     (eq_attr "cpu" "8000"))
641   "im_8000,rm_8000+store_8000")
643 (define_insn_reservation "Z2" 0
644   (and (eq_attr "type" "fpstore_load,store_fpload")
645        (eq_attr "cpu" "8000"))
646   "im_8000,rm_8000+store_8000,im_8000,rm_8000")
648 ;; We can issue and retire two non-memory operations per cycle with
649 ;; a few exceptions (branches).  This group catches those we want
650 ;; to assume have zero latency.
651 (define_insn_reservation "Z3" 0
652   (and
653     (eq_attr "type" "!load,fpload,store,fpstore,uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch,fpcc,fpalu,fpmulsgl,fpmuldbl,fpsqrtsgl,fpsqrtdbl,fpdivsgl,fpdivdbl,fpstore_load,store_fpload")
654     (eq_attr "cpu" "8000"))
655   "inm_8000,rnm_8000")
657 ;; Branches use both slots in the non-memory issue and
658 ;; retirement unit.
659 (define_insn_reservation "Z4" 0
660   (and
661     (eq_attr "type" "uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch")
662     (eq_attr "cpu" "8000"))
663   "inm0_8000+inm1_8000,rnm0_8000+rnm1_8000")
665 ;; We partial latency schedule the floating point units.
666 ;; They can issue/retire two at a time in the non-memory
667 ;; units.  We fix their latency at 2 cycles and they
668 ;; are fully pipelined.
669 (define_insn_reservation "Z5" 1
670  (and
671    (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
672    (eq_attr "cpu" "8000"))
673  "inm_8000,f_8000,rnm_8000")
675 ;; The fdivsqrt units are not pipelined and have a very long latency.  
676 ;; To keep the DFA from exploding, we do not show all the
677 ;; reservations for the divsqrt unit.
678 (define_insn_reservation "Z6" 17
679  (and
680    (eq_attr "type" "fpdivsgl,fpsqrtsgl")
681    (eq_attr "cpu" "8000"))
682  "inm_8000,fdivsqrt_8000*6,rnm_8000")
684 (define_insn_reservation "Z7" 31
685  (and
686    (eq_attr "type" "fpdivdbl,fpsqrtdbl")
687    (eq_attr "cpu" "8000"))
688  "inm_8000,fdivsqrt_8000*6,rnm_8000")
690 ;; Operand and operator predicates and constraints
692 (include "predicates.md")
693 (include "constraints.md")
695 ;; Atomic instructions
697 ;; All memory loads and stores access storage atomically except
698 ;; for one exception.  The STORE BYTES, STORE DOUBLE BYTES, and
699 ;; doubleword loads and stores are not guaranteed to be atomic
700 ;; when referencing the I/O address space.
702 ;; Implement atomic DImode load using 64-bit floating point load and copy.
704 (define_expand "atomic_loaddi"
705   [(match_operand:DI 0 "register_operand")              ;; val out
706    (match_operand:DI 1 "memory_operand")                ;; memory
707    (match_operand:SI 2 "const_int_operand")]            ;; model
708   "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
710   enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
711   operands[1] = force_reg (SImode, XEXP (operands[1], 0));
712   operands[2] = gen_reg_rtx (DImode);
713   expand_mem_thread_fence (model);
714   emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1], operands[2]));
715   if (is_mm_seq_cst (model))
716     expand_mem_thread_fence (model);
717   DONE;
720 (define_insn "atomic_loaddi_1"
721   [(set (match_operand:DI 0 "register_operand" "=r")
722         (mem:DI (match_operand:SI 1 "register_operand" "r")))
723    (clobber (match_operand:DI 2 "register_operand" "=&f"))]
724   "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
725   "{fldds|fldd} 0(%1),%2\;{fstds|fstd} %2,-16(%%sp)\;{ldws|ldw} -16(%%sp),%0\;{ldws|ldw} -12(%%sp),%R0"
726   [(set_attr "type" "move")
727    (set_attr "length" "16")])
729 ;; Implement atomic DImode store using copy and 64-bit floating point store.
731 (define_expand "atomic_storedi"
732   [(match_operand:DI 0 "memory_operand")                ;; memory
733    (match_operand:DI 1 "register_operand")              ;; val out
734    (match_operand:SI 2 "const_int_operand")]            ;; model
735   "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
737   enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
738   operands[0] = force_reg (SImode, XEXP (operands[0], 0));
739   operands[2] = gen_reg_rtx (DImode);
740   expand_mem_thread_fence (model);
741   emit_insn (gen_atomic_storedi_1 (operands[0], operands[1], operands[2]));
742   if (is_mm_seq_cst (model))
743     expand_mem_thread_fence (model);
744   DONE;
747 (define_insn "atomic_storedi_1"
748   [(set (mem:DI (match_operand:SI 0 "register_operand" "r"))
749         (match_operand:DI 1 "register_operand" "r"))
750    (clobber (match_operand:DI 2 "register_operand" "=&f"))]
751   "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
752   "{stws|stw} %1,-16(%%sp)\;{stws|stw} %R1,-12(%%sp)\;{fldds|fldd} -16(%%sp),%2\;{fstds|fstd} %2,0(%0)"
753   [(set_attr "type" "move")
754    (set_attr "length" "16")])
756 ;; Compare instructions.
757 ;; This controls RTL generation and register allocation.
759 (define_insn ""
760   [(set (reg:CCFP 0)
761         (match_operator:CCFP 2 "comparison_operator"
762                              [(match_operand:SF 0 "reg_or_0_operand" "fG")
763                               (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
764   "! TARGET_SOFT_FLOAT"
765   "fcmp,sgl,%Y2 %f0,%f1"
766   [(set_attr "length" "4")
767    (set_attr "type" "fpcc")])
769 (define_insn ""
770   [(set (reg:CCFP 0)
771         (match_operator:CCFP 2 "comparison_operator"
772                              [(match_operand:DF 0 "reg_or_0_operand" "fG")
773                               (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
774   "! TARGET_SOFT_FLOAT"
775   "fcmp,dbl,%Y2 %f0,%f1"
776   [(set_attr "length" "4")
777    (set_attr "type" "fpcc")])
779 ;; Provide a means to emit the movccfp0 and movccfp1 optimization
780 ;; placeholders.  This is necessary in rare situations when a
781 ;; placeholder is re-emitted (see PR 8705).
783 (define_expand "movccfp"
784   [(set (reg:CCFP 0)
785         (match_operand 0 "const_int_operand" ""))]
786   "! TARGET_SOFT_FLOAT"
787   "
789   if ((unsigned HOST_WIDE_INT) INTVAL (operands[0]) > 1)
790     FAIL;
793 ;; The following patterns are optimization placeholders.  In almost
794 ;; all cases, the user of the condition code will be simplified and the
795 ;; original condition code setting insn should be eliminated.
797 (define_insn "*movccfp0"
798   [(set (reg:CCFP 0)
799         (const_int 0))]
800   "! TARGET_SOFT_FLOAT"
801   "fcmp,dbl,= %%fr0,%%fr0"
802   [(set_attr "length" "4")
803    (set_attr "type" "fpcc")])
805 (define_insn "*movccfp1"
806   [(set (reg:CCFP 0)
807         (const_int 1))]
808   "! TARGET_SOFT_FLOAT"
809   "fcmp,dbl,!= %%fr0,%%fr0"
810   [(set_attr "length" "4")
811    (set_attr "type" "fpcc")])
813 ;; scc insns.
815 (define_expand "cstoresi4"
816   [(set (match_operand:SI 0 "register_operand")
817         (match_operator:SI 1 "ordered_comparison_operator"
818          [(match_operand:SI 2 "reg_or_0_operand" "")
819           (match_operand:SI 3 "arith5_operand" "")]))]
820   "!TARGET_64BIT"
821   "")
823 ;; Instruction canonicalization puts immediate operands second, which
824 ;; is the reverse of what we want.
826 (define_insn "scc"
827   [(set (match_operand:SI 0 "register_operand" "=r")
828         (match_operator:SI 3 "comparison_operator"
829                            [(match_operand:SI 1 "reg_or_0_operand" "rM")
830                             (match_operand:SI 2 "arith11_operand" "rI")]))]
831   ""
832   "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi 1,%0"
833   [(set_attr "type" "binary")
834    (set_attr "length" "8")])
836 (define_insn ""
837   [(set (match_operand:DI 0 "register_operand" "=r")
838         (match_operator:DI 3 "comparison_operator"
839                            [(match_operand:DI 1 "reg_or_0_operand" "rM")
840                             (match_operand:DI 2 "arith11_operand" "rI")]))]
841   "TARGET_64BIT"
842   "cmp%I2clr,*%B3 %2,%r1,%0\;ldi 1,%0"
843   [(set_attr "type" "binary")
844    (set_attr "length" "8")])
846 (define_insn "iorscc"
847   [(set (match_operand:SI 0 "register_operand" "=r")
848         (ior:SI (match_operator:SI 3 "comparison_operator"
849                                    [(match_operand:SI 1 "reg_or_0_operand" "rM")
850                                     (match_operand:SI 2 "arith11_operand" "rI")])
851                 (match_operator:SI 6 "comparison_operator"
852                                    [(match_operand:SI 4 "reg_or_0_operand" "rM")
853                                     (match_operand:SI 5 "arith11_operand" "rI")])))]
854   ""
855   "{com%I2clr|cmp%I2clr},%S3 %2,%r1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%r4,%0\;ldi 1,%0"
856   [(set_attr "type" "binary")
857    (set_attr "length" "12")])
859 (define_insn ""
860   [(set (match_operand:DI 0 "register_operand" "=r")
861         (ior:DI (match_operator:DI 3 "comparison_operator"
862                                    [(match_operand:DI 1 "reg_or_0_operand" "rM")
863                                     (match_operand:DI 2 "arith11_operand" "rI")])
864                 (match_operator:DI 6 "comparison_operator"
865                                    [(match_operand:DI 4 "reg_or_0_operand" "rM")
866                                     (match_operand:DI 5 "arith11_operand" "rI")])))]
867   "TARGET_64BIT"
868   "cmp%I2clr,*%S3 %2,%r1,%%r0\;cmp%I5clr,*%B6 %5,%r4,%0\;ldi 1,%0"
869   [(set_attr "type" "binary")
870    (set_attr "length" "12")])
872 ;; Combiner patterns for common operations performed with the output
873 ;; from an scc insn (negscc and incscc).
874 (define_insn "negscc"
875   [(set (match_operand:SI 0 "register_operand" "=r")
876         (neg:SI (match_operator:SI 3 "comparison_operator"
877                [(match_operand:SI 1 "reg_or_0_operand" "rM")
878                 (match_operand:SI 2 "arith11_operand" "rI")])))]
879   ""
880   "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi -1,%0"
881   [(set_attr "type" "binary")
882    (set_attr "length" "8")])
884 (define_insn ""
885   [(set (match_operand:DI 0 "register_operand" "=r")
886         (neg:DI (match_operator:DI 3 "comparison_operator"
887                [(match_operand:DI 1 "reg_or_0_operand" "rM")
888                 (match_operand:DI 2 "arith11_operand" "rI")])))]
889   "TARGET_64BIT"
890   "cmp%I2clr,*%B3 %2,%r1,%0\;ldi -1,%0"
891   [(set_attr "type" "binary")
892    (set_attr "length" "8")])
894 ;; Patterns for adding/subtracting the result of a boolean expression from
895 ;; a register.  First we have special patterns that make use of the carry
896 ;; bit, and output only two instructions.  For the cases we can't in
897 ;; general do in two instructions, the incscc pattern at the end outputs
898 ;; two or three instructions.
900 (define_insn ""
901   [(set (match_operand:SI 0 "register_operand" "=r")
902         (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
903                          (match_operand:SI 3 "arith11_operand" "rI"))
904                  (match_operand:SI 1 "register_operand" "r")))]
905   ""
906   "sub%I3 %3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
907   [(set_attr "type" "binary")
908    (set_attr "length" "8")])
910 (define_insn ""
911   [(set (match_operand:DI 0 "register_operand" "=r")
912         (plus:DI (leu:DI (match_operand:DI 2 "register_operand" "r")
913                          (match_operand:DI 3 "arith11_operand" "rI"))
914                  (match_operand:DI 1 "register_operand" "r")))]
915   "TARGET_64BIT"
916   "sub%I3 %3,%2,%%r0\;add,dc %%r0,%1,%0"
917   [(set_attr "type" "binary")
918    (set_attr "length" "8")])
920 ; This need only accept registers for op3, since canonicalization
921 ; replaces geu with gtu when op3 is an integer.
922 (define_insn ""
923   [(set (match_operand:SI 0 "register_operand" "=r")
924         (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
925                          (match_operand:SI 3 "register_operand" "r"))
926                  (match_operand:SI 1 "register_operand" "r")))]
927   ""
928   "sub %2,%3,%%r0\;{addc|add,c} %%r0,%1,%0"
929   [(set_attr "type" "binary")
930    (set_attr "length" "8")])
932 (define_insn ""
933   [(set (match_operand:DI 0 "register_operand" "=r")
934         (plus:DI (geu:DI (match_operand:DI 2 "register_operand" "r")
935                          (match_operand:DI 3 "register_operand" "r"))
936                  (match_operand:DI 1 "register_operand" "r")))]
937   "TARGET_64BIT"
938   "sub %2,%3,%%r0\;add,dc %%r0,%1,%0"
939   [(set_attr "type" "binary")
940    (set_attr "length" "8")])
942 ; Match only integers for op3 here.  This is used as canonical form of the
943 ; geu pattern when op3 is an integer.  Don't match registers since we can't
944 ; make better code than the general incscc pattern.
945 (define_insn ""
946   [(set (match_operand:SI 0 "register_operand" "=r")
947         (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
948                          (match_operand:SI 3 "int11_operand" "I"))
949                  (match_operand:SI 1 "register_operand" "r")))]
950   ""
951   "addi %k3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
952   [(set_attr "type" "binary")
953    (set_attr "length" "8")])
955 (define_insn ""
956   [(set (match_operand:DI 0 "register_operand" "=r")
957         (plus:DI (gtu:DI (match_operand:DI 2 "register_operand" "r")
958                          (match_operand:DI 3 "int11_operand" "I"))
959                  (match_operand:DI 1 "register_operand" "r")))]
960   "TARGET_64BIT"
961   "addi %k3,%2,%%r0\;add,dc %%r0,%1,%0"
962   [(set_attr "type" "binary")
963    (set_attr "length" "8")])
965 (define_insn "incscc"
966   [(set (match_operand:SI 0 "register_operand" "=r,r")
967         (plus:SI (match_operator:SI 4 "comparison_operator"
968                     [(match_operand:SI 2 "register_operand" "r,r")
969                      (match_operand:SI 3 "arith11_operand" "rI,rI")])
970                  (match_operand:SI 1 "register_operand" "0,?r")))]
971   ""
972   "@
973    {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi 1,%0,%0
974    {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
975   [(set_attr "type" "binary,binary")
976    (set_attr "length" "8,12")])
978 (define_insn ""
979   [(set (match_operand:DI 0 "register_operand" "=r,r")
980         (plus:DI (match_operator:DI 4 "comparison_operator"
981                     [(match_operand:DI 2 "register_operand" "r,r")
982                      (match_operand:DI 3 "arith11_operand" "rI,rI")])
983                  (match_operand:DI 1 "register_operand" "0,?r")))]
984   "TARGET_64BIT"
985   "@
986    cmp%I3clr,*%B4 %3,%2,%%r0\;addi 1,%0,%0
987    cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
988   [(set_attr "type" "binary,binary")
989    (set_attr "length" "8,12")])
991 (define_insn ""
992   [(set (match_operand:SI 0 "register_operand" "=r")
993         (minus:SI (match_operand:SI 1 "register_operand" "r")
994                   (gtu:SI (match_operand:SI 2 "register_operand" "r")
995                           (match_operand:SI 3 "arith11_operand" "rI"))))]
996   ""
997   "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
998   [(set_attr "type" "binary")
999    (set_attr "length" "8")])
1001 (define_insn ""
1002   [(set (match_operand:DI 0 "register_operand" "=r")
1003         (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   "TARGET_64BIT"
1007   "sub%I3 %3,%2,%%r0\;sub,db %1,%%r0,%0"
1008   [(set_attr "type" "binary")
1009    (set_attr "length" "8")])
1011 (define_insn ""
1012   [(set (match_operand:SI 0 "register_operand" "=r")
1013         (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1014                             (gtu:SI (match_operand:SI 2 "register_operand" "r")
1015                                     (match_operand:SI 3 "arith11_operand" "rI")))
1016                   (match_operand:SI 4 "register_operand" "r")))]
1017   ""
1018   "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1019   [(set_attr "type" "binary")
1020    (set_attr "length" "8")])
1022 (define_insn ""
1023   [(set (match_operand:DI 0 "register_operand" "=r")
1024         (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1025                             (gtu:DI (match_operand:DI 2 "register_operand" "r")
1026                                     (match_operand:DI 3 "arith11_operand" "rI")))
1027                   (match_operand:DI 4 "register_operand" "r")))]
1028   "TARGET_64BIT"
1029   "sub%I3 %3,%2,%%r0\;sub,db %1,%4,%0"
1030   [(set_attr "type" "binary")
1031    (set_attr "length" "8")])
1033 ; This need only accept registers for op3, since canonicalization
1034 ; replaces ltu with leu when op3 is an integer.
1035 (define_insn ""
1036   [(set (match_operand:SI 0 "register_operand" "=r")
1037         (minus:SI (match_operand:SI 1 "register_operand" "r")
1038                   (ltu:SI (match_operand:SI 2 "register_operand" "r")
1039                           (match_operand:SI 3 "register_operand" "r"))))]
1040   ""
1041   "sub %2,%3,%%r0\;{subb|sub,b} %1,%%r0,%0"
1042   [(set_attr "type" "binary")
1043    (set_attr "length" "8")])
1045 (define_insn ""
1046   [(set (match_operand:DI 0 "register_operand" "=r")
1047         (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   "TARGET_64BIT"
1051   "sub %2,%3,%%r0\;sub,db %1,%%r0,%0"
1052   [(set_attr "type" "binary")
1053    (set_attr "length" "8")])
1055 (define_insn ""
1056   [(set (match_operand:SI 0 "register_operand" "=r")
1057         (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1058                             (ltu:SI (match_operand:SI 2 "register_operand" "r")
1059                                     (match_operand:SI 3 "register_operand" "r")))
1060                   (match_operand:SI 4 "register_operand" "r")))]
1061   ""
1062   "sub %2,%3,%%r0\;{subb|sub,b} %1,%4,%0"
1063   [(set_attr "type" "binary")
1064    (set_attr "length" "8")])
1066 (define_insn ""
1067   [(set (match_operand:DI 0 "register_operand" "=r")
1068         (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1069                             (ltu:DI (match_operand:DI 2 "register_operand" "r")
1070                                     (match_operand:DI 3 "register_operand" "r")))
1071                   (match_operand:DI 4 "register_operand" "r")))]
1072   "TARGET_64BIT"
1073   "sub %2,%3,%%r0\;sub,db %1,%4,%0"
1074   [(set_attr "type" "binary")
1075    (set_attr "length" "8")])
1077 ; Match only integers for op3 here.  This is used as canonical form of the
1078 ; ltu pattern when op3 is an integer.  Don't match registers since we can't
1079 ; make better code than the general incscc pattern.
1080 (define_insn ""
1081   [(set (match_operand:SI 0 "register_operand" "=r")
1082         (minus:SI (match_operand:SI 1 "register_operand" "r")
1083                   (leu:SI (match_operand:SI 2 "register_operand" "r")
1084                           (match_operand:SI 3 "int11_operand" "I"))))]
1085   ""
1086   "addi %k3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1087   [(set_attr "type" "binary")
1088    (set_attr "length" "8")])
1090 (define_insn ""
1091   [(set (match_operand:DI 0 "register_operand" "=r")
1092         (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   "TARGET_64BIT"
1096   "addi %k3,%2,%%r0\;sub,db %1,%%r0,%0"
1097   [(set_attr "type" "binary")
1098    (set_attr "length" "8")])
1100 (define_insn ""
1101   [(set (match_operand:SI 0 "register_operand" "=r")
1102         (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1103                             (leu:SI (match_operand:SI 2 "register_operand" "r")
1104                                     (match_operand:SI 3 "int11_operand" "I")))
1105                   (match_operand:SI 4 "register_operand" "r")))]
1106   ""
1107   "addi %k3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1108   [(set_attr "type" "binary")
1109    (set_attr "length" "8")])
1111 (define_insn ""
1112   [(set (match_operand:DI 0 "register_operand" "=r")
1113         (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1114                             (leu:DI (match_operand:DI 2 "register_operand" "r")
1115                                     (match_operand:DI 3 "int11_operand" "I")))
1116                   (match_operand:DI 4 "register_operand" "r")))]
1117   "TARGET_64BIT"
1118   "addi %k3,%2,%%r0\;sub,db %1,%4,%0"
1119   [(set_attr "type" "binary")
1120    (set_attr "length" "8")])
1122 (define_insn "decscc"
1123   [(set (match_operand:SI 0 "register_operand" "=r,r")
1124         (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
1125                   (match_operator:SI 4 "comparison_operator"
1126                      [(match_operand:SI 2 "register_operand" "r,r")
1127                       (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
1128   ""
1129   "@
1130    {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi -1,%0,%0
1131    {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1132   [(set_attr "type" "binary,binary")
1133    (set_attr "length" "8,12")])
1135 (define_insn ""
1136   [(set (match_operand:DI 0 "register_operand" "=r,r")
1137         (minus:DI (match_operand:DI 1 "register_operand" "0,?r")
1138                   (match_operator:DI 4 "comparison_operator"
1139                      [(match_operand:DI 2 "register_operand" "r,r")
1140                       (match_operand:DI 3 "arith11_operand" "rI,rI")])))]
1141   "TARGET_64BIT"
1142   "@
1143    cmp%I3clr,*%B4 %3,%2,%%r0\;addi -1,%0,%0
1144    cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1145   [(set_attr "type" "binary,binary")
1146    (set_attr "length" "8,12")])
1148 ; Patterns for max and min.  (There is no need for an earlyclobber in the
1149 ; last alternative since the middle alternative will match if op0 == op1.)
1151 (define_insn "sminsi3"
1152   [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1153         (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1154                  (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1155   ""
1156   "@
1157   {comclr|cmpclr},> %2,%0,%%r0\;copy %2,%0
1158   {comiclr|cmpiclr},> %2,%0,%%r0\;ldi %2,%0
1159   {comclr|cmpclr},> %1,%r2,%0\;copy %1,%0"
1160 [(set_attr "type" "multi,multi,multi")
1161  (set_attr "length" "8,8,8")])
1163 (define_insn "smindi3"
1164   [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1165         (smin:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1166                  (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1167   "TARGET_64BIT"
1168   "@
1169   cmpclr,*> %2,%0,%%r0\;copy %2,%0
1170   cmpiclr,*> %2,%0,%%r0\;ldi %2,%0
1171   cmpclr,*> %1,%r2,%0\;copy %1,%0"
1172 [(set_attr "type" "multi,multi,multi")
1173  (set_attr "length" "8,8,8")])
1175 (define_insn "uminsi3"
1176   [(set (match_operand:SI 0 "register_operand" "=r,r")
1177         (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
1178                  (match_operand:SI 2 "arith11_operand" "r,I")))]
1179   ""
1180   "@
1181   {comclr|cmpclr},>> %2,%0,%%r0\;copy %2,%0
1182   {comiclr|cmpiclr},>> %2,%0,%%r0\;ldi %2,%0"
1183 [(set_attr "type" "multi,multi")
1184  (set_attr "length" "8,8")])
1186 (define_insn "umindi3"
1187   [(set (match_operand:DI 0 "register_operand" "=r,r")
1188         (umin:DI (match_operand:DI 1 "register_operand" "%0,0")
1189                  (match_operand:DI 2 "arith11_operand" "r,I")))]
1190   "TARGET_64BIT"
1191   "@
1192   cmpclr,*>> %2,%0,%%r0\;copy %2,%0
1193   cmpiclr,*>> %2,%0,%%r0\;ldi %2,%0"
1194 [(set_attr "type" "multi,multi")
1195  (set_attr "length" "8,8")])
1197 (define_insn "smaxsi3"
1198   [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1199         (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1200                  (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1201   ""
1202   "@
1203   {comclr|cmpclr},< %2,%0,%%r0\;copy %2,%0
1204   {comiclr|cmpiclr},< %2,%0,%%r0\;ldi %2,%0
1205   {comclr|cmpclr},< %1,%r2,%0\;copy %1,%0"
1206 [(set_attr "type" "multi,multi,multi")
1207  (set_attr "length" "8,8,8")])
1209 (define_insn "smaxdi3"
1210   [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1211         (smax:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1212                  (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1213   "TARGET_64BIT"
1214   "@
1215   cmpclr,*< %2,%0,%%r0\;copy %2,%0
1216   cmpiclr,*< %2,%0,%%r0\;ldi %2,%0
1217   cmpclr,*< %1,%r2,%0\;copy %1,%0"
1218 [(set_attr "type" "multi,multi,multi")
1219  (set_attr "length" "8,8,8")])
1221 (define_insn "umaxsi3"
1222   [(set (match_operand:SI 0 "register_operand" "=r,r")
1223         (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
1224                  (match_operand:SI 2 "arith11_operand" "r,I")))]
1225   ""
1226   "@
1227   {comclr|cmpclr},<< %2,%0,%%r0\;copy %2,%0
1228   {comiclr|cmpiclr},<< %2,%0,%%r0\;ldi %2,%0"
1229 [(set_attr "type" "multi,multi")
1230  (set_attr "length" "8,8")])
1232 (define_insn "umaxdi3"
1233   [(set (match_operand:DI 0 "register_operand" "=r,r")
1234         (umax:DI (match_operand:DI 1 "register_operand" "%0,0")
1235                  (match_operand:DI 2 "arith11_operand" "r,I")))]
1236   "TARGET_64BIT"
1237   "@
1238   cmpclr,*<< %2,%0,%%r0\;copy %2,%0
1239   cmpiclr,*<< %2,%0,%%r0\;ldi %2,%0"
1240 [(set_attr "type" "multi,multi")
1241  (set_attr "length" "8,8")])
1243 (define_insn "abssi2"
1244   [(set (match_operand:SI 0 "register_operand" "=r")
1245         (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1246   ""
1247   "or,>= %%r0,%1,%0\;subi 0,%0,%0"
1248   [(set_attr "type" "multi")
1249    (set_attr "length" "8")])
1251 (define_insn "absdi2"
1252   [(set (match_operand:DI 0 "register_operand" "=r")
1253         (abs:DI (match_operand:DI 1 "register_operand" "r")))]
1254   "TARGET_64BIT"
1255   "or,*>= %%r0,%1,%0\;subi 0,%0,%0"
1256   [(set_attr "type" "multi")
1257    (set_attr "length" "8")])
1259 ;;; Experimental conditional move patterns
1261 (define_expand "movsicc"
1262   [(set (match_operand:SI 0 "register_operand" "")
1263         (if_then_else:SI
1264          (match_operand 1 "comparison_operator" "")
1265          (match_operand:SI 2 "reg_or_cint_move_operand" "")
1266          (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
1267   ""
1268   "
1270   if (GET_MODE (XEXP (operands[1], 0)) != SImode
1271       || GET_MODE (XEXP (operands[1], 0)) != GET_MODE (XEXP (operands[1], 1)))
1272     FAIL;
1275 ;; We used to accept any register for op1.
1277 ;; However, it loses sometimes because the compiler will end up using
1278 ;; different registers for op0 and op1 in some critical cases.  local-alloc
1279 ;; will  not tie op0 and op1 because op0 is used in multiple basic blocks.
1281 ;; If/when global register allocation supports tying we should allow any
1282 ;; register for op1 again.
1283 (define_insn ""
1284   [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1285         (if_then_else:SI
1286          (match_operator 2 "comparison_operator"
1287             [(match_operand:SI 3 "register_operand" "r,r,r,r")
1288              (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI")])
1289          (match_operand:SI 1 "reg_or_cint_move_operand" "0,J,N,K")
1290          (const_int 0)))]
1291   ""
1292   "@
1293    {com%I4clr|cmp%I4clr},%S2 %4,%3,%%r0\;ldi 0,%0
1294    {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldi %1,%0
1295    {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldil L'%1,%0
1296    {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;{zdepi|depwi,z} %Z1,%0"
1297   [(set_attr "type" "multi,multi,multi,nullshift")
1298    (set_attr "length" "8,8,8,8")])
1300 (define_insn ""
1301   [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1302         (if_then_else:SI
1303          (match_operator 5 "comparison_operator"
1304             [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
1305              (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1306          (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1307          (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1308   ""
1309   "@
1310    {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;copy %2,%0
1311    {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldi %2,%0
1312    {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldil L'%2,%0
1313    {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;{zdepi|depwi,z} %Z2,%0
1314    {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;copy %1,%0
1315    {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldi %1,%0
1316    {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldil L'%1,%0
1317    {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;{zdepi|depwi,z} %Z1,%0"
1318   [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1319    (set_attr "length" "8,8,8,8,8,8,8,8")])
1321 (define_expand "movdicc"
1322   [(set (match_operand:DI 0 "register_operand" "")
1323         (if_then_else:DI
1324          (match_operand 1 "comparison_operator" "")
1325          (match_operand:DI 2 "reg_or_cint_move_operand" "")
1326          (match_operand:DI 3 "reg_or_cint_move_operand" "")))]
1327   "TARGET_64BIT"
1328   "
1330   if (GET_MODE (XEXP (operands[1], 0)) != DImode
1331       || GET_MODE (XEXP (operands[1], 0)) != GET_MODE (XEXP (operands[1], 1)))
1332     FAIL;
1335 ; We need the first constraint alternative in order to avoid
1336 ; earlyclobbers on all other alternatives.
1337 (define_insn ""
1338   [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1339         (if_then_else:DI
1340          (match_operator 2 "comparison_operator"
1341             [(match_operand:DI 3 "register_operand" "r,r,r,r,r")
1342              (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
1343          (match_operand:DI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
1344          (const_int 0)))]
1345   "TARGET_64BIT"
1346   "@
1347    cmp%I4clr,*%S2 %4,%3,%%r0\;ldi 0,%0
1348    cmp%I4clr,*%B2 %4,%3,%0\;copy %1,%0
1349    cmp%I4clr,*%B2 %4,%3,%0\;ldi %1,%0
1350    cmp%I4clr,*%B2 %4,%3,%0\;ldil L'%1,%0
1351    cmp%I4clr,*%B2 %4,%3,%0\;depdi,z %z1,%0"
1352   [(set_attr "type" "multi,multi,multi,multi,nullshift")
1353    (set_attr "length" "8,8,8,8,8")])
1355 (define_insn ""
1356   [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1357         (if_then_else:DI
1358          (match_operator 5 "comparison_operator"
1359             [(match_operand:DI 3 "register_operand" "r,r,r,r,r,r,r,r")
1360              (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1361          (match_operand:DI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1362          (match_operand:DI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1363   "TARGET_64BIT"
1364   "@
1365    cmp%I4clr,*%S5 %4,%3,%%r0\;copy %2,%0
1366    cmp%I4clr,*%S5 %4,%3,%%r0\;ldi %2,%0
1367    cmp%I4clr,*%S5 %4,%3,%%r0\;ldil L'%2,%0
1368    cmp%I4clr,*%S5 %4,%3,%%r0\;depdi,z %z2,%0
1369    cmp%I4clr,*%B5 %4,%3,%%r0\;copy %1,%0
1370    cmp%I4clr,*%B5 %4,%3,%%r0\;ldi %1,%0
1371    cmp%I4clr,*%B5 %4,%3,%%r0\;ldil L'%1,%0
1372    cmp%I4clr,*%B5 %4,%3,%%r0\;depdi,z %z1,%0"
1373   [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1374    (set_attr "length" "8,8,8,8,8,8,8,8")])
1376 ;; Conditional Branches
1378 (define_expand "cbranchdi4"
1379   [(set (pc)
1380         (if_then_else (match_operator 0 "ordered_comparison_operator"
1381                        [(match_operand:DI 1 "reg_or_0_operand" "")
1382                         (match_operand:DI 2 "register_operand" "")])
1383                       (label_ref (match_operand 3 "" ""))
1384                       (pc)))]
1385   "TARGET_64BIT"
1386   "")
1388 (define_expand "cbranchsi4"
1389   [(set (pc)
1390         (if_then_else (match_operator 0 "ordered_comparison_operator"
1391                        [(match_operand:SI 1 "reg_or_0_operand" "")
1392                         (match_operand:SI 2 "arith5_operand" "")])
1393                       (label_ref (match_operand 3 "" ""))
1394                       (pc)))]
1395   ""
1396   "")
1398 (define_expand "cbranchsf4"
1399   [(set (pc)
1400         (if_then_else (match_operator 0 "comparison_operator"
1401                        [(match_operand:SF 1 "reg_or_0_operand" "")
1402                         (match_operand:SF 2 "reg_or_0_operand" "")])
1403                       (label_ref (match_operand 3 "" ""))
1404                       (pc)))]
1405   ""
1406   "
1408   pa_emit_bcond_fp (operands);
1409   DONE;
1413 (define_expand "cbranchdf4"
1414   [(set (pc)
1415         (if_then_else (match_operator 0 "comparison_operator"
1416                        [(match_operand:DF 1 "reg_or_0_operand" "")
1417                         (match_operand:DF 2 "reg_or_0_operand" "")])
1418                       (label_ref (match_operand 3 "" ""))
1419                       (pc)))]
1420   ""
1421   "
1423   pa_emit_bcond_fp (operands);
1424   DONE;
1427 ;; Match the branch patterns.
1430 ;; Note a long backward conditional branch with an annulled delay slot
1431 ;; has a length of 12.
1432 (define_insn ""
1433   [(set (pc)
1434         (if_then_else
1435          (match_operator 3 "comparison_operator"
1436                          [(match_operand:SI 1 "reg_or_0_operand" "rM")
1437                           (match_operand:SI 2 "arith5_operand" "rL")])
1438          (label_ref (match_operand 0 "" ""))
1439          (pc)))]
1440   ""
1441   "*
1443   return pa_output_cbranch (operands, 0, insn);
1445 [(set_attr "type" "cbranch")
1446  (set (attr "length")
1447     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1448                (const_int MAX_12BIT_OFFSET))
1449            (const_int 4)
1450            (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1451                (const_int MAX_17BIT_OFFSET))
1452            (const_int 8)
1453            (match_test "TARGET_PORTABLE_RUNTIME")
1454            (const_int 24)
1455            (not (match_test "flag_pic"))
1456            (const_int 20)]
1457           (const_int 28)))])
1459 ;; Match the negated branch.
1461 (define_insn ""
1462   [(set (pc)
1463         (if_then_else
1464          (match_operator 3 "comparison_operator"
1465                          [(match_operand:SI 1 "reg_or_0_operand" "rM")
1466                           (match_operand:SI 2 "arith5_operand" "rL")])
1467          (pc)
1468          (label_ref (match_operand 0 "" ""))))]
1469   ""
1470   "*
1472   return pa_output_cbranch (operands, 1, insn);
1474 [(set_attr "type" "cbranch")
1475  (set (attr "length")
1476     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1477                (const_int MAX_12BIT_OFFSET))
1478            (const_int 4)
1479            (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1480                (const_int MAX_17BIT_OFFSET))
1481            (const_int 8)
1482            (match_test "TARGET_PORTABLE_RUNTIME")
1483            (const_int 24)
1484            (not (match_test "flag_pic"))
1485            (const_int 20)]
1486           (const_int 28)))])
1488 (define_insn ""
1489   [(set (pc)
1490         (if_then_else
1491          (match_operator 3 "comparison_operator"
1492                          [(match_operand:DI 1 "reg_or_0_operand" "rM")
1493                           (match_operand:DI 2 "reg_or_0_operand" "rM")])
1494          (label_ref (match_operand 0 "" ""))
1495          (pc)))]
1496   "TARGET_64BIT"
1497   "*
1499   return pa_output_cbranch (operands, 0, insn);
1501 [(set_attr "type" "cbranch")
1502  (set (attr "length")
1503     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1504                (const_int MAX_12BIT_OFFSET))
1505            (const_int 4)
1506            (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1507                (const_int MAX_17BIT_OFFSET))
1508            (const_int 8)
1509            (match_test "TARGET_PORTABLE_RUNTIME")
1510            (const_int 24)
1511            (not (match_test "flag_pic"))
1512            (const_int 20)]
1513           (const_int 28)))])
1515 ;; Match the negated branch.
1517 (define_insn ""
1518   [(set (pc)
1519         (if_then_else
1520          (match_operator 3 "comparison_operator"
1521                          [(match_operand:DI 1 "reg_or_0_operand" "rM")
1522                           (match_operand:DI 2 "reg_or_0_operand" "rM")])
1523          (pc)
1524          (label_ref (match_operand 0 "" ""))))]
1525   "TARGET_64BIT"
1526   "*
1528   return pa_output_cbranch (operands, 1, insn);
1530 [(set_attr "type" "cbranch")
1531  (set (attr "length")
1532     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1533                (const_int MAX_12BIT_OFFSET))
1534            (const_int 4)
1535            (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1536                (const_int MAX_17BIT_OFFSET))
1537            (const_int 8)
1538            (match_test "TARGET_PORTABLE_RUNTIME")
1539            (const_int 24)
1540            (not (match_test "flag_pic"))
1541            (const_int 20)]
1542           (const_int 28)))])
1543 (define_insn ""
1544   [(set (pc)
1545         (if_then_else
1546          (match_operator 3 "cmpib_comparison_operator"
1547                          [(match_operand:DI 1 "reg_or_0_operand" "rM")
1548                           (match_operand:DI 2 "arith5_operand" "rL")])
1549          (label_ref (match_operand 0 "" ""))
1550          (pc)))]
1551   "TARGET_64BIT"
1552   "*
1554   return pa_output_cbranch (operands, 0, insn);
1556 [(set_attr "type" "cbranch")
1557  (set (attr "length")
1558     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1559                (const_int MAX_12BIT_OFFSET))
1560            (const_int 4)
1561            (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1562                (const_int MAX_17BIT_OFFSET))
1563            (const_int 8)
1564            (match_test "TARGET_PORTABLE_RUNTIME")
1565            (const_int 24)
1566            (not (match_test "flag_pic"))
1567            (const_int 20)]
1568           (const_int 28)))])
1570 ;; Match the negated branch.
1572 (define_insn ""
1573   [(set (pc)
1574         (if_then_else
1575          (match_operator 3 "cmpib_comparison_operator"
1576                          [(match_operand:DI 1 "reg_or_0_operand" "rM")
1577                           (match_operand:DI 2 "arith5_operand" "rL")])
1578          (pc)
1579          (label_ref (match_operand 0 "" ""))))]
1580   "TARGET_64BIT"
1581   "*
1583   return pa_output_cbranch (operands, 1, insn);
1585 [(set_attr "type" "cbranch")
1586  (set (attr "length")
1587     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1588                (const_int MAX_12BIT_OFFSET))
1589            (const_int 4)
1590            (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1591                (const_int MAX_17BIT_OFFSET))
1592            (const_int 8)
1593            (match_test "TARGET_PORTABLE_RUNTIME")
1594            (const_int 24)
1595            (not (match_test "flag_pic"))
1596            (const_int 20)]
1597           (const_int 28)))])
1599 ;; Branch on Bit patterns.
1600 (define_insn ""
1601   [(set (pc)
1602         (if_then_else
1603          (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1604                               (const_int 1)
1605                               (match_operand:SI 1 "uint5_operand" ""))
1606              (const_int 0))
1607          (label_ref (match_operand 2 "" ""))
1608          (pc)))]
1609   ""
1610   "*
1612   return pa_output_bb (operands, 0, insn, 0);
1614 [(set_attr "type" "cbranch")
1615  (set (attr "length")
1616     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1617                (const_int MAX_12BIT_OFFSET))
1618            (const_int 4)
1619            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1620                (const_int MAX_17BIT_OFFSET))
1621            (const_int 8)
1622            (match_test "TARGET_PORTABLE_RUNTIME")
1623            (const_int 24)
1624            (not (match_test "flag_pic"))
1625            (const_int 20)]
1626           (const_int 28)))])
1628 (define_insn ""
1629   [(set (pc)
1630         (if_then_else
1631          (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1632                               (const_int 1)
1633                               (match_operand:DI 1 "uint32_operand" ""))
1634              (const_int 0))
1635          (label_ref (match_operand 2 "" ""))
1636          (pc)))]
1637   "TARGET_64BIT"
1638   "*
1640   return pa_output_bb (operands, 0, insn, 0);
1642 [(set_attr "type" "cbranch")
1643  (set (attr "length")
1644     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1645                (const_int MAX_12BIT_OFFSET))
1646            (const_int 4)
1647            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1648                (const_int MAX_17BIT_OFFSET))
1649            (const_int 8)
1650            (match_test "TARGET_PORTABLE_RUNTIME")
1651            (const_int 24)
1652            (not (match_test "flag_pic"))
1653            (const_int 20)]
1654           (const_int 28)))])
1656 (define_insn ""
1657   [(set (pc)
1658         (if_then_else
1659          (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1660                               (const_int 1)
1661                               (match_operand:SI 1 "uint5_operand" ""))
1662              (const_int 0))
1663          (pc)
1664          (label_ref (match_operand 2 "" ""))))]
1665   ""
1666   "*
1668   return pa_output_bb (operands, 1, insn, 0);
1670 [(set_attr "type" "cbranch")
1671  (set (attr "length")
1672     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1673                (const_int MAX_12BIT_OFFSET))
1674            (const_int 4)
1675            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1676                (const_int MAX_17BIT_OFFSET))
1677            (const_int 8)
1678            (match_test "TARGET_PORTABLE_RUNTIME")
1679            (const_int 24)
1680            (not (match_test "flag_pic"))
1681            (const_int 20)]
1682           (const_int 28)))])
1684 (define_insn ""
1685   [(set (pc)
1686         (if_then_else
1687          (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1688                               (const_int 1)
1689                               (match_operand:DI 1 "uint32_operand" ""))
1690              (const_int 0))
1691          (pc)
1692          (label_ref (match_operand 2 "" ""))))]
1693   "TARGET_64BIT"
1694   "*
1696   return pa_output_bb (operands, 1, insn, 0);
1698 [(set_attr "type" "cbranch")
1699  (set (attr "length")
1700     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1701                (const_int MAX_12BIT_OFFSET))
1702            (const_int 4)
1703            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1704                (const_int MAX_17BIT_OFFSET))
1705            (const_int 8)
1706            (match_test "TARGET_PORTABLE_RUNTIME")
1707            (const_int 24)
1708            (not (match_test "flag_pic"))
1709            (const_int 20)]
1710           (const_int 28)))])
1712 (define_insn ""
1713   [(set (pc)
1714         (if_then_else
1715          (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1716                               (const_int 1)
1717                               (match_operand:SI 1 "uint5_operand" ""))
1718              (const_int 0))
1719          (label_ref (match_operand 2 "" ""))
1720          (pc)))]
1721   ""
1722   "*
1724   return pa_output_bb (operands, 0, insn, 1);
1726 [(set_attr "type" "cbranch")
1727  (set (attr "length")
1728     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1729                (const_int MAX_12BIT_OFFSET))
1730            (const_int 4)
1731            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1732                (const_int MAX_17BIT_OFFSET))
1733            (const_int 8)
1734            (match_test "TARGET_PORTABLE_RUNTIME")
1735            (const_int 24)
1736            (not (match_test "flag_pic"))
1737            (const_int 20)]
1738           (const_int 28)))])
1740 (define_insn ""
1741   [(set (pc)
1742         (if_then_else
1743          (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1744                               (const_int 1)
1745                               (match_operand:DI 1 "uint32_operand" ""))
1746              (const_int 0))
1747          (label_ref (match_operand 2 "" ""))
1748          (pc)))]
1749   "TARGET_64BIT"
1750   "*
1752   return pa_output_bb (operands, 0, insn, 1);
1754 [(set_attr "type" "cbranch")
1755  (set (attr "length")
1756     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1757                (const_int MAX_12BIT_OFFSET))
1758            (const_int 4)
1759            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1760                (const_int MAX_17BIT_OFFSET))
1761            (const_int 8)
1762            (match_test "TARGET_PORTABLE_RUNTIME")
1763            (const_int 24)
1764            (not (match_test "flag_pic"))
1765            (const_int 20)]
1766           (const_int 28)))])
1768 (define_insn ""
1769   [(set (pc)
1770         (if_then_else
1771          (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1772                               (const_int 1)
1773                               (match_operand:SI 1 "uint5_operand" ""))
1774              (const_int 0))
1775          (pc)
1776          (label_ref (match_operand 2 "" ""))))]
1777   ""
1778   "*
1780   return pa_output_bb (operands, 1, insn, 1);
1782 [(set_attr "type" "cbranch")
1783  (set (attr "length")
1784     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1785                (const_int MAX_12BIT_OFFSET))
1786            (const_int 4)
1787            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1788                (const_int MAX_17BIT_OFFSET))
1789            (const_int 8)
1790            (match_test "TARGET_PORTABLE_RUNTIME")
1791            (const_int 24)
1792            (not (match_test "flag_pic"))
1793            (const_int 20)]
1794           (const_int 28)))])
1796 (define_insn ""
1797   [(set (pc)
1798         (if_then_else
1799          (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1800                               (const_int 1)
1801                               (match_operand:DI 1 "uint32_operand" ""))
1802              (const_int 0))
1803          (pc)
1804          (label_ref (match_operand 2 "" ""))))]
1805   "TARGET_64BIT"
1806   "*
1808   return pa_output_bb (operands, 1, insn, 1);
1810 [(set_attr "type" "cbranch")
1811  (set (attr "length")
1812     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1813                (const_int MAX_12BIT_OFFSET))
1814            (const_int 4)
1815            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1816                (const_int MAX_17BIT_OFFSET))
1817            (const_int 8)
1818            (match_test "TARGET_PORTABLE_RUNTIME")
1819            (const_int 24)
1820            (not (match_test "flag_pic"))
1821            (const_int 20)]
1822           (const_int 28)))])
1824 ;; Branch on Variable Bit patterns.
1825 (define_insn ""
1826   [(set (pc)
1827         (if_then_else
1828          (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1829                               (const_int 1)
1830                               (match_operand:SI 1 "register_operand" "q"))
1831              (const_int 0))
1832          (label_ref (match_operand 2 "" ""))
1833          (pc)))]
1834   ""
1835   "*
1837   return pa_output_bvb (operands, 0, insn, 0);
1839 [(set_attr "type" "cbranch")
1840  (set (attr "length")
1841     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1842                (const_int MAX_12BIT_OFFSET))
1843            (const_int 4)
1844            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1845                (const_int MAX_17BIT_OFFSET))
1846            (const_int 8)
1847            (match_test "TARGET_PORTABLE_RUNTIME")
1848            (const_int 24)
1849            (not (match_test "flag_pic"))
1850            (const_int 20)]
1851           (const_int 28)))])
1853 (define_insn ""
1854   [(set (pc)
1855         (if_then_else
1856          (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1857                               (const_int 1)
1858                               (match_operand:DI 1 "register_operand" "q"))
1859              (const_int 0))
1860          (label_ref (match_operand 2 "" ""))
1861          (pc)))]
1862   "TARGET_64BIT"
1863   "*
1865   return pa_output_bvb (operands, 0, insn, 0);
1867 [(set_attr "type" "cbranch")
1868  (set (attr "length")
1869     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1870                (const_int MAX_12BIT_OFFSET))
1871            (const_int 4)
1872            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1873                (const_int MAX_17BIT_OFFSET))
1874            (const_int 8)
1875            (match_test "TARGET_PORTABLE_RUNTIME")
1876            (const_int 24)
1877            (not (match_test "flag_pic"))
1878            (const_int 20)]
1879           (const_int 28)))])
1881 (define_insn ""
1882   [(set (pc)
1883         (if_then_else
1884          (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1885                               (const_int 1)
1886                               (match_operand:SI 1 "register_operand" "q"))
1887              (const_int 0))
1888          (pc)
1889          (label_ref (match_operand 2 "" ""))))]
1890   ""
1891   "*
1893   return pa_output_bvb (operands, 1, insn, 0);
1895 [(set_attr "type" "cbranch")
1896  (set (attr "length")
1897     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1898                (const_int MAX_12BIT_OFFSET))
1899            (const_int 4)
1900            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1901                (const_int MAX_17BIT_OFFSET))
1902            (const_int 8)
1903            (match_test "TARGET_PORTABLE_RUNTIME")
1904            (const_int 24)
1905            (not (match_test "flag_pic"))
1906            (const_int 20)]
1907           (const_int 28)))])
1909 (define_insn ""
1910   [(set (pc)
1911         (if_then_else
1912          (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1913                               (const_int 1)
1914                               (match_operand:DI 1 "register_operand" "q"))
1915              (const_int 0))
1916          (pc)
1917          (label_ref (match_operand 2 "" ""))))]
1918   "TARGET_64BIT"
1919   "*
1921   return pa_output_bvb (operands, 1, insn, 0);
1923 [(set_attr "type" "cbranch")
1924  (set (attr "length")
1925     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1926                (const_int MAX_12BIT_OFFSET))
1927            (const_int 4)
1928            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1929                (const_int MAX_17BIT_OFFSET))
1930            (const_int 8)
1931            (match_test "TARGET_PORTABLE_RUNTIME")
1932            (const_int 24)
1933            (not (match_test "flag_pic"))
1934            (const_int 20)]
1935           (const_int 28)))])
1937 (define_insn ""
1938   [(set (pc)
1939         (if_then_else
1940          (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1941                               (const_int 1)
1942                               (match_operand:SI 1 "register_operand" "q"))
1943              (const_int 0))
1944          (label_ref (match_operand 2 "" ""))
1945          (pc)))]
1946   ""
1947   "*
1949   return pa_output_bvb (operands, 0, insn, 1);
1951 [(set_attr "type" "cbranch")
1952  (set (attr "length")
1953     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1954                (const_int MAX_12BIT_OFFSET))
1955            (const_int 4)
1956            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1957                (const_int MAX_17BIT_OFFSET))
1958            (const_int 8)
1959            (match_test "TARGET_PORTABLE_RUNTIME")
1960            (const_int 24)
1961            (not (match_test "flag_pic"))
1962            (const_int 20)]
1963           (const_int 28)))])
1965 (define_insn ""
1966   [(set (pc)
1967         (if_then_else
1968          (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1969                               (const_int 1)
1970                               (match_operand:DI 1 "register_operand" "q"))
1971              (const_int 0))
1972          (label_ref (match_operand 2 "" ""))
1973          (pc)))]
1974   "TARGET_64BIT"
1975   "*
1977   return pa_output_bvb (operands, 0, insn, 1);
1979 [(set_attr "type" "cbranch")
1980  (set (attr "length")
1981     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1982                (const_int MAX_12BIT_OFFSET))
1983            (const_int 4)
1984            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1985                (const_int MAX_17BIT_OFFSET))
1986            (const_int 8)
1987            (match_test "TARGET_PORTABLE_RUNTIME")
1988            (const_int 24)
1989            (not (match_test "flag_pic"))
1990            (const_int 20)]
1991           (const_int 28)))])
1993 (define_insn ""
1994   [(set (pc)
1995         (if_then_else
1996          (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1997                               (const_int 1)
1998                               (match_operand:SI 1 "register_operand" "q"))
1999              (const_int 0))
2000          (pc)
2001          (label_ref (match_operand 2 "" ""))))]
2002   ""
2003   "*
2005   return pa_output_bvb (operands, 1, insn, 1);
2007 [(set_attr "type" "cbranch")
2008  (set (attr "length")
2009     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2010                (const_int MAX_12BIT_OFFSET))
2011            (const_int 4)
2012            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2013                (const_int MAX_17BIT_OFFSET))
2014            (const_int 8)
2015            (match_test "TARGET_PORTABLE_RUNTIME")
2016            (const_int 24)
2017            (not (match_test "flag_pic"))
2018            (const_int 20)]
2019           (const_int 28)))])
2021 (define_insn ""
2022   [(set (pc)
2023         (if_then_else
2024          (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2025                               (const_int 1)
2026                               (match_operand:DI 1 "register_operand" "q"))
2027              (const_int 0))
2028          (pc)
2029          (label_ref (match_operand 2 "" ""))))]
2030   "TARGET_64BIT"
2031   "*
2033   return pa_output_bvb (operands, 1, insn, 1);
2035 [(set_attr "type" "cbranch")
2036  (set (attr "length")
2037     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2038                (const_int MAX_12BIT_OFFSET))
2039            (const_int 4)
2040            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2041                (const_int MAX_17BIT_OFFSET))
2042            (const_int 8)
2043            (match_test "TARGET_PORTABLE_RUNTIME")
2044            (const_int 24)
2045            (not (match_test "flag_pic"))
2046            (const_int 20)]
2047           (const_int 28)))])
2049 ;; Floating point branches
2051 ;; ??? Nullification is handled differently from other branches.
2052 ;; If nullification is specified, the delay slot is nullified on any
2053 ;; taken branch regardless of branch direction.
2054 (define_insn ""
2055   [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2056                            (label_ref (match_operand 0 "" ""))
2057                            (pc)))]
2058   "!TARGET_SOFT_FLOAT"
2059   "*
2061   int length = get_attr_length (insn);
2062   rtx xoperands[1];
2063   int nullify, xdelay;
2065   if (length < 16)
2066     return \"ftest\;b%* %l0\";
2068   if (dbr_sequence_length () == 0 || INSN_ANNULLED_BRANCH_P (insn))
2069     {
2070       nullify = 1;
2071       xdelay = 0;
2072       xoperands[0] = GEN_INT (length - 8);
2073     }
2074   else
2075     {
2076       nullify = 0;
2077       xdelay = 1;
2078       xoperands[0] = GEN_INT (length - 4);
2079     }
2081   if (nullify)
2082     output_asm_insn (\"ftest\;add,tr %%r0,%%r0,%%r0\;b,n .+%0\", xoperands);
2083   else
2084     output_asm_insn (\"ftest\;add,tr %%r0,%%r0,%%r0\;b .+%0\", xoperands);
2085   return pa_output_lbranch (operands[0], insn, xdelay);
2087 [(set_attr "type" "fbranch")
2088  (set (attr "length")
2089     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
2090                (const_int MAX_17BIT_OFFSET))
2091            (const_int 8)
2092            (match_test "TARGET_PORTABLE_RUNTIME")
2093            (const_int 32)
2094            (not (match_test "flag_pic"))
2095            (const_int 28)]
2096           (const_int 36)))])
2098 (define_insn ""
2099   [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2100                            (pc)
2101                            (label_ref (match_operand 0 "" ""))))]
2102   "!TARGET_SOFT_FLOAT"
2103   "*
2105   int length = get_attr_length (insn);
2106   rtx xoperands[1];
2107   int nullify, xdelay;
2109   if (length < 16)
2110     return \"ftest\;add,tr %%r0,%%r0,%%r0\;b%* %0\";
2112   if (dbr_sequence_length () == 0 || INSN_ANNULLED_BRANCH_P (insn))
2113     {
2114       nullify = 1;
2115       xdelay = 0;
2116       xoperands[0] = GEN_INT (length - 4);
2117     }
2118   else
2119     {
2120       nullify = 0;
2121       xdelay = 1;
2122       xoperands[0] = GEN_INT (length);
2123     }
2125   if (nullify)
2126     output_asm_insn (\"ftest\;b,n .+%0\", xoperands);
2127   else
2128     output_asm_insn (\"ftest\;b .+%0\", xoperands);
2129   return pa_output_lbranch (operands[0], insn, xdelay);
2131 [(set_attr "type" "fbranch")
2132  (set (attr "length")
2133     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
2134                (const_int MAX_17BIT_OFFSET))
2135            (const_int 12)
2136            (match_test "TARGET_PORTABLE_RUNTIME")
2137            (const_int 28)
2138            (not (match_test "flag_pic"))
2139            (const_int 24)]
2140           (const_int 32)))])
2142 ;; Move instructions
2144 (define_expand "movsi"
2145   [(set (match_operand:SI 0 "general_operand" "")
2146         (match_operand:SI 1 "general_operand" ""))]
2147   ""
2148   "
2150   if (pa_emit_move_sequence (operands, SImode, 0))
2151     DONE;
2154 ;; Handle SImode input reloads requiring %r1 as a scratch register.
2155 (define_expand "reload_insi_r1"
2156   [(set (match_operand:SI 0 "register_operand" "=Z")
2157         (match_operand:SI 1 "non_hard_reg_operand" ""))
2158    (clobber (match_operand:SI 2 "register_operand" "=&a"))]
2159   ""
2160   "
2162   if (pa_emit_move_sequence (operands, SImode, operands[2]))
2163     DONE;
2165   /* We don't want the clobber emitted, so handle this ourselves.  */
2166   emit_insn (gen_rtx_SET (operands[0], operands[1]));
2167   DONE;
2170 ;; Handle SImode input reloads requiring a general register as a
2171 ;; scratch register.
2172 (define_expand "reload_insi"
2173   [(set (match_operand:SI 0 "register_operand" "=Z")
2174         (match_operand:SI 1 "non_hard_reg_operand" ""))
2175    (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2176   ""
2177   "
2179   if (pa_emit_move_sequence (operands, SImode, operands[2]))
2180     DONE;
2182   /* We don't want the clobber emitted, so handle this ourselves.  */
2183   emit_insn (gen_rtx_SET (operands[0], operands[1]));
2184   DONE;
2187 ;; Handle SImode output reloads requiring a general register as a
2188 ;; scratch register.
2189 (define_expand "reload_outsi"
2190   [(set (match_operand:SI 0 "non_hard_reg_operand" "")
2191         (match_operand:SI 1  "register_operand" "Z"))
2192    (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2193   ""
2194   "
2196   if (pa_emit_move_sequence (operands, SImode, operands[2]))
2197     DONE;
2199   /* We don't want the clobber emitted, so handle this ourselves.  */
2200   emit_insn (gen_rtx_SET (operands[0], operands[1]));
2201   DONE;
2204 (define_insn ""
2205   [(set (match_operand:SI 0 "move_dest_operand"
2206                           "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T,?r,?*f")
2207         (match_operand:SI 1 "move_src_operand"
2208                           "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f,*f,r"))]
2209   "(register_operand (operands[0], SImode)
2210     || reg_or_0_operand (operands[1], SImode))
2211    && !TARGET_SOFT_FLOAT
2212    && !TARGET_64BIT"
2213   "@
2214    ldw RT'%A1,%0
2215    copy %1,%0
2216    ldi %1,%0
2217    ldil L'%1,%0
2218    {zdepi|depwi,z} %Z1,%0
2219    ldw%M1 %1,%0
2220    stw%M0 %r1,%0
2221    mtsar %r1
2222    {mfctl|mfctl,w} %%sar,%0
2223    fcpy,sgl %f1,%0
2224    fldw%F1 %1,%0
2225    fstw%F0 %1,%0
2226    {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
2227    {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
2228   [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore,fpstore_load,store_fpload")
2229    (set_attr "pa_combine_type" "addmove")
2230    (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,8,8")])
2232 (define_insn ""
2233   [(set (match_operand:SI 0 "move_dest_operand"
2234                           "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
2235         (match_operand:SI 1 "move_src_operand"
2236                           "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
2237   "(register_operand (operands[0], SImode)
2238     || reg_or_0_operand (operands[1], SImode))
2239    && !TARGET_SOFT_FLOAT
2240    && TARGET_64BIT"
2241   "@
2242    ldw RT'%A1,%0
2243    copy %1,%0
2244    ldi %1,%0
2245    ldil L'%1,%0
2246    {zdepi|depwi,z} %Z1,%0
2247    ldw%M1 %1,%0
2248    stw%M0 %r1,%0
2249    mtsar %r1
2250    {mfctl|mfctl,w} %%sar,%0
2251    fcpy,sgl %f1,%0
2252    fldw%F1 %1,%0
2253    fstw%F0 %1,%0"
2254   [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
2255    (set_attr "pa_combine_type" "addmove")
2256    (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
2258 (define_insn ""
2259   [(set (match_operand:SI 0 "indexed_memory_operand" "=R")
2260         (match_operand:SI 1 "register_operand" "f"))]
2261   "!TARGET_SOFT_FLOAT
2262    && !TARGET_DISABLE_INDEXING
2263    && reload_completed"
2264   "fstw%F0 %1,%0"
2265   [(set_attr "type" "fpstore")
2266    (set_attr "pa_combine_type" "addmove")
2267    (set_attr "length" "4")])
2269 ; Rewrite RTL using an indexed store.  This will allow the insn that
2270 ; computes the address to be deleted if the register it sets is dead.
2271 (define_peephole2
2272   [(set (match_operand:SI 0 "register_operand" "")
2273         (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
2274                           (const_int 4))
2275                  (match_operand:SI 2 "register_operand" "")))
2276    (set (mem:SI (match_dup 0))
2277         (match_operand:SI 3 "register_operand" ""))]
2278   "!TARGET_SOFT_FLOAT
2279    && !TARGET_DISABLE_INDEXING
2280    && REG_OK_FOR_BASE_P (operands[2])
2281    && FP_REGNO_P (REGNO (operands[3]))"
2282   [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2283         (match_dup 3))
2284    (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
2285                                (match_dup 2)))]
2286   "")
2288 (define_peephole2
2289   [(set (match_operand:SI 0 "register_operand" "")
2290         (plus:SI (match_operand:SI 2 "register_operand" "")
2291                  (mult:SI (match_operand:SI 1 "register_operand" "")
2292                           (const_int 4))))
2293    (set (mem:SI (match_dup 0))
2294         (match_operand:SI 3 "register_operand" ""))]
2295   "!TARGET_SOFT_FLOAT
2296    && !TARGET_DISABLE_INDEXING
2297    && REG_OK_FOR_BASE_P (operands[2])
2298    && FP_REGNO_P (REGNO (operands[3]))"
2299   [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2300         (match_dup 3))
2301    (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
2302                                (match_dup 2)))]
2303   "")
2305 (define_peephole2
2306   [(set (match_operand:DI 0 "register_operand" "")
2307         (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2308                           (const_int 4))
2309                  (match_operand:DI 2 "register_operand" "")))
2310    (set (mem:SI (match_dup 0))
2311         (match_operand:SI 3 "register_operand" ""))]
2312   "!TARGET_SOFT_FLOAT
2313    && !TARGET_DISABLE_INDEXING
2314    && TARGET_64BIT
2315    && REG_OK_FOR_BASE_P (operands[2])
2316    && FP_REGNO_P (REGNO (operands[3]))"
2317   [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2318         (match_dup 3))
2319    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
2320                                (match_dup 2)))]
2321   "")
2323 (define_peephole2
2324   [(set (match_operand:DI 0 "register_operand" "")
2325         (plus:DI (match_operand:DI 2 "register_operand" "")
2326                  (mult:DI (match_operand:DI 1 "register_operand" "")
2327                           (const_int 4))))
2328    (set (mem:SI (match_dup 0))
2329         (match_operand:SI 3 "register_operand" ""))]
2330   "!TARGET_SOFT_FLOAT
2331    && !TARGET_DISABLE_INDEXING
2332    && TARGET_64BIT
2333    && REG_OK_FOR_BASE_P (operands[2])
2334    && FP_REGNO_P (REGNO (operands[3]))"
2335   [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2336         (match_dup 3))
2337    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
2338                                (match_dup 2)))]
2339   "")
2341 (define_peephole2
2342   [(set (match_operand:SI 0 "register_operand" "")
2343         (plus:SI (match_operand:SI 1 "register_operand" "")
2344                  (match_operand:SI 2 "register_operand" "")))
2345    (set (mem:SI (match_dup 0))
2346         (match_operand:SI 3 "register_operand" ""))]
2347   "!TARGET_SOFT_FLOAT
2348    && !TARGET_DISABLE_INDEXING
2349    && TARGET_NO_SPACE_REGS
2350    && REG_OK_FOR_INDEX_P (operands[1])
2351    && REG_OK_FOR_BASE_P (operands[2])
2352    && FP_REGNO_P (REGNO (operands[3]))"
2353   [(set (mem:SI (plus:SI (match_dup 1) (match_dup 2)))
2354         (match_dup 3))
2355    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2356   "")
2358 (define_peephole2
2359   [(set (match_operand:SI 0 "register_operand" "")
2360         (plus:SI (match_operand:SI 1 "register_operand" "")
2361                  (match_operand:SI 2 "register_operand" "")))
2362    (set (mem:SI (match_dup 0))
2363         (match_operand:SI 3 "register_operand" ""))]
2364   "!TARGET_SOFT_FLOAT
2365    && !TARGET_DISABLE_INDEXING
2366    && TARGET_NO_SPACE_REGS
2367    && REG_OK_FOR_BASE_P (operands[1])
2368    && REG_OK_FOR_INDEX_P (operands[2])
2369    && FP_REGNO_P (REGNO (operands[3]))"
2370   [(set (mem:SI (plus:SI (match_dup 2) (match_dup 1)))
2371         (match_dup 3))
2372    (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
2373   "")
2375 (define_peephole2
2376   [(set (match_operand:DI 0 "register_operand" "")
2377         (plus:DI (match_operand:DI 1 "register_operand" "")
2378                  (match_operand:DI 2 "register_operand" "")))
2379    (set (mem:SI (match_dup 0))
2380         (match_operand:SI 3 "register_operand" ""))]
2381   "!TARGET_SOFT_FLOAT
2382    && !TARGET_DISABLE_INDEXING
2383    && TARGET_64BIT
2384    && TARGET_NO_SPACE_REGS
2385    && REG_OK_FOR_INDEX_P (operands[1])
2386    && REG_OK_FOR_BASE_P (operands[2])
2387    && FP_REGNO_P (REGNO (operands[3]))"
2388   [(set (mem:SI (plus:DI (match_dup 1) (match_dup 2)))
2389         (match_dup 3))
2390    (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
2391   "")
2393 (define_peephole2
2394   [(set (match_operand:DI 0 "register_operand" "")
2395         (plus:DI (match_operand:DI 1 "register_operand" "")
2396                  (match_operand:DI 2 "register_operand" "")))
2397    (set (mem:SI (match_dup 0))
2398         (match_operand:SI 3 "register_operand" ""))]
2399   "!TARGET_SOFT_FLOAT
2400    && !TARGET_DISABLE_INDEXING
2401    && TARGET_64BIT
2402    && TARGET_NO_SPACE_REGS
2403    && REG_OK_FOR_BASE_P (operands[1])
2404    && REG_OK_FOR_INDEX_P (operands[2])
2405    && FP_REGNO_P (REGNO (operands[3]))"
2406   [(set (mem:SI (plus:DI (match_dup 2) (match_dup 1)))
2407         (match_dup 3))
2408    (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
2409   "")
2411 (define_insn ""
2412   [(set (match_operand:SI 0 "move_dest_operand"
2413                           "=r,r,r,r,r,r,Q,!*q,!r")
2414         (match_operand:SI 1 "move_src_operand"
2415                           "A,r,J,N,K,RQ,rM,!rM,!*q"))]
2416   "(register_operand (operands[0], SImode)
2417     || reg_or_0_operand (operands[1], SImode))
2418    && TARGET_SOFT_FLOAT"
2419   "@
2420    ldw RT'%A1,%0
2421    copy %1,%0
2422    ldi %1,%0
2423    ldil L'%1,%0
2424    {zdepi|depwi,z} %Z1,%0
2425    ldw%M1 %1,%0
2426    stw%M0 %r1,%0
2427    mtsar %r1
2428    {mfctl|mfctl,w} %%sar,%0"
2429   [(set_attr "type" "load,move,move,move,move,load,store,move,move")
2430    (set_attr "pa_combine_type" "addmove")
2431    (set_attr "length" "4,4,4,4,4,4,4,4,4")])
2433 ;; Load or store with base-register modification.
2434 (define_insn ""
2435   [(set (match_operand:SI 0 "register_operand" "=r")
2436         (mem:SI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2437                          (match_operand:DI 2 "int5_operand" "L"))))
2438    (set (match_dup 1)
2439         (plus:DI (match_dup 1) (match_dup 2)))]
2440   "TARGET_64BIT"
2441   "ldw,mb %2(%1),%0"
2442   [(set_attr "type" "load")
2443    (set_attr "length" "4")])
2445 ; And a zero extended variant.
2446 (define_insn ""
2447   [(set (match_operand:DI 0 "register_operand" "=r")
2448         (zero_extend:DI (mem:SI
2449                           (plus:DI
2450                             (match_operand:DI 1 "register_operand" "+r")
2451                             (match_operand:DI 2 "int5_operand" "L")))))
2452    (set (match_dup 1)
2453         (plus:DI (match_dup 1) (match_dup 2)))]
2454   "TARGET_64BIT"
2455   "ldw,mb %2(%1),%0"
2456   [(set_attr "type" "load")
2457    (set_attr "length" "4")])
2459 (define_expand "pre_load"
2460   [(parallel [(set (match_operand:SI 0 "register_operand" "")
2461               (mem (plus (match_operand 1 "register_operand" "")
2462                                (match_operand 2 "pre_cint_operand" ""))))
2463               (set (match_dup 1)
2464                    (plus (match_dup 1) (match_dup 2)))])]
2465   ""
2466   "
2468   if (TARGET_64BIT)
2469     {
2470       emit_insn (gen_pre_ldd (operands[0], operands[1], operands[2]));
2471       DONE;
2472     }
2473   emit_insn (gen_pre_ldw (operands[0], operands[1], operands[2]));
2474   DONE;
2477 (define_insn "pre_ldw"
2478   [(set (match_operand:SI 0 "register_operand" "=r")
2479         (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2480                          (match_operand:SI 2 "pre_cint_operand" ""))))
2481    (set (match_dup 1)
2482         (plus:SI (match_dup 1) (match_dup 2)))]
2483   ""
2484   "*
2486   if (INTVAL (operands[2]) < 0)
2487     return \"{ldwm|ldw,mb} %2(%1),%0\";
2488   return \"{ldws|ldw},mb %2(%1),%0\";
2490   [(set_attr "type" "load")
2491    (set_attr "length" "4")])
2493 (define_insn "pre_ldd"
2494   [(set (match_operand:DI 0 "register_operand" "=r")
2495         (mem:DI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2496                          (match_operand:DI 2 "pre_cint_operand" ""))))
2497    (set (match_dup 1)
2498         (plus:DI (match_dup 1) (match_dup 2)))]
2499   "TARGET_64BIT"
2500   "ldd,mb %2(%1),%0"
2501   [(set_attr "type" "load")
2502    (set_attr "length" "4")])
2504 (define_insn ""
2505   [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2506                          (match_operand:SI 1 "pre_cint_operand" "")))
2507         (match_operand:SI 2 "reg_or_0_operand" "rM"))
2508    (set (match_dup 0)
2509         (plus:SI (match_dup 0) (match_dup 1)))]
2510   ""
2511   "*
2513   if (INTVAL (operands[1]) < 0)
2514     return \"{stwm|stw,mb} %r2,%1(%0)\";
2515   return \"{stws|stw},mb %r2,%1(%0)\";
2517   [(set_attr "type" "store")
2518    (set_attr "length" "4")])
2520 (define_insn ""
2521   [(set (match_operand:SI 0 "register_operand" "=r")
2522         (mem:SI (match_operand:SI 1 "register_operand" "+r")))
2523    (set (match_dup 1)
2524         (plus:SI (match_dup 1)
2525                  (match_operand:SI 2 "post_cint_operand" "")))]
2526   ""
2527   "*
2529   if (INTVAL (operands[2]) > 0)
2530     return \"{ldwm|ldw,ma} %2(%1),%0\";
2531   return \"{ldws|ldw},ma %2(%1),%0\";
2533   [(set_attr "type" "load")
2534    (set_attr "length" "4")])
2536 (define_expand "post_store"
2537   [(parallel [(set (mem (match_operand 0 "register_operand" ""))
2538                    (match_operand 1 "reg_or_0_operand" ""))
2539               (set (match_dup 0)
2540                    (plus (match_dup 0)
2541                          (match_operand 2 "post_cint_operand" "")))])]
2542   ""
2543   "
2545   if (TARGET_64BIT)
2546     {
2547       emit_insn (gen_post_std (operands[0], operands[1], operands[2]));
2548       DONE;
2549     }
2550   emit_insn (gen_post_stw (operands[0], operands[1], operands[2]));
2551   DONE;
2554 (define_insn "post_stw"
2555   [(set (mem:SI (match_operand:SI 0 "register_operand" "+r"))
2556         (match_operand:SI 1 "reg_or_0_operand" "rM"))
2557    (set (match_dup 0)
2558         (plus:SI (match_dup 0)
2559                  (match_operand:SI 2 "post_cint_operand" "")))]
2560   ""
2561   "*
2563   if (INTVAL (operands[2]) > 0)
2564     return \"{stwm|stw,ma} %r1,%2(%0)\";
2565   return \"{stws|stw},ma %r1,%2(%0)\";
2567   [(set_attr "type" "store")
2568    (set_attr "length" "4")])
2570 (define_insn "post_std"
2571   [(set (mem:DI (match_operand:DI 0 "register_operand" "+r"))
2572         (match_operand:DI 1 "reg_or_0_operand" "rM"))
2573    (set (match_dup 0)
2574         (plus:DI (match_dup 0)
2575                  (match_operand:DI 2 "post_cint_operand" "")))]
2576   "TARGET_64BIT"
2577   "std,ma %r1,%2(%0)"
2578   [(set_attr "type" "store")
2579    (set_attr "length" "4")])
2581 ;; For loading the address of a label while generating PIC code.
2582 ;; Note since this pattern can be created at reload time (via movsi), all
2583 ;; the same rules for movsi apply here.  (no new pseudos, no temporaries).
2584 (define_insn ""
2585   [(set (match_operand 0 "pmode_register_operand" "=a")
2586         (match_operand 1 "pic_label_operand" ""))]
2587   "TARGET_PA_20"
2588   "*
2590   rtx xoperands[3];
2592   xoperands[0] = operands[0];
2593   xoperands[1] = operands[1];
2594   xoperands[2] = gen_label_rtx ();
2596   (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2597                                      CODE_LABEL_NUMBER (xoperands[2]));
2598   output_asm_insn (\"mfia %0\", xoperands);
2600   /* If we're trying to load the address of a label that happens to be
2601      close, then we can use a shorter sequence.  */
2602   if (GET_CODE (operands[1]) == LABEL_REF
2603       && !LABEL_REF_NONLOCAL_P (operands[1])
2604       && INSN_ADDRESSES_SET_P ()
2605       && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2606                 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2607     output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2608   else
2609     {
2610       output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2611       output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2612     }
2613   return \"\";
2615   [(set_attr "type" "multi")
2616    (set_attr "length" "12")])           ; 8 or 12
2618 (define_insn ""
2619   [(set (match_operand 0 "pmode_register_operand" "=a")
2620         (match_operand 1 "pic_label_operand" ""))]
2621   "!TARGET_PA_20"
2622   "*
2624   rtx xoperands[3];
2626   xoperands[0] = operands[0];
2627   xoperands[1] = operands[1];
2628   xoperands[2] = gen_label_rtx ();
2630   output_asm_insn (\"bl .+8,%0\", xoperands);
2631   output_asm_insn (\"depi 0,31,2,%0\", xoperands);
2632   (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2633                                      CODE_LABEL_NUMBER (xoperands[2]));
2635   /* If we're trying to load the address of a label that happens to be
2636      close, then we can use a shorter sequence.  */
2637   if (GET_CODE (operands[1]) == LABEL_REF
2638       && !LABEL_REF_NONLOCAL_P (operands[1])
2639       && INSN_ADDRESSES_SET_P ()
2640       && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2641                 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2642     output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2643   else
2644     {
2645       output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2646       output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2647     }
2648   return \"\";
2650   [(set_attr "type" "multi")
2651    (set_attr "length" "16")])           ; 12 or 16
2653 (define_insn ""
2654   [(set (match_operand:SI 0 "register_operand" "=a")
2655         (plus:SI (match_operand:SI 1 "register_operand" "r")
2656                  (high:SI (match_operand 2 "" ""))))]
2657   "symbolic_operand (operands[2], Pmode)
2658    && ! function_label_operand (operands[2], Pmode)
2659    && flag_pic"
2660   "addil LT'%G2,%1"
2661   [(set_attr "type" "binary")
2662    (set_attr "length" "4")])
2664 (define_insn ""
2665   [(set (match_operand:DI 0 "register_operand" "=a")
2666         (plus:DI (match_operand:DI 1 "register_operand" "r")
2667                  (high:DI (match_operand 2 "" ""))))]
2668   "symbolic_operand (operands[2], Pmode)
2669    && ! function_label_operand (operands[2], Pmode)
2670    && TARGET_64BIT
2671    && flag_pic"
2672   "addil LT'%G2,%1"
2673   [(set_attr "type" "binary")
2674    (set_attr "length" "4")])
2676 (define_insn ""
2677  [(set (match_operand:SI 0 "register_operand" "=r")
2678        (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2679                   (unspec:SI [(match_operand 2 "" "")] UNSPEC_DLTIND14R)))]
2680   "symbolic_operand (operands[2], Pmode)
2681    && ! function_label_operand (operands[2], Pmode)
2682    && flag_pic"
2683   "ldo RT'%G2(%1),%0"
2684   [(set_attr "type" "binary")
2685    (set_attr "length" "4")])
2687 (define_insn ""
2688  [(set (match_operand:DI 0 "register_operand" "=r")
2689        (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2690                   (unspec:DI [(match_operand 2 "" "")] UNSPEC_DLTIND14R)))]
2691   "symbolic_operand (operands[2], Pmode)
2692    && ! function_label_operand (operands[2], Pmode)
2693    && TARGET_64BIT
2694    && flag_pic"
2695   "ldo RT'%G2(%1),%0"
2696   [(set_attr "type" "binary")
2697    (set_attr "length" "4")])
2699 ;; Always use addil rather than ldil;add sequences.  This allows the
2700 ;; HP linker to eliminate the dp relocation if the symbolic operand
2701 ;; lives in the TEXT space.
2702 (define_insn ""
2703   [(set (match_operand:SI 0 "register_operand" "=a")
2704         (high:SI (match_operand 1 "" "")))]
2705   "symbolic_operand (operands[1], Pmode)
2706    && ! function_label_operand (operands[1], Pmode)
2707    && ! read_only_operand (operands[1], Pmode)
2708    && ! flag_pic"
2709   "*
2711   if (TARGET_LONG_LOAD_STORE)
2712     return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
2713   else
2714     return \"addil LR'%H1,%%r27\";
2716   [(set_attr "type" "binary")
2717    (set (attr "length")
2718       (if_then_else (not (match_test "TARGET_LONG_LOAD_STORE"))
2719                     (const_int 4)
2720                     (const_int 8)))])
2723 ;; This is for use in the prologue/epilogue code.  We need it
2724 ;; to add large constants to a stack pointer or frame pointer.
2725 ;; Because of the additional %r1 pressure, we probably do not
2726 ;; want to use this in general code, so make it available
2727 ;; only after reload.
2728 (define_insn ""
2729   [(set (match_operand:SI 0 "register_operand" "=!a,*r")
2730         (plus:SI (match_operand:SI 1 "register_operand" "r,r")
2731                  (high:SI (match_operand 2 "const_int_operand" ""))))]
2732   "reload_completed"
2733   "@
2734    addil L'%G2,%1
2735    ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2736   [(set_attr "type" "binary,binary")
2737    (set_attr "length" "4,8")])
2739 (define_insn ""
2740   [(set (match_operand:DI 0 "register_operand" "=!a,*r")
2741         (plus:DI (match_operand:DI 1 "register_operand" "r,r")
2742                  (high:DI (match_operand 2 "const_int_operand" ""))))]
2743   "reload_completed && TARGET_64BIT"
2744   "@
2745    addil L'%G2,%1
2746    ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2747   [(set_attr "type" "binary,binary")
2748    (set_attr "length" "4,8")])
2750 (define_insn ""
2751   [(set (match_operand:SI 0 "register_operand" "=r")
2752         (high:SI (match_operand 1 "" "")))]
2753   "(!flag_pic || !symbolic_operand (operands[1], Pmode))
2754     && !pa_is_function_label_plus_const (operands[1])"
2755   "*
2757   if (symbolic_operand (operands[1], Pmode))
2758     return \"ldil LR'%H1,%0\";
2759   else
2760     return \"ldil L'%G1,%0\";
2762   [(set_attr "type" "move")
2763    (set_attr "length" "4")])
2765 (define_insn ""
2766   [(set (match_operand:DI 0 "register_operand" "=r")
2767         (high:DI (match_operand 1 "const_int_operand" "")))]
2768   "TARGET_64BIT"
2769   "ldil L'%G1,%0";
2770   [(set_attr "type" "move")
2771    (set_attr "length" "4")])
2773 (define_insn ""
2774   [(set (match_operand:DI 0 "register_operand" "=r")
2775         (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2776                    (match_operand:DI 2 "const_int_operand" "i")))]
2777   "TARGET_64BIT"
2778   "ldo R'%G2(%1),%0";
2779   [(set_attr "type" "move")
2780    (set_attr "length" "4")])
2782 (define_insn ""
2783   [(set (match_operand:SI 0 "register_operand" "=r")
2784         (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2785                    (match_operand:SI 2 "immediate_operand" "i")))]
2786   "!pa_is_function_label_plus_const (operands[2])"
2787   "*
2789   gcc_assert (!flag_pic || !symbolic_operand (operands[2], Pmode));
2790   
2791   if (symbolic_operand (operands[2], Pmode))
2792     return \"ldo RR'%G2(%1),%0\";
2793   else
2794     return \"ldo R'%G2(%1),%0\";
2796   [(set_attr "type" "move")
2797    (set_attr "length" "4")])
2799 ;; Now that a symbolic_address plus a constant is broken up early
2800 ;; in the compilation phase (for better CSE) we need a special
2801 ;; combiner pattern to load the symbolic address plus the constant
2802 ;; in only 2 instructions. (For cases where the symbolic address
2803 ;; was not a common subexpression.)
2804 (define_split
2805   [(set (match_operand:SI 0 "register_operand" "")
2806         (match_operand:SI 1 "symbolic_operand" ""))
2807    (clobber (match_operand:SI 2 "register_operand" ""))]
2808   "! (flag_pic && pic_label_operand (operands[1], SImode))"
2809   [(set (match_dup 2) (high:SI (match_dup 1)))
2810    (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
2811   "")
2813 ;; hppa_legitimize_address goes to a great deal of trouble to
2814 ;; create addresses which use indexing.  In some cases, this
2815 ;; is a lose because there isn't any store instructions which
2816 ;; allow indexed addresses (with integer register source).
2818 ;; These define_splits try to turn a 3 insn store into
2819 ;; a 2 insn store with some creative RTL rewriting.
2820 (define_split
2821   [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2822                                (match_operand:SI 1 "shadd_operand" ""))
2823                    (plus:SI (match_operand:SI 2 "register_operand" "")
2824                             (match_operand:SI 3 "const_int_operand" ""))))
2825         (match_operand:SI 4 "register_operand" ""))
2826    (clobber (match_operand:SI 5 "register_operand" ""))]
2827   ""
2828   [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2829                                (match_dup 2)))
2830    (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2831   "")
2833 (define_split
2834   [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2835                                (match_operand:SI 1 "shadd_operand" ""))
2836                    (plus:SI (match_operand:SI 2 "register_operand" "")
2837                             (match_operand:SI 3 "const_int_operand" ""))))
2838         (match_operand:HI 4 "register_operand" ""))
2839    (clobber (match_operand:SI 5 "register_operand" ""))]
2840   ""
2841   [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2842                                (match_dup 2)))
2843    (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2844   "")
2846 (define_split
2847   [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2848                                (match_operand:SI 1 "shadd_operand" ""))
2849                    (plus:SI (match_operand:SI 2 "register_operand" "")
2850                             (match_operand:SI 3 "const_int_operand" ""))))
2851         (match_operand:QI 4 "register_operand" ""))
2852    (clobber (match_operand:SI 5 "register_operand" ""))]
2853   ""
2854   [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2855                                (match_dup 2)))
2856    (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2857   "")
2859 (define_expand "movhi"
2860   [(set (match_operand:HI 0 "general_operand" "")
2861         (match_operand:HI 1 "general_operand" ""))]
2862   ""
2863   "
2865   if (pa_emit_move_sequence (operands, HImode, 0))
2866     DONE;
2869 ;; Handle HImode input reloads requiring a general register as a
2870 ;; scratch register.
2871 (define_expand "reload_inhi"
2872   [(set (match_operand:HI 0 "register_operand" "=Z")
2873         (match_operand:HI 1 "non_hard_reg_operand" ""))
2874    (clobber (match_operand:HI 2 "register_operand" "=&r"))]
2875   ""
2876   "
2878   if (pa_emit_move_sequence (operands, HImode, operands[2]))
2879     DONE;
2881   /* We don't want the clobber emitted, so handle this ourselves.  */
2882   emit_insn (gen_rtx_SET (operands[0], operands[1]));
2883   DONE;
2886 ;; Handle HImode output reloads requiring a general register as a
2887 ;; scratch register.
2888 (define_expand "reload_outhi"
2889   [(set (match_operand:HI 0 "non_hard_reg_operand" "")
2890         (match_operand:HI 1  "register_operand" "Z"))
2891    (clobber (match_operand:HI 2 "register_operand" "=&r"))]
2892   ""
2893   "
2895   if (pa_emit_move_sequence (operands, HImode, operands[2]))
2896     DONE;
2898   /* We don't want the clobber emitted, so handle this ourselves.  */
2899   emit_insn (gen_rtx_SET (operands[0], operands[1]));
2900   DONE;
2903 (define_insn ""
2904   [(set (match_operand:HI 0 "move_dest_operand"
2905                           "=r,r,r,r,r,Q,!*q,!r")
2906         (match_operand:HI 1 "move_src_operand"
2907                           "r,J,N,K,RQ,rM,!rM,!*q"))]
2908   "(register_operand (operands[0], HImode)
2909     || reg_or_0_operand (operands[1], HImode))"
2910   "@
2911    copy %1,%0
2912    ldi %1,%0
2913    ldil L'%1,%0
2914    {zdepi|depwi,z} %Z1,%0
2915    ldh%M1 %1,%0
2916    sth%M0 %r1,%0
2917    mtsar %r1
2918    {mfctl|mfctl,w} %sar,%0"
2919   [(set_attr "type" "move,move,move,shift,load,store,move,move")
2920    (set_attr "pa_combine_type" "addmove")
2921    (set_attr "length" "4,4,4,4,4,4,4,4")])
2923 (define_insn ""
2924   [(set (match_operand:HI 0 "register_operand" "=r")
2925         (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2926                          (match_operand:SI 2 "int5_operand" "L"))))
2927    (set (match_dup 1)
2928         (plus:SI (match_dup 1) (match_dup 2)))]
2929   ""
2930   "{ldhs|ldh},mb %2(%1),%0"
2931   [(set_attr "type" "load")
2932    (set_attr "length" "4")])
2934 (define_insn ""
2935   [(set (match_operand:HI 0 "register_operand" "=r")
2936         (mem:HI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2937                          (match_operand:DI 2 "int5_operand" "L"))))
2938    (set (match_dup 1)
2939         (plus:DI (match_dup 1) (match_dup 2)))]
2940   "TARGET_64BIT"
2941   "ldh,mb %2(%1),%0"
2942   [(set_attr "type" "load")
2943    (set_attr "length" "4")])
2945 ; And a zero extended variant.
2946 (define_insn ""
2947   [(set (match_operand:DI 0 "register_operand" "=r")
2948         (zero_extend:DI (mem:HI
2949                           (plus:DI
2950                             (match_operand:DI 1 "register_operand" "+r")
2951                             (match_operand:DI 2 "int5_operand" "L")))))
2952    (set (match_dup 1)
2953         (plus:DI (match_dup 1) (match_dup 2)))]
2954   "TARGET_64BIT"
2955   "ldh,mb %2(%1),%0"
2956   [(set_attr "type" "load")
2957    (set_attr "length" "4")])
2959 (define_insn ""
2960   [(set (match_operand:SI 0 "register_operand" "=r")
2961         (zero_extend:SI (mem:HI
2962                           (plus:SI
2963                             (match_operand:SI 1 "register_operand" "+r")
2964                             (match_operand:SI 2 "int5_operand" "L")))))
2965    (set (match_dup 1)
2966         (plus:SI (match_dup 1) (match_dup 2)))]
2967   ""
2968   "{ldhs|ldh},mb %2(%1),%0"
2969   [(set_attr "type" "load")
2970    (set_attr "length" "4")])
2972 (define_insn ""
2973   [(set (match_operand:SI 0 "register_operand" "=r")
2974         (zero_extend:SI (mem:HI
2975                           (plus:DI
2976                             (match_operand:DI 1 "register_operand" "+r")
2977                             (match_operand:DI 2 "int5_operand" "L")))))
2978    (set (match_dup 1)
2979         (plus:DI (match_dup 1) (match_dup 2)))]
2980   "TARGET_64BIT"
2981   "ldh,mb %2(%1),%0"
2982   [(set_attr "type" "load")
2983    (set_attr "length" "4")])
2985 (define_insn ""
2986   [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2987                          (match_operand:SI 1 "int5_operand" "L")))
2988         (match_operand:HI 2 "reg_or_0_operand" "rM"))
2989    (set (match_dup 0)
2990         (plus:SI (match_dup 0) (match_dup 1)))]
2991   ""
2992   "{sths|sth},mb %r2,%1(%0)"
2993   [(set_attr "type" "store")
2994    (set_attr "length" "4")])
2996 (define_insn ""
2997   [(set (mem:HI (plus:DI (match_operand:DI 0 "register_operand" "+r")
2998                          (match_operand:DI 1 "int5_operand" "L")))
2999         (match_operand:HI 2 "reg_or_0_operand" "rM"))
3000    (set (match_dup 0)
3001         (plus:DI (match_dup 0) (match_dup 1)))]
3002   "TARGET_64BIT"
3003   "sth,mb %r2,%1(%0)"
3004   [(set_attr "type" "store")
3005    (set_attr "length" "4")])
3007 (define_insn "addhi3"
3008   [(set (match_operand:HI 0 "register_operand" "=r,r")
3009         (plus:HI (match_operand:HI 1 "register_operand" "%r,r")
3010                  (match_operand:HI 2 "arith14_operand" "r,J")))]
3011   ""
3012   "@
3013    {addl|add,l} %1,%2,%0
3014    ldo %2(%1),%0"
3015   [(set_attr "type" "binary,binary")
3016    (set_attr "pa_combine_type" "addmove")
3017    (set_attr "length" "4,4")])
3019 (define_expand "movqi"
3020   [(set (match_operand:QI 0 "general_operand" "")
3021         (match_operand:QI 1 "general_operand" ""))]
3022   ""
3023   "
3025   if (pa_emit_move_sequence (operands, QImode, 0))
3026     DONE;
3029 ;; Handle QImode input reloads requiring a general register as a
3030 ;; scratch register.
3031 (define_expand "reload_inqi"
3032   [(set (match_operand:QI 0 "register_operand" "=Z")
3033         (match_operand:QI 1 "non_hard_reg_operand" ""))
3034    (clobber (match_operand:QI 2 "register_operand" "=&r"))]
3035   ""
3036   "
3038   if (pa_emit_move_sequence (operands, QImode, operands[2]))
3039     DONE;
3041   /* We don't want the clobber emitted, so handle this ourselves.  */
3042   emit_insn (gen_rtx_SET (operands[0], operands[1]));
3043   DONE;
3046 ;; Handle QImode output reloads requiring a general register as a
3047 ;; scratch register.
3048 (define_expand "reload_outqi"
3049   [(set (match_operand:QI 0 "non_hard_reg_operand" "")
3050         (match_operand:QI 1  "register_operand" "Z"))
3051    (clobber (match_operand:QI 2 "register_operand" "=&r"))]
3052   ""
3053   "
3055   if (pa_emit_move_sequence (operands, QImode, operands[2]))
3056     DONE;
3058   /* We don't want the clobber emitted, so handle this ourselves.  */
3059   emit_insn (gen_rtx_SET (operands[0], operands[1]));
3060   DONE;
3063 (define_insn ""
3064   [(set (match_operand:QI 0 "move_dest_operand"
3065                           "=r,r,r,r,r,Q,!*q,!r")
3066         (match_operand:QI 1 "move_src_operand"
3067                           "r,J,N,K,RQ,rM,!rM,!*q"))]
3068   "(register_operand (operands[0], QImode)
3069     || reg_or_0_operand (operands[1], QImode))"
3070   "@
3071    copy %1,%0
3072    ldi %1,%0
3073    ldil L'%1,%0
3074    {zdepi|depwi,z} %Z1,%0
3075    ldb%M1 %1,%0
3076    stb%M0 %r1,%0
3077    mtsar %r1
3078    {mfctl|mfctl,w} %%sar,%0"
3079   [(set_attr "type" "move,move,move,shift,load,store,move,move")
3080    (set_attr "pa_combine_type" "addmove")
3081    (set_attr "length" "4,4,4,4,4,4,4,4")])
3083 (define_insn ""
3084   [(set (match_operand:QI 0 "register_operand" "=r")
3085         (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "+r")
3086                          (match_operand:SI 2 "int5_operand" "L"))))
3087    (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3088   ""
3089   "{ldbs|ldb},mb %2(%1),%0"
3090   [(set_attr "type" "load")
3091    (set_attr "length" "4")])
3093 (define_insn ""
3094   [(set (match_operand:QI 0 "register_operand" "=r")
3095         (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "+r")
3096                          (match_operand:DI 2 "int5_operand" "L"))))
3097    (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3098   "TARGET_64BIT"
3099   "ldb,mb %2(%1),%0"
3100   [(set_attr "type" "load")
3101    (set_attr "length" "4")])
3103 ; Now the same thing with zero extensions.
3104 (define_insn ""
3105   [(set (match_operand:DI 0 "register_operand" "=r")
3106         (zero_extend:DI (mem:QI (plus:DI
3107                                   (match_operand:DI 1 "register_operand" "+r")
3108                                   (match_operand:DI 2 "int5_operand" "L")))))
3109    (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3110   "TARGET_64BIT"
3111   "ldb,mb %2(%1),%0"
3112   [(set_attr "type" "load")
3113    (set_attr "length" "4")])
3115 (define_insn ""
3116   [(set (match_operand:SI 0 "register_operand" "=r")
3117         (zero_extend:SI (mem:QI (plus:SI
3118                                   (match_operand:SI 1 "register_operand" "+r")
3119                                   (match_operand:SI 2 "int5_operand" "L")))))
3120    (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3121   ""
3122   "{ldbs|ldb},mb %2(%1),%0"
3123   [(set_attr "type" "load")
3124    (set_attr "length" "4")])
3126 (define_insn ""
3127   [(set (match_operand:SI 0 "register_operand" "=r")
3128         (zero_extend:SI (mem:QI (plus:DI
3129                                   (match_operand:DI 1 "register_operand" "+r")
3130                                   (match_operand:DI 2 "int5_operand" "L")))))
3131    (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3132   "TARGET_64BIT"
3133   "ldb,mb %2(%1),%0"
3134   [(set_attr "type" "load")
3135    (set_attr "length" "4")])
3137 (define_insn ""
3138   [(set (match_operand:HI 0 "register_operand" "=r")
3139         (zero_extend:HI (mem:QI (plus:SI
3140                                   (match_operand:SI 1 "register_operand" "+r")
3141                                   (match_operand:SI 2 "int5_operand" "L")))))
3142    (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3143   ""
3144   "{ldbs|ldb},mb %2(%1),%0"
3145   [(set_attr "type" "load")
3146    (set_attr "length" "4")])
3148 (define_insn ""
3149   [(set (match_operand:HI 0 "register_operand" "=r")
3150         (zero_extend:HI (mem:QI (plus:DI
3151                                   (match_operand:DI 1 "register_operand" "+r")
3152                                   (match_operand:DI 2 "int5_operand" "L")))))
3153    (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3154   "TARGET_64BIT"
3155   "ldb,mb %2(%1),%0"
3156   [(set_attr "type" "load")
3157    (set_attr "length" "4")])
3159 (define_insn ""
3160   [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "+r")
3161                          (match_operand:SI 1 "int5_operand" "L")))
3162         (match_operand:QI 2 "reg_or_0_operand" "rM"))
3163    (set (match_dup 0)
3164         (plus:SI (match_dup 0) (match_dup 1)))]
3165   ""
3166   "{stbs|stb},mb %r2,%1(%0)"
3167   [(set_attr "type" "store")
3168    (set_attr "length" "4")])
3170 (define_insn ""
3171   [(set (mem:QI (plus:DI (match_operand:DI 0 "register_operand" "+r")
3172                          (match_operand:DI 1 "int5_operand" "L")))
3173         (match_operand:QI 2 "reg_or_0_operand" "rM"))
3174    (set (match_dup 0)
3175         (plus:DI (match_dup 0) (match_dup 1)))]
3176   "TARGET_64BIT"
3177   "stb,mb %r2,%1(%0)"
3178   [(set_attr "type" "store")
3179    (set_attr "length" "4")])
3181 ;; The definition of this insn does not really explain what it does,
3182 ;; but it should suffice that anything generated as this insn will be
3183 ;; recognized as a movmemsi operation, and that it will not successfully
3184 ;; combine with anything.
3185 (define_expand "movmemsi"
3186   [(parallel [(set (match_operand:BLK 0 "" "")
3187                    (match_operand:BLK 1 "" ""))
3188               (clobber (match_dup 4))
3189               (clobber (match_dup 5))
3190               (clobber (match_dup 6))
3191               (clobber (match_dup 7))
3192               (clobber (match_dup 8))
3193               (use (match_operand:SI 2 "arith14_operand" ""))
3194               (use (match_operand:SI 3 "const_int_operand" ""))])]
3195   "!TARGET_64BIT && optimize > 0"
3196   "
3198   int size, align;
3200   /* HP provides very fast block move library routine for the PA;
3201      this routine includes:
3203         4x4 byte at a time block moves,
3204         1x4 byte at a time with alignment checked at runtime with
3205             attempts to align the source and destination as needed
3206         1x1 byte loop
3208      With that in mind, here's the heuristics to try and guess when
3209      the inlined block move will be better than the library block
3210      move:
3212         If the size isn't constant, then always use the library routines.
3214         If the size is large in respect to the known alignment, then use
3215         the library routines.
3217         If the size is small in respect to the known alignment, then open
3218         code the copy (since that will lead to better scheduling).
3220         Else use the block move pattern.   */
3222   /* Undetermined size, use the library routine.  */
3223   if (GET_CODE (operands[2]) != CONST_INT)
3224     FAIL;
3226   size = INTVAL (operands[2]);
3227   align = INTVAL (operands[3]);
3228   align = align > 4 ? 4 : (align ? align : 1);
3230   /* If size/alignment is large, then use the library routines.  */
3231   if (size / align > 16)
3232     FAIL;
3234   /* This does happen, but not often enough to worry much about.  */
3235   if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3236     FAIL;
3237   
3238   /* Fall through means we're going to use our block move pattern.  */
3239   operands[0]
3240     = replace_equiv_address (operands[0],
3241                              copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3242   operands[1]
3243     = replace_equiv_address (operands[1],
3244                              copy_to_mode_reg (SImode, XEXP (operands[1], 0)));
3245   operands[4] = gen_reg_rtx (SImode);
3246   operands[5] = gen_reg_rtx (SImode);
3247   operands[6] = gen_reg_rtx (SImode);
3248   operands[7] = gen_reg_rtx (SImode);
3249   operands[8] = gen_reg_rtx (SImode);
3252 ;; The operand constraints are written like this to support both compile-time
3253 ;; and run-time determined byte counts.  The expander and pa_output_block_move
3254 ;; only support compile-time determined counts at this time.
3256 ;; If the count is run-time determined, the register with the byte count
3257 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3259 ;; We used to clobber operands 0 and 1.  However, a change to regrename.c
3260 ;; broke this semantic for pseudo registers.  We can't use match_scratch
3261 ;; as this requires two registers in the class R1_REGS when the MEMs for
3262 ;; operands 0 and 1 are both equivalent to symbolic MEMs.  Thus, we are
3263 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3264 ;; respectively.  We then split or peephole optimize after reload.
3265 (define_insn "movmemsi_prereload"
3266   [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3267         (mem:BLK (match_operand:SI 1 "register_operand" "r,r")))
3268    (clobber (match_operand:SI 2 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3269    (clobber (match_operand:SI 3 "register_operand" "=&r,&r"))   ;item tmp1
3270    (clobber (match_operand:SI 6 "register_operand" "=&r,&r"))   ;item tmp2
3271    (clobber (match_operand:SI 7 "register_operand" "=&r,&r"))   ;item tmp3
3272    (clobber (match_operand:SI 8 "register_operand" "=&r,&r"))   ;item tmp4
3273    (use (match_operand:SI 4 "arith14_operand" "J,2"))    ;byte count
3274    (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
3275   "!TARGET_64BIT"
3276   "#"
3277   [(set_attr "type" "multi,multi")])
3279 (define_split
3280   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3281                    (match_operand:BLK 1 "memory_operand" ""))
3282               (clobber (match_operand:SI 2 "register_operand" ""))
3283               (clobber (match_operand:SI 3 "register_operand" ""))
3284               (clobber (match_operand:SI 6 "register_operand" ""))
3285               (clobber (match_operand:SI 7 "register_operand" ""))
3286               (clobber (match_operand:SI 8 "register_operand" ""))
3287               (use (match_operand:SI 4 "arith14_operand" ""))
3288               (use (match_operand:SI 5 "const_int_operand" ""))])]
3289   "!TARGET_64BIT && reload_completed && !flag_peephole2
3290    && GET_CODE (operands[0]) == MEM
3291    && register_operand (XEXP (operands[0], 0), SImode)
3292    && GET_CODE (operands[1]) == MEM
3293    && register_operand (XEXP (operands[1], 0), SImode)"
3294   [(set (match_dup 7) (match_dup 9))
3295    (set (match_dup 8) (match_dup 10))
3296    (parallel [(set (match_dup 0) (match_dup 1))
3297               (clobber (match_dup 2))
3298               (clobber (match_dup 3))
3299               (clobber (match_dup 6))
3300               (clobber (match_dup 7))
3301               (clobber (match_dup 8))
3302               (use (match_dup 4))
3303               (use (match_dup 5))
3304               (const_int 0)])]
3305   "
3307   operands[9] = XEXP (operands[0], 0);
3308   operands[10] = XEXP (operands[1], 0);
3309   operands[0] = replace_equiv_address (operands[0], operands[7]);
3310   operands[1] = replace_equiv_address (operands[1], operands[8]);
3313 (define_peephole2
3314   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3315                    (match_operand:BLK 1 "memory_operand" ""))
3316               (clobber (match_operand:SI 2 "register_operand" ""))
3317               (clobber (match_operand:SI 3 "register_operand" ""))
3318               (clobber (match_operand:SI 6 "register_operand" ""))
3319               (clobber (match_operand:SI 7 "register_operand" ""))
3320               (clobber (match_operand:SI 8 "register_operand" ""))
3321               (use (match_operand:SI 4 "arith14_operand" ""))
3322               (use (match_operand:SI 5 "const_int_operand" ""))])]
3323   "!TARGET_64BIT
3324    && GET_CODE (operands[0]) == MEM
3325    && register_operand (XEXP (operands[0], 0), SImode)
3326    && GET_CODE (operands[1]) == MEM
3327    && register_operand (XEXP (operands[1], 0), SImode)"
3328   [(parallel [(set (match_dup 0) (match_dup 1))
3329               (clobber (match_dup 2))
3330               (clobber (match_dup 3))
3331               (clobber (match_dup 6))
3332               (clobber (match_dup 7))
3333               (clobber (match_dup 8))
3334               (use (match_dup 4))
3335               (use (match_dup 5))
3336               (const_int 0)])]
3337   "
3339   rtx addr = XEXP (operands[0], 0);
3340   if (dead_or_set_p (curr_insn, addr))
3341     operands[7] = addr;
3342   else
3343     {
3344       emit_insn (gen_rtx_SET (operands[7], addr));
3345       operands[0] = replace_equiv_address (operands[0], operands[7]);
3346     }
3348   addr = XEXP (operands[1], 0);
3349   if (dead_or_set_p (curr_insn, addr))
3350     operands[8] = addr;
3351   else
3352     {
3353       emit_insn (gen_rtx_SET (operands[8], addr));
3354       operands[1] = replace_equiv_address (operands[1], operands[8]);
3355     }
3358 (define_insn "movmemsi_postreload"
3359   [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3360         (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
3361    (clobber (match_operand:SI 2 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3362    (clobber (match_operand:SI 3 "register_operand" "=&r,&r"))   ;item tmp1
3363    (clobber (match_operand:SI 6 "register_operand" "=&r,&r"))   ;item tmp2
3364    (clobber (match_dup 0))
3365    (clobber (match_dup 1))
3366    (use (match_operand:SI 4 "arith14_operand" "J,2"))    ;byte count
3367    (use (match_operand:SI 5 "const_int_operand" "n,n"))  ;alignment
3368    (const_int 0)]
3369   "!TARGET_64BIT && reload_completed"
3370   "* return pa_output_block_move (operands, !which_alternative);"
3371   [(set_attr "type" "multi,multi")])
3373 (define_expand "movmemdi"
3374   [(parallel [(set (match_operand:BLK 0 "" "")
3375                    (match_operand:BLK 1 "" ""))
3376               (clobber (match_dup 4))
3377               (clobber (match_dup 5))
3378               (clobber (match_dup 6))
3379               (clobber (match_dup 7))
3380               (clobber (match_dup 8))
3381               (use (match_operand:DI 2 "arith14_operand" ""))
3382               (use (match_operand:DI 3 "const_int_operand" ""))])]
3383   "TARGET_64BIT && optimize > 0"
3384   "
3386   int size, align;
3388   /* HP provides very fast block move library routine for the PA;
3389      this routine includes:
3391         4x4 byte at a time block moves,
3392         1x4 byte at a time with alignment checked at runtime with
3393             attempts to align the source and destination as needed
3394         1x1 byte loop
3396      With that in mind, here's the heuristics to try and guess when
3397      the inlined block move will be better than the library block
3398      move:
3400         If the size isn't constant, then always use the library routines.
3402         If the size is large in respect to the known alignment, then use
3403         the library routines.
3405         If the size is small in respect to the known alignment, then open
3406         code the copy (since that will lead to better scheduling).
3408         Else use the block move pattern.   */
3410   /* Undetermined size, use the library routine.  */
3411   if (GET_CODE (operands[2]) != CONST_INT)
3412     FAIL;
3414   size = INTVAL (operands[2]);
3415   align = INTVAL (operands[3]);
3416   align = align > 8 ? 8 : (align ? align : 1);
3418   /* If size/alignment is large, then use the library routines.  */
3419   if (size / align > 16)
3420     FAIL;
3422   /* This does happen, but not often enough to worry much about.  */
3423   if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3424     FAIL;
3425   
3426   /* Fall through means we're going to use our block move pattern.  */
3427   operands[0]
3428     = replace_equiv_address (operands[0],
3429                              copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3430   operands[1]
3431     = replace_equiv_address (operands[1],
3432                              copy_to_mode_reg (DImode, XEXP (operands[1], 0)));
3433   operands[4] = gen_reg_rtx (DImode);
3434   operands[5] = gen_reg_rtx (DImode);
3435   operands[6] = gen_reg_rtx (DImode);
3436   operands[7] = gen_reg_rtx (DImode);
3437   operands[8] = gen_reg_rtx (DImode);
3440 ;; The operand constraints are written like this to support both compile-time
3441 ;; and run-time determined byte counts.  The expander and pa_output_block_move
3442 ;; only support compile-time determined counts at this time.
3444 ;; If the count is run-time determined, the register with the byte count
3445 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3447 ;; We used to clobber operands 0 and 1.  However, a change to regrename.c
3448 ;; broke this semantic for pseudo registers.  We can't use match_scratch
3449 ;; as this requires two registers in the class R1_REGS when the MEMs for
3450 ;; operands 0 and 1 are both equivalent to symbolic MEMs.  Thus, we are
3451 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3452 ;; respectively.  We then split or peephole optimize after reload.
3453 (define_insn "movmemdi_prereload"
3454   [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3455         (mem:BLK (match_operand:DI 1 "register_operand" "r,r")))
3456    (clobber (match_operand:DI 2 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3457    (clobber (match_operand:DI 3 "register_operand" "=&r,&r"))   ;item tmp1
3458    (clobber (match_operand:DI 6 "register_operand" "=&r,&r"))   ;item tmp2
3459    (clobber (match_operand:DI 7 "register_operand" "=&r,&r"))   ;item tmp3
3460    (clobber (match_operand:DI 8 "register_operand" "=&r,&r"))   ;item tmp4
3461    (use (match_operand:DI 4 "arith14_operand" "J,2"))    ;byte count
3462    (use (match_operand:DI 5 "const_int_operand" "n,n"))] ;alignment
3463   "TARGET_64BIT"
3464   "#"
3465   [(set_attr "type" "multi,multi")])
3467 (define_split
3468   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3469                    (match_operand:BLK 1 "memory_operand" ""))
3470               (clobber (match_operand:DI 2 "register_operand" ""))
3471               (clobber (match_operand:DI 3 "register_operand" ""))
3472               (clobber (match_operand:DI 6 "register_operand" ""))
3473               (clobber (match_operand:DI 7 "register_operand" ""))
3474               (clobber (match_operand:DI 8 "register_operand" ""))
3475               (use (match_operand:DI 4 "arith14_operand" ""))
3476               (use (match_operand:DI 5 "const_int_operand" ""))])]
3477   "TARGET_64BIT && reload_completed && !flag_peephole2
3478    && GET_CODE (operands[0]) == MEM
3479    && register_operand (XEXP (operands[0], 0), DImode)
3480    && GET_CODE (operands[1]) == MEM
3481    && register_operand (XEXP (operands[1], 0), DImode)"
3482   [(set (match_dup 7) (match_dup 9))
3483    (set (match_dup 8) (match_dup 10))
3484    (parallel [(set (match_dup 0) (match_dup 1))
3485               (clobber (match_dup 2))
3486               (clobber (match_dup 3))
3487               (clobber (match_dup 6))
3488               (clobber (match_dup 7))
3489               (clobber (match_dup 8))
3490               (use (match_dup 4))
3491               (use (match_dup 5))
3492               (const_int 0)])]
3493   "
3495   operands[9] = XEXP (operands[0], 0);
3496   operands[10] = XEXP (operands[1], 0);
3497   operands[0] = replace_equiv_address (operands[0], operands[7]);
3498   operands[1] = replace_equiv_address (operands[1], operands[8]);
3501 (define_peephole2
3502   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3503                    (match_operand:BLK 1 "memory_operand" ""))
3504               (clobber (match_operand:DI 2 "register_operand" ""))
3505               (clobber (match_operand:DI 3 "register_operand" ""))
3506               (clobber (match_operand:DI 6 "register_operand" ""))
3507               (clobber (match_operand:DI 7 "register_operand" ""))
3508               (clobber (match_operand:DI 8 "register_operand" ""))
3509               (use (match_operand:DI 4 "arith14_operand" ""))
3510               (use (match_operand:DI 5 "const_int_operand" ""))])]
3511   "TARGET_64BIT
3512    && GET_CODE (operands[0]) == MEM
3513    && register_operand (XEXP (operands[0], 0), DImode)
3514    && GET_CODE (operands[1]) == MEM
3515    && register_operand (XEXP (operands[1], 0), DImode)"
3516   [(parallel [(set (match_dup 0) (match_dup 1))
3517               (clobber (match_dup 2))
3518               (clobber (match_dup 3))
3519               (clobber (match_dup 6))
3520               (clobber (match_dup 7))
3521               (clobber (match_dup 8))
3522               (use (match_dup 4))
3523               (use (match_dup 5))
3524               (const_int 0)])]
3525   "
3527   rtx addr = XEXP (operands[0], 0);
3528   if (dead_or_set_p (curr_insn, addr))
3529     operands[7] = addr;
3530   else
3531     {
3532       emit_insn (gen_rtx_SET (operands[7], addr));
3533       operands[0] = replace_equiv_address (operands[0], operands[7]);
3534     }
3536   addr = XEXP (operands[1], 0);
3537   if (dead_or_set_p (curr_insn, addr))
3538     operands[8] = addr;
3539   else
3540     {
3541       emit_insn (gen_rtx_SET (operands[8], addr));
3542       operands[1] = replace_equiv_address (operands[1], operands[8]);
3543     }
3546 (define_insn "movmemdi_postreload"
3547   [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3548         (mem:BLK (match_operand:DI 1 "register_operand" "+r,r")))
3549    (clobber (match_operand:DI 2 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3550    (clobber (match_operand:DI 3 "register_operand" "=&r,&r"))   ;item tmp1
3551    (clobber (match_operand:DI 6 "register_operand" "=&r,&r"))   ;item tmp2
3552    (clobber (match_dup 0))
3553    (clobber (match_dup 1))
3554    (use (match_operand:DI 4 "arith14_operand" "J,2"))    ;byte count
3555    (use (match_operand:DI 5 "const_int_operand" "n,n"))  ;alignment
3556    (const_int 0)]
3557   "TARGET_64BIT && reload_completed"
3558   "* return pa_output_block_move (operands, !which_alternative);"
3559   [(set_attr "type" "multi,multi")])
3561 (define_expand "setmemsi"
3562   [(parallel [(set (match_operand:BLK 0 "" "")
3563                    (match_operand 2 "const_int_operand" ""))
3564               (clobber (match_dup 4))
3565               (clobber (match_dup 5))
3566               (use (match_operand:SI 1 "arith14_operand" ""))
3567               (use (match_operand:SI 3 "const_int_operand" ""))])]
3568   "!TARGET_64BIT && optimize > 0"
3569   "
3571   int size, align;
3573   /* If value to set is not zero, use the library routine.  */
3574   if (operands[2] != const0_rtx)
3575     FAIL;
3577   /* Undetermined size, use the library routine.  */
3578   if (GET_CODE (operands[1]) != CONST_INT)
3579     FAIL;
3581   size = INTVAL (operands[1]);
3582   align = INTVAL (operands[3]);
3583   align = align > 4 ? 4 : align;
3585   /* If size/alignment is large, then use the library routines.  */
3586   if (size / align > 16)
3587     FAIL;
3589   /* This does happen, but not often enough to worry much about.  */
3590   if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3591     FAIL;
3592   
3593   /* Fall through means we're going to use our block clear pattern.  */
3594   operands[0]
3595     = replace_equiv_address (operands[0],
3596                              copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3597   operands[4] = gen_reg_rtx (SImode);
3598   operands[5] = gen_reg_rtx (SImode);
3601 (define_insn "clrmemsi_prereload"
3602   [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3603         (const_int 0))
3604    (clobber (match_operand:SI 1 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3605    (clobber (match_operand:SI 4 "register_operand" "=&r,&r"))   ;tmp1
3606    (use (match_operand:SI 2 "arith14_operand" "J,1"))    ;byte count
3607    (use (match_operand:SI 3 "const_int_operand" "n,n"))] ;alignment
3608   "!TARGET_64BIT"
3609   "#"
3610   [(set_attr "type" "multi,multi")])
3612 (define_split
3613   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3614                    (const_int 0))
3615               (clobber (match_operand:SI 1 "register_operand" ""))
3616               (clobber (match_operand:SI 4 "register_operand" ""))
3617               (use (match_operand:SI 2 "arith14_operand" ""))
3618               (use (match_operand:SI 3 "const_int_operand" ""))])]
3619   "!TARGET_64BIT && reload_completed && !flag_peephole2
3620    && GET_CODE (operands[0]) == MEM
3621    && register_operand (XEXP (operands[0], 0), SImode)"
3622   [(set (match_dup 4) (match_dup 5))
3623    (parallel [(set (match_dup 0) (const_int 0))
3624               (clobber (match_dup 1))
3625               (clobber (match_dup 4))
3626               (use (match_dup 2))
3627               (use (match_dup 3))
3628               (const_int 0)])]
3629   "
3631   operands[5] = XEXP (operands[0], 0);
3632   operands[0] = replace_equiv_address (operands[0], operands[4]);
3635 (define_peephole2
3636   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3637                    (const_int 0))
3638               (clobber (match_operand:SI 1 "register_operand" ""))
3639               (clobber (match_operand:SI 4 "register_operand" ""))
3640               (use (match_operand:SI 2 "arith14_operand" ""))
3641               (use (match_operand:SI 3 "const_int_operand" ""))])]
3642   "!TARGET_64BIT
3643    && GET_CODE (operands[0]) == MEM
3644    && register_operand (XEXP (operands[0], 0), SImode)"
3645   [(parallel [(set (match_dup 0) (const_int 0))
3646               (clobber (match_dup 1))
3647               (clobber (match_dup 4))
3648               (use (match_dup 2))
3649               (use (match_dup 3))
3650               (const_int 0)])]
3651   "
3653   rtx addr = XEXP (operands[0], 0);
3654   if (dead_or_set_p (curr_insn, addr))
3655     operands[4] = addr;
3656   else
3657     {
3658       emit_insn (gen_rtx_SET (operands[4], addr));
3659       operands[0] = replace_equiv_address (operands[0], operands[4]);
3660     }
3663 (define_insn "clrmemsi_postreload"
3664   [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3665         (const_int 0))
3666    (clobber (match_operand:SI 1 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3667    (clobber (match_dup 0))
3668    (use (match_operand:SI 2 "arith14_operand" "J,1"))    ;byte count
3669    (use (match_operand:SI 3 "const_int_operand" "n,n"))  ;alignment
3670    (const_int 0)]
3671   "!TARGET_64BIT && reload_completed"
3672   "* return pa_output_block_clear (operands, !which_alternative);"
3673   [(set_attr "type" "multi,multi")])
3675 (define_expand "setmemdi"
3676   [(parallel [(set (match_operand:BLK 0 "" "")
3677                    (match_operand 2 "const_int_operand" ""))
3678               (clobber (match_dup 4))
3679               (clobber (match_dup 5))
3680               (use (match_operand:DI 1 "arith14_operand" ""))
3681               (use (match_operand:DI 3 "const_int_operand" ""))])]
3682   "TARGET_64BIT && optimize > 0"
3683   "
3685   int size, align;
3687   /* If value to set is not zero, use the library routine.  */
3688   if (operands[2] != const0_rtx)
3689     FAIL;
3691   /* Undetermined size, use the library routine.  */
3692   if (GET_CODE (operands[1]) != CONST_INT)
3693     FAIL;
3695   size = INTVAL (operands[1]);
3696   align = INTVAL (operands[3]);
3697   align = align > 8 ? 8 : align;
3699   /* If size/alignment is large, then use the library routines.  */
3700   if (size / align > 16)
3701     FAIL;
3703   /* This does happen, but not often enough to worry much about.  */
3704   if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3705     FAIL;
3706   
3707   /* Fall through means we're going to use our block clear pattern.  */
3708   operands[0]
3709     = replace_equiv_address (operands[0],
3710                              copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3711   operands[4] = gen_reg_rtx (DImode);
3712   operands[5] = gen_reg_rtx (DImode);
3715 (define_insn "clrmemdi_prereload"
3716   [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3717         (const_int 0))
3718    (clobber (match_operand:DI 1 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3719    (clobber (match_operand:DI 4 "register_operand" "=&r,&r"))   ;item tmp1
3720    (use (match_operand:DI 2 "arith14_operand" "J,1"))    ;byte count
3721    (use (match_operand:DI 3 "const_int_operand" "n,n"))] ;alignment
3722   "TARGET_64BIT"
3723   "#"
3724   [(set_attr "type" "multi,multi")])
3726 (define_split
3727   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3728                    (const_int 0))
3729               (clobber (match_operand:DI 1 "register_operand" ""))
3730               (clobber (match_operand:DI 4 "register_operand" ""))
3731               (use (match_operand:DI 2 "arith14_operand" ""))
3732               (use (match_operand:DI 3 "const_int_operand" ""))])]
3733   "TARGET_64BIT && reload_completed && !flag_peephole2
3734    && GET_CODE (operands[0]) == MEM
3735    && register_operand (XEXP (operands[0], 0), DImode)"
3736   [(set (match_dup 4) (match_dup 5))
3737    (parallel [(set (match_dup 0) (const_int 0))
3738               (clobber (match_dup 1))
3739               (clobber (match_dup 4))
3740               (use (match_dup 2))
3741               (use (match_dup 3))
3742               (const_int 0)])]
3743   "
3745   operands[5] = XEXP (operands[0], 0);
3746   operands[0] = replace_equiv_address (operands[0], operands[4]);
3749 (define_peephole2
3750   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3751                    (const_int 0))
3752               (clobber (match_operand:DI 1 "register_operand" ""))
3753               (clobber (match_operand:DI 4 "register_operand" ""))
3754               (use (match_operand:DI 2 "arith14_operand" ""))
3755               (use (match_operand:DI 3 "const_int_operand" ""))])]
3756   "TARGET_64BIT
3757    && GET_CODE (operands[0]) == MEM
3758    && register_operand (XEXP (operands[0], 0), DImode)"
3759   [(parallel [(set (match_dup 0) (const_int 0))
3760               (clobber (match_dup 1))
3761               (clobber (match_dup 4))
3762               (use (match_dup 2))
3763               (use (match_dup 3))
3764               (const_int 0)])]
3765   "
3766 {  
3767   rtx addr = XEXP (operands[0], 0);
3768   if (dead_or_set_p (curr_insn, addr))
3769     operands[4] = addr;
3770   else
3771     {
3772       emit_insn (gen_rtx_SET (operands[4], addr));
3773       operands[0] = replace_equiv_address (operands[0], operands[4]);
3774     }
3777 (define_insn "clrmemdi_postreload"
3778   [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3779         (const_int 0))
3780    (clobber (match_operand:DI 1 "register_operand" "=&r,&r"))   ;loop cnt/tmp
3781    (clobber (match_dup 0))
3782    (use (match_operand:DI 2 "arith14_operand" "J,1"))    ;byte count
3783    (use (match_operand:DI 3 "const_int_operand" "n,n"))  ;alignment
3784    (const_int 0)]
3785   "TARGET_64BIT && reload_completed"
3786   "* return pa_output_block_clear (operands, !which_alternative);"
3787   [(set_attr "type" "multi,multi")])
3789 ;; Floating point move insns
3791 (define_expand "movdf"
3792   [(set (match_operand:DF 0 "general_operand" "")
3793         (match_operand:DF 1 "general_operand" ""))]
3794   ""
3795   "
3797   if (pa_emit_move_sequence (operands, DFmode, 0))
3798     DONE;
3801 ;; Handle DFmode input reloads requiring %r1 as a scratch register.
3802 (define_expand "reload_indf_r1"
3803   [(set (match_operand:DF 0 "register_operand" "=Z")
3804         (match_operand:DF 1 "non_hard_reg_operand" ""))
3805    (clobber (match_operand:SI 2 "register_operand" "=&a"))]
3806   ""
3807   "
3809   if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3810     DONE;
3812   /* We don't want the clobber emitted, so handle this ourselves.  */
3813   emit_insn (gen_rtx_SET (operands[0], operands[1]));
3814   DONE;
3817 ;; Handle DFmode input reloads requiring a general register as a
3818 ;; scratch register.
3819 (define_expand "reload_indf"
3820   [(set (match_operand:DF 0 "register_operand" "=Z")
3821         (match_operand:DF 1 "non_hard_reg_operand" ""))
3822    (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3823   ""
3824   "
3826   if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3827     DONE;
3829   /* We don't want the clobber emitted, so handle this ourselves.  */
3830   emit_insn (gen_rtx_SET (operands[0], operands[1]));
3831   DONE;
3834 ;; Handle DFmode output reloads requiring a general register as a
3835 ;; scratch register.
3836 (define_expand "reload_outdf" 
3837  [(set (match_operand:DF 0 "non_hard_reg_operand" "")
3838         (match_operand:DF 1  "register_operand" "Z"))
3839    (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3840   ""
3841   "
3843   if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3844     DONE;
3846   /* We don't want the clobber emitted, so handle this ourselves.  */
3847   emit_insn (gen_rtx_SET (operands[0], operands[1]));
3848   DONE;
3851 (define_insn ""
3852   [(set (match_operand:DF 0 "move_dest_operand"
3853                           "=f,*r,T,?o,?Q,f,*r,*r,?*r,?f")
3854         (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3855                           "fG,*rG,f,*r,*r,RT,o,RQ,f,*r"))]
3856   "(register_operand (operands[0], DFmode)
3857     || reg_or_0_operand (operands[1], DFmode))
3858    && !(GET_CODE (operands[1]) == CONST_DOUBLE
3859         && GET_CODE (operands[0]) == MEM)
3860    && !TARGET_64BIT
3861    && !TARGET_SOFT_FLOAT"
3862   "*
3864   if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3865        || operands[1] == CONST0_RTX (DFmode))
3866       && !(REG_P (operands[0]) && REG_P (operands[1])
3867            && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
3868     return pa_output_fp_move_double (operands);
3869   return pa_output_move_double (operands);
3871   [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load,fpstore_load,store_fpload")
3872    (set_attr "length" "4,8,4,8,16,4,8,16,12,12")])
3874 (define_insn ""
3875   [(set (match_operand:DF 0 "indexed_memory_operand" "=R")
3876         (match_operand:DF 1 "reg_or_0_operand" "f"))]
3877   "!TARGET_SOFT_FLOAT
3878    && !TARGET_DISABLE_INDEXING
3879    && reload_completed"
3880   "fstd%F0 %1,%0"
3881   [(set_attr "type" "fpstore")
3882    (set_attr "pa_combine_type" "addmove")
3883    (set_attr "length" "4")])
3885 (define_peephole2
3886   [(set (match_operand:SI 0 "register_operand" "")
3887         (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
3888                           (const_int 8))
3889                  (match_operand:SI 2 "register_operand" "")))
3890    (set (mem:DF (match_dup 0))
3891         (match_operand:DF 3 "register_operand" ""))]
3892   "!TARGET_SOFT_FLOAT
3893    && !TARGET_DISABLE_INDEXING
3894    && REG_OK_FOR_BASE_P (operands[2])
3895    && FP_REGNO_P (REGNO (operands[3]))"
3896   [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
3897         (match_dup 3))
3898    (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 8))
3899                                (match_dup 2)))]
3900   "")
3902 (define_peephole2
3903   [(set (match_operand:SI 0 "register_operand" "")
3904         (plus:SI (match_operand:SI 2 "register_operand" "")
3905                  (mult:SI (match_operand:SI 1 "register_operand" "")
3906                           (const_int 8))))
3907    (set (mem:DF (match_dup 0))
3908         (match_operand:DF 3 "register_operand" ""))]
3909   "!TARGET_SOFT_FLOAT
3910    && !TARGET_DISABLE_INDEXING
3911    && REG_OK_FOR_BASE_P (operands[2])
3912    && FP_REGNO_P (REGNO (operands[3]))"
3913   [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
3914         (match_dup 3))
3915    (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 8))
3916                                (match_dup 2)))]
3917   "")
3919 (define_peephole2
3920   [(set (match_operand:DI 0 "register_operand" "")
3921         (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
3922                           (const_int 8))
3923                  (match_operand:DI 2 "register_operand" "")))
3924    (set (mem:DF (match_dup 0))
3925         (match_operand:DF 3 "register_operand" ""))]
3926   "!TARGET_SOFT_FLOAT
3927    && !TARGET_DISABLE_INDEXING
3928    && TARGET_64BIT
3929    && REG_OK_FOR_BASE_P (operands[2])
3930    && FP_REGNO_P (REGNO (operands[3]))"
3931   [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
3932         (match_dup 3))
3933    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
3934                                (match_dup 2)))]
3935   "")
3937 (define_peephole2
3938   [(set (match_operand:DI 0 "register_operand" "")
3939         (plus:DI (match_operand:DI 2 "register_operand" "")
3940                  (mult:DI (match_operand:DI 1 "register_operand" "")
3941                           (const_int 8))))
3942    (set (mem:DF (match_dup 0))
3943         (match_operand:DF 3 "register_operand" ""))]
3944   "!TARGET_SOFT_FLOAT
3945    && !TARGET_DISABLE_INDEXING
3946    && TARGET_64BIT
3947    && REG_OK_FOR_BASE_P (operands[2])
3948    && FP_REGNO_P (REGNO (operands[3]))"
3949   [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
3950         (match_dup 3))
3951    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
3952                                (match_dup 2)))]
3953   "")
3955 (define_peephole2
3956   [(set (match_operand:SI 0 "register_operand" "")
3957         (plus:SI (match_operand:SI 1 "register_operand" "")
3958                  (match_operand:SI 2 "register_operand" "")))
3959    (set (mem:DF (match_dup 0))
3960         (match_operand:DF 3 "register_operand" ""))]
3961   "!TARGET_SOFT_FLOAT
3962    && !TARGET_DISABLE_INDEXING
3963    && TARGET_NO_SPACE_REGS
3964    && REG_OK_FOR_INDEX_P (operands[1])
3965    && REG_OK_FOR_BASE_P (operands[2])
3966    && FP_REGNO_P (REGNO (operands[3]))"
3967   [(set (mem:DF (plus:SI (match_dup 1) (match_dup 2)))
3968         (match_dup 3))
3969    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
3970   "")
3972 (define_peephole2
3973   [(set (match_operand:SI 0 "register_operand" "")
3974         (plus:SI (match_operand:SI 1 "register_operand" "")
3975                  (match_operand:SI 2 "register_operand" "")))
3976    (set (mem:DF (match_dup 0))
3977         (match_operand:DF 3 "register_operand" ""))]
3978   "!TARGET_SOFT_FLOAT
3979    && !TARGET_DISABLE_INDEXING
3980    && TARGET_NO_SPACE_REGS
3981    && REG_OK_FOR_BASE_P (operands[1])
3982    && REG_OK_FOR_INDEX_P (operands[2])
3983    && FP_REGNO_P (REGNO (operands[3]))"
3984   [(set (mem:DF (plus:SI (match_dup 2) (match_dup 1)))
3985         (match_dup 3))
3986    (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
3987   "")
3989 (define_peephole2
3990   [(set (match_operand:DI 0 "register_operand" "")
3991         (plus:DI (match_operand:DI 1 "register_operand" "")
3992                  (match_operand:DI 2 "register_operand" "")))
3993    (set (mem:DF (match_dup 0))
3994         (match_operand:DF 3 "register_operand" ""))]
3995   "!TARGET_SOFT_FLOAT
3996    && !TARGET_DISABLE_INDEXING
3997    && TARGET_64BIT
3998    && TARGET_NO_SPACE_REGS
3999    && REG_OK_FOR_INDEX_P (operands[1])
4000    && REG_OK_FOR_BASE_P (operands[2])
4001    && FP_REGNO_P (REGNO (operands[3]))"
4002   [(set (mem:DF (plus:DI (match_dup 1) (match_dup 2)))
4003         (match_dup 3))
4004    (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4005   "")
4007 (define_peephole2
4008   [(set (match_operand:DI 0 "register_operand" "")
4009         (plus:DI (match_operand:DI 1 "register_operand" "")
4010                  (match_operand:DI 2 "register_operand" "")))
4011    (set (mem:DF (match_dup 0))
4012         (match_operand:DF 3 "register_operand" ""))]
4013   "!TARGET_SOFT_FLOAT
4014    && !TARGET_DISABLE_INDEXING
4015    && TARGET_64BIT
4016    && TARGET_NO_SPACE_REGS
4017    && REG_OK_FOR_BASE_P (operands[1])
4018    && REG_OK_FOR_INDEX_P (operands[2])
4019    && FP_REGNO_P (REGNO (operands[3]))"
4020   [(set (mem:DF (plus:DI (match_dup 2) (match_dup 1)))
4021         (match_dup 3))
4022    (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4023   "")
4025 (define_insn ""
4026   [(set (match_operand:DF 0 "move_dest_operand"
4027                           "=r,?o,?Q,r,r")
4028         (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
4029                           "rG,r,r,o,RQ"))]
4030   "(register_operand (operands[0], DFmode)
4031     || reg_or_0_operand (operands[1], DFmode))
4032    && !TARGET_64BIT
4033    && TARGET_SOFT_FLOAT"
4034   "*
4036   return pa_output_move_double (operands);
4038   [(set_attr "type" "move,store,store,load,load")
4039    (set_attr "length" "8,8,16,8,16")])
4041 (define_insn ""
4042   [(set (match_operand:DF 0 "move_dest_operand"
4043                           "=!*r,*r,*r,*r,*r,Q,f,f,T")
4044         (match_operand:DF 1 "move_src_operand"
4045                           "!*r,J,N,K,RQ,*rG,fG,RT,f"))]
4046   "(register_operand (operands[0], DFmode)
4047     || reg_or_0_operand (operands[1], DFmode))
4048    && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4049   "@
4050    copy %1,%0
4051    ldi %1,%0
4052    ldil L'%1,%0
4053    depdi,z %z1,%0
4054    ldd%M1 %1,%0
4055    std%M0 %r1,%0
4056    fcpy,dbl %f1,%0
4057    fldd%F1 %1,%0
4058    fstd%F0 %1,%0"
4059   [(set_attr "type" "move,move,move,shift,load,store,fpalu,fpload,fpstore")
4060    (set_attr "pa_combine_type" "addmove")
4061    (set_attr "length" "4,4,4,4,4,4,4,4,4")])
4064 (define_expand "movdi"
4065   [(set (match_operand:DI 0 "general_operand" "")
4066         (match_operand:DI 1 "general_operand" ""))]
4067   ""
4068   "
4070   if (pa_emit_move_sequence (operands, DImode, 0))
4071     DONE;
4074 ;; Handle DImode input reloads requiring %r1 as a scratch register.
4075 (define_expand "reload_indi_r1"
4076   [(set (match_operand:DI 0 "register_operand" "=Z")
4077         (match_operand:DI 1 "non_hard_reg_operand" ""))
4078    (clobber (match_operand:SI 2 "register_operand" "=&a"))]
4079   ""
4080   "
4082   if (pa_emit_move_sequence (operands, DImode, operands[2]))
4083     DONE;
4085   /* We don't want the clobber emitted, so handle this ourselves.  */
4086   emit_insn (gen_rtx_SET (operands[0], operands[1]));
4087   DONE;
4090 ;; Handle DImode input reloads requiring a general register as a
4091 ;; scratch register.
4092 (define_expand "reload_indi"
4093   [(set (match_operand:DI 0 "register_operand" "=Z")
4094         (match_operand:DI 1 "non_hard_reg_operand" ""))
4095    (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4096   ""
4097   "
4099   if (pa_emit_move_sequence (operands, DImode, operands[2]))
4100     DONE;
4102   /* We don't want the clobber emitted, so handle this ourselves.  */
4103   emit_insn (gen_rtx_SET (operands[0], operands[1]));
4104   DONE;
4107 ;; Handle DImode output reloads requiring a general register as a
4108 ;; scratch register.
4109 (define_expand "reload_outdi"
4110   [(set (match_operand:DI 0 "non_hard_reg_operand" "")
4111         (match_operand:DI 1 "register_operand" "Z"))
4112    (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4113   ""
4114   "
4116   if (pa_emit_move_sequence (operands, DImode, operands[2]))
4117     DONE;
4119   /* We don't want the clobber emitted, so handle this ourselves.  */
4120   emit_insn (gen_rtx_SET (operands[0], operands[1]));
4121   DONE;
4124 (define_insn ""
4125   [(set (match_operand:DI 0 "register_operand" "=r")
4126         (high:DI (match_operand 1 "" "")))]
4127   "!TARGET_64BIT"
4128   "*
4130   rtx op0 = operands[0];
4131   rtx op1 = operands[1];
4133   switch (GET_CODE (op1))
4134     {
4135     case CONST_INT:
4136 #if HOST_BITS_PER_WIDE_INT <= 32
4137       operands[0] = operand_subword (op0, 1, 0, DImode);
4138       output_asm_insn (\"ldil L'%1,%0\", operands);
4140       operands[0] = operand_subword (op0, 0, 0, DImode);
4141       if (INTVAL (op1) < 0)
4142         output_asm_insn (\"ldi -1,%0\", operands);
4143       else
4144         output_asm_insn (\"ldi 0,%0\", operands);
4145 #else
4146       operands[0] = operand_subword (op0, 1, 0, DImode);
4147       operands[1] = GEN_INT (INTVAL (op1) & 0xffffffff);
4148       output_asm_insn (\"ldil L'%1,%0\", operands);
4150       operands[0] = operand_subword (op0, 0, 0, DImode);
4151       operands[1] = GEN_INT (INTVAL (op1) >> 32);
4152       output_asm_insn (pa_singlemove_string (operands), operands);
4153 #endif
4154       break;
4156     case CONST_DOUBLE:
4157       operands[0] = operand_subword (op0, 1, 0, DImode);
4158       operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
4159       output_asm_insn (\"ldil L'%1,%0\", operands);
4161       operands[0] = operand_subword (op0, 0, 0, DImode);
4162       operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
4163       output_asm_insn (pa_singlemove_string (operands), operands);
4164       break;
4166     default:
4167       gcc_unreachable ();
4168     }
4169   return \"\";
4171   [(set_attr "type" "move")
4172    (set_attr "length" "12")])
4174 (define_insn ""
4175   [(set (match_operand:DI 0 "move_dest_operand"
4176                           "=r,o,Q,r,r,r,*f,*f,T,?r,?*f")
4177         (match_operand:DI 1 "move_src_operand"
4178                           "rM,r,r,o*R,Q,i,*fM,RT,*f,*f,r"))]
4179   "(register_operand (operands[0], DImode)
4180     || reg_or_0_operand (operands[1], DImode))
4181    && !TARGET_64BIT
4182    && !TARGET_SOFT_FLOAT"
4183   "*
4185   if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
4186        || operands[1] == CONST0_RTX (DFmode))
4187       && !(REG_P (operands[0]) && REG_P (operands[1])
4188            && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
4189     return pa_output_fp_move_double (operands);
4190   return pa_output_move_double (operands);
4192   [(set_attr "type"
4193     "move,store,store,load,load,multi,fpalu,fpload,fpstore,fpstore_load,store_fpload")
4194    (set_attr "length" "8,8,16,8,16,16,4,4,4,12,12")])
4196 (define_insn ""
4197   [(set (match_operand:DI 0 "move_dest_operand"
4198                           "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
4199         (match_operand:DI 1 "move_src_operand"
4200                           "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
4201   "(register_operand (operands[0], DImode)
4202     || reg_or_0_operand (operands[1], DImode))
4203    && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4204   "@
4205    ldd RT'%A1,%0
4206    copy %1,%0
4207    ldi %1,%0
4208    ldil L'%1,%0
4209    depdi,z %z1,%0
4210    ldd%M1 %1,%0
4211    std%M0 %r1,%0
4212    mtsar %r1
4213    {mfctl|mfctl,w} %%sar,%0
4214    fcpy,dbl %f1,%0
4215    fldd%F1 %1,%0
4216    fstd%F0 %1,%0"
4217   [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
4218    (set_attr "pa_combine_type" "addmove")
4219    (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
4221 (define_insn ""
4222   [(set (match_operand:DI 0 "indexed_memory_operand" "=R")
4223         (match_operand:DI 1 "register_operand" "f"))]
4224   "!TARGET_SOFT_FLOAT
4225    && TARGET_64BIT
4226    && !TARGET_DISABLE_INDEXING
4227    && reload_completed"
4228   "fstd%F0 %1,%0"
4229   [(set_attr "type" "fpstore")
4230    (set_attr "pa_combine_type" "addmove")
4231    (set_attr "length" "4")])
4233 (define_peephole2
4234   [(set (match_operand:DI 0 "register_operand" "")
4235         (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4236                           (const_int 8))
4237                  (match_operand:DI 2 "register_operand" "")))
4238    (set (mem:DI (match_dup 0))
4239         (match_operand:DI 3 "register_operand" ""))]
4240   "!TARGET_SOFT_FLOAT
4241    && !TARGET_DISABLE_INDEXING
4242    && TARGET_64BIT
4243    && REG_OK_FOR_BASE_P (operands[2])
4244    && FP_REGNO_P (REGNO (operands[3]))"
4245   [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4246         (match_dup 3))
4247    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4248                                (match_dup 2)))]
4249   "")
4251 (define_peephole2
4252   [(set (match_operand:DI 0 "register_operand" "")
4253         (plus:DI (match_operand:DI 2 "register_operand" "")
4254                  (mult:DI (match_operand:DI 1 "register_operand" "")
4255                           (const_int 8))))
4256    (set (mem:DI (match_dup 0))
4257         (match_operand:DI 3 "register_operand" ""))]
4258   "!TARGET_SOFT_FLOAT
4259    && !TARGET_DISABLE_INDEXING
4260    && TARGET_64BIT
4261    && REG_OK_FOR_BASE_P (operands[2])
4262    && FP_REGNO_P (REGNO (operands[3]))"
4263   [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4264         (match_dup 3))
4265    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4266                                (match_dup 2)))]
4267   "")
4269 (define_peephole2
4270   [(set (match_operand:DI 0 "register_operand" "")
4271         (plus:DI (match_operand:DI 1 "register_operand" "")
4272                  (match_operand:DI 2 "register_operand" "")))
4273    (set (mem:DI (match_dup 0))
4274         (match_operand:DI 3 "register_operand" ""))]
4275   "!TARGET_SOFT_FLOAT
4276    && !TARGET_DISABLE_INDEXING
4277    && TARGET_64BIT
4278    && TARGET_NO_SPACE_REGS
4279    && REG_OK_FOR_INDEX_P (operands[1])
4280    && REG_OK_FOR_BASE_P (operands[2])
4281    && FP_REGNO_P (REGNO (operands[3]))"
4282   [(set (mem:DI (plus:DI (match_dup 1) (match_dup 2)))
4283         (match_dup 3))
4284    (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4285   "")
4287 (define_peephole2
4288   [(set (match_operand:DI 0 "register_operand" "")
4289         (plus:DI (match_operand:DI 1 "register_operand" "")
4290                  (match_operand:DI 2 "register_operand" "")))
4291    (set (mem:DI (match_dup 0))
4292         (match_operand:DI 3 "register_operand" ""))]
4293   "!TARGET_SOFT_FLOAT
4294    && !TARGET_DISABLE_INDEXING
4295    && TARGET_64BIT
4296    && TARGET_NO_SPACE_REGS
4297    && REG_OK_FOR_BASE_P (operands[1])
4298    && REG_OK_FOR_INDEX_P (operands[2])
4299    && FP_REGNO_P (REGNO (operands[3]))"
4300   [(set (mem:DI (plus:DI (match_dup 2) (match_dup 1)))
4301         (match_dup 3))
4302    (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4303   "")
4305 (define_insn ""
4306   [(set (match_operand:DI 0 "move_dest_operand"
4307                           "=r,o,Q,r,r,r")
4308         (match_operand:DI 1 "general_operand"
4309                           "rM,r,r,o,Q,i"))]
4310   "(register_operand (operands[0], DImode)
4311     || reg_or_0_operand (operands[1], DImode))
4312    && !TARGET_64BIT
4313    && TARGET_SOFT_FLOAT"
4314   "*
4316   return pa_output_move_double (operands);
4318   [(set_attr "type" "move,store,store,load,load,multi")
4319    (set_attr "length" "8,8,16,8,16,16")])
4321 (define_insn ""
4322   [(set (match_operand:DI 0 "register_operand" "=r,&r")
4323         (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
4324                    (match_operand:DI 2 "immediate_operand" "i,i")))]
4325   "!TARGET_64BIT"
4326   "*
4328   /* Don't output a 64-bit constant, since we can't trust the assembler to
4329      handle it correctly.  */
4330   if (GET_CODE (operands[2]) == CONST_DOUBLE)
4331     operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
4332   else if (HOST_BITS_PER_WIDE_INT > 32
4333            && GET_CODE (operands[2]) == CONST_INT)
4334     operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffffffff);
4335   if (which_alternative == 1)
4336     output_asm_insn (\"copy %1,%0\", operands);
4337   return \"ldo R'%G2(%R1),%R0\";
4339   [(set_attr "type" "move,move")
4340    (set_attr "length" "4,8")])
4342 (define_expand "movsf"
4343   [(set (match_operand:SF 0 "general_operand" "")
4344         (match_operand:SF 1 "general_operand" ""))]
4345   ""
4346   "
4348   if (pa_emit_move_sequence (operands, SFmode, 0))
4349     DONE;
4352 ;; Handle SFmode input reloads requiring %r1 as a scratch register.
4353 (define_expand "reload_insf_r1"
4354   [(set (match_operand:SF 0 "register_operand" "=Z")
4355         (match_operand:SF 1 "non_hard_reg_operand" ""))
4356    (clobber (match_operand:SI 2 "register_operand" "=&a"))]
4357   ""
4358   "
4360   if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4361     DONE;
4363   /* We don't want the clobber emitted, so handle this ourselves.  */
4364   emit_insn (gen_rtx_SET (operands[0], operands[1]));
4365   DONE;
4368 ;; Handle SFmode input reloads requiring a general register as a
4369 ;; scratch register.
4370 (define_expand "reload_insf"
4371   [(set (match_operand:SF 0 "register_operand" "=Z")
4372         (match_operand:SF 1 "non_hard_reg_operand" ""))
4373    (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4374   ""
4375   "
4377   if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4378     DONE;
4380   /* We don't want the clobber emitted, so handle this ourselves.  */
4381   emit_insn (gen_rtx_SET (operands[0], operands[1]));
4382   DONE;
4385 ;; Handle SFmode output reloads requiring a general register as a
4386 ;; scratch register.
4387 (define_expand "reload_outsf"
4388   [(set (match_operand:SF 0 "non_hard_reg_operand" "")
4389         (match_operand:SF 1  "register_operand" "Z"))
4390    (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4391   ""
4392   "
4394   if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4395     DONE;
4397   /* We don't want the clobber emitted, so handle this ourselves.  */
4398   emit_insn (gen_rtx_SET (operands[0], operands[1]));
4399   DONE;
4402 (define_insn ""
4403   [(set (match_operand:SF 0 "move_dest_operand"
4404                           "=f,!*r,f,*r,T,Q,?*r,?f")
4405         (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4406                           "fG,!*rG,RT,RQ,f,*rG,f,*r"))]
4407   "(register_operand (operands[0], SFmode)
4408     || reg_or_0_operand (operands[1], SFmode))
4409    && !TARGET_SOFT_FLOAT
4410    && !TARGET_64BIT"
4411   "@
4412    fcpy,sgl %f1,%0
4413    copy %r1,%0
4414    fldw%F1 %1,%0
4415    ldw%M1 %1,%0
4416    fstw%F0 %1,%0
4417    stw%M0 %r1,%0
4418    {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
4419    {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
4420   [(set_attr "type" "fpalu,move,fpload,load,fpstore,store,fpstore_load,store_fpload")
4421    (set_attr "pa_combine_type" "addmove")
4422    (set_attr "length" "4,4,4,4,4,4,8,8")])
4424 (define_insn ""
4425   [(set (match_operand:SF 0 "move_dest_operand"
4426                           "=f,!*r,f,*r,T,Q")
4427         (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4428                           "fG,!*rG,RT,RQ,f,*rG"))]
4429   "(register_operand (operands[0], SFmode)
4430     || reg_or_0_operand (operands[1], SFmode))
4431    && !TARGET_SOFT_FLOAT
4432    && TARGET_64BIT"
4433   "@
4434    fcpy,sgl %f1,%0
4435    copy %r1,%0
4436    fldw%F1 %1,%0
4437    ldw%M1 %1,%0
4438    fstw%F0 %1,%0
4439    stw%M0 %r1,%0"
4440   [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
4441    (set_attr "pa_combine_type" "addmove")
4442    (set_attr "length" "4,4,4,4,4,4")])
4444 (define_insn ""
4445   [(set (match_operand:SF 0 "indexed_memory_operand" "=R")
4446         (match_operand:SF 1 "register_operand" "f"))]
4447   "!TARGET_SOFT_FLOAT
4448    && !TARGET_DISABLE_INDEXING
4449    && reload_completed"
4450   "fstw%F0 %1,%0"
4451   [(set_attr "type" "fpstore")
4452    (set_attr "pa_combine_type" "addmove")
4453    (set_attr "length" "4")])
4455 (define_peephole2
4456   [(set (match_operand:SI 0 "register_operand" "")
4457         (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
4458                           (const_int 4))
4459                  (match_operand:SI 2 "register_operand" "")))
4460    (set (mem:SF (match_dup 0))
4461         (match_operand:SF 3 "register_operand" ""))]
4462   "!TARGET_SOFT_FLOAT
4463    && !TARGET_DISABLE_INDEXING
4464    && REG_OK_FOR_BASE_P (operands[2])
4465    && FP_REGNO_P (REGNO (operands[3]))"
4466   [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4467         (match_dup 3))
4468    (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
4469                                (match_dup 2)))]
4470   "")
4472 (define_peephole2
4473   [(set (match_operand:SI 0 "register_operand" "")
4474         (plus:SI (match_operand:SI 2 "register_operand" "")
4475                  (mult:SI (match_operand:SI 1 "register_operand" "")
4476                           (const_int 4))))
4477    (set (mem:SF (match_dup 0))
4478         (match_operand:SF 3 "register_operand" ""))]
4479   "!TARGET_SOFT_FLOAT
4480    && !TARGET_DISABLE_INDEXING
4481    && REG_OK_FOR_BASE_P (operands[2])
4482    && FP_REGNO_P (REGNO (operands[3]))"
4483   [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4484         (match_dup 3))
4485    (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
4486                                (match_dup 2)))]
4487   "")
4489 (define_peephole2
4490   [(set (match_operand:DI 0 "register_operand" "")
4491         (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4492                           (const_int 4))
4493                  (match_operand:DI 2 "register_operand" "")))
4494    (set (mem:SF (match_dup 0))
4495         (match_operand:SF 3 "register_operand" ""))]
4496   "!TARGET_SOFT_FLOAT
4497    && !TARGET_DISABLE_INDEXING
4498    && TARGET_64BIT
4499    && REG_OK_FOR_BASE_P (operands[2])
4500    && FP_REGNO_P (REGNO (operands[3]))"
4501   [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4502         (match_dup 3))
4503    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
4504                                (match_dup 2)))]
4505   "")
4507 (define_peephole2
4508   [(set (match_operand:DI 0 "register_operand" "")
4509         (plus:DI (match_operand:DI 2 "register_operand" "")
4510                  (mult:DI (match_operand:DI 1 "register_operand" "")
4511                           (const_int 4))))
4512    (set (mem:SF (match_dup 0))
4513         (match_operand:SF 3 "register_operand" ""))]
4514   "!TARGET_SOFT_FLOAT
4515    && !TARGET_DISABLE_INDEXING
4516    && TARGET_64BIT
4517    && REG_OK_FOR_BASE_P (operands[2])
4518    && FP_REGNO_P (REGNO (operands[3]))"
4519   [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4520         (match_dup 3))
4521    (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
4522                                (match_dup 2)))]
4523   "")
4525 (define_peephole2
4526   [(set (match_operand:SI 0 "register_operand" "")
4527         (plus:SI (match_operand:SI 1 "register_operand" "")
4528                  (match_operand:SI 2 "register_operand" "")))
4529    (set (mem:SF (match_dup 0))
4530         (match_operand:SF 3 "register_operand" ""))]
4531   "!TARGET_SOFT_FLOAT
4532    && !TARGET_DISABLE_INDEXING
4533    && TARGET_NO_SPACE_REGS
4534    && REG_OK_FOR_INDEX_P (operands[1])
4535    && REG_OK_FOR_BASE_P (operands[2])
4536    && FP_REGNO_P (REGNO (operands[3]))"
4537   [(set (mem:SF (plus:SI (match_dup 1) (match_dup 2)))
4538         (match_dup 3))
4539    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
4540   "")
4542 (define_peephole2
4543   [(set (match_operand:SI 0 "register_operand" "")
4544         (plus:SI (match_operand:SI 1 "register_operand" "")
4545                  (match_operand:SI 2 "register_operand" "")))
4546    (set (mem:SF (match_dup 0))
4547         (match_operand:SF 3 "register_operand" ""))]
4548   "!TARGET_SOFT_FLOAT
4549    && !TARGET_DISABLE_INDEXING
4550    && TARGET_NO_SPACE_REGS
4551    && REG_OK_FOR_BASE_P (operands[1])
4552    && REG_OK_FOR_INDEX_P (operands[2])
4553    && FP_REGNO_P (REGNO (operands[3]))"
4554   [(set (mem:SF (plus:SI (match_dup 2) (match_dup 1)))
4555         (match_dup 3))
4556    (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
4557   "")
4559 (define_peephole2
4560   [(set (match_operand:DI 0 "register_operand" "")
4561         (plus:DI (match_operand:DI 1 "register_operand" "")
4562                  (match_operand:DI 2 "register_operand" "")))
4563    (set (mem:SF (match_dup 0))
4564         (match_operand:SF 3 "register_operand" ""))]
4565   "!TARGET_SOFT_FLOAT
4566    && !TARGET_DISABLE_INDEXING
4567    && TARGET_64BIT
4568    && TARGET_NO_SPACE_REGS
4569    && REG_OK_FOR_INDEX_P (operands[1])
4570    && REG_OK_FOR_BASE_P (operands[2])
4571    && FP_REGNO_P (REGNO (operands[3]))"
4572   [(set (mem:SF (plus:DI (match_dup 1) (match_dup 2)))
4573         (match_dup 3))
4574    (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4575   "")
4577 (define_peephole2
4578   [(set (match_operand:DI 0 "register_operand" "")
4579         (plus:DI (match_operand:DI 1 "register_operand" "")
4580                  (match_operand:DI 2 "register_operand" "")))
4581    (set (mem:SF (match_dup 0))
4582         (match_operand:SF 3 "register_operand" ""))]
4583   "!TARGET_SOFT_FLOAT
4584    && !TARGET_DISABLE_INDEXING
4585    && TARGET_64BIT
4586    && TARGET_NO_SPACE_REGS
4587    && REG_OK_FOR_BASE_P (operands[1])
4588    && REG_OK_FOR_INDEX_P (operands[2])
4589    && FP_REGNO_P (REGNO (operands[3]))"
4590   [(set (mem:SF (plus:DI (match_dup 2) (match_dup 1)))
4591         (match_dup 3))
4592    (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4593   "")
4595 (define_insn ""
4596   [(set (match_operand:SF 0 "move_dest_operand"
4597                           "=r,r,Q")
4598         (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4599                           "rG,RQ,rG"))]
4600   "(register_operand (operands[0], SFmode)
4601     || reg_or_0_operand (operands[1], SFmode))
4602    && TARGET_SOFT_FLOAT"
4603   "@
4604    copy %r1,%0
4605    ldw%M1 %1,%0
4606    stw%M0 %r1,%0"
4607   [(set_attr "type" "move,load,store")
4608    (set_attr "pa_combine_type" "addmove")
4609    (set_attr "length" "4,4,4")])
4613 ;;- zero extension instructions
4614 ;; We have define_expand for zero extension patterns to make sure the
4615 ;; operands get loaded into registers.  The define_insns accept
4616 ;; memory operands.  This gives us better overall code than just
4617 ;; having a pattern that does or does not accept memory operands.
4619 (define_expand "zero_extendqihi2"
4620   [(set (match_operand:HI 0 "register_operand" "")
4621         (zero_extend:HI
4622          (match_operand:QI 1 "register_operand" "")))]
4623   ""
4624   "")
4626 (define_insn ""
4627   [(set (match_operand:HI 0 "register_operand" "=r,r")
4628         (zero_extend:HI
4629          (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4630   "GET_CODE (operands[1]) != CONST_INT"
4631   "@
4632    {extru|extrw,u} %1,31,8,%0
4633    ldb%M1 %1,%0"
4634   [(set_attr "type" "shift,load")
4635    (set_attr "length" "4,4")])
4637 (define_expand "zero_extendqisi2"
4638   [(set (match_operand:SI 0 "register_operand" "")
4639         (zero_extend:SI
4640          (match_operand:QI 1 "register_operand" "")))]
4641   ""
4642   "")
4644 (define_insn ""
4645   [(set (match_operand:SI 0 "register_operand" "=r,r")
4646         (zero_extend:SI
4647          (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4648   "GET_CODE (operands[1]) != CONST_INT"
4649   "@
4650    {extru|extrw,u} %1,31,8,%0
4651    ldb%M1 %1,%0"
4652   [(set_attr "type" "shift,load")
4653    (set_attr "length" "4,4")])
4655 (define_expand "zero_extendhisi2"
4656   [(set (match_operand:SI 0 "register_operand" "")
4657         (zero_extend:SI
4658          (match_operand:HI 1 "register_operand" "")))]
4659   ""
4660   "")
4662 (define_insn ""
4663   [(set (match_operand:SI 0 "register_operand" "=r,r")
4664         (zero_extend:SI
4665          (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4666   "GET_CODE (operands[1]) != CONST_INT"
4667   "@
4668    {extru|extrw,u} %1,31,16,%0
4669    ldh%M1 %1,%0"
4670   [(set_attr "type" "shift,load")
4671    (set_attr "length" "4,4")])
4673 (define_expand "zero_extendqidi2"
4674   [(set (match_operand:DI 0 "register_operand" "")
4675         (zero_extend:DI
4676          (match_operand:QI 1 "register_operand" "")))]
4677   "TARGET_64BIT"
4678   "")
4680 (define_insn ""
4681   [(set (match_operand:DI 0 "register_operand" "=r,r")
4682         (zero_extend:DI
4683          (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4684   "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4685   "@
4686    extrd,u %1,63,8,%0
4687    ldb%M1 %1,%0"
4688   [(set_attr "type" "shift,load")
4689    (set_attr "length" "4,4")])
4691 (define_expand "zero_extendhidi2"
4692   [(set (match_operand:DI 0 "register_operand" "")
4693         (zero_extend:DI
4694          (match_operand:HI 1 "register_operand" "")))]
4695   "TARGET_64BIT"
4696   "")
4698 (define_insn ""
4699   [(set (match_operand:DI 0 "register_operand" "=r,r")
4700         (zero_extend:DI
4701          (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4702   "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4703   "@
4704    extrd,u %1,63,16,%0
4705    ldh%M1 %1,%0"
4706   [(set_attr "type" "shift,load")
4707    (set_attr "length" "4,4")])
4709 (define_expand "zero_extendsidi2"
4710   [(set (match_operand:DI 0 "register_operand" "")
4711         (zero_extend:DI
4712          (match_operand:SI 1 "register_operand" "")))]
4713   "TARGET_64BIT"
4714   "")
4716 (define_insn ""
4717   [(set (match_operand:DI 0 "register_operand" "=r,r")
4718         (zero_extend:DI
4719          (match_operand:SI 1 "move_src_operand" "r,RQ")))]
4720   "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4721   "@
4722    extrd,u %1,63,32,%0
4723    ldw%M1 %1,%0"
4724   [(set_attr "type" "shift,load")
4725    (set_attr "length" "4,4")])
4727 ;;- sign extension instructions
4729 (define_insn "extendhisi2"
4730   [(set (match_operand:SI 0 "register_operand" "=r")
4731         (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
4732   ""
4733   "{extrs|extrw,s} %1,31,16,%0"
4734   [(set_attr "type" "shift")
4735    (set_attr "length" "4")])
4737 (define_insn "extendqihi2"
4738   [(set (match_operand:HI 0 "register_operand" "=r")
4739         (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
4740   ""
4741   "{extrs|extrw,s} %1,31,8,%0"
4742   [(set_attr "type" "shift") 
4743   (set_attr "length" "4")])
4745 (define_insn "extendqisi2"
4746   [(set (match_operand:SI 0 "register_operand" "=r")
4747         (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
4748   ""
4749   "{extrs|extrw,s} %1,31,8,%0"
4750   [(set_attr "type" "shift")
4751    (set_attr "length" "4")])
4753 (define_insn "extendqidi2"
4754   [(set (match_operand:DI 0 "register_operand" "=r")
4755         (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
4756   "TARGET_64BIT"
4757   "extrd,s %1,63,8,%0"
4758   [(set_attr "type" "shift") 
4759   (set_attr "length" "4")])
4761 (define_insn "extendhidi2"
4762   [(set (match_operand:DI 0 "register_operand" "=r")
4763         (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
4764   "TARGET_64BIT"
4765   "extrd,s %1,63,16,%0"
4766   [(set_attr "type" "shift") 
4767   (set_attr "length" "4")])
4769 (define_insn "extendsidi2"
4770   [(set (match_operand:DI 0 "register_operand" "=r")
4771         (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))]
4772   "TARGET_64BIT"
4773   "extrd,s %1,63,32,%0"
4774   [(set_attr "type" "shift") 
4775   (set_attr "length" "4")])
4778 ;; Conversions between float and double.
4780 (define_insn "extendsfdf2"
4781   [(set (match_operand:DF 0 "register_operand" "=f")
4782         (float_extend:DF
4783          (match_operand:SF 1 "register_operand" "f")))]
4784   "! TARGET_SOFT_FLOAT"
4785   "{fcnvff|fcnv},sgl,dbl %1,%0"
4786   [(set_attr "type" "fpalu")
4787    (set_attr "length" "4")])
4789 (define_insn "truncdfsf2"
4790   [(set (match_operand:SF 0 "register_operand" "=f")
4791         (float_truncate:SF
4792          (match_operand:DF 1 "register_operand" "f")))]
4793   "! TARGET_SOFT_FLOAT"
4794   "{fcnvff|fcnv},dbl,sgl %1,%0"
4795   [(set_attr "type" "fpalu")
4796    (set_attr "length" "4")])
4798 ;; Conversion between fixed point and floating point.
4799 ;; Note that among the fix-to-float insns
4800 ;; the ones that start with SImode come first.
4801 ;; That is so that an operand that is a CONST_INT
4802 ;; (and therefore lacks a specific machine mode).
4803 ;; will be recognized as SImode (which is always valid)
4804 ;; rather than as QImode or HImode.
4806 ;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
4807 ;; to be reloaded by putting the constant into memory.
4808 ;; It must come before the more general floatsisf2 pattern.
4809 (define_insn ""
4810   [(set (match_operand:SF 0 "register_operand" "=f")
4811         (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
4812   "! TARGET_SOFT_FLOAT"
4813   "fldw%F1 %1,%0\;{fcnvxf,sgl,sgl|fcnv,w,sgl} %0,%0"
4814   [(set_attr "type" "fpalu")
4815    (set_attr "length" "8")])
4817 (define_insn "floatsisf2"
4818   [(set (match_operand:SF 0 "register_operand" "=f")
4819         (float:SF (match_operand:SI 1 "register_operand" "f")))]
4820   "! TARGET_SOFT_FLOAT"
4821   "{fcnvxf,sgl,sgl|fcnv,w,sgl} %1,%0"
4822   [(set_attr "type" "fpalu")
4823    (set_attr "length" "4")])
4825 ;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
4826 ;; to be reloaded by putting the constant into memory.
4827 ;; It must come before the more general floatsidf2 pattern.
4828 (define_insn ""
4829   [(set (match_operand:DF 0 "register_operand" "=f")
4830         (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
4831   "! TARGET_SOFT_FLOAT"
4832   "fldw%F1 %1,%0\;{fcnvxf,sgl,dbl|fcnv,w,dbl} %0,%0"
4833   [(set_attr "type" "fpalu")
4834    (set_attr "length" "8")])
4836 (define_insn "floatsidf2"
4837   [(set (match_operand:DF 0 "register_operand" "=f")
4838         (float:DF (match_operand:SI 1 "register_operand" "f")))]
4839   "! TARGET_SOFT_FLOAT"
4840   "{fcnvxf,sgl,dbl|fcnv,w,dbl} %1,%0"
4841   [(set_attr "type" "fpalu")
4842    (set_attr "length" "4")])
4844 (define_expand "floatunssisf2"
4845   [(set (subreg:SI (match_dup 2) 4)
4846         (match_operand:SI 1 "register_operand" ""))
4847    (set (subreg:SI (match_dup 2) 0)
4848         (const_int 0))
4849    (set (match_operand:SF 0 "register_operand" "")
4850         (float:SF (match_dup 2)))]
4851   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4852   "
4854   if (TARGET_PA_20)
4855     {
4856       emit_insn (gen_floatunssisf2_pa20 (operands[0], operands[1]));
4857       DONE;
4858     }
4859   operands[2] = gen_reg_rtx (DImode);
4862 (define_expand "floatunssidf2"
4863   [(set (subreg:SI (match_dup 2) 4)
4864         (match_operand:SI 1 "register_operand" ""))
4865    (set (subreg:SI (match_dup 2) 0)
4866         (const_int 0))
4867    (set (match_operand:DF 0 "register_operand" "")
4868         (float:DF (match_dup 2)))]
4869   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4870   "
4872   if (TARGET_PA_20)
4873     {
4874       emit_insn (gen_floatunssidf2_pa20 (operands[0], operands[1]));
4875       DONE;
4876     }
4877   operands[2] = gen_reg_rtx (DImode);
4880 (define_insn "floatdisf2"
4881   [(set (match_operand:SF 0 "register_operand" "=f")
4882         (float:SF (match_operand:DI 1 "register_operand" "f")))]
4883   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4884   "{fcnvxf,dbl,sgl|fcnv,dw,sgl} %1,%0"
4885   [(set_attr "type" "fpalu")
4886    (set_attr "length" "4")])
4888 (define_insn "floatdidf2"
4889   [(set (match_operand:DF 0 "register_operand" "=f")
4890         (float:DF (match_operand:DI 1 "register_operand" "f")))]
4891   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4892   "{fcnvxf,dbl,dbl|fcnv,dw,dbl} %1,%0"
4893   [(set_attr "type" "fpalu")
4894    (set_attr "length" "4")])
4896 ;; Convert a float to an actual integer.
4897 ;; Truncation is performed as part of the conversion.
4899 (define_insn "fix_truncsfsi2"
4900   [(set (match_operand:SI 0 "register_operand" "=f")
4901         (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4902   "! TARGET_SOFT_FLOAT"
4903   "{fcnvfxt,sgl,sgl|fcnv,t,sgl,w} %1,%0"
4904   [(set_attr "type" "fpalu")
4905    (set_attr "length" "4")])
4907 (define_insn "fix_truncdfsi2"
4908   [(set (match_operand:SI 0 "register_operand" "=f")
4909         (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4910   "! TARGET_SOFT_FLOAT"
4911   "{fcnvfxt,dbl,sgl|fcnv,t,dbl,w} %1,%0"
4912   [(set_attr "type" "fpalu")
4913    (set_attr "length" "4")])
4915 (define_insn "fix_truncsfdi2"
4916   [(set (match_operand:DI 0 "register_operand" "=f")
4917         (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4918   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4919   "{fcnvfxt,sgl,dbl|fcnv,t,sgl,dw} %1,%0"
4920   [(set_attr "type" "fpalu")
4921    (set_attr "length" "4")])
4923 (define_insn "fix_truncdfdi2"
4924   [(set (match_operand:DI 0 "register_operand" "=f")
4925         (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4926   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4927   "{fcnvfxt,dbl,dbl|fcnv,t,dbl,dw} %1,%0"
4928   [(set_attr "type" "fpalu")
4929    (set_attr "length" "4")])
4931 (define_insn "floatunssidf2_pa20"
4932   [(set (match_operand:DF 0 "register_operand" "=f")
4933         (unsigned_float:DF (match_operand:SI 1 "register_operand" "f")))]
4934   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4935   "fcnv,uw,dbl %1,%0"
4936   [(set_attr "type" "fpalu")
4937    (set_attr "length" "4")])
4939 (define_insn "floatunssisf2_pa20"
4940   [(set (match_operand:SF 0 "register_operand" "=f")
4941         (unsigned_float:SF (match_operand:SI 1 "register_operand" "f")))]
4942   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4943   "fcnv,uw,sgl %1,%0"
4944   [(set_attr "type" "fpalu")
4945    (set_attr "length" "4")])
4947 (define_insn "floatunsdisf2"
4948   [(set (match_operand:SF 0 "register_operand" "=f")
4949         (unsigned_float:SF (match_operand:DI 1 "register_operand" "f")))]
4950   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4951   "fcnv,udw,sgl %1,%0"
4952   [(set_attr "type" "fpalu")
4953    (set_attr "length" "4")])
4955 (define_insn "floatunsdidf2"
4956   [(set (match_operand:DF 0 "register_operand" "=f")
4957         (unsigned_float:DF (match_operand:DI 1 "register_operand" "f")))]
4958   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4959   "fcnv,udw,dbl %1,%0"
4960   [(set_attr "type" "fpalu")
4961    (set_attr "length" "4")])
4963 (define_insn "fixuns_truncsfsi2"
4964   [(set (match_operand:SI 0 "register_operand" "=f")
4965         (unsigned_fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4966   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4967   "fcnv,t,sgl,uw %1,%0"
4968   [(set_attr "type" "fpalu")
4969    (set_attr "length" "4")])
4971 (define_insn "fixuns_truncdfsi2"
4972   [(set (match_operand:SI 0 "register_operand" "=f")
4973         (unsigned_fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4974   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4975   "fcnv,t,dbl,uw %1,%0"
4976   [(set_attr "type" "fpalu")
4977    (set_attr "length" "4")])
4979 (define_insn "fixuns_truncsfdi2"
4980   [(set (match_operand:DI 0 "register_operand" "=f")
4981         (unsigned_fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4982   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4983   "fcnv,t,sgl,udw %1,%0"
4984   [(set_attr "type" "fpalu")
4985    (set_attr "length" "4")])
4987 (define_insn "fixuns_truncdfdi2"
4988   [(set (match_operand:DI 0 "register_operand" "=f")
4989         (unsigned_fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4990   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4991   "fcnv,t,dbl,udw %1,%0"
4992   [(set_attr "type" "fpalu")
4993    (set_attr "length" "4")])
4995 ;;- arithmetic instructions
4997 (define_expand "adddi3"
4998   [(set (match_operand:DI 0 "register_operand" "")
4999         (plus:DI (match_operand:DI 1 "register_operand" "")
5000                  (match_operand:DI 2 "adddi3_operand" "")))]
5001   ""
5002   "")
5004 (define_insn ""
5005   [(set (match_operand:DI 0 "register_operand" "=r")
5006         (plus:DI (match_operand:DI 1 "register_operand" "%r")
5007                  (match_operand:DI 2 "arith11_operand" "rI")))]
5008   "!TARGET_64BIT"
5009   "*
5011   if (GET_CODE (operands[2]) == CONST_INT)
5012     {
5013       if (INTVAL (operands[2]) >= 0)
5014         return \"addi %2,%R1,%R0\;{addc|add,c} %1,%%r0,%0\";
5015       else
5016         return \"addi %2,%R1,%R0\;{subb|sub,b} %1,%%r0,%0\";
5017     }
5018   else
5019     return \"add %R2,%R1,%R0\;{addc|add,c} %2,%1,%0\";
5021   [(set_attr "type" "binary")
5022    (set_attr "length" "8")])
5024 (define_insn ""
5025   [(set (match_operand:DI 0 "register_operand" "=r,r")
5026         (plus:DI (match_operand:DI 1 "register_operand" "%r,r")
5027                  (match_operand:DI 2 "arith14_operand" "r,J")))]
5028   "TARGET_64BIT"
5029   "@
5030    add,l %1,%2,%0
5031    ldo %2(%1),%0"
5032   [(set_attr "type" "binary,binary")
5033    (set_attr "pa_combine_type" "addmove")
5034    (set_attr "length" "4,4")])
5036 (define_insn ""
5037   [(set (match_operand:DI 0 "register_operand" "=r")
5038         (plus:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5039                  (match_operand:DI 2 "register_operand" "r")))]
5040   "TARGET_64BIT"
5041   "uaddcm %2,%1,%0"
5042   [(set_attr "type" "binary")
5043    (set_attr "length" "4")])
5045 (define_insn ""
5046   [(set (match_operand:SI 0 "register_operand" "=r")
5047         (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5048                  (match_operand:SI 2 "register_operand" "r")))]
5049   ""
5050   "uaddcm %2,%1,%0"
5051   [(set_attr "type" "binary")
5052    (set_attr "length" "4")])
5054 (define_expand "addvdi3"
5055   [(parallel [(set (match_operand:DI 0 "register_operand" "")
5056                    (plus:DI (match_operand:DI 1 "reg_or_0_operand" "")
5057                             (match_operand:DI 2 "arith11_operand" "")))
5058               (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
5059                                     (sign_extend:TI (match_dup 2)))
5060                            (sign_extend:TI (plus:DI (match_dup 1)
5061                                                     (match_dup 2))))
5062                        (const_int 0))])]
5063   ""
5064   "")
5066 (define_insn ""
5067   [(set (match_operand:DI 0 "register_operand" "=r,r")
5068         (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rM,rM")
5069                  (match_operand:DI 2 "arith11_operand" "r,I")))
5070    (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
5071                          (sign_extend:TI (match_dup 2)))
5072                 (sign_extend:TI (plus:DI (match_dup 1)
5073                                          (match_dup 2))))
5074             (const_int 0))]
5075   "TARGET_64BIT"
5076   "@
5077   add,tsv,* %2,%1,%0
5078   addi,tsv,* %2,%1,%0"
5079   [(set_attr "type" "binary,binary")
5080    (set_attr "length" "4,4")])
5082 (define_insn ""
5083   [(set (match_operand:DI 0 "register_operand" "=r")
5084         (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rM")
5085                  (match_operand:DI 2 "arith11_operand" "rI")))
5086    (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
5087                          (sign_extend:TI (match_dup 2)))
5088                 (sign_extend:TI (plus:DI (match_dup 1)
5089                                          (match_dup 2))))
5090             (const_int 0))]
5091   "!TARGET_64BIT"
5092   "*
5094   if (GET_CODE (operands[2]) == CONST_INT)
5095     {
5096       if (INTVAL (operands[2]) >= 0)
5097         return \"addi %2,%R1,%R0\;{addco|add,c,tsv} %1,%%r0,%0\";
5098       else
5099         return \"addi %2,%R1,%R0\;{subbo|sub,b,tsv} %1,%%r0,%0\";
5100     }
5101   else
5102     return \"add %R2,%R1,%R0\;{addco|add,c,tsv} %2,%1,%0\";
5104   [(set_attr "type" "binary")
5105    (set_attr "length" "8")])
5107 ;; define_splits to optimize cases of adding a constant integer
5108 ;; to a register when the constant does not fit in 14 bits.  */
5109 (define_split
5110   [(set (match_operand:SI 0 "register_operand" "")
5111         (plus:SI (match_operand:SI 1 "register_operand" "")
5112                  (match_operand:SI 2 "const_int_operand" "")))
5113    (clobber (match_operand:SI 4 "register_operand" ""))]
5114   "! pa_cint_ok_for_move (INTVAL (operands[2]))
5115    && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
5116   [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
5117    (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
5118   "
5120   int val = INTVAL (operands[2]);
5121   int low = (val < 0) ? -0x2000 : 0x1fff;
5122   int rest = val - low;
5124   operands[2] = GEN_INT (rest);
5125   operands[3] = GEN_INT (low);
5128 (define_split
5129   [(set (match_operand:SI 0 "register_operand" "")
5130         (plus:SI (match_operand:SI 1 "register_operand" "")
5131                  (match_operand:SI 2 "const_int_operand" "")))
5132    (clobber (match_operand:SI 4 "register_operand" ""))]
5133   "! pa_cint_ok_for_move (INTVAL (operands[2]))"
5134   [(set (match_dup 4) (match_dup 2))
5135    (set (match_dup 0) (plus:SI (ashift:SI (match_dup 4) (match_dup 3))
5136                                (match_dup 1)))]
5137   "
5139   HOST_WIDE_INT intval = INTVAL (operands[2]);
5141   /* Try dividing the constant by 2, then 4, and finally 8 to see
5142      if we can get a constant which can be loaded into a register
5143      in a single instruction (pa_cint_ok_for_move). 
5145      If that fails, try to negate the constant and subtract it
5146      from our input operand.  */
5147   if (intval % 2 == 0 && pa_cint_ok_for_move (intval / 2))
5148     {
5149       operands[2] = GEN_INT (intval / 2);
5150       operands[3] = const1_rtx;
5151     }
5152   else if (intval % 4 == 0 && pa_cint_ok_for_move (intval / 4))
5153     {
5154       operands[2] = GEN_INT (intval / 4);
5155       operands[3] = const2_rtx;
5156     }
5157   else if (intval % 8 == 0 && pa_cint_ok_for_move (intval / 8))
5158     {
5159       operands[2] = GEN_INT (intval / 8);
5160       operands[3] = GEN_INT (3);
5161     }
5162   else if (pa_cint_ok_for_move (-intval))
5163     {
5164       emit_insn (gen_rtx_SET (operands[4], GEN_INT (-intval)));
5165       emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
5166       DONE;
5167     }
5168   else
5169     FAIL;
5172 (define_insn "addsi3"
5173   [(set (match_operand:SI 0 "register_operand" "=r,r")
5174         (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
5175                  (match_operand:SI 2 "arith14_operand" "r,J")))]
5176   ""
5177   "@
5178    {addl|add,l} %1,%2,%0
5179    ldo %2(%1),%0"
5180   [(set_attr "type" "binary,binary")
5181    (set_attr "pa_combine_type" "addmove")
5182    (set_attr "length" "4,4")])
5184 (define_insn "addvsi3"
5185   [(set (match_operand:SI 0 "register_operand" "=r,r")
5186         (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rM,rM")
5187                  (match_operand:SI 2 "arith11_operand" "r,I")))
5188    (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
5189                          (sign_extend:DI (match_dup 2)))
5190                 (sign_extend:DI (plus:SI (match_dup 1)
5191                                          (match_dup 2))))
5192             (const_int 0))]
5193   ""
5194   "@
5195   {addo|add,tsv} %2,%1,%0
5196   {addio|addi,tsv} %2,%1,%0"
5197   [(set_attr "type" "binary,binary")
5198    (set_attr "length" "4,4")])
5200 (define_expand "subdi3"
5201   [(set (match_operand:DI 0 "register_operand" "")
5202         (minus:DI (match_operand:DI 1 "arith11_operand" "")
5203                   (match_operand:DI 2 "reg_or_0_operand" "")))]
5204   ""
5205   "")
5207 (define_insn ""
5208   [(set (match_operand:DI 0 "register_operand" "=r,r,!q")
5209         (minus:DI (match_operand:DI 1 "arith11_operand" "r,I,!U")
5210                   (match_operand:DI 2 "reg_or_0_operand" "rM,rM,!rM")))]
5211   "TARGET_64BIT"
5212   "@
5213    sub %1,%2,%0
5214    subi %1,%2,%0
5215    mtsarcm %2"
5216   [(set_attr "type" "binary,binary,move")
5217   (set_attr "length" "4,4,4")])
5219 (define_insn ""
5220   [(set (match_operand:DI 0 "register_operand" "=r,&r")
5221         (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5222                   (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))]
5223   "!TARGET_64BIT"
5224   "*
5226   if (GET_CODE (operands[1]) == CONST_INT)
5227     {
5228       if (INTVAL (operands[1]) >= 0)
5229         return \"subi %1,%R2,%R0\;{subb|sub,b} %%r0,%2,%0\";
5230       else
5231         return \"ldi -1,%0\;subi %1,%R2,%R0\;{subb|sub,b} %0,%2,%0\";
5232     }
5233   else
5234     return \"sub %R1,%R2,%R0\;{subb|sub,b} %1,%2,%0\";
5236   [(set_attr "type" "binary")
5237    (set (attr "length")
5238         (if_then_else (eq_attr "alternative" "0")
5239           (const_int 8)
5240           (if_then_else (ge (symbol_ref "INTVAL (operands[1])")
5241                             (const_int 0))
5242             (const_int 8)
5243             (const_int 12))))])
5245 (define_expand "subvdi3"
5246   [(parallel [(set (match_operand:DI 0 "register_operand" "")
5247                    (minus:DI (match_operand:DI 1 "arith11_operand" "")
5248                              (match_operand:DI 2 "reg_or_0_operand" "")))
5249               (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5250                                      (sign_extend:TI (match_dup 2)))
5251                            (sign_extend:TI (minus:DI (match_dup 1)
5252                                                      (match_dup 2))))
5253                        (const_int 0))])]
5254   ""
5255   "")
5257 (define_insn ""
5258   [(set (match_operand:DI 0 "register_operand" "=r,r")
5259         (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5260                   (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))
5261    (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5262                           (sign_extend:TI (match_dup 2)))
5263                 (sign_extend:TI (minus:DI (match_dup 1)
5264                                           (match_dup 2))))
5265             (const_int 0))]
5266   "TARGET_64BIT"
5267   "@
5268   {subo|sub,tsv} %1,%2,%0
5269   {subio|subi,tsv} %1,%2,%0"
5270   [(set_attr "type" "binary,binary")
5271    (set_attr "length" "4,4")])
5273 (define_insn ""
5274   [(set (match_operand:DI 0 "register_operand" "=r,&r")
5275         (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5276                   (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))
5277    (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5278                           (sign_extend:TI (match_dup 2)))
5279                 (sign_extend:TI (minus:DI (match_dup 1)
5280                                           (match_dup 2))))
5281             (const_int 0))]
5282   "!TARGET_64BIT"
5283   "*
5285   if (GET_CODE (operands[1]) == CONST_INT)
5286     {
5287       if (INTVAL (operands[1]) >= 0)
5288         return \"subi %1,%R2,%R0\;{subbo|sub,b,tsv} %%r0,%2,%0\";
5289       else
5290         return \"ldi -1,%0\;subi %1,%R2,%R0\;{subbo|sub,b,tsv} %0,%2,%0\";
5291     }
5292   else
5293     return \"sub %R1,%R2,%R0\;{subbo|sub,b,tsv} %1,%2,%0\";
5295   [(set_attr "type" "binary,binary")
5296    (set (attr "length")
5297         (if_then_else (eq_attr "alternative" "0")
5298           (const_int 8)
5299           (if_then_else (ge (symbol_ref "INTVAL (operands[1])")
5300                             (const_int 0))
5301             (const_int 8)
5302             (const_int 12))))])
5304 (define_expand "subsi3"
5305   [(set (match_operand:SI 0 "register_operand" "")
5306         (minus:SI (match_operand:SI 1 "arith11_operand" "")
5307                   (match_operand:SI 2 "register_operand" "")))]
5308   ""
5309   "")
5311 (define_insn ""
5312   [(set (match_operand:SI 0 "register_operand" "=r,r")
5313         (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
5314                   (match_operand:SI 2 "register_operand" "r,r")))]
5315   "!TARGET_PA_20"
5316   "@
5317    sub %1,%2,%0
5318    subi %1,%2,%0"
5319   [(set_attr "type" "binary,binary")
5320    (set_attr "length" "4,4")])
5322 (define_insn ""
5323   [(set (match_operand:SI 0 "register_operand" "=r,r,!q")
5324         (minus:SI (match_operand:SI 1 "arith11_operand" "r,I,!S")
5325                   (match_operand:SI 2 "register_operand" "r,r,!r")))]
5326   "TARGET_PA_20"
5327   "@
5328    sub %1,%2,%0
5329    subi %1,%2,%0
5330    mtsarcm %2"
5331   [(set_attr "type" "binary,binary,move")
5332    (set_attr "length" "4,4,4")])
5334 (define_insn "subvsi3"
5335   [(set (match_operand:SI 0 "register_operand" "=r,r")
5336         (minus:SI (match_operand:SI 1 "arith11_operand" "rM,I")
5337                   (match_operand:SI 2 "reg_or_0_operand" "rM,rM")))
5338    (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
5339                           (sign_extend:DI (match_dup 2)))
5340                 (sign_extend:DI (minus:SI (match_dup 1)
5341                                           (match_dup 2))))
5342             (const_int 0))]
5343   ""
5344   "@
5345   {subo|sub,tsv} %1,%2,%0
5346   {subio|subi,tsv} %1,%2,%0"
5347   [(set_attr "type" "binary,binary")
5348    (set_attr "length" "4,4")])
5350 ;; Trap instructions.
5352 (define_insn "trap"
5353   [(trap_if (const_int 1) (const_int 0))]
5354   ""
5355   "{addit|addi,tc},<> 1,%%r0,%%r0"
5356   [(set_attr "type" "trap")
5357    (set_attr "length" "4")])
5359 ;; Clobbering a "register_operand" instead of a match_scratch
5360 ;; in operand3 of millicode calls avoids spilling %r1 and
5361 ;; produces better code.
5363 ;; The mulsi3 insns set up registers for the millicode call.
5364 (define_expand "mulsi3"
5365   [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5366    (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5367    (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5368               (clobber (match_dup 3))
5369               (clobber (reg:SI 26))
5370               (clobber (reg:SI 25))
5371               (clobber (match_dup 4))])
5372    (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5373   ""
5374   "
5376   operands[4] = gen_rtx_REG (SImode, TARGET_64BIT ? 2 : 31);
5377   if (TARGET_PA_11 && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT)
5378     {
5379       rtx scratch = gen_reg_rtx (DImode);
5380       operands[1] = force_reg (SImode, operands[1]);
5381       operands[2] = force_reg (SImode, operands[2]);
5382       emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
5383       emit_insn (gen_movsi (operands[0],
5384                             gen_rtx_SUBREG (SImode, scratch,
5385                                             GET_MODE_SIZE (SImode))));
5386       DONE;
5387     }
5388   operands[3] = gen_reg_rtx (SImode);
5391 (define_insn "umulsidi3"
5392   [(set (match_operand:DI 0 "register_operand" "=f")
5393         (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5394                  (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
5395   "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5396   "xmpyu %1,%2,%0"
5397   [(set_attr "type" "fpmuldbl")
5398    (set_attr "length" "4")])
5400 (define_insn ""
5401   [(set (match_operand:DI 0 "register_operand" "=f")
5402         (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5403                  (match_operand:DI 2 "uint32_operand" "f")))]
5404   "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT"
5405   "xmpyu %1,%R2,%0"
5406   [(set_attr "type" "fpmuldbl")
5407    (set_attr "length" "4")])
5409 (define_insn ""
5410   [(set (match_operand:DI 0 "register_operand" "=f")
5411         (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5412                  (match_operand:DI 2 "uint32_operand" "f")))]
5413   "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
5414   "xmpyu %1,%2R,%0"
5415   [(set_attr "type" "fpmuldbl")
5416    (set_attr "length" "4")])
5418 (define_insn ""
5419   [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5420    (clobber (match_operand:SI 0 "register_operand" "=a"))
5421    (clobber (reg:SI 26))
5422    (clobber (reg:SI 25))
5423    (clobber (reg:SI 31))]
5424   "!TARGET_64BIT"
5425   "* return pa_output_mul_insn (0, insn);"
5426   [(set_attr "type" "milli")
5427    (set (attr "length")
5428         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5429               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5431 (define_insn ""
5432   [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5433    (clobber (match_operand:SI 0 "register_operand" "=a"))
5434    (clobber (reg:SI 26))
5435    (clobber (reg:SI 25))
5436    (clobber (reg:SI 2))]
5437   "TARGET_64BIT"
5438   "* return pa_output_mul_insn (0, insn);"
5439   [(set_attr "type" "milli")
5440    (set (attr "length")
5441         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5442               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5444 (define_expand "muldi3"
5445   [(set (match_operand:DI 0 "register_operand" "")
5446         (mult:DI (match_operand:DI 1 "register_operand" "")
5447                  (match_operand:DI 2 "register_operand" "")))]
5448   "TARGET_64BIT && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5449   "
5451   rtx low_product = gen_reg_rtx (DImode);
5452   rtx cross_product1 = gen_reg_rtx (DImode);
5453   rtx cross_product2 = gen_reg_rtx (DImode);
5454   rtx cross_scratch = gen_reg_rtx (DImode);
5455   rtx cross_product = gen_reg_rtx (DImode);
5456   rtx op1l, op1r, op2l, op2r;
5457   rtx op1shifted, op2shifted;
5459   op1shifted = gen_reg_rtx (DImode);
5460   op2shifted = gen_reg_rtx (DImode);
5461   op1l = gen_reg_rtx (SImode);
5462   op1r = gen_reg_rtx (SImode);
5463   op2l = gen_reg_rtx (SImode);
5464   op2r = gen_reg_rtx (SImode);
5466   emit_move_insn (op1shifted, gen_rtx_LSHIFTRT (DImode, operands[1],
5467                                                 GEN_INT (32)));
5468   emit_move_insn (op2shifted, gen_rtx_LSHIFTRT (DImode, operands[2],
5469                                                 GEN_INT (32)));
5470   op1r = force_reg (SImode, gen_rtx_SUBREG (SImode, operands[1], 4));
5471   op2r = force_reg (SImode, gen_rtx_SUBREG (SImode, operands[2], 4));
5472   op1l = force_reg (SImode, gen_rtx_SUBREG (SImode, op1shifted, 4));
5473   op2l = force_reg (SImode, gen_rtx_SUBREG (SImode, op2shifted, 4));
5475   /* Emit multiplies for the cross products.  */
5476   emit_insn (gen_umulsidi3 (cross_product1, op2r, op1l));
5477   emit_insn (gen_umulsidi3 (cross_product2, op2l, op1r));
5479   /* Emit a multiply for the low sub-word.  */
5480   emit_insn (gen_umulsidi3 (low_product, copy_rtx (op2r), copy_rtx (op1r)));
5482   /* Sum the cross products and shift them into proper position.  */
5483   emit_insn (gen_adddi3 (cross_scratch, cross_product1, cross_product2));
5484   emit_insn (gen_ashldi3 (cross_product, cross_scratch, GEN_INT (32)));
5486   /* Add the cross product to the low product and store the result
5487      into the output operand .  */
5488   emit_insn (gen_adddi3 (operands[0], cross_product, low_product));
5489   DONE;
5492 ;;; Division and mod.
5493 (define_expand "divsi3"
5494   [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5495    (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5496    (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
5497               (clobber (match_dup 3))
5498               (clobber (match_dup 4))
5499               (clobber (reg:SI 26))
5500               (clobber (reg:SI 25))
5501               (clobber (match_dup 5))])
5502    (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5503   ""
5504   "
5506   operands[3] = gen_reg_rtx (SImode);
5507   if (TARGET_64BIT)
5508     {
5509       operands[5] = gen_rtx_REG (SImode, 2);
5510       operands[4] = operands[5];
5511     }
5512   else
5513     {
5514       operands[5] = gen_rtx_REG (SImode, 31);
5515       operands[4] = gen_reg_rtx (SImode);
5516     }
5517   if (GET_CODE (operands[2]) == CONST_INT && pa_emit_hpdiv_const (operands, 0))
5518     DONE;
5521 (define_insn ""
5522   [(set (reg:SI 29)
5523         (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5524    (clobber (match_operand:SI 1 "register_operand" "=a"))
5525    (clobber (match_operand:SI 2 "register_operand" "=&r"))
5526    (clobber (reg:SI 26))
5527    (clobber (reg:SI 25))
5528    (clobber (reg:SI 31))]
5529   "!TARGET_64BIT"
5530   "*
5531    return pa_output_div_insn (operands, 0, insn);"
5532   [(set_attr "type" "milli")
5533    (set (attr "length")
5534         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5535               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5537 (define_insn ""
5538   [(set (reg:SI 29)
5539         (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5540    (clobber (match_operand:SI 1 "register_operand" "=a"))
5541    (clobber (match_operand:SI 2 "register_operand" "=&r"))
5542    (clobber (reg:SI 26))
5543    (clobber (reg:SI 25))
5544    (clobber (reg:SI 2))]
5545   "TARGET_64BIT"
5546   "*
5547    return pa_output_div_insn (operands, 0, insn);"
5548   [(set_attr "type" "milli")
5549    (set (attr "length")
5550         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5551               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5553 (define_expand "udivsi3"
5554   [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5555    (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5556    (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
5557               (clobber (match_dup 3))
5558               (clobber (match_dup 4))
5559               (clobber (reg:SI 26))
5560               (clobber (reg:SI 25))
5561               (clobber (match_dup 5))])
5562    (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5563   ""
5564   "
5566   operands[3] = gen_reg_rtx (SImode);
5568   if (TARGET_64BIT)
5569     {
5570       operands[5] = gen_rtx_REG (SImode, 2);
5571       operands[4] = operands[5];
5572     }
5573   else
5574     {
5575       operands[5] = gen_rtx_REG (SImode, 31);
5576       operands[4] = gen_reg_rtx (SImode);
5577     }
5578   if (GET_CODE (operands[2]) == CONST_INT && pa_emit_hpdiv_const (operands, 1))
5579     DONE;
5582 (define_insn ""
5583   [(set (reg:SI 29)
5584         (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5585    (clobber (match_operand:SI 1 "register_operand" "=a"))
5586    (clobber (match_operand:SI 2 "register_operand" "=&r"))
5587    (clobber (reg:SI 26))
5588    (clobber (reg:SI 25))
5589    (clobber (reg:SI 31))]
5590   "!TARGET_64BIT"
5591   "*
5592    return pa_output_div_insn (operands, 1, insn);"
5593   [(set_attr "type" "milli")
5594    (set (attr "length")
5595         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5596               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5598 (define_insn ""
5599   [(set (reg:SI 29)
5600         (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5601    (clobber (match_operand:SI 1 "register_operand" "=a"))
5602    (clobber (match_operand:SI 2 "register_operand" "=&r"))
5603    (clobber (reg:SI 26))
5604    (clobber (reg:SI 25))
5605    (clobber (reg:SI 2))]
5606   "TARGET_64BIT"
5607   "*
5608    return pa_output_div_insn (operands, 1, insn);"
5609   [(set_attr "type" "milli")
5610    (set (attr "length")
5611         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5612               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5614 (define_expand "modsi3"
5615   [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5616    (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5617    (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5618               (clobber (match_dup 3))
5619               (clobber (match_dup 4))
5620               (clobber (reg:SI 26))
5621               (clobber (reg:SI 25))
5622               (clobber (match_dup 5))])
5623    (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5624   ""
5625   "
5627   if (TARGET_64BIT)
5628     {
5629       operands[5] = gen_rtx_REG (SImode, 2);
5630       operands[4] = operands[5];
5631     }
5632   else
5633     {
5634       operands[5] = gen_rtx_REG (SImode, 31);
5635       operands[4] = gen_reg_rtx (SImode);
5636     }
5637   operands[3] = gen_reg_rtx (SImode);
5640 (define_insn ""
5641   [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5642    (clobber (match_operand:SI 0 "register_operand" "=a"))
5643    (clobber (match_operand:SI 1 "register_operand" "=&r"))
5644    (clobber (reg:SI 26))
5645    (clobber (reg:SI 25))
5646    (clobber (reg:SI 31))]
5647   "!TARGET_64BIT"
5648   "*
5649   return pa_output_mod_insn (0, insn);"
5650   [(set_attr "type" "milli")
5651    (set (attr "length")
5652         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5653               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5655 (define_insn ""
5656   [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5657    (clobber (match_operand:SI 0 "register_operand" "=a"))
5658    (clobber (match_operand:SI 1 "register_operand" "=&r"))
5659    (clobber (reg:SI 26))
5660    (clobber (reg:SI 25))
5661    (clobber (reg:SI 2))]
5662   "TARGET_64BIT"
5663   "*
5664   return pa_output_mod_insn (0, insn);"
5665   [(set_attr "type" "milli")
5666    (set (attr "length")
5667         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5668               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5670 (define_expand "umodsi3"
5671   [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5672    (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5673    (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5674               (clobber (match_dup 3))
5675               (clobber (match_dup 4))
5676               (clobber (reg:SI 26))
5677               (clobber (reg:SI 25))
5678               (clobber (match_dup 5))])
5679    (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5680   ""
5681   "
5683   if (TARGET_64BIT)
5684     {
5685       operands[5] = gen_rtx_REG (SImode, 2);
5686       operands[4] = operands[5];
5687     }
5688   else
5689     {
5690       operands[5] = gen_rtx_REG (SImode, 31);
5691       operands[4] = gen_reg_rtx (SImode);
5692     }
5693   operands[3] = gen_reg_rtx (SImode);
5696 (define_insn ""
5697   [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5698    (clobber (match_operand:SI 0 "register_operand" "=a"))
5699    (clobber (match_operand:SI 1 "register_operand" "=&r"))
5700    (clobber (reg:SI 26))
5701    (clobber (reg:SI 25))
5702    (clobber (reg:SI 31))]
5703   "!TARGET_64BIT"
5704   "*
5705   return pa_output_mod_insn (1, insn);"
5706   [(set_attr "type" "milli")
5707    (set (attr "length")
5708         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5709               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5711 (define_insn ""
5712   [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5713    (clobber (match_operand:SI 0 "register_operand" "=a"))
5714    (clobber (match_operand:SI 1 "register_operand" "=&r"))
5715    (clobber (reg:SI 26))
5716    (clobber (reg:SI 25))
5717    (clobber (reg:SI 2))]
5718   "TARGET_64BIT"
5719   "*
5720   return pa_output_mod_insn (1, insn);"
5721   [(set_attr "type" "milli")
5722    (set (attr "length")
5723         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5724               (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5726 ;;- and instructions
5727 ;; We define DImode `and` so with DImode `not` we can get
5728 ;; DImode `andn`.  Other combinations are possible.
5730 (define_expand "anddi3"
5731   [(set (match_operand:DI 0 "register_operand" "")
5732         (and:DI (match_operand:DI 1 "register_operand" "")
5733                 (match_operand:DI 2 "and_operand" "")))]
5734   "TARGET_64BIT"
5735   "")
5737 (define_insn ""
5738   [(set (match_operand:DI 0 "register_operand" "=r,r")
5739         (and:DI (match_operand:DI 1 "register_operand" "%?r,0")
5740                 (match_operand:DI 2 "and_operand" "rO,P")))]
5741   "TARGET_64BIT"
5742   "* return pa_output_64bit_and (operands); "
5743   [(set_attr "type" "binary")
5744    (set_attr "length" "4")])
5746 ; The ? for op1 makes reload prefer zdepi instead of loading a huge
5747 ; constant with ldil;ldo.
5748 (define_insn "andsi3"
5749   [(set (match_operand:SI 0 "register_operand" "=r,r")
5750         (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
5751                 (match_operand:SI 2 "and_operand" "rO,P")))]
5752   ""
5753   "* return pa_output_and (operands); "
5754   [(set_attr "type" "binary,shift")
5755    (set_attr "length" "4,4")])
5757 (define_insn ""
5758   [(set (match_operand:DI 0 "register_operand" "=r")
5759         (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5760                 (match_operand:DI 2 "register_operand" "r")))]
5761   "TARGET_64BIT"
5762   "andcm %2,%1,%0"
5763   [(set_attr "type" "binary")
5764    (set_attr "length" "4")])
5766 (define_insn ""
5767   [(set (match_operand:SI 0 "register_operand" "=r")
5768         (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5769                 (match_operand:SI 2 "register_operand" "r")))]
5770   ""
5771   "andcm %2,%1,%0"
5772   [(set_attr "type" "binary")
5773   (set_attr "length" "4")])
5775 (define_expand "iordi3"
5776   [(set (match_operand:DI 0 "register_operand" "")
5777         (ior:DI (match_operand:DI 1 "register_operand" "")
5778                 (match_operand:DI 2 "reg_or_cint_ior_operand" "")))]
5779   "TARGET_64BIT"
5780   "")
5782 (define_insn ""
5783   [(set (match_operand:DI 0 "register_operand" "=r,r")
5784         (ior:DI (match_operand:DI 1 "register_operand" "0,0")
5785                 (match_operand:DI 2 "cint_ior_operand" "M,i")))]
5786   "TARGET_64BIT"
5787   "* return pa_output_64bit_ior (operands); "
5788   [(set_attr "type" "binary,shift")
5789    (set_attr "length" "4,4")])
5791 (define_insn ""
5792   [(set (match_operand:DI 0 "register_operand" "=r")
5793         (ior:DI (match_operand:DI 1 "register_operand" "%r")
5794                 (match_operand:DI 2 "register_operand" "r")))]
5795   "TARGET_64BIT"
5796   "or %1,%2,%0"
5797   [(set_attr "type" "binary")
5798    (set_attr "length" "4")])
5800 ;; Need a define_expand because we've run out of CONST_OK... characters.
5801 (define_expand "iorsi3"
5802   [(set (match_operand:SI 0 "register_operand" "")
5803         (ior:SI (match_operand:SI 1 "register_operand" "")
5804                 (match_operand:SI 2 "reg_or_cint_ior_operand" "")))]
5805   ""
5806   "")
5808 (define_insn ""
5809   [(set (match_operand:SI 0 "register_operand" "=r,r")
5810         (ior:SI (match_operand:SI 1 "register_operand" "0,0")
5811                 (match_operand:SI 2 "cint_ior_operand" "M,i")))]
5812   ""
5813   "* return pa_output_ior (operands); "
5814   [(set_attr "type" "binary,shift")
5815    (set_attr "length" "4,4")])
5817 (define_insn ""
5818   [(set (match_operand:SI 0 "register_operand" "=r")
5819         (ior:SI (match_operand:SI 1 "register_operand" "%r")
5820                 (match_operand:SI 2 "register_operand" "r")))]
5821   ""
5822   "or %1,%2,%0"
5823   [(set_attr "type" "binary")
5824    (set_attr "length" "4")])
5826 (define_expand "xordi3"
5827   [(set (match_operand:DI 0 "register_operand" "")
5828         (xor:DI (match_operand:DI 1 "register_operand" "")
5829                 (match_operand:DI 2 "register_operand" "")))]
5830   "TARGET_64BIT"
5831   "")
5833 (define_insn ""
5834   [(set (match_operand:DI 0 "register_operand" "=r")
5835         (xor:DI (match_operand:DI 1 "register_operand" "%r")
5836                 (match_operand:DI 2 "register_operand" "r")))]
5837   "TARGET_64BIT"
5838   "xor %1,%2,%0"
5839   [(set_attr "type" "binary")
5840    (set_attr "length" "4")])
5842 (define_insn "xorsi3"
5843   [(set (match_operand:SI 0 "register_operand" "=r")
5844         (xor:SI (match_operand:SI 1 "register_operand" "%r")
5845                 (match_operand:SI 2 "register_operand" "r")))]
5846   ""
5847   "xor %1,%2,%0"
5848   [(set_attr "type" "binary")
5849    (set_attr "length" "4")])
5851 (define_expand "negdi2"
5852   [(set (match_operand:DI 0 "register_operand" "")
5853         (neg:DI (match_operand:DI 1 "register_operand" "")))]
5854   ""
5855   "")
5857 (define_insn ""
5858   [(set (match_operand:DI 0 "register_operand" "=r")
5859         (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5860   "!TARGET_64BIT"
5861   "sub %%r0,%R1,%R0\;{subb|sub,b} %%r0,%1,%0"
5862   [(set_attr "type" "unary")
5863    (set_attr "length" "8")])
5865 (define_insn ""
5866   [(set (match_operand:DI 0 "register_operand" "=r")
5867         (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5868   "TARGET_64BIT"
5869   "sub %%r0,%1,%0"
5870   [(set_attr "type" "unary")
5871    (set_attr "length" "4")])
5873 (define_expand "negvdi2"
5874   [(parallel [(set (match_operand:DI 0 "register_operand" "")
5875                    (neg:DI (match_operand:DI 1 "register_operand" "")))
5876               (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5877                                    (sign_extend:TI (neg:DI (match_dup 1))))
5878                        (const_int 0))])]
5879   ""
5880   "")
5882 (define_insn ""
5883   [(set (match_operand:DI 0 "register_operand" "=r")
5884         (neg:DI (match_operand:DI 1 "register_operand" "r")))
5885    (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5886                 (sign_extend:TI (neg:DI (match_dup 1))))
5887             (const_int 0))]
5888   "!TARGET_64BIT"
5889   "sub %%r0,%R1,%R0\;{subbo|sub,b,tsv} %%r0,%1,%0"
5890   [(set_attr "type" "unary")
5891    (set_attr "length" "8")])
5893 (define_insn ""
5894   [(set (match_operand:DI 0 "register_operand" "=r")
5895         (neg:DI (match_operand:DI 1 "register_operand" "r")))
5896    (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5897                 (sign_extend:TI (neg:DI (match_dup 1))))
5898             (const_int 0))]
5899   "TARGET_64BIT"
5900   "sub,tsv %%r0,%1,%0"
5901   [(set_attr "type" "unary")
5902    (set_attr "length" "4")])
5904 (define_insn "negsi2"
5905   [(set (match_operand:SI 0 "register_operand" "=r")
5906         (neg:SI (match_operand:SI 1 "register_operand" "r")))]
5907   ""
5908   "sub %%r0,%1,%0"
5909   [(set_attr "type" "unary")
5910    (set_attr "length" "4")])
5912 (define_insn "negvsi2"
5913   [(set (match_operand:SI 0 "register_operand" "=r")
5914         (neg:SI (match_operand:SI 1 "register_operand" "r")))
5915    (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
5916                 (sign_extend:DI (neg:SI (match_dup 1))))
5917             (const_int 0))]
5918    ""
5919    "{subo|sub,tsv} %%r0,%1,%0"
5920   [(set_attr "type" "unary")
5921    (set_attr "length" "4")])
5923 (define_expand "one_cmpldi2"
5924   [(set (match_operand:DI 0 "register_operand" "")
5925         (not:DI (match_operand:DI 1 "register_operand" "")))]
5926   ""
5927   "
5931 (define_insn ""
5932   [(set (match_operand:DI 0 "register_operand" "=r")
5933         (not:DI (match_operand:DI 1 "register_operand" "r")))]
5934   "!TARGET_64BIT"
5935   "uaddcm %%r0,%1,%0\;uaddcm %%r0,%R1,%R0"
5936   [(set_attr "type" "unary")
5937    (set_attr "length" "8")])
5939 (define_insn ""
5940   [(set (match_operand:DI 0 "register_operand" "=r")
5941         (not:DI (match_operand:DI 1 "register_operand" "r")))]
5942   "TARGET_64BIT"
5943   "uaddcm %%r0,%1,%0"
5944   [(set_attr "type" "unary")
5945    (set_attr "length" "4")])
5947 (define_insn "one_cmplsi2"
5948   [(set (match_operand:SI 0 "register_operand" "=r")
5949         (not:SI (match_operand:SI 1 "register_operand" "r")))]
5950   ""
5951   "uaddcm %%r0,%1,%0"
5952   [(set_attr "type" "unary")
5953    (set_attr "length" "4")])
5955 ;; Floating point arithmetic instructions.
5957 (define_insn "adddf3"
5958   [(set (match_operand:DF 0 "register_operand" "=f")
5959         (plus:DF (match_operand:DF 1 "register_operand" "f")
5960                  (match_operand:DF 2 "register_operand" "f")))]
5961   "! TARGET_SOFT_FLOAT"
5962   "fadd,dbl %1,%2,%0"
5963   [(set_attr "type" "fpalu")
5964    (set_attr "pa_combine_type" "faddsub")
5965    (set_attr "length" "4")])
5967 (define_insn "addsf3"
5968   [(set (match_operand:SF 0 "register_operand" "=f")
5969         (plus:SF (match_operand:SF 1 "register_operand" "f")
5970                  (match_operand:SF 2 "register_operand" "f")))]
5971   "! TARGET_SOFT_FLOAT"
5972   "fadd,sgl %1,%2,%0"
5973   [(set_attr "type" "fpalu")
5974    (set_attr "pa_combine_type" "faddsub")
5975    (set_attr "length" "4")])
5977 (define_insn "subdf3"
5978   [(set (match_operand:DF 0 "register_operand" "=f")
5979         (minus:DF (match_operand:DF 1 "register_operand" "f")
5980                   (match_operand:DF 2 "register_operand" "f")))]
5981   "! TARGET_SOFT_FLOAT"
5982   "fsub,dbl %1,%2,%0"
5983   [(set_attr "type" "fpalu")
5984    (set_attr "pa_combine_type" "faddsub")
5985    (set_attr "length" "4")])
5987 (define_insn "subsf3"
5988   [(set (match_operand:SF 0 "register_operand" "=f")
5989         (minus:SF (match_operand:SF 1 "register_operand" "f")
5990                   (match_operand:SF 2 "register_operand" "f")))]
5991   "! TARGET_SOFT_FLOAT"
5992   "fsub,sgl %1,%2,%0"
5993   [(set_attr "type" "fpalu")
5994    (set_attr "pa_combine_type" "faddsub")
5995    (set_attr "length" "4")])
5997 (define_insn "muldf3"
5998   [(set (match_operand:DF 0 "register_operand" "=f")
5999         (mult:DF (match_operand:DF 1 "register_operand" "f")
6000                  (match_operand:DF 2 "register_operand" "f")))]
6001   "! TARGET_SOFT_FLOAT"
6002   "fmpy,dbl %1,%2,%0"
6003   [(set_attr "type" "fpmuldbl")
6004    (set_attr "pa_combine_type" "fmpy")
6005    (set_attr "length" "4")])
6007 (define_insn "mulsf3"
6008   [(set (match_operand:SF 0 "register_operand" "=f")
6009         (mult:SF (match_operand:SF 1 "register_operand" "f")
6010                  (match_operand:SF 2 "register_operand" "f")))]
6011   "! TARGET_SOFT_FLOAT"
6012   "fmpy,sgl %1,%2,%0"
6013   [(set_attr "type" "fpmulsgl")
6014    (set_attr "pa_combine_type" "fmpy")
6015    (set_attr "length" "4")])
6017 (define_insn "divdf3"
6018   [(set (match_operand:DF 0 "register_operand" "=f")
6019         (div:DF (match_operand:DF 1 "register_operand" "f")
6020                 (match_operand:DF 2 "register_operand" "f")))]
6021   "! TARGET_SOFT_FLOAT"
6022   "fdiv,dbl %1,%2,%0"
6023   [(set_attr "type" "fpdivdbl")
6024    (set_attr "length" "4")])
6026 (define_insn "divsf3"
6027   [(set (match_operand:SF 0 "register_operand" "=f")
6028         (div:SF (match_operand:SF 1 "register_operand" "f")
6029                 (match_operand:SF 2 "register_operand" "f")))]
6030   "! TARGET_SOFT_FLOAT"
6031   "fdiv,sgl %1,%2,%0"
6032   [(set_attr "type" "fpdivsgl")
6033    (set_attr "length" "4")])
6035 ;; Processors prior to PA 2.0 don't have a fneg instruction.  Fast
6036 ;; negation can be done by subtracting from plus zero.  However, this
6037 ;; violates the IEEE standard when negating plus and minus zero.
6038 ;; The slow path toggles the sign bit in the general registers.
6039 (define_expand "negdf2"
6040   [(set (match_operand:DF 0 "register_operand" "")
6041         (neg:DF (match_operand:DF 1 "register_operand" "")))]
6042   "!TARGET_SOFT_FLOAT"
6044   if (TARGET_PA_20 || !flag_signed_zeros)
6045     emit_insn (gen_negdf2_fast (operands[0], operands[1]));
6046   else
6047     emit_insn (gen_negdf2_slow (operands[0], operands[1]));
6048   DONE;
6051 (define_insn "negdf2_slow"
6052   [(set (match_operand:DF 0 "register_operand" "=r")
6053         (neg:DF (match_operand:DF 1 "register_operand" "r")))]
6054   "!TARGET_SOFT_FLOAT && !TARGET_PA_20"
6055   "*
6057   if (rtx_equal_p (operands[0], operands[1]))
6058     return \"and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0\";
6059   else
6060     return \"and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0\;copy %R1,%R0\";
6062   [(set_attr "type" "multi")
6063    (set (attr "length")
6064         (if_then_else (match_test "rtx_equal_p (operands[0], operands[1])")
6065             (const_int 12)
6066             (const_int 16)))])
6068 (define_insn "negdf2_fast"
6069   [(set (match_operand:DF 0 "register_operand" "=f")
6070         (neg:DF (match_operand:DF 1 "register_operand" "f")))]
6071   "!TARGET_SOFT_FLOAT"
6072   "*
6074   if (TARGET_PA_20)
6075     return \"fneg,dbl %1,%0\";
6076   else
6077     return \"fsub,dbl %%fr0,%1,%0\";
6079   [(set_attr "type" "fpalu")
6080    (set_attr "length" "4")])
6082 (define_expand "negsf2"
6083   [(set (match_operand:SF 0 "register_operand" "")
6084         (neg:SF (match_operand:SF 1 "register_operand" "")))]
6085   "!TARGET_SOFT_FLOAT"
6087   if (TARGET_PA_20 || !flag_signed_zeros)
6088     emit_insn (gen_negsf2_fast (operands[0], operands[1]));
6089   else
6090     emit_insn (gen_negsf2_slow (operands[0], operands[1]));
6091   DONE;
6094 (define_insn "negsf2_slow"
6095   [(set (match_operand:SF 0 "register_operand" "=r")
6096         (neg:SF (match_operand:SF 1 "register_operand" "r")))]
6097   "!TARGET_SOFT_FLOAT && !TARGET_PA_20"
6098   "and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0"
6099   [(set_attr "type" "multi")
6100    (set_attr "length" "12")])
6102 (define_insn "negsf2_fast"
6103   [(set (match_operand:SF 0 "register_operand" "=f")
6104         (neg:SF (match_operand:SF 1 "register_operand" "f")))]
6105   "!TARGET_SOFT_FLOAT"
6106   "*
6108   if (TARGET_PA_20)
6109     return \"fneg,sgl %1,%0\";
6110   else
6111     return \"fsub,sgl %%fr0,%1,%0\";
6113   [(set_attr "type" "fpalu")
6114    (set_attr "length" "4")])
6116 (define_insn "absdf2"
6117   [(set (match_operand:DF 0 "register_operand" "=f")
6118         (abs:DF (match_operand:DF 1 "register_operand" "f")))]
6119   "! TARGET_SOFT_FLOAT"
6120   "fabs,dbl %1,%0"
6121   [(set_attr "type" "fpalu")
6122    (set_attr "length" "4")])
6124 (define_insn "abssf2"
6125   [(set (match_operand:SF 0 "register_operand" "=f")
6126         (abs:SF (match_operand:SF 1 "register_operand" "f")))]
6127   "! TARGET_SOFT_FLOAT"
6128   "fabs,sgl %1,%0"
6129   [(set_attr "type" "fpalu")
6130    (set_attr "length" "4")])
6132 (define_insn "sqrtdf2"
6133   [(set (match_operand:DF 0 "register_operand" "=f")
6134         (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
6135   "! TARGET_SOFT_FLOAT"
6136   "fsqrt,dbl %1,%0"
6137   [(set_attr "type" "fpsqrtdbl")
6138    (set_attr "length" "4")])
6140 (define_insn "sqrtsf2"
6141   [(set (match_operand:SF 0 "register_operand" "=f")
6142         (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
6143   "! TARGET_SOFT_FLOAT"
6144   "fsqrt,sgl %1,%0"
6145   [(set_attr "type" "fpsqrtsgl")
6146    (set_attr "length" "4")])
6148 ;; PA 2.0 floating point instructions
6150 ; fmpyfadd patterns
6151 (define_insn "fmadf4"
6152   [(set (match_operand:DF 0 "register_operand" "=f")
6153         (fma:DF (match_operand:DF 1 "register_operand" "f")
6154                 (match_operand:DF 2 "register_operand" "f")
6155                 (match_operand:DF 3 "register_operand" "f")))]
6156   "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6157   "fmpyfadd,dbl %1,%2,%3,%0"
6158   [(set_attr "type" "fpmuldbl")
6159    (set_attr "length" "4")])
6161 (define_insn "fmasf4"
6162   [(set (match_operand:SF 0 "register_operand" "=f")
6163         (fma:SF (match_operand:SF 1 "register_operand" "f")
6164                 (match_operand:SF 2 "register_operand" "f")
6165                 (match_operand:SF 3 "register_operand" "f")))]
6166   "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6167   "fmpyfadd,sgl %1,%2,%3,%0"
6168   [(set_attr "type" "fpmulsgl")
6169    (set_attr "length" "4")])
6171 ; fmpynfadd patterns
6172 (define_insn "fnmadf4"
6173   [(set (match_operand:DF 0 "register_operand" "=f")
6174         (fma:DF (neg:DF (match_operand:DF 1 "register_operand" "f"))
6175                 (match_operand:DF 2 "register_operand" "f")
6176                 (match_operand:DF 3 "register_operand" "f")))]
6177   "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6178   "fmpynfadd,dbl %1,%2,%3,%0"
6179   [(set_attr "type" "fpmuldbl")
6180    (set_attr "length" "4")])
6182 (define_insn "fnmasf4"
6183   [(set (match_operand:SF 0 "register_operand" "=f")
6184         (fma:SF (neg:SF (match_operand:SF 1 "register_operand" "f"))
6185                 (match_operand:SF 2 "register_operand" "f")
6186                 (match_operand:SF 3 "register_operand" "f")))]
6187   "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6188   "fmpynfadd,sgl %1,%2,%3,%0"
6189   [(set_attr "type" "fpmulsgl")
6190    (set_attr "length" "4")])
6192 ; fnegabs patterns
6193 (define_insn ""
6194   [(set (match_operand:DF 0 "register_operand" "=f")
6195         (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))]
6196   "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6197   "fnegabs,dbl %1,%0"
6198   [(set_attr "type" "fpalu")
6199    (set_attr "length" "4")])
6201 (define_insn ""
6202   [(set (match_operand:SF 0 "register_operand" "=f")
6203         (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))]
6204   "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6205   "fnegabs,sgl %1,%0"
6206   [(set_attr "type" "fpalu")
6207    (set_attr "length" "4")])
6209 (define_insn ""
6210   [(set (match_operand:DF 0 "register_operand" "=f")
6211         (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6212    (set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
6213   "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6214     && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6215   "#"
6216   [(set_attr "type" "fpalu")
6217    (set_attr "length" "8")])
6219 (define_split
6220   [(set (match_operand:DF 0 "register_operand" "")
6221         (neg:DF (abs:DF (match_operand:DF 1 "register_operand" ""))))
6222    (set (match_operand:DF 2 "register_operand" "") (abs:DF (match_dup 1)))]
6223   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6224   [(set (match_dup 2) (abs:DF (match_dup 1)))
6225    (set (match_dup 0) (neg:DF (abs:DF (match_dup 1))))]
6226   "")
6228 (define_insn ""
6229   [(set (match_operand:SF 0 "register_operand" "=f")
6230         (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6231    (set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
6232   "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6233     && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6234   "#"
6235   [(set_attr "type" "fpalu")
6236    (set_attr "length" "8")])
6238 (define_split
6239   [(set (match_operand:SF 0 "register_operand" "")
6240         (neg:SF (abs:SF (match_operand:SF 1 "register_operand" ""))))
6241    (set (match_operand:SF 2 "register_operand" "") (abs:SF (match_dup 1)))]
6242   "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6243   [(set (match_dup 2) (abs:SF (match_dup 1)))
6244    (set (match_dup 0) (neg:SF (abs:SF (match_dup 1))))]
6245   "")
6247 ;; Negating a multiply can be faked by adding zero in a fused multiply-add
6248 ;; instruction if we can ignore the sign of zero.
6249 (define_insn ""
6250   [(set (match_operand:DF 0 "register_operand" "=f")
6251         (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6252                          (match_operand:DF 2 "register_operand" "f"))))]
6253   "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6254   "fmpynfadd,dbl %1,%2,%%fr0,%0"
6255   [(set_attr "type" "fpmuldbl")
6256    (set_attr "length" "4")])
6258 (define_insn ""
6259   [(set (match_operand:SF 0 "register_operand" "=f")
6260         (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6261                          (match_operand:SF 2 "register_operand" "f"))))]
6262   "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6263   "fmpynfadd,sgl %1,%2,%%fr0,%0"
6264   [(set_attr "type" "fpmuldbl")
6265    (set_attr "length" "4")])
6267 (define_insn ""
6268   [(set (match_operand:DF 0 "register_operand" "=f")
6269         (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6270                          (match_operand:DF 2 "register_operand" "f"))))
6271    (set (match_operand:DF 3 "register_operand" "=&f")
6272         (mult:DF (match_dup 1) (match_dup 2)))]
6273   "(!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros
6274     && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6275           || reg_overlap_mentioned_p (operands[3], operands[2])))"
6276   "#"
6277   [(set_attr "type" "fpmuldbl")
6278    (set_attr "length" "8")])
6280 (define_split
6281   [(set (match_operand:DF 0 "register_operand" "")
6282         (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
6283                          (match_operand:DF 2 "register_operand" ""))))
6284    (set (match_operand:DF 3 "register_operand" "")
6285         (mult:DF (match_dup 1) (match_dup 2)))]
6286   "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6287   [(set (match_dup 3) (mult:DF (match_dup 1) (match_dup 2)))
6288    (set (match_dup 0) (neg:DF (mult:DF (match_dup 1) (match_dup 2))))]
6289   "")
6291 (define_insn ""
6292   [(set (match_operand:SF 0 "register_operand" "=f")
6293         (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6294                          (match_operand:SF 2 "register_operand" "f"))))
6295    (set (match_operand:SF 3 "register_operand" "=&f")
6296         (mult:SF (match_dup 1) (match_dup 2)))]
6297   "(!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros
6298     && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6299           || reg_overlap_mentioned_p (operands[3], operands[2])))"
6300   "#"
6301   [(set_attr "type" "fpmuldbl")
6302    (set_attr "length" "8")])
6304 (define_split
6305   [(set (match_operand:SF 0 "register_operand" "")
6306         (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
6307                          (match_operand:SF 2 "register_operand" ""))))
6308    (set (match_operand:SF 3 "register_operand" "")
6309         (mult:SF (match_dup 1) (match_dup 2)))]
6310   "!TARGET_SOFT_FLOAT && TARGET_PA_20&& !flag_signed_zeros"
6311   [(set (match_dup 3) (mult:SF (match_dup 1) (match_dup 2)))
6312    (set (match_dup 0) (neg:SF (mult:SF (match_dup 1) (match_dup 2))))]
6313   "")
6315 ;;- Shift instructions
6317 ;; Optimized special case of shifting.
6319 (define_insn ""
6320   [(set (match_operand:SI 0 "register_operand" "=r")
6321         (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6322                      (const_int 24)))]
6323   ""
6324   "ldb%M1 %1,%0"
6325   [(set_attr "type" "load")
6326    (set_attr "length" "4")])
6328 (define_insn ""
6329   [(set (match_operand:SI 0 "register_operand" "=r")
6330         (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6331                      (const_int 16)))]
6332   ""
6333   "ldh%M1 %1,%0"
6334   [(set_attr "type" "load")
6335    (set_attr "length" "4")])
6337 (define_insn ""
6338   [(set (match_operand:SI 0 "register_operand" "=r")
6339         (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
6340                           (match_operand:SI 3 "mem_shadd_operand" ""))
6341                  (match_operand:SI 1 "register_operand" "r")))]
6342   ""
6343   "{sh%O3addl %2,%1,%0|shladd,l %2,%O3,%1,%0} "
6344   [(set_attr "type" "binary")
6345    (set_attr "length" "4")])
6347 (define_insn ""
6348   [(set (match_operand:DI 0 "register_operand" "=r")
6349         (plus:DI (mult:DI (match_operand:DI 2 "register_operand" "r")
6350                           (match_operand:DI 3 "mem_shadd_operand" ""))
6351                  (match_operand:DI 1 "register_operand" "r")))]
6352   "TARGET_64BIT"
6353   "shladd,l %2,%O3,%1,%0"
6354   [(set_attr "type" "binary")
6355    (set_attr "length" "4")])
6357 (define_insn ""
6358   [(set (match_operand:SI 0 "register_operand" "=r")
6359         (plus:SI (ashift:SI (match_operand:SI 2 "register_operand" "r")
6360                             (match_operand:SI 3 "shadd_operand" ""))
6361                  (match_operand:SI 1 "register_operand" "r")))]
6362   ""
6363   "{sh%o3addl %2,%1,%0|shladd,l %2,%o3,%1,%0} "
6364   [(set_attr "type" "binary")
6365    (set_attr "length" "4")])
6367 (define_insn ""
6368   [(set (match_operand:DI 0 "register_operand" "=r")
6369         (plus:DI (ashift:DI (match_operand:DI 2 "register_operand" "r")
6370                             (match_operand:DI 3 "shadd_operand" ""))
6371                  (match_operand:DI 1 "register_operand" "r")))]
6372   "TARGET_64BIT"
6373   "shladd,l %2,%o3,%1,%0"
6374   [(set_attr "type" "binary")
6375    (set_attr "length" "4")])
6377 (define_expand "ashlsi3"
6378   [(set (match_operand:SI 0 "register_operand" "")
6379         (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
6380                    (match_operand:SI 2 "arith32_operand" "")))]
6381   ""
6382   "
6384   if (GET_CODE (operands[2]) != CONST_INT)
6385     {
6386       rtx temp = gen_reg_rtx (SImode);
6387       emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6388       if (GET_CODE (operands[1]) == CONST_INT)
6389         emit_insn (gen_zvdep_imm32 (operands[0], operands[1], temp));
6390       else
6391         emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
6392       DONE;
6393     }
6394   /* Make sure both inputs are not constants,
6395      there are no patterns for that.  */
6396   operands[1] = force_reg (SImode, operands[1]);
6399 (define_insn ""
6400   [(set (match_operand:SI 0 "register_operand" "=r")
6401         (ashift:SI (match_operand:SI 1 "register_operand" "r")
6402                    (match_operand:SI 2 "const_int_operand" "n")))]
6403   ""
6404   "{zdep|depw,z} %1,%P2,%L2,%0"
6405   [(set_attr "type" "shift")
6406    (set_attr "length" "4")])
6408 ; Match cases of op1 a CONST_INT here that zvdep_imm32 doesn't handle.
6409 ; Doing it like this makes slightly better code since reload can
6410 ; replace a register with a known value in range -16..15 with a
6411 ; constant.  Ideally, we would like to merge zvdep32 and zvdep_imm32,
6412 ; but since we have no more CONST_OK... characters, that is not
6413 ; possible.
6414 (define_insn "zvdep32"
6415   [(set (match_operand:SI 0 "register_operand" "=r,r")
6416         (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
6417                    (minus:SI (const_int 31)
6418                              (match_operand:SI 2 "register_operand" "q,q"))))]
6419   ""
6420   "@
6421    {zvdep %1,32,%0|depw,z %1,%%sar,32,%0}
6422    {zvdepi %1,32,%0|depwi,z %1,%%sar,32,%0}"
6423   [(set_attr "type" "shift,shift")
6424    (set_attr "length" "4,4")])
6426 (define_insn "zvdep_imm32"
6427   [(set (match_operand:SI 0 "register_operand" "=r")
6428         (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
6429                    (minus:SI (const_int 31)
6430                              (match_operand:SI 2 "register_operand" "q"))))]
6431   ""
6432   "*
6434   unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
6435   operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6436   operands[1] = GEN_INT ((x & 0xf) - 0x10);
6437   return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\";
6439   [(set_attr "type" "shift")
6440    (set_attr "length" "4")])
6442 (define_insn "vdepi_ior"
6443   [(set (match_operand:SI 0 "register_operand" "=r")
6444         (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
6445                            (minus:SI (const_int 31)
6446                                      (match_operand:SI 2 "register_operand" "q")))
6447                 (match_operand:SI 3 "register_operand" "0")))]
6448   ; accept ...0001...1, can this be generalized?
6449   "exact_log2 (INTVAL (operands[1]) + 1) > 0"
6450   "*
6452   HOST_WIDE_INT x = INTVAL (operands[1]);
6453   operands[2] = GEN_INT (exact_log2 (x + 1));
6454   return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\";
6456   [(set_attr "type" "shift")
6457    (set_attr "length" "4")])
6459 (define_insn "vdepi_and"
6460   [(set (match_operand:SI 0 "register_operand" "=r")
6461         (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
6462                            (minus:SI (const_int 31)
6463                                      (match_operand:SI 2 "register_operand" "q")))
6464                 (match_operand:SI 3 "register_operand" "0")))]
6465   ; this can be generalized...!
6466   "INTVAL (operands[1]) == -2"
6467   "*
6469   HOST_WIDE_INT x = INTVAL (operands[1]);
6470   operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6471   return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\";
6473   [(set_attr "type" "shift")
6474    (set_attr "length" "4")])
6476 (define_expand "ashldi3"
6477   [(set (match_operand:DI 0 "register_operand" "")
6478         (ashift:DI (match_operand:DI 1 "lhs_lshift_operand" "")
6479                    (match_operand:DI 2 "arith32_operand" "")))]
6480   "TARGET_64BIT"
6481   "
6483   if (GET_CODE (operands[2]) != CONST_INT)
6484     {
6485       rtx temp = gen_reg_rtx (DImode);
6486       emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6487       if (GET_CODE (operands[1]) == CONST_INT)
6488         emit_insn (gen_zvdep_imm64 (operands[0], operands[1], temp));
6489       else
6490         emit_insn (gen_zvdep64 (operands[0], operands[1], temp));
6491       DONE;
6492     }
6493   /* Make sure both inputs are not constants,
6494      there are no patterns for that.  */
6495   operands[1] = force_reg (DImode, operands[1]);
6498 (define_insn ""
6499   [(set (match_operand:DI 0 "register_operand" "=r")
6500         (ashift:DI (match_operand:DI 1 "register_operand" "r")
6501                    (match_operand:DI 2 "const_int_operand" "n")))]
6502   "TARGET_64BIT"
6503   "depd,z %1,%p2,%Q2,%0"
6504   [(set_attr "type" "shift")
6505    (set_attr "length" "4")])
6507 ; Match cases of op1 a CONST_INT here that zvdep_imm64 doesn't handle.
6508 ; Doing it like this makes slightly better code since reload can
6509 ; replace a register with a known value in range -16..15 with a
6510 ; constant.  Ideally, we would like to merge zvdep64 and zvdep_imm64,
6511 ; but since we have no more CONST_OK... characters, that is not
6512 ; possible.
6513 (define_insn "zvdep64"
6514   [(set (match_operand:DI 0 "register_operand" "=r,r")
6515         (ashift:DI (match_operand:DI 1 "arith5_operand" "r,L")
6516                    (minus:DI (const_int 63)
6517                              (match_operand:DI 2 "register_operand" "q,q"))))]
6518   "TARGET_64BIT"
6519   "@
6520    depd,z %1,%%sar,64,%0
6521    depdi,z %1,%%sar,64,%0"
6522   [(set_attr "type" "shift,shift")
6523    (set_attr "length" "4,4")])
6525 (define_insn "zvdep_imm64"
6526   [(set (match_operand:DI 0 "register_operand" "=r")
6527         (ashift:DI (match_operand:DI 1 "lhs_lshift_cint_operand" "")
6528                    (minus:DI (const_int 63)
6529                              (match_operand:DI 2 "register_operand" "q"))))]
6530   "TARGET_64BIT"
6531   "*
6533   unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
6534   operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6535   operands[1] = GEN_INT ((x & 0x1f) - 0x20);
6536   return \"depdi,z %1,%%sar,%2,%0\";
6538   [(set_attr "type" "shift")
6539    (set_attr "length" "4")])
6541 (define_insn ""
6542   [(set (match_operand:DI 0 "register_operand" "=r")
6543         (ior:DI (ashift:DI (match_operand:DI 1 "const_int_operand" "")
6544                            (minus:DI (const_int 63)
6545                                      (match_operand:DI 2 "register_operand" "q")))
6546                 (match_operand:DI 3 "register_operand" "0")))]
6547   ; accept ...0001...1, can this be generalized?
6548   "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) > 0"
6549   "*
6551   HOST_WIDE_INT x = INTVAL (operands[1]);
6552   operands[2] = GEN_INT (exact_log2 (x + 1));
6553   return \"depdi -1,%%sar,%2,%0\";
6555   [(set_attr "type" "shift")
6556    (set_attr "length" "4")])
6558 (define_insn ""
6559   [(set (match_operand:DI 0 "register_operand" "=r")
6560         (and:DI (rotate:DI (match_operand:DI 1 "const_int_operand" "")
6561                            (minus:DI (const_int 63)
6562                                      (match_operand:DI 2 "register_operand" "q")))
6563                 (match_operand:DI 3 "register_operand" "0")))]
6564   ; this can be generalized...!
6565   "TARGET_64BIT && INTVAL (operands[1]) == -2"
6566   "*
6568   HOST_WIDE_INT x = INTVAL (operands[1]);
6569   operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6570   return \"depdi 0,%%sar,%2,%0\";
6572   [(set_attr "type" "shift")
6573    (set_attr "length" "4")])
6575 (define_expand "ashrsi3"
6576   [(set (match_operand:SI 0 "register_operand" "")
6577         (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
6578                      (match_operand:SI 2 "arith32_operand" "")))]
6579   ""
6580   "
6582   if (GET_CODE (operands[2]) != CONST_INT)
6583     {
6584       rtx temp = gen_reg_rtx (SImode);
6585       emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6586       emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
6587       DONE;
6588     }
6591 (define_insn ""
6592   [(set (match_operand:SI 0 "register_operand" "=r")
6593         (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6594                      (match_operand:SI 2 "const_int_operand" "n")))]
6595   ""
6596   "{extrs|extrw,s} %1,%P2,%L2,%0"
6597   [(set_attr "type" "shift")
6598    (set_attr "length" "4")])
6600 (define_insn "vextrs32"
6601   [(set (match_operand:SI 0 "register_operand" "=r")
6602         (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6603                      (minus:SI (const_int 31)
6604                                (match_operand:SI 2 "register_operand" "q"))))]
6605   ""
6606   "{vextrs %1,32,%0|extrw,s %1,%%sar,32,%0}"
6607   [(set_attr "type" "shift")
6608    (set_attr "length" "4")])
6610 (define_expand "ashrdi3"
6611   [(set (match_operand:DI 0 "register_operand" "")
6612         (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6613                      (match_operand:DI 2 "arith32_operand" "")))]
6614   "TARGET_64BIT"
6615   "
6617   if (GET_CODE (operands[2]) != CONST_INT)
6618     {
6619       rtx temp = gen_reg_rtx (DImode);
6620       emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6621       emit_insn (gen_vextrs64 (operands[0], operands[1], temp));
6622       DONE;
6623     }
6626 (define_insn ""
6627   [(set (match_operand:DI 0 "register_operand" "=r")
6628         (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6629                      (match_operand:DI 2 "const_int_operand" "n")))]
6630   "TARGET_64BIT"
6631   "extrd,s %1,%p2,%Q2,%0"
6632   [(set_attr "type" "shift")
6633    (set_attr "length" "4")])
6635 (define_insn "vextrs64"
6636   [(set (match_operand:DI 0 "register_operand" "=r")
6637         (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6638                      (minus:DI (const_int 63)
6639                                (match_operand:DI 2 "register_operand" "q"))))]
6640   "TARGET_64BIT"
6641   "extrd,s %1,%%sar,64,%0"
6642   [(set_attr "type" "shift")
6643    (set_attr "length" "4")])
6645 (define_insn "lshrsi3"
6646   [(set (match_operand:SI 0 "register_operand" "=r,r")
6647         (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
6648                      (match_operand:SI 2 "shift5_operand" "q,n")))]
6649   ""
6650   "@
6651    {vshd %%r0,%1,%0|shrpw %%r0,%1,%%sar,%0}
6652    {extru|extrw,u} %1,%P2,%L2,%0"
6653   [(set_attr "type" "shift")
6654    (set_attr "length" "4")])
6656 (define_insn "lshrdi3"
6657   [(set (match_operand:DI 0 "register_operand" "=r,r")
6658         (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r")
6659                      (match_operand:DI 2 "shift6_operand" "q,n")))]
6660   "TARGET_64BIT"
6661   "@
6662    shrpd %%r0,%1,%%sar,%0
6663    extrd,u %1,%p2,%Q2,%0"
6664   [(set_attr "type" "shift")
6665    (set_attr "length" "4")])
6667 ; Shift right pair word 0 to 31 bits.
6668 (define_insn "shrpsi4"
6669   [(set (match_operand:SI 0 "register_operand" "=r,r")
6670         (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
6671                            (minus:SI (const_int 32)
6672                              (match_operand:SI 3 "shift5_operand" "q,n")))
6673                 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r,r")
6674                              (match_dup 3))))]
6675   ""
6676   "@
6677    {vshd %1,%2,%0|shrpw %1,%2,%%sar,%0}
6678    {shd|shrpw} %1,%2,%3,%0"
6679   [(set_attr "type" "shift")
6680    (set_attr "length" "4")])
6682 ; Shift right pair doubleword 0 to 63 bits.
6683 (define_insn "shrpdi4"
6684   [(set (match_operand:DI 0 "register_operand" "=r,r")
6685         (ior:DI (ashift:DI (match_operand:SI 1 "register_operand" "r,r")
6686                            (minus:DI (const_int 64)
6687                              (match_operand:DI 3 "shift6_operand" "q,n")))
6688                 (lshiftrt:DI (match_operand:DI 2 "register_operand" "r,r")
6689                              (match_dup 3))))]
6690   "TARGET_64BIT"
6691   "@
6692    shrpd %1,%2,%%sar,%0
6693    shrpd %1,%2,%3,%0"
6694   [(set_attr "type" "shift")
6695    (set_attr "length" "4")])
6697 (define_insn "rotrsi3"
6698   [(set (match_operand:SI 0 "register_operand" "=r,r")
6699         (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
6700                      (match_operand:SI 2 "shift5_operand" "q,n")))]
6701   ""
6702   "*
6704   if (GET_CODE (operands[2]) == CONST_INT)
6705     {
6706       operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
6707       return \"{shd|shrpw} %1,%1,%2,%0\";
6708     }
6709   else
6710     return \"{vshd %1,%1,%0|shrpw %1,%1,%%sar,%0}\";
6712   [(set_attr "type" "shift")
6713    (set_attr "length" "4")])
6715 (define_expand "rotlsi3"
6716   [(set (match_operand:SI 0 "register_operand" "")
6717         (rotate:SI (match_operand:SI 1 "register_operand" "")
6718                    (match_operand:SI 2 "arith32_operand" "")))]
6719   ""
6720   "
6722   if (GET_CODE (operands[2]) != CONST_INT)
6723     {
6724       rtx temp = gen_reg_rtx (SImode);
6725       emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
6726       emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
6727       DONE;
6728     }
6729   /* Else expand normally.  */
6732 (define_insn ""
6733   [(set (match_operand:SI 0 "register_operand" "=r")
6734         (rotate:SI (match_operand:SI 1 "register_operand" "r")
6735                    (match_operand:SI 2 "const_int_operand" "n")))]
6736   ""
6737   "*
6739   operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
6740   return \"{shd|shrpw} %1,%1,%2,%0\";
6742   [(set_attr "type" "shift")
6743    (set_attr "length" "4")])
6745 (define_insn ""
6746   [(set (match_operand:SI 0 "register_operand" "=r")
6747         (match_operator:SI 5 "plus_xor_ior_operator"
6748           [(ashift:SI (match_operand:SI 1 "register_operand" "r")
6749                       (match_operand:SI 3 "const_int_operand" "n"))
6750            (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6751                         (match_operand:SI 4 "const_int_operand" "n"))]))]
6752   "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6753   "{shd|shrpw} %1,%2,%4,%0"
6754   [(set_attr "type" "shift")
6755    (set_attr "length" "4")])
6757 (define_insn ""
6758   [(set (match_operand:SI 0 "register_operand" "=r")
6759         (match_operator:SI 5 "plus_xor_ior_operator"
6760           [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6761                         (match_operand:SI 4 "const_int_operand" "n"))
6762            (ashift:SI (match_operand:SI 1 "register_operand" "r")
6763                       (match_operand:SI 3 "const_int_operand" "n"))]))]
6764   "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6765   "{shd|shrpw} %1,%2,%4,%0"
6766   [(set_attr "type" "shift")
6767    (set_attr "length" "4")])
6769 (define_insn ""
6770   [(set (match_operand:SI 0 "register_operand" "=r")
6771         (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
6772                            (match_operand:SI 2 "const_int_operand" ""))
6773                 (match_operand:SI 3 "const_int_operand" "")))]
6774   "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) > 0"
6775   "*
6777   int cnt = INTVAL (operands[2]) & 31;
6778   operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
6779   operands[2] = GEN_INT (31 - cnt);
6780   return \"{zdep|depw,z} %1,%2,%3,%0\";
6782   [(set_attr "type" "shift")
6783    (set_attr "length" "4")])
6785 ;; Unconditional and other jump instructions.
6787 ;; Trivial return used when no epilogue is needed.
6788 (define_insn "return"
6789   [(return)
6790    (use (reg:SI 2))]
6791   "pa_can_use_return_insn ()"
6792   "*
6794   if (TARGET_PA_20)
6795     return \"bve%* (%%r2)\";
6796   return \"bv%* %%r0(%%r2)\";
6798   [(set_attr "type" "branch")
6799    (set_attr "length" "4")])
6801 ;; This is used for most returns.
6802 (define_insn "return_internal"
6803   [(return)
6804    (use (reg:SI 2))]
6805   ""
6806   "*
6808   if (TARGET_PA_20)
6809     return \"bve%* (%%r2)\";
6810   return \"bv%* %%r0(%%r2)\";
6812   [(set_attr "type" "branch")
6813    (set_attr "length" "4")])
6815 ;; This is used for eh returns which bypass the return stub.
6816 (define_insn "return_external_pic"
6817   [(return)
6818    (clobber (reg:SI 1))
6819    (use (reg:SI 2))]
6820   "!TARGET_NO_SPACE_REGS
6821    && !TARGET_PA_20
6822    && flag_pic && crtl->calls_eh_return"
6823   "ldsid (%%sr0,%%r2),%%r1\;mtsp %%r1,%%sr0\;be%* 0(%%sr0,%%r2)"
6824   [(set_attr "type" "branch")
6825    (set_attr "length" "12")])
6827 (define_expand "prologue"
6828   [(const_int 0)]
6829   ""
6830   "pa_expand_prologue ();DONE;")
6832 (define_expand "sibcall_epilogue"
6833   [(return)]
6834   ""
6835   "
6837   pa_expand_epilogue ();
6838   DONE;
6841 (define_expand "epilogue"
6842   [(return)]
6843   ""
6844   "
6846   rtx x;
6848   /* Try to use the trivial return first.  Else use the full epilogue.  */
6849   if (pa_can_use_return_insn ())
6850     x = gen_return ();
6851   else
6852     {
6853       pa_expand_epilogue ();
6855       /* EH returns bypass the normal return stub.  Thus, we must do an
6856          interspace branch to return from functions that call eh_return.
6857          This is only a problem for returns from shared code on ports
6858          using space registers.  */
6859       if (!TARGET_NO_SPACE_REGS
6860           && !TARGET_PA_20
6861           && flag_pic && crtl->calls_eh_return)
6862         x = gen_return_external_pic ();
6863       else
6864         x = gen_return_internal ();
6865     }
6866   emit_jump_insn (x);
6867   DONE;
6870 ; Used by hppa_profile_hook to load the starting address of the current
6871 ; function; operand 1 contains the address of the label in operand 3
6872 (define_insn "load_offset_label_address"
6873   [(set (match_operand:SI 0 "register_operand" "=r")
6874         (plus:SI (match_operand:SI 1 "register_operand" "r")
6875                  (minus:SI (match_operand:SI 2 "" "")
6876                            (label_ref:SI (match_operand 3 "" "")))))]
6877   ""
6878   "ldo %2-%l3(%1),%0"
6879   [(set_attr "type" "multi")
6880    (set_attr "length" "4")])
6882 ; Output a code label and load its address.
6883 (define_insn "lcla1"
6884   [(set (match_operand:SI 0 "register_operand" "=r")
6885         (label_ref:SI (match_operand 1 "" "")))
6886    (const_int 0)]
6887   "!TARGET_PA_20"
6888   "*
6890   output_asm_insn (\"bl .+8,%0\;depi 0,31,2,%0\", operands);
6891   (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6892                                      CODE_LABEL_NUMBER (operands[1]));
6893   return \"\";
6895   [(set_attr "type" "multi")
6896    (set_attr "length" "8")])
6898 (define_insn "lcla2"
6899   [(set (match_operand:SI 0 "register_operand" "=r")
6900         (label_ref:SI (match_operand 1 "" "")))
6901    (const_int 0)]
6902   "TARGET_PA_20"
6903   "*
6905   (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6906                                      CODE_LABEL_NUMBER (operands[1]));
6907   return \"mfia %0\";
6909   [(set_attr "type" "move")
6910    (set_attr "length" "4")])
6912 (define_insn "blockage"
6913   [(unspec_volatile [(const_int 2)] UNSPECV_BLOCKAGE)]
6914   ""
6915   ""
6916   [(set_attr "length" "0")])
6918 (define_insn "jump"
6919   [(set (pc) (label_ref (match_operand 0 "" "")))]
6920   ""
6921   "*
6923   /* An unconditional branch which can reach its target.  */
6924   if (get_attr_length (insn) < 16)
6925     return \"b%* %l0\";
6927   return pa_output_lbranch (operands[0], insn, 1);
6929   [(set_attr "type" "uncond_branch")
6930    (set_attr "pa_combine_type" "uncond_branch")
6931    (set (attr "length")
6932     (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
6933                (const_int MAX_17BIT_OFFSET))
6934            (const_int 4)
6935            (match_test "TARGET_PORTABLE_RUNTIME")
6936            (const_int 20)
6937            (not (match_test "flag_pic"))
6938            (const_int 16)]
6939           (const_int 24)))])
6941 ;;; Hope this is only within a function...
6942 (define_insn "indirect_jump"
6943   [(set (pc) (match_operand 0 "register_operand" "r"))]
6944   "GET_MODE (operands[0]) == word_mode"
6945   "bv%* %%r0(%0)"
6946   [(set_attr "type" "branch")
6947    (set_attr "length" "4")])
6949 ;;; An indirect jump can be optimized to a direct jump.  GAS for the
6950 ;;; SOM target doesn't allow branching to a label inside a function.
6951 ;;; We also don't correctly compute branch distances for labels
6952 ;;; outside the current function.  Thus, we use an indirect jump can't
6953 ;;; be optimized to a direct jump for all targets.  We assume that
6954 ;;; the branch target is in the same space (i.e., nested function
6955 ;;; jumping to a label in an outer function in the same translation
6956 ;;; unit).
6957 (define_expand "nonlocal_goto"
6958   [(use (match_operand 0 "general_operand" ""))
6959    (use (match_operand 1 "general_operand" ""))
6960    (use (match_operand 2 "general_operand" ""))
6961    (use (match_operand 3 "general_operand" ""))]
6962   ""
6964   rtx lab = operands[1];
6965   rtx stack = operands[2];
6966   rtx fp = operands[3];
6968   lab = copy_to_reg (lab);
6970   emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
6971   emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
6973   /* Restore the frame pointer.  The virtual_stack_vars_rtx is saved
6974      instead of the hard_frame_pointer_rtx in the save area.  As a
6975      result, an extra instruction is needed to adjust for the offset
6976      of the virtual stack variables and the hard frame pointer.  */
6977   if (GET_CODE (fp) != REG)
6978     fp = force_reg (Pmode, fp);
6979   emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
6981   emit_stack_restore (SAVE_NONLOCAL, stack);
6983   emit_use (hard_frame_pointer_rtx);
6984   emit_use (stack_pointer_rtx);
6986   /* Nonlocal goto jumps are only used between functions in the same
6987      translation unit.  Thus, we can avoid the extra overhead of an
6988      interspace jump.  */
6989   emit_jump_insn (gen_indirect_goto (lab));
6990   emit_barrier ();
6991   DONE;
6994 (define_insn "indirect_goto"
6995   [(unspec [(match_operand 0 "register_operand" "=r")] UNSPEC_GOTO)]
6996   "GET_MODE (operands[0]) == word_mode"
6997   "bv%* %%r0(%0)"
6998   [(set_attr "type" "branch")
6999    (set_attr "length" "4")])
7001 ;; Subroutines of "casesi".
7002 ;; operand 0 is index
7003 ;; operand 1 is the minimum bound
7004 ;; operand 2 is the maximum bound - minimum bound + 1
7005 ;; operand 3 is CODE_LABEL for the table;
7006 ;; operand 4 is the CODE_LABEL to go to if index out of range.
7008 (define_expand "casesi"
7009   [(match_operand:SI 0 "general_operand" "")
7010    (match_operand:SI 1 "const_int_operand" "")
7011    (match_operand:SI 2 "const_int_operand" "")
7012    (match_operand 3 "" "")
7013    (match_operand 4 "" "")]
7014   ""
7015   "
7017   if (GET_CODE (operands[0]) != REG)
7018     operands[0] = force_reg (SImode, operands[0]);
7020   if (operands[1] != const0_rtx)
7021     {
7022       rtx index = gen_reg_rtx (SImode);
7024       operands[1] = gen_int_mode (-INTVAL (operands[1]), SImode);
7025       if (!INT_14_BITS (operands[1]))
7026         operands[1] = force_reg (SImode, operands[1]);
7027       emit_insn (gen_addsi3 (index, operands[0], operands[1]));
7028       operands[0] = index;
7029     }
7031   if (!INT_5_BITS (operands[2]))
7032     operands[2] = force_reg (SImode, operands[2]);
7034   /* This branch prevents us finding an insn for the delay slot of the
7035      following vectored branch.  It might be possible to use the delay
7036      slot if an index value of -1 was used to transfer to the out-of-range
7037      label.  In order to do this, we would have to output the -1 vector
7038      element after the delay insn.  The casesi output code would have to
7039      check if the casesi insn is in a delay branch sequence and output
7040      the delay insn if one is found.  If this was done, then it might
7041      then be worthwhile to split the casesi patterns to improve scheduling.
7042      However, it's not clear that all this extra complexity is worth
7043      the effort.  */
7044   {
7045     rtx test = gen_rtx_GTU (VOIDmode, operands[0], operands[2]);
7046     emit_jump_insn (gen_cbranchsi4 (test, operands[0], operands[2], operands[4]));
7047   }
7049   /* In 64bit mode we must make sure to wipe the upper bits of the register
7050      just in case the addition overflowed or we had random bits in the
7051      high part of the register.  */
7052   if (TARGET_64BIT)
7053     {
7054       rtx index = gen_reg_rtx (DImode);
7056       emit_insn (gen_extendsidi2 (index, operands[0]));
7057       operands[0] = index;
7058     }
7060   if (TARGET_64BIT)
7061     emit_jump_insn (gen_casesi64p (operands[0], operands[3]));
7062   else if (flag_pic)
7063     emit_jump_insn (gen_casesi32p (operands[0], operands[3]));
7064   else
7065     emit_jump_insn (gen_casesi32 (operands[0], operands[3]));
7066   DONE;
7069 ;;; 32-bit code, absolute branch table.
7070 (define_insn "casesi32"
7071   [(set (pc) (mem:SI (plus:SI
7072                        (mult:SI (match_operand:SI 0 "register_operand" "r")
7073                                 (const_int 4))
7074                        (label_ref (match_operand 1 "" "")))))
7075    (clobber (match_scratch:SI 2 "=&r"))]
7076   "!flag_pic"
7077   "ldil L'%l1,%2\;ldo R'%l1(%2),%2\;{ldwx|ldw},s %0(%2),%2\;bv,n %%r0(%2)"
7078   [(set_attr "type" "multi")
7079    (set_attr "length" "16")])
7081 ;;; 32-bit code, relative branch table.
7082 (define_insn "casesi32p"
7083   [(set (pc) (mem:SI (plus:SI
7084                        (mult:SI (match_operand:SI 0 "register_operand" "r")
7085                                 (const_int 4))
7086                        (label_ref (match_operand 1 "" "")))))
7087    (clobber (match_scratch:SI 2 "=&r"))
7088    (clobber (match_scratch:SI 3 "=&r"))]
7089   "flag_pic"
7090   "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;ldo {%l1-.|%l1+4-.}(%2),%2\;\
7091 {ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
7092   [(set_attr "type" "multi")
7093    (set (attr "length")
7094      (if_then_else (match_test "TARGET_PA_20")
7095         (const_int 20)
7096         (const_int 24)))])
7098 ;;; 64-bit code, 32-bit relative branch table.
7099 (define_insn "casesi64p"
7100   [(set (pc) (mem:DI (plus:DI
7101                        (mult:DI (match_operand:DI 0 "register_operand" "r")
7102                                 (const_int 8))
7103                        (label_ref (match_operand 1 "" "")))))
7104    (clobber (match_scratch:DI 2 "=&r"))
7105    (clobber (match_scratch:DI 3 "=&r"))]
7106   ""
7107   "mfia %2\;ldo %l1+4-.(%2),%2\;ldw,s %0(%2),%3\;extrd,s %3,63,32,%3\;\
7108 add,l %2,%3,%3\;bv,n %%r0(%3)"
7109   [(set_attr "type" "multi")
7110    (set_attr "length" "24")])
7113 ;; Call patterns.
7114 ;;- jump to subroutine
7116 (define_expand "call"
7117   [(parallel [(call (match_operand:SI 0 "" "")
7118                     (match_operand 1 "" ""))
7119               (clobber (reg:SI 2))])]
7120   ""
7121   "
7123   rtx op;
7124   rtx nb = operands[1];
7126   if (TARGET_PORTABLE_RUNTIME)
7127     op = force_reg (SImode, XEXP (operands[0], 0));
7128   else
7129     {
7130       op = XEXP (operands[0], 0);
7132       /* Generate indirect long calls to non-local functions. */
7133       if (!TARGET_64BIT && TARGET_LONG_CALLS && GET_CODE (op) == SYMBOL_REF)
7134         {
7135           tree call_decl = SYMBOL_REF_DECL (op);
7136           if (!(call_decl && targetm.binds_local_p (call_decl)))
7137             op = force_reg (word_mode, op);
7138         }
7139     }
7141   if (TARGET_64BIT)
7142     {
7143       if (!virtuals_instantiated)
7144         emit_move_insn (arg_pointer_rtx,
7145                         gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7146                                       GEN_INT (64)));
7147       else
7148         {
7149           /* The loop pass can generate new libcalls after the virtual
7150              registers are instantiated when fpregs are disabled because
7151              the only method that we have for doing DImode multiplication
7152              is with a libcall.  This could be trouble if we haven't
7153              allocated enough space for the outgoing arguments.  */
7154           gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
7156           emit_move_insn (arg_pointer_rtx,
7157                           gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7158                                         GEN_INT (STACK_POINTER_OFFSET + 64)));
7159         }
7160     }
7162   /* Use two different patterns for calls to explicitly named functions
7163      and calls through function pointers.  This is necessary as these two
7164      types of calls use different calling conventions, and CSE might try
7165      to change the named call into an indirect call in some cases (using
7166      two patterns keeps CSE from performing this optimization).
7167      
7168      We now use even more call patterns as there was a subtle bug in
7169      attempting to restore the pic register after a call using a simple
7170      move insn.  During reload, a instruction involving a pseudo register
7171      with no explicit dependence on the PIC register can be converted
7172      to an equivalent load from memory using the PIC register.  If we
7173      emit a simple move to restore the PIC register in the initial rtl
7174      generation, then it can potentially be repositioned during scheduling.
7175      and an instruction that eventually uses the PIC register may end up
7176      between the call and the PIC register restore.
7177      
7178      This only worked because there is a post call group of instructions
7179      that are scheduled with the call.  These instructions are included
7180      in the same basic block as the call.  However, calls can throw in
7181      C++ code and a basic block has to terminate at the call if the call
7182      can throw.  This results in the PIC register restore being scheduled
7183      independently from the call.  So, we now hide the save and restore
7184      of the PIC register in the call pattern until after reload.  Then,
7185      we split the moves out.  A small side benefit is that we now don't
7186      need to have a use of the PIC register in the return pattern and
7187      the final save/restore operation is not needed.
7188      
7189      I elected to just use register %r4 in the PIC patterns instead
7190      of trying to force hppa_pic_save_rtx () to a callee saved register.
7191      This might have required a new register class and constraint.  It
7192      was also simpler to just handle the restore from a register than a
7193      generic pseudo.  */
7194   if (TARGET_64BIT)
7195     {
7196       rtx r4 = gen_rtx_REG (word_mode, 4);
7197       if (GET_CODE (op) == SYMBOL_REF)
7198         emit_call_insn (gen_call_symref_64bit (op, nb, r4));
7199       else
7200         {
7201           op = force_reg (word_mode, op);
7202           emit_call_insn (gen_call_reg_64bit (op, nb, r4));
7203         }
7204     }
7205   else
7206     {
7207       if (GET_CODE (op) == SYMBOL_REF)
7208         {
7209           if (flag_pic)
7210             {
7211               rtx r4 = gen_rtx_REG (word_mode, 4);
7212               emit_call_insn (gen_call_symref_pic (op, nb, r4));
7213             }
7214           else
7215             emit_call_insn (gen_call_symref (op, nb));
7216         }
7217       else
7218         {
7219           rtx tmpreg = gen_rtx_REG (word_mode, 22);
7220           emit_move_insn (tmpreg, force_reg (word_mode, op));
7221           if (flag_pic)
7222             {
7223               rtx r4 = gen_rtx_REG (word_mode, 4);
7224               emit_call_insn (gen_call_reg_pic (nb, r4));
7225             }
7226           else
7227             emit_call_insn (gen_call_reg (nb));
7228         }
7229     }
7231   DONE;
7234 ;; We use function calls to set the attribute length of calls and millicode
7235 ;; calls.  This is necessary because of the large variety of call sequences.
7236 ;; Implementing the calculation in rtl is difficult as well as ugly.  As
7237 ;; we need the same calculation in several places, maintenance becomes a
7238 ;; nightmare.
7240 ;; However, this has a subtle impact on branch shortening.  When the
7241 ;; expression used to set the length attribute of an instruction depends
7242 ;; on a relative address (e.g., pc or a branch address), genattrtab
7243 ;; notes that the insn's length is variable, and attempts to determine a
7244 ;; worst-case default length and code to compute an insn's current length.
7246 ;; The use of a function call hides the variable dependence of our calls
7247 ;; and millicode calls.  The result is genattrtab doesn't treat the operation
7248 ;; as variable and it only generates code for the default case using our
7249 ;; function call.  Because of this, calls and millicode calls have a fixed
7250 ;; length in the branch shortening pass, and some branches will use a longer
7251 ;; code sequence than necessary.  However, the length of any given call
7252 ;; will still reflect its final code location and it may be shorter than
7253 ;; the initial length estimate.
7255 ;; It's possible to trick genattrtab by adding an expression involving `pc'
7256 ;; in the set.  However, when genattrtab hits a function call in its attempt
7257 ;; to compute the default length, it marks the result as unknown and sets
7258 ;; the default result to MAX_INT ;-(  One possible fix that would allow
7259 ;; calls to participate in branch shortening would be to make the call to
7260 ;; insn_default_length a target option.  Then, we could massage unknown
7261 ;; results.  Another fix might be to change genattrtab so that it just does
7262 ;; the call in the variable case as it already does for the fixed case.
7264 (define_insn "call_symref"
7265   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7266          (match_operand 1 "" "i"))
7267    (clobber (reg:SI 1))
7268    (clobber (reg:SI 2))
7269    (use (const_int 0))]
7270   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7271   "*
7273   pa_output_arg_descriptor (insn);
7274   return pa_output_call (insn, operands[0], 0);
7276   [(set_attr "type" "call")
7277    (set (attr "length")
7278         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7279               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7281 (define_insn "call_symref_pic"
7282   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7283          (match_operand 1 "" "i"))
7284    (clobber (reg:SI 1))
7285    (clobber (reg:SI 2))
7286    (clobber (match_operand 2))
7287    (use (reg:SI 19))
7288    (use (const_int 0))]
7289   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7290   "#")
7292 ;; Split out the PIC register save and restore after reload.  As the
7293 ;; split is done after reload, there are some situations in which we
7294 ;; unnecessarily save and restore %r4.  This happens when there is a
7295 ;; single call and the PIC register is not used after the call.
7297 ;; The split has to be done since call_from_call_insn () can't handle
7298 ;; the pattern as is.  Noreturn calls are special because they have to
7299 ;; terminate the basic block.  The split has to contain more than one
7300 ;; insn.
7301 (define_split
7302   [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7303                     (match_operand 1 "" ""))
7304               (clobber (reg:SI 1))
7305               (clobber (reg:SI 2))
7306               (clobber (match_operand 2))
7307               (use (reg:SI 19))
7308               (use (const_int 0))])]
7309   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7310    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7311   [(set (match_dup 2) (reg:SI 19))
7312    (parallel [(call (mem:SI (match_dup 0))
7313                     (match_dup 1))
7314               (clobber (reg:SI 1))
7315               (clobber (reg:SI 2))
7316               (use (reg:SI 19))
7317               (use (const_int 0))])]
7318   "")
7320 (define_split
7321   [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7322                     (match_operand 1 "" ""))
7323               (clobber (reg:SI 1))
7324               (clobber (reg:SI 2))
7325               (clobber (match_operand 2))
7326               (use (reg:SI 19))
7327               (use (const_int 0))])]
7328   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7329   [(set (match_dup 2) (reg:SI 19))
7330    (parallel [(call (mem:SI (match_dup 0))
7331                     (match_dup 1))
7332               (clobber (reg:SI 1))
7333               (clobber (reg:SI 2))
7334               (use (reg:SI 19))
7335               (use (const_int 0))])
7336    (set (reg:SI 19) (match_dup 2))]
7337   "")
7339 (define_insn "*call_symref_pic_post_reload"
7340   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7341          (match_operand 1 "" "i"))
7342    (clobber (reg:SI 1))
7343    (clobber (reg:SI 2))
7344    (use (reg:SI 19))
7345    (use (const_int 0))]
7346   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7347   "*
7349   pa_output_arg_descriptor (insn);
7350   return pa_output_call (insn, operands[0], 0);
7352   [(set_attr "type" "call")
7353    (set (attr "length")
7354         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7355               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7357 ;; This pattern is split if it is necessary to save and restore the
7358 ;; PIC register.
7359 (define_insn "call_symref_64bit"
7360   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7361          (match_operand 1 "" "i"))
7362    (clobber (reg:DI 1))
7363    (clobber (reg:DI 2))
7364    (clobber (match_operand 2))
7365    (use (reg:DI 27))
7366    (use (reg:DI 29))
7367    (use (const_int 0))]
7368   "TARGET_64BIT"
7369   "#")
7371 ;; Split out the PIC register save and restore after reload.  As the
7372 ;; split is done after reload, there are some situations in which we
7373 ;; unnecessarily save and restore %r4.  This happens when there is a
7374 ;; single call and the PIC register is not used after the call.
7376 ;; The split has to be done since call_from_call_insn () can't handle
7377 ;; the pattern as is.  Noreturn calls are special because they have to
7378 ;; terminate the basic block.  The split has to contain more than one
7379 ;; insn.
7380 (define_split
7381   [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7382                     (match_operand 1 "" ""))
7383               (clobber (reg:DI 1))
7384               (clobber (reg:DI 2))
7385               (clobber (match_operand 2))
7386               (use (reg:DI 27))
7387               (use (reg:DI 29))
7388               (use (const_int 0))])]
7389   "TARGET_64BIT && reload_completed
7390    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7391   [(set (match_dup 2) (reg:DI 27))
7392    (parallel [(call (mem:SI (match_dup 0))
7393                     (match_dup 1))
7394               (clobber (reg:DI 1))
7395               (clobber (reg:DI 2))
7396               (use (reg:DI 27))
7397               (use (reg:DI 29))
7398               (use (const_int 0))])]
7399   "")
7401 (define_split
7402   [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7403                     (match_operand 1 "" ""))
7404               (clobber (reg:DI 1))
7405               (clobber (reg:DI 2))
7406               (clobber (match_operand 2))
7407               (use (reg:DI 27))
7408               (use (reg:DI 29))
7409               (use (const_int 0))])]
7410   "TARGET_64BIT && reload_completed"
7411   [(set (match_dup 2) (reg:DI 27))
7412    (parallel [(call (mem:SI (match_dup 0))
7413                     (match_dup 1))
7414               (clobber (reg:DI 1))
7415               (clobber (reg:DI 2))
7416               (use (reg:DI 27))
7417               (use (reg:DI 29))
7418               (use (const_int 0))])
7419    (set (reg:DI 27) (match_dup 2))]
7420   "")
7422 (define_insn "*call_symref_64bit_post_reload"
7423   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7424          (match_operand 1 "" "i"))
7425    (clobber (reg:DI 1))
7426    (clobber (reg:DI 2))
7427    (use (reg:DI 27))
7428    (use (reg:DI 29))
7429    (use (const_int 0))]
7430   "TARGET_64BIT"
7431   "*
7433   pa_output_arg_descriptor (insn);
7434   return pa_output_call (insn, operands[0], 0);
7436   [(set_attr "type" "call")
7437    (set (attr "length")
7438         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7439               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7441 (define_insn "call_reg"
7442   [(call (mem:SI (reg:SI 22))
7443          (match_operand 0 "" "i"))
7444    (clobber (reg:SI 1))
7445    (clobber (reg:SI 2))
7446    (use (const_int 1))]
7447   "!TARGET_64BIT"
7448   "*
7450   return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7452   [(set_attr "type" "dyncall")
7453    (set (attr "length")
7454         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7455               (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7457 ;; This pattern is split if it is necessary to save and restore the
7458 ;; PIC register.
7459 (define_insn "call_reg_pic"
7460   [(call (mem:SI (reg:SI 22))
7461          (match_operand 0 "" "i"))
7462    (clobber (reg:SI 1))
7463    (clobber (reg:SI 2))
7464    (clobber (match_operand 1))
7465    (use (reg:SI 19))
7466    (use (const_int 1))]
7467   "!TARGET_64BIT"
7468   "#")
7470 ;; Split out the PIC register save and restore after reload.  As the
7471 ;; split is done after reload, there are some situations in which we
7472 ;; unnecessarily save and restore %r4.  This happens when there is a
7473 ;; single call and the PIC register is not used after the call.
7475 ;; The split has to be done since call_from_call_insn () can't handle
7476 ;; the pattern as is.  Noreturn calls are special because they have to
7477 ;; terminate the basic block.  The split has to contain more than one
7478 ;; insn.
7479 (define_split
7480   [(parallel [(call (mem:SI (reg:SI 22))
7481                     (match_operand 0 "" ""))
7482               (clobber (reg:SI 1))
7483               (clobber (reg:SI 2))
7484               (clobber (match_operand 1))
7485               (use (reg:SI 19))
7486               (use (const_int 1))])]
7487   "!TARGET_64BIT && reload_completed
7488    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7489   [(set (match_dup 1) (reg:SI 19))
7490    (parallel [(call (mem:SI (reg:SI 22))
7491                     (match_dup 0))
7492               (clobber (reg:SI 1))
7493               (clobber (reg:SI 2))
7494               (use (reg:SI 19))
7495               (use (const_int 1))])]
7496   "")
7498 (define_split
7499   [(parallel [(call (mem:SI (reg:SI 22))
7500                     (match_operand 0 "" ""))
7501               (clobber (reg:SI 1))
7502               (clobber (reg:SI 2))
7503               (clobber (match_operand 1))
7504               (use (reg:SI 19))
7505               (use (const_int 1))])]
7506   "!TARGET_64BIT && reload_completed"
7507   [(set (match_dup 1) (reg:SI 19))
7508    (parallel [(call (mem:SI (reg:SI 22))
7509                     (match_dup 0))
7510               (clobber (reg:SI 1))
7511               (clobber (reg:SI 2))
7512               (use (reg:SI 19))
7513               (use (const_int 1))])
7514    (set (reg:SI 19) (match_dup 1))]
7515   "")
7517 (define_insn "*call_reg_pic_post_reload"
7518   [(call (mem:SI (reg:SI 22))
7519          (match_operand 0 "" "i"))
7520    (clobber (reg:SI 1))
7521    (clobber (reg:SI 2))
7522    (use (reg:SI 19))
7523    (use (const_int 1))]
7524   "!TARGET_64BIT"
7525   "*
7527   return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7529   [(set_attr "type" "dyncall")
7530    (set (attr "length")
7531         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7532               (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7534 ;; This pattern is split if it is necessary to save and restore the
7535 ;; PIC register.
7536 (define_insn "call_reg_64bit"
7537   [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7538          (match_operand 1 "" "i"))
7539    (clobber (reg:DI 1))
7540    (clobber (reg:DI 2))
7541    (clobber (match_operand 2))
7542    (use (reg:DI 27))
7543    (use (reg:DI 29))
7544    (use (const_int 1))]
7545   "TARGET_64BIT"
7546   "#")
7548 ;; Split out the PIC register save and restore after reload.  As the
7549 ;; split is done after reload, there are some situations in which we
7550 ;; unnecessarily save and restore %r4.  This happens when there is a
7551 ;; single call and the PIC register is not used after the call.
7553 ;; The split has to be done since call_from_call_insn () can't handle
7554 ;; the pattern as is.  Noreturn calls are special because they have to
7555 ;; terminate the basic block.  The split has to contain more than one
7556 ;; insn.
7557 (define_split
7558   [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7559                     (match_operand 1 "" ""))
7560               (clobber (reg:DI 1))
7561               (clobber (reg:DI 2))
7562               (clobber (match_operand 2))
7563               (use (reg:DI 27))
7564               (use (reg:DI 29))
7565               (use (const_int 1))])]
7566   "TARGET_64BIT && reload_completed
7567    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7568   [(set (match_dup 2) (reg:DI 27))
7569    (parallel [(call (mem:SI (match_dup 0))
7570                     (match_dup 1))
7571               (clobber (reg:DI 1))
7572               (clobber (reg:DI 2))
7573               (use (reg:DI 27))
7574               (use (reg:DI 29))
7575               (use (const_int 1))])]
7576   "")
7578 (define_split
7579   [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7580                     (match_operand 1 "" ""))
7581               (clobber (reg:DI 1))
7582               (clobber (reg:DI 2))
7583               (clobber (match_operand 2))
7584               (use (reg:DI 27))
7585               (use (reg:DI 29))
7586               (use (const_int 1))])]
7587   "TARGET_64BIT && reload_completed"
7588   [(set (match_dup 2) (reg:DI 27))
7589    (parallel [(call (mem:SI (match_dup 0))
7590                     (match_dup 1))
7591               (clobber (reg:DI 1))
7592               (clobber (reg:DI 2))
7593               (use (reg:DI 27))
7594               (use (reg:DI 29))
7595               (use (const_int 1))])
7596    (set (reg:DI 27) (match_dup 2))]
7597   "")
7599 (define_insn "*call_reg_64bit_post_reload"
7600   [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7601          (match_operand 1 "" "i"))
7602    (clobber (reg:DI 1))
7603    (clobber (reg:DI 2))
7604    (use (reg:DI 27))
7605    (use (reg:DI 29))
7606    (use (const_int 1))]
7607   "TARGET_64BIT"
7608   "*
7610   return pa_output_indirect_call (insn, operands[0]);
7612   [(set_attr "type" "dyncall")
7613    (set (attr "length")
7614         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 12)]
7615               (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7617 (define_expand "call_value"
7618   [(parallel [(set (match_operand 0 "" "")
7619                    (call (match_operand:SI 1 "" "")
7620                          (match_operand 2 "" "")))
7621               (clobber (reg:SI 2))])]
7622   ""
7624   rtx op;
7625   rtx dst = operands[0];
7626   rtx nb = operands[2];
7627   bool call_powf = false;
7629   if (TARGET_PORTABLE_RUNTIME)
7630     op = force_reg (SImode, XEXP (operands[1], 0));
7631   else
7632     {
7633       op = XEXP (operands[1], 0);
7634       if (GET_CODE (op) == SYMBOL_REF)
7635         {
7636           /* Handle special call to buggy powf function.  */
7637           if (TARGET_HPUX && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT
7638               && !strcmp (targetm.strip_name_encoding (XSTR (op, 0)), "powf"))
7639             call_powf = true;
7641           /* Generate indirect long calls to non-local functions. */
7642           else if (!TARGET_64BIT && TARGET_LONG_CALLS)
7643             {
7644               tree call_decl = SYMBOL_REF_DECL (op);
7645               if (!(call_decl && targetm.binds_local_p (call_decl)))
7646                 op = force_reg (word_mode, op);
7647             }
7648         }
7649     }
7651   if (TARGET_64BIT)
7652     {
7653       if (!virtuals_instantiated)
7654         emit_move_insn (arg_pointer_rtx,
7655                         gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7656                                       GEN_INT (64)));
7657       else
7658         {
7659           /* The loop pass can generate new libcalls after the virtual
7660              registers are instantiated when fpregs are disabled because
7661              the only method that we have for doing DImode multiplication
7662              is with a libcall.  This could be trouble if we haven't
7663              allocated enough space for the outgoing arguments.  */
7664           gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
7666           emit_move_insn (arg_pointer_rtx,
7667                           gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7668                                         GEN_INT (STACK_POINTER_OFFSET + 64)));
7669         }
7670     }
7672   /* Use two different patterns for calls to explicitly named functions
7673      and calls through function pointers.  This is necessary as these two
7674      types of calls use different calling conventions, and CSE might try
7675      to change the named call into an indirect call in some cases (using
7676      two patterns keeps CSE from performing this optimization).
7678      We now use even more call patterns as there was a subtle bug in
7679      attempting to restore the pic register after a call using a simple
7680      move insn.  During reload, a instruction involving a pseudo register
7681      with no explicit dependence on the PIC register can be converted
7682      to an equivalent load from memory using the PIC register.  If we
7683      emit a simple move to restore the PIC register in the initial rtl
7684      generation, then it can potentially be repositioned during scheduling.
7685      and an instruction that eventually uses the PIC register may end up
7686      between the call and the PIC register restore.
7687      
7688      This only worked because there is a post call group of instructions
7689      that are scheduled with the call.  These instructions are included
7690      in the same basic block as the call.  However, calls can throw in
7691      C++ code and a basic block has to terminate at the call if the call
7692      can throw.  This results in the PIC register restore being scheduled
7693      independently from the call.  So, we now hide the save and restore
7694      of the PIC register in the call pattern until after reload.  Then,
7695      we split the moves out.  A small side benefit is that we now don't
7696      need to have a use of the PIC register in the return pattern and
7697      the final save/restore operation is not needed.
7698      
7699      I elected to just use register %r4 in the PIC patterns instead
7700      of trying to force hppa_pic_save_rtx () to a callee saved register.
7701      This might have required a new register class and constraint.  It
7702      was also simpler to just handle the restore from a register than a
7703      generic pseudo.  */
7704   if (TARGET_64BIT)
7705     {
7706       rtx r4 = gen_rtx_REG (word_mode, 4);
7707       if (GET_CODE (op) == SYMBOL_REF)
7708         {
7709           if (call_powf)
7710             emit_call_insn (gen_call_val_powf_64bit (dst, op, nb, r4));
7711           else
7712             emit_call_insn (gen_call_val_symref_64bit (dst, op, nb, r4));
7713         }
7714       else
7715         {
7716           op = force_reg (word_mode, op);
7717           emit_call_insn (gen_call_val_reg_64bit (dst, op, nb, r4));
7718         }
7719     }
7720   else
7721     {
7722       if (GET_CODE (op) == SYMBOL_REF)
7723         {
7724           if (flag_pic)
7725             {
7726               rtx r4 = gen_rtx_REG (word_mode, 4);
7728               if (call_powf)
7729                 emit_call_insn (gen_call_val_powf_pic (dst, op, nb, r4));
7730               else
7731                 emit_call_insn (gen_call_val_symref_pic (dst, op, nb, r4));
7732             }
7733           else
7734             {
7735               if (call_powf)
7736                 emit_call_insn (gen_call_val_powf (dst, op, nb));
7737               else
7738                 emit_call_insn (gen_call_val_symref (dst, op, nb));
7739             }
7740         }
7741       else
7742         {
7743           rtx tmpreg = gen_rtx_REG (word_mode, 22);
7744           emit_move_insn (tmpreg, force_reg (word_mode, op));
7745           if (flag_pic)
7746             {
7747               rtx r4 = gen_rtx_REG (word_mode, 4);
7748               emit_call_insn (gen_call_val_reg_pic (dst, nb, r4));
7749             }
7750           else
7751             emit_call_insn (gen_call_val_reg (dst, nb));
7752         }
7753     }
7755   DONE;
7758 (define_insn "call_val_symref"
7759   [(set (match_operand 0 "" "")
7760         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7761               (match_operand 2 "" "i")))
7762    (clobber (reg:SI 1))
7763    (clobber (reg:SI 2))
7764    (use (const_int 0))]
7765   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7766   "*
7768   pa_output_arg_descriptor (insn);
7769   return pa_output_call (insn, operands[1], 0);
7771   [(set_attr "type" "call")
7772    (set (attr "length")
7773         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7774               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7776 ;; powf function clobbers %fr12
7777 (define_insn "call_val_powf"
7778   [(set (match_operand 0 "" "")
7779         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7780               (match_operand 2 "" "i")))
7781    (clobber (reg:SI 1))
7782    (clobber (reg:SI 2))
7783    (clobber (reg:DF 48))
7784    (use (const_int 1))]
7785   "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7786   "*
7788   pa_output_arg_descriptor (insn);
7789   return pa_output_call (insn, operands[1], 0);
7791   [(set_attr "type" "call")
7792    (set (attr "length")
7793         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7794               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7796 (define_insn "call_val_symref_pic"
7797   [(set (match_operand 0 "" "")
7798         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7799               (match_operand 2 "" "i")))
7800    (clobber (reg:SI 1))
7801    (clobber (reg:SI 2))
7802    (clobber (match_operand 3))
7803    (use (reg:SI 19))
7804    (use (const_int 0))]
7805   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7806   "#")
7808 ;; Split out the PIC register save and restore after reload.  As the
7809 ;; split is done after reload, there are some situations in which we
7810 ;; unnecessarily save and restore %r4.  This happens when there is a
7811 ;; single call and the PIC register is not used after the call.
7813 ;; The split has to be done since call_from_call_insn () can't handle
7814 ;; the pattern as is.  Noreturn calls are special because they have to
7815 ;; terminate the basic block.  The split has to contain more than one
7816 ;; insn.
7817 (define_split
7818   [(parallel [(set (match_operand 0 "" "")
7819               (call (mem:SI (match_operand 1 "call_operand_address" ""))
7820                     (match_operand 2 "" "")))
7821               (clobber (reg:SI 1))
7822               (clobber (reg:SI 2))
7823               (clobber (match_operand 3))
7824               (use (reg:SI 19))
7825               (use (const_int 0))])]
7826   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7827    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7828   [(set (match_dup 3) (reg:SI 19))
7829    (parallel [(set (match_dup 0)
7830               (call (mem:SI (match_dup 1))
7831                     (match_dup 2)))
7832               (clobber (reg:SI 1))
7833               (clobber (reg:SI 2))
7834               (use (reg:SI 19))
7835               (use (const_int 0))])]
7836   "")
7838 (define_split
7839   [(parallel [(set (match_operand 0 "" "")
7840               (call (mem:SI (match_operand 1 "call_operand_address" ""))
7841                     (match_operand 2 "" "")))
7842               (clobber (reg:SI 1))
7843               (clobber (reg:SI 2))
7844               (clobber (match_operand 3))
7845               (use (reg:SI 19))
7846               (use (const_int 0))])]
7847   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7848   [(set (match_dup 3) (reg:SI 19))
7849    (parallel [(set (match_dup 0)
7850               (call (mem:SI (match_dup 1))
7851                     (match_dup 2)))
7852               (clobber (reg:SI 1))
7853               (clobber (reg:SI 2))
7854               (use (reg:SI 19))
7855               (use (const_int 0))])
7856    (set (reg:SI 19) (match_dup 3))]
7857   "")
7859 (define_insn "*call_val_symref_pic_post_reload"
7860   [(set (match_operand 0 "" "")
7861         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7862               (match_operand 2 "" "i")))
7863    (clobber (reg:SI 1))
7864    (clobber (reg:SI 2))
7865    (use (reg:SI 19))
7866    (use (const_int 0))]
7867   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7868   "*
7870   pa_output_arg_descriptor (insn);
7871   return pa_output_call (insn, operands[1], 0);
7873   [(set_attr "type" "call")
7874    (set (attr "length")
7875         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7876               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7878 ;; powf function clobbers %fr12
7879 (define_insn "call_val_powf_pic"
7880   [(set (match_operand 0 "" "")
7881         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7882               (match_operand 2 "" "i")))
7883    (clobber (reg:SI 1))
7884    (clobber (reg:SI 2))
7885    (clobber (reg:DF 48))
7886    (clobber (match_operand 3))
7887    (use (reg:SI 19))
7888    (use (const_int 1))]
7889   "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7890   "#")
7892 ;; Split out the PIC register save and restore after reload.  As the
7893 ;; split is done after reload, there are some situations in which we
7894 ;; unnecessarily save and restore %r4.  This happens when there is a
7895 ;; single call and the PIC register is not used after the call.
7897 ;; The split has to be done since call_from_call_insn () can't handle
7898 ;; the pattern as is.  Noreturn calls are special because they have to
7899 ;; terminate the basic block.  The split has to contain more than one
7900 ;; insn.
7901 (define_split
7902   [(parallel [(set (match_operand 0 "" "")
7903               (call (mem:SI (match_operand 1 "call_operand_address" ""))
7904                     (match_operand 2 "" "")))
7905               (clobber (reg:SI 1))
7906               (clobber (reg:SI 2))
7907               (clobber (reg:DF 48))
7908               (clobber (match_operand 3))
7909               (use (reg:SI 19))
7910               (use (const_int 1))])]
7911   "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7912    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7913   [(set (match_dup 3) (reg:SI 19))
7914    (parallel [(set (match_dup 0)
7915               (call (mem:SI (match_dup 1))
7916                     (match_dup 2)))
7917               (clobber (reg:SI 1))
7918               (clobber (reg:SI 2))
7919               (clobber (reg:DF 48))
7920               (use (reg:SI 19))
7921               (use (const_int 1))])]
7922   "")
7924 (define_split
7925   [(parallel [(set (match_operand 0 "" "")
7926               (call (mem:SI (match_operand 1 "call_operand_address" ""))
7927                     (match_operand 2 "" "")))
7928               (clobber (reg:SI 1))
7929               (clobber (reg:SI 2))
7930               (clobber (reg:DF 48))
7931               (clobber (match_operand 3))
7932               (use (reg:SI 19))
7933               (use (const_int 1))])]
7934   "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7935   [(set (match_dup 3) (reg:SI 19))
7936    (parallel [(set (match_dup 0)
7937               (call (mem:SI (match_dup 1))
7938                     (match_dup 2)))
7939               (clobber (reg:SI 1))
7940               (clobber (reg:SI 2))
7941               (clobber (reg:DF 48))
7942               (use (reg:SI 19))
7943               (use (const_int 1))])
7944    (set (reg:SI 19) (match_dup 3))]
7945   "")
7947 (define_insn "*call_val_powf_pic_post_reload"
7948   [(set (match_operand 0 "" "")
7949         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7950               (match_operand 2 "" "i")))
7951    (clobber (reg:SI 1))
7952    (clobber (reg:SI 2))
7953    (clobber (reg:DF 48))
7954    (use (reg:SI 19))
7955    (use (const_int 1))]
7956   "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7957   "*
7959   pa_output_arg_descriptor (insn);
7960   return pa_output_call (insn, operands[1], 0);
7962   [(set_attr "type" "call")
7963    (set (attr "length")
7964         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7965               (symbol_ref "pa_attr_length_call (insn, 0)")))])
7967 ;; This pattern is split if it is necessary to save and restore the
7968 ;; PIC register.
7969 (define_insn "call_val_symref_64bit"
7970   [(set (match_operand 0 "" "")
7971         (call (mem:SI (match_operand 1 "call_operand_address" ""))
7972               (match_operand 2 "" "i")))
7973    (clobber (reg:DI 1))
7974    (clobber (reg:DI 2))
7975    (clobber (match_operand 3))
7976    (use (reg:DI 27))
7977    (use (reg:DI 29))
7978    (use (const_int 0))]
7979   "TARGET_64BIT"
7980   "#")
7982 ;; Split out the PIC register save and restore after reload.  As the
7983 ;; split is done after reload, there are some situations in which we
7984 ;; unnecessarily save and restore %r4.  This happens when there is a
7985 ;; single call and the PIC register is not used after the call.
7987 ;; The split has to be done since call_from_call_insn () can't handle
7988 ;; the pattern as is.  Noreturn calls are special because they have to
7989 ;; terminate the basic block.  The split has to contain more than one
7990 ;; insn.
7991 (define_split
7992   [(parallel [(set (match_operand 0 "" "")
7993               (call (mem:SI (match_operand 1 "call_operand_address" ""))
7994                     (match_operand 2 "" "")))
7995               (clobber (reg:DI 1))
7996               (clobber (reg:DI 2))
7997               (clobber (match_operand 3))
7998               (use (reg:DI 27))
7999               (use (reg:DI 29))
8000               (use (const_int 0))])]
8001   "TARGET_64BIT && reload_completed
8002    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8003   [(set (match_dup 3) (reg:DI 27))
8004    (parallel [(set (match_dup 0)
8005               (call (mem:SI (match_dup 1))
8006                     (match_dup 2)))
8007               (clobber (reg:DI 1))
8008               (clobber (reg:DI 2))
8009               (use (reg:DI 27))
8010               (use (reg:DI 29))
8011               (use (const_int 0))])]
8012   "")
8014 (define_split
8015   [(parallel [(set (match_operand 0 "" "")
8016               (call (mem:SI (match_operand 1 "call_operand_address" ""))
8017                     (match_operand 2 "" "")))
8018               (clobber (reg:DI 1))
8019               (clobber (reg:DI 2))
8020               (clobber (match_operand 3))
8021               (use (reg:DI 27))
8022               (use (reg:DI 29))
8023               (use (const_int 0))])]
8024   "TARGET_64BIT && reload_completed"
8025   [(set (match_dup 3) (reg:DI 27))
8026    (parallel [(set (match_dup 0)
8027               (call (mem:SI (match_dup 1))
8028                     (match_dup 2)))
8029               (clobber (reg:DI 1))
8030               (clobber (reg:DI 2))
8031               (use (reg:DI 27))
8032               (use (reg:DI 29))
8033               (use (const_int 0))])
8034    (set (reg:DI 27) (match_dup 3))]
8035   "")
8037 (define_insn "*call_val_symref_64bit_post_reload"
8038   [(set (match_operand 0 "" "")
8039         (call (mem:SI (match_operand 1 "call_operand_address" ""))
8040               (match_operand 2 "" "i")))
8041    (clobber (reg:DI 1))
8042    (clobber (reg:DI 2))
8043    (use (reg:DI 27))
8044    (use (reg:DI 29))
8045    (use (const_int 0))]
8046   "TARGET_64BIT"
8047   "*
8049   pa_output_arg_descriptor (insn);
8050   return pa_output_call (insn, operands[1], 0);
8052   [(set_attr "type" "call")
8053    (set (attr "length")
8054         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8055               (symbol_ref "pa_attr_length_call (insn, 0)")))])
8057 ;; powf function clobbers %fr12
8058 (define_insn "call_val_powf_64bit"
8059   [(set (match_operand 0 "" "")
8060         (call (mem:SI (match_operand 1 "call_operand_address" ""))
8061               (match_operand 2 "" "i")))
8062    (clobber (reg:DI 1))
8063    (clobber (reg:DI 2))
8064    (clobber (reg:DF 40))
8065    (clobber (match_operand 3))
8066    (use (reg:DI 27))
8067    (use (reg:DI 29))
8068    (use (const_int 1))]
8069   "TARGET_64BIT && TARGET_HPUX"
8070   "#")
8072 ;; Split out the PIC register save and restore after reload.  As the
8073 ;; split is done after reload, there are some situations in which we
8074 ;; unnecessarily save and restore %r4.  This happens when there is a
8075 ;; single call and the PIC register is not used after the call.
8077 ;; The split has to be done since call_from_call_insn () can't handle
8078 ;; the pattern as is.  Noreturn calls are special because they have to
8079 ;; terminate the basic block.  The split has to contain more than one
8080 ;; insn.
8081 (define_split
8082   [(parallel [(set (match_operand 0 "" "")
8083               (call (mem:SI (match_operand 1 "call_operand_address" ""))
8084                     (match_operand 2 "" "")))
8085               (clobber (reg:DI 1))
8086               (clobber (reg:DI 2))
8087               (clobber (reg:DF 40))
8088               (clobber (match_operand 3))
8089               (use (reg:DI 27))
8090               (use (reg:DI 29))
8091               (use (const_int 1))])]
8092   "TARGET_64BIT && TARGET_HPUX && reload_completed
8093    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8094   [(set (match_dup 3) (reg:DI 27))
8095    (parallel [(set (match_dup 0)
8096               (call (mem:SI (match_dup 1))
8097                     (match_dup 2)))
8098               (clobber (reg:DI 1))
8099               (clobber (reg:DI 2))
8100               (clobber (reg:DF 40))
8101               (use (reg:DI 27))
8102               (use (reg:DI 29))
8103               (use (const_int 1))])]
8104   "")
8106 (define_split
8107   [(parallel [(set (match_operand 0 "" "")
8108               (call (mem:SI (match_operand 1 "call_operand_address" ""))
8109                     (match_operand 2 "" "")))
8110               (clobber (reg:DI 1))
8111               (clobber (reg:DI 2))
8112               (clobber (reg:DF 40))
8113               (clobber (match_operand 3))
8114               (use (reg:DI 27))
8115               (use (reg:DI 29))
8116               (use (const_int 1))])]
8117   "TARGET_64BIT && TARGET_HPUX && reload_completed"
8118   [(set (match_dup 3) (reg:DI 27))
8119    (parallel [(set (match_dup 0)
8120               (call (mem:SI (match_dup 1))
8121                     (match_dup 2)))
8122               (clobber (reg:DI 1))
8123               (clobber (reg:DI 2))
8124               (clobber (reg:DF 40))
8125               (use (reg:DI 27))
8126               (use (reg:DI 29))
8127               (use (const_int 1))])
8128    (set (reg:DI 27) (match_dup 3))]
8129   "")
8131 (define_insn "*call_val_powf_64bit_post_reload"
8132   [(set (match_operand 0 "" "")
8133         (call (mem:SI (match_operand 1 "call_operand_address" ""))
8134               (match_operand 2 "" "i")))
8135    (clobber (reg:DI 1))
8136    (clobber (reg:DI 2))
8137    (clobber (reg:DF 40))
8138    (use (reg:DI 27))
8139    (use (reg:DI 29))
8140    (use (const_int 1))]
8141   "TARGET_64BIT && TARGET_HPUX"
8142   "*
8144   pa_output_arg_descriptor (insn);
8145   return pa_output_call (insn, operands[1], 0);
8147   [(set_attr "type" "call")
8148    (set (attr "length")
8149         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8150               (symbol_ref "pa_attr_length_call (insn, 0)")))])
8152 (define_insn "call_val_reg"
8153   [(set (match_operand 0 "" "")
8154         (call (mem:SI (reg:SI 22))
8155               (match_operand 1 "" "i")))
8156    (clobber (reg:SI 1))
8157    (clobber (reg:SI 2))
8158    (use (const_int 1))]
8159   "!TARGET_64BIT"
8160   "*
8162   return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8164   [(set_attr "type" "dyncall")
8165    (set (attr "length")
8166         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8167               (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8169 ;; This pattern is split if it is necessary to save and restore the
8170 ;; PIC register.
8171 (define_insn "call_val_reg_pic"
8172   [(set (match_operand 0 "" "")
8173         (call (mem:SI (reg:SI 22))
8174               (match_operand 1 "" "i")))
8175    (clobber (reg:SI 1))
8176    (clobber (reg:SI 2))
8177    (clobber (match_operand 2))
8178    (use (reg:SI 19))
8179    (use (const_int 1))]
8180   "!TARGET_64BIT"
8181   "#")
8183 ;; Split out the PIC register save and restore after reload.  As the
8184 ;; split is done after reload, there are some situations in which we
8185 ;; unnecessarily save and restore %r4.  This happens when there is a
8186 ;; single call and the PIC register is not used after the call.
8188 ;; The split has to be done since call_from_call_insn () can't handle
8189 ;; the pattern as is.  Noreturn calls are special because they have to
8190 ;; terminate the basic block.  The split has to contain more than one
8191 ;; insn.
8192 (define_split
8193   [(parallel [(set (match_operand 0 "" "")
8194                    (call (mem:SI (reg:SI 22))
8195                          (match_operand 1 "" "")))
8196               (clobber (reg:SI 1))
8197               (clobber (reg:SI 2))
8198               (clobber (match_operand 2))
8199               (use (reg:SI 19))
8200               (use (const_int 1))])]
8201   "!TARGET_64BIT && reload_completed
8202    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8203   [(set (match_dup 2) (reg:SI 19))
8204    (parallel [(set (match_dup 0)
8205                    (call (mem:SI (reg:SI 22))
8206                          (match_dup 1)))
8207               (clobber (reg:SI 1))
8208               (clobber (reg:SI 2))
8209               (use (reg:SI 19))
8210               (use (const_int 1))])]
8211   "")
8213 (define_split
8214   [(parallel [(set (match_operand 0 "" "")
8215                    (call (mem:SI (reg:SI 22))
8216                          (match_operand 1 "" "")))
8217               (clobber (reg:SI 1))
8218               (clobber (reg:SI 2))
8219               (clobber (match_operand 2))
8220               (use (reg:SI 19))
8221               (use (const_int 1))])]
8222   "!TARGET_64BIT && reload_completed"
8223   [(set (match_dup 2) (reg:SI 19))
8224    (parallel [(set (match_dup 0)
8225                    (call (mem:SI (reg:SI 22))
8226                          (match_dup 1)))
8227               (clobber (reg:SI 1))
8228               (clobber (reg:SI 2))
8229               (use (reg:SI 19))
8230               (use (const_int 1))])
8231    (set (reg:SI 19) (match_dup 2))]
8232   "")
8234 (define_insn "*call_val_reg_pic_post_reload"
8235   [(set (match_operand 0 "" "")
8236         (call (mem:SI (reg:SI 22))
8237               (match_operand 1 "" "i")))
8238    (clobber (reg:SI 1))
8239    (clobber (reg:SI 2))
8240    (use (reg:SI 19))
8241    (use (const_int 1))]
8242   "!TARGET_64BIT"
8243   "*
8245   return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8247   [(set_attr "type" "dyncall")
8248    (set (attr "length")
8249         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8250               (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8252 ;; This pattern is split if it is necessary to save and restore the
8253 ;; PIC register.
8254 (define_insn "call_val_reg_64bit"
8255   [(set (match_operand 0 "" "")
8256         (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8257               (match_operand 2 "" "i")))
8258    (clobber (reg:DI 1))
8259    (clobber (reg:DI 2))
8260    (clobber (match_operand 3))
8261    (use (reg:DI 27))
8262    (use (reg:DI 29))
8263    (use (const_int 1))]
8264   "TARGET_64BIT"
8265   "#")
8267 ;; Split out the PIC register save and restore after reload.  As the
8268 ;; split is done after reload, there are some situations in which we
8269 ;; unnecessarily save and restore %r4.  This happens when there is a
8270 ;; single call and the PIC register is not used after the call.
8272 ;; The split has to be done since call_from_call_insn () can't handle
8273 ;; the pattern as is.  Noreturn calls are special because they have to
8274 ;; terminate the basic block.  The split has to contain more than one
8275 ;; insn.
8276 (define_split
8277   [(parallel [(set (match_operand 0 "" "")
8278                    (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8279                          (match_operand 2 "" "")))
8280               (clobber (reg:DI 1))
8281               (clobber (reg:DI 2))
8282               (clobber (match_operand 3))
8283               (use (reg:DI 27))
8284               (use (reg:DI 29))
8285               (use (const_int 1))])]
8286   "TARGET_64BIT && reload_completed
8287    && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8288   [(set (match_dup 3) (reg:DI 27))
8289    (parallel [(set (match_dup 0)
8290                    (call (mem:SI (match_dup 1))
8291                          (match_dup 2)))
8292               (clobber (reg:DI 1))
8293               (clobber (reg:DI 2))
8294               (use (reg:DI 27))
8295               (use (reg:DI 29))
8296               (use (const_int 1))])]
8297   "")
8299 (define_split
8300   [(parallel [(set (match_operand 0 "" "")
8301                    (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8302                          (match_operand 2 "" "")))
8303               (clobber (reg:DI 1))
8304               (clobber (reg:DI 2))
8305               (clobber (match_operand 3))
8306               (use (reg:DI 27))
8307               (use (reg:DI 29))
8308               (use (const_int 1))])]
8309   "TARGET_64BIT && reload_completed"
8310   [(set (match_dup 3) (reg:DI 27))
8311    (parallel [(set (match_dup 0)
8312                    (call (mem:SI (match_dup 1))
8313                          (match_dup 2)))
8314               (clobber (reg:DI 1))
8315               (clobber (reg:DI 2))
8316               (use (reg:DI 27))
8317               (use (reg:DI 29))
8318               (use (const_int 1))])
8319    (set (reg:DI 27) (match_dup 3))]
8320   "")
8322 (define_insn "*call_val_reg_64bit_post_reload"
8323   [(set (match_operand 0 "" "")
8324         (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8325               (match_operand 2 "" "i")))
8326    (clobber (reg:DI 1))
8327    (clobber (reg:DI 2))
8328    (use (reg:DI 27))
8329    (use (reg:DI 29))
8330    (use (const_int 1))]
8331   "TARGET_64BIT"
8332   "*
8334   return pa_output_indirect_call (insn, operands[1]);
8336   [(set_attr "type" "dyncall")
8337    (set (attr "length")
8338         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 12)]
8339               (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8341 ;; Call subroutine returning any type.
8343 (define_expand "untyped_call"
8344   [(parallel [(call (match_operand 0 "" "")
8345                     (const_int 0))
8346               (match_operand 1 "" "")
8347               (match_operand 2 "" "")])]
8348   ""
8349   "
8351   int i;
8353   emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
8355   for (i = 0; i < XVECLEN (operands[2], 0); i++)
8356     {
8357       rtx set = XVECEXP (operands[2], 0, i);
8358       emit_move_insn (SET_DEST (set), SET_SRC (set));
8359     }
8361   /* The optimizer does not know that the call sets the function value
8362      registers we stored in the result block.  We avoid problems by
8363      claiming that all hard registers are used and clobbered at this
8364      point.  */
8365   emit_insn (gen_blockage ());
8367   DONE;
8370 (define_expand "sibcall"
8371   [(call (match_operand:SI 0 "" "")
8372          (match_operand 1 "" ""))]
8373   "!TARGET_PORTABLE_RUNTIME"
8374   "
8376   rtx op, call_insn;
8377   rtx nb = operands[1];
8379   op = XEXP (operands[0], 0);
8381   if (TARGET_64BIT)
8382     {
8383       if (!virtuals_instantiated)
8384         emit_move_insn (arg_pointer_rtx,
8385                         gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8386                                       GEN_INT (64)));
8387       else
8388         {
8389           /* The loop pass can generate new libcalls after the virtual
8390              registers are instantiated when fpregs are disabled because
8391              the only method that we have for doing DImode multiplication
8392              is with a libcall.  This could be trouble if we haven't
8393              allocated enough space for the outgoing arguments.  */
8394           gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
8396           emit_move_insn (arg_pointer_rtx,
8397                           gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8398                                         GEN_INT (STACK_POINTER_OFFSET + 64)));
8399         }
8400     }
8402   /* Indirect sibling calls are not allowed.  */
8403   if (TARGET_64BIT)
8404     call_insn = gen_sibcall_internal_symref_64bit (op, operands[1]);
8405   else
8406     call_insn = gen_sibcall_internal_symref (op, operands[1]);
8408   call_insn = emit_call_insn (call_insn);
8410   if (TARGET_64BIT)
8411     use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8413   /* We don't have to restore the PIC register.  */
8414   if (flag_pic)
8415     use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8417   DONE;
8420 (define_insn "sibcall_internal_symref"
8421   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8422          (match_operand 1 "" "i"))
8423    (clobber (reg:SI 1))
8424    (use (reg:SI 2))
8425    (use (const_int 0))]
8426   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8427   "*
8429   pa_output_arg_descriptor (insn);
8430   return pa_output_call (insn, operands[0], 1);
8432   [(set_attr "type" "sibcall")
8433    (set (attr "length")
8434         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8435               (symbol_ref "pa_attr_length_call (insn, 1)")))])
8437 (define_insn "sibcall_internal_symref_64bit"
8438   [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8439          (match_operand 1 "" "i"))
8440    (clobber (reg:DI 1))
8441    (use (reg:DI 2))
8442    (use (const_int 0))]
8443   "TARGET_64BIT"
8444   "*
8446   pa_output_arg_descriptor (insn);
8447   return pa_output_call (insn, operands[0], 1);
8449   [(set_attr "type" "sibcall")
8450    (set (attr "length")
8451         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8452               (symbol_ref "pa_attr_length_call (insn, 1)")))])
8454 (define_expand "sibcall_value"
8455   [(set (match_operand 0 "" "")
8456                    (call (match_operand:SI 1 "" "")
8457                          (match_operand 2 "" "")))]
8458   "!TARGET_PORTABLE_RUNTIME"
8459   "
8461   rtx op, call_insn;
8462   rtx nb = operands[1];
8464   op = XEXP (operands[1], 0);
8466   if (TARGET_64BIT)
8467     {
8468       if (!virtuals_instantiated)
8469         emit_move_insn (arg_pointer_rtx,
8470                         gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8471                                       GEN_INT (64)));
8472       else
8473         {
8474           /* The loop pass can generate new libcalls after the virtual
8475              registers are instantiated when fpregs are disabled because
8476              the only method that we have for doing DImode multiplication
8477              is with a libcall.  This could be trouble if we haven't
8478              allocated enough space for the outgoing arguments.  */
8479           gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
8481           emit_move_insn (arg_pointer_rtx,
8482                           gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8483                                         GEN_INT (STACK_POINTER_OFFSET + 64)));
8484         }
8485     }
8487   /* Indirect sibling calls are not allowed.  */
8488   if (TARGET_64BIT)
8489     call_insn
8490       = gen_sibcall_value_internal_symref_64bit (operands[0], op, operands[2]);
8491   else
8492     call_insn
8493       = gen_sibcall_value_internal_symref (operands[0], op, operands[2]);
8495   call_insn = emit_call_insn (call_insn);
8497   if (TARGET_64BIT)
8498     use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8500   /* We don't have to restore the PIC register.  */
8501   if (flag_pic)
8502     use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8504   DONE;
8507 (define_insn "sibcall_value_internal_symref"
8508   [(set (match_operand 0 "" "")
8509         (call (mem:SI (match_operand 1 "call_operand_address" ""))
8510               (match_operand 2 "" "i")))
8511    (clobber (reg:SI 1))
8512    (use (reg:SI 2))
8513    (use (const_int 0))]
8514   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8515   "*
8517   pa_output_arg_descriptor (insn);
8518   return pa_output_call (insn, operands[1], 1);
8520   [(set_attr "type" "sibcall")
8521    (set (attr "length")
8522         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8523               (symbol_ref "pa_attr_length_call (insn, 1)")))])
8525 (define_insn "sibcall_value_internal_symref_64bit"
8526   [(set (match_operand 0 "" "")
8527         (call (mem:SI (match_operand 1 "call_operand_address" ""))
8528               (match_operand 2 "" "i")))
8529    (clobber (reg:DI 1))
8530    (use (reg:DI 2))
8531    (use (const_int 0))]
8532   "TARGET_64BIT"
8533   "*
8535   pa_output_arg_descriptor (insn);
8536   return pa_output_call (insn, operands[1], 1);
8538   [(set_attr "type" "sibcall")
8539    (set (attr "length")
8540         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8541               (symbol_ref "pa_attr_length_call (insn, 1)")))])
8543 (define_insn "nop"
8544   [(const_int 0)]
8545   ""
8546   "nop"
8547   [(set_attr "type" "move")
8548    (set_attr "length" "4")])
8550 ;;; EH does longjmp's from and within the data section.  Thus,
8551 ;;; an interspace branch is required for the longjmp implementation.
8552 ;;; Registers r1 and r2 are used as scratch registers for the jump
8553 ;;; when necessary.
8554 (define_expand "interspace_jump"
8555   [(parallel
8556      [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8557       (clobber (match_dup 1))])]
8558   ""
8559   "
8561   operands[1] = gen_rtx_REG (word_mode, 2);
8564 (define_insn ""
8565   [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8566   (clobber (reg:SI 2))]
8567   "TARGET_PA_20 && !TARGET_64BIT"
8568   "bve%* (%0)"
8569    [(set_attr "type" "branch")
8570     (set_attr "length" "4")])
8572 (define_insn ""
8573   [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8574   (clobber (reg:SI 2))]
8575   "TARGET_NO_SPACE_REGS && !TARGET_64BIT"
8576   "be%* 0(%%sr4,%0)"
8577    [(set_attr "type" "branch")
8578     (set_attr "length" "4")])
8580 (define_insn ""
8581   [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8582   (clobber (reg:SI 2))]
8583   "!TARGET_64BIT"
8584   "ldsid (%%sr0,%0),%%r2\;mtsp %%r2,%%sr0\;be%* 0(%%sr0,%0)"
8585    [(set_attr "type" "branch")
8586     (set_attr "length" "12")])
8588 (define_insn ""
8589   [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8590   (clobber (reg:DI 2))]
8591   "TARGET_64BIT"
8592   "bve%* (%0)"
8593    [(set_attr "type" "branch")
8594     (set_attr "length" "4")])
8596 (define_expand "builtin_longjmp"
8597   [(unspec_volatile [(match_operand 0 "register_operand" "r")] UNSPECV_LONGJMP)]
8598   ""
8599   "
8601   /* The elements of the buffer are, in order:  */
8602   rtx fp = gen_rtx_MEM (Pmode, operands[0]);
8603   rtx lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
8604                          POINTER_SIZE / BITS_PER_UNIT));
8605   rtx stack = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
8606                            (POINTER_SIZE * 2) / BITS_PER_UNIT));
8607   rtx pv = gen_rtx_REG (Pmode, 1);
8609   emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
8610   emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
8612   /* Restore the frame pointer.  The virtual_stack_vars_rtx is saved
8613      instead of the hard_frame_pointer_rtx in the save area.  We need
8614      to adjust for the offset between these two values.  */
8615   if (GET_CODE (fp) != REG)
8616     fp = force_reg (Pmode, fp);
8617   emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
8619   /* This bit is the same as expand_builtin_longjmp.  */
8620   emit_stack_restore (SAVE_NONLOCAL, stack);
8621   emit_use (hard_frame_pointer_rtx);
8622   emit_use (stack_pointer_rtx);
8624   /* Load the label we are jumping through into r1 so that we know
8625      where to look for it when we get back to setjmp's function for
8626      restoring the gp.  */
8627   emit_move_insn (pv, lab);
8629   /* Prevent the insns above from being scheduled into the delay slot
8630      of the interspace jump because the space register could change.  */
8631   emit_insn (gen_blockage ());
8633   emit_jump_insn (gen_interspace_jump (pv));
8634   emit_barrier ();
8635   DONE;
8638 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8639 (define_expand "extzvsi"
8640   [(set (match_operand:SI 0 "register_operand" "")
8641         (zero_extract:SI (match_operand:SI 1 "register_operand" "")
8642                          (match_operand:SI 2 "uint5_operand" "")
8643                          (match_operand:SI 3 "uint5_operand" "")))]
8644   ""
8645   "
8647   unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8648   unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8650   /* PA extraction insns don't support zero length bitfields or fields
8651      extending beyond the left or right-most bits.  Also, the predicate
8652      rejects lengths equal to a word as they are better handled by
8653      the move patterns.  */
8654   if (len == 0 || pos + len > 32)
8655     FAIL;
8657   /* From mips.md: extract_bit_field doesn't verify that our source
8658      matches the predicate, so check it again here.  */
8659   if (!register_operand (operands[1], VOIDmode))
8660     FAIL;
8662   emit_insn (gen_extzv_32 (operands[0], operands[1],
8663                            operands[2], operands[3]));
8664   DONE;
8667 (define_insn "extzv_32"
8668   [(set (match_operand:SI 0 "register_operand" "=r")
8669         (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8670                          (match_operand:SI 2 "uint5_operand" "")
8671                          (match_operand:SI 3 "uint5_operand" "")))]
8672   "UINTVAL (operands[2]) > 0
8673    && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 32"
8674   "{extru|extrw,u} %1,%3+%2-1,%2,%0"
8675   [(set_attr "type" "shift")
8676    (set_attr "length" "4")])
8678 (define_insn ""
8679   [(set (match_operand:SI 0 "register_operand" "=r")
8680         (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8681                          (const_int 1)
8682                          (match_operand:SI 2 "register_operand" "q")))]
8683   ""
8684   "{vextru %1,1,%0|extrw,u %1,%%sar,1,%0}"
8685   [(set_attr "type" "shift")
8686    (set_attr "length" "4")])
8688 (define_expand "extzvdi"
8689   [(set (match_operand:DI 0 "register_operand" "")
8690         (zero_extract:DI (match_operand:DI 1 "register_operand" "")
8691                          (match_operand:DI 2 "uint6_operand" "")
8692                          (match_operand:DI 3 "uint6_operand" "")))]
8693   "TARGET_64BIT"
8694   "
8696   unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8697   unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8699   /* PA extraction insns don't support zero length bitfields or fields
8700      extending beyond the left or right-most bits.  Also, the predicate
8701      rejects lengths equal to a doubleword as they are better handled by
8702      the move patterns.  */
8703   if (len == 0 || pos + len > 64)
8704     FAIL;
8706   /* From mips.md: extract_bit_field doesn't verify that our source
8707      matches the predicate, so check it again here.  */
8708   if (!register_operand (operands[1], VOIDmode))
8709     FAIL;
8711   emit_insn (gen_extzv_64 (operands[0], operands[1],
8712                            operands[2], operands[3]));
8713   DONE;
8716 (define_insn "extzv_64"
8717   [(set (match_operand:DI 0 "register_operand" "=r")
8718         (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8719                          (match_operand:DI 2 "uint6_operand" "")
8720                          (match_operand:DI 3 "uint6_operand" "")))]
8721   "TARGET_64BIT
8722    && UINTVAL (operands[2]) > 0
8723    && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 64"
8724   "extrd,u %1,%3+%2-1,%2,%0"
8725   [(set_attr "type" "shift")
8726    (set_attr "length" "4")])
8728 (define_insn ""
8729   [(set (match_operand:DI 0 "register_operand" "=r")
8730         (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8731                          (const_int 1)
8732                          (match_operand:DI 2 "register_operand" "q")))]
8733   "TARGET_64BIT"
8734   "extrd,u %1,%%sar,1,%0"
8735   [(set_attr "type" "shift")
8736    (set_attr "length" "4")])
8738 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8739 (define_expand "extvsi"
8740   [(set (match_operand:SI 0 "register_operand" "")
8741         (sign_extract:SI (match_operand:SI 1 "register_operand" "")
8742                          (match_operand:SI 2 "uint5_operand" "")
8743                          (match_operand:SI 3 "uint5_operand" "")))]
8744   ""
8745   "
8747   unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8748   unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8750   /* PA extraction insns don't support zero length bitfields or fields
8751      extending beyond the left or right-most bits.  Also, the predicate
8752      rejects lengths equal to a word as they are better handled by
8753      the move patterns.  */
8754   if (len == 0 || pos + len > 32)
8755     FAIL;
8757   /* From mips.md: extract_bit_field doesn't verify that our source
8758      matches the predicate, so check it again here.  */
8759   if (!register_operand (operands[1], VOIDmode))
8760     FAIL;
8762   emit_insn (gen_extv_32 (operands[0], operands[1],
8763                           operands[2], operands[3]));
8764   DONE;
8767 (define_insn "extv_32"
8768   [(set (match_operand:SI 0 "register_operand" "=r")
8769         (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8770                          (match_operand:SI 2 "uint5_operand" "")
8771                          (match_operand:SI 3 "uint5_operand" "")))]
8772   "UINTVAL (operands[2]) > 0
8773    && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 32"
8774   "{extrs|extrw,s} %1,%3+%2-1,%2,%0"
8775   [(set_attr "type" "shift")
8776    (set_attr "length" "4")])
8778 (define_insn ""
8779   [(set (match_operand:SI 0 "register_operand" "=r")
8780         (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8781                          (const_int 1)
8782                          (match_operand:SI 2 "register_operand" "q")))]
8783   "!TARGET_64BIT"
8784   "{vextrs %1,1,%0|extrw,s %1,%%sar,1,%0}"
8785   [(set_attr "type" "shift")
8786    (set_attr "length" "4")])
8788 (define_expand "extvdi"
8789   [(set (match_operand:DI 0 "register_operand" "")
8790         (sign_extract:DI (match_operand:DI 1 "register_operand" "")
8791                          (match_operand:DI 2 "uint6_operand" "")
8792                          (match_operand:DI 3 "uint6_operand" "")))]
8793   "TARGET_64BIT"
8794   "
8796   unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8797   unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8799   /* PA extraction insns don't support zero length bitfields or fields
8800      extending beyond the left or right-most bits.  Also, the predicate
8801      rejects lengths equal to a doubleword as they are better handled by
8802      the move patterns.  */
8803   if (len == 0 || pos + len > 64)
8804     FAIL;
8806   /* From mips.md: extract_bit_field doesn't verify that our source
8807      matches the predicate, so check it again here.  */
8808   if (!register_operand (operands[1], VOIDmode))
8809     FAIL;
8811   emit_insn (gen_extv_64 (operands[0], operands[1],
8812                           operands[2], operands[3]));
8813   DONE;
8816 (define_insn "extv_64"
8817   [(set (match_operand:DI 0 "register_operand" "=r")
8818         (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8819                          (match_operand:DI 2 "uint6_operand" "")
8820                          (match_operand:DI 3 "uint6_operand" "")))]
8821   "TARGET_64BIT
8822    && UINTVAL (operands[2]) > 0
8823    && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 64"
8824   "extrd,s %1,%3+%2-1,%2,%0"
8825   [(set_attr "type" "shift")
8826    (set_attr "length" "4")])
8828 (define_insn ""
8829   [(set (match_operand:DI 0 "register_operand" "=r")
8830         (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8831                          (const_int 1)
8832                          (match_operand:DI 2 "register_operand" "q")))]
8833   "TARGET_64BIT"
8834   "extrd,s %1,%%sar,1,%0"
8835   [(set_attr "type" "shift")
8836    (set_attr "length" "4")])
8838 ;;; Operands 1 and 2 are assumed to be CONST_INTs.
8839 (define_expand "insvsi"
8840   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
8841                          (match_operand:SI 1 "uint5_operand" "")
8842                          (match_operand:SI 2 "uint5_operand" ""))
8843         (match_operand:SI 3 "arith5_operand" ""))]
8844   ""
8845   "
8847   unsigned HOST_WIDE_INT len = UINTVAL (operands[1]);
8848   unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]);
8850   /* PA insertion insns don't support zero length bitfields or fields
8851      extending beyond the left or right-most bits.  Also, the predicate
8852      rejects lengths equal to a word as they are better handled by
8853      the move patterns.  */
8854   if (len <= 0 || pos + len > 32)
8855     FAIL;
8857   /* From mips.md: insert_bit_field doesn't verify that our destination
8858      matches the predicate, so check it again here.  */
8859   if (!register_operand (operands[0], VOIDmode))
8860     FAIL;
8862   emit_insn (gen_insv_32 (operands[0], operands[1],
8863                           operands[2], operands[3]));
8864   DONE;
8867 (define_insn "insv_32"
8868   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
8869                          (match_operand:SI 1 "uint5_operand" "")
8870                          (match_operand:SI 2 "uint5_operand" ""))
8871         (match_operand:SI 3 "arith5_operand" "r,L"))]
8872   "UINTVAL (operands[1]) > 0
8873    && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 32"
8874   "@
8875    {dep|depw} %3,%2+%1-1,%1,%0
8876    {depi|depwi} %3,%2+%1-1,%1,%0"
8877   [(set_attr "type" "shift,shift")
8878    (set_attr "length" "4,4")])
8880 ;; Optimize insertion of const_int values of type 1...1xxxx.
8881 (define_insn ""
8882   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
8883                          (match_operand:SI 1 "uint5_operand" "")
8884                          (match_operand:SI 2 "uint5_operand" ""))
8885         (match_operand:SI 3 "const_int_operand" ""))]
8886   "(INTVAL (operands[3]) & 0x10) != 0 &&
8887    (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8888   "*
8890   operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8891   return \"{depi|depwi} %3,%2+%1-1,%1,%0\";
8893   [(set_attr "type" "shift")
8894    (set_attr "length" "4")])
8896 (define_expand "insvdi"
8897   [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
8898                          (match_operand:DI 1 "uint6_operand" "")
8899                          (match_operand:DI 2 "uint6_operand" ""))
8900         (match_operand:DI 3 "arith5_operand" ""))]
8901   "TARGET_64BIT"
8902   "
8904   unsigned HOST_WIDE_INT len = UINTVAL (operands[1]);
8905   unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]);
8907   /* PA insertion insns don't support zero length bitfields or fields
8908      extending beyond the left or right-most bits.  Also, the predicate
8909      rejects lengths equal to a doubleword as they are better handled by
8910      the move patterns.  */
8911   if (len <= 0 || pos + len > 64)
8912     FAIL;
8914   /* From mips.md: insert_bit_field doesn't verify that our destination
8915      matches the predicate, so check it again here.  */
8916   if (!register_operand (operands[0], VOIDmode))
8917     FAIL;
8919   emit_insn (gen_insv_64 (operands[0], operands[1],
8920                           operands[2], operands[3]));
8921   DONE;
8924 (define_insn "insv_64"
8925   [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r,r")
8926                          (match_operand:DI 1 "uint6_operand" "")
8927                          (match_operand:DI 2 "uint6_operand" ""))
8928         (match_operand:DI 3 "arith5_operand" "r,L"))]
8929   "TARGET_64BIT
8930    && UINTVAL (operands[1]) > 0
8931    && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 64"
8932   "@
8933    depd %3,%2+%1-1,%1,%0
8934    depdi %3,%2+%1-1,%1,%0"
8935   [(set_attr "type" "shift,shift")
8936    (set_attr "length" "4,4")])
8938 ;; Optimize insertion of const_int values of type 1...1xxxx.
8939 (define_insn ""
8940   [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
8941                          (match_operand:DI 1 "uint6_operand" "")
8942                          (match_operand:DI 2 "uint6_operand" ""))
8943         (match_operand:DI 3 "const_int_operand" ""))]
8944   "(INTVAL (operands[3]) & 0x10) != 0
8945    && TARGET_64BIT
8946    && (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8947   "*
8949   operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8950   return \"depdi %3,%2+%1-1,%1,%0\";
8952   [(set_attr "type" "shift")
8953    (set_attr "length" "4")])
8955 (define_insn ""
8956   [(set (match_operand:DI 0 "register_operand" "=r")
8957         (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
8958                    (const_int 32)))]
8959   "TARGET_64BIT"
8960   "depd,z %1,31,32,%0"
8961   [(set_attr "type" "shift")
8962    (set_attr "length" "4")])
8964 ;; This insn is used for some loop tests, typically loops reversed when
8965 ;; strength reduction is used.  It is actually created when the instruction
8966 ;; combination phase combines the special loop test.  Since this insn
8967 ;; is both a jump insn and has an output, it must deal with its own
8968 ;; reloads, hence the `Q' constraints.  The `!' constraints direct reload
8969 ;; to not choose the register alternatives in the event a reload is needed.
8970 (define_insn "decrement_and_branch_until_zero"
8971   [(set (pc)
8972         (if_then_else
8973           (match_operator 2 "comparison_operator"
8974            [(plus:SI
8975               (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*Q")
8976               (match_operand:SI 1 "int5_operand" "L,L,L"))
8977             (const_int 0)])
8978           (label_ref (match_operand 3 "" ""))
8979           (pc)))
8980    (set (match_dup 0)
8981         (plus:SI (match_dup 0) (match_dup 1)))
8982    (clobber (match_scratch:SI 4 "=X,r,r"))]
8983   ""
8984   "* return pa_output_dbra (operands, insn, which_alternative); "
8985 ;; Do not expect to understand this the first time through.
8986 [(set_attr "type" "cbranch,multi,multi")
8987  (set (attr "length")
8988       (if_then_else (eq_attr "alternative" "0")
8989 ;; Loop counter in register case
8990 ;; Short branch has length of 4
8991 ;; Long branch has length of 8, 20, 24 or 28
8992         (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8993                (const_int MAX_12BIT_OFFSET))
8994            (const_int 4)
8995            (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8996                (const_int MAX_17BIT_OFFSET))
8997            (const_int 8)
8998            (match_test "TARGET_PORTABLE_RUNTIME")
8999            (const_int 24)
9000            (not (match_test "flag_pic"))
9001            (const_int 20)]
9002           (const_int 28))
9004 ;; Loop counter in FP reg case.
9005 ;; Extra goo to deal with additional reload insns.
9006         (if_then_else (eq_attr "alternative" "1")
9007           (if_then_else (lt (match_dup 3) (pc))
9008              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
9009                       (const_int MAX_12BIT_OFFSET))
9010                     (const_int 24)
9011                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
9012                       (const_int MAX_17BIT_OFFSET))
9013                     (const_int 28)
9014                     (match_test "TARGET_PORTABLE_RUNTIME")
9015                     (const_int 44)
9016                     (not (match_test "flag_pic"))
9017                     (const_int 40)]
9018                   (const_int 48))
9019              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9020                       (const_int MAX_12BIT_OFFSET))
9021                     (const_int 24)
9022                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9023                       (const_int MAX_17BIT_OFFSET))
9024                     (const_int 28)
9025                     (match_test "TARGET_PORTABLE_RUNTIME")
9026                     (const_int 44)
9027                     (not (match_test "flag_pic"))
9028                     (const_int 40)]
9029                   (const_int 48)))
9031 ;; Loop counter in memory case.
9032 ;; Extra goo to deal with additional reload insns.
9033         (if_then_else (lt (match_dup 3) (pc))
9034              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9035                       (const_int MAX_12BIT_OFFSET))
9036                     (const_int 12)
9037                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9038                       (const_int MAX_17BIT_OFFSET))
9039                     (const_int 16)
9040                     (match_test "TARGET_PORTABLE_RUNTIME")
9041                     (const_int 32)
9042                     (not (match_test "flag_pic"))
9043                     (const_int 28)]
9044                   (const_int 36))
9045              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9046                       (const_int MAX_12BIT_OFFSET))
9047                     (const_int 12)
9048                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9049                       (const_int MAX_17BIT_OFFSET))
9050                     (const_int 16)
9051                     (match_test "TARGET_PORTABLE_RUNTIME")
9052                     (const_int 32)
9053                     (not (match_test "flag_pic"))
9054                     (const_int 28)]
9055                   (const_int 36))))))])
9057 (define_insn ""
9058   [(set (pc)
9059         (if_then_else
9060           (match_operator 2 "movb_comparison_operator"
9061            [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
9062           (label_ref (match_operand 3 "" ""))
9063           (pc)))
9064    (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q")
9065         (match_dup 1))]
9066   ""
9067 "* return pa_output_movb (operands, insn, which_alternative, 0); "
9068 ;; Do not expect to understand this the first time through.
9069 [(set_attr "type" "cbranch,multi,multi,multi")
9070  (set (attr "length")
9071       (if_then_else (eq_attr "alternative" "0")
9072 ;; Loop counter in register case
9073 ;; Short branch has length of 4
9074 ;; Long branch has length of 8, 20, 24 or 28
9075         (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9076                (const_int MAX_12BIT_OFFSET))
9077            (const_int 4)
9078            (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9079                (const_int MAX_17BIT_OFFSET))
9080            (const_int 8)
9081            (match_test "TARGET_PORTABLE_RUNTIME")
9082            (const_int 24)
9083            (not (match_test "flag_pic"))
9084            (const_int 20)]
9085           (const_int 28))
9087 ;; Loop counter in FP reg case.
9088 ;; Extra goo to deal with additional reload insns.
9089         (if_then_else (eq_attr "alternative" "1")
9090           (if_then_else (lt (match_dup 3) (pc))
9091              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9092                       (const_int MAX_12BIT_OFFSET))
9093                     (const_int 12)
9094                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9095                       (const_int MAX_17BIT_OFFSET))
9096                     (const_int 16)
9097                     (match_test "TARGET_PORTABLE_RUNTIME")
9098                     (const_int 32)
9099                     (not (match_test "flag_pic"))
9100                     (const_int 28)]
9101                   (const_int 36))
9102              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9103                       (const_int MAX_12BIT_OFFSET))
9104                     (const_int 12)
9105                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9106                       (const_int MAX_17BIT_OFFSET))
9107                     (const_int 16)
9108                     (match_test "TARGET_PORTABLE_RUNTIME")
9109                     (const_int 32)
9110                     (not (match_test "flag_pic"))
9111                     (const_int 28)]
9112                   (const_int 36)))
9114 ;; Loop counter in memory or sar case.
9115 ;; Extra goo to deal with additional reload insns.
9116         (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9117                    (const_int MAX_12BIT_OFFSET))
9118                 (const_int 8)
9119                 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9120                   (const_int MAX_17BIT_OFFSET))
9121                 (const_int 12)
9122                 (match_test "TARGET_PORTABLE_RUNTIME")
9123                 (const_int 28)
9124                 (not (match_test "flag_pic"))
9125                 (const_int 24)]
9126               (const_int 32)))))])
9128 ;; Handle negated branch.
9129 (define_insn ""
9130   [(set (pc)
9131         (if_then_else
9132           (match_operator 2 "movb_comparison_operator"
9133            [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
9134           (pc)
9135           (label_ref (match_operand 3 "" ""))))
9136    (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q")
9137         (match_dup 1))]
9138   ""
9139 "* return pa_output_movb (operands, insn, which_alternative, 1); "
9140 ;; Do not expect to understand this the first time through.
9141 [(set_attr "type" "cbranch,multi,multi,multi")
9142  (set (attr "length")
9143       (if_then_else (eq_attr "alternative" "0")
9144 ;; Loop counter in register case
9145 ;; Short branch has length of 4
9146 ;; Long branch has length of 8
9147         (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9148                (const_int MAX_12BIT_OFFSET))
9149            (const_int 4)
9150            (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9151                (const_int MAX_17BIT_OFFSET))
9152            (const_int 8)
9153            (match_test "TARGET_PORTABLE_RUNTIME")
9154            (const_int 24)
9155            (not (match_test "flag_pic"))
9156            (const_int 20)]
9157           (const_int 28))
9159 ;; Loop counter in FP reg case.
9160 ;; Extra goo to deal with additional reload insns.
9161         (if_then_else (eq_attr "alternative" "1")
9162           (if_then_else (lt (match_dup 3) (pc))
9163              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9164                       (const_int MAX_12BIT_OFFSET))
9165                     (const_int 12)
9166                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9167                       (const_int MAX_17BIT_OFFSET))
9168                     (const_int 16)
9169                     (match_test "TARGET_PORTABLE_RUNTIME")
9170                     (const_int 32)
9171                     (not (match_test "flag_pic"))
9172                     (const_int 28)]
9173                   (const_int 36))
9174              (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9175                       (const_int MAX_12BIT_OFFSET))
9176                     (const_int 12)
9177                     (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9178                       (const_int MAX_17BIT_OFFSET))
9179                     (const_int 16)
9180                     (match_test "TARGET_PORTABLE_RUNTIME")
9181                     (const_int 32)
9182                     (not (match_test "flag_pic"))
9183                     (const_int 28)]
9184                   (const_int 36)))
9186 ;; Loop counter in memory or SAR case.
9187 ;; Extra goo to deal with additional reload insns.
9188         (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9189                    (const_int MAX_12BIT_OFFSET))
9190                 (const_int 8)
9191                 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9192                   (const_int MAX_17BIT_OFFSET))
9193                 (const_int 12)
9194                 (match_test "TARGET_PORTABLE_RUNTIME")
9195                 (const_int 28)
9196                 (not (match_test "flag_pic"))
9197                 (const_int 24)]
9198               (const_int 32)))))])
9200 (define_insn ""
9201   [(set (pc) (label_ref (match_operand 3 "" "" )))
9202    (set (match_operand:SI 0 "ireg_operand" "=r")
9203         (plus:SI (match_operand:SI 1 "ireg_operand" "r")
9204                  (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
9205   "(reload_completed && operands[0] == operands[1]) || operands[0] == operands[2]"
9206   "*
9208   return pa_output_parallel_addb (operands, insn);
9210 [(set_attr "type" "parallel_branch")
9211  (set (attr "length")
9212     (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9213                (const_int MAX_12BIT_OFFSET))
9214            (const_int 4)
9215            (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9216                (const_int MAX_17BIT_OFFSET))
9217            (const_int 8)
9218            (match_test "TARGET_PORTABLE_RUNTIME")
9219            (const_int 24)
9220            (not (match_test "flag_pic"))
9221            (const_int 20)]
9222           (const_int 28)))])
9224 (define_insn ""
9225   [(set (pc) (label_ref (match_operand 2 "" "" )))
9226    (set (match_operand:SF 0 "ireg_operand" "=r")
9227         (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
9228   "reload_completed"
9229   "*
9231   return pa_output_parallel_movb (operands, insn);
9233 [(set_attr "type" "parallel_branch")
9234  (set (attr "length")
9235     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9236                (const_int MAX_12BIT_OFFSET))
9237            (const_int 4)
9238            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9239                (const_int MAX_17BIT_OFFSET))
9240            (const_int 8)
9241            (match_test "TARGET_PORTABLE_RUNTIME")
9242            (const_int 24)
9243            (not (match_test "flag_pic"))
9244            (const_int 20)]
9245           (const_int 28)))])
9247 (define_insn ""
9248   [(set (pc) (label_ref (match_operand 2 "" "" )))
9249    (set (match_operand:SI 0 "ireg_operand" "=r")
9250         (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
9251   "reload_completed"
9252   "*
9254   return pa_output_parallel_movb (operands, insn);
9256 [(set_attr "type" "parallel_branch")
9257  (set (attr "length")
9258     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9259                (const_int MAX_12BIT_OFFSET))
9260            (const_int 4)
9261            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9262                (const_int MAX_17BIT_OFFSET))
9263            (const_int 8)
9264            (match_test "TARGET_PORTABLE_RUNTIME")
9265            (const_int 24)
9266            (not (match_test "flag_pic"))
9267            (const_int 20)]
9268           (const_int 28)))])
9270 (define_insn ""
9271   [(set (pc) (label_ref (match_operand 2 "" "" )))
9272    (set (match_operand:HI 0 "ireg_operand" "=r")
9273         (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
9274   "reload_completed"
9275   "*
9277   return pa_output_parallel_movb (operands, insn);
9279 [(set_attr "type" "parallel_branch")
9280  (set (attr "length")
9281     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9282                (const_int MAX_12BIT_OFFSET))
9283            (const_int 4)
9284            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9285                (const_int MAX_17BIT_OFFSET))
9286            (const_int 8)
9287            (match_test "TARGET_PORTABLE_RUNTIME")
9288            (const_int 24)
9289            (not (match_test "flag_pic"))
9290            (const_int 20)]
9291           (const_int 28)))])
9293 (define_insn ""
9294   [(set (pc) (label_ref (match_operand 2 "" "" )))
9295    (set (match_operand:QI 0 "ireg_operand" "=r")
9296         (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
9297   "reload_completed"
9298   "*
9300   return pa_output_parallel_movb (operands, insn);
9302 [(set_attr "type" "parallel_branch")
9303  (set (attr "length")
9304     (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9305                (const_int MAX_12BIT_OFFSET))
9306            (const_int 4)
9307            (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9308                (const_int MAX_17BIT_OFFSET))
9309            (const_int 8)
9310            (match_test "TARGET_PORTABLE_RUNTIME")
9311            (const_int 24)
9312            (not (match_test "flag_pic"))
9313            (const_int 20)]
9314           (const_int 28)))])
9316 (define_insn ""
9317   [(set (match_operand 0 "register_operand" "=f")
9318         (mult (match_operand 1 "register_operand" "f")
9319               (match_operand 2 "register_operand" "f")))
9320    (set (match_operand 3 "register_operand" "+f")
9321         (plus (match_operand 4 "register_operand" "f")
9322               (match_operand 5 "register_operand" "f")))]
9323   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9324    && reload_completed && pa_fmpyaddoperands (operands)"
9325   "*
9327   if (GET_MODE (operands[0]) == DFmode)
9328     {
9329       if (rtx_equal_p (operands[3], operands[5]))
9330         return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9331       else
9332         return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9333     }
9334   else
9335     {
9336       if (rtx_equal_p (operands[3], operands[5]))
9337         return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9338       else
9339         return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9340     }
9342   [(set_attr "type" "fpalu")
9343    (set_attr "length" "4")])
9345 (define_insn ""
9346   [(set (match_operand 3 "register_operand" "+f")
9347         (plus (match_operand 4 "register_operand" "f")
9348               (match_operand 5 "register_operand" "f")))
9349    (set (match_operand 0 "register_operand" "=f")
9350         (mult (match_operand 1 "register_operand" "f")
9351               (match_operand 2 "register_operand" "f")))]
9352   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9353    && reload_completed && pa_fmpyaddoperands (operands)"
9354   "*
9356   if (GET_MODE (operands[0]) == DFmode)
9357     {
9358       if (rtx_equal_p (operands[3], operands[5]))
9359         return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9360       else
9361         return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9362     }
9363   else
9364     {
9365       if (rtx_equal_p (operands[3], operands[5]))
9366         return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9367       else
9368         return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9369     }
9371   [(set_attr "type" "fpalu")
9372    (set_attr "length" "4")])
9374 (define_insn ""
9375   [(set (match_operand 0 "register_operand" "=f")
9376         (mult (match_operand 1 "register_operand" "f")
9377               (match_operand 2 "register_operand" "f")))
9378    (set (match_operand 3 "register_operand" "+f")
9379         (minus (match_operand 4 "register_operand" "f")
9380                (match_operand 5 "register_operand" "f")))]
9381   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9382    && reload_completed && pa_fmpysuboperands (operands)"
9383   "*
9385   if (GET_MODE (operands[0]) == DFmode)
9386     return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9387   else
9388     return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9390   [(set_attr "type" "fpalu")
9391    (set_attr "length" "4")])
9393 (define_insn ""
9394   [(set (match_operand 3 "register_operand" "+f")
9395         (minus (match_operand 4 "register_operand" "f")
9396                (match_operand 5 "register_operand" "f")))
9397    (set (match_operand 0 "register_operand" "=f")
9398         (mult (match_operand 1 "register_operand" "f")
9399               (match_operand 2 "register_operand" "f")))]
9400   "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9401    && reload_completed && pa_fmpysuboperands (operands)"
9402   "*
9404   if (GET_MODE (operands[0]) == DFmode)
9405     return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9406   else
9407     return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9409   [(set_attr "type" "fpalu")
9410    (set_attr "length" "4")])
9412 ;; The following two patterns are used by the trampoline code for nested
9413 ;; functions.  They flush the I and D cache lines from the start address
9414 ;; (operand0) to the end address (operand1).  No lines are flushed if the
9415 ;; end address is less than the start address (unsigned).
9417 ;; Because the range of memory flushed is variable and the size of a MEM
9418 ;; can only be a CONST_INT, the patterns specify that they perform an
9419 ;; unspecified volatile operation on all memory.
9421 ;; The address range for an icache flush must lie within a single
9422 ;; space on targets with non-equivalent space registers.
9424 ;; Operand 0 contains the start address.
9425 ;; Operand 1 contains the end address.
9426 ;; Operand 2 contains the line length to use.
9427 (define_insn "dcacheflush<P:mode>"
9428   [(const_int 1)
9429    (unspec_volatile [(mem:BLK (scratch))] UNSPECV_DCACHE)
9430    (use (match_operand 0 "pmode_register_operand" "r"))
9431    (use (match_operand 1 "pmode_register_operand" "r"))
9432    (use (match_operand 2 "pmode_register_operand" "r"))
9433    (clobber (match_scratch:P 3 "=&0"))]
9434   ""
9435   "cmpb,<dwc><<=,n %3,%1,.\;fdc,m %2(%3)\;sync"
9436   [(set_attr "type" "multi")
9437    (set_attr "length" "12")])
9439 (define_insn "icacheflush<P:mode>"
9440   [(const_int 2)
9441    (unspec_volatile [(mem:BLK (scratch))] UNSPECV_ICACHE)
9442    (use (match_operand 0 "pmode_register_operand" "r"))
9443    (use (match_operand 1 "pmode_register_operand" "r"))
9444    (use (match_operand 2 "pmode_register_operand" "r"))
9445    (clobber (match_operand 3 "pmode_register_operand" "=&r"))
9446    (clobber (match_operand 4 "pmode_register_operand" "=&r"))
9447    (clobber (match_scratch:P 5 "=&0"))]
9448   ""
9449   "mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,<dwc><<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop"
9450   [(set_attr "type" "multi")
9451    (set_attr "length" "52")])
9453 ;; An out-of-line prologue.
9454 (define_insn "outline_prologue_call"
9455   [(unspec_volatile [(const_int 0)] UNSPECV_OPC)
9456    (clobber (reg:SI 31))
9457    (clobber (reg:SI 22))
9458    (clobber (reg:SI 21))
9459    (clobber (reg:SI 20))
9460    (clobber (reg:SI 19))
9461    (clobber (reg:SI 1))]
9462   ""
9463   "*
9466   /* We need two different versions depending on whether or not we
9467      need a frame pointer.   Also note that we return to the instruction
9468      immediately after the branch rather than two instructions after the
9469      break as normally is the case.  */
9470   if (frame_pointer_needed)
9471     {
9472       /* Must import the magic millicode routine(s).  */
9473       output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
9475       if (TARGET_PORTABLE_RUNTIME)
9476         {
9477           output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
9478           output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
9479                            NULL);
9480         }
9481       else
9482         output_asm_insn (\"{bl|b,l},n __outline_prologue_fp,%%r31\", NULL);
9483     }
9484   else
9485     {
9486       /* Must import the magic millicode routine(s).  */
9487       output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
9489       if (TARGET_PORTABLE_RUNTIME)
9490         {
9491           output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
9492           output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
9493         }
9494       else
9495         output_asm_insn (\"{bl|b,l},n __outline_prologue,%%r31\", NULL);
9496     }
9497   return \"\";
9499   [(set_attr "type" "multi")
9500    (set_attr "length" "8")])
9502 ;; An out-of-line epilogue.
9503 (define_insn "outline_epilogue_call"
9504   [(unspec_volatile [(const_int 1)] UNSPECV_OEC)
9505    (use (reg:SI 29))
9506    (use (reg:SI 28))
9507    (clobber (reg:SI 31))
9508    (clobber (reg:SI 22))
9509    (clobber (reg:SI 21))
9510    (clobber (reg:SI 20))
9511    (clobber (reg:SI 19))
9512    (clobber (reg:SI 2))
9513    (clobber (reg:SI 1))]
9514   ""
9515   "*
9518   /* We need two different versions depending on whether or not we
9519      need a frame pointer.   Also note that we return to the instruction
9520      immediately after the branch rather than two instructions after the
9521      break as normally is the case.  */
9522   if (frame_pointer_needed)
9523     {
9524       /* Must import the magic millicode routine.  */
9525       output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
9527       /* The out-of-line prologue will make sure we return to the right
9528          instruction.  */
9529       if (TARGET_PORTABLE_RUNTIME)
9530         {
9531           output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
9532           output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
9533                            NULL);
9534         }
9535       else
9536         output_asm_insn (\"{bl|b,l},n __outline_epilogue_fp,%%r31\", NULL);
9537     }
9538   else
9539     {
9540       /* Must import the magic millicode routine.  */
9541       output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
9543       /* The out-of-line prologue will make sure we return to the right
9544          instruction.  */
9545       if (TARGET_PORTABLE_RUNTIME)
9546         {
9547           output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
9548           output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
9549         }
9550       else
9551         output_asm_insn (\"{bl|b,l},n __outline_epilogue,%%r31\", NULL);
9552     }
9553   return \"\";
9555   [(set_attr "type" "multi")
9556    (set_attr "length" "8")])
9558 ;; Given a function pointer, canonicalize it so it can be 
9559 ;; reliably compared to another function pointer.  */
9560 (define_expand "canonicalize_funcptr_for_compare"
9561   [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
9562    (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9563               (clobber (match_dup 2))
9564               (clobber (reg:SI 26))
9565               (clobber (reg:SI 22))
9566               (clobber (reg:SI 31))])
9567    (set (match_operand:SI 0 "register_operand" "")
9568         (reg:SI 29))]
9569   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
9570   "
9572   if (TARGET_ELF32)
9573     {
9574       rtx canonicalize_funcptr_for_compare_libfunc
9575         = init_one_libfunc (CANONICALIZE_FUNCPTR_FOR_COMPARE_LIBCALL);
9577       emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
9578                                operands[0], LCT_NORMAL, Pmode,
9579                                1, operands[1], Pmode);
9580       DONE;
9581     }
9583   operands[2] = gen_reg_rtx (SImode);
9584   if (GET_CODE (operands[1]) != REG)
9585     {
9586       rtx tmp = gen_reg_rtx (Pmode);
9587       emit_move_insn (tmp, operands[1]);
9588       operands[1] = tmp;
9589     }
9592 (define_insn "*$$sh_func_adrs"
9593   [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9594    (clobber (match_operand:SI 0 "register_operand" "=a"))
9595    (clobber (reg:SI 26))
9596    (clobber (reg:SI 22))
9597    (clobber (reg:SI 31))]
9598   "!TARGET_64BIT"
9599   "*
9601   int length = get_attr_length (insn);
9602   rtx xoperands[2];
9604   xoperands[0] = GEN_INT (length - 8);
9605   xoperands[1] = GEN_INT (length - 16);
9607   /* Must import the magic millicode routine.  */
9608   output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
9610   /* This is absolutely amazing.
9612      First, copy our input parameter into %r29 just in case we don't
9613      need to call $$sh_func_adrs.  */
9614   output_asm_insn (\"copy %%r26,%%r29\", NULL);
9615   output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\", NULL);
9617   /* Next, examine the low two bits in %r26, if they aren't 0x2, then
9618      we use %r26 unchanged.  */
9619   output_asm_insn (\"{comib|cmpib},<>,n 2,%%r31,.+%0\", xoperands);
9620   output_asm_insn (\"ldi 4096,%%r31\", NULL);
9622   /* Next, compare %r26 with 4096, if %r26 is less than or equal to
9623      4096, then again we use %r26 unchanged.  */
9624   output_asm_insn (\"{comb|cmpb},<<,n %%r26,%%r31,.+%1\", xoperands);
9626   /* Finally, call $$sh_func_adrs to extract the function's real add24.  */
9627   return pa_output_millicode_call (insn,
9628                                    gen_rtx_SYMBOL_REF (SImode,
9629                                                        \"$$sh_func_adrs\"));
9631   [(set_attr "type" "sh_func_adrs")
9632    (set (attr "length")
9633         (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 28)]
9634               (plus (symbol_ref "pa_attr_length_millicode_call (insn)")
9635                     (const_int 20))))])
9637 ;; On the PA, the PIC register is call clobbered, so it must
9638 ;; be saved & restored around calls by the caller.  If the call
9639 ;; doesn't return normally (nonlocal goto, or an exception is
9640 ;; thrown), then the code at the exception handler label must
9641 ;; restore the PIC register.
9642 (define_expand "exception_receiver"
9643   [(const_int 4)]
9644   "flag_pic"
9645   "
9647   /* On the 64-bit port, we need a blockage because there is
9648      confusion regarding the dependence of the restore on the
9649      frame pointer.  As a result, the frame pointer and pic
9650      register restores sometimes are interchanged erroneously.  */
9651   if (TARGET_64BIT)
9652     emit_insn (gen_blockage ());
9653   /* Restore the PIC register using hppa_pic_save_rtx ().  The
9654      PIC register is not saved in the frame in 64-bit ABI.  */
9655   emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9656   emit_insn (gen_blockage ());
9657   DONE;
9660 (define_expand "builtin_setjmp_receiver"
9661   [(label_ref (match_operand 0 "" ""))]
9662   "flag_pic"
9663   "
9665   if (TARGET_64BIT)
9666     emit_insn (gen_blockage ());
9667   /* Restore the PIC register.  Hopefully, this will always be from
9668      a stack slot.  The only registers that are valid after a
9669      builtin_longjmp are the stack and frame pointers.  */
9670   emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9671   emit_insn (gen_blockage ());
9672   DONE;
9675 ;; Allocate new stack space and update the saved stack pointer in the
9676 ;; frame marker.  The HP C compilers also copy additional words in the
9677 ;; frame marker.  The 64-bit compiler copies words at -48, -32 and -24.
9678 ;; The 32-bit compiler copies the word at -16 (Static Link).  We
9679 ;; currently don't copy these values.
9681 ;; Since the copy of the frame marker can't be done atomically, I
9682 ;; suspect that using it for unwind purposes may be somewhat unreliable.
9683 ;; The HP compilers appear to raise the stack and copy the frame
9684 ;; marker in a strict instruction sequence.  This suggests that the
9685 ;; unwind library may check for an alloca sequence when ALLOCA_FRAME
9686 ;; is set in the callinfo data.  We currently don't set ALLOCA_FRAME
9687 ;; as GAS doesn't support it, or try to keep the instructions emitted
9688 ;; here in strict sequence.
9689 (define_expand "allocate_stack"
9690   [(match_operand 0 "" "")
9691    (match_operand 1 "" "")]
9692   ""
9693   "
9695   rtx addr;
9697   /* Since the stack grows upward, we need to store virtual_stack_dynamic_rtx
9698      in operand 0 before adjusting the stack.  */
9699   emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9700   anti_adjust_stack (operands[1]);
9701   if (TARGET_HPUX_UNWIND_LIBRARY)
9702     {
9703       addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx,
9704                            GEN_INT (TARGET_64BIT ? -8 : -4));
9705       emit_move_insn (gen_rtx_MEM (word_mode, addr), hard_frame_pointer_rtx);
9706     }
9707   if (!TARGET_64BIT && flag_pic)
9708     {
9709       rtx addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx, GEN_INT (-32));
9710       emit_move_insn (gen_rtx_MEM (word_mode, addr), pic_offset_table_rtx);
9711     }
9712   DONE;
9715 (define_expand "prefetch"
9716   [(match_operand 0 "address_operand" "")
9717    (match_operand 1 "const_int_operand" "")
9718    (match_operand 2 "const_int_operand" "")]
9719   "TARGET_PA_20"
9721   operands[0] = copy_addr_to_reg (operands[0]);
9722   emit_insn (gen_prefetch_20 (operands[0], operands[1], operands[2]));
9723   DONE;
9726 (define_insn "prefetch_20"
9727   [(prefetch (match_operand 0 "pmode_register_operand" "r")
9728              (match_operand:SI 1 "const_int_operand" "n")
9729              (match_operand:SI 2 "const_int_operand" "n"))]
9730   "TARGET_PA_20"
9732   /* The SL cache-control completer indicates good spatial locality but
9733      poor temporal locality.  The ldw instruction with a target of general
9734      register 0 prefetches a cache line for a read.  The ldd instruction
9735      prefetches a cache line for a write.  */
9736   static const char * const instr[2][2] = {
9737     {
9738       "ldw,sl 0(%0),%%r0",
9739       "ldd,sl 0(%0),%%r0"
9740     },
9741     {
9742       "ldw 0(%0),%%r0",
9743       "ldd 0(%0),%%r0"
9744     }
9745   };
9746   int read_or_write = INTVAL (operands[1]) == 0 ? 0 : 1;
9747   int locality = INTVAL (operands[2]) == 0 ? 0 : 1;
9749   return instr [locality][read_or_write];
9751   [(set_attr "type" "load")
9752    (set_attr "length" "4")])
9754 ;; TLS Support
9755 (define_insn "tgd_load"
9756  [(set (match_operand:SI 0 "register_operand" "=r")
9757        (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
9758   (clobber (reg:SI 1))
9759   (use (reg:SI 27))]
9760   ""
9761   "*
9763   return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
9765   [(set_attr "type" "multi")
9766    (set_attr "length" "8")])
9768 (define_insn "tgd_load_pic"
9769  [(set (match_operand:SI 0 "register_operand" "=r")
9770        (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
9771   (clobber (reg:SI 1))
9772   (use (reg:SI 19))]
9773   ""
9774   "*
9776   return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
9778   [(set_attr "type" "multi")
9779    (set_attr "length" "8")])
9781 (define_insn "tld_load"
9782  [(set (match_operand:SI 0 "register_operand" "=r")
9783        (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
9784   (clobber (reg:SI 1))
9785   (use (reg:SI 27))]
9786   ""
9787   "*
9789   return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
9791   [(set_attr "type" "multi")
9792    (set_attr "length" "8")])
9794 (define_insn "tld_load_pic"
9795  [(set (match_operand:SI 0 "register_operand" "=r")
9796        (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
9797   (clobber (reg:SI 1))
9798   (use (reg:SI 19))]
9799   ""
9800   "*
9802   return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
9804   [(set_attr "type" "multi")
9805    (set_attr "length" "8")])
9807 (define_insn "tld_offset_load"
9808   [(set (match_operand:SI 0 "register_operand" "=r")
9809         (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] 
9810                             UNSPEC_TLSLDO)
9811                  (match_operand:SI 2 "register_operand" "r")))
9812    (clobber (reg:SI 1))]
9813   ""
9814   "*
9816   return \"addil LR'%1-$tls_dtpoff$,%2\;ldo RR'%1-$tls_dtpoff$(%%r1),%0\"; 
9818   [(set_attr "type" "multi")
9819    (set_attr "length" "8")])
9821 (define_insn "tp_load"
9822   [(set (match_operand:SI 0 "register_operand" "=r")
9823         (unspec:SI [(const_int 0)] UNSPEC_TP))]
9824   ""
9825   "mfctl %%cr27,%0"
9826   [(set_attr "type" "multi")
9827    (set_attr "length" "4")])
9829 (define_insn "tie_load"
9830   [(set (match_operand:SI 0 "register_operand" "=r")
9831         (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
9832    (clobber (reg:SI 1))
9833    (use (reg:SI 27))]
9834   ""
9835   "*
9837   return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
9839   [(set_attr "type" "multi")
9840    (set_attr "length" "8")])
9842 (define_insn "tie_load_pic"
9843   [(set (match_operand:SI 0 "register_operand" "=r")
9844         (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
9845    (clobber (reg:SI 1))
9846    (use (reg:SI 19))]
9847   ""
9848   "*
9850   return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
9852   [(set_attr "type" "multi")
9853    (set_attr "length" "8")])
9855 (define_insn "tle_load"
9856   [(set (match_operand:SI 0 "register_operand" "=r")
9857         (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")] 
9858                             UNSPEC_TLSLE)
9859                  (match_operand:SI 2 "register_operand" "r")))
9860    (clobber (reg:SI 1))]
9861   ""
9862   "addil LR'%1-$tls_leoff$,%2\;ldo RR'%1-$tls_leoff$(%%r1),%0"
9863   [(set_attr "type" "multi")
9864    (set_attr "length" "8")])