1 ;;- Machine description for HP PA-RISC architecture for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
3 ;; 2002 Free Software Foundation, Inc.
4 ;; Contributed by the Center for Software Science at the University
7 ;; This file is part of GNU CC.
9 ;; GNU CC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU CC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU CC; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
24 ;; This gcc Version 2 machine description is inspired by sparc.md and
27 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 ;; Insn type. Used to default other attribute values.
31 ;; type "unary" insns have one input operand (1) and one output operand (0)
32 ;; type "binary" insns have two input operands (1,2) and one output (0)
35 "move,unary,binary,shift,nullshift,compare,load,store,uncond_branch,branch,cbranch,fbranch,call,dyncall,fpload,fpstore,fpalu,fpcc,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,multi,milli,parallel_branch"
36 (const_string "binary"))
38 (define_attr "pa_combine_type"
39 "fmpy,faddsub,uncond_branch,addmove,none"
40 (const_string "none"))
42 ;; Processor type (for scheduling, not code generation) -- this attribute
43 ;; must exactly match the processor_type enumeration in pa.h.
45 ;; FIXME: Add 800 scheduling for completeness?
47 (define_attr "cpu" "700,7100,7100LC,7200,7300,8000" (const (symbol_ref "pa_cpu_attr")))
49 ;; Length (in # of bytes).
50 (define_attr "length" ""
51 (cond [(eq_attr "type" "load,fpload")
52 (if_then_else (match_operand 1 "symbolic_memory_operand" "")
53 (const_int 8) (const_int 4))
55 (eq_attr "type" "store,fpstore")
56 (if_then_else (match_operand 0 "symbolic_memory_operand" "")
57 (const_int 8) (const_int 4))
59 (eq_attr "type" "binary,shift,nullshift")
60 (if_then_else (match_operand 2 "arith_operand" "")
61 (const_int 4) (const_int 12))
63 (eq_attr "type" "move,unary,shift,nullshift")
64 (if_then_else (match_operand 1 "arith_operand" "")
65 (const_int 4) (const_int 8))]
69 (define_asm_attributes
70 [(set_attr "length" "4")
71 (set_attr "type" "multi")])
73 ;; Attributes for instruction and branch scheduling
75 ;; For conditional branches.
76 (define_attr "in_branch_delay" "false,true"
77 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
78 (eq_attr "length" "4"))
80 (const_string "false")))
82 ;; Disallow instructions which use the FPU since they will tie up the FPU
83 ;; even if the instruction is nullified.
84 (define_attr "in_nullified_branch_delay" "false,true"
85 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch")
86 (eq_attr "length" "4"))
88 (const_string "false")))
90 ;; For calls and millicode calls. Allow unconditional branches in the
92 (define_attr "in_call_delay" "false,true"
93 (cond [(and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
94 (eq_attr "length" "4"))
96 (eq_attr "type" "uncond_branch")
97 (if_then_else (ne (symbol_ref "TARGET_JUMP_IN_DELAY")
100 (const_string "false"))]
101 (const_string "false")))
104 ;; Call delay slot description.
105 (define_delay (eq_attr "type" "call")
106 [(eq_attr "in_call_delay" "true") (nil) (nil)])
108 ;; millicode call delay slot description. Note it disallows delay slot
109 ;; when TARGET_PORTABLE_RUNTIME is true.
110 (define_delay (eq_attr "type" "milli")
111 [(and (eq_attr "in_call_delay" "true")
112 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)))
115 ;; Return and other similar instructions.
116 (define_delay (eq_attr "type" "branch,parallel_branch")
117 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
119 ;; Floating point conditional branch delay slot description and
120 (define_delay (eq_attr "type" "fbranch")
121 [(eq_attr "in_branch_delay" "true")
122 (eq_attr "in_nullified_branch_delay" "true")
125 ;; Integer conditional branch delay slot description.
126 ;; Nullification of conditional branches on the PA is dependent on the
127 ;; direction of the branch. Forward branches nullify true and
128 ;; backward branches nullify false. If the direction is unknown
129 ;; then nullification is not allowed.
130 (define_delay (eq_attr "type" "cbranch")
131 [(eq_attr "in_branch_delay" "true")
132 (and (eq_attr "in_nullified_branch_delay" "true")
133 (attr_flag "forward"))
134 (and (eq_attr "in_nullified_branch_delay" "true")
135 (attr_flag "backward"))])
137 (define_delay (and (eq_attr "type" "uncond_branch")
138 (eq (symbol_ref "following_call (insn)")
140 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
142 ;; Memory. Disregarding Cache misses, the Mustang memory times are:
143 ;; load: 2, fpload: 3
144 ;; store, fpstore: 3, no D-cache operations should be scheduled.
146 ;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
148 ;; Instruction Time Unit Minimum Distance (unit contention)
155 ;; fmpyadd 3 ALU,MPY 2
156 ;; fmpysub 3 ALU,MPY 2
157 ;; fmpycfxt 3 ALU,MPY 2
160 ;; fdiv,sgl 10 MPY 10
161 ;; fdiv,dbl 12 MPY 12
162 ;; fsqrt,sgl 14 MPY 14
163 ;; fsqrt,dbl 18 MPY 18
165 ;; We don't model fmpyadd/fmpysub properly as those instructions
166 ;; keep both the FP ALU and MPY units busy. Given that these
167 ;; processors are obsolete, I'm not going to spend the time to
168 ;; model those instructions correctly.
170 (define_automaton "pa700")
171 (define_cpu_unit "dummy_700,mem_700,fpalu_700,fpmpy_700" "pa700")
173 (define_insn_reservation "W0" 4
174 (and (eq_attr "type" "fpcc")
175 (eq_attr "cpu" "700"))
178 (define_insn_reservation "W1" 3
179 (and (eq_attr "type" "fpalu")
180 (eq_attr "cpu" "700"))
183 (define_insn_reservation "W2" 3
184 (and (eq_attr "type" "fpmulsgl,fpmuldbl")
185 (eq_attr "cpu" "700"))
188 (define_insn_reservation "W3" 10
189 (and (eq_attr "type" "fpdivsgl")
190 (eq_attr "cpu" "700"))
193 (define_insn_reservation "W4" 12
194 (and (eq_attr "type" "fpdivdbl")
195 (eq_attr "cpu" "700"))
198 (define_insn_reservation "W5" 14
199 (and (eq_attr "type" "fpsqrtsgl")
200 (eq_attr "cpu" "700"))
203 (define_insn_reservation "W6" 18
204 (and (eq_attr "type" "fpsqrtdbl")
205 (eq_attr "cpu" "700"))
208 (define_insn_reservation "W7" 2
209 (and (eq_attr "type" "load")
210 (eq_attr "cpu" "700"))
213 (define_insn_reservation "W8" 2
214 (and (eq_attr "type" "fpload")
215 (eq_attr "cpu" "700"))
218 (define_insn_reservation "W9" 3
219 (and (eq_attr "type" "store")
220 (eq_attr "cpu" "700"))
223 (define_insn_reservation "W10" 3
224 (and (eq_attr "type" "fpstore")
225 (eq_attr "cpu" "700"))
228 (define_insn_reservation "W11" 1
229 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,load,fpload,store,fpstore")
230 (eq_attr "cpu" "700"))
233 ;; We have a bypass for all computations in the FP unit which feed an
234 ;; FP store as long as the sizes are the same.
235 (define_bypass 2 "W1,W2" "W10" "hppa_fpstore_bypass_p")
236 (define_bypass 9 "W3" "W10" "hppa_fpstore_bypass_p")
237 (define_bypass 11 "W4" "W10" "hppa_fpstore_bypass_p")
238 (define_bypass 13 "W5" "W10" "hppa_fpstore_bypass_p")
239 (define_bypass 17 "W6" "W10" "hppa_fpstore_bypass_p")
241 ;; We have an "anti-bypass" for FP loads which feed an FP store.
242 (define_bypass 4 "W8" "W10" "hppa_fpstore_bypass_p")
244 ;; Function units for the 7100 and 7150. The 7100/7150 can dual-issue
245 ;; floating point computations with non-floating point computations (fp loads
246 ;; and stores are not fp computations).
248 ;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
249 ;; take two cycles, during which no Dcache operations should be scheduled.
250 ;; Any special cases are handled in pa_adjust_cost. The 7100, 7150 and 7100LC
251 ;; all have the same memory characteristics if one disregards cache misses.
253 ;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
254 ;; There's no value in modeling the ALU and MUL separately though
255 ;; since there can never be a functional unit conflict given the
256 ;; latency and issue rates for those units.
259 ;; Instruction Time Unit Minimum Distance (unit contention)
266 ;; fmpyadd 2 ALU,MPY 1
267 ;; fmpysub 2 ALU,MPY 1
268 ;; fmpycfxt 2 ALU,MPY 1
272 ;; fdiv,dbl 15 DIV 15
274 ;; fsqrt,dbl 15 DIV 15
276 (define_automaton "pa7100")
277 (define_cpu_unit "i_7100, f_7100,fpmac_7100,fpdivsqrt_7100,mem_7100" "pa7100")
279 (define_insn_reservation "X0" 2
280 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
281 (eq_attr "cpu" "7100"))
284 (define_insn_reservation "X1" 8
285 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
286 (eq_attr "cpu" "7100"))
287 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*7")
289 (define_insn_reservation "X2" 15
290 (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
291 (eq_attr "cpu" "7100"))
292 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*14")
294 (define_insn_reservation "X3" 2
295 (and (eq_attr "type" "load")
296 (eq_attr "cpu" "7100"))
299 (define_insn_reservation "X4" 2
300 (and (eq_attr "type" "fpload")
301 (eq_attr "cpu" "7100"))
304 (define_insn_reservation "X5" 2
305 (and (eq_attr "type" "store")
306 (eq_attr "cpu" "7100"))
307 "i_7100+mem_7100,mem_7100")
309 (define_insn_reservation "X6" 2
310 (and (eq_attr "type" "fpstore")
311 (eq_attr "cpu" "7100"))
312 "i_7100+mem_7100,mem_7100")
314 (define_insn_reservation "X7" 1
315 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore")
316 (eq_attr "cpu" "7100"))
319 ;; We have a bypass for all computations in the FP unit which feed an
320 ;; FP store as long as the sizes are the same.
321 (define_bypass 1 "X0" "X6" "hppa_fpstore_bypass_p")
322 (define_bypass 7 "X1" "X6" "hppa_fpstore_bypass_p")
323 (define_bypass 14 "X2" "X6" "hppa_fpstore_bypass_p")
325 ;; We have an "anti-bypass" for FP loads which feed an FP store.
326 (define_bypass 3 "X4" "X6" "hppa_fpstore_bypass_p")
328 ;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
329 ;; There's no value in modeling the ALU and MUL separately though
330 ;; since there can never be a functional unit conflict that
331 ;; can be avoided given the latency, issue rates and mandatory
332 ;; one cycle cpu-wide lock for a double precision fp multiply.
335 ;; Instruction Time Unit Minimum Distance (unit contention)
342 ;; fmpyadd,sgl 2 ALU,MPY 1
343 ;; fmpyadd,dbl 3 ALU,MPY 2
344 ;; fmpysub,sgl 2 ALU,MPY 1
345 ;; fmpysub,dbl 3 ALU,MPY 2
346 ;; fmpycfxt,sgl 2 ALU,MPY 1
347 ;; fmpycfxt,dbl 3 ALU,MPY 2
352 ;; fdiv,dbl 15 DIV 15
354 ;; fsqrt,dbl 15 DIV 15
356 ;; The PA7200 is just like the PA7100LC except that there is
357 ;; no store-store penalty.
359 ;; The PA7300 is just like the PA7200 except that there is
360 ;; no store-load penalty.
362 ;; Note there are some aspects of the 7100LC we are not modeling
363 ;; at the moment. I'll be reviewing the 7100LC scheduling info
364 ;; shortly and updating this description.
368 ;; other issue modeling
370 (define_automaton "pa7100lc")
371 (define_cpu_unit "i0_7100lc, i1_7100lc, f_7100lc" "pa7100lc")
372 (define_cpu_unit "fpmac_7100lc" "pa7100lc")
373 (define_cpu_unit "mem_7100lc" "pa7100lc")
375 ;; Double precision multiplies lock the entire CPU for one
376 ;; cycle. There is no way to avoid this lock and trying to
377 ;; schedule around the lock is pointless and thus there is no
378 ;; value in trying to model this lock.
380 ;; Not modeling the lock allows us to treat fp multiplies just
381 ;; like any other FP alu instruction. It allows for a smaller
382 ;; DFA and may reduce register pressure.
383 (define_insn_reservation "Y0" 2
384 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
385 (eq_attr "cpu" "7100LC,7200,7300"))
386 "f_7100lc,fpmac_7100lc")
388 ;; fp division and sqrt instructions lock the entire CPU for
389 ;; 7 cycles (single precision) or 14 cycles (double precision).
390 ;; There is no way to avoid this lock and trying to schedule
391 ;; around the lock is pointless and thus there is no value in
392 ;; trying to model this lock. Not modeling the lock allows
393 ;; for a smaller DFA and may reduce register pressure.
394 (define_insn_reservation "Y1" 1
395 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
396 (eq_attr "cpu" "7100LC,7200,7300"))
399 (define_insn_reservation "Y2" 2
400 (and (eq_attr "type" "load")
401 (eq_attr "cpu" "7100LC,7200,7300"))
402 "i1_7100lc+mem_7100lc")
404 (define_insn_reservation "Y3" 2
405 (and (eq_attr "type" "fpload")
406 (eq_attr "cpu" "7100LC,7200,7300"))
407 "i1_7100lc+mem_7100lc")
409 (define_insn_reservation "Y4" 2
410 (and (eq_attr "type" "store")
411 (eq_attr "cpu" "7100LC"))
412 "i1_7100lc+mem_7100lc,mem_7100lc")
414 (define_insn_reservation "Y5" 2
415 (and (eq_attr "type" "fpstore")
416 (eq_attr "cpu" "7100LC"))
417 "i1_7100lc+mem_7100lc,mem_7100lc")
419 (define_insn_reservation "Y6" 1
420 (and (eq_attr "type" "shift,nullshift")
421 (eq_attr "cpu" "7100LC,7200,7300"))
424 (define_insn_reservation "Y7" 1
425 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
426 (eq_attr "cpu" "7100LC,7200,7300"))
427 "(i0_7100lc|i1_7100lc)")
429 ;; The 7200 has a store-load penalty
430 (define_insn_reservation "Y8" 2
431 (and (eq_attr "type" "store")
432 (eq_attr "cpu" "7200"))
433 "i1_7100lc,mem_7100lc")
435 (define_insn_reservation "Y9" 2
436 (and (eq_attr "type" "fpstore")
437 (eq_attr "cpu" "7200"))
438 "i1_7100lc,mem_7100lc")
440 ;; The 7300 has no penalty for store-store or store-load
441 (define_insn_reservation "Y10" 2
442 (and (eq_attr "type" "store")
443 (eq_attr "cpu" "7300"))
446 (define_insn_reservation "Y11" 2
447 (and (eq_attr "type" "fpstore")
448 (eq_attr "cpu" "7300"))
451 ;; We have an "anti-bypass" for FP loads which feed an FP store.
452 (define_bypass 3 "Y3" "Y5,Y9,Y11" "hppa_fpstore_bypass_p")
454 ;; Scheduling for the PA8000 is somewhat different than scheduling for a
455 ;; traditional architecture.
457 ;; The PA8000 has a large (56) entry reorder buffer that is split between
458 ;; memory and non-memory operations.
460 ;; The PA8000 can issue two memory and two non-memory operations per cycle to
461 ;; the function units, with the exception of branches and multi-output
462 ;; instructions. The PA8000 can retire two non-memory operations per cycle
463 ;; and two memory operations per cycle, only one of which may be a store.
465 ;; Given the large reorder buffer, the processor can hide most latencies.
466 ;; According to HP, they've got the best results by scheduling for retirement
467 ;; bandwidth with limited latency scheduling for floating point operations.
468 ;; Latency for integer operations and memory references is ignored.
471 ;; We claim floating point operations have a 2 cycle latency and are
472 ;; fully pipelined, except for div and sqrt which are not pipelined and
473 ;; take from 17 to 31 cycles to complete.
475 ;; It's worth noting that there is no way to saturate all the functional
476 ;; units on the PA8000 as there is not enough issue bandwidth.
478 (define_automaton "pa8000")
479 (define_cpu_unit "inm0_8000, inm1_8000, im0_8000, im1_8000" "pa8000")
480 (define_cpu_unit "rnm0_8000, rnm1_8000, rm0_8000, rm1_8000" "pa8000")
481 (define_cpu_unit "store_8000" "pa8000")
482 (define_cpu_unit "f0_8000, f1_8000" "pa8000")
483 (define_cpu_unit "fdivsqrt0_8000, fdivsqrt1_8000" "pa8000")
484 (define_reservation "inm_8000" "inm0_8000 | inm1_8000")
485 (define_reservation "im_8000" "im0_8000 | im1_8000")
486 (define_reservation "rnm_8000" "rnm0_8000 | rnm1_8000")
487 (define_reservation "rm_8000" "rm0_8000 | rm1_8000")
488 (define_reservation "f_8000" "f0_8000 | f1_8000")
489 (define_reservation "fdivsqrt_8000" "fdivsqrt0_8000 | fdivsqrt1_8000")
491 ;; We can issue any two memops per cycle, but we can only retire
492 ;; one memory store per cycle. We assume that the reorder buffer
493 ;; will hide any memory latencies per HP's recommendation.
494 (define_insn_reservation "Z0" 0
496 (eq_attr "type" "load,fpload")
497 (eq_attr "cpu" "8000"))
500 (define_insn_reservation "Z1" 0
502 (eq_attr "type" "store,fpstore")
503 (eq_attr "cpu" "8000"))
504 "im_8000,rm_8000+store_8000")
506 ;; We can issue and retire two non-memory operations per cycle with
507 ;; a few exceptions (branches). This group catches those we want
508 ;; to assume have zero latency.
509 (define_insn_reservation "Z2" 0
511 (eq_attr "type" "!load,fpload,store,fpstore,uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch,fpcc,fpalu,fpmulsgl,fpmuldbl,fpsqrtsgl,fpsqrtdbl,fpdivsgl,fpdivdbl")
512 (eq_attr "cpu" "8000"))
515 ;; Branches use both slots in the non-memory issue and
517 (define_insn_reservation "Z3" 0
519 (eq_attr "type" "uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
520 (eq_attr "cpu" "8000"))
521 "inm0_8000+inm1_8000,rnm0_8000+rnm1_8000")
523 ;; We partial latency schedule the floating point units.
524 ;; They can issue/retire two at a time in the non-memory
525 ;; units. We fix their latency at 2 cycles and they
526 ;; are fully pipelined.
527 (define_insn_reservation "Z4" 1
529 (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
530 (eq_attr "cpu" "8000"))
531 "inm_8000,f_8000,rnm_8000")
533 ;; The fdivsqrt units are not pipelined and have a very long latency.
534 ;; To keep the DFA from exploding, we do not show all the
535 ;; reservations for the divsqrt unit.
536 (define_insn_reservation "Z5" 17
538 (eq_attr "type" "fpdivsgl,fpsqrtsgl")
539 (eq_attr "cpu" "8000"))
540 "inm_8000,fdivsqrt_8000*6,rnm_8000")
542 (define_insn_reservation "Z6" 31
544 (eq_attr "type" "fpdivdbl,fpsqrtdbl")
545 (eq_attr "cpu" "8000"))
546 "inm_8000,fdivsqrt_8000*6,rnm_8000")
550 ;; Compare instructions.
551 ;; This controls RTL generation and register allocation.
553 ;; We generate RTL for comparisons and branches by having the cmpxx
554 ;; patterns store away the operands. Then, the scc and bcc patterns
555 ;; emit RTL for both the compare and the branch.
558 (define_expand "cmpdi"
560 (compare:CC (match_operand:DI 0 "reg_or_0_operand" "")
561 (match_operand:DI 1 "register_operand" "")))]
566 hppa_compare_op0 = operands[0];
567 hppa_compare_op1 = operands[1];
568 hppa_branch_type = CMP_SI;
572 (define_expand "cmpsi"
574 (compare:CC (match_operand:SI 0 "reg_or_0_operand" "")
575 (match_operand:SI 1 "arith5_operand" "")))]
579 hppa_compare_op0 = operands[0];
580 hppa_compare_op1 = operands[1];
581 hppa_branch_type = CMP_SI;
585 (define_expand "cmpsf"
587 (compare:CCFP (match_operand:SF 0 "reg_or_0_operand" "")
588 (match_operand:SF 1 "reg_or_0_operand" "")))]
589 "! TARGET_SOFT_FLOAT"
592 hppa_compare_op0 = operands[0];
593 hppa_compare_op1 = operands[1];
594 hppa_branch_type = CMP_SF;
598 (define_expand "cmpdf"
600 (compare:CCFP (match_operand:DF 0 "reg_or_0_operand" "")
601 (match_operand:DF 1 "reg_or_0_operand" "")))]
602 "! TARGET_SOFT_FLOAT"
605 hppa_compare_op0 = operands[0];
606 hppa_compare_op1 = operands[1];
607 hppa_branch_type = CMP_DF;
613 (match_operator:CCFP 2 "comparison_operator"
614 [(match_operand:SF 0 "reg_or_0_operand" "fG")
615 (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
616 "! TARGET_SOFT_FLOAT"
617 "fcmp,sgl,%Y2 %f0,%f1"
618 [(set_attr "length" "4")
619 (set_attr "type" "fpcc")])
623 (match_operator:CCFP 2 "comparison_operator"
624 [(match_operand:DF 0 "reg_or_0_operand" "fG")
625 (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
626 "! TARGET_SOFT_FLOAT"
627 "fcmp,dbl,%Y2 %f0,%f1"
628 [(set_attr "length" "4")
629 (set_attr "type" "fpcc")])
634 [(set (match_operand:SI 0 "register_operand" "")
640 /* fp scc patterns rarely match, and are not a win on the PA. */
641 if (hppa_branch_type != CMP_SI)
643 /* set up operands from compare. */
644 operands[1] = hppa_compare_op0;
645 operands[2] = hppa_compare_op1;
646 /* fall through and generate default code */
650 [(set (match_operand:SI 0 "register_operand" "")
656 /* fp scc patterns rarely match, and are not a win on the PA. */
657 if (hppa_branch_type != CMP_SI)
659 operands[1] = hppa_compare_op0;
660 operands[2] = hppa_compare_op1;
664 [(set (match_operand:SI 0 "register_operand" "")
670 /* fp scc patterns rarely match, and are not a win on the PA. */
671 if (hppa_branch_type != CMP_SI)
673 operands[1] = hppa_compare_op0;
674 operands[2] = hppa_compare_op1;
678 [(set (match_operand:SI 0 "register_operand" "")
684 /* fp scc patterns rarely match, and are not a win on the PA. */
685 if (hppa_branch_type != CMP_SI)
687 operands[1] = hppa_compare_op0;
688 operands[2] = hppa_compare_op1;
692 [(set (match_operand:SI 0 "register_operand" "")
698 /* fp scc patterns rarely match, and are not a win on the PA. */
699 if (hppa_branch_type != CMP_SI)
701 operands[1] = hppa_compare_op0;
702 operands[2] = hppa_compare_op1;
706 [(set (match_operand:SI 0 "register_operand" "")
712 /* fp scc patterns rarely match, and are not a win on the PA. */
713 if (hppa_branch_type != CMP_SI)
715 operands[1] = hppa_compare_op0;
716 operands[2] = hppa_compare_op1;
719 (define_expand "sltu"
720 [(set (match_operand:SI 0 "register_operand" "")
721 (ltu:SI (match_dup 1)
726 if (hppa_branch_type != CMP_SI)
728 operands[1] = hppa_compare_op0;
729 operands[2] = hppa_compare_op1;
732 (define_expand "sgtu"
733 [(set (match_operand:SI 0 "register_operand" "")
734 (gtu:SI (match_dup 1)
739 if (hppa_branch_type != CMP_SI)
741 operands[1] = hppa_compare_op0;
742 operands[2] = hppa_compare_op1;
745 (define_expand "sleu"
746 [(set (match_operand:SI 0 "register_operand" "")
747 (leu:SI (match_dup 1)
752 if (hppa_branch_type != CMP_SI)
754 operands[1] = hppa_compare_op0;
755 operands[2] = hppa_compare_op1;
758 (define_expand "sgeu"
759 [(set (match_operand:SI 0 "register_operand" "")
760 (geu:SI (match_dup 1)
765 if (hppa_branch_type != CMP_SI)
767 operands[1] = hppa_compare_op0;
768 operands[2] = hppa_compare_op1;
771 ;; Instruction canonicalization puts immediate operands second, which
772 ;; is the reverse of what we want.
775 [(set (match_operand:SI 0 "register_operand" "=r")
776 (match_operator:SI 3 "comparison_operator"
777 [(match_operand:SI 1 "register_operand" "r")
778 (match_operand:SI 2 "arith11_operand" "rI")]))]
780 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0"
781 [(set_attr "type" "binary")
782 (set_attr "length" "8")])
785 [(set (match_operand:DI 0 "register_operand" "=r")
786 (match_operator:DI 3 "comparison_operator"
787 [(match_operand:DI 1 "register_operand" "r")
788 (match_operand:DI 2 "arith11_operand" "rI")]))]
790 "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0"
791 [(set_attr "type" "binary")
792 (set_attr "length" "8")])
794 (define_insn "iorscc"
795 [(set (match_operand:SI 0 "register_operand" "=r")
796 (ior:SI (match_operator:SI 3 "comparison_operator"
797 [(match_operand:SI 1 "register_operand" "r")
798 (match_operand:SI 2 "arith11_operand" "rI")])
799 (match_operator:SI 6 "comparison_operator"
800 [(match_operand:SI 4 "register_operand" "r")
801 (match_operand:SI 5 "arith11_operand" "rI")])))]
803 "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0"
804 [(set_attr "type" "binary")
805 (set_attr "length" "12")])
808 [(set (match_operand:DI 0 "register_operand" "=r")
809 (ior:DI (match_operator:DI 3 "comparison_operator"
810 [(match_operand:DI 1 "register_operand" "r")
811 (match_operand:DI 2 "arith11_operand" "rI")])
812 (match_operator:DI 6 "comparison_operator"
813 [(match_operand:DI 4 "register_operand" "r")
814 (match_operand:DI 5 "arith11_operand" "rI")])))]
816 "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0"
817 [(set_attr "type" "binary")
818 (set_attr "length" "12")])
820 ;; Combiner patterns for common operations performed with the output
821 ;; from an scc insn (negscc and incscc).
822 (define_insn "negscc"
823 [(set (match_operand:SI 0 "register_operand" "=r")
824 (neg:SI (match_operator:SI 3 "comparison_operator"
825 [(match_operand:SI 1 "register_operand" "r")
826 (match_operand:SI 2 "arith11_operand" "rI")])))]
828 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0"
829 [(set_attr "type" "binary")
830 (set_attr "length" "8")])
833 [(set (match_operand:DI 0 "register_operand" "=r")
834 (neg:DI (match_operator:DI 3 "comparison_operator"
835 [(match_operand:DI 1 "register_operand" "r")
836 (match_operand:DI 2 "arith11_operand" "rI")])))]
838 "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0"
839 [(set_attr "type" "binary")
840 (set_attr "length" "8")])
842 ;; Patterns for adding/subtracting the result of a boolean expression from
843 ;; a register. First we have special patterns that make use of the carry
844 ;; bit, and output only two instructions. For the cases we can't in
845 ;; general do in two instructions, the incscc pattern at the end outputs
846 ;; two or three instructions.
849 [(set (match_operand:SI 0 "register_operand" "=r")
850 (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
851 (match_operand:SI 3 "arith11_operand" "rI"))
852 (match_operand:SI 1 "register_operand" "r")))]
854 "sub%I3 %3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
855 [(set_attr "type" "binary")
856 (set_attr "length" "8")])
859 [(set (match_operand:DI 0 "register_operand" "=r")
860 (plus:DI (leu:DI (match_operand:DI 2 "register_operand" "r")
861 (match_operand:DI 3 "arith11_operand" "rI"))
862 (match_operand:DI 1 "register_operand" "r")))]
864 "sub%I3 %3,%2,%%r0\;add,dc %%r0,%1,%0"
865 [(set_attr "type" "binary")
866 (set_attr "length" "8")])
868 ; This need only accept registers for op3, since canonicalization
869 ; replaces geu with gtu when op3 is an integer.
871 [(set (match_operand:SI 0 "register_operand" "=r")
872 (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
873 (match_operand:SI 3 "register_operand" "r"))
874 (match_operand:SI 1 "register_operand" "r")))]
876 "sub %2,%3,%%r0\;{addc|add,c} %%r0,%1,%0"
877 [(set_attr "type" "binary")
878 (set_attr "length" "8")])
881 [(set (match_operand:DI 0 "register_operand" "=r")
882 (plus:DI (geu:DI (match_operand:DI 2 "register_operand" "r")
883 (match_operand:DI 3 "register_operand" "r"))
884 (match_operand:DI 1 "register_operand" "r")))]
886 "sub %2,%3,%%r0\;add,dc %%r0,%1,%0"
887 [(set_attr "type" "binary")
888 (set_attr "length" "8")])
890 ; Match only integers for op3 here. This is used as canonical form of the
891 ; geu pattern when op3 is an integer. Don't match registers since we can't
892 ; make better code than the general incscc pattern.
894 [(set (match_operand:SI 0 "register_operand" "=r")
895 (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
896 (match_operand:SI 3 "int11_operand" "I"))
897 (match_operand:SI 1 "register_operand" "r")))]
899 "addi %k3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
900 [(set_attr "type" "binary")
901 (set_attr "length" "8")])
904 [(set (match_operand:DI 0 "register_operand" "=r")
905 (plus:DI (gtu:DI (match_operand:DI 2 "register_operand" "r")
906 (match_operand:DI 3 "int11_operand" "I"))
907 (match_operand:DI 1 "register_operand" "r")))]
909 "addi %k3,%2,%%r0\;add,dc %%r0,%1,%0"
910 [(set_attr "type" "binary")
911 (set_attr "length" "8")])
913 (define_insn "incscc"
914 [(set (match_operand:SI 0 "register_operand" "=r,r")
915 (plus:SI (match_operator:SI 4 "comparison_operator"
916 [(match_operand:SI 2 "register_operand" "r,r")
917 (match_operand:SI 3 "arith11_operand" "rI,rI")])
918 (match_operand:SI 1 "register_operand" "0,?r")))]
921 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi 1,%0,%0
922 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
923 [(set_attr "type" "binary,binary")
924 (set_attr "length" "8,12")])
927 [(set (match_operand:DI 0 "register_operand" "=r,r")
928 (plus:DI (match_operator:DI 4 "comparison_operator"
929 [(match_operand:DI 2 "register_operand" "r,r")
930 (match_operand:DI 3 "arith11_operand" "rI,rI")])
931 (match_operand:DI 1 "register_operand" "0,?r")))]
934 cmp%I3clr,*%B4 %3,%2,%%r0\;addi 1,%0,%0
935 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
936 [(set_attr "type" "binary,binary")
937 (set_attr "length" "8,12")])
940 [(set (match_operand:SI 0 "register_operand" "=r")
941 (minus:SI (match_operand:SI 1 "register_operand" "r")
942 (gtu:SI (match_operand:SI 2 "register_operand" "r")
943 (match_operand:SI 3 "arith11_operand" "rI"))))]
945 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
946 [(set_attr "type" "binary")
947 (set_attr "length" "8")])
950 [(set (match_operand:DI 0 "register_operand" "=r")
951 (minus:DI (match_operand:DI 1 "register_operand" "r")
952 (gtu:DI (match_operand:DI 2 "register_operand" "r")
953 (match_operand:DI 3 "arith11_operand" "rI"))))]
955 "sub%I3 %3,%2,%%r0\;sub,db %1,%%r0,%0"
956 [(set_attr "type" "binary")
957 (set_attr "length" "8")])
960 [(set (match_operand:SI 0 "register_operand" "=r")
961 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
962 (gtu:SI (match_operand:SI 2 "register_operand" "r")
963 (match_operand:SI 3 "arith11_operand" "rI")))
964 (match_operand:SI 4 "register_operand" "r")))]
966 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
967 [(set_attr "type" "binary")
968 (set_attr "length" "8")])
971 [(set (match_operand:DI 0 "register_operand" "=r")
972 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
973 (gtu:DI (match_operand:DI 2 "register_operand" "r")
974 (match_operand:DI 3 "arith11_operand" "rI")))
975 (match_operand:DI 4 "register_operand" "r")))]
977 "sub%I3 %3,%2,%%r0\;sub,db %1,%4,%0"
978 [(set_attr "type" "binary")
979 (set_attr "length" "8")])
981 ; This need only accept registers for op3, since canonicalization
982 ; replaces ltu with leu when op3 is an integer.
984 [(set (match_operand:SI 0 "register_operand" "=r")
985 (minus:SI (match_operand:SI 1 "register_operand" "r")
986 (ltu:SI (match_operand:SI 2 "register_operand" "r")
987 (match_operand:SI 3 "register_operand" "r"))))]
989 "sub %2,%3,%%r0\;{subb|sub,b} %1,%%r0,%0"
990 [(set_attr "type" "binary")
991 (set_attr "length" "8")])
994 [(set (match_operand:DI 0 "register_operand" "=r")
995 (minus:DI (match_operand:DI 1 "register_operand" "r")
996 (ltu:DI (match_operand:DI 2 "register_operand" "r")
997 (match_operand:DI 3 "register_operand" "r"))))]
999 "sub %2,%3,%%r0\;sub,db %1,%%r0,%0"
1000 [(set_attr "type" "binary")
1001 (set_attr "length" "8")])
1004 [(set (match_operand:SI 0 "register_operand" "=r")
1005 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1006 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1007 (match_operand:SI 3 "register_operand" "r")))
1008 (match_operand:SI 4 "register_operand" "r")))]
1010 "sub %2,%3,%%r0\;{subb|sub,b} %1,%4,%0"
1011 [(set_attr "type" "binary")
1012 (set_attr "length" "8")])
1015 [(set (match_operand:DI 0 "register_operand" "=r")
1016 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1017 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1018 (match_operand:DI 3 "register_operand" "r")))
1019 (match_operand:DI 4 "register_operand" "r")))]
1021 "sub %2,%3,%%r0\;sub,db %1,%4,%0"
1022 [(set_attr "type" "binary")
1023 (set_attr "length" "8")])
1025 ; Match only integers for op3 here. This is used as canonical form of the
1026 ; ltu pattern when op3 is an integer. Don't match registers since we can't
1027 ; make better code than the general incscc pattern.
1029 [(set (match_operand:SI 0 "register_operand" "=r")
1030 (minus:SI (match_operand:SI 1 "register_operand" "r")
1031 (leu:SI (match_operand:SI 2 "register_operand" "r")
1032 (match_operand:SI 3 "int11_operand" "I"))))]
1034 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1035 [(set_attr "type" "binary")
1036 (set_attr "length" "8")])
1039 [(set (match_operand:DI 0 "register_operand" "=r")
1040 (minus:DI (match_operand:DI 1 "register_operand" "r")
1041 (leu:DI (match_operand:DI 2 "register_operand" "r")
1042 (match_operand:DI 3 "int11_operand" "I"))))]
1044 "addi %k3,%2,%%r0\;sub,db %1,%%r0,%0"
1045 [(set_attr "type" "binary")
1046 (set_attr "length" "8")])
1049 [(set (match_operand:SI 0 "register_operand" "=r")
1050 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1051 (leu:SI (match_operand:SI 2 "register_operand" "r")
1052 (match_operand:SI 3 "int11_operand" "I")))
1053 (match_operand:SI 4 "register_operand" "r")))]
1055 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1056 [(set_attr "type" "binary")
1057 (set_attr "length" "8")])
1060 [(set (match_operand:DI 0 "register_operand" "=r")
1061 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1062 (leu:DI (match_operand:DI 2 "register_operand" "r")
1063 (match_operand:DI 3 "int11_operand" "I")))
1064 (match_operand:DI 4 "register_operand" "r")))]
1066 "addi %k3,%2,%%r0\;sub,db %1,%4,%0"
1067 [(set_attr "type" "binary")
1068 (set_attr "length" "8")])
1070 (define_insn "decscc"
1071 [(set (match_operand:SI 0 "register_operand" "=r,r")
1072 (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
1073 (match_operator:SI 4 "comparison_operator"
1074 [(match_operand:SI 2 "register_operand" "r,r")
1075 (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
1078 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi -1,%0,%0
1079 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1080 [(set_attr "type" "binary,binary")
1081 (set_attr "length" "8,12")])
1084 [(set (match_operand:DI 0 "register_operand" "=r,r")
1085 (minus:DI (match_operand:DI 1 "register_operand" "0,?r")
1086 (match_operator:DI 4 "comparison_operator"
1087 [(match_operand:DI 2 "register_operand" "r,r")
1088 (match_operand:DI 3 "arith11_operand" "rI,rI")])))]
1091 cmp%I3clr,*%B4 %3,%2,%%r0\;addi -1,%0,%0
1092 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1093 [(set_attr "type" "binary,binary")
1094 (set_attr "length" "8,12")])
1096 ; Patterns for max and min. (There is no need for an earlyclobber in the
1097 ; last alternative since the middle alternative will match if op0 == op1.)
1099 (define_insn "sminsi3"
1100 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1101 (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1102 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1105 {comclr|cmpclr},> %2,%0,%%r0\;copy %2,%0
1106 {comiclr|cmpiclr},> %2,%0,%%r0\;ldi %2,%0
1107 {comclr|cmpclr},> %1,%r2,%0\;copy %1,%0"
1108 [(set_attr "type" "multi,multi,multi")
1109 (set_attr "length" "8,8,8")])
1111 (define_insn "smindi3"
1112 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1113 (smin:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1114 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1117 cmpclr,*> %2,%0,%%r0\;copy %2,%0
1118 cmpiclr,*> %2,%0,%%r0\;ldi %2,%0
1119 cmpclr,*> %1,%r2,%0\;copy %1,%0"
1120 [(set_attr "type" "multi,multi,multi")
1121 (set_attr "length" "8,8,8")])
1123 (define_insn "uminsi3"
1124 [(set (match_operand:SI 0 "register_operand" "=r,r")
1125 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
1126 (match_operand:SI 2 "arith11_operand" "r,I")))]
1129 {comclr|cmpclr},>> %2,%0,%%r0\;copy %2,%0
1130 {comiclr|cmpiclr},>> %2,%0,%%r0\;ldi %2,%0"
1131 [(set_attr "type" "multi,multi")
1132 (set_attr "length" "8,8")])
1134 (define_insn "umindi3"
1135 [(set (match_operand:DI 0 "register_operand" "=r,r")
1136 (umin:DI (match_operand:DI 1 "register_operand" "%0,0")
1137 (match_operand:DI 2 "arith11_operand" "r,I")))]
1140 cmpclr,*>> %2,%0,%%r0\;copy %2,%0
1141 cmpiclr,*>> %2,%0,%%r0\;ldi %2,%0"
1142 [(set_attr "type" "multi,multi")
1143 (set_attr "length" "8,8")])
1145 (define_insn "smaxsi3"
1146 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1147 (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1148 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1151 {comclr|cmpclr},< %2,%0,%%r0\;copy %2,%0
1152 {comiclr|cmpiclr},< %2,%0,%%r0\;ldi %2,%0
1153 {comclr|cmpclr},< %1,%r2,%0\;copy %1,%0"
1154 [(set_attr "type" "multi,multi,multi")
1155 (set_attr "length" "8,8,8")])
1157 (define_insn "smaxdi3"
1158 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1159 (smax:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1160 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1163 cmpclr,*< %2,%0,%%r0\;copy %2,%0
1164 cmpiclr,*< %2,%0,%%r0\;ldi %2,%0
1165 cmpclr,*< %1,%r2,%0\;copy %1,%0"
1166 [(set_attr "type" "multi,multi,multi")
1167 (set_attr "length" "8,8,8")])
1169 (define_insn "umaxsi3"
1170 [(set (match_operand:SI 0 "register_operand" "=r,r")
1171 (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
1172 (match_operand:SI 2 "arith11_operand" "r,I")))]
1175 {comclr|cmpclr},<< %2,%0,%%r0\;copy %2,%0
1176 {comiclr|cmpiclr},<< %2,%0,%%r0\;ldi %2,%0"
1177 [(set_attr "type" "multi,multi")
1178 (set_attr "length" "8,8")])
1180 (define_insn "umaxdi3"
1181 [(set (match_operand:DI 0 "register_operand" "=r,r")
1182 (umax:DI (match_operand:DI 1 "register_operand" "%0,0")
1183 (match_operand:DI 2 "arith11_operand" "r,I")))]
1186 cmpclr,*<< %2,%0,%%r0\;copy %2,%0
1187 cmpiclr,*<< %2,%0,%%r0\;ldi %2,%0"
1188 [(set_attr "type" "multi,multi")
1189 (set_attr "length" "8,8")])
1191 (define_insn "abssi2"
1192 [(set (match_operand:SI 0 "register_operand" "=r")
1193 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1195 "or,>= %%r0,%1,%0\;subi 0,%0,%0"
1196 [(set_attr "type" "multi")
1197 (set_attr "length" "8")])
1199 (define_insn "absdi2"
1200 [(set (match_operand:DI 0 "register_operand" "=r")
1201 (abs:DI (match_operand:DI 1 "register_operand" "r")))]
1203 "or,*>= %%r0,%1,%0\;subi 0,%0,%0"
1204 [(set_attr "type" "multi")
1205 (set_attr "length" "8")])
1207 ;;; Experimental conditional move patterns
1209 (define_expand "movsicc"
1210 [(set (match_operand:SI 0 "register_operand" "")
1212 (match_operator 1 "comparison_operator"
1215 (match_operand:SI 2 "reg_or_cint_move_operand" "")
1216 (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
1220 enum rtx_code code = GET_CODE (operands[1]);
1222 if (hppa_branch_type != CMP_SI)
1225 if (GET_MODE (hppa_compare_op0) != GET_MODE (hppa_compare_op1)
1226 || GET_MODE (hppa_compare_op0) != GET_MODE (operands[0]))
1229 /* operands[1] is currently the result of compare_from_rtx. We want to
1230 emit a compare of the original operands. */
1231 operands[1] = gen_rtx_fmt_ee (code, SImode, hppa_compare_op0, hppa_compare_op1);
1232 operands[4] = hppa_compare_op0;
1233 operands[5] = hppa_compare_op1;
1236 ;; We used to accept any register for op1.
1238 ;; However, it loses sometimes because the compiler will end up using
1239 ;; different registers for op0 and op1 in some critical cases. local-alloc
1240 ;; will not tie op0 and op1 because op0 is used in multiple basic blocks.
1242 ;; If/when global register allocation supports tying we should allow any
1243 ;; register for op1 again.
1245 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1247 (match_operator 2 "comparison_operator"
1248 [(match_operand:SI 3 "register_operand" "r,r,r,r")
1249 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI")])
1250 (match_operand:SI 1 "reg_or_cint_move_operand" "0,J,N,K")
1254 {com%I4clr|cmp%I4clr},%S2 %4,%3,%%r0\;ldi 0,%0
1255 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldi %1,%0
1256 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldil L'%1,%0
1257 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;{zdepi|depwi,z} %Z1,%0"
1258 [(set_attr "type" "multi,multi,multi,nullshift")
1259 (set_attr "length" "8,8,8,8")])
1262 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1264 (match_operator 5 "comparison_operator"
1265 [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
1266 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1267 (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1268 (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1271 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;copy %2,%0
1272 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldi %2,%0
1273 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldil L'%2,%0
1274 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;{zdepi|depwi,z} %Z2,%0
1275 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;copy %1,%0
1276 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldi %1,%0
1277 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldil L'%1,%0
1278 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;{zdepi|depwi,z} %Z1,%0"
1279 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1280 (set_attr "length" "8,8,8,8,8,8,8,8")])
1282 (define_expand "movdicc"
1283 [(set (match_operand:DI 0 "register_operand" "")
1285 (match_operator 1 "comparison_operator"
1288 (match_operand:DI 2 "reg_or_cint_move_operand" "")
1289 (match_operand:DI 3 "reg_or_cint_move_operand" "")))]
1293 enum rtx_code code = GET_CODE (operands[1]);
1295 if (hppa_branch_type != CMP_SI)
1298 if (GET_MODE (hppa_compare_op0) != GET_MODE (hppa_compare_op1)
1299 || GET_MODE (hppa_compare_op0) != GET_MODE (operands[0]))
1302 /* operands[1] is currently the result of compare_from_rtx. We want to
1303 emit a compare of the original operands. */
1304 operands[1] = gen_rtx_fmt_ee (code, DImode, hppa_compare_op0, hppa_compare_op1);
1305 operands[4] = hppa_compare_op0;
1306 operands[5] = hppa_compare_op1;
1309 ; We need the first constraint alternative in order to avoid
1310 ; earlyclobbers on all other alternatives.
1312 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1314 (match_operator 2 "comparison_operator"
1315 [(match_operand:DI 3 "register_operand" "r,r,r,r,r")
1316 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
1317 (match_operand:DI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
1321 cmp%I4clr,*%S2 %4,%3,%%r0\;ldi 0,%0
1322 cmp%I4clr,*%B2 %4,%3,%0\;copy %1,%0
1323 cmp%I4clr,*%B2 %4,%3,%0\;ldi %1,%0
1324 cmp%I4clr,*%B2 %4,%3,%0\;ldil L'%1,%0
1325 cmp%I4clr,*%B2 %4,%3,%0\;depdi,z %z1,%0"
1326 [(set_attr "type" "multi,multi,multi,multi,nullshift")
1327 (set_attr "length" "8,8,8,8,8")])
1330 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1332 (match_operator 5 "comparison_operator"
1333 [(match_operand:DI 3 "register_operand" "r,r,r,r,r,r,r,r")
1334 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1335 (match_operand:DI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1336 (match_operand:DI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1339 cmp%I4clr,*%S5 %4,%3,%%r0\;copy %2,%0
1340 cmp%I4clr,*%S5 %4,%3,%%r0\;ldi %2,%0
1341 cmp%I4clr,*%S5 %4,%3,%%r0\;ldil L'%2,%0
1342 cmp%I4clr,*%S5 %4,%3,%%r0\;depdi,z %z2,%0
1343 cmp%I4clr,*%B5 %4,%3,%%r0\;copy %1,%0
1344 cmp%I4clr,*%B5 %4,%3,%%r0\;ldi %1,%0
1345 cmp%I4clr,*%B5 %4,%3,%%r0\;ldil L'%1,%0
1346 cmp%I4clr,*%B5 %4,%3,%%r0\;depdi,z %z1,%0"
1347 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1348 (set_attr "length" "8,8,8,8,8,8,8,8")])
1350 ;; Conditional Branches
1352 (define_expand "beq"
1354 (if_then_else (eq (match_dup 1) (match_dup 2))
1355 (label_ref (match_operand 0 "" ""))
1360 if (hppa_branch_type != CMP_SI)
1362 emit_insn (gen_cmp_fp (EQ, hppa_compare_op0, hppa_compare_op1));
1363 emit_bcond_fp (NE, operands[0]);
1366 /* set up operands from compare. */
1367 operands[1] = hppa_compare_op0;
1368 operands[2] = hppa_compare_op1;
1369 /* fall through and generate default code */
1372 (define_expand "bne"
1374 (if_then_else (ne (match_dup 1) (match_dup 2))
1375 (label_ref (match_operand 0 "" ""))
1380 if (hppa_branch_type != CMP_SI)
1382 emit_insn (gen_cmp_fp (NE, hppa_compare_op0, hppa_compare_op1));
1383 emit_bcond_fp (NE, operands[0]);
1386 operands[1] = hppa_compare_op0;
1387 operands[2] = hppa_compare_op1;
1390 (define_expand "bgt"
1392 (if_then_else (gt (match_dup 1) (match_dup 2))
1393 (label_ref (match_operand 0 "" ""))
1398 if (hppa_branch_type != CMP_SI)
1400 emit_insn (gen_cmp_fp (GT, hppa_compare_op0, hppa_compare_op1));
1401 emit_bcond_fp (NE, operands[0]);
1404 operands[1] = hppa_compare_op0;
1405 operands[2] = hppa_compare_op1;
1408 (define_expand "blt"
1410 (if_then_else (lt (match_dup 1) (match_dup 2))
1411 (label_ref (match_operand 0 "" ""))
1416 if (hppa_branch_type != CMP_SI)
1418 emit_insn (gen_cmp_fp (LT, hppa_compare_op0, hppa_compare_op1));
1419 emit_bcond_fp (NE, operands[0]);
1422 operands[1] = hppa_compare_op0;
1423 operands[2] = hppa_compare_op1;
1426 (define_expand "bge"
1428 (if_then_else (ge (match_dup 1) (match_dup 2))
1429 (label_ref (match_operand 0 "" ""))
1434 if (hppa_branch_type != CMP_SI)
1436 emit_insn (gen_cmp_fp (GE, hppa_compare_op0, hppa_compare_op1));
1437 emit_bcond_fp (NE, operands[0]);
1440 operands[1] = hppa_compare_op0;
1441 operands[2] = hppa_compare_op1;
1444 (define_expand "ble"
1446 (if_then_else (le (match_dup 1) (match_dup 2))
1447 (label_ref (match_operand 0 "" ""))
1452 if (hppa_branch_type != CMP_SI)
1454 emit_insn (gen_cmp_fp (LE, hppa_compare_op0, hppa_compare_op1));
1455 emit_bcond_fp (NE, operands[0]);
1458 operands[1] = hppa_compare_op0;
1459 operands[2] = hppa_compare_op1;
1462 (define_expand "bgtu"
1464 (if_then_else (gtu (match_dup 1) (match_dup 2))
1465 (label_ref (match_operand 0 "" ""))
1470 if (hppa_branch_type != CMP_SI)
1472 operands[1] = hppa_compare_op0;
1473 operands[2] = hppa_compare_op1;
1476 (define_expand "bltu"
1478 (if_then_else (ltu (match_dup 1) (match_dup 2))
1479 (label_ref (match_operand 0 "" ""))
1484 if (hppa_branch_type != CMP_SI)
1486 operands[1] = hppa_compare_op0;
1487 operands[2] = hppa_compare_op1;
1490 (define_expand "bgeu"
1492 (if_then_else (geu (match_dup 1) (match_dup 2))
1493 (label_ref (match_operand 0 "" ""))
1498 if (hppa_branch_type != CMP_SI)
1500 operands[1] = hppa_compare_op0;
1501 operands[2] = hppa_compare_op1;
1504 (define_expand "bleu"
1506 (if_then_else (leu (match_dup 1) (match_dup 2))
1507 (label_ref (match_operand 0 "" ""))
1512 if (hppa_branch_type != CMP_SI)
1514 operands[1] = hppa_compare_op0;
1515 operands[2] = hppa_compare_op1;
1518 (define_expand "bltgt"
1520 (if_then_else (ltgt (match_dup 1) (match_dup 2))
1521 (label_ref (match_operand 0 "" ""))
1526 if (hppa_branch_type == CMP_SI)
1528 emit_insn (gen_cmp_fp (LTGT, hppa_compare_op0, hppa_compare_op1));
1529 emit_bcond_fp (NE, operands[0]);
1533 (define_expand "bunle"
1535 (if_then_else (unle (match_dup 1) (match_dup 2))
1536 (label_ref (match_operand 0 "" ""))
1541 if (hppa_branch_type == CMP_SI)
1543 emit_insn (gen_cmp_fp (UNLE, hppa_compare_op0, hppa_compare_op1));
1544 emit_bcond_fp (NE, operands[0]);
1548 (define_expand "bunlt"
1550 (if_then_else (unlt (match_dup 1) (match_dup 2))
1551 (label_ref (match_operand 0 "" ""))
1556 if (hppa_branch_type == CMP_SI)
1558 emit_insn (gen_cmp_fp (UNLT, hppa_compare_op0, hppa_compare_op1));
1559 emit_bcond_fp (NE, operands[0]);
1563 (define_expand "bunge"
1565 (if_then_else (unge (match_dup 1) (match_dup 2))
1566 (label_ref (match_operand 0 "" ""))
1571 if (hppa_branch_type == CMP_SI)
1573 emit_insn (gen_cmp_fp (UNGE, hppa_compare_op0, hppa_compare_op1));
1574 emit_bcond_fp (NE, operands[0]);
1578 (define_expand "bungt"
1580 (if_then_else (ungt (match_dup 1) (match_dup 2))
1581 (label_ref (match_operand 0 "" ""))
1586 if (hppa_branch_type == CMP_SI)
1588 emit_insn (gen_cmp_fp (UNGT, hppa_compare_op0, hppa_compare_op1));
1589 emit_bcond_fp (NE, operands[0]);
1593 (define_expand "buneq"
1595 (if_then_else (uneq (match_dup 1) (match_dup 2))
1596 (label_ref (match_operand 0 "" ""))
1601 if (hppa_branch_type == CMP_SI)
1603 emit_insn (gen_cmp_fp (UNEQ, hppa_compare_op0, hppa_compare_op1));
1604 emit_bcond_fp (NE, operands[0]);
1608 (define_expand "bunordered"
1610 (if_then_else (unordered (match_dup 1) (match_dup 2))
1611 (label_ref (match_operand 0 "" ""))
1616 if (hppa_branch_type == CMP_SI)
1618 emit_insn (gen_cmp_fp (UNORDERED, hppa_compare_op0, hppa_compare_op1));
1619 emit_bcond_fp (NE, operands[0]);
1623 (define_expand "bordered"
1625 (if_then_else (ordered (match_dup 1) (match_dup 2))
1626 (label_ref (match_operand 0 "" ""))
1631 if (hppa_branch_type == CMP_SI)
1633 emit_insn (gen_cmp_fp (ORDERED, hppa_compare_op0, hppa_compare_op1));
1634 emit_bcond_fp (NE, operands[0]);
1638 ;; Match the branch patterns.
1641 ;; Note a long backward conditional branch with an annulled delay slot
1642 ;; has a length of 12.
1646 (match_operator 3 "comparison_operator"
1647 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1648 (match_operand:SI 2 "arith5_operand" "rL")])
1649 (label_ref (match_operand 0 "" ""))
1654 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1655 get_attr_length (insn), 0, insn);
1657 [(set_attr "type" "cbranch")
1658 (set (attr "length")
1659 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1662 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1665 (eq (symbol_ref "flag_pic") (const_int 0))
1669 ;; Match the negated branch.
1674 (match_operator 3 "comparison_operator"
1675 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1676 (match_operand:SI 2 "arith5_operand" "rL")])
1678 (label_ref (match_operand 0 "" ""))))]
1682 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1683 get_attr_length (insn), 1, insn);
1685 [(set_attr "type" "cbranch")
1686 (set (attr "length")
1687 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1690 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1693 (eq (symbol_ref "flag_pic") (const_int 0))
1700 (match_operator 3 "comparison_operator"
1701 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1702 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1703 (label_ref (match_operand 0 "" ""))
1708 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1709 get_attr_length (insn), 0, insn);
1711 [(set_attr "type" "cbranch")
1712 (set (attr "length")
1713 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1716 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1719 (eq (symbol_ref "flag_pic") (const_int 0))
1723 ;; Match the negated branch.
1728 (match_operator 3 "comparison_operator"
1729 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1730 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1732 (label_ref (match_operand 0 "" ""))))]
1736 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1737 get_attr_length (insn), 1, insn);
1739 [(set_attr "type" "cbranch")
1740 (set (attr "length")
1741 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1744 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1747 (eq (symbol_ref "flag_pic") (const_int 0))
1753 (match_operator 3 "cmpib_comparison_operator"
1754 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1755 (match_operand:DI 2 "arith5_operand" "rL")])
1756 (label_ref (match_operand 0 "" ""))
1761 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1762 get_attr_length (insn), 0, insn);
1764 [(set_attr "type" "cbranch")
1765 (set (attr "length")
1766 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1769 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1772 (eq (symbol_ref "flag_pic") (const_int 0))
1776 ;; Match the negated branch.
1781 (match_operator 3 "cmpib_comparison_operator"
1782 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1783 (match_operand:DI 2 "arith5_operand" "rL")])
1785 (label_ref (match_operand 0 "" ""))))]
1789 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1790 get_attr_length (insn), 1, insn);
1792 [(set_attr "type" "cbranch")
1793 (set (attr "length")
1794 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1797 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1800 (eq (symbol_ref "flag_pic") (const_int 0))
1804 ;; Branch on Bit patterns.
1808 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1810 (match_operand:SI 1 "uint5_operand" ""))
1812 (label_ref (match_operand 2 "" ""))
1817 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1818 get_attr_length (insn), 0, insn, 0);
1820 [(set_attr "type" "cbranch")
1821 (set (attr "length")
1822 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1830 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1832 (match_operand:DI 1 "uint32_operand" ""))
1834 (label_ref (match_operand 2 "" ""))
1839 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1840 get_attr_length (insn), 0, insn, 0);
1842 [(set_attr "type" "cbranch")
1843 (set (attr "length")
1844 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1852 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1854 (match_operand:SI 1 "uint5_operand" ""))
1857 (label_ref (match_operand 2 "" ""))))]
1861 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1862 get_attr_length (insn), 1, insn, 0);
1864 [(set_attr "type" "cbranch")
1865 (set (attr "length")
1866 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1874 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1876 (match_operand:DI 1 "uint32_operand" ""))
1879 (label_ref (match_operand 2 "" ""))))]
1883 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1884 get_attr_length (insn), 1, insn, 0);
1886 [(set_attr "type" "cbranch")
1887 (set (attr "length")
1888 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1896 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1898 (match_operand:SI 1 "uint5_operand" ""))
1900 (label_ref (match_operand 2 "" ""))
1905 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1906 get_attr_length (insn), 0, insn, 1);
1908 [(set_attr "type" "cbranch")
1909 (set (attr "length")
1910 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1918 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1920 (match_operand:DI 1 "uint32_operand" ""))
1922 (label_ref (match_operand 2 "" ""))
1927 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1928 get_attr_length (insn), 0, insn, 1);
1930 [(set_attr "type" "cbranch")
1931 (set (attr "length")
1932 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1940 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1942 (match_operand:SI 1 "uint5_operand" ""))
1945 (label_ref (match_operand 2 "" ""))))]
1949 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1950 get_attr_length (insn), 1, insn, 1);
1952 [(set_attr "type" "cbranch")
1953 (set (attr "length")
1954 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1962 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1964 (match_operand:DI 1 "uint32_operand" ""))
1967 (label_ref (match_operand 2 "" ""))))]
1971 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1972 get_attr_length (insn), 1, insn, 1);
1974 [(set_attr "type" "cbranch")
1975 (set (attr "length")
1976 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1981 ;; Branch on Variable Bit patterns.
1985 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1987 (match_operand:SI 1 "register_operand" "q"))
1989 (label_ref (match_operand 2 "" ""))
1994 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
1995 get_attr_length (insn), 0, insn, 0);
1997 [(set_attr "type" "cbranch")
1998 (set (attr "length")
1999 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2007 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2009 (match_operand:DI 1 "register_operand" "q"))
2011 (label_ref (match_operand 2 "" ""))
2016 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2017 get_attr_length (insn), 0, insn, 0);
2019 [(set_attr "type" "cbranch")
2020 (set (attr "length")
2021 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2029 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2031 (match_operand:SI 1 "register_operand" "q"))
2034 (label_ref (match_operand 2 "" ""))))]
2038 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2039 get_attr_length (insn), 1, insn, 0);
2041 [(set_attr "type" "cbranch")
2042 (set (attr "length")
2043 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2051 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2053 (match_operand:DI 1 "register_operand" "q"))
2056 (label_ref (match_operand 2 "" ""))))]
2060 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2061 get_attr_length (insn), 1, insn, 0);
2063 [(set_attr "type" "cbranch")
2064 (set (attr "length")
2065 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2073 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2075 (match_operand:SI 1 "register_operand" "q"))
2077 (label_ref (match_operand 2 "" ""))
2082 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2083 get_attr_length (insn), 0, insn, 1);
2085 [(set_attr "type" "cbranch")
2086 (set (attr "length")
2087 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2095 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2097 (match_operand:DI 1 "register_operand" "q"))
2099 (label_ref (match_operand 2 "" ""))
2104 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2105 get_attr_length (insn), 0, insn, 1);
2107 [(set_attr "type" "cbranch")
2108 (set (attr "length")
2109 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2117 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2119 (match_operand:SI 1 "register_operand" "q"))
2122 (label_ref (match_operand 2 "" ""))))]
2126 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2127 get_attr_length (insn), 1, insn, 1);
2129 [(set_attr "type" "cbranch")
2130 (set (attr "length")
2131 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2139 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2141 (match_operand:DI 1 "register_operand" "q"))
2144 (label_ref (match_operand 2 "" ""))))]
2148 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2149 get_attr_length (insn), 1, insn, 1);
2151 [(set_attr "type" "cbranch")
2152 (set (attr "length")
2153 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2158 ;; Floating point branches
2160 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2161 (label_ref (match_operand 0 "" ""))
2163 "! TARGET_SOFT_FLOAT"
2166 if (INSN_ANNULLED_BRANCH_P (insn))
2167 return \"ftest\;b,n %0\";
2169 return \"ftest\;b%* %0\";
2171 [(set_attr "type" "fbranch")
2172 (set_attr "length" "8")])
2175 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2177 (label_ref (match_operand 0 "" ""))))]
2178 "! TARGET_SOFT_FLOAT"
2181 if (INSN_ANNULLED_BRANCH_P (insn))
2182 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b,n %0\";
2184 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b%* %0\";
2186 [(set_attr "type" "fbranch")
2187 (set_attr "length" "12")])
2189 ;; Move instructions
2191 (define_expand "movsi"
2192 [(set (match_operand:SI 0 "general_operand" "")
2193 (match_operand:SI 1 "general_operand" ""))]
2197 if (emit_move_sequence (operands, SImode, 0))
2201 ;; Reloading an SImode or DImode value requires a scratch register if
2202 ;; going in to or out of float point registers.
2204 (define_expand "reload_insi"
2205 [(set (match_operand:SI 0 "register_operand" "=Z")
2206 (match_operand:SI 1 "non_hard_reg_operand" ""))
2207 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2211 if (emit_move_sequence (operands, SImode, operands[2]))
2214 /* We don't want the clobber emitted, so handle this ourselves. */
2215 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2219 (define_expand "reload_outsi"
2220 [(set (match_operand:SI 0 "non_hard_reg_operand" "")
2221 (match_operand:SI 1 "register_operand" "Z"))
2222 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2226 if (emit_move_sequence (operands, SImode, operands[2]))
2229 /* We don't want the clobber emitted, so handle this ourselves. */
2230 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2235 [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand"
2236 "=r,r,r,r,r,r,Q,*q,!f,f,*TR")
2237 (match_operand:SI 1 "move_operand"
2238 "A,r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
2239 "(register_operand (operands[0], SImode)
2240 || reg_or_0_operand (operands[1], SImode))
2241 && ! TARGET_SOFT_FLOAT"
2247 {zdepi|depwi,z} %Z1,%0
2254 [(set_attr "type" "load,move,move,move,shift,load,store,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")])
2259 [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand"
2260 "=r,r,r,r,r,r,Q,*q")
2261 (match_operand:SI 1 "move_operand"
2262 "A,r,J,N,K,RQ,rM,rM"))]
2263 "(register_operand (operands[0], SImode)
2264 || reg_or_0_operand (operands[1], SImode))
2265 && TARGET_SOFT_FLOAT"
2271 {zdepi|depwi,z} %Z1,%0
2275 [(set_attr "type" "load,move,move,move,move,load,store,move")
2276 (set_attr "pa_combine_type" "addmove")
2277 (set_attr "length" "4,4,4,4,4,4,4,4")])
2280 [(set (match_operand:SI 0 "register_operand" "=r")
2281 (mem:SI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
2282 (match_operand:SI 2 "register_operand" "r"))))]
2283 "! TARGET_DISABLE_INDEXING"
2284 "{ldwx|ldw} %2(%1),%0"
2285 [(set_attr "type" "load")
2286 (set_attr "length" "4")])
2289 [(set (match_operand:SI 0 "register_operand" "=r")
2290 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
2291 (match_operand:SI 2 "basereg_operand" "r"))))]
2292 "! TARGET_DISABLE_INDEXING"
2293 "{ldwx|ldw} %1(%2),%0"
2294 [(set_attr "type" "load")
2295 (set_attr "length" "4")])
2297 ;; Load or store with base-register modification.
2299 (define_expand "pre_load"
2300 [(parallel [(set (match_operand:SI 0 "register_operand" "")
2301 (mem (plus (match_operand 1 "register_operand" "")
2302 (match_operand 2 "pre_cint_operand" ""))))
2304 (plus (match_dup 1) (match_dup 2)))])]
2310 emit_insn (gen_pre_ldd (operands[0], operands[1], operands[2]));
2313 emit_insn (gen_pre_ldw (operands[0], operands[1], operands[2]));
2317 (define_insn "pre_ldw"
2318 [(set (match_operand:SI 0 "register_operand" "=r")
2319 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2320 (match_operand:SI 2 "pre_cint_operand" ""))))
2322 (plus:SI (match_dup 1) (match_dup 2)))]
2326 if (INTVAL (operands[2]) < 0)
2327 return \"{ldwm|ldw,mb} %2(%1),%0\";
2328 return \"{ldws|ldw},mb %2(%1),%0\";
2330 [(set_attr "type" "load")
2331 (set_attr "length" "4")])
2333 (define_insn "pre_ldd"
2334 [(set (match_operand:DI 0 "register_operand" "=r")
2335 (mem:DI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2336 (match_operand:DI 2 "pre_cint_operand" ""))))
2338 (plus:DI (match_dup 1) (match_dup 2)))]
2341 [(set_attr "type" "load")
2342 (set_attr "length" "4")])
2345 [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2346 (match_operand:SI 1 "pre_cint_operand" "")))
2347 (match_operand:SI 2 "reg_or_0_operand" "rM"))
2349 (plus:SI (match_dup 0) (match_dup 1)))]
2353 if (INTVAL (operands[1]) < 0)
2354 return \"{stwm|stw,mb} %r2,%1(%0)\";
2355 return \"{stws|stw},mb %r2,%1(%0)\";
2357 [(set_attr "type" "store")
2358 (set_attr "length" "4")])
2361 [(set (match_operand:SI 0 "register_operand" "=r")
2362 (mem:SI (match_operand:SI 1 "register_operand" "+r")))
2364 (plus:SI (match_dup 1)
2365 (match_operand:SI 2 "post_cint_operand" "")))]
2369 if (INTVAL (operands[2]) > 0)
2370 return \"{ldwm|ldw,ma} %2(%1),%0\";
2371 return \"{ldws|ldw},ma %2(%1),%0\";
2373 [(set_attr "type" "load")
2374 (set_attr "length" "4")])
2376 (define_expand "post_store"
2377 [(parallel [(set (mem (match_operand 0 "register_operand" ""))
2378 (match_operand 1 "reg_or_0_operand" ""))
2381 (match_operand 2 "post_cint_operand" "")))])]
2387 emit_insn (gen_post_std (operands[0], operands[1], operands[2]));
2390 emit_insn (gen_post_stw (operands[0], operands[1], operands[2]));
2394 (define_insn "post_stw"
2395 [(set (mem:SI (match_operand:SI 0 "register_operand" "+r"))
2396 (match_operand:SI 1 "reg_or_0_operand" "rM"))
2398 (plus:SI (match_dup 0)
2399 (match_operand:SI 2 "post_cint_operand" "")))]
2403 if (INTVAL (operands[2]) > 0)
2404 return \"{stwm|stw,ma} %r1,%2(%0)\";
2405 return \"{stws|stw},ma %r1,%2(%0)\";
2407 [(set_attr "type" "store")
2408 (set_attr "length" "4")])
2410 (define_insn "post_std"
2411 [(set (mem:DI (match_operand:DI 0 "register_operand" "+r"))
2412 (match_operand:DI 1 "reg_or_0_operand" "rM"))
2414 (plus:DI (match_dup 0)
2415 (match_operand:DI 2 "post_cint_operand" "")))]
2418 [(set_attr "type" "store")
2419 (set_attr "length" "4")])
2421 ;; For loading the address of a label while generating PIC code.
2422 ;; Note since this pattern can be created at reload time (via movsi), all
2423 ;; the same rules for movsi apply here. (no new pseudos, no temporaries).
2425 [(set (match_operand 0 "pmode_register_operand" "=a")
2426 (match_operand 1 "pic_label_operand" ""))]
2431 extern FILE *asm_out_file;
2433 xoperands[0] = operands[0];
2434 xoperands[1] = operands[1];
2435 if (TARGET_SOM || ! TARGET_GAS)
2436 xoperands[2] = gen_label_rtx ();
2438 output_asm_insn (\"{bl|b,l} .+8,%0\", xoperands);
2439 output_asm_insn (\"{depi|depwi} 0,31,2,%0\", xoperands);
2440 if (TARGET_SOM || ! TARGET_GAS)
2441 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
2442 CODE_LABEL_NUMBER (xoperands[2]));
2444 /* If we're trying to load the address of a label that happens to be
2445 close, then we can use a shorter sequence. */
2446 if (GET_CODE (operands[1]) == LABEL_REF
2447 && INSN_ADDRESSES_SET_P ()
2448 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2449 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2451 /* Prefixing with R% here is wrong, it extracts just 11 bits and is
2452 always non-negative. */
2453 if (TARGET_SOM || ! TARGET_GAS)
2454 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2456 output_asm_insn (\"ldo %1-$PIC_pcrel$0+8(%0),%0\", xoperands);
2460 if (TARGET_SOM || ! TARGET_GAS)
2462 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2463 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2467 output_asm_insn (\"addil L%%%1-$PIC_pcrel$0+8,%0\", xoperands);
2468 output_asm_insn (\"ldo R%%%1-$PIC_pcrel$0+12(%0),%0\",
2474 [(set_attr "type" "multi")
2475 (set_attr "length" "16")]) ; 12 or 16
2478 [(set (match_operand:SI 0 "register_operand" "=a")
2479 (plus:SI (match_operand:SI 1 "register_operand" "r")
2480 (high:SI (match_operand 2 "" ""))))]
2481 "symbolic_operand (operands[2], Pmode)
2482 && ! function_label_operand (operands[2], Pmode)
2485 [(set_attr "type" "binary")
2486 (set_attr "length" "4")])
2489 [(set (match_operand:DI 0 "register_operand" "=a")
2490 (plus:DI (match_operand:DI 1 "register_operand" "r")
2491 (high:DI (match_operand 2 "" ""))))]
2492 "symbolic_operand (operands[2], Pmode)
2493 && ! function_label_operand (operands[2], Pmode)
2497 [(set_attr "type" "binary")
2498 (set_attr "length" "4")])
2500 ;; Always use addil rather than ldil;add sequences. This allows the
2501 ;; HP linker to eliminate the dp relocation if the symbolic operand
2502 ;; lives in the TEXT space.
2504 [(set (match_operand:SI 0 "register_operand" "=a")
2505 (high:SI (match_operand 1 "" "")))]
2506 "symbolic_operand (operands[1], Pmode)
2507 && ! function_label_operand (operands[1], Pmode)
2508 && ! read_only_operand (operands[1], Pmode)
2512 if (TARGET_LONG_LOAD_STORE)
2513 return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
2515 return \"addil LR'%H1,%%r27\";
2517 [(set_attr "type" "binary")
2518 (set (attr "length")
2519 (if_then_else (eq (symbol_ref "TARGET_LONG_LOAD_STORE") (const_int 0))
2524 ;; This is for use in the prologue/epilogue code. We need it
2525 ;; to add large constants to a stack pointer or frame pointer.
2526 ;; Because of the additional %r1 pressure, we probably do not
2527 ;; want to use this in general code, so make it available
2528 ;; only after reload.
2530 [(set (match_operand:SI 0 "register_operand" "=!a,*r")
2531 (plus:SI (match_operand:SI 1 "register_operand" "r,r")
2532 (high:SI (match_operand 2 "const_int_operand" ""))))]
2536 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2537 [(set_attr "type" "binary,binary")
2538 (set_attr "length" "4,8")])
2541 [(set (match_operand:DI 0 "register_operand" "=!a,*r")
2542 (plus:DI (match_operand:DI 1 "register_operand" "r,r")
2543 (high:DI (match_operand 2 "const_int_operand" ""))))]
2544 "reload_completed && TARGET_64BIT"
2547 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2548 [(set_attr "type" "binary,binary")
2549 (set_attr "length" "4,8")])
2552 [(set (match_operand:SI 0 "register_operand" "=r")
2553 (high:SI (match_operand 1 "" "")))]
2554 "(!flag_pic || !symbolic_operand (operands[1], Pmode))
2555 && !is_function_label_plus_const (operands[1])"
2558 if (symbolic_operand (operands[1], Pmode))
2559 return \"ldil LR'%H1,%0\";
2561 return \"ldil L'%G1,%0\";
2563 [(set_attr "type" "move")
2564 (set_attr "length" "4")])
2567 [(set (match_operand:DI 0 "register_operand" "=r")
2568 (high:DI (match_operand 1 "const_int_operand" "")))]
2571 [(set_attr "type" "move")
2572 (set_attr "length" "4")])
2575 [(set (match_operand:DI 0 "register_operand" "=r")
2576 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2577 (match_operand:DI 2 "const_int_operand" "i")))]
2580 [(set_attr "type" "move")
2581 (set_attr "length" "4")])
2584 [(set (match_operand:SI 0 "register_operand" "=r")
2585 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2586 (match_operand:SI 2 "immediate_operand" "i")))]
2587 "!is_function_label_plus_const (operands[2])"
2590 if (flag_pic && symbolic_operand (operands[2], Pmode))
2592 else if (symbolic_operand (operands[2], Pmode))
2593 return \"ldo RR'%G2(%1),%0\";
2595 return \"ldo R'%G2(%1),%0\";
2597 [(set_attr "type" "move")
2598 (set_attr "length" "4")])
2600 ;; Now that a symbolic_address plus a constant is broken up early
2601 ;; in the compilation phase (for better CSE) we need a special
2602 ;; combiner pattern to load the symbolic address plus the constant
2603 ;; in only 2 instructions. (For cases where the symbolic address
2604 ;; was not a common subexpression.)
2606 [(set (match_operand:SI 0 "register_operand" "")
2607 (match_operand:SI 1 "symbolic_operand" ""))
2608 (clobber (match_operand:SI 2 "register_operand" ""))]
2609 "! (flag_pic && pic_label_operand (operands[1], SImode))"
2610 [(set (match_dup 2) (high:SI (match_dup 1)))
2611 (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
2614 ;; hppa_legitimize_address goes to a great deal of trouble to
2615 ;; create addresses which use indexing. In some cases, this
2616 ;; is a lose because there isn't any store instructions which
2617 ;; allow indexed addresses (with integer register source).
2619 ;; These define_splits try to turn a 3 insn store into
2620 ;; a 2 insn store with some creative RTL rewriting.
2622 [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2623 (match_operand:SI 1 "shadd_operand" ""))
2624 (plus:SI (match_operand:SI 2 "register_operand" "")
2625 (match_operand:SI 3 "const_int_operand" ""))))
2626 (match_operand:SI 4 "register_operand" ""))
2627 (clobber (match_operand:SI 5 "register_operand" ""))]
2629 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2631 (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2635 [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2636 (match_operand:SI 1 "shadd_operand" ""))
2637 (plus:SI (match_operand:SI 2 "register_operand" "")
2638 (match_operand:SI 3 "const_int_operand" ""))))
2639 (match_operand:HI 4 "register_operand" ""))
2640 (clobber (match_operand:SI 5 "register_operand" ""))]
2642 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2644 (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2648 [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2649 (match_operand:SI 1 "shadd_operand" ""))
2650 (plus:SI (match_operand:SI 2 "register_operand" "")
2651 (match_operand:SI 3 "const_int_operand" ""))))
2652 (match_operand:QI 4 "register_operand" ""))
2653 (clobber (match_operand:SI 5 "register_operand" ""))]
2655 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2657 (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2660 (define_expand "movhi"
2661 [(set (match_operand:HI 0 "general_operand" "")
2662 (match_operand:HI 1 "general_operand" ""))]
2666 if (emit_move_sequence (operands, HImode, 0))
2671 [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q,*q,!*f")
2672 (match_operand:HI 1 "move_operand" "r,J,N,K,RQ,rM,rM,!*fM"))]
2673 "register_operand (operands[0], HImode)
2674 || reg_or_0_operand (operands[1], HImode)"
2679 {zdepi|depwi,z} %Z1,%0
2684 [(set_attr "type" "move,move,move,shift,load,store,move,fpalu")
2685 (set_attr "pa_combine_type" "addmove")
2686 (set_attr "length" "4,4,4,4,4,4,4,4")])
2689 [(set (match_operand:HI 0 "register_operand" "=r")
2690 (mem:HI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
2691 (match_operand:SI 2 "register_operand" "r"))))]
2692 "! TARGET_DISABLE_INDEXING"
2693 "{ldhx|ldh} %2(%1),%0"
2694 [(set_attr "type" "load")
2695 (set_attr "length" "4")])
2698 [(set (match_operand:HI 0 "register_operand" "=r")
2699 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "r")
2700 (match_operand:SI 2 "basereg_operand" "r"))))]
2701 "! TARGET_DISABLE_INDEXING"
2702 "{ldhx|ldh} %1(%2),%0"
2703 [(set_attr "type" "load")
2704 (set_attr "length" "4")])
2706 ; Now zero extended variants.
2708 [(set (match_operand:SI 0 "register_operand" "=r")
2709 (zero_extend:SI (mem:HI
2711 (match_operand:SI 1 "basereg_operand" "r")
2712 (match_operand:SI 2 "register_operand" "r")))))]
2713 "! TARGET_DISABLE_INDEXING"
2714 "{ldhx|ldh} %2(%1),%0"
2715 [(set_attr "type" "load")
2716 (set_attr "length" "4")])
2719 [(set (match_operand:SI 0 "register_operand" "=r")
2720 (zero_extend:SI (mem:HI
2722 (match_operand:SI 1 "register_operand" "r")
2723 (match_operand:SI 2 "basereg_operand" "r")))))]
2724 "! TARGET_DISABLE_INDEXING"
2725 "{ldhx|ldh} %1(%2),%0"
2726 [(set_attr "type" "load")
2727 (set_attr "length" "4")])
2730 [(set (match_operand:HI 0 "register_operand" "=r")
2731 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2732 (match_operand:SI 2 "int5_operand" "L"))))
2734 (plus:SI (match_dup 1) (match_dup 2)))]
2736 "{ldhs|ldh},mb %2(%1),%0"
2737 [(set_attr "type" "load")
2738 (set_attr "length" "4")])
2740 ; And a zero extended variant.
2742 [(set (match_operand:SI 0 "register_operand" "=r")
2743 (zero_extend:SI (mem:HI
2745 (match_operand:SI 1 "register_operand" "+r")
2746 (match_operand:SI 2 "int5_operand" "L")))))
2748 (plus:SI (match_dup 1) (match_dup 2)))]
2750 "{ldhs|ldh},mb %2(%1),%0"
2751 [(set_attr "type" "load")
2752 (set_attr "length" "4")])
2755 [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2756 (match_operand:SI 1 "int5_operand" "L")))
2757 (match_operand:HI 2 "reg_or_0_operand" "rM"))
2759 (plus:SI (match_dup 0) (match_dup 1)))]
2761 "{sths|sth},mb %r2,%1(%0)"
2762 [(set_attr "type" "store")
2763 (set_attr "length" "4")])
2766 [(set (match_operand:HI 0 "register_operand" "=r")
2767 (plus:HI (match_operand:HI 1 "register_operand" "r")
2768 (match_operand 2 "const_int_operand" "J")))]
2771 [(set_attr "type" "binary")
2772 (set_attr "pa_combine_type" "addmove")
2773 (set_attr "length" "4")])
2775 (define_expand "movqi"
2776 [(set (match_operand:QI 0 "general_operand" "")
2777 (match_operand:QI 1 "general_operand" ""))]
2781 if (emit_move_sequence (operands, QImode, 0))
2786 [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q,*q,!*f")
2787 (match_operand:QI 1 "move_operand" "r,J,N,K,RQ,rM,rM,!*fM"))]
2788 "register_operand (operands[0], QImode)
2789 || reg_or_0_operand (operands[1], QImode)"
2794 {zdepi|depwi,z} %Z1,%0
2799 [(set_attr "type" "move,move,move,shift,load,store,move,fpalu")
2800 (set_attr "pa_combine_type" "addmove")
2801 (set_attr "length" "4,4,4,4,4,4,4,4")])
2804 [(set (match_operand:QI 0 "register_operand" "=r")
2805 (mem:QI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
2806 (match_operand:SI 2 "register_operand" "r"))))]
2807 "! TARGET_DISABLE_INDEXING"
2808 "{ldbx|ldb} %2(%1),%0"
2809 [(set_attr "type" "load")
2810 (set_attr "length" "4")])
2813 [(set (match_operand:QI 0 "register_operand" "=r")
2814 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "r")
2815 (match_operand:SI 2 "basereg_operand" "r"))))]
2816 "! TARGET_DISABLE_INDEXING"
2817 "{ldbx|ldb} %1(%2),%0"
2818 [(set_attr "type" "load")
2819 (set_attr "length" "4")])
2821 ; Indexed byte load with zero extension to SImode or HImode.
2823 [(set (match_operand:SI 0 "register_operand" "=r")
2824 (zero_extend:SI (mem:QI
2826 (match_operand:SI 1 "basereg_operand" "r")
2827 (match_operand:SI 2 "register_operand" "r")))))]
2828 "! TARGET_DISABLE_INDEXING"
2829 "{ldbx|ldb} %2(%1),%0"
2830 [(set_attr "type" "load")
2831 (set_attr "length" "4")])
2834 [(set (match_operand:SI 0 "register_operand" "=r")
2835 (zero_extend:SI (mem:QI
2837 (match_operand:SI 1 "register_operand" "r")
2838 (match_operand:SI 2 "basereg_operand" "r")))))]
2839 "! TARGET_DISABLE_INDEXING"
2840 "{ldbx|ldb} %1(%2),%0"
2841 [(set_attr "type" "load")
2842 (set_attr "length" "4")])
2845 [(set (match_operand:HI 0 "register_operand" "=r")
2846 (zero_extend:HI (mem:QI
2848 (match_operand:SI 1 "basereg_operand" "r")
2849 (match_operand:SI 2 "register_operand" "r")))))]
2850 "! TARGET_DISABLE_INDEXING"
2851 "{ldbx|ldb} %2(%1),%0"
2852 [(set_attr "type" "load")
2853 (set_attr "length" "4")])
2856 [(set (match_operand:HI 0 "register_operand" "=r")
2857 (zero_extend:HI (mem:QI
2859 (match_operand:SI 1 "register_operand" "r")
2860 (match_operand:SI 2 "basereg_operand" "r")))))]
2861 "! TARGET_DISABLE_INDEXING"
2862 "{ldbx|ldb} %1(%2),%0"
2863 [(set_attr "type" "load")
2864 (set_attr "length" "4")])
2867 [(set (match_operand:QI 0 "register_operand" "=r")
2868 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2869 (match_operand:SI 2 "int5_operand" "L"))))
2870 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
2872 "{ldbs|ldb},mb %2(%1),%0"
2873 [(set_attr "type" "load")
2874 (set_attr "length" "4")])
2876 ; Now the same thing with zero extensions.
2878 [(set (match_operand:SI 0 "register_operand" "=r")
2879 (zero_extend:SI (mem:QI (plus:SI
2880 (match_operand:SI 1 "register_operand" "+r")
2881 (match_operand:SI 2 "int5_operand" "L")))))
2882 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
2884 "{ldbs|ldb},mb %2(%1),%0"
2885 [(set_attr "type" "load")
2886 (set_attr "length" "4")])
2889 [(set (match_operand:HI 0 "register_operand" "=r")
2890 (zero_extend:HI (mem:QI (plus:SI
2891 (match_operand:SI 1 "register_operand" "+r")
2892 (match_operand:SI 2 "int5_operand" "L")))))
2893 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
2895 "{ldbs|ldb},mb %2(%1),%0"
2896 [(set_attr "type" "load")
2897 (set_attr "length" "4")])
2900 [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2901 (match_operand:SI 1 "int5_operand" "L")))
2902 (match_operand:QI 2 "reg_or_0_operand" "rM"))
2904 (plus:SI (match_dup 0) (match_dup 1)))]
2906 "{stbs|stb},mb %r2,%1(%0)"
2907 [(set_attr "type" "store")
2908 (set_attr "length" "4")])
2910 ;; The definition of this insn does not really explain what it does,
2911 ;; but it should suffice
2912 ;; that anything generated as this insn will be recognized as one
2913 ;; and that it will not successfully combine with anything.
2914 (define_expand "movstrsi"
2915 [(parallel [(set (match_operand:BLK 0 "" "")
2916 (match_operand:BLK 1 "" ""))
2917 (clobber (match_dup 7))
2918 (clobber (match_dup 8))
2919 (clobber (match_dup 4))
2920 (clobber (match_dup 5))
2921 (clobber (match_dup 6))
2922 (use (match_operand:SI 2 "arith_operand" ""))
2923 (use (match_operand:SI 3 "const_int_operand" ""))])]
2929 /* HP provides very fast block move library routine for the PA;
2930 this routine includes:
2932 4x4 byte at a time block moves,
2933 1x4 byte at a time with alignment checked at runtime with
2934 attempts to align the source and destination as needed
2937 With that in mind, here's the heuristics to try and guess when
2938 the inlined block move will be better than the library block
2941 If the size isn't constant, then always use the library routines.
2943 If the size is large in respect to the known alignment, then use
2944 the library routines.
2946 If the size is small in repsect to the known alignment, then open
2947 code the copy (since that will lead to better scheduling).
2949 Else use the block move pattern. */
2951 /* Undetermined size, use the library routine. */
2952 if (GET_CODE (operands[2]) != CONST_INT)
2955 size = INTVAL (operands[2]);
2956 align = INTVAL (operands[3]);
2957 align = align > 4 ? 4 : align;
2959 /* If size/alignment > 8 (eg size is large in respect to alignment),
2960 then use the library routines. */
2961 if (size / align > 16)
2964 /* This does happen, but not often enough to worry much about. */
2965 if (size / align < MOVE_RATIO)
2968 /* Fall through means we're going to use our block move pattern. */
2970 = replace_equiv_address (operands[0],
2971 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
2973 = replace_equiv_address (operands[1],
2974 copy_to_mode_reg (SImode, XEXP (operands[1], 0)));
2975 operands[4] = gen_reg_rtx (SImode);
2976 operands[5] = gen_reg_rtx (SImode);
2977 operands[6] = gen_reg_rtx (SImode);
2978 operands[7] = XEXP (operands[0], 0);
2979 operands[8] = XEXP (operands[1], 0);
2982 ;; The operand constraints are written like this to support both compile-time
2983 ;; and run-time determined byte count. If the count is run-time determined,
2984 ;; the register with the byte count is clobbered by the copying code, and
2985 ;; therefore it is forced to operand 2. If the count is compile-time
2986 ;; determined, we need two scratch registers for the unrolled code.
2987 (define_insn "movstrsi_internal"
2988 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
2989 (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
2990 (clobber (match_dup 0))
2991 (clobber (match_dup 1))
2992 (clobber (match_operand:SI 2 "register_operand" "=r,r")) ;loop cnt/tmp
2993 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp
2994 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
2995 (use (match_operand:SI 4 "arith_operand" "J,2")) ;byte count
2996 (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
2998 "* return output_block_move (operands, !which_alternative);"
2999 [(set_attr "type" "multi,multi")])
3001 ;; Floating point move insns
3003 ;; This pattern forces (set (reg:DF ...) (const_double ...))
3004 ;; to be reloaded by putting the constant into memory when
3005 ;; reg is a floating point register.
3007 ;; For integer registers we use ldil;ldo to set the appropriate
3010 ;; This must come before the movdf pattern, and it must be present
3011 ;; to handle obscure reloading cases.
3013 [(set (match_operand:DF 0 "register_operand" "=?r,f")
3014 (match_operand:DF 1 "" "?F,m"))]
3015 "GET_CODE (operands[1]) == CONST_DOUBLE
3016 && operands[1] != CONST0_RTX (DFmode)
3018 && ! TARGET_SOFT_FLOAT"
3019 "* return (which_alternative == 0 ? output_move_double (operands)
3020 : \"fldd%F1 %1,%0\");"
3021 [(set_attr "type" "move,fpload")
3022 (set_attr "length" "16,4")])
3024 (define_expand "movdf"
3025 [(set (match_operand:DF 0 "general_operand" "")
3026 (match_operand:DF 1 "general_operand" ""))]
3030 if (GET_CODE (operands[1]) == CONST_DOUBLE && TARGET_64BIT)
3031 operands[1] = force_const_mem (DFmode, operands[1]);
3033 if (emit_move_sequence (operands, DFmode, 0))
3037 ;; Reloading an SImode or DImode value requires a scratch register if
3038 ;; going in to or out of float point registers.
3040 (define_expand "reload_indf"
3041 [(set (match_operand:DF 0 "register_operand" "=Z")
3042 (match_operand:DF 1 "non_hard_reg_operand" ""))
3043 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3047 if (emit_move_sequence (operands, DFmode, operands[2]))
3050 /* We don't want the clobber emitted, so handle this ourselves. */
3051 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3055 (define_expand "reload_outdf"
3056 [(set (match_operand:DF 0 "non_hard_reg_operand" "")
3057 (match_operand:DF 1 "register_operand" "Z"))
3058 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3062 if (emit_move_sequence (operands, DFmode, operands[2]))
3065 /* We don't want the clobber emitted, so handle this ourselves. */
3066 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3071 [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
3072 "=f,*r,RQ,?o,?Q,f,*r,*r")
3073 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3074 "fG,*rG,f,*r,*r,RQ,o,RQ"))]
3075 "(register_operand (operands[0], DFmode)
3076 || reg_or_0_operand (operands[1], DFmode))
3077 && ! (GET_CODE (operands[1]) == CONST_DOUBLE
3078 && GET_CODE (operands[0]) == MEM)
3080 && ! TARGET_SOFT_FLOAT"
3083 if (FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3084 || operands[1] == CONST0_RTX (DFmode))
3085 return output_fp_move_double (operands);
3086 return output_move_double (operands);
3088 [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load")
3089 (set_attr "length" "4,8,4,8,16,4,8,16")])
3092 [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
3094 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3096 "(register_operand (operands[0], DFmode)
3097 || reg_or_0_operand (operands[1], DFmode))
3099 && TARGET_SOFT_FLOAT"
3102 return output_move_double (operands);
3104 [(set_attr "type" "move,store,store,load,load")
3105 (set_attr "length" "8,8,16,8,16")])
3108 [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
3109 "=r,r,r,r,r,Q,*q,!f,f,*TR")
3110 (match_operand:DF 1 "move_operand"
3111 "r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
3112 "(register_operand (operands[0], DFmode)
3113 || reg_or_0_operand (operands[1], DFmode))
3114 && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
3126 [(set_attr "type" "move,move,move,shift,load,store,move,fpalu,fpload,fpstore")
3127 (set_attr "pa_combine_type" "addmove")
3128 (set_attr "length" "4,4,4,4,4,4,4,4,4,4")])
3131 [(set (match_operand:DF 0 "register_operand" "=fx")
3132 (mem:DF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3133 (match_operand:SI 2 "register_operand" "r"))))]
3134 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3135 "{flddx|fldd} %2(%1),%0"
3136 [(set_attr "type" "fpload")
3137 (set_attr "length" "4")])
3140 [(set (match_operand:DF 0 "register_operand" "=fx")
3141 (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "r")
3142 (match_operand:SI 2 "basereg_operand" "r"))))]
3143 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3144 "{flddx|fldd} %1(%2),%0"
3145 [(set_attr "type" "fpload")
3146 (set_attr "length" "4")])
3149 [(set (mem:DF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3150 (match_operand:SI 2 "register_operand" "r")))
3151 (match_operand:DF 0 "register_operand" "fx"))]
3152 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3153 "{fstdx|fstd} %0,%2(%1)"
3154 [(set_attr "type" "fpstore")
3155 (set_attr "length" "4")])
3158 [(set (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "r")
3159 (match_operand:SI 2 "basereg_operand" "r")))
3160 (match_operand:DF 0 "register_operand" "fx"))]
3161 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3162 "{fstdx|fstd} %0,%1(%2)"
3163 [(set_attr "type" "fpstore")
3164 (set_attr "length" "4")])
3166 (define_expand "movdi"
3167 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "")
3168 (match_operand:DI 1 "general_operand" ""))]
3172 if (GET_CODE (operands[1]) == CONST_DOUBLE && TARGET_64BIT)
3173 operands[1] = force_const_mem (DImode, operands[1]);
3175 if (emit_move_sequence (operands, DImode, 0))
3179 (define_expand "reload_indi"
3180 [(set (match_operand:DI 0 "register_operand" "=Z")
3181 (match_operand:DI 1 "non_hard_reg_operand" ""))
3182 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
3186 if (emit_move_sequence (operands, DImode, operands[2]))
3189 /* We don't want the clobber emitted, so handle this ourselves. */
3190 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3194 (define_expand "reload_outdi"
3195 [(set (match_operand:DI 0 "non_hard_reg_operand" "")
3196 (match_operand:DI 1 "register_operand" "Z"))
3197 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
3201 if (emit_move_sequence (operands, DImode, operands[2]))
3204 /* We don't want the clobber emitted, so handle this ourselves. */
3205 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3210 [(set (match_operand:DI 0 "register_operand" "=r")
3211 (high:DI (match_operand 1 "" "")))]
3215 rtx op0 = operands[0];
3216 rtx op1 = operands[1];
3218 if (GET_CODE (op1) == CONST_INT)
3220 operands[0] = operand_subword (op0, 1, 0, DImode);
3221 output_asm_insn (\"ldil L'%1,%0\", operands);
3223 operands[0] = operand_subword (op0, 0, 0, DImode);
3224 if (INTVAL (op1) < 0)
3225 output_asm_insn (\"ldi -1,%0\", operands);
3227 output_asm_insn (\"ldi 0,%0\", operands);
3230 else if (GET_CODE (op1) == CONST_DOUBLE)
3232 operands[0] = operand_subword (op0, 1, 0, DImode);
3233 operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
3234 output_asm_insn (\"ldil L'%1,%0\", operands);
3236 operands[0] = operand_subword (op0, 0, 0, DImode);
3237 operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
3238 output_asm_insn (singlemove_string (operands), operands);
3244 [(set_attr "type" "move")
3245 (set_attr "length" "8")])
3248 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
3249 "=r,o,Q,r,r,r,f,f,*TR")
3250 (match_operand:DI 1 "general_operand"
3251 "rM,r,r,o*R,Q,i,fM,*TR,f"))]
3252 "(register_operand (operands[0], DImode)
3253 || reg_or_0_operand (operands[1], DImode))
3255 && ! TARGET_SOFT_FLOAT"
3258 if (FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3259 || (operands[1] == CONST0_RTX (DImode)))
3260 return output_fp_move_double (operands);
3261 return output_move_double (operands);
3263 [(set_attr "type" "move,store,store,load,load,multi,fpalu,fpload,fpstore")
3264 (set_attr "length" "8,8,16,8,16,16,4,4,4")])
3267 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
3268 "=r,r,r,r,r,r,Q,*q,!f,f,*TR")
3269 (match_operand:DI 1 "move_operand"
3270 "A,r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
3271 "(register_operand (operands[0], DImode)
3272 || reg_or_0_operand (operands[1], DImode))
3273 && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
3286 [(set_attr "type" "load,move,move,move,shift,load,store,move,fpalu,fpload,fpstore")
3287 (set_attr "pa_combine_type" "addmove")
3288 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4")])
3291 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
3293 (match_operand:DI 1 "general_operand"
3295 "(register_operand (operands[0], DImode)
3296 || reg_or_0_operand (operands[1], DImode))
3298 && TARGET_SOFT_FLOAT"
3301 return output_move_double (operands);
3303 [(set_attr "type" "move,store,store,load,load,multi")
3304 (set_attr "length" "8,8,16,8,16,16")])
3307 [(set (match_operand:DI 0 "register_operand" "=r,&r")
3308 (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
3309 (match_operand:DI 2 "immediate_operand" "i,i")))]
3313 /* Don't output a 64 bit constant, since we can't trust the assembler to
3314 handle it correctly. */
3315 if (GET_CODE (operands[2]) == CONST_DOUBLE)
3316 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
3317 if (which_alternative == 1)
3318 output_asm_insn (\"copy %1,%0\", operands);
3319 return \"ldo R'%G2(%R1),%R0\";
3321 [(set_attr "type" "move,move")
3322 (set_attr "length" "4,8")])
3324 ;; This pattern forces (set (reg:SF ...) (const_double ...))
3325 ;; to be reloaded by putting the constant into memory when
3326 ;; reg is a floating point register.
3328 ;; For integer registers we use ldil;ldo to set the appropriate
3331 ;; This must come before the movsf pattern, and it must be present
3332 ;; to handle obscure reloading cases.
3334 [(set (match_operand:SF 0 "register_operand" "=?r,f")
3335 (match_operand:SF 1 "" "?F,m"))]
3336 "GET_CODE (operands[1]) == CONST_DOUBLE
3337 && operands[1] != CONST0_RTX (SFmode)
3338 && ! TARGET_SOFT_FLOAT"
3339 "* return (which_alternative == 0 ? singlemove_string (operands)
3340 : \" fldw%F1 %1,%0\");"
3341 [(set_attr "type" "move,fpload")
3342 (set_attr "length" "8,4")])
3344 (define_expand "movsf"
3345 [(set (match_operand:SF 0 "general_operand" "")
3346 (match_operand:SF 1 "general_operand" ""))]
3350 if (emit_move_sequence (operands, SFmode, 0))
3354 ;; Reloading an SImode or DImode value requires a scratch register if
3355 ;; going in to or out of float point registers.
3357 (define_expand "reload_insf"
3358 [(set (match_operand:SF 0 "register_operand" "=Z")
3359 (match_operand:SF 1 "non_hard_reg_operand" ""))
3360 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
3364 if (emit_move_sequence (operands, SFmode, operands[2]))
3367 /* We don't want the clobber emitted, so handle this ourselves. */
3368 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3372 (define_expand "reload_outsf"
3373 [(set (match_operand:SF 0 "non_hard_reg_operand" "")
3374 (match_operand:SF 1 "register_operand" "Z"))
3375 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
3379 if (emit_move_sequence (operands, SFmode, operands[2]))
3382 /* We don't want the clobber emitted, so handle this ourselves. */
3383 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3388 [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand"
3390 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
3391 "fG,rG,RQ,RQ,f,rG"))]
3392 "(register_operand (operands[0], SFmode)
3393 || reg_or_0_operand (operands[1], SFmode))
3394 && ! TARGET_SOFT_FLOAT"
3402 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
3403 (set_attr "pa_combine_type" "addmove")
3404 (set_attr "length" "4,4,4,4,4,4")])
3407 [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand"
3409 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
3411 "(register_operand (operands[0], SFmode)
3412 || reg_or_0_operand (operands[1], SFmode))
3413 && TARGET_SOFT_FLOAT"
3418 [(set_attr "type" "move,load,store")
3419 (set_attr "pa_combine_type" "addmove")
3420 (set_attr "length" "4,4,4")])
3423 [(set (match_operand:SF 0 "register_operand" "=fx")
3424 (mem:SF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3425 (match_operand:SI 2 "register_operand" "r"))))]
3426 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3427 "{fldwx|fldw} %2(%1),%0"
3428 [(set_attr "type" "fpload")
3429 (set_attr "length" "4")])
3432 [(set (match_operand:SF 0 "register_operand" "=fx")
3433 (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "r")
3434 (match_operand:SI 2 "basereg_operand" "r"))))]
3435 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3436 "{fldwx|fldw} %1(%2),%0"
3437 [(set_attr "type" "fpload")
3438 (set_attr "length" "4")])
3441 [(set (mem:SF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
3442 (match_operand:SI 2 "register_operand" "r")))
3443 (match_operand:SF 0 "register_operand" "fx"))]
3444 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3445 "{fstwx|fstw} %0,%2(%1)"
3446 [(set_attr "type" "fpstore")
3447 (set_attr "length" "4")])
3450 [(set (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "r")
3451 (match_operand:SI 2 "basereg_operand" "r")))
3452 (match_operand:SF 0 "register_operand" "fx"))]
3453 "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
3454 "{fstwx|fstw} %0,%1(%2)"
3455 [(set_attr "type" "fpstore")
3456 (set_attr "length" "4")])
3459 ;;- zero extension instructions
3460 ;; We have define_expand for zero extension patterns to make sure the
3461 ;; operands get loaded into registers. The define_insns accept
3462 ;; memory operands. This gives us better overall code than just
3463 ;; having a pattern that does or does not accept memory operands.
3465 (define_expand "zero_extendhisi2"
3466 [(set (match_operand:SI 0 "register_operand" "")
3468 (match_operand:HI 1 "register_operand" "")))]
3473 [(set (match_operand:SI 0 "register_operand" "=r,r")
3475 (match_operand:HI 1 "move_operand" "r,RQ")))]
3476 "GET_CODE (operands[1]) != CONST_INT"
3478 {extru|extrw,u} %1,31,16,%0
3480 [(set_attr "type" "shift,load")
3481 (set_attr "length" "4,4")])
3483 (define_expand "zero_extendqihi2"
3484 [(set (match_operand:HI 0 "register_operand" "")
3486 (match_operand:QI 1 "register_operand" "")))]
3491 [(set (match_operand:HI 0 "register_operand" "=r,r")
3493 (match_operand:QI 1 "move_operand" "r,RQ")))]
3494 "GET_CODE (operands[1]) != CONST_INT"
3496 {extru|extrw,u} %1,31,8,%0
3498 [(set_attr "type" "shift,load")
3499 (set_attr "length" "4,4")])
3501 (define_expand "zero_extendqisi2"
3502 [(set (match_operand:SI 0 "register_operand" "")
3504 (match_operand:QI 1 "register_operand" "")))]
3509 [(set (match_operand:SI 0 "register_operand" "=r,r")
3511 (match_operand:QI 1 "move_operand" "r,RQ")))]
3512 "GET_CODE (operands[1]) != CONST_INT"
3514 {extru|extrw,u} %1,31,8,%0
3516 [(set_attr "type" "shift,load")
3517 (set_attr "length" "4,4")])
3519 (define_insn "zero_extendqidi2"
3520 [(set (match_operand:DI 0 "register_operand" "=r")
3521 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
3523 "extrd,u %1,63,8,%0"
3524 [(set_attr "type" "shift")
3525 (set_attr "length" "4")])
3527 (define_insn "zero_extendhidi2"
3528 [(set (match_operand:DI 0 "register_operand" "=r")
3529 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
3531 "extrd,u %1,63,16,%0"
3532 [(set_attr "type" "shift")
3533 (set_attr "length" "4")])
3535 (define_insn "zero_extendsidi2"
3536 [(set (match_operand:DI 0 "register_operand" "=r")
3537 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
3539 "extrd,u %1,63,32,%0"
3540 [(set_attr "type" "shift")
3541 (set_attr "length" "4")])
3543 ;;- sign extension instructions
3545 (define_insn "extendhisi2"
3546 [(set (match_operand:SI 0 "register_operand" "=r")
3547 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
3549 "{extrs|extrw,s} %1,31,16,%0"
3550 [(set_attr "type" "shift")
3551 (set_attr "length" "4")])
3553 (define_insn "extendqihi2"
3554 [(set (match_operand:HI 0 "register_operand" "=r")
3555 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
3557 "{extrs|extrw,s} %1,31,8,%0"
3558 [(set_attr "type" "shift")
3559 (set_attr "length" "4")])
3561 (define_insn "extendqisi2"
3562 [(set (match_operand:SI 0 "register_operand" "=r")
3563 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
3565 "{extrs|extrw,s} %1,31,8,%0"
3566 [(set_attr "type" "shift")
3567 (set_attr "length" "4")])
3569 (define_insn "extendqidi2"
3570 [(set (match_operand:DI 0 "register_operand" "=r")
3571 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
3573 "extrd,s %1,63,8,%0"
3574 [(set_attr "type" "shift")
3575 (set_attr "length" "4")])
3577 (define_insn "extendhidi2"
3578 [(set (match_operand:DI 0 "register_operand" "=r")
3579 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
3581 "extrd,s %1,63,16,%0"
3582 [(set_attr "type" "shift")
3583 (set_attr "length" "4")])
3585 (define_insn "extendsidi2"
3586 [(set (match_operand:DI 0 "register_operand" "=r")
3587 (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))]
3589 "extrd,s %1,63,32,%0"
3590 [(set_attr "type" "shift")
3591 (set_attr "length" "4")])
3594 ;; Conversions between float and double.
3596 (define_insn "extendsfdf2"
3597 [(set (match_operand:DF 0 "register_operand" "=f")
3599 (match_operand:SF 1 "register_operand" "f")))]
3600 "! TARGET_SOFT_FLOAT"
3601 "{fcnvff|fcnv},sgl,dbl %1,%0"
3602 [(set_attr "type" "fpalu")
3603 (set_attr "length" "4")])
3605 (define_insn "truncdfsf2"
3606 [(set (match_operand:SF 0 "register_operand" "=f")
3608 (match_operand:DF 1 "register_operand" "f")))]
3609 "! TARGET_SOFT_FLOAT"
3610 "{fcnvff|fcnv},dbl,sgl %1,%0"
3611 [(set_attr "type" "fpalu")
3612 (set_attr "length" "4")])
3614 ;; Conversion between fixed point and floating point.
3615 ;; Note that among the fix-to-float insns
3616 ;; the ones that start with SImode come first.
3617 ;; That is so that an operand that is a CONST_INT
3618 ;; (and therefore lacks a specific machine mode).
3619 ;; will be recognized as SImode (which is always valid)
3620 ;; rather than as QImode or HImode.
3622 ;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
3623 ;; to be reloaded by putting the constant into memory.
3624 ;; It must come before the more general floatsisf2 pattern.
3626 [(set (match_operand:SF 0 "register_operand" "=f")
3627 (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
3628 "! TARGET_SOFT_FLOAT"
3629 "fldw%F1 %1,%0\;{fcnvxf,sgl,sgl|fcnv,w,sgl} %0,%0"
3630 [(set_attr "type" "fpalu")
3631 (set_attr "length" "8")])
3633 (define_insn "floatsisf2"
3634 [(set (match_operand:SF 0 "register_operand" "=f")
3635 (float:SF (match_operand:SI 1 "register_operand" "f")))]
3636 "! TARGET_SOFT_FLOAT"
3637 "{fcnvxf,sgl,sgl|fcnv,w,sgl} %1,%0"
3638 [(set_attr "type" "fpalu")
3639 (set_attr "length" "4")])
3641 ;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
3642 ;; to be reloaded by putting the constant into memory.
3643 ;; It must come before the more general floatsidf2 pattern.
3645 [(set (match_operand:DF 0 "register_operand" "=f")
3646 (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
3647 "! TARGET_SOFT_FLOAT"
3648 "fldw%F1 %1,%0\;{fcnvxf,sgl,dbl|fcnv,w,dbl} %0,%0"
3649 [(set_attr "type" "fpalu")
3650 (set_attr "length" "8")])
3652 (define_insn "floatsidf2"
3653 [(set (match_operand:DF 0 "register_operand" "=f")
3654 (float:DF (match_operand:SI 1 "register_operand" "f")))]
3655 "! TARGET_SOFT_FLOAT"
3656 "{fcnvxf,sgl,dbl|fcnv,w,dbl} %1,%0"
3657 [(set_attr "type" "fpalu")
3658 (set_attr "length" "4")])
3660 (define_expand "floatunssisf2"
3661 [(set (subreg:SI (match_dup 2) 4)
3662 (match_operand:SI 1 "register_operand" ""))
3663 (set (subreg:SI (match_dup 2) 0)
3665 (set (match_operand:SF 0 "register_operand" "")
3666 (float:SF (match_dup 2)))]
3667 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3672 emit_insn (gen_floatunssisf2_pa20 (operands[0], operands[1]));
3675 operands[2] = gen_reg_rtx (DImode);
3678 (define_expand "floatunssidf2"
3679 [(set (subreg:SI (match_dup 2) 4)
3680 (match_operand:SI 1 "register_operand" ""))
3681 (set (subreg:SI (match_dup 2) 0)
3683 (set (match_operand:DF 0 "register_operand" "")
3684 (float:DF (match_dup 2)))]
3685 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3690 emit_insn (gen_floatunssidf2_pa20 (operands[0], operands[1]));
3693 operands[2] = gen_reg_rtx (DImode);
3696 (define_insn "floatdisf2"
3697 [(set (match_operand:SF 0 "register_operand" "=f")
3698 (float:SF (match_operand:DI 1 "register_operand" "f")))]
3699 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3700 "{fcnvxf,dbl,sgl|fcnv,dw,sgl} %1,%0"
3701 [(set_attr "type" "fpalu")
3702 (set_attr "length" "4")])
3704 (define_insn "floatdidf2"
3705 [(set (match_operand:DF 0 "register_operand" "=f")
3706 (float:DF (match_operand:DI 1 "register_operand" "f")))]
3707 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3708 "{fcnvxf,dbl,dbl|fcnv,dw,dbl} %1,%0"
3709 [(set_attr "type" "fpalu")
3710 (set_attr "length" "4")])
3712 ;; Convert a float to an actual integer.
3713 ;; Truncation is performed as part of the conversion.
3715 (define_insn "fix_truncsfsi2"
3716 [(set (match_operand:SI 0 "register_operand" "=f")
3717 (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3718 "! TARGET_SOFT_FLOAT"
3719 "{fcnvfxt,sgl,sgl|fcnv,t,sgl,w} %1,%0"
3720 [(set_attr "type" "fpalu")
3721 (set_attr "length" "4")])
3723 (define_insn "fix_truncdfsi2"
3724 [(set (match_operand:SI 0 "register_operand" "=f")
3725 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3726 "! TARGET_SOFT_FLOAT"
3727 "{fcnvfxt,dbl,sgl|fcnv,t,dbl,w} %1,%0"
3728 [(set_attr "type" "fpalu")
3729 (set_attr "length" "4")])
3731 (define_insn "fix_truncsfdi2"
3732 [(set (match_operand:DI 0 "register_operand" "=f")
3733 (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3734 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3735 "{fcnvfxt,sgl,dbl|fcnv,t,sgl,dw} %1,%0"
3736 [(set_attr "type" "fpalu")
3737 (set_attr "length" "4")])
3739 (define_insn "fix_truncdfdi2"
3740 [(set (match_operand:DI 0 "register_operand" "=f")
3741 (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3742 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
3743 "{fcnvfxt,dbl,dbl|fcnv,t,dbl,dw} %1,%0"
3744 [(set_attr "type" "fpalu")
3745 (set_attr "length" "4")])
3747 (define_insn "floatunssidf2_pa20"
3748 [(set (match_operand:DF 0 "register_operand" "=f")
3749 (unsigned_float:DF (match_operand:SI 1 "register_operand" "f")))]
3750 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3752 [(set_attr "type" "fpalu")
3753 (set_attr "length" "4")])
3755 (define_insn "floatunssisf2_pa20"
3756 [(set (match_operand:SF 0 "register_operand" "=f")
3757 (unsigned_float:SF (match_operand:SI 1 "register_operand" "f")))]
3758 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3760 [(set_attr "type" "fpalu")
3761 (set_attr "length" "4")])
3763 (define_insn "floatunsdisf2"
3764 [(set (match_operand:SF 0 "register_operand" "=f")
3765 (unsigned_float:SF (match_operand:DI 1 "register_operand" "f")))]
3766 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3767 "fcnv,udw,sgl %1,%0"
3768 [(set_attr "type" "fpalu")
3769 (set_attr "length" "4")])
3771 (define_insn "floatunsdidf2"
3772 [(set (match_operand:DF 0 "register_operand" "=f")
3773 (unsigned_float:DF (match_operand:DI 1 "register_operand" "f")))]
3774 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3775 "fcnv,udw,dbl %1,%0"
3776 [(set_attr "type" "fpalu")
3777 (set_attr "length" "4")])
3779 (define_insn "fixuns_truncsfsi2"
3780 [(set (match_operand:SI 0 "register_operand" "=f")
3781 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3782 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3783 "fcnv,t,sgl,uw %1,%0"
3784 [(set_attr "type" "fpalu")
3785 (set_attr "length" "4")])
3787 (define_insn "fixuns_truncdfsi2"
3788 [(set (match_operand:SI 0 "register_operand" "=f")
3789 (unsigned_fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3790 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3791 "fcnv,t,dbl,uw %1,%0"
3792 [(set_attr "type" "fpalu")
3793 (set_attr "length" "4")])
3795 (define_insn "fixuns_truncsfdi2"
3796 [(set (match_operand:DI 0 "register_operand" "=f")
3797 (unsigned_fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
3798 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3799 "fcnv,t,sgl,udw %1,%0"
3800 [(set_attr "type" "fpalu")
3801 (set_attr "length" "4")])
3803 (define_insn "fixuns_truncdfdi2"
3804 [(set (match_operand:DI 0 "register_operand" "=f")
3805 (unsigned_fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
3806 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
3807 "fcnv,t,dbl,udw %1,%0"
3808 [(set_attr "type" "fpalu")
3809 (set_attr "length" "4")])
3811 ;;- arithmetic instructions
3813 (define_expand "adddi3"
3814 [(set (match_operand:DI 0 "register_operand" "")
3815 (plus:DI (match_operand:DI 1 "register_operand" "")
3816 (match_operand:DI 2 "arith_operand" "")))]
3821 && GET_CODE (operands[2]) == CONST_INT
3822 && !VAL_11_BITS_P (INTVAL (operands[2])))
3823 operands[2] = force_reg (DImode, operands[2]);
3827 [(set (match_operand:DI 0 "register_operand" "=r")
3828 (plus:DI (match_operand:DI 1 "register_operand" "%r")
3829 (match_operand:DI 2 "arith11_operand" "rI")))]
3833 if (GET_CODE (operands[2]) == CONST_INT)
3835 if (INTVAL (operands[2]) >= 0)
3836 return \"addi %2,%R1,%R0\;{addc|add,c} %1,%%r0,%0\";
3838 return \"addi %2,%R1,%R0\;{subb|sub,b} %1,%%r0,%0\";
3841 return \"add %R2,%R1,%R0\;{addc|add,c} %2,%1,%0\";
3843 [(set_attr "type" "binary")
3844 (set_attr "length" "8")])
3847 [(set (match_operand:DI 0 "register_operand" "=r,r")
3848 (plus:DI (match_operand:DI 1 "register_operand" "%r,r")
3849 (match_operand:DI 2 "arith_operand" "r,J")))]
3852 {addl|add,l} %1,%2,%0
3854 [(set_attr "type" "binary,binary")
3855 (set_attr "pa_combine_type" "addmove")
3856 (set_attr "length" "4,4")])
3859 [(set (match_operand:DI 0 "register_operand" "=r")
3860 (plus:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
3861 (match_operand:DI 2 "register_operand" "r")))]
3864 [(set_attr "type" "binary")
3865 (set_attr "length" "4")])
3868 [(set (match_operand:SI 0 "register_operand" "=r")
3869 (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
3870 (match_operand:SI 2 "register_operand" "r")))]
3873 [(set_attr "type" "binary")
3874 (set_attr "length" "4")])
3876 ;; define_splits to optimize cases of adding a constant integer
3877 ;; to a register when the constant does not fit in 14 bits. */
3879 [(set (match_operand:SI 0 "register_operand" "")
3880 (plus:SI (match_operand:SI 1 "register_operand" "")
3881 (match_operand:SI 2 "const_int_operand" "")))
3882 (clobber (match_operand:SI 4 "register_operand" ""))]
3883 "! cint_ok_for_move (INTVAL (operands[2]))
3884 && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
3885 [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
3886 (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
3889 int val = INTVAL (operands[2]);
3890 int low = (val < 0) ? -0x2000 : 0x1fff;
3891 int rest = val - low;
3893 operands[2] = GEN_INT (rest);
3894 operands[3] = GEN_INT (low);
3898 [(set (match_operand:SI 0 "register_operand" "")
3899 (plus:SI (match_operand:SI 1 "register_operand" "")
3900 (match_operand:SI 2 "const_int_operand" "")))
3901 (clobber (match_operand:SI 4 "register_operand" ""))]
3902 "! cint_ok_for_move (INTVAL (operands[2]))"
3903 [(set (match_dup 4) (match_dup 2))
3904 (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
3908 HOST_WIDE_INT intval = INTVAL (operands[2]);
3910 /* Try dividing the constant by 2, then 4, and finally 8 to see
3911 if we can get a constant which can be loaded into a register
3912 in a single instruction (cint_ok_for_move).
3914 If that fails, try to negate the constant and subtract it
3915 from our input operand. */
3916 if (intval % 2 == 0 && cint_ok_for_move (intval / 2))
3918 operands[2] = GEN_INT (intval / 2);
3919 operands[3] = GEN_INT (2);
3921 else if (intval % 4 == 0 && cint_ok_for_move (intval / 4))
3923 operands[2] = GEN_INT (intval / 4);
3924 operands[3] = GEN_INT (4);
3926 else if (intval % 8 == 0 && cint_ok_for_move (intval / 8))
3928 operands[2] = GEN_INT (intval / 8);
3929 operands[3] = GEN_INT (8);
3931 else if (cint_ok_for_move (-intval))
3933 emit_insn (gen_rtx_SET (VOIDmode, operands[4], GEN_INT (-intval)));
3934 emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
3941 (define_insn "addsi3"
3942 [(set (match_operand:SI 0 "register_operand" "=r,r")
3943 (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
3944 (match_operand:SI 2 "arith_operand" "r,J")))]
3947 {addl|add,l} %1,%2,%0
3949 [(set_attr "type" "binary,binary")
3950 (set_attr "pa_combine_type" "addmove")
3951 (set_attr "length" "4,4")])
3953 (define_expand "subdi3"
3954 [(set (match_operand:DI 0 "register_operand" "")
3955 (minus:DI (match_operand:DI 1 "register_operand" "")
3956 (match_operand:DI 2 "register_operand" "")))]
3961 [(set (match_operand:DI 0 "register_operand" "=r")
3962 (minus:DI (match_operand:DI 1 "register_operand" "r")
3963 (match_operand:DI 2 "register_operand" "r")))]
3965 "sub %R1,%R2,%R0\;{subb|sub,b} %1,%2,%0"
3966 [(set_attr "type" "binary")
3967 (set_attr "length" "8")])
3970 [(set (match_operand:DI 0 "register_operand" "=r,r,q")
3971 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I,U")
3972 (match_operand:DI 2 "register_operand" "r,r,r")))]
3978 [(set_attr "type" "binary,binary,move")
3979 (set_attr "length" "4,4,4")])
3981 (define_expand "subsi3"
3982 [(set (match_operand:SI 0 "register_operand" "")
3983 (minus:SI (match_operand:SI 1 "arith11_operand" "")
3984 (match_operand:SI 2 "register_operand" "")))]
3989 [(set (match_operand:SI 0 "register_operand" "=r,r")
3990 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
3991 (match_operand:SI 2 "register_operand" "r,r")))]
3996 [(set_attr "type" "binary,binary")
3997 (set_attr "length" "4,4")])
4000 [(set (match_operand:SI 0 "register_operand" "=r,r,q")
4001 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I,S")
4002 (match_operand:SI 2 "register_operand" "r,r,r")))]
4008 [(set_attr "type" "binary,binary,move")
4009 (set_attr "length" "4,4,4")])
4011 ;; Clobbering a "register_operand" instead of a match_scratch
4012 ;; in operand3 of millicode calls avoids spilling %r1 and
4013 ;; produces better code.
4015 ;; The mulsi3 insns set up registers for the millicode call.
4016 (define_expand "mulsi3"
4017 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4018 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4019 (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
4020 (clobber (match_dup 3))
4021 (clobber (reg:SI 26))
4022 (clobber (reg:SI 25))
4023 (clobber (match_dup 4))])
4024 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4028 operands[4] = gen_rtx_REG (SImode, TARGET_64BIT ? 2 : 31);
4029 if (TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT)
4031 rtx scratch = gen_reg_rtx (DImode);
4032 operands[1] = force_reg (SImode, operands[1]);
4033 operands[2] = force_reg (SImode, operands[2]);
4034 emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
4035 emit_insn (gen_rtx_SET (VOIDmode, operands[0],
4036 gen_rtx_SUBREG (SImode, scratch, GET_MODE_SIZE (SImode))));
4039 operands[3] = gen_reg_rtx (SImode);
4042 (define_insn "umulsidi3"
4043 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
4044 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
4045 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
4046 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
4048 [(set_attr "type" "fpmuldbl")
4049 (set_attr "length" "4")])
4052 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
4053 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
4054 (match_operand:DI 2 "uint32_operand" "f")))]
4055 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT"
4057 [(set_attr "type" "fpmuldbl")
4058 (set_attr "length" "4")])
4061 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
4062 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
4063 (match_operand:DI 2 "uint32_operand" "f")))]
4064 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
4066 [(set_attr "type" "fpmuldbl")
4067 (set_attr "length" "4")])
4070 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
4071 (clobber (match_operand:SI 0 "register_operand" "=a"))
4072 (clobber (reg:SI 26))
4073 (clobber (reg:SI 25))
4074 (clobber (reg:SI 31))]
4076 "* return output_mul_insn (0, insn);"
4077 [(set_attr "type" "milli")
4078 (set (attr "length")
4080 ;; Target (or stub) within reach
4081 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
4083 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
4088 (ne (symbol_ref "flag_pic")
4092 ;; Out of reach PORTABLE_RUNTIME
4093 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
4097 ;; Out of reach, can use ble
4101 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
4102 (clobber (match_operand:SI 0 "register_operand" "=a"))
4103 (clobber (reg:SI 26))
4104 (clobber (reg:SI 25))
4105 (clobber (reg:SI 2))]
4107 "* return output_mul_insn (0, insn);"
4108 [(set_attr "type" "milli")
4109 (set (attr "length") (const_int 4))])
4111 (define_expand "muldi3"
4112 [(set (match_operand:DI 0 "register_operand" "")
4113 (mult:DI (match_operand:DI 1 "register_operand" "")
4114 (match_operand:DI 2 "register_operand" "")))]
4115 "TARGET_64BIT && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
4118 rtx low_product = gen_reg_rtx (DImode);
4119 rtx cross_product1 = gen_reg_rtx (DImode);
4120 rtx cross_product2 = gen_reg_rtx (DImode);
4121 rtx cross_scratch = gen_reg_rtx (DImode);
4122 rtx cross_product = gen_reg_rtx (DImode);
4123 rtx op1l, op1r, op2l, op2r;
4124 rtx op1shifted, op2shifted;
4126 op1shifted = gen_reg_rtx (DImode);
4127 op2shifted = gen_reg_rtx (DImode);
4128 op1l = gen_reg_rtx (SImode);
4129 op1r = gen_reg_rtx (SImode);
4130 op2l = gen_reg_rtx (SImode);
4131 op2r = gen_reg_rtx (SImode);
4133 emit_move_insn (op1shifted, gen_rtx_LSHIFTRT (DImode, operands[1],
4135 emit_move_insn (op2shifted, gen_rtx_LSHIFTRT (DImode, operands[2],
4137 op1r = gen_rtx_SUBREG (SImode, operands[1], 4);
4138 op2r = gen_rtx_SUBREG (SImode, operands[2], 4);
4139 op1l = gen_rtx_SUBREG (SImode, op1shifted, 4);
4140 op2l = gen_rtx_SUBREG (SImode, op2shifted, 4);
4142 /* Emit multiplies for the cross products. */
4143 emit_insn (gen_umulsidi3 (cross_product1, op2r, op1l));
4144 emit_insn (gen_umulsidi3 (cross_product2, op2l, op1r));
4146 /* Emit a multiply for the low sub-word. */
4147 emit_insn (gen_umulsidi3 (low_product, op2r, op1r));
4149 /* Sum the cross products and shift them into proper position. */
4150 emit_insn (gen_adddi3 (cross_scratch, cross_product1, cross_product2));
4151 emit_insn (gen_ashldi3 (cross_product, cross_scratch, GEN_INT (32)));
4153 /* Add the cross product to the low product and store the result
4154 into the output operand . */
4155 emit_insn (gen_adddi3 (operands[0], cross_product, low_product));
4159 ;;; Division and mod.
4160 (define_expand "divsi3"
4161 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4162 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4163 (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
4164 (clobber (match_dup 3))
4165 (clobber (match_dup 4))
4166 (clobber (reg:SI 26))
4167 (clobber (reg:SI 25))
4168 (clobber (match_dup 5))])
4169 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4173 operands[3] = gen_reg_rtx (SImode);
4176 operands[5] = gen_rtx_REG (SImode, 2);
4177 operands[4] = operands[5];
4181 operands[5] = gen_rtx_REG (SImode, 31);
4182 operands[4] = gen_reg_rtx (SImode);
4184 if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 0))
4190 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4191 (clobber (match_operand:SI 1 "register_operand" "=a"))
4192 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4193 (clobber (reg:SI 26))
4194 (clobber (reg:SI 25))
4195 (clobber (reg:SI 31))]
4198 return output_div_insn (operands, 0, insn);"
4199 [(set_attr "type" "milli")
4200 (set (attr "length")
4202 ;; Target (or stub) within reach
4203 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
4205 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
4210 (ne (symbol_ref "flag_pic")
4214 ;; Out of reach PORTABLE_RUNTIME
4215 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
4219 ;; Out of reach, can use ble
4224 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4225 (clobber (match_operand:SI 1 "register_operand" "=a"))
4226 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4227 (clobber (reg:SI 26))
4228 (clobber (reg:SI 25))
4229 (clobber (reg:SI 2))]
4232 return output_div_insn (operands, 0, insn);"
4233 [(set_attr "type" "milli")
4234 (set (attr "length") (const_int 4))])
4236 (define_expand "udivsi3"
4237 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4238 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4239 (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
4240 (clobber (match_dup 3))
4241 (clobber (match_dup 4))
4242 (clobber (reg:SI 26))
4243 (clobber (reg:SI 25))
4244 (clobber (match_dup 5))])
4245 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4249 operands[3] = gen_reg_rtx (SImode);
4252 operands[5] = gen_rtx_REG (SImode, 2);
4253 operands[4] = operands[5];
4257 operands[5] = gen_rtx_REG (SImode, 31);
4258 operands[4] = gen_reg_rtx (SImode);
4260 if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 1))
4266 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4267 (clobber (match_operand:SI 1 "register_operand" "=a"))
4268 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4269 (clobber (reg:SI 26))
4270 (clobber (reg:SI 25))
4271 (clobber (reg:SI 31))]
4274 return output_div_insn (operands, 1, insn);"
4275 [(set_attr "type" "milli")
4276 (set (attr "length")
4278 ;; Target (or stub) within reach
4279 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
4281 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
4286 (ne (symbol_ref "flag_pic")
4290 ;; Out of reach PORTABLE_RUNTIME
4291 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
4295 ;; Out of reach, can use ble
4300 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
4301 (clobber (match_operand:SI 1 "register_operand" "=a"))
4302 (clobber (match_operand:SI 2 "register_operand" "=&r"))
4303 (clobber (reg:SI 26))
4304 (clobber (reg:SI 25))
4305 (clobber (reg:SI 2))]
4308 return output_div_insn (operands, 1, insn);"
4309 [(set_attr "type" "milli")
4310 (set (attr "length") (const_int 4))])
4312 (define_expand "modsi3"
4313 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4314 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4315 (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
4316 (clobber (match_dup 3))
4317 (clobber (match_dup 4))
4318 (clobber (reg:SI 26))
4319 (clobber (reg:SI 25))
4320 (clobber (match_dup 5))])
4321 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4327 operands[5] = gen_rtx_REG (SImode, 2);
4328 operands[4] = operands[5];
4332 operands[5] = gen_rtx_REG (SImode, 31);
4333 operands[4] = gen_reg_rtx (SImode);
4335 operands[3] = gen_reg_rtx (SImode);
4339 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
4340 (clobber (match_operand:SI 0 "register_operand" "=a"))
4341 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4342 (clobber (reg:SI 26))
4343 (clobber (reg:SI 25))
4344 (clobber (reg:SI 31))]
4347 return output_mod_insn (0, insn);"
4348 [(set_attr "type" "milli")
4349 (set (attr "length")
4351 ;; Target (or stub) within reach
4352 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
4354 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
4359 (ne (symbol_ref "flag_pic")
4363 ;; Out of reach PORTABLE_RUNTIME
4364 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
4368 ;; Out of reach, can use ble
4372 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
4373 (clobber (match_operand:SI 0 "register_operand" "=a"))
4374 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4375 (clobber (reg:SI 26))
4376 (clobber (reg:SI 25))
4377 (clobber (reg:SI 2))]
4380 return output_mod_insn (0, insn);"
4381 [(set_attr "type" "milli")
4382 (set (attr "length") (const_int 4))])
4384 (define_expand "umodsi3"
4385 [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
4386 (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
4387 (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
4388 (clobber (match_dup 3))
4389 (clobber (match_dup 4))
4390 (clobber (reg:SI 26))
4391 (clobber (reg:SI 25))
4392 (clobber (match_dup 5))])
4393 (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
4399 operands[5] = gen_rtx_REG (SImode, 2);
4400 operands[4] = operands[5];
4404 operands[5] = gen_rtx_REG (SImode, 31);
4405 operands[4] = gen_reg_rtx (SImode);
4407 operands[3] = gen_reg_rtx (SImode);
4411 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
4412 (clobber (match_operand:SI 0 "register_operand" "=a"))
4413 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4414 (clobber (reg:SI 26))
4415 (clobber (reg:SI 25))
4416 (clobber (reg:SI 31))]
4419 return output_mod_insn (1, insn);"
4420 [(set_attr "type" "milli")
4421 (set (attr "length")
4423 ;; Target (or stub) within reach
4424 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
4426 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
4431 (ne (symbol_ref "flag_pic")
4435 ;; Out of reach PORTABLE_RUNTIME
4436 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
4440 ;; Out of reach, can use ble
4444 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
4445 (clobber (match_operand:SI 0 "register_operand" "=a"))
4446 (clobber (match_operand:SI 1 "register_operand" "=&r"))
4447 (clobber (reg:SI 26))
4448 (clobber (reg:SI 25))
4449 (clobber (reg:SI 2))]
4452 return output_mod_insn (1, insn);"
4453 [(set_attr "type" "milli")
4454 (set (attr "length") (const_int 4))])
4456 ;;- and instructions
4457 ;; We define DImode `and` so with DImode `not` we can get
4458 ;; DImode `andn`. Other combinations are possible.
4460 (define_expand "anddi3"
4461 [(set (match_operand:DI 0 "register_operand" "")
4462 (and:DI (match_operand:DI 1 "arith_double_operand" "")
4463 (match_operand:DI 2 "arith_double_operand" "")))]
4467 if (! register_operand (operands[1], DImode)
4468 || ! register_operand (operands[2], DImode))
4469 /* Let GCC break this into word-at-a-time operations. */
4474 [(set (match_operand:DI 0 "register_operand" "=r")
4475 (and:DI (match_operand:DI 1 "register_operand" "%r")
4476 (match_operand:DI 2 "register_operand" "r")))]
4478 "and %1,%2,%0\;and %R1,%R2,%R0"
4479 [(set_attr "type" "binary")
4480 (set_attr "length" "8")])
4483 [(set (match_operand:DI 0 "register_operand" "=r,r")
4484 (and:DI (match_operand:DI 1 "register_operand" "%?r,0")
4485 (match_operand:DI 2 "and_operand" "rO,P")))]
4487 "* return output_64bit_and (operands); "
4488 [(set_attr "type" "binary")
4489 (set_attr "length" "4")])
4491 ; The ? for op1 makes reload prefer zdepi instead of loading a huge
4492 ; constant with ldil;ldo.
4493 (define_insn "andsi3"
4494 [(set (match_operand:SI 0 "register_operand" "=r,r")
4495 (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
4496 (match_operand:SI 2 "and_operand" "rO,P")))]
4498 "* return output_and (operands); "
4499 [(set_attr "type" "binary,shift")
4500 (set_attr "length" "4,4")])
4503 [(set (match_operand:DI 0 "register_operand" "=r")
4504 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
4505 (match_operand:DI 2 "register_operand" "r")))]
4507 "andcm %2,%1,%0\;andcm %R2,%R1,%R0"
4508 [(set_attr "type" "binary")
4509 (set_attr "length" "8")])
4512 [(set (match_operand:DI 0 "register_operand" "=r")
4513 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
4514 (match_operand:DI 2 "register_operand" "r")))]
4517 [(set_attr "type" "binary")
4518 (set_attr "length" "4")])
4521 [(set (match_operand:SI 0 "register_operand" "=r")
4522 (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
4523 (match_operand:SI 2 "register_operand" "r")))]
4526 [(set_attr "type" "binary")
4527 (set_attr "length" "4")])
4529 (define_expand "iordi3"
4530 [(set (match_operand:DI 0 "register_operand" "")
4531 (ior:DI (match_operand:DI 1 "arith_double_operand" "")
4532 (match_operand:DI 2 "arith_double_operand" "")))]
4536 if (! register_operand (operands[1], DImode)
4537 || ! register_operand (operands[2], DImode))
4538 /* Let GCC break this into word-at-a-time operations. */
4543 [(set (match_operand:DI 0 "register_operand" "=r")
4544 (ior:DI (match_operand:DI 1 "register_operand" "%r")
4545 (match_operand:DI 2 "register_operand" "r")))]
4547 "or %1,%2,%0\;or %R1,%R2,%R0"
4548 [(set_attr "type" "binary")
4549 (set_attr "length" "8")])
4552 [(set (match_operand:DI 0 "register_operand" "=r,r")
4553 (ior:DI (match_operand:DI 1 "register_operand" "0,0")
4554 (match_operand:DI 2 "ior_operand" "M,i")))]
4556 "* return output_64bit_ior (operands); "
4557 [(set_attr "type" "binary,shift")
4558 (set_attr "length" "4,4")])
4561 [(set (match_operand:DI 0 "register_operand" "=r")
4562 (ior:DI (match_operand:DI 1 "register_operand" "%r")
4563 (match_operand:DI 2 "register_operand" "r")))]
4566 [(set_attr "type" "binary")
4567 (set_attr "length" "4")])
4569 ;; Need a define_expand because we've run out of CONST_OK... characters.
4570 (define_expand "iorsi3"
4571 [(set (match_operand:SI 0 "register_operand" "")
4572 (ior:SI (match_operand:SI 1 "register_operand" "")
4573 (match_operand:SI 2 "arith32_operand" "")))]
4577 if (! (ior_operand (operands[2], SImode)
4578 || register_operand (operands[2], SImode)))
4579 operands[2] = force_reg (SImode, operands[2]);
4583 [(set (match_operand:SI 0 "register_operand" "=r,r")
4584 (ior:SI (match_operand:SI 1 "register_operand" "0,0")
4585 (match_operand:SI 2 "ior_operand" "M,i")))]
4587 "* return output_ior (operands); "
4588 [(set_attr "type" "binary,shift")
4589 (set_attr "length" "4,4")])
4592 [(set (match_operand:SI 0 "register_operand" "=r")
4593 (ior:SI (match_operand:SI 1 "register_operand" "%r")
4594 (match_operand:SI 2 "register_operand" "r")))]
4597 [(set_attr "type" "binary")
4598 (set_attr "length" "4")])
4600 (define_expand "xordi3"
4601 [(set (match_operand:DI 0 "register_operand" "")
4602 (xor:DI (match_operand:DI 1 "arith_double_operand" "")
4603 (match_operand:DI 2 "arith_double_operand" "")))]
4607 if (! register_operand (operands[1], DImode)
4608 || ! register_operand (operands[2], DImode))
4609 /* Let GCC break this into word-at-a-time operations. */
4614 [(set (match_operand:DI 0 "register_operand" "=r")
4615 (xor:DI (match_operand:DI 1 "register_operand" "%r")
4616 (match_operand:DI 2 "register_operand" "r")))]
4618 "xor %1,%2,%0\;xor %R1,%R2,%R0"
4619 [(set_attr "type" "binary")
4620 (set_attr "length" "8")])
4623 [(set (match_operand:DI 0 "register_operand" "=r")
4624 (xor:DI (match_operand:DI 1 "register_operand" "%r")
4625 (match_operand:DI 2 "register_operand" "r")))]
4628 [(set_attr "type" "binary")
4629 (set_attr "length" "4")])
4631 (define_insn "xorsi3"
4632 [(set (match_operand:SI 0 "register_operand" "=r")
4633 (xor:SI (match_operand:SI 1 "register_operand" "%r")
4634 (match_operand:SI 2 "register_operand" "r")))]
4637 [(set_attr "type" "binary")
4638 (set_attr "length" "4")])
4640 (define_expand "negdi2"
4641 [(set (match_operand:DI 0 "register_operand" "")
4642 (neg:DI (match_operand:DI 1 "register_operand" "")))]
4647 [(set (match_operand:DI 0 "register_operand" "=r")
4648 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
4650 "sub %%r0,%R1,%R0\;{subb|sub,b} %%r0,%1,%0"
4651 [(set_attr "type" "unary")
4652 (set_attr "length" "8")])
4655 [(set (match_operand:DI 0 "register_operand" "=r")
4656 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
4659 [(set_attr "type" "unary")
4660 (set_attr "length" "4")])
4662 (define_insn "negsi2"
4663 [(set (match_operand:SI 0 "register_operand" "=r")
4664 (neg:SI (match_operand:SI 1 "register_operand" "r")))]
4667 [(set_attr "type" "unary")
4668 (set_attr "length" "4")])
4670 (define_expand "one_cmpldi2"
4671 [(set (match_operand:DI 0 "register_operand" "")
4672 (not:DI (match_operand:DI 1 "arith_double_operand" "")))]
4676 if (! register_operand (operands[1], DImode))
4681 [(set (match_operand:DI 0 "register_operand" "=r")
4682 (not:DI (match_operand:DI 1 "register_operand" "r")))]
4684 "uaddcm %%r0,%1,%0\;uaddcm %%r0,%R1,%R0"
4685 [(set_attr "type" "unary")
4686 (set_attr "length" "8")])
4689 [(set (match_operand:DI 0 "register_operand" "=r")
4690 (not:DI (match_operand:DI 1 "register_operand" "r")))]
4693 [(set_attr "type" "unary")
4694 (set_attr "length" "4")])
4696 (define_insn "one_cmplsi2"
4697 [(set (match_operand:SI 0 "register_operand" "=r")
4698 (not:SI (match_operand:SI 1 "register_operand" "r")))]
4701 [(set_attr "type" "unary")
4702 (set_attr "length" "4")])
4704 ;; Floating point arithmetic instructions.
4706 (define_insn "adddf3"
4707 [(set (match_operand:DF 0 "register_operand" "=f")
4708 (plus:DF (match_operand:DF 1 "register_operand" "f")
4709 (match_operand:DF 2 "register_operand" "f")))]
4710 "! TARGET_SOFT_FLOAT"
4712 [(set_attr "type" "fpalu")
4713 (set_attr "pa_combine_type" "faddsub")
4714 (set_attr "length" "4")])
4716 (define_insn "addsf3"
4717 [(set (match_operand:SF 0 "register_operand" "=f")
4718 (plus:SF (match_operand:SF 1 "register_operand" "f")
4719 (match_operand:SF 2 "register_operand" "f")))]
4720 "! TARGET_SOFT_FLOAT"
4722 [(set_attr "type" "fpalu")
4723 (set_attr "pa_combine_type" "faddsub")
4724 (set_attr "length" "4")])
4726 (define_insn "subdf3"
4727 [(set (match_operand:DF 0 "register_operand" "=f")
4728 (minus:DF (match_operand:DF 1 "register_operand" "f")
4729 (match_operand:DF 2 "register_operand" "f")))]
4730 "! TARGET_SOFT_FLOAT"
4732 [(set_attr "type" "fpalu")
4733 (set_attr "pa_combine_type" "faddsub")
4734 (set_attr "length" "4")])
4736 (define_insn "subsf3"
4737 [(set (match_operand:SF 0 "register_operand" "=f")
4738 (minus:SF (match_operand:SF 1 "register_operand" "f")
4739 (match_operand:SF 2 "register_operand" "f")))]
4740 "! TARGET_SOFT_FLOAT"
4742 [(set_attr "type" "fpalu")
4743 (set_attr "pa_combine_type" "faddsub")
4744 (set_attr "length" "4")])
4746 (define_insn "muldf3"
4747 [(set (match_operand:DF 0 "register_operand" "=f")
4748 (mult:DF (match_operand:DF 1 "register_operand" "f")
4749 (match_operand:DF 2 "register_operand" "f")))]
4750 "! TARGET_SOFT_FLOAT"
4752 [(set_attr "type" "fpmuldbl")
4753 (set_attr "pa_combine_type" "fmpy")
4754 (set_attr "length" "4")])
4756 (define_insn "mulsf3"
4757 [(set (match_operand:SF 0 "register_operand" "=f")
4758 (mult:SF (match_operand:SF 1 "register_operand" "f")
4759 (match_operand:SF 2 "register_operand" "f")))]
4760 "! TARGET_SOFT_FLOAT"
4762 [(set_attr "type" "fpmulsgl")
4763 (set_attr "pa_combine_type" "fmpy")
4764 (set_attr "length" "4")])
4766 (define_insn "divdf3"
4767 [(set (match_operand:DF 0 "register_operand" "=f")
4768 (div:DF (match_operand:DF 1 "register_operand" "f")
4769 (match_operand:DF 2 "register_operand" "f")))]
4770 "! TARGET_SOFT_FLOAT"
4772 [(set_attr "type" "fpdivdbl")
4773 (set_attr "length" "4")])
4775 (define_insn "divsf3"
4776 [(set (match_operand:SF 0 "register_operand" "=f")
4777 (div:SF (match_operand:SF 1 "register_operand" "f")
4778 (match_operand:SF 2 "register_operand" "f")))]
4779 "! TARGET_SOFT_FLOAT"
4781 [(set_attr "type" "fpdivsgl")
4782 (set_attr "length" "4")])
4784 ;; Processors prior to PA 2.0 don't have a fneg instruction. Fast
4785 ;; negation can be done by subtracting from plus zero. However, this
4786 ;; violates the IEEE standard when negating plus and minus zero.
4787 (define_expand "negdf2"
4788 [(parallel [(set (match_operand:DF 0 "register_operand" "")
4789 (neg:DF (match_operand:DF 1 "register_operand" "")))
4790 (use (match_dup 2))])]
4791 "! TARGET_SOFT_FLOAT"
4793 if (TARGET_PA_20 || flag_unsafe_math_optimizations)
4794 emit_insn (gen_negdf2_fast (operands[0], operands[1]));
4797 operands[2] = force_reg (DFmode,
4798 CONST_DOUBLE_FROM_REAL_VALUE (dconstm1, DFmode));
4799 emit_insn (gen_muldf3 (operands[0], operands[1], operands[2]));
4804 (define_insn "negdf2_fast"
4805 [(set (match_operand:DF 0 "register_operand" "=f")
4806 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
4807 "! TARGET_SOFT_FLOAT && (TARGET_PA_20 || flag_unsafe_math_optimizations)"
4811 return \"fneg,dbl %1,%0\";
4813 return \"fsub,dbl %%fr0,%1,%0\";
4815 [(set_attr "type" "fpalu")
4816 (set_attr "length" "4")])
4818 (define_expand "negsf2"
4819 [(parallel [(set (match_operand:SF 0 "register_operand" "")
4820 (neg:SF (match_operand:SF 1 "register_operand" "")))
4821 (use (match_dup 2))])]
4822 "! TARGET_SOFT_FLOAT"
4824 if (TARGET_PA_20 || flag_unsafe_math_optimizations)
4825 emit_insn (gen_negsf2_fast (operands[0], operands[1]));
4828 operands[2] = force_reg (SFmode,
4829 CONST_DOUBLE_FROM_REAL_VALUE (dconstm1, SFmode));
4830 emit_insn (gen_mulsf3 (operands[0], operands[1], operands[2]));
4835 (define_insn "negsf2_fast"
4836 [(set (match_operand:SF 0 "register_operand" "=f")
4837 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
4838 "! TARGET_SOFT_FLOAT && (TARGET_PA_20 || flag_unsafe_math_optimizations)"
4842 return \"fneg,sgl %1,%0\";
4844 return \"fsub,sgl %%fr0,%1,%0\";
4846 [(set_attr "type" "fpalu")
4847 (set_attr "length" "4")])
4849 (define_insn "absdf2"
4850 [(set (match_operand:DF 0 "register_operand" "=f")
4851 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
4852 "! TARGET_SOFT_FLOAT"
4854 [(set_attr "type" "fpalu")
4855 (set_attr "length" "4")])
4857 (define_insn "abssf2"
4858 [(set (match_operand:SF 0 "register_operand" "=f")
4859 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
4860 "! TARGET_SOFT_FLOAT"
4862 [(set_attr "type" "fpalu")
4863 (set_attr "length" "4")])
4865 (define_insn "sqrtdf2"
4866 [(set (match_operand:DF 0 "register_operand" "=f")
4867 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
4868 "! TARGET_SOFT_FLOAT"
4870 [(set_attr "type" "fpsqrtdbl")
4871 (set_attr "length" "4")])
4873 (define_insn "sqrtsf2"
4874 [(set (match_operand:SF 0 "register_operand" "=f")
4875 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
4876 "! TARGET_SOFT_FLOAT"
4878 [(set_attr "type" "fpsqrtsgl")
4879 (set_attr "length" "4")])
4881 ;; PA 2.0 floating point instructions
4885 [(set (match_operand:DF 0 "register_operand" "=f")
4886 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
4887 (match_operand:DF 2 "register_operand" "f"))
4888 (match_operand:DF 3 "register_operand" "f")))]
4889 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4890 "fmpyfadd,dbl %1,%2,%3,%0"
4891 [(set_attr "type" "fpmuldbl")
4892 (set_attr "length" "4")])
4895 [(set (match_operand:DF 0 "register_operand" "=f")
4896 (plus:DF (match_operand:DF 1 "register_operand" "f")
4897 (mult:DF (match_operand:DF 2 "register_operand" "f")
4898 (match_operand:DF 3 "register_operand" "f"))))]
4899 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4900 "fmpyfadd,dbl %2,%3,%1,%0"
4901 [(set_attr "type" "fpmuldbl")
4902 (set_attr "length" "4")])
4905 [(set (match_operand:SF 0 "register_operand" "=f")
4906 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
4907 (match_operand:SF 2 "register_operand" "f"))
4908 (match_operand:SF 3 "register_operand" "f")))]
4909 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4910 "fmpyfadd,sgl %1,%2,%3,%0"
4911 [(set_attr "type" "fpmulsgl")
4912 (set_attr "length" "4")])
4915 [(set (match_operand:SF 0 "register_operand" "=f")
4916 (plus:SF (match_operand:SF 1 "register_operand" "f")
4917 (mult:SF (match_operand:SF 2 "register_operand" "f")
4918 (match_operand:SF 3 "register_operand" "f"))))]
4919 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4920 "fmpyfadd,sgl %2,%3,%1,%0"
4921 [(set_attr "type" "fpmulsgl")
4922 (set_attr "length" "4")])
4924 ; fmpynfadd patterns
4926 [(set (match_operand:DF 0 "register_operand" "=f")
4927 (minus:DF (match_operand:DF 1 "register_operand" "f")
4928 (mult:DF (match_operand:DF 2 "register_operand" "f")
4929 (match_operand:DF 3 "register_operand" "f"))))]
4930 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4931 "fmpynfadd,dbl %2,%3,%1,%0"
4932 [(set_attr "type" "fpmuldbl")
4933 (set_attr "length" "4")])
4936 [(set (match_operand:SF 0 "register_operand" "=f")
4937 (minus:SF (match_operand:SF 1 "register_operand" "f")
4938 (mult:SF (match_operand:SF 2 "register_operand" "f")
4939 (match_operand:SF 3 "register_operand" "f"))))]
4940 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4941 "fmpynfadd,sgl %2,%3,%1,%0"
4942 [(set_attr "type" "fpmulsgl")
4943 (set_attr "length" "4")])
4947 [(set (match_operand:DF 0 "register_operand" "=f")
4948 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))]
4949 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4951 [(set_attr "type" "fpalu")
4952 (set_attr "length" "4")])
4955 [(set (match_operand:SF 0 "register_operand" "=f")
4956 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))]
4957 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
4959 [(set_attr "type" "fpalu")
4960 (set_attr "length" "4")])
4962 ;; Generating a fused multiply sequence is a win for this case as it will
4963 ;; reduce the latency for the fused case without impacting the plain
4966 ;; Similar possibilities exist for fnegabs, shadd and other insns which
4967 ;; perform two operations with the result of the first feeding the second.
4969 [(set (match_operand:DF 0 "register_operand" "=f")
4970 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
4971 (match_operand:DF 2 "register_operand" "f"))
4972 (match_operand:DF 3 "register_operand" "f")))
4973 (set (match_operand:DF 4 "register_operand" "=&f")
4974 (mult:DF (match_dup 1) (match_dup 2)))]
4975 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
4976 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
4977 || reg_overlap_mentioned_p (operands[4], operands[2])))"
4979 [(set_attr "type" "fpmuldbl")
4980 (set_attr "length" "8")])
4982 ;; We want to split this up during scheduling since we want both insns
4983 ;; to schedule independently.
4985 [(set (match_operand:DF 0 "register_operand" "")
4986 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "")
4987 (match_operand:DF 2 "register_operand" ""))
4988 (match_operand:DF 3 "register_operand" "")))
4989 (set (match_operand:DF 4 "register_operand" "")
4990 (mult:DF (match_dup 1) (match_dup 2)))]
4991 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4992 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
4993 (set (match_dup 0) (plus:DF (mult:DF (match_dup 1) (match_dup 2))
4998 [(set (match_operand:SF 0 "register_operand" "=f")
4999 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5000 (match_operand:SF 2 "register_operand" "f"))
5001 (match_operand:SF 3 "register_operand" "f")))
5002 (set (match_operand:SF 4 "register_operand" "=&f")
5003 (mult:SF (match_dup 1) (match_dup 2)))]
5004 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5005 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5006 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5008 [(set_attr "type" "fpmuldbl")
5009 (set_attr "length" "8")])
5011 ;; We want to split this up during scheduling since we want both insns
5012 ;; to schedule independently.
5014 [(set (match_operand:SF 0 "register_operand" "")
5015 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "")
5016 (match_operand:SF 2 "register_operand" ""))
5017 (match_operand:SF 3 "register_operand" "")))
5018 (set (match_operand:SF 4 "register_operand" "")
5019 (mult:SF (match_dup 1) (match_dup 2)))]
5020 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5021 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
5022 (set (match_dup 0) (plus:SF (mult:SF (match_dup 1) (match_dup 2))
5026 ;; Negating a multiply can be faked by adding zero in a fused multiply-add
5029 [(set (match_operand:DF 0 "register_operand" "=f")
5030 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
5031 (match_operand:DF 2 "register_operand" "f"))))]
5032 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5033 "fmpynfadd,dbl %1,%2,%%fr0,%0"
5034 [(set_attr "type" "fpmuldbl")
5035 (set_attr "length" "4")])
5038 [(set (match_operand:SF 0 "register_operand" "=f")
5039 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5040 (match_operand:SF 2 "register_operand" "f"))))]
5041 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5042 "fmpynfadd,sgl %1,%2,%%fr0,%0"
5043 [(set_attr "type" "fpmuldbl")
5044 (set_attr "length" "4")])
5047 [(set (match_operand:DF 0 "register_operand" "=f")
5048 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
5049 (match_operand:DF 2 "register_operand" "f"))))
5050 (set (match_operand:DF 3 "register_operand" "=&f")
5051 (mult:DF (match_dup 1) (match_dup 2)))]
5052 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5053 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
5054 || reg_overlap_mentioned_p (operands[3], operands[2])))"
5056 [(set_attr "type" "fpmuldbl")
5057 (set_attr "length" "8")])
5060 [(set (match_operand:DF 0 "register_operand" "")
5061 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
5062 (match_operand:DF 2 "register_operand" ""))))
5063 (set (match_operand:DF 3 "register_operand" "")
5064 (mult:DF (match_dup 1) (match_dup 2)))]
5065 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5066 [(set (match_dup 3) (mult:DF (match_dup 1) (match_dup 2)))
5067 (set (match_dup 0) (neg:DF (mult:DF (match_dup 1) (match_dup 2))))]
5071 [(set (match_operand:SF 0 "register_operand" "=f")
5072 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5073 (match_operand:SF 2 "register_operand" "f"))))
5074 (set (match_operand:SF 3 "register_operand" "=&f")
5075 (mult:SF (match_dup 1) (match_dup 2)))]
5076 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5077 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
5078 || reg_overlap_mentioned_p (operands[3], operands[2])))"
5080 [(set_attr "type" "fpmuldbl")
5081 (set_attr "length" "8")])
5084 [(set (match_operand:SF 0 "register_operand" "")
5085 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
5086 (match_operand:SF 2 "register_operand" ""))))
5087 (set (match_operand:SF 3 "register_operand" "")
5088 (mult:SF (match_dup 1) (match_dup 2)))]
5089 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5090 [(set (match_dup 3) (mult:SF (match_dup 1) (match_dup 2)))
5091 (set (match_dup 0) (neg:SF (mult:SF (match_dup 1) (match_dup 2))))]
5094 ;; Now fused multiplies with the result of the multiply negated.
5096 [(set (match_operand:DF 0 "register_operand" "=f")
5097 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
5098 (match_operand:DF 2 "register_operand" "f")))
5099 (match_operand:DF 3 "register_operand" "f")))]
5100 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5101 "fmpynfadd,dbl %1,%2,%3,%0"
5102 [(set_attr "type" "fpmuldbl")
5103 (set_attr "length" "4")])
5106 [(set (match_operand:SF 0 "register_operand" "=f")
5107 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5108 (match_operand:SF 2 "register_operand" "f")))
5109 (match_operand:SF 3 "register_operand" "f")))]
5110 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5111 "fmpynfadd,sgl %1,%2,%3,%0"
5112 [(set_attr "type" "fpmuldbl")
5113 (set_attr "length" "4")])
5116 [(set (match_operand:DF 0 "register_operand" "=f")
5117 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
5118 (match_operand:DF 2 "register_operand" "f")))
5119 (match_operand:DF 3 "register_operand" "f")))
5120 (set (match_operand:DF 4 "register_operand" "=&f")
5121 (mult:DF (match_dup 1) (match_dup 2)))]
5122 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5123 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5124 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5126 [(set_attr "type" "fpmuldbl")
5127 (set_attr "length" "8")])
5130 [(set (match_operand:DF 0 "register_operand" "")
5131 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
5132 (match_operand:DF 2 "register_operand" "")))
5133 (match_operand:DF 3 "register_operand" "")))
5134 (set (match_operand:DF 4 "register_operand" "")
5135 (mult:DF (match_dup 1) (match_dup 2)))]
5136 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5137 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
5138 (set (match_dup 0) (plus:DF (neg:DF (mult:DF (match_dup 1) (match_dup 2)))
5143 [(set (match_operand:SF 0 "register_operand" "=f")
5144 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
5145 (match_operand:SF 2 "register_operand" "f")))
5146 (match_operand:SF 3 "register_operand" "f")))
5147 (set (match_operand:SF 4 "register_operand" "=&f")
5148 (mult:SF (match_dup 1) (match_dup 2)))]
5149 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5150 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5151 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5153 [(set_attr "type" "fpmuldbl")
5154 (set_attr "length" "8")])
5157 [(set (match_operand:SF 0 "register_operand" "")
5158 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
5159 (match_operand:SF 2 "register_operand" "")))
5160 (match_operand:SF 3 "register_operand" "")))
5161 (set (match_operand:SF 4 "register_operand" "")
5162 (mult:SF (match_dup 1) (match_dup 2)))]
5163 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5164 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
5165 (set (match_dup 0) (plus:SF (neg:SF (mult:SF (match_dup 1) (match_dup 2)))
5170 [(set (match_operand:DF 0 "register_operand" "=f")
5171 (minus:DF (match_operand:DF 3 "register_operand" "f")
5172 (mult:DF (match_operand:DF 1 "register_operand" "f")
5173 (match_operand:DF 2 "register_operand" "f"))))
5174 (set (match_operand:DF 4 "register_operand" "=&f")
5175 (mult:DF (match_dup 1) (match_dup 2)))]
5176 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5177 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5178 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5180 [(set_attr "type" "fpmuldbl")
5181 (set_attr "length" "8")])
5184 [(set (match_operand:DF 0 "register_operand" "")
5185 (minus:DF (match_operand:DF 3 "register_operand" "")
5186 (mult:DF (match_operand:DF 1 "register_operand" "")
5187 (match_operand:DF 2 "register_operand" ""))))
5188 (set (match_operand:DF 4 "register_operand" "")
5189 (mult:DF (match_dup 1) (match_dup 2)))]
5190 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5191 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
5192 (set (match_dup 0) (minus:DF (match_dup 3)
5193 (mult:DF (match_dup 1) (match_dup 2))))]
5197 [(set (match_operand:SF 0 "register_operand" "=f")
5198 (minus:SF (match_operand:SF 3 "register_operand" "f")
5199 (mult:SF (match_operand:SF 1 "register_operand" "f")
5200 (match_operand:SF 2 "register_operand" "f"))))
5201 (set (match_operand:SF 4 "register_operand" "=&f")
5202 (mult:SF (match_dup 1) (match_dup 2)))]
5203 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5204 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
5205 || reg_overlap_mentioned_p (operands[4], operands[2])))"
5207 [(set_attr "type" "fpmuldbl")
5208 (set_attr "length" "8")])
5211 [(set (match_operand:SF 0 "register_operand" "")
5212 (minus:SF (match_operand:SF 3 "register_operand" "")
5213 (mult:SF (match_operand:SF 1 "register_operand" "")
5214 (match_operand:SF 2 "register_operand" ""))))
5215 (set (match_operand:SF 4 "register_operand" "")
5216 (mult:SF (match_dup 1) (match_dup 2)))]
5217 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5218 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
5219 (set (match_dup 0) (minus:SF (match_dup 3)
5220 (mult:SF (match_dup 1) (match_dup 2))))]
5224 [(set (match_operand:DF 0 "register_operand" "=f")
5225 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5226 (set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
5227 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5228 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
5230 [(set_attr "type" "fpalu")
5231 (set_attr "length" "8")])
5234 [(set (match_operand:DF 0 "register_operand" "")
5235 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" ""))))
5236 (set (match_operand:DF 2 "register_operand" "") (abs:DF (match_dup 1)))]
5237 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5238 [(set (match_dup 2) (abs:DF (match_dup 1)))
5239 (set (match_dup 0) (neg:DF (abs:DF (match_dup 1))))]
5243 [(set (match_operand:SF 0 "register_operand" "=f")
5244 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5245 (set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
5246 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
5247 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
5249 [(set_attr "type" "fpalu")
5250 (set_attr "length" "8")])
5253 [(set (match_operand:SF 0 "register_operand" "")
5254 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" ""))))
5255 (set (match_operand:SF 2 "register_operand" "") (abs:SF (match_dup 1)))]
5256 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5257 [(set (match_dup 2) (abs:SF (match_dup 1)))
5258 (set (match_dup 0) (neg:SF (abs:SF (match_dup 1))))]
5261 ;;- Shift instructions
5263 ;; Optimized special case of shifting.
5266 [(set (match_operand:SI 0 "register_operand" "=r")
5267 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
5271 [(set_attr "type" "load")
5272 (set_attr "length" "4")])
5275 [(set (match_operand:SI 0 "register_operand" "=r")
5276 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
5280 [(set_attr "type" "load")
5281 (set_attr "length" "4")])
5284 [(set (match_operand:SI 0 "register_operand" "=r")
5285 (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
5286 (match_operand:SI 3 "shadd_operand" ""))
5287 (match_operand:SI 1 "register_operand" "r")))]
5289 "{sh%O3addl %2,%1,%0|shladd,l %2,%O3,%1,%0} "
5290 [(set_attr "type" "binary")
5291 (set_attr "length" "4")])
5294 [(set (match_operand:DI 0 "register_operand" "=r")
5295 (plus:DI (mult:DI (match_operand:DI 2 "register_operand" "r")
5296 (match_operand:DI 3 "shadd_operand" ""))
5297 (match_operand:DI 1 "register_operand" "r")))]
5299 "shladd,l %2,%O3,%1,%0"
5300 [(set_attr "type" "binary")
5301 (set_attr "length" "4")])
5303 (define_expand "ashlsi3"
5304 [(set (match_operand:SI 0 "register_operand" "")
5305 (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
5306 (match_operand:SI 2 "arith32_operand" "")))]
5310 if (GET_CODE (operands[2]) != CONST_INT)
5312 rtx temp = gen_reg_rtx (SImode);
5313 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
5314 if (GET_CODE (operands[1]) == CONST_INT)
5315 emit_insn (gen_zvdep_imm32 (operands[0], operands[1], temp));
5317 emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
5320 /* Make sure both inputs are not constants,
5321 there are no patterns for that. */
5322 operands[1] = force_reg (SImode, operands[1]);
5326 [(set (match_operand:SI 0 "register_operand" "=r")
5327 (ashift:SI (match_operand:SI 1 "register_operand" "r")
5328 (match_operand:SI 2 "const_int_operand" "n")))]
5330 "{zdep|depw,z} %1,%P2,%L2,%0"
5331 [(set_attr "type" "shift")
5332 (set_attr "length" "4")])
5334 ; Match cases of op1 a CONST_INT here that zvdep_imm32 doesn't handle.
5335 ; Doing it like this makes slightly better code since reload can
5336 ; replace a register with a known value in range -16..15 with a
5337 ; constant. Ideally, we would like to merge zvdep32 and zvdep_imm32,
5338 ; but since we have no more CONST_OK... characters, that is not
5340 (define_insn "zvdep32"
5341 [(set (match_operand:SI 0 "register_operand" "=r,r")
5342 (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
5343 (minus:SI (const_int 31)
5344 (match_operand:SI 2 "register_operand" "q,q"))))]
5347 {zvdep %1,32,%0|depw,z %1,%%sar,32,%0}
5348 {zvdepi %1,32,%0|depwi,z %1,%%sar,32,%0}"
5349 [(set_attr "type" "shift,shift")
5350 (set_attr "length" "4,4")])
5352 (define_insn "zvdep_imm32"
5353 [(set (match_operand:SI 0 "register_operand" "=r")
5354 (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
5355 (minus:SI (const_int 31)
5356 (match_operand:SI 2 "register_operand" "q"))))]
5360 int x = INTVAL (operands[1]);
5361 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
5362 operands[1] = GEN_INT ((x & 0xf) - 0x10);
5363 return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\";
5365 [(set_attr "type" "shift")
5366 (set_attr "length" "4")])
5368 (define_insn "vdepi_ior"
5369 [(set (match_operand:SI 0 "register_operand" "=r")
5370 (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
5371 (minus:SI (const_int 31)
5372 (match_operand:SI 2 "register_operand" "q")))
5373 (match_operand:SI 3 "register_operand" "0")))]
5374 ; accept ...0001...1, can this be generalized?
5375 "exact_log2 (INTVAL (operands[1]) + 1) >= 0"
5378 int x = INTVAL (operands[1]);
5379 operands[2] = GEN_INT (exact_log2 (x + 1));
5380 return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\";
5382 [(set_attr "type" "shift")
5383 (set_attr "length" "4")])
5385 (define_insn "vdepi_and"
5386 [(set (match_operand:SI 0 "register_operand" "=r")
5387 (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
5388 (minus:SI (const_int 31)
5389 (match_operand:SI 2 "register_operand" "q")))
5390 (match_operand:SI 3 "register_operand" "0")))]
5391 ; this can be generalized...!
5392 "INTVAL (operands[1]) == -2"
5395 int x = INTVAL (operands[1]);
5396 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
5397 return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\";
5399 [(set_attr "type" "shift")
5400 (set_attr "length" "4")])
5402 (define_expand "ashldi3"
5403 [(set (match_operand:DI 0 "register_operand" "")
5404 (ashift:DI (match_operand:DI 1 "lhs_lshift_operand" "")
5405 (match_operand:DI 2 "arith32_operand" "")))]
5409 if (GET_CODE (operands[2]) != CONST_INT)
5411 rtx temp = gen_reg_rtx (DImode);
5412 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
5413 if (GET_CODE (operands[1]) == CONST_INT)
5414 emit_insn (gen_zvdep_imm64 (operands[0], operands[1], temp));
5416 emit_insn (gen_zvdep64 (operands[0], operands[1], temp));
5419 /* Make sure both inputs are not constants,
5420 there are no patterns for that. */
5421 operands[1] = force_reg (DImode, operands[1]);
5425 [(set (match_operand:DI 0 "register_operand" "=r")
5426 (ashift:DI (match_operand:DI 1 "register_operand" "r")
5427 (match_operand:DI 2 "const_int_operand" "n")))]
5429 "depd,z %1,%p2,%Q2,%0"
5430 [(set_attr "type" "shift")
5431 (set_attr "length" "4")])
5433 ; Match cases of op1 a CONST_INT here that zvdep_imm64 doesn't handle.
5434 ; Doing it like this makes slightly better code since reload can
5435 ; replace a register with a known value in range -16..15 with a
5436 ; constant. Ideally, we would like to merge zvdep64 and zvdep_imm64,
5437 ; but since we have no more CONST_OK... characters, that is not
5439 (define_insn "zvdep64"
5440 [(set (match_operand:DI 0 "register_operand" "=r,r")
5441 (ashift:DI (match_operand:DI 1 "arith5_operand" "r,L")
5442 (minus:DI (const_int 63)
5443 (match_operand:DI 2 "register_operand" "q,q"))))]
5446 depd,z %1,%%sar,64,%0
5447 depdi,z %1,%%sar,64,%0"
5448 [(set_attr "type" "shift,shift")
5449 (set_attr "length" "4,4")])
5451 (define_insn "zvdep_imm64"
5452 [(set (match_operand:DI 0 "register_operand" "=r")
5453 (ashift:DI (match_operand:DI 1 "lhs_lshift_cint_operand" "")
5454 (minus:DI (const_int 63)
5455 (match_operand:DI 2 "register_operand" "q"))))]
5459 int x = INTVAL (operands[1]);
5460 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
5461 operands[1] = GEN_INT ((x & 0x1f) - 0x20);
5462 return \"depdi,z %1,%%sar,%2,%0\";
5464 [(set_attr "type" "shift")
5465 (set_attr "length" "4")])
5468 [(set (match_operand:DI 0 "register_operand" "=r")
5469 (ior:DI (ashift:DI (match_operand:DI 1 "const_int_operand" "")
5470 (minus:DI (const_int 63)
5471 (match_operand:DI 2 "register_operand" "q")))
5472 (match_operand:DI 3 "register_operand" "0")))]
5473 ; accept ...0001...1, can this be generalized?
5474 "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) >= 0"
5477 int x = INTVAL (operands[1]);
5478 operands[2] = GEN_INT (exact_log2 (x + 1));
5479 return \"depdi -1,%%sar,%2,%0\";
5481 [(set_attr "type" "shift")
5482 (set_attr "length" "4")])
5485 [(set (match_operand:DI 0 "register_operand" "=r")
5486 (and:DI (rotate:DI (match_operand:DI 1 "const_int_operand" "")
5487 (minus:DI (const_int 63)
5488 (match_operand:DI 2 "register_operand" "q")))
5489 (match_operand:DI 3 "register_operand" "0")))]
5490 ; this can be generalized...!
5491 "TARGET_64BIT && INTVAL (operands[1]) == -2"
5494 int x = INTVAL (operands[1]);
5495 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
5496 return \"depdi 0,%%sar,%2,%0\";
5498 [(set_attr "type" "shift")
5499 (set_attr "length" "4")])
5501 (define_expand "ashrsi3"
5502 [(set (match_operand:SI 0 "register_operand" "")
5503 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
5504 (match_operand:SI 2 "arith32_operand" "")))]
5508 if (GET_CODE (operands[2]) != CONST_INT)
5510 rtx temp = gen_reg_rtx (SImode);
5511 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
5512 emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
5518 [(set (match_operand:SI 0 "register_operand" "=r")
5519 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
5520 (match_operand:SI 2 "const_int_operand" "n")))]
5522 "{extrs|extrw,s} %1,%P2,%L2,%0"
5523 [(set_attr "type" "shift")
5524 (set_attr "length" "4")])
5526 (define_insn "vextrs32"
5527 [(set (match_operand:SI 0 "register_operand" "=r")
5528 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
5529 (minus:SI (const_int 31)
5530 (match_operand:SI 2 "register_operand" "q"))))]
5532 "{vextrs %1,32,%0|extrw,s %1,%%sar,32,%0}"
5533 [(set_attr "type" "shift")
5534 (set_attr "length" "4")])
5536 (define_expand "ashrdi3"
5537 [(set (match_operand:DI 0 "register_operand" "")
5538 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
5539 (match_operand:DI 2 "arith32_operand" "")))]
5543 if (GET_CODE (operands[2]) != CONST_INT)
5545 rtx temp = gen_reg_rtx (DImode);
5546 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
5547 emit_insn (gen_vextrs64 (operands[0], operands[1], temp));
5553 [(set (match_operand:DI 0 "register_operand" "=r")
5554 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
5555 (match_operand:DI 2 "const_int_operand" "n")))]
5557 "extrd,s %1,%p2,%Q2,%0"
5558 [(set_attr "type" "shift")
5559 (set_attr "length" "4")])
5561 (define_insn "vextrs64"
5562 [(set (match_operand:DI 0 "register_operand" "=r")
5563 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
5564 (minus:DI (const_int 63)
5565 (match_operand:DI 2 "register_operand" "q"))))]
5567 "extrd,s %1,%%sar,64,%0"
5568 [(set_attr "type" "shift")
5569 (set_attr "length" "4")])
5571 (define_insn "lshrsi3"
5572 [(set (match_operand:SI 0 "register_operand" "=r,r")
5573 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
5574 (match_operand:SI 2 "arith32_operand" "q,n")))]
5577 {vshd %%r0,%1,%0|shrpw %%r0,%1,%%sar,%0}
5578 {extru|extrw,u} %1,%P2,%L2,%0"
5579 [(set_attr "type" "shift")
5580 (set_attr "length" "4")])
5582 (define_insn "lshrdi3"
5583 [(set (match_operand:DI 0 "register_operand" "=r,r")
5584 (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r")
5585 (match_operand:DI 2 "arith32_operand" "q,n")))]
5588 shrpd %%r0,%1,%%sar,%0
5589 extrd,u %1,%p2,%Q2,%0"
5590 [(set_attr "type" "shift")
5591 (set_attr "length" "4")])
5593 (define_insn "rotrsi3"
5594 [(set (match_operand:SI 0 "register_operand" "=r,r")
5595 (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
5596 (match_operand:SI 2 "arith32_operand" "q,n")))]
5600 if (GET_CODE (operands[2]) == CONST_INT)
5602 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
5603 return \"{shd|shrpw} %1,%1,%2,%0\";
5606 return \"{vshd %1,%1,%0|shrpw %1,%1,%%sar,%0}\";
5608 [(set_attr "type" "shift")
5609 (set_attr "length" "4")])
5611 (define_expand "rotlsi3"
5612 [(set (match_operand:SI 0 "register_operand" "")
5613 (rotate:SI (match_operand:SI 1 "register_operand" "")
5614 (match_operand:SI 2 "arith32_operand" "")))]
5618 if (GET_CODE (operands[2]) != CONST_INT)
5620 rtx temp = gen_reg_rtx (SImode);
5621 emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
5622 emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
5625 /* Else expand normally. */
5629 [(set (match_operand:SI 0 "register_operand" "=r")
5630 (rotate:SI (match_operand:SI 1 "register_operand" "r")
5631 (match_operand:SI 2 "const_int_operand" "n")))]
5635 operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
5636 return \"{shd|shrpw} %1,%1,%2,%0\";
5638 [(set_attr "type" "shift")
5639 (set_attr "length" "4")])
5642 [(set (match_operand:SI 0 "register_operand" "=r")
5643 (match_operator:SI 5 "plus_xor_ior_operator"
5644 [(ashift:SI (match_operand:SI 1 "register_operand" "r")
5645 (match_operand:SI 3 "const_int_operand" "n"))
5646 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
5647 (match_operand:SI 4 "const_int_operand" "n"))]))]
5648 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
5649 "{shd|shrpw} %1,%2,%4,%0"
5650 [(set_attr "type" "shift")
5651 (set_attr "length" "4")])
5654 [(set (match_operand:SI 0 "register_operand" "=r")
5655 (match_operator:SI 5 "plus_xor_ior_operator"
5656 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
5657 (match_operand:SI 4 "const_int_operand" "n"))
5658 (ashift:SI (match_operand:SI 1 "register_operand" "r")
5659 (match_operand:SI 3 "const_int_operand" "n"))]))]
5660 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
5661 "{shd|shrpw} %1,%2,%4,%0"
5662 [(set_attr "type" "shift")
5663 (set_attr "length" "4")])
5666 [(set (match_operand:SI 0 "register_operand" "=r")
5667 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
5668 (match_operand:SI 2 "const_int_operand" ""))
5669 (match_operand:SI 3 "const_int_operand" "")))]
5670 "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) >= 0"
5673 int cnt = INTVAL (operands[2]) & 31;
5674 operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
5675 operands[2] = GEN_INT (31 - cnt);
5676 return \"{zdep|depw,z} %1,%2,%3,%0\";
5678 [(set_attr "type" "shift")
5679 (set_attr "length" "4")])
5681 ;; Unconditional and other jump instructions.
5683 ;; This can only be used in a leaf function, so we do
5684 ;; not need to use the PIC register when generating PIC code.
5685 (define_insn "return"
5689 "hppa_can_use_return_insn_p ()"
5693 return \"bve%* (%%r2)\";
5694 return \"bv%* %%r0(%%r2)\";
5696 [(set_attr "type" "branch")
5697 (set_attr "length" "4")])
5699 ;; Emit a different pattern for functions which have non-trivial
5700 ;; epilogues so as not to confuse jump and reorg.
5701 (define_insn "return_internal"
5709 return \"bve%* (%%r2)\";
5710 return \"bv%* %%r0(%%r2)\";
5712 [(set_attr "type" "branch")
5713 (set_attr "length" "4")])
5715 ;; Use the PIC register to ensure it's restored after a
5716 ;; call in PIC mode.
5717 (define_insn "return_internal_pic"
5719 (use (match_operand 0 "register_operand" "r"))
5721 "flag_pic && true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM"
5725 return \"bve%* (%%r2)\";
5726 return \"bv%* %%r0(%%r2)\";
5728 [(set_attr "type" "branch")
5729 (set_attr "length" "4")])
5731 ;; Use the PIC register to ensure it's restored after a
5732 ;; call in PIC mode. This is used for eh returns which
5733 ;; bypass the return stub.
5734 (define_insn "return_external_pic"
5736 (use (match_operand 0 "register_operand" "r"))
5738 (clobber (reg:SI 1))]
5740 && current_function_calls_eh_return
5741 && true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM"
5742 "ldsid (%%sr0,%%r2),%%r1\;mtsp %%r1,%%sr0\;be%* 0(%%sr0,%%r2)"
5743 [(set_attr "type" "branch")
5744 (set_attr "length" "12")])
5746 (define_expand "prologue"
5749 "hppa_expand_prologue ();DONE;")
5751 (define_expand "sibcall_epilogue"
5756 hppa_expand_epilogue ();
5760 (define_expand "epilogue"
5765 /* Try to use the trivial return first. Else use the full
5767 if (hppa_can_use_return_insn_p ())
5768 emit_jump_insn (gen_return ());
5773 hppa_expand_epilogue ();
5776 rtx pic = gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM);
5778 /* EH returns bypass the normal return stub. Thus, we must do an
5779 interspace branch to return from functions that call eh_return.
5780 This is only a problem for returns from shared code. */
5781 if (current_function_calls_eh_return)
5782 x = gen_return_external_pic (pic);
5784 x = gen_return_internal_pic (pic);
5787 x = gen_return_internal ();
5793 ;; Special because we use the value placed in %r2 by the bl instruction
5794 ;; from within its delay slot to set the value for the 2nd parameter to
5796 (define_insn "call_profiler"
5797 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
5798 (match_operand 1 "" ""))
5799 (use (match_operand 2 "" ""))
5802 (clobber (reg:SI 2))]
5808 output_arg_descriptor (insn);
5810 xoperands[0] = operands[0];
5811 xoperands[1] = operands[2];
5812 xoperands[2] = gen_label_rtx ();
5813 output_asm_insn (\"{bl|b,l} %0,%%r2\;ldo %1-%2(%%r2),%%r25\", xoperands);
5815 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
5816 CODE_LABEL_NUMBER (xoperands[2]));
5819 [(set_attr "type" "multi")
5820 (set_attr "length" "8")])
5822 (define_insn "blockage"
5823 [(unspec_volatile [(const_int 2)] 0)]
5826 [(set_attr "length" "0")])
5829 [(set (pc) (label_ref (match_operand 0 "" "")))]
5833 extern int optimize;
5835 if (GET_MODE (insn) == SImode)
5838 /* An unconditional branch which can reach its target. */
5839 if (get_attr_length (insn) != 24
5840 && get_attr_length (insn) != 16)
5843 /* An unconditional branch which can not reach its target.
5845 We need to be able to use %r1 as a scratch register; however,
5846 we can never be sure whether or not it's got a live value in
5847 it. Therefore, we must restore its original value after the
5850 To make matters worse, we don't have a stack slot which we
5851 can always clobber. sp-12/sp-16 shouldn't ever have a live
5852 value during a non-optimizing compilation, so we use those
5853 slots for now. We don't support very long branches when
5854 optimizing -- they should be quite rare when optimizing.
5856 Really the way to go long term is a register scavenger; goto
5857 the target of the jump and find a register which we can use
5858 as a scratch to hold the value in %r1. */
5860 /* We don't know how to register scavenge yet. */
5864 /* First store %r1 into the stack. */
5865 output_asm_insn (\"stw %%r1,-16(%%r30)\", operands);
5867 /* Now load the target address into %r1 and do an indirect jump
5868 to the value specified in %r1. Be careful to generate PIC
5873 xoperands[0] = operands[0];
5874 if (TARGET_SOM || ! TARGET_GAS)
5876 xoperands[1] = gen_label_rtx ();
5878 output_asm_insn (\"{bl|b,l} .+8,%%r1\\n\\taddil L'%l0-%l1,%%r1\",
5880 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
5881 CODE_LABEL_NUMBER (xoperands[1]));
5882 output_asm_insn (\"ldo R'%l0-%l1(%%r1),%%r1\", xoperands);
5886 output_asm_insn (\"{bl|b,l} .+8,%%r1\", xoperands);
5887 output_asm_insn (\"addil L'%l0-$PIC_pcrel$0+4,%%r1\", xoperands);
5888 output_asm_insn (\"ldo R'%l0-$PIC_pcrel$0+8(%%r1),%%r1\", xoperands);
5890 output_asm_insn (\"bv %%r0(%%r1)\", xoperands);
5893 output_asm_insn (\"ldil L'%l0,%%r1\\n\\tbe R'%l0(%%sr4,%%r1)\", operands);;
5895 /* And restore the value of %r1 in the delay slot. We're not optimizing,
5896 so we know nothing else can be in the delay slot. */
5897 return \"ldw -16(%%r30),%%r1\";
5899 [(set_attr "type" "uncond_branch")
5900 (set_attr "pa_combine_type" "uncond_branch")
5901 (set (attr "length")
5902 (cond [(eq (symbol_ref "jump_in_call_delay (insn)") (const_int 1))
5903 (if_then_else (lt (abs (minus (match_dup 0)
5904 (plus (pc) (const_int 8))))
5908 (ge (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
5910 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
5915 ;; Subroutines of "casesi".
5916 ;; operand 0 is index
5917 ;; operand 1 is the minimum bound
5918 ;; operand 2 is the maximum bound - minimum bound + 1
5919 ;; operand 3 is CODE_LABEL for the table;
5920 ;; operand 4 is the CODE_LABEL to go to if index out of range.
5922 (define_expand "casesi"
5923 [(match_operand:SI 0 "general_operand" "")
5924 (match_operand:SI 1 "const_int_operand" "")
5925 (match_operand:SI 2 "const_int_operand" "")
5926 (match_operand 3 "" "")
5927 (match_operand 4 "" "")]
5931 if (GET_CODE (operands[0]) != REG)
5932 operands[0] = force_reg (SImode, operands[0]);
5934 if (operands[1] != const0_rtx)
5936 rtx reg = gen_reg_rtx (SImode);
5938 operands[1] = GEN_INT (-INTVAL (operands[1]));
5939 if (!INT_14_BITS (operands[1]))
5940 operands[1] = force_reg (SImode, operands[1]);
5941 emit_insn (gen_addsi3 (reg, operands[0], operands[1]));
5946 /* In 64bit mode we must make sure to wipe the upper bits of the register
5947 just in case the addition overflowed or we had random bits in the
5948 high part of the register. */
5951 rtx reg = gen_reg_rtx (DImode);
5952 emit_insn (gen_extendsidi2 (reg, operands[0]));
5953 operands[0] = gen_rtx_SUBREG (SImode, reg, 4);
5956 if (!INT_5_BITS (operands[2]))
5957 operands[2] = force_reg (SImode, operands[2]);
5959 emit_insn (gen_cmpsi (operands[0], operands[2]));
5960 emit_jump_insn (gen_bgtu (operands[4]));
5961 if (TARGET_BIG_SWITCH)
5963 rtx temp = gen_reg_rtx (SImode);
5964 emit_move_insn (temp, gen_rtx_PLUS (SImode, operands[0], operands[0]));
5967 emit_jump_insn (gen_casesi0 (operands[0], operands[3]));
5971 (define_insn "casesi0"
5973 (mem:SI (plus:SI (pc)
5974 (match_operand:SI 0 "register_operand" "r")))
5975 (label_ref (match_operand 1 "" ""))))]
5978 [(set_attr "type" "multi")
5979 (set_attr "length" "8")])
5981 ;; Need nops for the calls because execution is supposed to continue
5982 ;; past; we don't want to nullify an instruction that we need.
5983 ;;- jump to subroutine
5985 (define_expand "call"
5986 [(parallel [(call (match_operand:SI 0 "" "")
5987 (match_operand 1 "" ""))
5988 (clobber (reg:SI 2))])]
5995 if (TARGET_PORTABLE_RUNTIME)
5996 op = force_reg (SImode, XEXP (operands[0], 0));
5998 op = XEXP (operands[0], 0);
6001 emit_move_insn (arg_pointer_rtx,
6002 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
6005 /* Use two different patterns for calls to explicitly named functions
6006 and calls through function pointers. This is necessary as these two
6007 types of calls use different calling conventions, and CSE might try
6008 to change the named call into an indirect call in some cases (using
6009 two patterns keeps CSE from performing this optimization). */
6010 if (GET_CODE (op) == SYMBOL_REF)
6011 call_insn = emit_call_insn (gen_call_internal_symref (op, operands[1]));
6012 else if (TARGET_64BIT)
6014 rtx tmpreg = force_reg (word_mode, op);
6015 call_insn = emit_call_insn (gen_call_internal_reg_64bit (tmpreg,
6020 rtx tmpreg = gen_rtx_REG (word_mode, 22);
6021 emit_move_insn (tmpreg, force_reg (word_mode, op));
6022 call_insn = emit_call_insn (gen_call_internal_reg (operands[1]));
6027 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
6029 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
6031 /* After each call we must restore the PIC register, even if it
6032 doesn't appear to be used. */
6033 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
6038 (define_insn "call_internal_symref"
6039 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6040 (match_operand 1 "" "i"))
6041 (clobber (reg:SI 2))
6042 (use (const_int 0))]
6043 "! TARGET_PORTABLE_RUNTIME"
6046 output_arg_descriptor (insn);
6047 return output_call (insn, operands[0], 0);
6049 [(set_attr "type" "call")
6050 (set (attr "length")
6051 ;; If we're sure that we can either reach the target or that the
6052 ;; linker can use a long-branch stub, then the length is at most
6055 ;; For long-calls the length will be at most 68 bytes (non-pic)
6056 ;; or 84 bytes (pic). */
6057 ;; Else we have to use a long-call;
6058 (if_then_else (lt (plus (symbol_ref "total_code_bytes") (pc))
6061 (if_then_else (eq (symbol_ref "flag_pic")
6066 (define_insn "call_internal_reg_64bit"
6067 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
6068 (match_operand 1 "" "i"))
6069 (clobber (reg:SI 2))
6070 (use (const_int 1))]
6074 /* ??? Needs more work. Length computation, split into multiple insns,
6075 do not use %r22 directly, expose delay slot. */
6076 return \"ldd 16(%0),%%r2\;ldd 24(%0),%%r27\;bve,l (%%r2),%%r2\;nop\";
6078 [(set_attr "type" "dyncall")
6079 (set (attr "length") (const_int 16))])
6081 (define_insn "call_internal_reg"
6082 [(call (mem:SI (reg:SI 22))
6083 (match_operand 0 "" "i"))
6084 (clobber (reg:SI 2))
6085 (use (const_int 1))]
6091 /* First the special case for kernels, level 0 systems, etc. */
6092 if (TARGET_FAST_INDIRECT_CALLS)
6093 return \"ble 0(%%sr4,%%r22)\;copy %%r31,%%r2\";
6095 /* Now the normal case -- we can reach $$dyncall directly or
6096 we're sure that we can get there via a long-branch stub.
6098 No need to check target flags as the length uniquely identifies
6099 the remaining cases. */
6100 if (get_attr_length (insn) == 8)
6101 return \".CALL\\tARGW0=GR\;{bl|b,l} $$dyncall,%%r31\;copy %%r31,%%r2\";
6103 /* Long millicode call, but we are not generating PIC or portable runtime
6105 if (get_attr_length (insn) == 12)
6106 return \".CALL\\tARGW0=GR\;ldil L%%$$dyncall,%%r2\;ble R%%$$dyncall(%%sr4,%%r2)\;copy %%r31,%%r2\";
6108 /* Long millicode call for portable runtime. */
6109 if (get_attr_length (insn) == 20)
6110 return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr %%r0,%%r2\;bv,n %%r0(%%r31)\;nop\";
6112 /* If we're generating PIC code. */
6113 xoperands[0] = operands[0];
6114 if (TARGET_SOM || ! TARGET_GAS)
6115 xoperands[1] = gen_label_rtx ();
6116 output_asm_insn (\"{bl|b,l} .+8,%%r1\", xoperands);
6117 if (TARGET_SOM || ! TARGET_GAS)
6119 output_asm_insn (\"addil L%%$$dyncall-%1,%%r1\", xoperands);
6120 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
6121 CODE_LABEL_NUMBER (xoperands[1]));
6122 output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
6126 output_asm_insn (\"addil L%%$$dyncall-$PIC_pcrel$0+4,%%r1\", xoperands);
6127 output_asm_insn (\"ldo R%%$$dyncall-$PIC_pcrel$0+8(%%r1),%%r1\",
6130 output_asm_insn (\"blr %%r0,%%r2\", xoperands);
6131 output_asm_insn (\"bv,n %%r0(%%r1)\\n\\tnop\", xoperands);
6134 [(set_attr "type" "dyncall")
6135 (set (attr "length")
6137 ;; First FAST_INDIRECT_CALLS
6138 (ne (symbol_ref "TARGET_FAST_INDIRECT_CALLS")
6142 ;; Target (or stub) within reach
6143 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
6145 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
6150 (ne (symbol_ref "flag_pic")
6154 ;; Out of reach PORTABLE_RUNTIME
6155 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
6159 ;; Out of reach, can use ble
6162 (define_expand "call_value"
6163 [(parallel [(set (match_operand 0 "" "")
6164 (call (match_operand:SI 1 "" "")
6165 (match_operand 2 "" "")))
6166 (clobber (reg:SI 2))])]
6173 if (TARGET_PORTABLE_RUNTIME)
6174 op = force_reg (word_mode, XEXP (operands[1], 0));
6176 op = XEXP (operands[1], 0);
6179 emit_move_insn (arg_pointer_rtx,
6180 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
6183 /* Use two different patterns for calls to explicitly named functions
6184 and calls through function pointers. This is necessary as these two
6185 types of calls use different calling conventions, and CSE might try
6186 to change the named call into an indirect call in some cases (using
6187 two patterns keeps CSE from performing this optimization). */
6188 if (GET_CODE (op) == SYMBOL_REF)
6189 call_insn = emit_call_insn (gen_call_value_internal_symref (operands[0],
6192 else if (TARGET_64BIT)
6194 rtx tmpreg = force_reg (word_mode, op);
6196 = emit_call_insn (gen_call_value_internal_reg_64bit (operands[0],
6202 rtx tmpreg = gen_rtx_REG (word_mode, 22);
6203 emit_move_insn (tmpreg, force_reg (word_mode, op));
6204 call_insn = emit_call_insn (gen_call_value_internal_reg (operands[0],
6209 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
6211 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
6213 /* After each call we must restore the PIC register, even if it
6214 doesn't appear to be used. */
6215 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
6220 (define_insn "call_value_internal_symref"
6221 [(set (match_operand 0 "" "=rf")
6222 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6223 (match_operand 2 "" "i")))
6224 (clobber (reg:SI 2))
6225 (use (const_int 0))]
6226 ;;- Don't use operand 1 for most machines.
6227 "! TARGET_PORTABLE_RUNTIME"
6230 output_arg_descriptor (insn);
6231 return output_call (insn, operands[1], 0);
6233 [(set_attr "type" "call")
6234 (set (attr "length")
6235 ;; If we're sure that we can either reach the target or that the
6236 ;; linker can use a long-branch stub, then the length is at most
6239 ;; For long-calls the length will be at most 68 bytes (non-pic)
6240 ;; or 84 bytes (pic). */
6241 ;; Else we have to use a long-call;
6242 (if_then_else (lt (plus (symbol_ref "total_code_bytes") (pc))
6245 (if_then_else (eq (symbol_ref "flag_pic")
6250 (define_insn "call_value_internal_reg_64bit"
6251 [(set (match_operand 0 "" "=rf")
6252 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
6253 (match_operand 2 "" "i")))
6254 (clobber (reg:SI 2))
6255 (use (const_int 1))]
6259 /* ??? Needs more work. Length computation, split into multiple insns,
6260 do not use %r22 directly, expose delay slot. */
6261 return \"ldd 16(%1),%%r2\;ldd 24(%1),%%r27\;bve,l (%%r2),%%r2\;nop\";
6263 [(set_attr "type" "dyncall")
6264 (set (attr "length") (const_int 16))])
6266 (define_insn "call_value_internal_reg"
6267 [(set (match_operand 0 "" "=rf")
6268 (call (mem:SI (reg:SI 22))
6269 (match_operand 1 "" "i")))
6270 (clobber (reg:SI 2))
6271 (use (const_int 1))]
6277 /* First the special case for kernels, level 0 systems, etc. */
6278 if (TARGET_FAST_INDIRECT_CALLS)
6279 return \"ble 0(%%sr4,%%r22)\;copy %%r31,%%r2\";
6281 /* Now the normal case -- we can reach $$dyncall directly or
6282 we're sure that we can get there via a long-branch stub.
6284 No need to check target flags as the length uniquely identifies
6285 the remaining cases. */
6286 if (get_attr_length (insn) == 8)
6287 return \".CALL\\tARGW0=GR\;{bl|b,l} $$dyncall,%%r31\;copy %%r31,%%r2\";
6289 /* Long millicode call, but we are not generating PIC or portable runtime
6291 if (get_attr_length (insn) == 12)
6292 return \".CALL\\tARGW0=GR\;ldil L%%$$dyncall,%%r2\;ble R%%$$dyncall(%%sr4,%%r2)\;copy %%r31,%%r2\";
6294 /* Long millicode call for portable runtime. */
6295 if (get_attr_length (insn) == 20)
6296 return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr %%r0,%%r2\;bv,n %%r0(%%r31)\;nop\";
6298 /* If we're generating PIC code. */
6299 xoperands[0] = operands[1];
6300 if (TARGET_SOM || ! TARGET_GAS)
6301 xoperands[1] = gen_label_rtx ();
6302 output_asm_insn (\"{bl|b,l} .+8,%%r1\", xoperands);
6303 if (TARGET_SOM || ! TARGET_GAS)
6305 output_asm_insn (\"addil L%%$$dyncall-%1,%%r1\", xoperands);
6306 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
6307 CODE_LABEL_NUMBER (xoperands[1]));
6308 output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
6312 output_asm_insn (\"addil L%%$$dyncall-$PIC_pcrel$0+4,%%r1\", xoperands);
6313 output_asm_insn (\"ldo R%%$$dyncall-$PIC_pcrel$0+8(%%r1),%%r1\",
6316 output_asm_insn (\"blr %%r0,%%r2\", xoperands);
6317 output_asm_insn (\"bv,n %%r0(%%r1)\\n\\tnop\", xoperands);
6320 [(set_attr "type" "dyncall")
6321 (set (attr "length")
6323 ;; First FAST_INDIRECT_CALLS
6324 (ne (symbol_ref "TARGET_FAST_INDIRECT_CALLS")
6328 ;; Target (or stub) within reach
6329 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
6331 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
6336 (ne (symbol_ref "flag_pic")
6340 ;; Out of reach PORTABLE_RUNTIME
6341 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
6345 ;; Out of reach, can use ble
6348 ;; Call subroutine returning any type.
6350 (define_expand "untyped_call"
6351 [(parallel [(call (match_operand 0 "" "")
6353 (match_operand 1 "" "")
6354 (match_operand 2 "" "")])]
6360 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
6362 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6364 rtx set = XVECEXP (operands[2], 0, i);
6365 emit_move_insn (SET_DEST (set), SET_SRC (set));
6368 /* The optimizer does not know that the call sets the function value
6369 registers we stored in the result block. We avoid problems by
6370 claiming that all hard registers are used and clobbered at this
6372 emit_insn (gen_blockage ());
6377 (define_expand "sibcall"
6378 [(parallel [(call (match_operand:SI 0 "" "")
6379 (match_operand 1 "" ""))
6380 (clobber (reg:SI 0))])]
6381 "! TARGET_PORTABLE_RUNTIME"
6387 op = XEXP (operands[0], 0);
6389 /* We do not allow indirect sibling calls. */
6390 call_insn = emit_call_insn (gen_sibcall_internal_symref (op, operands[1]));
6394 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
6396 /* After each call we must restore the PIC register, even if it
6397 doesn't appear to be used. */
6398 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
6403 (define_insn "sibcall_internal_symref"
6404 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
6405 (match_operand 1 "" "i"))
6406 (clobber (reg:SI 0))
6408 (use (const_int 0))]
6409 "! TARGET_PORTABLE_RUNTIME"
6412 output_arg_descriptor (insn);
6413 return output_call (insn, operands[0], 1);
6415 [(set_attr "type" "call")
6416 (set (attr "length")
6417 ;; If we're sure that we can either reach the target or that the
6418 ;; linker can use a long-branch stub, then the length is at most
6421 ;; For long-calls the length will be at most 68 bytes (non-pic)
6422 ;; or 84 bytes (pic). */
6423 ;; Else we have to use a long-call;
6424 (if_then_else (lt (plus (symbol_ref "total_code_bytes") (pc))
6427 (if_then_else (eq (symbol_ref "flag_pic")
6432 (define_expand "sibcall_value"
6433 [(parallel [(set (match_operand 0 "" "")
6434 (call (match_operand:SI 1 "" "")
6435 (match_operand 2 "" "")))
6436 (clobber (reg:SI 0))])]
6437 "! TARGET_PORTABLE_RUNTIME"
6443 op = XEXP (operands[1], 0);
6445 /* We do not allow indirect sibling calls. */
6446 call_insn = emit_call_insn (gen_sibcall_value_internal_symref (operands[0],
6451 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
6453 /* After each call we must restore the PIC register, even if it
6454 doesn't appear to be used. */
6455 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
6460 (define_insn "sibcall_value_internal_symref"
6461 [(set (match_operand 0 "" "=rf")
6462 (call (mem:SI (match_operand 1 "call_operand_address" ""))
6463 (match_operand 2 "" "i")))
6464 (clobber (reg:SI 0))
6466 (use (const_int 0))]
6467 ;;- Don't use operand 1 for most machines.
6468 "! TARGET_PORTABLE_RUNTIME"
6471 output_arg_descriptor (insn);
6472 return output_call (insn, operands[1], 1);
6474 [(set_attr "type" "call")
6475 (set (attr "length")
6476 ;; If we're sure that we can either reach the target or that the
6477 ;; linker can use a long-branch stub, then the length is at most
6480 ;; For long-calls the length will be at most 68 bytes (non-pic)
6481 ;; or 84 bytes (pic). */
6482 ;; Else we have to use a long-call;
6483 (if_then_else (lt (plus (symbol_ref "total_code_bytes") (pc))
6486 (if_then_else (eq (symbol_ref "flag_pic")
6495 [(set_attr "type" "move")
6496 (set_attr "length" "4")])
6498 ;; These are just placeholders so we know where branch tables
6500 (define_insn "begin_brtab"
6505 /* Only GAS actually supports this pseudo-op. */
6507 return \".begin_brtab\";
6511 [(set_attr "type" "move")
6512 (set_attr "length" "0")])
6514 (define_insn "end_brtab"
6519 /* Only GAS actually supports this pseudo-op. */
6521 return \".end_brtab\";
6525 [(set_attr "type" "move")
6526 (set_attr "length" "0")])
6528 ;;; EH does longjmp's from and within the data section. Thus,
6529 ;;; an interspace branch is required for the longjmp implementation.
6530 ;;; Registers r1 and r2 are used as scratch registers for the jump.
6531 (define_expand "interspace_jump"
6533 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
6534 (clobber (match_dup 1))])]
6538 operands[1] = gen_rtx_REG (word_mode, 2);
6542 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
6543 (clobber (reg:SI 2))]
6545 "ldsid (%%sr0,%0),%%r2\; mtsp %%r2,%%sr0\; be%* 0(%%sr0,%0)"
6546 [(set_attr "type" "branch")
6547 (set_attr "length" "12")])
6550 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
6551 (clobber (reg:DI 2))]
6553 "ldsid (%%sr0,%0),%%r2\; mtsp %%r2,%%sr0\; be%* 0(%%sr0,%0)"
6554 [(set_attr "type" "branch")
6555 (set_attr "length" "12")])
6557 (define_expand "builtin_longjmp"
6558 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
6562 /* The elements of the buffer are, in order: */
6563 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6564 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0],
6565 POINTER_SIZE / BITS_PER_UNIT));
6566 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0],
6567 (POINTER_SIZE * 2) / BITS_PER_UNIT));
6568 rtx pv = gen_rtx_REG (Pmode, 1);
6570 /* This bit is the same as expand_builtin_longjmp. */
6571 emit_move_insn (hard_frame_pointer_rtx, fp);
6572 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6573 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
6574 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
6576 /* Load the label we are jumping through into r1 so that we know
6577 where to look for it when we get back to setjmp's function for
6578 restoring the gp. */
6579 emit_move_insn (pv, lab);
6581 /* Prevent the insns above from being scheduled into the delay slot
6582 of the interspace jump because the space register could change. */
6583 emit_insn (gen_blockage ());
6585 emit_jump_insn (gen_interspace_jump (pv));
6590 ;;; Hope this is only within a function...
6591 (define_insn "indirect_jump"
6592 [(set (pc) (match_operand 0 "register_operand" "r"))]
6593 "GET_MODE (operands[0]) == word_mode"
6595 [(set_attr "type" "branch")
6596 (set_attr "length" "4")])
6598 (define_expand "extzv"
6599 [(set (match_operand 0 "register_operand" "")
6600 (zero_extract (match_operand 1 "register_operand" "")
6601 (match_operand 2 "uint32_operand" "")
6602 (match_operand 3 "uint32_operand" "")))]
6607 emit_insn (gen_extzv_64 (operands[0], operands[1],
6608 operands[2], operands[3]));
6610 emit_insn (gen_extzv_32 (operands[0], operands[1],
6611 operands[2], operands[3]));
6615 (define_insn "extzv_32"
6616 [(set (match_operand:SI 0 "register_operand" "=r")
6617 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
6618 (match_operand:SI 2 "uint5_operand" "")
6619 (match_operand:SI 3 "uint5_operand" "")))]
6621 "{extru|extrw,u} %1,%3+%2-1,%2,%0"
6622 [(set_attr "type" "shift")
6623 (set_attr "length" "4")])
6626 [(set (match_operand:SI 0 "register_operand" "=r")
6627 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
6629 (match_operand:SI 2 "register_operand" "q")))]
6631 "{vextru %1,1,%0|extrw,u %1,%%sar,1,%0}"
6632 [(set_attr "type" "shift")
6633 (set_attr "length" "4")])
6635 (define_insn "extzv_64"
6636 [(set (match_operand:DI 0 "register_operand" "=r")
6637 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
6638 (match_operand:DI 2 "uint32_operand" "")
6639 (match_operand:DI 3 "uint32_operand" "")))]
6641 "extrd,u %1,%3+%2-1,%2,%0"
6642 [(set_attr "type" "shift")
6643 (set_attr "length" "4")])
6646 [(set (match_operand:DI 0 "register_operand" "=r")
6647 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
6649 (match_operand:DI 2 "register_operand" "q")))]
6651 "extrd,u %1,%%sar,1,%0"
6652 [(set_attr "type" "shift")
6653 (set_attr "length" "4")])
6655 (define_expand "extv"
6656 [(set (match_operand 0 "register_operand" "")
6657 (sign_extract (match_operand 1 "register_operand" "")
6658 (match_operand 2 "uint32_operand" "")
6659 (match_operand 3 "uint32_operand" "")))]
6664 emit_insn (gen_extv_64 (operands[0], operands[1],
6665 operands[2], operands[3]));
6667 emit_insn (gen_extv_32 (operands[0], operands[1],
6668 operands[2], operands[3]));
6672 (define_insn "extv_32"
6673 [(set (match_operand:SI 0 "register_operand" "=r")
6674 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
6675 (match_operand:SI 2 "uint5_operand" "")
6676 (match_operand:SI 3 "uint5_operand" "")))]
6678 "{extrs|extrw,s} %1,%3+%2-1,%2,%0"
6679 [(set_attr "type" "shift")
6680 (set_attr "length" "4")])
6683 [(set (match_operand:SI 0 "register_operand" "=r")
6684 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
6686 (match_operand:SI 2 "register_operand" "q")))]
6688 "{vextrs %1,1,%0|extrw,s %1,%%sar,1,%0}"
6689 [(set_attr "type" "shift")
6690 (set_attr "length" "4")])
6692 (define_insn "extv_64"
6693 [(set (match_operand:DI 0 "register_operand" "=r")
6694 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
6695 (match_operand:DI 2 "uint32_operand" "")
6696 (match_operand:DI 3 "uint32_operand" "")))]
6698 "extrd,s %1,%3+%2-1,%2,%0"
6699 [(set_attr "type" "shift")
6700 (set_attr "length" "4")])
6703 [(set (match_operand:DI 0 "register_operand" "=r")
6704 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
6706 (match_operand:DI 2 "register_operand" "q")))]
6708 "extrd,s %1,%%sar,1,%0"
6709 [(set_attr "type" "shift")
6710 (set_attr "length" "4")])
6712 ;; Only specify the mode operands 0, the rest are assumed to be word_mode.
6713 (define_expand "insv"
6714 [(set (zero_extract (match_operand 0 "register_operand" "")
6715 (match_operand 1 "uint32_operand" "")
6716 (match_operand 2 "uint32_operand" ""))
6717 (match_operand 3 "arith5_operand" ""))]
6722 emit_insn (gen_insv_64 (operands[0], operands[1],
6723 operands[2], operands[3]));
6725 emit_insn (gen_insv_32 (operands[0], operands[1],
6726 operands[2], operands[3]));
6730 (define_insn "insv_32"
6731 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
6732 (match_operand:SI 1 "uint5_operand" "")
6733 (match_operand:SI 2 "uint5_operand" ""))
6734 (match_operand:SI 3 "arith5_operand" "r,L"))]
6737 {dep|depw} %3,%2+%1-1,%1,%0
6738 {depi|depwi} %3,%2+%1-1,%1,%0"
6739 [(set_attr "type" "shift,shift")
6740 (set_attr "length" "4,4")])
6742 ;; Optimize insertion of const_int values of type 1...1xxxx.
6744 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
6745 (match_operand:SI 1 "uint5_operand" "")
6746 (match_operand:SI 2 "uint5_operand" ""))
6747 (match_operand:SI 3 "const_int_operand" ""))]
6748 "(INTVAL (operands[3]) & 0x10) != 0 &&
6749 (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
6752 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
6753 return \"{depi|depwi} %3,%2+%1-1,%1,%0\";
6755 [(set_attr "type" "shift")
6756 (set_attr "length" "4")])
6758 (define_insn "insv_64"
6759 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r,r")
6760 (match_operand:DI 1 "uint32_operand" "")
6761 (match_operand:DI 2 "uint32_operand" ""))
6762 (match_operand:DI 3 "arith32_operand" "r,L"))]
6765 depd %3,%2+%1-1,%1,%0
6766 depdi %3,%2+%1-1,%1,%0"
6767 [(set_attr "type" "shift,shift")
6768 (set_attr "length" "4,4")])
6770 ;; Optimize insertion of const_int values of type 1...1xxxx.
6772 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
6773 (match_operand:DI 1 "uint32_operand" "")
6774 (match_operand:DI 2 "uint32_operand" ""))
6775 (match_operand:DI 3 "const_int_operand" ""))]
6776 "(INTVAL (operands[3]) & 0x10) != 0
6778 && (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
6781 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
6782 return \"depdi %3,%2+%1-1,%1,%0\";
6784 [(set_attr "type" "shift")
6785 (set_attr "length" "4")])
6788 [(set (match_operand:DI 0 "register_operand" "=r")
6789 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
6792 "depd,z %1,31,32,%0"
6793 [(set_attr "type" "shift")
6794 (set_attr "length" "4")])
6796 ;; This insn is used for some loop tests, typically loops reversed when
6797 ;; strength reduction is used. It is actually created when the instruction
6798 ;; combination phase combines the special loop test. Since this insn
6799 ;; is both a jump insn and has an output, it must deal with its own
6800 ;; reloads, hence the `m' constraints. The `!' constraints direct reload
6801 ;; to not choose the register alternatives in the event a reload is needed.
6802 (define_insn "decrement_and_branch_until_zero"
6805 (match_operator 2 "comparison_operator"
6807 (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*m")
6808 (match_operand:SI 1 "int5_operand" "L,L,L"))
6810 (label_ref (match_operand 3 "" ""))
6813 (plus:SI (match_dup 0) (match_dup 1)))
6814 (clobber (match_scratch:SI 4 "=X,r,r"))]
6816 "* return output_dbra (operands, insn, which_alternative); "
6817 ;; Do not expect to understand this the first time through.
6818 [(set_attr "type" "cbranch,multi,multi")
6819 (set (attr "length")
6820 (if_then_else (eq_attr "alternative" "0")
6821 ;; Loop counter in register case
6822 ;; Short branch has length of 4
6823 ;; Long branch has length of 8
6824 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6829 ;; Loop counter in FP reg case.
6830 ;; Extra goo to deal with additional reload insns.
6831 (if_then_else (eq_attr "alternative" "1")
6832 (if_then_else (lt (match_dup 3) (pc))
6834 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
6839 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6843 ;; Loop counter in memory case.
6844 ;; Extra goo to deal with additional reload insns.
6845 (if_then_else (lt (match_dup 3) (pc))
6847 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
6852 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6855 (const_int 16))))))])
6860 (match_operator 2 "movb_comparison_operator"
6861 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
6862 (label_ref (match_operand 3 "" ""))
6864 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
6867 "* return output_movb (operands, insn, which_alternative, 0); "
6868 ;; Do not expect to understand this the first time through.
6869 [(set_attr "type" "cbranch,multi,multi,multi")
6870 (set (attr "length")
6871 (if_then_else (eq_attr "alternative" "0")
6872 ;; Loop counter in register case
6873 ;; Short branch has length of 4
6874 ;; Long branch has length of 8
6875 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6880 ;; Loop counter in FP reg case.
6881 ;; Extra goo to deal with additional reload insns.
6882 (if_then_else (eq_attr "alternative" "1")
6883 (if_then_else (lt (match_dup 3) (pc))
6885 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
6890 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6894 ;; Loop counter in memory or sar case.
6895 ;; Extra goo to deal with additional reload insns.
6897 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6900 (const_int 12)))))])
6902 ;; Handle negated branch.
6906 (match_operator 2 "movb_comparison_operator"
6907 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
6909 (label_ref (match_operand 3 "" ""))))
6910 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
6913 "* return output_movb (operands, insn, which_alternative, 1); "
6914 ;; Do not expect to understand this the first time through.
6915 [(set_attr "type" "cbranch,multi,multi,multi")
6916 (set (attr "length")
6917 (if_then_else (eq_attr "alternative" "0")
6918 ;; Loop counter in register case
6919 ;; Short branch has length of 4
6920 ;; Long branch has length of 8
6921 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6926 ;; Loop counter in FP reg case.
6927 ;; Extra goo to deal with additional reload insns.
6928 (if_then_else (eq_attr "alternative" "1")
6929 (if_then_else (lt (match_dup 3) (pc))
6931 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
6936 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6940 ;; Loop counter in memory or SAR case.
6941 ;; Extra goo to deal with additional reload insns.
6943 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6946 (const_int 12)))))])
6949 [(set (pc) (label_ref (match_operand 3 "" "" )))
6950 (set (match_operand:SI 0 "ireg_operand" "=r")
6951 (plus:SI (match_operand:SI 1 "ireg_operand" "r")
6952 (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
6953 "(reload_completed && operands[0] == operands[1]) || operands[0] == operands[2]"
6956 return output_parallel_addb (operands, get_attr_length (insn));
6958 [(set_attr "type" "parallel_branch")
6959 (set (attr "length")
6960 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
6966 [(set (pc) (label_ref (match_operand 2 "" "" )))
6967 (set (match_operand:SF 0 "ireg_operand" "=r")
6968 (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
6972 return output_parallel_movb (operands, get_attr_length (insn));
6974 [(set_attr "type" "parallel_branch")
6975 (set (attr "length")
6976 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
6982 [(set (pc) (label_ref (match_operand 2 "" "" )))
6983 (set (match_operand:SI 0 "ireg_operand" "=r")
6984 (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
6988 return output_parallel_movb (operands, get_attr_length (insn));
6990 [(set_attr "type" "parallel_branch")
6991 (set (attr "length")
6992 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
6998 [(set (pc) (label_ref (match_operand 2 "" "" )))
6999 (set (match_operand:HI 0 "ireg_operand" "=r")
7000 (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
7004 return output_parallel_movb (operands, get_attr_length (insn));
7006 [(set_attr "type" "parallel_branch")
7007 (set (attr "length")
7008 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
7014 [(set (pc) (label_ref (match_operand 2 "" "" )))
7015 (set (match_operand:QI 0 "ireg_operand" "=r")
7016 (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
7020 return output_parallel_movb (operands, get_attr_length (insn));
7022 [(set_attr "type" "parallel_branch")
7023 (set (attr "length")
7024 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
7030 [(set (match_operand 0 "register_operand" "=f")
7031 (mult (match_operand 1 "register_operand" "f")
7032 (match_operand 2 "register_operand" "f")))
7033 (set (match_operand 3 "register_operand" "+f")
7034 (plus (match_operand 4 "register_operand" "f")
7035 (match_operand 5 "register_operand" "f")))]
7036 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7037 && reload_completed && fmpyaddoperands (operands)"
7040 if (GET_MODE (operands[0]) == DFmode)
7042 if (rtx_equal_p (operands[3], operands[5]))
7043 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
7045 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
7049 if (rtx_equal_p (operands[3], operands[5]))
7050 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
7052 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
7055 [(set_attr "type" "fpalu")
7056 (set_attr "length" "4")])
7059 [(set (match_operand 3 "register_operand" "+f")
7060 (plus (match_operand 4 "register_operand" "f")
7061 (match_operand 5 "register_operand" "f")))
7062 (set (match_operand 0 "register_operand" "=f")
7063 (mult (match_operand 1 "register_operand" "f")
7064 (match_operand 2 "register_operand" "f")))]
7065 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7066 && reload_completed && fmpyaddoperands (operands)"
7069 if (GET_MODE (operands[0]) == DFmode)
7071 if (rtx_equal_p (operands[3], operands[5]))
7072 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
7074 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
7078 if (rtx_equal_p (operands[3], operands[5]))
7079 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
7081 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
7084 [(set_attr "type" "fpalu")
7085 (set_attr "length" "4")])
7088 [(set (match_operand 0 "register_operand" "=f")
7089 (mult (match_operand 1 "register_operand" "f")
7090 (match_operand 2 "register_operand" "f")))
7091 (set (match_operand 3 "register_operand" "+f")
7092 (minus (match_operand 4 "register_operand" "f")
7093 (match_operand 5 "register_operand" "f")))]
7094 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7095 && reload_completed && fmpysuboperands (operands)"
7098 if (GET_MODE (operands[0]) == DFmode)
7099 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
7101 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
7103 [(set_attr "type" "fpalu")
7104 (set_attr "length" "4")])
7107 [(set (match_operand 3 "register_operand" "+f")
7108 (minus (match_operand 4 "register_operand" "f")
7109 (match_operand 5 "register_operand" "f")))
7110 (set (match_operand 0 "register_operand" "=f")
7111 (mult (match_operand 1 "register_operand" "f")
7112 (match_operand 2 "register_operand" "f")))]
7113 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
7114 && reload_completed && fmpysuboperands (operands)"
7117 if (GET_MODE (operands[0]) == DFmode)
7118 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
7120 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
7122 [(set_attr "type" "fpalu")
7123 (set_attr "length" "4")])
7125 ;; Clean up turds left by reload.
7127 [(set (match_operand 0 "reg_or_nonsymb_mem_operand" "")
7128 (match_operand 1 "register_operand" "fr"))
7129 (set (match_operand 2 "register_operand" "fr")
7131 "! TARGET_SOFT_FLOAT
7132 && GET_CODE (operands[0]) == MEM
7133 && ! MEM_VOLATILE_P (operands[0])
7134 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7135 && GET_MODE (operands[0]) == GET_MODE (operands[2])
7136 && GET_MODE (operands[0]) == DFmode
7137 && GET_CODE (operands[1]) == REG
7138 && GET_CODE (operands[2]) == REG
7139 && ! side_effects_p (XEXP (operands[0], 0))
7140 && REGNO_REG_CLASS (REGNO (operands[1]))
7141 == REGNO_REG_CLASS (REGNO (operands[2]))"
7146 if (FP_REG_P (operands[1]))
7147 output_asm_insn (output_fp_move_double (operands), operands);
7149 output_asm_insn (output_move_double (operands), operands);
7151 if (rtx_equal_p (operands[1], operands[2]))
7154 xoperands[0] = operands[2];
7155 xoperands[1] = operands[1];
7157 if (FP_REG_P (xoperands[1]))
7158 output_asm_insn (output_fp_move_double (xoperands), xoperands);
7160 output_asm_insn (output_move_double (xoperands), xoperands);
7166 [(set (match_operand 0 "register_operand" "fr")
7167 (match_operand 1 "reg_or_nonsymb_mem_operand" ""))
7168 (set (match_operand 2 "register_operand" "fr")
7170 "! TARGET_SOFT_FLOAT
7171 && GET_CODE (operands[1]) == MEM
7172 && ! MEM_VOLATILE_P (operands[1])
7173 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7174 && GET_MODE (operands[0]) == GET_MODE (operands[2])
7175 && GET_MODE (operands[0]) == DFmode
7176 && GET_CODE (operands[0]) == REG
7177 && GET_CODE (operands[2]) == REG
7178 && ! side_effects_p (XEXP (operands[1], 0))
7179 && REGNO_REG_CLASS (REGNO (operands[0]))
7180 == REGNO_REG_CLASS (REGNO (operands[2]))"
7185 if (FP_REG_P (operands[0]))
7186 output_asm_insn (output_fp_move_double (operands), operands);
7188 output_asm_insn (output_move_double (operands), operands);
7190 xoperands[0] = operands[2];
7191 xoperands[1] = operands[0];
7193 if (FP_REG_P (xoperands[1]))
7194 output_asm_insn (output_fp_move_double (xoperands), xoperands);
7196 output_asm_insn (output_move_double (xoperands), xoperands);
7201 ;; Flush the I and D cache line found at the address in operand 0.
7202 ;; This is used by the trampoline code for nested functions.
7203 ;; So long as the trampoline itself is less than 32 bytes this
7206 (define_insn "dcacheflush"
7207 [(unspec_volatile [(const_int 1)] 0)
7208 (use (mem:SI (match_operand 0 "pmode_register_operand" "r")))
7209 (use (mem:SI (match_operand 1 "pmode_register_operand" "r")))]
7211 "fdc 0(%0)\;fdc 0(%1)\;sync"
7212 [(set_attr "type" "multi")
7213 (set_attr "length" "12")])
7215 (define_insn "icacheflush"
7216 [(unspec_volatile [(const_int 2)] 0)
7217 (use (mem:SI (match_operand 0 "pmode_register_operand" "r")))
7218 (use (mem:SI (match_operand 1 "pmode_register_operand" "r")))
7219 (use (match_operand 2 "pmode_register_operand" "r"))
7220 (clobber (match_operand 3 "pmode_register_operand" "=&r"))
7221 (clobber (match_operand 4 "pmode_register_operand" "=&r"))]
7223 "mfsp %%sr0,%4\;ldsid (%2),%3\;mtsp %3,%%sr0\;fic 0(%%sr0,%0)\;fic 0(%%sr0,%1)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop"
7224 [(set_attr "type" "multi")
7225 (set_attr "length" "52")])
7227 ;; An out-of-line prologue.
7228 (define_insn "outline_prologue_call"
7229 [(unspec_volatile [(const_int 0)] 0)
7230 (clobber (reg:SI 31))
7231 (clobber (reg:SI 22))
7232 (clobber (reg:SI 21))
7233 (clobber (reg:SI 20))
7234 (clobber (reg:SI 19))
7235 (clobber (reg:SI 1))]
7239 extern int frame_pointer_needed;
7241 /* We need two different versions depending on whether or not we
7242 need a frame pointer. Also note that we return to the instruction
7243 immediately after the branch rather than two instructions after the
7244 break as normally is the case. */
7245 if (frame_pointer_needed)
7247 /* Must import the magic millicode routine(s). */
7248 output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
7250 if (TARGET_PORTABLE_RUNTIME)
7252 output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
7253 output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
7257 output_asm_insn (\"{bl|b,l},n __outline_prologue_fp,%%r31\", NULL);
7261 /* Must import the magic millicode routine(s). */
7262 output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
7264 if (TARGET_PORTABLE_RUNTIME)
7266 output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
7267 output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
7270 output_asm_insn (\"{bl|b,l},n __outline_prologue,%%r31\", NULL);
7274 [(set_attr "type" "multi")
7275 (set_attr "length" "8")])
7277 ;; An out-of-line epilogue.
7278 (define_insn "outline_epilogue_call"
7279 [(unspec_volatile [(const_int 1)] 0)
7282 (clobber (reg:SI 31))
7283 (clobber (reg:SI 22))
7284 (clobber (reg:SI 21))
7285 (clobber (reg:SI 20))
7286 (clobber (reg:SI 19))
7287 (clobber (reg:SI 2))
7288 (clobber (reg:SI 1))]
7292 extern int frame_pointer_needed;
7294 /* We need two different versions depending on whether or not we
7295 need a frame pointer. Also note that we return to the instruction
7296 immediately after the branch rather than two instructions after the
7297 break as normally is the case. */
7298 if (frame_pointer_needed)
7300 /* Must import the magic millicode routine. */
7301 output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
7303 /* The out-of-line prologue will make sure we return to the right
7305 if (TARGET_PORTABLE_RUNTIME)
7307 output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
7308 output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
7312 output_asm_insn (\"{bl|b,l},n __outline_epilogue_fp,%%r31\", NULL);
7316 /* Must import the magic millicode routine. */
7317 output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
7319 /* The out-of-line prologue will make sure we return to the right
7321 if (TARGET_PORTABLE_RUNTIME)
7323 output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
7324 output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
7327 output_asm_insn (\"{bl|b,l},n __outline_epilogue,%%r31\", NULL);
7331 [(set_attr "type" "multi")
7332 (set_attr "length" "8")])
7334 ;; Given a function pointer, canonicalize it so it can be
7335 ;; reliably compared to another function pointer. */
7336 (define_expand "canonicalize_funcptr_for_compare"
7337 [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
7338 (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] 0))
7339 (clobber (match_dup 2))
7340 (clobber (reg:SI 26))
7341 (clobber (reg:SI 22))
7342 (clobber (reg:SI 31))])
7343 (set (match_operand:SI 0 "register_operand" "")
7345 "! TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && !TARGET_ELF32"
7348 operands[2] = gen_reg_rtx (SImode);
7349 if (GET_CODE (operands[1]) != REG)
7351 rtx tmp = gen_reg_rtx (Pmode);
7352 emit_move_insn (tmp, operands[1]);
7358 [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] 0))
7359 (clobber (match_operand:SI 0 "register_operand" "=a"))
7360 (clobber (reg:SI 26))
7361 (clobber (reg:SI 22))
7362 (clobber (reg:SI 31))]
7366 /* Must import the magic millicode routine. */
7367 output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
7369 /* This is absolutely amazing.
7371 First, copy our input parameter into %r29 just in case we don't
7372 need to call $$sh_func_adrs. */
7373 output_asm_insn (\"copy %%r26,%%r29\", NULL);
7375 /* Next, examine the low two bits in %r26, if they aren't 0x2, then
7376 we use %r26 unchanged. */
7377 if (get_attr_length (insn) == 32)
7378 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\;{comib|cmpib},<>,n 2,%%r31,.+24\", NULL);
7379 else if (get_attr_length (insn) == 40)
7380 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\;{comib|cmpib},<>,n 2,%%r31,.+32\", NULL);
7381 else if (get_attr_length (insn) == 44)
7382 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\;{comib|cmpib},<>,n 2,%%r31,.+36\", NULL);
7384 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\;{comib|cmpib},<>,n 2,%%r31,.+20\", NULL);
7386 /* Next, compare %r26 with 4096, if %r26 is less than or equal to
7387 4096, then we use %r26 unchanged. */
7388 if (get_attr_length (insn) == 32)
7389 output_asm_insn (\"ldi 4096,%%r31\;{comb|cmpb},<<,n %%r26,%%r31,.+16\",
7391 else if (get_attr_length (insn) == 40)
7392 output_asm_insn (\"ldi 4096,%%r31\;{comb|cmpb},<<,n %%r26,%%r31,.+24\",
7394 else if (get_attr_length (insn) == 44)
7395 output_asm_insn (\"ldi 4096,%%r31\;{comb|cmpb},<<,n %%r26,%%r31,.+28\",
7398 output_asm_insn (\"ldi 4096,%%r31\;{comb|cmpb},<<,n %%r26,%%r31,.+12\",
7401 /* Else call $$sh_func_adrs to extract the function's real add24. */
7402 return output_millicode_call (insn,
7403 gen_rtx_SYMBOL_REF (SImode,
7404 \"$$sh_func_adrs\"));
7406 [(set_attr "type" "multi")
7407 (set (attr "length")
7409 ;; Target (or stub) within reach
7410 (and (lt (plus (symbol_ref "total_code_bytes") (pc))
7412 (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
7417 (ne (symbol_ref "flag_pic")
7421 ;; Out of reach PORTABLE_RUNTIME
7422 (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
7426 ;; Out of reach, can use ble
7429 ;; On the PA, the PIC register is call clobbered, so it must
7430 ;; be saved & restored around calls by the caller. If the call
7431 ;; doesn't return normally (nonlocal goto, or an exception is
7432 ;; thrown), then the code at the exception handler label must
7433 ;; restore the PIC register.
7434 (define_expand "exception_receiver"
7439 /* Restore the PIC register using hppa_pic_save_rtx (). The
7440 PIC register is not saved in the frame in 64-bit ABI. */
7441 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
7445 (define_expand "builtin_setjmp_receiver"
7446 [(label_ref (match_operand 0 "" ""))]
7450 /* Restore the PIC register. Hopefully, this will always be from
7451 a stack slot. The only registers that are valid after a
7452 builtin_longjmp are the stack and frame pointers. */
7453 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());