1 ;;- Machine description for HP PA-RISC architecture for GCC compiler
2 ;; Copyright (C) 1992-2016 Free Software Foundation, Inc.
3 ;; Contributed by the Center for Software Science at the University
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;; This machine description is inspired by sparc.md and to a lesser
25 ;; Possible improvements:
27 ;; * With PA1.1, most computational instructions can conditionally nullify
28 ;; the execution of the following instruction. A nullified instruction
29 ;; does not cause the instruction pipeline to stall, making it a very
30 ;; efficient alternative to e.g. branching or conditional moves.
32 ;; Nullification is performed conditionally based on the outcome of a
33 ;; test specified in the opcode. The test result is stored in PSW[N]
34 ;; and can only be used to nullify the instruction following immediately
35 ;; after the test. For example:
39 ;; sub,< %r26,%r25,%r28
40 ;; sub %r28,%r25,%r28 ; %r28 == 0
41 ;; sub,> %r26,%r25,%r29
42 ;; sub %r29,%r25,%r29 ; %r29 == 5
44 ;; This could be tricky to implement because the result of the test has
45 ;; to be propagated one instruction forward, which, in the worst case,
46 ;; would involve (1) adding a fake register for PSW[N]; (2) adding the
47 ;; variants of the computational instructions that set or consume this
48 ;; fake register. The cond_exec infrastructure is probably not helpful
51 ;; * PA-RISC includes a set of conventions for branch instruction usage
52 ;; to indicate whether a particular branch is more likely to be taken
53 ;; or not taken. For example, the prediction for CMPB instructions
54 ;; (CMPB,cond,n r1,r2,target) depends on the direction of the branch
55 ;; (forward or backward) and on the order of the operands:
57 ;; | branch | operand | branch |
58 ;; | direction | compare | prediction |
59 ;; +-----------+----------+------------+
60 ;; | backward | r1 < r2 | taken |
61 ;; | backward | r1 >= r2 | not taken |
62 ;; | forward | r1 < r2 | not taken |
63 ;; | forward | r1 >= r2 | taken |
65 ;; By choosing instructions and operand order carefully, the compiler
66 ;; could give the CPU branch predictor some help.
69 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
71 ;; Uses of UNSPEC in this file:
73 (define_c_enum "unspec"
74 [UNSPEC_CFFC ; canonicalize_funcptr_for_compare
75 UNSPEC_GOTO ; indirect_goto
91 (define_c_enum "unspecv"
92 [UNSPECV_BLOCKAGE ; blockage
93 UNSPECV_DCACHE ; dcacheflush
94 UNSPECV_ICACHE ; icacheflush
95 UNSPECV_OPC ; outline_prologue_call
96 UNSPECV_OEC ; outline_epilogue_call
97 UNSPECV_LONGJMP ; builtin_longjmp
100 ;; Maximum pc-relative branch offsets.
102 ;; These numbers are a bit smaller than the maximum allowable offsets
103 ;; so that a few instructions may be inserted before the actual branch.
106 [(MAX_12BIT_OFFSET 8184) ; 12-bit branch
107 (MAX_17BIT_OFFSET 262100) ; 17-bit branch
110 ;; Mode and code iterators
112 ;; This mode iterator allows :P to be used for patterns that operate on
113 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
114 (define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
116 ;; This attribute defines the condition prefix for word and double word
117 ;; add, compare, subtract and logical instructions.
118 (define_mode_attr dwc [(SI "") (DI "*")])
120 ;; Insn type. Used to default other attribute values.
122 ;; type "unary" insns have one input operand (1) and one output operand (0)
123 ;; type "binary" insns have two input operands (1,2) and one output (0)
126 "move,unary,binary,shift,nullshift,compare,load,store,uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,fpload,fpstore,fpalu,fpcc,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,multi,milli,sh_func_adrs,parallel_branch,fpstore_load,store_fpload,trap"
127 (const_string "binary"))
129 (define_attr "pa_combine_type"
130 "fmpy,faddsub,uncond_branch,addmove,none"
131 (const_string "none"))
133 ;; Processor type (for scheduling, not code generation) -- this attribute
134 ;; must exactly match the processor_type enumeration in pa.h.
136 ;; FIXME: Add 800 scheduling for completeness?
138 (define_attr "cpu" "700,7100,7100LC,7200,7300,8000" (const (symbol_ref "pa_cpu_attr")))
140 ;; Length (in # of bytes).
141 (define_attr "length" ""
142 (cond [(eq_attr "type" "load,fpload")
143 (if_then_else (match_operand 1 "symbolic_memory_operand" "")
144 (const_int 8) (const_int 4))
146 (eq_attr "type" "store,fpstore")
147 (if_then_else (match_operand 0 "symbolic_memory_operand" "")
148 (const_int 8) (const_int 4))
150 (eq_attr "type" "binary,shift,nullshift")
151 (if_then_else (match_operand 2 "arith14_operand" "")
152 (const_int 4) (const_int 12))
154 (eq_attr "type" "move,unary,shift,nullshift")
155 (if_then_else (match_operand 1 "arith14_operand" "")
156 (const_int 4) (const_int 8))]
160 (define_asm_attributes
161 [(set_attr "length" "4")
162 (set_attr "type" "multi")])
164 ;; Attributes for instruction and branch scheduling
166 ;; For conditional branches. Frame related instructions are not allowed
167 ;; because they confuse the unwind support.
168 (define_attr "in_branch_delay" "false,true"
169 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch,trap")
170 (eq_attr "length" "4")
171 (not (match_test "RTX_FRAME_RELATED_P (insn)")))
172 (const_string "true")
173 (const_string "false")))
175 ;; Disallow instructions which use the FPU since they will tie up the FPU
176 ;; even if the instruction is nullified.
177 (define_attr "in_nullified_branch_delay" "false,true"
178 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch,trap")
179 (eq_attr "length" "4")
180 (not (match_test "RTX_FRAME_RELATED_P (insn)")))
181 (const_string "true")
182 (const_string "false")))
184 ;; For calls and millicode calls.
185 (define_attr "in_call_delay" "false,true"
186 (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch,trap")
187 (eq_attr "length" "4")
188 (not (match_test "RTX_FRAME_RELATED_P (insn)")))
189 (const_string "true")
190 (const_string "false")))
192 ;; Call delay slot description.
193 (define_delay (eq_attr "type" "call")
194 [(eq_attr "in_call_delay" "true") (nil) (nil)])
196 ;; Sibcall delay slot description.
197 (define_delay (eq_attr "type" "sibcall")
198 [(eq_attr "in_call_delay" "true") (nil) (nil)])
200 ;; Millicode call delay slot description.
201 (define_delay (eq_attr "type" "milli")
202 [(eq_attr "in_call_delay" "true") (nil) (nil)])
204 ;; Return and other similar instructions.
205 (define_delay (eq_attr "type" "branch,parallel_branch")
206 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
208 ;; Floating point conditional branch delay slot description.
209 (define_delay (eq_attr "type" "fbranch")
210 [(eq_attr "in_branch_delay" "true")
211 (eq_attr "in_nullified_branch_delay" "true")
214 ;; Integer conditional branch delay slot description.
215 ;; Nullification of conditional branches on the PA is dependent on the
216 ;; direction of the branch. Forward branches nullify true and
217 ;; backward branches nullify false. If the direction is unknown
218 ;; then nullification is not allowed.
219 (define_delay (eq_attr "type" "cbranch")
220 [(eq_attr "in_branch_delay" "true")
221 (and (eq_attr "in_nullified_branch_delay" "true")
222 (attr_flag "forward"))
223 (and (eq_attr "in_nullified_branch_delay" "true")
224 (attr_flag "backward"))])
226 (define_delay (eq_attr "type" "uncond_branch")
227 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
229 ;; Memory. Disregarding Cache misses, the Mustang memory times are:
230 ;; load: 2, fpload: 3
231 ;; store, fpstore: 3, no D-cache operations should be scheduled.
233 ;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
235 ;; Instruction Time Unit Minimum Distance (unit contention)
242 ;; fmpyadd 3 ALU,MPY 2
243 ;; fmpysub 3 ALU,MPY 2
244 ;; fmpycfxt 3 ALU,MPY 2
247 ;; fdiv,sgl 10 MPY 10
248 ;; fdiv,dbl 12 MPY 12
249 ;; fsqrt,sgl 14 MPY 14
250 ;; fsqrt,dbl 18 MPY 18
252 ;; We don't model fmpyadd/fmpysub properly as those instructions
253 ;; keep both the FP ALU and MPY units busy. Given that these
254 ;; processors are obsolete, I'm not going to spend the time to
255 ;; model those instructions correctly.
257 (define_automaton "pa700")
258 (define_cpu_unit "dummy_700,mem_700,fpalu_700,fpmpy_700" "pa700")
260 (define_insn_reservation "W0" 4
261 (and (eq_attr "type" "fpcc")
262 (eq_attr "cpu" "700"))
265 (define_insn_reservation "W1" 3
266 (and (eq_attr "type" "fpalu")
267 (eq_attr "cpu" "700"))
270 (define_insn_reservation "W2" 3
271 (and (eq_attr "type" "fpmulsgl,fpmuldbl")
272 (eq_attr "cpu" "700"))
275 (define_insn_reservation "W3" 10
276 (and (eq_attr "type" "fpdivsgl")
277 (eq_attr "cpu" "700"))
280 (define_insn_reservation "W4" 12
281 (and (eq_attr "type" "fpdivdbl")
282 (eq_attr "cpu" "700"))
285 (define_insn_reservation "W5" 14
286 (and (eq_attr "type" "fpsqrtsgl")
287 (eq_attr "cpu" "700"))
290 (define_insn_reservation "W6" 18
291 (and (eq_attr "type" "fpsqrtdbl")
292 (eq_attr "cpu" "700"))
295 (define_insn_reservation "W7" 2
296 (and (eq_attr "type" "load")
297 (eq_attr "cpu" "700"))
300 (define_insn_reservation "W8" 2
301 (and (eq_attr "type" "fpload")
302 (eq_attr "cpu" "700"))
305 (define_insn_reservation "W9" 3
306 (and (eq_attr "type" "store")
307 (eq_attr "cpu" "700"))
310 (define_insn_reservation "W10" 3
311 (and (eq_attr "type" "fpstore")
312 (eq_attr "cpu" "700"))
315 (define_insn_reservation "W11" 5
316 (and (eq_attr "type" "fpstore_load")
317 (eq_attr "cpu" "700"))
320 (define_insn_reservation "W12" 6
321 (and (eq_attr "type" "store_fpload")
322 (eq_attr "cpu" "700"))
325 (define_insn_reservation "W13" 1
326 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,load,fpload,store,fpstore,fpstore_load,store_fpload")
327 (eq_attr "cpu" "700"))
330 ;; We have a bypass for all computations in the FP unit which feed an
331 ;; FP store as long as the sizes are the same.
332 (define_bypass 2 "W1,W2" "W10,W11" "pa_fpstore_bypass_p")
333 (define_bypass 9 "W3" "W10,W11" "pa_fpstore_bypass_p")
334 (define_bypass 11 "W4" "W10,W11" "pa_fpstore_bypass_p")
335 (define_bypass 13 "W5" "W10,W11" "pa_fpstore_bypass_p")
336 (define_bypass 17 "W6" "W10,W11" "pa_fpstore_bypass_p")
338 ;; We have an "anti-bypass" for FP loads which feed an FP store.
339 (define_bypass 4 "W8,W12" "W10,W11" "pa_fpstore_bypass_p")
341 ;; Function units for the 7100 and 7150. The 7100/7150 can dual-issue
342 ;; floating point computations with non-floating point computations (fp loads
343 ;; and stores are not fp computations).
345 ;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
346 ;; take two cycles, during which no Dcache operations should be scheduled.
347 ;; Any special cases are handled in pa_adjust_cost. The 7100, 7150 and 7100LC
348 ;; all have the same memory characteristics if one disregards cache misses.
350 ;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
351 ;; There's no value in modeling the ALU and MUL separately though
352 ;; since there can never be a functional unit conflict given the
353 ;; latency and issue rates for those units.
356 ;; Instruction Time Unit Minimum Distance (unit contention)
363 ;; fmpyadd 2 ALU,MPY 1
364 ;; fmpysub 2 ALU,MPY 1
365 ;; fmpycfxt 2 ALU,MPY 1
369 ;; fdiv,dbl 15 DIV 15
371 ;; fsqrt,dbl 15 DIV 15
373 (define_automaton "pa7100")
374 (define_cpu_unit "i_7100, f_7100,fpmac_7100,fpdivsqrt_7100,mem_7100" "pa7100")
376 (define_insn_reservation "X0" 2
377 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
378 (eq_attr "cpu" "7100"))
381 (define_insn_reservation "X1" 8
382 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
383 (eq_attr "cpu" "7100"))
384 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*7")
386 (define_insn_reservation "X2" 15
387 (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
388 (eq_attr "cpu" "7100"))
389 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*14")
391 (define_insn_reservation "X3" 2
392 (and (eq_attr "type" "load")
393 (eq_attr "cpu" "7100"))
396 (define_insn_reservation "X4" 2
397 (and (eq_attr "type" "fpload")
398 (eq_attr "cpu" "7100"))
401 (define_insn_reservation "X5" 2
402 (and (eq_attr "type" "store")
403 (eq_attr "cpu" "7100"))
404 "i_7100+mem_7100,mem_7100")
406 (define_insn_reservation "X6" 2
407 (and (eq_attr "type" "fpstore")
408 (eq_attr "cpu" "7100"))
409 "i_7100+mem_7100,mem_7100")
411 (define_insn_reservation "X7" 4
412 (and (eq_attr "type" "fpstore_load")
413 (eq_attr "cpu" "7100"))
414 "i_7100+mem_7100,mem_7100*3")
416 (define_insn_reservation "X8" 4
417 (and (eq_attr "type" "store_fpload")
418 (eq_attr "cpu" "7100"))
419 "i_7100+mem_7100,mem_7100*3")
421 (define_insn_reservation "X9" 1
422 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,fpstore_load,store_fpload")
423 (eq_attr "cpu" "7100"))
426 ;; We have a bypass for all computations in the FP unit which feed an
427 ;; FP store as long as the sizes are the same.
428 (define_bypass 1 "X0" "X6,X7" "pa_fpstore_bypass_p")
429 (define_bypass 7 "X1" "X6,X7" "pa_fpstore_bypass_p")
430 (define_bypass 14 "X2" "X6,X7" "pa_fpstore_bypass_p")
432 ;; We have an "anti-bypass" for FP loads which feed an FP store.
433 (define_bypass 3 "X4,X8" "X6,X7" "pa_fpstore_bypass_p")
435 ;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
436 ;; There's no value in modeling the ALU and MUL separately though
437 ;; since there can never be a functional unit conflict that
438 ;; can be avoided given the latency, issue rates and mandatory
439 ;; one cycle cpu-wide lock for a double precision fp multiply.
442 ;; Instruction Time Unit Minimum Distance (unit contention)
449 ;; fmpyadd,sgl 2 ALU,MPY 1
450 ;; fmpyadd,dbl 3 ALU,MPY 2
451 ;; fmpysub,sgl 2 ALU,MPY 1
452 ;; fmpysub,dbl 3 ALU,MPY 2
453 ;; fmpycfxt,sgl 2 ALU,MPY 1
454 ;; fmpycfxt,dbl 3 ALU,MPY 2
459 ;; fdiv,dbl 15 DIV 15
461 ;; fsqrt,dbl 15 DIV 15
463 ;; The PA7200 is just like the PA7100LC except that there is
464 ;; no store-store penalty.
466 ;; The PA7300 is just like the PA7200 except that there is
467 ;; no store-load penalty.
469 ;; Note there are some aspects of the 7100LC we are not modeling
470 ;; at the moment. I'll be reviewing the 7100LC scheduling info
471 ;; shortly and updating this description.
475 ;; other issue modeling
477 (define_automaton "pa7100lc")
478 (define_cpu_unit "i0_7100lc, i1_7100lc, f_7100lc" "pa7100lc")
479 (define_cpu_unit "fpmac_7100lc" "pa7100lc")
480 (define_cpu_unit "mem_7100lc" "pa7100lc")
482 ;; Double precision multiplies lock the entire CPU for one
483 ;; cycle. There is no way to avoid this lock and trying to
484 ;; schedule around the lock is pointless and thus there is no
485 ;; value in trying to model this lock.
487 ;; Not modeling the lock allows us to treat fp multiplies just
488 ;; like any other FP alu instruction. It allows for a smaller
489 ;; DFA and may reduce register pressure.
490 (define_insn_reservation "Y0" 2
491 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
492 (eq_attr "cpu" "7100LC,7200,7300"))
493 "f_7100lc,fpmac_7100lc")
495 ;; fp division and sqrt instructions lock the entire CPU for
496 ;; 7 cycles (single precision) or 14 cycles (double precision).
497 ;; There is no way to avoid this lock and trying to schedule
498 ;; around the lock is pointless and thus there is no value in
499 ;; trying to model this lock. Not modeling the lock allows
500 ;; for a smaller DFA and may reduce register pressure.
501 (define_insn_reservation "Y1" 1
502 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
503 (eq_attr "cpu" "7100LC,7200,7300"))
506 (define_insn_reservation "Y2" 2
507 (and (eq_attr "type" "load")
508 (eq_attr "cpu" "7100LC,7200,7300"))
509 "i1_7100lc+mem_7100lc")
511 (define_insn_reservation "Y3" 2
512 (and (eq_attr "type" "fpload")
513 (eq_attr "cpu" "7100LC,7200,7300"))
514 "i1_7100lc+mem_7100lc")
516 (define_insn_reservation "Y4" 2
517 (and (eq_attr "type" "store")
518 (eq_attr "cpu" "7100LC"))
519 "i1_7100lc+mem_7100lc,mem_7100lc")
521 (define_insn_reservation "Y5" 2
522 (and (eq_attr "type" "fpstore")
523 (eq_attr "cpu" "7100LC"))
524 "i1_7100lc+mem_7100lc,mem_7100lc")
526 (define_insn_reservation "Y6" 4
527 (and (eq_attr "type" "fpstore_load")
528 (eq_attr "cpu" "7100LC"))
529 "i1_7100lc+mem_7100lc,mem_7100lc*3")
531 (define_insn_reservation "Y7" 4
532 (and (eq_attr "type" "store_fpload")
533 (eq_attr "cpu" "7100LC"))
534 "i1_7100lc+mem_7100lc,mem_7100lc*3")
536 (define_insn_reservation "Y8" 1
537 (and (eq_attr "type" "shift,nullshift")
538 (eq_attr "cpu" "7100LC,7200,7300"))
541 (define_insn_reservation "Y9" 1
542 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
543 (eq_attr "cpu" "7100LC,7200,7300"))
544 "(i0_7100lc|i1_7100lc)")
546 ;; The 7200 has a store-load penalty
547 (define_insn_reservation "Y10" 2
548 (and (eq_attr "type" "store")
549 (eq_attr "cpu" "7200"))
550 "i1_7100lc,mem_7100lc")
552 (define_insn_reservation "Y11" 2
553 (and (eq_attr "type" "fpstore")
554 (eq_attr "cpu" "7200"))
555 "i1_7100lc,mem_7100lc")
557 (define_insn_reservation "Y12" 4
558 (and (eq_attr "type" "fpstore_load")
559 (eq_attr "cpu" "7200"))
560 "i1_7100lc,mem_7100lc,i1_7100lc+mem_7100lc")
562 (define_insn_reservation "Y13" 4
563 (and (eq_attr "type" "store_fpload")
564 (eq_attr "cpu" "7200"))
565 "i1_7100lc,mem_7100lc,i1_7100lc+mem_7100lc")
567 ;; The 7300 has no penalty for store-store or store-load
568 (define_insn_reservation "Y14" 2
569 (and (eq_attr "type" "store")
570 (eq_attr "cpu" "7300"))
573 (define_insn_reservation "Y15" 2
574 (and (eq_attr "type" "fpstore")
575 (eq_attr "cpu" "7300"))
578 (define_insn_reservation "Y16" 4
579 (and (eq_attr "type" "fpstore_load")
580 (eq_attr "cpu" "7300"))
581 "i1_7100lc,i1_7100lc+mem_7100lc")
583 (define_insn_reservation "Y17" 4
584 (and (eq_attr "type" "store_fpload")
585 (eq_attr "cpu" "7300"))
586 "i1_7100lc,i1_7100lc+mem_7100lc")
588 ;; We have an "anti-bypass" for FP loads which feed an FP store.
589 (define_bypass 3 "Y3,Y7,Y13,Y17" "Y5,Y6,Y11,Y12,Y15,Y16" "pa_fpstore_bypass_p")
591 ;; Scheduling for the PA8000 is somewhat different than scheduling for a
592 ;; traditional architecture.
594 ;; The PA8000 has a large (56) entry reorder buffer that is split between
595 ;; memory and non-memory operations.
597 ;; The PA8000 can issue two memory and two non-memory operations per cycle to
598 ;; the function units, with the exception of branches and multi-output
599 ;; instructions. The PA8000 can retire two non-memory operations per cycle
600 ;; and two memory operations per cycle, only one of which may be a store.
602 ;; Given the large reorder buffer, the processor can hide most latencies.
603 ;; According to HP, they've got the best results by scheduling for retirement
604 ;; bandwidth with limited latency scheduling for floating point operations.
605 ;; Latency for integer operations and memory references is ignored.
608 ;; We claim floating point operations have a 2 cycle latency and are
609 ;; fully pipelined, except for div and sqrt which are not pipelined and
610 ;; take from 17 to 31 cycles to complete.
612 ;; It's worth noting that there is no way to saturate all the functional
613 ;; units on the PA8000 as there is not enough issue bandwidth.
615 (define_automaton "pa8000")
616 (define_cpu_unit "inm0_8000, inm1_8000, im0_8000, im1_8000" "pa8000")
617 (define_cpu_unit "rnm0_8000, rnm1_8000, rm0_8000, rm1_8000" "pa8000")
618 (define_cpu_unit "store_8000" "pa8000")
619 (define_cpu_unit "f0_8000, f1_8000" "pa8000")
620 (define_cpu_unit "fdivsqrt0_8000, fdivsqrt1_8000" "pa8000")
621 (define_reservation "inm_8000" "inm0_8000 | inm1_8000")
622 (define_reservation "im_8000" "im0_8000 | im1_8000")
623 (define_reservation "rnm_8000" "rnm0_8000 | rnm1_8000")
624 (define_reservation "rm_8000" "rm0_8000 | rm1_8000")
625 (define_reservation "f_8000" "f0_8000 | f1_8000")
626 (define_reservation "fdivsqrt_8000" "fdivsqrt0_8000 | fdivsqrt1_8000")
628 ;; We can issue any two memops per cycle, but we can only retire
629 ;; one memory store per cycle. We assume that the reorder buffer
630 ;; will hide any memory latencies per HP's recommendation.
631 (define_insn_reservation "Z0" 0
633 (eq_attr "type" "load,fpload")
634 (eq_attr "cpu" "8000"))
637 (define_insn_reservation "Z1" 0
639 (eq_attr "type" "store,fpstore")
640 (eq_attr "cpu" "8000"))
641 "im_8000,rm_8000+store_8000")
643 (define_insn_reservation "Z2" 0
644 (and (eq_attr "type" "fpstore_load,store_fpload")
645 (eq_attr "cpu" "8000"))
646 "im_8000,rm_8000+store_8000,im_8000,rm_8000")
648 ;; We can issue and retire two non-memory operations per cycle with
649 ;; a few exceptions (branches). This group catches those we want
650 ;; to assume have zero latency.
651 (define_insn_reservation "Z3" 0
653 (eq_attr "type" "!load,fpload,store,fpstore,uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch,fpcc,fpalu,fpmulsgl,fpmuldbl,fpsqrtsgl,fpsqrtdbl,fpdivsgl,fpdivdbl,fpstore_load,store_fpload")
654 (eq_attr "cpu" "8000"))
657 ;; Branches use both slots in the non-memory issue and
659 (define_insn_reservation "Z4" 0
661 (eq_attr "type" "uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch")
662 (eq_attr "cpu" "8000"))
663 "inm0_8000+inm1_8000,rnm0_8000+rnm1_8000")
665 ;; We partial latency schedule the floating point units.
666 ;; They can issue/retire two at a time in the non-memory
667 ;; units. We fix their latency at 2 cycles and they
668 ;; are fully pipelined.
669 (define_insn_reservation "Z5" 1
671 (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
672 (eq_attr "cpu" "8000"))
673 "inm_8000,f_8000,rnm_8000")
675 ;; The fdivsqrt units are not pipelined and have a very long latency.
676 ;; To keep the DFA from exploding, we do not show all the
677 ;; reservations for the divsqrt unit.
678 (define_insn_reservation "Z6" 17
680 (eq_attr "type" "fpdivsgl,fpsqrtsgl")
681 (eq_attr "cpu" "8000"))
682 "inm_8000,fdivsqrt_8000*6,rnm_8000")
684 (define_insn_reservation "Z7" 31
686 (eq_attr "type" "fpdivdbl,fpsqrtdbl")
687 (eq_attr "cpu" "8000"))
688 "inm_8000,fdivsqrt_8000*6,rnm_8000")
690 ;; Operand and operator predicates and constraints
692 (include "predicates.md")
693 (include "constraints.md")
695 ;; Compare instructions.
696 ;; This controls RTL generation and register allocation.
700 (match_operator:CCFP 2 "comparison_operator"
701 [(match_operand:SF 0 "reg_or_0_operand" "fG")
702 (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
703 "! TARGET_SOFT_FLOAT"
704 "fcmp,sgl,%Y2 %f0,%f1"
705 [(set_attr "length" "4")
706 (set_attr "type" "fpcc")])
710 (match_operator:CCFP 2 "comparison_operator"
711 [(match_operand:DF 0 "reg_or_0_operand" "fG")
712 (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
713 "! TARGET_SOFT_FLOAT"
714 "fcmp,dbl,%Y2 %f0,%f1"
715 [(set_attr "length" "4")
716 (set_attr "type" "fpcc")])
718 ;; Provide a means to emit the movccfp0 and movccfp1 optimization
719 ;; placeholders. This is necessary in rare situations when a
720 ;; placeholder is re-emitted (see PR 8705).
722 (define_expand "movccfp"
724 (match_operand 0 "const_int_operand" ""))]
725 "! TARGET_SOFT_FLOAT"
728 if ((unsigned HOST_WIDE_INT) INTVAL (operands[0]) > 1)
732 ;; The following patterns are optimization placeholders. In almost
733 ;; all cases, the user of the condition code will be simplified and the
734 ;; original condition code setting insn should be eliminated.
736 (define_insn "*movccfp0"
739 "! TARGET_SOFT_FLOAT"
740 "fcmp,dbl,= %%fr0,%%fr0"
741 [(set_attr "length" "4")
742 (set_attr "type" "fpcc")])
744 (define_insn "*movccfp1"
747 "! TARGET_SOFT_FLOAT"
748 "fcmp,dbl,!= %%fr0,%%fr0"
749 [(set_attr "length" "4")
750 (set_attr "type" "fpcc")])
754 (define_expand "cstoresi4"
755 [(set (match_operand:SI 0 "register_operand")
756 (match_operator:SI 1 "ordered_comparison_operator"
757 [(match_operand:SI 2 "reg_or_0_operand" "")
758 (match_operand:SI 3 "arith5_operand" "")]))]
762 ;; Instruction canonicalization puts immediate operands second, which
763 ;; is the reverse of what we want.
766 [(set (match_operand:SI 0 "register_operand" "=r")
767 (match_operator:SI 3 "comparison_operator"
768 [(match_operand:SI 1 "reg_or_0_operand" "rM")
769 (match_operand:SI 2 "arith11_operand" "rI")]))]
771 "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi 1,%0"
772 [(set_attr "type" "binary")
773 (set_attr "length" "8")])
776 [(set (match_operand:DI 0 "register_operand" "=r")
777 (match_operator:DI 3 "comparison_operator"
778 [(match_operand:DI 1 "reg_or_0_operand" "rM")
779 (match_operand:DI 2 "arith11_operand" "rI")]))]
781 "cmp%I2clr,*%B3 %2,%r1,%0\;ldi 1,%0"
782 [(set_attr "type" "binary")
783 (set_attr "length" "8")])
785 (define_insn "iorscc"
786 [(set (match_operand:SI 0 "register_operand" "=r")
787 (ior:SI (match_operator:SI 3 "comparison_operator"
788 [(match_operand:SI 1 "reg_or_0_operand" "rM")
789 (match_operand:SI 2 "arith11_operand" "rI")])
790 (match_operator:SI 6 "comparison_operator"
791 [(match_operand:SI 4 "reg_or_0_operand" "rM")
792 (match_operand:SI 5 "arith11_operand" "rI")])))]
794 "{com%I2clr|cmp%I2clr},%S3 %2,%r1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%r4,%0\;ldi 1,%0"
795 [(set_attr "type" "binary")
796 (set_attr "length" "12")])
799 [(set (match_operand:DI 0 "register_operand" "=r")
800 (ior:DI (match_operator:DI 3 "comparison_operator"
801 [(match_operand:DI 1 "reg_or_0_operand" "rM")
802 (match_operand:DI 2 "arith11_operand" "rI")])
803 (match_operator:DI 6 "comparison_operator"
804 [(match_operand:DI 4 "reg_or_0_operand" "rM")
805 (match_operand:DI 5 "arith11_operand" "rI")])))]
807 "cmp%I2clr,*%S3 %2,%r1,%%r0\;cmp%I5clr,*%B6 %5,%r4,%0\;ldi 1,%0"
808 [(set_attr "type" "binary")
809 (set_attr "length" "12")])
811 ;; Combiner patterns for common operations performed with the output
812 ;; from an scc insn (negscc and incscc).
813 (define_insn "negscc"
814 [(set (match_operand:SI 0 "register_operand" "=r")
815 (neg:SI (match_operator:SI 3 "comparison_operator"
816 [(match_operand:SI 1 "reg_or_0_operand" "rM")
817 (match_operand:SI 2 "arith11_operand" "rI")])))]
819 "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi -1,%0"
820 [(set_attr "type" "binary")
821 (set_attr "length" "8")])
824 [(set (match_operand:DI 0 "register_operand" "=r")
825 (neg:DI (match_operator:DI 3 "comparison_operator"
826 [(match_operand:DI 1 "reg_or_0_operand" "rM")
827 (match_operand:DI 2 "arith11_operand" "rI")])))]
829 "cmp%I2clr,*%B3 %2,%r1,%0\;ldi -1,%0"
830 [(set_attr "type" "binary")
831 (set_attr "length" "8")])
833 ;; Patterns for adding/subtracting the result of a boolean expression from
834 ;; a register. First we have special patterns that make use of the carry
835 ;; bit, and output only two instructions. For the cases we can't in
836 ;; general do in two instructions, the incscc pattern at the end outputs
837 ;; two or three instructions.
840 [(set (match_operand:SI 0 "register_operand" "=r")
841 (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
842 (match_operand:SI 3 "arith11_operand" "rI"))
843 (match_operand:SI 1 "register_operand" "r")))]
845 "sub%I3 %3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
846 [(set_attr "type" "binary")
847 (set_attr "length" "8")])
850 [(set (match_operand:DI 0 "register_operand" "=r")
851 (plus:DI (leu:DI (match_operand:DI 2 "register_operand" "r")
852 (match_operand:DI 3 "arith11_operand" "rI"))
853 (match_operand:DI 1 "register_operand" "r")))]
855 "sub%I3 %3,%2,%%r0\;add,dc %%r0,%1,%0"
856 [(set_attr "type" "binary")
857 (set_attr "length" "8")])
859 ; This need only accept registers for op3, since canonicalization
860 ; replaces geu with gtu when op3 is an integer.
862 [(set (match_operand:SI 0 "register_operand" "=r")
863 (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
864 (match_operand:SI 3 "register_operand" "r"))
865 (match_operand:SI 1 "register_operand" "r")))]
867 "sub %2,%3,%%r0\;{addc|add,c} %%r0,%1,%0"
868 [(set_attr "type" "binary")
869 (set_attr "length" "8")])
872 [(set (match_operand:DI 0 "register_operand" "=r")
873 (plus:DI (geu:DI (match_operand:DI 2 "register_operand" "r")
874 (match_operand:DI 3 "register_operand" "r"))
875 (match_operand:DI 1 "register_operand" "r")))]
877 "sub %2,%3,%%r0\;add,dc %%r0,%1,%0"
878 [(set_attr "type" "binary")
879 (set_attr "length" "8")])
881 ; Match only integers for op3 here. This is used as canonical form of the
882 ; geu pattern when op3 is an integer. Don't match registers since we can't
883 ; make better code than the general incscc pattern.
885 [(set (match_operand:SI 0 "register_operand" "=r")
886 (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
887 (match_operand:SI 3 "int11_operand" "I"))
888 (match_operand:SI 1 "register_operand" "r")))]
890 "addi %k3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
891 [(set_attr "type" "binary")
892 (set_attr "length" "8")])
895 [(set (match_operand:DI 0 "register_operand" "=r")
896 (plus:DI (gtu:DI (match_operand:DI 2 "register_operand" "r")
897 (match_operand:DI 3 "int11_operand" "I"))
898 (match_operand:DI 1 "register_operand" "r")))]
900 "addi %k3,%2,%%r0\;add,dc %%r0,%1,%0"
901 [(set_attr "type" "binary")
902 (set_attr "length" "8")])
904 (define_insn "incscc"
905 [(set (match_operand:SI 0 "register_operand" "=r,r")
906 (plus:SI (match_operator:SI 4 "comparison_operator"
907 [(match_operand:SI 2 "register_operand" "r,r")
908 (match_operand:SI 3 "arith11_operand" "rI,rI")])
909 (match_operand:SI 1 "register_operand" "0,?r")))]
912 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi 1,%0,%0
913 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
914 [(set_attr "type" "binary,binary")
915 (set_attr "length" "8,12")])
918 [(set (match_operand:DI 0 "register_operand" "=r,r")
919 (plus:DI (match_operator:DI 4 "comparison_operator"
920 [(match_operand:DI 2 "register_operand" "r,r")
921 (match_operand:DI 3 "arith11_operand" "rI,rI")])
922 (match_operand:DI 1 "register_operand" "0,?r")))]
925 cmp%I3clr,*%B4 %3,%2,%%r0\;addi 1,%0,%0
926 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
927 [(set_attr "type" "binary,binary")
928 (set_attr "length" "8,12")])
931 [(set (match_operand:SI 0 "register_operand" "=r")
932 (minus:SI (match_operand:SI 1 "register_operand" "r")
933 (gtu:SI (match_operand:SI 2 "register_operand" "r")
934 (match_operand:SI 3 "arith11_operand" "rI"))))]
936 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
937 [(set_attr "type" "binary")
938 (set_attr "length" "8")])
941 [(set (match_operand:DI 0 "register_operand" "=r")
942 (minus:DI (match_operand:DI 1 "register_operand" "r")
943 (gtu:DI (match_operand:DI 2 "register_operand" "r")
944 (match_operand:DI 3 "arith11_operand" "rI"))))]
946 "sub%I3 %3,%2,%%r0\;sub,db %1,%%r0,%0"
947 [(set_attr "type" "binary")
948 (set_attr "length" "8")])
951 [(set (match_operand:SI 0 "register_operand" "=r")
952 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
953 (gtu:SI (match_operand:SI 2 "register_operand" "r")
954 (match_operand:SI 3 "arith11_operand" "rI")))
955 (match_operand:SI 4 "register_operand" "r")))]
957 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
958 [(set_attr "type" "binary")
959 (set_attr "length" "8")])
962 [(set (match_operand:DI 0 "register_operand" "=r")
963 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
964 (gtu:DI (match_operand:DI 2 "register_operand" "r")
965 (match_operand:DI 3 "arith11_operand" "rI")))
966 (match_operand:DI 4 "register_operand" "r")))]
968 "sub%I3 %3,%2,%%r0\;sub,db %1,%4,%0"
969 [(set_attr "type" "binary")
970 (set_attr "length" "8")])
972 ; This need only accept registers for op3, since canonicalization
973 ; replaces ltu with leu when op3 is an integer.
975 [(set (match_operand:SI 0 "register_operand" "=r")
976 (minus:SI (match_operand:SI 1 "register_operand" "r")
977 (ltu:SI (match_operand:SI 2 "register_operand" "r")
978 (match_operand:SI 3 "register_operand" "r"))))]
980 "sub %2,%3,%%r0\;{subb|sub,b} %1,%%r0,%0"
981 [(set_attr "type" "binary")
982 (set_attr "length" "8")])
985 [(set (match_operand:DI 0 "register_operand" "=r")
986 (minus:DI (match_operand:DI 1 "register_operand" "r")
987 (ltu:DI (match_operand:DI 2 "register_operand" "r")
988 (match_operand:DI 3 "register_operand" "r"))))]
990 "sub %2,%3,%%r0\;sub,db %1,%%r0,%0"
991 [(set_attr "type" "binary")
992 (set_attr "length" "8")])
995 [(set (match_operand:SI 0 "register_operand" "=r")
996 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
997 (ltu:SI (match_operand:SI 2 "register_operand" "r")
998 (match_operand:SI 3 "register_operand" "r")))
999 (match_operand:SI 4 "register_operand" "r")))]
1001 "sub %2,%3,%%r0\;{subb|sub,b} %1,%4,%0"
1002 [(set_attr "type" "binary")
1003 (set_attr "length" "8")])
1006 [(set (match_operand:DI 0 "register_operand" "=r")
1007 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1008 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1009 (match_operand:DI 3 "register_operand" "r")))
1010 (match_operand:DI 4 "register_operand" "r")))]
1012 "sub %2,%3,%%r0\;sub,db %1,%4,%0"
1013 [(set_attr "type" "binary")
1014 (set_attr "length" "8")])
1016 ; Match only integers for op3 here. This is used as canonical form of the
1017 ; ltu pattern when op3 is an integer. Don't match registers since we can't
1018 ; make better code than the general incscc pattern.
1020 [(set (match_operand:SI 0 "register_operand" "=r")
1021 (minus:SI (match_operand:SI 1 "register_operand" "r")
1022 (leu:SI (match_operand:SI 2 "register_operand" "r")
1023 (match_operand:SI 3 "int11_operand" "I"))))]
1025 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1026 [(set_attr "type" "binary")
1027 (set_attr "length" "8")])
1030 [(set (match_operand:DI 0 "register_operand" "=r")
1031 (minus:DI (match_operand:DI 1 "register_operand" "r")
1032 (leu:DI (match_operand:DI 2 "register_operand" "r")
1033 (match_operand:DI 3 "int11_operand" "I"))))]
1035 "addi %k3,%2,%%r0\;sub,db %1,%%r0,%0"
1036 [(set_attr "type" "binary")
1037 (set_attr "length" "8")])
1040 [(set (match_operand:SI 0 "register_operand" "=r")
1041 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1042 (leu:SI (match_operand:SI 2 "register_operand" "r")
1043 (match_operand:SI 3 "int11_operand" "I")))
1044 (match_operand:SI 4 "register_operand" "r")))]
1046 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1047 [(set_attr "type" "binary")
1048 (set_attr "length" "8")])
1051 [(set (match_operand:DI 0 "register_operand" "=r")
1052 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1053 (leu:DI (match_operand:DI 2 "register_operand" "r")
1054 (match_operand:DI 3 "int11_operand" "I")))
1055 (match_operand:DI 4 "register_operand" "r")))]
1057 "addi %k3,%2,%%r0\;sub,db %1,%4,%0"
1058 [(set_attr "type" "binary")
1059 (set_attr "length" "8")])
1061 (define_insn "decscc"
1062 [(set (match_operand:SI 0 "register_operand" "=r,r")
1063 (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
1064 (match_operator:SI 4 "comparison_operator"
1065 [(match_operand:SI 2 "register_operand" "r,r")
1066 (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
1069 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi -1,%0,%0
1070 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1071 [(set_attr "type" "binary,binary")
1072 (set_attr "length" "8,12")])
1075 [(set (match_operand:DI 0 "register_operand" "=r,r")
1076 (minus:DI (match_operand:DI 1 "register_operand" "0,?r")
1077 (match_operator:DI 4 "comparison_operator"
1078 [(match_operand:DI 2 "register_operand" "r,r")
1079 (match_operand:DI 3 "arith11_operand" "rI,rI")])))]
1082 cmp%I3clr,*%B4 %3,%2,%%r0\;addi -1,%0,%0
1083 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1084 [(set_attr "type" "binary,binary")
1085 (set_attr "length" "8,12")])
1087 ; Patterns for max and min. (There is no need for an earlyclobber in the
1088 ; last alternative since the middle alternative will match if op0 == op1.)
1090 (define_insn "sminsi3"
1091 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1092 (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1093 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1096 {comclr|cmpclr},> %2,%0,%%r0\;copy %2,%0
1097 {comiclr|cmpiclr},> %2,%0,%%r0\;ldi %2,%0
1098 {comclr|cmpclr},> %1,%r2,%0\;copy %1,%0"
1099 [(set_attr "type" "multi,multi,multi")
1100 (set_attr "length" "8,8,8")])
1102 (define_insn "smindi3"
1103 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1104 (smin:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1105 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1108 cmpclr,*> %2,%0,%%r0\;copy %2,%0
1109 cmpiclr,*> %2,%0,%%r0\;ldi %2,%0
1110 cmpclr,*> %1,%r2,%0\;copy %1,%0"
1111 [(set_attr "type" "multi,multi,multi")
1112 (set_attr "length" "8,8,8")])
1114 (define_insn "uminsi3"
1115 [(set (match_operand:SI 0 "register_operand" "=r,r")
1116 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
1117 (match_operand:SI 2 "arith11_operand" "r,I")))]
1120 {comclr|cmpclr},>> %2,%0,%%r0\;copy %2,%0
1121 {comiclr|cmpiclr},>> %2,%0,%%r0\;ldi %2,%0"
1122 [(set_attr "type" "multi,multi")
1123 (set_attr "length" "8,8")])
1125 (define_insn "umindi3"
1126 [(set (match_operand:DI 0 "register_operand" "=r,r")
1127 (umin:DI (match_operand:DI 1 "register_operand" "%0,0")
1128 (match_operand:DI 2 "arith11_operand" "r,I")))]
1131 cmpclr,*>> %2,%0,%%r0\;copy %2,%0
1132 cmpiclr,*>> %2,%0,%%r0\;ldi %2,%0"
1133 [(set_attr "type" "multi,multi")
1134 (set_attr "length" "8,8")])
1136 (define_insn "smaxsi3"
1137 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1138 (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1139 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1142 {comclr|cmpclr},< %2,%0,%%r0\;copy %2,%0
1143 {comiclr|cmpiclr},< %2,%0,%%r0\;ldi %2,%0
1144 {comclr|cmpclr},< %1,%r2,%0\;copy %1,%0"
1145 [(set_attr "type" "multi,multi,multi")
1146 (set_attr "length" "8,8,8")])
1148 (define_insn "smaxdi3"
1149 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1150 (smax:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1151 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1154 cmpclr,*< %2,%0,%%r0\;copy %2,%0
1155 cmpiclr,*< %2,%0,%%r0\;ldi %2,%0
1156 cmpclr,*< %1,%r2,%0\;copy %1,%0"
1157 [(set_attr "type" "multi,multi,multi")
1158 (set_attr "length" "8,8,8")])
1160 (define_insn "umaxsi3"
1161 [(set (match_operand:SI 0 "register_operand" "=r,r")
1162 (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
1163 (match_operand:SI 2 "arith11_operand" "r,I")))]
1166 {comclr|cmpclr},<< %2,%0,%%r0\;copy %2,%0
1167 {comiclr|cmpiclr},<< %2,%0,%%r0\;ldi %2,%0"
1168 [(set_attr "type" "multi,multi")
1169 (set_attr "length" "8,8")])
1171 (define_insn "umaxdi3"
1172 [(set (match_operand:DI 0 "register_operand" "=r,r")
1173 (umax:DI (match_operand:DI 1 "register_operand" "%0,0")
1174 (match_operand:DI 2 "arith11_operand" "r,I")))]
1177 cmpclr,*<< %2,%0,%%r0\;copy %2,%0
1178 cmpiclr,*<< %2,%0,%%r0\;ldi %2,%0"
1179 [(set_attr "type" "multi,multi")
1180 (set_attr "length" "8,8")])
1182 (define_insn "absqi2"
1183 [(set (match_operand:QI 0 "register_operand" "=r")
1184 (abs:QI (match_operand:QI 1 "register_operand" "r")))]
1186 "{extrs|extrw,s},>= %1,31,8,%0\;subi 0,%0,%0"
1187 [(set_attr "type" "multi")
1188 (set_attr "length" "8")])
1190 (define_insn "abshi2"
1191 [(set (match_operand:HI 0 "register_operand" "=r")
1192 (abs:HI (match_operand:HI 1 "register_operand" "r")))]
1194 "{extrs|extrw,s},>= %1,31,16,%0\;subi 0,%0,%0"
1195 [(set_attr "type" "multi")
1196 (set_attr "length" "8")])
1198 (define_insn "abssi2"
1199 [(set (match_operand:SI 0 "register_operand" "=r")
1200 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1202 "or,>= %%r0,%1,%0\;subi 0,%0,%0"
1203 [(set_attr "type" "multi")
1204 (set_attr "length" "8")])
1206 (define_insn "absdi2"
1207 [(set (match_operand:DI 0 "register_operand" "=r")
1208 (abs:DI (match_operand:DI 1 "register_operand" "r")))]
1210 "or,*>= %%r0,%1,%0\;subi 0,%0,%0"
1211 [(set_attr "type" "multi")
1212 (set_attr "length" "8")])
1214 (define_insn "bswaphi2"
1215 [(set (match_operand:HI 0 "register_operand" "=&r")
1216 (bswap:HI (match_operand:HI 1 "register_operand" "r")))]
1218 "{extru|extrw,u} %1,23,8,%0\;{dep|depw} %1,23,8,%0"
1219 [(set_attr "type" "multi")
1220 (set_attr "length" "8")])
1222 (define_insn "bswapsi2"
1223 [(set (match_operand:SI 0 "register_operand" "=&r")
1224 (bswap:SI (match_operand:SI 1 "register_operand" "r")))]
1226 "{shd|shrpw} %1,%1,16,%0\;{dep|depw} %0,15,8,%0\;{shd|shrpw} %1,%0,8,%0"
1227 [(set_attr "type" "multi")
1228 (set_attr "length" "12")])
1230 (define_insn "bswapdi2"
1231 [(set (match_operand:DI 0 "register_operand" "=&r")
1232 (bswap:DI (match_operand:DI 1 "register_operand" "r")))
1233 (clobber (match_scratch:DI 2 "=r"))]
1235 "permh,3210 %1,%2\;hshl %2,8,%0\;hshr,u %2,8,%2\;or %0,%2,%0"
1236 [(set_attr "type" "multi")
1237 (set_attr "length" "16")])
1239 ;;; Experimental conditional move patterns
1241 (define_expand "movsicc"
1242 [(set (match_operand:SI 0 "register_operand" "")
1244 (match_operand 1 "comparison_operator" "")
1245 (match_operand:SI 2 "reg_or_cint_move_operand" "")
1246 (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
1250 if (GET_MODE (XEXP (operands[1], 0)) != SImode
1251 || GET_MODE (XEXP (operands[1], 0)) != GET_MODE (XEXP (operands[1], 1)))
1255 ;; We used to accept any register for op1.
1257 ;; However, it loses sometimes because the compiler will end up using
1258 ;; different registers for op0 and op1 in some critical cases. local-alloc
1259 ;; will not tie op0 and op1 because op0 is used in multiple basic blocks.
1261 ;; If/when global register allocation supports tying we should allow any
1262 ;; register for op1 again.
1264 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1266 (match_operator 2 "comparison_operator"
1267 [(match_operand:SI 3 "register_operand" "r,r,r,r")
1268 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI")])
1269 (match_operand:SI 1 "reg_or_cint_move_operand" "0,J,N,K")
1273 {com%I4clr|cmp%I4clr},%S2 %4,%3,%%r0\;ldi 0,%0
1274 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldi %1,%0
1275 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldil L'%1,%0
1276 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;{zdepi|depwi,z} %Z1,%0"
1277 [(set_attr "type" "multi,multi,multi,nullshift")
1278 (set_attr "length" "8,8,8,8")])
1281 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1283 (match_operator 5 "comparison_operator"
1284 [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
1285 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1286 (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1287 (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1290 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;copy %2,%0
1291 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldi %2,%0
1292 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldil L'%2,%0
1293 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;{zdepi|depwi,z} %Z2,%0
1294 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;copy %1,%0
1295 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldi %1,%0
1296 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldil L'%1,%0
1297 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;{zdepi|depwi,z} %Z1,%0"
1298 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1299 (set_attr "length" "8,8,8,8,8,8,8,8")])
1301 (define_expand "movdicc"
1302 [(set (match_operand:DI 0 "register_operand" "")
1304 (match_operand 1 "comparison_operator" "")
1305 (match_operand:DI 2 "reg_or_cint_move_operand" "")
1306 (match_operand:DI 3 "reg_or_cint_move_operand" "")))]
1310 if (GET_MODE (XEXP (operands[1], 0)) != DImode
1311 || GET_MODE (XEXP (operands[1], 0)) != GET_MODE (XEXP (operands[1], 1)))
1315 ; We need the first constraint alternative in order to avoid
1316 ; earlyclobbers on all other alternatives.
1318 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1320 (match_operator 2 "comparison_operator"
1321 [(match_operand:DI 3 "register_operand" "r,r,r,r,r")
1322 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
1323 (match_operand:DI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
1327 cmp%I4clr,*%S2 %4,%3,%%r0\;ldi 0,%0
1328 cmp%I4clr,*%B2 %4,%3,%0\;copy %1,%0
1329 cmp%I4clr,*%B2 %4,%3,%0\;ldi %1,%0
1330 cmp%I4clr,*%B2 %4,%3,%0\;ldil L'%1,%0
1331 cmp%I4clr,*%B2 %4,%3,%0\;depdi,z %z1,%0"
1332 [(set_attr "type" "multi,multi,multi,multi,nullshift")
1333 (set_attr "length" "8,8,8,8,8")])
1336 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1338 (match_operator 5 "comparison_operator"
1339 [(match_operand:DI 3 "register_operand" "r,r,r,r,r,r,r,r")
1340 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1341 (match_operand:DI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1342 (match_operand:DI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1345 cmp%I4clr,*%S5 %4,%3,%%r0\;copy %2,%0
1346 cmp%I4clr,*%S5 %4,%3,%%r0\;ldi %2,%0
1347 cmp%I4clr,*%S5 %4,%3,%%r0\;ldil L'%2,%0
1348 cmp%I4clr,*%S5 %4,%3,%%r0\;depdi,z %z2,%0
1349 cmp%I4clr,*%B5 %4,%3,%%r0\;copy %1,%0
1350 cmp%I4clr,*%B5 %4,%3,%%r0\;ldi %1,%0
1351 cmp%I4clr,*%B5 %4,%3,%%r0\;ldil L'%1,%0
1352 cmp%I4clr,*%B5 %4,%3,%%r0\;depdi,z %z1,%0"
1353 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1354 (set_attr "length" "8,8,8,8,8,8,8,8")])
1356 ;; Conditional Branches
1358 (define_expand "cbranchdi4"
1360 (if_then_else (match_operator 0 "ordered_comparison_operator"
1361 [(match_operand:DI 1 "reg_or_0_operand" "")
1362 (match_operand:DI 2 "register_operand" "")])
1363 (label_ref (match_operand 3 "" ""))
1368 (define_expand "cbranchsi4"
1370 (if_then_else (match_operator 0 "ordered_comparison_operator"
1371 [(match_operand:SI 1 "reg_or_0_operand" "")
1372 (match_operand:SI 2 "arith5_operand" "")])
1373 (label_ref (match_operand 3 "" ""))
1378 (define_expand "cbranchsf4"
1380 (if_then_else (match_operator 0 "comparison_operator"
1381 [(match_operand:SF 1 "reg_or_0_operand" "")
1382 (match_operand:SF 2 "reg_or_0_operand" "")])
1383 (label_ref (match_operand 3 "" ""))
1388 pa_emit_bcond_fp (operands);
1393 (define_expand "cbranchdf4"
1395 (if_then_else (match_operator 0 "comparison_operator"
1396 [(match_operand:DF 1 "reg_or_0_operand" "")
1397 (match_operand:DF 2 "reg_or_0_operand" "")])
1398 (label_ref (match_operand 3 "" ""))
1403 pa_emit_bcond_fp (operands);
1407 ;; Match the branch patterns.
1410 ;; Note a long backward conditional branch with an annulled delay slot
1411 ;; has a length of 12.
1415 (match_operator 3 "comparison_operator"
1416 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1417 (match_operand:SI 2 "arith5_operand" "rL")])
1418 (label_ref (match_operand 0 "" ""))
1423 return pa_output_cbranch (operands, 0, insn);
1425 [(set_attr "type" "cbranch")
1426 (set (attr "length")
1427 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1428 (const_int MAX_12BIT_OFFSET))
1430 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1431 (const_int MAX_17BIT_OFFSET))
1433 (match_test "TARGET_PORTABLE_RUNTIME")
1435 (not (match_test "flag_pic"))
1439 ;; Match the negated branch.
1444 (match_operator 3 "comparison_operator"
1445 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1446 (match_operand:SI 2 "arith5_operand" "rL")])
1448 (label_ref (match_operand 0 "" ""))))]
1452 return pa_output_cbranch (operands, 1, insn);
1454 [(set_attr "type" "cbranch")
1455 (set (attr "length")
1456 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1457 (const_int MAX_12BIT_OFFSET))
1459 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1460 (const_int MAX_17BIT_OFFSET))
1462 (match_test "TARGET_PORTABLE_RUNTIME")
1464 (not (match_test "flag_pic"))
1471 (match_operator 3 "comparison_operator"
1472 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1473 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1474 (label_ref (match_operand 0 "" ""))
1479 return pa_output_cbranch (operands, 0, insn);
1481 [(set_attr "type" "cbranch")
1482 (set (attr "length")
1483 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1484 (const_int MAX_12BIT_OFFSET))
1486 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1487 (const_int MAX_17BIT_OFFSET))
1489 (match_test "TARGET_PORTABLE_RUNTIME")
1491 (not (match_test "flag_pic"))
1495 ;; Match the negated branch.
1500 (match_operator 3 "comparison_operator"
1501 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1502 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1504 (label_ref (match_operand 0 "" ""))))]
1508 return pa_output_cbranch (operands, 1, insn);
1510 [(set_attr "type" "cbranch")
1511 (set (attr "length")
1512 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1513 (const_int MAX_12BIT_OFFSET))
1515 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1516 (const_int MAX_17BIT_OFFSET))
1518 (match_test "TARGET_PORTABLE_RUNTIME")
1520 (not (match_test "flag_pic"))
1526 (match_operator 3 "cmpib_comparison_operator"
1527 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1528 (match_operand:DI 2 "arith5_operand" "rL")])
1529 (label_ref (match_operand 0 "" ""))
1534 return pa_output_cbranch (operands, 0, insn);
1536 [(set_attr "type" "cbranch")
1537 (set (attr "length")
1538 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1539 (const_int MAX_12BIT_OFFSET))
1541 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1542 (const_int MAX_17BIT_OFFSET))
1544 (match_test "TARGET_PORTABLE_RUNTIME")
1546 (not (match_test "flag_pic"))
1550 ;; Match the negated branch.
1555 (match_operator 3 "cmpib_comparison_operator"
1556 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1557 (match_operand:DI 2 "arith5_operand" "rL")])
1559 (label_ref (match_operand 0 "" ""))))]
1563 return pa_output_cbranch (operands, 1, insn);
1565 [(set_attr "type" "cbranch")
1566 (set (attr "length")
1567 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1568 (const_int MAX_12BIT_OFFSET))
1570 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1571 (const_int MAX_17BIT_OFFSET))
1573 (match_test "TARGET_PORTABLE_RUNTIME")
1575 (not (match_test "flag_pic"))
1579 ;; Branch on Bit patterns.
1583 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1585 (match_operand:SI 1 "uint5_operand" ""))
1587 (label_ref (match_operand 2 "" ""))
1592 return pa_output_bb (operands, 0, insn, 0);
1594 [(set_attr "type" "cbranch")
1595 (set (attr "length")
1596 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1597 (const_int MAX_12BIT_OFFSET))
1599 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1600 (const_int MAX_17BIT_OFFSET))
1602 (match_test "TARGET_PORTABLE_RUNTIME")
1604 (not (match_test "flag_pic"))
1611 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1613 (match_operand:DI 1 "uint32_operand" ""))
1615 (label_ref (match_operand 2 "" ""))
1620 return pa_output_bb (operands, 0, insn, 0);
1622 [(set_attr "type" "cbranch")
1623 (set (attr "length")
1624 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1625 (const_int MAX_12BIT_OFFSET))
1627 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1628 (const_int MAX_17BIT_OFFSET))
1630 (match_test "TARGET_PORTABLE_RUNTIME")
1632 (not (match_test "flag_pic"))
1639 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1641 (match_operand:SI 1 "uint5_operand" ""))
1644 (label_ref (match_operand 2 "" ""))))]
1648 return pa_output_bb (operands, 1, insn, 0);
1650 [(set_attr "type" "cbranch")
1651 (set (attr "length")
1652 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1653 (const_int MAX_12BIT_OFFSET))
1655 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1656 (const_int MAX_17BIT_OFFSET))
1658 (match_test "TARGET_PORTABLE_RUNTIME")
1660 (not (match_test "flag_pic"))
1667 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1669 (match_operand:DI 1 "uint32_operand" ""))
1672 (label_ref (match_operand 2 "" ""))))]
1676 return pa_output_bb (operands, 1, insn, 0);
1678 [(set_attr "type" "cbranch")
1679 (set (attr "length")
1680 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1681 (const_int MAX_12BIT_OFFSET))
1683 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1684 (const_int MAX_17BIT_OFFSET))
1686 (match_test "TARGET_PORTABLE_RUNTIME")
1688 (not (match_test "flag_pic"))
1695 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1697 (match_operand:SI 1 "uint5_operand" ""))
1699 (label_ref (match_operand 2 "" ""))
1704 return pa_output_bb (operands, 0, insn, 1);
1706 [(set_attr "type" "cbranch")
1707 (set (attr "length")
1708 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1709 (const_int MAX_12BIT_OFFSET))
1711 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1712 (const_int MAX_17BIT_OFFSET))
1714 (match_test "TARGET_PORTABLE_RUNTIME")
1716 (not (match_test "flag_pic"))
1723 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1725 (match_operand:DI 1 "uint32_operand" ""))
1727 (label_ref (match_operand 2 "" ""))
1732 return pa_output_bb (operands, 0, insn, 1);
1734 [(set_attr "type" "cbranch")
1735 (set (attr "length")
1736 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1737 (const_int MAX_12BIT_OFFSET))
1739 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1740 (const_int MAX_17BIT_OFFSET))
1742 (match_test "TARGET_PORTABLE_RUNTIME")
1744 (not (match_test "flag_pic"))
1751 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1753 (match_operand:SI 1 "uint5_operand" ""))
1756 (label_ref (match_operand 2 "" ""))))]
1760 return pa_output_bb (operands, 1, insn, 1);
1762 [(set_attr "type" "cbranch")
1763 (set (attr "length")
1764 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1765 (const_int MAX_12BIT_OFFSET))
1767 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1768 (const_int MAX_17BIT_OFFSET))
1770 (match_test "TARGET_PORTABLE_RUNTIME")
1772 (not (match_test "flag_pic"))
1779 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1781 (match_operand:DI 1 "uint32_operand" ""))
1784 (label_ref (match_operand 2 "" ""))))]
1788 return pa_output_bb (operands, 1, insn, 1);
1790 [(set_attr "type" "cbranch")
1791 (set (attr "length")
1792 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1793 (const_int MAX_12BIT_OFFSET))
1795 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1796 (const_int MAX_17BIT_OFFSET))
1798 (match_test "TARGET_PORTABLE_RUNTIME")
1800 (not (match_test "flag_pic"))
1804 ;; Branch on Variable Bit patterns.
1808 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1810 (match_operand:SI 1 "register_operand" "q"))
1812 (label_ref (match_operand 2 "" ""))
1817 return pa_output_bvb (operands, 0, insn, 0);
1819 [(set_attr "type" "cbranch")
1820 (set (attr "length")
1821 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1822 (const_int MAX_12BIT_OFFSET))
1824 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1825 (const_int MAX_17BIT_OFFSET))
1827 (match_test "TARGET_PORTABLE_RUNTIME")
1829 (not (match_test "flag_pic"))
1836 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1838 (match_operand:DI 1 "register_operand" "q"))
1840 (label_ref (match_operand 2 "" ""))
1845 return pa_output_bvb (operands, 0, insn, 0);
1847 [(set_attr "type" "cbranch")
1848 (set (attr "length")
1849 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1850 (const_int MAX_12BIT_OFFSET))
1852 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1853 (const_int MAX_17BIT_OFFSET))
1855 (match_test "TARGET_PORTABLE_RUNTIME")
1857 (not (match_test "flag_pic"))
1864 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1866 (match_operand:SI 1 "register_operand" "q"))
1869 (label_ref (match_operand 2 "" ""))))]
1873 return pa_output_bvb (operands, 1, insn, 0);
1875 [(set_attr "type" "cbranch")
1876 (set (attr "length")
1877 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1878 (const_int MAX_12BIT_OFFSET))
1880 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1881 (const_int MAX_17BIT_OFFSET))
1883 (match_test "TARGET_PORTABLE_RUNTIME")
1885 (not (match_test "flag_pic"))
1892 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1894 (match_operand:DI 1 "register_operand" "q"))
1897 (label_ref (match_operand 2 "" ""))))]
1901 return pa_output_bvb (operands, 1, insn, 0);
1903 [(set_attr "type" "cbranch")
1904 (set (attr "length")
1905 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1906 (const_int MAX_12BIT_OFFSET))
1908 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1909 (const_int MAX_17BIT_OFFSET))
1911 (match_test "TARGET_PORTABLE_RUNTIME")
1913 (not (match_test "flag_pic"))
1920 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1922 (match_operand:SI 1 "register_operand" "q"))
1924 (label_ref (match_operand 2 "" ""))
1929 return pa_output_bvb (operands, 0, insn, 1);
1931 [(set_attr "type" "cbranch")
1932 (set (attr "length")
1933 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1934 (const_int MAX_12BIT_OFFSET))
1936 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1937 (const_int MAX_17BIT_OFFSET))
1939 (match_test "TARGET_PORTABLE_RUNTIME")
1941 (not (match_test "flag_pic"))
1948 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1950 (match_operand:DI 1 "register_operand" "q"))
1952 (label_ref (match_operand 2 "" ""))
1957 return pa_output_bvb (operands, 0, insn, 1);
1959 [(set_attr "type" "cbranch")
1960 (set (attr "length")
1961 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1962 (const_int MAX_12BIT_OFFSET))
1964 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1965 (const_int MAX_17BIT_OFFSET))
1967 (match_test "TARGET_PORTABLE_RUNTIME")
1969 (not (match_test "flag_pic"))
1976 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1978 (match_operand:SI 1 "register_operand" "q"))
1981 (label_ref (match_operand 2 "" ""))))]
1985 return pa_output_bvb (operands, 1, insn, 1);
1987 [(set_attr "type" "cbranch")
1988 (set (attr "length")
1989 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1990 (const_int MAX_12BIT_OFFSET))
1992 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1993 (const_int MAX_17BIT_OFFSET))
1995 (match_test "TARGET_PORTABLE_RUNTIME")
1997 (not (match_test "flag_pic"))
2004 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2006 (match_operand:DI 1 "register_operand" "q"))
2009 (label_ref (match_operand 2 "" ""))))]
2013 return pa_output_bvb (operands, 1, insn, 1);
2015 [(set_attr "type" "cbranch")
2016 (set (attr "length")
2017 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2018 (const_int MAX_12BIT_OFFSET))
2020 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2021 (const_int MAX_17BIT_OFFSET))
2023 (match_test "TARGET_PORTABLE_RUNTIME")
2025 (not (match_test "flag_pic"))
2029 ;; Floating point branches
2031 ;; ??? Nullification is handled differently from other branches.
2032 ;; If nullification is specified, the delay slot is nullified on any
2033 ;; taken branch regardless of branch direction.
2035 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2036 (label_ref (match_operand 0 "" ""))
2038 "!TARGET_SOFT_FLOAT"
2041 int length = get_attr_length (insn);
2043 int nullify, xdelay;
2046 return \"ftest\;b%* %l0\";
2048 if (dbr_sequence_length () == 0 || INSN_ANNULLED_BRANCH_P (insn))
2052 xoperands[0] = GEN_INT (length - 8);
2058 xoperands[0] = GEN_INT (length - 4);
2062 output_asm_insn (\"ftest\;add,tr %%r0,%%r0,%%r0\;b,n .+%0\", xoperands);
2064 output_asm_insn (\"ftest\;add,tr %%r0,%%r0,%%r0\;b .+%0\", xoperands);
2065 return pa_output_lbranch (operands[0], insn, xdelay);
2067 [(set_attr "type" "fbranch")
2068 (set (attr "length")
2069 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
2070 (const_int MAX_17BIT_OFFSET))
2072 (match_test "TARGET_PORTABLE_RUNTIME")
2074 (not (match_test "flag_pic"))
2079 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2081 (label_ref (match_operand 0 "" ""))))]
2082 "!TARGET_SOFT_FLOAT"
2085 int length = get_attr_length (insn);
2087 int nullify, xdelay;
2090 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b%* %0\";
2092 if (dbr_sequence_length () == 0 || INSN_ANNULLED_BRANCH_P (insn))
2096 xoperands[0] = GEN_INT (length - 4);
2102 xoperands[0] = GEN_INT (length);
2106 output_asm_insn (\"ftest\;b,n .+%0\", xoperands);
2108 output_asm_insn (\"ftest\;b .+%0\", xoperands);
2109 return pa_output_lbranch (operands[0], insn, xdelay);
2111 [(set_attr "type" "fbranch")
2112 (set (attr "length")
2113 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
2114 (const_int MAX_17BIT_OFFSET))
2116 (match_test "TARGET_PORTABLE_RUNTIME")
2118 (not (match_test "flag_pic"))
2122 ;; Move instructions
2124 (define_expand "movsi"
2125 [(set (match_operand:SI 0 "general_operand" "")
2126 (match_operand:SI 1 "general_operand" ""))]
2130 if (pa_emit_move_sequence (operands, SImode, 0))
2134 ;; Handle SImode input reloads requiring %r1 as a scratch register.
2135 (define_expand "reload_insi_r1"
2136 [(set (match_operand:SI 0 "register_operand" "=Z")
2137 (match_operand:SI 1 "non_hard_reg_operand" ""))
2138 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
2142 if (pa_emit_move_sequence (operands, SImode, operands[2]))
2145 /* We don't want the clobber emitted, so handle this ourselves. */
2146 emit_insn (gen_rtx_SET (operands[0], operands[1]));
2150 ;; Handle SImode input reloads requiring a general register as a
2151 ;; scratch register.
2152 (define_expand "reload_insi"
2153 [(set (match_operand:SI 0 "register_operand" "=Z")
2154 (match_operand:SI 1 "non_hard_reg_operand" ""))
2155 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2159 if (pa_emit_move_sequence (operands, SImode, operands[2]))
2162 /* We don't want the clobber emitted, so handle this ourselves. */
2163 emit_insn (gen_rtx_SET (operands[0], operands[1]));
2167 ;; Handle SImode output reloads requiring a general register as a
2168 ;; scratch register.
2169 (define_expand "reload_outsi"
2170 [(set (match_operand:SI 0 "non_hard_reg_operand" "")
2171 (match_operand:SI 1 "register_operand" "Z"))
2172 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2176 if (pa_emit_move_sequence (operands, SImode, operands[2]))
2179 /* We don't want the clobber emitted, so handle this ourselves. */
2180 emit_insn (gen_rtx_SET (operands[0], operands[1]));
2185 [(set (match_operand:SI 0 "move_dest_operand"
2186 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T,?r,?*f")
2187 (match_operand:SI 1 "move_src_operand"
2188 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f,*f,r"))]
2189 "(register_operand (operands[0], SImode)
2190 || reg_or_0_operand (operands[1], SImode))
2191 && !TARGET_SOFT_FLOAT
2198 {zdepi|depwi,z} %Z1,%0
2202 {mfctl|mfctl,w} %%sar,%0
2206 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
2207 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
2208 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore,fpstore_load,store_fpload")
2209 (set_attr "pa_combine_type" "addmove")
2210 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,8,8")])
2213 [(set (match_operand:SI 0 "move_dest_operand"
2214 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
2215 (match_operand:SI 1 "move_src_operand"
2216 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
2217 "(register_operand (operands[0], SImode)
2218 || reg_or_0_operand (operands[1], SImode))
2219 && !TARGET_SOFT_FLOAT
2226 {zdepi|depwi,z} %Z1,%0
2230 {mfctl|mfctl,w} %%sar,%0
2234 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
2235 (set_attr "pa_combine_type" "addmove")
2236 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
2239 [(set (match_operand:SI 0 "indexed_memory_operand" "=R")
2240 (match_operand:SI 1 "register_operand" "f"))]
2242 && !TARGET_DISABLE_INDEXING
2243 && reload_completed"
2245 [(set_attr "type" "fpstore")
2246 (set_attr "pa_combine_type" "addmove")
2247 (set_attr "length" "4")])
2249 ; Rewrite RTL using an indexed store. This will allow the insn that
2250 ; computes the address to be deleted if the register it sets is dead.
2252 [(set (match_operand:SI 0 "register_operand" "")
2253 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
2255 (match_operand:SI 2 "register_operand" "")))
2256 (set (mem:SI (match_dup 0))
2257 (match_operand:SI 3 "register_operand" ""))]
2259 && !TARGET_DISABLE_INDEXING
2260 && REG_OK_FOR_BASE_P (operands[2])
2261 && FP_REGNO_P (REGNO (operands[3]))"
2262 [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2264 (set (match_dup 0) (plus:SI (ashift:SI (match_dup 1) (const_int 2))
2269 [(set (match_operand:DI 0 "register_operand" "")
2270 (plus:DI (ashift:DI (match_operand:DI 1 "register_operand" "")
2272 (match_operand:DI 2 "register_operand" "")))
2273 (set (mem:SI (match_dup 0))
2274 (match_operand:SI 3 "register_operand" ""))]
2276 && !TARGET_DISABLE_INDEXING
2278 && REG_OK_FOR_BASE_P (operands[2])
2279 && FP_REGNO_P (REGNO (operands[3]))"
2280 [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2282 (set (match_dup 0) (plus:DI (ashift:DI (match_dup 1) (const_int 2))
2287 [(set (match_operand:SI 0 "register_operand" "")
2288 (plus:SI (match_operand:SI 1 "register_operand" "")
2289 (match_operand:SI 2 "register_operand" "")))
2290 (set (mem:SI (match_dup 0))
2291 (match_operand:SI 3 "register_operand" ""))]
2293 && !TARGET_DISABLE_INDEXING
2294 && TARGET_NO_SPACE_REGS
2295 && REG_OK_FOR_INDEX_P (operands[1])
2296 && REG_OK_FOR_BASE_P (operands[2])
2297 && FP_REGNO_P (REGNO (operands[3]))"
2298 [(set (mem:SI (plus:SI (match_dup 1) (match_dup 2)))
2300 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2304 [(set (match_operand:SI 0 "register_operand" "")
2305 (plus:SI (match_operand:SI 1 "register_operand" "")
2306 (match_operand:SI 2 "register_operand" "")))
2307 (set (mem:SI (match_dup 0))
2308 (match_operand:SI 3 "register_operand" ""))]
2310 && !TARGET_DISABLE_INDEXING
2311 && TARGET_NO_SPACE_REGS
2312 && REG_OK_FOR_BASE_P (operands[1])
2313 && REG_OK_FOR_INDEX_P (operands[2])
2314 && FP_REGNO_P (REGNO (operands[3]))"
2315 [(set (mem:SI (plus:SI (match_dup 2) (match_dup 1)))
2317 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
2321 [(set (match_operand:DI 0 "register_operand" "")
2322 (plus:DI (match_operand:DI 1 "register_operand" "")
2323 (match_operand:DI 2 "register_operand" "")))
2324 (set (mem:SI (match_dup 0))
2325 (match_operand:SI 3 "register_operand" ""))]
2327 && !TARGET_DISABLE_INDEXING
2329 && TARGET_NO_SPACE_REGS
2330 && REG_OK_FOR_INDEX_P (operands[1])
2331 && REG_OK_FOR_BASE_P (operands[2])
2332 && FP_REGNO_P (REGNO (operands[3]))"
2333 [(set (mem:SI (plus:DI (match_dup 1) (match_dup 2)))
2335 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
2339 [(set (match_operand:DI 0 "register_operand" "")
2340 (plus:DI (match_operand:DI 1 "register_operand" "")
2341 (match_operand:DI 2 "register_operand" "")))
2342 (set (mem:SI (match_dup 0))
2343 (match_operand:SI 3 "register_operand" ""))]
2345 && !TARGET_DISABLE_INDEXING
2347 && TARGET_NO_SPACE_REGS
2348 && REG_OK_FOR_BASE_P (operands[1])
2349 && REG_OK_FOR_INDEX_P (operands[2])
2350 && FP_REGNO_P (REGNO (operands[3]))"
2351 [(set (mem:SI (plus:DI (match_dup 2) (match_dup 1)))
2353 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
2357 [(set (match_operand:SI 0 "move_dest_operand"
2358 "=r,r,r,r,r,r,Q,!*q,!r")
2359 (match_operand:SI 1 "move_src_operand"
2360 "A,r,J,N,K,RQ,rM,!rM,!*q"))]
2361 "(register_operand (operands[0], SImode)
2362 || reg_or_0_operand (operands[1], SImode))
2363 && TARGET_SOFT_FLOAT"
2369 {zdepi|depwi,z} %Z1,%0
2373 {mfctl|mfctl,w} %%sar,%0"
2374 [(set_attr "type" "load,move,move,move,move,load,store,move,move")
2375 (set_attr "pa_combine_type" "addmove")
2376 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
2378 ;; Load or store with base-register modification.
2380 [(set (match_operand:SI 0 "register_operand" "=r")
2381 (mem:SI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2382 (match_operand:DI 2 "int5_operand" "L"))))
2384 (plus:DI (match_dup 1) (match_dup 2)))]
2387 [(set_attr "type" "load")
2388 (set_attr "length" "4")])
2390 ; And a zero extended variant.
2392 [(set (match_operand:DI 0 "register_operand" "=r")
2393 (zero_extend:DI (mem:SI
2395 (match_operand:DI 1 "register_operand" "+r")
2396 (match_operand:DI 2 "int5_operand" "L")))))
2398 (plus:DI (match_dup 1) (match_dup 2)))]
2401 [(set_attr "type" "load")
2402 (set_attr "length" "4")])
2404 (define_expand "pre_load"
2405 [(parallel [(set (match_operand:SI 0 "register_operand" "")
2406 (mem (plus (match_operand 1 "register_operand" "")
2407 (match_operand 2 "pre_cint_operand" ""))))
2409 (plus (match_dup 1) (match_dup 2)))])]
2415 emit_insn (gen_pre_ldd (operands[0], operands[1], operands[2]));
2418 emit_insn (gen_pre_ldw (operands[0], operands[1], operands[2]));
2422 (define_insn "pre_ldw"
2423 [(set (match_operand:SI 0 "register_operand" "=r")
2424 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2425 (match_operand:SI 2 "pre_cint_operand" ""))))
2427 (plus:SI (match_dup 1) (match_dup 2)))]
2431 if (INTVAL (operands[2]) < 0)
2432 return \"{ldwm|ldw,mb} %2(%1),%0\";
2433 return \"{ldws|ldw},mb %2(%1),%0\";
2435 [(set_attr "type" "load")
2436 (set_attr "length" "4")])
2438 (define_insn "pre_ldd"
2439 [(set (match_operand:DI 0 "register_operand" "=r")
2440 (mem:DI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2441 (match_operand:DI 2 "pre_cint_operand" ""))))
2443 (plus:DI (match_dup 1) (match_dup 2)))]
2446 [(set_attr "type" "load")
2447 (set_attr "length" "4")])
2450 [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2451 (match_operand:SI 1 "pre_cint_operand" "")))
2452 (match_operand:SI 2 "reg_or_0_operand" "rM"))
2454 (plus:SI (match_dup 0) (match_dup 1)))]
2458 if (INTVAL (operands[1]) < 0)
2459 return \"{stwm|stw,mb} %r2,%1(%0)\";
2460 return \"{stws|stw},mb %r2,%1(%0)\";
2462 [(set_attr "type" "store")
2463 (set_attr "length" "4")])
2466 [(set (match_operand:SI 0 "register_operand" "=r")
2467 (mem:SI (match_operand:SI 1 "register_operand" "+r")))
2469 (plus:SI (match_dup 1)
2470 (match_operand:SI 2 "post_cint_operand" "")))]
2474 if (INTVAL (operands[2]) > 0)
2475 return \"{ldwm|ldw,ma} %2(%1),%0\";
2476 return \"{ldws|ldw},ma %2(%1),%0\";
2478 [(set_attr "type" "load")
2479 (set_attr "length" "4")])
2481 (define_expand "post_store"
2482 [(parallel [(set (mem (match_operand 0 "register_operand" ""))
2483 (match_operand 1 "reg_or_0_operand" ""))
2486 (match_operand 2 "post_cint_operand" "")))])]
2492 emit_insn (gen_post_std (operands[0], operands[1], operands[2]));
2495 emit_insn (gen_post_stw (operands[0], operands[1], operands[2]));
2499 (define_insn "post_stw"
2500 [(set (mem:SI (match_operand:SI 0 "register_operand" "+r"))
2501 (match_operand:SI 1 "reg_or_0_operand" "rM"))
2503 (plus:SI (match_dup 0)
2504 (match_operand:SI 2 "post_cint_operand" "")))]
2508 if (INTVAL (operands[2]) > 0)
2509 return \"{stwm|stw,ma} %r1,%2(%0)\";
2510 return \"{stws|stw},ma %r1,%2(%0)\";
2512 [(set_attr "type" "store")
2513 (set_attr "length" "4")])
2515 (define_insn "post_std"
2516 [(set (mem:DI (match_operand:DI 0 "register_operand" "+r"))
2517 (match_operand:DI 1 "reg_or_0_operand" "rM"))
2519 (plus:DI (match_dup 0)
2520 (match_operand:DI 2 "post_cint_operand" "")))]
2523 [(set_attr "type" "store")
2524 (set_attr "length" "4")])
2526 ;; For loading the address of a label while generating PIC code.
2527 ;; Note since this pattern can be created at reload time (via movsi), all
2528 ;; the same rules for movsi apply here. (no new pseudos, no temporaries).
2530 [(set (match_operand 0 "pmode_register_operand" "=a")
2531 (match_operand 1 "pic_label_operand" ""))]
2537 xoperands[0] = operands[0];
2538 xoperands[1] = operands[1];
2539 xoperands[2] = gen_label_rtx ();
2541 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2542 CODE_LABEL_NUMBER (xoperands[2]));
2543 output_asm_insn (\"mfia %0\", xoperands);
2545 /* If we're trying to load the address of a label that happens to be
2546 close, then we can use a shorter sequence. */
2547 if (GET_CODE (operands[1]) == LABEL_REF
2548 && !LABEL_REF_NONLOCAL_P (operands[1])
2549 && INSN_ADDRESSES_SET_P ()
2550 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2551 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2552 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2555 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2556 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2560 [(set_attr "type" "multi")
2561 (set_attr "length" "12")]) ; 8 or 12
2564 [(set (match_operand 0 "pmode_register_operand" "=a")
2565 (match_operand 1 "pic_label_operand" ""))]
2571 xoperands[0] = operands[0];
2572 xoperands[1] = operands[1];
2573 xoperands[2] = gen_label_rtx ();
2575 output_asm_insn (\"bl .+8,%0\", xoperands);
2576 output_asm_insn (\"depi 0,31,2,%0\", xoperands);
2577 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2578 CODE_LABEL_NUMBER (xoperands[2]));
2580 /* If we're trying to load the address of a label that happens to be
2581 close, then we can use a shorter sequence. */
2582 if (GET_CODE (operands[1]) == LABEL_REF
2583 && !LABEL_REF_NONLOCAL_P (operands[1])
2584 && INSN_ADDRESSES_SET_P ()
2585 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2586 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2587 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2590 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2591 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2595 [(set_attr "type" "multi")
2596 (set_attr "length" "16")]) ; 12 or 16
2599 [(set (match_operand:SI 0 "register_operand" "=a")
2600 (plus:SI (match_operand:SI 1 "register_operand" "r")
2601 (high:SI (match_operand 2 "" ""))))]
2602 "symbolic_operand (operands[2], Pmode)
2603 && ! function_label_operand (operands[2], Pmode)
2606 [(set_attr "type" "binary")
2607 (set_attr "length" "4")])
2610 [(set (match_operand:DI 0 "register_operand" "=a")
2611 (plus:DI (match_operand:DI 1 "register_operand" "r")
2612 (high:DI (match_operand 2 "" ""))))]
2613 "symbolic_operand (operands[2], Pmode)
2614 && ! function_label_operand (operands[2], Pmode)
2618 [(set_attr "type" "binary")
2619 (set_attr "length" "4")])
2622 [(set (match_operand:SI 0 "register_operand" "=r")
2623 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2624 (unspec:SI [(match_operand 2 "" "")] UNSPEC_DLTIND14R)))]
2625 "symbolic_operand (operands[2], Pmode)
2626 && ! function_label_operand (operands[2], Pmode)
2629 [(set_attr "type" "binary")
2630 (set_attr "length" "4")])
2633 [(set (match_operand:DI 0 "register_operand" "=r")
2634 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2635 (unspec:DI [(match_operand 2 "" "")] UNSPEC_DLTIND14R)))]
2636 "symbolic_operand (operands[2], Pmode)
2637 && ! function_label_operand (operands[2], Pmode)
2641 [(set_attr "type" "binary")
2642 (set_attr "length" "4")])
2644 ;; Always use addil rather than ldil;add sequences. This allows the
2645 ;; HP linker to eliminate the dp relocation if the symbolic operand
2646 ;; lives in the TEXT space.
2648 [(set (match_operand:SI 0 "register_operand" "=a")
2649 (high:SI (match_operand 1 "" "")))]
2650 "symbolic_operand (operands[1], Pmode)
2651 && ! function_label_operand (operands[1], Pmode)
2652 && ! read_only_operand (operands[1], Pmode)
2656 if (TARGET_LONG_LOAD_STORE)
2657 return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
2659 return \"addil LR'%H1,%%r27\";
2661 [(set_attr "type" "binary")
2662 (set (attr "length")
2663 (if_then_else (not (match_test "TARGET_LONG_LOAD_STORE"))
2668 ;; This is for use in the prologue/epilogue code. We need it
2669 ;; to add large constants to a stack pointer or frame pointer.
2670 ;; Because of the additional %r1 pressure, we probably do not
2671 ;; want to use this in general code, so make it available
2672 ;; only after reload.
2674 [(set (match_operand:SI 0 "register_operand" "=!a,*r")
2675 (plus:SI (match_operand:SI 1 "register_operand" "r,r")
2676 (high:SI (match_operand 2 "const_int_operand" ""))))]
2680 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2681 [(set_attr "type" "binary,binary")
2682 (set_attr "length" "4,8")])
2685 [(set (match_operand:DI 0 "register_operand" "=!a,*r")
2686 (plus:DI (match_operand:DI 1 "register_operand" "r,r")
2687 (high:DI (match_operand 2 "const_int_operand" ""))))]
2688 "reload_completed && TARGET_64BIT"
2691 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2692 [(set_attr "type" "binary,binary")
2693 (set_attr "length" "4,8")])
2696 [(set (match_operand:SI 0 "register_operand" "=r")
2697 (high:SI (match_operand 1 "" "")))]
2698 "(!flag_pic || !symbolic_operand (operands[1], Pmode))
2699 && !pa_is_function_label_plus_const (operands[1])"
2702 if (symbolic_operand (operands[1], Pmode))
2703 return \"ldil LR'%H1,%0\";
2705 return \"ldil L'%G1,%0\";
2707 [(set_attr "type" "move")
2708 (set_attr "length" "4")])
2711 [(set (match_operand:DI 0 "register_operand" "=r")
2712 (high:DI (match_operand 1 "const_int_operand" "")))]
2715 [(set_attr "type" "move")
2716 (set_attr "length" "4")])
2719 [(set (match_operand:DI 0 "register_operand" "=r")
2720 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2721 (match_operand:DI 2 "const_int_operand" "i")))]
2724 [(set_attr "type" "move")
2725 (set_attr "length" "4")])
2728 [(set (match_operand:SI 0 "register_operand" "=r")
2729 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2730 (match_operand:SI 2 "immediate_operand" "i")))]
2731 "!pa_is_function_label_plus_const (operands[2])"
2734 gcc_assert (!flag_pic || !symbolic_operand (operands[2], Pmode));
2736 if (symbolic_operand (operands[2], Pmode))
2737 return \"ldo RR'%G2(%1),%0\";
2739 return \"ldo R'%G2(%1),%0\";
2741 [(set_attr "type" "move")
2742 (set_attr "length" "4")])
2744 ;; Now that a symbolic_address plus a constant is broken up early
2745 ;; in the compilation phase (for better CSE) we need a special
2746 ;; combiner pattern to load the symbolic address plus the constant
2747 ;; in only 2 instructions. (For cases where the symbolic address
2748 ;; was not a common subexpression.)
2750 [(set (match_operand:SI 0 "register_operand" "")
2751 (match_operand:SI 1 "symbolic_operand" ""))
2752 (clobber (match_operand:SI 2 "register_operand" ""))]
2753 "! (flag_pic && pic_label_operand (operands[1], SImode))"
2754 [(set (match_dup 2) (high:SI (match_dup 1)))
2755 (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
2758 ;; hppa_legitimize_address goes to a great deal of trouble to
2759 ;; create addresses which use indexing. In some cases, this
2760 ;; is a lose because there isn't any store instructions which
2761 ;; allow indexed addresses (with integer register source).
2763 ;; These define_splits try to turn a 3 insn store into
2764 ;; a 2 insn store with some creative RTL rewriting.
2766 [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2767 (match_operand:SI 1 "mem_shadd_operand" ""))
2768 (plus:SI (match_operand:SI 2 "register_operand" "")
2769 (match_operand:SI 3 "const_int_operand" ""))))
2770 (match_operand:SI 4 "register_operand" ""))
2771 (clobber (match_operand:SI 5 "register_operand" ""))]
2773 [(set (match_dup 5) (plus:SI (ashift:SI (match_dup 0) (match_dup 1))
2775 (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2778 operands[1] = GEN_INT (exact_log2 (INTVAL (operands[1])));
2783 [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2784 (match_operand:SI 1 "mem_shadd_operand" ""))
2785 (plus:SI (match_operand:SI 2 "register_operand" "")
2786 (match_operand:SI 3 "const_int_operand" ""))))
2787 (match_operand:HI 4 "register_operand" ""))
2788 (clobber (match_operand:SI 5 "register_operand" ""))]
2790 [(set (match_dup 5) (plus:SI (ashift:SI (match_dup 0) (match_dup 1))
2792 (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2795 operands[1] = GEN_INT (exact_log2 (INTVAL (operands[1])));
2800 [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2801 (match_operand:SI 1 "mem_shadd_operand" ""))
2802 (plus:SI (match_operand:SI 2 "register_operand" "")
2803 (match_operand:SI 3 "const_int_operand" ""))))
2804 (match_operand:QI 4 "register_operand" ""))
2805 (clobber (match_operand:SI 5 "register_operand" ""))]
2807 [(set (match_dup 5) (plus:SI (ashift:SI (match_dup 0) (match_dup 1))
2809 (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2812 operands[1] = GEN_INT (exact_log2 (INTVAL (operands[1])));
2816 (define_expand "movhi"
2817 [(set (match_operand:HI 0 "general_operand" "")
2818 (match_operand:HI 1 "general_operand" ""))]
2822 if (pa_emit_move_sequence (operands, HImode, 0))
2826 ;; Handle HImode input reloads requiring a general register as a
2827 ;; scratch register.
2828 (define_expand "reload_inhi"
2829 [(set (match_operand:HI 0 "register_operand" "=Z")
2830 (match_operand:HI 1 "non_hard_reg_operand" ""))
2831 (clobber (match_operand:HI 2 "register_operand" "=&r"))]
2835 if (pa_emit_move_sequence (operands, HImode, operands[2]))
2838 /* We don't want the clobber emitted, so handle this ourselves. */
2839 emit_insn (gen_rtx_SET (operands[0], operands[1]));
2843 ;; Handle HImode output reloads requiring a general register as a
2844 ;; scratch register.
2845 (define_expand "reload_outhi"
2846 [(set (match_operand:HI 0 "non_hard_reg_operand" "")
2847 (match_operand:HI 1 "register_operand" "Z"))
2848 (clobber (match_operand:HI 2 "register_operand" "=&r"))]
2852 if (pa_emit_move_sequence (operands, HImode, operands[2]))
2855 /* We don't want the clobber emitted, so handle this ourselves. */
2856 emit_insn (gen_rtx_SET (operands[0], operands[1]));
2861 [(set (match_operand:HI 0 "move_dest_operand"
2862 "=r,r,r,r,r,Q,!*q,!r")
2863 (match_operand:HI 1 "move_src_operand"
2864 "r,J,N,K,RQ,rM,!rM,!*q"))]
2865 "(register_operand (operands[0], HImode)
2866 || reg_or_0_operand (operands[1], HImode))"
2871 {zdepi|depwi,z} %Z1,%0
2875 {mfctl|mfctl,w} %sar,%0"
2876 [(set_attr "type" "move,move,move,shift,load,store,move,move")
2877 (set_attr "pa_combine_type" "addmove")
2878 (set_attr "length" "4,4,4,4,4,4,4,4")])
2881 [(set (match_operand:HI 0 "register_operand" "=r")
2882 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2883 (match_operand:SI 2 "int5_operand" "L"))))
2885 (plus:SI (match_dup 1) (match_dup 2)))]
2887 "{ldhs|ldh},mb %2(%1),%0"
2888 [(set_attr "type" "load")
2889 (set_attr "length" "4")])
2892 [(set (match_operand:HI 0 "register_operand" "=r")
2893 (mem:HI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2894 (match_operand:DI 2 "int5_operand" "L"))))
2896 (plus:DI (match_dup 1) (match_dup 2)))]
2899 [(set_attr "type" "load")
2900 (set_attr "length" "4")])
2902 ; And a zero extended variant.
2904 [(set (match_operand:DI 0 "register_operand" "=r")
2905 (zero_extend:DI (mem:HI
2907 (match_operand:DI 1 "register_operand" "+r")
2908 (match_operand:DI 2 "int5_operand" "L")))))
2910 (plus:DI (match_dup 1) (match_dup 2)))]
2913 [(set_attr "type" "load")
2914 (set_attr "length" "4")])
2917 [(set (match_operand:SI 0 "register_operand" "=r")
2918 (zero_extend:SI (mem:HI
2920 (match_operand:SI 1 "register_operand" "+r")
2921 (match_operand:SI 2 "int5_operand" "L")))))
2923 (plus:SI (match_dup 1) (match_dup 2)))]
2925 "{ldhs|ldh},mb %2(%1),%0"
2926 [(set_attr "type" "load")
2927 (set_attr "length" "4")])
2930 [(set (match_operand:SI 0 "register_operand" "=r")
2931 (zero_extend:SI (mem:HI
2933 (match_operand:DI 1 "register_operand" "+r")
2934 (match_operand:DI 2 "int5_operand" "L")))))
2936 (plus:DI (match_dup 1) (match_dup 2)))]
2939 [(set_attr "type" "load")
2940 (set_attr "length" "4")])
2943 [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2944 (match_operand:SI 1 "int5_operand" "L")))
2945 (match_operand:HI 2 "reg_or_0_operand" "rM"))
2947 (plus:SI (match_dup 0) (match_dup 1)))]
2949 "{sths|sth},mb %r2,%1(%0)"
2950 [(set_attr "type" "store")
2951 (set_attr "length" "4")])
2954 [(set (mem:HI (plus:DI (match_operand:DI 0 "register_operand" "+r")
2955 (match_operand:DI 1 "int5_operand" "L")))
2956 (match_operand:HI 2 "reg_or_0_operand" "rM"))
2958 (plus:DI (match_dup 0) (match_dup 1)))]
2961 [(set_attr "type" "store")
2962 (set_attr "length" "4")])
2964 (define_insn "addhi3"
2965 [(set (match_operand:HI 0 "register_operand" "=r,r")
2966 (plus:HI (match_operand:HI 1 "register_operand" "%r,r")
2967 (match_operand:HI 2 "arith14_operand" "r,J")))]
2970 {addl|add,l} %1,%2,%0
2972 [(set_attr "type" "binary,binary")
2973 (set_attr "pa_combine_type" "addmove")
2974 (set_attr "length" "4,4")])
2976 (define_expand "movqi"
2977 [(set (match_operand:QI 0 "general_operand" "")
2978 (match_operand:QI 1 "general_operand" ""))]
2982 if (pa_emit_move_sequence (operands, QImode, 0))
2986 ;; Handle QImode input reloads requiring a general register as a
2987 ;; scratch register.
2988 (define_expand "reload_inqi"
2989 [(set (match_operand:QI 0 "register_operand" "=Z")
2990 (match_operand:QI 1 "non_hard_reg_operand" ""))
2991 (clobber (match_operand:QI 2 "register_operand" "=&r"))]
2995 if (pa_emit_move_sequence (operands, QImode, operands[2]))
2998 /* We don't want the clobber emitted, so handle this ourselves. */
2999 emit_insn (gen_rtx_SET (operands[0], operands[1]));
3003 ;; Handle QImode output reloads requiring a general register as a
3004 ;; scratch register.
3005 (define_expand "reload_outqi"
3006 [(set (match_operand:QI 0 "non_hard_reg_operand" "")
3007 (match_operand:QI 1 "register_operand" "Z"))
3008 (clobber (match_operand:QI 2 "register_operand" "=&r"))]
3012 if (pa_emit_move_sequence (operands, QImode, operands[2]))
3015 /* We don't want the clobber emitted, so handle this ourselves. */
3016 emit_insn (gen_rtx_SET (operands[0], operands[1]));
3021 [(set (match_operand:QI 0 "move_dest_operand"
3022 "=r,r,r,r,r,Q,!*q,!r")
3023 (match_operand:QI 1 "move_src_operand"
3024 "r,J,N,K,RQ,rM,!rM,!*q"))]
3025 "(register_operand (operands[0], QImode)
3026 || reg_or_0_operand (operands[1], QImode))"
3031 {zdepi|depwi,z} %Z1,%0
3035 {mfctl|mfctl,w} %%sar,%0"
3036 [(set_attr "type" "move,move,move,shift,load,store,move,move")
3037 (set_attr "pa_combine_type" "addmove")
3038 (set_attr "length" "4,4,4,4,4,4,4,4")])
3041 [(set (match_operand:QI 0 "register_operand" "=r")
3042 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "+r")
3043 (match_operand:SI 2 "int5_operand" "L"))))
3044 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3046 "{ldbs|ldb},mb %2(%1),%0"
3047 [(set_attr "type" "load")
3048 (set_attr "length" "4")])
3051 [(set (match_operand:QI 0 "register_operand" "=r")
3052 (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "+r")
3053 (match_operand:DI 2 "int5_operand" "L"))))
3054 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3057 [(set_attr "type" "load")
3058 (set_attr "length" "4")])
3060 ; Now the same thing with zero extensions.
3062 [(set (match_operand:DI 0 "register_operand" "=r")
3063 (zero_extend:DI (mem:QI (plus:DI
3064 (match_operand:DI 1 "register_operand" "+r")
3065 (match_operand:DI 2 "int5_operand" "L")))))
3066 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3069 [(set_attr "type" "load")
3070 (set_attr "length" "4")])
3073 [(set (match_operand:SI 0 "register_operand" "=r")
3074 (zero_extend:SI (mem:QI (plus:SI
3075 (match_operand:SI 1 "register_operand" "+r")
3076 (match_operand:SI 2 "int5_operand" "L")))))
3077 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3079 "{ldbs|ldb},mb %2(%1),%0"
3080 [(set_attr "type" "load")
3081 (set_attr "length" "4")])
3084 [(set (match_operand:SI 0 "register_operand" "=r")
3085 (zero_extend:SI (mem:QI (plus:DI
3086 (match_operand:DI 1 "register_operand" "+r")
3087 (match_operand:DI 2 "int5_operand" "L")))))
3088 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3091 [(set_attr "type" "load")
3092 (set_attr "length" "4")])
3095 [(set (match_operand:HI 0 "register_operand" "=r")
3096 (zero_extend:HI (mem:QI (plus:SI
3097 (match_operand:SI 1 "register_operand" "+r")
3098 (match_operand:SI 2 "int5_operand" "L")))))
3099 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3101 "{ldbs|ldb},mb %2(%1),%0"
3102 [(set_attr "type" "load")
3103 (set_attr "length" "4")])
3106 [(set (match_operand:HI 0 "register_operand" "=r")
3107 (zero_extend:HI (mem:QI (plus:DI
3108 (match_operand:DI 1 "register_operand" "+r")
3109 (match_operand:DI 2 "int5_operand" "L")))))
3110 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3113 [(set_attr "type" "load")
3114 (set_attr "length" "4")])
3117 [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "+r")
3118 (match_operand:SI 1 "int5_operand" "L")))
3119 (match_operand:QI 2 "reg_or_0_operand" "rM"))
3121 (plus:SI (match_dup 0) (match_dup 1)))]
3123 "{stbs|stb},mb %r2,%1(%0)"
3124 [(set_attr "type" "store")
3125 (set_attr "length" "4")])
3128 [(set (mem:QI (plus:DI (match_operand:DI 0 "register_operand" "+r")
3129 (match_operand:DI 1 "int5_operand" "L")))
3130 (match_operand:QI 2 "reg_or_0_operand" "rM"))
3132 (plus:DI (match_dup 0) (match_dup 1)))]
3135 [(set_attr "type" "store")
3136 (set_attr "length" "4")])
3138 ;; The definition of this insn does not really explain what it does,
3139 ;; but it should suffice that anything generated as this insn will be
3140 ;; recognized as a movmemsi operation, and that it will not successfully
3141 ;; combine with anything.
3142 (define_expand "movmemsi"
3143 [(parallel [(set (match_operand:BLK 0 "" "")
3144 (match_operand:BLK 1 "" ""))
3145 (clobber (match_dup 4))
3146 (clobber (match_dup 5))
3147 (clobber (match_dup 6))
3148 (clobber (match_dup 7))
3149 (clobber (match_dup 8))
3150 (use (match_operand:SI 2 "arith14_operand" ""))
3151 (use (match_operand:SI 3 "const_int_operand" ""))])]
3152 "!TARGET_64BIT && optimize > 0"
3157 /* HP provides very fast block move library routine for the PA;
3158 this routine includes:
3160 4x4 byte at a time block moves,
3161 1x4 byte at a time with alignment checked at runtime with
3162 attempts to align the source and destination as needed
3165 With that in mind, here's the heuristics to try and guess when
3166 the inlined block move will be better than the library block
3169 If the size isn't constant, then always use the library routines.
3171 If the size is large in respect to the known alignment, then use
3172 the library routines.
3174 If the size is small in respect to the known alignment, then open
3175 code the copy (since that will lead to better scheduling).
3177 Else use the block move pattern. */
3179 /* Undetermined size, use the library routine. */
3180 if (GET_CODE (operands[2]) != CONST_INT)
3183 size = INTVAL (operands[2]);
3184 align = INTVAL (operands[3]);
3185 align = align > 4 ? 4 : (align ? align : 1);
3187 /* If size/alignment is large, then use the library routines. */
3188 if (size / align > 16)
3191 /* This does happen, but not often enough to worry much about. */
3192 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3195 /* Fall through means we're going to use our block move pattern. */
3197 = replace_equiv_address (operands[0],
3198 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3200 = replace_equiv_address (operands[1],
3201 copy_to_mode_reg (SImode, XEXP (operands[1], 0)));
3202 operands[4] = gen_reg_rtx (SImode);
3203 operands[5] = gen_reg_rtx (SImode);
3204 operands[6] = gen_reg_rtx (SImode);
3205 operands[7] = gen_reg_rtx (SImode);
3206 operands[8] = gen_reg_rtx (SImode);
3209 ;; The operand constraints are written like this to support both compile-time
3210 ;; and run-time determined byte counts. The expander and pa_output_block_move
3211 ;; only support compile-time determined counts at this time.
3213 ;; If the count is run-time determined, the register with the byte count
3214 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3216 ;; We used to clobber operands 0 and 1. However, a change to regrename.c
3217 ;; broke this semantic for pseudo registers. We can't use match_scratch
3218 ;; as this requires two registers in the class R1_REGS when the MEMs for
3219 ;; operands 0 and 1 are both equivalent to symbolic MEMs. Thus, we are
3220 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3221 ;; respectively. We then split or peephole optimize after reload.
3222 (define_insn "movmemsi_prereload"
3223 [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3224 (mem:BLK (match_operand:SI 1 "register_operand" "r,r")))
3225 (clobber (match_operand:SI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3226 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp1
3227 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3228 (clobber (match_operand:SI 7 "register_operand" "=&r,&r")) ;item tmp3
3229 (clobber (match_operand:SI 8 "register_operand" "=&r,&r")) ;item tmp4
3230 (use (match_operand:SI 4 "arith14_operand" "J,2")) ;byte count
3231 (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
3234 [(set_attr "type" "multi,multi")])
3237 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3238 (match_operand:BLK 1 "memory_operand" ""))
3239 (clobber (match_operand:SI 2 "register_operand" ""))
3240 (clobber (match_operand:SI 3 "register_operand" ""))
3241 (clobber (match_operand:SI 6 "register_operand" ""))
3242 (clobber (match_operand:SI 7 "register_operand" ""))
3243 (clobber (match_operand:SI 8 "register_operand" ""))
3244 (use (match_operand:SI 4 "arith14_operand" ""))
3245 (use (match_operand:SI 5 "const_int_operand" ""))])]
3246 "!TARGET_64BIT && reload_completed && !flag_peephole2
3247 && GET_CODE (operands[0]) == MEM
3248 && register_operand (XEXP (operands[0], 0), SImode)
3249 && GET_CODE (operands[1]) == MEM
3250 && register_operand (XEXP (operands[1], 0), SImode)"
3251 [(set (match_dup 7) (match_dup 9))
3252 (set (match_dup 8) (match_dup 10))
3253 (parallel [(set (match_dup 0) (match_dup 1))
3254 (clobber (match_dup 2))
3255 (clobber (match_dup 3))
3256 (clobber (match_dup 6))
3257 (clobber (match_dup 7))
3258 (clobber (match_dup 8))
3264 operands[9] = XEXP (operands[0], 0);
3265 operands[10] = XEXP (operands[1], 0);
3266 operands[0] = replace_equiv_address (operands[0], operands[7]);
3267 operands[1] = replace_equiv_address (operands[1], operands[8]);
3271 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3272 (match_operand:BLK 1 "memory_operand" ""))
3273 (clobber (match_operand:SI 2 "register_operand" ""))
3274 (clobber (match_operand:SI 3 "register_operand" ""))
3275 (clobber (match_operand:SI 6 "register_operand" ""))
3276 (clobber (match_operand:SI 7 "register_operand" ""))
3277 (clobber (match_operand:SI 8 "register_operand" ""))
3278 (use (match_operand:SI 4 "arith14_operand" ""))
3279 (use (match_operand:SI 5 "const_int_operand" ""))])]
3281 && GET_CODE (operands[0]) == MEM
3282 && register_operand (XEXP (operands[0], 0), SImode)
3283 && GET_CODE (operands[1]) == MEM
3284 && register_operand (XEXP (operands[1], 0), SImode)"
3285 [(parallel [(set (match_dup 0) (match_dup 1))
3286 (clobber (match_dup 2))
3287 (clobber (match_dup 3))
3288 (clobber (match_dup 6))
3289 (clobber (match_dup 7))
3290 (clobber (match_dup 8))
3296 rtx addr = XEXP (operands[0], 0);
3297 if (dead_or_set_p (curr_insn, addr))
3301 emit_insn (gen_rtx_SET (operands[7], addr));
3302 operands[0] = replace_equiv_address (operands[0], operands[7]);
3305 addr = XEXP (operands[1], 0);
3306 if (dead_or_set_p (curr_insn, addr))
3310 emit_insn (gen_rtx_SET (operands[8], addr));
3311 operands[1] = replace_equiv_address (operands[1], operands[8]);
3315 (define_insn "movmemsi_postreload"
3316 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3317 (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
3318 (clobber (match_operand:SI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3319 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp1
3320 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3321 (clobber (match_dup 0))
3322 (clobber (match_dup 1))
3323 (use (match_operand:SI 4 "arith14_operand" "J,2")) ;byte count
3324 (use (match_operand:SI 5 "const_int_operand" "n,n")) ;alignment
3326 "!TARGET_64BIT && reload_completed"
3327 "* return pa_output_block_move (operands, !which_alternative);"
3328 [(set_attr "type" "multi,multi")])
3330 (define_expand "movmemdi"
3331 [(parallel [(set (match_operand:BLK 0 "" "")
3332 (match_operand:BLK 1 "" ""))
3333 (clobber (match_dup 4))
3334 (clobber (match_dup 5))
3335 (clobber (match_dup 6))
3336 (clobber (match_dup 7))
3337 (clobber (match_dup 8))
3338 (use (match_operand:DI 2 "arith14_operand" ""))
3339 (use (match_operand:DI 3 "const_int_operand" ""))])]
3340 "TARGET_64BIT && optimize > 0"
3345 /* HP provides very fast block move library routine for the PA;
3346 this routine includes:
3348 4x4 byte at a time block moves,
3349 1x4 byte at a time with alignment checked at runtime with
3350 attempts to align the source and destination as needed
3353 With that in mind, here's the heuristics to try and guess when
3354 the inlined block move will be better than the library block
3357 If the size isn't constant, then always use the library routines.
3359 If the size is large in respect to the known alignment, then use
3360 the library routines.
3362 If the size is small in respect to the known alignment, then open
3363 code the copy (since that will lead to better scheduling).
3365 Else use the block move pattern. */
3367 /* Undetermined size, use the library routine. */
3368 if (GET_CODE (operands[2]) != CONST_INT)
3371 size = INTVAL (operands[2]);
3372 align = INTVAL (operands[3]);
3373 align = align > 8 ? 8 : (align ? align : 1);
3375 /* If size/alignment is large, then use the library routines. */
3376 if (size / align > 16)
3379 /* This does happen, but not often enough to worry much about. */
3380 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3383 /* Fall through means we're going to use our block move pattern. */
3385 = replace_equiv_address (operands[0],
3386 copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3388 = replace_equiv_address (operands[1],
3389 copy_to_mode_reg (DImode, XEXP (operands[1], 0)));
3390 operands[4] = gen_reg_rtx (DImode);
3391 operands[5] = gen_reg_rtx (DImode);
3392 operands[6] = gen_reg_rtx (DImode);
3393 operands[7] = gen_reg_rtx (DImode);
3394 operands[8] = gen_reg_rtx (DImode);
3397 ;; The operand constraints are written like this to support both compile-time
3398 ;; and run-time determined byte counts. The expander and pa_output_block_move
3399 ;; only support compile-time determined counts at this time.
3401 ;; If the count is run-time determined, the register with the byte count
3402 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3404 ;; We used to clobber operands 0 and 1. However, a change to regrename.c
3405 ;; broke this semantic for pseudo registers. We can't use match_scratch
3406 ;; as this requires two registers in the class R1_REGS when the MEMs for
3407 ;; operands 0 and 1 are both equivalent to symbolic MEMs. Thus, we are
3408 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3409 ;; respectively. We then split or peephole optimize after reload.
3410 (define_insn "movmemdi_prereload"
3411 [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3412 (mem:BLK (match_operand:DI 1 "register_operand" "r,r")))
3413 (clobber (match_operand:DI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3414 (clobber (match_operand:DI 3 "register_operand" "=&r,&r")) ;item tmp1
3415 (clobber (match_operand:DI 6 "register_operand" "=&r,&r")) ;item tmp2
3416 (clobber (match_operand:DI 7 "register_operand" "=&r,&r")) ;item tmp3
3417 (clobber (match_operand:DI 8 "register_operand" "=&r,&r")) ;item tmp4
3418 (use (match_operand:DI 4 "arith14_operand" "J,2")) ;byte count
3419 (use (match_operand:DI 5 "const_int_operand" "n,n"))] ;alignment
3422 [(set_attr "type" "multi,multi")])
3425 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3426 (match_operand:BLK 1 "memory_operand" ""))
3427 (clobber (match_operand:DI 2 "register_operand" ""))
3428 (clobber (match_operand:DI 3 "register_operand" ""))
3429 (clobber (match_operand:DI 6 "register_operand" ""))
3430 (clobber (match_operand:DI 7 "register_operand" ""))
3431 (clobber (match_operand:DI 8 "register_operand" ""))
3432 (use (match_operand:DI 4 "arith14_operand" ""))
3433 (use (match_operand:DI 5 "const_int_operand" ""))])]
3434 "TARGET_64BIT && reload_completed && !flag_peephole2
3435 && GET_CODE (operands[0]) == MEM
3436 && register_operand (XEXP (operands[0], 0), DImode)
3437 && GET_CODE (operands[1]) == MEM
3438 && register_operand (XEXP (operands[1], 0), DImode)"
3439 [(set (match_dup 7) (match_dup 9))
3440 (set (match_dup 8) (match_dup 10))
3441 (parallel [(set (match_dup 0) (match_dup 1))
3442 (clobber (match_dup 2))
3443 (clobber (match_dup 3))
3444 (clobber (match_dup 6))
3445 (clobber (match_dup 7))
3446 (clobber (match_dup 8))
3452 operands[9] = XEXP (operands[0], 0);
3453 operands[10] = XEXP (operands[1], 0);
3454 operands[0] = replace_equiv_address (operands[0], operands[7]);
3455 operands[1] = replace_equiv_address (operands[1], operands[8]);
3459 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3460 (match_operand:BLK 1 "memory_operand" ""))
3461 (clobber (match_operand:DI 2 "register_operand" ""))
3462 (clobber (match_operand:DI 3 "register_operand" ""))
3463 (clobber (match_operand:DI 6 "register_operand" ""))
3464 (clobber (match_operand:DI 7 "register_operand" ""))
3465 (clobber (match_operand:DI 8 "register_operand" ""))
3466 (use (match_operand:DI 4 "arith14_operand" ""))
3467 (use (match_operand:DI 5 "const_int_operand" ""))])]
3469 && GET_CODE (operands[0]) == MEM
3470 && register_operand (XEXP (operands[0], 0), DImode)
3471 && GET_CODE (operands[1]) == MEM
3472 && register_operand (XEXP (operands[1], 0), DImode)"
3473 [(parallel [(set (match_dup 0) (match_dup 1))
3474 (clobber (match_dup 2))
3475 (clobber (match_dup 3))
3476 (clobber (match_dup 6))
3477 (clobber (match_dup 7))
3478 (clobber (match_dup 8))
3484 rtx addr = XEXP (operands[0], 0);
3485 if (dead_or_set_p (curr_insn, addr))
3489 emit_insn (gen_rtx_SET (operands[7], addr));
3490 operands[0] = replace_equiv_address (operands[0], operands[7]);
3493 addr = XEXP (operands[1], 0);
3494 if (dead_or_set_p (curr_insn, addr))
3498 emit_insn (gen_rtx_SET (operands[8], addr));
3499 operands[1] = replace_equiv_address (operands[1], operands[8]);
3503 (define_insn "movmemdi_postreload"
3504 [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3505 (mem:BLK (match_operand:DI 1 "register_operand" "+r,r")))
3506 (clobber (match_operand:DI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3507 (clobber (match_operand:DI 3 "register_operand" "=&r,&r")) ;item tmp1
3508 (clobber (match_operand:DI 6 "register_operand" "=&r,&r")) ;item tmp2
3509 (clobber (match_dup 0))
3510 (clobber (match_dup 1))
3511 (use (match_operand:DI 4 "arith14_operand" "J,2")) ;byte count
3512 (use (match_operand:DI 5 "const_int_operand" "n,n")) ;alignment
3514 "TARGET_64BIT && reload_completed"
3515 "* return pa_output_block_move (operands, !which_alternative);"
3516 [(set_attr "type" "multi,multi")])
3518 (define_expand "setmemsi"
3519 [(parallel [(set (match_operand:BLK 0 "" "")
3520 (match_operand 2 "const_int_operand" ""))
3521 (clobber (match_dup 4))
3522 (clobber (match_dup 5))
3523 (use (match_operand:SI 1 "arith14_operand" ""))
3524 (use (match_operand:SI 3 "const_int_operand" ""))])]
3525 "!TARGET_64BIT && optimize > 0"
3530 /* If value to set is not zero, use the library routine. */
3531 if (operands[2] != const0_rtx)
3534 /* Undetermined size, use the library routine. */
3535 if (GET_CODE (operands[1]) != CONST_INT)
3538 size = INTVAL (operands[1]);
3539 align = INTVAL (operands[3]);
3540 align = align > 4 ? 4 : align;
3542 /* If size/alignment is large, then use the library routines. */
3543 if (size / align > 16)
3546 /* This does happen, but not often enough to worry much about. */
3547 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3550 /* Fall through means we're going to use our block clear pattern. */
3552 = replace_equiv_address (operands[0],
3553 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3554 operands[4] = gen_reg_rtx (SImode);
3555 operands[5] = gen_reg_rtx (SImode);
3558 (define_insn "clrmemsi_prereload"
3559 [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3561 (clobber (match_operand:SI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3562 (clobber (match_operand:SI 4 "register_operand" "=&r,&r")) ;tmp1
3563 (use (match_operand:SI 2 "arith14_operand" "J,1")) ;byte count
3564 (use (match_operand:SI 3 "const_int_operand" "n,n"))] ;alignment
3567 [(set_attr "type" "multi,multi")])
3570 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3572 (clobber (match_operand:SI 1 "register_operand" ""))
3573 (clobber (match_operand:SI 4 "register_operand" ""))
3574 (use (match_operand:SI 2 "arith14_operand" ""))
3575 (use (match_operand:SI 3 "const_int_operand" ""))])]
3576 "!TARGET_64BIT && reload_completed && !flag_peephole2
3577 && GET_CODE (operands[0]) == MEM
3578 && register_operand (XEXP (operands[0], 0), SImode)"
3579 [(set (match_dup 4) (match_dup 5))
3580 (parallel [(set (match_dup 0) (const_int 0))
3581 (clobber (match_dup 1))
3582 (clobber (match_dup 4))
3588 operands[5] = XEXP (operands[0], 0);
3589 operands[0] = replace_equiv_address (operands[0], operands[4]);
3593 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3595 (clobber (match_operand:SI 1 "register_operand" ""))
3596 (clobber (match_operand:SI 4 "register_operand" ""))
3597 (use (match_operand:SI 2 "arith14_operand" ""))
3598 (use (match_operand:SI 3 "const_int_operand" ""))])]
3600 && GET_CODE (operands[0]) == MEM
3601 && register_operand (XEXP (operands[0], 0), SImode)"
3602 [(parallel [(set (match_dup 0) (const_int 0))
3603 (clobber (match_dup 1))
3604 (clobber (match_dup 4))
3610 rtx addr = XEXP (operands[0], 0);
3611 if (dead_or_set_p (curr_insn, addr))
3615 emit_insn (gen_rtx_SET (operands[4], addr));
3616 operands[0] = replace_equiv_address (operands[0], operands[4]);
3620 (define_insn "clrmemsi_postreload"
3621 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3623 (clobber (match_operand:SI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3624 (clobber (match_dup 0))
3625 (use (match_operand:SI 2 "arith14_operand" "J,1")) ;byte count
3626 (use (match_operand:SI 3 "const_int_operand" "n,n")) ;alignment
3628 "!TARGET_64BIT && reload_completed"
3629 "* return pa_output_block_clear (operands, !which_alternative);"
3630 [(set_attr "type" "multi,multi")])
3632 (define_expand "setmemdi"
3633 [(parallel [(set (match_operand:BLK 0 "" "")
3634 (match_operand 2 "const_int_operand" ""))
3635 (clobber (match_dup 4))
3636 (clobber (match_dup 5))
3637 (use (match_operand:DI 1 "arith14_operand" ""))
3638 (use (match_operand:DI 3 "const_int_operand" ""))])]
3639 "TARGET_64BIT && optimize > 0"
3644 /* If value to set is not zero, use the library routine. */
3645 if (operands[2] != const0_rtx)
3648 /* Undetermined size, use the library routine. */
3649 if (GET_CODE (operands[1]) != CONST_INT)
3652 size = INTVAL (operands[1]);
3653 align = INTVAL (operands[3]);
3654 align = align > 8 ? 8 : align;
3656 /* If size/alignment is large, then use the library routines. */
3657 if (size / align > 16)
3660 /* This does happen, but not often enough to worry much about. */
3661 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3664 /* Fall through means we're going to use our block clear pattern. */
3666 = replace_equiv_address (operands[0],
3667 copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3668 operands[4] = gen_reg_rtx (DImode);
3669 operands[5] = gen_reg_rtx (DImode);
3672 (define_insn "clrmemdi_prereload"
3673 [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3675 (clobber (match_operand:DI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3676 (clobber (match_operand:DI 4 "register_operand" "=&r,&r")) ;item tmp1
3677 (use (match_operand:DI 2 "arith14_operand" "J,1")) ;byte count
3678 (use (match_operand:DI 3 "const_int_operand" "n,n"))] ;alignment
3681 [(set_attr "type" "multi,multi")])
3684 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3686 (clobber (match_operand:DI 1 "register_operand" ""))
3687 (clobber (match_operand:DI 4 "register_operand" ""))
3688 (use (match_operand:DI 2 "arith14_operand" ""))
3689 (use (match_operand:DI 3 "const_int_operand" ""))])]
3690 "TARGET_64BIT && reload_completed && !flag_peephole2
3691 && GET_CODE (operands[0]) == MEM
3692 && register_operand (XEXP (operands[0], 0), DImode)"
3693 [(set (match_dup 4) (match_dup 5))
3694 (parallel [(set (match_dup 0) (const_int 0))
3695 (clobber (match_dup 1))
3696 (clobber (match_dup 4))
3702 operands[5] = XEXP (operands[0], 0);
3703 operands[0] = replace_equiv_address (operands[0], operands[4]);
3707 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3709 (clobber (match_operand:DI 1 "register_operand" ""))
3710 (clobber (match_operand:DI 4 "register_operand" ""))
3711 (use (match_operand:DI 2 "arith14_operand" ""))
3712 (use (match_operand:DI 3 "const_int_operand" ""))])]
3714 && GET_CODE (operands[0]) == MEM
3715 && register_operand (XEXP (operands[0], 0), DImode)"
3716 [(parallel [(set (match_dup 0) (const_int 0))
3717 (clobber (match_dup 1))
3718 (clobber (match_dup 4))
3724 rtx addr = XEXP (operands[0], 0);
3725 if (dead_or_set_p (curr_insn, addr))
3729 emit_insn (gen_rtx_SET (operands[4], addr));
3730 operands[0] = replace_equiv_address (operands[0], operands[4]);
3734 (define_insn "clrmemdi_postreload"
3735 [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3737 (clobber (match_operand:DI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3738 (clobber (match_dup 0))
3739 (use (match_operand:DI 2 "arith14_operand" "J,1")) ;byte count
3740 (use (match_operand:DI 3 "const_int_operand" "n,n")) ;alignment
3742 "TARGET_64BIT && reload_completed"
3743 "* return pa_output_block_clear (operands, !which_alternative);"
3744 [(set_attr "type" "multi,multi")])
3746 ;; Floating point move insns
3748 (define_expand "movdf"
3749 [(set (match_operand:DF 0 "general_operand" "")
3750 (match_operand:DF 1 "general_operand" ""))]
3754 if (pa_emit_move_sequence (operands, DFmode, 0))
3758 ;; Handle DFmode input reloads requiring %r1 as a scratch register.
3759 (define_expand "reload_indf_r1"
3760 [(set (match_operand:DF 0 "register_operand" "=Z")
3761 (match_operand:DF 1 "non_hard_reg_operand" ""))
3762 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
3766 if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3769 /* We don't want the clobber emitted, so handle this ourselves. */
3770 emit_insn (gen_rtx_SET (operands[0], operands[1]));
3774 ;; Handle DFmode input reloads requiring a general register as a
3775 ;; scratch register.
3776 (define_expand "reload_indf"
3777 [(set (match_operand:DF 0 "register_operand" "=Z")
3778 (match_operand:DF 1 "non_hard_reg_operand" ""))
3779 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3783 if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3786 /* We don't want the clobber emitted, so handle this ourselves. */
3787 emit_insn (gen_rtx_SET (operands[0], operands[1]));
3791 ;; Handle DFmode output reloads requiring a general register as a
3792 ;; scratch register.
3793 (define_expand "reload_outdf"
3794 [(set (match_operand:DF 0 "non_hard_reg_operand" "")
3795 (match_operand:DF 1 "register_operand" "Z"))
3796 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3800 if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3803 /* We don't want the clobber emitted, so handle this ourselves. */
3804 emit_insn (gen_rtx_SET (operands[0], operands[1]));
3809 [(set (match_operand:DF 0 "move_dest_operand"
3810 "=f,*r,T,?o,?Q,f,*r,*r,?*r,?f")
3811 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3812 "fG,*rG,f,*r,*r,RT,o,RQ,f,*r"))]
3813 "(register_operand (operands[0], DFmode)
3814 || reg_or_0_operand (operands[1], DFmode))
3815 && !(GET_CODE (operands[1]) == CONST_DOUBLE
3816 && GET_CODE (operands[0]) == MEM)
3818 && !TARGET_SOFT_FLOAT"
3821 if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3822 || operands[1] == CONST0_RTX (DFmode))
3823 && !(REG_P (operands[0]) && REG_P (operands[1])
3824 && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
3825 return pa_output_fp_move_double (operands);
3826 return pa_output_move_double (operands);
3828 [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load,fpstore_load,store_fpload")
3829 (set_attr "length" "4,8,4,8,16,4,8,16,12,12")])
3832 [(set (match_operand:DF 0 "indexed_memory_operand" "=R")
3833 (match_operand:DF 1 "reg_or_0_operand" "f"))]
3835 && !TARGET_DISABLE_INDEXING
3836 && reload_completed"
3838 [(set_attr "type" "fpstore")
3839 (set_attr "pa_combine_type" "addmove")
3840 (set_attr "length" "4")])
3843 [(set (match_operand:SI 0 "register_operand" "")
3844 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
3846 (match_operand:SI 2 "register_operand" "")))
3847 (set (mem:DF (match_dup 0))
3848 (match_operand:DF 3 "register_operand" ""))]
3850 && !TARGET_DISABLE_INDEXING
3851 && REG_OK_FOR_BASE_P (operands[2])
3852 && FP_REGNO_P (REGNO (operands[3]))"
3853 [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
3855 (set (match_dup 0) (plus:SI (ashift:SI (match_dup 1) (const_int 3))
3860 [(set (match_operand:SI 0 "register_operand" "")
3861 (plus:SI (match_operand:SI 2 "register_operand" "")
3862 (ashift:SI (match_operand:SI 1 "register_operand" "")
3864 (set (mem:DF (match_dup 0))
3865 (match_operand:DF 3 "register_operand" ""))]
3867 && !TARGET_DISABLE_INDEXING
3868 && REG_OK_FOR_BASE_P (operands[2])
3869 && FP_REGNO_P (REGNO (operands[3]))"
3870 [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
3872 (set (match_dup 0) (plus:SI (ashift:SI (match_dup 1) (const_int 3))
3877 [(set (match_operand:DI 0 "register_operand" "")
3878 (plus:DI (ashift:DI (match_operand:DI 1 "register_operand" "")
3880 (match_operand:DI 2 "register_operand" "")))
3881 (set (mem:DF (match_dup 0))
3882 (match_operand:DF 3 "register_operand" ""))]
3884 && !TARGET_DISABLE_INDEXING
3886 && REG_OK_FOR_BASE_P (operands[2])
3887 && FP_REGNO_P (REGNO (operands[3]))"
3888 [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
3890 (set (match_dup 0) (plus:DI (ashift:DI (match_dup 1) (const_int 3))
3895 [(set (match_operand:DI 0 "register_operand" "")
3896 (plus:DI (match_operand:DI 2 "register_operand" "")
3897 (ashift:DI (match_operand:DI 1 "register_operand" "")
3899 (set (mem:DF (match_dup 0))
3900 (match_operand:DF 3 "register_operand" ""))]
3902 && !TARGET_DISABLE_INDEXING
3904 && REG_OK_FOR_BASE_P (operands[2])
3905 && FP_REGNO_P (REGNO (operands[3]))"
3906 [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
3908 (set (match_dup 0) (plus:DI (ashift:DI (match_dup 1) (const_int 3))
3913 [(set (match_operand:SI 0 "register_operand" "")
3914 (plus:SI (match_operand:SI 1 "register_operand" "")
3915 (match_operand:SI 2 "register_operand" "")))
3916 (set (mem:DF (match_dup 0))
3917 (match_operand:DF 3 "register_operand" ""))]
3919 && !TARGET_DISABLE_INDEXING
3920 && TARGET_NO_SPACE_REGS
3921 && REG_OK_FOR_INDEX_P (operands[1])
3922 && REG_OK_FOR_BASE_P (operands[2])
3923 && FP_REGNO_P (REGNO (operands[3]))"
3924 [(set (mem:DF (plus:SI (match_dup 1) (match_dup 2)))
3926 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
3930 [(set (match_operand:SI 0 "register_operand" "")
3931 (plus:SI (match_operand:SI 1 "register_operand" "")
3932 (match_operand:SI 2 "register_operand" "")))
3933 (set (mem:DF (match_dup 0))
3934 (match_operand:DF 3 "register_operand" ""))]
3936 && !TARGET_DISABLE_INDEXING
3937 && TARGET_NO_SPACE_REGS
3938 && REG_OK_FOR_BASE_P (operands[1])
3939 && REG_OK_FOR_INDEX_P (operands[2])
3940 && FP_REGNO_P (REGNO (operands[3]))"
3941 [(set (mem:DF (plus:SI (match_dup 2) (match_dup 1)))
3943 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
3947 [(set (match_operand:DI 0 "register_operand" "")
3948 (plus:DI (match_operand:DI 1 "register_operand" "")
3949 (match_operand:DI 2 "register_operand" "")))
3950 (set (mem:DF (match_dup 0))
3951 (match_operand:DF 3 "register_operand" ""))]
3953 && !TARGET_DISABLE_INDEXING
3955 && TARGET_NO_SPACE_REGS
3956 && REG_OK_FOR_INDEX_P (operands[1])
3957 && REG_OK_FOR_BASE_P (operands[2])
3958 && FP_REGNO_P (REGNO (operands[3]))"
3959 [(set (mem:DF (plus:DI (match_dup 1) (match_dup 2)))
3961 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3965 [(set (match_operand:DI 0 "register_operand" "")
3966 (plus:DI (match_operand:DI 1 "register_operand" "")
3967 (match_operand:DI 2 "register_operand" "")))
3968 (set (mem:DF (match_dup 0))
3969 (match_operand:DF 3 "register_operand" ""))]
3971 && !TARGET_DISABLE_INDEXING
3973 && TARGET_NO_SPACE_REGS
3974 && REG_OK_FOR_BASE_P (operands[1])
3975 && REG_OK_FOR_INDEX_P (operands[2])
3976 && FP_REGNO_P (REGNO (operands[3]))"
3977 [(set (mem:DF (plus:DI (match_dup 2) (match_dup 1)))
3979 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
3983 [(set (match_operand:DF 0 "move_dest_operand"
3985 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3987 "(register_operand (operands[0], DFmode)
3988 || reg_or_0_operand (operands[1], DFmode))
3990 && TARGET_SOFT_FLOAT"
3993 return pa_output_move_double (operands);
3995 [(set_attr "type" "move,store,store,load,load")
3996 (set_attr "length" "8,8,16,8,16")])
3999 [(set (match_operand:DF 0 "move_dest_operand"
4000 "=!*r,*r,*r,*r,*r,Q,f,f,T")
4001 (match_operand:DF 1 "move_src_operand"
4002 "!*r,J,N,K,RQ,*rG,fG,RT,f"))]
4003 "(register_operand (operands[0], DFmode)
4004 || reg_or_0_operand (operands[1], DFmode))
4005 && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4016 [(set_attr "type" "move,move,move,shift,load,store,fpalu,fpload,fpstore")
4017 (set_attr "pa_combine_type" "addmove")
4018 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
4021 (define_expand "movdi"
4022 [(set (match_operand:DI 0 "general_operand" "")
4023 (match_operand:DI 1 "general_operand" ""))]
4027 if (pa_emit_move_sequence (operands, DImode, 0))
4031 ;; Handle DImode input reloads requiring %r1 as a scratch register.
4032 (define_expand "reload_indi_r1"
4033 [(set (match_operand:DI 0 "register_operand" "=Z")
4034 (match_operand:DI 1 "non_hard_reg_operand" ""))
4035 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
4039 if (pa_emit_move_sequence (operands, DImode, operands[2]))
4042 /* We don't want the clobber emitted, so handle this ourselves. */
4043 emit_insn (gen_rtx_SET (operands[0], operands[1]));
4047 ;; Handle DImode input reloads requiring a general register as a
4048 ;; scratch register.
4049 (define_expand "reload_indi"
4050 [(set (match_operand:DI 0 "register_operand" "=Z")
4051 (match_operand:DI 1 "non_hard_reg_operand" ""))
4052 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4056 if (pa_emit_move_sequence (operands, DImode, operands[2]))
4059 /* We don't want the clobber emitted, so handle this ourselves. */
4060 emit_insn (gen_rtx_SET (operands[0], operands[1]));
4064 ;; Handle DImode output reloads requiring a general register as a
4065 ;; scratch register.
4066 (define_expand "reload_outdi"
4067 [(set (match_operand:DI 0 "non_hard_reg_operand" "")
4068 (match_operand:DI 1 "register_operand" "Z"))
4069 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4073 if (pa_emit_move_sequence (operands, DImode, operands[2]))
4076 /* We don't want the clobber emitted, so handle this ourselves. */
4077 emit_insn (gen_rtx_SET (operands[0], operands[1]));
4082 [(set (match_operand:DI 0 "register_operand" "=r")
4083 (high:DI (match_operand 1 "" "")))]
4087 rtx op0 = operands[0];
4088 rtx op1 = operands[1];
4090 switch (GET_CODE (op1))
4093 #if HOST_BITS_PER_WIDE_INT <= 32
4094 operands[0] = operand_subword (op0, 1, 0, DImode);
4095 output_asm_insn (\"ldil L'%1,%0\", operands);
4097 operands[0] = operand_subword (op0, 0, 0, DImode);
4098 if (INTVAL (op1) < 0)
4099 output_asm_insn (\"ldi -1,%0\", operands);
4101 output_asm_insn (\"ldi 0,%0\", operands);
4103 operands[0] = operand_subword (op0, 1, 0, DImode);
4104 operands[1] = GEN_INT (INTVAL (op1) & 0xffffffff);
4105 output_asm_insn (\"ldil L'%1,%0\", operands);
4107 operands[0] = operand_subword (op0, 0, 0, DImode);
4108 operands[1] = GEN_INT (INTVAL (op1) >> 32);
4109 output_asm_insn (pa_singlemove_string (operands), operands);
4114 operands[0] = operand_subword (op0, 1, 0, DImode);
4115 operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
4116 output_asm_insn (\"ldil L'%1,%0\", operands);
4118 operands[0] = operand_subword (op0, 0, 0, DImode);
4119 operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
4120 output_asm_insn (pa_singlemove_string (operands), operands);
4128 [(set_attr "type" "move")
4129 (set_attr "length" "12")])
4132 [(set (match_operand:DI 0 "move_dest_operand"
4133 "=r,o,Q,r,r,r,*f,*f,T,?r,?*f")
4134 (match_operand:DI 1 "move_src_operand"
4135 "rM,r,r,o*R,Q,i,*fM,RT,*f,*f,r"))]
4136 "(register_operand (operands[0], DImode)
4137 || reg_or_0_operand (operands[1], DImode))
4139 && !TARGET_SOFT_FLOAT"
4142 if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
4143 || operands[1] == CONST0_RTX (DFmode))
4144 && !(REG_P (operands[0]) && REG_P (operands[1])
4145 && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
4146 return pa_output_fp_move_double (operands);
4147 return pa_output_move_double (operands);
4150 "move,store,store,load,load,multi,fpalu,fpload,fpstore,fpstore_load,store_fpload")
4151 (set_attr "length" "8,8,16,8,16,16,4,4,4,12,12")])
4154 [(set (match_operand:DI 0 "move_dest_operand"
4155 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
4156 (match_operand:DI 1 "move_src_operand"
4157 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
4158 "(register_operand (operands[0], DImode)
4159 || reg_or_0_operand (operands[1], DImode))
4160 && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4170 {mfctl|mfctl,w} %%sar,%0
4174 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
4175 (set_attr "pa_combine_type" "addmove")
4176 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
4179 [(set (match_operand:DI 0 "indexed_memory_operand" "=R")
4180 (match_operand:DI 1 "register_operand" "f"))]
4183 && !TARGET_DISABLE_INDEXING
4184 && reload_completed"
4186 [(set_attr "type" "fpstore")
4187 (set_attr "pa_combine_type" "addmove")
4188 (set_attr "length" "4")])
4191 [(set (match_operand:DI 0 "register_operand" "")
4192 (plus:DI (ashift:DI (match_operand:DI 1 "register_operand" "")
4194 (match_operand:DI 2 "register_operand" "")))
4195 (set (mem:DI (match_dup 0))
4196 (match_operand:DI 3 "register_operand" ""))]
4198 && !TARGET_DISABLE_INDEXING
4200 && REG_OK_FOR_BASE_P (operands[2])
4201 && FP_REGNO_P (REGNO (operands[3]))"
4202 [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4204 (set (match_dup 0) (plus:DI (ashift:DI (match_dup 1) (const_int 3))
4209 [(set (match_operand:DI 0 "register_operand" "")
4210 (plus:DI (match_operand:DI 1 "register_operand" "")
4211 (match_operand:DI 2 "register_operand" "")))
4212 (set (mem:DI (match_dup 0))
4213 (match_operand:DI 3 "register_operand" ""))]
4215 && !TARGET_DISABLE_INDEXING
4217 && TARGET_NO_SPACE_REGS
4218 && REG_OK_FOR_INDEX_P (operands[1])
4219 && REG_OK_FOR_BASE_P (operands[2])
4220 && FP_REGNO_P (REGNO (operands[3]))"
4221 [(set (mem:DI (plus:DI (match_dup 1) (match_dup 2)))
4223 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4227 [(set (match_operand:DI 0 "register_operand" "")
4228 (plus:DI (match_operand:DI 1 "register_operand" "")
4229 (match_operand:DI 2 "register_operand" "")))
4230 (set (mem:DI (match_dup 0))
4231 (match_operand:DI 3 "register_operand" ""))]
4233 && !TARGET_DISABLE_INDEXING
4235 && TARGET_NO_SPACE_REGS
4236 && REG_OK_FOR_BASE_P (operands[1])
4237 && REG_OK_FOR_INDEX_P (operands[2])
4238 && FP_REGNO_P (REGNO (operands[3]))"
4239 [(set (mem:DI (plus:DI (match_dup 2) (match_dup 1)))
4241 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4245 [(set (match_operand:DI 0 "move_dest_operand"
4247 (match_operand:DI 1 "general_operand"
4249 "(register_operand (operands[0], DImode)
4250 || reg_or_0_operand (operands[1], DImode))
4252 && TARGET_SOFT_FLOAT"
4255 return pa_output_move_double (operands);
4257 [(set_attr "type" "move,store,store,load,load,multi")
4258 (set_attr "length" "8,8,16,8,16,16")])
4261 [(set (match_operand:DI 0 "register_operand" "=r,&r")
4262 (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
4263 (match_operand:DI 2 "immediate_operand" "i,i")))]
4267 /* Don't output a 64-bit constant, since we can't trust the assembler to
4268 handle it correctly. */
4269 if (GET_CODE (operands[2]) == CONST_DOUBLE)
4270 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
4271 else if (HOST_BITS_PER_WIDE_INT > 32
4272 && GET_CODE (operands[2]) == CONST_INT)
4273 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffffffff);
4274 if (which_alternative == 1)
4275 output_asm_insn (\"copy %1,%0\", operands);
4276 return \"ldo R'%G2(%R1),%R0\";
4278 [(set_attr "type" "move,move")
4279 (set_attr "length" "4,8")])
4281 (define_expand "movsf"
4282 [(set (match_operand:SF 0 "general_operand" "")
4283 (match_operand:SF 1 "general_operand" ""))]
4287 if (pa_emit_move_sequence (operands, SFmode, 0))
4291 ;; Handle SFmode input reloads requiring %r1 as a scratch register.
4292 (define_expand "reload_insf_r1"
4293 [(set (match_operand:SF 0 "register_operand" "=Z")
4294 (match_operand:SF 1 "non_hard_reg_operand" ""))
4295 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
4299 if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4302 /* We don't want the clobber emitted, so handle this ourselves. */
4303 emit_insn (gen_rtx_SET (operands[0], operands[1]));
4307 ;; Handle SFmode input reloads requiring a general register as a
4308 ;; scratch register.
4309 (define_expand "reload_insf"
4310 [(set (match_operand:SF 0 "register_operand" "=Z")
4311 (match_operand:SF 1 "non_hard_reg_operand" ""))
4312 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4316 if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4319 /* We don't want the clobber emitted, so handle this ourselves. */
4320 emit_insn (gen_rtx_SET (operands[0], operands[1]));
4324 ;; Handle SFmode output reloads requiring a general register as a
4325 ;; scratch register.
4326 (define_expand "reload_outsf"
4327 [(set (match_operand:SF 0 "non_hard_reg_operand" "")
4328 (match_operand:SF 1 "register_operand" "Z"))
4329 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4333 if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4336 /* We don't want the clobber emitted, so handle this ourselves. */
4337 emit_insn (gen_rtx_SET (operands[0], operands[1]));
4342 [(set (match_operand:SF 0 "move_dest_operand"
4343 "=f,!*r,f,*r,T,Q,?*r,?f")
4344 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4345 "fG,!*rG,RT,RQ,f,*rG,f,*r"))]
4346 "(register_operand (operands[0], SFmode)
4347 || reg_or_0_operand (operands[1], SFmode))
4348 && !TARGET_SOFT_FLOAT
4357 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
4358 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
4359 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store,fpstore_load,store_fpload")
4360 (set_attr "pa_combine_type" "addmove")
4361 (set_attr "length" "4,4,4,4,4,4,8,8")])
4364 [(set (match_operand:SF 0 "move_dest_operand"
4366 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4367 "fG,!*rG,RT,RQ,f,*rG"))]
4368 "(register_operand (operands[0], SFmode)
4369 || reg_or_0_operand (operands[1], SFmode))
4370 && !TARGET_SOFT_FLOAT
4379 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
4380 (set_attr "pa_combine_type" "addmove")
4381 (set_attr "length" "4,4,4,4,4,4")])
4384 [(set (match_operand:SF 0 "indexed_memory_operand" "=R")
4385 (match_operand:SF 1 "register_operand" "f"))]
4387 && !TARGET_DISABLE_INDEXING
4388 && reload_completed"
4390 [(set_attr "type" "fpstore")
4391 (set_attr "pa_combine_type" "addmove")
4392 (set_attr "length" "4")])
4395 [(set (match_operand:SI 0 "register_operand" "")
4396 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
4398 (match_operand:SI 2 "register_operand" "")))
4399 (set (mem:SF (match_dup 0))
4400 (match_operand:SF 3 "register_operand" ""))]
4402 && !TARGET_DISABLE_INDEXING
4403 && REG_OK_FOR_BASE_P (operands[2])
4404 && FP_REGNO_P (REGNO (operands[3]))"
4405 [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4407 (set (match_dup 0) (plus:SI (ashift:SI (match_dup 1) (const_int 2))
4412 [(set (match_operand:DI 0 "register_operand" "")
4413 (plus:DI (ashift:DI (match_operand:DI 1 "register_operand" "")
4415 (match_operand:DI 2 "register_operand" "")))
4416 (set (mem:SF (match_dup 0))
4417 (match_operand:SF 3 "register_operand" ""))]
4419 && !TARGET_DISABLE_INDEXING
4421 && REG_OK_FOR_BASE_P (operands[2])
4422 && FP_REGNO_P (REGNO (operands[3]))"
4423 [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4425 (set (match_dup 0) (plus:DI (ashift:DI (match_dup 1) (const_int 2))
4430 [(set (match_operand:SI 0 "register_operand" "")
4431 (plus:SI (match_operand:SI 1 "register_operand" "")
4432 (match_operand:SI 2 "register_operand" "")))
4433 (set (mem:SF (match_dup 0))
4434 (match_operand:SF 3 "register_operand" ""))]
4436 && !TARGET_DISABLE_INDEXING
4437 && TARGET_NO_SPACE_REGS
4438 && REG_OK_FOR_INDEX_P (operands[1])
4439 && REG_OK_FOR_BASE_P (operands[2])
4440 && FP_REGNO_P (REGNO (operands[3]))"
4441 [(set (mem:SF (plus:SI (match_dup 1) (match_dup 2)))
4443 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
4447 [(set (match_operand:SI 0 "register_operand" "")
4448 (plus:SI (match_operand:SI 1 "register_operand" "")
4449 (match_operand:SI 2 "register_operand" "")))
4450 (set (mem:SF (match_dup 0))
4451 (match_operand:SF 3 "register_operand" ""))]
4453 && !TARGET_DISABLE_INDEXING
4454 && TARGET_NO_SPACE_REGS
4455 && REG_OK_FOR_BASE_P (operands[1])
4456 && REG_OK_FOR_INDEX_P (operands[2])
4457 && FP_REGNO_P (REGNO (operands[3]))"
4458 [(set (mem:SF (plus:SI (match_dup 2) (match_dup 1)))
4460 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
4464 [(set (match_operand:DI 0 "register_operand" "")
4465 (plus:DI (match_operand:DI 1 "register_operand" "")
4466 (match_operand:DI 2 "register_operand" "")))
4467 (set (mem:SF (match_dup 0))
4468 (match_operand:SF 3 "register_operand" ""))]
4470 && !TARGET_DISABLE_INDEXING
4472 && TARGET_NO_SPACE_REGS
4473 && REG_OK_FOR_INDEX_P (operands[1])
4474 && REG_OK_FOR_BASE_P (operands[2])
4475 && FP_REGNO_P (REGNO (operands[3]))"
4476 [(set (mem:SF (plus:DI (match_dup 1) (match_dup 2)))
4478 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4482 [(set (match_operand:DI 0 "register_operand" "")
4483 (plus:DI (match_operand:DI 1 "register_operand" "")
4484 (match_operand:DI 2 "register_operand" "")))
4485 (set (mem:SF (match_dup 0))
4486 (match_operand:SF 3 "register_operand" ""))]
4488 && !TARGET_DISABLE_INDEXING
4490 && TARGET_NO_SPACE_REGS
4491 && REG_OK_FOR_BASE_P (operands[1])
4492 && REG_OK_FOR_INDEX_P (operands[2])
4493 && FP_REGNO_P (REGNO (operands[3]))"
4494 [(set (mem:SF (plus:DI (match_dup 2) (match_dup 1)))
4496 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4500 [(set (match_operand:SF 0 "move_dest_operand"
4502 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4504 "(register_operand (operands[0], SFmode)
4505 || reg_or_0_operand (operands[1], SFmode))
4506 && TARGET_SOFT_FLOAT"
4511 [(set_attr "type" "move,load,store")
4512 (set_attr "pa_combine_type" "addmove")
4513 (set_attr "length" "4,4,4")])
4517 ;;- zero extension instructions
4518 ;; We have define_expand for zero extension patterns to make sure the
4519 ;; operands get loaded into registers. The define_insns accept
4520 ;; memory operands. This gives us better overall code than just
4521 ;; having a pattern that does or does not accept memory operands.
4523 (define_expand "zero_extendqihi2"
4524 [(set (match_operand:HI 0 "register_operand" "")
4526 (match_operand:QI 1 "register_operand" "")))]
4531 [(set (match_operand:HI 0 "register_operand" "=r,r")
4533 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4534 "GET_CODE (operands[1]) != CONST_INT"
4536 {extru|extrw,u} %1,31,8,%0
4538 [(set_attr "type" "shift,load")
4539 (set_attr "length" "4,4")])
4541 (define_expand "zero_extendqisi2"
4542 [(set (match_operand:SI 0 "register_operand" "")
4544 (match_operand:QI 1 "register_operand" "")))]
4549 [(set (match_operand:SI 0 "register_operand" "=r,r")
4551 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4552 "GET_CODE (operands[1]) != CONST_INT"
4554 {extru|extrw,u} %1,31,8,%0
4556 [(set_attr "type" "shift,load")
4557 (set_attr "length" "4,4")])
4559 (define_expand "zero_extendhisi2"
4560 [(set (match_operand:SI 0 "register_operand" "")
4562 (match_operand:HI 1 "register_operand" "")))]
4567 [(set (match_operand:SI 0 "register_operand" "=r,r")
4569 (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4570 "GET_CODE (operands[1]) != CONST_INT"
4572 {extru|extrw,u} %1,31,16,%0
4574 [(set_attr "type" "shift,load")
4575 (set_attr "length" "4,4")])
4577 (define_expand "zero_extendqidi2"
4578 [(set (match_operand:DI 0 "register_operand" "")
4580 (match_operand:QI 1 "register_operand" "")))]
4585 [(set (match_operand:DI 0 "register_operand" "=r,r")
4587 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4588 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4592 [(set_attr "type" "shift,load")
4593 (set_attr "length" "4,4")])
4595 (define_expand "zero_extendhidi2"
4596 [(set (match_operand:DI 0 "register_operand" "")
4598 (match_operand:HI 1 "register_operand" "")))]
4603 [(set (match_operand:DI 0 "register_operand" "=r,r")
4605 (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4606 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4610 [(set_attr "type" "shift,load")
4611 (set_attr "length" "4,4")])
4613 (define_expand "zero_extendsidi2"
4614 [(set (match_operand:DI 0 "register_operand" "")
4616 (match_operand:SI 1 "register_operand" "")))]
4621 [(set (match_operand:DI 0 "register_operand" "=r,r")
4623 (match_operand:SI 1 "move_src_operand" "r,RQ")))]
4624 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4628 [(set_attr "type" "shift,load")
4629 (set_attr "length" "4,4")])
4631 ;;- sign extension instructions
4633 (define_insn "extendhisi2"
4634 [(set (match_operand:SI 0 "register_operand" "=r")
4635 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
4637 "{extrs|extrw,s} %1,31,16,%0"
4638 [(set_attr "type" "shift")
4639 (set_attr "length" "4")])
4641 (define_insn "extendqihi2"
4642 [(set (match_operand:HI 0 "register_operand" "=r")
4643 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
4645 "{extrs|extrw,s} %1,31,8,%0"
4646 [(set_attr "type" "shift")
4647 (set_attr "length" "4")])
4649 (define_insn "extendqisi2"
4650 [(set (match_operand:SI 0 "register_operand" "=r")
4651 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
4653 "{extrs|extrw,s} %1,31,8,%0"
4654 [(set_attr "type" "shift")
4655 (set_attr "length" "4")])
4657 (define_insn "extendqidi2"
4658 [(set (match_operand:DI 0 "register_operand" "=r")
4659 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
4661 "extrd,s %1,63,8,%0"
4662 [(set_attr "type" "shift")
4663 (set_attr "length" "4")])
4665 (define_insn "extendhidi2"
4666 [(set (match_operand:DI 0 "register_operand" "=r")
4667 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
4669 "extrd,s %1,63,16,%0"
4670 [(set_attr "type" "shift")
4671 (set_attr "length" "4")])
4673 (define_insn "extendsidi2"
4674 [(set (match_operand:DI 0 "register_operand" "=r")
4675 (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))]
4677 "extrd,s %1,63,32,%0"
4678 [(set_attr "type" "shift")
4679 (set_attr "length" "4")])
4682 ;; Conversions between float and double.
4684 (define_insn "extendsfdf2"
4685 [(set (match_operand:DF 0 "register_operand" "=f")
4687 (match_operand:SF 1 "register_operand" "f")))]
4688 "! TARGET_SOFT_FLOAT"
4689 "{fcnvff|fcnv},sgl,dbl %1,%0"
4690 [(set_attr "type" "fpalu")
4691 (set_attr "length" "4")])
4693 (define_insn "truncdfsf2"
4694 [(set (match_operand:SF 0 "register_operand" "=f")
4696 (match_operand:DF 1 "register_operand" "f")))]
4697 "! TARGET_SOFT_FLOAT"
4698 "{fcnvff|fcnv},dbl,sgl %1,%0"
4699 [(set_attr "type" "fpalu")
4700 (set_attr "length" "4")])
4702 ;; Conversion between fixed point and floating point.
4703 ;; Note that among the fix-to-float insns
4704 ;; the ones that start with SImode come first.
4705 ;; That is so that an operand that is a CONST_INT
4706 ;; (and therefore lacks a specific machine mode).
4707 ;; will be recognized as SImode (which is always valid)
4708 ;; rather than as QImode or HImode.
4710 ;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
4711 ;; to be reloaded by putting the constant into memory.
4712 ;; It must come before the more general floatsisf2 pattern.
4714 [(set (match_operand:SF 0 "register_operand" "=f")
4715 (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
4716 "! TARGET_SOFT_FLOAT"
4717 "fldw%F1 %1,%0\;{fcnvxf,sgl,sgl|fcnv,w,sgl} %0,%0"
4718 [(set_attr "type" "fpalu")
4719 (set_attr "length" "8")])
4721 (define_insn "floatsisf2"
4722 [(set (match_operand:SF 0 "register_operand" "=f")
4723 (float:SF (match_operand:SI 1 "register_operand" "f")))]
4724 "! TARGET_SOFT_FLOAT"
4725 "{fcnvxf,sgl,sgl|fcnv,w,sgl} %1,%0"
4726 [(set_attr "type" "fpalu")
4727 (set_attr "length" "4")])
4729 ;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
4730 ;; to be reloaded by putting the constant into memory.
4731 ;; It must come before the more general floatsidf2 pattern.
4733 [(set (match_operand:DF 0 "register_operand" "=f")
4734 (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
4735 "! TARGET_SOFT_FLOAT"
4736 "fldw%F1 %1,%0\;{fcnvxf,sgl,dbl|fcnv,w,dbl} %0,%0"
4737 [(set_attr "type" "fpalu")
4738 (set_attr "length" "8")])
4740 (define_insn "floatsidf2"
4741 [(set (match_operand:DF 0 "register_operand" "=f")
4742 (float:DF (match_operand:SI 1 "register_operand" "f")))]
4743 "! TARGET_SOFT_FLOAT"
4744 "{fcnvxf,sgl,dbl|fcnv,w,dbl} %1,%0"
4745 [(set_attr "type" "fpalu")
4746 (set_attr "length" "4")])
4748 (define_expand "floatunssisf2"
4749 [(set (subreg:SI (match_dup 2) 4)
4750 (match_operand:SI 1 "register_operand" ""))
4751 (set (subreg:SI (match_dup 2) 0)
4753 (set (match_operand:SF 0 "register_operand" "")
4754 (float:SF (match_dup 2)))]
4755 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4760 emit_insn (gen_floatunssisf2_pa20 (operands[0], operands[1]));
4763 operands[2] = gen_reg_rtx (DImode);
4766 (define_expand "floatunssidf2"
4767 [(set (subreg:SI (match_dup 2) 4)
4768 (match_operand:SI 1 "register_operand" ""))
4769 (set (subreg:SI (match_dup 2) 0)
4771 (set (match_operand:DF 0 "register_operand" "")
4772 (float:DF (match_dup 2)))]
4773 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4778 emit_insn (gen_floatunssidf2_pa20 (operands[0], operands[1]));
4781 operands[2] = gen_reg_rtx (DImode);
4784 (define_insn "floatdisf2"
4785 [(set (match_operand:SF 0 "register_operand" "=f")
4786 (float:SF (match_operand:DI 1 "register_operand" "f")))]
4787 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4788 "{fcnvxf,dbl,sgl|fcnv,dw,sgl} %1,%0"
4789 [(set_attr "type" "fpalu")
4790 (set_attr "length" "4")])
4792 (define_insn "floatdidf2"
4793 [(set (match_operand:DF 0 "register_operand" "=f")
4794 (float:DF (match_operand:DI 1 "register_operand" "f")))]
4795 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4796 "{fcnvxf,dbl,dbl|fcnv,dw,dbl} %1,%0"
4797 [(set_attr "type" "fpalu")
4798 (set_attr "length" "4")])
4800 ;; Convert a float to an actual integer.
4801 ;; Truncation is performed as part of the conversion.
4803 (define_insn "fix_truncsfsi2"
4804 [(set (match_operand:SI 0 "register_operand" "=f")
4805 (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4806 "! TARGET_SOFT_FLOAT"
4807 "{fcnvfxt,sgl,sgl|fcnv,t,sgl,w} %1,%0"
4808 [(set_attr "type" "fpalu")
4809 (set_attr "length" "4")])
4811 (define_insn "fix_truncdfsi2"
4812 [(set (match_operand:SI 0 "register_operand" "=f")
4813 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4814 "! TARGET_SOFT_FLOAT"
4815 "{fcnvfxt,dbl,sgl|fcnv,t,dbl,w} %1,%0"
4816 [(set_attr "type" "fpalu")
4817 (set_attr "length" "4")])
4819 (define_insn "fix_truncsfdi2"
4820 [(set (match_operand:DI 0 "register_operand" "=f")
4821 (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4822 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4823 "{fcnvfxt,sgl,dbl|fcnv,t,sgl,dw} %1,%0"
4824 [(set_attr "type" "fpalu")
4825 (set_attr "length" "4")])
4827 (define_insn "fix_truncdfdi2"
4828 [(set (match_operand:DI 0 "register_operand" "=f")
4829 (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4830 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4831 "{fcnvfxt,dbl,dbl|fcnv,t,dbl,dw} %1,%0"
4832 [(set_attr "type" "fpalu")
4833 (set_attr "length" "4")])
4835 (define_insn "floatunssidf2_pa20"
4836 [(set (match_operand:DF 0 "register_operand" "=f")
4837 (unsigned_float:DF (match_operand:SI 1 "register_operand" "f")))]
4838 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4840 [(set_attr "type" "fpalu")
4841 (set_attr "length" "4")])
4843 (define_insn "floatunssisf2_pa20"
4844 [(set (match_operand:SF 0 "register_operand" "=f")
4845 (unsigned_float:SF (match_operand:SI 1 "register_operand" "f")))]
4846 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4848 [(set_attr "type" "fpalu")
4849 (set_attr "length" "4")])
4851 (define_insn "floatunsdisf2"
4852 [(set (match_operand:SF 0 "register_operand" "=f")
4853 (unsigned_float:SF (match_operand:DI 1 "register_operand" "f")))]
4854 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4855 "fcnv,udw,sgl %1,%0"
4856 [(set_attr "type" "fpalu")
4857 (set_attr "length" "4")])
4859 (define_insn "floatunsdidf2"
4860 [(set (match_operand:DF 0 "register_operand" "=f")
4861 (unsigned_float:DF (match_operand:DI 1 "register_operand" "f")))]
4862 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4863 "fcnv,udw,dbl %1,%0"
4864 [(set_attr "type" "fpalu")
4865 (set_attr "length" "4")])
4867 (define_insn "fixuns_truncsfsi2"
4868 [(set (match_operand:SI 0 "register_operand" "=f")
4869 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4870 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4871 "fcnv,t,sgl,uw %1,%0"
4872 [(set_attr "type" "fpalu")
4873 (set_attr "length" "4")])
4875 (define_insn "fixuns_truncdfsi2"
4876 [(set (match_operand:SI 0 "register_operand" "=f")
4877 (unsigned_fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4878 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4879 "fcnv,t,dbl,uw %1,%0"
4880 [(set_attr "type" "fpalu")
4881 (set_attr "length" "4")])
4883 (define_insn "fixuns_truncsfdi2"
4884 [(set (match_operand:DI 0 "register_operand" "=f")
4885 (unsigned_fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4886 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4887 "fcnv,t,sgl,udw %1,%0"
4888 [(set_attr "type" "fpalu")
4889 (set_attr "length" "4")])
4891 (define_insn "fixuns_truncdfdi2"
4892 [(set (match_operand:DI 0 "register_operand" "=f")
4893 (unsigned_fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4894 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4895 "fcnv,t,dbl,udw %1,%0"
4896 [(set_attr "type" "fpalu")
4897 (set_attr "length" "4")])
4899 ;;- arithmetic instructions
4901 (define_expand "adddi3"
4902 [(set (match_operand:DI 0 "register_operand" "")
4903 (plus:DI (match_operand:DI 1 "register_operand" "")
4904 (match_operand:DI 2 "adddi3_operand" "")))]
4909 [(set (match_operand:DI 0 "register_operand" "=r")
4910 (plus:DI (match_operand:DI 1 "register_operand" "%r")
4911 (match_operand:DI 2 "arith11_operand" "rI")))]
4915 if (GET_CODE (operands[2]) == CONST_INT)
4917 if (INTVAL (operands[2]) >= 0)
4918 return \"addi %2,%R1,%R0\;{addc|add,c} %1,%%r0,%0\";
4920 return \"addi %2,%R1,%R0\;{subb|sub,b} %1,%%r0,%0\";
4923 return \"add %R2,%R1,%R0\;{addc|add,c} %2,%1,%0\";
4925 [(set_attr "type" "binary")
4926 (set_attr "length" "8")])
4929 [(set (match_operand:DI 0 "register_operand" "=r,r")
4930 (plus:DI (match_operand:DI 1 "register_operand" "%r,r")
4931 (match_operand:DI 2 "arith14_operand" "r,J")))]
4936 [(set_attr "type" "binary,binary")
4937 (set_attr "pa_combine_type" "addmove")
4938 (set_attr "length" "4,4")])
4941 [(set (match_operand:DI 0 "register_operand" "=r")
4942 (plus:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
4943 (match_operand:DI 2 "register_operand" "r")))]
4946 [(set_attr "type" "binary")
4947 (set_attr "length" "4")])
4950 [(set (match_operand:SI 0 "register_operand" "=r")
4951 (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
4952 (match_operand:SI 2 "register_operand" "r")))]
4955 [(set_attr "type" "binary")
4956 (set_attr "length" "4")])
4958 (define_expand "addvdi3"
4959 [(parallel [(set (match_operand:DI 0 "register_operand" "")
4960 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "")
4961 (match_operand:DI 2 "arith11_operand" "")))
4962 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
4963 (sign_extend:TI (match_dup 2)))
4964 (sign_extend:TI (plus:DI (match_dup 1)
4971 [(set (match_operand:DI 0 "register_operand" "=r,r")
4972 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rM,rM")
4973 (match_operand:DI 2 "arith11_operand" "r,I")))
4974 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
4975 (sign_extend:TI (match_dup 2)))
4976 (sign_extend:TI (plus:DI (match_dup 1)
4982 addi,tsv,* %2,%1,%0"
4983 [(set_attr "type" "binary,binary")
4984 (set_attr "length" "4,4")])
4987 [(set (match_operand:DI 0 "register_operand" "=r")
4988 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rM")
4989 (match_operand:DI 2 "arith11_operand" "rI")))
4990 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
4991 (sign_extend:TI (match_dup 2)))
4992 (sign_extend:TI (plus:DI (match_dup 1)
4998 if (GET_CODE (operands[2]) == CONST_INT)
5000 if (INTVAL (operands[2]) >= 0)
5001 return \"addi %2,%R1,%R0\;{addco|add,c,tsv} %1,%%r0,%0\";
5003 return \"addi %2,%R1,%R0\;{subbo|sub,b,tsv} %1,%%r0,%0\";
5006 return \"add %R2,%R1,%R0\;{addco|add,c,tsv} %2,%1,%0\";
5008 [(set_attr "type" "binary")
5009 (set_attr "length" "8")])
5011 ;; define_splits to optimize cases of adding a constant integer
5012 ;; to a register when the constant does not fit in 14 bits. */
5014 [(set (match_operand:SI 0 "register_operand" "")
5015 (plus:SI (match_operand:SI 1 "register_operand" "")
5016 (match_operand:SI 2 "const_int_operand" "")))
5017 (clobber (match_operand:SI 4 "register_operand" ""))]
5018 "! pa_cint_ok_for_move (UINTVAL (operands[2]))
5019 && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
5020 [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
5021 (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
5024 int val = INTVAL (operands[2]);
5025 int low = (val < 0) ? -0x2000 : 0x1fff;
5026 int rest = val - low;
5028 operands[2] = GEN_INT (rest);
5029 operands[3] = GEN_INT (low);
5033 [(set (match_operand:SI 0 "register_operand" "")
5034 (plus:SI (match_operand:SI 1 "register_operand" "")
5035 (match_operand:SI 2 "const_int_operand" "")))
5036 (clobber (match_operand:SI 4 "register_operand" ""))]
5037 "! pa_cint_ok_for_move (UINTVAL (operands[2]))"
5038 [(set (match_dup 4) (match_dup 2))
5039 (set (match_dup 0) (plus:SI (ashift:SI (match_dup 4) (match_dup 3))
5043 unsigned HOST_WIDE_INT intval = UINTVAL (operands[2]);
5045 /* Try dividing the constant by 2, then 4, and finally 8 to see
5046 if we can get a constant which can be loaded into a register
5047 in a single instruction (pa_cint_ok_for_move).
5049 If that fails, try to negate the constant and subtract it
5050 from our input operand. */
5051 if (intval % 2 == 0 && pa_cint_ok_for_move (intval / 2))
5053 operands[2] = GEN_INT (intval / 2);
5054 operands[3] = const1_rtx;
5056 else if (intval % 4 == 0 && pa_cint_ok_for_move (intval / 4))
5058 operands[2] = GEN_INT (intval / 4);
5059 operands[3] = const2_rtx;
5061 else if (intval % 8 == 0 && pa_cint_ok_for_move (intval / 8))
5063 operands[2] = GEN_INT (intval / 8);
5064 operands[3] = GEN_INT (3);
5066 else if (pa_cint_ok_for_move (-intval))
5068 emit_insn (gen_rtx_SET (operands[4], GEN_INT (-intval)));
5069 emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
5076 (define_insn "addsi3"
5077 [(set (match_operand:SI 0 "register_operand" "=r,r")
5078 (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
5079 (match_operand:SI 2 "arith14_operand" "r,J")))]
5082 {addl|add,l} %1,%2,%0
5084 [(set_attr "type" "binary,binary")
5085 (set_attr "pa_combine_type" "addmove")
5086 (set_attr "length" "4,4")])
5088 (define_insn "addvsi3"
5089 [(set (match_operand:SI 0 "register_operand" "=r,r")
5090 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rM,rM")
5091 (match_operand:SI 2 "arith11_operand" "r,I")))
5092 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
5093 (sign_extend:DI (match_dup 2)))
5094 (sign_extend:DI (plus:SI (match_dup 1)
5099 {addo|add,tsv} %2,%1,%0
5100 {addio|addi,tsv} %2,%1,%0"
5101 [(set_attr "type" "binary,binary")
5102 (set_attr "length" "4,4")])
5104 (define_expand "subdi3"
5105 [(set (match_operand:DI 0 "register_operand" "")
5106 (minus:DI (match_operand:DI 1 "arith11_operand" "")
5107 (match_operand:DI 2 "reg_or_0_operand" "")))]
5112 [(set (match_operand:DI 0 "register_operand" "=r,r,!q")
5113 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I,!U")
5114 (match_operand:DI 2 "reg_or_0_operand" "rM,rM,!rM")))]
5120 [(set_attr "type" "binary,binary,move")
5121 (set_attr "length" "4,4,4")])
5124 [(set (match_operand:DI 0 "register_operand" "=r,&r")
5125 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5126 (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))]
5130 if (GET_CODE (operands[1]) == CONST_INT)
5132 if (INTVAL (operands[1]) >= 0)
5133 return \"subi %1,%R2,%R0\;{subb|sub,b} %%r0,%2,%0\";
5135 return \"ldi -1,%0\;subi %1,%R2,%R0\;{subb|sub,b} %0,%2,%0\";
5138 return \"sub %R1,%R2,%R0\;{subb|sub,b} %1,%2,%0\";
5140 [(set_attr "type" "binary")
5141 (set (attr "length")
5142 (if_then_else (eq_attr "alternative" "0")
5144 (if_then_else (ge (symbol_ref "INTVAL (operands[1])")
5149 (define_expand "subvdi3"
5150 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5151 (minus:DI (match_operand:DI 1 "arith11_operand" "")
5152 (match_operand:DI 2 "reg_or_0_operand" "")))
5153 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5154 (sign_extend:TI (match_dup 2)))
5155 (sign_extend:TI (minus:DI (match_dup 1)
5162 [(set (match_operand:DI 0 "register_operand" "=r,r")
5163 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5164 (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))
5165 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5166 (sign_extend:TI (match_dup 2)))
5167 (sign_extend:TI (minus:DI (match_dup 1)
5172 {subo|sub,tsv} %1,%2,%0
5173 {subio|subi,tsv} %1,%2,%0"
5174 [(set_attr "type" "binary,binary")
5175 (set_attr "length" "4,4")])
5178 [(set (match_operand:DI 0 "register_operand" "=r,&r")
5179 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5180 (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))
5181 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5182 (sign_extend:TI (match_dup 2)))
5183 (sign_extend:TI (minus:DI (match_dup 1)
5189 if (GET_CODE (operands[1]) == CONST_INT)
5191 if (INTVAL (operands[1]) >= 0)
5192 return \"subi %1,%R2,%R0\;{subbo|sub,b,tsv} %%r0,%2,%0\";
5194 return \"ldi -1,%0\;subi %1,%R2,%R0\;{subbo|sub,b,tsv} %0,%2,%0\";
5197 return \"sub %R1,%R2,%R0\;{subbo|sub,b,tsv} %1,%2,%0\";
5199 [(set_attr "type" "binary,binary")
5200 (set (attr "length")
5201 (if_then_else (eq_attr "alternative" "0")
5203 (if_then_else (ge (symbol_ref "INTVAL (operands[1])")
5208 (define_expand "subsi3"
5209 [(set (match_operand:SI 0 "register_operand" "")
5210 (minus:SI (match_operand:SI 1 "arith11_operand" "")
5211 (match_operand:SI 2 "register_operand" "")))]
5216 [(set (match_operand:SI 0 "register_operand" "=r,r")
5217 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
5218 (match_operand:SI 2 "register_operand" "r,r")))]
5223 [(set_attr "type" "binary,binary")
5224 (set_attr "length" "4,4")])
5227 [(set (match_operand:SI 0 "register_operand" "=r,r,!q")
5228 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I,!S")
5229 (match_operand:SI 2 "register_operand" "r,r,!r")))]
5235 [(set_attr "type" "binary,binary,move")
5236 (set_attr "length" "4,4,4")])
5238 (define_insn "subvsi3"
5239 [(set (match_operand:SI 0 "register_operand" "=r,r")
5240 (minus:SI (match_operand:SI 1 "arith11_operand" "rM,I")
5241 (match_operand:SI 2 "reg_or_0_operand" "rM,rM")))
5242 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
5243 (sign_extend:DI (match_dup 2)))
5244 (sign_extend:DI (minus:SI (match_dup 1)
5249 {subo|sub,tsv} %1,%2,%0
5250 {subio|subi,tsv} %1,%2,%0"
5251 [(set_attr "type" "binary,binary")
5252 (set_attr "length" "4,4")])
5254 ;; Trap instructions.
5257 [(trap_if (const_int 1) (const_int 0))]
5259 "{addit|addi,tc},<> 1,%%r0,%%r0"
5260 [(set_attr "type" "trap")
5261 (set_attr "length" "4")])
5263 ;; Clobbering a "register_operand" instead of a match_scratch
5264 ;; in operand3 of millicode calls avoids spilling %r1 and
5265 ;; produces better code.
5267 ;; The mulsi3 insns set up registers for the millicode call.
5268 (define_expand "mulsi3"
5269 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5270 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5271 (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5272 (clobber (match_dup 3))
5273 (clobber (reg:SI 26))
5274 (clobber (reg:SI 25))
5275 (clobber (match_dup 4))])
5276 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5280 operands[4] = gen_rtx_REG (SImode, TARGET_64BIT ? 2 : 31);
5281 if (TARGET_PA_11 && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT)
5283 rtx scratch = gen_reg_rtx (DImode);
5284 operands[1] = force_reg (SImode, operands[1]);
5285 operands[2] = force_reg (SImode, operands[2]);
5286 emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
5287 emit_insn (gen_movsi (operands[0],
5288 gen_rtx_SUBREG (SImode, scratch,
5289 GET_MODE_SIZE (SImode))));
5292 operands[3] = gen_reg_rtx (SImode);
5295 (define_insn "umulsidi3"
5296 [(set (match_operand:DI 0 "register_operand" "=f")
5297 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5298 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
5299 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5301 [(set_attr "type" "fpmuldbl")
5302 (set_attr "length" "4")])
5305 [(set (match_operand:DI 0 "register_operand" "=f")
5306 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5307 (match_operand:DI 2 "uint32_operand" "f")))]
5308 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT"
5310 [(set_attr "type" "fpmuldbl")
5311 (set_attr "length" "4")])
5314 [(set (match_operand:DI 0 "register_operand" "=f")
5315 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5316 (match_operand:DI 2 "uint32_operand" "f")))]
5317 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
5319 [(set_attr "type" "fpmuldbl")
5320 (set_attr "length" "4")])
5323 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5324 (clobber (match_operand:SI 0 "register_operand" "=a"))
5325 (clobber (reg:SI 26))
5326 (clobber (reg:SI 25))
5327 (clobber (reg:SI 31))]
5329 "* return pa_output_mul_insn (0, insn);"
5330 [(set_attr "type" "milli")
5331 (set (attr "length")
5332 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5333 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5336 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5337 (clobber (match_operand:SI 0 "register_operand" "=a"))
5338 (clobber (reg:SI 26))
5339 (clobber (reg:SI 25))
5340 (clobber (reg:SI 2))]
5342 "* return pa_output_mul_insn (0, insn);"
5343 [(set_attr "type" "milli")
5344 (set (attr "length")
5345 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5346 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5348 (define_expand "muldi3"
5349 [(set (match_operand:DI 0 "register_operand" "")
5350 (mult:DI (match_operand:DI 1 "register_operand" "")
5351 (match_operand:DI 2 "register_operand" "")))]
5352 "TARGET_64BIT && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5355 rtx low_product = gen_reg_rtx (DImode);
5356 rtx cross_product1 = gen_reg_rtx (DImode);
5357 rtx cross_product2 = gen_reg_rtx (DImode);
5358 rtx cross_scratch = gen_reg_rtx (DImode);
5359 rtx cross_product = gen_reg_rtx (DImode);
5360 rtx op1l, op1r, op2l, op2r;
5361 rtx op1shifted, op2shifted;
5363 op1shifted = gen_reg_rtx (DImode);
5364 op2shifted = gen_reg_rtx (DImode);
5365 op1l = gen_reg_rtx (SImode);
5366 op1r = gen_reg_rtx (SImode);
5367 op2l = gen_reg_rtx (SImode);
5368 op2r = gen_reg_rtx (SImode);
5370 emit_move_insn (op1shifted, gen_rtx_LSHIFTRT (DImode, operands[1],
5372 emit_move_insn (op2shifted, gen_rtx_LSHIFTRT (DImode, operands[2],
5374 op1r = force_reg (SImode, gen_rtx_SUBREG (SImode, operands[1], 4));
5375 op2r = force_reg (SImode, gen_rtx_SUBREG (SImode, operands[2], 4));
5376 op1l = force_reg (SImode, gen_rtx_SUBREG (SImode, op1shifted, 4));
5377 op2l = force_reg (SImode, gen_rtx_SUBREG (SImode, op2shifted, 4));
5379 /* Emit multiplies for the cross products. */
5380 emit_insn (gen_umulsidi3 (cross_product1, op2r, op1l));
5381 emit_insn (gen_umulsidi3 (cross_product2, op2l, op1r));
5383 /* Emit a multiply for the low sub-word. */
5384 emit_insn (gen_umulsidi3 (low_product, copy_rtx (op2r), copy_rtx (op1r)));
5386 /* Sum the cross products and shift them into proper position. */
5387 emit_insn (gen_adddi3 (cross_scratch, cross_product1, cross_product2));
5388 emit_insn (gen_ashldi3 (cross_product, cross_scratch, GEN_INT (32)));
5390 /* Add the cross product to the low product and store the result
5391 into the output operand . */
5392 emit_insn (gen_adddi3 (operands[0], cross_product, low_product));
5396 ;;; Division and mod.
5397 (define_expand "divsi3"
5398 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5399 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5400 (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
5401 (clobber (match_dup 3))
5402 (clobber (match_dup 4))
5403 (clobber (reg:SI 26))
5404 (clobber (reg:SI 25))
5405 (clobber (match_dup 5))])
5406 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5410 operands[3] = gen_reg_rtx (SImode);
5413 operands[5] = gen_rtx_REG (SImode, 2);
5414 operands[4] = operands[5];
5418 operands[5] = gen_rtx_REG (SImode, 31);
5419 operands[4] = gen_reg_rtx (SImode);
5421 if (GET_CODE (operands[2]) == CONST_INT && pa_emit_hpdiv_const (operands, 0))
5427 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5428 (clobber (match_operand:SI 1 "register_operand" "=a"))
5429 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5430 (clobber (reg:SI 26))
5431 (clobber (reg:SI 25))
5432 (clobber (reg:SI 31))]
5435 return pa_output_div_insn (operands, 0, insn);"
5436 [(set_attr "type" "milli")
5437 (set (attr "length")
5438 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5439 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5443 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5444 (clobber (match_operand:SI 1 "register_operand" "=a"))
5445 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5446 (clobber (reg:SI 26))
5447 (clobber (reg:SI 25))
5448 (clobber (reg:SI 2))]
5451 return pa_output_div_insn (operands, 0, insn);"
5452 [(set_attr "type" "milli")
5453 (set (attr "length")
5454 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5455 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5457 (define_expand "udivsi3"
5458 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5459 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5460 (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
5461 (clobber (match_dup 3))
5462 (clobber (match_dup 4))
5463 (clobber (reg:SI 26))
5464 (clobber (reg:SI 25))
5465 (clobber (match_dup 5))])
5466 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5470 operands[3] = gen_reg_rtx (SImode);
5474 operands[5] = gen_rtx_REG (SImode, 2);
5475 operands[4] = operands[5];
5479 operands[5] = gen_rtx_REG (SImode, 31);
5480 operands[4] = gen_reg_rtx (SImode);
5482 if (GET_CODE (operands[2]) == CONST_INT && pa_emit_hpdiv_const (operands, 1))
5488 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5489 (clobber (match_operand:SI 1 "register_operand" "=a"))
5490 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5491 (clobber (reg:SI 26))
5492 (clobber (reg:SI 25))
5493 (clobber (reg:SI 31))]
5496 return pa_output_div_insn (operands, 1, insn);"
5497 [(set_attr "type" "milli")
5498 (set (attr "length")
5499 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5500 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5504 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5505 (clobber (match_operand:SI 1 "register_operand" "=a"))
5506 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5507 (clobber (reg:SI 26))
5508 (clobber (reg:SI 25))
5509 (clobber (reg:SI 2))]
5512 return pa_output_div_insn (operands, 1, insn);"
5513 [(set_attr "type" "milli")
5514 (set (attr "length")
5515 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5516 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5518 (define_expand "modsi3"
5519 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5520 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5521 (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5522 (clobber (match_dup 3))
5523 (clobber (match_dup 4))
5524 (clobber (reg:SI 26))
5525 (clobber (reg:SI 25))
5526 (clobber (match_dup 5))])
5527 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5533 operands[5] = gen_rtx_REG (SImode, 2);
5534 operands[4] = operands[5];
5538 operands[5] = gen_rtx_REG (SImode, 31);
5539 operands[4] = gen_reg_rtx (SImode);
5541 operands[3] = gen_reg_rtx (SImode);
5545 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5546 (clobber (match_operand:SI 0 "register_operand" "=a"))
5547 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5548 (clobber (reg:SI 26))
5549 (clobber (reg:SI 25))
5550 (clobber (reg:SI 31))]
5553 return pa_output_mod_insn (0, insn);"
5554 [(set_attr "type" "milli")
5555 (set (attr "length")
5556 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5557 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5560 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5561 (clobber (match_operand:SI 0 "register_operand" "=a"))
5562 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5563 (clobber (reg:SI 26))
5564 (clobber (reg:SI 25))
5565 (clobber (reg:SI 2))]
5568 return pa_output_mod_insn (0, insn);"
5569 [(set_attr "type" "milli")
5570 (set (attr "length")
5571 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5572 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5574 (define_expand "umodsi3"
5575 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5576 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5577 (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5578 (clobber (match_dup 3))
5579 (clobber (match_dup 4))
5580 (clobber (reg:SI 26))
5581 (clobber (reg:SI 25))
5582 (clobber (match_dup 5))])
5583 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5589 operands[5] = gen_rtx_REG (SImode, 2);
5590 operands[4] = operands[5];
5594 operands[5] = gen_rtx_REG (SImode, 31);
5595 operands[4] = gen_reg_rtx (SImode);
5597 operands[3] = gen_reg_rtx (SImode);
5601 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5602 (clobber (match_operand:SI 0 "register_operand" "=a"))
5603 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5604 (clobber (reg:SI 26))
5605 (clobber (reg:SI 25))
5606 (clobber (reg:SI 31))]
5609 return pa_output_mod_insn (1, insn);"
5610 [(set_attr "type" "milli")
5611 (set (attr "length")
5612 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5613 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5616 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5617 (clobber (match_operand:SI 0 "register_operand" "=a"))
5618 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5619 (clobber (reg:SI 26))
5620 (clobber (reg:SI 25))
5621 (clobber (reg:SI 2))]
5624 return pa_output_mod_insn (1, insn);"
5625 [(set_attr "type" "milli")
5626 (set (attr "length")
5627 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5628 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5630 ;;- and instructions
5631 ;; We define DImode `and` so with DImode `not` we can get
5632 ;; DImode `andn`. Other combinations are possible.
5634 (define_expand "anddi3"
5635 [(set (match_operand:DI 0 "register_operand" "")
5636 (and:DI (match_operand:DI 1 "register_operand" "")
5637 (match_operand:DI 2 "and_operand" "")))]
5642 [(set (match_operand:DI 0 "register_operand" "=r,r")
5643 (and:DI (match_operand:DI 1 "register_operand" "%?r,0")
5644 (match_operand:DI 2 "and_operand" "rO,P")))]
5646 "* return pa_output_64bit_and (operands); "
5647 [(set_attr "type" "binary")
5648 (set_attr "length" "4")])
5650 ; The ? for op1 makes reload prefer zdepi instead of loading a huge
5651 ; constant with ldil;ldo.
5652 (define_insn "andsi3"
5653 [(set (match_operand:SI 0 "register_operand" "=r,r")
5654 (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
5655 (match_operand:SI 2 "and_operand" "rO,P")))]
5657 "* return pa_output_and (operands); "
5658 [(set_attr "type" "binary,shift")
5659 (set_attr "length" "4,4")])
5662 [(set (match_operand:DI 0 "register_operand" "=r")
5663 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5664 (match_operand:DI 2 "register_operand" "r")))]
5667 [(set_attr "type" "binary")
5668 (set_attr "length" "4")])
5671 [(set (match_operand:SI 0 "register_operand" "=r")
5672 (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5673 (match_operand:SI 2 "register_operand" "r")))]
5676 [(set_attr "type" "binary")
5677 (set_attr "length" "4")])
5679 (define_expand "iordi3"
5680 [(set (match_operand:DI 0 "register_operand" "")
5681 (ior:DI (match_operand:DI 1 "register_operand" "")
5682 (match_operand:DI 2 "reg_or_cint_ior_operand" "")))]
5687 [(set (match_operand:DI 0 "register_operand" "=r,r")
5688 (ior:DI (match_operand:DI 1 "register_operand" "0,0")
5689 (match_operand:DI 2 "cint_ior_operand" "M,i")))]
5691 "* return pa_output_64bit_ior (operands); "
5692 [(set_attr "type" "binary,shift")
5693 (set_attr "length" "4,4")])
5696 [(set (match_operand:DI 0 "register_operand" "=r")
5697 (ior:DI (match_operand:DI 1 "register_operand" "%r")
5698 (match_operand:DI 2 "register_operand" "r")))]
5701 [(set_attr "type" "binary")
5702 (set_attr "length" "4")])
5704 ;; Need a define_expand because we've run out of CONST_OK... characters.
5705 (define_expand "iorsi3"
5706 [(set (match_operand:SI 0 "register_operand" "")
5707 (ior:SI (match_operand:SI 1 "register_operand" "")
5708 (match_operand:SI 2 "reg_or_cint_ior_operand" "")))]
5713 [(set (match_operand:SI 0 "register_operand" "=r,r")
5714 (ior:SI (match_operand:SI 1 "register_operand" "0,0")
5715 (match_operand:SI 2 "cint_ior_operand" "M,i")))]
5717 "* return pa_output_ior (operands); "
5718 [(set_attr "type" "binary,shift")
5719 (set_attr "length" "4,4")])
5722 [(set (match_operand:SI 0 "register_operand" "=r")
5723 (ior:SI (match_operand:SI 1 "register_operand" "%r")
5724 (match_operand:SI 2 "register_operand" "r")))]
5727 [(set_attr "type" "binary")
5728 (set_attr "length" "4")])
5730 (define_expand "xordi3"
5731 [(set (match_operand:DI 0 "register_operand" "")
5732 (xor:DI (match_operand:DI 1 "register_operand" "")
5733 (match_operand:DI 2 "register_operand" "")))]
5738 [(set (match_operand:DI 0 "register_operand" "=r")
5739 (xor:DI (match_operand:DI 1 "register_operand" "%r")
5740 (match_operand:DI 2 "register_operand" "r")))]
5743 [(set_attr "type" "binary")
5744 (set_attr "length" "4")])
5746 (define_insn "xorsi3"
5747 [(set (match_operand:SI 0 "register_operand" "=r")
5748 (xor:SI (match_operand:SI 1 "register_operand" "%r")
5749 (match_operand:SI 2 "register_operand" "r")))]
5752 [(set_attr "type" "binary")
5753 (set_attr "length" "4")])
5755 (define_expand "negdi2"
5756 [(set (match_operand:DI 0 "register_operand" "")
5757 (neg:DI (match_operand:DI 1 "register_operand" "")))]
5762 [(set (match_operand:DI 0 "register_operand" "=r")
5763 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5765 "sub %%r0,%R1,%R0\;{subb|sub,b} %%r0,%1,%0"
5766 [(set_attr "type" "unary")
5767 (set_attr "length" "8")])
5770 [(set (match_operand:DI 0 "register_operand" "=r")
5771 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5774 [(set_attr "type" "unary")
5775 (set_attr "length" "4")])
5777 (define_expand "negvdi2"
5778 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5779 (neg:DI (match_operand:DI 1 "register_operand" "")))
5780 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5781 (sign_extend:TI (neg:DI (match_dup 1))))
5787 [(set (match_operand:DI 0 "register_operand" "=r")
5788 (neg:DI (match_operand:DI 1 "register_operand" "r")))
5789 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5790 (sign_extend:TI (neg:DI (match_dup 1))))
5793 "sub %%r0,%R1,%R0\;{subbo|sub,b,tsv} %%r0,%1,%0"
5794 [(set_attr "type" "unary")
5795 (set_attr "length" "8")])
5798 [(set (match_operand:DI 0 "register_operand" "=r")
5799 (neg:DI (match_operand:DI 1 "register_operand" "r")))
5800 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5801 (sign_extend:TI (neg:DI (match_dup 1))))
5804 "sub,tsv %%r0,%1,%0"
5805 [(set_attr "type" "unary")
5806 (set_attr "length" "4")])
5808 (define_insn "negsi2"
5809 [(set (match_operand:SI 0 "register_operand" "=r")
5810 (neg:SI (match_operand:SI 1 "register_operand" "r")))]
5813 [(set_attr "type" "unary")
5814 (set_attr "length" "4")])
5816 (define_insn "negvsi2"
5817 [(set (match_operand:SI 0 "register_operand" "=r")
5818 (neg:SI (match_operand:SI 1 "register_operand" "r")))
5819 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
5820 (sign_extend:DI (neg:SI (match_dup 1))))
5823 "{subo|sub,tsv} %%r0,%1,%0"
5824 [(set_attr "type" "unary")
5825 (set_attr "length" "4")])
5827 (define_expand "one_cmpldi2"
5828 [(set (match_operand:DI 0 "register_operand" "")
5829 (not:DI (match_operand:DI 1 "register_operand" "")))]
5836 [(set (match_operand:DI 0 "register_operand" "=r")
5837 (not:DI (match_operand:DI 1 "register_operand" "r")))]
5839 "uaddcm %%r0,%1,%0\;uaddcm %%r0,%R1,%R0"
5840 [(set_attr "type" "unary")
5841 (set_attr "length" "8")])
5844 [(set (match_operand:DI 0 "register_operand" "=r")
5845 (not:DI (match_operand:DI 1 "register_operand" "r")))]
5848 [(set_attr "type" "unary")
5849 (set_attr "length" "4")])
5851 (define_insn "one_cmplsi2"
5852 [(set (match_operand:SI 0 "register_operand" "=r")
5853 (not:SI (match_operand:SI 1 "register_operand" "r")))]
5856 [(set_attr "type" "unary")
5857 (set_attr "length" "4")])
5859 ;; Floating point arithmetic instructions.
5861 (define_insn "adddf3"
5862 [(set (match_operand:DF 0 "register_operand" "=f")
5863 (plus:DF (match_operand:DF 1 "register_operand" "f")
5864 (match_operand:DF 2 "register_operand" "f")))]
5865 "! TARGET_SOFT_FLOAT"
5867 [(set_attr "type" "fpalu")
5868 (set_attr "pa_combine_type" "faddsub")
5869 (set_attr "length" "4")])
5871 (define_insn "addsf3"
5872 [(set (match_operand:SF 0 "register_operand" "=f")
5873 (plus:SF (match_operand:SF 1 "register_operand" "f")
5874 (match_operand:SF 2 "register_operand" "f")))]
5875 "! TARGET_SOFT_FLOAT"
5877 [(set_attr "type" "fpalu")
5878 (set_attr "pa_combine_type" "faddsub")
5879 (set_attr "length" "4")])
5881 (define_insn "subdf3"
5882 [(set (match_operand:DF 0 "register_operand" "=f")
5883 (minus:DF (match_operand:DF 1 "register_operand" "f")
5884 (match_operand:DF 2 "register_operand" "f")))]
5885 "! TARGET_SOFT_FLOAT"
5887 [(set_attr "type" "fpalu")
5888 (set_attr "pa_combine_type" "faddsub")
5889 (set_attr "length" "4")])
5891 (define_insn "subsf3"
5892 [(set (match_operand:SF 0 "register_operand" "=f")
5893 (minus:SF (match_operand:SF 1 "register_operand" "f")
5894 (match_operand:SF 2 "register_operand" "f")))]
5895 "! TARGET_SOFT_FLOAT"
5897 [(set_attr "type" "fpalu")
5898 (set_attr "pa_combine_type" "faddsub")
5899 (set_attr "length" "4")])
5901 (define_insn "muldf3"
5902 [(set (match_operand:DF 0 "register_operand" "=f")
5903 (mult:DF (match_operand:DF 1 "register_operand" "f")
5904 (match_operand:DF 2 "register_operand" "f")))]
5905 "! TARGET_SOFT_FLOAT"
5907 [(set_attr "type" "fpmuldbl")
5908 (set_attr "pa_combine_type" "fmpy")
5909 (set_attr "length" "4")])
5911 (define_insn "mulsf3"
5912 [(set (match_operand:SF 0 "register_operand" "=f")
5913 (mult:SF (match_operand:SF 1 "register_operand" "f")
5914 (match_operand:SF 2 "register_operand" "f")))]
5915 "! TARGET_SOFT_FLOAT"
5917 [(set_attr "type" "fpmulsgl")
5918 (set_attr "pa_combine_type" "fmpy")
5919 (set_attr "length" "4")])
5921 (define_insn "divdf3"
5922 [(set (match_operand:DF 0 "register_operand" "=f")
5923 (div:DF (match_operand:DF 1 "register_operand" "f")
5924 (match_operand:DF 2 "register_operand" "f")))]
5925 "! TARGET_SOFT_FLOAT"
5927 [(set_attr "type" "fpdivdbl")
5928 (set_attr "length" "4")])
5930 (define_insn "divsf3"
5931 [(set (match_operand:SF 0 "register_operand" "=f")
5932 (div:SF (match_operand:SF 1 "register_operand" "f")
5933 (match_operand:SF 2 "register_operand" "f")))]
5934 "! TARGET_SOFT_FLOAT"
5936 [(set_attr "type" "fpdivsgl")
5937 (set_attr "length" "4")])
5939 ;; Processors prior to PA 2.0 don't have a fneg instruction. Fast
5940 ;; negation can be done by subtracting from plus zero. However, this
5941 ;; violates the IEEE standard when negating plus and minus zero.
5942 ;; The slow path toggles the sign bit in the general registers.
5943 (define_expand "negdf2"
5944 [(set (match_operand:DF 0 "register_operand" "")
5945 (neg:DF (match_operand:DF 1 "register_operand" "")))]
5946 "!TARGET_SOFT_FLOAT"
5948 if (TARGET_PA_20 || !flag_signed_zeros)
5949 emit_insn (gen_negdf2_fast (operands[0], operands[1]));
5951 emit_insn (gen_negdf2_slow (operands[0], operands[1]));
5955 (define_insn "negdf2_slow"
5956 [(set (match_operand:DF 0 "register_operand" "=r")
5957 (neg:DF (match_operand:DF 1 "register_operand" "r")))]
5958 "!TARGET_SOFT_FLOAT && !TARGET_PA_20"
5961 if (rtx_equal_p (operands[0], operands[1]))
5962 return \"and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0\";
5964 return \"and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0\;copy %R1,%R0\";
5966 [(set_attr "type" "multi")
5967 (set (attr "length")
5968 (if_then_else (match_test "rtx_equal_p (operands[0], operands[1])")
5972 (define_insn "negdf2_fast"
5973 [(set (match_operand:DF 0 "register_operand" "=f")
5974 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
5975 "!TARGET_SOFT_FLOAT"
5979 return \"fneg,dbl %1,%0\";
5981 return \"fsub,dbl %%fr0,%1,%0\";
5983 [(set_attr "type" "fpalu")
5984 (set_attr "length" "4")])
5986 (define_expand "negsf2"
5987 [(set (match_operand:SF 0 "register_operand" "")
5988 (neg:SF (match_operand:SF 1 "register_operand" "")))]
5989 "!TARGET_SOFT_FLOAT"
5991 if (TARGET_PA_20 || !flag_signed_zeros)
5992 emit_insn (gen_negsf2_fast (operands[0], operands[1]));
5994 emit_insn (gen_negsf2_slow (operands[0], operands[1]));
5998 (define_insn "negsf2_slow"
5999 [(set (match_operand:SF 0 "register_operand" "=r")
6000 (neg:SF (match_operand:SF 1 "register_operand" "r")))]
6001 "!TARGET_SOFT_FLOAT && !TARGET_PA_20"
6002 "and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0"
6003 [(set_attr "type" "multi")
6004 (set_attr "length" "12")])
6006 (define_insn "negsf2_fast"
6007 [(set (match_operand:SF 0 "register_operand" "=f")
6008 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
6009 "!TARGET_SOFT_FLOAT"
6013 return \"fneg,sgl %1,%0\";
6015 return \"fsub,sgl %%fr0,%1,%0\";
6017 [(set_attr "type" "fpalu")
6018 (set_attr "length" "4")])
6020 (define_insn "absdf2"
6021 [(set (match_operand:DF 0 "register_operand" "=f")
6022 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
6023 "! TARGET_SOFT_FLOAT"
6025 [(set_attr "type" "fpalu")
6026 (set_attr "length" "4")])
6028 (define_insn "abssf2"
6029 [(set (match_operand:SF 0 "register_operand" "=f")
6030 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
6031 "! TARGET_SOFT_FLOAT"
6033 [(set_attr "type" "fpalu")
6034 (set_attr "length" "4")])
6036 (define_insn "sqrtdf2"
6037 [(set (match_operand:DF 0 "register_operand" "=f")
6038 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
6039 "! TARGET_SOFT_FLOAT"
6041 [(set_attr "type" "fpsqrtdbl")
6042 (set_attr "length" "4")])
6044 (define_insn "sqrtsf2"
6045 [(set (match_operand:SF 0 "register_operand" "=f")
6046 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
6047 "! TARGET_SOFT_FLOAT"
6049 [(set_attr "type" "fpsqrtsgl")
6050 (set_attr "length" "4")])
6052 ;; PA 2.0 floating point instructions
6055 (define_insn "fmadf4"
6056 [(set (match_operand:DF 0 "register_operand" "=f")
6057 (fma:DF (match_operand:DF 1 "register_operand" "f")
6058 (match_operand:DF 2 "register_operand" "f")
6059 (match_operand:DF 3 "register_operand" "f")))]
6060 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6061 "fmpyfadd,dbl %1,%2,%3,%0"
6062 [(set_attr "type" "fpmuldbl")
6063 (set_attr "length" "4")])
6065 (define_insn "fmasf4"
6066 [(set (match_operand:SF 0 "register_operand" "=f")
6067 (fma:SF (match_operand:SF 1 "register_operand" "f")
6068 (match_operand:SF 2 "register_operand" "f")
6069 (match_operand:SF 3 "register_operand" "f")))]
6070 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6071 "fmpyfadd,sgl %1,%2,%3,%0"
6072 [(set_attr "type" "fpmulsgl")
6073 (set_attr "length" "4")])
6075 ; fmpynfadd patterns
6076 (define_insn "fnmadf4"
6077 [(set (match_operand:DF 0 "register_operand" "=f")
6078 (fma:DF (neg:DF (match_operand:DF 1 "register_operand" "f"))
6079 (match_operand:DF 2 "register_operand" "f")
6080 (match_operand:DF 3 "register_operand" "f")))]
6081 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6082 "fmpynfadd,dbl %1,%2,%3,%0"
6083 [(set_attr "type" "fpmuldbl")
6084 (set_attr "length" "4")])
6086 (define_insn "fnmasf4"
6087 [(set (match_operand:SF 0 "register_operand" "=f")
6088 (fma:SF (neg:SF (match_operand:SF 1 "register_operand" "f"))
6089 (match_operand:SF 2 "register_operand" "f")
6090 (match_operand:SF 3 "register_operand" "f")))]
6091 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6092 "fmpynfadd,sgl %1,%2,%3,%0"
6093 [(set_attr "type" "fpmulsgl")
6094 (set_attr "length" "4")])
6098 [(set (match_operand:DF 0 "register_operand" "=f")
6099 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))]
6100 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6102 [(set_attr "type" "fpalu")
6103 (set_attr "length" "4")])
6106 [(set (match_operand:SF 0 "register_operand" "=f")
6107 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))]
6108 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6110 [(set_attr "type" "fpalu")
6111 (set_attr "length" "4")])
6114 [(set (match_operand:DF 0 "register_operand" "=f")
6115 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6116 (set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
6117 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6118 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6120 [(set_attr "type" "fpalu")
6121 (set_attr "length" "8")])
6124 [(set (match_operand:DF 0 "register_operand" "")
6125 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" ""))))
6126 (set (match_operand:DF 2 "register_operand" "") (abs:DF (match_dup 1)))]
6127 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6128 [(set (match_dup 2) (abs:DF (match_dup 1)))
6129 (set (match_dup 0) (neg:DF (abs:DF (match_dup 1))))]
6133 [(set (match_operand:SF 0 "register_operand" "=f")
6134 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6135 (set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
6136 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6137 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6139 [(set_attr "type" "fpalu")
6140 (set_attr "length" "8")])
6143 [(set (match_operand:SF 0 "register_operand" "")
6144 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" ""))))
6145 (set (match_operand:SF 2 "register_operand" "") (abs:SF (match_dup 1)))]
6146 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6147 [(set (match_dup 2) (abs:SF (match_dup 1)))
6148 (set (match_dup 0) (neg:SF (abs:SF (match_dup 1))))]
6151 ;; Negating a multiply can be faked by adding zero in a fused multiply-add
6152 ;; instruction if we can ignore the sign of zero.
6154 [(set (match_operand:DF 0 "register_operand" "=f")
6155 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6156 (match_operand:DF 2 "register_operand" "f"))))]
6157 "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6158 "fmpynfadd,dbl %1,%2,%%fr0,%0"
6159 [(set_attr "type" "fpmuldbl")
6160 (set_attr "length" "4")])
6163 [(set (match_operand:SF 0 "register_operand" "=f")
6164 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6165 (match_operand:SF 2 "register_operand" "f"))))]
6166 "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6167 "fmpynfadd,sgl %1,%2,%%fr0,%0"
6168 [(set_attr "type" "fpmuldbl")
6169 (set_attr "length" "4")])
6172 [(set (match_operand:DF 0 "register_operand" "=f")
6173 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6174 (match_operand:DF 2 "register_operand" "f"))))
6175 (set (match_operand:DF 3 "register_operand" "=&f")
6176 (mult:DF (match_dup 1) (match_dup 2)))]
6177 "(!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros
6178 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6179 || reg_overlap_mentioned_p (operands[3], operands[2])))"
6181 [(set_attr "type" "fpmuldbl")
6182 (set_attr "length" "8")])
6185 [(set (match_operand:DF 0 "register_operand" "")
6186 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
6187 (match_operand:DF 2 "register_operand" ""))))
6188 (set (match_operand:DF 3 "register_operand" "")
6189 (mult:DF (match_dup 1) (match_dup 2)))]
6190 "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6191 [(set (match_dup 3) (mult:DF (match_dup 1) (match_dup 2)))
6192 (set (match_dup 0) (neg:DF (mult:DF (match_dup 1) (match_dup 2))))]
6196 [(set (match_operand:SF 0 "register_operand" "=f")
6197 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6198 (match_operand:SF 2 "register_operand" "f"))))
6199 (set (match_operand:SF 3 "register_operand" "=&f")
6200 (mult:SF (match_dup 1) (match_dup 2)))]
6201 "(!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros
6202 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6203 || reg_overlap_mentioned_p (operands[3], operands[2])))"
6205 [(set_attr "type" "fpmuldbl")
6206 (set_attr "length" "8")])
6209 [(set (match_operand:SF 0 "register_operand" "")
6210 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
6211 (match_operand:SF 2 "register_operand" ""))))
6212 (set (match_operand:SF 3 "register_operand" "")
6213 (mult:SF (match_dup 1) (match_dup 2)))]
6214 "!TARGET_SOFT_FLOAT && TARGET_PA_20&& !flag_signed_zeros"
6215 [(set (match_dup 3) (mult:SF (match_dup 1) (match_dup 2)))
6216 (set (match_dup 0) (neg:SF (mult:SF (match_dup 1) (match_dup 2))))]
6219 ;;- Shift instructions
6221 ;; Optimized special case of shifting.
6224 [(set (match_operand:SI 0 "register_operand" "=r")
6225 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6229 [(set_attr "type" "load")
6230 (set_attr "length" "4")])
6233 [(set (match_operand:SI 0 "register_operand" "=r")
6234 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6238 [(set_attr "type" "load")
6239 (set_attr "length" "4")])
6242 [(set (match_operand:SI 0 "register_operand" "=r")
6243 (plus:SI (ashift:SI (match_operand:SI 2 "register_operand" "r")
6244 (match_operand:SI 3 "shadd_operand" ""))
6245 (match_operand:SI 1 "register_operand" "r")))]
6247 "{sh%o3addl %2,%1,%0|shladd,l %2,%o3,%1,%0} "
6248 [(set_attr "type" "binary")
6249 (set_attr "length" "4")])
6252 [(set (match_operand:DI 0 "register_operand" "=r")
6253 (plus:DI (ashift:DI (match_operand:DI 2 "register_operand" "r")
6254 (match_operand:DI 3 "shadd_operand" ""))
6255 (match_operand:DI 1 "register_operand" "r")))]
6257 "shladd,l %2,%o3,%1,%0"
6258 [(set_attr "type" "binary")
6259 (set_attr "length" "4")])
6261 (define_expand "ashlsi3"
6262 [(set (match_operand:SI 0 "register_operand" "")
6263 (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
6264 (match_operand:SI 2 "arith32_operand" "")))]
6268 if (GET_CODE (operands[2]) != CONST_INT)
6270 rtx temp = gen_reg_rtx (SImode);
6271 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6272 if (GET_CODE (operands[1]) == CONST_INT)
6273 emit_insn (gen_zvdep_imm32 (operands[0], operands[1], temp));
6275 emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
6278 /* Make sure both inputs are not constants,
6279 there are no patterns for that. */
6280 operands[1] = force_reg (SImode, operands[1]);
6284 [(set (match_operand:SI 0 "register_operand" "=r")
6285 (ashift:SI (match_operand:SI 1 "register_operand" "r")
6286 (match_operand:SI 2 "const_int_operand" "n")))]
6288 "{zdep|depw,z} %1,%P2,%L2,%0"
6289 [(set_attr "type" "shift")
6290 (set_attr "length" "4")])
6292 ; Match cases of op1 a CONST_INT here that zvdep_imm32 doesn't handle.
6293 ; Doing it like this makes slightly better code since reload can
6294 ; replace a register with a known value in range -16..15 with a
6295 ; constant. Ideally, we would like to merge zvdep32 and zvdep_imm32,
6296 ; but since we have no more CONST_OK... characters, that is not
6298 (define_insn "zvdep32"
6299 [(set (match_operand:SI 0 "register_operand" "=r,r")
6300 (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
6301 (minus:SI (const_int 31)
6302 (match_operand:SI 2 "register_operand" "q,q"))))]
6305 {zvdep %1,32,%0|depw,z %1,%%sar,32,%0}
6306 {zvdepi %1,32,%0|depwi,z %1,%%sar,32,%0}"
6307 [(set_attr "type" "shift,shift")
6308 (set_attr "length" "4,4")])
6310 (define_insn "zvdep_imm32"
6311 [(set (match_operand:SI 0 "register_operand" "=r")
6312 (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
6313 (minus:SI (const_int 31)
6314 (match_operand:SI 2 "register_operand" "q"))))]
6318 unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
6319 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6320 operands[1] = GEN_INT ((x & 0xf) - 0x10);
6321 return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\";
6323 [(set_attr "type" "shift")
6324 (set_attr "length" "4")])
6326 (define_insn "vdepi_ior"
6327 [(set (match_operand:SI 0 "register_operand" "=r")
6328 (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
6329 (minus:SI (const_int 31)
6330 (match_operand:SI 2 "register_operand" "q")))
6331 (match_operand:SI 3 "register_operand" "0")))]
6332 ; accept ...0001...1, can this be generalized?
6333 "exact_log2 (INTVAL (operands[1]) + 1) > 0"
6336 HOST_WIDE_INT x = INTVAL (operands[1]);
6337 operands[2] = GEN_INT (exact_log2 (x + 1));
6338 return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\";
6340 [(set_attr "type" "shift")
6341 (set_attr "length" "4")])
6343 (define_insn "vdepi_and"
6344 [(set (match_operand:SI 0 "register_operand" "=r")
6345 (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
6346 (minus:SI (const_int 31)
6347 (match_operand:SI 2 "register_operand" "q")))
6348 (match_operand:SI 3 "register_operand" "0")))]
6349 ; this can be generalized...!
6350 "INTVAL (operands[1]) == -2"
6353 HOST_WIDE_INT x = INTVAL (operands[1]);
6354 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6355 return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\";
6357 [(set_attr "type" "shift")
6358 (set_attr "length" "4")])
6360 (define_expand "ashldi3"
6361 [(set (match_operand:DI 0 "register_operand" "")
6362 (ashift:DI (match_operand:DI 1 "lhs_lshift_operand" "")
6363 (match_operand:DI 2 "arith32_operand" "")))]
6367 if (GET_CODE (operands[2]) != CONST_INT)
6369 rtx temp = gen_reg_rtx (DImode);
6370 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6371 if (GET_CODE (operands[1]) == CONST_INT)
6372 emit_insn (gen_zvdep_imm64 (operands[0], operands[1], temp));
6374 emit_insn (gen_zvdep64 (operands[0], operands[1], temp));
6377 /* Make sure both inputs are not constants,
6378 there are no patterns for that. */
6379 operands[1] = force_reg (DImode, operands[1]);
6383 [(set (match_operand:DI 0 "register_operand" "=r")
6384 (ashift:DI (match_operand:DI 1 "register_operand" "r")
6385 (match_operand:DI 2 "const_int_operand" "n")))]
6387 "depd,z %1,%p2,%Q2,%0"
6388 [(set_attr "type" "shift")
6389 (set_attr "length" "4")])
6391 ; Match cases of op1 a CONST_INT here that zvdep_imm64 doesn't handle.
6392 ; Doing it like this makes slightly better code since reload can
6393 ; replace a register with a known value in range -16..15 with a
6394 ; constant. Ideally, we would like to merge zvdep64 and zvdep_imm64,
6395 ; but since we have no more CONST_OK... characters, that is not
6397 (define_insn "zvdep64"
6398 [(set (match_operand:DI 0 "register_operand" "=r,r")
6399 (ashift:DI (match_operand:DI 1 "arith5_operand" "r,L")
6400 (minus:DI (const_int 63)
6401 (match_operand:DI 2 "register_operand" "q,q"))))]
6404 depd,z %1,%%sar,64,%0
6405 depdi,z %1,%%sar,64,%0"
6406 [(set_attr "type" "shift,shift")
6407 (set_attr "length" "4,4")])
6409 (define_insn "zvdep_imm64"
6410 [(set (match_operand:DI 0 "register_operand" "=r")
6411 (ashift:DI (match_operand:DI 1 "lhs_lshift_cint_operand" "")
6412 (minus:DI (const_int 63)
6413 (match_operand:DI 2 "register_operand" "q"))))]
6417 unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
6418 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6419 operands[1] = GEN_INT ((x & 0x1f) - 0x20);
6420 return \"depdi,z %1,%%sar,%2,%0\";
6422 [(set_attr "type" "shift")
6423 (set_attr "length" "4")])
6426 [(set (match_operand:DI 0 "register_operand" "=r")
6427 (ior:DI (ashift:DI (match_operand:DI 1 "const_int_operand" "")
6428 (minus:DI (const_int 63)
6429 (match_operand:DI 2 "register_operand" "q")))
6430 (match_operand:DI 3 "register_operand" "0")))]
6431 ; accept ...0001...1, can this be generalized?
6432 "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) > 0"
6435 HOST_WIDE_INT x = INTVAL (operands[1]);
6436 operands[2] = GEN_INT (exact_log2 (x + 1));
6437 return \"depdi -1,%%sar,%2,%0\";
6439 [(set_attr "type" "shift")
6440 (set_attr "length" "4")])
6443 [(set (match_operand:DI 0 "register_operand" "=r")
6444 (and:DI (rotate:DI (match_operand:DI 1 "const_int_operand" "")
6445 (minus:DI (const_int 63)
6446 (match_operand:DI 2 "register_operand" "q")))
6447 (match_operand:DI 3 "register_operand" "0")))]
6448 ; this can be generalized...!
6449 "TARGET_64BIT && INTVAL (operands[1]) == -2"
6452 HOST_WIDE_INT x = INTVAL (operands[1]);
6453 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6454 return \"depdi 0,%%sar,%2,%0\";
6456 [(set_attr "type" "shift")
6457 (set_attr "length" "4")])
6459 (define_expand "ashrsi3"
6460 [(set (match_operand:SI 0 "register_operand" "")
6461 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
6462 (match_operand:SI 2 "arith32_operand" "")))]
6466 if (GET_CODE (operands[2]) != CONST_INT)
6468 rtx temp = gen_reg_rtx (SImode);
6469 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6470 emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
6476 [(set (match_operand:SI 0 "register_operand" "=r")
6477 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6478 (match_operand:SI 2 "const_int_operand" "n")))]
6480 "{extrs|extrw,s} %1,%P2,%L2,%0"
6481 [(set_attr "type" "shift")
6482 (set_attr "length" "4")])
6484 (define_insn "vextrs32"
6485 [(set (match_operand:SI 0 "register_operand" "=r")
6486 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6487 (minus:SI (const_int 31)
6488 (match_operand:SI 2 "register_operand" "q"))))]
6490 "{vextrs %1,32,%0|extrw,s %1,%%sar,32,%0}"
6491 [(set_attr "type" "shift")
6492 (set_attr "length" "4")])
6494 (define_expand "ashrdi3"
6495 [(set (match_operand:DI 0 "register_operand" "")
6496 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6497 (match_operand:DI 2 "arith32_operand" "")))]
6501 if (GET_CODE (operands[2]) != CONST_INT)
6503 rtx temp = gen_reg_rtx (DImode);
6504 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6505 emit_insn (gen_vextrs64 (operands[0], operands[1], temp));
6511 [(set (match_operand:DI 0 "register_operand" "=r")
6512 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6513 (match_operand:DI 2 "const_int_operand" "n")))]
6515 "extrd,s %1,%p2,%Q2,%0"
6516 [(set_attr "type" "shift")
6517 (set_attr "length" "4")])
6519 (define_insn "vextrs64"
6520 [(set (match_operand:DI 0 "register_operand" "=r")
6521 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6522 (minus:DI (const_int 63)
6523 (match_operand:DI 2 "register_operand" "q"))))]
6525 "extrd,s %1,%%sar,64,%0"
6526 [(set_attr "type" "shift")
6527 (set_attr "length" "4")])
6529 (define_insn "lshrsi3"
6530 [(set (match_operand:SI 0 "register_operand" "=r,r")
6531 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
6532 (match_operand:SI 2 "shift5_operand" "q,n")))]
6535 {vshd %%r0,%1,%0|shrpw %%r0,%1,%%sar,%0}
6536 {extru|extrw,u} %1,%P2,%L2,%0"
6537 [(set_attr "type" "shift")
6538 (set_attr "length" "4")])
6540 (define_insn "lshrdi3"
6541 [(set (match_operand:DI 0 "register_operand" "=r,r")
6542 (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r")
6543 (match_operand:DI 2 "shift6_operand" "q,n")))]
6546 shrpd %%r0,%1,%%sar,%0
6547 extrd,u %1,%p2,%Q2,%0"
6548 [(set_attr "type" "shift")
6549 (set_attr "length" "4")])
6551 ; Shift right pair word 0 to 31 bits.
6552 (define_insn "shrpsi4"
6553 [(set (match_operand:SI 0 "register_operand" "=r,r")
6554 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
6555 (minus:SI (const_int 32)
6556 (match_operand:SI 3 "shift5_operand" "q,n")))
6557 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r,r")
6561 {vshd %1,%2,%0|shrpw %1,%2,%%sar,%0}
6562 {shd|shrpw} %1,%2,%3,%0"
6563 [(set_attr "type" "shift")
6564 (set_attr "length" "4")])
6566 ; Shift right pair doubleword 0 to 63 bits.
6567 (define_insn "shrpdi4"
6568 [(set (match_operand:DI 0 "register_operand" "=r,r")
6569 (ior:DI (ashift:DI (match_operand:SI 1 "register_operand" "r,r")
6570 (minus:DI (const_int 64)
6571 (match_operand:DI 3 "shift6_operand" "q,n")))
6572 (lshiftrt:DI (match_operand:DI 2 "register_operand" "r,r")
6576 shrpd %1,%2,%%sar,%0
6578 [(set_attr "type" "shift")
6579 (set_attr "length" "4")])
6581 (define_insn "rotrsi3"
6582 [(set (match_operand:SI 0 "register_operand" "=r,r")
6583 (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
6584 (match_operand:SI 2 "shift5_operand" "q,n")))]
6588 if (GET_CODE (operands[2]) == CONST_INT)
6590 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
6591 return \"{shd|shrpw} %1,%1,%2,%0\";
6594 return \"{vshd %1,%1,%0|shrpw %1,%1,%%sar,%0}\";
6596 [(set_attr "type" "shift")
6597 (set_attr "length" "4")])
6599 (define_expand "rotlsi3"
6600 [(set (match_operand:SI 0 "register_operand" "")
6601 (rotate:SI (match_operand:SI 1 "register_operand" "")
6602 (match_operand:SI 2 "arith32_operand" "")))]
6606 if (GET_CODE (operands[2]) != CONST_INT)
6608 rtx temp = gen_reg_rtx (SImode);
6609 emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
6610 emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
6613 /* Else expand normally. */
6617 [(set (match_operand:SI 0 "register_operand" "=r")
6618 (rotate:SI (match_operand:SI 1 "register_operand" "r")
6619 (match_operand:SI 2 "const_int_operand" "n")))]
6623 operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
6624 return \"{shd|shrpw} %1,%1,%2,%0\";
6626 [(set_attr "type" "shift")
6627 (set_attr "length" "4")])
6630 [(set (match_operand:SI 0 "register_operand" "=r")
6631 (match_operator:SI 5 "plus_xor_ior_operator"
6632 [(ashift:SI (match_operand:SI 1 "register_operand" "r")
6633 (match_operand:SI 3 "const_int_operand" "n"))
6634 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6635 (match_operand:SI 4 "const_int_operand" "n"))]))]
6636 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6637 "{shd|shrpw} %1,%2,%4,%0"
6638 [(set_attr "type" "shift")
6639 (set_attr "length" "4")])
6642 [(set (match_operand:SI 0 "register_operand" "=r")
6643 (match_operator:SI 5 "plus_xor_ior_operator"
6644 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6645 (match_operand:SI 4 "const_int_operand" "n"))
6646 (ashift:SI (match_operand:SI 1 "register_operand" "r")
6647 (match_operand:SI 3 "const_int_operand" "n"))]))]
6648 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6649 "{shd|shrpw} %1,%2,%4,%0"
6650 [(set_attr "type" "shift")
6651 (set_attr "length" "4")])
6654 [(set (match_operand:SI 0 "register_operand" "=r")
6655 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
6656 (match_operand:SI 2 "const_int_operand" ""))
6657 (match_operand:SI 3 "const_int_operand" "")))]
6658 "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) > 0"
6661 int cnt = INTVAL (operands[2]) & 31;
6662 operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
6663 operands[2] = GEN_INT (31 - cnt);
6664 return \"{zdep|depw,z} %1,%2,%3,%0\";
6666 [(set_attr "type" "shift")
6667 (set_attr "length" "4")])
6669 ;; Unconditional and other jump instructions.
6671 ;; Trivial return used when no epilogue is needed.
6672 (define_insn "return"
6675 "pa_can_use_return_insn ()"
6679 return \"bve%* (%%r2)\";
6680 return \"bv%* %%r0(%%r2)\";
6682 [(set_attr "type" "branch")
6683 (set_attr "length" "4")])
6685 ;; This is used for most returns.
6686 (define_insn "return_internal"
6693 return \"bve%* (%%r2)\";
6694 return \"bv%* %%r0(%%r2)\";
6696 [(set_attr "type" "branch")
6697 (set_attr "length" "4")])
6699 ;; This is used for eh returns which bypass the return stub.
6700 (define_insn "return_external_pic"
6702 (clobber (reg:SI 1))
6704 "!TARGET_NO_SPACE_REGS
6706 && flag_pic && crtl->calls_eh_return"
6707 "ldsid (%%sr0,%%r2),%%r1\;mtsp %%r1,%%sr0\;be%* 0(%%sr0,%%r2)"
6708 [(set_attr "type" "branch")
6709 (set_attr "length" "12")])
6711 (define_expand "prologue"
6714 "pa_expand_prologue ();DONE;")
6716 (define_expand "sibcall_epilogue"
6721 pa_expand_epilogue ();
6725 (define_expand "epilogue"
6732 /* Try to use the trivial return first. Else use the full epilogue. */
6733 if (pa_can_use_return_insn ())
6737 pa_expand_epilogue ();
6739 /* EH returns bypass the normal return stub. Thus, we must do an
6740 interspace branch to return from functions that call eh_return.
6741 This is only a problem for returns from shared code on ports
6742 using space registers. */
6743 if (!TARGET_NO_SPACE_REGS
6745 && flag_pic && crtl->calls_eh_return)
6746 x = gen_return_external_pic ();
6748 x = gen_return_internal ();
6754 ; Used by hppa_profile_hook to load the starting address of the current
6755 ; function; operand 1 contains the address of the label in operand 3
6756 (define_insn "load_offset_label_address"
6757 [(set (match_operand:SI 0 "register_operand" "=r")
6758 (plus:SI (match_operand:SI 1 "register_operand" "r")
6759 (minus:SI (match_operand:SI 2 "" "")
6760 (label_ref:SI (match_operand 3 "" "")))))]
6763 [(set_attr "type" "multi")
6764 (set_attr "length" "4")])
6766 ; Output a code label and load its address.
6767 (define_insn "lcla1"
6768 [(set (match_operand:SI 0 "register_operand" "=r")
6769 (label_ref:SI (match_operand 1 "" "")))
6774 output_asm_insn (\"bl .+8,%0\;depi 0,31,2,%0\", operands);
6775 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6776 CODE_LABEL_NUMBER (operands[1]));
6779 [(set_attr "type" "multi")
6780 (set_attr "length" "8")])
6782 (define_insn "lcla2"
6783 [(set (match_operand:SI 0 "register_operand" "=r")
6784 (label_ref:SI (match_operand 1 "" "")))
6789 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6790 CODE_LABEL_NUMBER (operands[1]));
6793 [(set_attr "type" "move")
6794 (set_attr "length" "4")])
6796 (define_insn "blockage"
6797 [(unspec_volatile [(const_int 2)] UNSPECV_BLOCKAGE)]
6800 [(set_attr "length" "0")])
6803 [(set (pc) (label_ref (match_operand 0 "" "")))]
6807 /* An unconditional branch which can reach its target. */
6808 if (get_attr_length (insn) < 16)
6811 return pa_output_lbranch (operands[0], insn, 1);
6813 [(set_attr "type" "uncond_branch")
6814 (set_attr "pa_combine_type" "uncond_branch")
6815 (set (attr "length")
6816 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
6817 (const_int MAX_17BIT_OFFSET))
6819 (match_test "TARGET_PORTABLE_RUNTIME")
6821 (not (match_test "flag_pic"))
6825 ;;; Hope this is only within a function...
6826 (define_insn "indirect_jump"
6827 [(set (pc) (match_operand 0 "pmode_register_operand" "r"))]
6830 [(set_attr "type" "branch")
6831 (set_attr "length" "4")])
6833 ;;; An indirect jump can be optimized to a direct jump. GAS for the
6834 ;;; SOM target doesn't allow branching to a label inside a function.
6835 ;;; We also don't correctly compute branch distances for labels
6836 ;;; outside the current function. Thus, we use an indirect jump can't
6837 ;;; be optimized to a direct jump for all targets. We assume that
6838 ;;; the branch target is in the same space (i.e., nested function
6839 ;;; jumping to a label in an outer function in the same translation
6841 (define_expand "nonlocal_goto"
6842 [(use (match_operand 0 "general_operand" ""))
6843 (use (match_operand 1 "general_operand" ""))
6844 (use (match_operand 2 "general_operand" ""))
6845 (use (match_operand 3 "general_operand" ""))]
6848 rtx lab = operands[1];
6849 rtx stack = operands[2];
6850 rtx fp = operands[3];
6852 lab = copy_to_reg (lab);
6854 emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
6855 emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
6857 /* Restore the frame pointer. The virtual_stack_vars_rtx is saved
6858 instead of the hard_frame_pointer_rtx in the save area. As a
6859 result, an extra instruction is needed to adjust for the offset
6860 of the virtual stack variables and the hard frame pointer. */
6861 if (GET_CODE (fp) != REG)
6862 fp = force_reg (Pmode, fp);
6863 emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
6865 emit_stack_restore (SAVE_NONLOCAL, stack);
6867 emit_use (hard_frame_pointer_rtx);
6868 emit_use (stack_pointer_rtx);
6870 /* Nonlocal goto jumps are only used between functions in the same
6871 translation unit. Thus, we can avoid the extra overhead of an
6873 emit_jump_insn (gen_indirect_goto (lab));
6878 (define_insn "indirect_goto"
6879 [(unspec [(match_operand 0 "register_operand" "=r")] UNSPEC_GOTO)]
6880 "GET_MODE (operands[0]) == word_mode"
6882 [(set_attr "type" "branch")
6883 (set_attr "length" "4")])
6885 ;; Subroutines of "casesi".
6886 ;; operand 0 is index
6887 ;; operand 1 is the minimum bound
6888 ;; operand 2 is the maximum bound - minimum bound + 1
6889 ;; operand 3 is CODE_LABEL for the table;
6890 ;; operand 4 is the CODE_LABEL to go to if index out of range.
6892 (define_expand "casesi"
6893 [(match_operand:SI 0 "general_operand" "")
6894 (match_operand:SI 1 "const_int_operand" "")
6895 (match_operand:SI 2 "const_int_operand" "")
6896 (match_operand 3 "" "")
6897 (match_operand 4 "" "")]
6901 if (GET_CODE (operands[0]) != REG)
6902 operands[0] = force_reg (SImode, operands[0]);
6904 if (operands[1] != const0_rtx)
6906 rtx index = gen_reg_rtx (SImode);
6908 operands[1] = gen_int_mode (-INTVAL (operands[1]), SImode);
6909 if (!INT_14_BITS (operands[1]))
6910 operands[1] = force_reg (SImode, operands[1]);
6911 emit_insn (gen_addsi3 (index, operands[0], operands[1]));
6912 operands[0] = index;
6915 if (!INT_5_BITS (operands[2]))
6916 operands[2] = force_reg (SImode, operands[2]);
6918 /* This branch prevents us finding an insn for the delay slot of the
6919 following vectored branch. It might be possible to use the delay
6920 slot if an index value of -1 was used to transfer to the out-of-range
6921 label. In order to do this, we would have to output the -1 vector
6922 element after the delay insn. The casesi output code would have to
6923 check if the casesi insn is in a delay branch sequence and output
6924 the delay insn if one is found. If this was done, then it might
6925 then be worthwhile to split the casesi patterns to improve scheduling.
6926 However, it's not clear that all this extra complexity is worth
6929 rtx test = gen_rtx_GTU (VOIDmode, operands[0], operands[2]);
6930 emit_jump_insn (gen_cbranchsi4 (test, operands[0], operands[2], operands[4]));
6933 /* In 64bit mode we must make sure to wipe the upper bits of the register
6934 just in case the addition overflowed or we had random bits in the
6935 high part of the register. */
6938 rtx index = gen_reg_rtx (DImode);
6940 emit_insn (gen_extendsidi2 (index, operands[0]));
6941 operands[0] = index;
6945 emit_jump_insn (gen_casesi64p (operands[0], operands[3]));
6947 emit_jump_insn (gen_casesi32p (operands[0], operands[3]));
6949 emit_jump_insn (gen_casesi32 (operands[0], operands[3]));
6953 ;;; 32-bit code, absolute branch table.
6954 (define_insn "casesi32"
6955 [(set (pc) (mem:SI (plus:SI
6956 (mult:SI (match_operand:SI 0 "register_operand" "r")
6958 (label_ref (match_operand 1 "" "")))))
6959 (clobber (match_scratch:SI 2 "=&r"))]
6961 "ldil L'%l1,%2\;ldo R'%l1(%2),%2\;{ldwx|ldw},s %0(%2),%2\;bv,n %%r0(%2)"
6962 [(set_attr "type" "multi")
6963 (set_attr "length" "16")])
6965 ;;; 32-bit code, relative branch table.
6966 (define_insn "casesi32p"
6967 [(set (pc) (mem:SI (plus:SI
6968 (mult:SI (match_operand:SI 0 "register_operand" "r")
6970 (label_ref (match_operand 1 "" "")))))
6971 (clobber (match_scratch:SI 2 "=&r"))
6972 (clobber (match_scratch:SI 3 "=&r"))]
6974 "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;ldo {%l1-.|%l1+4-.}(%2),%2\;\
6975 {ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
6976 [(set_attr "type" "multi")
6977 (set (attr "length")
6978 (if_then_else (match_test "TARGET_PA_20")
6982 ;;; 64-bit code, 32-bit relative branch table.
6983 (define_insn "casesi64p"
6984 [(set (pc) (mem:DI (plus:DI
6985 (mult:DI (match_operand:DI 0 "register_operand" "r")
6987 (label_ref (match_operand 1 "" "")))))
6988 (clobber (match_scratch:DI 2 "=&r"))
6989 (clobber (match_scratch:DI 3 "=&r"))]
6991 "mfia %2\;ldo %l1+4-.(%2),%2\;ldw,s %0(%2),%3\;extrd,s %3,63,32,%3\;\
6992 add,l %2,%3,%3\;bv,n %%r0(%3)"
6993 [(set_attr "type" "multi")
6994 (set_attr "length" "24")])
6998 ;;- jump to subroutine
7000 (define_expand "call"
7001 [(parallel [(call (match_operand:SI 0 "" "")
7002 (match_operand 1 "" ""))
7003 (clobber (reg:SI 2))])]
7008 rtx nb = operands[1];
7010 if (TARGET_PORTABLE_RUNTIME)
7011 op = force_reg (SImode, XEXP (operands[0], 0));
7014 op = XEXP (operands[0], 0);
7016 /* Generate indirect long calls to non-local functions. */
7017 if (TARGET_LONG_CALLS && GET_CODE (op) == SYMBOL_REF)
7019 tree call_decl = SYMBOL_REF_DECL (op);
7020 if (!(call_decl && targetm.binds_local_p (call_decl)))
7021 op = force_reg (word_mode, op);
7027 if (!virtuals_instantiated)
7028 emit_move_insn (arg_pointer_rtx,
7029 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7033 /* The loop pass can generate new libcalls after the virtual
7034 registers are instantiated when fpregs are disabled because
7035 the only method that we have for doing DImode multiplication
7036 is with a libcall. This could be trouble if we haven't
7037 allocated enough space for the outgoing arguments. */
7038 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
7040 emit_move_insn (arg_pointer_rtx,
7041 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7042 GEN_INT (STACK_POINTER_OFFSET + 64)));
7046 /* Use two different patterns for calls to explicitly named functions
7047 and calls through function pointers. This is necessary as these two
7048 types of calls use different calling conventions, and CSE might try
7049 to change the named call into an indirect call in some cases (using
7050 two patterns keeps CSE from performing this optimization).
7052 We now use even more call patterns as there was a subtle bug in
7053 attempting to restore the pic register after a call using a simple
7054 move insn. During reload, a instruction involving a pseudo register
7055 with no explicit dependence on the PIC register can be converted
7056 to an equivalent load from memory using the PIC register. If we
7057 emit a simple move to restore the PIC register in the initial rtl
7058 generation, then it can potentially be repositioned during scheduling.
7059 and an instruction that eventually uses the PIC register may end up
7060 between the call and the PIC register restore.
7062 This only worked because there is a post call group of instructions
7063 that are scheduled with the call. These instructions are included
7064 in the same basic block as the call. However, calls can throw in
7065 C++ code and a basic block has to terminate at the call if the call
7066 can throw. This results in the PIC register restore being scheduled
7067 independently from the call. So, we now hide the save and restore
7068 of the PIC register in the call pattern until after reload. Then,
7069 we split the moves out. A small side benefit is that we now don't
7070 need to have a use of the PIC register in the return pattern and
7071 the final save/restore operation is not needed.
7073 I elected to just use register %r4 in the PIC patterns instead
7074 of trying to force hppa_pic_save_rtx () to a callee saved register.
7075 This might have required a new register class and constraint. It
7076 was also simpler to just handle the restore from a register than a
7080 rtx r4 = gen_rtx_REG (word_mode, 4);
7081 if (GET_CODE (op) == SYMBOL_REF)
7082 emit_call_insn (gen_call_symref_64bit (op, nb, r4));
7085 op = force_reg (word_mode, op);
7086 emit_call_insn (gen_call_reg_64bit (op, nb, r4));
7091 if (GET_CODE (op) == SYMBOL_REF)
7095 rtx r4 = gen_rtx_REG (word_mode, 4);
7096 emit_call_insn (gen_call_symref_pic (op, nb, r4));
7099 emit_call_insn (gen_call_symref (op, nb));
7103 rtx tmpreg = gen_rtx_REG (word_mode, 22);
7104 emit_move_insn (tmpreg, force_reg (word_mode, op));
7107 rtx r4 = gen_rtx_REG (word_mode, 4);
7108 emit_call_insn (gen_call_reg_pic (nb, r4));
7111 emit_call_insn (gen_call_reg (nb));
7118 ;; We use function calls to set the attribute length of calls and millicode
7119 ;; calls. This is necessary because of the large variety of call sequences.
7120 ;; Implementing the calculation in rtl is difficult as well as ugly. As
7121 ;; we need the same calculation in several places, maintenance becomes a
7124 ;; However, this has a subtle impact on branch shortening. When the
7125 ;; expression used to set the length attribute of an instruction depends
7126 ;; on a relative address (e.g., pc or a branch address), genattrtab
7127 ;; notes that the insn's length is variable, and attempts to determine a
7128 ;; worst-case default length and code to compute an insn's current length.
7130 ;; The use of a function call hides the variable dependence of our calls
7131 ;; and millicode calls. The result is genattrtab doesn't treat the operation
7132 ;; as variable and it only generates code for the default case using our
7133 ;; function call. Because of this, calls and millicode calls have a fixed
7134 ;; length in the branch shortening pass, and some branches will use a longer
7135 ;; code sequence than necessary. However, the length of any given call
7136 ;; will still reflect its final code location and it may be shorter than
7137 ;; the initial length estimate.
7139 ;; It's possible to trick genattrtab by adding an expression involving `pc'
7140 ;; in the set. However, when genattrtab hits a function call in its attempt
7141 ;; to compute the default length, it marks the result as unknown and sets
7142 ;; the default result to MAX_INT ;-( One possible fix that would allow
7143 ;; calls to participate in branch shortening would be to make the call to
7144 ;; insn_default_length a target option. Then, we could massage unknown
7145 ;; results. Another fix might be to change genattrtab so that it just does
7146 ;; the call in the variable case as it already does for the fixed case.
7148 (define_insn "call_symref"
7149 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7150 (match_operand 1 "" "i"))
7151 (clobber (reg:SI 1))
7152 (clobber (reg:SI 2))
7153 (use (const_int 0))]
7154 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7157 pa_output_arg_descriptor (insn);
7158 return pa_output_call (insn, operands[0], 0);
7160 [(set_attr "type" "call")
7161 (set (attr "length")
7162 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7163 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7165 (define_insn "call_symref_pic"
7166 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7167 (match_operand 1 "" "i"))
7168 (clobber (reg:SI 1))
7169 (clobber (reg:SI 2))
7170 (clobber (match_operand 2))
7172 (use (const_int 0))]
7173 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7176 ;; Split out the PIC register save and restore after reload. As the
7177 ;; split is done after reload, there are some situations in which we
7178 ;; unnecessarily save and restore %r4. This happens when there is a
7179 ;; single call and the PIC register is not used after the call.
7181 ;; The split has to be done since call_from_call_insn () can't handle
7182 ;; the pattern as is. Noreturn calls are special because they have to
7183 ;; terminate the basic block. The split has to contain more than one
7186 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7187 (match_operand 1 "" ""))
7188 (clobber (reg:SI 1))
7189 (clobber (reg:SI 2))
7190 (clobber (match_operand 2))
7192 (use (const_int 0))])]
7193 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7194 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7195 [(set (match_dup 2) (reg:SI 19))
7196 (parallel [(call (mem:SI (match_dup 0))
7198 (clobber (reg:SI 1))
7199 (clobber (reg:SI 2))
7201 (use (const_int 0))])]
7205 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7206 (match_operand 1 "" ""))
7207 (clobber (reg:SI 1))
7208 (clobber (reg:SI 2))
7209 (clobber (match_operand 2))
7211 (use (const_int 0))])]
7212 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7213 [(set (match_dup 2) (reg:SI 19))
7214 (parallel [(call (mem:SI (match_dup 0))
7216 (clobber (reg:SI 1))
7217 (clobber (reg:SI 2))
7219 (use (const_int 0))])
7220 (set (reg:SI 19) (match_dup 2))]
7223 (define_insn "*call_symref_pic_post_reload"
7224 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7225 (match_operand 1 "" "i"))
7226 (clobber (reg:SI 1))
7227 (clobber (reg:SI 2))
7229 (use (const_int 0))]
7230 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7233 pa_output_arg_descriptor (insn);
7234 return pa_output_call (insn, operands[0], 0);
7236 [(set_attr "type" "call")
7237 (set (attr "length")
7238 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7239 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7241 ;; This pattern is split if it is necessary to save and restore the
7243 (define_insn "call_symref_64bit"
7244 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7245 (match_operand 1 "" "i"))
7246 (clobber (reg:DI 1))
7247 (clobber (reg:DI 2))
7248 (clobber (match_operand 2))
7251 (use (const_int 0))]
7255 ;; Split out the PIC register save and restore after reload. As the
7256 ;; split is done after reload, there are some situations in which we
7257 ;; unnecessarily save and restore %r4. This happens when there is a
7258 ;; single call and the PIC register is not used after the call.
7260 ;; The split has to be done since call_from_call_insn () can't handle
7261 ;; the pattern as is. Noreturn calls are special because they have to
7262 ;; terminate the basic block. The split has to contain more than one
7265 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7266 (match_operand 1 "" ""))
7267 (clobber (reg:DI 1))
7268 (clobber (reg:DI 2))
7269 (clobber (match_operand 2))
7272 (use (const_int 0))])]
7273 "TARGET_64BIT && reload_completed
7274 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7275 [(set (match_dup 2) (reg:DI 27))
7276 (parallel [(call (mem:SI (match_dup 0))
7278 (clobber (reg:DI 1))
7279 (clobber (reg:DI 2))
7282 (use (const_int 0))])]
7286 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7287 (match_operand 1 "" ""))
7288 (clobber (reg:DI 1))
7289 (clobber (reg:DI 2))
7290 (clobber (match_operand 2))
7293 (use (const_int 0))])]
7294 "TARGET_64BIT && reload_completed"
7295 [(set (match_dup 2) (reg:DI 27))
7296 (parallel [(call (mem:SI (match_dup 0))
7298 (clobber (reg:DI 1))
7299 (clobber (reg:DI 2))
7302 (use (const_int 0))])
7303 (set (reg:DI 27) (match_dup 2))]
7306 (define_insn "*call_symref_64bit_post_reload"
7307 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7308 (match_operand 1 "" "i"))
7309 (clobber (reg:DI 1))
7310 (clobber (reg:DI 2))
7313 (use (const_int 0))]
7317 return pa_output_call (insn, operands[0], 0);
7319 [(set_attr "type" "call")
7320 (set (attr "length")
7321 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7322 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7324 (define_insn "call_reg"
7325 [(call (mem:SI (reg:SI 22))
7326 (match_operand 0 "" "i"))
7327 (clobber (reg:SI 1))
7328 (clobber (reg:SI 2))
7329 (use (const_int 1))]
7333 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7335 [(set_attr "type" "dyncall")
7336 (set (attr "length")
7337 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7338 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7340 ;; This pattern is split if it is necessary to save and restore the
7342 (define_insn "call_reg_pic"
7343 [(call (mem:SI (reg:SI 22))
7344 (match_operand 0 "" "i"))
7345 (clobber (reg:SI 1))
7346 (clobber (reg:SI 2))
7347 (clobber (match_operand 1))
7349 (use (const_int 1))]
7353 ;; Split out the PIC register save and restore after reload. As the
7354 ;; split is done after reload, there are some situations in which we
7355 ;; unnecessarily save and restore %r4. This happens when there is a
7356 ;; single call and the PIC register is not used after the call.
7358 ;; The split has to be done since call_from_call_insn () can't handle
7359 ;; the pattern as is. Noreturn calls are special because they have to
7360 ;; terminate the basic block. The split has to contain more than one
7363 [(parallel [(call (mem:SI (reg:SI 22))
7364 (match_operand 0 "" ""))
7365 (clobber (reg:SI 1))
7366 (clobber (reg:SI 2))
7367 (clobber (match_operand 1))
7369 (use (const_int 1))])]
7370 "!TARGET_64BIT && reload_completed
7371 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7372 [(set (match_dup 1) (reg:SI 19))
7373 (parallel [(call (mem:SI (reg:SI 22))
7375 (clobber (reg:SI 1))
7376 (clobber (reg:SI 2))
7378 (use (const_int 1))])]
7382 [(parallel [(call (mem:SI (reg:SI 22))
7383 (match_operand 0 "" ""))
7384 (clobber (reg:SI 1))
7385 (clobber (reg:SI 2))
7386 (clobber (match_operand 1))
7388 (use (const_int 1))])]
7389 "!TARGET_64BIT && reload_completed"
7390 [(set (match_dup 1) (reg:SI 19))
7391 (parallel [(call (mem:SI (reg:SI 22))
7393 (clobber (reg:SI 1))
7394 (clobber (reg:SI 2))
7396 (use (const_int 1))])
7397 (set (reg:SI 19) (match_dup 1))]
7400 (define_insn "*call_reg_pic_post_reload"
7401 [(call (mem:SI (reg:SI 22))
7402 (match_operand 0 "" "i"))
7403 (clobber (reg:SI 1))
7404 (clobber (reg:SI 2))
7406 (use (const_int 1))]
7410 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7412 [(set_attr "type" "dyncall")
7413 (set (attr "length")
7414 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7415 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7417 ;; This pattern is split if it is necessary to save and restore the
7419 (define_insn "call_reg_64bit"
7420 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7421 (match_operand 1 "" "i"))
7422 (clobber (reg:DI 2))
7423 (clobber (match_operand 2))
7426 (use (const_int 1))]
7430 ;; Split out the PIC register save and restore after reload. As the
7431 ;; split is done after reload, there are some situations in which we
7432 ;; unnecessarily save and restore %r4. This happens when there is a
7433 ;; single call and the PIC register is not used after the call.
7435 ;; The split has to be done since call_from_call_insn () can't handle
7436 ;; the pattern as is. Noreturn calls are special because they have to
7437 ;; terminate the basic block. The split has to contain more than one
7440 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7441 (match_operand 1 "" ""))
7442 (clobber (reg:DI 2))
7443 (clobber (match_operand 2))
7446 (use (const_int 1))])]
7447 "TARGET_64BIT && reload_completed
7448 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7449 [(set (match_dup 2) (reg:DI 27))
7450 (parallel [(call (mem:SI (match_dup 0))
7452 (clobber (reg:DI 2))
7455 (use (const_int 1))])]
7459 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7460 (match_operand 1 "" ""))
7461 (clobber (reg:DI 2))
7462 (clobber (match_operand 2))
7465 (use (const_int 1))])]
7466 "TARGET_64BIT && reload_completed"
7467 [(set (match_dup 2) (reg:DI 27))
7468 (parallel [(call (mem:SI (match_dup 0))
7470 (clobber (reg:DI 2))
7473 (use (const_int 1))])
7474 (set (reg:DI 27) (match_dup 2))]
7477 (define_insn "*call_reg_64bit_post_reload"
7478 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7479 (match_operand 1 "" "i"))
7480 (clobber (reg:DI 2))
7483 (use (const_int 1))]
7487 return pa_output_indirect_call (insn, operands[0]);
7489 [(set_attr "type" "dyncall")
7490 (set (attr "length")
7491 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 12)]
7492 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7494 (define_expand "call_value"
7495 [(parallel [(set (match_operand 0 "" "")
7496 (call (match_operand:SI 1 "" "")
7497 (match_operand 2 "" "")))
7498 (clobber (reg:SI 2))])]
7502 rtx dst = operands[0];
7503 rtx nb = operands[2];
7504 bool call_powf = false;
7506 if (TARGET_PORTABLE_RUNTIME)
7507 op = force_reg (SImode, XEXP (operands[1], 0));
7510 op = XEXP (operands[1], 0);
7511 if (GET_CODE (op) == SYMBOL_REF)
7513 /* Handle special call to buggy powf function. */
7514 if (TARGET_HPUX && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT
7515 && !strcmp (targetm.strip_name_encoding (XSTR (op, 0)), "powf"))
7518 /* Generate indirect long calls to non-local functions. */
7519 else if (TARGET_LONG_CALLS)
7521 tree call_decl = SYMBOL_REF_DECL (op);
7522 if (!(call_decl && targetm.binds_local_p (call_decl)))
7523 op = force_reg (word_mode, op);
7530 if (!virtuals_instantiated)
7531 emit_move_insn (arg_pointer_rtx,
7532 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7536 /* The loop pass can generate new libcalls after the virtual
7537 registers are instantiated when fpregs are disabled because
7538 the only method that we have for doing DImode multiplication
7539 is with a libcall. This could be trouble if we haven't
7540 allocated enough space for the outgoing arguments. */
7541 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
7543 emit_move_insn (arg_pointer_rtx,
7544 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7545 GEN_INT (STACK_POINTER_OFFSET + 64)));
7549 /* Use two different patterns for calls to explicitly named functions
7550 and calls through function pointers. This is necessary as these two
7551 types of calls use different calling conventions, and CSE might try
7552 to change the named call into an indirect call in some cases (using
7553 two patterns keeps CSE from performing this optimization).
7555 We now use even more call patterns as there was a subtle bug in
7556 attempting to restore the pic register after a call using a simple
7557 move insn. During reload, a instruction involving a pseudo register
7558 with no explicit dependence on the PIC register can be converted
7559 to an equivalent load from memory using the PIC register. If we
7560 emit a simple move to restore the PIC register in the initial rtl
7561 generation, then it can potentially be repositioned during scheduling.
7562 and an instruction that eventually uses the PIC register may end up
7563 between the call and the PIC register restore.
7565 This only worked because there is a post call group of instructions
7566 that are scheduled with the call. These instructions are included
7567 in the same basic block as the call. However, calls can throw in
7568 C++ code and a basic block has to terminate at the call if the call
7569 can throw. This results in the PIC register restore being scheduled
7570 independently from the call. So, we now hide the save and restore
7571 of the PIC register in the call pattern until after reload. Then,
7572 we split the moves out. A small side benefit is that we now don't
7573 need to have a use of the PIC register in the return pattern and
7574 the final save/restore operation is not needed.
7576 I elected to just use register %r4 in the PIC patterns instead
7577 of trying to force hppa_pic_save_rtx () to a callee saved register.
7578 This might have required a new register class and constraint. It
7579 was also simpler to just handle the restore from a register than a
7583 rtx r4 = gen_rtx_REG (word_mode, 4);
7584 if (GET_CODE (op) == SYMBOL_REF)
7587 emit_call_insn (gen_call_val_powf_64bit (dst, op, nb, r4));
7589 emit_call_insn (gen_call_val_symref_64bit (dst, op, nb, r4));
7593 op = force_reg (word_mode, op);
7594 emit_call_insn (gen_call_val_reg_64bit (dst, op, nb, r4));
7599 if (GET_CODE (op) == SYMBOL_REF)
7603 rtx r4 = gen_rtx_REG (word_mode, 4);
7606 emit_call_insn (gen_call_val_powf_pic (dst, op, nb, r4));
7608 emit_call_insn (gen_call_val_symref_pic (dst, op, nb, r4));
7613 emit_call_insn (gen_call_val_powf (dst, op, nb));
7615 emit_call_insn (gen_call_val_symref (dst, op, nb));
7620 rtx tmpreg = gen_rtx_REG (word_mode, 22);
7621 emit_move_insn (tmpreg, force_reg (word_mode, op));
7624 rtx r4 = gen_rtx_REG (word_mode, 4);
7625 emit_call_insn (gen_call_val_reg_pic (dst, nb, r4));
7628 emit_call_insn (gen_call_val_reg (dst, nb));
7635 (define_insn "call_val_symref"
7636 [(set (match_operand 0 "" "")
7637 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7638 (match_operand 2 "" "i")))
7639 (clobber (reg:SI 1))
7640 (clobber (reg:SI 2))
7641 (use (const_int 0))]
7642 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7645 pa_output_arg_descriptor (insn);
7646 return pa_output_call (insn, operands[1], 0);
7648 [(set_attr "type" "call")
7649 (set (attr "length")
7650 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7651 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7653 ;; powf function clobbers %fr12
7654 (define_insn "call_val_powf"
7655 [(set (match_operand 0 "" "")
7656 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7657 (match_operand 2 "" "i")))
7658 (clobber (reg:SI 1))
7659 (clobber (reg:SI 2))
7660 (clobber (reg:DF 48))
7661 (use (const_int 1))]
7662 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7665 pa_output_arg_descriptor (insn);
7666 return pa_output_call (insn, operands[1], 0);
7668 [(set_attr "type" "call")
7669 (set (attr "length")
7670 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7671 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7673 (define_insn "call_val_symref_pic"
7674 [(set (match_operand 0 "" "")
7675 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7676 (match_operand 2 "" "i")))
7677 (clobber (reg:SI 1))
7678 (clobber (reg:SI 2))
7679 (clobber (match_operand 3))
7681 (use (const_int 0))]
7682 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7685 ;; Split out the PIC register save and restore after reload. As the
7686 ;; split is done after reload, there are some situations in which we
7687 ;; unnecessarily save and restore %r4. This happens when there is a
7688 ;; single call and the PIC register is not used after the call.
7690 ;; The split has to be done since call_from_call_insn () can't handle
7691 ;; the pattern as is. Noreturn calls are special because they have to
7692 ;; terminate the basic block. The split has to contain more than one
7695 [(parallel [(set (match_operand 0 "" "")
7696 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7697 (match_operand 2 "" "")))
7698 (clobber (reg:SI 1))
7699 (clobber (reg:SI 2))
7700 (clobber (match_operand 3))
7702 (use (const_int 0))])]
7703 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7704 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7705 [(set (match_dup 3) (reg:SI 19))
7706 (parallel [(set (match_dup 0)
7707 (call (mem:SI (match_dup 1))
7709 (clobber (reg:SI 1))
7710 (clobber (reg:SI 2))
7712 (use (const_int 0))])]
7716 [(parallel [(set (match_operand 0 "" "")
7717 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7718 (match_operand 2 "" "")))
7719 (clobber (reg:SI 1))
7720 (clobber (reg:SI 2))
7721 (clobber (match_operand 3))
7723 (use (const_int 0))])]
7724 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7725 [(set (match_dup 3) (reg:SI 19))
7726 (parallel [(set (match_dup 0)
7727 (call (mem:SI (match_dup 1))
7729 (clobber (reg:SI 1))
7730 (clobber (reg:SI 2))
7732 (use (const_int 0))])
7733 (set (reg:SI 19) (match_dup 3))]
7736 (define_insn "*call_val_symref_pic_post_reload"
7737 [(set (match_operand 0 "" "")
7738 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7739 (match_operand 2 "" "i")))
7740 (clobber (reg:SI 1))
7741 (clobber (reg:SI 2))
7743 (use (const_int 0))]
7744 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7747 pa_output_arg_descriptor (insn);
7748 return pa_output_call (insn, operands[1], 0);
7750 [(set_attr "type" "call")
7751 (set (attr "length")
7752 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7753 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7755 ;; powf function clobbers %fr12
7756 (define_insn "call_val_powf_pic"
7757 [(set (match_operand 0 "" "")
7758 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7759 (match_operand 2 "" "i")))
7760 (clobber (reg:SI 1))
7761 (clobber (reg:SI 2))
7762 (clobber (reg:DF 48))
7763 (clobber (match_operand 3))
7765 (use (const_int 1))]
7766 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7769 ;; Split out the PIC register save and restore after reload. As the
7770 ;; split is done after reload, there are some situations in which we
7771 ;; unnecessarily save and restore %r4. This happens when there is a
7772 ;; single call and the PIC register is not used after the call.
7774 ;; The split has to be done since call_from_call_insn () can't handle
7775 ;; the pattern as is. Noreturn calls are special because they have to
7776 ;; terminate the basic block. The split has to contain more than one
7779 [(parallel [(set (match_operand 0 "" "")
7780 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7781 (match_operand 2 "" "")))
7782 (clobber (reg:SI 1))
7783 (clobber (reg:SI 2))
7784 (clobber (reg:DF 48))
7785 (clobber (match_operand 3))
7787 (use (const_int 1))])]
7788 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7789 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7790 [(set (match_dup 3) (reg:SI 19))
7791 (parallel [(set (match_dup 0)
7792 (call (mem:SI (match_dup 1))
7794 (clobber (reg:SI 1))
7795 (clobber (reg:SI 2))
7796 (clobber (reg:DF 48))
7798 (use (const_int 1))])]
7802 [(parallel [(set (match_operand 0 "" "")
7803 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7804 (match_operand 2 "" "")))
7805 (clobber (reg:SI 1))
7806 (clobber (reg:SI 2))
7807 (clobber (reg:DF 48))
7808 (clobber (match_operand 3))
7810 (use (const_int 1))])]
7811 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7812 [(set (match_dup 3) (reg:SI 19))
7813 (parallel [(set (match_dup 0)
7814 (call (mem:SI (match_dup 1))
7816 (clobber (reg:SI 1))
7817 (clobber (reg:SI 2))
7818 (clobber (reg:DF 48))
7820 (use (const_int 1))])
7821 (set (reg:SI 19) (match_dup 3))]
7824 (define_insn "*call_val_powf_pic_post_reload"
7825 [(set (match_operand 0 "" "")
7826 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7827 (match_operand 2 "" "i")))
7828 (clobber (reg:SI 1))
7829 (clobber (reg:SI 2))
7830 (clobber (reg:DF 48))
7832 (use (const_int 1))]
7833 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7836 pa_output_arg_descriptor (insn);
7837 return pa_output_call (insn, operands[1], 0);
7839 [(set_attr "type" "call")
7840 (set (attr "length")
7841 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7842 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7844 ;; This pattern is split if it is necessary to save and restore the
7846 (define_insn "call_val_symref_64bit"
7847 [(set (match_operand 0 "" "")
7848 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7849 (match_operand 2 "" "i")))
7850 (clobber (reg:DI 1))
7851 (clobber (reg:DI 2))
7852 (clobber (match_operand 3))
7855 (use (const_int 0))]
7859 ;; Split out the PIC register save and restore after reload. As the
7860 ;; split is done after reload, there are some situations in which we
7861 ;; unnecessarily save and restore %r4. This happens when there is a
7862 ;; single call and the PIC register is not used after the call.
7864 ;; The split has to be done since call_from_call_insn () can't handle
7865 ;; the pattern as is. Noreturn calls are special because they have to
7866 ;; terminate the basic block. The split has to contain more than one
7869 [(parallel [(set (match_operand 0 "" "")
7870 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7871 (match_operand 2 "" "")))
7872 (clobber (reg:DI 1))
7873 (clobber (reg:DI 2))
7874 (clobber (match_operand 3))
7877 (use (const_int 0))])]
7878 "TARGET_64BIT && reload_completed
7879 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7880 [(set (match_dup 3) (reg:DI 27))
7881 (parallel [(set (match_dup 0)
7882 (call (mem:SI (match_dup 1))
7884 (clobber (reg:DI 1))
7885 (clobber (reg:DI 2))
7888 (use (const_int 0))])]
7892 [(parallel [(set (match_operand 0 "" "")
7893 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7894 (match_operand 2 "" "")))
7895 (clobber (reg:DI 1))
7896 (clobber (reg:DI 2))
7897 (clobber (match_operand 3))
7900 (use (const_int 0))])]
7901 "TARGET_64BIT && reload_completed"
7902 [(set (match_dup 3) (reg:DI 27))
7903 (parallel [(set (match_dup 0)
7904 (call (mem:SI (match_dup 1))
7906 (clobber (reg:DI 1))
7907 (clobber (reg:DI 2))
7910 (use (const_int 0))])
7911 (set (reg:DI 27) (match_dup 3))]
7914 (define_insn "*call_val_symref_64bit_post_reload"
7915 [(set (match_operand 0 "" "")
7916 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7917 (match_operand 2 "" "i")))
7918 (clobber (reg:DI 1))
7919 (clobber (reg:DI 2))
7922 (use (const_int 0))]
7926 return pa_output_call (insn, operands[1], 0);
7928 [(set_attr "type" "call")
7929 (set (attr "length")
7930 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7931 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7933 ;; powf function clobbers %fr12
7934 (define_insn "call_val_powf_64bit"
7935 [(set (match_operand 0 "" "")
7936 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7937 (match_operand 2 "" "i")))
7938 (clobber (reg:DI 1))
7939 (clobber (reg:DI 2))
7940 (clobber (reg:DF 40))
7941 (clobber (match_operand 3))
7944 (use (const_int 1))]
7945 "TARGET_64BIT && TARGET_HPUX"
7948 ;; Split out the PIC register save and restore after reload. As the
7949 ;; split is done after reload, there are some situations in which we
7950 ;; unnecessarily save and restore %r4. This happens when there is a
7951 ;; single call and the PIC register is not used after the call.
7953 ;; The split has to be done since call_from_call_insn () can't handle
7954 ;; the pattern as is. Noreturn calls are special because they have to
7955 ;; terminate the basic block. The split has to contain more than one
7958 [(parallel [(set (match_operand 0 "" "")
7959 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7960 (match_operand 2 "" "")))
7961 (clobber (reg:DI 1))
7962 (clobber (reg:DI 2))
7963 (clobber (reg:DF 40))
7964 (clobber (match_operand 3))
7967 (use (const_int 1))])]
7968 "TARGET_64BIT && TARGET_HPUX && reload_completed
7969 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7970 [(set (match_dup 3) (reg:DI 27))
7971 (parallel [(set (match_dup 0)
7972 (call (mem:SI (match_dup 1))
7974 (clobber (reg:DI 1))
7975 (clobber (reg:DI 2))
7976 (clobber (reg:DF 40))
7979 (use (const_int 1))])]
7983 [(parallel [(set (match_operand 0 "" "")
7984 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7985 (match_operand 2 "" "")))
7986 (clobber (reg:DI 1))
7987 (clobber (reg:DI 2))
7988 (clobber (reg:DF 40))
7989 (clobber (match_operand 3))
7992 (use (const_int 1))])]
7993 "TARGET_64BIT && TARGET_HPUX && reload_completed"
7994 [(set (match_dup 3) (reg:DI 27))
7995 (parallel [(set (match_dup 0)
7996 (call (mem:SI (match_dup 1))
7998 (clobber (reg:DI 1))
7999 (clobber (reg:DI 2))
8000 (clobber (reg:DF 40))
8003 (use (const_int 1))])
8004 (set (reg:DI 27) (match_dup 3))]
8007 (define_insn "*call_val_powf_64bit_post_reload"
8008 [(set (match_operand 0 "" "")
8009 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8010 (match_operand 2 "" "i")))
8011 (clobber (reg:DI 1))
8012 (clobber (reg:DI 2))
8013 (clobber (reg:DF 40))
8016 (use (const_int 1))]
8017 "TARGET_64BIT && TARGET_HPUX"
8020 return pa_output_call (insn, operands[1], 0);
8022 [(set_attr "type" "call")
8023 (set (attr "length")
8024 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8025 (symbol_ref "pa_attr_length_call (insn, 0)")))])
8027 (define_insn "call_val_reg"
8028 [(set (match_operand 0 "" "")
8029 (call (mem:SI (reg:SI 22))
8030 (match_operand 1 "" "i")))
8031 (clobber (reg:SI 1))
8032 (clobber (reg:SI 2))
8033 (use (const_int 1))]
8037 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8039 [(set_attr "type" "dyncall")
8040 (set (attr "length")
8041 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8042 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8044 ;; This pattern is split if it is necessary to save and restore the
8046 (define_insn "call_val_reg_pic"
8047 [(set (match_operand 0 "" "")
8048 (call (mem:SI (reg:SI 22))
8049 (match_operand 1 "" "i")))
8050 (clobber (reg:SI 1))
8051 (clobber (reg:SI 2))
8052 (clobber (match_operand 2))
8054 (use (const_int 1))]
8058 ;; Split out the PIC register save and restore after reload. As the
8059 ;; split is done after reload, there are some situations in which we
8060 ;; unnecessarily save and restore %r4. This happens when there is a
8061 ;; single call and the PIC register is not used after the call.
8063 ;; The split has to be done since call_from_call_insn () can't handle
8064 ;; the pattern as is. Noreturn calls are special because they have to
8065 ;; terminate the basic block. The split has to contain more than one
8068 [(parallel [(set (match_operand 0 "" "")
8069 (call (mem:SI (reg:SI 22))
8070 (match_operand 1 "" "")))
8071 (clobber (reg:SI 1))
8072 (clobber (reg:SI 2))
8073 (clobber (match_operand 2))
8075 (use (const_int 1))])]
8076 "!TARGET_64BIT && reload_completed
8077 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8078 [(set (match_dup 2) (reg:SI 19))
8079 (parallel [(set (match_dup 0)
8080 (call (mem:SI (reg:SI 22))
8082 (clobber (reg:SI 1))
8083 (clobber (reg:SI 2))
8085 (use (const_int 1))])]
8089 [(parallel [(set (match_operand 0 "" "")
8090 (call (mem:SI (reg:SI 22))
8091 (match_operand 1 "" "")))
8092 (clobber (reg:SI 1))
8093 (clobber (reg:SI 2))
8094 (clobber (match_operand 2))
8096 (use (const_int 1))])]
8097 "!TARGET_64BIT && reload_completed"
8098 [(set (match_dup 2) (reg:SI 19))
8099 (parallel [(set (match_dup 0)
8100 (call (mem:SI (reg:SI 22))
8102 (clobber (reg:SI 1))
8103 (clobber (reg:SI 2))
8105 (use (const_int 1))])
8106 (set (reg:SI 19) (match_dup 2))]
8109 (define_insn "*call_val_reg_pic_post_reload"
8110 [(set (match_operand 0 "" "")
8111 (call (mem:SI (reg:SI 22))
8112 (match_operand 1 "" "i")))
8113 (clobber (reg:SI 1))
8114 (clobber (reg:SI 2))
8116 (use (const_int 1))]
8120 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8122 [(set_attr "type" "dyncall")
8123 (set (attr "length")
8124 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8125 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8127 ;; This pattern is split if it is necessary to save and restore the
8129 (define_insn "call_val_reg_64bit"
8130 [(set (match_operand 0 "" "")
8131 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8132 (match_operand 2 "" "i")))
8133 (clobber (reg:DI 2))
8134 (clobber (match_operand 3))
8137 (use (const_int 1))]
8141 ;; Split out the PIC register save and restore after reload. As the
8142 ;; split is done after reload, there are some situations in which we
8143 ;; unnecessarily save and restore %r4. This happens when there is a
8144 ;; single call and the PIC register is not used after the call.
8146 ;; The split has to be done since call_from_call_insn () can't handle
8147 ;; the pattern as is. Noreturn calls are special because they have to
8148 ;; terminate the basic block. The split has to contain more than one
8151 [(parallel [(set (match_operand 0 "" "")
8152 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8153 (match_operand 2 "" "")))
8154 (clobber (reg:DI 2))
8155 (clobber (match_operand 3))
8158 (use (const_int 1))])]
8159 "TARGET_64BIT && reload_completed
8160 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8161 [(set (match_dup 3) (reg:DI 27))
8162 (parallel [(set (match_dup 0)
8163 (call (mem:SI (match_dup 1))
8165 (clobber (reg:DI 2))
8168 (use (const_int 1))])]
8172 [(parallel [(set (match_operand 0 "" "")
8173 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8174 (match_operand 2 "" "")))
8175 (clobber (reg:DI 2))
8176 (clobber (match_operand 3))
8179 (use (const_int 1))])]
8180 "TARGET_64BIT && reload_completed"
8181 [(set (match_dup 3) (reg:DI 27))
8182 (parallel [(set (match_dup 0)
8183 (call (mem:SI (match_dup 1))
8185 (clobber (reg:DI 2))
8188 (use (const_int 1))])
8189 (set (reg:DI 27) (match_dup 3))]
8192 (define_insn "*call_val_reg_64bit_post_reload"
8193 [(set (match_operand 0 "" "")
8194 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8195 (match_operand 2 "" "i")))
8196 (clobber (reg:DI 2))
8199 (use (const_int 1))]
8203 return pa_output_indirect_call (insn, operands[1]);
8205 [(set_attr "type" "dyncall")
8206 (set (attr "length")
8207 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 12)]
8208 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8210 /* Expand special pc-relative call to _mcount. */
8212 (define_expand "call_mcount"
8213 [(parallel [(call (match_operand:SI 0 "" "")
8214 (match_operand 1 "" ""))
8217 (minus:SI (match_operand 2 "" "")
8218 (plus:SI (pc) (const_int 4)))))
8219 (clobber (reg:SI 2))])]
8220 "!TARGET_PORTABLE_RUNTIME"
8223 rtx op = XEXP (operands[0], 0);
8224 rtx nb = operands[1];
8225 rtx lab = operands[2];
8229 rtx r4 = gen_rtx_REG (word_mode, 4);
8230 emit_move_insn (arg_pointer_rtx,
8231 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8233 emit_call_insn (gen_call_mcount_64bit (op, nb, lab, r4));
8239 rtx r4 = gen_rtx_REG (word_mode, 4);
8240 emit_call_insn (gen_call_mcount_pic (op, nb, lab, r4));
8243 emit_call_insn (gen_call_mcount_nonpic (op, nb, lab));
8249 (define_insn "call_mcount_nonpic"
8250 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8251 (match_operand 1 "" "i"))
8254 (minus:SI (match_operand 2 "" "")
8255 (plus:SI (pc) (const_int 4)))))
8256 (clobber (reg:SI 2))]
8257 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8260 pa_output_arg_descriptor (insn);
8261 return \"{bl|b,l} %0,%%r2\;ldo %2-.-4(%%r2),%%r25\";
8263 [(set_attr "type" "multi")
8264 (set_attr "length" "8")])
8266 (define_insn "call_mcount_pic"
8267 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8268 (match_operand 1 "" "i"))
8271 (minus:SI (match_operand 2 "" "")
8272 (plus:SI (pc) (const_int 4)))))
8273 (clobber (reg:SI 2))
8274 (clobber (match_operand 3))
8276 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8280 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8281 (match_operand 1 "" ""))
8284 (minus:SI (match_operand 2 "" "")
8285 (plus:SI (pc) (const_int 4)))))
8286 (clobber (reg:SI 2))
8287 (clobber (match_operand 3))
8288 (use (reg:SI 19))])]
8289 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
8290 [(set (match_dup 3) (reg:SI 19))
8291 (parallel [(call (mem:SI (match_dup 0))
8295 (minus:SI (match_dup 2)
8296 (plus:SI (pc) (const_int 4)))))
8297 (clobber (reg:SI 2))
8299 (set (reg:SI 19) (match_dup 3))]
8302 (define_insn "*call_mcount_pic_post_reload"
8303 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8304 (match_operand 1 "" "i"))
8307 (minus:SI (match_operand 2 "" "")
8308 (plus:SI (pc) (const_int 4)))))
8309 (clobber (reg:SI 2))
8311 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8314 pa_output_arg_descriptor (insn);
8315 return \"{bl|b,l} %0,%%r2\;ldo %2-.-4(%%r2),%%r25\";
8317 [(set_attr "type" "multi")
8318 (set_attr "length" "8")])
8320 (define_insn "call_mcount_64bit"
8321 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8322 (match_operand 1 "" "i"))
8325 (minus:SI (match_operand 2 "" "")
8326 (plus:SI (pc) (const_int 4)))))
8327 (clobber (reg:DI 2))
8328 (clobber (match_operand 3))
8335 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8336 (match_operand 1 "" ""))
8339 (minus:SI (match_operand 2 "" "")
8340 (plus:SI (pc) (const_int 4)))))
8341 (clobber (reg:DI 2))
8342 (clobber (match_operand 3))
8344 (use (reg:DI 29))])]
8345 "TARGET_64BIT && reload_completed"
8346 [(set (match_dup 3) (reg:DI 27))
8347 (parallel [(call (mem:SI (match_dup 0))
8351 (minus:SI (match_dup 2)
8352 (plus:SI (pc) (const_int 4)))))
8353 (clobber (reg:DI 2))
8356 (set (reg:DI 27) (match_dup 3))]
8359 (define_insn "*call_mcount_64bit_post_reload"
8360 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8361 (match_operand 1 "" "i"))
8364 (minus:SI (match_operand 2 "" "")
8365 (plus:SI (pc) (const_int 4)))))
8366 (clobber (reg:DI 2))
8370 "{bl|b,l} %0,%%r2\;ldo %2-.-4(%%r2),%%r25"
8371 [(set_attr "type" "multi")
8372 (set_attr "length" "8")])
8374 ;; Call subroutine returning any type.
8376 (define_expand "untyped_call"
8377 [(parallel [(call (match_operand 0 "" "")
8379 (match_operand 1 "" "")
8380 (match_operand 2 "" "")])]
8386 emit_call_insn (gen_call (operands[0], const0_rtx));
8388 for (i = 0; i < XVECLEN (operands[2], 0); i++)
8390 rtx set = XVECEXP (operands[2], 0, i);
8391 emit_move_insn (SET_DEST (set), SET_SRC (set));
8394 /* The optimizer does not know that the call sets the function value
8395 registers we stored in the result block. We avoid problems by
8396 claiming that all hard registers are used and clobbered at this
8398 emit_insn (gen_blockage ());
8403 (define_expand "sibcall"
8404 [(call (match_operand:SI 0 "" "")
8405 (match_operand 1 "" ""))]
8406 "!TARGET_PORTABLE_RUNTIME"
8410 rtx nb = operands[1];
8412 op = XEXP (operands[0], 0);
8416 if (!virtuals_instantiated)
8417 emit_move_insn (arg_pointer_rtx,
8418 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8422 /* The loop pass can generate new libcalls after the virtual
8423 registers are instantiated when fpregs are disabled because
8424 the only method that we have for doing DImode multiplication
8425 is with a libcall. This could be trouble if we haven't
8426 allocated enough space for the outgoing arguments. */
8427 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
8429 emit_move_insn (arg_pointer_rtx,
8430 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8431 GEN_INT (STACK_POINTER_OFFSET + 64)));
8435 /* Indirect sibling calls are not allowed. */
8437 call_insn = gen_sibcall_internal_symref_64bit (op, operands[1]);
8439 call_insn = gen_sibcall_internal_symref (op, operands[1]);
8441 call_insn = emit_call_insn (call_insn);
8444 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8446 /* We don't have to restore the PIC register. */
8448 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8453 (define_insn "sibcall_internal_symref"
8454 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8455 (match_operand 1 "" "i"))
8456 (clobber (reg:SI 1))
8458 (use (const_int 0))]
8459 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8462 pa_output_arg_descriptor (insn);
8463 return pa_output_call (insn, operands[0], 1);
8465 [(set_attr "type" "sibcall")
8466 (set (attr "length")
8467 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8468 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8470 (define_insn "sibcall_internal_symref_64bit"
8471 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8472 (match_operand 1 "" "i"))
8473 (clobber (reg:DI 1))
8475 (use (const_int 0))]
8479 return pa_output_call (insn, operands[0], 1);
8481 [(set_attr "type" "sibcall")
8482 (set (attr "length")
8483 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8484 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8486 (define_expand "sibcall_value"
8487 [(set (match_operand 0 "" "")
8488 (call (match_operand:SI 1 "" "")
8489 (match_operand 2 "" "")))]
8490 "!TARGET_PORTABLE_RUNTIME"
8494 rtx nb = operands[1];
8496 op = XEXP (operands[1], 0);
8500 if (!virtuals_instantiated)
8501 emit_move_insn (arg_pointer_rtx,
8502 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8506 /* The loop pass can generate new libcalls after the virtual
8507 registers are instantiated when fpregs are disabled because
8508 the only method that we have for doing DImode multiplication
8509 is with a libcall. This could be trouble if we haven't
8510 allocated enough space for the outgoing arguments. */
8511 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
8513 emit_move_insn (arg_pointer_rtx,
8514 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8515 GEN_INT (STACK_POINTER_OFFSET + 64)));
8519 /* Indirect sibling calls are not allowed. */
8522 = gen_sibcall_value_internal_symref_64bit (operands[0], op, operands[2]);
8525 = gen_sibcall_value_internal_symref (operands[0], op, operands[2]);
8527 call_insn = emit_call_insn (call_insn);
8530 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8532 /* We don't have to restore the PIC register. */
8534 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8539 (define_insn "sibcall_value_internal_symref"
8540 [(set (match_operand 0 "" "")
8541 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8542 (match_operand 2 "" "i")))
8543 (clobber (reg:SI 1))
8545 (use (const_int 0))]
8546 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8549 pa_output_arg_descriptor (insn);
8550 return pa_output_call (insn, operands[1], 1);
8552 [(set_attr "type" "sibcall")
8553 (set (attr "length")
8554 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8555 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8557 (define_insn "sibcall_value_internal_symref_64bit"
8558 [(set (match_operand 0 "" "")
8559 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8560 (match_operand 2 "" "i")))
8561 (clobber (reg:DI 1))
8563 (use (const_int 0))]
8567 return pa_output_call (insn, operands[1], 1);
8569 [(set_attr "type" "sibcall")
8570 (set (attr "length")
8571 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8572 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8578 [(set_attr "type" "move")
8579 (set_attr "length" "4")])
8581 ;;; EH does longjmp's from and within the data section. Thus,
8582 ;;; an interspace branch is required for the longjmp implementation.
8583 ;;; Registers r1 and r2 are used as scratch registers for the jump
8585 (define_expand "interspace_jump"
8587 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8588 (clobber (match_dup 1))])]
8592 operands[1] = gen_rtx_REG (word_mode, 2);
8596 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8597 (clobber (reg:SI 2))]
8598 "TARGET_PA_20 && !TARGET_64BIT"
8600 [(set_attr "type" "branch")
8601 (set_attr "length" "4")])
8604 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8605 (clobber (reg:SI 2))]
8606 "TARGET_NO_SPACE_REGS && !TARGET_64BIT"
8608 [(set_attr "type" "branch")
8609 (set_attr "length" "4")])
8612 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8613 (clobber (reg:SI 2))]
8615 "ldsid (%%sr0,%0),%%r2\;mtsp %%r2,%%sr0\;be%* 0(%%sr0,%0)"
8616 [(set_attr "type" "branch")
8617 (set_attr "length" "12")])
8620 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8621 (clobber (reg:DI 2))]
8624 [(set_attr "type" "branch")
8625 (set_attr "length" "4")])
8627 (define_expand "builtin_longjmp"
8628 [(unspec_volatile [(match_operand 0 "register_operand" "r")] UNSPECV_LONGJMP)]
8632 /* The elements of the buffer are, in order: */
8633 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
8634 rtx lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
8635 POINTER_SIZE / BITS_PER_UNIT));
8636 rtx stack = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
8637 (POINTER_SIZE * 2) / BITS_PER_UNIT));
8638 rtx pv = gen_rtx_REG (Pmode, 1);
8640 emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
8641 emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
8643 /* Restore the frame pointer. The virtual_stack_vars_rtx is saved
8644 instead of the hard_frame_pointer_rtx in the save area. We need
8645 to adjust for the offset between these two values. */
8646 if (GET_CODE (fp) != REG)
8647 fp = force_reg (Pmode, fp);
8648 emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
8650 /* This bit is the same as expand_builtin_longjmp. */
8651 emit_stack_restore (SAVE_NONLOCAL, stack);
8652 emit_use (hard_frame_pointer_rtx);
8653 emit_use (stack_pointer_rtx);
8655 /* Load the label we are jumping through into r1 so that we know
8656 where to look for it when we get back to setjmp's function for
8657 restoring the gp. */
8658 emit_move_insn (pv, lab);
8660 /* Prevent the insns above from being scheduled into the delay slot
8661 of the interspace jump because the space register could change. */
8662 emit_insn (gen_blockage ());
8664 emit_jump_insn (gen_interspace_jump (pv));
8669 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8670 (define_expand "extzvsi"
8671 [(set (match_operand:SI 0 "register_operand" "")
8672 (zero_extract:SI (match_operand:SI 1 "register_operand" "")
8673 (match_operand:SI 2 "uint5_operand" "")
8674 (match_operand:SI 3 "uint5_operand" "")))]
8678 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8679 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8681 /* PA extraction insns don't support zero length bitfields or fields
8682 extending beyond the left or right-most bits. Also, the predicate
8683 rejects lengths equal to a word as they are better handled by
8684 the move patterns. */
8685 if (len == 0 || pos + len > 32)
8688 /* From mips.md: extract_bit_field doesn't verify that our source
8689 matches the predicate, so check it again here. */
8690 if (!register_operand (operands[1], VOIDmode))
8693 emit_insn (gen_extzv_32 (operands[0], operands[1],
8694 operands[2], operands[3]));
8698 (define_insn "extzv_32"
8699 [(set (match_operand:SI 0 "register_operand" "=r")
8700 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8701 (match_operand:SI 2 "uint5_operand" "")
8702 (match_operand:SI 3 "uint5_operand" "")))]
8703 "UINTVAL (operands[2]) > 0
8704 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 32"
8705 "{extru|extrw,u} %1,%3+%2-1,%2,%0"
8706 [(set_attr "type" "shift")
8707 (set_attr "length" "4")])
8710 [(set (match_operand:SI 0 "register_operand" "=r")
8711 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8713 (match_operand:SI 2 "register_operand" "q")))]
8715 "{vextru %1,1,%0|extrw,u %1,%%sar,1,%0}"
8716 [(set_attr "type" "shift")
8717 (set_attr "length" "4")])
8719 (define_expand "extzvdi"
8720 [(set (match_operand:DI 0 "register_operand" "")
8721 (zero_extract:DI (match_operand:DI 1 "register_operand" "")
8722 (match_operand:DI 2 "uint6_operand" "")
8723 (match_operand:DI 3 "uint6_operand" "")))]
8727 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8728 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8730 /* PA extraction insns don't support zero length bitfields or fields
8731 extending beyond the left or right-most bits. Also, the predicate
8732 rejects lengths equal to a doubleword as they are better handled by
8733 the move patterns. */
8734 if (len == 0 || pos + len > 64)
8737 /* From mips.md: extract_bit_field doesn't verify that our source
8738 matches the predicate, so check it again here. */
8739 if (!register_operand (operands[1], VOIDmode))
8742 emit_insn (gen_extzv_64 (operands[0], operands[1],
8743 operands[2], operands[3]));
8747 (define_insn "extzv_64"
8748 [(set (match_operand:DI 0 "register_operand" "=r")
8749 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8750 (match_operand:DI 2 "uint6_operand" "")
8751 (match_operand:DI 3 "uint6_operand" "")))]
8753 && UINTVAL (operands[2]) > 0
8754 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 64"
8755 "extrd,u %1,%3+%2-1,%2,%0"
8756 [(set_attr "type" "shift")
8757 (set_attr "length" "4")])
8760 [(set (match_operand:DI 0 "register_operand" "=r")
8761 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8763 (match_operand:DI 2 "register_operand" "q")))]
8765 "extrd,u %1,%%sar,1,%0"
8766 [(set_attr "type" "shift")
8767 (set_attr "length" "4")])
8769 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8770 (define_expand "extvsi"
8771 [(set (match_operand:SI 0 "register_operand" "")
8772 (sign_extract:SI (match_operand:SI 1 "register_operand" "")
8773 (match_operand:SI 2 "uint5_operand" "")
8774 (match_operand:SI 3 "uint5_operand" "")))]
8778 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8779 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8781 /* PA extraction insns don't support zero length bitfields or fields
8782 extending beyond the left or right-most bits. Also, the predicate
8783 rejects lengths equal to a word as they are better handled by
8784 the move patterns. */
8785 if (len == 0 || pos + len > 32)
8788 /* From mips.md: extract_bit_field doesn't verify that our source
8789 matches the predicate, so check it again here. */
8790 if (!register_operand (operands[1], VOIDmode))
8793 emit_insn (gen_extv_32 (operands[0], operands[1],
8794 operands[2], operands[3]));
8798 (define_insn "extv_32"
8799 [(set (match_operand:SI 0 "register_operand" "=r")
8800 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8801 (match_operand:SI 2 "uint5_operand" "")
8802 (match_operand:SI 3 "uint5_operand" "")))]
8803 "UINTVAL (operands[2]) > 0
8804 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 32"
8805 "{extrs|extrw,s} %1,%3+%2-1,%2,%0"
8806 [(set_attr "type" "shift")
8807 (set_attr "length" "4")])
8810 [(set (match_operand:SI 0 "register_operand" "=r")
8811 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8813 (match_operand:SI 2 "register_operand" "q")))]
8815 "{vextrs %1,1,%0|extrw,s %1,%%sar,1,%0}"
8816 [(set_attr "type" "shift")
8817 (set_attr "length" "4")])
8819 (define_expand "extvdi"
8820 [(set (match_operand:DI 0 "register_operand" "")
8821 (sign_extract:DI (match_operand:DI 1 "register_operand" "")
8822 (match_operand:DI 2 "uint6_operand" "")
8823 (match_operand:DI 3 "uint6_operand" "")))]
8827 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8828 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8830 /* PA extraction insns don't support zero length bitfields or fields
8831 extending beyond the left or right-most bits. Also, the predicate
8832 rejects lengths equal to a doubleword as they are better handled by
8833 the move patterns. */
8834 if (len == 0 || pos + len > 64)
8837 /* From mips.md: extract_bit_field doesn't verify that our source
8838 matches the predicate, so check it again here. */
8839 if (!register_operand (operands[1], VOIDmode))
8842 emit_insn (gen_extv_64 (operands[0], operands[1],
8843 operands[2], operands[3]));
8847 (define_insn "extv_64"
8848 [(set (match_operand:DI 0 "register_operand" "=r")
8849 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8850 (match_operand:DI 2 "uint6_operand" "")
8851 (match_operand:DI 3 "uint6_operand" "")))]
8853 && UINTVAL (operands[2]) > 0
8854 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 64"
8855 "extrd,s %1,%3+%2-1,%2,%0"
8856 [(set_attr "type" "shift")
8857 (set_attr "length" "4")])
8860 [(set (match_operand:DI 0 "register_operand" "=r")
8861 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8863 (match_operand:DI 2 "register_operand" "q")))]
8865 "extrd,s %1,%%sar,1,%0"
8866 [(set_attr "type" "shift")
8867 (set_attr "length" "4")])
8869 ;;; Operands 1 and 2 are assumed to be CONST_INTs.
8870 (define_expand "insvsi"
8871 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
8872 (match_operand:SI 1 "uint5_operand" "")
8873 (match_operand:SI 2 "uint5_operand" ""))
8874 (match_operand:SI 3 "arith5_operand" ""))]
8878 unsigned HOST_WIDE_INT len = UINTVAL (operands[1]);
8879 unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]);
8881 /* PA insertion insns don't support zero length bitfields or fields
8882 extending beyond the left or right-most bits. Also, the predicate
8883 rejects lengths equal to a word as they are better handled by
8884 the move patterns. */
8885 if (len <= 0 || pos + len > 32)
8888 /* From mips.md: insert_bit_field doesn't verify that our destination
8889 matches the predicate, so check it again here. */
8890 if (!register_operand (operands[0], VOIDmode))
8893 emit_insn (gen_insv_32 (operands[0], operands[1],
8894 operands[2], operands[3]));
8898 (define_insn "insv_32"
8899 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
8900 (match_operand:SI 1 "uint5_operand" "")
8901 (match_operand:SI 2 "uint5_operand" ""))
8902 (match_operand:SI 3 "arith5_operand" "r,L"))]
8903 "UINTVAL (operands[1]) > 0
8904 && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 32"
8906 {dep|depw} %3,%2+%1-1,%1,%0
8907 {depi|depwi} %3,%2+%1-1,%1,%0"
8908 [(set_attr "type" "shift,shift")
8909 (set_attr "length" "4,4")])
8911 ;; Optimize insertion of const_int values of type 1...1xxxx.
8913 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
8914 (match_operand:SI 1 "uint5_operand" "")
8915 (match_operand:SI 2 "uint5_operand" ""))
8916 (match_operand:SI 3 "const_int_operand" ""))]
8917 "(INTVAL (operands[3]) & 0x10) != 0 &&
8918 (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8921 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8922 return \"{depi|depwi} %3,%2+%1-1,%1,%0\";
8924 [(set_attr "type" "shift")
8925 (set_attr "length" "4")])
8927 (define_expand "insvdi"
8928 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
8929 (match_operand:DI 1 "uint6_operand" "")
8930 (match_operand:DI 2 "uint6_operand" ""))
8931 (match_operand:DI 3 "arith5_operand" ""))]
8935 unsigned HOST_WIDE_INT len = UINTVAL (operands[1]);
8936 unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]);
8938 /* PA insertion insns don't support zero length bitfields or fields
8939 extending beyond the left or right-most bits. Also, the predicate
8940 rejects lengths equal to a doubleword as they are better handled by
8941 the move patterns. */
8942 if (len <= 0 || pos + len > 64)
8945 /* From mips.md: insert_bit_field doesn't verify that our destination
8946 matches the predicate, so check it again here. */
8947 if (!register_operand (operands[0], VOIDmode))
8950 emit_insn (gen_insv_64 (operands[0], operands[1],
8951 operands[2], operands[3]));
8955 (define_insn "insv_64"
8956 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r,r")
8957 (match_operand:DI 1 "uint6_operand" "")
8958 (match_operand:DI 2 "uint6_operand" ""))
8959 (match_operand:DI 3 "arith5_operand" "r,L"))]
8961 && UINTVAL (operands[1]) > 0
8962 && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 64"
8964 depd %3,%2+%1-1,%1,%0
8965 depdi %3,%2+%1-1,%1,%0"
8966 [(set_attr "type" "shift,shift")
8967 (set_attr "length" "4,4")])
8969 ;; Optimize insertion of const_int values of type 1...1xxxx.
8971 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
8972 (match_operand:DI 1 "uint6_operand" "")
8973 (match_operand:DI 2 "uint6_operand" ""))
8974 (match_operand:DI 3 "const_int_operand" ""))]
8975 "(INTVAL (operands[3]) & 0x10) != 0
8977 && (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8980 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8981 return \"depdi %3,%2+%1-1,%1,%0\";
8983 [(set_attr "type" "shift")
8984 (set_attr "length" "4")])
8987 [(set (match_operand:DI 0 "register_operand" "=r")
8988 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
8991 "depd,z %1,31,32,%0"
8992 [(set_attr "type" "shift")
8993 (set_attr "length" "4")])
8995 ;; This insn is used for some loop tests, typically loops reversed when
8996 ;; strength reduction is used. It is actually created when the instruction
8997 ;; combination phase combines the special loop test. Since this insn
8998 ;; is both a jump insn and has an output, it must deal with its own
8999 ;; reloads, hence the `Q' constraints. The `!' constraints direct reload
9000 ;; to not choose the register alternatives in the event a reload is needed.
9001 (define_insn "decrement_and_branch_until_zero"
9004 (match_operator 2 "comparison_operator"
9006 (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*Q")
9007 (match_operand:SI 1 "int5_operand" "L,L,L"))
9009 (label_ref (match_operand 3 "" ""))
9012 (plus:SI (match_dup 0) (match_dup 1)))
9013 (clobber (match_scratch:SI 4 "=X,r,r"))]
9015 "* return pa_output_dbra (operands, insn, which_alternative); "
9016 ;; Do not expect to understand this the first time through.
9017 [(set_attr "type" "cbranch,multi,multi")
9018 (set (attr "length")
9019 (if_then_else (eq_attr "alternative" "0")
9020 ;; Loop counter in register case
9021 ;; Short branch has length of 4
9022 ;; Long branch has length of 8, 20, 24 or 28
9023 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9024 (const_int MAX_12BIT_OFFSET))
9026 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9027 (const_int MAX_17BIT_OFFSET))
9029 (match_test "TARGET_PORTABLE_RUNTIME")
9031 (not (match_test "flag_pic"))
9035 ;; Loop counter in FP reg case.
9036 ;; Extra goo to deal with additional reload insns.
9037 (if_then_else (eq_attr "alternative" "1")
9038 (if_then_else (lt (match_dup 3) (pc))
9039 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
9040 (const_int MAX_12BIT_OFFSET))
9042 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
9043 (const_int MAX_17BIT_OFFSET))
9045 (match_test "TARGET_PORTABLE_RUNTIME")
9047 (not (match_test "flag_pic"))
9050 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9051 (const_int MAX_12BIT_OFFSET))
9053 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9054 (const_int MAX_17BIT_OFFSET))
9056 (match_test "TARGET_PORTABLE_RUNTIME")
9058 (not (match_test "flag_pic"))
9062 ;; Loop counter in memory case.
9063 ;; Extra goo to deal with additional reload insns.
9064 (if_then_else (lt (match_dup 3) (pc))
9065 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9066 (const_int MAX_12BIT_OFFSET))
9068 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9069 (const_int MAX_17BIT_OFFSET))
9071 (match_test "TARGET_PORTABLE_RUNTIME")
9073 (not (match_test "flag_pic"))
9076 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9077 (const_int MAX_12BIT_OFFSET))
9079 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9080 (const_int MAX_17BIT_OFFSET))
9082 (match_test "TARGET_PORTABLE_RUNTIME")
9084 (not (match_test "flag_pic"))
9086 (const_int 36))))))])
9091 (match_operator 2 "movb_comparison_operator"
9092 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
9093 (label_ref (match_operand 3 "" ""))
9095 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q")
9098 "* return pa_output_movb (operands, insn, which_alternative, 0); "
9099 ;; Do not expect to understand this the first time through.
9100 [(set_attr "type" "cbranch,multi,multi,multi")
9101 (set (attr "length")
9102 (if_then_else (eq_attr "alternative" "0")
9103 ;; Loop counter in register case
9104 ;; Short branch has length of 4
9105 ;; Long branch has length of 8, 20, 24 or 28
9106 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9107 (const_int MAX_12BIT_OFFSET))
9109 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9110 (const_int MAX_17BIT_OFFSET))
9112 (match_test "TARGET_PORTABLE_RUNTIME")
9114 (not (match_test "flag_pic"))
9118 ;; Loop counter in FP reg case.
9119 ;; Extra goo to deal with additional reload insns.
9120 (if_then_else (eq_attr "alternative" "1")
9121 (if_then_else (lt (match_dup 3) (pc))
9122 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9123 (const_int MAX_12BIT_OFFSET))
9125 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9126 (const_int MAX_17BIT_OFFSET))
9128 (match_test "TARGET_PORTABLE_RUNTIME")
9130 (not (match_test "flag_pic"))
9133 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9134 (const_int MAX_12BIT_OFFSET))
9136 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9137 (const_int MAX_17BIT_OFFSET))
9139 (match_test "TARGET_PORTABLE_RUNTIME")
9141 (not (match_test "flag_pic"))
9145 ;; Loop counter in memory or sar case.
9146 ;; Extra goo to deal with additional reload insns.
9147 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9148 (const_int MAX_12BIT_OFFSET))
9150 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9151 (const_int MAX_17BIT_OFFSET))
9153 (match_test "TARGET_PORTABLE_RUNTIME")
9155 (not (match_test "flag_pic"))
9157 (const_int 32)))))])
9159 ;; Handle negated branch.
9163 (match_operator 2 "movb_comparison_operator"
9164 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
9166 (label_ref (match_operand 3 "" ""))))
9167 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q")
9170 "* return pa_output_movb (operands, insn, which_alternative, 1); "
9171 ;; Do not expect to understand this the first time through.
9172 [(set_attr "type" "cbranch,multi,multi,multi")
9173 (set (attr "length")
9174 (if_then_else (eq_attr "alternative" "0")
9175 ;; Loop counter in register case
9176 ;; Short branch has length of 4
9177 ;; Long branch has length of 8
9178 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9179 (const_int MAX_12BIT_OFFSET))
9181 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9182 (const_int MAX_17BIT_OFFSET))
9184 (match_test "TARGET_PORTABLE_RUNTIME")
9186 (not (match_test "flag_pic"))
9190 ;; Loop counter in FP reg case.
9191 ;; Extra goo to deal with additional reload insns.
9192 (if_then_else (eq_attr "alternative" "1")
9193 (if_then_else (lt (match_dup 3) (pc))
9194 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9195 (const_int MAX_12BIT_OFFSET))
9197 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9198 (const_int MAX_17BIT_OFFSET))
9200 (match_test "TARGET_PORTABLE_RUNTIME")
9202 (not (match_test "flag_pic"))
9205 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9206 (const_int MAX_12BIT_OFFSET))
9208 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9209 (const_int MAX_17BIT_OFFSET))
9211 (match_test "TARGET_PORTABLE_RUNTIME")
9213 (not (match_test "flag_pic"))
9217 ;; Loop counter in memory or SAR case.
9218 ;; Extra goo to deal with additional reload insns.
9219 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9220 (const_int MAX_12BIT_OFFSET))
9222 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9223 (const_int MAX_17BIT_OFFSET))
9225 (match_test "TARGET_PORTABLE_RUNTIME")
9227 (not (match_test "flag_pic"))
9229 (const_int 32)))))])
9232 [(set (pc) (label_ref (match_operand 3 "" "" )))
9233 (set (match_operand:SI 0 "ireg_operand" "=r")
9234 (plus:SI (match_operand:SI 1 "ireg_operand" "r")
9235 (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
9236 "(reload_completed && operands[0] == operands[1]) || operands[0] == operands[2]"
9239 return pa_output_parallel_addb (operands, insn);
9241 [(set_attr "type" "parallel_branch")
9242 (set (attr "length")
9243 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9244 (const_int MAX_12BIT_OFFSET))
9246 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9247 (const_int MAX_17BIT_OFFSET))
9249 (match_test "TARGET_PORTABLE_RUNTIME")
9251 (not (match_test "flag_pic"))
9256 [(set (pc) (label_ref (match_operand 2 "" "" )))
9257 (set (match_operand:SF 0 "ireg_operand" "=r")
9258 (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
9262 return pa_output_parallel_movb (operands, insn);
9264 [(set_attr "type" "parallel_branch")
9265 (set (attr "length")
9266 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9267 (const_int MAX_12BIT_OFFSET))
9269 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9270 (const_int MAX_17BIT_OFFSET))
9272 (match_test "TARGET_PORTABLE_RUNTIME")
9274 (not (match_test "flag_pic"))
9279 [(set (pc) (label_ref (match_operand 2 "" "" )))
9280 (set (match_operand:SI 0 "ireg_operand" "=r")
9281 (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
9285 return pa_output_parallel_movb (operands, insn);
9287 [(set_attr "type" "parallel_branch")
9288 (set (attr "length")
9289 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9290 (const_int MAX_12BIT_OFFSET))
9292 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9293 (const_int MAX_17BIT_OFFSET))
9295 (match_test "TARGET_PORTABLE_RUNTIME")
9297 (not (match_test "flag_pic"))
9302 [(set (pc) (label_ref (match_operand 2 "" "" )))
9303 (set (match_operand:HI 0 "ireg_operand" "=r")
9304 (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
9308 return pa_output_parallel_movb (operands, insn);
9310 [(set_attr "type" "parallel_branch")
9311 (set (attr "length")
9312 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9313 (const_int MAX_12BIT_OFFSET))
9315 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9316 (const_int MAX_17BIT_OFFSET))
9318 (match_test "TARGET_PORTABLE_RUNTIME")
9320 (not (match_test "flag_pic"))
9325 [(set (pc) (label_ref (match_operand 2 "" "" )))
9326 (set (match_operand:QI 0 "ireg_operand" "=r")
9327 (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
9331 return pa_output_parallel_movb (operands, insn);
9333 [(set_attr "type" "parallel_branch")
9334 (set (attr "length")
9335 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9336 (const_int MAX_12BIT_OFFSET))
9338 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9339 (const_int MAX_17BIT_OFFSET))
9341 (match_test "TARGET_PORTABLE_RUNTIME")
9343 (not (match_test "flag_pic"))
9348 [(set (match_operand 0 "register_operand" "=f")
9349 (mult (match_operand 1 "register_operand" "f")
9350 (match_operand 2 "register_operand" "f")))
9351 (set (match_operand 3 "register_operand" "+f")
9352 (plus (match_operand 4 "register_operand" "f")
9353 (match_operand 5 "register_operand" "f")))]
9354 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9355 && reload_completed && pa_fmpyaddoperands (operands)"
9358 if (GET_MODE (operands[0]) == DFmode)
9360 if (rtx_equal_p (operands[3], operands[5]))
9361 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9363 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9367 if (rtx_equal_p (operands[3], operands[5]))
9368 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9370 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9373 [(set_attr "type" "fpalu")
9374 (set_attr "length" "4")])
9377 [(set (match_operand 3 "register_operand" "+f")
9378 (plus (match_operand 4 "register_operand" "f")
9379 (match_operand 5 "register_operand" "f")))
9380 (set (match_operand 0 "register_operand" "=f")
9381 (mult (match_operand 1 "register_operand" "f")
9382 (match_operand 2 "register_operand" "f")))]
9383 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9384 && reload_completed && pa_fmpyaddoperands (operands)"
9387 if (GET_MODE (operands[0]) == DFmode)
9389 if (rtx_equal_p (operands[3], operands[5]))
9390 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9392 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9396 if (rtx_equal_p (operands[3], operands[5]))
9397 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9399 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9402 [(set_attr "type" "fpalu")
9403 (set_attr "length" "4")])
9406 [(set (match_operand 0 "register_operand" "=f")
9407 (mult (match_operand 1 "register_operand" "f")
9408 (match_operand 2 "register_operand" "f")))
9409 (set (match_operand 3 "register_operand" "+f")
9410 (minus (match_operand 4 "register_operand" "f")
9411 (match_operand 5 "register_operand" "f")))]
9412 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9413 && reload_completed && pa_fmpysuboperands (operands)"
9416 if (GET_MODE (operands[0]) == DFmode)
9417 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9419 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9421 [(set_attr "type" "fpalu")
9422 (set_attr "length" "4")])
9425 [(set (match_operand 3 "register_operand" "+f")
9426 (minus (match_operand 4 "register_operand" "f")
9427 (match_operand 5 "register_operand" "f")))
9428 (set (match_operand 0 "register_operand" "=f")
9429 (mult (match_operand 1 "register_operand" "f")
9430 (match_operand 2 "register_operand" "f")))]
9431 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9432 && reload_completed && pa_fmpysuboperands (operands)"
9435 if (GET_MODE (operands[0]) == DFmode)
9436 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9438 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9440 [(set_attr "type" "fpalu")
9441 (set_attr "length" "4")])
9443 ;; The following two patterns are used by the trampoline code for nested
9444 ;; functions. They flush the I and D cache lines from the start address
9445 ;; (operand0) to the end address (operand1). No lines are flushed if the
9446 ;; end address is less than the start address (unsigned).
9448 ;; Because the range of memory flushed is variable and the size of a MEM
9449 ;; can only be a CONST_INT, the patterns specify that they perform an
9450 ;; unspecified volatile operation on all memory.
9452 ;; The address range for an icache flush must lie within a single
9453 ;; space on targets with non-equivalent space registers.
9455 ;; Operand 0 contains the start address.
9456 ;; Operand 1 contains the end address.
9457 ;; Operand 2 contains the line length to use.
9458 (define_insn "dcacheflush<P:mode>"
9460 (unspec_volatile [(mem:BLK (scratch))] UNSPECV_DCACHE)
9461 (use (match_operand 0 "pmode_register_operand" "r"))
9462 (use (match_operand 1 "pmode_register_operand" "r"))
9463 (use (match_operand 2 "pmode_register_operand" "r"))
9464 (clobber (match_scratch:P 3 "=&0"))]
9466 "cmpb,<dwc><<=,n %3,%1,.\;fdc,m %2(%3)\;sync"
9467 [(set_attr "type" "multi")
9468 (set_attr "length" "12")])
9470 (define_insn "icacheflush<P:mode>"
9472 (unspec_volatile [(mem:BLK (scratch))] UNSPECV_ICACHE)
9473 (use (match_operand 0 "pmode_register_operand" "r"))
9474 (use (match_operand 1 "pmode_register_operand" "r"))
9475 (use (match_operand 2 "pmode_register_operand" "r"))
9476 (clobber (match_operand 3 "pmode_register_operand" "=&r"))
9477 (clobber (match_operand 4 "pmode_register_operand" "=&r"))
9478 (clobber (match_scratch:P 5 "=&0"))]
9480 "mfsp %%sr0,%4\;ldsid (%5),%3\;mtsp %3,%%sr0\;cmpb,<dwc><<=,n %5,%1,.\;fic,m %2(%%sr0,%5)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop"
9481 [(set_attr "type" "multi")
9482 (set_attr "length" "52")])
9484 ;; An out-of-line prologue.
9485 (define_insn "outline_prologue_call"
9486 [(unspec_volatile [(const_int 0)] UNSPECV_OPC)
9487 (clobber (reg:SI 31))
9488 (clobber (reg:SI 22))
9489 (clobber (reg:SI 21))
9490 (clobber (reg:SI 20))
9491 (clobber (reg:SI 19))
9492 (clobber (reg:SI 1))]
9497 /* We need two different versions depending on whether or not we
9498 need a frame pointer. Also note that we return to the instruction
9499 immediately after the branch rather than two instructions after the
9500 break as normally is the case. */
9501 if (frame_pointer_needed)
9503 /* Must import the magic millicode routine(s). */
9504 output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
9506 if (TARGET_PORTABLE_RUNTIME)
9508 output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
9509 output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
9513 output_asm_insn (\"{bl|b,l},n __outline_prologue_fp,%%r31\", NULL);
9517 /* Must import the magic millicode routine(s). */
9518 output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
9520 if (TARGET_PORTABLE_RUNTIME)
9522 output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
9523 output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
9526 output_asm_insn (\"{bl|b,l},n __outline_prologue,%%r31\", NULL);
9530 [(set_attr "type" "multi")
9531 (set_attr "length" "8")])
9533 ;; An out-of-line epilogue.
9534 (define_insn "outline_epilogue_call"
9535 [(unspec_volatile [(const_int 1)] UNSPECV_OEC)
9538 (clobber (reg:SI 31))
9539 (clobber (reg:SI 22))
9540 (clobber (reg:SI 21))
9541 (clobber (reg:SI 20))
9542 (clobber (reg:SI 19))
9543 (clobber (reg:SI 2))
9544 (clobber (reg:SI 1))]
9549 /* We need two different versions depending on whether or not we
9550 need a frame pointer. Also note that we return to the instruction
9551 immediately after the branch rather than two instructions after the
9552 break as normally is the case. */
9553 if (frame_pointer_needed)
9555 /* Must import the magic millicode routine. */
9556 output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
9558 /* The out-of-line prologue will make sure we return to the right
9560 if (TARGET_PORTABLE_RUNTIME)
9562 output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
9563 output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
9567 output_asm_insn (\"{bl|b,l},n __outline_epilogue_fp,%%r31\", NULL);
9571 /* Must import the magic millicode routine. */
9572 output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
9574 /* The out-of-line prologue will make sure we return to the right
9576 if (TARGET_PORTABLE_RUNTIME)
9578 output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
9579 output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
9582 output_asm_insn (\"{bl|b,l},n __outline_epilogue,%%r31\", NULL);
9586 [(set_attr "type" "multi")
9587 (set_attr "length" "8")])
9589 ;; Given a function pointer, canonicalize it so it can be
9590 ;; reliably compared to another function pointer. */
9591 (define_expand "canonicalize_funcptr_for_compare"
9592 [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
9593 (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9594 (clobber (match_dup 2))
9595 (clobber (reg:SI 26))
9596 (clobber (reg:SI 22))
9597 (clobber (reg:SI 31))])
9598 (set (match_operand:SI 0 "register_operand" "")
9600 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
9605 rtx canonicalize_funcptr_for_compare_libfunc
9606 = init_one_libfunc (CANONICALIZE_FUNCPTR_FOR_COMPARE_LIBCALL);
9608 emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
9609 operands[0], LCT_NORMAL, Pmode,
9610 1, operands[1], Pmode);
9614 operands[2] = gen_reg_rtx (SImode);
9615 if (GET_CODE (operands[1]) != REG)
9617 rtx tmp = gen_reg_rtx (Pmode);
9618 emit_move_insn (tmp, operands[1]);
9623 (define_insn "*$$sh_func_adrs"
9624 [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9625 (clobber (match_operand:SI 0 "register_operand" "=a"))
9626 (clobber (reg:SI 26))
9627 (clobber (reg:SI 22))
9628 (clobber (reg:SI 31))]
9632 int length = get_attr_length (insn);
9635 xoperands[0] = GEN_INT (length - 8);
9636 xoperands[1] = GEN_INT (length - 16);
9638 /* Must import the magic millicode routine. */
9639 output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
9641 /* This is absolutely amazing.
9643 First, copy our input parameter into %r29 just in case we don't
9644 need to call $$sh_func_adrs. */
9645 output_asm_insn (\"copy %%r26,%%r29\", NULL);
9646 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\", NULL);
9648 /* Next, examine the low two bits in %r26, if they aren't 0x2, then
9649 we use %r26 unchanged. */
9650 output_asm_insn (\"{comib|cmpib},<>,n 2,%%r31,.+%0\", xoperands);
9651 output_asm_insn (\"ldi 4096,%%r31\", NULL);
9653 /* Next, compare %r26 with 4096, if %r26 is less than or equal to
9654 4096, then again we use %r26 unchanged. */
9655 output_asm_insn (\"{comb|cmpb},<<,n %%r26,%%r31,.+%1\", xoperands);
9657 /* Finally, call $$sh_func_adrs to extract the function's real add24. */
9658 return pa_output_millicode_call (insn,
9659 gen_rtx_SYMBOL_REF (SImode,
9660 \"$$sh_func_adrs\"));
9662 [(set_attr "type" "sh_func_adrs")
9663 (set (attr "length")
9664 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 28)]
9665 (plus (symbol_ref "pa_attr_length_millicode_call (insn)")
9668 ;; On the PA, the PIC register is call clobbered, so it must
9669 ;; be saved & restored around calls by the caller. If the call
9670 ;; doesn't return normally (nonlocal goto, or an exception is
9671 ;; thrown), then the code at the exception handler label must
9672 ;; restore the PIC register.
9673 (define_expand "exception_receiver"
9678 /* On the 64-bit port, we need a blockage because there is
9679 confusion regarding the dependence of the restore on the
9680 frame pointer. As a result, the frame pointer and pic
9681 register restores sometimes are interchanged erroneously. */
9683 emit_insn (gen_blockage ());
9684 /* Restore the PIC register using hppa_pic_save_rtx (). The
9685 PIC register is not saved in the frame in 64-bit ABI. */
9686 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9687 emit_insn (gen_blockage ());
9691 (define_expand "builtin_setjmp_receiver"
9692 [(label_ref (match_operand 0 "" ""))]
9697 emit_insn (gen_blockage ());
9698 /* Restore the PIC register. Hopefully, this will always be from
9699 a stack slot. The only registers that are valid after a
9700 builtin_longjmp are the stack and frame pointers. */
9701 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9702 emit_insn (gen_blockage ());
9706 ;; Allocate new stack space and update the saved stack pointer in the
9707 ;; frame marker. The HP C compilers also copy additional words in the
9708 ;; frame marker. The 64-bit compiler copies words at -48, -32 and -24.
9709 ;; The 32-bit compiler copies the word at -16 (Static Link). We
9710 ;; currently don't copy these values.
9712 ;; Since the copy of the frame marker can't be done atomically, I
9713 ;; suspect that using it for unwind purposes may be somewhat unreliable.
9714 ;; The HP compilers appear to raise the stack and copy the frame
9715 ;; marker in a strict instruction sequence. This suggests that the
9716 ;; unwind library may check for an alloca sequence when ALLOCA_FRAME
9717 ;; is set in the callinfo data. We currently don't set ALLOCA_FRAME
9718 ;; as GAS doesn't support it, or try to keep the instructions emitted
9719 ;; here in strict sequence.
9720 (define_expand "allocate_stack"
9721 [(match_operand 0 "" "")
9722 (match_operand 1 "" "")]
9728 /* Since the stack grows upward, we need to store virtual_stack_dynamic_rtx
9729 in operand 0 before adjusting the stack. */
9730 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9731 anti_adjust_stack (operands[1]);
9732 if (TARGET_HPUX_UNWIND_LIBRARY)
9734 addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx,
9735 GEN_INT (TARGET_64BIT ? -8 : -4));
9736 emit_move_insn (gen_rtx_MEM (word_mode, addr), hard_frame_pointer_rtx);
9738 if (!TARGET_64BIT && flag_pic)
9740 rtx addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx, GEN_INT (-32));
9741 emit_move_insn (gen_rtx_MEM (word_mode, addr), pic_offset_table_rtx);
9746 (define_expand "prefetch"
9747 [(match_operand 0 "address_operand" "")
9748 (match_operand 1 "const_int_operand" "")
9749 (match_operand 2 "const_int_operand" "")]
9752 operands[0] = copy_addr_to_reg (operands[0]);
9753 emit_insn (gen_prefetch_20 (operands[0], operands[1], operands[2]));
9757 (define_insn "prefetch_20"
9758 [(prefetch (match_operand 0 "pmode_register_operand" "r")
9759 (match_operand:SI 1 "const_int_operand" "n")
9760 (match_operand:SI 2 "const_int_operand" "n"))]
9763 /* The SL cache-control completer indicates good spatial locality but
9764 poor temporal locality. The ldw instruction with a target of general
9765 register 0 prefetches a cache line for a read. The ldd instruction
9766 prefetches a cache line for a write. */
9767 static const char * const instr[2][2] = {
9769 "ldw,sl 0(%0),%%r0",
9777 int read_or_write = INTVAL (operands[1]) == 0 ? 0 : 1;
9778 int locality = INTVAL (operands[2]) == 0 ? 0 : 1;
9780 return instr [locality][read_or_write];
9782 [(set_attr "type" "load")
9783 (set_attr "length" "4")])
9786 (define_insn "tgd_load"
9787 [(set (match_operand:SI 0 "register_operand" "=r")
9788 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
9789 (clobber (reg:SI 1))
9794 return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
9796 [(set_attr "type" "multi")
9797 (set_attr "length" "8")])
9799 (define_insn "tgd_load_pic"
9800 [(set (match_operand:SI 0 "register_operand" "=r")
9801 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
9802 (clobber (reg:SI 1))
9807 return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
9809 [(set_attr "type" "multi")
9810 (set_attr "length" "8")])
9812 (define_insn "tld_load"
9813 [(set (match_operand:SI 0 "register_operand" "=r")
9814 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
9815 (clobber (reg:SI 1))
9820 return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
9822 [(set_attr "type" "multi")
9823 (set_attr "length" "8")])
9825 (define_insn "tld_load_pic"
9826 [(set (match_operand:SI 0 "register_operand" "=r")
9827 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
9828 (clobber (reg:SI 1))
9833 return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
9835 [(set_attr "type" "multi")
9836 (set_attr "length" "8")])
9838 (define_insn "tld_offset_load"
9839 [(set (match_operand:SI 0 "register_operand" "=r")
9840 (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")]
9842 (match_operand:SI 2 "register_operand" "r")))
9843 (clobber (reg:SI 1))]
9847 return \"addil LR'%1-$tls_dtpoff$,%2\;ldo RR'%1-$tls_dtpoff$(%%r1),%0\";
9849 [(set_attr "type" "multi")
9850 (set_attr "length" "8")])
9852 (define_insn "tp_load"
9853 [(set (match_operand:SI 0 "register_operand" "=r")
9854 (unspec:SI [(const_int 0)] UNSPEC_TP))]
9857 [(set_attr "type" "multi")
9858 (set_attr "length" "4")])
9860 (define_insn "tie_load"
9861 [(set (match_operand:SI 0 "register_operand" "=r")
9862 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
9863 (clobber (reg:SI 1))
9868 return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
9870 [(set_attr "type" "multi")
9871 (set_attr "length" "8")])
9873 (define_insn "tie_load_pic"
9874 [(set (match_operand:SI 0 "register_operand" "=r")
9875 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
9876 (clobber (reg:SI 1))
9881 return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
9883 [(set_attr "type" "multi")
9884 (set_attr "length" "8")])
9886 (define_insn "tle_load"
9887 [(set (match_operand:SI 0 "register_operand" "=r")
9888 (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")]
9890 (match_operand:SI 2 "register_operand" "r")))
9891 (clobber (reg:SI 1))]
9893 "addil LR'%1-$tls_leoff$,%2\;ldo RR'%1-$tls_leoff$(%%r1),%0"
9894 [(set_attr "type" "multi")
9895 (set_attr "length" "8")])
9897 ;; Atomic instructions
9899 ;; All memory loads and stores access storage atomically except
9900 ;; for one exception. The STORE BYTES, STORE DOUBLE BYTES, and
9901 ;; doubleword loads and stores are not guaranteed to be atomic
9902 ;; when referencing the I/O address space.
9904 ;; The kernel cmpxchg operation on linux is not atomic with respect to
9905 ;; memory stores on SMP machines, so we must do stores using a cmpxchg
9908 ;; These patterns are at the bottom so the non atomic versions are preferred.
9910 ;; Implement atomic QImode store using exchange.
9912 (define_expand "atomic_storeqi"
9913 [(match_operand:QI 0 "memory_operand") ;; memory
9914 (match_operand:QI 1 "register_operand") ;; val out
9915 (match_operand:SI 2 "const_int_operand")] ;; model
9918 if (TARGET_SYNC_LIBCALL)
9920 rtx mem = operands[0];
9921 rtx val = operands[1];
9922 if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val))
9928 ;; Implement atomic HImode stores using exchange.
9930 (define_expand "atomic_storehi"
9931 [(match_operand:HI 0 "memory_operand") ;; memory
9932 (match_operand:HI 1 "register_operand") ;; val out
9933 (match_operand:SI 2 "const_int_operand")] ;; model
9936 if (TARGET_SYNC_LIBCALL)
9938 rtx mem = operands[0];
9939 rtx val = operands[1];
9940 if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val))
9946 ;; Implement atomic SImode store using exchange.
9948 (define_expand "atomic_storesi"
9949 [(match_operand:SI 0 "memory_operand") ;; memory
9950 (match_operand:SI 1 "register_operand") ;; val out
9951 (match_operand:SI 2 "const_int_operand")] ;; model
9954 if (TARGET_SYNC_LIBCALL)
9956 rtx mem = operands[0];
9957 rtx val = operands[1];
9958 if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val))
9964 ;; Implement atomic SFmode store using exchange.
9966 (define_expand "atomic_storesf"
9967 [(match_operand:SF 0 "memory_operand") ;; memory
9968 (match_operand:SF 1 "register_operand") ;; val out
9969 (match_operand:SI 2 "const_int_operand")] ;; model
9972 if (TARGET_SYNC_LIBCALL)
9974 rtx mem = operands[0];
9975 rtx val = operands[1];
9976 if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val))
9982 ;; Implement atomic DImode load using 64-bit floating point load.
9984 (define_expand "atomic_loaddi"
9985 [(match_operand:DI 0 "register_operand") ;; val out
9986 (match_operand:DI 1 "memory_operand") ;; memory
9987 (match_operand:SI 2 "const_int_operand")] ;; model
9990 enum memmodel model;
9992 if (TARGET_64BIT || TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT)
9995 model = memmodel_from_int (INTVAL (operands[2]));
9996 operands[1] = force_reg (SImode, XEXP (operands[1], 0));
9997 expand_mem_thread_fence (model);
9998 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
9999 if (is_mm_seq_cst (model))
10000 expand_mem_thread_fence (model);
10004 (define_insn "atomic_loaddi_1"
10005 [(set (match_operand:DI 0 "register_operand" "=f,r")
10006 (mem:DI (match_operand:SI 1 "register_operand" "r,r")))
10007 (clobber (match_scratch:DI 2 "=X,f"))]
10008 "!TARGET_64BIT && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT"
10010 {fldds|fldd} 0(%1),%0
10011 {fldds|fldd} 0(%1),%2\n\t{fstds|fstd} %2,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0\n\t{ldws|ldw} -12(%%sp),%R0"
10012 [(set_attr "type" "move,move")
10013 (set_attr "length" "4,16")])
10015 ;; Implement atomic DImode store.
10017 (define_expand "atomic_storedi"
10018 [(match_operand:DI 0 "memory_operand") ;; memory
10019 (match_operand:DI 1 "register_operand") ;; val out
10020 (match_operand:SI 2 "const_int_operand")] ;; model
10023 enum memmodel model;
10025 if (TARGET_SYNC_LIBCALL)
10027 rtx mem = operands[0];
10028 rtx val = operands[1];
10029 if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val))
10033 if (TARGET_64BIT || TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT)
10036 model = memmodel_from_int (INTVAL (operands[2]));
10037 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
10038 expand_mem_thread_fence (model);
10039 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
10040 if (is_mm_seq_cst (model))
10041 expand_mem_thread_fence (model);
10045 (define_insn "atomic_storedi_1"
10046 [(set (mem:DI (match_operand:SI 0 "register_operand" "r,r"))
10047 (match_operand:DI 1 "register_operand" "f,r"))
10048 (clobber (match_scratch:DI 2 "=X,f"))]
10049 "!TARGET_64BIT && !TARGET_DISABLE_FPREGS
10050 && !TARGET_SOFT_FLOAT && !TARGET_SYNC_LIBCALL"
10052 {fstds|fstd} %1,0(%0)
10053 {stws|stw} %1,-16(%%sp)\n\t{stws|stw} %R1,-12(%%sp)\n\t{fldds|fldd} -16(%%sp),%2\n\t{fstds|fstd} %2,0(%0)"
10054 [(set_attr "type" "move,move")
10055 (set_attr "length" "4,16")])
10057 ;; Implement atomic DFmode load using 64-bit floating point load.
10059 (define_expand "atomic_loaddf"
10060 [(match_operand:DF 0 "register_operand") ;; val out
10061 (match_operand:DF 1 "memory_operand") ;; memory
10062 (match_operand:SI 2 "const_int_operand")] ;; model
10065 enum memmodel model;
10067 if (TARGET_64BIT || TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT)
10070 model = memmodel_from_int (INTVAL (operands[2]));
10071 operands[1] = force_reg (SImode, XEXP (operands[1], 0));
10072 expand_mem_thread_fence (model);
10073 emit_insn (gen_atomic_loaddf_1 (operands[0], operands[1]));
10074 if (is_mm_seq_cst (model))
10075 expand_mem_thread_fence (model);
10079 (define_insn "atomic_loaddf_1"
10080 [(set (match_operand:DF 0 "register_operand" "=f,r")
10081 (mem:DF (match_operand:SI 1 "register_operand" "r,r")))
10082 (clobber (match_scratch:DF 2 "=X,f"))]
10083 "!TARGET_64BIT && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT"
10085 {fldds|fldd} 0(%1),%0
10086 {fldds|fldd} 0(%1),%2\n\t{fstds|fstd} %2,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0\n\t{ldws|ldw} -12(%%sp),%R0"
10087 [(set_attr "type" "move,move")
10088 (set_attr "length" "4,16")])
10090 ;; Implement atomic DFmode store using 64-bit floating point store.
10092 (define_expand "atomic_storedf"
10093 [(match_operand:DF 0 "memory_operand") ;; memory
10094 (match_operand:DF 1 "register_operand") ;; val out
10095 (match_operand:SI 2 "const_int_operand")] ;; model
10098 enum memmodel model;
10100 if (TARGET_SYNC_LIBCALL)
10102 rtx mem = operands[0];
10103 rtx val = operands[1];
10104 if (pa_maybe_emit_compare_and_swap_exchange_loop (NULL_RTX, mem, val))
10108 if (TARGET_64BIT || TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT)
10111 model = memmodel_from_int (INTVAL (operands[2]));
10112 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
10113 expand_mem_thread_fence (model);
10114 emit_insn (gen_atomic_storedf_1 (operands[0], operands[1]));
10115 if (is_mm_seq_cst (model))
10116 expand_mem_thread_fence (model);
10120 (define_insn "atomic_storedf_1"
10121 [(set (mem:DF (match_operand:SI 0 "register_operand" "r,r"))
10122 (match_operand:DF 1 "register_operand" "f,r"))
10123 (clobber (match_scratch:DF 2 "=X,f"))]
10124 "!TARGET_64BIT && !TARGET_DISABLE_FPREGS
10125 && !TARGET_SOFT_FLOAT && !TARGET_SYNC_LIBCALL"
10127 {fstds|fstd} %1,0(%0)
10128 {stws|stw} %1,-16(%%sp)\n\t{stws|stw} %R1,-12(%%sp)\n\t{fldds|fldd} -16(%%sp),%2\n\t{fstds|fstd} %2,0(%0)"
10129 [(set_attr "type" "move,move")
10130 (set_attr "length" "4,16")])