1 ;;- Machine description for HP PA-RISC architecture for GCC compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
3 ;; 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 ;; Contributed by the Center for Software Science at the University
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, 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 ;; Uses of UNSPEC in this file:
32 [(UNSPEC_CFFC 0) ; canonicalize_funcptr_for_compare
33 (UNSPEC_GOTO 1) ; indirect_goto
34 (UNSPEC_DLTIND14R 2) ;
43 (UNSPEC_TLSLDM_PIC 11)
50 [(UNSPECV_BLOCKAGE 0) ; blockage
51 (UNSPECV_DCACHE 1) ; dcacheflush
52 (UNSPECV_ICACHE 2) ; icacheflush
53 (UNSPECV_OPC 3) ; outline_prologue_call
54 (UNSPECV_OEC 4) ; outline_epilogue_call
55 (UNSPECV_LONGJMP 5) ; builtin_longjmp
58 ;; Insn type. Used to default other attribute values.
60 ;; type "unary" insns have one input operand (1) and one output operand (0)
61 ;; type "binary" insns have two input operands (1,2) and one output (0)
64 "move,unary,binary,shift,nullshift,compare,load,store,uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,fpload,fpstore,fpalu,fpcc,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,multi,milli,parallel_branch"
65 (const_string "binary"))
67 (define_attr "pa_combine_type"
68 "fmpy,faddsub,uncond_branch,addmove,none"
69 (const_string "none"))
71 ;; Processor type (for scheduling, not code generation) -- this attribute
72 ;; must exactly match the processor_type enumeration in pa.h.
74 ;; FIXME: Add 800 scheduling for completeness?
76 (define_attr "cpu" "700,7100,7100LC,7200,7300,8000" (const (symbol_ref "pa_cpu_attr")))
78 ;; Length (in # of bytes).
79 (define_attr "length" ""
80 (cond [(eq_attr "type" "load,fpload")
81 (if_then_else (match_operand 1 "symbolic_memory_operand" "")
82 (const_int 8) (const_int 4))
84 (eq_attr "type" "store,fpstore")
85 (if_then_else (match_operand 0 "symbolic_memory_operand" "")
86 (const_int 8) (const_int 4))
88 (eq_attr "type" "binary,shift,nullshift")
89 (if_then_else (match_operand 2 "arith_operand" "")
90 (const_int 4) (const_int 12))
92 (eq_attr "type" "move,unary,shift,nullshift")
93 (if_then_else (match_operand 1 "arith_operand" "")
94 (const_int 4) (const_int 8))]
98 (define_asm_attributes
99 [(set_attr "length" "4")
100 (set_attr "type" "multi")])
102 ;; Attributes for instruction and branch scheduling
104 ;; For conditional branches.
105 (define_attr "in_branch_delay" "false,true"
106 (if_then_else (and (eq_attr "type" "!uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
107 (eq_attr "length" "4"))
108 (const_string "true")
109 (const_string "false")))
111 ;; Disallow instructions which use the FPU since they will tie up the FPU
112 ;; even if the instruction is nullified.
113 (define_attr "in_nullified_branch_delay" "false,true"
114 (if_then_else (and (eq_attr "type" "!uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch")
115 (eq_attr "length" "4"))
116 (const_string "true")
117 (const_string "false")))
119 ;; For calls and millicode calls. Allow unconditional branches in the
121 (define_attr "in_call_delay" "false,true"
122 (cond [(and (eq_attr "type" "!uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
123 (eq_attr "length" "4"))
124 (const_string "true")
125 (eq_attr "type" "uncond_branch")
126 (if_then_else (ne (symbol_ref "TARGET_JUMP_IN_DELAY")
128 (const_string "true")
129 (const_string "false"))]
130 (const_string "false")))
133 ;; Call delay slot description.
134 (define_delay (eq_attr "type" "call")
135 [(eq_attr "in_call_delay" "true") (nil) (nil)])
137 ;; Millicode call delay slot description.
138 (define_delay (eq_attr "type" "milli")
139 [(eq_attr "in_call_delay" "true") (nil) (nil)])
141 ;; Return and other similar instructions.
142 (define_delay (eq_attr "type" "btable_branch,branch,parallel_branch")
143 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
145 ;; Floating point conditional branch delay slot description and
146 (define_delay (eq_attr "type" "fbranch")
147 [(eq_attr "in_branch_delay" "true")
148 (eq_attr "in_nullified_branch_delay" "true")
151 ;; Integer conditional branch delay slot description.
152 ;; Nullification of conditional branches on the PA is dependent on the
153 ;; direction of the branch. Forward branches nullify true and
154 ;; backward branches nullify false. If the direction is unknown
155 ;; then nullification is not allowed.
156 (define_delay (eq_attr "type" "cbranch")
157 [(eq_attr "in_branch_delay" "true")
158 (and (eq_attr "in_nullified_branch_delay" "true")
159 (attr_flag "forward"))
160 (and (eq_attr "in_nullified_branch_delay" "true")
161 (attr_flag "backward"))])
163 (define_delay (and (eq_attr "type" "uncond_branch")
164 (eq (symbol_ref "following_call (insn)")
166 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
168 ;; Memory. Disregarding Cache misses, the Mustang memory times are:
169 ;; load: 2, fpload: 3
170 ;; store, fpstore: 3, no D-cache operations should be scheduled.
172 ;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
174 ;; Instruction Time Unit Minimum Distance (unit contention)
181 ;; fmpyadd 3 ALU,MPY 2
182 ;; fmpysub 3 ALU,MPY 2
183 ;; fmpycfxt 3 ALU,MPY 2
186 ;; fdiv,sgl 10 MPY 10
187 ;; fdiv,dbl 12 MPY 12
188 ;; fsqrt,sgl 14 MPY 14
189 ;; fsqrt,dbl 18 MPY 18
191 ;; We don't model fmpyadd/fmpysub properly as those instructions
192 ;; keep both the FP ALU and MPY units busy. Given that these
193 ;; processors are obsolete, I'm not going to spend the time to
194 ;; model those instructions correctly.
196 (define_automaton "pa700")
197 (define_cpu_unit "dummy_700,mem_700,fpalu_700,fpmpy_700" "pa700")
199 (define_insn_reservation "W0" 4
200 (and (eq_attr "type" "fpcc")
201 (eq_attr "cpu" "700"))
204 (define_insn_reservation "W1" 3
205 (and (eq_attr "type" "fpalu")
206 (eq_attr "cpu" "700"))
209 (define_insn_reservation "W2" 3
210 (and (eq_attr "type" "fpmulsgl,fpmuldbl")
211 (eq_attr "cpu" "700"))
214 (define_insn_reservation "W3" 10
215 (and (eq_attr "type" "fpdivsgl")
216 (eq_attr "cpu" "700"))
219 (define_insn_reservation "W4" 12
220 (and (eq_attr "type" "fpdivdbl")
221 (eq_attr "cpu" "700"))
224 (define_insn_reservation "W5" 14
225 (and (eq_attr "type" "fpsqrtsgl")
226 (eq_attr "cpu" "700"))
229 (define_insn_reservation "W6" 18
230 (and (eq_attr "type" "fpsqrtdbl")
231 (eq_attr "cpu" "700"))
234 (define_insn_reservation "W7" 2
235 (and (eq_attr "type" "load")
236 (eq_attr "cpu" "700"))
239 (define_insn_reservation "W8" 2
240 (and (eq_attr "type" "fpload")
241 (eq_attr "cpu" "700"))
244 (define_insn_reservation "W9" 3
245 (and (eq_attr "type" "store")
246 (eq_attr "cpu" "700"))
249 (define_insn_reservation "W10" 3
250 (and (eq_attr "type" "fpstore")
251 (eq_attr "cpu" "700"))
254 (define_insn_reservation "W11" 1
255 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,load,fpload,store,fpstore")
256 (eq_attr "cpu" "700"))
259 ;; We have a bypass for all computations in the FP unit which feed an
260 ;; FP store as long as the sizes are the same.
261 (define_bypass 2 "W1,W2" "W10" "hppa_fpstore_bypass_p")
262 (define_bypass 9 "W3" "W10" "hppa_fpstore_bypass_p")
263 (define_bypass 11 "W4" "W10" "hppa_fpstore_bypass_p")
264 (define_bypass 13 "W5" "W10" "hppa_fpstore_bypass_p")
265 (define_bypass 17 "W6" "W10" "hppa_fpstore_bypass_p")
267 ;; We have an "anti-bypass" for FP loads which feed an FP store.
268 (define_bypass 4 "W8" "W10" "hppa_fpstore_bypass_p")
270 ;; Function units for the 7100 and 7150. The 7100/7150 can dual-issue
271 ;; floating point computations with non-floating point computations (fp loads
272 ;; and stores are not fp computations).
274 ;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
275 ;; take two cycles, during which no Dcache operations should be scheduled.
276 ;; Any special cases are handled in pa_adjust_cost. The 7100, 7150 and 7100LC
277 ;; all have the same memory characteristics if one disregards cache misses.
279 ;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
280 ;; There's no value in modeling the ALU and MUL separately though
281 ;; since there can never be a functional unit conflict given the
282 ;; latency and issue rates for those units.
285 ;; Instruction Time Unit Minimum Distance (unit contention)
292 ;; fmpyadd 2 ALU,MPY 1
293 ;; fmpysub 2 ALU,MPY 1
294 ;; fmpycfxt 2 ALU,MPY 1
298 ;; fdiv,dbl 15 DIV 15
300 ;; fsqrt,dbl 15 DIV 15
302 (define_automaton "pa7100")
303 (define_cpu_unit "i_7100, f_7100,fpmac_7100,fpdivsqrt_7100,mem_7100" "pa7100")
305 (define_insn_reservation "X0" 2
306 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
307 (eq_attr "cpu" "7100"))
310 (define_insn_reservation "X1" 8
311 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
312 (eq_attr "cpu" "7100"))
313 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*7")
315 (define_insn_reservation "X2" 15
316 (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
317 (eq_attr "cpu" "7100"))
318 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*14")
320 (define_insn_reservation "X3" 2
321 (and (eq_attr "type" "load")
322 (eq_attr "cpu" "7100"))
325 (define_insn_reservation "X4" 2
326 (and (eq_attr "type" "fpload")
327 (eq_attr "cpu" "7100"))
330 (define_insn_reservation "X5" 2
331 (and (eq_attr "type" "store")
332 (eq_attr "cpu" "7100"))
333 "i_7100+mem_7100,mem_7100")
335 (define_insn_reservation "X6" 2
336 (and (eq_attr "type" "fpstore")
337 (eq_attr "cpu" "7100"))
338 "i_7100+mem_7100,mem_7100")
340 (define_insn_reservation "X7" 1
341 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore")
342 (eq_attr "cpu" "7100"))
345 ;; We have a bypass for all computations in the FP unit which feed an
346 ;; FP store as long as the sizes are the same.
347 (define_bypass 1 "X0" "X6" "hppa_fpstore_bypass_p")
348 (define_bypass 7 "X1" "X6" "hppa_fpstore_bypass_p")
349 (define_bypass 14 "X2" "X6" "hppa_fpstore_bypass_p")
351 ;; We have an "anti-bypass" for FP loads which feed an FP store.
352 (define_bypass 3 "X4" "X6" "hppa_fpstore_bypass_p")
354 ;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
355 ;; There's no value in modeling the ALU and MUL separately though
356 ;; since there can never be a functional unit conflict that
357 ;; can be avoided given the latency, issue rates and mandatory
358 ;; one cycle cpu-wide lock for a double precision fp multiply.
361 ;; Instruction Time Unit Minimum Distance (unit contention)
368 ;; fmpyadd,sgl 2 ALU,MPY 1
369 ;; fmpyadd,dbl 3 ALU,MPY 2
370 ;; fmpysub,sgl 2 ALU,MPY 1
371 ;; fmpysub,dbl 3 ALU,MPY 2
372 ;; fmpycfxt,sgl 2 ALU,MPY 1
373 ;; fmpycfxt,dbl 3 ALU,MPY 2
378 ;; fdiv,dbl 15 DIV 15
380 ;; fsqrt,dbl 15 DIV 15
382 ;; The PA7200 is just like the PA7100LC except that there is
383 ;; no store-store penalty.
385 ;; The PA7300 is just like the PA7200 except that there is
386 ;; no store-load penalty.
388 ;; Note there are some aspects of the 7100LC we are not modeling
389 ;; at the moment. I'll be reviewing the 7100LC scheduling info
390 ;; shortly and updating this description.
394 ;; other issue modeling
396 (define_automaton "pa7100lc")
397 (define_cpu_unit "i0_7100lc, i1_7100lc, f_7100lc" "pa7100lc")
398 (define_cpu_unit "fpmac_7100lc" "pa7100lc")
399 (define_cpu_unit "mem_7100lc" "pa7100lc")
401 ;; Double precision multiplies lock the entire CPU for one
402 ;; cycle. There is no way to avoid this lock and trying to
403 ;; schedule around the lock is pointless and thus there is no
404 ;; value in trying to model this lock.
406 ;; Not modeling the lock allows us to treat fp multiplies just
407 ;; like any other FP alu instruction. It allows for a smaller
408 ;; DFA and may reduce register pressure.
409 (define_insn_reservation "Y0" 2
410 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
411 (eq_attr "cpu" "7100LC,7200,7300"))
412 "f_7100lc,fpmac_7100lc")
414 ;; fp division and sqrt instructions lock the entire CPU for
415 ;; 7 cycles (single precision) or 14 cycles (double precision).
416 ;; There is no way to avoid this lock and trying to schedule
417 ;; around the lock is pointless and thus there is no value in
418 ;; trying to model this lock. Not modeling the lock allows
419 ;; for a smaller DFA and may reduce register pressure.
420 (define_insn_reservation "Y1" 1
421 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
422 (eq_attr "cpu" "7100LC,7200,7300"))
425 (define_insn_reservation "Y2" 2
426 (and (eq_attr "type" "load")
427 (eq_attr "cpu" "7100LC,7200,7300"))
428 "i1_7100lc+mem_7100lc")
430 (define_insn_reservation "Y3" 2
431 (and (eq_attr "type" "fpload")
432 (eq_attr "cpu" "7100LC,7200,7300"))
433 "i1_7100lc+mem_7100lc")
435 (define_insn_reservation "Y4" 2
436 (and (eq_attr "type" "store")
437 (eq_attr "cpu" "7100LC"))
438 "i1_7100lc+mem_7100lc,mem_7100lc")
440 (define_insn_reservation "Y5" 2
441 (and (eq_attr "type" "fpstore")
442 (eq_attr "cpu" "7100LC"))
443 "i1_7100lc+mem_7100lc,mem_7100lc")
445 (define_insn_reservation "Y6" 1
446 (and (eq_attr "type" "shift,nullshift")
447 (eq_attr "cpu" "7100LC,7200,7300"))
450 (define_insn_reservation "Y7" 1
451 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
452 (eq_attr "cpu" "7100LC,7200,7300"))
453 "(i0_7100lc|i1_7100lc)")
455 ;; The 7200 has a store-load penalty
456 (define_insn_reservation "Y8" 2
457 (and (eq_attr "type" "store")
458 (eq_attr "cpu" "7200"))
459 "i1_7100lc,mem_7100lc")
461 (define_insn_reservation "Y9" 2
462 (and (eq_attr "type" "fpstore")
463 (eq_attr "cpu" "7200"))
464 "i1_7100lc,mem_7100lc")
466 ;; The 7300 has no penalty for store-store or store-load
467 (define_insn_reservation "Y10" 2
468 (and (eq_attr "type" "store")
469 (eq_attr "cpu" "7300"))
472 (define_insn_reservation "Y11" 2
473 (and (eq_attr "type" "fpstore")
474 (eq_attr "cpu" "7300"))
477 ;; We have an "anti-bypass" for FP loads which feed an FP store.
478 (define_bypass 3 "Y3" "Y5,Y9,Y11" "hppa_fpstore_bypass_p")
480 ;; Scheduling for the PA8000 is somewhat different than scheduling for a
481 ;; traditional architecture.
483 ;; The PA8000 has a large (56) entry reorder buffer that is split between
484 ;; memory and non-memory operations.
486 ;; The PA8000 can issue two memory and two non-memory operations per cycle to
487 ;; the function units, with the exception of branches and multi-output
488 ;; instructions. The PA8000 can retire two non-memory operations per cycle
489 ;; and two memory operations per cycle, only one of which may be a store.
491 ;; Given the large reorder buffer, the processor can hide most latencies.
492 ;; According to HP, they've got the best results by scheduling for retirement
493 ;; bandwidth with limited latency scheduling for floating point operations.
494 ;; Latency for integer operations and memory references is ignored.
497 ;; We claim floating point operations have a 2 cycle latency and are
498 ;; fully pipelined, except for div and sqrt which are not pipelined and
499 ;; take from 17 to 31 cycles to complete.
501 ;; It's worth noting that there is no way to saturate all the functional
502 ;; units on the PA8000 as there is not enough issue bandwidth.
504 (define_automaton "pa8000")
505 (define_cpu_unit "inm0_8000, inm1_8000, im0_8000, im1_8000" "pa8000")
506 (define_cpu_unit "rnm0_8000, rnm1_8000, rm0_8000, rm1_8000" "pa8000")
507 (define_cpu_unit "store_8000" "pa8000")
508 (define_cpu_unit "f0_8000, f1_8000" "pa8000")
509 (define_cpu_unit "fdivsqrt0_8000, fdivsqrt1_8000" "pa8000")
510 (define_reservation "inm_8000" "inm0_8000 | inm1_8000")
511 (define_reservation "im_8000" "im0_8000 | im1_8000")
512 (define_reservation "rnm_8000" "rnm0_8000 | rnm1_8000")
513 (define_reservation "rm_8000" "rm0_8000 | rm1_8000")
514 (define_reservation "f_8000" "f0_8000 | f1_8000")
515 (define_reservation "fdivsqrt_8000" "fdivsqrt0_8000 | fdivsqrt1_8000")
517 ;; We can issue any two memops per cycle, but we can only retire
518 ;; one memory store per cycle. We assume that the reorder buffer
519 ;; will hide any memory latencies per HP's recommendation.
520 (define_insn_reservation "Z0" 0
522 (eq_attr "type" "load,fpload")
523 (eq_attr "cpu" "8000"))
526 (define_insn_reservation "Z1" 0
528 (eq_attr "type" "store,fpstore")
529 (eq_attr "cpu" "8000"))
530 "im_8000,rm_8000+store_8000")
532 ;; We can issue and retire two non-memory operations per cycle with
533 ;; a few exceptions (branches). This group catches those we want
534 ;; to assume have zero latency.
535 (define_insn_reservation "Z2" 0
537 (eq_attr "type" "!load,fpload,store,fpstore,uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch,fpcc,fpalu,fpmulsgl,fpmuldbl,fpsqrtsgl,fpsqrtdbl,fpdivsgl,fpdivdbl")
538 (eq_attr "cpu" "8000"))
541 ;; Branches use both slots in the non-memory issue and
543 (define_insn_reservation "Z3" 0
545 (eq_attr "type" "uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
546 (eq_attr "cpu" "8000"))
547 "inm0_8000+inm1_8000,rnm0_8000+rnm1_8000")
549 ;; We partial latency schedule the floating point units.
550 ;; They can issue/retire two at a time in the non-memory
551 ;; units. We fix their latency at 2 cycles and they
552 ;; are fully pipelined.
553 (define_insn_reservation "Z4" 1
555 (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
556 (eq_attr "cpu" "8000"))
557 "inm_8000,f_8000,rnm_8000")
559 ;; The fdivsqrt units are not pipelined and have a very long latency.
560 ;; To keep the DFA from exploding, we do not show all the
561 ;; reservations for the divsqrt unit.
562 (define_insn_reservation "Z5" 17
564 (eq_attr "type" "fpdivsgl,fpsqrtsgl")
565 (eq_attr "cpu" "8000"))
566 "inm_8000,fdivsqrt_8000*6,rnm_8000")
568 (define_insn_reservation "Z6" 31
570 (eq_attr "type" "fpdivdbl,fpsqrtdbl")
571 (eq_attr "cpu" "8000"))
572 "inm_8000,fdivsqrt_8000*6,rnm_8000")
574 (include "predicates.md")
576 ;; Compare instructions.
577 ;; This controls RTL generation and register allocation.
579 ;; We generate RTL for comparisons and branches by having the cmpxx
580 ;; patterns store away the operands. Then, the scc and bcc patterns
581 ;; emit RTL for both the compare and the branch.
584 (define_expand "cmpdi"
586 (compare:CC (match_operand:DI 0 "reg_or_0_operand" "")
587 (match_operand:DI 1 "register_operand" "")))]
592 hppa_compare_op0 = operands[0];
593 hppa_compare_op1 = operands[1];
594 hppa_branch_type = CMP_SI;
598 (define_expand "cmpsi"
600 (compare:CC (match_operand:SI 0 "reg_or_0_operand" "")
601 (match_operand:SI 1 "arith5_operand" "")))]
605 hppa_compare_op0 = operands[0];
606 hppa_compare_op1 = operands[1];
607 hppa_branch_type = CMP_SI;
611 (define_expand "cmpsf"
613 (compare:CCFP (match_operand:SF 0 "reg_or_0_operand" "")
614 (match_operand:SF 1 "reg_or_0_operand" "")))]
615 "! TARGET_SOFT_FLOAT"
618 hppa_compare_op0 = operands[0];
619 hppa_compare_op1 = operands[1];
620 hppa_branch_type = CMP_SF;
624 (define_expand "cmpdf"
626 (compare:CCFP (match_operand:DF 0 "reg_or_0_operand" "")
627 (match_operand:DF 1 "reg_or_0_operand" "")))]
628 "! TARGET_SOFT_FLOAT"
631 hppa_compare_op0 = operands[0];
632 hppa_compare_op1 = operands[1];
633 hppa_branch_type = CMP_DF;
639 (match_operator:CCFP 2 "comparison_operator"
640 [(match_operand:SF 0 "reg_or_0_operand" "fG")
641 (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
642 "! TARGET_SOFT_FLOAT"
643 "fcmp,sgl,%Y2 %f0,%f1"
644 [(set_attr "length" "4")
645 (set_attr "type" "fpcc")])
649 (match_operator:CCFP 2 "comparison_operator"
650 [(match_operand:DF 0 "reg_or_0_operand" "fG")
651 (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
652 "! TARGET_SOFT_FLOAT"
653 "fcmp,dbl,%Y2 %f0,%f1"
654 [(set_attr "length" "4")
655 (set_attr "type" "fpcc")])
657 ;; Provide a means to emit the movccfp0 and movccfp1 optimization
658 ;; placeholders. This is necessary in rare situations when a
659 ;; placeholder is re-emitted (see PR 8705).
661 (define_expand "movccfp"
663 (match_operand 0 "const_int_operand" ""))]
664 "! TARGET_SOFT_FLOAT"
667 if ((unsigned HOST_WIDE_INT) INTVAL (operands[0]) > 1)
671 ;; The following patterns are optimization placeholders. In almost
672 ;; all cases, the user of the condition code will be simplified and the
673 ;; original condition code setting insn should be eliminated.
675 (define_insn "*movccfp0"
678 "! TARGET_SOFT_FLOAT"
679 "fcmp,dbl,= %%fr0,%%fr0"
680 [(set_attr "length" "4")
681 (set_attr "type" "fpcc")])
683 (define_insn "*movccfp1"
686 "! TARGET_SOFT_FLOAT"
687 "fcmp,dbl,!= %%fr0,%%fr0"
688 [(set_attr "length" "4")
689 (set_attr "type" "fpcc")])
694 [(set (match_operand:SI 0 "register_operand" "")
700 /* fp scc patterns rarely match, and are not a win on the PA. */
701 if (hppa_branch_type != CMP_SI)
703 /* set up operands from compare. */
704 operands[1] = hppa_compare_op0;
705 operands[2] = hppa_compare_op1;
706 /* fall through and generate default code */
710 [(set (match_operand:SI 0 "register_operand" "")
716 /* fp scc patterns rarely match, and are not a win on the PA. */
717 if (hppa_branch_type != CMP_SI)
719 operands[1] = hppa_compare_op0;
720 operands[2] = hppa_compare_op1;
724 [(set (match_operand:SI 0 "register_operand" "")
730 /* fp scc patterns rarely match, and are not a win on the PA. */
731 if (hppa_branch_type != CMP_SI)
733 operands[1] = hppa_compare_op0;
734 operands[2] = hppa_compare_op1;
738 [(set (match_operand:SI 0 "register_operand" "")
744 /* fp scc patterns rarely match, and are not a win on the PA. */
745 if (hppa_branch_type != CMP_SI)
747 operands[1] = hppa_compare_op0;
748 operands[2] = hppa_compare_op1;
752 [(set (match_operand:SI 0 "register_operand" "")
758 /* fp scc patterns rarely match, and are not a win on the PA. */
759 if (hppa_branch_type != CMP_SI)
761 operands[1] = hppa_compare_op0;
762 operands[2] = hppa_compare_op1;
766 [(set (match_operand:SI 0 "register_operand" "")
772 /* fp scc patterns rarely match, and are not a win on the PA. */
773 if (hppa_branch_type != CMP_SI)
775 operands[1] = hppa_compare_op0;
776 operands[2] = hppa_compare_op1;
779 (define_expand "sltu"
780 [(set (match_operand:SI 0 "register_operand" "")
781 (ltu:SI (match_dup 1)
786 if (hppa_branch_type != CMP_SI)
788 operands[1] = hppa_compare_op0;
789 operands[2] = hppa_compare_op1;
792 (define_expand "sgtu"
793 [(set (match_operand:SI 0 "register_operand" "")
794 (gtu:SI (match_dup 1)
799 if (hppa_branch_type != CMP_SI)
801 operands[1] = hppa_compare_op0;
802 operands[2] = hppa_compare_op1;
805 (define_expand "sleu"
806 [(set (match_operand:SI 0 "register_operand" "")
807 (leu:SI (match_dup 1)
812 if (hppa_branch_type != CMP_SI)
814 operands[1] = hppa_compare_op0;
815 operands[2] = hppa_compare_op1;
818 (define_expand "sgeu"
819 [(set (match_operand:SI 0 "register_operand" "")
820 (geu:SI (match_dup 1)
825 if (hppa_branch_type != CMP_SI)
827 operands[1] = hppa_compare_op0;
828 operands[2] = hppa_compare_op1;
831 ;; Instruction canonicalization puts immediate operands second, which
832 ;; is the reverse of what we want.
835 [(set (match_operand:SI 0 "register_operand" "=r")
836 (match_operator:SI 3 "comparison_operator"
837 [(match_operand:SI 1 "register_operand" "r")
838 (match_operand:SI 2 "arith11_operand" "rI")]))]
840 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0"
841 [(set_attr "type" "binary")
842 (set_attr "length" "8")])
845 [(set (match_operand:DI 0 "register_operand" "=r")
846 (match_operator:DI 3 "comparison_operator"
847 [(match_operand:DI 1 "register_operand" "r")
848 (match_operand:DI 2 "arith11_operand" "rI")]))]
850 "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0"
851 [(set_attr "type" "binary")
852 (set_attr "length" "8")])
854 (define_insn "iorscc"
855 [(set (match_operand:SI 0 "register_operand" "=r")
856 (ior:SI (match_operator:SI 3 "comparison_operator"
857 [(match_operand:SI 1 "register_operand" "r")
858 (match_operand:SI 2 "arith11_operand" "rI")])
859 (match_operator:SI 6 "comparison_operator"
860 [(match_operand:SI 4 "register_operand" "r")
861 (match_operand:SI 5 "arith11_operand" "rI")])))]
863 "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0"
864 [(set_attr "type" "binary")
865 (set_attr "length" "12")])
868 [(set (match_operand:DI 0 "register_operand" "=r")
869 (ior:DI (match_operator:DI 3 "comparison_operator"
870 [(match_operand:DI 1 "register_operand" "r")
871 (match_operand:DI 2 "arith11_operand" "rI")])
872 (match_operator:DI 6 "comparison_operator"
873 [(match_operand:DI 4 "register_operand" "r")
874 (match_operand:DI 5 "arith11_operand" "rI")])))]
876 "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0"
877 [(set_attr "type" "binary")
878 (set_attr "length" "12")])
880 ;; Combiner patterns for common operations performed with the output
881 ;; from an scc insn (negscc and incscc).
882 (define_insn "negscc"
883 [(set (match_operand:SI 0 "register_operand" "=r")
884 (neg:SI (match_operator:SI 3 "comparison_operator"
885 [(match_operand:SI 1 "register_operand" "r")
886 (match_operand:SI 2 "arith11_operand" "rI")])))]
888 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0"
889 [(set_attr "type" "binary")
890 (set_attr "length" "8")])
893 [(set (match_operand:DI 0 "register_operand" "=r")
894 (neg:DI (match_operator:DI 3 "comparison_operator"
895 [(match_operand:DI 1 "register_operand" "r")
896 (match_operand:DI 2 "arith11_operand" "rI")])))]
898 "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0"
899 [(set_attr "type" "binary")
900 (set_attr "length" "8")])
902 ;; Patterns for adding/subtracting the result of a boolean expression from
903 ;; a register. First we have special patterns that make use of the carry
904 ;; bit, and output only two instructions. For the cases we can't in
905 ;; general do in two instructions, the incscc pattern at the end outputs
906 ;; two or three instructions.
909 [(set (match_operand:SI 0 "register_operand" "=r")
910 (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
911 (match_operand:SI 3 "arith11_operand" "rI"))
912 (match_operand:SI 1 "register_operand" "r")))]
914 "sub%I3 %3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
915 [(set_attr "type" "binary")
916 (set_attr "length" "8")])
919 [(set (match_operand:DI 0 "register_operand" "=r")
920 (plus:DI (leu:DI (match_operand:DI 2 "register_operand" "r")
921 (match_operand:DI 3 "arith11_operand" "rI"))
922 (match_operand:DI 1 "register_operand" "r")))]
924 "sub%I3 %3,%2,%%r0\;add,dc %%r0,%1,%0"
925 [(set_attr "type" "binary")
926 (set_attr "length" "8")])
928 ; This need only accept registers for op3, since canonicalization
929 ; replaces geu with gtu when op3 is an integer.
931 [(set (match_operand:SI 0 "register_operand" "=r")
932 (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
933 (match_operand:SI 3 "register_operand" "r"))
934 (match_operand:SI 1 "register_operand" "r")))]
936 "sub %2,%3,%%r0\;{addc|add,c} %%r0,%1,%0"
937 [(set_attr "type" "binary")
938 (set_attr "length" "8")])
941 [(set (match_operand:DI 0 "register_operand" "=r")
942 (plus:DI (geu:DI (match_operand:DI 2 "register_operand" "r")
943 (match_operand:DI 3 "register_operand" "r"))
944 (match_operand:DI 1 "register_operand" "r")))]
946 "sub %2,%3,%%r0\;add,dc %%r0,%1,%0"
947 [(set_attr "type" "binary")
948 (set_attr "length" "8")])
950 ; Match only integers for op3 here. This is used as canonical form of the
951 ; geu pattern when op3 is an integer. Don't match registers since we can't
952 ; make better code than the general incscc pattern.
954 [(set (match_operand:SI 0 "register_operand" "=r")
955 (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
956 (match_operand:SI 3 "int11_operand" "I"))
957 (match_operand:SI 1 "register_operand" "r")))]
959 "addi %k3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
960 [(set_attr "type" "binary")
961 (set_attr "length" "8")])
964 [(set (match_operand:DI 0 "register_operand" "=r")
965 (plus:DI (gtu:DI (match_operand:DI 2 "register_operand" "r")
966 (match_operand:DI 3 "int11_operand" "I"))
967 (match_operand:DI 1 "register_operand" "r")))]
969 "addi %k3,%2,%%r0\;add,dc %%r0,%1,%0"
970 [(set_attr "type" "binary")
971 (set_attr "length" "8")])
973 (define_insn "incscc"
974 [(set (match_operand:SI 0 "register_operand" "=r,r")
975 (plus:SI (match_operator:SI 4 "comparison_operator"
976 [(match_operand:SI 2 "register_operand" "r,r")
977 (match_operand:SI 3 "arith11_operand" "rI,rI")])
978 (match_operand:SI 1 "register_operand" "0,?r")))]
981 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi 1,%0,%0
982 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
983 [(set_attr "type" "binary,binary")
984 (set_attr "length" "8,12")])
987 [(set (match_operand:DI 0 "register_operand" "=r,r")
988 (plus:DI (match_operator:DI 4 "comparison_operator"
989 [(match_operand:DI 2 "register_operand" "r,r")
990 (match_operand:DI 3 "arith11_operand" "rI,rI")])
991 (match_operand:DI 1 "register_operand" "0,?r")))]
994 cmp%I3clr,*%B4 %3,%2,%%r0\;addi 1,%0,%0
995 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
996 [(set_attr "type" "binary,binary")
997 (set_attr "length" "8,12")])
1000 [(set (match_operand:SI 0 "register_operand" "=r")
1001 (minus:SI (match_operand:SI 1 "register_operand" "r")
1002 (gtu:SI (match_operand:SI 2 "register_operand" "r")
1003 (match_operand:SI 3 "arith11_operand" "rI"))))]
1005 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1006 [(set_attr "type" "binary")
1007 (set_attr "length" "8")])
1010 [(set (match_operand:DI 0 "register_operand" "=r")
1011 (minus:DI (match_operand:DI 1 "register_operand" "r")
1012 (gtu:DI (match_operand:DI 2 "register_operand" "r")
1013 (match_operand:DI 3 "arith11_operand" "rI"))))]
1015 "sub%I3 %3,%2,%%r0\;sub,db %1,%%r0,%0"
1016 [(set_attr "type" "binary")
1017 (set_attr "length" "8")])
1020 [(set (match_operand:SI 0 "register_operand" "=r")
1021 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1022 (gtu:SI (match_operand:SI 2 "register_operand" "r")
1023 (match_operand:SI 3 "arith11_operand" "rI")))
1024 (match_operand:SI 4 "register_operand" "r")))]
1026 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1027 [(set_attr "type" "binary")
1028 (set_attr "length" "8")])
1031 [(set (match_operand:DI 0 "register_operand" "=r")
1032 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1033 (gtu:DI (match_operand:DI 2 "register_operand" "r")
1034 (match_operand:DI 3 "arith11_operand" "rI")))
1035 (match_operand:DI 4 "register_operand" "r")))]
1037 "sub%I3 %3,%2,%%r0\;sub,db %1,%4,%0"
1038 [(set_attr "type" "binary")
1039 (set_attr "length" "8")])
1041 ; This need only accept registers for op3, since canonicalization
1042 ; replaces ltu with leu when op3 is an integer.
1044 [(set (match_operand:SI 0 "register_operand" "=r")
1045 (minus:SI (match_operand:SI 1 "register_operand" "r")
1046 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1047 (match_operand:SI 3 "register_operand" "r"))))]
1049 "sub %2,%3,%%r0\;{subb|sub,b} %1,%%r0,%0"
1050 [(set_attr "type" "binary")
1051 (set_attr "length" "8")])
1054 [(set (match_operand:DI 0 "register_operand" "=r")
1055 (minus:DI (match_operand:DI 1 "register_operand" "r")
1056 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1057 (match_operand:DI 3 "register_operand" "r"))))]
1059 "sub %2,%3,%%r0\;sub,db %1,%%r0,%0"
1060 [(set_attr "type" "binary")
1061 (set_attr "length" "8")])
1064 [(set (match_operand:SI 0 "register_operand" "=r")
1065 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1066 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1067 (match_operand:SI 3 "register_operand" "r")))
1068 (match_operand:SI 4 "register_operand" "r")))]
1070 "sub %2,%3,%%r0\;{subb|sub,b} %1,%4,%0"
1071 [(set_attr "type" "binary")
1072 (set_attr "length" "8")])
1075 [(set (match_operand:DI 0 "register_operand" "=r")
1076 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1077 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1078 (match_operand:DI 3 "register_operand" "r")))
1079 (match_operand:DI 4 "register_operand" "r")))]
1081 "sub %2,%3,%%r0\;sub,db %1,%4,%0"
1082 [(set_attr "type" "binary")
1083 (set_attr "length" "8")])
1085 ; Match only integers for op3 here. This is used as canonical form of the
1086 ; ltu pattern when op3 is an integer. Don't match registers since we can't
1087 ; make better code than the general incscc pattern.
1089 [(set (match_operand:SI 0 "register_operand" "=r")
1090 (minus:SI (match_operand:SI 1 "register_operand" "r")
1091 (leu:SI (match_operand:SI 2 "register_operand" "r")
1092 (match_operand:SI 3 "int11_operand" "I"))))]
1094 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1095 [(set_attr "type" "binary")
1096 (set_attr "length" "8")])
1099 [(set (match_operand:DI 0 "register_operand" "=r")
1100 (minus:DI (match_operand:DI 1 "register_operand" "r")
1101 (leu:DI (match_operand:DI 2 "register_operand" "r")
1102 (match_operand:DI 3 "int11_operand" "I"))))]
1104 "addi %k3,%2,%%r0\;sub,db %1,%%r0,%0"
1105 [(set_attr "type" "binary")
1106 (set_attr "length" "8")])
1109 [(set (match_operand:SI 0 "register_operand" "=r")
1110 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1111 (leu:SI (match_operand:SI 2 "register_operand" "r")
1112 (match_operand:SI 3 "int11_operand" "I")))
1113 (match_operand:SI 4 "register_operand" "r")))]
1115 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1116 [(set_attr "type" "binary")
1117 (set_attr "length" "8")])
1120 [(set (match_operand:DI 0 "register_operand" "=r")
1121 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1122 (leu:DI (match_operand:DI 2 "register_operand" "r")
1123 (match_operand:DI 3 "int11_operand" "I")))
1124 (match_operand:DI 4 "register_operand" "r")))]
1126 "addi %k3,%2,%%r0\;sub,db %1,%4,%0"
1127 [(set_attr "type" "binary")
1128 (set_attr "length" "8")])
1130 (define_insn "decscc"
1131 [(set (match_operand:SI 0 "register_operand" "=r,r")
1132 (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
1133 (match_operator:SI 4 "comparison_operator"
1134 [(match_operand:SI 2 "register_operand" "r,r")
1135 (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
1138 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi -1,%0,%0
1139 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1140 [(set_attr "type" "binary,binary")
1141 (set_attr "length" "8,12")])
1144 [(set (match_operand:DI 0 "register_operand" "=r,r")
1145 (minus:DI (match_operand:DI 1 "register_operand" "0,?r")
1146 (match_operator:DI 4 "comparison_operator"
1147 [(match_operand:DI 2 "register_operand" "r,r")
1148 (match_operand:DI 3 "arith11_operand" "rI,rI")])))]
1151 cmp%I3clr,*%B4 %3,%2,%%r0\;addi -1,%0,%0
1152 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1153 [(set_attr "type" "binary,binary")
1154 (set_attr "length" "8,12")])
1156 ; Patterns for max and min. (There is no need for an earlyclobber in the
1157 ; last alternative since the middle alternative will match if op0 == op1.)
1159 (define_insn "sminsi3"
1160 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1161 (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1162 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1165 {comclr|cmpclr},> %2,%0,%%r0\;copy %2,%0
1166 {comiclr|cmpiclr},> %2,%0,%%r0\;ldi %2,%0
1167 {comclr|cmpclr},> %1,%r2,%0\;copy %1,%0"
1168 [(set_attr "type" "multi,multi,multi")
1169 (set_attr "length" "8,8,8")])
1171 (define_insn "smindi3"
1172 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1173 (smin:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1174 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1177 cmpclr,*> %2,%0,%%r0\;copy %2,%0
1178 cmpiclr,*> %2,%0,%%r0\;ldi %2,%0
1179 cmpclr,*> %1,%r2,%0\;copy %1,%0"
1180 [(set_attr "type" "multi,multi,multi")
1181 (set_attr "length" "8,8,8")])
1183 (define_insn "uminsi3"
1184 [(set (match_operand:SI 0 "register_operand" "=r,r")
1185 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
1186 (match_operand:SI 2 "arith11_operand" "r,I")))]
1189 {comclr|cmpclr},>> %2,%0,%%r0\;copy %2,%0
1190 {comiclr|cmpiclr},>> %2,%0,%%r0\;ldi %2,%0"
1191 [(set_attr "type" "multi,multi")
1192 (set_attr "length" "8,8")])
1194 (define_insn "umindi3"
1195 [(set (match_operand:DI 0 "register_operand" "=r,r")
1196 (umin:DI (match_operand:DI 1 "register_operand" "%0,0")
1197 (match_operand:DI 2 "arith11_operand" "r,I")))]
1200 cmpclr,*>> %2,%0,%%r0\;copy %2,%0
1201 cmpiclr,*>> %2,%0,%%r0\;ldi %2,%0"
1202 [(set_attr "type" "multi,multi")
1203 (set_attr "length" "8,8")])
1205 (define_insn "smaxsi3"
1206 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1207 (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1208 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1211 {comclr|cmpclr},< %2,%0,%%r0\;copy %2,%0
1212 {comiclr|cmpiclr},< %2,%0,%%r0\;ldi %2,%0
1213 {comclr|cmpclr},< %1,%r2,%0\;copy %1,%0"
1214 [(set_attr "type" "multi,multi,multi")
1215 (set_attr "length" "8,8,8")])
1217 (define_insn "smaxdi3"
1218 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1219 (smax:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1220 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1223 cmpclr,*< %2,%0,%%r0\;copy %2,%0
1224 cmpiclr,*< %2,%0,%%r0\;ldi %2,%0
1225 cmpclr,*< %1,%r2,%0\;copy %1,%0"
1226 [(set_attr "type" "multi,multi,multi")
1227 (set_attr "length" "8,8,8")])
1229 (define_insn "umaxsi3"
1230 [(set (match_operand:SI 0 "register_operand" "=r,r")
1231 (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
1232 (match_operand:SI 2 "arith11_operand" "r,I")))]
1235 {comclr|cmpclr},<< %2,%0,%%r0\;copy %2,%0
1236 {comiclr|cmpiclr},<< %2,%0,%%r0\;ldi %2,%0"
1237 [(set_attr "type" "multi,multi")
1238 (set_attr "length" "8,8")])
1240 (define_insn "umaxdi3"
1241 [(set (match_operand:DI 0 "register_operand" "=r,r")
1242 (umax:DI (match_operand:DI 1 "register_operand" "%0,0")
1243 (match_operand:DI 2 "arith11_operand" "r,I")))]
1246 cmpclr,*<< %2,%0,%%r0\;copy %2,%0
1247 cmpiclr,*<< %2,%0,%%r0\;ldi %2,%0"
1248 [(set_attr "type" "multi,multi")
1249 (set_attr "length" "8,8")])
1251 (define_insn "abssi2"
1252 [(set (match_operand:SI 0 "register_operand" "=r")
1253 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1255 "or,>= %%r0,%1,%0\;subi 0,%0,%0"
1256 [(set_attr "type" "multi")
1257 (set_attr "length" "8")])
1259 (define_insn "absdi2"
1260 [(set (match_operand:DI 0 "register_operand" "=r")
1261 (abs:DI (match_operand:DI 1 "register_operand" "r")))]
1263 "or,*>= %%r0,%1,%0\;subi 0,%0,%0"
1264 [(set_attr "type" "multi")
1265 (set_attr "length" "8")])
1267 ;;; Experimental conditional move patterns
1269 (define_expand "movsicc"
1270 [(set (match_operand:SI 0 "register_operand" "")
1272 (match_operator 1 "comparison_operator"
1275 (match_operand:SI 2 "reg_or_cint_move_operand" "")
1276 (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
1280 enum rtx_code code = GET_CODE (operands[1]);
1282 if (hppa_branch_type != CMP_SI)
1285 if (GET_MODE (hppa_compare_op0) != GET_MODE (hppa_compare_op1)
1286 || GET_MODE (hppa_compare_op0) != GET_MODE (operands[0]))
1289 /* operands[1] is currently the result of compare_from_rtx. We want to
1290 emit a compare of the original operands. */
1291 operands[1] = gen_rtx_fmt_ee (code, SImode, hppa_compare_op0, hppa_compare_op1);
1292 operands[4] = hppa_compare_op0;
1293 operands[5] = hppa_compare_op1;
1296 ;; We used to accept any register for op1.
1298 ;; However, it loses sometimes because the compiler will end up using
1299 ;; different registers for op0 and op1 in some critical cases. local-alloc
1300 ;; will not tie op0 and op1 because op0 is used in multiple basic blocks.
1302 ;; If/when global register allocation supports tying we should allow any
1303 ;; register for op1 again.
1305 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1307 (match_operator 2 "comparison_operator"
1308 [(match_operand:SI 3 "register_operand" "r,r,r,r")
1309 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI")])
1310 (match_operand:SI 1 "reg_or_cint_move_operand" "0,J,N,K")
1314 {com%I4clr|cmp%I4clr},%S2 %4,%3,%%r0\;ldi 0,%0
1315 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldi %1,%0
1316 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldil L'%1,%0
1317 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;{zdepi|depwi,z} %Z1,%0"
1318 [(set_attr "type" "multi,multi,multi,nullshift")
1319 (set_attr "length" "8,8,8,8")])
1322 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1324 (match_operator 5 "comparison_operator"
1325 [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
1326 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1327 (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1328 (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1331 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;copy %2,%0
1332 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldi %2,%0
1333 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldil L'%2,%0
1334 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;{zdepi|depwi,z} %Z2,%0
1335 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;copy %1,%0
1336 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldi %1,%0
1337 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldil L'%1,%0
1338 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;{zdepi|depwi,z} %Z1,%0"
1339 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1340 (set_attr "length" "8,8,8,8,8,8,8,8")])
1342 (define_expand "movdicc"
1343 [(set (match_operand:DI 0 "register_operand" "")
1345 (match_operator 1 "comparison_operator"
1348 (match_operand:DI 2 "reg_or_cint_move_operand" "")
1349 (match_operand:DI 3 "reg_or_cint_move_operand" "")))]
1353 enum rtx_code code = GET_CODE (operands[1]);
1355 if (hppa_branch_type != CMP_SI)
1358 if (GET_MODE (hppa_compare_op0) != GET_MODE (hppa_compare_op1)
1359 || GET_MODE (hppa_compare_op0) != GET_MODE (operands[0]))
1362 /* operands[1] is currently the result of compare_from_rtx. We want to
1363 emit a compare of the original operands. */
1364 operands[1] = gen_rtx_fmt_ee (code, DImode, hppa_compare_op0, hppa_compare_op1);
1365 operands[4] = hppa_compare_op0;
1366 operands[5] = hppa_compare_op1;
1369 ; We need the first constraint alternative in order to avoid
1370 ; earlyclobbers on all other alternatives.
1372 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1374 (match_operator 2 "comparison_operator"
1375 [(match_operand:DI 3 "register_operand" "r,r,r,r,r")
1376 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
1377 (match_operand:DI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
1381 cmp%I4clr,*%S2 %4,%3,%%r0\;ldi 0,%0
1382 cmp%I4clr,*%B2 %4,%3,%0\;copy %1,%0
1383 cmp%I4clr,*%B2 %4,%3,%0\;ldi %1,%0
1384 cmp%I4clr,*%B2 %4,%3,%0\;ldil L'%1,%0
1385 cmp%I4clr,*%B2 %4,%3,%0\;depdi,z %z1,%0"
1386 [(set_attr "type" "multi,multi,multi,multi,nullshift")
1387 (set_attr "length" "8,8,8,8,8")])
1390 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1392 (match_operator 5 "comparison_operator"
1393 [(match_operand:DI 3 "register_operand" "r,r,r,r,r,r,r,r")
1394 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1395 (match_operand:DI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1396 (match_operand:DI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1399 cmp%I4clr,*%S5 %4,%3,%%r0\;copy %2,%0
1400 cmp%I4clr,*%S5 %4,%3,%%r0\;ldi %2,%0
1401 cmp%I4clr,*%S5 %4,%3,%%r0\;ldil L'%2,%0
1402 cmp%I4clr,*%S5 %4,%3,%%r0\;depdi,z %z2,%0
1403 cmp%I4clr,*%B5 %4,%3,%%r0\;copy %1,%0
1404 cmp%I4clr,*%B5 %4,%3,%%r0\;ldi %1,%0
1405 cmp%I4clr,*%B5 %4,%3,%%r0\;ldil L'%1,%0
1406 cmp%I4clr,*%B5 %4,%3,%%r0\;depdi,z %z1,%0"
1407 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1408 (set_attr "length" "8,8,8,8,8,8,8,8")])
1410 ;; Conditional Branches
1412 (define_expand "beq"
1414 (if_then_else (eq (match_dup 1) (match_dup 2))
1415 (label_ref (match_operand 0 "" ""))
1420 if (hppa_branch_type != CMP_SI)
1422 emit_insn (gen_cmp_fp (EQ, hppa_compare_op0, hppa_compare_op1));
1423 emit_bcond_fp (NE, operands[0]);
1426 /* set up operands from compare. */
1427 operands[1] = hppa_compare_op0;
1428 operands[2] = hppa_compare_op1;
1429 /* fall through and generate default code */
1432 (define_expand "bne"
1434 (if_then_else (ne (match_dup 1) (match_dup 2))
1435 (label_ref (match_operand 0 "" ""))
1440 if (hppa_branch_type != CMP_SI)
1442 emit_insn (gen_cmp_fp (NE, hppa_compare_op0, hppa_compare_op1));
1443 emit_bcond_fp (NE, operands[0]);
1446 operands[1] = hppa_compare_op0;
1447 operands[2] = hppa_compare_op1;
1450 (define_expand "bgt"
1452 (if_then_else (gt (match_dup 1) (match_dup 2))
1453 (label_ref (match_operand 0 "" ""))
1458 if (hppa_branch_type != CMP_SI)
1460 emit_insn (gen_cmp_fp (GT, hppa_compare_op0, hppa_compare_op1));
1461 emit_bcond_fp (NE, operands[0]);
1464 operands[1] = hppa_compare_op0;
1465 operands[2] = hppa_compare_op1;
1468 (define_expand "blt"
1470 (if_then_else (lt (match_dup 1) (match_dup 2))
1471 (label_ref (match_operand 0 "" ""))
1476 if (hppa_branch_type != CMP_SI)
1478 emit_insn (gen_cmp_fp (LT, hppa_compare_op0, hppa_compare_op1));
1479 emit_bcond_fp (NE, operands[0]);
1482 operands[1] = hppa_compare_op0;
1483 operands[2] = hppa_compare_op1;
1486 (define_expand "bge"
1488 (if_then_else (ge (match_dup 1) (match_dup 2))
1489 (label_ref (match_operand 0 "" ""))
1494 if (hppa_branch_type != CMP_SI)
1496 emit_insn (gen_cmp_fp (GE, hppa_compare_op0, hppa_compare_op1));
1497 emit_bcond_fp (NE, operands[0]);
1500 operands[1] = hppa_compare_op0;
1501 operands[2] = hppa_compare_op1;
1504 (define_expand "ble"
1506 (if_then_else (le (match_dup 1) (match_dup 2))
1507 (label_ref (match_operand 0 "" ""))
1512 if (hppa_branch_type != CMP_SI)
1514 emit_insn (gen_cmp_fp (LE, hppa_compare_op0, hppa_compare_op1));
1515 emit_bcond_fp (NE, operands[0]);
1518 operands[1] = hppa_compare_op0;
1519 operands[2] = hppa_compare_op1;
1522 (define_expand "bgtu"
1524 (if_then_else (gtu (match_dup 1) (match_dup 2))
1525 (label_ref (match_operand 0 "" ""))
1530 if (hppa_branch_type != CMP_SI)
1532 operands[1] = hppa_compare_op0;
1533 operands[2] = hppa_compare_op1;
1536 (define_expand "bltu"
1538 (if_then_else (ltu (match_dup 1) (match_dup 2))
1539 (label_ref (match_operand 0 "" ""))
1544 if (hppa_branch_type != CMP_SI)
1546 operands[1] = hppa_compare_op0;
1547 operands[2] = hppa_compare_op1;
1550 (define_expand "bgeu"
1552 (if_then_else (geu (match_dup 1) (match_dup 2))
1553 (label_ref (match_operand 0 "" ""))
1558 if (hppa_branch_type != CMP_SI)
1560 operands[1] = hppa_compare_op0;
1561 operands[2] = hppa_compare_op1;
1564 (define_expand "bleu"
1566 (if_then_else (leu (match_dup 1) (match_dup 2))
1567 (label_ref (match_operand 0 "" ""))
1572 if (hppa_branch_type != CMP_SI)
1574 operands[1] = hppa_compare_op0;
1575 operands[2] = hppa_compare_op1;
1578 (define_expand "bltgt"
1580 (if_then_else (ltgt (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 (LTGT, hppa_compare_op0, hppa_compare_op1));
1589 emit_bcond_fp (NE, operands[0]);
1593 (define_expand "bunle"
1595 (if_then_else (unle (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 (UNLE, hppa_compare_op0, hppa_compare_op1));
1604 emit_bcond_fp (NE, operands[0]);
1608 (define_expand "bunlt"
1610 (if_then_else (unlt (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 (UNLT, hppa_compare_op0, hppa_compare_op1));
1619 emit_bcond_fp (NE, operands[0]);
1623 (define_expand "bunge"
1625 (if_then_else (unge (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 (UNGE, hppa_compare_op0, hppa_compare_op1));
1634 emit_bcond_fp (NE, operands[0]);
1638 (define_expand "bungt"
1640 (if_then_else (ungt (match_dup 1) (match_dup 2))
1641 (label_ref (match_operand 0 "" ""))
1646 if (hppa_branch_type == CMP_SI)
1648 emit_insn (gen_cmp_fp (UNGT, hppa_compare_op0, hppa_compare_op1));
1649 emit_bcond_fp (NE, operands[0]);
1653 (define_expand "buneq"
1655 (if_then_else (uneq (match_dup 1) (match_dup 2))
1656 (label_ref (match_operand 0 "" ""))
1661 if (hppa_branch_type == CMP_SI)
1663 emit_insn (gen_cmp_fp (UNEQ, hppa_compare_op0, hppa_compare_op1));
1664 emit_bcond_fp (NE, operands[0]);
1668 (define_expand "bunordered"
1670 (if_then_else (unordered (match_dup 1) (match_dup 2))
1671 (label_ref (match_operand 0 "" ""))
1676 if (hppa_branch_type == CMP_SI)
1678 emit_insn (gen_cmp_fp (UNORDERED, hppa_compare_op0, hppa_compare_op1));
1679 emit_bcond_fp (NE, operands[0]);
1683 (define_expand "bordered"
1685 (if_then_else (ordered (match_dup 1) (match_dup 2))
1686 (label_ref (match_operand 0 "" ""))
1691 if (hppa_branch_type == CMP_SI)
1693 emit_insn (gen_cmp_fp (ORDERED, hppa_compare_op0, hppa_compare_op1));
1694 emit_bcond_fp (NE, operands[0]);
1698 ;; Match the branch patterns.
1701 ;; Note a long backward conditional branch with an annulled delay slot
1702 ;; has a length of 12.
1706 (match_operator 3 "comparison_operator"
1707 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1708 (match_operand:SI 2 "arith5_operand" "rL")])
1709 (label_ref (match_operand 0 "" ""))
1714 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1715 get_attr_length (insn), 0, insn);
1717 [(set_attr "type" "cbranch")
1718 (set (attr "length")
1719 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1722 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1725 (eq (symbol_ref "flag_pic") (const_int 0))
1729 ;; Match the negated branch.
1734 (match_operator 3 "comparison_operator"
1735 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1736 (match_operand:SI 2 "arith5_operand" "rL")])
1738 (label_ref (match_operand 0 "" ""))))]
1742 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1743 get_attr_length (insn), 1, insn);
1745 [(set_attr "type" "cbranch")
1746 (set (attr "length")
1747 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1750 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1753 (eq (symbol_ref "flag_pic") (const_int 0))
1760 (match_operator 3 "comparison_operator"
1761 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1762 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1763 (label_ref (match_operand 0 "" ""))
1768 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1769 get_attr_length (insn), 0, insn);
1771 [(set_attr "type" "cbranch")
1772 (set (attr "length")
1773 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1776 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1779 (eq (symbol_ref "flag_pic") (const_int 0))
1783 ;; Match the negated branch.
1788 (match_operator 3 "comparison_operator"
1789 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1790 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1792 (label_ref (match_operand 0 "" ""))))]
1796 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1797 get_attr_length (insn), 1, insn);
1799 [(set_attr "type" "cbranch")
1800 (set (attr "length")
1801 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1804 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1807 (eq (symbol_ref "flag_pic") (const_int 0))
1813 (match_operator 3 "cmpib_comparison_operator"
1814 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1815 (match_operand:DI 2 "arith5_operand" "rL")])
1816 (label_ref (match_operand 0 "" ""))
1821 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1822 get_attr_length (insn), 0, insn);
1824 [(set_attr "type" "cbranch")
1825 (set (attr "length")
1826 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1829 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1832 (eq (symbol_ref "flag_pic") (const_int 0))
1836 ;; Match the negated branch.
1841 (match_operator 3 "cmpib_comparison_operator"
1842 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1843 (match_operand:DI 2 "arith5_operand" "rL")])
1845 (label_ref (match_operand 0 "" ""))))]
1849 return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
1850 get_attr_length (insn), 1, insn);
1852 [(set_attr "type" "cbranch")
1853 (set (attr "length")
1854 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1857 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1860 (eq (symbol_ref "flag_pic") (const_int 0))
1864 ;; Branch on Bit patterns.
1868 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1870 (match_operand:SI 1 "uint5_operand" ""))
1872 (label_ref (match_operand 2 "" ""))
1877 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1878 get_attr_length (insn), 0, insn, 0);
1880 [(set_attr "type" "cbranch")
1881 (set (attr "length")
1882 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1890 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1892 (match_operand:DI 1 "uint32_operand" ""))
1894 (label_ref (match_operand 2 "" ""))
1899 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1900 get_attr_length (insn), 0, insn, 0);
1902 [(set_attr "type" "cbranch")
1903 (set (attr "length")
1904 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1912 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1914 (match_operand:SI 1 "uint5_operand" ""))
1917 (label_ref (match_operand 2 "" ""))))]
1921 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1922 get_attr_length (insn), 1, insn, 0);
1924 [(set_attr "type" "cbranch")
1925 (set (attr "length")
1926 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1934 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1936 (match_operand:DI 1 "uint32_operand" ""))
1939 (label_ref (match_operand 2 "" ""))))]
1943 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1944 get_attr_length (insn), 1, insn, 0);
1946 [(set_attr "type" "cbranch")
1947 (set (attr "length")
1948 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1956 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1958 (match_operand:SI 1 "uint5_operand" ""))
1960 (label_ref (match_operand 2 "" ""))
1965 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1966 get_attr_length (insn), 0, insn, 1);
1968 [(set_attr "type" "cbranch")
1969 (set (attr "length")
1970 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1978 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1980 (match_operand:DI 1 "uint32_operand" ""))
1982 (label_ref (match_operand 2 "" ""))
1987 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
1988 get_attr_length (insn), 0, insn, 1);
1990 [(set_attr "type" "cbranch")
1991 (set (attr "length")
1992 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2000 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2002 (match_operand:SI 1 "uint5_operand" ""))
2005 (label_ref (match_operand 2 "" ""))))]
2009 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
2010 get_attr_length (insn), 1, insn, 1);
2012 [(set_attr "type" "cbranch")
2013 (set (attr "length")
2014 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2022 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2024 (match_operand:DI 1 "uint32_operand" ""))
2027 (label_ref (match_operand 2 "" ""))))]
2031 return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
2032 get_attr_length (insn), 1, insn, 1);
2034 [(set_attr "type" "cbranch")
2035 (set (attr "length")
2036 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2041 ;; Branch on Variable Bit patterns.
2045 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2047 (match_operand:SI 1 "register_operand" "q"))
2049 (label_ref (match_operand 2 "" ""))
2054 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2055 get_attr_length (insn), 0, insn, 0);
2057 [(set_attr "type" "cbranch")
2058 (set (attr "length")
2059 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2067 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2069 (match_operand:DI 1 "register_operand" "q"))
2071 (label_ref (match_operand 2 "" ""))
2076 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2077 get_attr_length (insn), 0, insn, 0);
2079 [(set_attr "type" "cbranch")
2080 (set (attr "length")
2081 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2089 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2091 (match_operand:SI 1 "register_operand" "q"))
2094 (label_ref (match_operand 2 "" ""))))]
2098 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2099 get_attr_length (insn), 1, insn, 0);
2101 [(set_attr "type" "cbranch")
2102 (set (attr "length")
2103 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2111 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2113 (match_operand:DI 1 "register_operand" "q"))
2116 (label_ref (match_operand 2 "" ""))))]
2120 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2121 get_attr_length (insn), 1, insn, 0);
2123 [(set_attr "type" "cbranch")
2124 (set (attr "length")
2125 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2133 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2135 (match_operand:SI 1 "register_operand" "q"))
2137 (label_ref (match_operand 2 "" ""))
2142 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2143 get_attr_length (insn), 0, insn, 1);
2145 [(set_attr "type" "cbranch")
2146 (set (attr "length")
2147 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2155 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2157 (match_operand:DI 1 "register_operand" "q"))
2159 (label_ref (match_operand 2 "" ""))
2164 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2165 get_attr_length (insn), 0, insn, 1);
2167 [(set_attr "type" "cbranch")
2168 (set (attr "length")
2169 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2177 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2179 (match_operand:SI 1 "register_operand" "q"))
2182 (label_ref (match_operand 2 "" ""))))]
2186 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2187 get_attr_length (insn), 1, insn, 1);
2189 [(set_attr "type" "cbranch")
2190 (set (attr "length")
2191 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2199 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2201 (match_operand:DI 1 "register_operand" "q"))
2204 (label_ref (match_operand 2 "" ""))))]
2208 return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
2209 get_attr_length (insn), 1, insn, 1);
2211 [(set_attr "type" "cbranch")
2212 (set (attr "length")
2213 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2218 ;; Floating point branches
2220 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2221 (label_ref (match_operand 0 "" ""))
2223 "! TARGET_SOFT_FLOAT"
2226 if (INSN_ANNULLED_BRANCH_P (insn))
2227 return \"ftest\;b,n %0\";
2229 return \"ftest\;b%* %0\";
2231 [(set_attr "type" "fbranch")
2232 (set_attr "length" "8")])
2235 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2237 (label_ref (match_operand 0 "" ""))))]
2238 "! TARGET_SOFT_FLOAT"
2241 if (INSN_ANNULLED_BRANCH_P (insn))
2242 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b,n %0\";
2244 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b%* %0\";
2246 [(set_attr "type" "fbranch")
2247 (set_attr "length" "12")])
2249 ;; Move instructions
2251 (define_expand "movsi"
2252 [(set (match_operand:SI 0 "general_operand" "")
2253 (match_operand:SI 1 "general_operand" ""))]
2257 if (emit_move_sequence (operands, SImode, 0))
2261 ;; Reloading an SImode or DImode value requires a scratch register if
2262 ;; going in to or out of float point registers.
2264 (define_expand "reload_insi"
2265 [(set (match_operand:SI 0 "register_operand" "=Z")
2266 (match_operand:SI 1 "non_hard_reg_operand" ""))
2267 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2271 if (emit_move_sequence (operands, SImode, operands[2]))
2274 /* We don't want the clobber emitted, so handle this ourselves. */
2275 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2279 (define_expand "reload_outsi"
2280 [(set (match_operand:SI 0 "non_hard_reg_operand" "")
2281 (match_operand:SI 1 "register_operand" "Z"))
2282 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2286 if (emit_move_sequence (operands, SImode, operands[2]))
2289 /* We don't want the clobber emitted, so handle this ourselves. */
2290 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2295 [(set (match_operand:SI 0 "move_dest_operand"
2296 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T,?r,?*f")
2297 (match_operand:SI 1 "move_src_operand"
2298 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f,*f,r"))]
2299 "(register_operand (operands[0], SImode)
2300 || reg_or_0_operand (operands[1], SImode))
2301 && !TARGET_SOFT_FLOAT
2308 {zdepi|depwi,z} %Z1,%0
2312 {mfctl|mfctl,w} %%sar,%0
2316 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
2317 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
2318 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore,move,move")
2319 (set_attr "pa_combine_type" "addmove")
2320 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,8,8")])
2323 [(set (match_operand:SI 0 "move_dest_operand"
2324 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
2325 (match_operand:SI 1 "move_src_operand"
2326 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
2327 "(register_operand (operands[0], SImode)
2328 || reg_or_0_operand (operands[1], SImode))
2329 && !TARGET_SOFT_FLOAT
2336 {zdepi|depwi,z} %Z1,%0
2340 {mfctl|mfctl,w} %%sar,%0
2344 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
2345 (set_attr "pa_combine_type" "addmove")
2346 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
2349 [(set (match_operand:SI 0 "indexed_memory_operand" "=R")
2350 (match_operand:SI 1 "register_operand" "f"))]
2352 && !TARGET_DISABLE_INDEXING
2353 && reload_completed"
2355 [(set_attr "type" "fpstore")
2356 (set_attr "pa_combine_type" "addmove")
2357 (set_attr "length" "4")])
2359 ; Rewrite RTL using an indexed store. This will allow the insn that
2360 ; computes the address to be deleted if the register it sets is dead.
2362 [(set (match_operand:SI 0 "register_operand" "")
2363 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
2365 (match_operand:SI 2 "register_operand" "")))
2366 (set (mem:SI (match_dup 0))
2367 (match_operand:SI 3 "register_operand" ""))]
2369 && !TARGET_DISABLE_INDEXING
2370 && REG_OK_FOR_BASE_P (operands[2])
2371 && FP_REGNO_P (REGNO (operands[3]))"
2372 [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2374 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
2379 [(set (match_operand:SI 0 "register_operand" "")
2380 (plus:SI (match_operand:SI 2 "register_operand" "")
2381 (mult:SI (match_operand:SI 1 "register_operand" "")
2383 (set (mem:SI (match_dup 0))
2384 (match_operand:SI 3 "register_operand" ""))]
2386 && !TARGET_DISABLE_INDEXING
2387 && REG_OK_FOR_BASE_P (operands[2])
2388 && FP_REGNO_P (REGNO (operands[3]))"
2389 [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2391 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
2396 [(set (match_operand:DI 0 "register_operand" "")
2397 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2399 (match_operand:DI 2 "register_operand" "")))
2400 (set (mem:SI (match_dup 0))
2401 (match_operand:SI 3 "register_operand" ""))]
2403 && !TARGET_DISABLE_INDEXING
2405 && REG_OK_FOR_BASE_P (operands[2])
2406 && FP_REGNO_P (REGNO (operands[3]))"
2407 [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2409 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
2414 [(set (match_operand:DI 0 "register_operand" "")
2415 (plus:DI (match_operand:DI 2 "register_operand" "")
2416 (mult:DI (match_operand:DI 1 "register_operand" "")
2418 (set (mem:SI (match_dup 0))
2419 (match_operand:SI 3 "register_operand" ""))]
2421 && !TARGET_DISABLE_INDEXING
2423 && REG_OK_FOR_BASE_P (operands[2])
2424 && FP_REGNO_P (REGNO (operands[3]))"
2425 [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2427 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
2432 [(set (match_operand:SI 0 "register_operand" "")
2433 (plus:SI (match_operand:SI 1 "register_operand" "")
2434 (match_operand:SI 2 "register_operand" "")))
2435 (set (mem:SI (match_dup 0))
2436 (match_operand:SI 3 "register_operand" ""))]
2438 && !TARGET_DISABLE_INDEXING
2439 && TARGET_NO_SPACE_REGS
2440 && REG_OK_FOR_INDEX_P (operands[1])
2441 && REG_OK_FOR_BASE_P (operands[2])
2442 && FP_REGNO_P (REGNO (operands[3]))"
2443 [(set (mem:SI (plus:SI (match_dup 1) (match_dup 2)))
2445 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2449 [(set (match_operand:SI 0 "register_operand" "")
2450 (plus:SI (match_operand:SI 1 "register_operand" "")
2451 (match_operand:SI 2 "register_operand" "")))
2452 (set (mem:SI (match_dup 0))
2453 (match_operand:SI 3 "register_operand" ""))]
2455 && !TARGET_DISABLE_INDEXING
2456 && TARGET_NO_SPACE_REGS
2457 && REG_OK_FOR_BASE_P (operands[1])
2458 && REG_OK_FOR_INDEX_P (operands[2])
2459 && FP_REGNO_P (REGNO (operands[3]))"
2460 [(set (mem:SI (plus:SI (match_dup 2) (match_dup 1)))
2462 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
2466 [(set (match_operand:DI 0 "register_operand" "")
2467 (plus:DI (match_operand:DI 1 "register_operand" "")
2468 (match_operand:DI 2 "register_operand" "")))
2469 (set (mem:SI (match_dup 0))
2470 (match_operand:SI 3 "register_operand" ""))]
2472 && !TARGET_DISABLE_INDEXING
2474 && TARGET_NO_SPACE_REGS
2475 && REG_OK_FOR_INDEX_P (operands[1])
2476 && REG_OK_FOR_BASE_P (operands[2])
2477 && FP_REGNO_P (REGNO (operands[3]))"
2478 [(set (mem:SI (plus:DI (match_dup 1) (match_dup 2)))
2480 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
2484 [(set (match_operand:DI 0 "register_operand" "")
2485 (plus:DI (match_operand:DI 1 "register_operand" "")
2486 (match_operand:DI 2 "register_operand" "")))
2487 (set (mem:SI (match_dup 0))
2488 (match_operand:SI 3 "register_operand" ""))]
2490 && !TARGET_DISABLE_INDEXING
2492 && TARGET_NO_SPACE_REGS
2493 && REG_OK_FOR_BASE_P (operands[1])
2494 && REG_OK_FOR_INDEX_P (operands[2])
2495 && FP_REGNO_P (REGNO (operands[3]))"
2496 [(set (mem:SI (plus:DI (match_dup 2) (match_dup 1)))
2498 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
2502 [(set (match_operand:SI 0 "move_dest_operand"
2503 "=r,r,r,r,r,r,Q,!*q,!r")
2504 (match_operand:SI 1 "move_src_operand"
2505 "A,r,J,N,K,RQ,rM,!rM,!*q"))]
2506 "(register_operand (operands[0], SImode)
2507 || reg_or_0_operand (operands[1], SImode))
2508 && TARGET_SOFT_FLOAT"
2514 {zdepi|depwi,z} %Z1,%0
2518 {mfctl|mfctl,w} %%sar,%0"
2519 [(set_attr "type" "load,move,move,move,move,load,store,move,move")
2520 (set_attr "pa_combine_type" "addmove")
2521 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
2523 ;; Load or store with base-register modification.
2525 [(set (match_operand:SI 0 "register_operand" "=r")
2526 (mem:SI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2527 (match_operand:DI 2 "int5_operand" "L"))))
2529 (plus:DI (match_dup 1) (match_dup 2)))]
2532 [(set_attr "type" "load")
2533 (set_attr "length" "4")])
2535 ; And a zero extended variant.
2537 [(set (match_operand:DI 0 "register_operand" "=r")
2538 (zero_extend:DI (mem:SI
2540 (match_operand:DI 1 "register_operand" "+r")
2541 (match_operand:DI 2 "int5_operand" "L")))))
2543 (plus:DI (match_dup 1) (match_dup 2)))]
2546 [(set_attr "type" "load")
2547 (set_attr "length" "4")])
2549 (define_expand "pre_load"
2550 [(parallel [(set (match_operand:SI 0 "register_operand" "")
2551 (mem (plus (match_operand 1 "register_operand" "")
2552 (match_operand 2 "pre_cint_operand" ""))))
2554 (plus (match_dup 1) (match_dup 2)))])]
2560 emit_insn (gen_pre_ldd (operands[0], operands[1], operands[2]));
2563 emit_insn (gen_pre_ldw (operands[0], operands[1], operands[2]));
2567 (define_insn "pre_ldw"
2568 [(set (match_operand:SI 0 "register_operand" "=r")
2569 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2570 (match_operand:SI 2 "pre_cint_operand" ""))))
2572 (plus:SI (match_dup 1) (match_dup 2)))]
2576 if (INTVAL (operands[2]) < 0)
2577 return \"{ldwm|ldw,mb} %2(%1),%0\";
2578 return \"{ldws|ldw},mb %2(%1),%0\";
2580 [(set_attr "type" "load")
2581 (set_attr "length" "4")])
2583 (define_insn "pre_ldd"
2584 [(set (match_operand:DI 0 "register_operand" "=r")
2585 (mem:DI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2586 (match_operand:DI 2 "pre_cint_operand" ""))))
2588 (plus:DI (match_dup 1) (match_dup 2)))]
2591 [(set_attr "type" "load")
2592 (set_attr "length" "4")])
2595 [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2596 (match_operand:SI 1 "pre_cint_operand" "")))
2597 (match_operand:SI 2 "reg_or_0_operand" "rM"))
2599 (plus:SI (match_dup 0) (match_dup 1)))]
2603 if (INTVAL (operands[1]) < 0)
2604 return \"{stwm|stw,mb} %r2,%1(%0)\";
2605 return \"{stws|stw},mb %r2,%1(%0)\";
2607 [(set_attr "type" "store")
2608 (set_attr "length" "4")])
2611 [(set (match_operand:SI 0 "register_operand" "=r")
2612 (mem:SI (match_operand:SI 1 "register_operand" "+r")))
2614 (plus:SI (match_dup 1)
2615 (match_operand:SI 2 "post_cint_operand" "")))]
2619 if (INTVAL (operands[2]) > 0)
2620 return \"{ldwm|ldw,ma} %2(%1),%0\";
2621 return \"{ldws|ldw},ma %2(%1),%0\";
2623 [(set_attr "type" "load")
2624 (set_attr "length" "4")])
2626 (define_expand "post_store"
2627 [(parallel [(set (mem (match_operand 0 "register_operand" ""))
2628 (match_operand 1 "reg_or_0_operand" ""))
2631 (match_operand 2 "post_cint_operand" "")))])]
2637 emit_insn (gen_post_std (operands[0], operands[1], operands[2]));
2640 emit_insn (gen_post_stw (operands[0], operands[1], operands[2]));
2644 (define_insn "post_stw"
2645 [(set (mem:SI (match_operand:SI 0 "register_operand" "+r"))
2646 (match_operand:SI 1 "reg_or_0_operand" "rM"))
2648 (plus:SI (match_dup 0)
2649 (match_operand:SI 2 "post_cint_operand" "")))]
2653 if (INTVAL (operands[2]) > 0)
2654 return \"{stwm|stw,ma} %r1,%2(%0)\";
2655 return \"{stws|stw},ma %r1,%2(%0)\";
2657 [(set_attr "type" "store")
2658 (set_attr "length" "4")])
2660 (define_insn "post_std"
2661 [(set (mem:DI (match_operand:DI 0 "register_operand" "+r"))
2662 (match_operand:DI 1 "reg_or_0_operand" "rM"))
2664 (plus:DI (match_dup 0)
2665 (match_operand:DI 2 "post_cint_operand" "")))]
2668 [(set_attr "type" "store")
2669 (set_attr "length" "4")])
2671 ;; For loading the address of a label while generating PIC code.
2672 ;; Note since this pattern can be created at reload time (via movsi), all
2673 ;; the same rules for movsi apply here. (no new pseudos, no temporaries).
2675 [(set (match_operand 0 "pmode_register_operand" "=a")
2676 (match_operand 1 "pic_label_operand" ""))]
2682 xoperands[0] = operands[0];
2683 xoperands[1] = operands[1];
2684 xoperands[2] = gen_label_rtx ();
2686 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2687 CODE_LABEL_NUMBER (xoperands[2]));
2688 output_asm_insn (\"mfia %0\", xoperands);
2690 /* If we're trying to load the address of a label that happens to be
2691 close, then we can use a shorter sequence. */
2692 if (GET_CODE (operands[1]) == LABEL_REF
2693 && !LABEL_REF_NONLOCAL_P (operands[1])
2694 && INSN_ADDRESSES_SET_P ()
2695 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2696 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2697 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2700 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2701 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2705 [(set_attr "type" "multi")
2706 (set_attr "length" "12")]) ; 8 or 12
2709 [(set (match_operand 0 "pmode_register_operand" "=a")
2710 (match_operand 1 "pic_label_operand" ""))]
2716 xoperands[0] = operands[0];
2717 xoperands[1] = operands[1];
2718 xoperands[2] = gen_label_rtx ();
2720 output_asm_insn (\"bl .+8,%0\", xoperands);
2721 output_asm_insn (\"depi 0,31,2,%0\", xoperands);
2722 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2723 CODE_LABEL_NUMBER (xoperands[2]));
2725 /* If we're trying to load the address of a label that happens to be
2726 close, then we can use a shorter sequence. */
2727 if (GET_CODE (operands[1]) == LABEL_REF
2728 && !LABEL_REF_NONLOCAL_P (operands[1])
2729 && INSN_ADDRESSES_SET_P ()
2730 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2731 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2732 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2735 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2736 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2740 [(set_attr "type" "multi")
2741 (set_attr "length" "16")]) ; 12 or 16
2744 [(set (match_operand:SI 0 "register_operand" "=a")
2745 (plus:SI (match_operand:SI 1 "register_operand" "r")
2746 (high:SI (match_operand 2 "" ""))))]
2747 "symbolic_operand (operands[2], Pmode)
2748 && ! function_label_operand (operands[2], Pmode)
2751 [(set_attr "type" "binary")
2752 (set_attr "length" "4")])
2755 [(set (match_operand:DI 0 "register_operand" "=a")
2756 (plus:DI (match_operand:DI 1 "register_operand" "r")
2757 (high:DI (match_operand 2 "" ""))))]
2758 "symbolic_operand (operands[2], Pmode)
2759 && ! function_label_operand (operands[2], Pmode)
2763 [(set_attr "type" "binary")
2764 (set_attr "length" "4")])
2766 ;; Always use addil rather than ldil;add sequences. This allows the
2767 ;; HP linker to eliminate the dp relocation if the symbolic operand
2768 ;; lives in the TEXT space.
2770 [(set (match_operand:SI 0 "register_operand" "=a")
2771 (high:SI (match_operand 1 "" "")))]
2772 "symbolic_operand (operands[1], Pmode)
2773 && ! function_label_operand (operands[1], Pmode)
2774 && ! read_only_operand (operands[1], Pmode)
2778 if (TARGET_LONG_LOAD_STORE)
2779 return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
2781 return \"addil LR'%H1,%%r27\";
2783 [(set_attr "type" "binary")
2784 (set (attr "length")
2785 (if_then_else (eq (symbol_ref "TARGET_LONG_LOAD_STORE") (const_int 0))
2790 ;; This is for use in the prologue/epilogue code. We need it
2791 ;; to add large constants to a stack pointer or frame pointer.
2792 ;; Because of the additional %r1 pressure, we probably do not
2793 ;; want to use this in general code, so make it available
2794 ;; only after reload.
2796 [(set (match_operand:SI 0 "register_operand" "=!a,*r")
2797 (plus:SI (match_operand:SI 1 "register_operand" "r,r")
2798 (high:SI (match_operand 2 "const_int_operand" ""))))]
2802 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2803 [(set_attr "type" "binary,binary")
2804 (set_attr "length" "4,8")])
2807 [(set (match_operand:DI 0 "register_operand" "=!a,*r")
2808 (plus:DI (match_operand:DI 1 "register_operand" "r,r")
2809 (high:DI (match_operand 2 "const_int_operand" ""))))]
2810 "reload_completed && TARGET_64BIT"
2813 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2814 [(set_attr "type" "binary,binary")
2815 (set_attr "length" "4,8")])
2818 [(set (match_operand:SI 0 "register_operand" "=r")
2819 (high:SI (match_operand 1 "" "")))]
2820 "(!flag_pic || !symbolic_operand (operands[1], Pmode))
2821 && !is_function_label_plus_const (operands[1])"
2824 if (symbolic_operand (operands[1], Pmode))
2825 return \"ldil LR'%H1,%0\";
2827 return \"ldil L'%G1,%0\";
2829 [(set_attr "type" "move")
2830 (set_attr "length" "4")])
2833 [(set (match_operand:DI 0 "register_operand" "=r")
2834 (high:DI (match_operand 1 "const_int_operand" "")))]
2837 [(set_attr "type" "move")
2838 (set_attr "length" "4")])
2841 [(set (match_operand:DI 0 "register_operand" "=r")
2842 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2843 (match_operand:DI 2 "const_int_operand" "i")))]
2846 [(set_attr "type" "move")
2847 (set_attr "length" "4")])
2850 [(set (match_operand:SI 0 "register_operand" "=r")
2851 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2852 (match_operand:SI 2 "immediate_operand" "i")))]
2853 "!is_function_label_plus_const (operands[2])"
2856 gcc_assert (!flag_pic || !symbolic_operand (operands[2], Pmode));
2858 if (symbolic_operand (operands[2], Pmode))
2859 return \"ldo RR'%G2(%1),%0\";
2861 return \"ldo R'%G2(%1),%0\";
2863 [(set_attr "type" "move")
2864 (set_attr "length" "4")])
2866 ;; Now that a symbolic_address plus a constant is broken up early
2867 ;; in the compilation phase (for better CSE) we need a special
2868 ;; combiner pattern to load the symbolic address plus the constant
2869 ;; in only 2 instructions. (For cases where the symbolic address
2870 ;; was not a common subexpression.)
2872 [(set (match_operand:SI 0 "register_operand" "")
2873 (match_operand:SI 1 "symbolic_operand" ""))
2874 (clobber (match_operand:SI 2 "register_operand" ""))]
2875 "! (flag_pic && pic_label_operand (operands[1], SImode))"
2876 [(set (match_dup 2) (high:SI (match_dup 1)))
2877 (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
2880 ;; hppa_legitimize_address goes to a great deal of trouble to
2881 ;; create addresses which use indexing. In some cases, this
2882 ;; is a lose because there isn't any store instructions which
2883 ;; allow indexed addresses (with integer register source).
2885 ;; These define_splits try to turn a 3 insn store into
2886 ;; a 2 insn store with some creative RTL rewriting.
2888 [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2889 (match_operand:SI 1 "shadd_operand" ""))
2890 (plus:SI (match_operand:SI 2 "register_operand" "")
2891 (match_operand:SI 3 "const_int_operand" ""))))
2892 (match_operand:SI 4 "register_operand" ""))
2893 (clobber (match_operand:SI 5 "register_operand" ""))]
2895 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2897 (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2901 [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2902 (match_operand:SI 1 "shadd_operand" ""))
2903 (plus:SI (match_operand:SI 2 "register_operand" "")
2904 (match_operand:SI 3 "const_int_operand" ""))))
2905 (match_operand:HI 4 "register_operand" ""))
2906 (clobber (match_operand:SI 5 "register_operand" ""))]
2908 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2910 (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2914 [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2915 (match_operand:SI 1 "shadd_operand" ""))
2916 (plus:SI (match_operand:SI 2 "register_operand" "")
2917 (match_operand:SI 3 "const_int_operand" ""))))
2918 (match_operand:QI 4 "register_operand" ""))
2919 (clobber (match_operand:SI 5 "register_operand" ""))]
2921 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2923 (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2926 (define_expand "movhi"
2927 [(set (match_operand:HI 0 "general_operand" "")
2928 (match_operand:HI 1 "general_operand" ""))]
2932 if (emit_move_sequence (operands, HImode, 0))
2937 [(set (match_operand:HI 0 "move_dest_operand"
2938 "=r,r,r,r,r,Q,!*q,!r,!*f,?r,?*f")
2939 (match_operand:HI 1 "move_src_operand"
2940 "r,J,N,K,RQ,rM,!rM,!*q,!*fM,*f,r"))]
2941 "(register_operand (operands[0], HImode)
2942 || reg_or_0_operand (operands[1], HImode))
2943 && !TARGET_SOFT_FLOAT
2949 {zdepi|depwi,z} %Z1,%0
2953 {mfctl|mfctl,w} %sar,%0
2955 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
2956 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
2957 [(set_attr "type" "move,move,move,shift,load,store,move,move,move,move,move")
2958 (set_attr "pa_combine_type" "addmove")
2959 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,8")])
2962 [(set (match_operand:HI 0 "move_dest_operand"
2963 "=r,r,r,r,r,Q,!*q,!r,!*f")
2964 (match_operand:HI 1 "move_src_operand"
2965 "r,J,N,K,RQ,rM,!rM,!*q,!*fM"))]
2966 "(register_operand (operands[0], HImode)
2967 || reg_or_0_operand (operands[1], HImode))
2968 && !TARGET_SOFT_FLOAT
2974 {zdepi|depwi,z} %Z1,%0
2978 {mfctl|mfctl,w} %sar,%0
2980 [(set_attr "type" "move,move,move,shift,load,store,move,move,move")
2981 (set_attr "pa_combine_type" "addmove")
2982 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
2985 [(set (match_operand:HI 0 "move_dest_operand"
2986 "=r,r,r,r,r,Q,!*q,!r")
2987 (match_operand:HI 1 "move_src_operand"
2988 "r,J,N,K,RQ,rM,!rM,!*q"))]
2989 "(register_operand (operands[0], HImode)
2990 || reg_or_0_operand (operands[1], HImode))
2991 && TARGET_SOFT_FLOAT"
2996 {zdepi|depwi,z} %Z1,%0
3000 {mfctl|mfctl,w} %sar,%0"
3001 [(set_attr "type" "move,move,move,shift,load,store,move,move")
3002 (set_attr "pa_combine_type" "addmove")
3003 (set_attr "length" "4,4,4,4,4,4,4,4")])
3006 [(set (match_operand:HI 0 "register_operand" "=r")
3007 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "+r")
3008 (match_operand:SI 2 "int5_operand" "L"))))
3010 (plus:SI (match_dup 1) (match_dup 2)))]
3012 "{ldhs|ldh},mb %2(%1),%0"
3013 [(set_attr "type" "load")
3014 (set_attr "length" "4")])
3017 [(set (match_operand:HI 0 "register_operand" "=r")
3018 (mem:HI (plus:DI (match_operand:DI 1 "register_operand" "+r")
3019 (match_operand:DI 2 "int5_operand" "L"))))
3021 (plus:DI (match_dup 1) (match_dup 2)))]
3024 [(set_attr "type" "load")
3025 (set_attr "length" "4")])
3027 ; And a zero extended variant.
3029 [(set (match_operand:DI 0 "register_operand" "=r")
3030 (zero_extend:DI (mem:HI
3032 (match_operand:DI 1 "register_operand" "+r")
3033 (match_operand:DI 2 "int5_operand" "L")))))
3035 (plus:DI (match_dup 1) (match_dup 2)))]
3038 [(set_attr "type" "load")
3039 (set_attr "length" "4")])
3042 [(set (match_operand:SI 0 "register_operand" "=r")
3043 (zero_extend:SI (mem:HI
3045 (match_operand:SI 1 "register_operand" "+r")
3046 (match_operand:SI 2 "int5_operand" "L")))))
3048 (plus:SI (match_dup 1) (match_dup 2)))]
3050 "{ldhs|ldh},mb %2(%1),%0"
3051 [(set_attr "type" "load")
3052 (set_attr "length" "4")])
3055 [(set (match_operand:SI 0 "register_operand" "=r")
3056 (zero_extend:SI (mem:HI
3058 (match_operand:DI 1 "register_operand" "+r")
3059 (match_operand:DI 2 "int5_operand" "L")))))
3061 (plus:DI (match_dup 1) (match_dup 2)))]
3064 [(set_attr "type" "load")
3065 (set_attr "length" "4")])
3068 [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "+r")
3069 (match_operand:SI 1 "int5_operand" "L")))
3070 (match_operand:HI 2 "reg_or_0_operand" "rM"))
3072 (plus:SI (match_dup 0) (match_dup 1)))]
3074 "{sths|sth},mb %r2,%1(%0)"
3075 [(set_attr "type" "store")
3076 (set_attr "length" "4")])
3079 [(set (mem:HI (plus:DI (match_operand:DI 0 "register_operand" "+r")
3080 (match_operand:DI 1 "int5_operand" "L")))
3081 (match_operand:HI 2 "reg_or_0_operand" "rM"))
3083 (plus:DI (match_dup 0) (match_dup 1)))]
3086 [(set_attr "type" "store")
3087 (set_attr "length" "4")])
3090 [(set (match_operand:HI 0 "register_operand" "=r")
3091 (plus:HI (match_operand:HI 1 "register_operand" "r")
3092 (match_operand 2 "const_int_operand" "J")))]
3095 [(set_attr "type" "binary")
3096 (set_attr "pa_combine_type" "addmove")
3097 (set_attr "length" "4")])
3099 (define_expand "movqi"
3100 [(set (match_operand:QI 0 "general_operand" "")
3101 (match_operand:QI 1 "general_operand" ""))]
3105 if (emit_move_sequence (operands, QImode, 0))
3110 [(set (match_operand:QI 0 "move_dest_operand"
3111 "=r,r,r,r,r,Q,!*q,!r,!*f,?r,?*f")
3112 (match_operand:QI 1 "move_src_operand"
3113 "r,J,N,K,RQ,rM,!rM,!*q,!*fM,*f,r"))]
3114 "(register_operand (operands[0], QImode)
3115 || reg_or_0_operand (operands[1], QImode))
3116 && !TARGET_SOFT_FLOAT
3122 {zdepi|depwi,z} %Z1,%0
3126 {mfctl|mfctl,w} %%sar,%0
3128 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
3129 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
3130 [(set_attr "type" "move,move,move,shift,load,store,move,move,move,move,move")
3131 (set_attr "pa_combine_type" "addmove")
3132 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,8")])
3135 [(set (match_operand:QI 0 "move_dest_operand"
3136 "=r,r,r,r,r,Q,!*q,!r,!*f")
3137 (match_operand:QI 1 "move_src_operand"
3138 "r,J,N,K,RQ,rM,!rM,!*q,!*fM"))]
3139 "(register_operand (operands[0], QImode)
3140 || reg_or_0_operand (operands[1], QImode))
3141 && !TARGET_SOFT_FLOAT
3147 {zdepi|depwi,z} %Z1,%0
3151 {mfctl|mfctl,w} %%sar,%0
3153 [(set_attr "type" "move,move,move,shift,load,store,move,move,move")
3154 (set_attr "pa_combine_type" "addmove")
3155 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
3158 [(set (match_operand:QI 0 "move_dest_operand"
3159 "=r,r,r,r,r,Q,!*q,!r")
3160 (match_operand:QI 1 "move_src_operand"
3161 "r,J,N,K,RQ,rM,!rM,!*q"))]
3162 "(register_operand (operands[0], QImode)
3163 || reg_or_0_operand (operands[1], QImode))
3164 && TARGET_SOFT_FLOAT"
3169 {zdepi|depwi,z} %Z1,%0
3173 {mfctl|mfctl,w} %%sar,%0"
3174 [(set_attr "type" "move,move,move,shift,load,store,move,move")
3175 (set_attr "pa_combine_type" "addmove")
3176 (set_attr "length" "4,4,4,4,4,4,4,4")])
3179 [(set (match_operand:QI 0 "register_operand" "=r")
3180 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "+r")
3181 (match_operand:SI 2 "int5_operand" "L"))))
3182 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3184 "{ldbs|ldb},mb %2(%1),%0"
3185 [(set_attr "type" "load")
3186 (set_attr "length" "4")])
3189 [(set (match_operand:QI 0 "register_operand" "=r")
3190 (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "+r")
3191 (match_operand:DI 2 "int5_operand" "L"))))
3192 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3195 [(set_attr "type" "load")
3196 (set_attr "length" "4")])
3198 ; Now the same thing with zero extensions.
3200 [(set (match_operand:DI 0 "register_operand" "=r")
3201 (zero_extend:DI (mem:QI (plus:DI
3202 (match_operand:DI 1 "register_operand" "+r")
3203 (match_operand:DI 2 "int5_operand" "L")))))
3204 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3207 [(set_attr "type" "load")
3208 (set_attr "length" "4")])
3211 [(set (match_operand:SI 0 "register_operand" "=r")
3212 (zero_extend:SI (mem:QI (plus:SI
3213 (match_operand:SI 1 "register_operand" "+r")
3214 (match_operand:SI 2 "int5_operand" "L")))))
3215 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3217 "{ldbs|ldb},mb %2(%1),%0"
3218 [(set_attr "type" "load")
3219 (set_attr "length" "4")])
3222 [(set (match_operand:SI 0 "register_operand" "=r")
3223 (zero_extend:SI (mem:QI (plus:DI
3224 (match_operand:DI 1 "register_operand" "+r")
3225 (match_operand:DI 2 "int5_operand" "L")))))
3226 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3229 [(set_attr "type" "load")
3230 (set_attr "length" "4")])
3233 [(set (match_operand:HI 0 "register_operand" "=r")
3234 (zero_extend:HI (mem:QI (plus:SI
3235 (match_operand:SI 1 "register_operand" "+r")
3236 (match_operand:SI 2 "int5_operand" "L")))))
3237 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3239 "{ldbs|ldb},mb %2(%1),%0"
3240 [(set_attr "type" "load")
3241 (set_attr "length" "4")])
3244 [(set (match_operand:HI 0 "register_operand" "=r")
3245 (zero_extend:HI (mem:QI (plus:DI
3246 (match_operand:DI 1 "register_operand" "+r")
3247 (match_operand:DI 2 "int5_operand" "L")))))
3248 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3251 [(set_attr "type" "load")
3252 (set_attr "length" "4")])
3255 [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "+r")
3256 (match_operand:SI 1 "int5_operand" "L")))
3257 (match_operand:QI 2 "reg_or_0_operand" "rM"))
3259 (plus:SI (match_dup 0) (match_dup 1)))]
3261 "{stbs|stb},mb %r2,%1(%0)"
3262 [(set_attr "type" "store")
3263 (set_attr "length" "4")])
3266 [(set (mem:QI (plus:DI (match_operand:DI 0 "register_operand" "+r")
3267 (match_operand:DI 1 "int5_operand" "L")))
3268 (match_operand:QI 2 "reg_or_0_operand" "rM"))
3270 (plus:DI (match_dup 0) (match_dup 1)))]
3273 [(set_attr "type" "store")
3274 (set_attr "length" "4")])
3276 ;; The definition of this insn does not really explain what it does,
3277 ;; but it should suffice that anything generated as this insn will be
3278 ;; recognized as a movmemsi operation, and that it will not successfully
3279 ;; combine with anything.
3280 (define_expand "movmemsi"
3281 [(parallel [(set (match_operand:BLK 0 "" "")
3282 (match_operand:BLK 1 "" ""))
3283 (clobber (match_dup 4))
3284 (clobber (match_dup 5))
3285 (clobber (match_dup 6))
3286 (clobber (match_dup 7))
3287 (clobber (match_dup 8))
3288 (use (match_operand:SI 2 "arith_operand" ""))
3289 (use (match_operand:SI 3 "const_int_operand" ""))])]
3290 "!TARGET_64BIT && optimize > 0"
3295 /* HP provides very fast block move library routine for the PA;
3296 this routine includes:
3298 4x4 byte at a time block moves,
3299 1x4 byte at a time with alignment checked at runtime with
3300 attempts to align the source and destination as needed
3303 With that in mind, here's the heuristics to try and guess when
3304 the inlined block move will be better than the library block
3307 If the size isn't constant, then always use the library routines.
3309 If the size is large in respect to the known alignment, then use
3310 the library routines.
3312 If the size is small in respect to the known alignment, then open
3313 code the copy (since that will lead to better scheduling).
3315 Else use the block move pattern. */
3317 /* Undetermined size, use the library routine. */
3318 if (GET_CODE (operands[2]) != CONST_INT)
3321 size = INTVAL (operands[2]);
3322 align = INTVAL (operands[3]);
3323 align = align > 4 ? 4 : align;
3325 /* If size/alignment is large, then use the library routines. */
3326 if (size / align > 16)
3329 /* This does happen, but not often enough to worry much about. */
3330 if (size / align < MOVE_RATIO)
3333 /* Fall through means we're going to use our block move pattern. */
3335 = replace_equiv_address (operands[0],
3336 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3338 = replace_equiv_address (operands[1],
3339 copy_to_mode_reg (SImode, XEXP (operands[1], 0)));
3340 operands[4] = gen_reg_rtx (SImode);
3341 operands[5] = gen_reg_rtx (SImode);
3342 operands[6] = gen_reg_rtx (SImode);
3343 operands[7] = gen_reg_rtx (SImode);
3344 operands[8] = gen_reg_rtx (SImode);
3347 ;; The operand constraints are written like this to support both compile-time
3348 ;; and run-time determined byte counts. The expander and output_block_move
3349 ;; only support compile-time determined counts at this time.
3351 ;; If the count is run-time determined, the register with the byte count
3352 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3354 ;; We used to clobber operands 0 and 1. However, a change to regrename.c
3355 ;; broke this semantic for pseudo registers. We can't use match_scratch
3356 ;; as this requires two registers in the class R1_REGS when the MEMs for
3357 ;; operands 0 and 1 are both equivalent to symbolic MEMs. Thus, we are
3358 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3359 ;; respectively. We then split or peephole optimize after reload.
3360 (define_insn "movmemsi_prereload"
3361 [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3362 (mem:BLK (match_operand:SI 1 "register_operand" "r,r")))
3363 (clobber (match_operand:SI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3364 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp1
3365 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3366 (clobber (match_operand:SI 7 "register_operand" "=&r,&r")) ;item tmp3
3367 (clobber (match_operand:SI 8 "register_operand" "=&r,&r")) ;item tmp4
3368 (use (match_operand:SI 4 "arith_operand" "J,2")) ;byte count
3369 (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
3372 [(set_attr "type" "multi,multi")])
3375 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3376 (match_operand:BLK 1 "memory_operand" ""))
3377 (clobber (match_operand:SI 2 "register_operand" ""))
3378 (clobber (match_operand:SI 3 "register_operand" ""))
3379 (clobber (match_operand:SI 6 "register_operand" ""))
3380 (clobber (match_operand:SI 7 "register_operand" ""))
3381 (clobber (match_operand:SI 8 "register_operand" ""))
3382 (use (match_operand:SI 4 "arith_operand" ""))
3383 (use (match_operand:SI 5 "const_int_operand" ""))])]
3384 "!TARGET_64BIT && reload_completed && !flag_peephole2
3385 && GET_CODE (operands[0]) == MEM
3386 && register_operand (XEXP (operands[0], 0), SImode)
3387 && GET_CODE (operands[1]) == MEM
3388 && register_operand (XEXP (operands[1], 0), SImode)"
3389 [(set (match_dup 7) (match_dup 9))
3390 (set (match_dup 8) (match_dup 10))
3391 (parallel [(set (match_dup 0) (match_dup 1))
3392 (clobber (match_dup 2))
3393 (clobber (match_dup 3))
3394 (clobber (match_dup 6))
3395 (clobber (match_dup 7))
3396 (clobber (match_dup 8))
3402 operands[9] = XEXP (operands[0], 0);
3403 operands[10] = XEXP (operands[1], 0);
3404 operands[0] = replace_equiv_address (operands[0], operands[7]);
3405 operands[1] = replace_equiv_address (operands[1], operands[8]);
3409 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3410 (match_operand:BLK 1 "memory_operand" ""))
3411 (clobber (match_operand:SI 2 "register_operand" ""))
3412 (clobber (match_operand:SI 3 "register_operand" ""))
3413 (clobber (match_operand:SI 6 "register_operand" ""))
3414 (clobber (match_operand:SI 7 "register_operand" ""))
3415 (clobber (match_operand:SI 8 "register_operand" ""))
3416 (use (match_operand:SI 4 "arith_operand" ""))
3417 (use (match_operand:SI 5 "const_int_operand" ""))])]
3419 && GET_CODE (operands[0]) == MEM
3420 && register_operand (XEXP (operands[0], 0), SImode)
3421 && GET_CODE (operands[1]) == MEM
3422 && register_operand (XEXP (operands[1], 0), SImode)"
3423 [(parallel [(set (match_dup 0) (match_dup 1))
3424 (clobber (match_dup 2))
3425 (clobber (match_dup 3))
3426 (clobber (match_dup 6))
3427 (clobber (match_dup 7))
3428 (clobber (match_dup 8))
3434 rtx addr = XEXP (operands[0], 0);
3435 if (dead_or_set_p (curr_insn, addr))
3439 emit_insn (gen_rtx_SET (VOIDmode, operands[7], addr));
3440 operands[0] = replace_equiv_address (operands[0], operands[7]);
3443 addr = XEXP (operands[1], 0);
3444 if (dead_or_set_p (curr_insn, addr))
3448 emit_insn (gen_rtx_SET (VOIDmode, operands[8], addr));
3449 operands[1] = replace_equiv_address (operands[1], operands[8]);
3453 (define_insn "movmemsi_postreload"
3454 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3455 (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
3456 (clobber (match_operand:SI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3457 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp1
3458 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3459 (clobber (match_dup 0))
3460 (clobber (match_dup 1))
3461 (use (match_operand:SI 4 "arith_operand" "J,2")) ;byte count
3462 (use (match_operand:SI 5 "const_int_operand" "n,n")) ;alignment
3464 "!TARGET_64BIT && reload_completed"
3465 "* return output_block_move (operands, !which_alternative);"
3466 [(set_attr "type" "multi,multi")])
3468 (define_expand "movmemdi"
3469 [(parallel [(set (match_operand:BLK 0 "" "")
3470 (match_operand:BLK 1 "" ""))
3471 (clobber (match_dup 4))
3472 (clobber (match_dup 5))
3473 (clobber (match_dup 6))
3474 (clobber (match_dup 7))
3475 (clobber (match_dup 8))
3476 (use (match_operand:DI 2 "arith_operand" ""))
3477 (use (match_operand:DI 3 "const_int_operand" ""))])]
3478 "TARGET_64BIT && optimize > 0"
3483 /* HP provides very fast block move library routine for the PA;
3484 this routine includes:
3486 4x4 byte at a time block moves,
3487 1x4 byte at a time with alignment checked at runtime with
3488 attempts to align the source and destination as needed
3491 With that in mind, here's the heuristics to try and guess when
3492 the inlined block move will be better than the library block
3495 If the size isn't constant, then always use the library routines.
3497 If the size is large in respect to the known alignment, then use
3498 the library routines.
3500 If the size is small in respect to the known alignment, then open
3501 code the copy (since that will lead to better scheduling).
3503 Else use the block move pattern. */
3505 /* Undetermined size, use the library routine. */
3506 if (GET_CODE (operands[2]) != CONST_INT)
3509 size = INTVAL (operands[2]);
3510 align = INTVAL (operands[3]);
3511 align = align > 8 ? 8 : align;
3513 /* If size/alignment is large, then use the library routines. */
3514 if (size / align > 16)
3517 /* This does happen, but not often enough to worry much about. */
3518 if (size / align < MOVE_RATIO)
3521 /* Fall through means we're going to use our block move pattern. */
3523 = replace_equiv_address (operands[0],
3524 copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3526 = replace_equiv_address (operands[1],
3527 copy_to_mode_reg (DImode, XEXP (operands[1], 0)));
3528 operands[4] = gen_reg_rtx (DImode);
3529 operands[5] = gen_reg_rtx (DImode);
3530 operands[6] = gen_reg_rtx (DImode);
3531 operands[7] = gen_reg_rtx (DImode);
3532 operands[8] = gen_reg_rtx (DImode);
3535 ;; The operand constraints are written like this to support both compile-time
3536 ;; and run-time determined byte counts. The expander and output_block_move
3537 ;; only support compile-time determined counts at this time.
3539 ;; If the count is run-time determined, the register with the byte count
3540 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3542 ;; We used to clobber operands 0 and 1. However, a change to regrename.c
3543 ;; broke this semantic for pseudo registers. We can't use match_scratch
3544 ;; as this requires two registers in the class R1_REGS when the MEMs for
3545 ;; operands 0 and 1 are both equivalent to symbolic MEMs. Thus, we are
3546 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3547 ;; respectively. We then split or peephole optimize after reload.
3548 (define_insn "movmemdi_prereload"
3549 [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3550 (mem:BLK (match_operand:DI 1 "register_operand" "r,r")))
3551 (clobber (match_operand:DI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3552 (clobber (match_operand:DI 3 "register_operand" "=&r,&r")) ;item tmp1
3553 (clobber (match_operand:DI 6 "register_operand" "=&r,&r")) ;item tmp2
3554 (clobber (match_operand:DI 7 "register_operand" "=&r,&r")) ;item tmp3
3555 (clobber (match_operand:DI 8 "register_operand" "=&r,&r")) ;item tmp4
3556 (use (match_operand:DI 4 "arith_operand" "J,2")) ;byte count
3557 (use (match_operand:DI 5 "const_int_operand" "n,n"))] ;alignment
3560 [(set_attr "type" "multi,multi")])
3563 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3564 (match_operand:BLK 1 "memory_operand" ""))
3565 (clobber (match_operand:DI 2 "register_operand" ""))
3566 (clobber (match_operand:DI 3 "register_operand" ""))
3567 (clobber (match_operand:DI 6 "register_operand" ""))
3568 (clobber (match_operand:DI 7 "register_operand" ""))
3569 (clobber (match_operand:DI 8 "register_operand" ""))
3570 (use (match_operand:DI 4 "arith_operand" ""))
3571 (use (match_operand:DI 5 "const_int_operand" ""))])]
3572 "TARGET_64BIT && reload_completed && !flag_peephole2
3573 && GET_CODE (operands[0]) == MEM
3574 && register_operand (XEXP (operands[0], 0), DImode)
3575 && GET_CODE (operands[1]) == MEM
3576 && register_operand (XEXP (operands[1], 0), DImode)"
3577 [(set (match_dup 7) (match_dup 9))
3578 (set (match_dup 8) (match_dup 10))
3579 (parallel [(set (match_dup 0) (match_dup 1))
3580 (clobber (match_dup 2))
3581 (clobber (match_dup 3))
3582 (clobber (match_dup 6))
3583 (clobber (match_dup 7))
3584 (clobber (match_dup 8))
3590 operands[9] = XEXP (operands[0], 0);
3591 operands[10] = XEXP (operands[1], 0);
3592 operands[0] = replace_equiv_address (operands[0], operands[7]);
3593 operands[1] = replace_equiv_address (operands[1], operands[8]);
3597 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3598 (match_operand:BLK 1 "memory_operand" ""))
3599 (clobber (match_operand:DI 2 "register_operand" ""))
3600 (clobber (match_operand:DI 3 "register_operand" ""))
3601 (clobber (match_operand:DI 6 "register_operand" ""))
3602 (clobber (match_operand:DI 7 "register_operand" ""))
3603 (clobber (match_operand:DI 8 "register_operand" ""))
3604 (use (match_operand:DI 4 "arith_operand" ""))
3605 (use (match_operand:DI 5 "const_int_operand" ""))])]
3607 && GET_CODE (operands[0]) == MEM
3608 && register_operand (XEXP (operands[0], 0), DImode)
3609 && GET_CODE (operands[1]) == MEM
3610 && register_operand (XEXP (operands[1], 0), DImode)"
3611 [(parallel [(set (match_dup 0) (match_dup 1))
3612 (clobber (match_dup 2))
3613 (clobber (match_dup 3))
3614 (clobber (match_dup 6))
3615 (clobber (match_dup 7))
3616 (clobber (match_dup 8))
3622 rtx addr = XEXP (operands[0], 0);
3623 if (dead_or_set_p (curr_insn, addr))
3627 emit_insn (gen_rtx_SET (VOIDmode, operands[7], addr));
3628 operands[0] = replace_equiv_address (operands[0], operands[7]);
3631 addr = XEXP (operands[1], 0);
3632 if (dead_or_set_p (curr_insn, addr))
3636 emit_insn (gen_rtx_SET (VOIDmode, operands[8], addr));
3637 operands[1] = replace_equiv_address (operands[1], operands[8]);
3641 (define_insn "movmemdi_postreload"
3642 [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3643 (mem:BLK (match_operand:DI 1 "register_operand" "+r,r")))
3644 (clobber (match_operand:DI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3645 (clobber (match_operand:DI 3 "register_operand" "=&r,&r")) ;item tmp1
3646 (clobber (match_operand:DI 6 "register_operand" "=&r,&r")) ;item tmp2
3647 (clobber (match_dup 0))
3648 (clobber (match_dup 1))
3649 (use (match_operand:DI 4 "arith_operand" "J,2")) ;byte count
3650 (use (match_operand:DI 5 "const_int_operand" "n,n")) ;alignment
3652 "TARGET_64BIT && reload_completed"
3653 "* return output_block_move (operands, !which_alternative);"
3654 [(set_attr "type" "multi,multi")])
3656 (define_expand "setmemsi"
3657 [(parallel [(set (match_operand:BLK 0 "" "")
3658 (match_operand 2 "const_int_operand" ""))
3659 (clobber (match_dup 4))
3660 (clobber (match_dup 5))
3661 (use (match_operand:SI 1 "arith_operand" ""))
3662 (use (match_operand:SI 3 "const_int_operand" ""))])]
3663 "!TARGET_64BIT && optimize > 0"
3668 /* If value to set is not zero, use the library routine. */
3669 if (operands[2] != const0_rtx)
3672 /* Undetermined size, use the library routine. */
3673 if (GET_CODE (operands[1]) != CONST_INT)
3676 size = INTVAL (operands[1]);
3677 align = INTVAL (operands[3]);
3678 align = align > 4 ? 4 : align;
3680 /* If size/alignment is large, then use the library routines. */
3681 if (size / align > 16)
3684 /* This does happen, but not often enough to worry much about. */
3685 if (size / align < MOVE_RATIO)
3688 /* Fall through means we're going to use our block clear pattern. */
3690 = replace_equiv_address (operands[0],
3691 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3692 operands[4] = gen_reg_rtx (SImode);
3693 operands[5] = gen_reg_rtx (SImode);
3696 (define_insn "clrmemsi_prereload"
3697 [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3699 (clobber (match_operand:SI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3700 (clobber (match_operand:SI 4 "register_operand" "=&r,&r")) ;tmp1
3701 (use (match_operand:SI 2 "arith_operand" "J,1")) ;byte count
3702 (use (match_operand:SI 3 "const_int_operand" "n,n"))] ;alignment
3705 [(set_attr "type" "multi,multi")])
3708 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3710 (clobber (match_operand:SI 1 "register_operand" ""))
3711 (clobber (match_operand:SI 4 "register_operand" ""))
3712 (use (match_operand:SI 2 "arith_operand" ""))
3713 (use (match_operand:SI 3 "const_int_operand" ""))])]
3714 "!TARGET_64BIT && reload_completed && !flag_peephole2
3715 && GET_CODE (operands[0]) == MEM
3716 && register_operand (XEXP (operands[0], 0), SImode)"
3717 [(set (match_dup 4) (match_dup 5))
3718 (parallel [(set (match_dup 0) (const_int 0))
3719 (clobber (match_dup 1))
3720 (clobber (match_dup 4))
3726 operands[5] = XEXP (operands[0], 0);
3727 operands[0] = replace_equiv_address (operands[0], operands[4]);
3731 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3733 (clobber (match_operand:SI 1 "register_operand" ""))
3734 (clobber (match_operand:SI 4 "register_operand" ""))
3735 (use (match_operand:SI 2 "arith_operand" ""))
3736 (use (match_operand:SI 3 "const_int_operand" ""))])]
3738 && GET_CODE (operands[0]) == MEM
3739 && register_operand (XEXP (operands[0], 0), SImode)"
3740 [(parallel [(set (match_dup 0) (const_int 0))
3741 (clobber (match_dup 1))
3742 (clobber (match_dup 4))
3748 rtx addr = XEXP (operands[0], 0);
3749 if (dead_or_set_p (curr_insn, addr))
3753 emit_insn (gen_rtx_SET (VOIDmode, operands[4], addr));
3754 operands[0] = replace_equiv_address (operands[0], operands[4]);
3758 (define_insn "clrmemsi_postreload"
3759 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3761 (clobber (match_operand:SI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3762 (clobber (match_dup 0))
3763 (use (match_operand:SI 2 "arith_operand" "J,1")) ;byte count
3764 (use (match_operand:SI 3 "const_int_operand" "n,n")) ;alignment
3766 "!TARGET_64BIT && reload_completed"
3767 "* return output_block_clear (operands, !which_alternative);"
3768 [(set_attr "type" "multi,multi")])
3770 (define_expand "setmemdi"
3771 [(parallel [(set (match_operand:BLK 0 "" "")
3772 (match_operand 2 "const_int_operand" ""))
3773 (clobber (match_dup 4))
3774 (clobber (match_dup 5))
3775 (use (match_operand:DI 1 "arith_operand" ""))
3776 (use (match_operand:DI 3 "const_int_operand" ""))])]
3777 "TARGET_64BIT && optimize > 0"
3782 /* If value to set is not zero, use the library routine. */
3783 if (operands[2] != const0_rtx)
3786 /* Undetermined size, use the library routine. */
3787 if (GET_CODE (operands[1]) != CONST_INT)
3790 size = INTVAL (operands[1]);
3791 align = INTVAL (operands[3]);
3792 align = align > 8 ? 8 : align;
3794 /* If size/alignment is large, then use the library routines. */
3795 if (size / align > 16)
3798 /* This does happen, but not often enough to worry much about. */
3799 if (size / align < MOVE_RATIO)
3802 /* Fall through means we're going to use our block clear pattern. */
3804 = replace_equiv_address (operands[0],
3805 copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3806 operands[4] = gen_reg_rtx (DImode);
3807 operands[5] = gen_reg_rtx (DImode);
3810 (define_insn "clrmemdi_prereload"
3811 [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3813 (clobber (match_operand:DI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3814 (clobber (match_operand:DI 4 "register_operand" "=&r,&r")) ;item tmp1
3815 (use (match_operand:DI 2 "arith_operand" "J,1")) ;byte count
3816 (use (match_operand:DI 3 "const_int_operand" "n,n"))] ;alignment
3819 [(set_attr "type" "multi,multi")])
3822 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3824 (clobber (match_operand:DI 1 "register_operand" ""))
3825 (clobber (match_operand:DI 4 "register_operand" ""))
3826 (use (match_operand:DI 2 "arith_operand" ""))
3827 (use (match_operand:DI 3 "const_int_operand" ""))])]
3828 "TARGET_64BIT && reload_completed && !flag_peephole2
3829 && GET_CODE (operands[0]) == MEM
3830 && register_operand (XEXP (operands[0], 0), DImode)"
3831 [(set (match_dup 4) (match_dup 5))
3832 (parallel [(set (match_dup 0) (const_int 0))
3833 (clobber (match_dup 1))
3834 (clobber (match_dup 4))
3840 operands[5] = XEXP (operands[0], 0);
3841 operands[0] = replace_equiv_address (operands[0], operands[4]);
3845 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3847 (clobber (match_operand:DI 1 "register_operand" ""))
3848 (clobber (match_operand:DI 4 "register_operand" ""))
3849 (use (match_operand:DI 2 "arith_operand" ""))
3850 (use (match_operand:DI 3 "const_int_operand" ""))])]
3852 && GET_CODE (operands[0]) == MEM
3853 && register_operand (XEXP (operands[0], 0), DImode)"
3854 [(parallel [(set (match_dup 0) (const_int 0))
3855 (clobber (match_dup 1))
3856 (clobber (match_dup 4))
3862 rtx addr = XEXP (operands[0], 0);
3863 if (dead_or_set_p (curr_insn, addr))
3867 emit_insn (gen_rtx_SET (VOIDmode, operands[4], addr));
3868 operands[0] = replace_equiv_address (operands[0], operands[4]);
3872 (define_insn "clrmemdi_postreload"
3873 [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3875 (clobber (match_operand:DI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3876 (clobber (match_dup 0))
3877 (use (match_operand:DI 2 "arith_operand" "J,1")) ;byte count
3878 (use (match_operand:DI 3 "const_int_operand" "n,n")) ;alignment
3880 "TARGET_64BIT && reload_completed"
3881 "* return output_block_clear (operands, !which_alternative);"
3882 [(set_attr "type" "multi,multi")])
3884 ;; Floating point move insns
3886 ;; This pattern forces (set (reg:DF ...) (const_double ...))
3887 ;; to be reloaded by putting the constant into memory when
3888 ;; reg is a floating point register.
3890 ;; For integer registers we use ldil;ldo to set the appropriate
3893 ;; This must come before the movdf pattern, and it must be present
3894 ;; to handle obscure reloading cases.
3896 [(set (match_operand:DF 0 "register_operand" "=?r,f")
3897 (match_operand:DF 1 "" "?F,m"))]
3898 "GET_CODE (operands[1]) == CONST_DOUBLE
3899 && operands[1] != CONST0_RTX (DFmode)
3901 && !TARGET_SOFT_FLOAT"
3902 "* return (which_alternative == 0 ? output_move_double (operands)
3903 : \"fldd%F1 %1,%0\");"
3904 [(set_attr "type" "move,fpload")
3905 (set_attr "length" "16,4")])
3907 (define_expand "movdf"
3908 [(set (match_operand:DF 0 "general_operand" "")
3909 (match_operand:DF 1 "general_operand" ""))]
3913 if (GET_CODE (operands[1]) == CONST_DOUBLE
3914 && operands[1] != CONST0_RTX (DFmode))
3916 /* Reject CONST_DOUBLE loads to all hard registers when
3917 generating 64-bit code and to floating point registers
3918 when generating 32-bit code. */
3919 if (REG_P (operands[0])
3920 && HARD_REGISTER_P (operands[0])
3921 && (TARGET_64BIT || REGNO (operands[0]) >= 32))
3925 operands[1] = force_const_mem (DFmode, operands[1]);
3928 if (emit_move_sequence (operands, DFmode, 0))
3932 ;; Reloading an SImode or DImode value requires a scratch register if
3933 ;; going in to or out of float point registers.
3935 (define_expand "reload_indf"
3936 [(set (match_operand:DF 0 "register_operand" "=Z")
3937 (match_operand:DF 1 "non_hard_reg_operand" ""))
3938 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3942 if (emit_move_sequence (operands, DFmode, operands[2]))
3945 /* We don't want the clobber emitted, so handle this ourselves. */
3946 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3950 (define_expand "reload_outdf"
3951 [(set (match_operand:DF 0 "non_hard_reg_operand" "")
3952 (match_operand:DF 1 "register_operand" "Z"))
3953 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3957 if (emit_move_sequence (operands, DFmode, operands[2]))
3960 /* We don't want the clobber emitted, so handle this ourselves. */
3961 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3966 [(set (match_operand:DF 0 "move_dest_operand"
3967 "=f,*r,Q,?o,?Q,f,*r,*r,?*r,?f")
3968 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3969 "fG,*rG,f,*r,*r,RQ,o,RQ,f,*r"))]
3970 "(register_operand (operands[0], DFmode)
3971 || reg_or_0_operand (operands[1], DFmode))
3972 && !(GET_CODE (operands[1]) == CONST_DOUBLE
3973 && GET_CODE (operands[0]) == MEM)
3975 && !TARGET_SOFT_FLOAT"
3978 if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3979 || operands[1] == CONST0_RTX (DFmode))
3980 && !(REG_P (operands[0]) && REG_P (operands[1])
3981 && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
3982 return output_fp_move_double (operands);
3983 return output_move_double (operands);
3985 [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load,move,move")
3986 (set_attr "length" "4,8,4,8,16,4,8,16,12,12")])
3989 [(set (match_operand:DF 0 "indexed_memory_operand" "=R")
3990 (match_operand:DF 1 "reg_or_0_operand" "f"))]
3992 && !TARGET_DISABLE_INDEXING
3993 && reload_completed"
3995 [(set_attr "type" "fpstore")
3996 (set_attr "pa_combine_type" "addmove")
3997 (set_attr "length" "4")])
4000 [(set (match_operand:SI 0 "register_operand" "")
4001 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
4003 (match_operand:SI 2 "register_operand" "")))
4004 (set (mem:DF (match_dup 0))
4005 (match_operand:DF 3 "register_operand" ""))]
4007 && !TARGET_DISABLE_INDEXING
4008 && REG_OK_FOR_BASE_P (operands[2])
4009 && FP_REGNO_P (REGNO (operands[3]))"
4010 [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
4012 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 8))
4017 [(set (match_operand:SI 0 "register_operand" "")
4018 (plus:SI (match_operand:SI 2 "register_operand" "")
4019 (mult:SI (match_operand:SI 1 "register_operand" "")
4021 (set (mem:DF (match_dup 0))
4022 (match_operand:DF 3 "register_operand" ""))]
4024 && !TARGET_DISABLE_INDEXING
4025 && REG_OK_FOR_BASE_P (operands[2])
4026 && FP_REGNO_P (REGNO (operands[3]))"
4027 [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
4029 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 8))
4034 [(set (match_operand:DI 0 "register_operand" "")
4035 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4037 (match_operand:DI 2 "register_operand" "")))
4038 (set (mem:DF (match_dup 0))
4039 (match_operand:DF 3 "register_operand" ""))]
4041 && !TARGET_DISABLE_INDEXING
4043 && REG_OK_FOR_BASE_P (operands[2])
4044 && FP_REGNO_P (REGNO (operands[3]))"
4045 [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4047 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4052 [(set (match_operand:DI 0 "register_operand" "")
4053 (plus:DI (match_operand:DI 2 "register_operand" "")
4054 (mult:DI (match_operand:DI 1 "register_operand" "")
4056 (set (mem:DF (match_dup 0))
4057 (match_operand:DF 3 "register_operand" ""))]
4059 && !TARGET_DISABLE_INDEXING
4061 && REG_OK_FOR_BASE_P (operands[2])
4062 && FP_REGNO_P (REGNO (operands[3]))"
4063 [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4065 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4070 [(set (match_operand:SI 0 "register_operand" "")
4071 (plus:SI (match_operand:SI 1 "register_operand" "")
4072 (match_operand:SI 2 "register_operand" "")))
4073 (set (mem:DF (match_dup 0))
4074 (match_operand:DF 3 "register_operand" ""))]
4076 && !TARGET_DISABLE_INDEXING
4077 && TARGET_NO_SPACE_REGS
4078 && REG_OK_FOR_INDEX_P (operands[1])
4079 && REG_OK_FOR_BASE_P (operands[2])
4080 && FP_REGNO_P (REGNO (operands[3]))"
4081 [(set (mem:DF (plus:SI (match_dup 1) (match_dup 2)))
4083 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
4087 [(set (match_operand:SI 0 "register_operand" "")
4088 (plus:SI (match_operand:SI 1 "register_operand" "")
4089 (match_operand:SI 2 "register_operand" "")))
4090 (set (mem:DF (match_dup 0))
4091 (match_operand:DF 3 "register_operand" ""))]
4093 && !TARGET_DISABLE_INDEXING
4094 && TARGET_NO_SPACE_REGS
4095 && REG_OK_FOR_BASE_P (operands[1])
4096 && REG_OK_FOR_INDEX_P (operands[2])
4097 && FP_REGNO_P (REGNO (operands[3]))"
4098 [(set (mem:DF (plus:SI (match_dup 2) (match_dup 1)))
4100 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
4104 [(set (match_operand:DI 0 "register_operand" "")
4105 (plus:DI (match_operand:DI 1 "register_operand" "")
4106 (match_operand:DI 2 "register_operand" "")))
4107 (set (mem:DF (match_dup 0))
4108 (match_operand:DF 3 "register_operand" ""))]
4110 && !TARGET_DISABLE_INDEXING
4112 && TARGET_NO_SPACE_REGS
4113 && REG_OK_FOR_INDEX_P (operands[1])
4114 && REG_OK_FOR_BASE_P (operands[2])
4115 && FP_REGNO_P (REGNO (operands[3]))"
4116 [(set (mem:DF (plus:DI (match_dup 1) (match_dup 2)))
4118 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4122 [(set (match_operand:DI 0 "register_operand" "")
4123 (plus:DI (match_operand:DI 1 "register_operand" "")
4124 (match_operand:DI 2 "register_operand" "")))
4125 (set (mem:DF (match_dup 0))
4126 (match_operand:DF 3 "register_operand" ""))]
4128 && !TARGET_DISABLE_INDEXING
4130 && TARGET_NO_SPACE_REGS
4131 && REG_OK_FOR_BASE_P (operands[1])
4132 && REG_OK_FOR_INDEX_P (operands[2])
4133 && FP_REGNO_P (REGNO (operands[3]))"
4134 [(set (mem:DF (plus:DI (match_dup 2) (match_dup 1)))
4136 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4140 [(set (match_operand:DF 0 "move_dest_operand"
4142 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
4144 "(register_operand (operands[0], DFmode)
4145 || reg_or_0_operand (operands[1], DFmode))
4147 && TARGET_SOFT_FLOAT"
4150 return output_move_double (operands);
4152 [(set_attr "type" "move,store,store,load,load")
4153 (set_attr "length" "8,8,16,8,16")])
4156 [(set (match_operand:DF 0 "move_dest_operand"
4157 "=!*r,*r,*r,*r,*r,Q,f,f,T")
4158 (match_operand:DF 1 "move_src_operand"
4159 "!*r,J,N,K,RQ,*rG,fG,RT,f"))]
4160 "(register_operand (operands[0], DFmode)
4161 || reg_or_0_operand (operands[1], DFmode))
4162 && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4173 [(set_attr "type" "move,move,move,shift,load,store,fpalu,fpload,fpstore")
4174 (set_attr "pa_combine_type" "addmove")
4175 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
4178 (define_expand "movdi"
4179 [(set (match_operand:DI 0 "general_operand" "")
4180 (match_operand:DI 1 "general_operand" ""))]
4184 if (GET_CODE (operands[1]) == CONST_DOUBLE && TARGET_64BIT)
4185 operands[1] = force_const_mem (DImode, operands[1]);
4187 if (emit_move_sequence (operands, DImode, 0))
4191 (define_expand "reload_indi"
4192 [(set (match_operand:DI 0 "register_operand" "=Z")
4193 (match_operand:DI 1 "non_hard_reg_operand" ""))
4194 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4198 if (emit_move_sequence (operands, DImode, operands[2]))
4201 /* We don't want the clobber emitted, so handle this ourselves. */
4202 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4206 (define_expand "reload_outdi"
4207 [(set (match_operand:DI 0 "non_hard_reg_operand" "")
4208 (match_operand:DI 1 "register_operand" "Z"))
4209 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4213 if (emit_move_sequence (operands, DImode, operands[2]))
4216 /* We don't want the clobber emitted, so handle this ourselves. */
4217 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4222 [(set (match_operand:DI 0 "register_operand" "=r")
4223 (high:DI (match_operand 1 "" "")))]
4227 rtx op0 = operands[0];
4228 rtx op1 = operands[1];
4230 switch (GET_CODE (op1))
4233 #if HOST_BITS_PER_WIDE_INT <= 32
4234 operands[0] = operand_subword (op0, 1, 0, DImode);
4235 output_asm_insn (\"ldil L'%1,%0\", operands);
4237 operands[0] = operand_subword (op0, 0, 0, DImode);
4238 if (INTVAL (op1) < 0)
4239 output_asm_insn (\"ldi -1,%0\", operands);
4241 output_asm_insn (\"ldi 0,%0\", operands);
4243 operands[0] = operand_subword (op0, 1, 0, DImode);
4244 operands[1] = GEN_INT (INTVAL (op1) & 0xffffffff);
4245 output_asm_insn (\"ldil L'%1,%0\", operands);
4247 operands[0] = operand_subword (op0, 0, 0, DImode);
4248 operands[1] = GEN_INT (INTVAL (op1) >> 32);
4249 output_asm_insn (singlemove_string (operands), operands);
4254 operands[0] = operand_subword (op0, 1, 0, DImode);
4255 operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
4256 output_asm_insn (\"ldil L'%1,%0\", operands);
4258 operands[0] = operand_subword (op0, 0, 0, DImode);
4259 operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
4260 output_asm_insn (singlemove_string (operands), operands);
4268 [(set_attr "type" "move")
4269 (set_attr "length" "12")])
4272 [(set (match_operand:DI 0 "move_dest_operand"
4273 "=r,o,Q,r,r,r,*f,*f,T,?r,?*f")
4274 (match_operand:DI 1 "general_operand"
4275 "rM,r,r,o*R,Q,i,*fM,RT,*f,*f,r"))]
4276 "(register_operand (operands[0], DImode)
4277 || reg_or_0_operand (operands[1], DImode))
4279 && !TARGET_SOFT_FLOAT"
4282 if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
4283 || operands[1] == CONST0_RTX (DFmode))
4284 && !(REG_P (operands[0]) && REG_P (operands[1])
4285 && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
4286 return output_fp_move_double (operands);
4287 return output_move_double (operands);
4290 "move,store,store,load,load,multi,fpalu,fpload,fpstore,move,move")
4291 (set_attr "length" "8,8,16,8,16,16,4,4,4,12,12")])
4294 [(set (match_operand:DI 0 "move_dest_operand"
4295 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
4296 (match_operand:DI 1 "move_src_operand"
4297 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
4298 "(register_operand (operands[0], DImode)
4299 || reg_or_0_operand (operands[1], DImode))
4300 && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4310 {mfctl|mfctl,w} %%sar,%0
4314 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
4315 (set_attr "pa_combine_type" "addmove")
4316 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
4319 [(set (match_operand:DI 0 "indexed_memory_operand" "=R")
4320 (match_operand:DI 1 "register_operand" "f"))]
4323 && !TARGET_DISABLE_INDEXING
4324 && reload_completed"
4326 [(set_attr "type" "fpstore")
4327 (set_attr "pa_combine_type" "addmove")
4328 (set_attr "length" "4")])
4331 [(set (match_operand:DI 0 "register_operand" "")
4332 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4334 (match_operand:DI 2 "register_operand" "")))
4335 (set (mem:DI (match_dup 0))
4336 (match_operand:DI 3 "register_operand" ""))]
4338 && !TARGET_DISABLE_INDEXING
4340 && REG_OK_FOR_BASE_P (operands[2])
4341 && FP_REGNO_P (REGNO (operands[3]))"
4342 [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4344 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4349 [(set (match_operand:DI 0 "register_operand" "")
4350 (plus:DI (match_operand:DI 2 "register_operand" "")
4351 (mult:DI (match_operand:DI 1 "register_operand" "")
4353 (set (mem:DI (match_dup 0))
4354 (match_operand:DI 3 "register_operand" ""))]
4356 && !TARGET_DISABLE_INDEXING
4358 && REG_OK_FOR_BASE_P (operands[2])
4359 && FP_REGNO_P (REGNO (operands[3]))"
4360 [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4362 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4367 [(set (match_operand:DI 0 "register_operand" "")
4368 (plus:DI (match_operand:DI 1 "register_operand" "")
4369 (match_operand:DI 2 "register_operand" "")))
4370 (set (mem:DI (match_dup 0))
4371 (match_operand:DI 3 "register_operand" ""))]
4373 && !TARGET_DISABLE_INDEXING
4375 && TARGET_NO_SPACE_REGS
4376 && REG_OK_FOR_INDEX_P (operands[1])
4377 && REG_OK_FOR_BASE_P (operands[2])
4378 && FP_REGNO_P (REGNO (operands[3]))"
4379 [(set (mem:DI (plus:DI (match_dup 1) (match_dup 2)))
4381 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4385 [(set (match_operand:DI 0 "register_operand" "")
4386 (plus:DI (match_operand:DI 1 "register_operand" "")
4387 (match_operand:DI 2 "register_operand" "")))
4388 (set (mem:DI (match_dup 0))
4389 (match_operand:DI 3 "register_operand" ""))]
4391 && !TARGET_DISABLE_INDEXING
4393 && TARGET_NO_SPACE_REGS
4394 && REG_OK_FOR_BASE_P (operands[1])
4395 && REG_OK_FOR_INDEX_P (operands[2])
4396 && FP_REGNO_P (REGNO (operands[3]))"
4397 [(set (mem:DI (plus:DI (match_dup 2) (match_dup 1)))
4399 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4403 [(set (match_operand:DI 0 "move_dest_operand"
4405 (match_operand:DI 1 "general_operand"
4407 "(register_operand (operands[0], DImode)
4408 || reg_or_0_operand (operands[1], DImode))
4410 && TARGET_SOFT_FLOAT"
4413 return output_move_double (operands);
4415 [(set_attr "type" "move,store,store,load,load,multi")
4416 (set_attr "length" "8,8,16,8,16,16")])
4419 [(set (match_operand:DI 0 "register_operand" "=r,&r")
4420 (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
4421 (match_operand:DI 2 "immediate_operand" "i,i")))]
4425 /* Don't output a 64 bit constant, since we can't trust the assembler to
4426 handle it correctly. */
4427 if (GET_CODE (operands[2]) == CONST_DOUBLE)
4428 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
4429 else if (HOST_BITS_PER_WIDE_INT > 32
4430 && GET_CODE (operands[2]) == CONST_INT)
4431 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffffffff);
4432 if (which_alternative == 1)
4433 output_asm_insn (\"copy %1,%0\", operands);
4434 return \"ldo R'%G2(%R1),%R0\";
4436 [(set_attr "type" "move,move")
4437 (set_attr "length" "4,8")])
4439 ;; This pattern forces (set (reg:SF ...) (const_double ...))
4440 ;; to be reloaded by putting the constant into memory when
4441 ;; reg is a floating point register.
4443 ;; For integer registers we use ldil;ldo to set the appropriate
4446 ;; This must come before the movsf pattern, and it must be present
4447 ;; to handle obscure reloading cases.
4449 [(set (match_operand:SF 0 "register_operand" "=?r,f")
4450 (match_operand:SF 1 "" "?F,m"))]
4451 "GET_CODE (operands[1]) == CONST_DOUBLE
4452 && operands[1] != CONST0_RTX (SFmode)
4453 && ! TARGET_SOFT_FLOAT"
4454 "* return (which_alternative == 0 ? singlemove_string (operands)
4455 : \" fldw%F1 %1,%0\");"
4456 [(set_attr "type" "move,fpload")
4457 (set_attr "length" "8,4")])
4459 (define_expand "movsf"
4460 [(set (match_operand:SF 0 "general_operand" "")
4461 (match_operand:SF 1 "general_operand" ""))]
4465 /* Reject CONST_DOUBLE loads to floating point registers. */
4466 if (GET_CODE (operands[1]) == CONST_DOUBLE
4467 && operands[1] != CONST0_RTX (SFmode)
4468 && REG_P (operands[0])
4469 && HARD_REGISTER_P (operands[0])
4470 && REGNO (operands[0]) >= 32)
4473 if (emit_move_sequence (operands, SFmode, 0))
4477 ;; Reloading an SImode or DImode value requires a scratch register if
4478 ;; going in to or out of float point registers.
4480 (define_expand "reload_insf"
4481 [(set (match_operand:SF 0 "register_operand" "=Z")
4482 (match_operand:SF 1 "non_hard_reg_operand" ""))
4483 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4487 if (emit_move_sequence (operands, SFmode, operands[2]))
4490 /* We don't want the clobber emitted, so handle this ourselves. */
4491 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4495 (define_expand "reload_outsf"
4496 [(set (match_operand:SF 0 "non_hard_reg_operand" "")
4497 (match_operand:SF 1 "register_operand" "Z"))
4498 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4502 if (emit_move_sequence (operands, SFmode, operands[2]))
4505 /* We don't want the clobber emitted, so handle this ourselves. */
4506 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4511 [(set (match_operand:SF 0 "move_dest_operand"
4512 "=f,!*r,f,*r,Q,Q,?*r,?f")
4513 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4514 "fG,!*rG,RQ,RQ,f,*rG,f,*r"))]
4515 "(register_operand (operands[0], SFmode)
4516 || reg_or_0_operand (operands[1], SFmode))
4517 && !TARGET_SOFT_FLOAT
4526 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
4527 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
4528 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store,move,move")
4529 (set_attr "pa_combine_type" "addmove")
4530 (set_attr "length" "4,4,4,4,4,4,8,8")])
4533 [(set (match_operand:SF 0 "move_dest_operand"
4535 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4536 "fG,!*rG,RQ,RQ,f,*rG"))]
4537 "(register_operand (operands[0], SFmode)
4538 || reg_or_0_operand (operands[1], SFmode))
4539 && !TARGET_SOFT_FLOAT
4548 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
4549 (set_attr "pa_combine_type" "addmove")
4550 (set_attr "length" "4,4,4,4,4,4")])
4553 [(set (match_operand:SF 0 "indexed_memory_operand" "=R")
4554 (match_operand:SF 1 "register_operand" "f"))]
4556 && !TARGET_DISABLE_INDEXING
4557 && reload_completed"
4559 [(set_attr "type" "fpstore")
4560 (set_attr "pa_combine_type" "addmove")
4561 (set_attr "length" "4")])
4564 [(set (match_operand:SI 0 "register_operand" "")
4565 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
4567 (match_operand:SI 2 "register_operand" "")))
4568 (set (mem:SF (match_dup 0))
4569 (match_operand:SF 3 "register_operand" ""))]
4571 && !TARGET_DISABLE_INDEXING
4572 && REG_OK_FOR_BASE_P (operands[2])
4573 && FP_REGNO_P (REGNO (operands[3]))"
4574 [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4576 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
4581 [(set (match_operand:SI 0 "register_operand" "")
4582 (plus:SI (match_operand:SI 2 "register_operand" "")
4583 (mult:SI (match_operand:SI 1 "register_operand" "")
4585 (set (mem:SF (match_dup 0))
4586 (match_operand:SF 3 "register_operand" ""))]
4588 && !TARGET_DISABLE_INDEXING
4589 && REG_OK_FOR_BASE_P (operands[2])
4590 && FP_REGNO_P (REGNO (operands[3]))"
4591 [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4593 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
4598 [(set (match_operand:DI 0 "register_operand" "")
4599 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4601 (match_operand:DI 2 "register_operand" "")))
4602 (set (mem:SF (match_dup 0))
4603 (match_operand:SF 3 "register_operand" ""))]
4605 && !TARGET_DISABLE_INDEXING
4607 && REG_OK_FOR_BASE_P (operands[2])
4608 && FP_REGNO_P (REGNO (operands[3]))"
4609 [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4611 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
4616 [(set (match_operand:DI 0 "register_operand" "")
4617 (plus:DI (match_operand:DI 2 "register_operand" "")
4618 (mult:DI (match_operand:DI 1 "register_operand" "")
4620 (set (mem:SF (match_dup 0))
4621 (match_operand:SF 3 "register_operand" ""))]
4623 && !TARGET_DISABLE_INDEXING
4625 && REG_OK_FOR_BASE_P (operands[2])
4626 && FP_REGNO_P (REGNO (operands[3]))"
4627 [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4629 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
4634 [(set (match_operand:SI 0 "register_operand" "")
4635 (plus:SI (match_operand:SI 1 "register_operand" "")
4636 (match_operand:SI 2 "register_operand" "")))
4637 (set (mem:SF (match_dup 0))
4638 (match_operand:SF 3 "register_operand" ""))]
4640 && !TARGET_DISABLE_INDEXING
4641 && TARGET_NO_SPACE_REGS
4642 && REG_OK_FOR_INDEX_P (operands[1])
4643 && REG_OK_FOR_BASE_P (operands[2])
4644 && FP_REGNO_P (REGNO (operands[3]))"
4645 [(set (mem:SF (plus:SI (match_dup 1) (match_dup 2)))
4647 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
4651 [(set (match_operand:SI 0 "register_operand" "")
4652 (plus:SI (match_operand:SI 1 "register_operand" "")
4653 (match_operand:SI 2 "register_operand" "")))
4654 (set (mem:SF (match_dup 0))
4655 (match_operand:SF 3 "register_operand" ""))]
4657 && !TARGET_DISABLE_INDEXING
4658 && TARGET_NO_SPACE_REGS
4659 && REG_OK_FOR_BASE_P (operands[1])
4660 && REG_OK_FOR_INDEX_P (operands[2])
4661 && FP_REGNO_P (REGNO (operands[3]))"
4662 [(set (mem:SF (plus:SI (match_dup 2) (match_dup 1)))
4664 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
4668 [(set (match_operand:DI 0 "register_operand" "")
4669 (plus:DI (match_operand:DI 1 "register_operand" "")
4670 (match_operand:DI 2 "register_operand" "")))
4671 (set (mem:SF (match_dup 0))
4672 (match_operand:SF 3 "register_operand" ""))]
4674 && !TARGET_DISABLE_INDEXING
4676 && TARGET_NO_SPACE_REGS
4677 && REG_OK_FOR_INDEX_P (operands[1])
4678 && REG_OK_FOR_BASE_P (operands[2])
4679 && FP_REGNO_P (REGNO (operands[3]))"
4680 [(set (mem:SF (plus:DI (match_dup 1) (match_dup 2)))
4682 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4686 [(set (match_operand:DI 0 "register_operand" "")
4687 (plus:DI (match_operand:DI 1 "register_operand" "")
4688 (match_operand:DI 2 "register_operand" "")))
4689 (set (mem:SF (match_dup 0))
4690 (match_operand:SF 3 "register_operand" ""))]
4692 && !TARGET_DISABLE_INDEXING
4694 && TARGET_NO_SPACE_REGS
4695 && REG_OK_FOR_BASE_P (operands[1])
4696 && REG_OK_FOR_INDEX_P (operands[2])
4697 && FP_REGNO_P (REGNO (operands[3]))"
4698 [(set (mem:SF (plus:DI (match_dup 2) (match_dup 1)))
4700 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4704 [(set (match_operand:SF 0 "move_dest_operand"
4706 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4708 "(register_operand (operands[0], SFmode)
4709 || reg_or_0_operand (operands[1], SFmode))
4710 && TARGET_SOFT_FLOAT"
4715 [(set_attr "type" "move,load,store")
4716 (set_attr "pa_combine_type" "addmove")
4717 (set_attr "length" "4,4,4")])
4721 ;;- zero extension instructions
4722 ;; We have define_expand for zero extension patterns to make sure the
4723 ;; operands get loaded into registers. The define_insns accept
4724 ;; memory operands. This gives us better overall code than just
4725 ;; having a pattern that does or does not accept memory operands.
4727 (define_expand "zero_extendqihi2"
4728 [(set (match_operand:HI 0 "register_operand" "")
4730 (match_operand:QI 1 "register_operand" "")))]
4735 [(set (match_operand:HI 0 "register_operand" "=r,r")
4737 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4738 "GET_CODE (operands[1]) != CONST_INT"
4740 {extru|extrw,u} %1,31,8,%0
4742 [(set_attr "type" "shift,load")
4743 (set_attr "length" "4,4")])
4745 (define_expand "zero_extendqisi2"
4746 [(set (match_operand:SI 0 "register_operand" "")
4748 (match_operand:QI 1 "register_operand" "")))]
4753 [(set (match_operand:SI 0 "register_operand" "=r,r")
4755 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4756 "GET_CODE (operands[1]) != CONST_INT"
4758 {extru|extrw,u} %1,31,8,%0
4760 [(set_attr "type" "shift,load")
4761 (set_attr "length" "4,4")])
4763 (define_expand "zero_extendhisi2"
4764 [(set (match_operand:SI 0 "register_operand" "")
4766 (match_operand:HI 1 "register_operand" "")))]
4771 [(set (match_operand:SI 0 "register_operand" "=r,r")
4773 (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4774 "GET_CODE (operands[1]) != CONST_INT"
4776 {extru|extrw,u} %1,31,16,%0
4778 [(set_attr "type" "shift,load")
4779 (set_attr "length" "4,4")])
4781 (define_expand "zero_extendqidi2"
4782 [(set (match_operand:DI 0 "register_operand" "")
4784 (match_operand:QI 1 "register_operand" "")))]
4789 [(set (match_operand:DI 0 "register_operand" "=r,r")
4791 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4792 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4796 [(set_attr "type" "shift,load")
4797 (set_attr "length" "4,4")])
4799 (define_expand "zero_extendhidi2"
4800 [(set (match_operand:DI 0 "register_operand" "")
4802 (match_operand:HI 1 "register_operand" "")))]
4807 [(set (match_operand:DI 0 "register_operand" "=r,r")
4809 (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4810 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4814 [(set_attr "type" "shift,load")
4815 (set_attr "length" "4,4")])
4817 (define_expand "zero_extendsidi2"
4818 [(set (match_operand:DI 0 "register_operand" "")
4820 (match_operand:SI 1 "register_operand" "")))]
4825 [(set (match_operand:DI 0 "register_operand" "=r,r")
4827 (match_operand:SI 1 "move_src_operand" "r,RQ")))]
4828 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4832 [(set_attr "type" "shift,load")
4833 (set_attr "length" "4,4")])
4835 ;;- sign extension instructions
4837 (define_insn "extendhisi2"
4838 [(set (match_operand:SI 0 "register_operand" "=r")
4839 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
4841 "{extrs|extrw,s} %1,31,16,%0"
4842 [(set_attr "type" "shift")
4843 (set_attr "length" "4")])
4845 (define_insn "extendqihi2"
4846 [(set (match_operand:HI 0 "register_operand" "=r")
4847 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
4849 "{extrs|extrw,s} %1,31,8,%0"
4850 [(set_attr "type" "shift")
4851 (set_attr "length" "4")])
4853 (define_insn "extendqisi2"
4854 [(set (match_operand:SI 0 "register_operand" "=r")
4855 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
4857 "{extrs|extrw,s} %1,31,8,%0"
4858 [(set_attr "type" "shift")
4859 (set_attr "length" "4")])
4861 (define_insn "extendqidi2"
4862 [(set (match_operand:DI 0 "register_operand" "=r")
4863 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
4865 "extrd,s %1,63,8,%0"
4866 [(set_attr "type" "shift")
4867 (set_attr "length" "4")])
4869 (define_insn "extendhidi2"
4870 [(set (match_operand:DI 0 "register_operand" "=r")
4871 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
4873 "extrd,s %1,63,16,%0"
4874 [(set_attr "type" "shift")
4875 (set_attr "length" "4")])
4877 (define_insn "extendsidi2"
4878 [(set (match_operand:DI 0 "register_operand" "=r")
4879 (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))]
4881 "extrd,s %1,63,32,%0"
4882 [(set_attr "type" "shift")
4883 (set_attr "length" "4")])
4886 ;; Conversions between float and double.
4888 (define_insn "extendsfdf2"
4889 [(set (match_operand:DF 0 "register_operand" "=f")
4891 (match_operand:SF 1 "register_operand" "f")))]
4892 "! TARGET_SOFT_FLOAT"
4893 "{fcnvff|fcnv},sgl,dbl %1,%0"
4894 [(set_attr "type" "fpalu")
4895 (set_attr "length" "4")])
4897 (define_insn "truncdfsf2"
4898 [(set (match_operand:SF 0 "register_operand" "=f")
4900 (match_operand:DF 1 "register_operand" "f")))]
4901 "! TARGET_SOFT_FLOAT"
4902 "{fcnvff|fcnv},dbl,sgl %1,%0"
4903 [(set_attr "type" "fpalu")
4904 (set_attr "length" "4")])
4906 ;; Conversion between fixed point and floating point.
4907 ;; Note that among the fix-to-float insns
4908 ;; the ones that start with SImode come first.
4909 ;; That is so that an operand that is a CONST_INT
4910 ;; (and therefore lacks a specific machine mode).
4911 ;; will be recognized as SImode (which is always valid)
4912 ;; rather than as QImode or HImode.
4914 ;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
4915 ;; to be reloaded by putting the constant into memory.
4916 ;; It must come before the more general floatsisf2 pattern.
4918 [(set (match_operand:SF 0 "register_operand" "=f")
4919 (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
4920 "! TARGET_SOFT_FLOAT"
4921 "fldw%F1 %1,%0\;{fcnvxf,sgl,sgl|fcnv,w,sgl} %0,%0"
4922 [(set_attr "type" "fpalu")
4923 (set_attr "length" "8")])
4925 (define_insn "floatsisf2"
4926 [(set (match_operand:SF 0 "register_operand" "=f")
4927 (float:SF (match_operand:SI 1 "register_operand" "f")))]
4928 "! TARGET_SOFT_FLOAT"
4929 "{fcnvxf,sgl,sgl|fcnv,w,sgl} %1,%0"
4930 [(set_attr "type" "fpalu")
4931 (set_attr "length" "4")])
4933 ;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
4934 ;; to be reloaded by putting the constant into memory.
4935 ;; It must come before the more general floatsidf2 pattern.
4937 [(set (match_operand:DF 0 "register_operand" "=f")
4938 (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
4939 "! TARGET_SOFT_FLOAT"
4940 "fldw%F1 %1,%0\;{fcnvxf,sgl,dbl|fcnv,w,dbl} %0,%0"
4941 [(set_attr "type" "fpalu")
4942 (set_attr "length" "8")])
4944 (define_insn "floatsidf2"
4945 [(set (match_operand:DF 0 "register_operand" "=f")
4946 (float:DF (match_operand:SI 1 "register_operand" "f")))]
4947 "! TARGET_SOFT_FLOAT"
4948 "{fcnvxf,sgl,dbl|fcnv,w,dbl} %1,%0"
4949 [(set_attr "type" "fpalu")
4950 (set_attr "length" "4")])
4952 (define_expand "floatunssisf2"
4953 [(set (subreg:SI (match_dup 2) 4)
4954 (match_operand:SI 1 "register_operand" ""))
4955 (set (subreg:SI (match_dup 2) 0)
4957 (set (match_operand:SF 0 "register_operand" "")
4958 (float:SF (match_dup 2)))]
4959 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4964 emit_insn (gen_floatunssisf2_pa20 (operands[0], operands[1]));
4967 operands[2] = gen_reg_rtx (DImode);
4970 (define_expand "floatunssidf2"
4971 [(set (subreg:SI (match_dup 2) 4)
4972 (match_operand:SI 1 "register_operand" ""))
4973 (set (subreg:SI (match_dup 2) 0)
4975 (set (match_operand:DF 0 "register_operand" "")
4976 (float:DF (match_dup 2)))]
4977 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4982 emit_insn (gen_floatunssidf2_pa20 (operands[0], operands[1]));
4985 operands[2] = gen_reg_rtx (DImode);
4988 (define_insn "floatdisf2"
4989 [(set (match_operand:SF 0 "register_operand" "=f")
4990 (float:SF (match_operand:DI 1 "register_operand" "f")))]
4991 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4992 "{fcnvxf,dbl,sgl|fcnv,dw,sgl} %1,%0"
4993 [(set_attr "type" "fpalu")
4994 (set_attr "length" "4")])
4996 (define_insn "floatdidf2"
4997 [(set (match_operand:DF 0 "register_operand" "=f")
4998 (float:DF (match_operand:DI 1 "register_operand" "f")))]
4999 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
5000 "{fcnvxf,dbl,dbl|fcnv,dw,dbl} %1,%0"
5001 [(set_attr "type" "fpalu")
5002 (set_attr "length" "4")])
5004 ;; Convert a float to an actual integer.
5005 ;; Truncation is performed as part of the conversion.
5007 (define_insn "fix_truncsfsi2"
5008 [(set (match_operand:SI 0 "register_operand" "=f")
5009 (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
5010 "! TARGET_SOFT_FLOAT"
5011 "{fcnvfxt,sgl,sgl|fcnv,t,sgl,w} %1,%0"
5012 [(set_attr "type" "fpalu")
5013 (set_attr "length" "4")])
5015 (define_insn "fix_truncdfsi2"
5016 [(set (match_operand:SI 0 "register_operand" "=f")
5017 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
5018 "! TARGET_SOFT_FLOAT"
5019 "{fcnvfxt,dbl,sgl|fcnv,t,dbl,w} %1,%0"
5020 [(set_attr "type" "fpalu")
5021 (set_attr "length" "4")])
5023 (define_insn "fix_truncsfdi2"
5024 [(set (match_operand:DI 0 "register_operand" "=f")
5025 (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
5026 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
5027 "{fcnvfxt,sgl,dbl|fcnv,t,sgl,dw} %1,%0"
5028 [(set_attr "type" "fpalu")
5029 (set_attr "length" "4")])
5031 (define_insn "fix_truncdfdi2"
5032 [(set (match_operand:DI 0 "register_operand" "=f")
5033 (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
5034 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
5035 "{fcnvfxt,dbl,dbl|fcnv,t,dbl,dw} %1,%0"
5036 [(set_attr "type" "fpalu")
5037 (set_attr "length" "4")])
5039 (define_insn "floatunssidf2_pa20"
5040 [(set (match_operand:DF 0 "register_operand" "=f")
5041 (unsigned_float:DF (match_operand:SI 1 "register_operand" "f")))]
5042 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5044 [(set_attr "type" "fpalu")
5045 (set_attr "length" "4")])
5047 (define_insn "floatunssisf2_pa20"
5048 [(set (match_operand:SF 0 "register_operand" "=f")
5049 (unsigned_float:SF (match_operand:SI 1 "register_operand" "f")))]
5050 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5052 [(set_attr "type" "fpalu")
5053 (set_attr "length" "4")])
5055 (define_insn "floatunsdisf2"
5056 [(set (match_operand:SF 0 "register_operand" "=f")
5057 (unsigned_float:SF (match_operand:DI 1 "register_operand" "f")))]
5058 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5059 "fcnv,udw,sgl %1,%0"
5060 [(set_attr "type" "fpalu")
5061 (set_attr "length" "4")])
5063 (define_insn "floatunsdidf2"
5064 [(set (match_operand:DF 0 "register_operand" "=f")
5065 (unsigned_float:DF (match_operand:DI 1 "register_operand" "f")))]
5066 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5067 "fcnv,udw,dbl %1,%0"
5068 [(set_attr "type" "fpalu")
5069 (set_attr "length" "4")])
5071 (define_insn "fixuns_truncsfsi2"
5072 [(set (match_operand:SI 0 "register_operand" "=f")
5073 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
5074 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5075 "fcnv,t,sgl,uw %1,%0"
5076 [(set_attr "type" "fpalu")
5077 (set_attr "length" "4")])
5079 (define_insn "fixuns_truncdfsi2"
5080 [(set (match_operand:SI 0 "register_operand" "=f")
5081 (unsigned_fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
5082 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5083 "fcnv,t,dbl,uw %1,%0"
5084 [(set_attr "type" "fpalu")
5085 (set_attr "length" "4")])
5087 (define_insn "fixuns_truncsfdi2"
5088 [(set (match_operand:DI 0 "register_operand" "=f")
5089 (unsigned_fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
5090 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5091 "fcnv,t,sgl,udw %1,%0"
5092 [(set_attr "type" "fpalu")
5093 (set_attr "length" "4")])
5095 (define_insn "fixuns_truncdfdi2"
5096 [(set (match_operand:DI 0 "register_operand" "=f")
5097 (unsigned_fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
5098 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
5099 "fcnv,t,dbl,udw %1,%0"
5100 [(set_attr "type" "fpalu")
5101 (set_attr "length" "4")])
5103 ;;- arithmetic instructions
5105 (define_expand "adddi3"
5106 [(set (match_operand:DI 0 "register_operand" "")
5107 (plus:DI (match_operand:DI 1 "register_operand" "")
5108 (match_operand:DI 2 "adddi3_operand" "")))]
5113 [(set (match_operand:DI 0 "register_operand" "=r")
5114 (plus:DI (match_operand:DI 1 "register_operand" "%r")
5115 (match_operand:DI 2 "arith11_operand" "rI")))]
5119 if (GET_CODE (operands[2]) == CONST_INT)
5121 if (INTVAL (operands[2]) >= 0)
5122 return \"addi %2,%R1,%R0\;{addc|add,c} %1,%%r0,%0\";
5124 return \"addi %2,%R1,%R0\;{subb|sub,b} %1,%%r0,%0\";
5127 return \"add %R2,%R1,%R0\;{addc|add,c} %2,%1,%0\";
5129 [(set_attr "type" "binary")
5130 (set_attr "length" "8")])
5133 [(set (match_operand:DI 0 "register_operand" "=r,r")
5134 (plus:DI (match_operand:DI 1 "register_operand" "%r,r")
5135 (match_operand:DI 2 "arith_operand" "r,J")))]
5140 [(set_attr "type" "binary,binary")
5141 (set_attr "pa_combine_type" "addmove")
5142 (set_attr "length" "4,4")])
5145 [(set (match_operand:DI 0 "register_operand" "=r")
5146 (plus:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5147 (match_operand:DI 2 "register_operand" "r")))]
5150 [(set_attr "type" "binary")
5151 (set_attr "length" "4")])
5154 [(set (match_operand:SI 0 "register_operand" "=r")
5155 (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5156 (match_operand:SI 2 "register_operand" "r")))]
5159 [(set_attr "type" "binary")
5160 (set_attr "length" "4")])
5162 ;; define_splits to optimize cases of adding a constant integer
5163 ;; to a register when the constant does not fit in 14 bits. */
5165 [(set (match_operand:SI 0 "register_operand" "")
5166 (plus:SI (match_operand:SI 1 "register_operand" "")
5167 (match_operand:SI 2 "const_int_operand" "")))
5168 (clobber (match_operand:SI 4 "register_operand" ""))]
5169 "! cint_ok_for_move (INTVAL (operands[2]))
5170 && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
5171 [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
5172 (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
5175 int val = INTVAL (operands[2]);
5176 int low = (val < 0) ? -0x2000 : 0x1fff;
5177 int rest = val - low;
5179 operands[2] = GEN_INT (rest);
5180 operands[3] = GEN_INT (low);
5184 [(set (match_operand:SI 0 "register_operand" "")
5185 (plus:SI (match_operand:SI 1 "register_operand" "")
5186 (match_operand:SI 2 "const_int_operand" "")))
5187 (clobber (match_operand:SI 4 "register_operand" ""))]
5188 "! cint_ok_for_move (INTVAL (operands[2]))"
5189 [(set (match_dup 4) (match_dup 2))
5190 (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
5194 HOST_WIDE_INT intval = INTVAL (operands[2]);
5196 /* Try dividing the constant by 2, then 4, and finally 8 to see
5197 if we can get a constant which can be loaded into a register
5198 in a single instruction (cint_ok_for_move).
5200 If that fails, try to negate the constant and subtract it
5201 from our input operand. */
5202 if (intval % 2 == 0 && cint_ok_for_move (intval / 2))
5204 operands[2] = GEN_INT (intval / 2);
5205 operands[3] = const2_rtx;
5207 else if (intval % 4 == 0 && cint_ok_for_move (intval / 4))
5209 operands[2] = GEN_INT (intval / 4);
5210 operands[3] = GEN_INT (4);
5212 else if (intval % 8 == 0 && cint_ok_for_move (intval / 8))
5214 operands[2] = GEN_INT (intval / 8);
5215 operands[3] = GEN_INT (8);
5217 else if (cint_ok_for_move (-intval))
5219 emit_insn (gen_rtx_SET (VOIDmode, operands[4], GEN_INT (-intval)));
5220 emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
5227 (define_insn "addsi3"
5228 [(set (match_operand:SI 0 "register_operand" "=r,r")
5229 (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
5230 (match_operand:SI 2 "arith_operand" "r,J")))]
5233 {addl|add,l} %1,%2,%0
5235 [(set_attr "type" "binary,binary")
5236 (set_attr "pa_combine_type" "addmove")
5237 (set_attr "length" "4,4")])
5239 (define_expand "subdi3"
5240 [(set (match_operand:DI 0 "register_operand" "")
5241 (minus:DI (match_operand:DI 1 "register_operand" "")
5242 (match_operand:DI 2 "register_operand" "")))]
5247 [(set (match_operand:DI 0 "register_operand" "=r")
5248 (minus:DI (match_operand:DI 1 "register_operand" "r")
5249 (match_operand:DI 2 "register_operand" "r")))]
5251 "sub %R1,%R2,%R0\;{subb|sub,b} %1,%2,%0"
5252 [(set_attr "type" "binary")
5253 (set_attr "length" "8")])
5256 [(set (match_operand:DI 0 "register_operand" "=r,r,!q")
5257 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I,!U")
5258 (match_operand:DI 2 "register_operand" "r,r,!r")))]
5264 [(set_attr "type" "binary,binary,move")
5265 (set_attr "length" "4,4,4")])
5267 (define_expand "subsi3"
5268 [(set (match_operand:SI 0 "register_operand" "")
5269 (minus:SI (match_operand:SI 1 "arith11_operand" "")
5270 (match_operand:SI 2 "register_operand" "")))]
5275 [(set (match_operand:SI 0 "register_operand" "=r,r")
5276 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
5277 (match_operand:SI 2 "register_operand" "r,r")))]
5282 [(set_attr "type" "binary,binary")
5283 (set_attr "length" "4,4")])
5286 [(set (match_operand:SI 0 "register_operand" "=r,r,!q")
5287 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I,!S")
5288 (match_operand:SI 2 "register_operand" "r,r,!r")))]
5294 [(set_attr "type" "binary,binary,move")
5295 (set_attr "length" "4,4,4")])
5297 ;; Clobbering a "register_operand" instead of a match_scratch
5298 ;; in operand3 of millicode calls avoids spilling %r1 and
5299 ;; produces better code.
5301 ;; The mulsi3 insns set up registers for the millicode call.
5302 (define_expand "mulsi3"
5303 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5304 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5305 (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5306 (clobber (match_dup 3))
5307 (clobber (reg:SI 26))
5308 (clobber (reg:SI 25))
5309 (clobber (match_dup 4))])
5310 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5314 operands[4] = gen_rtx_REG (SImode, TARGET_64BIT ? 2 : 31);
5315 if (TARGET_PA_11 && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT)
5317 rtx scratch = gen_reg_rtx (DImode);
5318 operands[1] = force_reg (SImode, operands[1]);
5319 operands[2] = force_reg (SImode, operands[2]);
5320 emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
5321 emit_insn (gen_movsi (operands[0],
5322 gen_rtx_SUBREG (SImode, scratch,
5323 GET_MODE_SIZE (SImode))));
5326 operands[3] = gen_reg_rtx (SImode);
5329 (define_insn "umulsidi3"
5330 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
5331 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5332 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
5333 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5335 [(set_attr "type" "fpmuldbl")
5336 (set_attr "length" "4")])
5339 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
5340 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5341 (match_operand:DI 2 "uint32_operand" "f")))]
5342 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT"
5344 [(set_attr "type" "fpmuldbl")
5345 (set_attr "length" "4")])
5348 [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
5349 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5350 (match_operand:DI 2 "uint32_operand" "f")))]
5351 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
5353 [(set_attr "type" "fpmuldbl")
5354 (set_attr "length" "4")])
5357 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5358 (clobber (match_operand:SI 0 "register_operand" "=a"))
5359 (clobber (reg:SI 26))
5360 (clobber (reg:SI 25))
5361 (clobber (reg:SI 31))]
5363 "* return output_mul_insn (0, insn);"
5364 [(set_attr "type" "milli")
5365 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5368 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5369 (clobber (match_operand:SI 0 "register_operand" "=a"))
5370 (clobber (reg:SI 26))
5371 (clobber (reg:SI 25))
5372 (clobber (reg:SI 2))]
5374 "* return output_mul_insn (0, insn);"
5375 [(set_attr "type" "milli")
5376 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5378 (define_expand "muldi3"
5379 [(set (match_operand:DI 0 "register_operand" "")
5380 (mult:DI (match_operand:DI 1 "register_operand" "")
5381 (match_operand:DI 2 "register_operand" "")))]
5382 "TARGET_64BIT && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5385 rtx low_product = gen_reg_rtx (DImode);
5386 rtx cross_product1 = gen_reg_rtx (DImode);
5387 rtx cross_product2 = gen_reg_rtx (DImode);
5388 rtx cross_scratch = gen_reg_rtx (DImode);
5389 rtx cross_product = gen_reg_rtx (DImode);
5390 rtx op1l, op1r, op2l, op2r;
5391 rtx op1shifted, op2shifted;
5393 op1shifted = gen_reg_rtx (DImode);
5394 op2shifted = gen_reg_rtx (DImode);
5395 op1l = gen_reg_rtx (SImode);
5396 op1r = gen_reg_rtx (SImode);
5397 op2l = gen_reg_rtx (SImode);
5398 op2r = gen_reg_rtx (SImode);
5400 emit_move_insn (op1shifted, gen_rtx_LSHIFTRT (DImode, operands[1],
5402 emit_move_insn (op2shifted, gen_rtx_LSHIFTRT (DImode, operands[2],
5404 op1r = gen_rtx_SUBREG (SImode, operands[1], 4);
5405 op2r = gen_rtx_SUBREG (SImode, operands[2], 4);
5406 op1l = gen_rtx_SUBREG (SImode, op1shifted, 4);
5407 op2l = gen_rtx_SUBREG (SImode, op2shifted, 4);
5409 /* Emit multiplies for the cross products. */
5410 emit_insn (gen_umulsidi3 (cross_product1, op2r, op1l));
5411 emit_insn (gen_umulsidi3 (cross_product2, op2l, op1r));
5413 /* Emit a multiply for the low sub-word. */
5414 emit_insn (gen_umulsidi3 (low_product, copy_rtx (op2r), copy_rtx (op1r)));
5416 /* Sum the cross products and shift them into proper position. */
5417 emit_insn (gen_adddi3 (cross_scratch, cross_product1, cross_product2));
5418 emit_insn (gen_ashldi3 (cross_product, cross_scratch, GEN_INT (32)));
5420 /* Add the cross product to the low product and store the result
5421 into the output operand . */
5422 emit_insn (gen_adddi3 (operands[0], cross_product, low_product));
5426 ;;; Division and mod.
5427 (define_expand "divsi3"
5428 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5429 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5430 (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
5431 (clobber (match_dup 3))
5432 (clobber (match_dup 4))
5433 (clobber (reg:SI 26))
5434 (clobber (reg:SI 25))
5435 (clobber (match_dup 5))])
5436 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5440 operands[3] = gen_reg_rtx (SImode);
5443 operands[5] = gen_rtx_REG (SImode, 2);
5444 operands[4] = operands[5];
5448 operands[5] = gen_rtx_REG (SImode, 31);
5449 operands[4] = gen_reg_rtx (SImode);
5451 if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 0))
5457 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5458 (clobber (match_operand:SI 1 "register_operand" "=a"))
5459 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5460 (clobber (reg:SI 26))
5461 (clobber (reg:SI 25))
5462 (clobber (reg:SI 31))]
5465 return output_div_insn (operands, 0, insn);"
5466 [(set_attr "type" "milli")
5467 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5471 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5472 (clobber (match_operand:SI 1 "register_operand" "=a"))
5473 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5474 (clobber (reg:SI 26))
5475 (clobber (reg:SI 25))
5476 (clobber (reg:SI 2))]
5479 return output_div_insn (operands, 0, insn);"
5480 [(set_attr "type" "milli")
5481 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5483 (define_expand "udivsi3"
5484 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5485 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5486 (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
5487 (clobber (match_dup 3))
5488 (clobber (match_dup 4))
5489 (clobber (reg:SI 26))
5490 (clobber (reg:SI 25))
5491 (clobber (match_dup 5))])
5492 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5496 operands[3] = gen_reg_rtx (SImode);
5500 operands[5] = gen_rtx_REG (SImode, 2);
5501 operands[4] = operands[5];
5505 operands[5] = gen_rtx_REG (SImode, 31);
5506 operands[4] = gen_reg_rtx (SImode);
5508 if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 1))
5514 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5515 (clobber (match_operand:SI 1 "register_operand" "=a"))
5516 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5517 (clobber (reg:SI 26))
5518 (clobber (reg:SI 25))
5519 (clobber (reg:SI 31))]
5522 return output_div_insn (operands, 1, insn);"
5523 [(set_attr "type" "milli")
5524 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5528 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5529 (clobber (match_operand:SI 1 "register_operand" "=a"))
5530 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5531 (clobber (reg:SI 26))
5532 (clobber (reg:SI 25))
5533 (clobber (reg:SI 2))]
5536 return output_div_insn (operands, 1, insn);"
5537 [(set_attr "type" "milli")
5538 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5540 (define_expand "modsi3"
5541 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5542 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5543 (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5544 (clobber (match_dup 3))
5545 (clobber (match_dup 4))
5546 (clobber (reg:SI 26))
5547 (clobber (reg:SI 25))
5548 (clobber (match_dup 5))])
5549 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5555 operands[5] = gen_rtx_REG (SImode, 2);
5556 operands[4] = operands[5];
5560 operands[5] = gen_rtx_REG (SImode, 31);
5561 operands[4] = gen_reg_rtx (SImode);
5563 operands[3] = gen_reg_rtx (SImode);
5567 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5568 (clobber (match_operand:SI 0 "register_operand" "=a"))
5569 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5570 (clobber (reg:SI 26))
5571 (clobber (reg:SI 25))
5572 (clobber (reg:SI 31))]
5575 return output_mod_insn (0, insn);"
5576 [(set_attr "type" "milli")
5577 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5580 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5581 (clobber (match_operand:SI 0 "register_operand" "=a"))
5582 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5583 (clobber (reg:SI 26))
5584 (clobber (reg:SI 25))
5585 (clobber (reg:SI 2))]
5588 return output_mod_insn (0, insn);"
5589 [(set_attr "type" "milli")
5590 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5592 (define_expand "umodsi3"
5593 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5594 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5595 (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5596 (clobber (match_dup 3))
5597 (clobber (match_dup 4))
5598 (clobber (reg:SI 26))
5599 (clobber (reg:SI 25))
5600 (clobber (match_dup 5))])
5601 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5607 operands[5] = gen_rtx_REG (SImode, 2);
5608 operands[4] = operands[5];
5612 operands[5] = gen_rtx_REG (SImode, 31);
5613 operands[4] = gen_reg_rtx (SImode);
5615 operands[3] = gen_reg_rtx (SImode);
5619 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5620 (clobber (match_operand:SI 0 "register_operand" "=a"))
5621 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5622 (clobber (reg:SI 26))
5623 (clobber (reg:SI 25))
5624 (clobber (reg:SI 31))]
5627 return output_mod_insn (1, insn);"
5628 [(set_attr "type" "milli")
5629 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5632 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5633 (clobber (match_operand:SI 0 "register_operand" "=a"))
5634 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5635 (clobber (reg:SI 26))
5636 (clobber (reg:SI 25))
5637 (clobber (reg:SI 2))]
5640 return output_mod_insn (1, insn);"
5641 [(set_attr "type" "milli")
5642 (set (attr "length") (symbol_ref "attr_length_millicode_call (insn)"))])
5644 ;;- and instructions
5645 ;; We define DImode `and` so with DImode `not` we can get
5646 ;; DImode `andn`. Other combinations are possible.
5648 (define_expand "anddi3"
5649 [(set (match_operand:DI 0 "register_operand" "")
5650 (and:DI (match_operand:DI 1 "register_operand" "")
5651 (match_operand:DI 2 "and_operand" "")))]
5655 /* Both operands must be register operands. */
5656 if (!TARGET_64BIT && !register_operand (operands[2], DImode))
5661 [(set (match_operand:DI 0 "register_operand" "=r")
5662 (and:DI (match_operand:DI 1 "register_operand" "%r")
5663 (match_operand:DI 2 "register_operand" "r")))]
5665 "and %1,%2,%0\;and %R1,%R2,%R0"
5666 [(set_attr "type" "binary")
5667 (set_attr "length" "8")])
5670 [(set (match_operand:DI 0 "register_operand" "=r,r")
5671 (and:DI (match_operand:DI 1 "register_operand" "%?r,0")
5672 (match_operand:DI 2 "and_operand" "rO,P")))]
5674 "* return output_64bit_and (operands); "
5675 [(set_attr "type" "binary")
5676 (set_attr "length" "4")])
5678 ; The ? for op1 makes reload prefer zdepi instead of loading a huge
5679 ; constant with ldil;ldo.
5680 (define_insn "andsi3"
5681 [(set (match_operand:SI 0 "register_operand" "=r,r")
5682 (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
5683 (match_operand:SI 2 "and_operand" "rO,P")))]
5685 "* return output_and (operands); "
5686 [(set_attr "type" "binary,shift")
5687 (set_attr "length" "4,4")])
5690 [(set (match_operand:DI 0 "register_operand" "=r")
5691 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5692 (match_operand:DI 2 "register_operand" "r")))]
5694 "andcm %2,%1,%0\;andcm %R2,%R1,%R0"
5695 [(set_attr "type" "binary")
5696 (set_attr "length" "8")])
5699 [(set (match_operand:DI 0 "register_operand" "=r")
5700 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5701 (match_operand:DI 2 "register_operand" "r")))]
5704 [(set_attr "type" "binary")
5705 (set_attr "length" "4")])
5708 [(set (match_operand:SI 0 "register_operand" "=r")
5709 (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5710 (match_operand:SI 2 "register_operand" "r")))]
5713 [(set_attr "type" "binary")
5714 (set_attr "length" "4")])
5716 (define_expand "iordi3"
5717 [(set (match_operand:DI 0 "register_operand" "")
5718 (ior:DI (match_operand:DI 1 "register_operand" "")
5719 (match_operand:DI 2 "ior_operand" "")))]
5723 /* Both operands must be register operands. */
5724 if (!TARGET_64BIT && !register_operand (operands[2], DImode))
5729 [(set (match_operand:DI 0 "register_operand" "=r")
5730 (ior:DI (match_operand:DI 1 "register_operand" "%r")
5731 (match_operand:DI 2 "register_operand" "r")))]
5733 "or %1,%2,%0\;or %R1,%R2,%R0"
5734 [(set_attr "type" "binary")
5735 (set_attr "length" "8")])
5738 [(set (match_operand:DI 0 "register_operand" "=r,r")
5739 (ior:DI (match_operand:DI 1 "register_operand" "0,0")
5740 (match_operand:DI 2 "ior_operand" "M,i")))]
5742 "* return output_64bit_ior (operands); "
5743 [(set_attr "type" "binary,shift")
5744 (set_attr "length" "4,4")])
5747 [(set (match_operand:DI 0 "register_operand" "=r")
5748 (ior:DI (match_operand:DI 1 "register_operand" "%r")
5749 (match_operand:DI 2 "register_operand" "r")))]
5752 [(set_attr "type" "binary")
5753 (set_attr "length" "4")])
5755 ;; Need a define_expand because we've run out of CONST_OK... characters.
5756 (define_expand "iorsi3"
5757 [(set (match_operand:SI 0 "register_operand" "")
5758 (ior:SI (match_operand:SI 1 "register_operand" "")
5759 (match_operand:SI 2 "arith32_operand" "")))]
5763 if (! (ior_operand (operands[2], SImode)
5764 || register_operand (operands[2], SImode)))
5765 operands[2] = force_reg (SImode, operands[2]);
5769 [(set (match_operand:SI 0 "register_operand" "=r,r")
5770 (ior:SI (match_operand:SI 1 "register_operand" "0,0")
5771 (match_operand:SI 2 "ior_operand" "M,i")))]
5773 "* return output_ior (operands); "
5774 [(set_attr "type" "binary,shift")
5775 (set_attr "length" "4,4")])
5778 [(set (match_operand:SI 0 "register_operand" "=r")
5779 (ior:SI (match_operand:SI 1 "register_operand" "%r")
5780 (match_operand:SI 2 "register_operand" "r")))]
5783 [(set_attr "type" "binary")
5784 (set_attr "length" "4")])
5786 (define_expand "xordi3"
5787 [(set (match_operand:DI 0 "register_operand" "")
5788 (xor:DI (match_operand:DI 1 "register_operand" "")
5789 (match_operand:DI 2 "register_operand" "")))]
5796 [(set (match_operand:DI 0 "register_operand" "=r")
5797 (xor:DI (match_operand:DI 1 "register_operand" "%r")
5798 (match_operand:DI 2 "register_operand" "r")))]
5800 "xor %1,%2,%0\;xor %R1,%R2,%R0"
5801 [(set_attr "type" "binary")
5802 (set_attr "length" "8")])
5805 [(set (match_operand:DI 0 "register_operand" "=r")
5806 (xor:DI (match_operand:DI 1 "register_operand" "%r")
5807 (match_operand:DI 2 "register_operand" "r")))]
5810 [(set_attr "type" "binary")
5811 (set_attr "length" "4")])
5813 (define_insn "xorsi3"
5814 [(set (match_operand:SI 0 "register_operand" "=r")
5815 (xor:SI (match_operand:SI 1 "register_operand" "%r")
5816 (match_operand:SI 2 "register_operand" "r")))]
5819 [(set_attr "type" "binary")
5820 (set_attr "length" "4")])
5822 (define_expand "negdi2"
5823 [(set (match_operand:DI 0 "register_operand" "")
5824 (neg:DI (match_operand:DI 1 "register_operand" "")))]
5829 [(set (match_operand:DI 0 "register_operand" "=r")
5830 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5832 "sub %%r0,%R1,%R0\;{subb|sub,b} %%r0,%1,%0"
5833 [(set_attr "type" "unary")
5834 (set_attr "length" "8")])
5837 [(set (match_operand:DI 0 "register_operand" "=r")
5838 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5841 [(set_attr "type" "unary")
5842 (set_attr "length" "4")])
5844 (define_insn "negsi2"
5845 [(set (match_operand:SI 0 "register_operand" "=r")
5846 (neg:SI (match_operand:SI 1 "register_operand" "r")))]
5849 [(set_attr "type" "unary")
5850 (set_attr "length" "4")])
5852 (define_expand "one_cmpldi2"
5853 [(set (match_operand:DI 0 "register_operand" "")
5854 (not:DI (match_operand:DI 1 "register_operand" "")))]
5861 [(set (match_operand:DI 0 "register_operand" "=r")
5862 (not:DI (match_operand:DI 1 "register_operand" "r")))]
5864 "uaddcm %%r0,%1,%0\;uaddcm %%r0,%R1,%R0"
5865 [(set_attr "type" "unary")
5866 (set_attr "length" "8")])
5869 [(set (match_operand:DI 0 "register_operand" "=r")
5870 (not:DI (match_operand:DI 1 "register_operand" "r")))]
5873 [(set_attr "type" "unary")
5874 (set_attr "length" "4")])
5876 (define_insn "one_cmplsi2"
5877 [(set (match_operand:SI 0 "register_operand" "=r")
5878 (not:SI (match_operand:SI 1 "register_operand" "r")))]
5881 [(set_attr "type" "unary")
5882 (set_attr "length" "4")])
5884 ;; Floating point arithmetic instructions.
5886 (define_insn "adddf3"
5887 [(set (match_operand:DF 0 "register_operand" "=f")
5888 (plus:DF (match_operand:DF 1 "register_operand" "f")
5889 (match_operand:DF 2 "register_operand" "f")))]
5890 "! TARGET_SOFT_FLOAT"
5892 [(set_attr "type" "fpalu")
5893 (set_attr "pa_combine_type" "faddsub")
5894 (set_attr "length" "4")])
5896 (define_insn "addsf3"
5897 [(set (match_operand:SF 0 "register_operand" "=f")
5898 (plus:SF (match_operand:SF 1 "register_operand" "f")
5899 (match_operand:SF 2 "register_operand" "f")))]
5900 "! TARGET_SOFT_FLOAT"
5902 [(set_attr "type" "fpalu")
5903 (set_attr "pa_combine_type" "faddsub")
5904 (set_attr "length" "4")])
5906 (define_insn "subdf3"
5907 [(set (match_operand:DF 0 "register_operand" "=f")
5908 (minus:DF (match_operand:DF 1 "register_operand" "f")
5909 (match_operand:DF 2 "register_operand" "f")))]
5910 "! TARGET_SOFT_FLOAT"
5912 [(set_attr "type" "fpalu")
5913 (set_attr "pa_combine_type" "faddsub")
5914 (set_attr "length" "4")])
5916 (define_insn "subsf3"
5917 [(set (match_operand:SF 0 "register_operand" "=f")
5918 (minus:SF (match_operand:SF 1 "register_operand" "f")
5919 (match_operand:SF 2 "register_operand" "f")))]
5920 "! TARGET_SOFT_FLOAT"
5922 [(set_attr "type" "fpalu")
5923 (set_attr "pa_combine_type" "faddsub")
5924 (set_attr "length" "4")])
5926 (define_insn "muldf3"
5927 [(set (match_operand:DF 0 "register_operand" "=f")
5928 (mult:DF (match_operand:DF 1 "register_operand" "f")
5929 (match_operand:DF 2 "register_operand" "f")))]
5930 "! TARGET_SOFT_FLOAT"
5932 [(set_attr "type" "fpmuldbl")
5933 (set_attr "pa_combine_type" "fmpy")
5934 (set_attr "length" "4")])
5936 (define_insn "mulsf3"
5937 [(set (match_operand:SF 0 "register_operand" "=f")
5938 (mult:SF (match_operand:SF 1 "register_operand" "f")
5939 (match_operand:SF 2 "register_operand" "f")))]
5940 "! TARGET_SOFT_FLOAT"
5942 [(set_attr "type" "fpmulsgl")
5943 (set_attr "pa_combine_type" "fmpy")
5944 (set_attr "length" "4")])
5946 (define_insn "divdf3"
5947 [(set (match_operand:DF 0 "register_operand" "=f")
5948 (div:DF (match_operand:DF 1 "register_operand" "f")
5949 (match_operand:DF 2 "register_operand" "f")))]
5950 "! TARGET_SOFT_FLOAT"
5952 [(set_attr "type" "fpdivdbl")
5953 (set_attr "length" "4")])
5955 (define_insn "divsf3"
5956 [(set (match_operand:SF 0 "register_operand" "=f")
5957 (div:SF (match_operand:SF 1 "register_operand" "f")
5958 (match_operand:SF 2 "register_operand" "f")))]
5959 "! TARGET_SOFT_FLOAT"
5961 [(set_attr "type" "fpdivsgl")
5962 (set_attr "length" "4")])
5964 ;; Processors prior to PA 2.0 don't have a fneg instruction. Fast
5965 ;; negation can be done by subtracting from plus zero. However, this
5966 ;; violates the IEEE standard when negating plus and minus zero.
5967 (define_expand "negdf2"
5968 [(parallel [(set (match_operand:DF 0 "register_operand" "")
5969 (neg:DF (match_operand:DF 1 "register_operand" "")))
5970 (use (match_dup 2))])]
5971 "! TARGET_SOFT_FLOAT"
5973 if (TARGET_PA_20 || flag_unsafe_math_optimizations)
5974 emit_insn (gen_negdf2_fast (operands[0], operands[1]));
5977 operands[2] = force_reg (DFmode,
5978 CONST_DOUBLE_FROM_REAL_VALUE (dconstm1, DFmode));
5979 emit_insn (gen_muldf3 (operands[0], operands[1], operands[2]));
5984 (define_insn "negdf2_fast"
5985 [(set (match_operand:DF 0 "register_operand" "=f")
5986 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
5987 "! TARGET_SOFT_FLOAT && (TARGET_PA_20 || flag_unsafe_math_optimizations)"
5991 return \"fneg,dbl %1,%0\";
5993 return \"fsub,dbl %%fr0,%1,%0\";
5995 [(set_attr "type" "fpalu")
5996 (set_attr "length" "4")])
5998 (define_expand "negsf2"
5999 [(parallel [(set (match_operand:SF 0 "register_operand" "")
6000 (neg:SF (match_operand:SF 1 "register_operand" "")))
6001 (use (match_dup 2))])]
6002 "! TARGET_SOFT_FLOAT"
6004 if (TARGET_PA_20 || flag_unsafe_math_optimizations)
6005 emit_insn (gen_negsf2_fast (operands[0], operands[1]));
6008 operands[2] = force_reg (SFmode,
6009 CONST_DOUBLE_FROM_REAL_VALUE (dconstm1, SFmode));
6010 emit_insn (gen_mulsf3 (operands[0], operands[1], operands[2]));
6015 (define_insn "negsf2_fast"
6016 [(set (match_operand:SF 0 "register_operand" "=f")
6017 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
6018 "! TARGET_SOFT_FLOAT && (TARGET_PA_20 || flag_unsafe_math_optimizations)"
6022 return \"fneg,sgl %1,%0\";
6024 return \"fsub,sgl %%fr0,%1,%0\";
6026 [(set_attr "type" "fpalu")
6027 (set_attr "length" "4")])
6029 (define_insn "absdf2"
6030 [(set (match_operand:DF 0 "register_operand" "=f")
6031 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
6032 "! TARGET_SOFT_FLOAT"
6034 [(set_attr "type" "fpalu")
6035 (set_attr "length" "4")])
6037 (define_insn "abssf2"
6038 [(set (match_operand:SF 0 "register_operand" "=f")
6039 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
6040 "! TARGET_SOFT_FLOAT"
6042 [(set_attr "type" "fpalu")
6043 (set_attr "length" "4")])
6045 (define_insn "sqrtdf2"
6046 [(set (match_operand:DF 0 "register_operand" "=f")
6047 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
6048 "! TARGET_SOFT_FLOAT"
6050 [(set_attr "type" "fpsqrtdbl")
6051 (set_attr "length" "4")])
6053 (define_insn "sqrtsf2"
6054 [(set (match_operand:SF 0 "register_operand" "=f")
6055 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
6056 "! TARGET_SOFT_FLOAT"
6058 [(set_attr "type" "fpsqrtsgl")
6059 (set_attr "length" "4")])
6061 ;; PA 2.0 floating point instructions
6065 [(set (match_operand:DF 0 "register_operand" "=f")
6066 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6067 (match_operand:DF 2 "register_operand" "f"))
6068 (match_operand:DF 3 "register_operand" "f")))]
6069 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6070 "fmpyfadd,dbl %1,%2,%3,%0"
6071 [(set_attr "type" "fpmuldbl")
6072 (set_attr "length" "4")])
6075 [(set (match_operand:DF 0 "register_operand" "=f")
6076 (plus:DF (match_operand:DF 1 "register_operand" "f")
6077 (mult:DF (match_operand:DF 2 "register_operand" "f")
6078 (match_operand:DF 3 "register_operand" "f"))))]
6079 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6080 "fmpyfadd,dbl %2,%3,%1,%0"
6081 [(set_attr "type" "fpmuldbl")
6082 (set_attr "length" "4")])
6085 [(set (match_operand:SF 0 "register_operand" "=f")
6086 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6087 (match_operand:SF 2 "register_operand" "f"))
6088 (match_operand:SF 3 "register_operand" "f")))]
6089 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6090 "fmpyfadd,sgl %1,%2,%3,%0"
6091 [(set_attr "type" "fpmulsgl")
6092 (set_attr "length" "4")])
6095 [(set (match_operand:SF 0 "register_operand" "=f")
6096 (plus:SF (match_operand:SF 1 "register_operand" "f")
6097 (mult:SF (match_operand:SF 2 "register_operand" "f")
6098 (match_operand:SF 3 "register_operand" "f"))))]
6099 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6100 "fmpyfadd,sgl %2,%3,%1,%0"
6101 [(set_attr "type" "fpmulsgl")
6102 (set_attr "length" "4")])
6104 ; fmpynfadd patterns
6106 [(set (match_operand:DF 0 "register_operand" "=f")
6107 (minus:DF (match_operand:DF 1 "register_operand" "f")
6108 (mult:DF (match_operand:DF 2 "register_operand" "f")
6109 (match_operand:DF 3 "register_operand" "f"))))]
6110 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6111 "fmpynfadd,dbl %2,%3,%1,%0"
6112 [(set_attr "type" "fpmuldbl")
6113 (set_attr "length" "4")])
6116 [(set (match_operand:SF 0 "register_operand" "=f")
6117 (minus:SF (match_operand:SF 1 "register_operand" "f")
6118 (mult:SF (match_operand:SF 2 "register_operand" "f")
6119 (match_operand:SF 3 "register_operand" "f"))))]
6120 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6121 "fmpynfadd,sgl %2,%3,%1,%0"
6122 [(set_attr "type" "fpmulsgl")
6123 (set_attr "length" "4")])
6127 [(set (match_operand:DF 0 "register_operand" "=f")
6128 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))]
6129 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6131 [(set_attr "type" "fpalu")
6132 (set_attr "length" "4")])
6135 [(set (match_operand:SF 0 "register_operand" "=f")
6136 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))]
6137 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6139 [(set_attr "type" "fpalu")
6140 (set_attr "length" "4")])
6142 ;; Generating a fused multiply sequence is a win for this case as it will
6143 ;; reduce the latency for the fused case without impacting the plain
6146 ;; Similar possibilities exist for fnegabs, shadd and other insns which
6147 ;; perform two operations with the result of the first feeding the second.
6149 [(set (match_operand:DF 0 "register_operand" "=f")
6150 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6151 (match_operand:DF 2 "register_operand" "f"))
6152 (match_operand:DF 3 "register_operand" "f")))
6153 (set (match_operand:DF 4 "register_operand" "=&f")
6154 (mult:DF (match_dup 1) (match_dup 2)))]
6155 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6156 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
6157 || reg_overlap_mentioned_p (operands[4], operands[2])))"
6159 [(set_attr "type" "fpmuldbl")
6160 (set_attr "length" "8")])
6162 ;; We want to split this up during scheduling since we want both insns
6163 ;; to schedule independently.
6165 [(set (match_operand:DF 0 "register_operand" "")
6166 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "")
6167 (match_operand:DF 2 "register_operand" ""))
6168 (match_operand:DF 3 "register_operand" "")))
6169 (set (match_operand:DF 4 "register_operand" "")
6170 (mult:DF (match_dup 1) (match_dup 2)))]
6171 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6172 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
6173 (set (match_dup 0) (plus:DF (mult:DF (match_dup 1) (match_dup 2))
6178 [(set (match_operand:SF 0 "register_operand" "=f")
6179 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6180 (match_operand:SF 2 "register_operand" "f"))
6181 (match_operand:SF 3 "register_operand" "f")))
6182 (set (match_operand:SF 4 "register_operand" "=&f")
6183 (mult:SF (match_dup 1) (match_dup 2)))]
6184 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6185 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
6186 || reg_overlap_mentioned_p (operands[4], operands[2])))"
6188 [(set_attr "type" "fpmuldbl")
6189 (set_attr "length" "8")])
6191 ;; We want to split this up during scheduling since we want both insns
6192 ;; to schedule independently.
6194 [(set (match_operand:SF 0 "register_operand" "")
6195 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "")
6196 (match_operand:SF 2 "register_operand" ""))
6197 (match_operand:SF 3 "register_operand" "")))
6198 (set (match_operand:SF 4 "register_operand" "")
6199 (mult:SF (match_dup 1) (match_dup 2)))]
6200 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6201 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
6202 (set (match_dup 0) (plus:SF (mult:SF (match_dup 1) (match_dup 2))
6206 ;; Negating a multiply can be faked by adding zero in a fused multiply-add
6209 [(set (match_operand:DF 0 "register_operand" "=f")
6210 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6211 (match_operand:DF 2 "register_operand" "f"))))]
6212 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6213 "fmpynfadd,dbl %1,%2,%%fr0,%0"
6214 [(set_attr "type" "fpmuldbl")
6215 (set_attr "length" "4")])
6218 [(set (match_operand:SF 0 "register_operand" "=f")
6219 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6220 (match_operand:SF 2 "register_operand" "f"))))]
6221 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6222 "fmpynfadd,sgl %1,%2,%%fr0,%0"
6223 [(set_attr "type" "fpmuldbl")
6224 (set_attr "length" "4")])
6227 [(set (match_operand:DF 0 "register_operand" "=f")
6228 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6229 (match_operand:DF 2 "register_operand" "f"))))
6230 (set (match_operand:DF 3 "register_operand" "=&f")
6231 (mult:DF (match_dup 1) (match_dup 2)))]
6232 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6233 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6234 || reg_overlap_mentioned_p (operands[3], operands[2])))"
6236 [(set_attr "type" "fpmuldbl")
6237 (set_attr "length" "8")])
6240 [(set (match_operand:DF 0 "register_operand" "")
6241 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
6242 (match_operand:DF 2 "register_operand" ""))))
6243 (set (match_operand:DF 3 "register_operand" "")
6244 (mult:DF (match_dup 1) (match_dup 2)))]
6245 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6246 [(set (match_dup 3) (mult:DF (match_dup 1) (match_dup 2)))
6247 (set (match_dup 0) (neg:DF (mult:DF (match_dup 1) (match_dup 2))))]
6251 [(set (match_operand:SF 0 "register_operand" "=f")
6252 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6253 (match_operand:SF 2 "register_operand" "f"))))
6254 (set (match_operand:SF 3 "register_operand" "=&f")
6255 (mult:SF (match_dup 1) (match_dup 2)))]
6256 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6257 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6258 || reg_overlap_mentioned_p (operands[3], operands[2])))"
6260 [(set_attr "type" "fpmuldbl")
6261 (set_attr "length" "8")])
6264 [(set (match_operand:SF 0 "register_operand" "")
6265 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
6266 (match_operand:SF 2 "register_operand" ""))))
6267 (set (match_operand:SF 3 "register_operand" "")
6268 (mult:SF (match_dup 1) (match_dup 2)))]
6269 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6270 [(set (match_dup 3) (mult:SF (match_dup 1) (match_dup 2)))
6271 (set (match_dup 0) (neg:SF (mult:SF (match_dup 1) (match_dup 2))))]
6274 ;; Now fused multiplies with the result of the multiply negated.
6276 [(set (match_operand:DF 0 "register_operand" "=f")
6277 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6278 (match_operand:DF 2 "register_operand" "f")))
6279 (match_operand:DF 3 "register_operand" "f")))]
6280 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6281 "fmpynfadd,dbl %1,%2,%3,%0"
6282 [(set_attr "type" "fpmuldbl")
6283 (set_attr "length" "4")])
6286 [(set (match_operand:SF 0 "register_operand" "=f")
6287 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6288 (match_operand:SF 2 "register_operand" "f")))
6289 (match_operand:SF 3 "register_operand" "f")))]
6290 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6291 "fmpynfadd,sgl %1,%2,%3,%0"
6292 [(set_attr "type" "fpmuldbl")
6293 (set_attr "length" "4")])
6296 [(set (match_operand:DF 0 "register_operand" "=f")
6297 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6298 (match_operand:DF 2 "register_operand" "f")))
6299 (match_operand:DF 3 "register_operand" "f")))
6300 (set (match_operand:DF 4 "register_operand" "=&f")
6301 (mult:DF (match_dup 1) (match_dup 2)))]
6302 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6303 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
6304 || reg_overlap_mentioned_p (operands[4], operands[2])))"
6306 [(set_attr "type" "fpmuldbl")
6307 (set_attr "length" "8")])
6310 [(set (match_operand:DF 0 "register_operand" "")
6311 (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
6312 (match_operand:DF 2 "register_operand" "")))
6313 (match_operand:DF 3 "register_operand" "")))
6314 (set (match_operand:DF 4 "register_operand" "")
6315 (mult:DF (match_dup 1) (match_dup 2)))]
6316 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6317 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
6318 (set (match_dup 0) (plus:DF (neg:DF (mult:DF (match_dup 1) (match_dup 2)))
6323 [(set (match_operand:SF 0 "register_operand" "=f")
6324 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6325 (match_operand:SF 2 "register_operand" "f")))
6326 (match_operand:SF 3 "register_operand" "f")))
6327 (set (match_operand:SF 4 "register_operand" "=&f")
6328 (mult:SF (match_dup 1) (match_dup 2)))]
6329 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6330 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
6331 || reg_overlap_mentioned_p (operands[4], operands[2])))"
6333 [(set_attr "type" "fpmuldbl")
6334 (set_attr "length" "8")])
6337 [(set (match_operand:SF 0 "register_operand" "")
6338 (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
6339 (match_operand:SF 2 "register_operand" "")))
6340 (match_operand:SF 3 "register_operand" "")))
6341 (set (match_operand:SF 4 "register_operand" "")
6342 (mult:SF (match_dup 1) (match_dup 2)))]
6343 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6344 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
6345 (set (match_dup 0) (plus:SF (neg:SF (mult:SF (match_dup 1) (match_dup 2)))
6350 [(set (match_operand:DF 0 "register_operand" "=f")
6351 (minus:DF (match_operand:DF 3 "register_operand" "f")
6352 (mult:DF (match_operand:DF 1 "register_operand" "f")
6353 (match_operand:DF 2 "register_operand" "f"))))
6354 (set (match_operand:DF 4 "register_operand" "=&f")
6355 (mult:DF (match_dup 1) (match_dup 2)))]
6356 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6357 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
6358 || reg_overlap_mentioned_p (operands[4], operands[2])))"
6360 [(set_attr "type" "fpmuldbl")
6361 (set_attr "length" "8")])
6364 [(set (match_operand:DF 0 "register_operand" "")
6365 (minus:DF (match_operand:DF 3 "register_operand" "")
6366 (mult:DF (match_operand:DF 1 "register_operand" "")
6367 (match_operand:DF 2 "register_operand" ""))))
6368 (set (match_operand:DF 4 "register_operand" "")
6369 (mult:DF (match_dup 1) (match_dup 2)))]
6370 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6371 [(set (match_dup 4) (mult:DF (match_dup 1) (match_dup 2)))
6372 (set (match_dup 0) (minus:DF (match_dup 3)
6373 (mult:DF (match_dup 1) (match_dup 2))))]
6377 [(set (match_operand:SF 0 "register_operand" "=f")
6378 (minus:SF (match_operand:SF 3 "register_operand" "f")
6379 (mult:SF (match_operand:SF 1 "register_operand" "f")
6380 (match_operand:SF 2 "register_operand" "f"))))
6381 (set (match_operand:SF 4 "register_operand" "=&f")
6382 (mult:SF (match_dup 1) (match_dup 2)))]
6383 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6384 && ! (reg_overlap_mentioned_p (operands[4], operands[1])
6385 || reg_overlap_mentioned_p (operands[4], operands[2])))"
6387 [(set_attr "type" "fpmuldbl")
6388 (set_attr "length" "8")])
6391 [(set (match_operand:SF 0 "register_operand" "")
6392 (minus:SF (match_operand:SF 3 "register_operand" "")
6393 (mult:SF (match_operand:SF 1 "register_operand" "")
6394 (match_operand:SF 2 "register_operand" ""))))
6395 (set (match_operand:SF 4 "register_operand" "")
6396 (mult:SF (match_dup 1) (match_dup 2)))]
6397 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6398 [(set (match_dup 4) (mult:SF (match_dup 1) (match_dup 2)))
6399 (set (match_dup 0) (minus:SF (match_dup 3)
6400 (mult:SF (match_dup 1) (match_dup 2))))]
6404 [(set (match_operand:DF 0 "register_operand" "=f")
6405 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6406 (set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
6407 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6408 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6410 [(set_attr "type" "fpalu")
6411 (set_attr "length" "8")])
6414 [(set (match_operand:DF 0 "register_operand" "")
6415 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" ""))))
6416 (set (match_operand:DF 2 "register_operand" "") (abs:DF (match_dup 1)))]
6417 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6418 [(set (match_dup 2) (abs:DF (match_dup 1)))
6419 (set (match_dup 0) (neg:DF (abs:DF (match_dup 1))))]
6423 [(set (match_operand:SF 0 "register_operand" "=f")
6424 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6425 (set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
6426 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6427 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6429 [(set_attr "type" "fpalu")
6430 (set_attr "length" "8")])
6433 [(set (match_operand:SF 0 "register_operand" "")
6434 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" ""))))
6435 (set (match_operand:SF 2 "register_operand" "") (abs:SF (match_dup 1)))]
6436 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6437 [(set (match_dup 2) (abs:SF (match_dup 1)))
6438 (set (match_dup 0) (neg:SF (abs:SF (match_dup 1))))]
6441 ;;- Shift instructions
6443 ;; Optimized special case of shifting.
6446 [(set (match_operand:SI 0 "register_operand" "=r")
6447 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6451 [(set_attr "type" "load")
6452 (set_attr "length" "4")])
6455 [(set (match_operand:SI 0 "register_operand" "=r")
6456 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6460 [(set_attr "type" "load")
6461 (set_attr "length" "4")])
6464 [(set (match_operand:SI 0 "register_operand" "=r")
6465 (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
6466 (match_operand:SI 3 "shadd_operand" ""))
6467 (match_operand:SI 1 "register_operand" "r")))]
6469 "{sh%O3addl %2,%1,%0|shladd,l %2,%O3,%1,%0} "
6470 [(set_attr "type" "binary")
6471 (set_attr "length" "4")])
6474 [(set (match_operand:DI 0 "register_operand" "=r")
6475 (plus:DI (mult:DI (match_operand:DI 2 "register_operand" "r")
6476 (match_operand:DI 3 "shadd_operand" ""))
6477 (match_operand:DI 1 "register_operand" "r")))]
6479 "shladd,l %2,%O3,%1,%0"
6480 [(set_attr "type" "binary")
6481 (set_attr "length" "4")])
6483 (define_expand "ashlsi3"
6484 [(set (match_operand:SI 0 "register_operand" "")
6485 (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
6486 (match_operand:SI 2 "arith32_operand" "")))]
6490 if (GET_CODE (operands[2]) != CONST_INT)
6492 rtx temp = gen_reg_rtx (SImode);
6493 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6494 if (GET_CODE (operands[1]) == CONST_INT)
6495 emit_insn (gen_zvdep_imm32 (operands[0], operands[1], temp));
6497 emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
6500 /* Make sure both inputs are not constants,
6501 there are no patterns for that. */
6502 operands[1] = force_reg (SImode, operands[1]);
6506 [(set (match_operand:SI 0 "register_operand" "=r")
6507 (ashift:SI (match_operand:SI 1 "register_operand" "r")
6508 (match_operand:SI 2 "const_int_operand" "n")))]
6510 "{zdep|depw,z} %1,%P2,%L2,%0"
6511 [(set_attr "type" "shift")
6512 (set_attr "length" "4")])
6514 ; Match cases of op1 a CONST_INT here that zvdep_imm32 doesn't handle.
6515 ; Doing it like this makes slightly better code since reload can
6516 ; replace a register with a known value in range -16..15 with a
6517 ; constant. Ideally, we would like to merge zvdep32 and zvdep_imm32,
6518 ; but since we have no more CONST_OK... characters, that is not
6520 (define_insn "zvdep32"
6521 [(set (match_operand:SI 0 "register_operand" "=r,r")
6522 (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
6523 (minus:SI (const_int 31)
6524 (match_operand:SI 2 "register_operand" "q,q"))))]
6527 {zvdep %1,32,%0|depw,z %1,%%sar,32,%0}
6528 {zvdepi %1,32,%0|depwi,z %1,%%sar,32,%0}"
6529 [(set_attr "type" "shift,shift")
6530 (set_attr "length" "4,4")])
6532 (define_insn "zvdep_imm32"
6533 [(set (match_operand:SI 0 "register_operand" "=r")
6534 (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
6535 (minus:SI (const_int 31)
6536 (match_operand:SI 2 "register_operand" "q"))))]
6540 int x = INTVAL (operands[1]);
6541 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6542 operands[1] = GEN_INT ((x & 0xf) - 0x10);
6543 return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\";
6545 [(set_attr "type" "shift")
6546 (set_attr "length" "4")])
6548 (define_insn "vdepi_ior"
6549 [(set (match_operand:SI 0 "register_operand" "=r")
6550 (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
6551 (minus:SI (const_int 31)
6552 (match_operand:SI 2 "register_operand" "q")))
6553 (match_operand:SI 3 "register_operand" "0")))]
6554 ; accept ...0001...1, can this be generalized?
6555 "exact_log2 (INTVAL (operands[1]) + 1) > 0"
6558 int x = INTVAL (operands[1]);
6559 operands[2] = GEN_INT (exact_log2 (x + 1));
6560 return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\";
6562 [(set_attr "type" "shift")
6563 (set_attr "length" "4")])
6565 (define_insn "vdepi_and"
6566 [(set (match_operand:SI 0 "register_operand" "=r")
6567 (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
6568 (minus:SI (const_int 31)
6569 (match_operand:SI 2 "register_operand" "q")))
6570 (match_operand:SI 3 "register_operand" "0")))]
6571 ; this can be generalized...!
6572 "INTVAL (operands[1]) == -2"
6575 int x = INTVAL (operands[1]);
6576 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6577 return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\";
6579 [(set_attr "type" "shift")
6580 (set_attr "length" "4")])
6582 (define_expand "ashldi3"
6583 [(set (match_operand:DI 0 "register_operand" "")
6584 (ashift:DI (match_operand:DI 1 "lhs_lshift_operand" "")
6585 (match_operand:DI 2 "arith32_operand" "")))]
6589 if (GET_CODE (operands[2]) != CONST_INT)
6591 rtx temp = gen_reg_rtx (DImode);
6592 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6593 if (GET_CODE (operands[1]) == CONST_INT)
6594 emit_insn (gen_zvdep_imm64 (operands[0], operands[1], temp));
6596 emit_insn (gen_zvdep64 (operands[0], operands[1], temp));
6599 /* Make sure both inputs are not constants,
6600 there are no patterns for that. */
6601 operands[1] = force_reg (DImode, operands[1]);
6605 [(set (match_operand:DI 0 "register_operand" "=r")
6606 (ashift:DI (match_operand:DI 1 "register_operand" "r")
6607 (match_operand:DI 2 "const_int_operand" "n")))]
6609 "depd,z %1,%p2,%Q2,%0"
6610 [(set_attr "type" "shift")
6611 (set_attr "length" "4")])
6613 ; Match cases of op1 a CONST_INT here that zvdep_imm64 doesn't handle.
6614 ; Doing it like this makes slightly better code since reload can
6615 ; replace a register with a known value in range -16..15 with a
6616 ; constant. Ideally, we would like to merge zvdep64 and zvdep_imm64,
6617 ; but since we have no more CONST_OK... characters, that is not
6619 (define_insn "zvdep64"
6620 [(set (match_operand:DI 0 "register_operand" "=r,r")
6621 (ashift:DI (match_operand:DI 1 "arith5_operand" "r,L")
6622 (minus:DI (const_int 63)
6623 (match_operand:DI 2 "register_operand" "q,q"))))]
6626 depd,z %1,%%sar,64,%0
6627 depdi,z %1,%%sar,64,%0"
6628 [(set_attr "type" "shift,shift")
6629 (set_attr "length" "4,4")])
6631 (define_insn "zvdep_imm64"
6632 [(set (match_operand:DI 0 "register_operand" "=r")
6633 (ashift:DI (match_operand:DI 1 "lhs_lshift_cint_operand" "")
6634 (minus:DI (const_int 63)
6635 (match_operand:DI 2 "register_operand" "q"))))]
6639 int x = INTVAL (operands[1]);
6640 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6641 operands[1] = GEN_INT ((x & 0x1f) - 0x20);
6642 return \"depdi,z %1,%%sar,%2,%0\";
6644 [(set_attr "type" "shift")
6645 (set_attr "length" "4")])
6648 [(set (match_operand:DI 0 "register_operand" "=r")
6649 (ior:DI (ashift:DI (match_operand:DI 1 "const_int_operand" "")
6650 (minus:DI (const_int 63)
6651 (match_operand:DI 2 "register_operand" "q")))
6652 (match_operand:DI 3 "register_operand" "0")))]
6653 ; accept ...0001...1, can this be generalized?
6654 "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) > 0"
6657 int x = INTVAL (operands[1]);
6658 operands[2] = GEN_INT (exact_log2 (x + 1));
6659 return \"depdi -1,%%sar,%2,%0\";
6661 [(set_attr "type" "shift")
6662 (set_attr "length" "4")])
6665 [(set (match_operand:DI 0 "register_operand" "=r")
6666 (and:DI (rotate:DI (match_operand:DI 1 "const_int_operand" "")
6667 (minus:DI (const_int 63)
6668 (match_operand:DI 2 "register_operand" "q")))
6669 (match_operand:DI 3 "register_operand" "0")))]
6670 ; this can be generalized...!
6671 "TARGET_64BIT && INTVAL (operands[1]) == -2"
6674 int x = INTVAL (operands[1]);
6675 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6676 return \"depdi 0,%%sar,%2,%0\";
6678 [(set_attr "type" "shift")
6679 (set_attr "length" "4")])
6681 (define_expand "ashrsi3"
6682 [(set (match_operand:SI 0 "register_operand" "")
6683 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
6684 (match_operand:SI 2 "arith32_operand" "")))]
6688 if (GET_CODE (operands[2]) != CONST_INT)
6690 rtx temp = gen_reg_rtx (SImode);
6691 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6692 emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
6698 [(set (match_operand:SI 0 "register_operand" "=r")
6699 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6700 (match_operand:SI 2 "const_int_operand" "n")))]
6702 "{extrs|extrw,s} %1,%P2,%L2,%0"
6703 [(set_attr "type" "shift")
6704 (set_attr "length" "4")])
6706 (define_insn "vextrs32"
6707 [(set (match_operand:SI 0 "register_operand" "=r")
6708 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6709 (minus:SI (const_int 31)
6710 (match_operand:SI 2 "register_operand" "q"))))]
6712 "{vextrs %1,32,%0|extrw,s %1,%%sar,32,%0}"
6713 [(set_attr "type" "shift")
6714 (set_attr "length" "4")])
6716 (define_expand "ashrdi3"
6717 [(set (match_operand:DI 0 "register_operand" "")
6718 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6719 (match_operand:DI 2 "arith32_operand" "")))]
6723 if (GET_CODE (operands[2]) != CONST_INT)
6725 rtx temp = gen_reg_rtx (DImode);
6726 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6727 emit_insn (gen_vextrs64 (operands[0], operands[1], temp));
6733 [(set (match_operand:DI 0 "register_operand" "=r")
6734 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6735 (match_operand:DI 2 "const_int_operand" "n")))]
6737 "extrd,s %1,%p2,%Q2,%0"
6738 [(set_attr "type" "shift")
6739 (set_attr "length" "4")])
6741 (define_insn "vextrs64"
6742 [(set (match_operand:DI 0 "register_operand" "=r")
6743 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6744 (minus:DI (const_int 63)
6745 (match_operand:DI 2 "register_operand" "q"))))]
6747 "extrd,s %1,%%sar,64,%0"
6748 [(set_attr "type" "shift")
6749 (set_attr "length" "4")])
6751 (define_insn "lshrsi3"
6752 [(set (match_operand:SI 0 "register_operand" "=r,r")
6753 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
6754 (match_operand:SI 2 "arith32_operand" "q,n")))]
6757 {vshd %%r0,%1,%0|shrpw %%r0,%1,%%sar,%0}
6758 {extru|extrw,u} %1,%P2,%L2,%0"
6759 [(set_attr "type" "shift")
6760 (set_attr "length" "4")])
6762 (define_insn "lshrdi3"
6763 [(set (match_operand:DI 0 "register_operand" "=r,r")
6764 (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r")
6765 (match_operand:DI 2 "arith32_operand" "q,n")))]
6768 shrpd %%r0,%1,%%sar,%0
6769 extrd,u %1,%p2,%Q2,%0"
6770 [(set_attr "type" "shift")
6771 (set_attr "length" "4")])
6773 (define_insn "rotrsi3"
6774 [(set (match_operand:SI 0 "register_operand" "=r,r")
6775 (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
6776 (match_operand:SI 2 "arith32_operand" "q,n")))]
6780 if (GET_CODE (operands[2]) == CONST_INT)
6782 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
6783 return \"{shd|shrpw} %1,%1,%2,%0\";
6786 return \"{vshd %1,%1,%0|shrpw %1,%1,%%sar,%0}\";
6788 [(set_attr "type" "shift")
6789 (set_attr "length" "4")])
6791 (define_expand "rotlsi3"
6792 [(set (match_operand:SI 0 "register_operand" "")
6793 (rotate:SI (match_operand:SI 1 "register_operand" "")
6794 (match_operand:SI 2 "arith32_operand" "")))]
6798 if (GET_CODE (operands[2]) != CONST_INT)
6800 rtx temp = gen_reg_rtx (SImode);
6801 emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
6802 emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
6805 /* Else expand normally. */
6809 [(set (match_operand:SI 0 "register_operand" "=r")
6810 (rotate:SI (match_operand:SI 1 "register_operand" "r")
6811 (match_operand:SI 2 "const_int_operand" "n")))]
6815 operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
6816 return \"{shd|shrpw} %1,%1,%2,%0\";
6818 [(set_attr "type" "shift")
6819 (set_attr "length" "4")])
6822 [(set (match_operand:SI 0 "register_operand" "=r")
6823 (match_operator:SI 5 "plus_xor_ior_operator"
6824 [(ashift:SI (match_operand:SI 1 "register_operand" "r")
6825 (match_operand:SI 3 "const_int_operand" "n"))
6826 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6827 (match_operand:SI 4 "const_int_operand" "n"))]))]
6828 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6829 "{shd|shrpw} %1,%2,%4,%0"
6830 [(set_attr "type" "shift")
6831 (set_attr "length" "4")])
6834 [(set (match_operand:SI 0 "register_operand" "=r")
6835 (match_operator:SI 5 "plus_xor_ior_operator"
6836 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6837 (match_operand:SI 4 "const_int_operand" "n"))
6838 (ashift:SI (match_operand:SI 1 "register_operand" "r")
6839 (match_operand:SI 3 "const_int_operand" "n"))]))]
6840 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6841 "{shd|shrpw} %1,%2,%4,%0"
6842 [(set_attr "type" "shift")
6843 (set_attr "length" "4")])
6846 [(set (match_operand:SI 0 "register_operand" "=r")
6847 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
6848 (match_operand:SI 2 "const_int_operand" ""))
6849 (match_operand:SI 3 "const_int_operand" "")))]
6850 "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) > 0"
6853 int cnt = INTVAL (operands[2]) & 31;
6854 operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
6855 operands[2] = GEN_INT (31 - cnt);
6856 return \"{zdep|depw,z} %1,%2,%3,%0\";
6858 [(set_attr "type" "shift")
6859 (set_attr "length" "4")])
6861 ;; Unconditional and other jump instructions.
6863 ;; This can only be used in a leaf function, so we do
6864 ;; not need to use the PIC register when generating PIC code.
6865 (define_insn "return"
6869 "hppa_can_use_return_insn_p ()"
6873 return \"bve%* (%%r2)\";
6874 return \"bv%* %%r0(%%r2)\";
6876 [(set_attr "type" "branch")
6877 (set_attr "length" "4")])
6879 ;; Emit a different pattern for functions which have non-trivial
6880 ;; epilogues so as not to confuse jump and reorg.
6881 (define_insn "return_internal"
6889 return \"bve%* (%%r2)\";
6890 return \"bv%* %%r0(%%r2)\";
6892 [(set_attr "type" "branch")
6893 (set_attr "length" "4")])
6895 ;; This is used for eh returns which bypass the return stub.
6896 (define_insn "return_external_pic"
6898 (clobber (reg:SI 1))
6900 "!TARGET_NO_SPACE_REGS
6902 && flag_pic && current_function_calls_eh_return"
6903 "ldsid (%%sr0,%%r2),%%r1\;mtsp %%r1,%%sr0\;be%* 0(%%sr0,%%r2)"
6904 [(set_attr "type" "branch")
6905 (set_attr "length" "12")])
6907 (define_expand "prologue"
6910 "hppa_expand_prologue ();DONE;")
6912 (define_expand "sibcall_epilogue"
6917 hppa_expand_epilogue ();
6921 (define_expand "epilogue"
6926 /* Try to use the trivial return first. Else use the full
6928 if (hppa_can_use_return_insn_p ())
6929 emit_jump_insn (gen_return ());
6934 hppa_expand_epilogue ();
6936 /* EH returns bypass the normal return stub. Thus, we must do an
6937 interspace branch to return from functions that call eh_return.
6938 This is only a problem for returns from shared code on ports
6939 using space registers. */
6940 if (!TARGET_NO_SPACE_REGS
6942 && flag_pic && current_function_calls_eh_return)
6943 x = gen_return_external_pic ();
6945 x = gen_return_internal ();
6952 ; Used by hppa_profile_hook to load the starting address of the current
6953 ; function; operand 1 contains the address of the label in operand 3
6954 (define_insn "load_offset_label_address"
6955 [(set (match_operand:SI 0 "register_operand" "=r")
6956 (plus:SI (match_operand:SI 1 "register_operand" "r")
6957 (minus:SI (match_operand:SI 2 "" "")
6958 (label_ref:SI (match_operand 3 "" "")))))]
6961 [(set_attr "type" "multi")
6962 (set_attr "length" "4")])
6964 ; Output a code label and load its address.
6965 (define_insn "lcla1"
6966 [(set (match_operand:SI 0 "register_operand" "=r")
6967 (label_ref:SI (match_operand 1 "" "")))
6972 output_asm_insn (\"bl .+8,%0\;depi 0,31,2,%0\", operands);
6973 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6974 CODE_LABEL_NUMBER (operands[1]));
6977 [(set_attr "type" "multi")
6978 (set_attr "length" "8")])
6980 (define_insn "lcla2"
6981 [(set (match_operand:SI 0 "register_operand" "=r")
6982 (label_ref:SI (match_operand 1 "" "")))
6987 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6988 CODE_LABEL_NUMBER (operands[1]));
6991 [(set_attr "type" "move")
6992 (set_attr "length" "4")])
6994 (define_insn "blockage"
6995 [(unspec_volatile [(const_int 2)] UNSPECV_BLOCKAGE)]
6998 [(set_attr "length" "0")])
7001 [(set (pc) (label_ref (match_operand 0 "" "")))]
7005 /* An unconditional branch which can reach its target. */
7006 if (get_attr_length (insn) != 24
7007 && get_attr_length (insn) != 16)
7010 return output_lbranch (operands[0], insn);
7012 [(set_attr "type" "uncond_branch")
7013 (set_attr "pa_combine_type" "uncond_branch")
7014 (set (attr "length")
7015 (cond [(eq (symbol_ref "jump_in_call_delay (insn)") (const_int 1))
7016 (if_then_else (lt (abs (minus (match_dup 0)
7017 (plus (pc) (const_int 8))))
7021 (ge (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
7023 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7028 ;;; Hope this is only within a function...
7029 (define_insn "indirect_jump"
7030 [(set (pc) (match_operand 0 "register_operand" "r"))]
7031 "GET_MODE (operands[0]) == word_mode"
7033 [(set_attr "type" "branch")
7034 (set_attr "length" "4")])
7036 ;;; An indirect jump can be optimized to a direct jump. GAS for the
7037 ;;; SOM target doesn't allow branching to a label inside a function.
7038 ;;; We also don't correctly compute branch distances for labels
7039 ;;; outside the current function. Thus, we use an indirect jump can't
7040 ;;; be optimized to a direct jump for all targets. We assume that
7041 ;;; the branch target is in the same space (i.e., nested function
7042 ;;; jumping to a label in an outer function in the same translation
7044 (define_expand "nonlocal_goto"
7045 [(use (match_operand 0 "general_operand" ""))
7046 (use (match_operand 1 "general_operand" ""))
7047 (use (match_operand 2 "general_operand" ""))
7048 (use (match_operand 3 "general_operand" ""))]
7051 rtx lab = operands[1];
7052 rtx stack = operands[2];
7053 rtx fp = operands[3];
7055 lab = copy_to_reg (lab);
7057 emit_insn (gen_rtx_CLOBBER (VOIDmode,
7058 gen_rtx_MEM (BLKmode,
7059 gen_rtx_SCRATCH (VOIDmode))));
7060 emit_insn (gen_rtx_CLOBBER (VOIDmode,
7061 gen_rtx_MEM (BLKmode,
7062 hard_frame_pointer_rtx)));
7064 /* Restore the frame pointer. The virtual_stack_vars_rtx is saved
7065 instead of the hard_frame_pointer_rtx in the save area. As a
7066 result, an extra instruction is needed to adjust for the offset
7067 of the virtual stack variables and the frame pointer. */
7068 if (GET_CODE (fp) != REG)
7069 fp = force_reg (Pmode, fp);
7070 emit_move_insn (virtual_stack_vars_rtx, fp);
7072 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
7074 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
7075 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
7077 /* Nonlocal goto jumps are only used between functions in the same
7078 translation unit. Thus, we can avoid the extra overhead of an
7080 emit_jump_insn (gen_indirect_goto (lab));
7085 (define_insn "indirect_goto"
7086 [(unspec [(match_operand 0 "register_operand" "=r")] UNSPEC_GOTO)]
7087 "GET_MODE (operands[0]) == word_mode"
7089 [(set_attr "type" "branch")
7090 (set_attr "length" "4")])
7092 ;;; This jump is used in branch tables where the insn length is fixed.
7093 ;;; The length of this insn is adjusted if the delay slot is not filled.
7094 (define_insn "short_jump"
7095 [(set (pc) (label_ref (match_operand 0 "" "")))
7099 [(set_attr "type" "btable_branch")
7100 (set_attr "length" "4")])
7102 ;; Subroutines of "casesi".
7103 ;; operand 0 is index
7104 ;; operand 1 is the minimum bound
7105 ;; operand 2 is the maximum bound - minimum bound + 1
7106 ;; operand 3 is CODE_LABEL for the table;
7107 ;; operand 4 is the CODE_LABEL to go to if index out of range.
7109 (define_expand "casesi"
7110 [(match_operand:SI 0 "general_operand" "")
7111 (match_operand:SI 1 "const_int_operand" "")
7112 (match_operand:SI 2 "const_int_operand" "")
7113 (match_operand 3 "" "")
7114 (match_operand 4 "" "")]
7118 if (GET_CODE (operands[0]) != REG)
7119 operands[0] = force_reg (SImode, operands[0]);
7121 if (operands[1] != const0_rtx)
7123 rtx index = gen_reg_rtx (SImode);
7125 operands[1] = GEN_INT (-INTVAL (operands[1]));
7126 if (!INT_14_BITS (operands[1]))
7127 operands[1] = force_reg (SImode, operands[1]);
7128 emit_insn (gen_addsi3 (index, operands[0], operands[1]));
7129 operands[0] = index;
7132 /* In 64bit mode we must make sure to wipe the upper bits of the register
7133 just in case the addition overflowed or we had random bits in the
7134 high part of the register. */
7137 rtx index = gen_reg_rtx (DImode);
7139 emit_insn (gen_extendsidi2 (index, operands[0]));
7140 operands[0] = gen_rtx_SUBREG (SImode, index, 4);
7143 if (!INT_5_BITS (operands[2]))
7144 operands[2] = force_reg (SImode, operands[2]);
7146 /* This branch prevents us finding an insn for the delay slot of the
7147 following vectored branch. It might be possible to use the delay
7148 slot if an index value of -1 was used to transfer to the out-of-range
7149 label. In order to do this, we would have to output the -1 vector
7150 element after the delay insn. The casesi output code would have to
7151 check if the casesi insn is in a delay branch sequence and output
7152 the delay insn if one is found. If this was done, then it might
7153 then be worthwhile to split the casesi patterns to improve scheduling.
7154 However, it's not clear that all this extra complexity is worth
7156 emit_insn (gen_cmpsi (operands[0], operands[2]));
7157 emit_jump_insn (gen_bgtu (operands[4]));
7159 if (TARGET_BIG_SWITCH)
7163 rtx tmp1 = gen_reg_rtx (DImode);
7164 rtx tmp2 = gen_reg_rtx (DImode);
7166 emit_jump_insn (gen_casesi64p (operands[0], operands[3],
7171 rtx tmp1 = gen_reg_rtx (SImode);
7175 rtx tmp2 = gen_reg_rtx (SImode);
7177 emit_jump_insn (gen_casesi32p (operands[0], operands[3],
7181 emit_jump_insn (gen_casesi32 (operands[0], operands[3], tmp1));
7185 emit_jump_insn (gen_casesi0 (operands[0], operands[3]));
7189 ;;; The rtl for this pattern doesn't accurately describe what the insn
7190 ;;; actually does, particularly when case-vector elements are exploded
7191 ;;; in pa_reorg. However, the initial SET in these patterns must show
7192 ;;; the connection of the insn to the following jump table.
7193 (define_insn "casesi0"
7194 [(set (pc) (mem:SI (plus:SI
7195 (mult:SI (match_operand:SI 0 "register_operand" "r")
7197 (label_ref (match_operand 1 "" "")))))]
7199 "blr,n %0,%%r0\;nop"
7200 [(set_attr "type" "multi")
7201 (set_attr "length" "8")])
7203 ;;; 32-bit code, absolute branch table.
7204 (define_insn "casesi32"
7205 [(set (pc) (mem:SI (plus:SI
7206 (mult:SI (match_operand:SI 0 "register_operand" "r")
7208 (label_ref (match_operand 1 "" "")))))
7209 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
7210 "!TARGET_64BIT && TARGET_BIG_SWITCH"
7211 "ldil L'%l1,%2\;ldo R'%l1(%2),%2\;{ldwx|ldw},s %0(%2),%2\;bv,n %%r0(%2)"
7212 [(set_attr "type" "multi")
7213 (set_attr "length" "16")])
7215 ;;; 32-bit code, relative branch table.
7216 (define_insn "casesi32p"
7217 [(set (pc) (mem:SI (plus:SI
7218 (mult:SI (match_operand:SI 0 "register_operand" "r")
7220 (label_ref (match_operand 1 "" "")))))
7221 (clobber (match_operand:SI 2 "register_operand" "=&a"))
7222 (clobber (match_operand:SI 3 "register_operand" "=&r"))]
7223 "!TARGET_64BIT && TARGET_BIG_SWITCH"
7224 "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;ldo {16|20}(%2),%2\;\
7225 {ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
7226 [(set_attr "type" "multi")
7227 (set (attr "length")
7228 (if_then_else (ne (symbol_ref "TARGET_PA_20") (const_int 0))
7232 ;;; 64-bit code, 32-bit relative branch table.
7233 (define_insn "casesi64p"
7234 [(set (pc) (mem:DI (plus:DI
7235 (mult:DI (sign_extend:DI
7236 (match_operand:SI 0 "register_operand" "r"))
7238 (label_ref (match_operand 1 "" "")))))
7239 (clobber (match_operand:DI 2 "register_operand" "=&r"))
7240 (clobber (match_operand:DI 3 "register_operand" "=&r"))]
7241 "TARGET_64BIT && TARGET_BIG_SWITCH"
7242 "mfia %2\;ldo 24(%2),%2\;ldw,s %0(%2),%3\;extrd,s %3,63,32,%3\;\
7243 add,l %2,%3,%3\;bv,n %%r0(%3)"
7244 [(set_attr "type" "multi")
7245 (set_attr "length" "24")])
7249 ;;- jump to subroutine
7251 (define_expand "call"
7252 [(parallel [(call (match_operand:SI 0 "" "")
7253 (match_operand 1 "" ""))
7254 (clobber (reg:SI 2))])]
7259 rtx nb = operands[1];
7261 if (TARGET_PORTABLE_RUNTIME)
7262 op = force_reg (SImode, XEXP (operands[0], 0));
7264 op = XEXP (operands[0], 0);
7268 if (!virtuals_instantiated)
7269 emit_move_insn (arg_pointer_rtx,
7270 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7274 /* The loop pass can generate new libcalls after the virtual
7275 registers are instantiated when fpregs are disabled because
7276 the only method that we have for doing DImode multiplication
7277 is with a libcall. This could be trouble if we haven't
7278 allocated enough space for the outgoing arguments. */
7279 gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size);
7281 emit_move_insn (arg_pointer_rtx,
7282 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7283 GEN_INT (STACK_POINTER_OFFSET + 64)));
7287 /* Use two different patterns for calls to explicitly named functions
7288 and calls through function pointers. This is necessary as these two
7289 types of calls use different calling conventions, and CSE might try
7290 to change the named call into an indirect call in some cases (using
7291 two patterns keeps CSE from performing this optimization).
7293 We now use even more call patterns as there was a subtle bug in
7294 attempting to restore the pic register after a call using a simple
7295 move insn. During reload, a instruction involving a pseudo register
7296 with no explicit dependence on the PIC register can be converted
7297 to an equivalent load from memory using the PIC register. If we
7298 emit a simple move to restore the PIC register in the initial rtl
7299 generation, then it can potentially be repositioned during scheduling.
7300 and an instruction that eventually uses the PIC register may end up
7301 between the call and the PIC register restore.
7303 This only worked because there is a post call group of instructions
7304 that are scheduled with the call. These instructions are included
7305 in the same basic block as the call. However, calls can throw in
7306 C++ code and a basic block has to terminate at the call if the call
7307 can throw. This results in the PIC register restore being scheduled
7308 independently from the call. So, we now hide the save and restore
7309 of the PIC register in the call pattern until after reload. Then,
7310 we split the moves out. A small side benefit is that we now don't
7311 need to have a use of the PIC register in the return pattern and
7312 the final save/restore operation is not needed.
7314 I elected to just clobber %r4 in the PIC patterns and use it instead
7315 of trying to force hppa_pic_save_rtx () to a callee saved register.
7316 This might have required a new register class and constraint. It
7317 was also simpler to just handle the restore from a register than a
7321 if (GET_CODE (op) == SYMBOL_REF)
7322 call_insn = emit_call_insn (gen_call_symref_64bit (op, nb));
7325 op = force_reg (word_mode, op);
7326 call_insn = emit_call_insn (gen_call_reg_64bit (op, nb));
7331 if (GET_CODE (op) == SYMBOL_REF)
7334 call_insn = emit_call_insn (gen_call_symref_pic (op, nb));
7336 call_insn = emit_call_insn (gen_call_symref (op, nb));
7340 rtx tmpreg = gen_rtx_REG (word_mode, 22);
7342 emit_move_insn (tmpreg, force_reg (word_mode, op));
7344 call_insn = emit_call_insn (gen_call_reg_pic (nb));
7346 call_insn = emit_call_insn (gen_call_reg (nb));
7353 ;; We use function calls to set the attribute length of calls and millicode
7354 ;; calls. This is necessary because of the large variety of call sequences.
7355 ;; Implementing the calculation in rtl is difficult as well as ugly. As
7356 ;; we need the same calculation in several places, maintenance becomes a
7359 ;; However, this has a subtle impact on branch shortening. When the
7360 ;; expression used to set the length attribute of an instruction depends
7361 ;; on a relative address (e.g., pc or a branch address), genattrtab
7362 ;; notes that the insn's length is variable, and attempts to determine a
7363 ;; worst-case default length and code to compute an insn's current length.
7365 ;; The use of a function call hides the variable dependence of our calls
7366 ;; and millicode calls. The result is genattrtab doesn't treat the operation
7367 ;; as variable and it only generates code for the default case using our
7368 ;; function call. Because of this, calls and millicode calls have a fixed
7369 ;; length in the branch shortening pass, and some branches will use a longer
7370 ;; code sequence than necessary. However, the length of any given call
7371 ;; will still reflect its final code location and it may be shorter than
7372 ;; the initial length estimate.
7374 ;; It's possible to trick genattrtab by adding an expression involving `pc'
7375 ;; in the set. However, when genattrtab hits a function call in its attempt
7376 ;; to compute the default length, it marks the result as unknown and sets
7377 ;; the default result to MAX_INT ;-( One possible fix that would allow
7378 ;; calls to participate in branch shortening would be to make the call to
7379 ;; insn_default_length a target option. Then, we could massage unknown
7380 ;; results. Another fix might be to change genattrtab so that it just does
7381 ;; the call in the variable case as it already does for the fixed case.
7383 (define_insn "call_symref"
7384 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7385 (match_operand 1 "" "i"))
7386 (clobber (reg:SI 1))
7387 (clobber (reg:SI 2))
7388 (use (const_int 0))]
7389 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7392 output_arg_descriptor (insn);
7393 return output_call (insn, operands[0], 0);
7395 [(set_attr "type" "call")
7396 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
7398 (define_insn "call_symref_pic"
7399 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7400 (match_operand 1 "" "i"))
7401 (clobber (reg:SI 1))
7402 (clobber (reg:SI 2))
7403 (clobber (reg:SI 4))
7405 (use (const_int 0))]
7406 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7409 output_arg_descriptor (insn);
7410 return output_call (insn, operands[0], 0);
7412 [(set_attr "type" "call")
7413 (set (attr "length")
7414 (plus (symbol_ref "attr_length_call (insn, 0)")
7415 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
7417 ;; Split out the PIC register save and restore after reload. This is
7418 ;; done only if the function returns. As the split is done after reload,
7419 ;; there are some situations in which we unnecessarily save and restore
7420 ;; %r4. This happens when there is a single call and the PIC register
7421 ;; is "dead" after the call. This isn't easy to fix as the usage of
7422 ;; the PIC register isn't completely determined until the reload pass.
7424 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7425 (match_operand 1 "" ""))
7426 (clobber (reg:SI 1))
7427 (clobber (reg:SI 2))
7428 (clobber (reg:SI 4))
7430 (use (const_int 0))])]
7431 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT
7433 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7434 [(set (reg:SI 4) (reg:SI 19))
7435 (parallel [(call (mem:SI (match_dup 0))
7437 (clobber (reg:SI 1))
7438 (clobber (reg:SI 2))
7440 (use (const_int 0))])
7441 (set (reg:SI 19) (reg:SI 4))]
7444 ;; Remove the clobber of register 4 when optimizing. This has to be
7445 ;; done with a peephole optimization rather than a split because the
7446 ;; split sequence for a call must be longer than one instruction.
7448 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7449 (match_operand 1 "" ""))
7450 (clobber (reg:SI 1))
7451 (clobber (reg:SI 2))
7452 (clobber (reg:SI 4))
7454 (use (const_int 0))])]
7455 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7456 [(parallel [(call (mem:SI (match_dup 0))
7458 (clobber (reg:SI 1))
7459 (clobber (reg:SI 2))
7461 (use (const_int 0))])]
7464 (define_insn "*call_symref_pic_post_reload"
7465 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7466 (match_operand 1 "" "i"))
7467 (clobber (reg:SI 1))
7468 (clobber (reg:SI 2))
7470 (use (const_int 0))]
7471 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7474 output_arg_descriptor (insn);
7475 return output_call (insn, operands[0], 0);
7477 [(set_attr "type" "call")
7478 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
7480 ;; This pattern is split if it is necessary to save and restore the
7482 (define_insn "call_symref_64bit"
7483 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7484 (match_operand 1 "" "i"))
7485 (clobber (reg:DI 1))
7486 (clobber (reg:DI 2))
7487 (clobber (reg:DI 4))
7490 (use (const_int 0))]
7494 output_arg_descriptor (insn);
7495 return output_call (insn, operands[0], 0);
7497 [(set_attr "type" "call")
7498 (set (attr "length")
7499 (plus (symbol_ref "attr_length_call (insn, 0)")
7500 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
7502 ;; Split out the PIC register save and restore after reload. This is
7503 ;; done only if the function returns. As the split is done after reload,
7504 ;; there are some situations in which we unnecessarily save and restore
7505 ;; %r4. This happens when there is a single call and the PIC register
7506 ;; is "dead" after the call. This isn't easy to fix as the usage of
7507 ;; the PIC register isn't completely determined until the reload pass.
7509 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7510 (match_operand 1 "" ""))
7511 (clobber (reg:DI 1))
7512 (clobber (reg:DI 2))
7513 (clobber (reg:DI 4))
7516 (use (const_int 0))])]
7519 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7520 [(set (reg:DI 4) (reg:DI 27))
7521 (parallel [(call (mem:SI (match_dup 0))
7523 (clobber (reg:DI 1))
7524 (clobber (reg:DI 2))
7527 (use (const_int 0))])
7528 (set (reg:DI 27) (reg:DI 4))]
7531 ;; Remove the clobber of register 4 when optimizing. This has to be
7532 ;; done with a peephole optimization rather than a split because the
7533 ;; split sequence for a call must be longer than one instruction.
7535 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7536 (match_operand 1 "" ""))
7537 (clobber (reg:DI 1))
7538 (clobber (reg:DI 2))
7539 (clobber (reg:DI 4))
7542 (use (const_int 0))])]
7543 "TARGET_64BIT && reload_completed"
7544 [(parallel [(call (mem:SI (match_dup 0))
7546 (clobber (reg:DI 1))
7547 (clobber (reg:DI 2))
7550 (use (const_int 0))])]
7553 (define_insn "*call_symref_64bit_post_reload"
7554 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7555 (match_operand 1 "" "i"))
7556 (clobber (reg:DI 1))
7557 (clobber (reg:DI 2))
7560 (use (const_int 0))]
7564 output_arg_descriptor (insn);
7565 return output_call (insn, operands[0], 0);
7567 [(set_attr "type" "call")
7568 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
7570 (define_insn "call_reg"
7571 [(call (mem:SI (reg:SI 22))
7572 (match_operand 0 "" "i"))
7573 (clobber (reg:SI 1))
7574 (clobber (reg:SI 2))
7575 (use (const_int 1))]
7579 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7581 [(set_attr "type" "dyncall")
7582 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
7584 ;; This pattern is split if it is necessary to save and restore the
7586 (define_insn "call_reg_pic"
7587 [(call (mem:SI (reg:SI 22))
7588 (match_operand 0 "" "i"))
7589 (clobber (reg:SI 1))
7590 (clobber (reg:SI 2))
7591 (clobber (reg:SI 4))
7593 (use (const_int 1))]
7597 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7599 [(set_attr "type" "dyncall")
7600 (set (attr "length")
7601 (plus (symbol_ref "attr_length_indirect_call (insn)")
7602 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
7604 ;; Split out the PIC register save and restore after reload. This is
7605 ;; done only if the function returns. As the split is done after reload,
7606 ;; there are some situations in which we unnecessarily save and restore
7607 ;; %r4. This happens when there is a single call and the PIC register
7608 ;; is "dead" after the call. This isn't easy to fix as the usage of
7609 ;; the PIC register isn't completely determined until the reload pass.
7611 [(parallel [(call (mem:SI (reg:SI 22))
7612 (match_operand 0 "" ""))
7613 (clobber (reg:SI 1))
7614 (clobber (reg:SI 2))
7615 (clobber (reg:SI 4))
7617 (use (const_int 1))])]
7620 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7621 [(set (reg:SI 4) (reg:SI 19))
7622 (parallel [(call (mem:SI (reg:SI 22))
7624 (clobber (reg:SI 1))
7625 (clobber (reg:SI 2))
7627 (use (const_int 1))])
7628 (set (reg:SI 19) (reg:SI 4))]
7631 ;; Remove the clobber of register 4 when optimizing. This has to be
7632 ;; done with a peephole optimization rather than a split because the
7633 ;; split sequence for a call must be longer than one instruction.
7635 [(parallel [(call (mem:SI (reg:SI 22))
7636 (match_operand 0 "" ""))
7637 (clobber (reg:SI 1))
7638 (clobber (reg:SI 2))
7639 (clobber (reg:SI 4))
7641 (use (const_int 1))])]
7642 "!TARGET_64BIT && reload_completed"
7643 [(parallel [(call (mem:SI (reg:SI 22))
7645 (clobber (reg:SI 1))
7646 (clobber (reg:SI 2))
7648 (use (const_int 1))])]
7651 (define_insn "*call_reg_pic_post_reload"
7652 [(call (mem:SI (reg:SI 22))
7653 (match_operand 0 "" "i"))
7654 (clobber (reg:SI 1))
7655 (clobber (reg:SI 2))
7657 (use (const_int 1))]
7661 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7663 [(set_attr "type" "dyncall")
7664 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
7666 ;; This pattern is split if it is necessary to save and restore the
7668 (define_insn "call_reg_64bit"
7669 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7670 (match_operand 1 "" "i"))
7671 (clobber (reg:DI 2))
7672 (clobber (reg:DI 4))
7675 (use (const_int 1))]
7679 return output_indirect_call (insn, operands[0]);
7681 [(set_attr "type" "dyncall")
7682 (set (attr "length")
7683 (plus (symbol_ref "attr_length_indirect_call (insn)")
7684 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
7686 ;; Split out the PIC register save and restore after reload. This is
7687 ;; done only if the function returns. As the split is done after reload,
7688 ;; there are some situations in which we unnecessarily save and restore
7689 ;; %r4. This happens when there is a single call and the PIC register
7690 ;; is "dead" after the call. This isn't easy to fix as the usage of
7691 ;; the PIC register isn't completely determined until the reload pass.
7693 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7694 (match_operand 1 "" ""))
7695 (clobber (reg:DI 2))
7696 (clobber (reg:DI 4))
7699 (use (const_int 1))])]
7702 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7703 [(set (reg:DI 4) (reg:DI 27))
7704 (parallel [(call (mem:SI (match_dup 0))
7706 (clobber (reg:DI 2))
7709 (use (const_int 1))])
7710 (set (reg:DI 27) (reg:DI 4))]
7713 ;; Remove the clobber of register 4 when optimizing. This has to be
7714 ;; done with a peephole optimization rather than a split because the
7715 ;; split sequence for a call must be longer than one instruction.
7717 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7718 (match_operand 1 "" ""))
7719 (clobber (reg:DI 2))
7720 (clobber (reg:DI 4))
7723 (use (const_int 1))])]
7724 "TARGET_64BIT && reload_completed"
7725 [(parallel [(call (mem:SI (match_dup 0))
7727 (clobber (reg:DI 2))
7730 (use (const_int 1))])]
7733 (define_insn "*call_reg_64bit_post_reload"
7734 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7735 (match_operand 1 "" "i"))
7736 (clobber (reg:DI 2))
7739 (use (const_int 1))]
7743 return output_indirect_call (insn, operands[0]);
7745 [(set_attr "type" "dyncall")
7746 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
7748 (define_expand "call_value"
7749 [(parallel [(set (match_operand 0 "" "")
7750 (call (match_operand:SI 1 "" "")
7751 (match_operand 2 "" "")))
7752 (clobber (reg:SI 2))])]
7757 rtx dst = operands[0];
7758 rtx nb = operands[2];
7760 if (TARGET_PORTABLE_RUNTIME)
7761 op = force_reg (SImode, XEXP (operands[1], 0));
7763 op = XEXP (operands[1], 0);
7767 if (!virtuals_instantiated)
7768 emit_move_insn (arg_pointer_rtx,
7769 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7773 /* The loop pass can generate new libcalls after the virtual
7774 registers are instantiated when fpregs are disabled because
7775 the only method that we have for doing DImode multiplication
7776 is with a libcall. This could be trouble if we haven't
7777 allocated enough space for the outgoing arguments. */
7778 gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size);
7780 emit_move_insn (arg_pointer_rtx,
7781 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7782 GEN_INT (STACK_POINTER_OFFSET + 64)));
7786 /* Use two different patterns for calls to explicitly named functions
7787 and calls through function pointers. This is necessary as these two
7788 types of calls use different calling conventions, and CSE might try
7789 to change the named call into an indirect call in some cases (using
7790 two patterns keeps CSE from performing this optimization).
7792 We now use even more call patterns as there was a subtle bug in
7793 attempting to restore the pic register after a call using a simple
7794 move insn. During reload, a instruction involving a pseudo register
7795 with no explicit dependence on the PIC register can be converted
7796 to an equivalent load from memory using the PIC register. If we
7797 emit a simple move to restore the PIC register in the initial rtl
7798 generation, then it can potentially be repositioned during scheduling.
7799 and an instruction that eventually uses the PIC register may end up
7800 between the call and the PIC register restore.
7802 This only worked because there is a post call group of instructions
7803 that are scheduled with the call. These instructions are included
7804 in the same basic block as the call. However, calls can throw in
7805 C++ code and a basic block has to terminate at the call if the call
7806 can throw. This results in the PIC register restore being scheduled
7807 independently from the call. So, we now hide the save and restore
7808 of the PIC register in the call pattern until after reload. Then,
7809 we split the moves out. A small side benefit is that we now don't
7810 need to have a use of the PIC register in the return pattern and
7811 the final save/restore operation is not needed.
7813 I elected to just clobber %r4 in the PIC patterns and use it instead
7814 of trying to force hppa_pic_save_rtx () to a callee saved register.
7815 This might have required a new register class and constraint. It
7816 was also simpler to just handle the restore from a register than a
7820 if (GET_CODE (op) == SYMBOL_REF)
7821 call_insn = emit_call_insn (gen_call_val_symref_64bit (dst, op, nb));
7824 op = force_reg (word_mode, op);
7825 call_insn = emit_call_insn (gen_call_val_reg_64bit (dst, op, nb));
7830 if (GET_CODE (op) == SYMBOL_REF)
7833 call_insn = emit_call_insn (gen_call_val_symref_pic (dst, op, nb));
7835 call_insn = emit_call_insn (gen_call_val_symref (dst, op, nb));
7839 rtx tmpreg = gen_rtx_REG (word_mode, 22);
7841 emit_move_insn (tmpreg, force_reg (word_mode, op));
7843 call_insn = emit_call_insn (gen_call_val_reg_pic (dst, nb));
7845 call_insn = emit_call_insn (gen_call_val_reg (dst, nb));
7852 (define_insn "call_val_symref"
7853 [(set (match_operand 0 "" "")
7854 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7855 (match_operand 2 "" "i")))
7856 (clobber (reg:SI 1))
7857 (clobber (reg:SI 2))
7858 (use (const_int 0))]
7859 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7862 output_arg_descriptor (insn);
7863 return output_call (insn, operands[1], 0);
7865 [(set_attr "type" "call")
7866 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
7868 (define_insn "call_val_symref_pic"
7869 [(set (match_operand 0 "" "")
7870 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7871 (match_operand 2 "" "i")))
7872 (clobber (reg:SI 1))
7873 (clobber (reg:SI 2))
7874 (clobber (reg:SI 4))
7876 (use (const_int 0))]
7877 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7880 output_arg_descriptor (insn);
7881 return output_call (insn, operands[1], 0);
7883 [(set_attr "type" "call")
7884 (set (attr "length")
7885 (plus (symbol_ref "attr_length_call (insn, 0)")
7886 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
7888 ;; Split out the PIC register save and restore after reload. This is
7889 ;; done only if the function returns. As the split is done after reload,
7890 ;; there are some situations in which we unnecessarily save and restore
7891 ;; %r4. This happens when there is a single call and the PIC register
7892 ;; is "dead" after the call. This isn't easy to fix as the usage of
7893 ;; the PIC register isn't completely determined until the reload pass.
7895 [(parallel [(set (match_operand 0 "" "")
7896 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7897 (match_operand 2 "" "")))
7898 (clobber (reg:SI 1))
7899 (clobber (reg:SI 2))
7900 (clobber (reg:SI 4))
7902 (use (const_int 0))])]
7903 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT
7905 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7906 [(set (reg:SI 4) (reg:SI 19))
7907 (parallel [(set (match_dup 0)
7908 (call (mem:SI (match_dup 1))
7910 (clobber (reg:SI 1))
7911 (clobber (reg:SI 2))
7913 (use (const_int 0))])
7914 (set (reg:SI 19) (reg:SI 4))]
7917 ;; Remove the clobber of register 4 when optimizing. This has to be
7918 ;; done with a peephole optimization rather than a split because the
7919 ;; split sequence for a call must be longer than one instruction.
7921 [(parallel [(set (match_operand 0 "" "")
7922 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7923 (match_operand 2 "" "")))
7924 (clobber (reg:SI 1))
7925 (clobber (reg:SI 2))
7926 (clobber (reg:SI 4))
7928 (use (const_int 0))])]
7929 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7930 [(parallel [(set (match_dup 0)
7931 (call (mem:SI (match_dup 1))
7933 (clobber (reg:SI 1))
7934 (clobber (reg:SI 2))
7936 (use (const_int 0))])]
7939 (define_insn "*call_val_symref_pic_post_reload"
7940 [(set (match_operand 0 "" "")
7941 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7942 (match_operand 2 "" "i")))
7943 (clobber (reg:SI 1))
7944 (clobber (reg:SI 2))
7946 (use (const_int 0))]
7947 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7950 output_arg_descriptor (insn);
7951 return output_call (insn, operands[1], 0);
7953 [(set_attr "type" "call")
7954 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
7956 ;; This pattern is split if it is necessary to save and restore the
7958 (define_insn "call_val_symref_64bit"
7959 [(set (match_operand 0 "" "")
7960 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7961 (match_operand 2 "" "i")))
7962 (clobber (reg:DI 1))
7963 (clobber (reg:DI 2))
7964 (clobber (reg:DI 4))
7967 (use (const_int 0))]
7971 output_arg_descriptor (insn);
7972 return output_call (insn, operands[1], 0);
7974 [(set_attr "type" "call")
7975 (set (attr "length")
7976 (plus (symbol_ref "attr_length_call (insn, 0)")
7977 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
7979 ;; Split out the PIC register save and restore after reload. This is
7980 ;; done only if the function returns. As the split is done after reload,
7981 ;; there are some situations in which we unnecessarily save and restore
7982 ;; %r4. This happens when there is a single call and the PIC register
7983 ;; is "dead" after the call. This isn't easy to fix as the usage of
7984 ;; the PIC register isn't completely determined until the reload pass.
7986 [(parallel [(set (match_operand 0 "" "")
7987 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7988 (match_operand 2 "" "")))
7989 (clobber (reg:DI 1))
7990 (clobber (reg:DI 2))
7991 (clobber (reg:DI 4))
7994 (use (const_int 0))])]
7997 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7998 [(set (reg:DI 4) (reg:DI 27))
7999 (parallel [(set (match_dup 0)
8000 (call (mem:SI (match_dup 1))
8002 (clobber (reg:DI 1))
8003 (clobber (reg:DI 2))
8006 (use (const_int 0))])
8007 (set (reg:DI 27) (reg:DI 4))]
8010 ;; Remove the clobber of register 4 when optimizing. This has to be
8011 ;; done with a peephole optimization rather than a split because the
8012 ;; split sequence for a call must be longer than one instruction.
8014 [(parallel [(set (match_operand 0 "" "")
8015 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8016 (match_operand 2 "" "")))
8017 (clobber (reg:DI 1))
8018 (clobber (reg:DI 2))
8019 (clobber (reg:DI 4))
8022 (use (const_int 0))])]
8023 "TARGET_64BIT && reload_completed"
8024 [(parallel [(set (match_dup 0)
8025 (call (mem:SI (match_dup 1))
8027 (clobber (reg:DI 1))
8028 (clobber (reg:DI 2))
8031 (use (const_int 0))])]
8034 (define_insn "*call_val_symref_64bit_post_reload"
8035 [(set (match_operand 0 "" "")
8036 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8037 (match_operand 2 "" "i")))
8038 (clobber (reg:DI 1))
8039 (clobber (reg:DI 2))
8042 (use (const_int 0))]
8046 output_arg_descriptor (insn);
8047 return output_call (insn, operands[1], 0);
8049 [(set_attr "type" "call")
8050 (set (attr "length") (symbol_ref "attr_length_call (insn, 0)"))])
8052 (define_insn "call_val_reg"
8053 [(set (match_operand 0 "" "")
8054 (call (mem:SI (reg:SI 22))
8055 (match_operand 1 "" "i")))
8056 (clobber (reg:SI 1))
8057 (clobber (reg:SI 2))
8058 (use (const_int 1))]
8062 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8064 [(set_attr "type" "dyncall")
8065 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
8067 ;; This pattern is split if it is necessary to save and restore the
8069 (define_insn "call_val_reg_pic"
8070 [(set (match_operand 0 "" "")
8071 (call (mem:SI (reg:SI 22))
8072 (match_operand 1 "" "i")))
8073 (clobber (reg:SI 1))
8074 (clobber (reg:SI 2))
8075 (clobber (reg:SI 4))
8077 (use (const_int 1))]
8081 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8083 [(set_attr "type" "dyncall")
8084 (set (attr "length")
8085 (plus (symbol_ref "attr_length_indirect_call (insn)")
8086 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
8088 ;; Split out the PIC register save and restore after reload. This is
8089 ;; done only if the function returns. As the split is done after reload,
8090 ;; there are some situations in which we unnecessarily save and restore
8091 ;; %r4. This happens when there is a single call and the PIC register
8092 ;; is "dead" after the call. This isn't easy to fix as the usage of
8093 ;; the PIC register isn't completely determined until the reload pass.
8095 [(parallel [(set (match_operand 0 "" "")
8096 (call (mem:SI (reg:SI 22))
8097 (match_operand 1 "" "")))
8098 (clobber (reg:SI 1))
8099 (clobber (reg:SI 2))
8100 (clobber (reg:SI 4))
8102 (use (const_int 1))])]
8105 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8106 [(set (reg:SI 4) (reg:SI 19))
8107 (parallel [(set (match_dup 0)
8108 (call (mem:SI (reg:SI 22))
8110 (clobber (reg:SI 1))
8111 (clobber (reg:SI 2))
8113 (use (const_int 1))])
8114 (set (reg:SI 19) (reg:SI 4))]
8117 ;; Remove the clobber of register 4 when optimizing. This has to be
8118 ;; done with a peephole optimization rather than a split because the
8119 ;; split sequence for a call must be longer than one instruction.
8121 [(parallel [(set (match_operand 0 "" "")
8122 (call (mem:SI (reg:SI 22))
8123 (match_operand 1 "" "")))
8124 (clobber (reg:SI 1))
8125 (clobber (reg:SI 2))
8126 (clobber (reg:SI 4))
8128 (use (const_int 1))])]
8129 "!TARGET_64BIT && reload_completed"
8130 [(parallel [(set (match_dup 0)
8131 (call (mem:SI (reg:SI 22))
8133 (clobber (reg:SI 1))
8134 (clobber (reg:SI 2))
8136 (use (const_int 1))])]
8139 (define_insn "*call_val_reg_pic_post_reload"
8140 [(set (match_operand 0 "" "")
8141 (call (mem:SI (reg:SI 22))
8142 (match_operand 1 "" "i")))
8143 (clobber (reg:SI 1))
8144 (clobber (reg:SI 2))
8146 (use (const_int 1))]
8150 return output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8152 [(set_attr "type" "dyncall")
8153 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
8155 ;; This pattern is split if it is necessary to save and restore the
8157 (define_insn "call_val_reg_64bit"
8158 [(set (match_operand 0 "" "")
8159 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8160 (match_operand 2 "" "i")))
8161 (clobber (reg:DI 2))
8162 (clobber (reg:DI 4))
8165 (use (const_int 1))]
8169 return output_indirect_call (insn, operands[1]);
8171 [(set_attr "type" "dyncall")
8172 (set (attr "length")
8173 (plus (symbol_ref "attr_length_indirect_call (insn)")
8174 (symbol_ref "attr_length_save_restore_dltp (insn)")))])
8176 ;; Split out the PIC register save and restore after reload. This is
8177 ;; done only if the function returns. As the split is done after reload,
8178 ;; there are some situations in which we unnecessarily save and restore
8179 ;; %r4. This happens when there is a single call and the PIC register
8180 ;; is "dead" after the call. This isn't easy to fix as the usage of
8181 ;; the PIC register isn't completely determined until the reload pass.
8183 [(parallel [(set (match_operand 0 "" "")
8184 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8185 (match_operand 2 "" "")))
8186 (clobber (reg:DI 2))
8187 (clobber (reg:DI 4))
8190 (use (const_int 1))])]
8193 && !find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8194 [(set (reg:DI 4) (reg:DI 27))
8195 (parallel [(set (match_dup 0)
8196 (call (mem:SI (match_dup 1))
8198 (clobber (reg:DI 2))
8201 (use (const_int 1))])
8202 (set (reg:DI 27) (reg:DI 4))]
8205 ;; Remove the clobber of register 4 when optimizing. This has to be
8206 ;; done with a peephole optimization rather than a split because the
8207 ;; split sequence for a call must be longer than one instruction.
8209 [(parallel [(set (match_operand 0 "" "")
8210 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8211 (match_operand 2 "" "")))
8212 (clobber (reg:DI 2))
8213 (clobber (reg:DI 4))
8216 (use (const_int 1))])]
8217 "TARGET_64BIT && reload_completed"
8218 [(parallel [(set (match_dup 0)
8219 (call (mem:SI (match_dup 1))
8221 (clobber (reg:DI 2))
8224 (use (const_int 1))])]
8227 (define_insn "*call_val_reg_64bit_post_reload"
8228 [(set (match_operand 0 "" "")
8229 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8230 (match_operand 2 "" "i")))
8231 (clobber (reg:DI 2))
8234 (use (const_int 1))]
8238 return output_indirect_call (insn, operands[1]);
8240 [(set_attr "type" "dyncall")
8241 (set (attr "length") (symbol_ref "attr_length_indirect_call (insn)"))])
8243 ;; Call subroutine returning any type.
8245 (define_expand "untyped_call"
8246 [(parallel [(call (match_operand 0 "" "")
8248 (match_operand 1 "" "")
8249 (match_operand 2 "" "")])]
8255 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
8257 for (i = 0; i < XVECLEN (operands[2], 0); i++)
8259 rtx set = XVECEXP (operands[2], 0, i);
8260 emit_move_insn (SET_DEST (set), SET_SRC (set));
8263 /* The optimizer does not know that the call sets the function value
8264 registers we stored in the result block. We avoid problems by
8265 claiming that all hard registers are used and clobbered at this
8267 emit_insn (gen_blockage ());
8272 (define_expand "sibcall"
8273 [(call (match_operand:SI 0 "" "")
8274 (match_operand 1 "" ""))]
8275 "!TARGET_PORTABLE_RUNTIME"
8279 rtx nb = operands[1];
8281 op = XEXP (operands[0], 0);
8285 if (!virtuals_instantiated)
8286 emit_move_insn (arg_pointer_rtx,
8287 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8291 /* The loop pass can generate new libcalls after the virtual
8292 registers are instantiated when fpregs are disabled because
8293 the only method that we have for doing DImode multiplication
8294 is with a libcall. This could be trouble if we haven't
8295 allocated enough space for the outgoing arguments. */
8296 gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size);
8298 emit_move_insn (arg_pointer_rtx,
8299 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8300 GEN_INT (STACK_POINTER_OFFSET + 64)));
8304 /* Indirect sibling calls are not allowed. */
8306 call_insn = gen_sibcall_internal_symref_64bit (op, operands[1]);
8308 call_insn = gen_sibcall_internal_symref (op, operands[1]);
8310 call_insn = emit_call_insn (call_insn);
8313 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8315 /* We don't have to restore the PIC register. */
8317 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8322 (define_insn "sibcall_internal_symref"
8323 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8324 (match_operand 1 "" "i"))
8325 (clobber (reg:SI 1))
8327 (use (const_int 0))]
8328 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8331 output_arg_descriptor (insn);
8332 return output_call (insn, operands[0], 1);
8334 [(set_attr "type" "call")
8335 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
8337 (define_insn "sibcall_internal_symref_64bit"
8338 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8339 (match_operand 1 "" "i"))
8340 (clobber (reg:DI 1))
8342 (use (const_int 0))]
8346 output_arg_descriptor (insn);
8347 return output_call (insn, operands[0], 1);
8349 [(set_attr "type" "call")
8350 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
8352 (define_expand "sibcall_value"
8353 [(set (match_operand 0 "" "")
8354 (call (match_operand:SI 1 "" "")
8355 (match_operand 2 "" "")))]
8356 "!TARGET_PORTABLE_RUNTIME"
8360 rtx nb = operands[1];
8362 op = XEXP (operands[1], 0);
8366 if (!virtuals_instantiated)
8367 emit_move_insn (arg_pointer_rtx,
8368 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8372 /* The loop pass can generate new libcalls after the virtual
8373 registers are instantiated when fpregs are disabled because
8374 the only method that we have for doing DImode multiplication
8375 is with a libcall. This could be trouble if we haven't
8376 allocated enough space for the outgoing arguments. */
8377 gcc_assert (INTVAL (nb) <= current_function_outgoing_args_size);
8379 emit_move_insn (arg_pointer_rtx,
8380 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8381 GEN_INT (STACK_POINTER_OFFSET + 64)));
8385 /* Indirect sibling calls are not allowed. */
8388 = gen_sibcall_value_internal_symref_64bit (operands[0], op, operands[2]);
8391 = gen_sibcall_value_internal_symref (operands[0], op, operands[2]);
8393 call_insn = emit_call_insn (call_insn);
8396 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8398 /* We don't have to restore the PIC register. */
8400 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8405 (define_insn "sibcall_value_internal_symref"
8406 [(set (match_operand 0 "" "")
8407 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8408 (match_operand 2 "" "i")))
8409 (clobber (reg:SI 1))
8411 (use (const_int 0))]
8412 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8415 output_arg_descriptor (insn);
8416 return output_call (insn, operands[1], 1);
8418 [(set_attr "type" "call")
8419 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
8421 (define_insn "sibcall_value_internal_symref_64bit"
8422 [(set (match_operand 0 "" "")
8423 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8424 (match_operand 2 "" "i")))
8425 (clobber (reg:DI 1))
8427 (use (const_int 0))]
8431 output_arg_descriptor (insn);
8432 return output_call (insn, operands[1], 1);
8434 [(set_attr "type" "call")
8435 (set (attr "length") (symbol_ref "attr_length_call (insn, 1)"))])
8441 [(set_attr "type" "move")
8442 (set_attr "length" "4")])
8444 ;; These are just placeholders so we know where branch tables
8446 (define_insn "begin_brtab"
8451 /* Only GAS actually supports this pseudo-op. */
8453 return \".begin_brtab\";
8457 [(set_attr "type" "move")
8458 (set_attr "length" "0")])
8460 (define_insn "end_brtab"
8465 /* Only GAS actually supports this pseudo-op. */
8467 return \".end_brtab\";
8471 [(set_attr "type" "move")
8472 (set_attr "length" "0")])
8474 ;;; EH does longjmp's from and within the data section. Thus,
8475 ;;; an interspace branch is required for the longjmp implementation.
8476 ;;; Registers r1 and r2 are used as scratch registers for the jump
8478 (define_expand "interspace_jump"
8480 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8481 (clobber (match_dup 1))])]
8485 operands[1] = gen_rtx_REG (word_mode, 2);
8489 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8490 (clobber (reg:SI 2))]
8491 "TARGET_PA_20 && !TARGET_64BIT"
8493 [(set_attr "type" "branch")
8494 (set_attr "length" "4")])
8497 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8498 (clobber (reg:SI 2))]
8499 "TARGET_NO_SPACE_REGS && !TARGET_64BIT"
8501 [(set_attr "type" "branch")
8502 (set_attr "length" "4")])
8505 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8506 (clobber (reg:SI 2))]
8508 "ldsid (%%sr0,%0),%%r2\;mtsp %%r2,%%sr0\;be%* 0(%%sr0,%0)"
8509 [(set_attr "type" "branch")
8510 (set_attr "length" "12")])
8513 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8514 (clobber (reg:DI 2))]
8517 [(set_attr "type" "branch")
8518 (set_attr "length" "4")])
8520 (define_expand "builtin_longjmp"
8521 [(unspec_volatile [(match_operand 0 "register_operand" "r")] UNSPECV_LONGJMP)]
8525 /* The elements of the buffer are, in order: */
8526 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
8527 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0],
8528 POINTER_SIZE / BITS_PER_UNIT));
8529 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0],
8530 (POINTER_SIZE * 2) / BITS_PER_UNIT));
8531 rtx pv = gen_rtx_REG (Pmode, 1);
8533 emit_insn (gen_rtx_CLOBBER (VOIDmode,
8534 gen_rtx_MEM (BLKmode,
8535 gen_rtx_SCRATCH (VOIDmode))));
8536 emit_insn (gen_rtx_CLOBBER (VOIDmode,
8537 gen_rtx_MEM (BLKmode,
8538 hard_frame_pointer_rtx)));
8540 /* Restore the frame pointer. The virtual_stack_vars_rtx is saved
8541 instead of the hard_frame_pointer_rtx in the save area. We need
8542 to adjust for the offset between these two values when we have
8543 a nonlocal_goto pattern. When we don't have a nonlocal_goto
8544 pattern, the receiver performs the adjustment. */
8545 #ifdef HAVE_nonlocal_goto
8546 if (HAVE_nonlocal_goto)
8547 emit_move_insn (virtual_stack_vars_rtx, force_reg (Pmode, fp));
8550 emit_move_insn (hard_frame_pointer_rtx, fp);
8552 /* This bit is the same as expand_builtin_longjmp. */
8553 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
8554 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
8555 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
8557 /* Load the label we are jumping through into r1 so that we know
8558 where to look for it when we get back to setjmp's function for
8559 restoring the gp. */
8560 emit_move_insn (pv, lab);
8562 /* Prevent the insns above from being scheduled into the delay slot
8563 of the interspace jump because the space register could change. */
8564 emit_insn (gen_blockage ());
8566 emit_jump_insn (gen_interspace_jump (pv));
8571 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8572 (define_expand "extzv"
8573 [(set (match_operand 0 "register_operand" "")
8574 (zero_extract (match_operand 1 "register_operand" "")
8575 (match_operand 2 "uint32_operand" "")
8576 (match_operand 3 "uint32_operand" "")))]
8580 HOST_WIDE_INT len = INTVAL (operands[2]);
8581 HOST_WIDE_INT pos = INTVAL (operands[3]);
8583 /* PA extraction insns don't support zero length bitfields or fields
8584 extending beyond the left or right-most bits. Also, we reject lengths
8585 equal to a word as they are better handled by the move patterns. */
8586 if (len <= 0 || len >= BITS_PER_WORD || pos < 0 || pos + len > BITS_PER_WORD)
8589 /* From mips.md: extract_bit_field doesn't verify that our source
8590 matches the predicate, so check it again here. */
8591 if (!register_operand (operands[1], VOIDmode))
8595 emit_insn (gen_extzv_64 (operands[0], operands[1],
8596 operands[2], operands[3]));
8598 emit_insn (gen_extzv_32 (operands[0], operands[1],
8599 operands[2], operands[3]));
8603 (define_insn "extzv_32"
8604 [(set (match_operand:SI 0 "register_operand" "=r")
8605 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8606 (match_operand:SI 2 "uint5_operand" "")
8607 (match_operand:SI 3 "uint5_operand" "")))]
8609 "{extru|extrw,u} %1,%3+%2-1,%2,%0"
8610 [(set_attr "type" "shift")
8611 (set_attr "length" "4")])
8614 [(set (match_operand:SI 0 "register_operand" "=r")
8615 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8617 (match_operand:SI 2 "register_operand" "q")))]
8619 "{vextru %1,1,%0|extrw,u %1,%%sar,1,%0}"
8620 [(set_attr "type" "shift")
8621 (set_attr "length" "4")])
8623 (define_insn "extzv_64"
8624 [(set (match_operand:DI 0 "register_operand" "=r")
8625 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8626 (match_operand:DI 2 "uint32_operand" "")
8627 (match_operand:DI 3 "uint32_operand" "")))]
8629 "extrd,u %1,%3+%2-1,%2,%0"
8630 [(set_attr "type" "shift")
8631 (set_attr "length" "4")])
8634 [(set (match_operand:DI 0 "register_operand" "=r")
8635 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8637 (match_operand:DI 2 "register_operand" "q")))]
8639 "extrd,u %1,%%sar,1,%0"
8640 [(set_attr "type" "shift")
8641 (set_attr "length" "4")])
8643 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8644 (define_expand "extv"
8645 [(set (match_operand 0 "register_operand" "")
8646 (sign_extract (match_operand 1 "register_operand" "")
8647 (match_operand 2 "uint32_operand" "")
8648 (match_operand 3 "uint32_operand" "")))]
8652 HOST_WIDE_INT len = INTVAL (operands[2]);
8653 HOST_WIDE_INT pos = INTVAL (operands[3]);
8655 /* PA extraction insns don't support zero length bitfields or fields
8656 extending beyond the left or right-most bits. Also, we reject lengths
8657 equal to a word as they are better handled by the move patterns. */
8658 if (len <= 0 || len >= BITS_PER_WORD || pos < 0 || pos + len > BITS_PER_WORD)
8661 /* From mips.md: extract_bit_field doesn't verify that our source
8662 matches the predicate, so check it again here. */
8663 if (!register_operand (operands[1], VOIDmode))
8667 emit_insn (gen_extv_64 (operands[0], operands[1],
8668 operands[2], operands[3]));
8670 emit_insn (gen_extv_32 (operands[0], operands[1],
8671 operands[2], operands[3]));
8675 (define_insn "extv_32"
8676 [(set (match_operand:SI 0 "register_operand" "=r")
8677 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8678 (match_operand:SI 2 "uint5_operand" "")
8679 (match_operand:SI 3 "uint5_operand" "")))]
8681 "{extrs|extrw,s} %1,%3+%2-1,%2,%0"
8682 [(set_attr "type" "shift")
8683 (set_attr "length" "4")])
8686 [(set (match_operand:SI 0 "register_operand" "=r")
8687 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8689 (match_operand:SI 2 "register_operand" "q")))]
8691 "{vextrs %1,1,%0|extrw,s %1,%%sar,1,%0}"
8692 [(set_attr "type" "shift")
8693 (set_attr "length" "4")])
8695 (define_insn "extv_64"
8696 [(set (match_operand:DI 0 "register_operand" "=r")
8697 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8698 (match_operand:DI 2 "uint32_operand" "")
8699 (match_operand:DI 3 "uint32_operand" "")))]
8701 "extrd,s %1,%3+%2-1,%2,%0"
8702 [(set_attr "type" "shift")
8703 (set_attr "length" "4")])
8706 [(set (match_operand:DI 0 "register_operand" "=r")
8707 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8709 (match_operand:DI 2 "register_operand" "q")))]
8711 "extrd,s %1,%%sar,1,%0"
8712 [(set_attr "type" "shift")
8713 (set_attr "length" "4")])
8715 ;;; Operands 1 and 2 are assumed to be CONST_INTs.
8716 (define_expand "insv"
8717 [(set (zero_extract (match_operand 0 "register_operand" "")
8718 (match_operand 1 "uint32_operand" "")
8719 (match_operand 2 "uint32_operand" ""))
8720 (match_operand 3 "arith5_operand" ""))]
8724 HOST_WIDE_INT len = INTVAL (operands[1]);
8725 HOST_WIDE_INT pos = INTVAL (operands[2]);
8727 /* PA insertion insns don't support zero length bitfields or fields
8728 extending beyond the left or right-most bits. Also, we reject lengths
8729 equal to a word as they are better handled by the move patterns. */
8730 if (len <= 0 || len >= BITS_PER_WORD || pos < 0 || pos + len > BITS_PER_WORD)
8733 /* From mips.md: insert_bit_field doesn't verify that our destination
8734 matches the predicate, so check it again here. */
8735 if (!register_operand (operands[0], VOIDmode))
8739 emit_insn (gen_insv_64 (operands[0], operands[1],
8740 operands[2], operands[3]));
8742 emit_insn (gen_insv_32 (operands[0], operands[1],
8743 operands[2], operands[3]));
8747 (define_insn "insv_32"
8748 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
8749 (match_operand:SI 1 "uint5_operand" "")
8750 (match_operand:SI 2 "uint5_operand" ""))
8751 (match_operand:SI 3 "arith5_operand" "r,L"))]
8754 {dep|depw} %3,%2+%1-1,%1,%0
8755 {depi|depwi} %3,%2+%1-1,%1,%0"
8756 [(set_attr "type" "shift,shift")
8757 (set_attr "length" "4,4")])
8759 ;; Optimize insertion of const_int values of type 1...1xxxx.
8761 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
8762 (match_operand:SI 1 "uint5_operand" "")
8763 (match_operand:SI 2 "uint5_operand" ""))
8764 (match_operand:SI 3 "const_int_operand" ""))]
8765 "(INTVAL (operands[3]) & 0x10) != 0 &&
8766 (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8769 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8770 return \"{depi|depwi} %3,%2+%1-1,%1,%0\";
8772 [(set_attr "type" "shift")
8773 (set_attr "length" "4")])
8775 (define_insn "insv_64"
8776 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r,r")
8777 (match_operand:DI 1 "uint32_operand" "")
8778 (match_operand:DI 2 "uint32_operand" ""))
8779 (match_operand:DI 3 "arith32_operand" "r,L"))]
8782 depd %3,%2+%1-1,%1,%0
8783 depdi %3,%2+%1-1,%1,%0"
8784 [(set_attr "type" "shift,shift")
8785 (set_attr "length" "4,4")])
8787 ;; Optimize insertion of const_int values of type 1...1xxxx.
8789 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
8790 (match_operand:DI 1 "uint32_operand" "")
8791 (match_operand:DI 2 "uint32_operand" ""))
8792 (match_operand:DI 3 "const_int_operand" ""))]
8793 "(INTVAL (operands[3]) & 0x10) != 0
8795 && (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8798 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8799 return \"depdi %3,%2+%1-1,%1,%0\";
8801 [(set_attr "type" "shift")
8802 (set_attr "length" "4")])
8805 [(set (match_operand:DI 0 "register_operand" "=r")
8806 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
8809 "depd,z %1,31,32,%0"
8810 [(set_attr "type" "shift")
8811 (set_attr "length" "4")])
8813 ;; This insn is used for some loop tests, typically loops reversed when
8814 ;; strength reduction is used. It is actually created when the instruction
8815 ;; combination phase combines the special loop test. Since this insn
8816 ;; is both a jump insn and has an output, it must deal with its own
8817 ;; reloads, hence the `m' constraints. The `!' constraints direct reload
8818 ;; to not choose the register alternatives in the event a reload is needed.
8819 (define_insn "decrement_and_branch_until_zero"
8822 (match_operator 2 "comparison_operator"
8824 (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*m")
8825 (match_operand:SI 1 "int5_operand" "L,L,L"))
8827 (label_ref (match_operand 3 "" ""))
8830 (plus:SI (match_dup 0) (match_dup 1)))
8831 (clobber (match_scratch:SI 4 "=X,r,r"))]
8833 "* return output_dbra (operands, insn, which_alternative); "
8834 ;; Do not expect to understand this the first time through.
8835 [(set_attr "type" "cbranch,multi,multi")
8836 (set (attr "length")
8837 (if_then_else (eq_attr "alternative" "0")
8838 ;; Loop counter in register case
8839 ;; Short branch has length of 4
8840 ;; Long branch has length of 8
8841 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8846 ;; Loop counter in FP reg case.
8847 ;; Extra goo to deal with additional reload insns.
8848 (if_then_else (eq_attr "alternative" "1")
8849 (if_then_else (lt (match_dup 3) (pc))
8851 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
8856 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8860 ;; Loop counter in memory case.
8861 ;; Extra goo to deal with additional reload insns.
8862 (if_then_else (lt (match_dup 3) (pc))
8864 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
8869 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8872 (const_int 16))))))])
8877 (match_operator 2 "movb_comparison_operator"
8878 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
8879 (label_ref (match_operand 3 "" ""))
8881 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
8884 "* return output_movb (operands, insn, which_alternative, 0); "
8885 ;; Do not expect to understand this the first time through.
8886 [(set_attr "type" "cbranch,multi,multi,multi")
8887 (set (attr "length")
8888 (if_then_else (eq_attr "alternative" "0")
8889 ;; Loop counter in register case
8890 ;; Short branch has length of 4
8891 ;; Long branch has length of 8
8892 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8897 ;; Loop counter in FP reg case.
8898 ;; Extra goo to deal with additional reload insns.
8899 (if_then_else (eq_attr "alternative" "1")
8900 (if_then_else (lt (match_dup 3) (pc))
8902 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
8907 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8911 ;; Loop counter in memory or sar case.
8912 ;; Extra goo to deal with additional reload insns.
8914 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8917 (const_int 12)))))])
8919 ;; Handle negated branch.
8923 (match_operator 2 "movb_comparison_operator"
8924 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
8926 (label_ref (match_operand 3 "" ""))))
8927 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
8930 "* return output_movb (operands, insn, which_alternative, 1); "
8931 ;; Do not expect to understand this the first time through.
8932 [(set_attr "type" "cbranch,multi,multi,multi")
8933 (set (attr "length")
8934 (if_then_else (eq_attr "alternative" "0")
8935 ;; Loop counter in register case
8936 ;; Short branch has length of 4
8937 ;; Long branch has length of 8
8938 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8943 ;; Loop counter in FP reg case.
8944 ;; Extra goo to deal with additional reload insns.
8945 (if_then_else (eq_attr "alternative" "1")
8946 (if_then_else (lt (match_dup 3) (pc))
8948 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
8953 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8957 ;; Loop counter in memory or SAR case.
8958 ;; Extra goo to deal with additional reload insns.
8960 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8963 (const_int 12)))))])
8966 [(set (pc) (label_ref (match_operand 3 "" "" )))
8967 (set (match_operand:SI 0 "ireg_operand" "=r")
8968 (plus:SI (match_operand:SI 1 "ireg_operand" "r")
8969 (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
8970 "(reload_completed && operands[0] == operands[1]) || operands[0] == operands[2]"
8973 return output_parallel_addb (operands, get_attr_length (insn));
8975 [(set_attr "type" "parallel_branch")
8976 (set (attr "length")
8977 (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8983 [(set (pc) (label_ref (match_operand 2 "" "" )))
8984 (set (match_operand:SF 0 "ireg_operand" "=r")
8985 (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
8989 return output_parallel_movb (operands, get_attr_length (insn));
8991 [(set_attr "type" "parallel_branch")
8992 (set (attr "length")
8993 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
8999 [(set (pc) (label_ref (match_operand 2 "" "" )))
9000 (set (match_operand:SI 0 "ireg_operand" "=r")
9001 (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
9005 return output_parallel_movb (operands, get_attr_length (insn));
9007 [(set_attr "type" "parallel_branch")
9008 (set (attr "length")
9009 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9015 [(set (pc) (label_ref (match_operand 2 "" "" )))
9016 (set (match_operand:HI 0 "ireg_operand" "=r")
9017 (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
9021 return output_parallel_movb (operands, get_attr_length (insn));
9023 [(set_attr "type" "parallel_branch")
9024 (set (attr "length")
9025 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9031 [(set (pc) (label_ref (match_operand 2 "" "" )))
9032 (set (match_operand:QI 0 "ireg_operand" "=r")
9033 (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
9037 return output_parallel_movb (operands, get_attr_length (insn));
9039 [(set_attr "type" "parallel_branch")
9040 (set (attr "length")
9041 (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9047 [(set (match_operand 0 "register_operand" "=f")
9048 (mult (match_operand 1 "register_operand" "f")
9049 (match_operand 2 "register_operand" "f")))
9050 (set (match_operand 3 "register_operand" "+f")
9051 (plus (match_operand 4 "register_operand" "f")
9052 (match_operand 5 "register_operand" "f")))]
9053 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9054 && reload_completed && fmpyaddoperands (operands)"
9057 if (GET_MODE (operands[0]) == DFmode)
9059 if (rtx_equal_p (operands[3], operands[5]))
9060 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9062 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9066 if (rtx_equal_p (operands[3], operands[5]))
9067 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9069 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9072 [(set_attr "type" "fpalu")
9073 (set_attr "length" "4")])
9076 [(set (match_operand 3 "register_operand" "+f")
9077 (plus (match_operand 4 "register_operand" "f")
9078 (match_operand 5 "register_operand" "f")))
9079 (set (match_operand 0 "register_operand" "=f")
9080 (mult (match_operand 1 "register_operand" "f")
9081 (match_operand 2 "register_operand" "f")))]
9082 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9083 && reload_completed && fmpyaddoperands (operands)"
9086 if (GET_MODE (operands[0]) == DFmode)
9088 if (rtx_equal_p (operands[3], operands[5]))
9089 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9091 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9095 if (rtx_equal_p (operands[3], operands[5]))
9096 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9098 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9101 [(set_attr "type" "fpalu")
9102 (set_attr "length" "4")])
9105 [(set (match_operand 0 "register_operand" "=f")
9106 (mult (match_operand 1 "register_operand" "f")
9107 (match_operand 2 "register_operand" "f")))
9108 (set (match_operand 3 "register_operand" "+f")
9109 (minus (match_operand 4 "register_operand" "f")
9110 (match_operand 5 "register_operand" "f")))]
9111 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9112 && reload_completed && fmpysuboperands (operands)"
9115 if (GET_MODE (operands[0]) == DFmode)
9116 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9118 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9120 [(set_attr "type" "fpalu")
9121 (set_attr "length" "4")])
9124 [(set (match_operand 3 "register_operand" "+f")
9125 (minus (match_operand 4 "register_operand" "f")
9126 (match_operand 5 "register_operand" "f")))
9127 (set (match_operand 0 "register_operand" "=f")
9128 (mult (match_operand 1 "register_operand" "f")
9129 (match_operand 2 "register_operand" "f")))]
9130 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9131 && reload_completed && fmpysuboperands (operands)"
9134 if (GET_MODE (operands[0]) == DFmode)
9135 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9137 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9139 [(set_attr "type" "fpalu")
9140 (set_attr "length" "4")])
9142 ;; Flush the I and D cache lines from the start address (operand0)
9143 ;; to the end address (operand1). No lines are flushed if the end
9144 ;; address is less than the start address (unsigned).
9146 ;; Because the range of memory flushed is variable and the size of
9147 ;; a MEM can only be a CONST_INT, the patterns specify that they
9148 ;; perform an unspecified volatile operation on all memory.
9150 ;; The address range for an icache flush must lie within a single
9151 ;; space on targets with non-equivalent space registers.
9153 ;; This is used by the trampoline code for nested functions.
9155 ;; Operand 0 contains the start address.
9156 ;; Operand 1 contains the end address.
9157 ;; Operand 2 contains the line length to use.
9158 ;; Operands 3 and 4 (icacheflush) are clobbered scratch registers.
9159 (define_insn "dcacheflush"
9161 (unspec_volatile [(mem:BLK (scratch))] UNSPECV_DCACHE)
9162 (use (match_operand 0 "pmode_register_operand" "r"))
9163 (use (match_operand 1 "pmode_register_operand" "r"))
9164 (use (match_operand 2 "pmode_register_operand" "r"))
9165 (clobber (match_scratch 3 "=&0"))]
9170 return \"cmpb,*<<=,n %3,%1,.\;fdc,m %2(%3)\;sync\";
9172 return \"cmpb,<<=,n %3,%1,.\;fdc,m %2(%3)\;sync\";
9174 [(set_attr "type" "multi")
9175 (set_attr "length" "12")])
9177 (define_insn "icacheflush"
9179 (unspec_volatile [(mem:BLK (scratch))] UNSPECV_ICACHE)
9180 (use (match_operand 0 "pmode_register_operand" "r"))
9181 (use (match_operand 1 "pmode_register_operand" "r"))
9182 (use (match_operand 2 "pmode_register_operand" "r"))
9183 (clobber (match_operand 3 "pmode_register_operand" "=&r"))
9184 (clobber (match_operand 4 "pmode_register_operand" "=&r"))
9185 (clobber (match_scratch 5 "=&0"))]
9190 return \"mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,*<<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop\";
9192 return \"mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,<<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop\";
9194 [(set_attr "type" "multi")
9195 (set_attr "length" "52")])
9197 ;; An out-of-line prologue.
9198 (define_insn "outline_prologue_call"
9199 [(unspec_volatile [(const_int 0)] UNSPECV_OPC)
9200 (clobber (reg:SI 31))
9201 (clobber (reg:SI 22))
9202 (clobber (reg:SI 21))
9203 (clobber (reg:SI 20))
9204 (clobber (reg:SI 19))
9205 (clobber (reg:SI 1))]
9209 extern int frame_pointer_needed;
9211 /* We need two different versions depending on whether or not we
9212 need a frame pointer. Also note that we return to the instruction
9213 immediately after the branch rather than two instructions after the
9214 break as normally is the case. */
9215 if (frame_pointer_needed)
9217 /* Must import the magic millicode routine(s). */
9218 output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
9220 if (TARGET_PORTABLE_RUNTIME)
9222 output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
9223 output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
9227 output_asm_insn (\"{bl|b,l},n __outline_prologue_fp,%%r31\", NULL);
9231 /* Must import the magic millicode routine(s). */
9232 output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
9234 if (TARGET_PORTABLE_RUNTIME)
9236 output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
9237 output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
9240 output_asm_insn (\"{bl|b,l},n __outline_prologue,%%r31\", NULL);
9244 [(set_attr "type" "multi")
9245 (set_attr "length" "8")])
9247 ;; An out-of-line epilogue.
9248 (define_insn "outline_epilogue_call"
9249 [(unspec_volatile [(const_int 1)] UNSPECV_OEC)
9252 (clobber (reg:SI 31))
9253 (clobber (reg:SI 22))
9254 (clobber (reg:SI 21))
9255 (clobber (reg:SI 20))
9256 (clobber (reg:SI 19))
9257 (clobber (reg:SI 2))
9258 (clobber (reg:SI 1))]
9262 extern int frame_pointer_needed;
9264 /* We need two different versions depending on whether or not we
9265 need a frame pointer. Also note that we return to the instruction
9266 immediately after the branch rather than two instructions after the
9267 break as normally is the case. */
9268 if (frame_pointer_needed)
9270 /* Must import the magic millicode routine. */
9271 output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
9273 /* The out-of-line prologue will make sure we return to the right
9275 if (TARGET_PORTABLE_RUNTIME)
9277 output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
9278 output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
9282 output_asm_insn (\"{bl|b,l},n __outline_epilogue_fp,%%r31\", NULL);
9286 /* Must import the magic millicode routine. */
9287 output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
9289 /* The out-of-line prologue will make sure we return to the right
9291 if (TARGET_PORTABLE_RUNTIME)
9293 output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
9294 output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
9297 output_asm_insn (\"{bl|b,l},n __outline_epilogue,%%r31\", NULL);
9301 [(set_attr "type" "multi")
9302 (set_attr "length" "8")])
9304 ;; Given a function pointer, canonicalize it so it can be
9305 ;; reliably compared to another function pointer. */
9306 (define_expand "canonicalize_funcptr_for_compare"
9307 [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
9308 (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9309 (clobber (match_dup 2))
9310 (clobber (reg:SI 26))
9311 (clobber (reg:SI 22))
9312 (clobber (reg:SI 31))])
9313 (set (match_operand:SI 0 "register_operand" "")
9315 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
9320 rtx canonicalize_funcptr_for_compare_libfunc
9321 = init_one_libfunc (CANONICALIZE_FUNCPTR_FOR_COMPARE_LIBCALL);
9323 emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
9324 operands[0], LCT_NORMAL, Pmode,
9325 1, operands[1], Pmode);
9329 operands[2] = gen_reg_rtx (SImode);
9330 if (GET_CODE (operands[1]) != REG)
9332 rtx tmp = gen_reg_rtx (Pmode);
9333 emit_move_insn (tmp, operands[1]);
9338 (define_insn "*$$sh_func_adrs"
9339 [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9340 (clobber (match_operand:SI 0 "register_operand" "=a"))
9341 (clobber (reg:SI 26))
9342 (clobber (reg:SI 22))
9343 (clobber (reg:SI 31))]
9347 int length = get_attr_length (insn);
9350 xoperands[0] = GEN_INT (length - 8);
9351 xoperands[1] = GEN_INT (length - 16);
9353 /* Must import the magic millicode routine. */
9354 output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
9356 /* This is absolutely amazing.
9358 First, copy our input parameter into %r29 just in case we don't
9359 need to call $$sh_func_adrs. */
9360 output_asm_insn (\"copy %%r26,%%r29\", NULL);
9361 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\", NULL);
9363 /* Next, examine the low two bits in %r26, if they aren't 0x2, then
9364 we use %r26 unchanged. */
9365 output_asm_insn (\"{comib|cmpib},<>,n 2,%%r31,.+%0\", xoperands);
9366 output_asm_insn (\"ldi 4096,%%r31\", NULL);
9368 /* Next, compare %r26 with 4096, if %r26 is less than or equal to
9369 4096, then again we use %r26 unchanged. */
9370 output_asm_insn (\"{comb|cmpb},<<,n %%r26,%%r31,.+%1\", xoperands);
9372 /* Finally, call $$sh_func_adrs to extract the function's real add24. */
9373 return output_millicode_call (insn,
9374 gen_rtx_SYMBOL_REF (SImode,
9375 \"$$sh_func_adrs\"));
9377 [(set_attr "type" "multi")
9378 (set (attr "length")
9379 (plus (symbol_ref "attr_length_millicode_call (insn)")
9382 ;; On the PA, the PIC register is call clobbered, so it must
9383 ;; be saved & restored around calls by the caller. If the call
9384 ;; doesn't return normally (nonlocal goto, or an exception is
9385 ;; thrown), then the code at the exception handler label must
9386 ;; restore the PIC register.
9387 (define_expand "exception_receiver"
9392 /* On the 64-bit port, we need a blockage because there is
9393 confusion regarding the dependence of the restore on the
9394 frame pointer. As a result, the frame pointer and pic
9395 register restores sometimes are interchanged erroneously. */
9397 emit_insn (gen_blockage ());
9398 /* Restore the PIC register using hppa_pic_save_rtx (). The
9399 PIC register is not saved in the frame in 64-bit ABI. */
9400 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9401 emit_insn (gen_blockage ());
9405 (define_expand "builtin_setjmp_receiver"
9406 [(label_ref (match_operand 0 "" ""))]
9411 emit_insn (gen_blockage ());
9412 /* Restore the PIC register. Hopefully, this will always be from
9413 a stack slot. The only registers that are valid after a
9414 builtin_longjmp are the stack and frame pointers. */
9415 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9416 emit_insn (gen_blockage ());
9420 ;; Allocate new stack space and update the saved stack pointer in the
9421 ;; frame marker. The HP C compilers also copy additional words in the
9422 ;; frame marker. The 64-bit compiler copies words at -48, -32 and -24.
9423 ;; The 32-bit compiler copies the word at -16 (Static Link). We
9424 ;; currently don't copy these values.
9426 ;; Since the copy of the frame marker can't be done atomically, I
9427 ;; suspect that using it for unwind purposes may be somewhat unreliable.
9428 ;; The HP compilers appear to raise the stack and copy the frame
9429 ;; marker in a strict instruction sequence. This suggests that the
9430 ;; unwind library may check for an alloca sequence when ALLOCA_FRAME
9431 ;; is set in the callinfo data. We currently don't set ALLOCA_FRAME
9432 ;; as GAS doesn't support it, or try to keep the instructions emitted
9433 ;; here in strict sequence.
9434 (define_expand "allocate_stack"
9435 [(match_operand 0 "" "")
9436 (match_operand 1 "" "")]
9442 /* Since the stack grows upward, we need to store virtual_stack_dynamic_rtx
9443 in operand 0 before adjusting the stack. */
9444 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9445 anti_adjust_stack (operands[1]);
9446 if (TARGET_HPUX_UNWIND_LIBRARY)
9448 addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx,
9449 GEN_INT (TARGET_64BIT ? -8 : -4));
9450 emit_move_insn (gen_rtx_MEM (word_mode, addr), frame_pointer_rtx);
9452 if (!TARGET_64BIT && flag_pic)
9454 rtx addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx, GEN_INT (-32));
9455 emit_move_insn (gen_rtx_MEM (word_mode, addr), pic_offset_table_rtx);
9460 (define_expand "prefetch"
9461 [(match_operand 0 "address_operand" "")
9462 (match_operand 1 "const_int_operand" "")
9463 (match_operand 2 "const_int_operand" "")]
9466 int locality = INTVAL (operands[2]);
9468 gcc_assert (locality >= 0 && locality <= 3);
9470 /* Change operand[0] to a MEM as we don't have the infrastructure
9471 to output all the supported address modes for ldw/ldd when we use
9472 the address directly. However, we do have it for MEMs. */
9473 operands[0] = gen_rtx_MEM (QImode, operands[0]);
9475 /* If the address isn't valid for the prefetch, replace it. */
9478 if (!prefetch_nocc_operand (operands[0], QImode))
9480 = replace_equiv_address (operands[0],
9481 copy_to_mode_reg (Pmode,
9482 XEXP (operands[0], 0)));
9483 emit_insn (gen_prefetch_nocc (operands[0], operands[1], operands[2]));
9487 if (!prefetch_cc_operand (operands[0], QImode))
9489 = replace_equiv_address (operands[0],
9490 copy_to_mode_reg (Pmode,
9491 XEXP (operands[0], 0)));
9492 emit_insn (gen_prefetch_cc (operands[0], operands[1], operands[2]));
9497 (define_insn "prefetch_cc"
9498 [(prefetch (match_operand:QI 0 "prefetch_cc_operand" "RW")
9499 (match_operand:SI 1 "const_int_operand" "n")
9500 (match_operand:SI 2 "const_int_operand" "n"))]
9501 "TARGET_PA_20 && operands[2] == const0_rtx"
9503 /* The SL cache-control completor indicates good spatial locality but
9504 poor temporal locality. The ldw instruction with a target of general
9505 register 0 prefetches a cache line for a read. The ldd instruction
9506 prefetches a cache line for a write. */
9507 static const char * const instr[2] = {
9508 "ldw%M0,sl %0,%%r0",
9511 int read_or_write = INTVAL (operands[1]);
9513 gcc_assert (read_or_write >= 0 && read_or_write <= 1);
9515 return instr [read_or_write];
9517 [(set_attr "type" "load")
9518 (set_attr "length" "4")])
9520 (define_insn "prefetch_nocc"
9521 [(prefetch (match_operand:QI 0 "prefetch_nocc_operand" "A,RQ")
9522 (match_operand:SI 1 "const_int_operand" "n,n")
9523 (match_operand:SI 2 "const_int_operand" "n,n"))]
9524 "TARGET_PA_20 && operands[2] != const0_rtx"
9526 /* The ldw instruction with a target of general register 0 prefetches
9527 a cache line for a read. The ldd instruction prefetches a cache line
9529 static const char * const instr[2][2] = {
9539 int read_or_write = INTVAL (operands[1]);
9541 gcc_assert (which_alternative == 0 || which_alternative == 1);
9542 gcc_assert (read_or_write >= 0 && read_or_write <= 1);
9544 return instr [which_alternative][read_or_write];
9546 [(set_attr "type" "load")
9547 (set_attr "length" "4")])
9551 (define_insn "tgd_load"
9552 [(set (match_operand:SI 0 "register_operand" "=r")
9553 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
9554 (clobber (reg:SI 1))
9559 return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
9561 [(set_attr "type" "multi")
9562 (set_attr "length" "8")])
9564 (define_insn "tgd_load_pic"
9565 [(set (match_operand:SI 0 "register_operand" "=r")
9566 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
9567 (clobber (reg:SI 1))
9572 return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
9574 [(set_attr "type" "multi")
9575 (set_attr "length" "8")])
9577 (define_insn "tld_load"
9578 [(set (match_operand:SI 0 "register_operand" "=r")
9579 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
9580 (clobber (reg:SI 1))
9585 return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
9587 [(set_attr "type" "multi")
9588 (set_attr "length" "8")])
9590 (define_insn "tld_load_pic"
9591 [(set (match_operand:SI 0 "register_operand" "=r")
9592 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
9593 (clobber (reg:SI 1))
9598 return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
9600 [(set_attr "type" "multi")
9601 (set_attr "length" "8")])
9603 (define_insn "tld_offset_load"
9604 [(set (match_operand:SI 0 "register_operand" "=r")
9605 (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")]
9607 (match_operand:SI 2 "register_operand" "r")))
9608 (clobber (reg:SI 1))]
9612 return \"addil LR'%1-$tls_dtpoff$,%2\;ldo RR'%1-$tls_dtpoff$(%%r1),%0\";
9614 [(set_attr "type" "multi")
9615 (set_attr "length" "8")])
9617 (define_insn "tp_load"
9618 [(set (match_operand:SI 0 "register_operand" "=r")
9619 (unspec:SI [(const_int 0)] UNSPEC_TP))]
9622 [(set_attr "type" "multi")
9623 (set_attr "length" "4")])
9625 (define_insn "tie_load"
9626 [(set (match_operand:SI 0 "register_operand" "=r")
9627 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
9628 (clobber (reg:SI 1))
9633 return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
9635 [(set_attr "type" "multi")
9636 (set_attr "length" "8")])
9638 (define_insn "tie_load_pic"
9639 [(set (match_operand:SI 0 "register_operand" "=r")
9640 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
9641 (clobber (reg:SI 1))
9646 return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
9648 [(set_attr "type" "multi")
9649 (set_attr "length" "8")])
9651 (define_insn "tle_load"
9652 [(set (match_operand:SI 0 "register_operand" "=r")
9653 (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")]
9655 (match_operand:SI 2 "register_operand" "r")))
9656 (clobber (reg:SI 1))]
9658 "addil LR'%1-$tls_leoff$,%2\;ldo RR'%1-$tls_leoff$(%%r1),%0"
9659 [(set_attr "type" "multi")
9660 (set_attr "length" "8")])